Fix MixAdd with volume. The previous volume formula completely failed with volumes >= 1.0 (0x8000). Fixes Tomb Raider Legends (GC) music.

This commit is contained in:
Pierre Bourdon 2012-12-18 07:01:22 +01:00
parent faaaa97c9e
commit 1cecbaedce
1 changed files with 5 additions and 2 deletions

View File

@ -337,8 +337,11 @@ void MixAdd(int* out, const s16* input, u16* pvol, bool ramp)
for (u32 i = 0; i < 32; ++i)
{
s64 sample = 2 * (s16)input[i] * (s16)volume;
out[i] += (s32)(sample >> 16);
s64 sample = input[i];
sample *= volume;
sample >>= 15;
out[i] += (s32)sample;
volume += volume_delta;
}
}