aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-11-15 01:27:53 -0800
committerChris Robinson <[email protected]>2007-11-15 01:27:53 -0800
commitf3d9421e908000e8dbef47d9b5085ae20ff67a2f (patch)
tree4522fa8bf2dbf4310fc96d062e29a7a33bdf9272
parent7395be8d23866639c067ba0fdd61ed4351eab96c (diff)
Use aluBytesFromFormat and aluChannelsFromFormat to get the channel count and frame size
-rw-r--r--Alc/ALc.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 2adcbb8e..20e3e2db 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1014,38 +1014,17 @@ ALCAPI ALCdevice* ALCAPIENTRY alcOpenDevice(const ALCchar *deviceName)
fmt = GetConfigValue(NULL, "format", "AL_FORMAT_STEREO16");
if(fmt[0])
device->Format = alGetEnumValue(fmt);
- switch(device->Format)
+
+ device->Channels = aluChannelsFromFormat(device->Format);
+ if(!device->Channels)
{
- case AL_FORMAT_MONO8:
- device->Channels = 1;
- device->FrameSize = 1;
- break;
- case AL_FORMAT_STEREO8:
- device->Channels = 2;
- device->FrameSize = 2;
- break;
- case AL_FORMAT_QUAD8:
- device->Channels = 4;
- device->FrameSize = 4;
- break;
- case AL_FORMAT_MONO16:
- device->Channels = 1;
- device->FrameSize = 2;
- break;
- case AL_FORMAT_STEREO16:
- device->Channels = 2;
- device->FrameSize = 4;
- break;
- case AL_FORMAT_QUAD16:
- device->Channels = 4;
- device->FrameSize = 8;
- break;
- default:
- device->Format = AL_FORMAT_STEREO16;
- device->Channels = 2;
- device->FrameSize = 4;
- break;
+ device->Format = AL_FORMAT_STEREO16;
+ device->Channels = 2;
+ device->FrameSize = 4;
}
+ else
+ device->FrameSize = aluBytesFromFormat(device->Format) *
+ device->Channels;
device->UpdateFreq = GetConfigValueInt(NULL, "refresh", 0);
if((ALint)device->UpdateFreq <= 0)