aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c3
-rw-r--r--Alc/ALu.c11
-rw-r--r--Alc/mixer.c7
-rw-r--r--OpenAL32/alSource.c5
-rw-r--r--OpenAL32/event.c3
5 files changed, 10 insertions, 19 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index ab21c356..0cde449e 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2749,9 +2749,8 @@ static void FreeContext(ALCcontext *context)
if(ATOMIC_EXCHANGE(&context->EnabledEvts, 0, almemory_order_acq_rel))
{
static const AsyncEvent kill_evt = { 0 };
- while(ll_ringbuffer_write_space(context->AsyncEvents) == 0)
+ while(ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1) == 0)
althrd_yield();
- ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1);
alsem_post(&context->EventSem);
althrd_join(context->EventThread, NULL);
}
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 57f4188b..f1b958e5 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -238,9 +238,8 @@ static void SendSourceStoppedEvent(ALCcontext *context, ALuint id)
}
strcpy(evt.Message+strpos, " state changed to AL_STOPPED");
- if(ll_ringbuffer_write_space(context->AsyncEvents) > 0)
- ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1);
- alsem_post(&context->EventSem);
+ if(ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1) == 1)
+ alsem_post(&context->EventSem);
}
@@ -1942,11 +1941,9 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...)
ALbitfieldSOFT enabledevt = ATOMIC_LOAD(&ctx->EnabledEvts, almemory_order_acquire);
ALsizei i;
- if((enabledevt&EventType_Disconnected) && ll_ringbuffer_write_space(ctx->AsyncEvents) > 0)
- {
- ll_ringbuffer_write(ctx->AsyncEvents, (const char*)&evt, 1);
+ if((enabledevt&EventType_Disconnected) &&
+ ll_ringbuffer_write(ctx->AsyncEvents, (const char*)&evt, 1) == 1)
alsem_post(&ctx->EventSem);
- }
for(i = 0;i < ctx->VoiceCount;i++)
{
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 96a5335b..7a7bbfe0 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -203,8 +203,8 @@ static void SendAsyncEvent(ALCcontext *context, ALuint enumtype, ALenum type,
evt.ObjectId = objid;
evt.Param = param;
strcpy(evt.Message, msg);
- if(ll_ringbuffer_write_space(context->AsyncEvents) > 0)
- ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1);
+ if(ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1) == 1)
+ alsem_post(&context->EventSem);
}
@@ -773,12 +773,9 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize
/* Send any events now, after the position/buffer info was updated. */
enabledevt = ATOMIC_LOAD(&Context->EnabledEvts, almemory_order_acquire);
if(buffers_done > 0 && (enabledevt&EventType_BufferCompleted))
- {
SendAsyncEvent(Context, EventType_BufferCompleted,
AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT, SourceID, buffers_done, "Buffer completed"
);
- alsem_post(&Context->EventSem);
- }
return isplaying;
}
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 02511382..40b2c494 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -248,9 +248,8 @@ static void SendStateChangeEvent(ALCcontext *context, ALuint id, ALenum state)
* and we don't want state change messages to occur out of order, so send
* it through the async queue to ensure proper ordering.
*/
- if(ll_ringbuffer_write_space(context->AsyncEvents) > 0)
- ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1);
- alsem_post(&context->EventSem);
+ if(ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1) == 1)
+ alsem_post(&context->EventSem);
}
diff --git a/OpenAL32/event.c b/OpenAL32/event.c
index 1189e889..12636489 100644
--- a/OpenAL32/event.c
+++ b/OpenAL32/event.c
@@ -102,9 +102,8 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A
if(isrunning && !(enabledevts&~flags))
{
static const AsyncEvent kill_evt = { 0 };
- while(ll_ringbuffer_write_space(context->AsyncEvents) == 0)
+ while(ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1) == 0)
althrd_yield();
- ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1);
alsem_post(&context->EventSem);
althrd_join(context->EventThread, NULL);
}