aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-06-28 10:17:36 -0700
committerChris Robinson <[email protected]>2017-06-28 10:17:36 -0700
commit7cadbebe9f24a61b6b024359496a7a32d4eae5ee (patch)
tree3ae72af5f38e9959b40fc5e9a2c4c0f5895e4cf2
parente9a7218a06e268afcedf8207e5a5d79991e21356 (diff)
Calculate the converter stepping value using floating point
-rw-r--r--Alc/converter.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Alc/converter.c b/Alc/converter.c
index 3a926797..d9d8ecbf 100644
--- a/Alc/converter.c
+++ b/Alc/converter.c
@@ -10,6 +10,7 @@ SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType
{
SampleConverter *converter;
FPUCtl oldMode;
+ ALsizei step;
if(numchans <= 0 || srcRate <= 0 || dstRate <= 0)
return NULL;
@@ -26,9 +27,8 @@ SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType
/* Have to set the mixer FPU mode since that's what the resampler code expects. */
SetMixerFPUMode(&oldMode);
- converter->mIncrement = (ALsizei)clampu64(
- ScaleRound(srcRate, FRACTIONONE, dstRate), 1, MAX_PITCH*FRACTIONONE
- );
+ step = fastf2i(minf((ALdouble)srcRate / dstRate, MAX_PITCH)*FRACTIONONE + 0.5f);
+ converter->mIncrement = maxi(step, 1);
if(converter->mIncrement == FRACTIONONE)
converter->mResample = Resample_copy32_C;
else