WoW:API PlaySoundFile: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{wowapi}} | {{wowapi}} | ||
PlaySoundFile(SoundFile); | PlaySoundFile(SoundFile); | ||
Play the specified sound file. The file will be played once. Unlike [[API PlayMusic|PlayMusic]], you cannot stop the file fron playing once it starts. | Play the specified sound file. The file will be played once. Unlike [[API PlayMusic|PlayMusic]], you cannot stop the file fron playing once it starts. | ||
Line 20: | Line 15: | ||
---- | ---- | ||
;''Example: Playing a sound file from within an AddOn's directory'' | ;''Example: Playing a sound file from within an AddOn's directory'' | ||
PlaySoundFile("Interface\\AddOns\\MyAddOn\\mysound.wav"); | PlaySoundFile("Interface\\AddOns\\MyAddOn\\mysound.wav"); | ||
Line 31: | Line 24: | ||
---- | ---- | ||
;''Details'' | ;''Details'' | ||
This has been successfully tested for playing sounds inside your AddOn's directory, so you don't have to worry about putting your sound files outside your AddOn directory. | This has been successfully tested for playing sounds inside your AddOn's directory, so you don't have to worry about putting your sound files outside your AddOn directory. |
Revision as of 08:40, 2 June 2007
← WoW API < PlaySoundFile
PlaySoundFile(SoundFile);
Play the specified sound file. The file will be played once. Unlike PlayMusic, you cannot stop the file fron playing once it starts.
- Arguments
- (SoundFile)
- SoundFile
- String - The path and name of the sound file you'd like to play. This has been successfully tested with .wav and .mp3 files. Note that the path is relative to the World of Warcraft installation directory.
- Example: Playing a sound file from within an AddOn's directory
PlaySoundFile("Interface\\AddOns\\MyAddOn\\mysound.wav");
or
PlaySoundFile("Interface\\AddOns\\MyAddOn\\mysound.mp3");
- Details
This has been successfully tested for playing sounds inside your AddOn's directory, so you don't have to worry about putting your sound files outside your AddOn directory.
However - it does appear that the sound file must be present in the AddOn directory BEFORE loading the game. A /console reloadui will not refresh the sound files.
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.