Allow sources to play while alcSuspendContext is in effect
This appears to be how Creative's Windows drivers handle it, and is necessary for at least the Windows version of UT2k4 (otherwise it tries to play a source while suspended, checks and sees it's stopped, then kills it before it's given a chance to start playing). Consequently, the internal properties it gets mixed with are determined by what the source properties are at the time of the play call, and the listener properties at the time of the suspend call. This does not change alDeferUpdatesSOFT, which will still hold the play state change until alProcessUpdatesSOFT.
This commit is contained in:
@@ -1584,9 +1584,9 @@ extern inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS
|
||||
* does *NOT* stop mixing, but rather prevents certain property changes from
|
||||
* taking effect.
|
||||
*/
|
||||
void ALCcontext_DeferUpdates(ALCcontext *context)
|
||||
void ALCcontext_DeferUpdates(ALCcontext *context, ALenum type)
|
||||
{
|
||||
ATOMIC_STORE(&context->DeferUpdates, AL_TRUE);
|
||||
ATOMIC_STORE(&context->DeferUpdates, type);
|
||||
}
|
||||
|
||||
/* ALCcontext_ProcessUpdates
|
||||
@@ -2545,7 +2545,7 @@ ALC_API ALCvoid ALC_APIENTRY alcSuspendContext(ALCcontext *context)
|
||||
alcSetError(NULL, ALC_INVALID_CONTEXT);
|
||||
else
|
||||
{
|
||||
ALCcontext_DeferUpdates(context);
|
||||
ALCcontext_DeferUpdates(context, DeferAllowPlay);
|
||||
ALCcontext_DecRef(context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ void AppendCaptureDeviceList(const ALCchar *name);
|
||||
void ALCdevice_Lock(ALCdevice *device);
|
||||
void ALCdevice_Unlock(ALCdevice *device);
|
||||
|
||||
void ALCcontext_DeferUpdates(ALCcontext *context);
|
||||
void ALCcontext_DeferUpdates(ALCcontext *context, ALenum type);
|
||||
void ALCcontext_ProcessUpdates(ALCcontext *context);
|
||||
|
||||
inline void LockContext(ALCcontext *context)
|
||||
@@ -781,6 +781,12 @@ inline void LockContext(ALCcontext *context)
|
||||
inline void UnlockContext(ALCcontext *context)
|
||||
{ ALCdevice_Unlock(context->Device); }
|
||||
|
||||
enum {
|
||||
DeferOff = AL_FALSE,
|
||||
DeferAll,
|
||||
DeferAllowPlay
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
#ifdef HAVE_FENV_H
|
||||
|
||||
+1
-1
@@ -2316,7 +2316,7 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
|
||||
context->MaxVoices = newcount;
|
||||
}
|
||||
|
||||
if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
|
||||
if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
|
||||
{
|
||||
for(i = 0;i < n;i++)
|
||||
{
|
||||
|
||||
+11
-6
@@ -150,7 +150,8 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname)
|
||||
break;
|
||||
|
||||
case AL_DEFERRED_UPDATES_SOFT:
|
||||
value = ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire);
|
||||
if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
|
||||
value = AL_TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -190,7 +191,8 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname)
|
||||
break;
|
||||
|
||||
case AL_DEFERRED_UPDATES_SOFT:
|
||||
value = (ALdouble)ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire);
|
||||
if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
|
||||
value = (ALdouble)AL_TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -230,7 +232,8 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname)
|
||||
break;
|
||||
|
||||
case AL_DEFERRED_UPDATES_SOFT:
|
||||
value = (ALfloat)ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire);
|
||||
if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
|
||||
value = (ALfloat)AL_TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -270,7 +273,8 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
|
||||
break;
|
||||
|
||||
case AL_DEFERRED_UPDATES_SOFT:
|
||||
value = (ALint)ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire);
|
||||
if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
|
||||
value = (ALint)AL_TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -310,7 +314,8 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname)
|
||||
break;
|
||||
|
||||
case AL_DEFERRED_UPDATES_SOFT:
|
||||
value = (ALint64SOFT)ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire);
|
||||
if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll)
|
||||
value = (ALint64SOFT)AL_TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -638,7 +643,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
|
||||
context = GetContextRef();
|
||||
if(!context) return;
|
||||
|
||||
ALCcontext_DeferUpdates(context);
|
||||
ALCcontext_DeferUpdates(context, DeferAll);
|
||||
|
||||
ALCcontext_DecRef(context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user