2009-05-15 21:22:43 -04:00
|
|
|
#include "ardour/session.h"
|
2009-05-20 16:54:07 -04:00
|
|
|
#include "ardour/io.h"
|
|
|
|
#include "ardour/auditioner.h"
|
|
|
|
#include "ardour/audioengine.h"
|
|
|
|
#include "ardour/port.h"
|
2009-05-15 21:22:43 -04:00
|
|
|
#include "session_option_editor.h"
|
2009-05-20 16:54:07 -04:00
|
|
|
#include "port_matrix.h"
|
2009-05-15 21:22:43 -04:00
|
|
|
#include "i18n.h"
|
|
|
|
|
2009-05-20 16:54:07 -04:00
|
|
|
using namespace std;
|
2009-05-15 21:22:43 -04:00
|
|
|
using namespace sigc;
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
2009-05-20 16:54:07 -04:00
|
|
|
class OptionsPortMatrix : public PortMatrix
|
|
|
|
{
|
|
|
|
public:
|
2009-07-21 21:28:31 -04:00
|
|
|
OptionsPortMatrix (Gtk::Window* parent, ARDOUR::Session& session)
|
|
|
|
: PortMatrix (parent, session, DataType::AUDIO)
|
2009-05-20 16:54:07 -04:00
|
|
|
{
|
|
|
|
_port_group.reset (new PortGroup (""));
|
|
|
|
_ports[OURS].add_group (_port_group);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-20 16:54:07 -04:00
|
|
|
setup_all_ports ();
|
2009-11-23 10:55:52 -05:00
|
|
|
init ();
|
2009-05-20 16:54:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void setup_ports (int dim)
|
|
|
|
{
|
2009-06-09 16:21:19 -04:00
|
|
|
cerr << _session.the_auditioner()->output()->n_ports() << "\n";
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-20 16:54:07 -04:00
|
|
|
if (dim == OURS) {
|
|
|
|
_port_group->clear ();
|
2009-06-09 16:21:19 -04:00
|
|
|
_port_group->add_bundle (_session.click_io()->bundle());
|
|
|
|
_port_group->add_bundle (_session.the_auditioner()->output()->bundle());
|
2009-05-20 16:54:07 -04:00
|
|
|
} else {
|
2009-11-14 18:08:17 -05:00
|
|
|
_ports[OTHER].gather (_session, true, false);
|
2009-05-20 16:54:07 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_state (ARDOUR::BundleChannel c[2], bool s)
|
|
|
|
{
|
|
|
|
Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel);
|
|
|
|
Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
if (c[OURS].bundle == _session.click_io()->bundle()) {
|
2009-05-20 16:54:07 -04:00
|
|
|
|
|
|
|
for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
|
|
|
|
for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) {
|
|
|
|
|
|
|
|
Port* f = _session.engine().get_port_by_name (*i);
|
|
|
|
assert (f);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-20 16:54:07 -04:00
|
|
|
if (s) {
|
2009-06-09 16:21:19 -04:00
|
|
|
_session.click_io()->connect (f, *j, 0);
|
2009-05-20 16:54:07 -04:00
|
|
|
} else {
|
2009-06-09 16:21:19 -04:00
|
|
|
_session.click_io()->disconnect (f, *j, 0);
|
2009-05-20 16:54:07 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const
|
|
|
|
{
|
|
|
|
Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel);
|
|
|
|
Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
if (c[OURS].bundle == _session.click_io()->bundle()) {
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-20 16:54:07 -04:00
|
|
|
for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
|
|
|
|
for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) {
|
|
|
|
Port* f = _session.engine().get_port_by_name (*i);
|
|
|
|
assert (f);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-20 16:54:07 -04:00
|
|
|
if (f->connected_to (*j)) {
|
|
|
|
return PortMatrixNode::ASSOCIATED;
|
|
|
|
} else {
|
|
|
|
return PortMatrixNode::NOT_ASSOCIATED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* XXX */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return PortMatrixNode::NOT_ASSOCIATED;
|
|
|
|
}
|
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
bool list_is_global (int dim) const {
|
2009-05-20 16:54:07 -04:00
|
|
|
return (dim == OTHER);
|
|
|
|
}
|
|
|
|
|
2009-07-19 20:22:09 -04:00
|
|
|
bool can_remove_channels (boost::shared_ptr<Bundle>) const {
|
2009-05-20 16:54:07 -04:00
|
|
|
return false;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-20 16:54:07 -04:00
|
|
|
void remove_channel (ARDOUR::BundleChannel) {}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-19 15:07:31 -04:00
|
|
|
std::string disassociation_verb () const {
|
|
|
|
return _("Disassociate");
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-20 16:54:07 -04:00
|
|
|
private:
|
|
|
|
/* see PortMatrix: signal flow from 0 to 1 (out to in) */
|
|
|
|
enum {
|
|
|
|
OURS = 0,
|
|
|
|
OTHER = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
boost::shared_ptr<PortGroup> _port_group;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ConnectionOptions : public OptionEditorBox
|
|
|
|
{
|
|
|
|
public:
|
2009-07-21 21:28:31 -04:00
|
|
|
ConnectionOptions (Gtk::Window* parent, ARDOUR::Session* s)
|
|
|
|
: _port_matrix (parent, *s)
|
2009-05-20 16:54:07 -04:00
|
|
|
{
|
|
|
|
_box->pack_start (_port_matrix);
|
|
|
|
}
|
|
|
|
|
2009-07-21 11:55:17 -04:00
|
|
|
void parameter_changed (string const &)
|
2009-05-20 16:54:07 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_state_from_config ()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
OptionsPortMatrix _port_matrix;
|
|
|
|
};
|
|
|
|
|
2009-05-15 21:22:43 -04:00
|
|
|
SessionOptionEditor::SessionOptionEditor (Session* s)
|
2009-11-09 15:05:18 -05:00
|
|
|
: OptionEditor (&(s->config), _("Session Preferences"))
|
|
|
|
, _session_config (&(s->config))
|
2009-05-15 21:22:43 -04:00
|
|
|
{
|
|
|
|
/* SYNC */
|
|
|
|
|
|
|
|
ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
|
|
|
|
"subframes-per-frame",
|
|
|
|
_("Subframes per frame"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
|
|
|
|
);
|
|
|
|
|
|
|
|
spf->add (80, _("80"));
|
|
|
|
spf->add (100, _("100"));
|
|
|
|
|
|
|
|
add_option (_("Sync"), spf);
|
|
|
|
|
2009-11-09 15:05:18 -05:00
|
|
|
ComboOption<SyncSource>* ssrc = new ComboOption<SyncSource> (
|
|
|
|
"sync-source",
|
|
|
|
_("External sync source"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_sync_source),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_sync_source)
|
|
|
|
);
|
|
|
|
|
|
|
|
s->MTC_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc));
|
|
|
|
s->MIDIClock_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc));
|
2009-11-09 23:30:08 -05:00
|
|
|
s->config.ParameterChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::follow_sync_state), s, ssrc));
|
|
|
|
|
2009-11-09 15:05:18 -05:00
|
|
|
populate_sync_options (s, ssrc);
|
2009-11-09 23:30:08 -05:00
|
|
|
follow_sync_state (string ("external-sync"), s, ssrc);
|
2009-11-09 15:05:18 -05:00
|
|
|
|
|
|
|
add_option (_("Sync"), ssrc);
|
|
|
|
|
2009-10-26 22:24:56 -04:00
|
|
|
ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
|
2009-10-26 10:38:58 -04:00
|
|
|
"timecode-format",
|
2009-05-15 21:22:43 -04:00
|
|
|
_("Timecode frames-per-second"),
|
2009-10-26 10:38:58 -04:00
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
|
2009-05-15 21:22:43 -04:00
|
|
|
);
|
|
|
|
|
2009-10-26 10:38:58 -04:00
|
|
|
smf->add (timecode_23976, _("23.976"));
|
|
|
|
smf->add (timecode_24, _("24"));
|
|
|
|
smf->add (timecode_24976, _("24.976"));
|
|
|
|
smf->add (timecode_25, _("25"));
|
|
|
|
smf->add (timecode_2997, _("29.97"));
|
|
|
|
smf->add (timecode_2997drop, _("29.97 drop"));
|
|
|
|
smf->add (timecode_30, _("30"));
|
|
|
|
smf->add (timecode_30drop, _("30 drop"));
|
|
|
|
smf->add (timecode_5994, _("59.94"));
|
|
|
|
smf->add (timecode_60, _("60"));
|
2009-05-15 21:22:43 -04:00
|
|
|
|
|
|
|
add_option (_("Sync"), smf);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-15 21:22:43 -04:00
|
|
|
add_option (_("Sync"), new BoolOption (
|
|
|
|
"timecode-source-is-synced",
|
2009-12-01 08:20:36 -05:00
|
|
|
_("Timecode source shares sample clock with audio interface"),
|
2009-05-15 21:22:43 -04:00
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
|
|
|
|
));
|
2009-05-15 21:53:43 -04:00
|
|
|
|
|
|
|
ComboOption<float>* vpu = new ComboOption<float> (
|
|
|
|
"video-pullup",
|
|
|
|
_("Pull-up / pull-down"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
|
|
|
|
);
|
|
|
|
|
|
|
|
vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
|
|
|
|
vpu->add (4.1667, _("4.1667"));
|
|
|
|
vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
|
|
|
|
vpu->add (0.1, _("0.1"));
|
|
|
|
vpu->add (0, _("none"));
|
|
|
|
vpu->add (-0.1, _("-0.1"));
|
|
|
|
vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
|
|
|
|
vpu->add (-4.1667, _("-4.1667"));
|
|
|
|
vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-15 21:53:43 -04:00
|
|
|
add_option (_("Sync"), vpu);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-11-09 23:30:08 -05:00
|
|
|
/* FADES */
|
|
|
|
|
|
|
|
ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
|
|
|
|
"xfade-model",
|
|
|
|
_("Crossfades are created"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
|
|
|
|
);
|
|
|
|
|
|
|
|
cfm->add (FullCrossfade, _("to span entire overlap"));
|
|
|
|
cfm->add (ShortCrossfade, _("short"));
|
|
|
|
|
|
|
|
add_option (_("Fades"), cfm);
|
|
|
|
|
|
|
|
add_option (_("Fades"), new SpinOption<float> (
|
|
|
|
_("short-xfade-seconds"),
|
|
|
|
_("Short crossfade length"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
|
|
|
|
0, 1000, 1, 10,
|
|
|
|
_("ms"), 0.001
|
|
|
|
));
|
|
|
|
|
|
|
|
add_option (_("Fades"), new SpinOption<float> (
|
|
|
|
_("destructive-xfade-seconds"),
|
|
|
|
_("Destructive crossfade length"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
|
|
|
|
0, 1000, 1, 10,
|
|
|
|
_("ms")
|
|
|
|
));
|
|
|
|
|
|
|
|
add_option (_("Fades"), new BoolOption (
|
|
|
|
"auto-xfade",
|
|
|
|
_("Create crossfades automatically"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
|
|
|
|
));
|
|
|
|
|
|
|
|
add_option (_("Fades"), new BoolOption (
|
|
|
|
"xfades-active",
|
|
|
|
_("Crossfades active"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_xfades_active),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_xfades_active)
|
|
|
|
));
|
|
|
|
|
|
|
|
add_option (_("Fades"), new BoolOption (
|
|
|
|
"xfades-visible",
|
|
|
|
_("Crossfades visible"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_xfades_visible),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_xfades_visible)
|
|
|
|
));
|
|
|
|
|
|
|
|
add_option (_("Fades"), new BoolOption (
|
|
|
|
"use-region-fades",
|
|
|
|
_("Region fades active"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
|
|
|
|
));
|
|
|
|
|
|
|
|
add_option (_("Fades"), new BoolOption (
|
|
|
|
"show-region-fades",
|
|
|
|
_("Region fades visible"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
|
|
|
|
));
|
|
|
|
|
2009-05-15 21:22:43 -04:00
|
|
|
/* MISC */
|
|
|
|
|
|
|
|
add_option (_("Misc"), new OptionEditorHeading (_("Audio file format")));
|
|
|
|
|
|
|
|
ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
|
|
|
|
"native-file-data-format",
|
|
|
|
_("Sample format"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
|
|
|
|
);
|
|
|
|
|
|
|
|
sf->add (FormatFloat, _("32-bit floating point"));
|
|
|
|
sf->add (FormatInt24, _("24-bit integer"));
|
|
|
|
sf->add (FormatInt16, _("16-bit integer"));
|
|
|
|
|
|
|
|
add_option (_("Misc"), sf);
|
|
|
|
|
|
|
|
ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
|
|
|
|
"native-file-header-format",
|
|
|
|
_("File type"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
|
|
|
|
);
|
|
|
|
|
|
|
|
hf->add (BWF, _("Broadcast WAVE"));
|
|
|
|
hf->add (WAVE, _("WAVE"));
|
|
|
|
hf->add (WAVE64, _("WAVE-64"));
|
|
|
|
hf->add (CAF, _("CAF"));
|
|
|
|
|
|
|
|
add_option (_("Misc"), hf);
|
|
|
|
|
|
|
|
add_option (_("Misc"), new OptionEditorHeading (_("Layering")));
|
|
|
|
|
|
|
|
ComboOption<LayerModel>* lm = new ComboOption<LayerModel> (
|
|
|
|
"layer-model",
|
2009-08-25 20:06:21 -04:00
|
|
|
_("Layering model in overlaid mode"),
|
2009-05-15 21:22:43 -04:00
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_layer_model),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_layer_model)
|
|
|
|
);
|
|
|
|
|
|
|
|
lm->add (LaterHigher, _("later is higher"));
|
|
|
|
lm->add (MoveAddHigher, _("most recently moved or added is higher"));
|
|
|
|
lm->add (AddHigher, _("most recently added is higher"));
|
|
|
|
|
|
|
|
add_option (_("Misc"), lm);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-15 21:22:43 -04:00
|
|
|
add_option (_("Misc"), new OptionEditorHeading (_("Broadcast WAVE metadata")));
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-05-15 21:22:43 -04:00
|
|
|
add_option (_("Misc"), new EntryOption (
|
|
|
|
"bwf-country-code",
|
|
|
|
_("Country code"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_bwf_country_code),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_bwf_country_code)
|
|
|
|
));
|
|
|
|
|
|
|
|
add_option (_("Misc"), new EntryOption (
|
|
|
|
"bwf-organization-code",
|
|
|
|
_("Organization code"),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::get_bwf_organization_code),
|
|
|
|
mem_fun (*_session_config, &SessionConfiguration::set_bwf_organization_code)
|
|
|
|
));
|
2009-05-20 16:54:07 -04:00
|
|
|
|
2009-07-21 21:28:31 -04:00
|
|
|
add_option (_("Connections"), new ConnectionOptions (this, s));
|
2009-05-15 21:22:43 -04:00
|
|
|
}
|
2009-11-09 15:05:18 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
SessionOptionEditor::populate_sync_options (Session* s, Option* opt)
|
|
|
|
{
|
|
|
|
ComboOption<SyncSource>* sync_opt = dynamic_cast<ComboOption<SyncSource>* > (opt);
|
|
|
|
|
|
|
|
vector<SyncSource> sync_opts = s->get_available_sync_options ();
|
|
|
|
|
|
|
|
sync_opt->clear ();
|
|
|
|
|
|
|
|
for (vector<SyncSource>::iterator i = sync_opts.begin(); i != sync_opts.end(); ++i) {
|
|
|
|
sync_opt->add (*i, sync_source_to_string (*i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-09 23:30:08 -05:00
|
|
|
void
|
|
|
|
SessionOptionEditor::follow_sync_state (std::string p, Session* s, Option* opt)
|
|
|
|
{
|
|
|
|
ComboOption<SyncSource>* sync_opt = dynamic_cast<ComboOption<SyncSource>* > (opt);
|
|
|
|
if (p == "external-sync") {
|
|
|
|
if (s->config.get_external_sync()) {
|
|
|
|
sync_opt->set_sensitive (false);
|
|
|
|
} else {
|
|
|
|
sync_opt->set_sensitive (true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|