aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c79
1 files 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);