aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
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
parent22d77b87a3f103eeceec004cd9d053c17bf1b883 (diff)
Use macros to set and restore the mixer FPU mode
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c10
-rw-r--r--Alc/ALu.c7
-rw-r--r--Alc/converter.c10
3 files changed, 10 insertions, 17 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 107d4ef2..e4b57c45 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1741,7 +1741,6 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
ALCsizei hrtf_id = -1;
ALCcontext *context;
ALCuint oldFreq;
- FPUCtl oldMode;
size_t size;
ALCsizei i;
int val;
@@ -2244,7 +2243,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
* allocated with the appropriate size.
*/
update_failed = AL_FALSE;
- SetMixerFPUMode(&oldMode);
+ START_MIXER_MODE();
context = ATOMIC_LOAD_SEQ(&device->ContextList);
while(context)
{
@@ -2359,7 +2358,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
context = context->next;
}
- RestoreFPUMode(&oldMode);
+ END_MIXER_MODE();
if(update_failed)
return ALC_INVALID_DEVICE;
@@ -3662,11 +3661,10 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
if(ALContext->DefaultSlot)
{
- FPUCtl oldMode;
ALeffectslot *slot = ALContext->DefaultSlot;
ALeffectState *state = slot->Effect.State;
- SetMixerFPUMode(&oldMode);
+ START_MIXER_MODE();
state->OutBuffer = device->Dry.Buffer;
state->OutChannels = device->Dry.NumChannels;
if(V(state,deviceUpdate)(device) != AL_FALSE)
@@ -3676,7 +3674,7 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
DeinitEffectSlot(ALContext->DefaultSlot);
ALContext->DefaultSlot = NULL;
}
- RestoreFPUMode(&oldMode);
+ END_MIXER_MODE();
}
ALCdevice_IncRef(ALContext->Device);
diff --git a/Alc/ALu.c b/Alc/ALu.c
index e44c6c2c..25626320 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1611,11 +1611,9 @@ void aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
{
ALsizei SamplesToDo;
ALCcontext *ctx;
- FPUCtl oldMode;
ALsizei i, c;
- SetMixerFPUMode(&oldMode);
-
+ START_MIXER_MODE();
while(size > 0)
{
SamplesToDo = mini(size, BUFFERSIZE);
@@ -1819,8 +1817,7 @@ void aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
size -= SamplesToDo;
}
-
- RestoreFPUMode(&oldMode);
+ END_MIXER_MODE();
}
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;
}