summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-06-12 08:19:16 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-06-12 08:19:16 -0400
commita8d7b0fca3d11954f079e7216f0a8803b688b25c (patch)
tree0099d2615f39b173c2d66e65dc42874b624d638e /libs
parent4717080aeed8bce37e11218c2a54c5ac91f29f3c (diff)
redesign/reimplement selection knowledge in MackieControlProtocol object
strips listen to Stripable::presentation_info().PropertyChange, and forward selected status changes to the MCP object
Diffstat (limited to 'libs')
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc20
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.h4
-rw-r--r--libs/surfaces/mackie/strip.cc23
3 files changed, 32 insertions, 15 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 40fe07b8ff..65489e44e1 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -1728,12 +1728,16 @@ MackieControlProtocol::redisplay_subview_mode ()
int
MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Stripable> r)
{
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("set subview mode %1 with stripable %2, current flip mode %3\n", sm, (r ? r->name() : string ("null")), _flip_mode));
+
if (_flip_mode != Normal) {
set_flip_mode (Normal);
}
if (!subview_mode_would_be_ok (sm, r)) {
+ DEBUG_TRACE (DEBUG::MackieControl, "subview mode not OK\n");
+
if (r) {
Glib::Threads::Mutex::Lock lm (surfaces_lock);
@@ -2347,9 +2351,7 @@ MackieControlProtocol::is_midi_track (boost::shared_ptr<Stripable> r) const
bool
MackieControlProtocol::selected (boost::shared_ptr<Stripable> r) const
{
- const StripableNotificationList* rl = &_last_selected_stripables;
-
- for (ARDOUR::StripableNotificationList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
+ for (Selection::const_iterator i = _last_selected_stripables.begin(); i != _last_selected_stripables.end(); ++i) {
boost::shared_ptr<ARDOUR::Stripable> rt = (*i).lock();
if (rt == r) {
return true;
@@ -2381,6 +2383,16 @@ MackieControlProtocol::is_mapped (boost::shared_ptr<Stripable> r) const
return false;
}
+void
+MackieControlProtocol::update_selected (boost::shared_ptr<Stripable> s, bool selected)
+{
+ if (selected) {
+ _last_selected_stripables.insert (boost::weak_ptr<Stripable> (s));
+ } else {
+ _last_selected_stripables.erase (boost::weak_ptr<Stripable> (s));
+ }
+}
+
boost::shared_ptr<Stripable>
MackieControlProtocol::first_selected_stripable () const
{
@@ -2388,7 +2400,7 @@ MackieControlProtocol::first_selected_stripable () const
return boost::shared_ptr<Stripable>();
}
- boost::shared_ptr<Stripable> r = _last_selected_stripables.front().lock();
+ boost::shared_ptr<Stripable> r = (*(_last_selected_stripables.begin())).lock();
if (r) {
/* check it is on one of our surfaces */
diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h
index 647d2fcdb3..20a3ff31ca 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.h
+++ b/libs/surfaces/mackie/mackie_control_protocol.h
@@ -142,6 +142,7 @@ class MackieControlProtocol
bool is_hidden (boost::shared_ptr<ARDOUR::Stripable>) const;
bool is_mapped (boost::shared_ptr<ARDOUR::Stripable>) const;
boost::shared_ptr<ARDOUR::Stripable> first_selected_stripable () const;
+ void update_selected (boost::shared_ptr<ARDOUR::Stripable>, bool selected);
void check_fader_automation_state ();
void update_fader_automation_state ();
@@ -334,7 +335,8 @@ class MackieControlProtocol
bool needs_ipmidi_restart;
bool _metering_active;
bool _initialized;
- ARDOUR::StripableNotificationList _last_selected_stripables;
+ typedef std::set<boost::weak_ptr<ARDOUR::Stripable> > Selection;
+ Selection _last_selected_stripables;
XMLNode* configuration_state;
int state_version;
int _last_bank[9];
diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc
index 48d170e91c..c438750289 100644
--- a/libs/surfaces/mackie/strip.cc
+++ b/libs/surfaces/mackie/strip.cc
@@ -381,6 +381,7 @@ Strip::notify_property_changed (const PropertyChange& what_changed)
if (what_changed.contains (ARDOUR::Properties::selected)) {
if (_stripable) {
_surface->write (_select->set_state (_stripable->presentation_info().selected()));
+ _surface->mcp().update_selected (_stripable, _stripable->presentation_info().selected());
}
}
}
@@ -1352,24 +1353,26 @@ Strip::flip_mode_changed ()
boost::shared_ptr<AutomationControl> fader_control = _fader->control();
if (pot_control && fader_control) {
+
_vpot->set_control (fader_control);
_fader->set_control (pot_control);
- }
- if (_surface->mcp().flip_mode() == MackieControlProtocol::Normal) {
- do_parameter_display (GainAutomation, fader_control->get_value());
- } else {
- do_parameter_display (BusSendLevel, fader_control->get_value());
- }
+ /* update fader with pot value */
- /* update fader */
+ _surface->write (_fader->set_position (pot_control->internal_to_interface (pot_control->get_value ())));
- _surface->write (_fader->set_position (pot_control->internal_to_interface (pot_control->get_value ())));
+ /* update pot with fader value */
- /* update pot */
+ _surface->write (_vpot->set (fader_control->internal_to_interface (fader_control->get_value()), true, Pot::wrap));
- _surface->write (_vpot->set (fader_control->internal_to_interface (fader_control->get_value()), true, Pot::wrap));
+ if (_surface->mcp().flip_mode() == MackieControlProtocol::Normal) {
+ do_parameter_display (GainAutomation, fader_control->get_value());
+ } else {
+ do_parameter_display (BusSendLevel, pot_control->get_value());
+ }
+
+ }
} else {
/* do nothing */