Fix weird buzzing in the software mixer

Not really sure why this causes it, but apparently it does.
This commit is contained in:
Clownacy 2020-04-05 18:14:26 +01:00
parent 0aa65f7cd3
commit bcd883e767

View file

@ -159,7 +159,7 @@ ATTR_HOT void Mixer_MixSounds(float *stream, unsigned int frames_total)
const float sample2 = (sound->samples[(size_t)sound->position + 1] - 128.0f) / 128.0f; const float sample2 = (sound->samples[(size_t)sound->position + 1] - 128.0f) / 128.0f;
// Perform linear interpolation // Perform linear interpolation
const float interpolated_sample = sample1 + ((sample2 - sample1) * fmod((float)sound->position, 1.0f)); const float interpolated_sample = sample1 + ((sample2 - sample1) * fmod(sound->position, 1.0));
*steam_pointer++ += interpolated_sample * sound->volume_l; *steam_pointer++ += interpolated_sample * sound->volume_l;
*steam_pointer++ += interpolated_sample * sound->volume_r; *steam_pointer++ += interpolated_sample * sound->volume_r;