changeSoundChannelGain method
Increase the gain on the given soundChannel
by value
.
Implementation
void changeSoundChannelGain({
required final SoundChannel soundChannel,
required final double value,
}) {
var gain = soundChannel.gain + value;
if (gain < 0) {
gain = 0.0;
}
if (gain > 1) {
gain = 1;
}
soundChannel.gain = gain;
final sound = world.menuActivateSound;
if (sound != null) {
soundChannel.playSound(sound);
}
if (soundChannel == game.interfaceSounds) {
playerPreferences.interfaceSoundsGain = gain;
} else if (soundChannel == game.musicSounds) {
playerPreferences.musicGain = gain;
} else if (soundChannel == game.ambianceSounds) {
playerPreferences.ambianceGain = gain;
} else {
return;
}
savePlayerPreferences();
}