diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c index 6a0b280f..45e2a72f 100644 --- a/src/synth/fluid_synth.c +++ b/src/synth/fluid_synth.c @@ -3800,6 +3800,16 @@ int fluid_synth_write_float(fluid_synth_t *synth, int len, void *lout, int loff, int lincr, void *rout, int roff, int rincr) +{ + return fluid_synth_write_float_LOCAL(synth, len, lout, loff, lincr, rout, roff, rincr, fluid_synth_render_blocks); +} + +int +fluid_synth_write_float_LOCAL(fluid_synth_t *synth, int len, + void *lout, int loff, int lincr, + void *rout, int roff, int rincr, + int (*block_render_func)(fluid_synth_t *, int) + ) { int i, j, k, l; float *left_out = (float *) lout; @@ -3825,7 +3835,7 @@ fluid_synth_write_float(fluid_synth_t *synth, int len, if(l >= synth->curmax) { int blocksleft = (len - i + FLUID_BUFSIZE - 1) / FLUID_BUFSIZE; - synth->curmax = FLUID_BUFSIZE * fluid_synth_render_blocks(synth, blocksleft); + synth->curmax = FLUID_BUFSIZE * block_render_func(synth, blocksleft); fluid_rvoice_mixer_get_bufs(synth->eventhandler->mixer, &left_in, &right_in); l = 0; diff --git a/src/synth/fluid_synth.h b/src/synth/fluid_synth.h index 0b9758ba..b649bcf3 100644 --- a/src/synth/fluid_synth.h +++ b/src/synth/fluid_synth.h @@ -216,6 +216,11 @@ int fluid_synth_set_gen2(fluid_synth_t *synth, int chan, int fluid_synth_process_LOCAL(fluid_synth_t *synth, int len, int nfx, float *fx[], int nout, float *out[], int (*block_render_func)(fluid_synth_t *, int)); +int +fluid_synth_write_float_LOCAL(fluid_synth_t *synth, int len, + void *lout, int loff, int lincr, + void *rout, int roff, int rincr, + int (*block_render_func)(fluid_synth_t *, int)); /* * misc */ diff --git a/test/test_synth_process.c b/test/test_synth_process.c index bdae3bbd..0e2bff71 100644 --- a/test/test_synth_process.c +++ b/test/test_synth_process.c @@ -8,18 +8,17 @@ // static const int CHANNELS=16; enum { SAMPLES=1024 }; +static int smpl; + int render_one_mock(fluid_synth_t *synth, int blocks) { - static int smpl; - + fluid_real_t *left_in, *fx_left_in; fluid_real_t *right_in, *fx_right_in; int i, j; - int nfxchan = fluid_synth_count_effects_channels(synth), - nfxunits = fluid_synth_count_effects_groups(synth), - naudchan = fluid_synth_count_audio_channels(synth); + int naudchan = fluid_synth_count_audio_channels(synth); fluid_rvoice_mixer_get_bufs(synth->eventhandler->mixer, &left_in, &right_in); fluid_rvoice_mixer_get_fx_bufs(synth->eventhandler->mixer, &fx_left_in, &fx_right_in); @@ -37,27 +36,61 @@ int render_one_mock(fluid_synth_t *synth, int blocks) return blocks; } -int render_and_check(fluid_synth_t* synth, int number_of_samples, int offset) +int process_and_check(fluid_synth_t* synth, int number_of_samples, int offset) { int i; float left[SAMPLES], right[SAMPLES]; float *dry[1 * 2]; dry[0] = left; dry[1] = right; - memset(left, 0, sizeof(left)); - memset(right, 0, sizeof(right)); - + FLUID_MEMSET(left, 0, sizeof(left)); + FLUID_MEMSET(right, 0, sizeof(right)); + TEST_SUCCESS(fluid_synth_process_LOCAL(synth, number_of_samples, 0, NULL, 2, dry, render_one_mock)); - + for(i=0; i