aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-05-03 21:43:53 -0700
committerChris Robinson <[email protected]>2018-05-03 22:02:32 -0700
commitac8dbd7a56e4ca0ccfbef61b89bdb55775abea6a (patch)
treed4b67b98a59bb7812460df8c2426e3dfccefff84 /Alc/ALu.c
parentd8a659c6f2db425729a33b0649f467c14ef18a9b (diff)
Add a specific function for truncating float-to-int conversions
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 177509b6..0c930a29 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -352,25 +352,20 @@ void aluSelectPostProcess(ALCdevice *device)
*/
void BsincPrepare(const ALuint increment, BsincState *state, const BSincTable *table)
{
- ALfloat sf;
- ALsizei si;
+ ALfloat sf = 0.0f;
+ ALsizei si = BSINC_SCALE_COUNT-1;
if(increment > FRACTIONONE)
{
sf = (ALfloat)FRACTIONONE / increment;
sf = maxf(0.0f, (BSINC_SCALE_COUNT-1) * (sf-table->scaleBase) * table->scaleRange);
- si = fastf2i(sf);
+ si = float2int(sf);
/* The interpolation factor is fit to this diagonally-symmetric curve
* to reduce the transition ripple caused by interpolating different
* scales of the sinc function.
*/
sf = 1.0f - cosf(asinf(sf - si));
}
- else
- {
- sf = 0.0f;
- si = BSINC_SCALE_COUNT - 1;
- }
state->sf = sf;
state->m = table->m[si];