From fdb08e59cf85f7decfc495678febc4fc81850f97 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Mon, 12 Dec 2022 14:17:56 +1100 Subject: Fix crash in convolution based plugins --- plugins/ZamHeadX2/ZamHeadX2Plugin.cpp | 2 ++ plugins/ZamHeadX2/convolution.cpp | 5 +---- plugins/ZamVerb/ZamVerbPlugin.cpp | 2 ++ plugins/ZamVerb/convolution.cpp | 5 +---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/ZamHeadX2/ZamHeadX2Plugin.cpp b/plugins/ZamHeadX2/ZamHeadX2Plugin.cpp index c74a069..ac7b698 100644 --- a/plugins/ZamHeadX2/ZamHeadX2Plugin.cpp +++ b/plugins/ZamHeadX2/ZamHeadX2Plugin.cpp @@ -209,10 +209,12 @@ void ZamHeadX2Plugin::setState(const char* key, const char*) snprintf(azim, 3, "%d", az); if ((az != azold) || (el != elold)) { other = !active; + signal = false; clv[other]->clv_release(); clv[other]->clv_configure("convolution.ir.preset", elev, azim); clv[other]->clv_initialize(getSampleRate(), 2, 2, getBufferSize()); swap = other; + signal = true; } azold = az; elold = el; diff --git a/plugins/ZamHeadX2/convolution.cpp b/plugins/ZamHeadX2/convolution.cpp index 8f21269..a3e3f33 100644 --- a/plugins/ZamHeadX2/convolution.cpp +++ b/plugins/ZamHeadX2/convolution.cpp @@ -448,7 +448,7 @@ void LV2convolv::clv_release (void) { void LV2convolv::clv_clone_settings(LV2convolv *clv_new) { convproc = clv_new->convproc; - ir_fn = clv_new->ir_fn; + ir_fn = strdup(clv_new->ir_fn); ir_preset = clv_new->ir_preset; ir_presetx = clv_new->ir_presetx; ir_presety = clv_new->ir_presety; @@ -462,9 +462,6 @@ void LV2convolv::clv_clone_settings(LV2convolv *clv_new) { fragment_size = clv_new->fragment_size; clv_new->convproc = NULL; - if (ir_fn) { - clv_new->ir_fn = strdup (ir_fn); - } } void LV2convolv::clv_free (void) { diff --git a/plugins/ZamVerb/ZamVerbPlugin.cpp b/plugins/ZamVerb/ZamVerbPlugin.cpp index d4235f8..8e777b0 100644 --- a/plugins/ZamVerb/ZamVerbPlugin.cpp +++ b/plugins/ZamVerb/ZamVerbPlugin.cpp @@ -193,10 +193,12 @@ void ZamVerbPlugin::setState(const char* key, const char*) if (strcmp(key, "reload") == 0) { snprintf(preset, 2, "%d", (int)room); other = !active; + signal = false; clv[other]->clv_release(); clv[other]->clv_configure("convolution.ir.preset", preset); clv[other]->clv_initialize(getSampleRate(), 2, 2, getBufferSize()); swap = other; + signal = true; } } diff --git a/plugins/ZamVerb/convolution.cpp b/plugins/ZamVerb/convolution.cpp index 57f04b2..1ef44bc 100644 --- a/plugins/ZamVerb/convolution.cpp +++ b/plugins/ZamVerb/convolution.cpp @@ -140,7 +140,7 @@ void LV2convolv::clv_release (void) { void LV2convolv::clv_clone_settings(LV2convolv *clv_new) { convproc = clv_new->convproc; - ir_fn = clv_new->ir_fn; + ir_fn = strdup(clv_new->ir_fn); ir_preset = clv_new->ir_preset; memcpy (chn_inp, clv_new->chn_inp, sizeof(chn_inp)); memcpy (chn_out, clv_new->chn_out, sizeof(chn_out)); @@ -152,9 +152,6 @@ void LV2convolv::clv_clone_settings(LV2convolv *clv_new) { fragment_size = clv_new->fragment_size; clv_new->convproc = NULL; - if (ir_fn) { - clv_new->ir_fn = strdup (ir_fn); - } } void LV2convolv::clv_free (void) { -- cgit v1.2.3