summaryrefslogtreecommitdiff
path: root/libs/surfaces/mackie/surface.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-04-26 14:28:41 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-04-26 14:28:41 +0000
commit3b7e2f7d67ad87bfb0ce183c10e9d00e71b6b085 (patch)
tree91e31a908368cc3a194deebe4761373d23f37f9f /libs/surfaces/mackie/surface.cc
parent42d018ffa81b026ff4dc5d6a290bb118c6f244e7 (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/surface.cc')
-rw-r--r--libs/surfaces/mackie/surface.cc39
1 files changed, 35 insertions, 4 deletions
diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc
index 71198a7464..f27ac3893e 100644
--- a/libs/surfaces/mackie/surface.cc
+++ b/libs/surfaces/mackie/surface.cc
@@ -520,9 +520,20 @@ Surface::write_sysex (MIDI::byte msg)
}
uint32_t
-Surface::n_strips () const
+Surface::n_strips (bool with_locked_strips) const
{
- return strips.size();
+ if (with_locked_strips) {
+ return strips.size();
+ }
+
+ uint32_t n = 0;
+
+ for (Strips::const_iterator it = strips.begin(); it != strips.end(); ++it) {
+ if (!(*it)->locked()) {
+ ++n;
+ }
+ }
+ return n;
}
Strip*
@@ -597,8 +608,17 @@ Surface::map_routes (const vector<boost::shared_ptr<Route> >& routes)
vector<boost::shared_ptr<Route> >::const_iterator r;
Strips::iterator s;
- for (r = routes.begin(), s = strips.begin(); r != routes.end() && s != strips.end(); ++r, ++s) {
- (*s)->set_route (*r);
+ for (r = routes.begin(), s = strips.begin(); r != routes.end() && s != strips.end(); ++s) {
+
+ /* don't try to assign routes 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);
+ ++r;
+ }
}
for (; s != strips.end(); ++s) {
@@ -803,3 +823,14 @@ void
Surface::set_jog_mode (JogWheel::Mode m)
{
}
+
+bool
+Surface::route_is_locked_to_strip (boost::shared_ptr<Route> r) const
+{
+ for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) {
+ if ((*s)->route() == r && (*s)->locked()) {
+ return true;
+ }
+ }
+ return false;
+}