m (→Patch changes: 7.0.3) Tag: WoW API docs |
mNo edit summary Tag: WoW API docs |
||
Line 4: | Line 4: | ||
==Arguments== |
==Arguments== |
||
− | ;soundKitID : number - All sounds used by Blizzard's UI are defined in the [https://github.com/Gethe/wow-ui-source/blob/live/SharedXML/SoundKitConstants.lua SOUNDKIT] table. |
+ | ;soundKitID : {{api|t=t|number}} - All sounds used by Blizzard's UI are defined in the [https://github.com/Gethe/wow-ui-source/blob/live/SharedXML/SoundKitConstants.lua SOUNDKIT] table. |
− | ;channel : string |
+ | ;channel : {{api|t=t?|string}} - The sound volume slider setting the sound should use, one of: <code>Master</code>, <code>SFX</code>, <code>Music</code>, <code>Ambience</code>, <code>Dialog</code>. Individual channels (except "Master") have user-configurable volume settings and may be muted, preventing playback. Defaults to <code>SFX</code> (Sound) if not specified. |
− | ;forceNoDuplicate : boolean |
+ | ;forceNoDuplicate : {{api|t=t?|boolean}} - Allow duplicate sounds if false. Defaults to true. |
− | ;runFinishCallback : boolean |
+ | ;runFinishCallback : {{api|t=t?|boolean}} - Fires {{api|t=e|SOUNDKIT_FINISHED}} when sound is done, arg1 will be soundHandle given below. Defaults to false. |
[[Image:API_PlaySoundFile_channels.png|thumb|Sound channels]] |
[[Image:API_PlaySoundFile_channels.png|thumb|Sound channels]] |
||
== Returns == |
== Returns == |
||
− | ; willPlay : boolean - true if the sound will be played, nil otherwise (prevented by a muted sound channel, for instance). |
+ | ; willPlay : {{api|t=t|boolean}} - true if the sound will be played, nil otherwise (prevented by a muted sound channel, for instance). |
− | ; soundHandle : number - identifier for the queued playback. |
+ | ; soundHandle : {{api|t=t|number}} - identifier for the queued playback. |
==Example== |
==Example== |
Revision as of 00:18, 5 June 2020
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Play one of a set of built-in sounds. Other players will not hear the sound.
willPlay, soundHandle = PlaySound(soundKitID [, channel, forceNoDuplicates, runFinishCallback])
Arguments
- soundKitID
- number - All sounds used by Blizzard's UI are defined in the SOUNDKIT table.
- channel
- string? - The sound volume slider setting the sound should use, one of:
Master
,SFX
,Music
,Ambience
,Dialog
. Individual channels (except "Master") have user-configurable volume settings and may be muted, preventing playback. Defaults toSFX
(Sound) if not specified. - forceNoDuplicate
- boolean? - Allow duplicate sounds if false. Defaults to true.
- runFinishCallback
- boolean? - Fires SOUNDKIT_FINISHED when sound is done, arg1 will be soundHandle given below. Defaults to false.
Returns
- willPlay
- boolean - true if the sound will be played, nil otherwise (prevented by a muted sound channel, for instance).
- soundHandle
- number - identifier for the queued playback.
Example
Plays the ready check sound file (sound/interface/levelup2.ogg)
PlaySound(SOUNDKIT.READY_CHECK) -- by SOUNDKIT key PlaySound(8960) -- by SoundKitID
PlaySoundFile(567478) -- by FileDataID
Finding Sound IDs
File Data IDs
- By file name/path, e.g. Spells/LevelUp,type:ogg in wow.tools
- By SoundKitID, e.g. skit:888 in wow.tools
- By sound kit name with https://wow.tools/files/sounds.php
Sound Kit Names/IDs
- From the sounds tab for an NPC, for example https://www.wowhead.com/npc=154304/waveblade-shaman#sounds
- By sound kit name with https://www.wowhead.com/sounds and SoundKitName.db2
- IDs used by the FrameXML are defined in the SOUNDKIT table
- The full list of IDs can be found in SoundKitEntry.db2
Patch history
- Patch 7.3.0 (2017-08-29): Changed. String-based input is not allowed. SoundKitID should be given while calling PlaySound(). This change is more like a replacement for PlaySoundKitID.
- Patch 7.0.3 (2016-07-19): Added fourth argument,
runFinishCallback
. - Patch 5.0.4 (2012-08-28): Added
willPlay
andsoundHandle
return values. - Patch 1.1.0 (2004-11-07): Added.
See also
- PlaySoundFile - Accepts FileDataIDs and addon file paths.
- StopSound