aboutsummaryrefslogtreecommitdiffstats
path: root/alc/voice.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-03-25 22:24:09 -0700
committerChris Robinson <[email protected]>2020-03-25 22:24:09 -0700
commite8149ec509b9ab71b03b2e5059b6a44fcdc42c40 (patch)
tree24d1dd9f5416ecafc860a879414572064eadc1e1 /alc/voice.cpp
parenta27096dd6305bbbdc470371ce8807e1e1bf331c1 (diff)
Move some setup to a more logical place
Diffstat (limited to 'alc/voice.cpp')
-rw-r--r--alc/voice.cpp35
1 files changed, 33 insertions, 2 deletions
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_<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();
}