aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index b8e34198..2bb502eb 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -507,6 +507,87 @@ void EnableRTPrio(ALint level)
AL_PRINT("Failed to set priority level for thread\n");
}
+static void SetupChannelMatrix(ALCdevice *Device)
+{
+ ALuint s, s2;
+
+ for(s = 0;s < OUTPUTCHANNELS;s++)
+ {
+ for(s2 = 0;s2 < OUTPUTCHANNELS;s2++)
+ Device->ChannelMatrix[s][s2] = ((s==s2) ? 1.0f : 0.0f);
+ }
+
+ switch(Device->Format)
+ {
+ case AL_FORMAT_MONO8:
+ case AL_FORMAT_MONO16:
+ case AL_FORMAT_MONO_FLOAT32:
+ Device->ChannelMatrix[FRONT_LEFT][FRONT_CENTER] = aluSqrt(0.5);
+ Device->ChannelMatrix[FRONT_RIGHT][FRONT_CENTER] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_LEFT][FRONT_CENTER] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_RIGHT][FRONT_CENTER] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_LEFT][FRONT_CENTER] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_RIGHT][FRONT_CENTER] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_CENTER][FRONT_CENTER] = 1.0f;
+ break;
+
+ case AL_FORMAT_STEREO8:
+ case AL_FORMAT_STEREO16:
+ case AL_FORMAT_STEREO_FLOAT32:
+ Device->ChannelMatrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_LEFT][FRONT_LEFT] = 1.0f;
+ Device->ChannelMatrix[SIDE_RIGHT][FRONT_RIGHT] = 1.0f;
+ Device->ChannelMatrix[BACK_LEFT][FRONT_LEFT] = 1.0f;
+ Device->ChannelMatrix[BACK_RIGHT][FRONT_RIGHT] = 1.0f;
+ Device->ChannelMatrix[BACK_CENTER][FRONT_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_CENTER][FRONT_RIGHT] = aluSqrt(0.5);
+ break;
+
+ case AL_FORMAT_QUAD8:
+ case AL_FORMAT_QUAD16:
+ case AL_FORMAT_QUAD32:
+ Device->ChannelMatrix[FRONT_CENTER][FRONT_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[FRONT_CENTER][FRONT_RIGHT] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_LEFT][FRONT_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_LEFT][BACK_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_RIGHT][FRONT_RIGHT] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_RIGHT][BACK_RIGHT] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_CENTER][BACK_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(0.5);
+ break;
+
+ case AL_FORMAT_51CHN8:
+ case AL_FORMAT_51CHN16:
+ case AL_FORMAT_51CHN32:
+ Device->ChannelMatrix[SIDE_LEFT][FRONT_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_LEFT][BACK_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_RIGHT][FRONT_RIGHT] = aluSqrt(0.5);
+ Device->ChannelMatrix[SIDE_RIGHT][BACK_RIGHT] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_CENTER][BACK_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(0.5);
+ break;
+
+ case AL_FORMAT_61CHN8:
+ case AL_FORMAT_61CHN16:
+ case AL_FORMAT_61CHN32:
+ Device->ChannelMatrix[BACK_LEFT][BACK_CENTER] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_LEFT][SIDE_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_RIGHT][BACK_CENTER] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_RIGHT][SIDE_RIGHT] = aluSqrt(0.5);
+ break;
+
+ case AL_FORMAT_71CHN8:
+ case AL_FORMAT_71CHN16:
+ case AL_FORMAT_71CHN32:
+ Device->ChannelMatrix[BACK_CENTER][BACK_LEFT] = aluSqrt(0.5);
+ Device->ChannelMatrix[BACK_CENTER][BACK_RIGHT] = aluSqrt(0.5);
+ break;
+
+ default:
+ assert(0);
+ }
+}
/*
IsDevice
@@ -1283,6 +1364,7 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
ProcessContext(NULL);
return NULL;
}
+ SetupChannelMatrix(device);
for(i = 0;i < device->NumContexts;i++)
{