scale in mixing to prevent excessive gain

This commit is contained in:
veclavtalica 2025-01-15 21:31:19 +03:00
parent 2de536210b
commit 40aef0a1f9

View File

@ -366,9 +366,11 @@ static void audio_mixin_streams(const AudioChannel *channel,
for (size_t s = 0; s < frames; ++s) {
/* left channel */
sa[s * 2 + 0] += (float)(sb[s * 2 + 0] * channel->volume * left_panning);
sa[s * 2 + 0] *= 1 / (float)M_2_SQRTPI;
/* right channel */
sa[s * 2 + 1] += (float)(sb[s * 2 + 1] * channel->volume * right_panning);
sa[s * 2 + 1] *= 1 / (float)M_2_SQRTPI;
}
}