aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-02-19 11:54:24 -0800
committerChris Robinson <[email protected]>2012-02-19 11:54:24 -0800
commit1aa69e77e995e348432ff50a93839c2af0060379 (patch)
treed5a3b8b7a73c5c372b8b5e78648c7b6289705827 /Alc/ALc.c
parent6ac16867b43ae039a19f9967294f47d6cc311de0 (diff)
Print a warning if using the 'format' config option
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c95
1 files changed, 49 insertions, 46 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index a08419a9..e0b2c481 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2459,52 +2459,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
device->NumUpdates = 4;
device->UpdateSize = 1024;
- if(ConfigValueStr(NULL, "format", &fmt))
- {
- static const struct {
- const char name[32];
- enum DevFmtChannels channels;
- enum DevFmtType type;
- } formats[] = {
- { "AL_FORMAT_MONO32", DevFmtMono, DevFmtFloat },
- { "AL_FORMAT_STEREO32", DevFmtStereo, DevFmtFloat },
- { "AL_FORMAT_QUAD32", DevFmtQuad, DevFmtFloat },
- { "AL_FORMAT_51CHN32", DevFmtX51, DevFmtFloat },
- { "AL_FORMAT_61CHN32", DevFmtX61, DevFmtFloat },
- { "AL_FORMAT_71CHN32", DevFmtX71, DevFmtFloat },
-
- { "AL_FORMAT_MONO16", DevFmtMono, DevFmtShort },
- { "AL_FORMAT_STEREO16", DevFmtStereo, DevFmtShort },
- { "AL_FORMAT_QUAD16", DevFmtQuad, DevFmtShort },
- { "AL_FORMAT_51CHN16", DevFmtX51, DevFmtShort },
- { "AL_FORMAT_61CHN16", DevFmtX61, DevFmtShort },
- { "AL_FORMAT_71CHN16", DevFmtX71, DevFmtShort },
-
- { "AL_FORMAT_MONO8", DevFmtMono, DevFmtByte },
- { "AL_FORMAT_STEREO8", DevFmtStereo, DevFmtByte },
- { "AL_FORMAT_QUAD8", DevFmtQuad, DevFmtByte },
- { "AL_FORMAT_51CHN8", DevFmtX51, DevFmtByte },
- { "AL_FORMAT_61CHN8", DevFmtX61, DevFmtByte },
- { "AL_FORMAT_71CHN8", DevFmtX71, DevFmtByte }
- };
- size_t i;
-
- for(i = 0;i < sizeof(formats)/sizeof(formats[0]);i++)
- {
- if(strcasecmp(fmt, formats[i].name) == 0)
- {
- if(!(device->Flags&DEVICE_CHANNELS_REQUEST))
- device->FmtChans = formats[i].channels;
- if(!(device->Flags&DEVICE_SAMPLE_TYPE_REQUEST))
- device->FmtType = formats[i].type;
- device->Flags |= DEVICE_CHANNELS_REQUEST |
- DEVICE_SAMPLE_TYPE_REQUEST;
- break;
- }
- }
- if(i == sizeof(formats)/sizeof(formats[0]))
- ERR("Unsupported format: %s\n", fmt);
- }
if(ConfigValueStr(NULL, "channels", &fmt))
{
static const struct {
@@ -2560,6 +2514,55 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
if(i == sizeof(chanlist)/sizeof(chanlist[0]))
ERR("Unsupported sample-type: %s\n", fmt);
}
+#define DEVICE_FORMAT_REQUEST (DEVICE_CHANNELS_REQUEST|DEVICE_SAMPLE_TYPE_REQUEST)
+ if((device->Flags&DEVICE_FORMAT_REQUEST) != DEVICE_FORMAT_REQUEST &&
+ ConfigValueStr(NULL, "format", &fmt))
+ {
+ static const struct {
+ const char name[32];
+ enum DevFmtChannels channels;
+ enum DevFmtType type;
+ } formats[] = {
+ { "AL_FORMAT_MONO32", DevFmtMono, DevFmtFloat },
+ { "AL_FORMAT_STEREO32", DevFmtStereo, DevFmtFloat },
+ { "AL_FORMAT_QUAD32", DevFmtQuad, DevFmtFloat },
+ { "AL_FORMAT_51CHN32", DevFmtX51, DevFmtFloat },
+ { "AL_FORMAT_61CHN32", DevFmtX61, DevFmtFloat },
+ { "AL_FORMAT_71CHN32", DevFmtX71, DevFmtFloat },
+
+ { "AL_FORMAT_MONO16", DevFmtMono, DevFmtShort },
+ { "AL_FORMAT_STEREO16", DevFmtStereo, DevFmtShort },
+ { "AL_FORMAT_QUAD16", DevFmtQuad, DevFmtShort },
+ { "AL_FORMAT_51CHN16", DevFmtX51, DevFmtShort },
+ { "AL_FORMAT_61CHN16", DevFmtX61, DevFmtShort },
+ { "AL_FORMAT_71CHN16", DevFmtX71, DevFmtShort },
+
+ { "AL_FORMAT_MONO8", DevFmtMono, DevFmtByte },
+ { "AL_FORMAT_STEREO8", DevFmtStereo, DevFmtByte },
+ { "AL_FORMAT_QUAD8", DevFmtQuad, DevFmtByte },
+ { "AL_FORMAT_51CHN8", DevFmtX51, DevFmtByte },
+ { "AL_FORMAT_61CHN8", DevFmtX61, DevFmtByte },
+ { "AL_FORMAT_71CHN8", DevFmtX71, DevFmtByte }
+ };
+ size_t i;
+
+ ERR("Option 'format' is deprecated, please use 'channels' and 'sample-type'\n");
+ for(i = 0;i < sizeof(formats)/sizeof(formats[0]);i++)
+ {
+ if(strcasecmp(fmt, formats[i].name) == 0)
+ {
+ if(!(device->Flags&DEVICE_CHANNELS_REQUEST))
+ device->FmtChans = formats[i].channels;
+ if(!(device->Flags&DEVICE_SAMPLE_TYPE_REQUEST))
+ device->FmtType = formats[i].type;
+ device->Flags |= DEVICE_FORMAT_REQUEST;
+ break;
+ }
+ }
+ if(i == sizeof(formats)/sizeof(formats[0]))
+ ERR("Unsupported format: %s\n", fmt);
+ }
+#undef DEVICE_FORMAT_REQUEST
if(ConfigValueUInt(NULL, "frequency", &device->Frequency))
{