From 5a2a5342403ca99a4613a56f69c95ed5ce91f8b2 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 17 Jan 2012 15:55:37 -0800 Subject: Report parameter request changes in UpdateDeviceParams --- Alc/ALc.c | 62 ++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 18 deletions(-) (limited to 'Alc') diff --git a/Alc/ALc.c b/Alc/ALc.c index b6a01c57..3505bfc4 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1139,26 +1139,52 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if((device->Flags&DEVICE_RUNNING)) return ALC_TRUE; - - LockDevice(device); - TRACE("Format pre-setup: %s%s, %s, %uhz%s, %u update size x%d\n", - DevFmtChannelsString(device->FmtChans), - (device->Flags&DEVICE_CHANNELS_REQUEST)?" (requested)":"", - DevFmtTypeString(device->FmtType), device->Frequency, - (device->Flags&DEVICE_FREQUENCY_REQUEST)?" (requested)":"", - device->UpdateSize, device->NumUpdates); - if(ALCdevice_ResetPlayback(device) == ALC_FALSE) + else { - UnlockDevice(device); - return ALC_FALSE; + enum DevFmtChannels schans; + enum DevFmtType stype; + ALCuint freq; + + LockDevice(device); + + freq = device->Frequency; + schans = device->FmtChans; + stype = device->FmtType; + + TRACE("Format pre-setup: %s%s, %s, %uhz%s, %u update size x%d\n", + DevFmtChannelsString(device->FmtChans), + (device->Flags&DEVICE_CHANNELS_REQUEST)?" (requested)":"", + DevFmtTypeString(device->FmtType), device->Frequency, + (device->Flags&DEVICE_FREQUENCY_REQUEST)?" (requested)":"", + device->UpdateSize, device->NumUpdates); + if(ALCdevice_ResetPlayback(device) == ALC_FALSE) + { + UnlockDevice(device); + return ALC_FALSE; + } + device->Flags |= DEVICE_RUNNING; + + if(device->FmtChans != schans) + { + if((device->Flags&DEVICE_CHANNELS_REQUEST)) + ERR("Failed to set %s, got %s instead\n", + DevFmtChannelsString(schans), + DevFmtChannelsString(device->FmtChans)); + device->Flags &= ~DEVICE_CHANNELS_REQUEST; + } + if(device->Frequency != freq) + { + if((device->Flags&DEVICE_FREQUENCY_REQUEST)) + ERR("Failed to set %uhz, got %uhz instead\n", + freq, device->Frequency); + device->Flags &= ~DEVICE_FREQUENCY_REQUEST; + } + + TRACE("Format post-setup: %s, %s, %uhz, %u update size x%d\n", + DevFmtChannelsString(device->FmtChans), + DevFmtTypeString(device->FmtType), device->Frequency, + device->UpdateSize, device->NumUpdates); } - device->Flags |= DEVICE_RUNNING; - TRACE("Format post-setup: %s%s, %s, %uhz%s, %u update size x%d\n", - DevFmtChannelsString(device->FmtChans), - (device->Flags&DEVICE_CHANNELS_REQUEST)?" (requested)":"", - DevFmtTypeString(device->FmtType), device->Frequency, - (device->Flags&DEVICE_FREQUENCY_REQUEST)?" (requested)":"", - device->UpdateSize, device->NumUpdates); aluInitPanning(device); -- cgit v1.2.3