View Single Post
10-31-17, 06:56 AM   #14
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by MunkDev View Post
If you want to mute all sounds, use this:
Lua Code:
  1. local dummy = false
  2. hooksecurefunc('PlaySound', function(id)
  3.         if dummy then return end
  4.         dummy = true
  5.         local played, handle = PlaySound(id+1)
  6.         if played then
  7.             StopSound(handle-1)
  8.             StopSound(handle)
  9.         end
  10.         dummy = false
  11. end)

If you want to allow unique sounds, like the talking head monologues or any other uncommon sound, but not UI sounds, use this:
Lua Code:
  1. local dummy, kit = false, {}
  2. for _, v in pairs(SOUNDKIT) do kit[v] = true end
  3.  
  4. hooksecurefunc('PlaySound', function(id)
  5.         if dummy or (not kit[id]) then return end
  6.         dummy = true
  7.         local played, handle = PlaySound(id+1)
  8.         if played then
  9.             StopSound(handle-1)
  10.             StopSound(handle)
  11.         end
  12.         dummy = false
  13. end)

If you want to mute specific sounds use Kanegasi's solution. They all work the same way.
The SOUNDKIT table is not nearly as complete as you would like it, mostly they just throw stuff into it that's used by the default UI.

Here is a complete table with old names and IDs that you can play with PlaySound:
https://github.com/Resike/BlizzardIn...ndKitNames.lua
  Reply With Quote