2008-09-17 08:56:00 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2008-2013 Sakari Bergen <sakari.bergen@beatwaves.net>
|
|
|
|
* Copyright (C) 2008-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2013-2015 Colin Fletcher <colin.m.fletcher@googlemail.com>
|
|
|
|
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2015 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
* Copyright (C) 2015 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
#include <algorithm>
|
2019-07-18 20:10:27 -04:00
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <gtkmm/menu.h>
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/convert.h"
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/audio_track.h"
|
2010-12-20 16:22:49 -05:00
|
|
|
#include "ardour/audioregion.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/export_channel_configuration.h"
|
|
|
|
#include "ardour/io.h"
|
|
|
|
#include "ardour/route.h"
|
|
|
|
#include "ardour/session.h"
|
2019-10-07 09:19:36 -04:00
|
|
|
#include "ardour/selection.h"
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
#include "export_channel_selector.h"
|
|
|
|
#include "route_sorter.h"
|
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
using namespace std;
|
|
|
|
using namespace Glib;
|
2008-09-17 08:56:00 -04:00
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
PortExportChannelSelector::PortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager) :
|
|
|
|
ExportChannelSelector (session, manager),
|
2008-09-17 08:56:00 -04:00
|
|
|
channels_label (_("Channels:"), Gtk::ALIGN_LEFT),
|
|
|
|
split_checkbox (_("Split to mono files")),
|
|
|
|
max_channels (20),
|
|
|
|
channel_view (max_channels)
|
|
|
|
{
|
|
|
|
channels_hbox.pack_start (channels_label, false, false, 0);
|
|
|
|
channels_hbox.pack_end (channels_spinbutton, false, false, 0);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
channels_vbox.pack_start (channels_hbox, false, false, 0);
|
|
|
|
channels_vbox.pack_start (split_checkbox, false, false, 6);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
channel_alignment.add (channel_scroller);
|
|
|
|
channel_alignment.set_padding (0, 0, 12, 0);
|
|
|
|
channel_scroller.add (channel_view);
|
|
|
|
channel_scroller.set_size_request (-1, 130);
|
|
|
|
channel_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
pack_start (channels_vbox, false, false, 0);
|
|
|
|
pack_start (channel_alignment, true, true, 0);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Channels spinbutton */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
channels_spinbutton.set_digits (0);
|
|
|
|
channels_spinbutton.set_increments (1, 2);
|
|
|
|
channels_spinbutton.set_range (1, max_channels);
|
|
|
|
channels_spinbutton.set_value (2);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
channels_spinbutton.signal_value_changed().connect (sigc::mem_fun (*this, &PortExportChannelSelector::update_channel_count));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Other signals */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
split_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &PortExportChannelSelector::update_split_state));
|
2008-09-17 08:56:00 -04:00
|
|
|
channel_view.CriticalSelectionChanged.connect (CriticalSelectionChanged.make_slot());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Finalize */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
sync_with_manager();
|
2008-09-17 08:56:00 -04:00
|
|
|
show_all_children ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::~PortExportChannelSelector ()
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-03-08 06:56:40 -04:00
|
|
|
PortExportChannelSelector::sync_with_manager ()
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
2009-03-08 06:56:40 -04:00
|
|
|
state = manager->get_channel_configs().front();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
split_checkbox.set_active (state->config->get_split());
|
|
|
|
channels_spinbutton.set_value (state->config->get_n_chans());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-05-25 07:53:21 -04:00
|
|
|
/* 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
|
|
|
|
*/
|
2016-05-25 19:52:34 -04:00
|
|
|
channel_view.set_config (ChannelConfigPtr ());
|
2008-09-17 08:56:00 -04:00
|
|
|
fill_route_list ();
|
|
|
|
channel_view.set_config (state->config);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::fill_route_list ()
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
channel_view.clear_routes ();
|
2018-11-07 16:05:05 -05:00
|
|
|
RouteList routes = _session->get_routelist();
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
/* Add master bus and then everything else */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2013-05-05 18:15:48 -04:00
|
|
|
if (_session->master_out()) {
|
|
|
|
ARDOUR::IO* master = _session->master_out()->output().get();
|
|
|
|
channel_view.add_route (master);
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-06-16 17:45:16 -04:00
|
|
|
routes.sort (Stripable::Sorter ());
|
2015-08-04 16:33:44 -04:00
|
|
|
|
2009-01-30 02:40:13 -05:00
|
|
|
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
|
2011-10-25 12:08:16 -04:00
|
|
|
if ((*it)->is_master () || (*it)->is_monitor ()) {
|
2008-09-17 08:56:00 -04:00
|
|
|
continue;
|
|
|
|
}
|
2009-06-09 16:21:19 -04:00
|
|
|
channel_view.add_route ((*it)->output().get());
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
update_channel_count ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::update_channel_count ()
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
uint32_t chans = static_cast<uint32_t> (channels_spinbutton.get_value());
|
|
|
|
channel_view.set_channel_count (chans);
|
|
|
|
CriticalSelectionChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::update_split_state ()
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
state->config->set_split (split_checkbox.get_active());
|
|
|
|
CriticalSelectionChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::RouteCols::add_channels (uint32_t chans)
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
while (chans > 0) {
|
|
|
|
channels.push_back (Channel (*this));
|
|
|
|
++n_channels;
|
|
|
|
--chans;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::RouteCols::Channel &
|
|
|
|
PortExportChannelSelector::RouteCols::get_channel (uint32_t channel)
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
if (channel > n_channels) {
|
2015-06-06 10:14:20 -04:00
|
|
|
std::cout << "Invalid channel count for get_channel!" << std::endl;
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
std::list<Channel>::iterator it = channels.begin();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
while (channel > 1) { // Channel count starts from one!
|
|
|
|
++it;
|
|
|
|
--channel;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
return *it;
|
|
|
|
}
|
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::ChannelTreeView::ChannelTreeView (uint32_t max_channels) :
|
2008-09-17 08:56:00 -04:00
|
|
|
n_channels (0)
|
|
|
|
{
|
|
|
|
/* Main columns */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
route_cols.add_channels (max_channels);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
route_list = Gtk::ListStore::create(route_cols);
|
|
|
|
set_model (route_list);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Add column with toggle and text */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2015-04-05 07:43:49 -04:00
|
|
|
append_column_editable (_("Export"), route_cols.selected);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::CellRendererText* text_renderer = Gtk::manage (new Gtk::CellRendererText);
|
|
|
|
text_renderer->property_editable() = false;
|
2015-04-05 07:43:49 -04:00
|
|
|
text_renderer->set_alignment (0.0, 0.5);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2015-04-05 07:43:49 -04:00
|
|
|
Gtk::TreeView::Column* column = Gtk::manage (new Gtk::TreeView::Column);
|
|
|
|
column->set_title (_("Bus or Track"));
|
2008-09-17 08:56:00 -04:00
|
|
|
column->pack_start (*text_renderer);
|
2015-04-05 07:43:49 -04:00
|
|
|
column->set_expand (true);
|
2008-09-17 08:56:00 -04:00
|
|
|
column->add_attribute (text_renderer->property_text(), route_cols.name);
|
2015-04-05 07:43:49 -04:00
|
|
|
append_column (*column);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::CellRendererToggle *toggle = dynamic_cast<Gtk::CellRendererToggle *>(get_column_cell_renderer (0));
|
2015-04-05 07:43:49 -04:00
|
|
|
toggle->set_alignment (0.0, 0.5);
|
2009-12-11 18:29:48 -05:00
|
|
|
toggle->signal_toggled().connect (sigc::mem_fun (*this, &PortExportChannelSelector::ChannelTreeView::update_toggle_selection));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
static_columns = get_columns().size();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::ChannelTreeView::set_config (ChannelConfigPtr c)
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
/* TODO Without the following line, the state might get reset.
|
|
|
|
* Pointing to the same address does not mean the state of the configuration hasn't changed.
|
|
|
|
* In the current code this is safe, but the actual cause of the problem would be good to fix
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (config == c) { return; }
|
|
|
|
config = c;
|
2016-05-25 07:53:21 -04:00
|
|
|
if (!config) { return; }
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
uint32_t i = 1;
|
|
|
|
ExportChannelConfiguration::ChannelList chan_list = config->get_channels();
|
|
|
|
for (ExportChannelConfiguration::ChannelList::iterator c_it = chan_list.begin(); c_it != chan_list.end(); ++c_it) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
for (Gtk::ListStore::Children::iterator r_it = route_list->children().begin(); r_it != route_list->children().end(); ++r_it) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
ARDOUR::PortExportChannel * pec;
|
|
|
|
if (!(pec = dynamic_cast<ARDOUR::PortExportChannel *> (c_it->get()))) {
|
|
|
|
continue;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Glib::RefPtr<Gtk::ListStore> port_list = r_it->get_value (route_cols.port_list_col);
|
2011-10-28 13:04:09 -04:00
|
|
|
std::set<boost::weak_ptr<AudioPort> > route_ports;
|
|
|
|
std::set<boost::weak_ptr<AudioPort> > intersection;
|
|
|
|
std::map<boost::weak_ptr<AudioPort>, string> port_labels;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
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));
|
2011-10-28 13:04:09 -04:00
|
|
|
port_labels.insert (make_pair ((*p_it)->get_value (route_cols.port_cols.port),
|
2017-07-01 12:42:24 -04:00
|
|
|
(*p_it)->get_value (route_cols.port_cols.label)));
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
std::set_intersection (pec->get_ports().begin(), pec->get_ports().end(),
|
2008-09-17 08:56:00 -04:00
|
|
|
route_ports.begin(), route_ports.end(),
|
2011-10-28 13:04:09 -04:00
|
|
|
std::insert_iterator<std::set<boost::weak_ptr<AudioPort> > > (intersection, intersection.begin()));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-10-28 13:04:09 -04:00
|
|
|
intersection.erase (boost::weak_ptr<AudioPort> ()); // Remove "none" selection
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
if (intersection.empty()) {
|
|
|
|
continue;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
if (!r_it->get_value (route_cols.selected)) {
|
|
|
|
r_it->set_value (route_cols.selected, true);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Set previous channels (if any) to none */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
for (uint32_t chn = 1; chn < i; ++chn) {
|
2011-10-28 13:04:09 -04:00
|
|
|
r_it->set_value (route_cols.get_channel (chn).port, boost::weak_ptr<AudioPort> ());
|
2010-09-14 12:51:02 -04:00
|
|
|
r_it->set_value (route_cols.get_channel (chn).label, string ("(none)"));
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-10-28 13:04:09 -04:00
|
|
|
boost::weak_ptr<AudioPort> port = *intersection.begin();
|
|
|
|
std::map<boost::weak_ptr<AudioPort>, string>::iterator label_it = port_labels.find (port);
|
2010-09-14 12:51:02 -04:00
|
|
|
string label = label_it != port_labels.end() ? label_it->second : "error";
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
r_it->set_value (route_cols.get_channel (i).port, port);
|
|
|
|
r_it->set_value (route_cols.get_channel (i).label, label);
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-06-09 16:21:19 -04:00
|
|
|
PortExportChannelSelector::ChannelTreeView::add_route (ARDOUR::IO * io)
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
Gtk::TreeModel::iterator iter = route_list->append();
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
|
|
|
|
row[route_cols.selected] = false;
|
2009-06-09 16:21:19 -04:00
|
|
|
row[route_cols.name] = io->name();
|
|
|
|
row[route_cols.io] = io;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Initialize port list */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Glib::RefPtr<Gtk::ListStore> port_list = Gtk::ListStore::create (route_cols.port_cols);
|
|
|
|
row[route_cols.port_list_col] = port_list;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
uint32_t outs = io->n_ports().n_audio();
|
2008-09-17 08:56:00 -04:00
|
|
|
for (uint32_t i = 0; i < outs; ++i) {
|
|
|
|
iter = port_list->append();
|
|
|
|
row = *iter;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
row[route_cols.port_cols.selected] = false;
|
2009-06-09 16:21:19 -04:00
|
|
|
row[route_cols.port_cols.port] = io->audio (i);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
std::ostringstream oss;
|
|
|
|
oss << "Out-" << (i + 1);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
row[route_cols.port_cols.label] = oss.str();
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
iter = port_list->append();
|
|
|
|
row = *iter;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
row[route_cols.port_cols.selected] = false;
|
2011-10-28 13:04:09 -04:00
|
|
|
row[route_cols.port_cols.port] = boost::weak_ptr<AudioPort> ();
|
2008-09-17 08:56:00 -04:00
|
|
|
row[route_cols.port_cols.label] = "(none)";
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::ChannelTreeView::set_channel_count (uint32_t channels)
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
int offset = channels - n_channels;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
while (offset > 0) {
|
|
|
|
++n_channels;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
std::ostringstream oss;
|
|
|
|
oss << n_channels;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* New column */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
|
|
|
Gtk::TreeView::Column* column = Gtk::manage (new Gtk::TreeView::Column (oss.str()));
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::CellRendererCombo* combo_renderer = Gtk::manage (new Gtk::CellRendererCombo);
|
2009-10-14 12:10:01 -04:00
|
|
|
combo_renderer->property_text_column() = 2;
|
2015-04-05 07:43:49 -04:00
|
|
|
combo_renderer->property_has_entry() = false;
|
2008-09-17 08:56:00 -04:00
|
|
|
column->pack_start (*combo_renderer);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
append_column (*column);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
column->add_attribute (combo_renderer->property_text(), route_cols.get_channel(n_channels).label);
|
|
|
|
column->add_attribute (combo_renderer->property_model(), route_cols.port_list_col);
|
|
|
|
column->add_attribute (combo_renderer->property_editable(), route_cols.selected);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
combo_renderer->signal_edited().connect (sigc::bind (sigc::mem_fun (*this, &PortExportChannelSelector::ChannelTreeView::update_selection_text), n_channels));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* put data into view */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
for (Gtk::ListStore::Children::iterator it = route_list->children().begin(); it != route_list->children().end(); ++it) {
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string label = it->get_value(route_cols.selected) ? "(none)" : "";
|
2008-09-17 08:56:00 -04:00
|
|
|
it->set_value (route_cols.get_channel (n_channels).label, label);
|
2011-10-28 13:04:09 -04:00
|
|
|
it->set_value (route_cols.get_channel (n_channels).port, boost::weak_ptr<AudioPort> ());
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* set column width */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
get_column (static_columns + n_channels - 1)->set_min_width (80);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
--offset;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
while (offset < 0) {
|
|
|
|
--n_channels;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
remove_column (*get_column (n_channels + static_columns));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
++offset;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
update_config ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-10-11 06:14:51 -04:00
|
|
|
PortExportChannelSelector::ChannelTreeView::update_config ()
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
if (!config) { return; }
|
|
|
|
|
|
|
|
config->clear_channels();
|
|
|
|
|
|
|
|
for (uint32_t i = 1; i <= n_channels; ++i) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
ExportChannelPtr channel (new PortExportChannel ());
|
|
|
|
PortExportChannel * pec = static_cast<PortExportChannel *> (channel.get());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
for (Gtk::ListStore::Children::iterator it = route_list->children().begin(); it != route_list->children().end(); ++it) {
|
|
|
|
Gtk::TreeModel::Row row = *it;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
if (!row[route_cols.selected]) {
|
|
|
|
continue;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-10-28 13:04:09 -04:00
|
|
|
boost::weak_ptr<AudioPort> weak_port = row[route_cols.get_channel (i).port];
|
|
|
|
boost::shared_ptr<AudioPort> port = weak_port.lock ();
|
2008-09-17 08:56:00 -04:00
|
|
|
if (port) {
|
2008-10-11 06:14:51 -04:00
|
|
|
pec->add_port (port);
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
config->register_channel (channel);
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
CriticalSelectionChanged ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-09-14 12:51:02 -04:00
|
|
|
PortExportChannelSelector::ChannelTreeView::update_toggle_selection (std::string const & path)
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
Gtk::TreeModel::iterator iter = get_model ()->get_iter (path);
|
|
|
|
bool selected = iter->get_value (route_cols.selected);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
for (uint32_t i = 1; i <= n_channels; ++i) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
if (!selected) {
|
2010-09-14 12:51:02 -04:00
|
|
|
iter->set_value (route_cols.get_channel (i).label, std::string (""));
|
2008-09-17 08:56:00 -04:00
|
|
|
continue;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
iter->set_value (route_cols.get_channel (i).label, std::string("(none)"));
|
2011-10-28 13:04:09 -04:00
|
|
|
iter->set_value (route_cols.get_channel (i).port, boost::weak_ptr<AudioPort> ());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Glib::RefPtr<Gtk::ListStore> port_list = iter->get_value (route_cols.port_list_col);
|
|
|
|
Gtk::ListStore::Children::iterator port_it;
|
|
|
|
uint32_t port_number = 1;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
for (port_it = port_list->children().begin(); port_it != port_list->children().end(); ++port_it) {
|
|
|
|
if (port_number == i) {
|
2010-09-14 12:51:02 -04:00
|
|
|
iter->set_value (route_cols.get_channel (i).label, (std::string) (*port_it)->get_value (route_cols.port_cols.label));
|
2011-10-28 13:04:09 -04:00
|
|
|
iter->set_value (route_cols.get_channel (i).port, (*port_it)->get_value (route_cols.port_cols.port));
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
++port_number;
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
update_config ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-09-14 12:51:02 -04:00
|
|
|
PortExportChannelSelector::ChannelTreeView::update_selection_text (std::string const & path, std::string const & new_text, uint32_t channel)
|
2008-09-17 08:56:00 -04:00
|
|
|
{
|
|
|
|
Gtk::TreeModel::iterator iter = get_model ()->get_iter (path);
|
|
|
|
iter->set_value (route_cols.get_channel (channel).label, new_text);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Glib::RefPtr<Gtk::ListStore> port_list = iter->get_value (route_cols.port_list_col);
|
|
|
|
Gtk::ListStore::Children::iterator port_it;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
for (port_it = port_list->children().begin(); port_it != port_list->children().end(); ++port_it) {
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string label = port_it->get_value (route_cols.port_cols.label);
|
2008-09-17 08:56:00 -04:00
|
|
|
if (label == new_text) {
|
2011-10-28 13:04:09 -04:00
|
|
|
boost::weak_ptr<AudioPort> w = (*port_it)[route_cols.port_cols.port];
|
|
|
|
iter->set_value (route_cols.get_channel (channel).port, w);
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
update_config ();
|
|
|
|
}
|
2008-10-11 06:14:51 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
RegionExportChannelSelector::RegionExportChannelSelector (ARDOUR::Session * _session,
|
2009-03-08 06:56:40 -04:00
|
|
|
ProfileManagerPtr manager,
|
|
|
|
ARDOUR::AudioRegion const & region,
|
|
|
|
ARDOUR::AudioTrack & track) :
|
2017-07-01 12:42:24 -04:00
|
|
|
ExportChannelSelector (_session, manager),
|
|
|
|
region (region),
|
|
|
|
track (track),
|
|
|
|
region_chans (region.n_channels()),
|
|
|
|
|
|
|
|
raw_button (type_group),
|
2020-03-05 21:19:07 -05:00
|
|
|
fades_button (type_group)
|
2008-10-11 06:14:51 -04:00
|
|
|
{
|
|
|
|
pack_start (vbox);
|
|
|
|
|
2011-12-03 09:02:49 -05:00
|
|
|
/* make fades+region gain be the default */
|
|
|
|
|
|
|
|
fades_button.set_active ();
|
|
|
|
|
2010-05-02 09:48:06 -04:00
|
|
|
raw_button.set_label (string_compose (_("Region contents without fades nor region gain (channels: %1)"), region_chans));
|
2008-10-11 06:14:51 -04:00
|
|
|
raw_button.signal_toggled ().connect (sigc::mem_fun (*this, &RegionExportChannelSelector::handle_selection));
|
2013-06-16 13:47:16 -04:00
|
|
|
vbox.pack_start (raw_button, false, false);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-05-02 09:48:06 -04:00
|
|
|
fades_button.set_label (string_compose (_("Region contents with fades and region gain (channels: %1)"), region_chans));
|
2008-10-11 10:07:50 -04:00
|
|
|
fades_button.signal_toggled ().connect (sigc::mem_fun (*this, &RegionExportChannelSelector::handle_selection));
|
2013-06-16 13:47:16 -04:00
|
|
|
vbox.pack_start (fades_button, false, false);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
sync_with_manager();
|
2008-10-11 06:14:51 -04:00
|
|
|
vbox.show_all_children ();
|
|
|
|
show_all_children ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-03-08 06:56:40 -04:00
|
|
|
RegionExportChannelSelector::sync_with_manager ()
|
2008-10-11 06:14:51 -04:00
|
|
|
{
|
2009-03-08 06:56:40 -04:00
|
|
|
state = manager->get_channel_configs().front();
|
2012-01-28 10:05:53 -05:00
|
|
|
|
|
|
|
if (!state) { return; }
|
|
|
|
|
|
|
|
switch (state->config->region_processing_type()) {
|
|
|
|
case RegionExportChannelFactory::None:
|
|
|
|
// Do nothing
|
|
|
|
break;
|
|
|
|
case RegionExportChannelFactory::Raw:
|
|
|
|
raw_button.set_active (true);
|
|
|
|
break;
|
|
|
|
case RegionExportChannelFactory::Fades:
|
|
|
|
fades_button.set_active (true);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
handle_selection ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RegionExportChannelSelector::handle_selection ()
|
|
|
|
{
|
|
|
|
if (!state) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
state->config->clear_channels ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-01-28 10:05:53 -05:00
|
|
|
RegionExportChannelFactory::Type type = RegionExportChannelFactory::None;
|
2008-10-11 06:14:51 -04:00
|
|
|
if (raw_button.get_active ()) {
|
2012-01-28 10:05:53 -05:00
|
|
|
type = RegionExportChannelFactory::Raw;
|
2008-10-11 10:07:50 -04:00
|
|
|
} else if (fades_button.get_active ()) {
|
2012-01-28 10:05:53 -05:00
|
|
|
type = RegionExportChannelFactory::Fades;
|
2008-10-11 10:07:50 -04:00
|
|
|
} else {
|
|
|
|
CriticalSelectionChanged ();
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-01-28 10:05:53 -05:00
|
|
|
factory.reset (new RegionExportChannelFactory (_session, region, track, type));
|
|
|
|
state->config->set_region_processing_type (type);
|
|
|
|
|
2020-03-05 21:19:07 -05:00
|
|
|
for (size_t chan = 0; chan < region_chans; ++chan) {
|
2008-10-11 10:07:50 -04:00
|
|
|
state->config->register_channel (factory->create (chan));
|
2008-10-11 06:14:51 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
CriticalSelectionChanged ();
|
|
|
|
}
|
2011-01-06 11:55:19 -05:00
|
|
|
|
2013-03-24 15:53:34 -04:00
|
|
|
/* Track export channel selector */
|
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
TrackExportChannelSelector::TrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
|
|
|
|
: ExportChannelSelector(session, manager)
|
2015-08-04 15:49:27 -04:00
|
|
|
, track_output_button(_("Apply track/bus processing"))
|
2011-01-06 11:55:19 -05:00
|
|
|
{
|
2013-03-24 15:53:34 -04:00
|
|
|
pack_start(main_layout);
|
|
|
|
|
2019-07-18 20:10:27 -04:00
|
|
|
// Populate Selection Menu
|
|
|
|
{
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
|
|
|
|
select_menu.set_text (_("Selection Actions"));
|
|
|
|
select_menu.disable_scrolling ();
|
|
|
|
|
|
|
|
select_menu.AddMenuElem (MenuElem (_("Select tracks"), sigc::mem_fun (*this, &TrackExportChannelSelector::select_tracks)));
|
|
|
|
select_menu.AddMenuElem (MenuElem (_("Select busses"), sigc::mem_fun (*this, &TrackExportChannelSelector::select_busses)));
|
|
|
|
select_menu.AddMenuElem (MenuElem (_("Deselect all"), sigc::mem_fun (*this, &TrackExportChannelSelector::select_none)));
|
|
|
|
select_menu.AddMenuElem (SeparatorElem ());
|
|
|
|
|
|
|
|
exclude_hidden = new Gtk::CheckMenuItem (_("Exclude Hidden"));
|
|
|
|
exclude_hidden->set_active (false);
|
|
|
|
exclude_hidden->show();
|
|
|
|
select_menu.AddMenuElem (*exclude_hidden);
|
|
|
|
|
|
|
|
exclude_muted = new Gtk::CheckMenuItem (_("Exclude Muted"));
|
|
|
|
exclude_muted->set_active (true);
|
|
|
|
exclude_muted->show();
|
|
|
|
select_menu.AddMenuElem (*exclude_muted);
|
|
|
|
}
|
|
|
|
|
2013-03-24 15:53:34 -04:00
|
|
|
// Options
|
2019-07-18 20:10:27 -04:00
|
|
|
options_box.set_spacing (8);
|
|
|
|
options_box.pack_start (track_output_button, false, false);
|
|
|
|
options_box.pack_start (select_menu, false, false);
|
|
|
|
main_layout.pack_start (options_box, false, false);
|
2013-03-24 15:53:34 -04:00
|
|
|
|
|
|
|
// Track scroller
|
2011-01-06 11:55:19 -05:00
|
|
|
track_scroller.add (track_view);
|
|
|
|
track_scroller.set_size_request (-1, 130);
|
|
|
|
track_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
2013-03-24 15:53:34 -04:00
|
|
|
main_layout.pack_start(track_scroller);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
// Track list
|
|
|
|
track_list = Gtk::ListStore::create (track_cols);
|
2015-04-04 11:40:37 -04:00
|
|
|
track_list->set_sort_column (track_cols.order_key, Gtk::SORT_ASCENDING);
|
2011-01-06 11:55:19 -05:00
|
|
|
track_view.set_model (track_list);
|
|
|
|
track_view.set_headers_visible (true);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2015-04-04 08:20:15 -04:00
|
|
|
track_view.append_column_editable (_("Export"), track_cols.selected);
|
2011-01-06 11:55:19 -05:00
|
|
|
Gtk::CellRendererToggle *toggle = dynamic_cast<Gtk::CellRendererToggle *>(track_view.get_column_cell_renderer (0));
|
2015-04-04 08:20:15 -04:00
|
|
|
toggle->set_alignment (0.0, 0.5);
|
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
toggle->signal_toggled().connect (sigc::hide (sigc::mem_fun (*this, &TrackExportChannelSelector::update_config)));
|
|
|
|
|
|
|
|
Gtk::CellRendererText* text_renderer = Gtk::manage (new Gtk::CellRendererText);
|
|
|
|
text_renderer->property_editable() = false;
|
2015-04-04 08:20:15 -04:00
|
|
|
text_renderer->set_alignment (0.0, 0.5);
|
2011-01-06 11:55:19 -05:00
|
|
|
|
2015-04-04 08:20:15 -04:00
|
|
|
Gtk::TreeView::Column* column = Gtk::manage (new Gtk::TreeView::Column);
|
|
|
|
column->set_title (_("Track name"));
|
|
|
|
|
|
|
|
track_view.append_column (*column);
|
|
|
|
column->pack_start (*text_renderer, false);
|
2011-01-06 11:55:19 -05:00
|
|
|
column->add_attribute (text_renderer->property_text(), track_cols.label);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2015-08-04 15:49:27 -04:00
|
|
|
track_output_button.signal_clicked().connect (sigc::mem_fun (*this, &TrackExportChannelSelector::track_outputs_selected));
|
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
fill_list();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
show_all_children ();
|
|
|
|
}
|
|
|
|
|
2019-07-18 20:10:27 -04:00
|
|
|
TrackExportChannelSelector::~TrackExportChannelSelector ()
|
|
|
|
{
|
|
|
|
delete exclude_hidden;
|
|
|
|
delete exclude_muted;
|
|
|
|
}
|
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
void
|
|
|
|
TrackExportChannelSelector::sync_with_manager ()
|
|
|
|
{
|
|
|
|
// TODO implement properly
|
|
|
|
update_config();
|
|
|
|
}
|
|
|
|
|
2015-06-05 18:08:38 -04:00
|
|
|
void
|
|
|
|
TrackExportChannelSelector::select_tracks ()
|
|
|
|
{
|
2019-07-18 20:10:27 -04:00
|
|
|
bool excl_hidden = exclude_hidden->get_active ();
|
|
|
|
bool excl_muted = exclude_muted->get_active ();
|
|
|
|
|
2015-06-05 18:08:38 -04:00
|
|
|
for (Gtk::ListStore::Children::iterator it = track_list->children().begin(); it != track_list->children().end(); ++it) {
|
|
|
|
Gtk::TreeModel::Row row = *it;
|
|
|
|
boost::shared_ptr<Route> route = row[track_cols.route];
|
|
|
|
if (boost::dynamic_pointer_cast<Track> (route)) {
|
2019-07-18 20:10:27 -04:00
|
|
|
if (excl_muted && route->muted ()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (excl_hidden && route->is_hidden ()) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-06-05 18:08:38 -04:00
|
|
|
row[track_cols.selected] = true;
|
|
|
|
}
|
|
|
|
}
|
2015-06-08 15:07:52 -04:00
|
|
|
update_config();
|
2015-06-05 18:08:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackExportChannelSelector::select_busses ()
|
|
|
|
{
|
2019-07-18 20:10:27 -04:00
|
|
|
bool excl_hidden = exclude_hidden->get_active ();
|
|
|
|
bool excl_muted = exclude_muted->get_active ();
|
|
|
|
|
2015-06-05 18:08:38 -04:00
|
|
|
for (Gtk::ListStore::Children::iterator it = track_list->children().begin(); it != track_list->children().end(); ++it) {
|
|
|
|
Gtk::TreeModel::Row row = *it;
|
|
|
|
boost::shared_ptr<Route> route = row[track_cols.route];
|
|
|
|
if (!boost::dynamic_pointer_cast<Track> (route)) {
|
2019-07-18 20:10:27 -04:00
|
|
|
if (excl_muted && route->muted ()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (excl_hidden && route->is_hidden ()) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-06-05 18:08:38 -04:00
|
|
|
row[track_cols.selected] = true;
|
|
|
|
}
|
|
|
|
}
|
2015-06-08 15:07:52 -04:00
|
|
|
update_config();
|
2015-06-05 18:08:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackExportChannelSelector::select_none ()
|
|
|
|
{
|
|
|
|
for (Gtk::ListStore::Children::iterator it = track_list->children().begin(); it != track_list->children().end(); ++it) {
|
|
|
|
Gtk::TreeModel::Row row = *it;
|
|
|
|
row[track_cols.selected] = false;
|
|
|
|
}
|
2015-06-08 15:07:52 -04:00
|
|
|
update_config();
|
2015-06-05 18:08:38 -04:00
|
|
|
}
|
|
|
|
|
2015-08-04 15:49:27 -04:00
|
|
|
void
|
|
|
|
TrackExportChannelSelector::track_outputs_selected ()
|
|
|
|
{
|
|
|
|
update_config();
|
|
|
|
}
|
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
void
|
|
|
|
TrackExportChannelSelector::fill_list()
|
|
|
|
{
|
|
|
|
track_list->clear();
|
2018-11-07 16:05:05 -05:00
|
|
|
RouteList routes = _session->get_routelist();
|
2011-01-06 11:55:19 -05:00
|
|
|
|
2019-10-07 09:19:36 -04:00
|
|
|
CoreSelection const& cs (_session->selection());
|
|
|
|
|
2012-12-06 07:46:27 -05:00
|
|
|
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
|
2012-12-06 14:56:33 -05:00
|
|
|
if (!boost::dynamic_pointer_cast<Track>(*it)) {
|
2012-12-06 07:46:27 -05:00
|
|
|
// not a track, must be a bus
|
|
|
|
if ((*it)->is_master () || (*it)->is_monitor ()) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-06-06 10:13:39 -04:00
|
|
|
if (!(*it)->active ()) {
|
|
|
|
// don't include inactive busses
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-12-06 07:46:27 -05:00
|
|
|
// not monitor or master bus
|
2019-10-07 09:19:36 -04:00
|
|
|
add_track (*it, cs.selected (*it));
|
2012-12-06 07:46:27 -05:00
|
|
|
}
|
|
|
|
}
|
2011-01-06 11:55:19 -05:00
|
|
|
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
|
2012-12-06 14:56:33 -05:00
|
|
|
if (boost::dynamic_pointer_cast<AudioTrack>(*it)) {
|
2015-06-06 10:13:39 -04:00
|
|
|
if (!(*it)->active ()) {
|
|
|
|
// don't include inactive tracks
|
|
|
|
continue;
|
|
|
|
}
|
2019-10-07 09:19:36 -04:00
|
|
|
add_track (*it, cs.selected (*it));
|
2011-01-06 11:55:19 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2019-10-07 09:19:36 -04:00
|
|
|
TrackExportChannelSelector::add_track (boost::shared_ptr<Route> route, bool selected)
|
2011-01-06 11:55:19 -05:00
|
|
|
{
|
|
|
|
Gtk::TreeModel::iterator iter = track_list->append();
|
|
|
|
Gtk::TreeModel::Row row = *iter;
|
|
|
|
|
2019-10-07 09:19:36 -04:00
|
|
|
row[track_cols.selected] = selected;
|
2011-01-16 14:41:11 -05:00
|
|
|
row[track_cols.label] = route->name();
|
2012-12-06 14:56:33 -05:00
|
|
|
row[track_cols.route] = route;
|
2016-06-03 15:15:30 -04:00
|
|
|
row[track_cols.order_key] = route->presentation_info().order();
|
2011-01-06 11:55:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackExportChannelSelector::update_config()
|
|
|
|
{
|
|
|
|
manager->clear_channel_configs();
|
|
|
|
|
|
|
|
for (Gtk::ListStore::Children::iterator it = track_list->children().begin(); it != track_list->children().end(); ++it) {
|
|
|
|
Gtk::TreeModel::Row row = *it;
|
|
|
|
|
|
|
|
if (!row[track_cols.selected]) {
|
|
|
|
continue;
|
|
|
|
}
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2016-07-12 22:59:26 -04:00
|
|
|
ExportProfileManager::ChannelConfigStatePtr state;
|
2011-01-16 14:41:11 -05:00
|
|
|
|
2012-12-06 14:56:33 -05:00
|
|
|
boost::shared_ptr<Route> route = row[track_cols.route];
|
2011-01-16 14:41:11 -05:00
|
|
|
|
2013-03-24 15:53:34 -04:00
|
|
|
if (track_output_button.get_active()) {
|
|
|
|
uint32_t outs = route->n_outputs().n_audio();
|
|
|
|
for (uint32_t i = 0; i < outs; ++i) {
|
|
|
|
boost::shared_ptr<AudioPort> port = route->output()->audio (i);
|
|
|
|
if (port) {
|
|
|
|
ExportChannelPtr channel (new PortExportChannel ());
|
|
|
|
PortExportChannel * pec = static_cast<PortExportChannel *> (channel.get());
|
|
|
|
pec->add_port(port);
|
2016-07-12 22:59:26 -04:00
|
|
|
if (!state) {
|
|
|
|
state = manager->add_channel_config();
|
|
|
|
}
|
2013-03-24 15:53:34 -04:00
|
|
|
state->config->register_channel(channel);
|
|
|
|
}
|
2011-01-06 11:55:19 -05:00
|
|
|
}
|
2013-03-24 15:53:34 -04:00
|
|
|
} else {
|
|
|
|
std::list<ExportChannelPtr> list;
|
|
|
|
RouteExportChannel::create_from_route (list, route);
|
2016-07-12 22:59:26 -04:00
|
|
|
if (list.size () == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
state = manager->add_channel_config();
|
2013-03-24 15:53:34 -04:00
|
|
|
state->config->register_channels (list);
|
2011-01-06 11:55:19 -05:00
|
|
|
}
|
2011-01-16 14:41:11 -05:00
|
|
|
|
2016-07-12 22:59:26 -04:00
|
|
|
if (state) {
|
2018-10-02 17:28:44 -04:00
|
|
|
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());
|
|
|
|
}
|
2016-07-12 22:59:26 -04:00
|
|
|
}
|
2015-08-04 15:49:27 -04:00
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
CriticalSelectionChanged ();
|
|
|
|
}
|