diff --git a/gtk2_ardour/export_channel_selector.cc b/gtk2_ardour/export_channel_selector.cc index 0362dad209..1c23871a55 100644 --- a/gtk2_ardour/export_channel_selector.cc +++ b/gtk2_ardour/export_channel_selector.cc @@ -114,6 +114,12 @@ PortExportChannelSelector::sync_with_manager () channel_view.set_config (state->config); } +bool +PortExportChannelSelector::channel_limit_reached () const +{ + return channel_view.max_route_channel_count () > channel_view.channel_count (); +} + void PortExportChannelSelector::fill_route_list () { @@ -457,6 +463,22 @@ PortExportChannelSelector::ChannelTreeView::update_selection_text (std::string c update_config (); } +uint32_t +PortExportChannelSelector::ChannelTreeView::max_route_channel_count () const +{ + uint32_t rv = 0; + for (Gtk::ListStore::Children::const_iterator it = route_list->children().begin(); it != route_list->children().end(); ++it) { + Gtk::TreeModel::Row row = *it; + if (!row[route_cols.selected]) { + continue; + } + ARDOUR::IO* io = row[route_cols.io]; + uint32_t outs = io->n_ports().n_audio(); + rv = std::max (rv, outs); + } + return rv; +} + RegionExportChannelSelector::RegionExportChannelSelector (ARDOUR::Session * _session, ProfileManagerPtr manager, ARDOUR::AudioRegion const & region, diff --git a/gtk2_ardour/export_channel_selector.h b/gtk2_ardour/export_channel_selector.h index ed131576dd..1bcba291cc 100644 --- a/gtk2_ardour/export_channel_selector.h +++ b/gtk2_ardour/export_channel_selector.h @@ -78,6 +78,7 @@ public: virtual ~ExportChannelSelector () {} virtual void sync_with_manager () = 0; + virtual bool channel_limit_reached () const = 0; sigc::signal CriticalSelectionChanged; }; @@ -90,6 +91,7 @@ public: ~PortExportChannelSelector (); void sync_with_manager (); + bool channel_limit_reached () const; private: @@ -183,6 +185,8 @@ private: void clear_routes () { route_list->clear (); } void add_route (ARDOUR::IO * route); void set_channel_count (uint32_t channels); + uint32_t channel_count () const { return n_channels; } + uint32_t max_route_channel_count () const; sigc::signal CriticalSelectionChanged; @@ -220,6 +224,7 @@ public: ARDOUR::AudioTrack & track); virtual void sync_with_manager (); + bool channel_limit_reached () const { return false; } private: @@ -250,6 +255,7 @@ class TrackExportChannelSelector : public ExportChannelSelector virtual void sync_with_manager (); bool track_output () const { return track_output_button.get_active(); } + bool channel_limit_reached () const { return false; } private: diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index e4a40a6c99..58ece58a92 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -274,6 +274,11 @@ ExportDialog::update_warnings_and_example_filename () add_warning (*it); } + /* add channel count warning */ + if (channel_selector && channel_selector->channel_limit_reached ()) { + add_warning (_("A track or bus has more channels than the target.")); + } + if (!warnings->conflicting_filenames.empty()) { list_files_hbox.show (); for (std::list::iterator it = warnings->conflicting_filenames.begin(); it != warnings->conflicting_filenames.end(); ++it) {