I'm trying to implement separate sound and music turn On/Off buttons. My intention is to implement this globally, so I don't have to check these settings separately all around the code and the ini. What is the best way to do this?
I'm currently inclined to add a handler for orxSOUND_EVENT_START events, and adjust the volume of the sound (multiply by 0 or 1 based on the relevant setting). Is this efficient? Will it still be playing the sound with 0 volume? Will there be any audible glitches? Is there any better way?
Thanks
Comments
At the moment, in Little Cells, I do what you suggested: I turn the sounds/musics volumes down to 0 when muted and back to what they should be when not muted. There shouldn't be any audible glitches (at least we don't have any) and we also use the orxSOUND_EVENT_START for that purpose. When a player switches a toggle, we just go over all the sounds/musics that are currently existing and update their volume accordingly.
We have a couple of additional properties to handle things like unmute-able sounds or to handle more than just sounds vs musics, but those are really details that don't matter.