mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-10 23:11:41 +00:00
expose a getter for bufcount for rvoice_mixer
This commit is contained in:
parent
8d952d1e59
commit
6c3061cba3
3 changed files with 13 additions and 8 deletions
|
@ -710,6 +710,10 @@ int fluid_rvoice_mixer_get_fx_bufs(fluid_rvoice_mixer_t* mixer,
|
||||||
return mixer->buffers.fx_buf_count;
|
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
|
#ifdef ENABLE_MIXER_THREADS
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ int fluid_rvoice_mixer_get_bufs(fluid_rvoice_mixer_t* mixer,
|
||||||
fluid_real_t*** left, fluid_real_t*** right);
|
fluid_real_t*** left, fluid_real_t*** right);
|
||||||
int fluid_rvoice_mixer_get_fx_bufs(fluid_rvoice_mixer_t* mixer,
|
int fluid_rvoice_mixer_get_fx_bufs(fluid_rvoice_mixer_t* mixer,
|
||||||
fluid_real_t*** fx_left, fluid_real_t*** fx_right);
|
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_rvoice_mixer_t* new_fluid_rvoice_mixer(int buf_count, int fx_buf_count,
|
||||||
fluid_real_t sample_rate);
|
fluid_real_t sample_rate);
|
||||||
|
|
|
@ -2929,7 +2929,7 @@ void fluid_synth_process_event_queue(fluid_synth_t* synth)
|
||||||
static int
|
static int
|
||||||
fluid_synth_render_blocks(fluid_synth_t* synth, int blockcount)
|
fluid_synth_render_blocks(fluid_synth_t* synth, int blockcount)
|
||||||
{
|
{
|
||||||
int i;
|
int i, maxblocks;
|
||||||
fluid_profile_ref_var (prof_ref);
|
fluid_profile_ref_var (prof_ref);
|
||||||
|
|
||||||
/* Assign ID of synthesis thread */
|
/* 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);
|
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++) {
|
for (i=0; i < blockcount; i++) {
|
||||||
fluid_sample_timer_process(synth);
|
fluid_sample_timer_process(synth);
|
||||||
fluid_synth_add_ticks(synth, FLUID_BUFSIZE);
|
fluid_synth_add_ticks(synth, FLUID_BUFSIZE);
|
||||||
|
|
||||||
/* If events have been queued waiting for fluid_rvoice_eventhandler_dispatch_all()
|
/* 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
|
* (should only happen with parallel render) stop processing and go for rendering
|
||||||
* 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
|
|
||||||
*/
|
*/
|
||||||
if (fluid_rvoice_eventhandler_dispatch_count(synth->eventhandler)
|
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 */
|
|
||||||
) {
|
|
||||||
// Something has happened, we can't process more
|
// Something has happened, we can't process more
|
||||||
blockcount = i+1;
|
blockcount = i+1;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue