diff options
-rw-r--r-- | Alc/ALc.c | 79 |
1 files changed, 38 insertions, 41 deletions
@@ -1043,6 +1043,9 @@ static void alcSetError(ALCdevice *device, ALCenum errorCode) static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { ALCcontext *context; + enum DevFmtChannels oldChans; + enum DevFmtType oldType; + ALCuint oldFreq; int oldMode; ALuint i; @@ -1148,52 +1151,46 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if((device->Flags&DEVICE_RUNNING)) return ALC_TRUE; - else - { - enum DevFmtChannels schans; - enum DevFmtType stype; - ALCuint freq; - - LockDevice(device); - freq = device->Frequency; - schans = device->FmtChans; - stype = device->FmtType; + 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) - { - UnlockDevice(device); - return ALC_FALSE; - } - device->Flags |= DEVICE_RUNNING; + oldFreq = device->Frequency; + oldChans = device->FmtChans; + oldType = device->FmtType; - 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 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; - 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); + if(device->FmtChans != oldChans) + { + if((device->Flags&DEVICE_CHANNELS_REQUEST)) + ERR("Failed to set %s, got %s instead\n", + DevFmtChannelsString(oldChans), + DevFmtChannelsString(device->FmtChans)); + device->Flags &= ~DEVICE_CHANNELS_REQUEST; } + if(device->Frequency != oldFreq) + { + if((device->Flags&DEVICE_FREQUENCY_REQUEST)) + ERR("Failed to set %uhz, got %uhz instead\n", + oldFreq, 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); aluInitPanning(device); |