Move some setup to a more logical place

This commit is contained in:
Chris Robinson
2020-03-25 22:24:09 -07:00
parent a27096dd63
commit e8149ec509
2 changed files with 34 additions and 34 deletions
+1 -32
View File
@@ -122,9 +122,6 @@ const ALfloat ConeScale{InitConeScale()};
/* Localized Z scalar for mono sources */
const ALfloat ZScale{InitZScale()};
MixerFunc MixSamples{Mix_<CTag>};
RowMixerFunc MixRowSamples{MixRow_<CTag>};
namespace {
struct ChanMap {
@@ -133,33 +130,7 @@ struct ChanMap {
ALfloat elevation;
};
HrtfDirectMixerFunc MixDirectHrtf = MixDirectHrtf_<CTag>;
inline MixerFunc SelectMixer()
{
#ifdef HAVE_NEON
if((CPUCapFlags&CPU_CAP_NEON))
return Mix_<NEONTag>;
#endif
#ifdef HAVE_SSE
if((CPUCapFlags&CPU_CAP_SSE))
return Mix_<SSETag>;
#endif
return Mix_<CTag>;
}
inline RowMixerFunc SelectRowMixer()
{
#ifdef HAVE_NEON
if((CPUCapFlags&CPU_CAP_NEON))
return MixRow_<NEONTag>;
#endif
#ifdef HAVE_SSE
if((CPUCapFlags&CPU_CAP_SSE))
return MixRow_<SSETag>;
#endif
return MixRow_<CTag>;
}
HrtfDirectMixerFunc MixDirectHrtf{MixDirectHrtf_<CTag>};
inline HrtfDirectMixerFunc SelectHrtfMixer(void)
{
@@ -256,8 +227,6 @@ inline ResamplerFunc SelectResampler(Resampler resampler, ALuint increment)
void aluInit(void)
{
MixSamples = SelectMixer();
MixRowSamples = SelectRowMixer();
MixDirectHrtf = SelectHrtfMixer();
}
+33 -2
View File
@@ -71,6 +71,9 @@ static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE,
Resampler ResamplerDefault{Resampler::Linear};
MixerFunc MixSamples{Mix_<CTag>};
RowMixerFunc MixRowSamples{MixRow_<CTag>};
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_<CTag>;
HrtfMixerBlendFunc MixHrtfBlendSamples = MixHrtfBlend_<CTag>;
HrtfMixerFunc MixHrtfSamples{MixHrtf_<CTag>};
HrtfMixerBlendFunc MixHrtfBlendSamples{MixHrtfBlend_<CTag>};
inline MixerFunc SelectMixer()
{
#ifdef HAVE_NEON
if((CPUCapFlags&CPU_CAP_NEON))
return Mix_<NEONTag>;
#endif
#ifdef HAVE_SSE
if((CPUCapFlags&CPU_CAP_SSE))
return Mix_<SSETag>;
#endif
return Mix_<CTag>;
}
inline RowMixerFunc SelectRowMixer()
{
#ifdef HAVE_NEON
if((CPUCapFlags&CPU_CAP_NEON))
return MixRow_<NEONTag>;
#endif
#ifdef HAVE_SSE
if((CPUCapFlags&CPU_CAP_SSE))
return MixRow_<SSETag>;
#endif
return MixRow_<CTag>;
}
inline HrtfMixerFunc SelectHrtfMixer()
{
@@ -150,6 +179,8 @@ void aluInitMixer()
ResamplerDefault = iter->resampler;
}
MixSamples = SelectMixer();
MixRowSamples = SelectRowMixer();
MixHrtfBlendSamples = SelectHrtfBlendMixer();
MixHrtfSamples = SelectHrtfMixer();
}