WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   PTR UI Bugs (https://www.wowinterface.com/forums/forumdisplay.php?f=176)
-   -   PlaySound() (https://www.wowinterface.com/forums/showthread.php?t=55576)

liquidbase 07-17-17 07:49 AM

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

liquidbase 07-17-17 08:07 AM

Nevertheless I have found the issue. Blizzard has renamed the sound file from
Code:

igBackPackClose
to
Code:

SOUNDKIT.IG_BACKPACK_CLOSE
Works now correctly.

Kanegasi 07-17-17 09:54 AM

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.

Seerah 07-17-17 11:33 AM

http://www.wowinterface.com/forums/s...ad.php?t=55536

Jarod24 07-17-17 12:20 PM

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.

Fizzlemizz 07-17-17 12:24 PM

There is PlaySoundFile() to play a file.

Kanegasi 07-17-17 03:14 PM

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.

liquidbase 07-17-17 11:04 PM

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.


All times are GMT -6. The time now is 10:52 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI