From c63d468d4cc738ead65ff7ebc9cf6afcad400ee1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 1 Jun 2016 05:30:06 -0700 Subject: [PATCH] Use a macro to specify the ambisonic periphonic channel mask --- Alc/bformatdec.c | 2 +- Alc/panning.c | 4 ++-- OpenAL32/Include/alMain.h | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c index a871fb09..7da50692 100644 --- a/Alc/bformatdec.c +++ b/Alc/bformatdec.c @@ -310,7 +310,7 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, ratio = 400.0f / (ALfloat)srate; for(i = 0;i < 4;i++) bandsplit_init(&dec->UpSampler.XOver[i], ratio); - if((conf->ChanMask & ~0x831b)) + if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) { dec->UpSampler.MatrixHF = CubeMatrixHF; dec->UpSampler.MatrixLF = CubeMatrixLF; diff --git a/Alc/panning.c b/Alc/panning.c index 2116e739..6949c565 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -673,7 +673,7 @@ static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALuin if(GetConfigValueBool(devname, "decoder", "distance-comp", 1)) decflags |= BFDF_DistanceComp; - if((conf->ChanMask & ~0x831b)) + if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) { count = (conf->ChanMask > 0x1ff) ? 16 : (conf->ChanMask > 0xf) ? 9 : 4; @@ -701,7 +701,7 @@ static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALuin TRACE("Enabling %s-band %s-order%s ambisonic decoder\n", (conf->FreqBands == 1) ? "single" : "dual", (conf->ChanMask > 0xf) ? (conf->ChanMask > 0x1ff) ? "third" : "second" : "first", - (conf->ChanMask & ~0x831b) ? " periphonic" : "" + (conf->ChanMask&AMBI_PERIPHONIC_MASK) ? " periphonic" : "" ); bformatdec_reset(device->AmbiDecoder, conf, count, device->Frequency, speakermap, decflags); diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index d7b54310..18aa4df3 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -483,10 +483,19 @@ 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, and third-order has 16. */ + * 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)) +/* A bitmask of ambisonic channels with height information. If none of these + * channels are used/needed, there's no height (e.g. with most surround sound + * speaker setups). This only specifies up to 4th order, which is the highest + * order a 32-bit mask value can specify (a 64-bit mask could handle up to 7th + * order). This is ACN ordering, with bit 0 being ACN 0, etc. + */ +#define AMBI_PERIPHONIC_MASK (0xfe7ce4) + + typedef ALfloat ChannelConfig[MAX_AMBI_COEFFS]; typedef struct BFChannelConfig { ALfloat Scale; -- 2.11.4.GIT