X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_channel_selector.cc;h=09dab030407c99b9c244bcb037390aa4cdd78d66;hb=17f5fb81d2c9d2394f62169b90c15bf371b44f6c;hp=939fbee950b1655f8621556f816f5c877e0ad526;hpb=53a97515328c5cea1da0d2ef2001fc5890ca7a95;p=ardour.git diff --git a/gtk2_ardour/export_channel_selector.cc b/gtk2_ardour/export_channel_selector.cc index 939fbee950..09dab03040 100644 --- a/gtk2_ardour/export_channel_selector.cc +++ b/gtk2_ardour/export_channel_selector.cc @@ -18,8 +18,6 @@ */ -#include "export_channel_selector.h" - #include #include "pbd/convert.h" @@ -33,19 +31,16 @@ #include -#include "i18n.h" +#include "export_channel_selector.h" +#include "route_sorter.h" + +#include "pbd/i18n.h" using namespace std; using namespace Glib; using namespace ARDOUR; using namespace PBD; -struct EditorOrderRouteSorter { - bool operator() (boost::shared_ptr a, boost::shared_ptr b) { - return a->order_key () < b->order_key (); - } -}; - PortExportChannelSelector::PortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager) : ExportChannelSelector (session, manager), channels_label (_("Channels:"), Gtk::ALIGN_LEFT), @@ -104,6 +99,11 @@ PortExportChannelSelector::sync_with_manager () split_checkbox.set_active (state->config->get_split()); channels_spinbutton.set_value (state->config->get_n_chans()); + /* when loading presets, config is ready set here (shared ptr) + * fill_route_list () -> update_channel_count () -> set_channel_count () -> update_config() + * will call config->clear_channels(); and clear the config + */ + channel_view.set_config (ChannelConfigPtr ()); fill_route_list (); channel_view.set_config (state->config); } @@ -112,7 +112,7 @@ void PortExportChannelSelector::fill_route_list () { channel_view.clear_routes (); - RouteList routes = *_session->get_routes(); + RouteList routes = _session->get_routelist(); /* Add master bus and then everything else */ @@ -121,7 +121,7 @@ PortExportChannelSelector::fill_route_list () channel_view.add_route (master); } - routes.sort (EditorOrderRouteSorter ()); + routes.sort (Stripable::Sorter ()); for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) { if ((*it)->is_master () || (*it)->is_monitor ()) { @@ -217,6 +217,7 @@ PortExportChannelSelector::ChannelTreeView::set_config (ChannelConfigPtr c) if (config == c) { return; } config = c; + if (!config) { return; } uint32_t i = 1; ExportChannelConfiguration::ChannelList chan_list = config->get_channels(); @@ -237,7 +238,7 @@ PortExportChannelSelector::ChannelTreeView::set_config (ChannelConfigPtr c) for (Gtk::ListStore::Children::const_iterator p_it = port_list->children().begin(); p_it != port_list->children().end(); ++p_it) { route_ports.insert ((*p_it)->get_value (route_cols.port_cols.port)); port_labels.insert (make_pair ((*p_it)->get_value (route_cols.port_cols.port), - (*p_it)->get_value (route_cols.port_cols.label))); + (*p_it)->get_value (route_cols.port_cols.label))); } std::set_intersection (pec->get_ports().begin(), pec->get_ports().end(), @@ -454,15 +455,15 @@ RegionExportChannelSelector::RegionExportChannelSelector (ARDOUR::Session * _ses ProfileManagerPtr manager, ARDOUR::AudioRegion const & region, ARDOUR::AudioTrack & track) : - ExportChannelSelector (_session, manager), - region (region), - track (track), - region_chans (region.n_channels()), - track_chans (track.n_outputs().n_audio()), - - raw_button (type_group), - fades_button (type_group), - processed_button (type_group) + ExportChannelSelector (_session, manager), + region (region), + track (track), + region_chans (region.n_channels()), + track_chans (track.n_outputs().n_audio()), + + raw_button (type_group), + fades_button (type_group), + processed_button (type_group) { pack_start (vbox); @@ -657,7 +658,7 @@ void TrackExportChannelSelector::fill_list() { track_list->clear(); - RouteList routes = *_session->get_routes(); + RouteList routes = _session->get_routelist(); for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) { if (!boost::dynamic_pointer_cast(*it)) { @@ -694,7 +695,7 @@ TrackExportChannelSelector::add_track (boost::shared_ptr route) row[track_cols.selected] = false; row[track_cols.label] = route->name(); row[track_cols.route] = route; - row[track_cols.order_key] = route->order_key(); + row[track_cols.order_key] = route->presentation_info().order(); } void @@ -709,7 +710,7 @@ TrackExportChannelSelector::update_config() continue; } - ExportProfileManager::ChannelConfigStatePtr state = manager->add_channel_config(); + ExportProfileManager::ChannelConfigStatePtr state; boost::shared_ptr route = row[track_cols.route]; @@ -721,16 +722,29 @@ TrackExportChannelSelector::update_config() ExportChannelPtr channel (new PortExportChannel ()); PortExportChannel * pec = static_cast (channel.get()); pec->add_port(port); + if (!state) { + state = manager->add_channel_config(); + } state->config->register_channel(channel); } } } else { std::list list; RouteExportChannel::create_from_route (list, route); + if (list.size () == 0) { + continue; + } + state = manager->add_channel_config(); state->config->register_channels (list); } - state->config->set_name (route->name()); + if (state) { + if (_session->config.get_track_name_number() && route->track_number() > 0) { + state->config->set_name (string_compose ("%1-%2", route->track_number(), route->name())); + } else { + state->config->set_name (route->name()); + } + } }