aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-10-15 15:38:07 -0700
committerChris Robinson <[email protected]>2015-10-15 15:38:07 -0700
commit2730d8e76f5155e6c28ddc028a8553b40326f97d (patch)
treeca3df4388154f2866cc6aff7aa918633c314fdd5 /Alc/ALu.c
parent2ff3bf5ab0240c2273cef3ba8a958ec063be691b (diff)
Round the calculated stepping value
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 23b7b057..ddc0cc53 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -405,11 +405,7 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
if(Pitch > (ALfloat)MAX_PITCH)
voice->Step = MAX_PITCH<<FRACTIONBITS;
else
- {
- voice->Step = fastf2i(Pitch*FRACTIONONE);
- if(voice->Step == 0)
- voice->Step = 1;
- }
+ voice->Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1);
Channels = ALBuffer->FmtChannels;
break;
@@ -991,11 +987,7 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte
if(Pitch > (ALfloat)MAX_PITCH)
voice->Step = MAX_PITCH<<FRACTIONBITS;
else
- {
- voice->Step = fastf2i(Pitch*FRACTIONONE);
- if(voice->Step == 0)
- voice->Step = 1;
- }
+ voice->Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1);
break;
}