convert Mackie Control Surface support to use Stripable, not Route

This commit is contained in:
Paul Davis
2016-05-16 16:45:37 -04:00
parent 153d2a1c1b
commit c34ad3a723
7 changed files with 306 additions and 309 deletions

View File

@@ -136,7 +136,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
_last_bank[i] = 0;
}
TrackSelectionChanged.connect (gui_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::gui_track_selection_changed, this, _1, true), this);
StripableSelectionChanged.connect (gui_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::gui_track_selection_changed, this, _1, true), this);
_instance = this;
@@ -210,7 +210,6 @@ MackieControlProtocol::ping_devices ()
}
// go to the previous track.
// Assume that get_sorted_routes().size() > route_table.size()
void
MackieControlProtocol::prev_track()
{
@@ -220,137 +219,128 @@ MackieControlProtocol::prev_track()
}
// go to the next track.
// Assume that get_sorted_routes().size() > route_table.size()
void
MackieControlProtocol::next_track()
{
Sorted sorted = get_sorted_routes();
Sorted sorted = get_sorted_stripables();
if (_current_initial_bank + n_strips() < sorted.size()) {
switch_banks (_current_initial_bank + 1);
}
}
bool
MackieControlProtocol::route_is_locked_to_strip (boost::shared_ptr<Route> r) const
MackieControlProtocol::stripable_is_locked_to_strip (boost::shared_ptr<Stripable> r) const
{
for (Surfaces::const_iterator si = surfaces.begin(); si != surfaces.end(); ++si) {
if ((*si)->route_is_locked_to_strip (r)) {
if ((*si)->stripable_is_locked_to_strip (r)) {
return true;
}
}
return false;
}
// predicate for sort call in get_sorted_routes
struct RouteByPresentationOrder
// predicate for sort call in get_sorted_stripables
struct StripableByPresentationOrder
{
bool operator () (const boost::shared_ptr<Route> & a, const boost::shared_ptr<Route> & b) const
bool operator () (const boost::shared_ptr<Stripable> & a, const boost::shared_ptr<Stripable> & b) const
{
return a->presentation_info() < b->presentation_info();
}
bool operator () (const Route & a, const Route & b) const
bool operator () (const Stripable & a, const Stripable & b) const
{
return a.presentation_info() < b.presentation_info();
}
bool operator () (const Route * a, const Route * b) const
bool operator () (const Stripable * a, const Stripable * b) const
{
return a->presentation_info() < b->presentation_info();
}
};
MackieControlProtocol::Sorted
MackieControlProtocol::get_sorted_routes()
MackieControlProtocol::get_sorted_stripables()
{
Sorted sorted;
// fetch all routes
boost::shared_ptr<RouteList> routes = session->get_routes();
set<PresentationInfo> remote_ids;
// fetch all stripables
StripableList stripables;
// sort in presentation order, and exclude master, control and hidden routes
// and any routes that are already set.
session->get_stripables (stripables);
for (RouteList::iterator it = routes->begin(); it != routes->end(); ++it) {
// sort in presentation order, and exclude master, control and hidden stripables
// and any stripables that are already set.
boost::shared_ptr<Route> route = *it;
for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
if (route->is_auditioner() || route->is_master() || route->is_monitor()) {
boost::shared_ptr<Stripable> s = *it;
if (s->presentation_info().special()) {
continue;
}
/* don't include locked routes */
if (route_is_locked_to_strip (route)) {
if (stripable_is_locked_to_strip (s)) {
continue;
}
switch (_view_mode) {
case Mixer:
if (! is_hidden(route)) {
sorted.push_back (route);
remote_ids.insert (route->presentation_info());
if (!is_hidden (s)) {
sorted.push_back (s);
}
break;
case AudioTracks:
if (is_audio_track(route) && !is_hidden(route)) {
sorted.push_back (route);
remote_ids.insert (route->presentation_info());
if (is_audio_track(s) && !is_hidden(s)) {
sorted.push_back (s);
}
break;
case Busses:
if (Profile->get_mixbus()) {
#ifdef MIXBUS
if (route->mixbus()) {
sorted.push_back (route);
remote_ids.insert (route->presentation_info());
if (s->mixbus()) {
sorted.push_back (s);
}
#endif
} else {
if (!is_track(route) && !is_hidden(route)) {
sorted.push_back (route);
remote_ids.insert (route->presentation_info());
if (!is_track(s) && !is_hidden(s)) {
sorted.push_back (s);
}
}
break;
case MidiTracks:
if (is_midi_track(route) && !is_hidden(route)) {
sorted.push_back (route);
remote_ids.insert (route->presentation_info());
if (is_midi_track(s) && !is_hidden(s)) {
sorted.push_back (s);
}
break;
case Plugins:
break;
case Auxes: // in ardour, for now aux and buss are same. for mixbus, "Busses" are mixbuses, "Auxes" are ardour buses
#ifdef MIXBUS
if (!route->mixbus() && !is_track(route) && !is_hidden(route))
if (!s->mixbus() && !is_track() && !is_hidden(s))
#else
if (!is_track(route) && !is_hidden(route))
if (!is_track(s) && !is_hidden(s))
#endif
{
sorted.push_back (route);
remote_ids.insert (route->presentation_info());
sorted.push_back (s);
}
break;
case Hidden: // Show all the tracks we have hidden
if (is_hidden(route)) {
if (is_hidden(s)) {
// maybe separate groups
sorted.push_back (route);
remote_ids.insert (route->presentation_info());
sorted.push_back (s);
}
break;
case Selected: // For example: a group (this is USER)
if (selected(route) && !is_hidden(route)) {
sorted.push_back (route);
remote_ids.insert (route->presentation_info());
if (selected(s) && !is_hidden(s)) {
sorted.push_back (s);
}
break;
}
}
sort (sorted.begin(), sorted.end(), RouteByPresentationOrder());
sort (sorted.begin(), sorted.end(), StripableByPresentationOrder());
return sorted;
}
@@ -382,7 +372,7 @@ MackieControlProtocol::switch_banks (uint32_t initial, bool force)
return 0;
}
Sorted sorted = get_sorted_routes();
Sorted sorted = get_sorted_stripables();
uint32_t strip_cnt = n_strips (false); // do not include locked strips
// in this count
@@ -394,7 +384,7 @@ MackieControlProtocol::switch_banks (uint32_t initial, bool force)
}
if (sorted.size() <= strip_cnt && _current_initial_bank == 0 && !force) {
/* no banking - not enough routes to fill all strips and we're
/* no banking - not enough stripables to fill all strips and we're
* not at the first one.
*/
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("less routes (%1) than strips (%2) and we're at the end already (%3)\n",
@@ -405,31 +395,31 @@ MackieControlProtocol::switch_banks (uint32_t initial, bool force)
_current_initial_bank = initial;
_current_selected_track = -1;
// Map current bank of routes onto each surface(+strip)
// Map current bank of stripables onto each surface(+strip)
if (_current_initial_bank < sorted.size()) {
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("switch to %1, %2, available routes %3 on %4 surfaces\n",
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("switch to %1, %2, available stripables %3 on %4 surfaces\n",
_current_initial_bank, strip_cnt, sorted.size(),
surfaces.size()));
// link routes to strips
// link stripables to strips
Sorted::iterator r = sorted.begin() + _current_initial_bank;
for (Surfaces::iterator si = surfaces.begin(); si != surfaces.end(); ++si) {
vector<boost::shared_ptr<Route> > routes;
vector<boost::shared_ptr<Stripable> > stripables;
uint32_t added = 0;
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("surface has %1 unlockedstrips\n", (*si)->n_strips (false)));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("surface has %1 unlocked strips\n", (*si)->n_strips (false)));
for (; r != sorted.end() && added < (*si)->n_strips (false); ++r, ++added) {
routes.push_back (*r);
stripables.push_back (*r);
}
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("give surface %1 routes\n", routes.size()));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("give surface %1 stripables\n", stripables.size()));
(*si)->map_routes (routes);
(*si)->map_stripables (stripables);
}
} else {
@@ -446,7 +436,7 @@ MackieControlProtocol::switch_banks (uint32_t initial, bool force)
/* make sure selection is correct */
_gui_track_selection_changed (&_last_selected_routes, false, false);
_gui_track_selection_changed (&_last_selected_stripables, false, false);
/* current bank has not been saved */
session->set_dirty();
@@ -654,7 +644,7 @@ MackieControlProtocol::device_ready ()
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("device ready init (active=%1)\n", active()));
update_surfaces ();
set_subview_mode (MackieControlProtocol::None, boost::shared_ptr<Route>());
set_subview_mode (MackieControlProtocol::None, boost::shared_ptr<Stripable>());
set_flip_mode (Normal);
}
@@ -707,7 +697,10 @@ void
MackieControlProtocol::connect_session_signals()
{
// receive routes added
session->RouteAdded.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_route_added, this, _1), this);
session->RouteAdded.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_routes_added, this, _1), this);
// receive VCAs added
//session->RoutesAdded.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_stripable_added, this, _1), 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
@@ -720,11 +713,11 @@ MackieControlProtocol::connect_session_signals()
session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_solo_active_changed, this, _1), this);
// make sure remote id changed signals reach here
// see also notify_route_added
Sorted sorted = get_sorted_routes();
// see also notify_stripable_added
Sorted sorted = get_sorted_stripables();
for (Sorted::iterator it = sorted.begin(); it != sorted.end(); ++it) {
(*it)->PresentationInfoChanged.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_presentation_info_changed, this), this);
(*it)->PresentationInfoChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_presentation_info_changed, this), this);
}
}
@@ -968,7 +961,7 @@ MackieControlProtocol::close()
{
port_connection.disconnect ();
session_connections.drop_connections ();
route_connections.drop_connections ();
stripable_connections.drop_connections ();
periodic_connection.disconnect ();
clear_surfaces();
@@ -1242,7 +1235,7 @@ void MackieControlProtocol::notify_parameter_changed (std::string const & p)
}
void
MackieControlProtocol::notify_route_removed ()
MackieControlProtocol::notify_stripable_removed ()
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
@@ -1250,9 +1243,9 @@ MackieControlProtocol::notify_route_removed ()
}
}
// RouteList is the set of routes that have just been added
// RouteList is the set of Routes that have just been added
void
MackieControlProtocol::notify_route_added (ARDOUR::RouteList & rl)
MackieControlProtocol::notify_routes_added (ARDOUR::RouteList & rl)
{
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
@@ -1278,11 +1271,11 @@ MackieControlProtocol::notify_route_added (ARDOUR::RouteList & rl)
// otherwise route added, but current bank needs no updating
// make sure remote id changes in the new route are handled
// make sure presentation info changes in the new stripables are handled
typedef ARDOUR::RouteList ARS;
for (ARS::iterator it = rl.begin(); it != rl.end(); ++it) {
(*it)->PresentationInfoChanged.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_presentation_info_changed, this), this);
(*it)->PresentationInfoChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_presentation_info_changed, this), this);
}
}
@@ -1321,7 +1314,7 @@ MackieControlProtocol::notify_presentation_info_changed()
}
}
Sorted sorted = get_sorted_routes();
Sorted sorted = get_sorted_stripables();
uint32_t sz = n_strips();
// if a remote id has been moved off the end, we need to shift
@@ -1679,15 +1672,15 @@ MackieControlProtocol::clear_ports ()
}
void
MackieControlProtocol::notify_subview_route_deleted ()
MackieControlProtocol::notify_subview_stripable_deleted ()
{
/* return to global/mixer view */
_subview_route.reset ();
_subview_stripable.reset ();
set_view_mode (Mixer);
}
bool
MackieControlProtocol::subview_mode_would_be_ok (SubViewMode mode, boost::shared_ptr<Route> r)
MackieControlProtocol::subview_mode_would_be_ok (SubViewMode mode, boost::shared_ptr<Stripable> r)
{
switch (mode) {
case None:
@@ -1740,7 +1733,7 @@ MackieControlProtocol::redisplay_subview_mode ()
}
int
MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route> r)
MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Stripable> r)
{
if (_flip_mode != Normal) {
set_flip_mode (Normal);
@@ -1788,19 +1781,19 @@ MackieControlProtocol::set_subview_mode (SubViewMode sm, boost::shared_ptr<Route
return -1;
}
boost::shared_ptr<Route> old_route = _subview_route;
boost::shared_ptr<Stripable> old_stripable = _subview_stripable;
_subview_mode = sm;
_subview_route = r;
_subview_stripable = r;
if (_subview_route != old_route) {
if (_subview_route != old_stripable) {
subview_route_connections.drop_connections ();
/* Catch the current subview route going away */
if (_subview_route) {
_subview_route->DropReferences.connect (subview_route_connections, MISSING_INVALIDATOR,
boost::bind (&MackieControlProtocol::notify_subview_route_deleted, this),
this);
/* Catch the current subview stripable going away */
if (_subview_stripable) {
_subview_stripable->DropReferences.connect (subview_stripable_connections, MISSING_INVALIDATOR,
boost::bind (&MackieControlProtocol::notify_subview_stripable_deleted, this),
this);
}
}
@@ -1871,7 +1864,7 @@ MackieControlProtocol::set_view_mode (ViewMode m)
}
/* leave subview mode, whatever it was */
set_subview_mode (None, boost::shared_ptr<Route>());
set_subview_mode (None, boost::shared_ptr<Stripable>());
display_view_mode ();
}
@@ -1906,17 +1899,17 @@ MackieControlProtocol::set_flip_mode (FlipMode fm)
void
MackieControlProtocol::set_master_on_surface_strip (uint32_t surface, uint32_t strip_number)
{
force_special_route_to_strip (session->master_out(), surface, strip_number);
force_special_stripable_to_strip (session->master_out(), surface, strip_number);
}
void
MackieControlProtocol::set_monitor_on_surface_strip (uint32_t surface, uint32_t strip_number)
{
force_special_route_to_strip (session->monitor_out(), surface, strip_number);
force_special_stripable_to_strip (session->monitor_out(), surface, strip_number);
}
void
MackieControlProtocol::force_special_route_to_strip (boost::shared_ptr<Route> r, uint32_t surface, uint32_t strip_number)
MackieControlProtocol::force_special_stripable_to_strip (boost::shared_ptr<Stripable> r, uint32_t surface, uint32_t strip_number)
{
if (!r) {
return;
@@ -1928,7 +1921,7 @@ MackieControlProtocol::force_special_route_to_strip (boost::shared_ptr<Route> r,
if ((*s)->number() == surface) {
Strip* strip = (*s)->nth_strip (strip_number);
if (strip) {
strip->set_route (session->master_out());
strip->set_stripable (session->master_out());
strip->lock_controls ();
}
}
@@ -1936,27 +1929,27 @@ MackieControlProtocol::force_special_route_to_strip (boost::shared_ptr<Route> r,
}
void
MackieControlProtocol::gui_track_selection_changed (ARDOUR::RouteNotificationListPtr rl, bool save_list)
MackieControlProtocol::gui_track_selection_changed (ARDOUR::StripableNotificationListPtr rl, bool save_list)
{
_gui_track_selection_changed (rl.get(), save_list, true);
}
void
MackieControlProtocol::_gui_track_selection_changed (ARDOUR::RouteNotificationList* rl, bool save_list, bool gui_selection_did_change)
MackieControlProtocol::_gui_track_selection_changed (ARDOUR::StripableNotificationList* rl, bool save_list, bool gui_selection_did_change)
{
/* We need to keep a list of the most recently selected routes around,
but we are not allowed to keep shared_ptr<Route> unless we want to
but we are not allowed to keep shared_ptr<Stripable> unless we want to
handle the complexities of route deletion. So instead, the GUI sends
us a notification using weak_ptr<Route>, which we keep a copy
us a notification using weak_ptr<Stripable>, which we keep a copy
of. For efficiency's sake, however, we convert the weak_ptr's into
shared_ptr<Route> before passing them to however many surfaces (and
shared_ptr<Stripable> before passing them to however many surfaces (and
thus strips) that we have.
*/
StrongRouteNotificationList srl;
StrongStripableNotificationList srl;
for (ARDOUR::RouteNotificationList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<ARDOUR::Route> r = (*i).lock();
for (ARDOUR::StripableNotificationList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<ARDOUR::Stripable> r = (*i).lock();
if (r) {
srl.push_back (r);
}
@@ -1971,7 +1964,7 @@ MackieControlProtocol::_gui_track_selection_changed (ARDOUR::RouteNotificationLi
}
if (save_list) {
_last_selected_routes = *rl;
_last_selected_stripables = *rl;
}
if (gui_selection_did_change) {
@@ -1984,15 +1977,15 @@ MackieControlProtocol::_gui_track_selection_changed (ARDOUR::RouteNotificationLi
* so .. we only have to care about subview mode if the
* GUI selection has changed.
*
* It is possible that first_selected_route() may return null if we
* It is possible that first_selected_stripable() may return null if we
* are no longer displaying/mapping that route. In that case,
* we will exit subview mode. If first_selected_route() is
* we will exit subview mode. If first_selected_stripable() is
* null, and subview mode is not None, then the first call to
* set_subview_mode() will fail, and we will reset to None.
*/
if (set_subview_mode (_subview_mode, first_selected_route())) {
set_subview_mode (None, boost::shared_ptr<Route>());
if (set_subview_mode (_subview_mode, first_selected_stripable())) {
set_subview_mode (None, boost::shared_ptr<Stripable>());
}
}
}
@@ -2002,7 +1995,7 @@ MackieControlProtocol::check_fader_automation_state ()
{
fader_automation_connections.drop_connections ();
boost::shared_ptr<Route> r = first_selected_route ();
boost::shared_ptr<Stripable> r = first_selected_stripable ();
if (!r) {
update_global_button (Button::Read, off);
@@ -2025,7 +2018,7 @@ MackieControlProtocol::check_fader_automation_state ()
void
MackieControlProtocol::update_fader_automation_state ()
{
boost::shared_ptr<Route> r = first_selected_route ();
boost::shared_ptr<Stripable> r = first_selected_stripable ();
if (!r) {
update_global_button (Button::Read, off);
@@ -2101,26 +2094,28 @@ MackieControlProtocol::remove_down_select_button (int surface, int strip)
void
MackieControlProtocol::select_range ()
{
RouteList routes;
StripableList stripables;
pull_route_range (_down_select_buttons, routes);
pull_stripable_range (_down_select_buttons, stripables);
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("select range: found %1 routes\n", routes.size()));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("select range: found %1 stripables\n", stripables.size()));
if (!routes.empty()) {
for (RouteList::iterator r = routes.begin(); r != routes.end(); ++r) {
if (stripables.empty()) {
return;
}
if (main_modifier_state() == MODIFIER_SHIFT) {
for (StripableList::iterator s = stripables.begin(); s != stripables.end(); ++s) {
if (main_modifier_state() == MODIFIER_SHIFT) {
/* XXX can only use numeric part of ID at present */
ToggleStripableSelection ((*s)->presentation_info ().global_order());
} else {
if (s == stripables.begin()) {
/* XXX can only use numeric part of ID at present */
ToggleRouteSelection ((*r)->presentation_info ().global_order());
SetStripableSelection ((*s)->presentation_info().global_order());
} else {
if (r == routes.begin()) {
/* XXX can only use numeric part of ID at present */
SetRouteSelection ((*r)->presentation_info().global_order());
} else {
/* XXX can only use numeric part of ID at present */
AddRouteToSelection ((*r)->presentation_info().global_order());
}
/* XXX can only use numeric part of ID at present */
AddStripableToSelection ((*s)->presentation_info().global_order());
}
}
}
@@ -2164,7 +2159,7 @@ MackieControlProtocol::ControlList
MackieControlProtocol::down_controls (AutomationType p)
{
ControlList controls;
RouteList routes;
StripableList stripables;
DownButtonMap::iterator m = _down_buttons.find (p);
@@ -2175,29 +2170,29 @@ MackieControlProtocol::down_controls (AutomationType p)
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("looking for down buttons for %1, got %2\n",
p, m->second.size()));
pull_route_range (m->second, routes);
pull_stripable_range (m->second, stripables);
switch (p) {
case GainAutomation:
for (RouteList::iterator r = routes.begin(); r != routes.end(); ++r) {
controls.push_back ((*r)->gain_control());
for (StripableList::iterator s = stripables.begin(); s != stripables.end(); ++s) {
controls.push_back ((*s)->gain_control());
}
break;
case SoloAutomation:
for (RouteList::iterator r = routes.begin(); r != routes.end(); ++r) {
controls.push_back ((*r)->solo_control());
for (StripableList::iterator s = stripables.begin(); s != stripables.end(); ++s) {
controls.push_back ((*s)->solo_control());
}
break;
case MuteAutomation:
for (RouteList::iterator r = routes.begin(); r != routes.end(); ++r) {
controls.push_back ((*r)->mute_control());
for (StripableList::iterator s = stripables.begin(); s != stripables.end(); ++s) {
controls.push_back ((*s)->mute_control());
}
break;
case RecEnableAutomation:
for (RouteList::iterator r = routes.begin(); r != routes.end(); ++r) {
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<Track> (*r);
if (trk) {
controls.push_back (trk->rec_enable_control());
for (StripableList::iterator s = stripables.begin(); s != stripables.end(); ++s) {
boost::shared_ptr<AutomationControl> ac = (*s)->recenable_control();
if (ac) {
controls.push_back (ac);
}
}
break;
@@ -2218,7 +2213,7 @@ struct ButtonRangeSorter {
};
void
MackieControlProtocol::pull_route_range (DownButtonList& down, RouteList& selected)
MackieControlProtocol::pull_stripable_range (DownButtonList& down, StripableList& selected)
{
ButtonRangeSorter cmp;
@@ -2268,7 +2263,7 @@ MackieControlProtocol::pull_route_range (DownButtonList& down, RouteList& select
(*s)->number(), fs, ls));
for (uint32_t n = fs; n < ls; ++n) {
boost::shared_ptr<Route> r = (*s)->nth_strip (n)->route();
boost::shared_ptr<Stripable> r = (*s)->nth_strip (n)->stripable();
if (r) {
selected.push_back (r);
}
@@ -2398,30 +2393,30 @@ MackieControlProtocol::connection_handler (boost::weak_ptr<ARDOUR::Port> wp1, st
}
bool
MackieControlProtocol::is_track (boost::shared_ptr<Route> r) const
MackieControlProtocol::is_track (boost::shared_ptr<Stripable> r) const
{
return boost::dynamic_pointer_cast<Track>(r) != 0;
}
bool
MackieControlProtocol::is_audio_track (boost::shared_ptr<Route> r) const
MackieControlProtocol::is_audio_track (boost::shared_ptr<Stripable> r) const
{
return boost::dynamic_pointer_cast<AudioTrack>(r) != 0;
}
bool
MackieControlProtocol::is_midi_track (boost::shared_ptr<Route> r) const
MackieControlProtocol::is_midi_track (boost::shared_ptr<Stripable> r) const
{
return boost::dynamic_pointer_cast<MidiTrack>(r) != 0;
}
bool
MackieControlProtocol::selected (boost::shared_ptr<Route> r) const
MackieControlProtocol::selected (boost::shared_ptr<Stripable> r) const
{
const RouteNotificationList* rl = &_last_selected_routes;
const StripableNotificationList* rl = &_last_selected_stripables;
for (ARDOUR::RouteNotificationList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<ARDOUR::Route> rt = (*i).lock();
for (ARDOUR::StripableNotificationList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<ARDOUR::Stripable> rt = (*i).lock();
if (rt == r) {
return true;
}
@@ -2430,7 +2425,7 @@ MackieControlProtocol::selected (boost::shared_ptr<Route> r) const
}
bool
MackieControlProtocol::is_hidden (boost::shared_ptr<Route> r) const
MackieControlProtocol::is_hidden (boost::shared_ptr<Stripable> r) const
{
if (!r) {
return false;
@@ -2439,12 +2434,12 @@ MackieControlProtocol::is_hidden (boost::shared_ptr<Route> r) const
}
bool
MackieControlProtocol::is_mapped (boost::shared_ptr<Route> r) const
MackieControlProtocol::is_mapped (boost::shared_ptr<Stripable> r) const
{
Glib::Threads::Mutex::Lock lm (surfaces_lock);
for (Surfaces::const_iterator s = surfaces.begin(); s != surfaces.end(); ++s) {
if ((*s)->route_is_mapped (r)) {
if ((*s)->stripable_is_mapped (r)) {
return true;
}
}
@@ -2452,14 +2447,14 @@ MackieControlProtocol::is_mapped (boost::shared_ptr<Route> r) const
return false;
}
boost::shared_ptr<Route>
MackieControlProtocol::first_selected_route () const
boost::shared_ptr<Stripable>
MackieControlProtocol::first_selected_stripable () const
{
if (_last_selected_routes.empty()) {
return boost::shared_ptr<Route>();
if (_last_selected_stripables.empty()) {
return boost::shared_ptr<Stripable>();
}
boost::shared_ptr<Route> r = _last_selected_routes.front().lock();
boost::shared_ptr<Stripable> r = _last_selected_stripables.front().lock();
if (r) {
/* check it is on one of our surfaces */
@@ -2468,9 +2463,9 @@ MackieControlProtocol::first_selected_route () const
return r;
}
/* route is not mapped. thus, the currently selected route is
/* stripable is not mapped. thus, the currently selected stripable is
* not on the surfaces, and so from our perspective, there is
* no currently selected route.
* no currently selected stripable.
*/
r.reset ();
@@ -2479,10 +2474,10 @@ MackieControlProtocol::first_selected_route () const
return r; /* may be null */
}
boost::shared_ptr<Route>
MackieControlProtocol::subview_route () const
boost::shared_ptr<Stripable>
MackieControlProtocol::subview_stripable () const
{
return _subview_route;
return _subview_stripable;
}
uint32_t
@@ -2515,7 +2510,7 @@ MackieControlProtocol::request_factory (uint32_t num_requests)
void
MackieControlProtocol::set_automation_state (AutoState as)
{
boost::shared_ptr<Route> r = first_selected_route ();
boost::shared_ptr<Stripable> r = first_selected_stripable ();
if (!r) {
return;

View File

@@ -130,25 +130,25 @@ class MackieControlProtocol
FlipMode flip_mode () const { return _flip_mode; }
ViewMode view_mode () const { return _view_mode; }
SubViewMode subview_mode () const { return _subview_mode; }
static bool subview_mode_would_be_ok (SubViewMode, boost::shared_ptr<ARDOUR::Route>);
boost::shared_ptr<ARDOUR::Route> subview_route() const;
static bool subview_mode_would_be_ok (SubViewMode, boost::shared_ptr<ARDOUR::Stripable>);
boost::shared_ptr<ARDOUR::Stripable> subview_stripable() const;
bool zoom_mode () const { return modifier_state() & MODIFIER_ZOOM; }
bool metering_active () const { return _metering_active; }
bool is_track (boost::shared_ptr<ARDOUR::Route>) const;
bool is_audio_track (boost::shared_ptr<ARDOUR::Route>) const;
bool is_midi_track (boost::shared_ptr<ARDOUR::Route>) const;
bool selected (boost::shared_ptr<ARDOUR::Route>) const;
bool is_hidden (boost::shared_ptr<ARDOUR::Route>) const;
bool is_mapped (boost::shared_ptr<ARDOUR::Route>) const;
boost::shared_ptr<ARDOUR::Route> first_selected_route () const;
bool is_track (boost::shared_ptr<ARDOUR::Stripable>) const;
bool is_audio_track (boost::shared_ptr<ARDOUR::Stripable>) const;
bool is_midi_track (boost::shared_ptr<ARDOUR::Stripable>) const;
bool selected (boost::shared_ptr<ARDOUR::Stripable>) const;
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 check_fader_automation_state ();
void update_fader_automation_state ();
void set_automation_state (ARDOUR::AutoState);
void set_view_mode (ViewMode);
int set_subview_mode (SubViewMode, boost::shared_ptr<ARDOUR::Route>);
int set_subview_mode (SubViewMode, boost::shared_ptr<ARDOUR::Stripable>);
void set_flip_mode (FlipMode);
void display_view_mode ();
@@ -185,17 +185,18 @@ class MackieControlProtocol
void handle_button_event (Mackie::Surface&, Mackie::Button& button, Mackie::ButtonState);
void notify_subview_route_deleted ();
void notify_route_removed ();
void notify_route_added (ARDOUR::RouteList &);
void notify_subview_stripable_deleted ();
void notify_stripable_removed ();
void notify_routes_added (ARDOUR::RouteList &);
void notify_presentation_info_changed();
void recalibrate_faders ();
void toggle_backlight ();
void set_touch_sensitivity (int);
/// rebuild the current bank. Called on route added/removed and
/// remote id changed.
/// rebuild the current bank. Called on route or vca added/removed and
/// presentation info changed.
void refresh_current_bank();
// button-related signals
@@ -254,11 +255,11 @@ class MackieControlProtocol
void zero_all();
/**
Fetch the set of routes to be considered for control by the
Fetch the set of Stripables to be considered for control by the
surface. Excluding master, hidden and control routes, and inactive routes
*/
typedef std::vector<boost::shared_ptr<ARDOUR::Route> > Sorted;
Sorted get_sorted_routes();
typedef std::vector<boost::shared_ptr<ARDOUR::Stripable> > Sorted;
Sorted get_sorted_stripables();
// bank switching
int switch_banks (uint32_t first_remote_id, bool force = false);
@@ -276,7 +277,7 @@ class MackieControlProtocol
void thread_init ();
bool route_is_locked_to_strip (boost::shared_ptr<ARDOUR::Route>) const;
bool stripable_is_locked_to_strip (boost::shared_ptr<ARDOUR::Stripable>) const;
private:
@@ -304,8 +305,8 @@ class MackieControlProtocol
uint32_t _current_initial_bank;
PBD::ScopedConnectionList audio_engine_connections;
PBD::ScopedConnectionList session_connections;
PBD::ScopedConnectionList route_connections;
PBD::ScopedConnectionList subview_route_connections;
PBD::ScopedConnectionList stripable_connections;
PBD::ScopedConnectionList subview_stripable_connections;
PBD::ScopedConnectionList gui_connections;
PBD::ScopedConnectionList fader_automation_connections;
// timer for two quick marker left presses
@@ -324,7 +325,7 @@ class MackieControlProtocol
FlipMode _flip_mode;
ViewMode _view_mode;
SubViewMode _subview_mode;
boost::shared_ptr<ARDOUR::Route> _subview_route;
boost::shared_ptr<ARDOUR::Stripable> _subview_stripable;
int _current_selected_track;
int _modifier_state;
ButtonMap button_map;
@@ -332,7 +333,7 @@ class MackieControlProtocol
bool needs_ipmidi_restart;
bool _metering_active;
bool _initialized;
ARDOUR::RouteNotificationList _last_selected_routes;
ARDOUR::StripableNotificationList _last_selected_stripables;
XMLNode* configuration_state;
int state_version;
int _last_bank[9];
@@ -357,10 +358,10 @@ class MackieControlProtocol
bool midi_input_handler (Glib::IOCondition ioc, MIDI::Port* port);
void clear_ports ();
void clear_surfaces ();
void force_special_route_to_strip (boost::shared_ptr<ARDOUR::Route> r, uint32_t surface, uint32_t strip_number);
void force_special_stripable_to_strip (boost::shared_ptr<ARDOUR::Stripable> r, uint32_t surface, uint32_t strip_number);
void build_button_map ();
void gui_track_selection_changed (ARDOUR::RouteNotificationListPtr, bool save_list);
void _gui_track_selection_changed (ARDOUR::RouteNotificationList*, bool save_list, bool gui_did_change);
void gui_track_selection_changed (ARDOUR::StripableNotificationListPtr, bool save_list);
void _gui_track_selection_changed (ARDOUR::StripableNotificationList*, bool save_list, bool gui_did_change);
int ipmidi_restart ();
void initialize ();
int set_device_info (const std::string& device_name);
@@ -378,7 +379,7 @@ class MackieControlProtocol
DownButtonMap _down_buttons;
DownButtonList _down_select_buttons;
void pull_route_range (DownButtonList&, ARDOUR::RouteList&);
void pull_stripable_range (DownButtonList&, ARDOUR::StripableList&);
/* implemented button handlers */
Mackie::LedState stop_press(Mackie::Button &);

View File

@@ -102,7 +102,7 @@ MackieControlProtocol::left_press (Button &)
return none;
}
Sorted sorted = get_sorted_routes();
Sorted sorted = get_sorted_stripables();
uint32_t strip_cnt = n_strips ();
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("bank left with current initial = %1 nstrips = %2 tracks/busses = %3\n",
@@ -130,7 +130,7 @@ MackieControlProtocol::right_press (Button &)
return none;
}
Sorted sorted = get_sorted_routes();
Sorted sorted = get_sorted_stripables();
uint32_t strip_cnt = n_strips();
uint32_t route_cnt = sorted.size();
uint32_t max_bank = route_cnt / strip_cnt * strip_cnt;
@@ -270,7 +270,7 @@ MackieControlProtocol::channel_left_press (Button &)
if (_subview_mode != None) {
return none;
}
Sorted sorted = get_sorted_routes();
Sorted sorted = get_sorted_stripables();
if (sorted.size() > n_strips()) {
prev_track();
return on;
@@ -291,7 +291,7 @@ MackieControlProtocol::channel_right_press (Button &)
if (_subview_mode != None) {
return none;
}
Sorted sorted = get_sorted_routes();
Sorted sorted = get_sorted_stripables();
if (sorted.size() > n_strips()) {
next_track();
return on;
@@ -703,7 +703,7 @@ LedState
MackieControlProtocol::pan_press (Button &)
{
/* XXX eventually pan may have its own subview mode */
set_subview_mode (MackieControlProtocol::None, boost::shared_ptr<Route>());
set_subview_mode (MackieControlProtocol::None, boost::shared_ptr<Stripable>());
return none;
}
LedState
@@ -726,7 +726,7 @@ MackieControlProtocol::plugin_release (Button &)
LedState
MackieControlProtocol::eq_press (Button &)
{
set_subview_mode (EQ, first_selected_route ());
set_subview_mode (EQ, first_selected_stripable ());
return none; /* led state handled by set_subview_mode() */
}
@@ -738,7 +738,7 @@ MackieControlProtocol::eq_release (Button &)
LedState
MackieControlProtocol::dyn_press (Button &)
{
set_subview_mode (Dynamics, first_selected_route ());
set_subview_mode (Dynamics, first_selected_stripable ());
return none; /* led state handled by set_subview_mode() */
}
@@ -903,7 +903,7 @@ MackieControlProtocol::clearsolo_release (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::track_press (Mackie::Button&)
{
set_subview_mode (TrackView, first_selected_route());
set_subview_mode (TrackView, first_selected_stripable());
return none;
}
Mackie::LedState
@@ -914,7 +914,7 @@ MackieControlProtocol::track_release (Mackie::Button&)
Mackie::LedState
MackieControlProtocol::send_press (Mackie::Button&)
{
set_subview_mode (Sends, first_selected_route());
set_subview_mode (Sends, first_selected_stripable());
return none; /* led state handled by set_subview_mode() */
}
Mackie::LedState

View File

@@ -166,7 +166,7 @@ Strip::add (Control & control)
}
void
Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
Strip::set_stripable (boost::shared_ptr<Stripable> r, bool /*with_messages*/)
{
if (_controls_locked) {
return;
@@ -174,7 +174,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
mb_pan_controllable.reset();
route_connections.drop_connections ();
stripable_connections.drop_connections ();
_solo->set_control (boost::shared_ptr<AutomationControl>());
_mute->set_control (boost::shared_ptr<AutomationControl>());
@@ -183,7 +183,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
_fader->set_control (boost::shared_ptr<AutomationControl>());
_vpot->set_control (boost::shared_ptr<AutomationControl>());
_route = r;
_stripable = r;
reset_saved_values ();
@@ -193,58 +193,59 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
return;
}
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface %1 strip %2 now mapping route %3\n",
_surface->number(), _index, _route->name()));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface %1 strip %2 now mapping stripable %3\n",
_surface->number(), _index, _stripable->name()));
_solo->set_control (_route->solo_control());
_mute->set_control (_route->mute_control());
_solo->set_control (_stripable->solo_control());
_mute->set_control (_stripable->mute_control());
_route->solo_control()->Changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_solo_changed, this), ui_context());
_route->mute_control()->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_mute_changed, this), ui_context());
_stripable->solo_control()->Changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_solo_changed, this), ui_context());
_stripable->mute_control()->Changed.connect(stripable_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_mute_changed, this), ui_context());
boost::shared_ptr<AutomationControl> pan_control = _route->pan_azimuth_control();
boost::shared_ptr<AutomationControl> pan_control = _stripable->pan_azimuth_control();
if (pan_control) {
pan_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_azi_changed, this, false), ui_context());
pan_control->Changed.connect(stripable_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_azi_changed, this, false), ui_context());
}
pan_control = _route->pan_width_control();
pan_control = _stripable->pan_width_control();
if (pan_control) {
pan_control->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_width_changed, this, false), ui_context());
pan_control->Changed.connect(stripable_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_panner_width_changed, this, false), ui_context());
}
_route->gain_control()->Changed.connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_gain_changed, this, false), ui_context());
_route->PropertyChanged.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_property_changed, this, _1), ui_context());
_stripable->gain_control()->Changed.connect(stripable_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_gain_changed, this, false), ui_context());
_stripable->PropertyChanged.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_property_changed, this, _1), ui_context());
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_route);
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<ARDOUR::Track>(_stripable);
if (trk) {
_recenable->set_control (trk->rec_enable_control());
trk->rec_enable_control()->Changed .connect(route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_record_enable_changed, this), ui_context());
trk->rec_enable_control()->Changed .connect(stripable_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_record_enable_changed, this), ui_context());
}
// TODO this works when a currently-banked route is made inactive, but not
// when a route is activated which should be currently banked.
// TODO this works when a currently-banked stripable is made inactive, but not
// when a stripable is activated which should be currently banked.
_route->active_changed.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_active_changed, this), ui_context());
_route->DropReferences.connect (route_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_route_deleted, this), ui_context());
// XXX Stripable
// _stripable->active_changed.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_active_changed, this), ui_context());
_stripable->DropReferences.connect (stripable_connections, MISSING_INVALIDATOR, boost::bind (&Strip::notify_stripable_deleted, this), ui_context());
/* setup legal VPot modes for this route */
/* setup legal VPot modes for this stripable */
possible_pot_parameters.clear();
if (_route->pan_azimuth_control()) {
if (_stripable->pan_azimuth_control()) {
possible_pot_parameters.push_back (PanAzimuthAutomation);
}
if (_route->pan_width_control()) {
if (_stripable->pan_width_control()) {
possible_pot_parameters.push_back (PanWidthAutomation);
}
if (_route->pan_elevation_control()) {
if (_stripable->pan_elevation_control()) {
possible_pot_parameters.push_back (PanElevationAutomation);
}
if (_route->pan_frontback_control()) {
if (_stripable->pan_frontback_control()) {
possible_pot_parameters.push_back (PanFrontBackAutomation);
}
if (_route->pan_lfe_control()) {
if (_stripable->pan_lfe_control()) {
possible_pot_parameters.push_back (PanLFEAutomation);
}
@@ -254,7 +255,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
set_vpot_parameter (_pan_mode);
}
_fader->set_control (_route->gain_control());
_fader->set_control (_stripable->gain_control());
notify_all ();
}
@@ -262,7 +263,7 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
void
Strip::notify_all()
{
if (!_route) {
if (!_stripable) {
zero ();
return;
}
@@ -284,8 +285,8 @@ Strip::notify_all()
void
Strip::notify_solo_changed ()
{
if (_route && _solo) {
_surface->write (_solo->set_state (_route->soloed() ? on : off));
if (_stripable && _solo) {
_surface->write (_solo->set_state (_stripable->solo_control()->soloed() ? on : off));
}
}
@@ -293,19 +294,19 @@ void
Strip::notify_mute_changed ()
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Strip %1 mute changed\n", _index));
if (_route && _mute) {
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("\troute muted ? %1\n", _route->muted()));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("mute message: %1\n", _mute->set_state (_route->muted() ? on : off)));
if (_stripable && _mute) {
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("\tstripable muted ? %1\n", _stripable->mute_control()->muted()));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("mute message: %1\n", _mute->set_state (_stripable->mute_control()->muted() ? on : off)));
_surface->write (_mute->set_state (_route->muted() ? on : off));
_surface->write (_mute->set_state (_stripable->mute_control()->muted() ? on : off));
}
}
void
Strip::notify_record_enable_changed ()
{
if (_route && _recenable) {
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<Track> (_route);
if (_stripable && _recenable) {
boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<Track> (_stripable);
if (trk) {
_surface->write (_recenable->set_state (trk->rec_enable_control()->get_value() ? on : off));
}
@@ -319,20 +320,20 @@ Strip::notify_active_changed ()
}
void
Strip::notify_route_deleted ()
Strip::notify_stripable_deleted ()
{
_surface->mcp().notify_route_removed ();
_surface->mcp().notify_stripable_removed ();
_surface->mcp().refresh_current_bank();
}
void
Strip::notify_gain_changed (bool force_update)
{
if (!_route) {
if (!_stripable) {
return;
}
boost::shared_ptr<AutomationControl> ac = _route->gain_control();
boost::shared_ptr<AutomationControl> ac = _stripable->gain_control();
Control* control;
if (!ac) {
@@ -382,11 +383,11 @@ Strip::notify_property_changed (const PropertyChange& what_changed)
return;
}
show_route_name ();
show_stripable_name ();
}
void
Strip::show_route_name ()
Strip::show_stripable_name ()
{
MackieControlProtocol::SubViewMode svm = _surface->mcp().subview_mode();
@@ -396,10 +397,10 @@ Strip::show_route_name ()
}
string fullname = string();
if (!_route) {
if (!_stripable) {
fullname = string();
} else {
fullname = _route->name();
fullname = _stripable->name();
}
if (fullname.length() <= 6) {
@@ -412,7 +413,7 @@ Strip::show_route_name ()
void
Strip::notify_send_level_change (AutomationType type, uint32_t send_num, bool force_update)
{
boost::shared_ptr<Route> r = _surface->mcp().subview_route();
boost::shared_ptr<Stripable> r = _surface->mcp().subview_stripable();
if (!r) {
/* not in subview mode */
@@ -443,7 +444,7 @@ Strip::notify_send_level_change (AutomationType type, uint32_t send_num, bool fo
void
Strip::notify_trackview_change (AutomationType type, uint32_t send_num, bool force_update)
{
boost::shared_ptr<Route> r = _surface->mcp().subview_route();
boost::shared_ptr<Stripable> r = _surface->mcp().subview_stripable();
if (!r) {
/* not in subview mode */
@@ -497,7 +498,7 @@ Strip::notify_trackview_change (AutomationType type, uint32_t send_num, bool for
void
Strip::notify_eq_change (AutomationType type, uint32_t band, bool force_update)
{
boost::shared_ptr<Route> r = _surface->mcp().subview_route();
boost::shared_ptr<Stripable> r = _surface->mcp().subview_stripable();
if (!r) {
/* not in subview mode */
@@ -545,7 +546,7 @@ Strip::notify_eq_change (AutomationType type, uint32_t band, bool force_update)
void
Strip::notify_dyn_change (AutomationType type, bool force_update, bool propagate_mode)
{
boost::shared_ptr<Route> r = _surface->mcp().subview_route();
boost::shared_ptr<Stripable> r = _surface->mcp().subview_stripable();
if (!r) {
/* not in subview mode */
@@ -599,13 +600,13 @@ Strip::notify_dyn_change (AutomationType type, bool force_update, bool propagate
void
Strip::notify_panner_azi_changed (bool force_update)
{
if (!_route) {
if (!_stripable) {
return;
}
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("pan change for strip %1\n", _index));
boost::shared_ptr<AutomationControl> pan_control = _route->pan_azimuth_control ();
boost::shared_ptr<AutomationControl> pan_control = _stripable->pan_azimuth_control ();
if (!pan_control) {
/* basically impossible, since we're here because that control
@@ -634,13 +635,13 @@ Strip::notify_panner_azi_changed (bool force_update)
void
Strip::notify_panner_width_changed (bool force_update)
{
if (!_route) {
if (!_stripable) {
return;
}
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("pan width change for strip %1\n", _index));
boost::shared_ptr<AutomationControl> pan_control = _route->pan_width_control ();
boost::shared_ptr<AutomationControl> pan_control = _stripable->pan_width_control ();
if (!pan_control) {
/* basically impossible, since we're here because that control
@@ -738,7 +739,7 @@ Strip::vselect_event (Button&, ButtonState bs)
* explicitly.
*/
boost::shared_ptr<Route> r = _surface->mcp().subview_route();
boost::shared_ptr<Stripable> r = _surface->mcp().subview_stripable();
if (r) {
@@ -763,7 +764,7 @@ Strip::vselect_event (Button&, ButtonState bs)
} else {
/* we just turned it on, show the level
*/
control = _route->send_level_controllable (global_pos);
control = _stripable->send_level_controllable (global_pos);
do_parameter_display (BusSendLevel, control->get_value());
}
}
@@ -792,8 +793,8 @@ Strip::vselect_event (Button&, ButtonState bs)
} else {
#ifdef MIXBUS
if (_route) {
boost::shared_ptr<AutomationControl> ac = _route->master_send_enable_controllable ();
if (_stripable) {
boost::shared_ptr<AutomationControl> ac = _stripable->master_send_enable_controllable ();
if (ac) {
Controllable::GroupControlDisposition gcd;
@@ -951,10 +952,10 @@ Strip::do_parameter_display (AutomationType type, float val)
pending_display[1] = buf;
screen_hold = true;
} else {
if (_route) {
boost::shared_ptr<Pannable> p = _route->pannable();
if (p && _route->panner()) {
pending_display[1] =_route->panner()->value_as_string (p->pan_azimuth_control);
if (_stripable) {
boost::shared_ptr<AutomationControl> pa = _stripable->pan_azimuth_control();
if (pa) {
pending_display[1] = pa->get_user_string ();
screen_hold = true;
}
}
@@ -962,7 +963,7 @@ Strip::do_parameter_display (AutomationType type, float val)
break;
case PanWidthAutomation:
if (_route) {
if (_stripable) {
snprintf (buf, sizeof (buf), "%5ld%%", lrintf ((val * 200.0)-100));
pending_display[1] = buf;
screen_hold = true;
@@ -970,7 +971,7 @@ Strip::do_parameter_display (AutomationType type, float val)
break;
case TrimAutomation:
if (_route) {
if (_stripable) {
float dB = accurate_coefficient_to_dB (val);
snprintf (buf, sizeof (buf), "%6.1f", dB);
pending_display[1] = buf;
@@ -979,7 +980,7 @@ Strip::do_parameter_display (AutomationType type, float val)
break;
case PhaseAutomation:
if (_route) {
if (_stripable) {
if (val < 0.5) {
pending_display[1] = "Normal";
} else {
@@ -1011,8 +1012,8 @@ Strip::do_parameter_display (AutomationType type, float val)
}
break;
case CompMode:
if (_surface->mcp().subview_route()) {
pending_display[1] = _surface->mcp().subview_route()->comp_mode_name (val);
if (_surface->mcp().subview_stripable()) {
pending_display[1] = _surface->mcp().subview_stripable()->comp_mode_name (val);
}
break;
case SoloSafeAutomation:
@@ -1193,17 +1194,17 @@ Strip::redisplay (ARDOUR::microseconds_t now, bool force)
void
Strip::update_automation ()
{
if (!_route) {
if (!_stripable) {
return;
}
ARDOUR::AutoState state = _route->gain_control()->automation_state();
ARDOUR::AutoState state = _stripable->gain_control()->automation_state();
if (state == Touch || state == Play) {
notify_gain_changed (false);
}
boost::shared_ptr<AutomationControl> pan_control = _route->pan_azimuth_control ();
boost::shared_ptr<AutomationControl> pan_control = _stripable->pan_azimuth_control ();
if (pan_control) {
state = pan_control->automation_state ();
if (state == Touch || state == Play) {
@@ -1211,7 +1212,7 @@ Strip::update_automation ()
}
}
pan_control = _route->pan_width_control ();
pan_control = _stripable->pan_width_control ();
if (pan_control) {
state = pan_control->automation_state ();
if (state == Touch || state == Play) {
@@ -1223,7 +1224,7 @@ Strip::update_automation ()
void
Strip::update_meter ()
{
if (!_route) {
if (!_stripable) {
return;
}
@@ -1232,7 +1233,7 @@ Strip::update_meter ()
}
if (_meter && _transport_is_rolling && _metering_active) {
float dB = _route->peak_meter()->meter_level (0, MeterMCP);
float dB = _stripable->peak_meter()->meter_level (0, MeterMCP);
_meter->send_update (*_surface, dB);
return;
}
@@ -1313,10 +1314,10 @@ Strip::unlock_controls ()
}
void
Strip::gui_selection_changed (const ARDOUR::StrongRouteNotificationList& rl)
Strip::gui_selection_changed (const ARDOUR::StrongStripableNotificationList& rl)
{
for (ARDOUR::StrongRouteNotificationList::const_iterator i = rl.begin(); i != rl.end(); ++i) {
if ((*i) == _route) {
for (ARDOUR::StrongStripableNotificationList::const_iterator i = rl.begin(); i != rl.end(); ++i) {
if ((*i) == _stripable) {
_surface->write (_select->set_state (on));
return;
}
@@ -1411,7 +1412,7 @@ Strip::return_to_vpot_mode_display ()
if (_surface->mcp().subview_mode() != MackieControlProtocol::None) {
/* do nothing - second line shows value of current subview parameter */
return;
} else if (_route) {
} else if (_stripable) {
pending_display[1] = vpot_mode_string();
} else {
pending_display[1] = string();
@@ -1471,7 +1472,7 @@ Strip::next_pot_mode ()
void
Strip::subview_mode_changed ()
{
boost::shared_ptr<Route> r = _surface->mcp().subview_route();
boost::shared_ptr<Stripable> r = _surface->mcp().subview_stripable();
subview_connections.drop_connections ();
@@ -1479,8 +1480,8 @@ Strip::subview_mode_changed ()
case MackieControlProtocol::None:
set_vpot_parameter (_pan_mode);
/* need to show strip name again */
show_route_name ();
if (!_route) {
show_stripable_name ();
if (!_stripable) {
_surface->write (_vpot->set (0, true, Pot::wrap));
_surface->write (_fader->set_position (0.0));
}
@@ -1525,7 +1526,7 @@ Strip::subview_mode_changed ()
}
void
Strip::setup_dyn_vpot (boost::shared_ptr<Route> r)
Strip::setup_dyn_vpot (boost::shared_ptr<Stripable> r)
{
if (!r) {
return;
@@ -1610,7 +1611,7 @@ Strip::setup_dyn_vpot (boost::shared_ptr<Route> r)
}
void
Strip::setup_eq_vpot (boost::shared_ptr<Route> r)
Strip::setup_eq_vpot (boost::shared_ptr<Stripable> r)
{
uint32_t bands = r->eq_band_cnt ();
@@ -1745,7 +1746,7 @@ Strip::setup_eq_vpot (boost::shared_ptr<Route> r)
}
void
Strip::setup_sends_vpot (boost::shared_ptr<Route> r)
Strip::setup_sends_vpot (boost::shared_ptr<Stripable> r)
{
if (!r) {
return;
@@ -1770,7 +1771,7 @@ Strip::setup_sends_vpot (boost::shared_ptr<Route> r)
}
void
Strip::setup_trackview_vpot (boost::shared_ptr<Route> r)
Strip::setup_trackview_vpot (boost::shared_ptr<Stripable> r)
{
if (!r) {
return;
@@ -1854,7 +1855,7 @@ Strip::setup_trackview_vpot (boost::shared_ptr<Route> r)
void
Strip::set_vpot_parameter (AutomationType p)
{
if (!_route || (p == NullAutomation)) {
if (!_stripable || (p == NullAutomation)) {
_vpot->set_control (boost::shared_ptr<AutomationControl>());
pending_display[1] = string();
return;
@@ -1868,10 +1869,10 @@ Strip::set_vpot_parameter (AutomationType p)
switch (p) {
case PanAzimuthAutomation:
pan_control = _route->pan_azimuth_control ();
pan_control = _stripable->pan_azimuth_control ();
break;
case PanWidthAutomation:
pan_control = _route->pan_width_control ();
pan_control = _stripable->pan_width_control ();
break;
case PanElevationAutomation:
break;
@@ -1894,7 +1895,7 @@ Strip::set_vpot_parameter (AutomationType p)
bool
Strip::is_midi_track () const
{
return boost::dynamic_pointer_cast<MidiTrack>(_route) != 0;
return boost::dynamic_pointer_cast<MidiTrack>(_stripable) != 0;
}
void
@@ -1914,7 +1915,7 @@ Strip::notify_metering_state_changed()
return;
}
if (!_route || !_meter) {
if (!_stripable || !_meter) {
return;
}

View File

@@ -20,7 +20,7 @@
#include "device_info.h"
namespace ARDOUR {
class Route;
class Stripable;
class Bundle;
class ChannelCount;
}
@@ -53,13 +53,13 @@ public:
Strip (Surface&, const std::string & name, int index, const std::map<Button::ID,StripButtonInfo>&);
~Strip();
boost::shared_ptr<ARDOUR::Route> route() const { return _route; }
boost::shared_ptr<ARDOUR::Stripable> stripable() const { return _stripable; }
void add (Control & control);
int index() const { return _index; } // zero based
Surface* surface() const { return _surface; }
void set_route (boost::shared_ptr<ARDOUR::Route>, bool with_messages = true);
void set_stripable (boost::shared_ptr<ARDOUR::Stripable>, bool with_messages = true);
// call all signal handlers manually
void notify_all ();
@@ -84,7 +84,7 @@ public:
void unlock_controls ();
bool locked() const { return _controls_locked; }
void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&);
void gui_selection_changed (const ARDOUR::StrongStripableNotificationList&);
void notify_metering_state_changed();
@@ -115,8 +115,8 @@ private:
std::string current_display[2];
uint64_t _block_screen_redisplay_until;
uint64_t return_to_vpot_mode_display_at;
boost::shared_ptr<ARDOUR::Route> _route;
PBD::ScopedConnectionList route_connections;
boost::shared_ptr<ARDOUR::Stripable> _stripable;
PBD::ScopedConnectionList stripable_connections;
PBD::ScopedConnectionList subview_connections;
PBD::ScopedConnectionList send_connections;
int eq_band;
@@ -136,7 +136,7 @@ private:
void notify_panner_azi_changed (bool force_update = true);
void notify_panner_width_changed (bool force_update = true);
void notify_active_changed ();
void notify_route_deleted ();
void notify_stripable_deleted ();
void notify_processor_changed (bool force_update = true);
void update_automation ();
void update_meter ();
@@ -155,23 +155,23 @@ private:
std::vector<ARDOUR::AutomationType> possible_pot_parameters;
std::vector<ARDOUR::AutomationType> possible_trim_parameters;
void set_vpot_parameter (ARDOUR::AutomationType);
void show_route_name ();
void show_stripable_name ();
void reset_saved_values ();
bool is_midi_track () const;
void notify_eq_change (ARDOUR::AutomationType, uint32_t band, bool force);
void setup_eq_vpot (boost::shared_ptr<ARDOUR::Route>);
void setup_eq_vpot (boost::shared_ptr<ARDOUR::Stripable>);
void notify_dyn_change (ARDOUR::AutomationType, bool force, bool propagate_mode_change);
void setup_dyn_vpot (boost::shared_ptr<ARDOUR::Route>);
void setup_dyn_vpot (boost::shared_ptr<ARDOUR::Stripable>);
void notify_send_level_change (ARDOUR::AutomationType, uint32_t band, bool force);
void setup_sends_vpot (boost::shared_ptr<ARDOUR::Route>);
void setup_sends_vpot (boost::shared_ptr<ARDOUR::Stripable>);
void notify_trackview_change (ARDOUR::AutomationType, uint32_t band, bool force);
void setup_trackview_vpot (boost::shared_ptr<ARDOUR::Route>);
void setup_trackview_vpot (boost::shared_ptr<ARDOUR::Stripable>);
};
}

View File

@@ -65,7 +65,7 @@
using namespace std;
using namespace PBD;
using ARDOUR::Route;
using ARDOUR::Stripable;
using ARDOUR::Panner;
using ARDOUR::Profile;
using ARDOUR::AutomationControl;
@@ -377,7 +377,7 @@ Surface::master_monitor_may_have_changed ()
void
Surface::setup_master ()
{
boost::shared_ptr<Route> m;
boost::shared_ptr<Stripable> m;
if ((m = _mcp.get_session().monitor_out()) == 0) {
m = _mcp.get_session().master_out();
@@ -932,29 +932,29 @@ Surface::write (const MidiByteArray& data)
}
void
Surface::map_routes (const vector<boost::shared_ptr<Route> >& routes)
Surface::map_stripables (const vector<boost::shared_ptr<Stripable> >& stripables)
{
vector<boost::shared_ptr<Route> >::const_iterator r;
vector<boost::shared_ptr<Stripable> >::const_iterator r;
Strips::iterator s = strips.begin();
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mapping %1 routes to %2 strips\n", routes.size(), strips.size()));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mapping %1 stripables to %2 strips\n", stripables.size(), strips.size()));
for (r = routes.begin(); r != routes.end() && s != strips.end(); ++s) {
for (r = stripables.begin(); r != stripables.end() && s != strips.end(); ++s) {
/* don't try to assign routes to a locked strip. it won't
/* don't try to assign stripables to a locked strip. it won't
use it anyway, but if we do, then we get out of sync
with the proposed mapping.
*/
if (!(*s)->locked()) {
(*s)->set_route (*r);
(*s)->set_stripable (*r);
++r;
}
}
for (; s != strips.end(); ++s) {
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("strip %1 being set to null route\n", (*s)->index()));
(*s)->set_route (boost::shared_ptr<Route>());
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("strip %1 being set to null stripable\n", (*s)->index()));
(*s)->set_stripable (boost::shared_ptr<Stripable>());
}
}
@@ -1142,10 +1142,10 @@ Surface::update_view_mode_display (bool with_helpful_text)
}
void
Surface::gui_selection_changed (const ARDOUR::StrongRouteNotificationList& routes)
Surface::gui_selection_changed (const ARDOUR::StrongStripableNotificationList& stripables)
{
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
(*s)->gui_selection_changed (routes);
(*s)->gui_selection_changed (stripables);
}
}
@@ -1174,10 +1174,10 @@ Surface::set_jog_mode (JogWheel::Mode)
}
bool
Surface::route_is_locked_to_strip (boost::shared_ptr<Route> r) const
Surface::stripable_is_locked_to_strip (boost::shared_ptr<Stripable> stripable) const
{
for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
if ((*s)->route() == r && (*s)->locked()) {
if ((*s)->stripable() == stripable && (*s)->locked()) {
return true;
}
}
@@ -1185,10 +1185,10 @@ Surface::route_is_locked_to_strip (boost::shared_ptr<Route> r) const
}
bool
Surface::route_is_mapped (boost::shared_ptr<Route> r) const
Surface::stripable_is_mapped (boost::shared_ptr<Stripable> stripable) const
{
for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
if ((*s)->route() == r) {
if ((*s)->stripable() == stripable) {
return true;
}
}

View File

@@ -22,7 +22,7 @@ namespace MIDI {
}
namespace ARDOUR {
class Route;
class Stripable;
class Port;
}
@@ -79,8 +79,8 @@ public:
uint32_t n_strips (bool with_locked_strips = true) const;
Strip* nth_strip (uint32_t n) const;
bool route_is_locked_to_strip (boost::shared_ptr<ARDOUR::Route>) const;
bool route_is_mapped (boost::shared_ptr<ARDOUR::Route>) const;
bool stripable_is_locked_to_strip (boost::shared_ptr<ARDOUR::Stripable>) const;
bool stripable_is_mapped (boost::shared_ptr<ARDOUR::Stripable>) const;
/// This collection owns the groups
typedef std::map<std::string,Group*> Groups;
@@ -88,7 +88,7 @@ public:
SurfacePort& port() const { return *_port; }
void map_routes (const std::vector<boost::shared_ptr<ARDOUR::Route> >& routes);
void map_stripables (const std::vector<boost::shared_ptr<ARDOUR::Stripable> >&);
const MidiByteArray& sysex_hdr() const;
@@ -155,7 +155,7 @@ public:
void update_view_mode_display (bool with_helpful_text);
void update_flip_mode_display ();
void gui_selection_changed (const ARDOUR::StrongRouteNotificationList&);
void gui_selection_changed (const ARDOUR::StrongStripableNotificationList&);
void subview_mode_changed ();
MackieControlProtocol& mcp() const { return _mcp; }