mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
Handle generic-midi bindings per session.
This allows to special-cases session-specific control-surface state.
e.g. midi-learn.
Only restore midi-learned, session-specific, bindings when loading a
session with generic-midi enabled.
Also dis/re-enable generic-midi resets midi-learned, but no other
session-independent settings.
This also handles the edge case:
1) load global config, generic-midi = ON, w/ bindings.
state is remembered as cpi->state
2) load session-condig, generic-midi = OFF, cpi->state is retained
3) user enables the surface, cpi->state from (1) is applied.
-> invalid bindings applied -> fail
This commit is contained in:
parent
9df6e334fc
commit
b6b353d452
4 changed files with 9 additions and 4 deletions
|
|
@ -452,7 +452,7 @@ ControlProtocolManager::cpi_by_name (string name)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ControlProtocolManager::set_state (const XMLNode& node, int /*version*/)
|
ControlProtocolManager::set_state (const XMLNode& node, int session_specific_state /* here: not version */)
|
||||||
{
|
{
|
||||||
XMLNodeList clist;
|
XMLNodeList clist;
|
||||||
XMLNodeConstIterator citer;
|
XMLNodeConstIterator citer;
|
||||||
|
|
@ -483,6 +483,7 @@ ControlProtocolManager::set_state (const XMLNode& node, int /*version*/)
|
||||||
if (active) {
|
if (active) {
|
||||||
delete cpi->state;
|
delete cpi->state;
|
||||||
cpi->state = new XMLNode (**citer);
|
cpi->state = new XMLNode (**citer);
|
||||||
|
cpi->state->set_property (X_("session-state"), session_specific_state ? true : false);
|
||||||
if (_session) {
|
if (_session) {
|
||||||
instantiate (*cpi);
|
instantiate (*cpi);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -492,6 +493,7 @@ ControlProtocolManager::set_state (const XMLNode& node, int /*version*/)
|
||||||
if (!cpi->state) {
|
if (!cpi->state) {
|
||||||
cpi->state = new XMLNode (**citer);
|
cpi->state = new XMLNode (**citer);
|
||||||
cpi->state->set_property (X_("active"), false);
|
cpi->state->set_property (X_("active"), false);
|
||||||
|
cpi->state->set_property (X_("session-state"), session_specific_state ? true : false);
|
||||||
}
|
}
|
||||||
cpi->requested = false;
|
cpi->requested = false;
|
||||||
if (_session) {
|
if (_session) {
|
||||||
|
|
|
||||||
|
|
@ -599,7 +599,7 @@ ARDOUR::init_post_engine ()
|
||||||
XMLNode* node;
|
XMLNode* node;
|
||||||
|
|
||||||
if ((node = Config->control_protocol_state()) != 0) {
|
if ((node = Config->control_protocol_state()) != 0) {
|
||||||
ControlProtocolManager::instance().set_state (*node, Stateful::loading_state_version);
|
ControlProtocolManager::instance().set_state (*node, 0 /* here: global-config state */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((node = Config->transport_master_state()) != 0) {
|
if ((node = Config->transport_master_state()) != 0) {
|
||||||
|
|
|
||||||
|
|
@ -1729,7 +1729,7 @@ Session::set_state (const XMLNode& node, int version)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((child = find_named_node (node, ControlProtocolManager::state_node_name)) != 0) {
|
if ((child = find_named_node (node, ControlProtocolManager::state_node_name)) != 0) {
|
||||||
ControlProtocolManager::instance().set_state (*child, version);
|
ControlProtocolManager::instance().set_state (*child, 1 /* here: session-specific state */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((child = find_named_node (node, "Script"))) {
|
if ((child = find_named_node (node, "Script"))) {
|
||||||
|
|
|
||||||
|
|
@ -669,7 +669,10 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version)
|
||||||
* <Controls><MidiControllable>...</MidiControllable><Controls> section
|
* <Controls><MidiControllable>...</MidiControllable><Controls> section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
bool load_dynamic_bindings = false;
|
||||||
|
node.get_property ("session-state", load_dynamic_bindings);
|
||||||
|
|
||||||
|
if (load_dynamic_bindings) {
|
||||||
Glib::Threads::Mutex::Lock lm2 (controllables_lock);
|
Glib::Threads::Mutex::Lock lm2 (controllables_lock);
|
||||||
nlist = node.children(); // "Controls"
|
nlist = node.children(); // "Controls"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue