From 174ad10e1b4ddfd266040ded1b72f215d558871b Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Sun, 7 Jun 2009 08:10:09 +0000 Subject: [PATCH] Call sample timers before processing block to get better latency --- fluidsynth/src/fluid_midi.c | 1 - fluidsynth/src/fluid_synth.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fluidsynth/src/fluid_midi.c b/fluidsynth/src/fluid_midi.c index e39d2897..4019ad92 100644 --- a/fluidsynth/src/fluid_midi.c +++ b/fluidsynth/src/fluid_midi.c @@ -1361,7 +1361,6 @@ int fluid_player_play(fluid_player_t* player) if (player->sample_timer == NULL) { return FLUID_FAILED; } - fluid_player_callback(player, 0); /* Process the first events before the first block */ } return FLUID_OK; } diff --git a/fluidsynth/src/fluid_synth.c b/fluidsynth/src/fluid_synth.c index c8497467..e4854b8d 100644 --- a/fluidsynth/src/fluid_synth.c +++ b/fluidsynth/src/fluid_synth.c @@ -2012,6 +2012,10 @@ fluid_synth_one_block(fluid_synth_t* synth, int do_not_mix_fx_to_out) fluid_check_fpe("??? Just starting up ???"); + fluid_sample_timer_process(synth); + + fluid_check_fpe("fluid_sample_timer_process"); + /* clean the audio buffers */ for (i = 0; i < synth->nbuf; i++) { FLUID_MEMSET(synth->left_buf[i], 0, byte_size); @@ -2125,10 +2129,6 @@ fluid_synth_one_block(fluid_synth_t* synth, int do_not_mix_fx_to_out) /* fluid_mutex_unlock(synth->busy); /\* Allow other threads to touch the synth *\/ */ - fluid_sample_timer_process(synth); - - fluid_check_fpe("fluid_sample_timer_process"); - return 0; }