aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-08-12 17:24:55 -0700
committerChris Robinson <[email protected]>2010-08-12 17:24:55 -0700
commit928572d384518858c9f7fa0e6c1ae445a943567d (patch)
treedee2a11a15b20a765a64215253ab5c1c3a5a498c
parent2d1988bb6ffaec62de849cce694a5fec30188997 (diff)
Start the device when creating a context without specified attributes
-rw-r--r--Alc/ALc.c94
1 files changed, 49 insertions, 45 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 3bc7be78..72106824 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -827,66 +827,70 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
ALuint attrIdx;
ALuint i;
- // Check for attributes
- if(!attrList || !attrList[0])
- return ALC_TRUE;
-
running = ((device->NumContexts > 0) ? AL_TRUE : AL_FALSE);
oldRate = device->Frequency;
- // If a context is already running on the device, stop playback so the
- // device attributes can be updated
- if(running)
- {
- ProcessContext(NULL);
- ALCdevice_StopPlayback(device);
- SuspendContext(NULL);
- running = AL_FALSE;
- }
-
- freq = device->Frequency;
- numMono = device->NumMonoSources;
- numStereo = device->NumStereoSources;
- numSends = device->NumAuxSends;
-
- attrIdx = 0;
- while(attrList[attrIdx])
+ // Check for attributes
+ if(attrList && attrList[0])
{
- if(attrList[attrIdx] == ALC_FREQUENCY &&
- !ConfigValueExists(NULL, "frequency"))
+ // If a context is already running on the device, stop playback so the
+ // device attributes can be updated
+ if(running)
{
- freq = attrList[attrIdx + 1];
- if(freq < 8000)
- freq = 8000;
+ ProcessContext(NULL);
+ ALCdevice_StopPlayback(device);
+ SuspendContext(NULL);
+ running = AL_FALSE;
}
- if(attrList[attrIdx] == ALC_STEREO_SOURCES)
+ freq = device->Frequency;
+ numMono = device->NumMonoSources;
+ numStereo = device->NumStereoSources;
+ numSends = device->NumAuxSends;
+
+ attrIdx = 0;
+ while(attrList[attrIdx])
{
- numStereo = attrList[attrIdx + 1];
- if(numStereo > device->MaxNoOfSources)
- numStereo = device->MaxNoOfSources;
+ if(attrList[attrIdx] == ALC_FREQUENCY &&
+ !ConfigValueExists(NULL, "frequency"))
+ {
+ freq = attrList[attrIdx + 1];
+ if(freq < 8000)
+ freq = 8000;
+ }
- numMono = device->MaxNoOfSources - numStereo;
- }
+ if(attrList[attrIdx] == ALC_STEREO_SOURCES)
+ {
+ numStereo = attrList[attrIdx + 1];
+ if(numStereo > device->MaxNoOfSources)
+ numStereo = device->MaxNoOfSources;
- if(attrList[attrIdx] == ALC_MAX_AUXILIARY_SENDS &&
- !ConfigValueExists(NULL, "sends"))
- {
- numSends = attrList[attrIdx + 1];
- if(numSends > MAX_SENDS)
- numSends = MAX_SENDS;
+ numMono = device->MaxNoOfSources - numStereo;
+ }
+
+ if(attrList[attrIdx] == ALC_MAX_AUXILIARY_SENDS &&
+ !ConfigValueExists(NULL, "sends"))
+ {
+ numSends = attrList[attrIdx + 1];
+ if(numSends > MAX_SENDS)
+ numSends = MAX_SENDS;
+ }
+
+ attrIdx += 2;
}
- attrIdx += 2;
+ device->UpdateSize = (ALuint64)device->UpdateSize * freq /
+ device->Frequency;
+
+ device->Frequency = freq;
+ device->NumMonoSources = numMono;
+ device->NumStereoSources = numStereo;
+ device->NumAuxSends = numSends;
}
- device->UpdateSize = (ALuint64)device->UpdateSize * freq /
- device->Frequency;
+ if(running)
+ return ALC_TRUE;
- device->Frequency = freq;
- device->NumMonoSources = numMono;
- device->NumStereoSources = numStereo;
- device->NumAuxSends = numSends;
if(ALCdevice_ResetPlayback(device) == ALC_FALSE)
return ALC_FALSE;