summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2017-01-22 19:48:10 +0100
committerPaul Davis <paul@linuxaudiosystems.com>2017-01-22 19:49:40 +0100
commit247f8a0809f52b54ac219948011c12ff5f0570ef (patch)
tree64934f7113d4fb7b26d60ff2dbc973ac77ae8547 /libs/ardour/session.cc
parent2f1899d5dd120e613671eded3c6ad9cedeb06598 (diff)
implement Session::route_by_selected_count()
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc33
1 files changed, 21 insertions, 12 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 24a531b424..f3e23e237c 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -4336,18 +4336,6 @@ Session::get_remote_nth_stripable (PresentationInfo::order_t n, PresentationInfo
return boost::shared_ptr<Stripable>();
}
-boost::shared_ptr<Route>
-Session::route_by_selected_count (uint32_t id) const
-{
- boost::shared_ptr<RouteList> r = routes.reader ();
-
- for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- /* NOT IMPLEMENTED */
- }
-
- return boost::shared_ptr<Route> ((Route*) 0);
-}
-
struct PresentationOrderSorter {
bool operator() (boost::shared_ptr<Stripable> a, boost::shared_ptr<Stripable> b) {
if (a->presentation_info().special() && !b->presentation_info().special()) {
@@ -4362,6 +4350,27 @@ struct PresentationOrderSorter {
}
};
+boost::shared_ptr<Route>
+Session::route_by_selected_count (uint32_t id) const
+{
+ RouteList r (*(routes.reader ()));
+ PresentationOrderSorter sorter;
+ r.sort (sorter);
+
+ RouteList::iterator i;
+
+ for (i = r.begin(); i != r.end(); ++i) {
+ if ((*i)->presentation_info().selected()) {
+ if (id == 0) {
+ return *i;
+ }
+ --id;
+ }
+ }
+
+ return boost::shared_ptr<Route> ();
+}
+
void
Session::reassign_track_numbers ()
{