Quantcast PlaySound() - WoWInterface
Thread Tools Display Modes
07-17-17, 07:49 AM   #1
liquidbase
A Black Drake
 
liquidbase's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 82
PlaySound()

Hi there!

At the moment I work on the current version of DuffedUI to make it ready for 7.3.
I had a weird problem with PlaySound(). The line in my code ist correctly written and worked well on Live-Server but on PTR I get the following error-message:
Code:
1x DuffedUI\modules\loot\bags.lua:691: Usage: PlaySound(soundKitID, optional["SFX","Music","Ambience", "Dialog" or "Master"], [forceNoDuplicates, runFinishCallback])
[C]: in function `PlaySound'
DuffedUI\modules\loot\bags.lua:691: in function `CloseAllBags'
DuffedUI\modules\loot\bags.lua:711: in function `ToggleBags'
DuffedUI\modules\loot\bags.lua:785: in function `ToggleAllBags'
DuffedUI\modules\loot\bags.lua:794: in function `Enable'
DuffedUI\modules\loot\bags.lua:800: in function <DuffedUI\modules\loot\bags.lua:799>

Locals:
(*temporary) = "igBackPackClose"
The line in my bag-code looks like this one:
Lua Code:
  1. function Bags:CloseAllBags()
  2.     if MerchantFrame:IsVisible() or InboxFrame:IsVisible() then return end
  3.     CloseAllBags()
  4.     PlaySound("igBackPackClose")
  5. end

Soundfile is correct and the channel is not necessary because it is missing the client uses the master-channel. Anyone have the same issue or an idea how I can fix this?

greetz liquid
  Reply With Quote
07-17-17, 08:07 AM   #2
liquidbase
A Black Drake
 
liquidbase's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 82
Nevertheless I have found the issue. Blizzard has renamed the sound file from
Code:
igBackPackClose
to
Code:
SOUNDKIT.IG_BACKPACK_CLOSE
Works now correctly.
  Reply With Quote
07-17-17, 09:54 AM   #3
Kanegasi
A Rage Talon Dragon Guard
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 337
I'm glad you fixed it, but that's not exactly the issue. They didn't rename the file, PlaySound() only accepts numbers in 7.3. What you found was the SOUNDKIT table that has keys named exactly like the old sounds. The values of those keys are the sound IDs. Basically, PlaySound is now PlaySoundKitID. You can find any sound ID by searching for the sound on Wowhead and using the number in the page's address bar.
  Reply With Quote
07-17-17, 11:33 AM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,600
http://www.wowinterface.com/forums/s...ad.php?t=55536
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-17-17, 12:20 PM   #5
Jarod24
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 66
Is there's anyone that could maybe elaborate for me how/why this new SOUNDKIT approach is better?

I don't quite see the logic in why Blizzard would change PlaySound() from accepting an input string (i.e a filepath) into taking a numbered id instead.

How much more costly (time, cpu, memory) is it to support an occasional lookup of a new string (I presume they implemented a cached table of most used paths for faster re-lookup) compared to pre-enumerating ALL sounds in the game into a LUA table and having to maintain such a table.


Edit: Seems I got PlaySound() and PlaySoundFile() mixed up. It all makes sense now.
__________________
Author of IfThen, Links in Chat

Last edited by Jarod24 : 07-17-17 at 03:48 PM.
  Reply With Quote
07-17-17, 12:24 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,109
There is PlaySoundFile() to play a file.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
07-17-17, 03:14 PM   #7
Kanegasi
A Rage Talon Dragon Guard
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 337
Actually, the way WoW's C implementation works, functions dealing with any game files have always used IDs. The files themselves are available directly through ID, the path was simply part of user code. It took them a few years, but they're finally getting rid of the overhead needed to convert strings into the internal ID, just like they did with textures. Also, PlaySound never accepted file paths afaik, and I'm pretty sure it was never able to play every sound due to a limited internal list of sound names.
  Reply With Quote
07-17-17, 11:04 PM   #8
liquidbase
A Black Drake
 
liquidbase's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 82
Thanks for the exact explanation. Since I will have missed the change simply. Since I will but then the days change all uses of PlaySound() accordingly to their IDs, probably would be also better and avoid future errors.

@Seerah
Thanks for the link. I had not found anything else in the first moment.
  Reply With Quote

WoWInterface » PTR » PTR UI Bugs » PlaySound()

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off