From 247f8a0809f52b54ac219948011c12ff5f0570ef Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 22 Jan 2017 19:48:10 +0100 Subject: implement Session::route_by_selected_count() --- libs/ardour/session.cc | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'libs/ardour') 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(); } -boost::shared_ptr -Session::route_by_selected_count (uint32_t id) const -{ - boost::shared_ptr r = routes.reader (); - - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { - /* NOT IMPLEMENTED */ - } - - return boost::shared_ptr ((Route*) 0); -} - struct PresentationOrderSorter { bool operator() (boost::shared_ptr a, boost::shared_ptr b) { if (a->presentation_info().special() && !b->presentation_info().special()) { @@ -4362,6 +4350,27 @@ struct PresentationOrderSorter { } }; +boost::shared_ptr +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 (); +} + void Session::reassign_track_numbers () { -- cgit v1.2.3