[Summary] progressing the XML-ized Eaport dialogs.

This commit is contained in:
VKamyshniy 2015-01-26 01:16:11 +02:00
parent ee51f29f24
commit 5ddbee785b
15 changed files with 1233 additions and 97 deletions

View file

@ -72,7 +72,7 @@ Editor::export_audio ()
void
Editor::stem_export ()
{
StemExportDialog dialog (*this);
WavesStemExportDialog dialog (*this);
dialog.set_session (_session);
dialog.run();
}
@ -99,7 +99,7 @@ Editor::export_range ()
bool is_start;
if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) {
ExportRangeDialog dialog (*this, l->id().to_s());
WavesExportRangeDialog dialog (*this, l->id().to_s());
dialog.set_session (_session);
dialog.run();
}
@ -122,7 +122,7 @@ Editor::export_region ()
RouteTimeAxisView & rtv (dynamic_cast<RouteTimeAxisView &> (selection->regions.front()->get_time_axis_view()));
AudioTrack & track (dynamic_cast<AudioTrack &> (*rtv.route()));
ExportRegionDialog dialog (*this, *(audio_region.get()), track);
WavesExportRegionDialog dialog (*this, *(audio_region.get()), track);
dialog.set_session (_session);
dialog.run ();

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

View file

@ -27,90 +27,90 @@
fgnormal="#C1C1C1"/>
<style name="generic_dropdown_menu"
style="generic_dropdown"/>
<VBox>
<HBox spacing="6">
<Label style="generic_control"
text="Folder:"/>
<Entry id="path_entry"
style="generic_button"
activatesdefault="true"
hasframe="false"
horzalignment="start"
height="22"
box.fill="true"
box.expand="true"/>
<Button id="browse_button"
style="generic_button"
text="Browse"
width="60"/>
</HBox>
<VBox height="18"/>
<VBox>
<HBox spacing="6">
<Label style="generic_control"
text="Build filename(s) from these components:"
text="Folder:"/>
<Entry id="path_entry"
style="generic_button"
activatesdefault="true"
hasframe="false"
horzalignment="start"
winfont="Arial Italic 10"
macfont="Helvetica Italic 10"/>
<VBox height="6"/>
<HBox spacing="6">
height="22"
box.fill="true"
box.expand="true"/>
<Button id="browse_button"
style="generic_button"
text="Browse"
width="60"/>
</HBox>
<VBox height="18"/>
<Label style="generic_control"
text="Build filename(s) from these components:"
horzalignment="start"
winfont="Arial Italic 10"
macfont="Helvetica Italic 10"/>
<VBox height="6"/>
<HBox spacing="6">
<Label style="generic_control"
text="Label:"/>
<Entry id="label_entry"
style="generic_button"
hasframe="false"
activatesdefault="true"
horzalignment="start"
height="22"
box.fill="true"
box.expand="true"/>
<HBox>
<Iconbutton id="session_button"
width="20"
height="20"
normalicon="waves_darker_check_box"
activeicon="waves_darker_check_box_active"
toggleable="true"/>
<Label style="generic_control"
text="Label:"/>
<Entry id="label_entry"
style="generic_button"
hasframe="false"
activatesdefault="true"
horzalignment="start"
height="22"
box.fill="true"
box.expand="true"/>
text="Session Name"/>
</HBox>
<Dropdown style="generic_dropdown"
id="date_format_dropdown"
width="90"
height="20"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive">
<HBox>
<Iconbutton id="session_button"
width="20"
height="20"
normalicon="waves_darker_check_box"
activeicon="waves_darker_check_box_active"
toggleable="true"/>
<Label style="generic_control"
text="Session Name"/>
<VBox width="10"/>
<Label style="generic_dropdown"
horzalignment="start"/>
</HBox>
<Dropdown style="generic_dropdown"
id="date_format_dropdown"
width="90"
height="20"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"
horzalignment="start"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
<Dropdown style="generic_dropdown"
id="time_format_dropdown"
width="90"
height="20"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive">
<HBox>
<VBox width="10"/>
<Label style="generic_dropdown"
horzalignment="start"/>
</HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
<Dropdown style="generic_dropdown"
id="time_format_dropdown"
width="90"
height="20"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive">
<HBox>
<Iconbutton id="revision_button"
width="20"
height="20"
normalicon="waves_darker_check_box"
activeicon="waves_darker_check_box_active"
toggleable="true"/>
<Label style="generic_control"
text="Revision:"/>
<VBox width="10"/>
<Label style="generic_dropdown"
horzalignment="start"/>
</HBox>
<HBox>
<DropdownMenu style="generic_dropdown_menu"/>
</Dropdown>
<HBox>
<Iconbutton id="revision_button"
width="20"
height="20"
normalicon="waves_darker_check_box"
activeicon="waves_darker_check_box_active"
toggleable="true"/>
<Label style="generic_control"
text="Revision:"/>
</HBox>
<HBox>
<Entry id="revision_entry"
style="generic_button"
hasframe="false"
@ -133,13 +133,13 @@
activeicon="spin_down_12x11_inactive"
inactiveicon="spin_down_12x11_inactive"/>
</VBox>
</HBox>
</HBox>
<VBox height="11"/>
<Label id="example_filename_label"
style="generic_control"
horzalignment="start"
winfont="Arial Italic 10"
macfont="Helvetica Italic 10"/>
</VBox>
</HBox>
<VBox height="11"/>
<Label id="example_filename_label"
style="generic_control"
horzalignment="start"
winfont="Arial Italic 10"
macfont="Helvetica Italic 10"/>
</VBox>
</VBox>

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<HBox CACHEIT="false"
UI.NEEDINIT="true"
spacing="5"
borderwidth="10">
<style name="generic_control"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#6C6C6C"
fgactive="#BFBFBF"
bgactive="#454545"
fghover="#CCCCCC"
bghover="#898989"/>
<style name="generic_button"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
textcolornormal="#6D6E72"
bgnormal="#CACAC5"
basenormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"/>
<style name="generic_dropdown"
style="generic_button"
fgnormal="#EDECE8"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive"
width="90"
height="20"
horzalignment="start"/>
<style name="generic_dropdown_menu"
style="generic_dropdown"/>
<VBox spacing="5">
<HBox spacing="8">
<Label style="generic_control"
text="Channels:"/>
<HBox>
<Entry id="channels_entry"
style="generic_button"
hasframe="false"
horzalignment="start"
width="32"
height="22"
box.fill="true"
box.expand="true"/>
<VBox>
<iconbutton id="channels_inc_button"
width="12"
height="11"
normalicon="spin_up_12x11"
activeicon="spin_up_12x11_inactive"
inactiveicon="spin_up_12x11_inactive"/>
<iconbutton id="channels_dec_button"
width="12"
height="11"
normalicon="spin_down_12x11"
activeicon="spin_down_12x11_inactive"
inactiveicon="spin_down_12x11_inactive"/>
</VBox>
</HBox>
</HBox>
<Hbox>
<IconButton id="split_button"
width="20"
height="20"
normalicon="waves_darker_check_box"
activeicon="waves_darker_check_box_active"
toggleable="true"/>
<Label style="generic_control"
text="Split mono files"/>
</Hbox>
</VBox>
<ScrolledWindow id="channel_scroller"
height="130"
box.fill="true"
box.expand="true"/>
</HBox>

View file

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<HBox CACHEIT="false"
UI.NEEDINIT="true"
spacing="5"
borderwidth="8">
<style name="generic_control"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#6C6C6C"
fgactive="#BFBFBF"
bgactive="#454545"
fghover="#CCCCCC"
bghover="#898989"/>
<style name="generic_button"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
textcolornormal="#6D6E72"
bgnormal="#CACAC5"
basenormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"/>
<style name="generic_dropdown"
style="generic_button"
fgnormal="#EDECE8"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive"
width="90"
height="20"
horzalignment="start"/>
<style name="generic_dropdown_menu"
style="generic_dropdown"/>
<VBox>
<HBox>
<IconButton id="raw_button"
width="20"
height="20"
normalicon="waves_darker_radio_button"
activeicon="waves_darker_radio_button_active"
toggleable="true"/>
<Label style="generic_control"
text="Region contents without fades nor region gain (channels: "/>
<Label id="raw_label"
style="generic_control"/>
<Label style="generic_control"
text=")"/>
</HBox>
<HBox>
<IconButton id="fades_button"
width="20"
height="20"
normalicon="waves_darker_radio_button"
activeicon="waves_darker_radio_button_active"
toggleable="true"
state="active"/>
<Label style="generic_control"
text="Region contents with fades and region gain (channels: "/>
<Label id="fades_label"
style="generic_control"/>
<Label style="generic_control"
text=")"/>
</HBox>
<HBox>
<IconButton id="processed_button"
width="20"
height="20"
normalicon="waves_darker_radio_button"
activeicon="waves_darker_radio_button_active"
toggleable="true"/>
<Label style="generic_control"
text="Track output (channels: "/>
<Label id="processed_label"
style="generic_control"/>
<Label style="generic_control"
text=")"/>
</HBox>
</VBox>
</HBox>

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<HBox CACHEIT="false"
UI.NEEDINIT="true"
spacing="5"
borderwidth="10">
<style name="generic_control"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
bgnormal="#6C6C6C"
fgactive="#BFBFBF"
bgactive="#454545"
fghover="#CCCCCC"
bghover="#898989"/>
<style name="generic_button"
winfont ="Arial Bold 10"
macfont ="Helvetica Bold 10"
fgnormal="#6D6E72"
textcolornormal="#6D6E72"
bgnormal="#CACAC5"
basenormal="#CACAC5"
fgactive="#EDECE8"
bgactive="#6D6E72"
borderwidth="0 0 0 0"
bordercolor="#6D6E72"/>
<style name="generic_dropdown"
style="generic_button"
fgnormal="#EDECE8"
normalicon="dropdown_90x20"
activeicon="dropdown_90x20_active"
inactiveicon="dropdown_90x20_inactive"
width="90"
height="20"
horzalignment="start"/>
<style name="generic_dropdown_menu"
style="generic_dropdown"/>
<VBox spacing="5">
<Hbox spacing="8">
<HBox>
<IconButton id="region_contents_button"
width="20"
height="20"
normalicon="waves_darker_radio_button"
activeicon="waves_darker_radio_button_active"
toggleable="true"
state="active"/>
<Label style="generic_control"
text="Export region contents"/>
</HBox>
<HBox>
<IconButton id="track_output_button"
width="20"
height="20"
normalicon="waves_darker_radio_button"
activeicon="waves_darker_radio_button_active"
toggleable="true"/>
<Label style="generic_control"
text="Export track output"/>
</HBox>
</Hbox>
<ScrolledWindow id="track_scroller"
height="130"
width="622"/>
</VBox>
</HBox>

View file

@ -0,0 +1,654 @@
/*
Copyright (C) 2008 Paul Davis
Copyright (C) 2015 Waves Audio Ltd.
Author: Sakari Bergen
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "waves_export_channel_selector.h"
#include <algorithm>
#include "pbd/convert.h"
#include "ardour/audio_track.h"
#include "ardour/audioregion.h"
#include "ardour/export_channel_configuration.h"
#include "ardour/io.h"
#include "ardour/route.h"
#include "ardour/session.h"
#include <sstream>
#include "i18n.h"
using namespace std;
using namespace Glib;
using namespace ARDOUR;
using namespace PBD;
uint32_t WavesPortExportChannelSelector::__max_channels = 20;
WavesPortExportChannelSelector::WavesPortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
: WavesExportChannelSelector (session, manager)
, WavesUI ("waves_port_export_channel_selector.xml", *this)
, _split_button (get_waves_button ("split_button"))
, _channels_inc_button (get_waves_button ("channels_inc_button"))
, _channels_dec_button (get_waves_button ("channels_dec_button"))
, _channels_entry (get_entry ("channels_entry"))
, _channel_scroller (get_scrolled_window ("channel_scroller"))
, _channel_view (__max_channels)
{
_channel_scroller.add (_channel_view);
_channels_entry.signal_changed().connect (sigc::mem_fun (*this, &WavesPortExportChannelSelector::update_channel_count));
_channels_inc_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesPortExportChannelSelector::on_channels_inc_button));
_channels_dec_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesPortExportChannelSelector::on_channels_dec_button));
_split_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesPortExportChannelSelector::update_split_state));
_channel_view.CriticalSelectionChanged.connect (CriticalSelectionChanged.make_slot());
/* Finalize */
sync_with_manager();
show_all_children ();
}
WavesPortExportChannelSelector::~WavesPortExportChannelSelector ()
{
// if (session) {
// session->add_instant_xml (get_state(), false);
// }
}
void
WavesPortExportChannelSelector::sync_with_manager ()
{
state = manager->get_channel_configs().front();
_split_button.set_active_state (state->config->get_split() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_channels_entry.set_text (string_compose ("%1", state->config->get_n_chans()));
fill_route_list ();
_channel_view.set_config (state->config);
}
void
WavesPortExportChannelSelector::fill_route_list ()
{
_channel_view.clear_routes ();
RouteList routes = *_session->get_routes();
/* Add master bus and then everything else */
if (_session->master_out()) {
ARDOUR::IO* master = _session->master_out()->output().get();
_channel_view.add_route (master);
}
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
if ((*it)->is_master () || (*it)->is_monitor ()) {
continue;
}
_channel_view.add_route ((*it)->output().get());
}
update_channel_count ();
}
void
WavesPortExportChannelSelector::update_channel_count ()
{
uint32_t channels = (uint32_t)PBD::atoi (_channels_entry.get_text());
uint32_t correct_channels = min (__max_channels, max (uint32_t(1), channels));
if (correct_channels != channels) {
_channels_entry.set_text (string_compose ("%1", correct_channels));
}
_channel_view.set_channel_count (correct_channels);
CriticalSelectionChanged();
}
void
WavesPortExportChannelSelector::on_channels_inc_button (WavesButton*)
{
change_channels_value (1);
}
void
WavesPortExportChannelSelector::on_channels_dec_button (WavesButton*)
{
change_channels_value (-1);
}
void
WavesPortExportChannelSelector::change_channels_value (int change)
{
int channels = min ( int (__max_channels), max (1, PBD::atoi (_channels_entry.get_text()) + change));
_channels_entry.set_text (string_compose ("%1", channels));
CriticalSelectionChanged();
}
void
WavesPortExportChannelSelector::update_split_state (WavesButton*)
{
state->config->set_split (_split_button.active_state () == Gtkmm2ext::ExplicitActive);
CriticalSelectionChanged();
}
void
WavesPortExportChannelSelector::RouteCols::add_channels (uint32_t chans)
{
while (chans > 0) {
channels.push_back (Channel (*this));
++n_channels;
--chans;
}
}
WavesPortExportChannelSelector::RouteCols::Channel &
WavesPortExportChannelSelector::RouteCols::get_channel (uint32_t channel)
{
if (channel > n_channels) {
std::cout << "Invalid channel cout for get_channel!" << std::endl;
}
std::list<Channel>::iterator it = channels.begin();
while (channel > 1) { // Channel count starts from one!
++it;
--channel;
}
return *it;
}
WavesPortExportChannelSelector::ChannelTreeView::ChannelTreeView (uint32_t max_channels) :
n_channels (0)
{
/* Main columns */
route_cols.add_channels (max_channels);
route_list = Gtk::ListStore::create(route_cols);
set_model (route_list);
/* Add column with toggle and text */
append_column_editable (_("Bus or Track"), route_cols.selected);
Gtk::CellRendererText* text_renderer = Gtk::manage (new Gtk::CellRendererText);
text_renderer->property_editable() = false;
Gtk::TreeView::Column* column = get_column (0);
column->pack_start (*text_renderer);
column->add_attribute (text_renderer->property_text(), route_cols.name);
Gtk::CellRendererToggle *toggle = dynamic_cast<Gtk::CellRendererToggle *>(get_column_cell_renderer (0));
toggle->signal_toggled().connect (sigc::mem_fun (*this, &WavesPortExportChannelSelector::ChannelTreeView::update_toggle_selection));
static_columns = get_columns().size();
}
void
WavesPortExportChannelSelector::ChannelTreeView::set_config (ChannelConfigPtr c)
{
/* 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;
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) {
for (Gtk::ListStore::Children::iterator r_it = route_list->children().begin(); r_it != route_list->children().end(); ++r_it) {
ARDOUR::PortExportChannel * pec;
if (!(pec = dynamic_cast<ARDOUR::PortExportChannel *> (c_it->get()))) {
continue;
}
Glib::RefPtr<Gtk::ListStore> port_list = r_it->get_value (route_cols.port_list_col);
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 (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<boost::weak_ptr<AudioPort> > > (intersection, intersection.begin()));
intersection.erase (boost::weak_ptr<AudioPort> ()); // Remove "none" selection
if (intersection.empty()) {
continue;
}
if (!r_it->get_value (route_cols.selected)) {
r_it->set_value (route_cols.selected, true);
/* 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, boost::weak_ptr<AudioPort> ());
r_it->set_value (route_cols.get_channel (chn).label, string ("(none)"));
}
}
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);
r_it->set_value (route_cols.get_channel (i).label, label);
}
++i;
}
}
void
WavesPortExportChannelSelector::ChannelTreeView::add_route (ARDOUR::IO * io)
{
Gtk::TreeModel::iterator iter = route_list->append();
Gtk::TreeModel::Row row = *iter;
row[route_cols.selected] = false;
row[route_cols.name] = io->name();
row[route_cols.io] = io;
/* Initialize port list */
Glib::RefPtr<Gtk::ListStore> port_list = Gtk::ListStore::create (route_cols.port_cols);
row[route_cols.port_list_col] = port_list;
uint32_t outs = io->n_ports().n_audio();
for (uint32_t i = 0; i < outs; ++i) {
iter = port_list->append();
row = *iter;
row[route_cols.port_cols.selected] = false;
row[route_cols.port_cols.port] = io->audio (i);
std::ostringstream oss;
oss << "Out-" << (i + 1);
row[route_cols.port_cols.label] = oss.str();
}
iter = port_list->append();
row = *iter;
row[route_cols.port_cols.selected] = false;
row[route_cols.port_cols.port] = boost::weak_ptr<AudioPort> ();
row[route_cols.port_cols.label] = "(none)";
}
void
WavesPortExportChannelSelector::ChannelTreeView::set_channel_count (uint32_t channels)
{
int offset = channels - n_channels;
while (offset > 0) {
++n_channels;
std::ostringstream oss;
oss << n_channels;
/* New column */
Gtk::TreeView::Column* column = Gtk::manage (new Gtk::TreeView::Column (oss.str()));
Gtk::CellRendererCombo* combo_renderer = Gtk::manage (new Gtk::CellRendererCombo);
combo_renderer->property_text_column() = 2;
column->pack_start (*combo_renderer);
append_column (*column);
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);
combo_renderer->signal_edited().connect (sigc::bind (sigc::mem_fun (*this, &WavesPortExportChannelSelector::ChannelTreeView::update_selection_text), n_channels));
/* put data into view */
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, boost::weak_ptr<AudioPort> ());
}
/* set column width */
get_column (static_columns + n_channels - 1)->set_min_width (80);
--offset;
}
while (offset < 0) {
--n_channels;
remove_column (*get_column (n_channels + static_columns));
++offset;
}
update_config ();
}
void
WavesPortExportChannelSelector::ChannelTreeView::update_config ()
{
if (!config) { return; }
config->clear_channels();
for (uint32_t i = 1; i <= n_channels; ++i) {
ExportChannelPtr channel (new PortExportChannel ());
PortExportChannel * pec = static_cast<PortExportChannel *> (channel.get());
for (Gtk::ListStore::Children::iterator it = route_list->children().begin(); it != route_list->children().end(); ++it) {
Gtk::TreeModel::Row row = *it;
if (!row[route_cols.selected]) {
continue;
}
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);
}
}
config->register_channel (channel);
}
CriticalSelectionChanged ();
}
void
WavesPortExportChannelSelector::ChannelTreeView::update_toggle_selection (std::string const & path)
{
Gtk::TreeModel::iterator iter = get_model ()->get_iter (path);
bool selected = iter->get_value (route_cols.selected);
for (uint32_t i = 1; i <= n_channels; ++i) {
if (!selected) {
iter->set_value (route_cols.get_channel (i).label, std::string (""));
continue;
}
iter->set_value (route_cols.get_channel (i).label, std::string("(none)"));
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;
uint32_t port_number = 1;
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, (*port_it)->get_value (route_cols.port_cols.port));
}
++port_number;
}
}
update_config ();
}
void
WavesPortExportChannelSelector::ChannelTreeView::update_selection_text (std::string const & path, std::string const & new_text, uint32_t channel)
{
Gtk::TreeModel::iterator iter = get_model ()->get_iter (path);
iter->set_value (route_cols.get_channel (channel).label, new_text);
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) {
std::string label = port_it->get_value (route_cols.port_cols.label);
if (label == new_text) {
boost::weak_ptr<AudioPort> w = (*port_it)[route_cols.port_cols.port];
iter->set_value (route_cols.get_channel (channel).port, w);
}
}
update_config ();
}
WavesRegionExportChannelSelector::WavesRegionExportChannelSelector (ARDOUR::Session * _session,
ProfileManagerPtr manager,
ARDOUR::AudioRegion const & region,
ARDOUR::AudioTrack & track)
: WavesExportChannelSelector (_session, manager)
, WavesUI ("waves_region_export_channel_selector.xml", *this)
, region (region)
, track (track)
, region_chans (region.n_channels())
, track_chans (track.n_outputs().n_audio())
, _raw_button (get_waves_button ("raw_button"))
, _fades_button (get_waves_button ("fades_button"))
, _processed_button (get_waves_button ("processed_button"))
{
get_label ("raw_label").set_text (string_compose ("%", region_chans));
_raw_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesRegionExportChannelSelector::on_raw_fades_processed_button));
get_label ("fades_label").set_text (string_compose ("%1", region_chans));
_fades_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesRegionExportChannelSelector::on_raw_fades_processed_button));
get_label ("processed_label").set_text (string_compose ("%1", track_chans));
_processed_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesRegionExportChannelSelector::on_raw_fades_processed_button));
state = manager->get_channel_configs().front();
handle_selection (); // To follow the buttons
sync_with_manager();
show_all_children ();
}
void
WavesRegionExportChannelSelector::sync_with_manager ()
{
if (!state) { return; }
RegionExportChannelFactory::Type current_type (state->config->region_processing_type());
_raw_button.set_active_state (current_type == RegionExportChannelFactory::Raw ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_fades_button.set_active_state (current_type == RegionExportChannelFactory::Fades ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_processed_button.set_active_state (current_type == RegionExportChannelFactory::Processed ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
handle_selection ();
}
void
WavesRegionExportChannelSelector::on_raw_fades_processed_button (WavesButton* button)
{
_raw_button.set_active_state (button == &_raw_button ? Gtkmm2ext::ExplicitActive:Gtkmm2ext::Off);
_fades_button.set_active_state (button == &_fades_button ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_processed_button.set_active_state (button == &_processed_button ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
handle_selection ();
}
void
WavesRegionExportChannelSelector::handle_selection ()
{
if (!state) {
return;
}
state->config->clear_channels ();
RegionExportChannelFactory::Type type = RegionExportChannelFactory::None;
if (_raw_button.active_state () == Gtkmm2ext::ExplicitActive) {
type = RegionExportChannelFactory::Raw;
} else if (_fades_button.active_state () == Gtkmm2ext::ExplicitActive) {
type = RegionExportChannelFactory::Fades;
} else if (_processed_button.active_state () == Gtkmm2ext::ExplicitActive) {
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 */
WavesTrackExportChannelSelector::WavesTrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
: WavesExportChannelSelector(session, manager)
, WavesUI ("waves_track_export_channel_selector.xml", *this)
, _region_contents_button (get_waves_button ("region_contents_button"))
, _track_output_button (get_waves_button ("track_output_button"))
, _track_scroller (get_scrolled_window ("track_scroller"))
{
// Track scroller
_region_contents_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesTrackExportChannelSelector::on_region_contents_track_output_button));
_track_output_button.signal_clicked.connect (sigc::mem_fun (*this, &WavesTrackExportChannelSelector::on_region_contents_track_output_button));
_track_scroller.add (_track_view);
// Track list
track_list = Gtk::ListStore::create (track_cols);
_track_view.set_model (track_list);
_track_view.set_headers_visible (true);
_track_view.append_column_editable (_("Track"), track_cols.selected);
Gtk::CellRendererToggle *toggle = dynamic_cast<Gtk::CellRendererToggle *>(_track_view.get_column_cell_renderer (0));
toggle->signal_toggled().connect (sigc::hide (sigc::mem_fun (*this, &WavesTrackExportChannelSelector::update_config)));
Gtk::CellRendererText* text_renderer = Gtk::manage (new Gtk::CellRendererText);
text_renderer->property_editable() = false;
Gtk::TreeView::Column* column = _track_view.get_column (0);
column->pack_start (*text_renderer);
column->add_attribute (text_renderer->property_text(), track_cols.label);
fill_list();
show_all_children ();
}
void
WavesTrackExportChannelSelector::sync_with_manager ()
{
// TODO implement properly
update_config();
}
void
WavesTrackExportChannelSelector::fill_list()
{
track_list->clear();
RouteList routes = *_session->get_routes();
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
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
WavesTrackExportChannelSelector::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.route] = route;
}
void
WavesTrackExportChannelSelector::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;
}
ExportProfileManager::ChannelConfigStatePtr state = manager->add_channel_config();
boost::shared_ptr<Route> route = row[track_cols.route];
if (_track_output_button.active_state () == Gtkmm2ext::ExplicitActive) {
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);
}
state->config->set_name (route->name());
}
CriticalSelectionChanged ();
}
void
WavesTrackExportChannelSelector::on_region_contents_track_output_button (WavesButton* button)
{
_region_contents_button.set_active_state (button == &_region_contents_button ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
_track_output_button.set_active_state (button == &_track_output_button ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
update_config ();
}

View file

@ -0,0 +1,255 @@
/*
Copyright (C) 2008 Paul Davis
Copyright (C) 2015 Waves Audio Ltd.
Author: Sakari Bergen
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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __export_channel_selector_h__
#define __export_channel_selector_h__
#include <list>
#include "ardour/export_profile_manager.h"
#ifdef interface
#undef interface
#endif
#include <gtkmm.h>
#include <sigc++/signal.h>
#include <boost/shared_ptr.hpp>
#include "waves_ui.h"
namespace ARDOUR {
class Session;
class ExportChannelConfiguration;
class RegionExportChannelFactory;
class ExportHandler;
class AudioPort;
class IO;
class AudioRegion;
class AudioTrack;
}
class XMLNode;
class WavesExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
protected:
typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
typedef std::list<ChannelConfigPtr> ChannelConfigList;
typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
ProfileManagerPtr manager;
public:
WavesExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
: SessionHandlePtr (session)
, manager (manager)
{}
virtual ~WavesExportChannelSelector () {}
virtual void sync_with_manager () = 0;
sigc::signal<void> CriticalSelectionChanged;
};
class WavesPortExportChannelSelector : public WavesExportChannelSelector, public WavesUI
{
public:
WavesPortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
~WavesPortExportChannelSelector ();
void sync_with_manager ();
private:
void fill_route_list ();
void update_channel_count ();
void update_split_state (WavesButton*);
void on_channels_dec_button (WavesButton*);
void on_channels_inc_button (WavesButton*);
void change_channels_value (int change);
typedef std::list<ARDOUR::ExportChannelPtr> CahnnelList;
ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
/*** GUI stuff ***/
class RouteCols : public Gtk::TreeModelColumnRecord
{
public:
struct Channel;
RouteCols () : n_channels (0)
{ add (selected); add (name); add (io); add (port_list_col); }
void add_channels (uint32_t chans);
uint32_t n_channels;
/* Channel count starts from one! */
Channel & get_channel (uint32_t channel);
/* Static columns */
Gtk::TreeModelColumn<bool> selected;
Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<ARDOUR::IO *> io;
/* Combo list column (shared by all channels) */
typedef Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > ComboCol;
ComboCol port_list_col;
/* Channel struct, that represents the selected port and its name */
struct Channel {
public:
Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
Gtk::TreeModelColumn<std::string> label;
};
std::list<Channel> channels;
/* List of available ports
* Note: We need only one list of selectable ports per route,
* so the list is kept in the column record
*/
/* Column record for selecting ports for a channel from a route */
class PortCols : public Gtk::TreeModel::ColumnRecord
{
public:
PortCols () { add(selected); add(port); add(label); }
Gtk::TreeModelColumn<bool> selected; // not used ATM
Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
Gtk::TreeModelColumn<std::string> label;
};
PortCols port_cols;
};
class ChannelTreeView : public Gtk::TreeView {
public:
ChannelTreeView (uint32_t max_channels);
void set_config (ChannelConfigPtr c);
/* Routes have to be added before adding channels */
void clear_routes () { route_list->clear (); }
void add_route (ARDOUR::IO * route);
void set_channel_count (uint32_t channels);
sigc::signal<void> CriticalSelectionChanged;
private:
ChannelConfigPtr config;
void update_config ();
/* Signal handlers for selections changes in the view */
void update_toggle_selection (std::string const & path);
void update_selection_text (std::string const & path, std::string const & new_text, uint32_t channel);
RouteCols route_cols;
Glib::RefPtr<Gtk::ListStore> route_list;
uint32_t static_columns;
uint32_t n_channels;
};
Gtk::Entry& _channels_entry;
WavesButton& _channels_inc_button;
WavesButton& _channels_dec_button;
WavesButton& _split_button;
Gtk::ScrolledWindow &_channel_scroller;
ChannelTreeView _channel_view;
static uint32_t __max_channels;
};
class WavesRegionExportChannelSelector : public WavesExportChannelSelector, public WavesUI
{
public:
WavesRegionExportChannelSelector (ARDOUR::Session * session,
ProfileManagerPtr manager,
ARDOUR::AudioRegion const & region,
ARDOUR::AudioTrack & track);
virtual void sync_with_manager ();
private:
void handle_selection ();
void on_raw_fades_processed_button (WavesButton*);
ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
boost::shared_ptr<ARDOUR::RegionExportChannelFactory> factory;
ARDOUR::AudioRegion const & region;
ARDOUR::AudioTrack & track;
uint32_t region_chans;
uint32_t track_chans;
WavesButton& _raw_button;
WavesButton& _fades_button;
WavesButton& _processed_button;
};
class WavesTrackExportChannelSelector : public WavesExportChannelSelector, WavesUI
{
public:
WavesTrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
virtual void sync_with_manager ();
private:
void fill_list();
void add_track (boost::shared_ptr<ARDOUR::Route> route);
void update_config();
void on_region_contents_track_output_button (WavesButton*);
ChannelConfigList configs;
struct TrackCols : public Gtk::TreeModelColumnRecord
{
public:
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
Gtk::TreeModelColumn<std::string> label;
Gtk::TreeModelColumn<bool> selected;
TrackCols () { add (route); add(label); add(selected); }
};
TrackCols track_cols;
Glib::RefPtr<Gtk::ListStore> track_list;
Gtk::TreeView _track_view;
Gtk::ScrolledWindow& _track_scroller;
WavesButton& _region_contents_button;
WavesButton& _track_output_button;
};
#endif /* __export_channel_selector_h__ */

View file

@ -170,7 +170,7 @@ WavesExportDialog::init_components ()
{
preset_selector.reset (new WavesExportPresetSelector ());
timespan_selector.reset (new WavesExportTimespanSelectorMultiple (_session, profile_manager));
channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
channel_selector.reset (new WavesPortExportChannelSelector (_session, profile_manager));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new WavesExportFileNotebook ());
}
@ -446,7 +446,7 @@ WavesExportRangeDialog::init_components ()
{
preset_selector.reset (new WavesExportPresetSelector ());
timespan_selector.reset (new WavesExportTimespanSelectorSingle (_session, profile_manager, range_id));
channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
channel_selector.reset (new WavesPortExportChannelSelector (_session, profile_manager));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new WavesExportFileNotebook ());
}
@ -460,7 +460,7 @@ WavesExportSelectionDialog::init_components ()
{
preset_selector.reset (new WavesExportPresetSelector ());
timespan_selector.reset (new WavesExportTimespanSelectorSingle (_session, profile_manager, X_("selection")));
channel_selector.reset (new PortExportChannelSelector (_session, profile_manager));
channel_selector.reset (new WavesPortExportChannelSelector (_session, profile_manager));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new WavesExportFileNotebook ());
}
@ -485,7 +485,7 @@ WavesExportRegionDialog::init_components ()
preset_selector.reset (new WavesExportPresetSelector ());
timespan_selector.reset (new WavesExportTimespanSelectorSingle (_session, profile_manager, loc_id));
channel_selector.reset (new RegionExportChannelSelector (_session, profile_manager, region, track));
channel_selector.reset (new WavesRegionExportChannelSelector (_session, profile_manager, region, track));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new WavesExportFileNotebook ());
}
@ -501,7 +501,7 @@ WavesStemExportDialog::init_components ()
{
preset_selector.reset (new WavesExportPresetSelector ());
timespan_selector.reset (new WavesExportTimespanSelectorMultiple (_session, profile_manager));
channel_selector.reset (new TrackExportChannelSelector (_session, profile_manager));
channel_selector.reset (new WavesTrackExportChannelSelector (_session, profile_manager));
soundcloud_selector.reset (new SoundcloudExportSelector ());
file_notebook.reset (new WavesExportFileNotebook ());
}

View file

@ -29,7 +29,7 @@
#include "public_editor.h"
#include "waves_export_timespan_selector.h"
#include "export_channel_selector.h"
#include "waves_export_channel_selector.h"
#include "waves_export_file_notebook.h"
#include "waves_export_preset_selector.h"
#include "waves_dialog.h"
@ -42,8 +42,6 @@ namespace ARDOUR {
class ExportHandler;
}
class ExportChannelSelector;
class WavesExportDialog : public WavesDialog, public PBD::ScopedConnectionList
{
@ -79,7 +77,7 @@ class WavesExportDialog : public WavesDialog, public PBD::ScopedConnectionList
boost::scoped_ptr<WavesExportPresetSelector> preset_selector;
boost::scoped_ptr<WavesExportTimespanSelector> timespan_selector;
boost::scoped_ptr<ExportChannelSelector> channel_selector;
boost::scoped_ptr<WavesExportChannelSelector> channel_selector;
boost::scoped_ptr<WavesExportFileNotebook> file_notebook;
boost::shared_ptr<SoundcloudExportSelector> soundcloud_selector;

View file

@ -29,6 +29,7 @@ path_prefix = 'gtk2_ardour/'
gtk2_ardour_sources = [
'mixer_bridge_view.cc',
'waves_export_dialog.cc',
'waves_export_channel_selector.cc',
'waves_track_color_dialog.cc',
'waves_track_color_dialog.logic.cc',
'waves_export_file_notebook.cc',