expose a getter for bufcount for rvoice_mixer

This commit is contained in:
derselbst 2017-08-19 22:01:47 +02:00
parent 8d952d1e59
commit 6c3061cba3
3 changed files with 13 additions and 8 deletions

View File

@ -710,6 +710,10 @@ int fluid_rvoice_mixer_get_fx_bufs(fluid_rvoice_mixer_t* mixer,
return mixer->buffers.fx_buf_count;
}
int fluid_rvoice_mixer_get_bufcount(fluid_rvoice_mixer_t* mixer)
{
return mixer->buffers.buf_blocks;
}
#ifdef ENABLE_MIXER_THREADS

View File

@ -42,6 +42,7 @@ int fluid_rvoice_mixer_get_bufs(fluid_rvoice_mixer_t* mixer,
fluid_real_t*** left, fluid_real_t*** right);
int fluid_rvoice_mixer_get_fx_bufs(fluid_rvoice_mixer_t* mixer,
fluid_real_t*** fx_left, fluid_real_t*** fx_right);
int fluid_rvoice_mixer_get_bufcount(fluid_rvoice_mixer_t* mixer);
fluid_rvoice_mixer_t* new_fluid_rvoice_mixer(int buf_count, int fx_buf_count,
fluid_real_t sample_rate);

View File

@ -2929,7 +2929,7 @@ void fluid_synth_process_event_queue(fluid_synth_t* synth)
static int
fluid_synth_render_blocks(fluid_synth_t* synth, int blockcount)
{
int i;
int i, maxblocks;
fluid_profile_ref_var (prof_ref);
/* Assign ID of synthesis thread */
@ -2939,19 +2939,19 @@ fluid_synth_render_blocks(fluid_synth_t* synth, int blockcount)
fluid_rvoice_eventhandler_dispatch_all(synth->eventhandler);
/* do not render more blocks than we can store internally */
maxblocks = fluid_rvoice_mixer_get_bufcount(synth->eventhandler->mixer);
if (blockcount > maxblocks)
blockcount = maxblocks;
for (i=0; i < blockcount; i++) {
fluid_sample_timer_process(synth);
fluid_synth_add_ticks(synth, FLUID_BUFSIZE);
/* If events have been queued waiting for fluid_rvoice_eventhandler_dispatch_all()
* (should only happen with parallel render) OR we are about to process more
* blocks than we can store internally (being at risk having already dispatched many rvoices,
* because we may not be using parallel render), stop processing and go for rendering
* (should only happen with parallel render) stop processing and go for rendering
*/
if (fluid_rvoice_eventhandler_dispatch_count(synth->eventhandler)
|| i+1 >= FLUID_MIXER_MAX_BUFFERS_DEFAULT-1 /* there actually is one 1 too many here,
but this seems to be the only way it works */
) {
if (fluid_rvoice_eventhandler_dispatch_count(synth->eventhandler)) {
// Something has happened, we can't process more
blockcount = i+1;
break;