GrupoW/as3-Sound-Manager — Issue #5: MuteAllSounds
Author: bastman
Created: 2011-10-19 15:24:05+00:00
State: open

please check the each SoundItem has not been muted before saving the current volume as savedVolume.

than I can call the muteAllSounds method as often as I like.

My problem was:
- sound 1 is playing -> muteAllSounds -> fine
-> now sound 2,3 are going to play at volume 1 (but I do not want to hear them, because everything is muted - but I wan volume =1 to be saved)
-> thats why I call: playSound("sound2",1); and muteAllSounds()

using this little patch, evrything works fine ...

/**
* Mutes the volume for all sounds in the sound dictionary.
*
* @return void
*/
public function muteAllSounds():void
{
_areAllMuted = true;

var len:int = _sounds.length;
var id:String;
var si:SoundItem;

for (var i:int = 0;i < len;i++) {
id = (_sounds[i] as SoundItem).name;
si = (_soundsDict[id] as SoundItem);

// changed by seb
if (!si.muted) {
si.savedVolume = si.channel.soundTransform.volume;
}

si.muted = true;

setSoundVolume(id, 0);
}

dispatchEvent(new SoundManagerEvent(SoundManagerEvent.MUTE_ALL));
}