diff options
-rw-r--r-- | Alc/uhjfilter.cpp (renamed from Alc/uhjfilter.c) | 10 | ||||
-rw-r--r-- | Alc/uhjfilter.h | 8 | ||||
-rw-r--r-- | CMakeLists.txt | 2 |
3 files changed, 16 insertions, 4 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 */ diff --git a/CMakeLists.txt b/CMakeLists.txt index f4c0ae4c..eb02a366 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -872,7 +872,7 @@ SET(ALC_OBJS Alc/vector.h Alc/hrtf.c Alc/hrtf.h - Alc/uhjfilter.c + Alc/uhjfilter.cpp Alc/uhjfilter.h Alc/ambdec.c Alc/ambdec.h |