Reverted fmodf stuff and tried to make it so C++ compilers would go for the float version in appropriate circumstances (fmodf directly is unavailable due to not being in C89)
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
parent
d88db09752
commit
88a8362f23
1 changed files with 2 additions and 2 deletions
|
@ -87,7 +87,7 @@ attrHot static void 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) * fmodf(sound->position, 1.0));
|
const float interpolated_sample = sample1 + ((sample2 - sample1) * (float)fmod((float)sound->position, 1.0f));
|
||||||
|
|
||||||
*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;
|
||||||
|
@ -98,7 +98,7 @@ attrHot static void MixSounds(float *stream, unsigned int frames_total)
|
||||||
{
|
{
|
||||||
if (sound->looping)
|
if (sound->looping)
|
||||||
{
|
{
|
||||||
sound->position = fmodf(sound->position, sound->frames);
|
sound->position = fmod(sound->position, sound->frames);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue