diff options
author | Chris Robinson <[email protected]> | 2018-11-03 15:32:09 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-03 15:32:09 -0700 |
commit | 67f9efdad45f4da65d1f02d95d878c5f6fc03bb1 (patch) | |
tree | 74a60614fd7c4b49e0a9cf02bf50572a71a71ae9 | |
parent | 12d5b638f2afc0a8b762bd5e5e8056e85c72d189 (diff) |
Convert the BFormat decoder to C++
-rw-r--r-- | Alc/bformatdec.cpp (renamed from Alc/bformatdec.c) | 8 | ||||
-rw-r--r-- | Alc/bformatdec.h | 13 | ||||
-rw-r--r-- | CMakeLists.txt | 2 |
3 files changed, 15 insertions, 8 deletions
diff --git a/Alc/bformatdec.c b/Alc/bformatdec.cpp index 91eb8ca8..a0893f89 100644 --- a/Alc/bformatdec.c +++ b/Alc/bformatdec.cpp @@ -116,7 +116,7 @@ typedef struct BFormatDec { BFormatDec *bformatdec_alloc() { - return al_calloc(16, sizeof(BFormatDec)); + return reinterpret_cast<BFormatDec*>(al_calloc(16, sizeof(BFormatDec))); } void bformatdec_free(BFormatDec **dec) @@ -149,7 +149,8 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALsizei chancount dec->SamplesLF = NULL; dec->NumChannels = chancount; - dec->Samples = al_calloc(16, dec->NumChannels*2 * sizeof(dec->Samples[0])); + dec->Samples = reinterpret_cast<ALfloat(*)[BUFFERSIZE]>(al_calloc(16, + dec->NumChannels*2 * sizeof(dec->Samples[0]))); dec->SamplesHF = dec->Samples; dec->SamplesLF = dec->SamplesHF + dec->NumChannels; @@ -308,7 +309,6 @@ void bformatdec_process(struct BFormatDec *dec, ALfloat (*RESTRICT OutBuffer)[BU { ALsizei chan, i; - OutBuffer = ASSUME_ALIGNED(OutBuffer, 16); if(dec->DualBand) { for(i = 0;i < dec->NumChannels;i++) @@ -406,7 +406,7 @@ typedef struct AmbiUpsampler { AmbiUpsampler *ambiup_alloc() { - return al_calloc(16, sizeof(AmbiUpsampler)); + return reinterpret_cast<AmbiUpsampler*>(al_calloc(16, sizeof(AmbiUpsampler))); } void ambiup_free(struct AmbiUpsampler **ambiup) diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h index 3c081807..964a89f9 100644 --- a/Alc/bformatdec.h +++ b/Alc/bformatdec.h @@ -3,6 +3,9 @@ #include "alMain.h" +#ifdef __cplusplus +extern "C" { +#endif /* These are the necessary scales for first-order HF responses to play over * higher-order 2D (non-periphonic) decoders. @@ -24,9 +27,9 @@ /* NOTE: These are scale factors as applied to Ambisonics content. Decoder * coefficients should be divided by these values to get proper N3D scalings. */ -const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS]; -const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS]; -const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS]; +extern const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS]; +extern const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS]; +extern const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS]; struct AmbDecConf; @@ -54,4 +57,8 @@ void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device, ALfloat void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*RESTRICT InSamples)[BUFFERSIZE], ALsizei SamplesToDo); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* BFORMATDEC_H */ diff --git a/CMakeLists.txt b/CMakeLists.txt index 138de1c3..2743bcaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -876,7 +876,7 @@ SET(ALC_OBJS Alc/uhjfilter.h Alc/ambdec.c Alc/ambdec.h - Alc/bformatdec.c + Alc/bformatdec.cpp Alc/bformatdec.h Alc/panning.c Alc/polymorphism.h |