From d0e3eb42a62343ca91d5efef40003c0035039e7d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 17 Feb 2017 00:50:52 +0100 Subject: Fix initial order-keys when creating tracks/busses .. and leave some notes for the day when UI treemodel won't be canonical to set order-keys. --- libs/ardour/session.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'libs') diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 540665be18..e28685d03f 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3484,6 +3484,16 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool } } + /* auditioner and monitor routes are not part of the order */ + if (auditioner) { + assert (n_routes > 0); + --n_routes; + } + if (_monitor_out) { + assert (n_routes > 0); + --n_routes; + } + DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("ensure order gap starting at %1 for %2\n", order, new_routes.size())); ensure_route_presentation_info_gap (order, new_routes.size()); @@ -3532,6 +3542,17 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool /* presentation info order may already have been set from XML */ if (!r->presentation_info().order_set()) { + /* this is only useful for headless sessions, + * Editor::add_routes() and Mixer_UI::add_routes() will + * override it following the RouteAdded signal. + * + * Also routes should be sorted before VCAs (like the GUI does). + * Session::ensure_route_presentation_info_gap() does not special case VCAs either. + * + * ... but not to worry, the GUI's + * gtk2_ardour/route_sorter.h and various ::sync_presentation_info_from_treeview() + * handle this :) + */ if (order == PresentationInfo::max_order) { /* just add to the end */ -- cgit v1.2.3