summaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-05-28 19:35:32 -0700
committerChris Robinson <[email protected]>2011-05-28 19:35:32 -0700
commit7da2eea8f073aa63d2ef0dfb995510af3463c097 (patch)
treea70b139a5d252a6b3c17d3542e7a594402d2796f /Alc
parent596a1af7d97d9ca34bad6bd1b64296d97a94c864 (diff)
Add a 5.1 device format that uses side channels instead of back
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c17
-rw-r--r--Alc/ALu.c11
-rw-r--r--Alc/dsound.c8
-rw-r--r--Alc/mmdevapi.c10
-rw-r--r--Alc/panning.c15
-rw-r--r--Alc/pulseaudio.c2
6 files changed, 63 insertions, 0 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 483f759e..7e4d5c6a 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -867,6 +867,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 DevFmtX61: return "6.1 Surround";
case DevFmtX71: return "7.1 Surround";
}
@@ -893,6 +894,7 @@ ALuint ChannelsFromDevFmt(enum DevFmtChannels chans)
case DevFmtStereo: return 2;
case DevFmtQuad: return 4;
case DevFmtX51: return 6;
+ case DevFmtX51Side: return 6;
case DevFmtX61: return 7;
case DevFmtX71: return 8;
}
@@ -1233,6 +1235,7 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
break;
case DevFmtQuad:
case DevFmtX51:
+ case DevFmtX51Side:
case DevFmtX61:
case DevFmtX71:
if(GetConfigValueBool(NULL, "stereodup", AL_TRUE))
@@ -2234,6 +2237,13 @@ void SetDefaultChannelOrder(ALCdevice *device)
device->DevChannels[FRONT_CENTER] = 4;
device->DevChannels[LFE] = 5; break;
+ case DevFmtX51Side: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[FRONT_CENTER] = 2;
+ device->DevChannels[LFE] = 3;
+ device->DevChannels[SIDE_LEFT] = 4;
+ device->DevChannels[SIDE_RIGHT] = 5; break;
+
case DevFmtX61: device->DevChannels[FRONT_LEFT] = 0;
device->DevChannels[FRONT_RIGHT] = 1;
device->DevChannels[FRONT_CENTER] = 2;
@@ -2274,6 +2284,13 @@ void SetDefaultWFXChannelOrder(ALCdevice *device)
device->DevChannels[BACK_LEFT] = 4;
device->DevChannels[BACK_RIGHT] = 5; break;
+ case DevFmtX51Side: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[FRONT_CENTER] = 2;
+ device->DevChannels[LFE] = 3;
+ device->DevChannels[SIDE_LEFT] = 4;
+ device->DevChannels[SIDE_RIGHT] = 5; break;
+
case DevFmtX61: device->DevChannels[FRONT_LEFT] = 0;
device->DevChannels[FRONT_RIGHT] = 1;
device->DevChannels[FRONT_CENTER] = 2;
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 35419631..934d5992 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -763,6 +763,9 @@ static const Channel QuadChans[] = { FRONT_LEFT, FRONT_RIGHT,
static const Channel X51Chans[] = { FRONT_LEFT, FRONT_RIGHT,
FRONT_CENTER, LFE,
BACK_LEFT, BACK_RIGHT };
+static const Channel X51SideChans[] = { FRONT_LEFT, FRONT_RIGHT,
+ FRONT_CENTER, LFE,
+ SIDE_LEFT, SIDE_RIGHT };
static const Channel X61Chans[] = { FRONT_LEFT, FRONT_LEFT,
FRONT_CENTER, LFE, BACK_CENTER,
SIDE_LEFT, SIDE_RIGHT };
@@ -790,30 +793,35 @@ static void Write_##T##_##chans(ALCdevice *device, T *RESTRICT buffer, \
DECL_TEMPLATE(ALfloat, MonoChans,1, aluF2F)
DECL_TEMPLATE(ALfloat, QuadChans,4, aluF2F)
DECL_TEMPLATE(ALfloat, X51Chans,6, aluF2F)
+DECL_TEMPLATE(ALfloat, X51SideChans,6, aluF2F)
DECL_TEMPLATE(ALfloat, X61Chans,7, aluF2F)
DECL_TEMPLATE(ALfloat, X71Chans,8, aluF2F)
DECL_TEMPLATE(ALushort, MonoChans,1, aluF2US)
DECL_TEMPLATE(ALushort, QuadChans,4, aluF2US)
DECL_TEMPLATE(ALushort, X51Chans,6, aluF2US)
+DECL_TEMPLATE(ALushort, X51SideChans,6, aluF2US)
DECL_TEMPLATE(ALushort, X61Chans,7, aluF2US)
DECL_TEMPLATE(ALushort, X71Chans,8, aluF2US)
DECL_TEMPLATE(ALshort, MonoChans,1, aluF2S)
DECL_TEMPLATE(ALshort, QuadChans,4, aluF2S)
DECL_TEMPLATE(ALshort, X51Chans,6, aluF2S)
+DECL_TEMPLATE(ALshort, X51SideChans,6, aluF2S)
DECL_TEMPLATE(ALshort, X61Chans,7, aluF2S)
DECL_TEMPLATE(ALshort, X71Chans,8, aluF2S)
DECL_TEMPLATE(ALubyte, MonoChans,1, aluF2UB)
DECL_TEMPLATE(ALubyte, QuadChans,4, aluF2UB)
DECL_TEMPLATE(ALubyte, X51Chans,6, aluF2UB)
+DECL_TEMPLATE(ALubyte, X51SideChans,6, aluF2UB)
DECL_TEMPLATE(ALubyte, X61Chans,7, aluF2UB)
DECL_TEMPLATE(ALubyte, X71Chans,8, aluF2UB)
DECL_TEMPLATE(ALbyte, MonoChans,1, aluF2B)
DECL_TEMPLATE(ALbyte, QuadChans,4, aluF2B)
DECL_TEMPLATE(ALbyte, X51Chans,6, aluF2B)
+DECL_TEMPLATE(ALbyte, X51SideChans,6, aluF2B)
DECL_TEMPLATE(ALbyte, X61Chans,7, aluF2B)
DECL_TEMPLATE(ALbyte, X71Chans,8, aluF2B)
@@ -876,6 +884,9 @@ static void Write_##T(ALCdevice *device, T *buffer, ALuint SamplesToDo) \
case DevFmtX51: \
Write_##T##_X51Chans(device, buffer, SamplesToDo); \
break; \
+ case DevFmtX51Side: \
+ Write_##T##_X51SideChans(device, buffer, SamplesToDo); \
+ break; \
case DevFmtX61: \
Write_##T##_X61Chans(device, buffer, SamplesToDo); \
break; \
diff --git a/Alc/dsound.c b/Alc/dsound.c
index 7ef49729..883b84e0 100644
--- a/Alc/dsound.c
+++ b/Alc/dsound.c
@@ -395,6 +395,14 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device)
SPEAKER_BACK_LEFT |
SPEAKER_BACK_RIGHT;
break;
+ case DevFmtX51Side:
+ OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
+ SPEAKER_FRONT_RIGHT |
+ SPEAKER_FRONT_CENTER |
+ SPEAKER_LOW_FREQUENCY |
+ SPEAKER_SIDE_LEFT |
+ SPEAKER_SIDE_RIGHT;
+ break;
case DevFmtX61:
OutputType.dwChannelMask = SPEAKER_FRONT_LEFT |
SPEAKER_FRONT_RIGHT |
diff --git a/Alc/mmdevapi.c b/Alc/mmdevapi.c
index 39628c95..cbeba71e 100644
--- a/Alc/mmdevapi.c
+++ b/Alc/mmdevapi.c
@@ -47,6 +47,7 @@ DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0
#define STEREO (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT)
#define QUAD (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT)
#define X5DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT)
+#define X5DOT1SIDE (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)
#define X6DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)
#define X7DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)
@@ -276,6 +277,8 @@ static ALCboolean MMDevApiResetPlayback(ALCdevice *device)
device->FmtChans = DevFmtQuad;
else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1)
device->FmtChans = DevFmtX51;
+ else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1SIDE)
+ device->FmtChans = DevFmtX51Side;
else if(OutputType.Format.nChannels == 7 && OutputType.dwChannelMask == X6DOT1)
device->FmtChans = DevFmtX61;
else if(OutputType.Format.nChannels == 8 && OutputType.dwChannelMask == X7DOT1)
@@ -302,6 +305,10 @@ static ALCboolean MMDevApiResetPlayback(ALCdevice *device)
OutputType.Format.nChannels = 6;
OutputType.dwChannelMask = X5DOT1;
break;
+ case DevFmtX51Side:
+ OutputType.Format.nChannels = 6;
+ OutputType.dwChannelMask = X5DOT1SIDE;
+ break;
case DevFmtX61:
OutputType.Format.nChannels = 7;
OutputType.dwChannelMask = X6DOT1;
@@ -373,6 +380,7 @@ static ALCboolean MMDevApiResetPlayback(ALCdevice *device)
(device->FmtChans == DevFmtStereo && OutputType.Format.nChannels == 2 && OutputType.dwChannelMask == STEREO) ||
(device->FmtChans == DevFmtQuad && OutputType.Format.nChannels == 4 && OutputType.dwChannelMask == QUAD) ||
(device->FmtChans == DevFmtX51 && OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1) ||
+ (device->FmtChans == DevFmtX51Side && OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1SIDE) ||
(device->FmtChans == DevFmtX61 && OutputType.Format.nChannels == 7 && OutputType.dwChannelMask == X6DOT1) ||
(device->FmtChans == DevFmtX71 && OutputType.Format.nChannels == 8 && OutputType.dwChannelMask == X7DOT1)))
{
@@ -388,6 +396,8 @@ static ALCboolean MMDevApiResetPlayback(ALCdevice *device)
device->FmtChans = DevFmtQuad;
else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1)
device->FmtChans = DevFmtX51;
+ else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1SIDE)
+ device->FmtChans = DevFmtX51Side;
else if(OutputType.Format.nChannels == 7 && OutputType.dwChannelMask == X6DOT1)
device->FmtChans = DevFmtX61;
else if(OutputType.Format.nChannels == 8 && OutputType.dwChannelMask == X7DOT1)
diff --git a/Alc/panning.c b/Alc/panning.c
index a5a92298..8df70f30 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -217,6 +217,21 @@ ALvoid aluInitPanning(ALCdevice *Device)
SetSpeakerArrangement("layout_51CHN", SpeakerAngle, Speaker2Chan, Device->NumChan);
break;
+ case DevFmtX51Side:
+ Device->NumChan = 5;
+ Speaker2Chan[0] = SIDE_LEFT;
+ Speaker2Chan[1] = FRONT_LEFT;
+ Speaker2Chan[2] = FRONT_CENTER;
+ Speaker2Chan[3] = FRONT_RIGHT;
+ Speaker2Chan[4] = SIDE_RIGHT;
+ SpeakerAngle[0] = -90.0f * M_PI/180.0f;
+ SpeakerAngle[1] = -30.0f * M_PI/180.0f;
+ SpeakerAngle[2] = 0.0f * M_PI/180.0f;
+ SpeakerAngle[3] = 30.0f * M_PI/180.0f;
+ SpeakerAngle[4] = 90.0f * M_PI/180.0f;
+ SetSpeakerArrangement("layout_51SIDECHN", SpeakerAngle, Speaker2Chan, Device->NumChan);
+ break;
+
case DevFmtX61:
Device->NumChan = 6;
Speaker2Chan[0] = SIDE_LEFT;
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c
index 353e2e09..161df3a3 100644
--- a/Alc/pulseaudio.c
+++ b/Alc/pulseaudio.c
@@ -394,6 +394,8 @@ static void sink_info_callback(pa_context *context, const pa_sink_info *info, in
DevFmtX61 },
{ "front-left,front-right,front-center,lfe,rear-left,rear-right",
DevFmtX51 },
+ { "front-left,front-right,front-center,lfe,side-left,side-right",
+ DevFmtX51Side },
{ "front-left,front-right,rear-left,rear-right", DevFmtQuad },
{ "front-left,front-right", DevFmtStereo },
{ "mono", DevFmtMono },