aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/converter.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-07-13 22:30:39 -0700
committerChris Robinson <[email protected]>2017-07-13 22:30:39 -0700
commita535169bbdd6766cbc6b53188065fbee6d4da1bc (patch)
tree26fd1cf5cf1cd7220026a817180dd1f7583d751b /Alc/converter.c
parent22d77b87a3f103eeceec004cd9d053c17bf1b883 (diff)
Use macros to set and restore the mixer FPU mode
Diffstat (limited to 'Alc/converter.c')
-rw-r--r--Alc/converter.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Alc/converter.c b/Alc/converter.c
index d9d8ecbf..5cfe7031 100644
--- a/Alc/converter.c
+++ b/Alc/converter.c
@@ -9,7 +9,6 @@
SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate)
{
SampleConverter *converter;
- FPUCtl oldMode;
ALsizei step;
if(numchans <= 0 || srcRate <= 0 || dstRate <= 0)
@@ -26,7 +25,7 @@ SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType
converter->mFracOffset = 0;
/* Have to set the mixer FPU mode since that's what the resampler code expects. */
- SetMixerFPUMode(&oldMode);
+ START_MIXER_MODE();
step = fastf2i(minf((ALdouble)srcRate / dstRate, MAX_PITCH)*FRACTIONONE + 0.5f);
converter->mIncrement = maxi(step, 1);
if(converter->mIncrement == FRACTIONONE)
@@ -37,7 +36,7 @@ SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType
BsincPrepare(converter->mIncrement, &converter->mState.bsinc);
converter->mResample = SelectResampler(BSincResampler);
}
- RestoreFPUMode(&oldMode);
+ END_MIXER_MODE();
return converter;
}
@@ -230,9 +229,8 @@ ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALs
const ALsizei DstFrameSize = converter->mNumChannels * converter->mDstTypeSize;
const ALsizei increment = converter->mIncrement;
ALsizei pos = 0;
- FPUCtl oldMode;
- SetMixerFPUMode(&oldMode);
+ START_MIXER_MODE();
while(pos < dstframes && *srcframes > 0)
{
ALfloat *restrict SrcData = ASSUME_ALIGNED(converter->mSrcSamples, 16);
@@ -344,7 +342,7 @@ ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALs
dst = (ALbyte*)dst + DstFrameSize*DstSize;
pos += DstSize;
}
- RestoreFPUMode(&oldMode);
+ END_MIXER_MODE();
return pos;
}