Thread Tools Display Modes
04/13/15, 05:32 PM   #1
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Remove enlightened sound

Hey there,

I just tried to remove this annoying enlightened sound that plays at the startup of the game, if you login.
I can remove it for later calls if you do not logout again.

But the initial playing of the sound cannot be removed as it seems that the call will be done in local functions inside file ingame\centerannounce\centerannouncehandlers.lua:

Lua Code:
  1. local function GetEnlightenedGainedAnnouncement()
  2.     local barParams = GetCurrentVeteranPointsBarParams()
  3.     return CSA_EVENT_COMBINED_TEXT, SOUNDS.ENLIGHTENED_STATE_GAINED, GetString(SI_ENLIGHTENED_STATE_GAINED_HEADER), GetString(SI_ENLIGHTENED_STATE_GAINED_DESCRIPTION), nil, nil, nil, barParams
  4. end
  5.  
  6. CSH[EVENT_ENLIGHTENED_STATE_GAINED] = function()
  7.     if IsEnlightenedAvailableForCharacter() then
  8.         return GetEnlightenedGainedAnnouncement()
  9.     end
  10. end
  11.  
  12. local firstActivation = true
  13. CSH[EVENT_PLAYER_ACTIVATED] = function()
  14.     if firstActivation then
  15.         firstActivation = false
  16.  
  17.         if IsEnlightenedAvailableForCharacter() and GetEnlightenedPool() > 0 then
  18.             return GetEnlightenedGainedAnnouncement()
  19.         end
  20.     end
  21. end

Look at the "CSH[EVENT_PLAYER_ACTIVATED] = function()":
At the "first" player activated (which will be the one without any addons I guess, or the very firsta ddon that loads?) the sound will be played by using the local function GetEnlightenedGainedAnnouncement() :-(

As far as I know I cannot priorize my addon to be the first somehow so I can prevent this EVENT_PLAYER_ACTIVATED from being executed?

Any other ideas how to get there to stop this annoying sound from playing? It is really loud even if I turn down the game's sound. All other SFX is ok but this one sux!
And as explained above my addon's player activated or addon loaded will always be AFTER this local call to the sound palying announcement...

Thanks for any good news and help.
  Reply With Quote
04/13/15, 05:49 PM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
EVENT_PLAYER_ACTIVATED is fired when all addons are already loaded, so disabling this handler is a simple task. I'm already doing it in No, thank you!.

This is the easy way (disable CSA EVENT_PLAYER_ACTIVATED handler):

Lua Code:
  1. ZO_PreHook(ZO_CenterScreenAnnounce_GetHandlers(), EVENT_PLAYER_ACTIVATED, function() return true end)

A bit harder way would be just disabling sound and leave message untouched:
Lua Code:
  1. local AddMessage_Orig
  2.  
  3. local function AddMessage_Hook(self, eventId, category, soundId, ...)
  4.     if (eventId == EVENT_PLAYER_ACTIVATED and soundId == SOUNDS.ENLIGHTENED_STATE_GAINED) then
  5.         soundId = nil
  6.     end
  7.     AddMessage_Orig(self, eventId, category, soundId, ...)
  8. end
  9.  
  10. AddMessage_Orig = CENTER_SCREEN_ANNOUNCE.AddMessage
  11. CENTER_SCREEN_ANNOUNCE.AddMessage = AddMessage_Hook

EDIT:
If you want to disable that sound everywhere, you can also redefine it in SOUNDS table:
Lua Code:
  1. SOUNDS.ENLIGHTENED_STATE_GAINED = "No_Sound"

Or you can hook PlaySound function (if hook returns true, original function isn't called):
Lua Code:
  1. local function PlaySound_Hook(soundId)
  2.     return soundId == SOUNDS.ENLIGHTENED_STATE_GAINED
  3. end
  4. ZO_PreHook("PlaySound", PlaySound_Hook)

And I think you can find even more ways how to do it.

Last edited by Garkin : 04/13/15 at 05:58 PM.
  Reply With Quote
04/13/15, 05:51 PM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
I'd like to use the harder way so the experience bar and everything else is still shown.
Thank you for the solution Garkin. I'll try them now.

EDIT:
It works just fine! Thanks for helping me with this disturbing sound.
I had tested the first solution already but with the wrong function as it seems.
I had tried to PreHook the function ZO_CenterScreenAnnounce_GetHandler("EVENT_PLAYER_ACTIVATED") and got some error messages.

Last edited by Baertram : 04/13/15 at 05:57 PM.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Remove enlightened sound


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