Ctrl Surfaces: update bound controllables

Note: this only affects surfaces that use mapped_controls, and do
not already subscribe to processors_changed/RouteProcessorChange signal.
This commit is contained in:
Robin Gareus 2024-01-13 16:18:32 +01:00
parent c3ec93997c
commit bfb22e2acc
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
8 changed files with 29 additions and 3 deletions

View File

@ -545,6 +545,8 @@ Console1::set_current_stripable (std::shared_ptr<Stripable> r)
if (_current_stripable) {
DEBUG_TRACE (DEBUG::Console1, "current_stripable found: \n");
r->MappedControlsChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&Console1::set_current_stripable, this, r), this);
current_plugin_index = -1;
PresentationInfo pi = _current_stripable->presentation_info ();

View File

@ -1459,6 +1459,8 @@ FaderPort8::select_plugin (int num)
plugin->PresetLoaded.connect (processor_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::preset_changed, this), this);
plugin->PresetDirty.connect (processor_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::preset_changed, this), this);
r->MappedControlsChanged.connect (processor_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::stripable_selection_changed, this), this);
if (_auto_pluginui) {
pi->ShowUI (); /* EMIT SIGNAL */
}

View File

@ -980,7 +980,7 @@ GenericMidiControlProtocol::reset_controllables ()
}
std::shared_ptr<Controllable>
GenericMidiControlProtocol::lookup_controllable (const string & str) const
GenericMidiControlProtocol::lookup_controllable (const string & str, MIDIControllable& mc) const
{
std::shared_ptr<Controllable> c;
@ -1394,6 +1394,7 @@ GenericMidiControlProtocol::lookup_controllable (const string & str) const
if (c) {
DEBUG_TRACE (DEBUG::GenericMidi, string_compose ("found controllable \"%1\"\n", c->name()));
mc.bind_remap (r);
} else {
DEBUG_TRACE (DEBUG::GenericMidi, "no controllable found\n");
}

View File

@ -82,7 +82,7 @@ public:
int set_feedback (bool yn);
bool get_feedback () const;
std::shared_ptr<PBD::Controllable> lookup_controllable (std::string const &) const;
std::shared_ptr<PBD::Controllable> lookup_controllable (std::string const &, MIDIControllable&) const;
void maybe_start_touch (std::shared_ptr<PBD::Controllable>);

View File

@ -39,6 +39,7 @@
#include "ardour/automation_control.h"
#include "ardour/midi_ui.h"
#include "ardour/debug.h"
#include "ardour/stripable.h"
#include "midicontrollable.h"
#include "generic_midi_control_protocol.h"
@ -143,6 +144,7 @@ MIDIControllable::set_controllable (std::shared_ptr<PBD::Controllable> c)
} else {
_controllable.reset();
last_controllable_value = 0.0f; // is there a better value?
controllable_remapped_connection.disconnect ();
}
last_incoming = 256;
@ -152,6 +154,16 @@ MIDIControllable::set_controllable (std::shared_ptr<PBD::Controllable> c)
}
}
void
MIDIControllable::bind_remap (std::shared_ptr<ARDOUR::Stripable> s)
{
controllable_remapped_connection.disconnect ();
if (!s) {
return;
}
s->MappedControlsChanged.connect (controllable_remapped_connection, MISSING_INVALIDATOR, boost::bind (&GenericMidiControlProtocol::lookup_controllable, this), this);
}
void
MIDIControllable::midi_rebind (channel_t c)
{
@ -264,7 +276,8 @@ MIDIControllable::lookup_controllable()
return -1;
}
std::shared_ptr<Controllable> c = _surface->lookup_controllable (_current_uri);
controllable_remapped_connection.disconnect ();
std::shared_ptr<Controllable> c = _surface->lookup_controllable (_current_uri, *this);
if (!c) {
set_controllable (std::shared_ptr<PBD::Controllable>());

View File

@ -43,6 +43,7 @@ class GenericMidiControlProtocol;
namespace ARDOUR {
class AsyncMIDIPort;
class Stripable;
}
class MIDIControllable : public PBD::Stateful
@ -114,6 +115,8 @@ public:
int lookup_controllable();
void bind_remap (std::shared_ptr<ARDOUR::Stripable>);
private:
int max_value_for_type () const;
@ -135,6 +138,7 @@ private:
PBD::ScopedConnection midi_sense_connection[2];
PBD::ScopedConnection midi_learn_connection;
PBD::ScopedConnection controllable_death_connection;
PBD::ScopedConnection controllable_remapped_connection;
/** the type of MIDI message that is used for this control */
MIDI::eventType control_type;
MIDI::byte control_additional;

View File

@ -252,6 +252,9 @@ OSCSelectObserver::refresh_strip (std::shared_ptr<ARDOUR::Stripable> new_strip,
_strip->mapped_control (Comp_Makeup)->Changed.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::change_message, this, X_("/select/comp_makeup"), _strip->mapped_control (Comp_Makeup)), OSC::instance());
change_message (X_("/select/comp_makeup"), _strip->mapped_control (Comp_Makeup));
}
_strip->MappedControlsChanged.connect (strip_connections, MISSING_INVALIDATOR, boost::bind (&OSCSelectObserver::eq_restart, this, 0), OSC::instance ());
renew_sends ();
renew_plugin ();
eq_restart(0);

View File

@ -793,6 +793,7 @@ Strip::setup_trackview_vpot (std::shared_ptr<Stripable> r)
return;
}
r->MappedControlsChanged.connect (subview_connections, MISSING_INVALIDATOR, boost::bind (&Strip::subview_mode_changed, this), ui_context());
std::shared_ptr<AutomationControl> pc;
std::shared_ptr<Track> track = std::dynamic_pointer_cast<Track> (r);