From b375897374efa8a80d3324519ce1cda8de0c8044 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 20 Jan 2012 12:20:24 -0800 Subject: Remove an unnecessary else statement --- Alc/ALc.c | 79 ++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 38 insertions(+), 41 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index ff22ad01..e0cb3efc 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -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); -- cgit v1.2.3