scale in mixing to prevent excessive gain
This commit is contained in:
parent
2de536210b
commit
40aef0a1f9
@ -366,9 +366,11 @@ static void audio_mixin_streams(const AudioChannel *channel,
|
|||||||
for (size_t s = 0; s < frames; ++s) {
|
for (size_t s = 0; s < frames; ++s) {
|
||||||
/* left channel */
|
/* left channel */
|
||||||
sa[s * 2 + 0] += (float)(sb[s * 2 + 0] * channel->volume * left_panning);
|
sa[s * 2 + 0] += (float)(sb[s * 2 + 0] * channel->volume * left_panning);
|
||||||
|
sa[s * 2 + 0] *= 1 / (float)M_2_SQRTPI;
|
||||||
|
|
||||||
/* right channel */
|
/* right channel */
|
||||||
sa[s * 2 + 1] += (float)(sb[s * 2 + 1] * channel->volume * right_panning);
|
sa[s * 2 + 1] += (float)(sb[s * 2 + 1] * channel->volume * right_panning);
|
||||||
|
sa[s * 2 + 1] *= 1 / (float)M_2_SQRTPI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user