aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-03 21:57:42 -0800
committerChris Robinson <[email protected]>2018-03-03 21:57:42 -0800
commit179e1c4dbc143c9df50676ce538f628690799cd3 (patch)
tree98299a4841c6bb09aef87a72697e4e1651a91974 /Alc/mixer.c
parent945d74cbc9dfa41c325efc029f2a4069dfcf9317 (diff)
Don't check for space in the ringbuffer before trying to write
The write method already checks and returns how much it managed to fit in.
Diffstat (limited to 'Alc/mixer.c')
-rw-r--r--Alc/mixer.c7
1 files changed, 2 insertions, 5 deletions
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;
}