diff options
author | Robin Gareus <robin@gareus.org> | 2017-06-17 02:31:03 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-06-17 04:36:32 +0200 |
commit | 140c511d2c123aafdb5f74ce0be070e2b464f7dc (patch) | |
tree | ffaa59c64fc06cf17b47d2eaf7477f1aca91dc3b | |
parent | 10db824461e3bd8eb0661ddfb35da283192e8c29 (diff) |
Add method to ensure Stripable sort constrains (for UI use)
-rw-r--r-- | libs/ardour/ardour/session.h | 3 | ||||
-rw-r--r-- | libs/ardour/session.cc | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 8217f45149..303c0bc457 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -873,6 +873,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop boost::shared_ptr<Route> monitor_out() const { return _monitor_out; } boost::shared_ptr<Route> master_out() const { return _master_out; } + PresentationInfo::order_t master_order_key () const { return _master_out ? _master_out->presentation_info ().order () : -1; } + bool ensure_stripable_sort_order (); + void globally_add_internal_sends (boost::shared_ptr<Route> dest, Placement p, bool); void globally_set_send_gains_from_track (boost::shared_ptr<Route> dest); void globally_set_send_gains_to_zero (boost::shared_ptr<Route> dest); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 6c2cbd3601..ae1aff5498 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3037,6 +3037,30 @@ Session::reconnect_mmc_ports(bool inputs) #endif +bool +Session::ensure_stripable_sort_order () +{ + StripableList sl; + get_stripables (sl); + sl.sort (Stripable::Sorter ()); + + bool change = false; + PresentationInfo::order_t order = 0; + + for (StripableList::iterator si = sl.begin(); si != sl.end(); ++si) { + boost::shared_ptr<Stripable> s (*si); + if (s->is_monitor () || s->is_auditioner ()) { + continue; + } + if (order != s->presentation_info().order()) { + s->set_presentation_order (order); + change = true; + } + ++order; + } + return change; +} + void Session::ensure_route_presentation_info_gap (PresentationInfo::order_t first_new_order, uint32_t how_many) { |