From 50b74629ddcbc7c8adf38ff5a02c3ee5162789a1 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 15 Jan 2014 16:44:12 -0800 Subject: Add a flag to specify the device being paused Used to prevent UpdateDeviceParams from restarting the device, if a new context is created while paused. --- Alc/ALc.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'Alc/ALc.c') diff --git a/Alc/ALc.c b/Alc/ALc.c index 458a6874..fea0320d 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1925,9 +1925,12 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) ALCdevice_Unlock(device); RestoreFPUMode(&oldMode); - if(V0(device->Backend,start)() == ALC_FALSE) - return ALC_INVALID_DEVICE; - device->Flags |= DEVICE_RUNNING; + if(!(device->Flags&DEVICE_PAUSED)) + { + if(V0(device->Backend,start)() == ALC_FALSE) + return ALC_INVALID_DEVICE; + device->Flags |= DEVICE_RUNNING; + } return ALC_NO_ERROR; } @@ -3515,6 +3518,7 @@ ALC_API void ALC_APIENTRY alcDevicePauseSOFT(ALCdevice *device) if((device->Flags&DEVICE_RUNNING)) V0(device->Backend,stop)(); device->Flags &= ~DEVICE_RUNNING; + device->Flags |= DEVICE_PAUSED; UnlockLists(); } if(device) ALCdevice_DecRef(device); @@ -3531,10 +3535,13 @@ ALC_API void ALC_APIENTRY alcDeviceResumeSOFT(ALCdevice *device) else { LockLists(); - if(device->ContextList) + if((device->Flags&DEVICE_PAUSED)) { if(V0(device->Backend,start)() != ALC_FALSE) + { device->Flags |= DEVICE_RUNNING; + device->Flags &= ~DEVICE_PAUSED; + } else { alcSetError(device, ALC_INVALID_DEVICE); -- cgit v1.2.3