always enforce enqueuing rvoice_events

This commit is contained in:
derselbst 2017-08-27 12:43:24 +02:00
parent 1bb6210f91
commit ef9564e000
2 changed files with 7 additions and 8 deletions

View File

@ -233,7 +233,13 @@ new_fluid_rvoice_eventhandler(int is_threadsafe, int queuesize,
eventhandler->mixer = NULL; eventhandler->mixer = NULL;
eventhandler->queue = NULL; eventhandler->queue = NULL;
eventhandler->finished_voices = NULL; eventhandler->finished_voices = NULL;
eventhandler->is_threadsafe = is_threadsafe;
/* HACK 2017-08-27: always enforce threadsafety, i.e. enforce enqueuing events
* otherwise we mess up rendering if more than one block is requested by the user
* because fluid_rvoice_eventhandler_dispatch_count() always stays zero causing
* that too many events are dispatched too early, causing incorrectly timed audio
*/
eventhandler->is_threadsafe = TRUE;
eventhandler->queue_stored = 0; eventhandler->queue_stored = 0;
eventhandler->finished_voices = new_fluid_ringbuffer(finished_voices_size, eventhandler->finished_voices = new_fluid_ringbuffer(finished_voices_size,

View File

@ -2939,17 +2939,10 @@ fluid_synth_render_blocks(fluid_synth_t* synth, int blockcount)
fluid_rvoice_eventhandler_dispatch_all(synth->eventhandler); fluid_rvoice_eventhandler_dispatch_all(synth->eventhandler);
#if 0
/* do not render more blocks than we can store internally */ /* do not render more blocks than we can store internally */
maxblocks = fluid_rvoice_mixer_get_bufcount(synth->eventhandler->mixer); maxblocks = fluid_rvoice_mixer_get_bufcount(synth->eventhandler->mixer);
if (blockcount > maxblocks) if (blockcount > maxblocks)
blockcount = maxblocks; blockcount = maxblocks;
#else
/* if we process more blocks, noteons will be timed incorrectly
* this bug seems to be design made, i.e. the current implementation requires to
* process all events for one block and then render whatever we just processed. */
blockcount = 1;
#endif
for (i=0; i < blockcount; i++) { for (i=0; i < blockcount; i++) {
fluid_sample_timer_process(synth); fluid_sample_timer_process(synth);