mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-03-01 15:10:43 +00:00
atomically read queue_stored
This commit is contained in:
parent
680fcf1f88
commit
0bf4873ab2
1 changed files with 12 additions and 6 deletions
|
@ -67,9 +67,11 @@ int fluid_rvoice_eventhandler_dispatch_count(fluid_rvoice_eventhandler_t*);
|
|||
static FLUID_INLINE void
|
||||
fluid_rvoice_eventhandler_flush(fluid_rvoice_eventhandler_t* handler)
|
||||
{
|
||||
if (handler->queue_stored > 0) {
|
||||
fluid_ringbuffer_next_inptr(handler->queue, handler->queue_stored);
|
||||
handler->queue_stored = 0;
|
||||
int queue_stored = fluid_atomic_int_get(&handler->queue_stored);
|
||||
|
||||
if (queue_stored > 0) {
|
||||
fluid_atomic_int_set(&handler->queue_stored, 0);
|
||||
fluid_ringbuffer_next_inptr(handler->queue, queue_stored);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,11 +105,15 @@ static FLUID_INLINE void
|
|||
fluid_rvoice_eventhandler_add_rvoice(fluid_rvoice_eventhandler_t* handler,
|
||||
fluid_rvoice_t* rvoice)
|
||||
{
|
||||
if (handler->is_threadsafe)
|
||||
/* always queue events. without it we may run into timing issues, when events are being dispatched
|
||||
* via the sampletimers, without actually rendering it.
|
||||
*/
|
||||
|
||||
// if (handler->is_threadsafe)
|
||||
fluid_rvoice_eventhandler_push_ptr(handler, fluid_rvoice_mixer_add_voice,
|
||||
handler->mixer, rvoice);
|
||||
else
|
||||
fluid_rvoice_mixer_add_voice(handler->mixer, rvoice);
|
||||
// else
|
||||
// fluid_rvoice_mixer_add_voice(handler->mixer, rvoice);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue