Convert the BFormat decoder to C++

This commit is contained in:
Chris Robinson
2018-11-03 15:32:09 -07:00
parent 12d5b638f2
commit 67f9efdad4
3 changed files with 15 additions and 8 deletions
+4 -4
View File
@@ -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)
+10 -3
View File
@@ -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 */
+1 -1
View File
@@ -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