I have a easy and specific question.
Let's say that in my game I use singleton for playing/pausing/changing volume of specific sounds (SimpleAudioEngine in cocos2d-x).
What is the best way to handle mute button, which is displayed in the upper corner of the screen? Should I just volume everything down and do not care about checking the state of this setting before playing any kind of sound?
1) This is called when an object is destroyed
if (!UserDefault::getInstance()->getBoolForKey(MUTED, false))
{
SimpleAudioEngine::getInstance()->playEffect("shouting.ogg", /* other arguments */)
}
I think that not playing a sound at all is bad practise (if muted is on - like in the above example), because when the user changes this setting while eg. his hero is getting shot, nothing will be played - even if it supposed to take 5 seconds and the option was changed after 2,5 seconds.
But if I only volume everything down - then the rest of the shout will be heard.