From 0051a9637644795c721945faf64f9917ec5aa788 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 7 Nov 2014 00:54:16 -0800 Subject: Fix 5.1 surround sound Apparently, 5.1 surround sound is supposed to use the "side" channels, not the back channels, and we've been wrong this whole time. That means the "5.1 Side" is actually the correct 5.1 setup, and using the back channels is anomalous. Additionally, this means the 5.1 buffer format should also use the the side channels instead of the back channels. A final note: the 5.1 mixing coefficients are changed so both use the original 5.1 surround sound set (with the surround channels at +/-110 degrees). So the only difference now between 5.1 "side" and 5.1 "back" is the channel labels. --- Alc/ALc.c | 129 +++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 69 insertions(+), 60 deletions(-) (limited to 'Alc/ALc.c') diff --git a/Alc/ALc.c b/Alc/ALc.c index ab9a73d0..0c448d55 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1324,7 +1324,7 @@ const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans) case DevFmtStereo: return "Stereo"; case DevFmtQuad: return "Quadraphonic"; case DevFmtX51: return "5.1 Surround"; - case DevFmtX51Side: return "5.1 Side"; + case DevFmtX51Rear: return "5.1 Surround (Rear)"; case DevFmtX61: return "6.1 Surround"; case DevFmtX71: return "7.1 Surround"; } @@ -1354,7 +1354,7 @@ ALuint ChannelsFromDevFmt(enum DevFmtChannels chans) case DevFmtStereo: return 2; case DevFmtQuad: return 4; case DevFmtX51: return 6; - case DevFmtX51Side: return 6; + case DevFmtX51Rear: return 6; case DevFmtX61: return 7; case DevFmtX71: return 8; } @@ -1475,47 +1475,54 @@ void SetDefaultWFXChannelOrder(ALCdevice *device) switch(device->FmtChans) { - case DevFmtMono: device->ChannelName[0] = FrontCenter; - break; - case DevFmtStereo: device->ChannelName[0] = FrontLeft; - device->ChannelName[1] = FrontRight; - break; - case DevFmtQuad: device->ChannelName[0] = FrontLeft; - device->ChannelName[1] = FrontRight; - device->ChannelName[2] = BackLeft; - device->ChannelName[3] = BackRight; - break; - case DevFmtX51: device->ChannelName[0] = FrontLeft; - device->ChannelName[1] = FrontRight; - device->ChannelName[2] = FrontCenter; - device->ChannelName[3] = LFE; - device->ChannelName[4] = BackLeft; - device->ChannelName[5] = BackRight; - break; - case DevFmtX51Side: device->ChannelName[0] = FrontLeft; - device->ChannelName[1] = FrontRight; - device->ChannelName[2] = FrontCenter; - device->ChannelName[3] = LFE; - device->ChannelName[4] = SideLeft; - device->ChannelName[5] = SideRight; - break; - case DevFmtX61: device->ChannelName[0] = FrontLeft; - device->ChannelName[1] = FrontRight; - device->ChannelName[2] = FrontCenter; - device->ChannelName[3] = LFE; - device->ChannelName[4] = BackCenter; - device->ChannelName[5] = SideLeft; - device->ChannelName[6] = SideRight; - break; - case DevFmtX71: device->ChannelName[0] = FrontLeft; - device->ChannelName[1] = FrontRight; - device->ChannelName[2] = FrontCenter; - device->ChannelName[3] = LFE; - device->ChannelName[4] = BackLeft; - device->ChannelName[5] = BackRight; - device->ChannelName[6] = SideLeft; - device->ChannelName[7] = SideRight; - break; + case DevFmtMono: + device->ChannelName[0] = FrontCenter; + break; + case DevFmtStereo: + device->ChannelName[0] = FrontLeft; + device->ChannelName[1] = FrontRight; + break; + case DevFmtQuad: + device->ChannelName[0] = FrontLeft; + device->ChannelName[1] = FrontRight; + device->ChannelName[2] = BackLeft; + device->ChannelName[3] = BackRight; + break; + case DevFmtX51: + device->ChannelName[0] = FrontLeft; + device->ChannelName[1] = FrontRight; + device->ChannelName[2] = FrontCenter; + device->ChannelName[3] = LFE; + device->ChannelName[4] = SideLeft; + device->ChannelName[5] = SideRight; + break; + case DevFmtX51Rear: + device->ChannelName[0] = FrontLeft; + device->ChannelName[1] = FrontRight; + device->ChannelName[2] = FrontCenter; + device->ChannelName[3] = LFE; + device->ChannelName[4] = BackLeft; + device->ChannelName[5] = BackRight; + break; + case DevFmtX61: + device->ChannelName[0] = FrontLeft; + device->ChannelName[1] = FrontRight; + device->ChannelName[2] = FrontCenter; + device->ChannelName[3] = LFE; + device->ChannelName[4] = BackCenter; + device->ChannelName[5] = SideLeft; + device->ChannelName[6] = SideRight; + break; + case DevFmtX71: + device->ChannelName[0] = FrontLeft; + device->ChannelName[1] = FrontRight; + device->ChannelName[2] = FrontCenter; + device->ChannelName[3] = LFE; + device->ChannelName[4] = BackLeft; + device->ChannelName[5] = BackRight; + device->ChannelName[6] = SideLeft; + device->ChannelName[7] = SideRight; + break; } } @@ -1532,28 +1539,30 @@ void SetDefaultChannelOrder(ALCdevice *device) switch(device->FmtChans) { - case DevFmtX51: device->ChannelName[0] = FrontLeft; - device->ChannelName[1] = FrontRight; - device->ChannelName[2] = BackLeft; - device->ChannelName[3] = BackRight; - device->ChannelName[4] = FrontCenter; - device->ChannelName[5] = LFE; - return; - case DevFmtX71: device->ChannelName[0] = FrontLeft; - device->ChannelName[1] = FrontRight; - device->ChannelName[2] = BackLeft; - device->ChannelName[3] = BackRight; - device->ChannelName[4] = FrontCenter; - device->ChannelName[5] = LFE; - device->ChannelName[6] = SideLeft; - device->ChannelName[7] = SideRight; - return; + case DevFmtX51Rear: + device->ChannelName[0] = FrontLeft; + device->ChannelName[1] = FrontRight; + device->ChannelName[2] = BackLeft; + device->ChannelName[3] = BackRight; + device->ChannelName[4] = FrontCenter; + device->ChannelName[5] = LFE; + return; + case DevFmtX71: + device->ChannelName[0] = FrontLeft; + device->ChannelName[1] = FrontRight; + device->ChannelName[2] = BackLeft; + device->ChannelName[3] = BackRight; + device->ChannelName[4] = FrontCenter; + device->ChannelName[5] = LFE; + device->ChannelName[6] = SideLeft; + device->ChannelName[7] = SideRight; + return; /* Same as WFX order */ case DevFmtMono: case DevFmtStereo: case DevFmtQuad: - case DevFmtX51Side: + case DevFmtX51: case DevFmtX61: SetDefaultWFXChannelOrder(device); break; -- cgit v1.2.3