aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-05-04 02:05:26 -0700
committerChris Robinson <[email protected]>2018-05-04 02:09:32 -0700
commit75e2cb97f74aeed2e50e4355607f041414a43976 (patch)
tree70d5957e9616fccc65b81a1dc4ff62babf1b6b36 /Alc/ALu.c
parentac8dbd7a56e4ca0ccfbef61b89bdb55775abea6a (diff)
Don't assume round-to-zero for fastf2i
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 0c930a29..81914850 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1092,7 +1092,7 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *p
if(Pitch > (ALfloat)MAX_PITCH)
voice->Step = MAX_PITCH<<FRACTIONBITS;
else
- voice->Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1);
+ voice->Step = maxi(fastf2i(Pitch * FRACTIONONE), 1);
if(props->Resampler == BSinc24Resampler)
BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc24);
else if(props->Resampler == BSinc12Resampler)
@@ -1453,7 +1453,7 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop
if(Pitch > (ALfloat)MAX_PITCH)
voice->Step = MAX_PITCH<<FRACTIONBITS;
else
- voice->Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1);
+ voice->Step = maxi(fastf2i(Pitch * FRACTIONONE), 1);
if(props->Resampler == BSinc24Resampler)
BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc24);
else if(props->Resampler == BSinc12Resampler)
@@ -1663,7 +1663,7 @@ static void ApplyDither(ALfloat (*restrict Samples)[BUFFERSIZE], ALuint *dither_
ALuint rng0 = dither_rng(&seed);
ALuint rng1 = dither_rng(&seed);
val += (ALfloat)(rng0*(1.0/UINT_MAX) - rng1*(1.0/UINT_MAX));
- samples[i] = roundf(val) * invscale;
+ samples[i] = fastf2i(val) * invscale;
}
}
*dither_seed = seed;