aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/bformatdec.c8
-rw-r--r--OpenAL32/Include/alMain.h9
2 files changed, 12 insertions, 5 deletions
diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c
index 49532cc5..d6cf25e2 100644
--- a/Alc/bformatdec.c
+++ b/Alc/bformatdec.c
@@ -272,7 +272,7 @@ int bformatdec_getOrder(const struct BFormatDec *dec)
void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, ALuint srate, const ALuint chanmap[MAX_OUTPUT_CHANNELS], int flags)
{
- static const ALuint map2DTo3D[7] = {
+ static const ALuint map2DTo3D[MAX_AMBI2D_COEFFS] = {
0, 1, 3, 4, 8, 9, 15
};
const ALfloat *coeff_scale = UnitScale;
@@ -365,7 +365,7 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount,
if(!dec->Periphonic)
{
- for(j = 0,k = 0;j < 7;j++)
+ for(j = 0,k = 0;j < MAX_AMBI2D_COEFFS;j++)
{
ALuint l = map2DTo3D[j];
if(j == 0) gain = conf->HFOrderGain[0];
@@ -409,7 +409,7 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount,
if(!dec->Periphonic)
{
- for(j = 0,k = 0;j < 7;j++)
+ for(j = 0,k = 0;j < MAX_AMBI2D_COEFFS;j++)
{
ALuint l = map2DTo3D[j];
if(j == 0) gain = conf->HFOrderGain[0] * ratio;
@@ -421,7 +421,7 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount,
coeff_scale[l] * gain *
distgain[i];
}
- for(j = 0,k = 0;j < 7;j++)
+ for(j = 0,k = 0;j < MAX_AMBI2D_COEFFS;j++)
{
ALuint l = map2DTo3D[j];
if(j == 0) gain = conf->LFOrderGain[0] / ratio;
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 13aadef5..05abc0fa 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -485,7 +485,8 @@ enum RenderMode {
/* The maximum number of Ambisonics coefficients. For a given order (o), the
* size needed will be (o+1)**2, thus zero-order has 1, first-order has 4,
- * second-order has 9, third-order has 16, and fourth-order has 25. */
+ * second-order has 9, third-order has 16, and fourth-order has 25.
+ */
#define MAX_AMBI_ORDER 3
#define MAX_AMBI_COEFFS ((MAX_AMBI_ORDER+1) * (MAX_AMBI_ORDER+1))
@@ -497,6 +498,12 @@ enum RenderMode {
*/
#define AMBI_PERIPHONIC_MASK (0xfe7ce4)
+/* The maximum number of Ambisonic coefficients for 2D (non-periphonic)
+ * representation. This is 2 per each order above zero-order, plus 1 for zero-
+ * order. Or simply, o*2 + 1.
+ */
+#define MAX_AMBI2D_COEFFS (MAX_AMBI_ORDER*2 + 1)
+
typedef ALfloat ChannelConfig[MAX_AMBI_COEFFS];
typedef struct BFChannelConfig {