Don't re-init and re-allocate some stuff when the device is left running

This commit is contained in:
Chris Robinson 2010-08-07 09:13:51 -07:00
parent 762bdaeee1
commit df822513fa

View File

@ -1559,7 +1559,10 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
device->NumAuxSends = numSends; device->NumAuxSends = numSends;
} }
if(running == AL_FALSE && ALCdevice_ResetPlayback(device) == ALC_FALSE) if(running != AL_FALSE)
goto make_context;
if(ALCdevice_ResetPlayback(device) == ALC_FALSE)
{ {
alcSetError(device, ALC_INVALID_DEVICE); alcSetError(device, ALC_INVALID_DEVICE);
aluHandleDisconnect(device); aluHandleDisconnect(device);
@ -1638,6 +1641,7 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
else else
device->HeadDampen = 0.0f; device->HeadDampen = 0.0f;
make_context:
temp = realloc(device->Contexts, (device->NumContexts+1) * sizeof(*device->Contexts)); temp = realloc(device->Contexts, (device->NumContexts+1) * sizeof(*device->Contexts));
if(!temp) if(!temp)
{ {