summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-10-04 01:36:51 +0200
committerRobin Gareus <robin@gareus.org>2018-10-04 01:36:51 +0200
commit9df6e334fc01ce024702c51e84a80193bea36bff (patch)
tree1e1d998b66b0d80da43496c6ddbdbe6cd205c14b
parentbe826f363522dbca96c8263d404c57c4fe9ff0e2 (diff)
Persistent ctrl-surface state
Keep latest surface configuration, regardless if surface is active or being deactivated. Current state after de-activation is retained. Currently state loaded from a session overrides global state from global preferences, if the surface is marked active in the session. This is to allow midi-learn. generic-midi and session-specific midi-learn will require additional work.
-rw-r--r--libs/ardour/control_protocol_manager.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc
index c2929a3968..c1c595ebb2 100644
--- a/libs/ardour/control_protocol_manager.cc
+++ b/libs/ardour/control_protocol_manager.cc
@@ -266,6 +266,7 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi, bool lock_required)
cpi.descriptor->destroy (cpi.descriptor, cpi.protocol);
if (lock_required) {
+ /* the lock is required when the protocol is torn down by a user from the GUI. */
Glib::Threads::RWLock::WriterLock lm (protocols_lock);
list<ControlProtocol*>::iterator p = find (control_protocols.begin(), control_protocols.end(), cpi.protocol);
if (p != control_protocols.end()) {
@@ -284,14 +285,6 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi, bool lock_required)
cpi.protocol = 0;
- if (lock_required) {
- /* the lock is only required when the protocol is torn down from the GUI.
- * If a user disables a protocol, we take this as indicator to forget the
- * state.
- */
- delete cpi.state;
- cpi.state = 0;
- }
delete (Glib::Module*) cpi.descriptor->module;
/* cpi->descriptor is now inaccessible since dlclose() or equivalent
* has been performed, and the descriptor is (or could be) a static
@@ -525,6 +518,8 @@ ControlProtocolManager::get_state ()
if ((*i)->protocol) {
XMLNode& child_state ((*i)->protocol->get_state());
child_state.set_property (X_("active"), true);
+ delete ((*i)->state);
+ (*i)->state = new XMLNode (child_state);
root->add_child_nocopy (child_state);
} else if ((*i)->state) {
XMLNode* child_state = new XMLNode (*(*i)->state);