From 1674261f8900b7085c84ad64dc073ea550d25f9e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 21 Jun 2020 17:36:01 +0200 Subject: [PATCH] On plugin internal-state change, mark preset as modified --- libs/ardour/ardour/plugin.h | 6 ++++++ libs/ardour/lv2_plugin.cc | 2 +- libs/ardour/plugin.cc | 8 ++++++++ libs/ardour/session_vst.cc | 12 ++++++++---- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index e4b5d1adbe..a062cc8858 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -376,6 +376,12 @@ protected: /** Do the actual removal of a preset of the provided name */ virtual void do_remove_preset (std::string) = 0; + + /** Plugin's [internal] state changed, mark preset and session + * as modified. + */ + void state_changed (); + ARDOUR::AudioEngine& _engine; ARDOUR::Session& _session; PluginInfoPtr _info; diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index f841e6e8c1..22587da4b6 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -2999,7 +2999,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs, atom->type == _uri_map.urids.atom_Object) { LV2_Atom_Object* obj = (LV2_Atom_Object*)atom; if (obj->body.otype == _uri_map.urids.state_StateChanged) { - _session.set_dirty (); + Plugin::state_changed (); } } } diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index b3a805b9f5..1330011173 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -493,6 +493,14 @@ Plugin::parameter_changed_externally (uint32_t which, float /* value */) PresetDirty (); /* EMIT SIGNAL */ } +void +Plugin::state_changed () +{ + _parameter_changed_since_last_preset = true; + _session.set_dirty (); + PresetDirty (); /* EMIT SIGNAL */ +} + int Plugin::set_state (const XMLNode& node, int /*version*/) { diff --git a/libs/ardour/session_vst.cc b/libs/ardour/session_vst.cc index af1fd01b3a..fad298fe77 100644 --- a/libs/ardour/session_vst.cc +++ b/libs/ardour/session_vst.cc @@ -502,10 +502,14 @@ intptr_t Session::vst_callback ( case audioMasterUpdateDisplay: SHOW_CALLBACK ("audioMasterUpdateDisplay"); - // something has changed, update 'multi-fx' display - /* TODO: consider emitting ParameterChangedExternally() for each ctrl input */ - if (session) { - session->set_dirty (); + /* Something has changed, update 'multi-fx' display. + * (Ardour watches output ports already, and redraws when idle.) + * + * We assume that the internal state of the plugin has changed, + * and session as well as preset is marked as modified. + */ + if (plug) { + plug->state_changed (); } return 0;