diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-06-10 13:50:19 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-06-10 13:57:18 -0400 |
commit | 2d4358ddb5e9cf3cd21b603b74dc999aaebf53a2 (patch) | |
tree | 156fb8fa0d0e182cacece8d112cb4dec3fd3f5aa /libs/ardour/session.cc | |
parent | 3eaa6c038988776e3bab441b84de45b2a8364130 (diff) |
Various changes to PresentationInfo and a small consolidation of sorters.
The semantics for sorting PresentationInfo are up to the caller, not the
PresentationInfo object, so operator<() was removed and callers specifically
invoke ::order() for sorting.
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r-- | libs/ardour/session.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 6b8c7f3ed8..88c958495e 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -4225,11 +4225,23 @@ Session::get_remote_nth_route (PresentationInfo::order_t n) const return boost::dynamic_pointer_cast<Route> (get_remote_nth_stripable (n, PresentationInfo::Route)); } -struct GlobalPresentationOrderSorter { - bool operator() (boost::shared_ptr<Stripable> a, boost::shared_ptr<Stripable> b) { - return a->presentation_info() < b->presentation_info(); +boost::shared_ptr<Stripable> +Session::get_nth_stripable (PresentationInfo::order_t n) const +{ + StripableList sl; + + get_stripables (sl); + + for (StripableList::const_iterator s = sl.begin(); s != sl.end(); ++s) { + if ((*s)->presentation_info().order() == n) { + return *s; + } } -}; + + /* there is no nth stripable */ + + return boost::shared_ptr<Stripable>(); +} boost::shared_ptr<Stripable> Session::get_remote_nth_stripable (PresentationInfo::order_t n, PresentationInfo::Flag flags) const @@ -4238,7 +4250,7 @@ Session::get_remote_nth_stripable (PresentationInfo::order_t n, PresentationInfo PresentationInfo::order_t match_cnt = 0; get_stripables (sl); - sl.sort (GlobalPresentationOrderSorter()); + sl.sort (Stripable::PresentationOrderSorter()); for (StripableList::const_iterator s = sl.begin(); s != sl.end(); ++s) { if ((*s)->presentation_info().flag_match (flags)) { @@ -5370,7 +5382,7 @@ Session::RoutePublicOrderSorter::operator() (boost::shared_ptr<Route> a, boost:: if (b->is_monitor()) { return false; } - return a->presentation_info() < b->presentation_info(); + return a->presentation_info().order() < b->presentation_info().order(); } bool |