aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-05-26 00:26:11 -0700
committerChris Robinson <[email protected]>2018-05-26 00:26:11 -0700
commitec84a107a4e0d26fa6a528940a40405d1fd1ce65 (patch)
tree3b4ed90c6b05d95c6cbb61e9c1f939f81e0dd80f /Alc
parent803d331711cf5c0ecd0796bf28e9c95cf3724198 (diff)
Don't hardcode the max channels for HRTF B-Format decoding
Diffstat (limited to 'Alc')
-rw-r--r--Alc/hrtf.c6
-rw-r--r--Alc/hrtf.h6
-rw-r--r--Alc/panning.c1
3 files changed, 5 insertions, 8 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index 376c849f..ddbd3a28 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -202,13 +202,15 @@ void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei N
#define NUM_BANDS 2
BandSplitter splitter;
ALdouble (*tmpres)[HRIR_LENGTH][2];
- ALsizei idx[HRTF_AMBI_MAX_CHANNELS];
+ ALsizei *restrict idx;
ALsizei min_delay = HRTF_HISTORY_LENGTH;
ALsizei max_delay = 0;
ALfloat temps[3][HRIR_LENGTH];
ALsizei max_length;
ALsizei i, c, b;
+ idx = al_calloc(DEF_ALIGN, AmbiCount*sizeof(*idx));
+
for(c = 0;c < AmbiCount;c++)
{
ALuint evidx, azidx;
@@ -312,6 +314,8 @@ void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei N
}
al_free(tmpres);
tmpres = NULL;
+ al_free(idx);
+ idx = NULL;
if(NUM_BANDS == 1)
max_length = mini(max_delay-min_delay + Hrtf->irSize, HRIR_LENGTH);
diff --git a/Alc/hrtf.h b/Alc/hrtf.h
index aaffa904..ab68929b 100644
--- a/Alc/hrtf.h
+++ b/Alc/hrtf.h
@@ -9,12 +9,6 @@
#include "atomic.h"
-/* The maximum number of virtual speakers used to generate HRTF coefficients
- * for decoding B-Format.
- */
-#define HRTF_AMBI_MAX_CHANNELS 18
-
-
#define HRTF_HISTORY_BITS (6)
#define HRTF_HISTORY_LENGTH (1<<HRTF_HISTORY_BITS)
#define HRTF_HISTORY_MASK (HRTF_HISTORY_LENGTH-1)
diff --git a/Alc/panning.c b/Alc/panning.c
index 4a7c592b..e4562387 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -884,7 +884,6 @@ static void InitHrtfPanning(ALCdevice *device)
static_assert(COUNTOF(AmbiPoints) == COUNTOF(AmbiMatrixFOA), "FOA Ambisonic HRTF mismatch");
static_assert(COUNTOF(AmbiPoints) == COUNTOF(AmbiMatrixHOA), "HOA Ambisonic HRTF mismatch");
- static_assert(COUNTOF(AmbiPoints) <= HRTF_AMBI_MAX_CHANNELS, "HRTF_AMBI_MAX_CHANNELS is too small");
if(device->AmbiUp)
{