diff options
author | Chris Robinson <[email protected]> | 2018-05-03 21:43:53 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-05-03 22:02:32 -0700 |
commit | ac8dbd7a56e4ca0ccfbef61b89bdb55775abea6a (patch) | |
tree | d4b67b98a59bb7812460df8c2426e3dfccefff84 /Alc/ALu.c | |
parent | d8a659c6f2db425729a33b0649f467c14ef18a9b (diff) |
Add a specific function for truncating float-to-int conversions
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -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]; |