diff options
author | Chris Robinson <[email protected]> | 2014-01-15 16:44:12 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-01-15 16:44:12 -0800 |
commit | 50b74629ddcbc7c8adf38ff5a02c3ee5162789a1 (patch) | |
tree | 7f5a2dff9b0e8f6d8ac17591e3cffde3cda23583 /Alc/ALc.c | |
parent | 8d7559d9d00c66213471538632b389ad289b31a0 (diff) |
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.
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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); |