From f5602adfe8a5f4de2362f2ae5c1071bdbb0cbeec Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 24 Aug 2016 13:01:40 +0200 Subject: tweak a-fluidsynth reinit strategy. reset synth in offline thread, queue panic on deactivate to be called in run() after first re-activate. Initial activation does not warrant a panic. --- libs/plugins/a-fluidsynth.lv2/a-fluidsynth.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'libs') diff --git a/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.c b/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.c index 11015b5ba1..79f5586e3f 100644 --- a/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.c +++ b/libs/plugins/a-fluidsynth.lv2/a-fluidsynth.c @@ -281,7 +281,7 @@ instantiate (const LV2_Descriptor* descriptor, /* initialize plugin state */ - self->panic = true; + self->panic = false; self->inform_ui = false; self->initialized = false; self->reinit_in_progress = false; @@ -327,7 +327,7 @@ connect_port (LV2_Handle instance, } static void -activate (LV2_Handle instance) +deactivate (LV2_Handle instance) { AFluidSynth* self = (AFluidSynth*)instance; self->panic = true; @@ -352,8 +352,6 @@ run (LV2_Handle instance, uint32_t n_samples) } else if (self->panic) { fluid_synth_all_notes_off (self->synth, -1); fluid_synth_all_sounds_off (self->synth, -1); - //fluid_synth_reset_reverb (self->synth); - //fluid_synth_reset_chorus (self->synth); self->panic = false; } @@ -506,6 +504,13 @@ work (LV2_Handle instance, } self->initialized = load_sf2 (self, self->queue_sf2_file_path); + + if (self->initialized) { + fluid_synth_all_notes_off (self->synth, -1); + fluid_synth_all_sounds_off (self->synth, -1); + self->panic = false; + } + respond (handle, 1, ""); return LV2_WORKER_SUCCESS; } @@ -519,7 +524,6 @@ work_response (LV2_Handle instance, self->reinit_in_progress = false; self->queue_reinit = false; self->inform_ui = true; - self->panic = true; if (self->initialized) { strcpy (self->current_sf2_file_path, self->queue_sf2_file_path); @@ -607,9 +611,9 @@ static const LV2_Descriptor descriptor = { AFS_URN, instantiate, connect_port, - activate, - run, NULL, + run, + deactivate, cleanup, extension_data }; -- cgit v1.2.3