mastervol = ch->master_vol;
- // always apply "master"
- mastervol *= mastervolume.value;
-
- // If this channel does not manage its own volume (like CD tracks)
- if (!(ch->flags & CHANNELFLAG_FULLVOLUME))
- mastervol *= volume.value;
-
// Adjust volume of static sounds
if (isstatic)
mastervol *= snd_staticvolume.value;
}
}
+ // If this channel does not manage its own volume (like CD tracks)
+ if (!(ch->flags & CHANNELFLAG_FULLVOLUME))
+ mastervol *= volume.value;
+
+ // clamp HERE to allow to go at most 10dB past mastervolume (before clamping), when mastervolume < -10dB (so relative volumes don't get too messy)
+ mastervol = bound(0, mastervol, 655360);
+
+ // always apply "master"
+ mastervol *= mastervolume.value;
+
// clamp HERE to keep relative volumes of the channels correct
mastervol = bound(0, mastervol, 65536);