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.
This commit is contained in:
parent
8d7559d9d0
commit
50b74629dd
@ -1925,9 +1925,12 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
||||
ALCdevice_Unlock(device);
|
||||
RestoreFPUMode(&oldMode);
|
||||
|
||||
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);
|
||||
|
@ -657,6 +657,9 @@ struct ALCdevice_struct
|
||||
// Stereo sources cover 120-degree angles around +/-90
|
||||
#define DEVICE_WIDE_STEREO (1<<16)
|
||||
|
||||
// Specifies if the DSP is paused at user request
|
||||
#define DEVICE_PAUSED (1<<30)
|
||||
|
||||
// Specifies if the device is currently running
|
||||
#define DEVICE_RUNNING (1<<31)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user