aboutsummaryrefslogtreecommitdiffstats
path: root/alc/alu.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-10-02 16:53:23 -0700
committerChris Robinson <[email protected]>2019-10-02 16:53:23 -0700
commit64e2c377d865d67efdac675c355e7b1a6b4166e6 (patch)
tree574d85a15e26c6041da98b23d4c00ab264f481aa /alc/alu.cpp
parentd639935e1975db4276f6ee8c3622684cefa6b269 (diff)
Move ALvoice from alu.h to a separate header
Diffstat (limited to 'alc/alu.cpp')
-rw-r--r--alc/alu.cpp44
1 files changed, 37 insertions, 7 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp
index 21eea1db..6d3e5549 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -25,14 +25,12 @@
#include <algorithm>
#include <array>
#include <atomic>
-#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
-#include <cstring>
#include <functional>
#include <iterator>
#include <limits>
@@ -78,6 +76,7 @@
#include "threads.h"
#include "uhjfilter.h"
#include "vecmat.h"
+#include "voice.h"
#include "bsinc_inc.h"
@@ -122,21 +121,50 @@ const ALfloat ConeScale{InitConeScale()};
/* Localized Z scalar for mono sources */
const ALfloat ZScale{InitZScale()};
+MixerFunc MixSamples{Mix_<CTag>};
+RowMixerFunc MixRowSamples{MixRow_<CTag>};
namespace {
-void ClearArray(ALfloat (&f)[MAX_OUTPUT_CHANNELS])
-{
- std::fill(std::begin(f), std::end(f), 0.0f);
-}
-
struct ChanMap {
Channel channel;
ALfloat angle;
ALfloat elevation;
};
+void ClearArray(ALfloat (&f)[MAX_OUTPUT_CHANNELS])
+{
+ std::fill(std::begin(f), std::end(f), 0.0f);
+}
+
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>;
+}
+
inline HrtfDirectMixerFunc SelectHrtfMixer(void)
{
#ifdef HAVE_NEON
@@ -232,6 +260,8 @@ inline ResamplerFunc SelectResampler(Resampler resampler, ALuint increment)
void aluInit(void)
{
+ MixSamples = SelectMixer();
+ MixRowSamples = SelectRowMixer();
MixDirectHrtf = SelectHrtfMixer();
}