diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-26 14:28:41 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-26 14:28:41 +0000 |
commit | 3b7e2f7d67ad87bfb0ce183c10e9d00e71b6b085 (patch) | |
tree | 91e31a908368cc3a194deebe4761373d23f37f9f /libs/surfaces/mackie/mackie_control_protocol.cc | |
parent | 42d018ffa81b026ff4dc5d6a290bb118c6f244e7 (diff) |
MCP: properly (?) handle bank/channel scrolling with locked strips
git-svn-id: svn://localhost/ardour2/branches/3.0@12095 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces/mackie/mackie_control_protocol.cc')
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 82e9ea6df2..78fed5cb82 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -192,6 +192,17 @@ MackieControlProtocol::next_track() } } +bool +MackieControlProtocol::route_is_locked_to_strip (boost::shared_ptr<Route> r) const +{ + for (Surfaces::const_iterator si = surfaces.begin(); si != surfaces.end(); ++si) { + if ((*si)->route_is_locked_to_strip (r)) { + return true; + } + } + return false; +} + // predicate for sort call in get_sorted_routes struct RouteByRemoteId { @@ -229,13 +240,19 @@ MackieControlProtocol::get_sorted_routes() for (RouteList::iterator it = routes->begin(); it != routes->end(); ++it) { - Route & route = **it; + boost::shared_ptr<Route> route = *it; - if (remote_ids.find (route.remote_control_id()) != remote_ids.end()) { + if (remote_ids.find (route->remote_control_id()) != remote_ids.end()) { continue; } - if (route.is_hidden() || route.is_master() || route.is_monitor()) { + if (route->is_hidden() || route->is_master() || route->is_monitor()) { + continue; + } + + /* don't include locked routes */ + + if (route_is_locked_to_strip(route)) { continue; } @@ -261,7 +278,7 @@ MackieControlProtocol::get_sorted_routes() } sorted.push_back (*it); - remote_ids.insert (route.remote_control_id()); + remote_ids.insert (route->remote_control_id()); } sort (sorted.begin(), sorted.end(), RouteByRemoteId()); @@ -275,12 +292,12 @@ MackieControlProtocol::refresh_current_bank() } uint32_t -MackieControlProtocol::n_strips() const +MackieControlProtocol::n_strips (bool with_locked_strips) const { uint32_t strip_count = 0; for (Surfaces::const_iterator si = surfaces.begin(); si != surfaces.end(); ++si) { - strip_count += (*si)->n_strips (); + strip_count += (*si)->n_strips (with_locked_strips); } return strip_count; @@ -296,7 +313,8 @@ MackieControlProtocol::switch_banks (uint32_t initial, bool force) } Sorted sorted = get_sorted_routes(); - uint32_t strip_cnt = n_strips(); + uint32_t strip_cnt = n_strips (false); // do not include locked strips + // in this count if (sorted.size() <= strip_cnt && !force) { /* no banking - not enough routes to fill all strips */ @@ -327,9 +345,9 @@ MackieControlProtocol::switch_banks (uint32_t initial, bool force) vector<boost::shared_ptr<Route> > routes; uint32_t added = 0; - DEBUG_TRACE (DEBUG::MackieControl, string_compose ("surface has %1 strips\n", (*si)->n_strips())); + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("surface has %1 unlockedstrips\n", (*si)->n_strips (false))); - for (; r != sorted.end() && added < (*si)->n_strips(); ++r, ++added) { + for (; r != sorted.end() && added < (*si)->n_strips (false); ++r, ++added) { routes.push_back (*r); } |