Used fmodf instead of fmod for a 0.5% performance increase in MixSounds
Signed-off-by: Gabriel Ravier <gabrielravier@gabrielAncientIBMv2>
This commit is contained in:
parent
bd876e9309
commit
c15ecbf728
1 changed files with 2 additions and 2 deletions
|
@ -85,7 +85,7 @@ static void MixSounds(float *stream, unsigned int frames_total)
|
|||
const float sample2 = (sound->samples[(size_t)sound->position + 1] - 128.0f) / 128.0f;
|
||||
|
||||
// Perform linear interpolation
|
||||
const float interpolated_sample = sample1 + ((sample2 - sample1) * (float)fmod(sound->position, 1.0));
|
||||
const float interpolated_sample = sample1 + ((sample2 - sample1) * fmodf(sound->position, 1.0));
|
||||
|
||||
*steam_pointer++ += interpolated_sample * sound->volume_l;
|
||||
*steam_pointer++ += interpolated_sample * sound->volume_r;
|
||||
|
@ -96,7 +96,7 @@ static void MixSounds(float *stream, unsigned int frames_total)
|
|||
{
|
||||
if (sound->looping)
|
||||
{
|
||||
sound->position = fmod(sound->position, (double)sound->frames);
|
||||
sound->position = fmodf(sound->position, sound->frames);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue