aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-04-08 13:11:21 -0700
committerChris Robinson <[email protected]>2010-04-08 13:11:21 -0700
commit1b1c76da341f446f926ffad44a9f7d12a4f0f2d5 (patch)
tree5e7a3f79d9452d209a25a518d4545ebadff99b1d
parent5db1aec1d1c909c71c657f0826bce0eac5cdf229 (diff)
Invert device channel map array
-rw-r--r--Alc/ALc.c132
-rw-r--r--Alc/ALu.c89
-rw-r--r--OpenAL32/Include/alMain.h2
3 files changed, 124 insertions, 99 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index e7d3d343..b8e34198 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1567,39 +1567,39 @@ void SetDefaultChannelOrder(ALCdevice *device)
{
switch(aluChannelsFromFormat(device->Format))
{
- case 1: device->DevChannels[0] = FRONT_CENTER; break;
-
- case 2: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT; break;
-
- case 4: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT;
- device->DevChannels[2] = BACK_LEFT;
- device->DevChannels[3] = BACK_RIGHT; break;
-
- case 6: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT;
- device->DevChannels[2] = BACK_LEFT;
- device->DevChannels[3] = BACK_RIGHT;
- device->DevChannels[4] = FRONT_CENTER;
- device->DevChannels[5] = LFE; break;
-
- case 7: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT;
- device->DevChannels[2] = FRONT_CENTER;
- device->DevChannels[3] = LFE;
- device->DevChannels[4] = BACK_CENTER;
- device->DevChannels[5] = SIDE_LEFT;
- device->DevChannels[6] = SIDE_RIGHT; break;
-
- case 8: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT;
- device->DevChannels[2] = BACK_LEFT;
- device->DevChannels[3] = BACK_RIGHT;
- device->DevChannels[4] = FRONT_CENTER;
- device->DevChannels[5] = LFE;
- device->DevChannels[6] = SIDE_LEFT;
- device->DevChannels[7] = SIDE_RIGHT; break;
+ case 1: device->DevChannels[FRONT_CENTER] = 0; break;
+
+ case 2: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1; break;
+
+ case 4: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[BACK_LEFT] = 2;
+ device->DevChannels[BACK_RIGHT] = 3; break;
+
+ case 6: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[BACK_LEFT] = 2;
+ device->DevChannels[BACK_RIGHT] = 3;
+ device->DevChannels[FRONT_CENTER] = 4;
+ device->DevChannels[LFE] = 5; break;
+
+ case 7: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[FRONT_CENTER] = 2;
+ device->DevChannels[LFE] = 3;
+ device->DevChannels[BACK_CENTER] = 4;
+ device->DevChannels[SIDE_LEFT] = 5;
+ device->DevChannels[SIDE_RIGHT] = 6; break;
+
+ case 8: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[BACK_LEFT] = 2;
+ device->DevChannels[BACK_RIGHT] = 3;
+ device->DevChannels[FRONT_CENTER] = 4;
+ device->DevChannels[LFE] = 5;
+ device->DevChannels[SIDE_LEFT] = 6;
+ device->DevChannels[SIDE_RIGHT] = 7; break;
}
}
// Sets the default order used by WaveFormatEx
@@ -1607,39 +1607,39 @@ void SetDefaultWFXChannelOrder(ALCdevice *device)
{
switch(aluChannelsFromFormat(device->Format))
{
- case 1: device->DevChannels[0] = FRONT_CENTER; break;
-
- case 2: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT; break;
-
- case 4: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT;
- device->DevChannels[2] = BACK_LEFT;
- device->DevChannels[3] = BACK_RIGHT; break;
-
- case 6: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT;
- device->DevChannels[2] = FRONT_CENTER;
- device->DevChannels[3] = LFE;
- device->DevChannels[4] = BACK_LEFT;
- device->DevChannels[5] = BACK_RIGHT; break;
-
- case 7: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT;
- device->DevChannels[2] = FRONT_CENTER;
- device->DevChannels[3] = LFE;
- device->DevChannels[4] = BACK_CENTER;
- device->DevChannels[5] = SIDE_LEFT;
- device->DevChannels[6] = SIDE_RIGHT; break;
-
- case 8: device->DevChannels[0] = FRONT_LEFT;
- device->DevChannels[1] = FRONT_RIGHT;
- device->DevChannels[2] = FRONT_CENTER;
- device->DevChannels[3] = LFE;
- device->DevChannels[4] = BACK_LEFT;
- device->DevChannels[5] = BACK_RIGHT;
- device->DevChannels[6] = SIDE_LEFT;
- device->DevChannels[7] = SIDE_RIGHT; break;
+ case 1: device->DevChannels[FRONT_CENTER] = 0; break;
+
+ case 2: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1; break;
+
+ case 4: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[BACK_LEFT] = 2;
+ device->DevChannels[BACK_RIGHT] = 3; break;
+
+ case 6: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[FRONT_CENTER] = 2;
+ device->DevChannels[LFE] = 3;
+ device->DevChannels[BACK_LEFT] = 4;
+ device->DevChannels[BACK_RIGHT] = 5; break;
+
+ case 7: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[FRONT_CENTER] = 2;
+ device->DevChannels[LFE] = 3;
+ device->DevChannels[BACK_CENTER] = 4;
+ device->DevChannels[SIDE_LEFT] = 5;
+ device->DevChannels[SIDE_RIGHT] = 6; break;
+
+ case 8: device->DevChannels[FRONT_LEFT] = 0;
+ device->DevChannels[FRONT_RIGHT] = 1;
+ device->DevChannels[FRONT_CENTER] = 2;
+ device->DevChannels[LFE] = 3;
+ device->DevChannels[BACK_LEFT] = 4;
+ device->DevChannels[BACK_RIGHT] = 5;
+ device->DevChannels[SIDE_LEFT] = 6;
+ device->DevChannels[SIDE_RIGHT] = 7; break;
}
}
diff --git a/Alc/ALu.c b/Alc/ALu.c
index e35d8734..2d5c7c3a 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1395,7 +1395,8 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
case AL_FORMAT_MONO##bits: \
for(i = 0;i < SamplesToDo;i++) \
{ \
- ((type*)buffer)[0] = (func)(DryBuffer[i][ChanMap[0]]); \
+ ((type*)buffer)[ChanMap[FRONT_CENTER]] = \
+ (func)(DryBuffer[i][FRONT_CENTER]);\
buffer = ((type*)buffer) + 1; \
} \
break; \
@@ -1405,11 +1406,11 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
for(i = 0;i < SamplesToDo;i++) \
{ \
float samples[2]; \
- samples[0] = DryBuffer[i][ChanMap[0]]; \
- samples[1] = DryBuffer[i][ChanMap[1]]; \
+ samples[0] = DryBuffer[i][FRONT_LEFT]; \
+ samples[1] = DryBuffer[i][FRONT_RIGHT]; \
bs2b_cross_feed(device->Bs2b, samples); \
- ((type*)buffer)[0] = (func)(samples[0]); \
- ((type*)buffer)[1] = (func)(samples[1]); \
+ ((type*)buffer)[ChanMap[FRONT_LEFT]] = (func)(samples[0]);\
+ ((type*)buffer)[ChanMap[FRONT_RIGHT]] =(func)(samples[1]);\
buffer = ((type*)buffer) + 2; \
} \
} \
@@ -1417,8 +1418,10 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
{ \
for(i = 0;i < SamplesToDo;i++) \
{ \
- ((type*)buffer)[0] = (func)(DryBuffer[i][ChanMap[0]]); \
- ((type*)buffer)[1] = (func)(DryBuffer[i][ChanMap[1]]); \
+ ((type*)buffer)[ChanMap[FRONT_LEFT]] = \
+ (func)(DryBuffer[i][FRONT_LEFT]);\
+ ((type*)buffer)[ChanMap[FRONT_RIGHT]] = \
+ (func)(DryBuffer[i][FRONT_RIGHT]);\
buffer = ((type*)buffer) + 2; \
} \
} \
@@ -1426,49 +1429,71 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
case AL_FORMAT_QUAD##bits: \
for(i = 0;i < SamplesToDo;i++) \
{ \
- ((type*)buffer)[0] = (func)(DryBuffer[i][ChanMap[0]]); \
- ((type*)buffer)[1] = (func)(DryBuffer[i][ChanMap[1]]); \
- ((type*)buffer)[2] = (func)(DryBuffer[i][ChanMap[2]]); \
- ((type*)buffer)[3] = (func)(DryBuffer[i][ChanMap[3]]); \
+ ((type*)buffer)[ChanMap[FRONT_LEFT]] = \
+ (func)(DryBuffer[i][FRONT_LEFT]);\
+ ((type*)buffer)[ChanMap[FRONT_RIGHT]] = \
+ (func)(DryBuffer[i][FRONT_RIGHT]);\
+ ((type*)buffer)[ChanMap[BACK_LEFT]] = \
+ (func)(DryBuffer[i][BACK_LEFT]);\
+ ((type*)buffer)[ChanMap[BACK_RIGHT]] = \
+ (func)(DryBuffer[i][BACK_RIGHT]);\
buffer = ((type*)buffer) + 4; \
} \
break; \
case AL_FORMAT_51CHN##bits: \
for(i = 0;i < SamplesToDo;i++) \
{ \
- ((type*)buffer)[0] = (func)(DryBuffer[i][ChanMap[0]]); \
- ((type*)buffer)[1] = (func)(DryBuffer[i][ChanMap[1]]); \
- ((type*)buffer)[2] = (func)(DryBuffer[i][ChanMap[2]]); \
- ((type*)buffer)[3] = (func)(DryBuffer[i][ChanMap[3]]); \
- ((type*)buffer)[4] = (func)(DryBuffer[i][ChanMap[4]]); \
- ((type*)buffer)[5] = (func)(DryBuffer[i][ChanMap[5]]); \
+ ((type*)buffer)[ChanMap[FRONT_LEFT]] = \
+ (func)(DryBuffer[i][FRONT_LEFT]);\
+ ((type*)buffer)[ChanMap[FRONT_RIGHT]] = \
+ (func)(DryBuffer[i][FRONT_RIGHT]);\
+ ((type*)buffer)[ChanMap[FRONT_CENTER]] = \
+ (func)(DryBuffer[i][FRONT_CENTER]);\
+ ((type*)buffer)[ChanMap[LFE]] = (func)(DryBuffer[i][LFE]); \
+ ((type*)buffer)[ChanMap[BACK_LEFT]] = \
+ (func)(DryBuffer[i][BACK_LEFT]);\
+ ((type*)buffer)[ChanMap[BACK_RIGHT]] = \
+ (func)(DryBuffer[i][BACK_RIGHT]);\
buffer = ((type*)buffer) + 6; \
} \
break; \
case AL_FORMAT_61CHN##bits: \
for(i = 0;i < SamplesToDo;i++) \
{ \
- ((type*)buffer)[0] = (func)(DryBuffer[i][ChanMap[0]]); \
- ((type*)buffer)[1] = (func)(DryBuffer[i][ChanMap[1]]); \
- ((type*)buffer)[2] = (func)(DryBuffer[i][ChanMap[2]]); \
- ((type*)buffer)[3] = (func)(DryBuffer[i][ChanMap[3]]); \
- ((type*)buffer)[4] = (func)(DryBuffer[i][ChanMap[4]]); \
- ((type*)buffer)[5] = (func)(DryBuffer[i][ChanMap[5]]); \
- ((type*)buffer)[6] = (func)(DryBuffer[i][ChanMap[6]]); \
+ ((type*)buffer)[ChanMap[FRONT_LEFT]] = \
+ (func)(DryBuffer[i][FRONT_LEFT]);\
+ ((type*)buffer)[ChanMap[FRONT_RIGHT]] = \
+ (func)(DryBuffer[i][FRONT_RIGHT]);\
+ ((type*)buffer)[ChanMap[FRONT_CENTER]] = \
+ (func)(DryBuffer[i][FRONT_CENTER]);\
+ ((type*)buffer)[ChanMap[LFE]] = (func)(DryBuffer[i][LFE]); \
+ ((type*)buffer)[ChanMap[BACK_CENTER]] = \
+ (func)(DryBuffer[i][BACK_CENTER]);\
+ ((type*)buffer)[ChanMap[SIDE_LEFT]] = \
+ (func)(DryBuffer[i][SIDE_LEFT]);\
+ ((type*)buffer)[ChanMap[SIDE_RIGHT]] = \
+ (func)(DryBuffer[i][SIDE_RIGHT]);\
buffer = ((type*)buffer) + 7; \
} \
break; \
case AL_FORMAT_71CHN##bits: \
for(i = 0;i < SamplesToDo;i++) \
{ \
- ((type*)buffer)[0] = (func)(DryBuffer[i][ChanMap[0]]); \
- ((type*)buffer)[1] = (func)(DryBuffer[i][ChanMap[1]]); \
- ((type*)buffer)[2] = (func)(DryBuffer[i][ChanMap[2]]); \
- ((type*)buffer)[3] = (func)(DryBuffer[i][ChanMap[3]]); \
- ((type*)buffer)[4] = (func)(DryBuffer[i][ChanMap[4]]); \
- ((type*)buffer)[5] = (func)(DryBuffer[i][ChanMap[5]]); \
- ((type*)buffer)[6] = (func)(DryBuffer[i][ChanMap[6]]); \
- ((type*)buffer)[7] = (func)(DryBuffer[i][ChanMap[7]]); \
+ ((type*)buffer)[ChanMap[FRONT_LEFT]] = \
+ (func)(DryBuffer[i][FRONT_LEFT]);\
+ ((type*)buffer)[ChanMap[FRONT_RIGHT]] = \
+ (func)(DryBuffer[i][FRONT_RIGHT]);\
+ ((type*)buffer)[ChanMap[FRONT_CENTER]] = \
+ (func)(DryBuffer[i][FRONT_CENTER]);\
+ ((type*)buffer)[ChanMap[LFE]] = (func)(DryBuffer[i][LFE]); \
+ ((type*)buffer)[ChanMap[BACK_LEFT]] = \
+ (func)(DryBuffer[i][BACK_LEFT]);\
+ ((type*)buffer)[ChanMap[BACK_RIGHT]] = \
+ (func)(DryBuffer[i][BACK_RIGHT]);\
+ ((type*)buffer)[ChanMap[SIDE_LEFT]] = \
+ (func)(DryBuffer[i][SIDE_LEFT]);\
+ ((type*)buffer)[ChanMap[SIDE_RIGHT]] = \
+ (func)(DryBuffer[i][SIDE_RIGHT]);\
buffer = ((type*)buffer) + 8; \
} \
break;
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 7dea61b2..617119ff 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -275,7 +275,7 @@ struct ALCdevice_struct
// Dry path buffer mix
float DryBuffer[BUFFERSIZE][OUTPUTCHANNELS];
- Channel DevChannels[OUTPUTCHANNELS];
+ ALuint DevChannels[OUTPUTCHANNELS];
// Contexts created on this device
ALCcontext **Contexts;