track add/remove of monitor and/or master busses in mackie support code.
Somehow fails to move master fader to correct position when monitor section is added
This commit is contained in:
parent
6e13b91a35
commit
8bdab38d43
@ -696,6 +696,7 @@ MackieControlProtocol::connect_session_signals()
|
||||
{
|
||||
// receive routes added
|
||||
session->RouteAdded.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_route_added, this, _1), this);
|
||||
session->RouteAddedOrRemoved.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_route_added_or_removed, this), this);
|
||||
// receive record state toggled
|
||||
session->RecordStateChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_record_state_changed, this), this);
|
||||
// receive transport state changed
|
||||
@ -1190,6 +1191,15 @@ void MackieControlProtocol::notify_parameter_changed (std::string const & p)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MackieControlProtocol::notify_route_added_or_removed ()
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
||||
(*s)->master_monitor_may_have_changed ();
|
||||
}
|
||||
}
|
||||
|
||||
// RouteList is the set of routes that have just been added
|
||||
void
|
||||
MackieControlProtocol::notify_route_added (ARDOUR::RouteList & rl)
|
||||
@ -1202,6 +1212,15 @@ MackieControlProtocol::notify_route_added (ARDOUR::RouteList & rl)
|
||||
}
|
||||
}
|
||||
|
||||
/* special case: single route, and it is the monitor or master out */
|
||||
|
||||
if (rl.size() == 1 && (rl.front()->is_monitor() || rl.front()->is_master())) {
|
||||
Glib::Threads::Mutex::Lock lm (surfaces_lock);
|
||||
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
|
||||
(*s)->master_monitor_may_have_changed ();
|
||||
}
|
||||
}
|
||||
|
||||
// currently assigned banks are less than the full set of
|
||||
// strips, so activate the new strip now.
|
||||
|
||||
|
@ -187,6 +187,7 @@ class MackieControlProtocol
|
||||
|
||||
void handle_button_event (Mackie::Surface&, Mackie::Button& button, Mackie::ButtonState);
|
||||
|
||||
void notify_route_added_or_removed ();
|
||||
void notify_route_added (ARDOUR::RouteList &);
|
||||
void notify_remote_id_changed();
|
||||
|
||||
|
@ -363,6 +363,14 @@ Surface::init_strips (uint32_t n)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Surface::master_monitor_may_have_changed ()
|
||||
{
|
||||
std::cerr << "MMmhc\n";
|
||||
setup_master ();
|
||||
std::cerr << " done\n";
|
||||
}
|
||||
|
||||
void
|
||||
Surface::setup_master ()
|
||||
{
|
||||
@ -373,28 +381,37 @@ Surface::setup_master ()
|
||||
}
|
||||
|
||||
if (!m) {
|
||||
_master_fader->set_control (boost::shared_ptr<AutomationControl>());
|
||||
master_connection.disconnect ();
|
||||
return;
|
||||
}
|
||||
|
||||
_master_fader = dynamic_cast<Fader*> (Fader::factory (*this, _mcp.device_info().strip_cnt(), "master", *groups["master"]));
|
||||
if (!_master_fader) {
|
||||
_master_fader = dynamic_cast<Fader*> (Fader::factory (*this, _mcp.device_info().strip_cnt(), "master", *groups["master"]));
|
||||
|
||||
Groups::iterator group_it;
|
||||
group_it = groups.find("master");
|
||||
|
||||
DeviceInfo device_info = _mcp.device_info();
|
||||
GlobalButtonInfo master_button = device_info.get_global_button(Button::MasterFaderTouch);
|
||||
Button* bb = dynamic_cast<Button*> (Button::factory (
|
||||
*this,
|
||||
Button::MasterFaderTouch,
|
||||
master_button.id,
|
||||
master_button.label,
|
||||
*(group_it->second)
|
||||
));
|
||||
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("surface %1 Master Fader new button BID %2 id %3\n",
|
||||
number(), Button::MasterFaderTouch, bb->id()));
|
||||
} else {
|
||||
master_connection.disconnect ();
|
||||
}
|
||||
|
||||
_master_fader->set_control (m->gain_control());
|
||||
m->gain_control()->Changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&Surface::master_gain_changed, this), ui_context());
|
||||
|
||||
Groups::iterator group_it;
|
||||
group_it = groups.find("master");
|
||||
|
||||
DeviceInfo device_info = _mcp.device_info();
|
||||
GlobalButtonInfo master_button = device_info.get_global_button(Button::MasterFaderTouch);
|
||||
Button* bb = dynamic_cast<Button*> (Button::factory (
|
||||
*this,
|
||||
Button::MasterFaderTouch,
|
||||
master_button.id,
|
||||
master_button.label,
|
||||
*(group_it->second)
|
||||
));
|
||||
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("surface %1 Master Fader new button BID %2 id %3\n",
|
||||
number(), Button::MasterFaderTouch, bb->id()));
|
||||
m->gain_control()->Changed.connect (master_connection, MISSING_INVALIDATOR, boost::bind (&Surface::master_gain_changed, this), ui_context());
|
||||
_last_master_gain_written = FLT_MAX; /* some essentially impossible value */
|
||||
master_gain_changed ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -406,6 +423,7 @@ Surface::master_gain_changed ()
|
||||
|
||||
boost::shared_ptr<AutomationControl> ac = _master_fader->control();
|
||||
if (!ac) {
|
||||
std::cerr << "no control!\n";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -416,6 +434,8 @@ Surface::master_gain_changed ()
|
||||
|
||||
DEBUG_TRACE (DEBUG::MackieControl, "Surface::master_gain_changed: updating surface master fader\n");
|
||||
|
||||
std::cerr << "send " << normalized_position << std::endl;
|
||||
|
||||
_port->write (_master_fader->set_position (normalized_position));
|
||||
_last_master_gain_written = normalized_position;
|
||||
}
|
||||
|
@ -169,6 +169,8 @@ public:
|
||||
|
||||
bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool);
|
||||
|
||||
void master_monitor_may_have_changed ();
|
||||
|
||||
XMLNode& get_state ();
|
||||
int set_state (const XMLNode&, int version);
|
||||
|
||||
@ -183,6 +185,7 @@ public:
|
||||
Mackie::JogWheel* _jog_wheel;
|
||||
Fader* _master_fader;
|
||||
float _last_master_gain_written;
|
||||
PBD::ScopedConnection master_connection;
|
||||
|
||||
void handle_midi_sysex (MIDI::Parser&, MIDI::byte *, size_t count);
|
||||
MidiByteArray host_connection_query (MidiByteArray& bytes);
|
||||
|
Loading…
Reference in New Issue
Block a user