From 679f2480c9a66905b0a03c99e099b59bfd07879d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 3 May 2011 17:11:07 -0700 Subject: Add a device flag for channel config requests --- Alc/coreaudio.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'Alc/coreaudio.c') diff --git a/Alc/coreaudio.c b/Alc/coreaudio.c index 2ca9802b..1d086926 100644 --- a/Alc/coreaudio.c +++ b/Alc/coreaudio.c @@ -172,25 +172,62 @@ static ALCboolean ca_reset_playback(ALCdevice *device) switch(streamFormat.mChannelsPerFrame) { case 1: + if((device->Flags&DEVICE_CHANNELS_REQUEST) && + device->FmtChans != DevFmtMono) + { + AL_PRINT("Failed to set requested channel config %#x, got mono instead\n", device->FmtChans); + device->Flags &= ~DEVICE_CHANNELS_REQUEST; + } device->FmtChans = DevFmtMono; break; case 2: + if((device->Flags&DEVICE_CHANNELS_REQUEST) && + device->FmtChans != DevFmtStereo) + { + AL_PRINT("Failed to set requested channel config %#x, got stereo instead\n", device->FmtChans); + device->Flags &= ~DEVICE_CHANNELS_REQUEST; + } device->FmtChans = DevFmtStereo; break; case 4: + if((device->Flags&DEVICE_CHANNELS_REQUEST) && + device->FmtChans != DevFmtQuad) + { + AL_PRINT("Failed to set requested channel config %#x, got quad instead\n", device->FmtChans); + device->Flags &= ~DEVICE_CHANNELS_REQUEST; + } device->FmtChans = DevFmtQuad; break; case 6: + if((device->Flags&DEVICE_CHANNELS_REQUEST) && + device->FmtChans != DevFmtX51) + { + AL_PRINT("Failed to set requested channel config %#x, got 5.1 instead\n", device->FmtChans); + device->Flags &= ~DEVICE_CHANNELS_REQUEST; + } device->FmtChans = DevFmtX51; break; case 7: + if((device->Flags&DEVICE_CHANNELS_REQUEST) && + device->FmtChans != DevFmtX61) + { + AL_PRINT("Failed to set requested channel config %#x, got 6.1 instead\n", device->FmtChans); + device->Flags &= ~DEVICE_CHANNELS_REQUEST; + } device->FmtChans = DevFmtX61; break; case 8: + if((device->Flags&DEVICE_CHANNELS_REQUEST) && + device->FmtChans != DevFmtX71) + { + AL_PRINT("Failed to set requested channel config %#x, got 7.1 instead\n", device->FmtChans); + device->Flags &= ~DEVICE_CHANNELS_REQUEST; + } device->FmtChans = DevFmtX71; break; default: AL_PRINT("Unhandled channel count (%d), using stereo\n", streamFormat.mChannelsPerFrame); + device->Flags &= ~DEVICE_CHANNELS_REQUEST; device->FmtChans = DevFmtStereo; streamFormat.mChannelsPerFrame = 2; break; -- cgit v1.2.3