aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-02-27 16:11:45 -0800
committerChris Robinson <[email protected]>2017-02-27 16:11:45 -0800
commita9610b3607e8dd23f731b614c3b0761c38cb36a8 (patch)
tree6163c30f02668224717e4e055b340962d94b7bc7
parent5c859af24ea44dabbbb31631309bb08a858a523e (diff)
Use separate enums for the ambisonic channel order and normalization
-rw-r--r--Alc/ALc.c24
-rw-r--r--Alc/backends/wave.c3
-rw-r--r--Alc/panning.c8
-rw-r--r--OpenAL32/Include/alMain.h20
4 files changed, 38 insertions, 17 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index bf683ba3..56063bb1 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -3640,7 +3640,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
device->FmtType = DevFmtTypeDefault;
device->Frequency = DEFAULT_OUTPUT_RATE;
device->IsHeadphones = AL_FALSE;
- device->AmbiFmt = AmbiFormat_Default;
+ device->AmbiLayout = AmbiLayout_Default;
+ device->AmbiScale = AmbiNorm_Default;
device->NumUpdates = 3;
device->UpdateSize = 1024;
@@ -3763,11 +3764,20 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "ambi-format", &fmt))
{
if(strcasecmp(fmt, "fuma") == 0)
- device->AmbiFmt = AmbiFormat_FuMa;
+ {
+ device->AmbiLayout = AmbiLayout_FuMa;
+ device->AmbiScale = AmbiNorm_FuMa;
+ }
else if(strcasecmp(fmt, "acn+sn3d") == 0)
- device->AmbiFmt = AmbiFormat_ACN_SN3D;
+ {
+ device->AmbiLayout = AmbiLayout_ACN;
+ device->AmbiScale = AmbiNorm_SN3D;
+ }
else if(strcasecmp(fmt, "acn+n3d") == 0)
- device->AmbiFmt = AmbiFormat_ACN_N3D;
+ {
+ device->AmbiLayout = AmbiLayout_ACN;
+ device->AmbiScale = AmbiNorm_N3D;
+ }
else
ERR("Unsupported ambi-format: %s\n", fmt);
}
@@ -3939,7 +3949,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName,
return NULL;
}
device->IsHeadphones = AL_FALSE;
- device->AmbiFmt = AmbiFormat_Default;
+ device->AmbiLayout = AmbiLayout_Default;
+ device->AmbiScale = AmbiNorm_Default;
device->UpdateSize = samples;
device->NumUpdates = 1;
@@ -4142,7 +4153,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN
device->FmtChans = DevFmtChannelsDefault;
device->FmtType = DevFmtTypeDefault;
device->IsHeadphones = AL_FALSE;
- device->AmbiFmt = AmbiFormat_Default;
+ device->AmbiLayout = AmbiLayout_Default;
+ device->AmbiScale = AmbiNorm_Default;
ConfigValueUInt(NULL, NULL, "sources", &device->SourcesMax);
if(device->SourcesMax == 0) device->SourcesMax = 256;
diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c
index ac0ffd80..1b13746e 100644
--- a/Alc/backends/wave.c
+++ b/Alc/backends/wave.c
@@ -283,7 +283,8 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self)
case DevFmtAmbi2:
case DevFmtAmbi3:
/* .amb output requires FuMa */
- device->AmbiFmt = AmbiFormat_FuMa;
+ device->AmbiLayout = AmbiLayout_FuMa;
+ device->AmbiScale = AmbiNorm_FuMa;
isbformat = 1;
chanmask = 0;
break;
diff --git a/Alc/panning.c b/Alc/panning.c
index 46f134a6..77f8e31b 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -546,10 +546,10 @@ static void InitPanning(ALCdevice *device)
if(device->FmtChans >= DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3)
{
- const ALsizei *acnmap = (device->AmbiFmt == AmbiFormat_FuMa) ? FuMa2ACN : ACN2ACN;
- const ALfloat *n3dscale = (device->AmbiFmt == AmbiFormat_FuMa) ? FuMa2N3DScale :
- (device->AmbiFmt == AmbiFormat_ACN_SN3D) ? SN3D2N3DScale :
- /*(device->AmbiFmt == AmbiFormat_ACN_N3D) ?*/ UnitScale;
+ const ALsizei *acnmap = (device->AmbiLayout == AmbiLayout_FuMa) ? FuMa2ACN : ACN2ACN;
+ const ALfloat *n3dscale = (device->AmbiScale == AmbiNorm_FuMa) ? FuMa2N3DScale :
+ (device->AmbiScale == AmbiNorm_SN3D) ? SN3D2N3DScale :
+ /*(device->AmbiScale == AmbiNorm_N3D) ?*/ UnitScale;
count = (device->FmtChans == DevFmtAmbi3) ? 16 :
(device->FmtChans == DevFmtAmbi2) ? 9 :
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 0b467403..23572a90 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -510,12 +510,19 @@ inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType ty
return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type);
}
-enum AmbiFormat {
- AmbiFormat_FuMa, /* FuMa channel order and normalization */
- AmbiFormat_ACN_SN3D, /* ACN channel order and SN3D normalization */
- AmbiFormat_ACN_N3D, /* ACN channel order and N3D normalization */
+enum AmbiLayout {
+ AmbiLayout_FuMa, /* FuMa channel order */
+ AmbiLayout_ACN, /* ACN channel order */
- AmbiFormat_Default = AmbiFormat_ACN_SN3D
+ AmbiLayout_Default = AmbiLayout_ACN
+};
+
+enum AmbiNorm {
+ AmbiNorm_FuMa, /* FuMa normalization */
+ AmbiNorm_SN3D, /* SN3D normalization */
+ AmbiNorm_N3D, /* N3D normalization */
+
+ AmbiNorm_Default = AmbiNorm_SN3D
};
@@ -635,7 +642,8 @@ struct ALCdevice_struct
/* For DevFmtAmbi* output only, specifies the channel order and
* normalization.
*/
- enum AmbiFormat AmbiFmt;
+ enum AmbiLayout AmbiLayout;
+ enum AmbiNorm AmbiScale;
al_string DeviceName;