From ec84a107a4e0d26fa6a528940a40405d1fd1ce65 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 26 May 2018 00:26:11 -0700 Subject: Don't hardcode the max channels for HRTF B-Format decoding --- Alc/hrtf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Alc/hrtf.c') 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); -- cgit v1.2.3