#include "pbd/convert.h"
-#include "ardour/audio_port.h"
#include "ardour/audio_track.h"
-#include "ardour/audioengine.h"
#include "ardour/audioregion.h"
#include "ardour/export_channel_configuration.h"
-#include "ardour/export_handler.h"
#include "ardour/io.h"
#include "ardour/route.h"
#include "ardour/session.h"
}
Glib::RefPtr<Gtk::ListStore> port_list = r_it->get_value (route_cols.port_list_col);
- std::set<AudioPort *> route_ports;
- std::set<AudioPort *> intersection;
- std::map<AudioPort *, string> port_labels;
+ std::set<boost::weak_ptr<AudioPort> > route_ports;
+ std::set<boost::weak_ptr<AudioPort> > intersection;
+ std::map<boost::weak_ptr<AudioPort>, string> port_labels;
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 (std::pair<AudioPort*, string> ((*p_it)->get_value (route_cols.port_cols.port),
- (*p_it)->get_value (route_cols.port_cols.label)));
+ port_labels.insert (make_pair ((*p_it)->get_value (route_cols.port_cols.port),
+ (*p_it)->get_value (route_cols.port_cols.label)));
}
std::set_intersection (pec->get_ports().begin(), pec->get_ports().end(),
route_ports.begin(), route_ports.end(),
- std::insert_iterator<std::set<AudioPort *> > (intersection, intersection.begin()));
+ std::insert_iterator<std::set<boost::weak_ptr<AudioPort> > > (intersection, intersection.begin()));
- intersection.erase (0); // Remove "none" selection
+ intersection.erase (boost::weak_ptr<AudioPort> ()); // Remove "none" selection
if (intersection.empty()) {
continue;
/* Set previous channels (if any) to none */
for (uint32_t chn = 1; chn < i; ++chn) {
- r_it->set_value (route_cols.get_channel (chn).port, (AudioPort *) 0);
+ r_it->set_value (route_cols.get_channel (chn).port, boost::weak_ptr<AudioPort> ());
r_it->set_value (route_cols.get_channel (chn).label, string ("(none)"));
}
}
- AudioPort * port = *intersection.begin();
- std::map<AudioPort *, string>::iterator label_it = port_labels.find (port);
+ boost::weak_ptr<AudioPort> port = *intersection.begin();
+ std::map<boost::weak_ptr<AudioPort>, string>::iterator label_it = port_labels.find (port);
string label = label_it != port_labels.end() ? label_it->second : "error";
r_it->set_value (route_cols.get_channel (i).port, port);
row = *iter;
row[route_cols.port_cols.selected] = false;
- row[route_cols.port_cols.port] = 0;
+ row[route_cols.port_cols.port] = boost::weak_ptr<AudioPort> ();
row[route_cols.port_cols.label] = "(none)";
}
for (Gtk::ListStore::Children::iterator it = route_list->children().begin(); it != route_list->children().end(); ++it) {
std::string label = it->get_value(route_cols.selected) ? "(none)" : "";
it->set_value (route_cols.get_channel (n_channels).label, label);
- it->set_value (route_cols.get_channel (n_channels).port, (AudioPort *) 0);
+ it->set_value (route_cols.get_channel (n_channels).port, boost::weak_ptr<AudioPort> ());
}
/* set column width */
void
PortExportChannelSelector::ChannelTreeView::update_config ()
{
-
if (!config) { return; }
config->clear_channels();
continue;
}
- AudioPort * port = row[route_cols.get_channel (i).port];
+ boost::weak_ptr<AudioPort> weak_port = row[route_cols.get_channel (i).port];
+ boost::shared_ptr<AudioPort> port = weak_port.lock ();
if (port) {
pec->add_port (port);
}
}
iter->set_value (route_cols.get_channel (i).label, std::string("(none)"));
- iter->set_value (route_cols.get_channel (i).port, (AudioPort *) 0);
+ iter->set_value (route_cols.get_channel (i).port, boost::weak_ptr<AudioPort> ());
Glib::RefPtr<Gtk::ListStore> port_list = iter->get_value (route_cols.port_list_col);
Gtk::ListStore::Children::iterator port_it;
for (port_it = port_list->children().begin(); port_it != port_list->children().end(); ++port_it) {
if (port_number == i) {
iter->set_value (route_cols.get_channel (i).label, (std::string) (*port_it)->get_value (route_cols.port_cols.label));
- iter->set_value (route_cols.get_channel (i).port, (AudioPort *) (*port_it)->get_value (route_cols.port_cols.port));
+ iter->set_value (route_cols.get_channel (i).port, (*port_it)->get_value (route_cols.port_cols.port));
}
++port_number;
for (port_it = port_list->children().begin(); port_it != port_list->children().end(); ++port_it) {
std::string label = port_it->get_value (route_cols.port_cols.label);
if (label == new_text) {
- iter->set_value (route_cols.get_channel (channel).port, (AudioPort *) (*port_it)[route_cols.port_cols.port]);
+ boost::weak_ptr<AudioPort> w = (*port_it)[route_cols.port_cols.port];
+ iter->set_value (route_cols.get_channel (channel).port, w);
}
}
{
pack_start (vbox);
+ /* make fades+region gain be the default */
+
+ fades_button.set_active ();
+
raw_button.set_label (string_compose (_("Region contents without fades nor region gain (channels: %1)"), region_chans));
raw_button.signal_toggled ().connect (sigc::mem_fun (*this, &RegionExportChannelSelector::handle_selection));
vbox.pack_start (raw_button);
RegionExportChannelSelector::sync_with_manager ()
{
state = manager->get_channel_configs().front();
+
+ 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;
+ case RegionExportChannelFactory::Processed:
+ processed_button.set_active (true);
+ break;
+ }
+
handle_selection ();
}
state->config->clear_channels ();
+ RegionExportChannelFactory::Type type = RegionExportChannelFactory::None;
if (raw_button.get_active ()) {
- factory.reset (new RegionExportChannelFactory (_session, region, track, RegionExportChannelFactory::Raw));
+ type = RegionExportChannelFactory::Raw;
} else if (fades_button.get_active ()) {
- factory.reset (new RegionExportChannelFactory (_session, region, track, RegionExportChannelFactory::Fades));
+ type = RegionExportChannelFactory::Fades;
} else if (processed_button.get_active ()) {
- factory.reset (new RegionExportChannelFactory(_session, region, track, RegionExportChannelFactory::Processed));
+ type = RegionExportChannelFactory::Processed;
} else {
CriticalSelectionChanged ();
return;
}
+ factory.reset (new RegionExportChannelFactory (_session, region, track, type));
+ state->config->set_region_processing_type (type);
+
for (size_t chan = 0; chan < region_chans; ++chan) {
state->config->register_channel (factory->create (chan));
}
CriticalSelectionChanged ();
}
+/* Track export channel selector */
+
TrackExportChannelSelector::TrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
: ExportChannelSelector(session, manager)
+ , region_contents_button(source_group, _("Export region contents"))
+ , track_output_button(source_group, _("Export track output"))
{
+ pack_start(main_layout);
+
+ // Options
+ options_box.pack_start(region_contents_button);
+ options_box.pack_start(track_output_button);
+ main_layout.pack_start(options_box);
+
+ // Track scroller
track_scroller.add (track_view);
track_scroller.set_size_request (-1, 130);
track_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- pack_start(track_scroller);
+ main_layout.pack_start(track_scroller);
// Track list
track_list = Gtk::ListStore::create (track_cols);
RouteList routes = *_session->get_routes();
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
- Route * route = it->get();
- if(dynamic_cast<AudioTrack *>(route)) {
- add_track(route);
+ if (!boost::dynamic_pointer_cast<Track>(*it)) {
+ // not a track, must be a bus
+ if ((*it)->is_master () || (*it)->is_monitor ()) {
+ continue;
+ }
+ // not monitor or master bus
+ add_track (*it);
+ }
+ }
+ for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
+ if (boost::dynamic_pointer_cast<AudioTrack>(*it)) {
+ add_track (*it);
}
}
}
void
-TrackExportChannelSelector::add_track(Route * route)
+TrackExportChannelSelector::add_track (boost::shared_ptr<Route> route)
{
Gtk::TreeModel::iterator iter = track_list->append();
Gtk::TreeModel::Row row = *iter;
row[track_cols.selected] = true;
row[track_cols.label] = route->name();
- row[track_cols.track] = route;
+ row[track_cols.route] = route;
}
void
ExportProfileManager::ChannelConfigStatePtr state = manager->add_channel_config();
- Route * track = row[track_cols.track];
-
- /* Output of track code. TODO make this an option also
- uint32_t outs = track->n_ports().n_audio();
- for (uint32_t i = 0; i < outs; ++i) {
- AudioPort * port = track->audio (i);
- if(port) {
- ExportChannelPtr channel (new PortExportChannel ());
- PortExportChannel * pec = static_cast<PortExportChannel *> (channel.get());
- pec->add_port(port);
- state->config->register_channel(channel);
+ boost::shared_ptr<Route> route = row[track_cols.route];
+
+ 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);
+ state->config->register_channel(channel);
+ }
}
+ } else {
+ std::list<ExportChannelPtr> list;
+ RouteExportChannel::create_from_route (list, route);
+ state->config->register_channels (list);
}
- */
- std::list<ExportChannelPtr> list;
- RouteExportChannel::create_from_route (list, *track);
- state->config->register_channels (list);
- state->config->set_name(track->name());
+ state->config->set_name (route->name());
}
CriticalSelectionChanged ();