aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALu.c3
-rw-r--r--OpenAL32/Include/alMain.h7
2 files changed, 10 insertions, 0 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index ca38e737..85cb6332 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1039,6 +1039,8 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
while(size > 0)
{
+ IncrementRef(&device->MixCount);
+
SamplesToDo = minu(size, BUFFERSIZE);
for(c = 0;c < MaxChannels;c++)
memset(device->DryBuffer[c], 0, SamplesToDo*sizeof(ALfloat));
@@ -1228,6 +1230,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
}
size -= SamplesToDo;
+ IncrementRef(&device->MixCount);
}
RestoreFPUMode(&oldMode);
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 1d5eb888..b62ad9c7 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -668,6 +668,13 @@ struct ALCdevice_struct
ALIGN(16) ALfloat ClickRemoval[MaxChannels];
ALIGN(16) ALfloat PendingClicks[MaxChannels];
+ /* Running count of the mixer invocations, in 31.1 fixed point. This
+ * actually increments *twice* when mixing, first at the start and then at
+ * the end, so the bottom bit indicates if the device is currently mixing
+ * and the upper bits indicates how many mixes have been done.
+ */
+ volatile RefCount MixCount;
+
/* Default effect slot */
struct ALeffectslot *DefaultSlot;