diff options
author | Robin Gareus <robin@gareus.org> | 2017-06-16 23:44:09 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-06-17 04:36:22 +0200 |
commit | 867a0f5228ae7b9ad3d05142e58762d4f7ef3936 (patch) | |
tree | afc7649ce58a625b63ce9c1845eedaa9cb2543ed /libs/ardour/ardour/stripable.h | |
parent | 921bdd4a51d53af26e28548641ff461080390da7 (diff) |
Move StripableSorter into libardour
Diffstat (limited to 'libs/ardour/ardour/stripable.h')
-rw-r--r-- | libs/ardour/ardour/stripable.h | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/libs/ardour/ardour/stripable.h b/libs/ardour/ardour/stripable.h index b657ac6161..5f71c6ae5f 100644 --- a/libs/ardour/ardour/stripable.h +++ b/libs/ardour/ardour/stripable.h @@ -87,9 +87,67 @@ class LIBARDOUR_API Stripable : public SessionObject, void set_presentation_order (PresentationInfo::order_t); - struct PresentationOrderSorter { - bool operator() (boost::shared_ptr<Stripable> a, boost::shared_ptr<Stripable> b) { - return a->presentation_info().order() < b->presentation_info().order(); + struct Sorter + { + bool _mixer_order; // master is last + Sorter (bool mixer_order = false) : _mixer_order (mixer_order) {} + + bool operator() (boost::shared_ptr<ARDOUR::Stripable> a, boost::shared_ptr<ARDOUR::Stripable> b) + { + if (a->presentation_info().flags () == b->presentation_info().flags ()) { + return a->presentation_info().order() < b->presentation_info().order(); + } + + int cmp_a = 0; + int cmp_b = 0; + + if (a->is_auditioner ()) { cmp_a = -2; } + if (b->is_auditioner ()) { cmp_b = -2; } + if (a->is_monitor ()) { cmp_a = -1; } + if (b->is_monitor ()) { cmp_b = -1; } + + /* ARDOUR-Editor: [Track|Bus|Master] (0) < VCA (3) + * ARDOUR-Mixer : [Track|Bus] (0) < VCA (3) < Master (4) + * + * Mixbus-Editor: [Track|Bus] (0) < Mixbus (1) < VCA (3) < Master (4) + * Mixbus-Mixer : [Track|Bus] (0) < Mixbus (1) < Master (2) < VCA (3) + */ + + if (a->presentation_info().flags () & ARDOUR::PresentationInfo::VCA) { + cmp_a = 3; + } +#ifdef MIXBUS + else if (a->presentation_info().flags () & ARDOUR::PresentationInfo::MasterOut) { + cmp_a = _mixer_order ? 2 : 4; + } + else if ((a->presentation_info().flags () & ARDOUR::PresentationInfo::Mixbus) || a->mixbus()) { + cmp_a = 1; + } +#endif + else if (_mixer_order && (a->presentation_info().flags () & ARDOUR::PresentationInfo::MasterOut)) { + cmp_a = 4; + } + + + if (b->presentation_info().flags () & ARDOUR::PresentationInfo::VCA) { + cmp_b = 3; + } +#ifdef MIXBUS + else if (b->presentation_info().flags () & ARDOUR::PresentationInfo::MasterOut) { + cmp_b = _mixer_order ? 2 : 4; + } + else if ((b->presentation_info().flags () & ARDOUR::PresentationInfo::Mixbus) || b->mixbus()) { + cmp_b = 1; + } +#endif + else if (_mixer_order && (b->presentation_info().flags () & ARDOUR::PresentationInfo::MasterOut)) { + cmp_b = 4; + } + + if (cmp_a == cmp_b) { + return a->presentation_info().order() < b->presentation_info().order(); + } + return cmp_a < cmp_b; } }; |