aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-03 14:39:16 -0700
committerChris Robinson <[email protected]>2018-11-03 14:40:40 -0700
commit18e1d10338deda77cff58f21c2e1687442c6190d (patch)
treed7115bc11b9934d9f6530465a36265bdb44bd2e1 /Alc
parente9d17c51912bbec566279290a435e504ace7aa0c (diff)
Convert the UHJ encoder to C++
Diffstat (limited to 'Alc')
-rw-r--r--Alc/uhjfilter.cpp (renamed from Alc/uhjfilter.c)10
-rw-r--r--Alc/uhjfilter.h8
2 files changed, 15 insertions, 3 deletions
diff --git a/Alc/uhjfilter.c b/Alc/uhjfilter.cpp
index 6ee6fdb0..4fae721f 100644
--- a/Alc/uhjfilter.c
+++ b/Alc/uhjfilter.cpp
@@ -4,19 +4,21 @@
#include "alu.h"
#include "uhjfilter.h"
+namespace {
+
/* This is the maximum number of samples processed for each inner loop
* iteration. */
#define MAX_UPDATE_SAMPLES 128
-static const ALfloat Filter1CoeffSqr[4] = {
+constexpr ALfloat Filter1CoeffSqr[4] = {
0.479400865589f, 0.876218493539f, 0.976597589508f, 0.997499255936f
};
-static const ALfloat Filter2CoeffSqr[4] = {
+constexpr ALfloat Filter2CoeffSqr[4] = {
0.161758498368f, 0.733028932341f, 0.945349700329f, 0.990599156685f
};
-static void allpass_process(AllPassState *state, ALfloat *RESTRICT dst, const ALfloat *RESTRICT src, const ALfloat aa, ALsizei todo)
+void allpass_process(AllPassState *state, ALfloat *RESTRICT dst, const ALfloat *RESTRICT src, const ALfloat aa, ALsizei todo)
{
ALfloat z1 = state->z[0];
ALfloat z2 = state->z[1];
@@ -34,6 +36,8 @@ static void allpass_process(AllPassState *state, ALfloat *RESTRICT dst, const AL
state->z[1] = z2;
}
+} // namespace
+
/* NOTE: There seems to be a bit of an inconsistency in how this encoding is
* supposed to work. Some references, such as
diff --git a/Alc/uhjfilter.h b/Alc/uhjfilter.h
index 9ea1fb44..211425ed 100644
--- a/Alc/uhjfilter.h
+++ b/Alc/uhjfilter.h
@@ -5,6 +5,10 @@
#include "alMain.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct AllPassState {
ALfloat z[2];
} AllPassState;
@@ -46,4 +50,8 @@ typedef struct Uhj2Encoder {
*/
void EncodeUhj2(Uhj2Encoder *enc, ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, ALfloat (*RESTRICT InSamples)[BUFFERSIZE], ALsizei SamplesToDo);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif /* UHJFILTER_H */