From 5f3568deee6246869bc9359c07fee5112f020fbe Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Sun, 18 Nov 2012 09:30:46 +0000 Subject: [PATCH] fluidmax: Fix compilation failure ...by adding new functions to reset reverb and chorus into the engine. --- fluidsynth/bindings/fluidmax/fluidmax.c | 4 +-- fluidsynth/src/rvoice/fluid_rvoice_event.c | 2 ++ fluidsynth/src/rvoice/fluid_rvoice_mixer.c | 10 ++++++++ fluidsynth/src/rvoice/fluid_rvoice_mixer.h | 2 ++ fluidsynth/src/synth/fluid_synth.c | 29 ++++++++++++++++++++++ fluidsynth/src/synth/fluid_synth.h | 2 ++ 6 files changed, 47 insertions(+), 2 deletions(-) diff --git a/fluidsynth/bindings/fluidmax/fluidmax.c b/fluidsynth/bindings/fluidmax/fluidmax.c index ee47c78e..0651f99f 100644 --- a/fluidsynth/bindings/fluidmax/fluidmax.c +++ b/fluidsynth/bindings/fluidmax/fluidmax.c @@ -761,7 +761,7 @@ fluidmax_reverb(t_object *o, Symbol *s, short ac, Atom *at) if(ac == 0) { fluid_synth_set_reverb_on(self->synth, 1); - fluid_revmodel_reset(self->synth->reverb); + fluid_synth_reset_reverb(self->synth); self->reverb = 1; } else if(ftmax_is_number(at)) @@ -816,7 +816,7 @@ fluidmax_chorus(t_object *o, Symbol *s, short ac, Atom *at) if(ac == 0) { fluid_synth_set_chorus_on(self->synth, 1); - fluid_chorus_reset(self->synth->chorus); + fluid_synth_reset_chorus(self->synth); self->chorus = 1; } else if(ftmax_is_number(at)) diff --git a/fluidsynth/src/rvoice/fluid_rvoice_event.c b/fluidsynth/src/rvoice/fluid_rvoice_event.c index d6506a9e..65edb9da 100644 --- a/fluidsynth/src/rvoice/fluid_rvoice_event.c +++ b/fluidsynth/src/rvoice/fluid_rvoice_event.c @@ -111,6 +111,8 @@ fluid_rvoice_event_dispatch(fluid_rvoice_event_t* event) EVENTFUNC_I1(fluid_rvoice_mixer_set_chorus_enabled, fluid_rvoice_mixer_t*); EVENTFUNC_I1(fluid_rvoice_mixer_set_mix_fx, fluid_rvoice_mixer_t*); EVENTFUNC_0(fluid_rvoice_mixer_reset_fx, fluid_rvoice_mixer_t*); + EVENTFUNC_0(fluid_rvoice_mixer_reset_reverb, fluid_rvoice_mixer_t*); + EVENTFUNC_0(fluid_rvoice_mixer_reset_chorus, fluid_rvoice_mixer_t*); EVENTFUNC_IR(fluid_rvoice_mixer_set_threads, fluid_rvoice_mixer_t*); EVENTFUNC_ALL(fluid_rvoice_mixer_set_chorus_params, fluid_rvoice_mixer_t*); diff --git a/fluidsynth/src/rvoice/fluid_rvoice_mixer.c b/fluidsynth/src/rvoice/fluid_rvoice_mixer.c index 900fa616..7983a815 100644 --- a/fluidsynth/src/rvoice/fluid_rvoice_mixer.c +++ b/fluidsynth/src/rvoice/fluid_rvoice_mixer.c @@ -683,6 +683,16 @@ void fluid_rvoice_mixer_reset_fx(fluid_rvoice_mixer_t* mixer) fluid_chorus_reset(mixer->fx.chorus); } +void fluid_rvoice_mixer_reset_reverb(fluid_rvoice_mixer_t* mixer) +{ + fluid_revmodel_reset(mixer->fx.reverb); +} + +void fluid_rvoice_mixer_reset_chorus(fluid_rvoice_mixer_t* mixer) +{ + fluid_chorus_reset(mixer->fx.chorus); +} + int fluid_rvoice_mixer_get_bufs(fluid_rvoice_mixer_t* mixer, fluid_real_t*** left, fluid_real_t*** right) { diff --git a/fluidsynth/src/rvoice/fluid_rvoice_mixer.h b/fluidsynth/src/rvoice/fluid_rvoice_mixer.h index 88e4174e..eeb49ec8 100644 --- a/fluidsynth/src/rvoice/fluid_rvoice_mixer.h +++ b/fluidsynth/src/rvoice/fluid_rvoice_mixer.h @@ -59,6 +59,8 @@ void fluid_rvoice_mixer_set_reverb_params(fluid_rvoice_mixer_t* mixer, int set, double roomsize, double damping, double width, double level); void fluid_rvoice_mixer_reset_fx(fluid_rvoice_mixer_t* mixer); +void fluid_rvoice_mixer_reset_reverb(fluid_rvoice_mixer_t* mixer); +void fluid_rvoice_mixer_reset_chorus(fluid_rvoice_mixer_t* mixer); void fluid_rvoice_mixer_set_threads(fluid_rvoice_mixer_t* mixer, int thread_count, int prio_level); diff --git a/fluidsynth/src/synth/fluid_synth.c b/fluidsynth/src/synth/fluid_synth.c index ff3c4147..d25a7be6 100644 --- a/fluidsynth/src/synth/fluid_synth.c +++ b/fluidsynth/src/synth/fluid_synth.c @@ -1535,6 +1535,35 @@ fluid_synth_all_sounds_off_LOCAL(fluid_synth_t* synth, int chan) return FLUID_OK; } +/** + * Reset reverb engine + * @param synth FluidSynth instance + * @return FLUID_OK on success, FLUID_FAILED otherwise + */ +int +fluid_synth_reset_reverb(fluid_synth_t* synth) +{ + fluid_return_val_if_fail (synth != NULL, FLUID_FAILED); + fluid_synth_api_enter(synth); + fluid_synth_update_mixer(synth, fluid_rvoice_mixer_reset_reverb, 0, 0.0f); + FLUID_API_RETURN(FLUID_OK); +} + +/** + * Reset chorus engine + * @param synth FluidSynth instance + * @return FLUID_OK on success, FLUID_FAILED otherwise + */ +int +fluid_synth_reset_chorus(fluid_synth_t* synth) +{ + fluid_return_val_if_fail (synth != NULL, FLUID_FAILED); + fluid_synth_api_enter(synth); + fluid_synth_update_mixer(synth, fluid_rvoice_mixer_reset_chorus, 0, 0.0f); + FLUID_API_RETURN(FLUID_OK); +} + + /** * Send MIDI system reset command (big red 'panic' button), turns off notes and * resets controllers. diff --git a/fluidsynth/src/synth/fluid_synth.h b/fluidsynth/src/synth/fluid_synth.h index ad80ea26..3af336d7 100644 --- a/fluidsynth/src/synth/fluid_synth.h +++ b/fluidsynth/src/synth/fluid_synth.h @@ -211,10 +211,12 @@ void fluid_synth_dither_s16(int *dither_index, int len, float* lin, float* rin, void* lout, int loff, int lincr, void* rout, int roff, int rincr); +int fluid_synth_reset_reverb(fluid_synth_t* synth); int fluid_synth_set_reverb_preset(fluid_synth_t* synth, int num); int fluid_synth_set_reverb_full(fluid_synth_t* synth, int set, double roomsize, double damping, double width, double level); +int fluid_synth_reset_chorus(fluid_synth_t* synth); int fluid_synth_set_chorus_full(fluid_synth_t* synth, int set, int nr, double level, double speed, double depth_ms, int type);