diff --git a/alc/alu.cpp b/alc/alu.cpp index 13e57a09..f50815ae 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -122,9 +122,6 @@ const ALfloat ConeScale{InitConeScale()}; /* Localized Z scalar for mono sources */ const ALfloat ZScale{InitZScale()}; -MixerFunc MixSamples{Mix_}; -RowMixerFunc MixRowSamples{MixRow_}; - namespace { struct ChanMap { @@ -133,33 +130,7 @@ struct ChanMap { ALfloat elevation; }; -HrtfDirectMixerFunc MixDirectHrtf = MixDirectHrtf_; - -inline MixerFunc SelectMixer() -{ -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return Mix_; -#endif -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return Mix_; -#endif - return Mix_; -} - -inline RowMixerFunc SelectRowMixer() -{ -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return MixRow_; -#endif -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return MixRow_; -#endif - return MixRow_; -} +HrtfDirectMixerFunc MixDirectHrtf{MixDirectHrtf_}; inline HrtfDirectMixerFunc SelectHrtfMixer(void) { @@ -256,8 +227,6 @@ inline ResamplerFunc SelectResampler(Resampler resampler, ALuint increment) void aluInit(void) { - MixSamples = SelectMixer(); - MixRowSamples = SelectRowMixer(); MixDirectHrtf = SelectHrtfMixer(); } diff --git a/alc/voice.cpp b/alc/voice.cpp index 369c2ad4..d09aa700 100644 --- a/alc/voice.cpp +++ b/alc/voice.cpp @@ -71,6 +71,9 @@ static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE, Resampler ResamplerDefault{Resampler::Linear}; +MixerFunc MixSamples{Mix_}; +RowMixerFunc MixRowSamples{MixRow_}; + namespace { using HrtfMixerFunc = void(*)(const ALfloat *InSamples, float2 *AccumSamples, const ALuint IrSize, @@ -79,8 +82,34 @@ using HrtfMixerBlendFunc = void(*)(const ALfloat *InSamples, float2 *AccumSample const ALuint IrSize, const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize); -HrtfMixerFunc MixHrtfSamples = MixHrtf_; -HrtfMixerBlendFunc MixHrtfBlendSamples = MixHrtfBlend_; +HrtfMixerFunc MixHrtfSamples{MixHrtf_}; +HrtfMixerBlendFunc MixHrtfBlendSamples{MixHrtfBlend_}; + +inline MixerFunc SelectMixer() +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return Mix_; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return Mix_; +#endif + return Mix_; +} + +inline RowMixerFunc SelectRowMixer() +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return MixRow_; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return MixRow_; +#endif + return MixRow_; +} inline HrtfMixerFunc SelectHrtfMixer() { @@ -150,6 +179,8 @@ void aluInitMixer() ResamplerDefault = iter->resampler; } + MixSamples = SelectMixer(); + MixRowSamples = SelectRowMixer(); MixHrtfBlendSamples = SelectHrtfBlendMixer(); MixHrtfSamples = SelectHrtfMixer(); }