No edit summary |
No edit summary Tag: WoW API docs |
||
(25 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
− | {{wowapi}} |
+ | {{wowapi}} |
Play one of a set of built-in sounds. Other players will not hear the sound. |
Play one of a set of built-in sounds. Other players will not hear the sound. |
||
− | willPlay, soundHandle = PlaySound( |
+ | willPlay, soundHandle = PlaySound(soundKitID [, channel, forceNoDuplicates, runFinishCallback]) |
==Arguments== |
==Arguments== |
||
+ | ;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. |
||
− | ;SoundName : String - One of the below sound names (not all these actually make a sound) |
||
+ | ;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> if not specified. There is also a <code>"Talking Head"</code> channel.<ref>https://github.com/Gethe/wow-ui-source/blob/9.0.5/AddOns/Blizzard_TalkingHeadUI/Blizzard_TalkingHeadUI.lua#L199</ref> |
||
− | <div style="border: 2px solid #404040; overflow-y: auto; height: 14em; margin-left: 2.5em; padding: 0.2em"><div style="margin-left: -1.5em;"> |
||
+ | ;forceNoDuplicate : {{api|t=t?|boolean}} - Allow duplicate sounds if false. Defaults to true. |
||
− | : PVPENTERQUEUE - Sound for entering BG queue and when it refreshes periodicly |
||
+ | ;runFinishCallback : {{api|t=t?|boolean}} - Fires {{api|t=e|SOUNDKIT_FINISHED}} when sound is done, arg1 will be soundHandle given below. Defaults to false. |
||
− | : PVPTHROUGHQUEUE - You are eligible to enter the battleground! |
||
+ | |||
− | : GLUESCREENSMALLBUTTONMOUSEDOWN |
||
+ | [[Image:API_PlaySoundFile_channels.png|thumb|Sound channels]] |
||
− | : GLUESCREENSMALLBUTTONMOUSEUP |
||
− | : GLUESCREENSMALLBUTTONMOUSEOVER |
||
− | : GLUESCREENMEDIUMBUTTONMOUSEDOWN |
||
− | : GLUESCREENMEDIUMBUTTONMOUSEUP |
||
− | : GLUESCREENMEDIUMBUTTONMOUSEOVER |
||
− | : GLUESCREENLARGEBUTTONMOUSEDOWN |
||
− | : GLUESCREENLARGEBUTTONMOUSEUP |
||
− | : GLUESCREENLARGEBUTTONMOUSEOVER |
||
− | : GLUESCREENEDITBOXKEYCLICK |
||
− | : GLUECHECKBOXMOUSEDOWN |
||
− | : GLUECHECKBOXMOUSEUP |
||
− | : GLUECHECKBOXMOUSEOVER |
||
− | : GLUECHARCUSTOMIZATIONMOUSEDOWN |
||
− | : GLUECHARCUSTOMIZATIONMOUSEUP |
||
− | : GLUECHARCUSTOMIZATIONMOUSEOVER |
||
− | : GLUESCROLLBUTTONMOUSEDOWN |
||
− | : GLUESCROLLBUTTONMOUSEUP |
||
− | : GLUESCROLLBUTTONMOUSEOVER |
||
− | : GAMEABILITYBUTTONMOUSEDOWN |
||
− | : GAMESPELLBUTTONMOUSEDOWN |
||
− | : GAMEWINDOWOPEN |
||
− | : GAMEWINDOWCLOSE |
||
− | : GAMEDIALOGOPEN |
||
− | : GAMEDIALOGCLOSE |
||
− | : GAMENEWWINDOWTAB |
||
− | : GAMESCREENSMALLBUTTONMOUSEDOWN |
||
− | : GAMESCREENSMALLBUTTONMOUSEUP |
||
− | : GAMESCREENSMALLBUTTONMOUSEOVER |
||
− | : GAMESCREENMEDIUMBUTTONMOUSEDOWN |
||
− | : GAMESCREENMEDIUMBUTTONMOUSEUP |
||
− | : GAMESCREENMEDIUMBUTTONMOUSEOVER |
||
− | : GAMESCREENLARGEBUTTONMOUSEDOWN |
||
− | : GAMESCREENLARGEBUTTONMOUSEUP |
||
− | : GAMESCREENLARGEBUTTONMOUSEOVER |
||
− | : GAMETARGETFRIENDLYUNIT |
||
− | : GAMETARGETHOSTILEUNIT |
||
− | : GAMETARGETNEUTRALUNIT |
||
− | : GAMEHIGHLIGHTFRIENDLYUNIT |
||
− | : GAMEHIGHLIGHTHOSTILEUNIT |
||
− | : GAMEHIGHLIGHTNEUTRALUNIT |
||
− | : GAMEINITIALATTACK |
||
− | : GAMEERROROUTOFRANGE |
||
− | : GAMEERROROUTOFMANA |
||
− | : GAMEERRORUNABLETOEQUIP |
||
− | : GAMEERRORINVALIDTARGET |
||
− | : ACTIONBARBUTTONDOWN |
||
− | : MAINBUTTONBARMENU |
||
− | : MINIMAPZOOMOUT |
||
− | : MINIMAPZOOMIN |
||
− | : MINIMAPOPEN |
||
− | : MINIMAPCLOSE |
||
− | : BAGMENUBUTTONPRESS |
||
− | : LOOTWINDOWOPEN |
||
− | : LOOTWINDOWCLOSE |
||
− | : LOOTWINDOWCOINSOUND |
||
− | : ITEMWEAPONSOUND |
||
− | : ITEMARMORSOUND |
||
− | : ITEMGENERICSOUND |
||
− | : LEVELUPSOUND |
||
− | : GLUECREATECHARACTERBUTTON |
||
− | : GLUEENTERWORLDBUTTON |
||
− | : SPELLBOOKOPEN |
||
− | : SPELLBOOKCLOSE |
||
− | : SPELLBOOKCHANGEPAGE |
||
− | : PAPERDOLLOPEN |
||
− | : PAPERDOLLCLOSE |
||
− | : QUESTADDED |
||
− | : QUESTCOMPLETED |
||
− | : QUESTLOGOPEN |
||
− | : QUESTLOGCLOSE |
||
− | : GLUEGENERICBUTTONPRESS |
||
− | : GAMEGENERICBUTTONPRESS |
||
− | : INTERFACESOUND_MONEYFRAMEOPEN |
||
− | : INTERFACESOUND_MONEYFRAMECLOSE |
||
− | : INTERFACESOUND_CHARWINDOWOPEN |
||
− | : INTERFACESOUND_CHARWINDOWCLOSE |
||
− | : INTERFACESOUND_CHARWINDOWTAB |
||
− | : INTERFACESOUND_GAMEMENUOPEN |
||
− | : INTERFACESOUND_GAMEMENUCLOSE |
||
− | : INTERFACESOUND_LOSTTARGETUNIT |
||
− | : INTERFACESOUND_BACKPACKOPEN |
||
− | : INTERFACESOUND_BACKPACKCLOSE |
||
− | : INTERFACESOUND_GAMESCROLLBUTTON |
||
− | : INTERFACESOUND_CURSORGRABOBJECT |
||
− | : INTERFACESOUND_CURSORDROPOBJECT |
||
− | : SHEATHINGSHIELDSHEATHE |
||
− | : SHEATHINGWOODWEAPONSHEATHE |
||
− | : SHEATHINGMETALWEAPONSHEATHE |
||
− | : SHEATHINGWOODWEAPONUNSHEATHE |
||
− | : SHEATHINGMETALWEAPONUNSHEATHE |
||
− | : SHEATHINGSHIELDUNSHEATHE |
||
− | : igCreatureAggroDeselect |
||
− | : igQuestListOpen |
||
− | : igQuestListClose |
||
− | : igQuestListSelect |
||
− | : igQuestListComplete |
||
− | : igQuestCancel |
||
− | : igPlayerInvite |
||
− | : igPlayerInviteAccept |
||
− | : igPlayerInviteDecline |
||
− | : GAMEERRORUNABLETOEQUIP |
||
− | : ITEMGENERICSOUND |
||
− | : GAMEERRORINVALIDTARGET |
||
− | : LEVELUP |
||
− | : GAMEERROROUTOFRANGE |
||
− | : QUESTADDED |
||
− | : MONEYFRAMEOPEN |
||
− | : MONEYFRAMECLOSE |
||
− | : LOOTWINDOWOPEN |
||
− | : LOOTWINDOWCLOSE |
||
− | : LOOTWINDOWCOINSOUND |
||
− | : GAMEHIGHLIGHTHOSTILEUNIT |
||
− | : GAMEHIGHLIGHTNEUTRALUNIT |
||
− | : GAMEHIGHLIGHTFRIENDLYUNIT |
||
− | : INTERFACESOUND_LOSTTARGETUNIT |
||
− | : INTERFACESOUND_CURSORGRABOBJECT |
||
− | : INTERFACESOUND_CURSORDROPOBJECT |
||
− | : GAMESCREENMEDIUMBUTTONMOUSEDOWN |
||
− | : GAMEABILITYACTIVATE |
||
− | : GAMESPELLACTIVATE |
||
− | : gsTitleEnterWorld |
||
− | : gsTitleOptions |
||
− | : gsTitleQuit |
||
− | : gsTitleCredits |
||
− | : gsTitleIntroMovie |
||
− | : gsTitleOptionScreenResolution |
||
− | : gsTitleOption16bit |
||
− | : gsTitleOption32bit |
||
− | : gsTitleOptionOpenGL |
||
− | : gsTitleOptionDirect3D |
||
− | : gsTitleOptionFullScreenMode |
||
− | : gsTitleOptionOK |
||
− | : gsTitleOptionExit |
||
− | : gsLogin |
||
− | : gsLoginNewAccount |
||
− | : gsLoginChangeRealm |
||
− | : gsLoginExit |
||
− | : gsLoginChangeRealmOK |
||
− | : gsLoginChangeRealmSelect |
||
− | : gsLoginChangeRealmCancel |
||
− | : gsCharacterSelection |
||
− | : gsCharacterSelectionEnterWorld |
||
− | : gsCharacterSelectionDelCharacter |
||
− | : gsCharacterSelectionAcctOptions |
||
− | : gsCharacterSelectionExit |
||
− | : gsCharacterSelectionCreateNew |
||
− | : gsCharacterCreationClass |
||
− | : gsCharacterCreationRace |
||
− | : gsCharacterCreationGender |
||
− | : gsCharacterCreationLook |
||
− | : gsCharacterCreationCreateChar |
||
− | : gsCharacterCreationCancel |
||
− | : igCurrentActiveSpell |
||
− | : igMiniMapOpen |
||
− | : igMiniMapClose |
||
− | : igMiniMapZoomIn |
||
− | : igMiniMapZoomOut |
||
− | : igChatEmoteButton |
||
− | : igChatScrollUp |
||
− | : igChatScrollDown |
||
− | : igChatBottom |
||
− | : igSpellBookOpen |
||
− | : igSpellBookClose |
||
− | : igSpellBokPageTur n |
||
− | : igSpellBookSpellIconPickup |
||
− | : igSpellBookSpellIconDrop |
||
− | : igAbilityOpen |
||
− | : igAbilityClose |
||
− | : igAbiliityPageTurn |
||
− | : igAbilityIconPickup |
||
− | : igAbilityIconDrop |
||
− | : TalentScreenOpen |
||
− | : TalentScreenClose |
||
− | : igCharacterInfoOpen |
||
− | : igCharacterInfoClose |
||
− | : igCharacterInfoTab |
||
− | : igCharacterInfoScrollUp |
||
− | : igCharacterInfoScrollDown |
||
− | : igQuestLogOpen |
||
− | : igQuestLogClose |
||
− | : igQuestLogAbandonQuest |
||
− | : igQuestFailed |
||
− | : igSocialOepn (sic) |
||
− | : igSocialClose |
||
− | : igMainMenuOpen |
||
− | : igMainMenuClose |
||
− | : igMainMenuOption |
||
− | : igMainMenuLogout |
||
− | : igMainMenuQuit |
||
− | : igMainMenuContinue |
||
− | : igMainMenuOptionCheckBoxOn |
||
− | : igMainMenuOptionCheckBoxOff |
||
− | : igMainMenuOptionFaerTab |
||
− | : igInventoryOepn (sic) |
||
− | : igInventoryClose |
||
− | : igInventoryRotateCharacter |
||
− | : igBackPackOpen |
||
− | : igBackPackClose |
||
− | : igBackPackCoinSelect |
||
− | : igBackPackCoinOK |
||
− | : igBackPackCoinCancel |
||
− | : igCharacterNPCSelect |
||
− | : igCharacterNPCDeselect |
||
− | : igCharacterSelect |
||
− | : igCharacterDeselect |
||
− | : igCreatureNeutralSelect |
||
− | : igCreatureNeutralDeselect |
||
− | : igCreatureAggroSelect |
||
− | : UChatScrollButton |
||
− | : Deathbind Sound |
||
− | : LOOTWINDOWOPENEMPTY |
||
− | : TaxiNodeDiscovered |
||
− | : UnwrapGift |
||
− | : TellMessage |
||
− | : WriteQuest |
||
− | : MapPing |
||
− | : igBonusBarOpen |
||
− | : FriendJoinGame |
||
− | : Fishing Reel in |
||
− | : HumanExploration |
||
− | : OrcExploration |
||
− | : UndeadExploration |
||
− | : TaurenExploration |
||
− | : TrollExploration |
||
− | : NightElfExploration |
||
− | : GnomeExploration |
||
− | : DwarfExploration |
||
− | : igPVPUpdate |
||
− | : ReadyCheck |
||
− | : RaidWarning |
||
− | : AuctionWindowOpen |
||
− | : AuctionWindowClose |
||
− | </div></div> |
||
− | ;channel : String - Either "Master" (this will play the sound also with disabled sounds like before 4.0.1), "SFX", "Ambience", "Music". |
||
== Returns == |
== Returns == |
||
− | ; willPlay : |
+ | ; willPlay : {{api|t=t|boolean}} - true if the sound will be played, nil otherwise (prevented by a muted sound channel, for instance). |
− | ; soundHandle : |
+ | ; soundHandle : {{api|t=t|number}} - identifier for the queued playback. |
==Example== |
==Example== |
||
+ | Plays the ready check sound file (''sound/interface/levelup2.ogg'') |
||
− | PlaySound("LEVELUPSOUND", "master"); |
||
+ | PlaySound(SOUNDKIT.READY_CHECK) -- by SOUNDKIT key |
||
+ | PlaySound(8960) -- by SoundKitID |
||
+ | |||
+ | {{api|PlaySoundFile}}(567478) -- by FileDataID |
||
+ | |||
+ | ==Finding Sound IDs== |
||
+ | {{:API_PlaySoundFile}} |
||
== Patch history == |
== Patch history == |
||
+ | * {{Patch 7.3.0|note=Changed. String-based input is not allowed. SoundKitID should be given while calling ''PlaySound()''. This change is more like a replacement for {{api|PlaySoundKitID}}.}} |
||
− | {{Patch 5.0.1|note=Added <tt>willPlay</tt> and <tt>soundHandle</tt> return values.}} |
||
+ | * {{Patch 7.0.3|note=Added fourth argument, <code>runFinishCallback</code>.}} |
||
+ | * {{Patch 5.0.4|note=Added <code>willPlay</code> and <code>soundHandle</code> return values.}} |
||
+ | * {{Patch 1.1.0|note=Added.}} |
||
== See also == |
== See also == |
||
+ | * {{api|PlaySoundFile}} - Accepts FileDataIDs and addon file paths. |
||
− | * {{api|PlaySoundKitID}} |
||
* {{api|StopSound}} |
* {{api|StopSound}} |
||
+ | |||
+ | ==External links== |
||
+ | <!-- Please read https://wow.gamepedia.com/Wowpedia:External_links_policy before adding new links. --> |
||
+ | {{Elinks-api}} |
||
+ | |||
+ | ==References== |
Revision as of 19:19, 15 April 2021
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 to"SFX"
if not specified. There is also a"Talking Head"
channel.[1] - 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
External links
- GitHub FrameXML, Gethe
- Globe "wut?" Tool, Townlong-Yak