WoW:API PlaySoundFile: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
(Custom .WAVs no longer work with PlaySoundFile, added references to .OGG)
Line 4: Line 4:


== Arguments ==
== Arguments ==
;path : String – The path and name of the sound file you'd like to play, relative to the WoW directory; both wav and mp3 formats are accepted. The file must exist prior to logging in to WoW.
;path : String – The path and name of the sound file you'd like to play, relative to the WoW directory; both ogg and mp3 formats are accepted. The file must exist prior to logging in to WoW.


== Examples ==
== Examples ==
You can play a sound file included with your addon:
You can play a sound file included with your addon:
  PlaySoundFile("Interface\\AddOns\\MyAddOn\\mysound.wav")
  PlaySoundFile("Interface\\AddOns\\MyAddOn\\mysound.ogg")
Or one of the ones shipped with WoW ([[Power of the Horde]], in this case):
Or one of the ones shipped with WoW ([[Power of the Horde]], in this case):
  PlaySoundFile("Sound\\Music\\ZoneMusic\\DMF_L70ETC01.mp3")  
  PlaySoundFile("Sound\\Music\\ZoneMusic\\DMF_L70ETC01.mp3")  
Line 15: Line 15:
* There does not appear to be a bad error if the file is missing - it just won't play. There is a return status, which is 1 if the sound was OK and nil if it couldn't be found.
* There does not appear to be a bad error if the file is missing - it just won't play. There is a return status, which is 1 if the sound was OK and nil if it couldn't be found.
* This API call was broken in patch 1.11 and was fixed in patch 1.11.2.
* This API call was broken in patch 1.11 and was fixed in patch 1.11.2.
* As of 4.0.1, custom .wav files are no longer supported.


== See also ==
== See also ==
* [[PlaySoundFile macros]] for a listing of audio files shipped with the game.
* [[PlaySoundFile macros]] for a listing of audio files shipped with the game.

Revision as of 08:39, 19 October 2010

WoW API < PlaySoundFile

Plays the specified audio file once. Unlike PlayMusic, you cannot stop the playback.

PlaySoundFile("path")

Arguments

path
String – The path and name of the sound file you'd like to play, relative to the WoW directory; both ogg and mp3 formats are accepted. The file must exist prior to logging in to WoW.

Examples

You can play a sound file included with your addon:

PlaySoundFile("Interface\\AddOns\\MyAddOn\\mysound.ogg")

Or one of the ones shipped with WoW (Power of the Horde, in this case):

PlaySoundFile("Sound\\Music\\ZoneMusic\\DMF_L70ETC01.mp3") 

Notes

  • There does not appear to be a bad error if the file is missing - it just won't play. There is a return status, which is 1 if the sound was OK and nil if it couldn't be found.
  • This API call was broken in patch 1.11 and was fixed in patch 1.11.2.
  • As of 4.0.1, custom .wav files are no longer supported.

See also