1 #include "ardour/session.h"
3 #include "ardour/auditioner.h"
4 #include "ardour/audioengine.h"
5 #include "ardour/port.h"
6 #include "session_option_editor.h"
7 #include "port_matrix.h"
12 using namespace ARDOUR;
14 class OptionsPortMatrix : public PortMatrix
17 OptionsPortMatrix (ARDOUR::Session& session)
18 : PortMatrix (session, DataType::AUDIO)
20 _port_group.reset (new PortGroup (""));
21 _ports[OURS].add_group (_port_group);
26 void setup_ports (int dim)
28 cerr << _session.the_auditioner()->output()->n_ports() << "\n";
31 _port_group->clear ();
32 _port_group->add_bundle (_session.click_io()->bundle());
33 _port_group->add_bundle (_session.the_auditioner()->output()->bundle());
35 _ports[OTHER].gather (_session, true);
39 void set_state (ARDOUR::BundleChannel c[2], bool s)
41 Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel);
42 Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel);
44 if (c[OURS].bundle == _session.click_io()->bundle()) {
46 for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
47 for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) {
49 Port* f = _session.engine().get_port_by_name (*i);
53 _session.click_io()->connect (f, *j, 0);
55 _session.click_io()->disconnect (f, *j, 0);
62 PortMatrixNode::State get_state (ARDOUR::BundleChannel c[2]) const
64 Bundle::PortList const & our_ports = c[OURS].bundle->channel_ports (c[OURS].channel);
65 Bundle::PortList const & other_ports = c[OTHER].bundle->channel_ports (c[OTHER].channel);
67 if (c[OURS].bundle == _session.click_io()->bundle()) {
69 for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) {
70 for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) {
71 Port* f = _session.engine().get_port_by_name (*i);
74 if (f->connected_to (*j)) {
75 return PortMatrixNode::ASSOCIATED;
77 return PortMatrixNode::NOT_ASSOCIATED;
88 return PortMatrixNode::NOT_ASSOCIATED;
91 bool list_is_global (int dim) const
93 return (dim == OTHER);
96 bool can_remove_channels (int) const {
99 void remove_channel (ARDOUR::BundleChannel) {}
100 bool can_rename_channels (int) const {
104 std::string disassociation_verb () const {
105 return _("Disassociate");
109 /* see PortMatrix: signal flow from 0 to 1 (out to in) */
115 boost::shared_ptr<PortGroup> _port_group;
120 class ConnectionOptions : public OptionEditorBox
123 ConnectionOptions (ARDOUR::Session* s)
126 _box->pack_start (_port_matrix);
129 void parameter_changed (string const & p)
134 void set_state_from_config ()
140 OptionsPortMatrix _port_matrix;
143 SessionOptionEditor::SessionOptionEditor (Session* s)
144 : OptionEditor (&(s->config), _("Session Preferences")),
145 _session_config (&(s->config))
149 ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
151 _("Crossfades are created"),
152 mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
153 mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
156 cfm->add (FullCrossfade, _("to span entire overlap"));
157 cfm->add (ShortCrossfade, _("short"));
159 add_option (_("Fades"), cfm);
161 add_option (_("Fades"), new SpinOption<float> (
162 _("short-xfade-seconds"),
163 _("Short crossfade length"),
164 mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
165 mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
170 add_option (_("Fades"), new SpinOption<float> (
171 _("destructive-xfade-seconds"),
172 _("Destructive crossfade length"),
173 mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
174 mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
179 add_option (_("Fades"), new BoolOption (
181 _("Create crossfades automatically"),
182 mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
183 mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
186 add_option (_("Fades"), new BoolOption (
188 _("Crossfades active"),
189 mem_fun (*_session_config, &SessionConfiguration::get_xfades_active),
190 mem_fun (*_session_config, &SessionConfiguration::set_xfades_active)
193 add_option (_("Fades"), new BoolOption (
195 _("Crossfades visible"),
196 mem_fun (*_session_config, &SessionConfiguration::get_xfades_visible),
197 mem_fun (*_session_config, &SessionConfiguration::set_xfades_visible)
200 add_option (_("Fades"), new BoolOption (
202 _("Region fades active"),
203 mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
204 mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
207 add_option (_("Fades"), new BoolOption (
209 _("Region fades visible"),
210 mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
211 mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
216 ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
217 "subframes-per-frame",
218 _("Subframes per frame"),
219 mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
220 mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
223 spf->add (80, _("80"));
224 spf->add (100, _("100"));
226 add_option (_("Sync"), spf);
228 ComboOption<SmpteFormat>* smf = new ComboOption<SmpteFormat> (
230 _("Timecode frames-per-second"),
231 mem_fun (*_session_config, &SessionConfiguration::get_smpte_format),
232 mem_fun (*_session_config, &SessionConfiguration::set_smpte_format)
235 smf->add (smpte_23976, _("23.976"));
236 smf->add (smpte_24, _("24"));
237 smf->add (smpte_24976, _("24.976"));
238 smf->add (smpte_25, _("25"));
239 smf->add (smpte_2997, _("29.97"));
240 smf->add (smpte_2997drop, _("29.97 drop"));
241 smf->add (smpte_30, _("30"));
242 smf->add (smpte_30drop, _("30 drop"));
243 smf->add (smpte_5994, _("59.94"));
244 smf->add (smpte_60, _("60"));
246 add_option (_("Sync"), smf);
248 add_option (_("Sync"), new BoolOption (
249 "timecode-source-is-synced",
250 _("Timecode source is synced"),
251 mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
252 mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
255 ComboOption<float>* vpu = new ComboOption<float> (
257 _("Pull-up / pull-down"),
258 mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
259 mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
262 vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
263 vpu->add (4.1667, _("4.1667"));
264 vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
265 vpu->add (0.1, _("0.1"));
266 vpu->add (0, _("none"));
267 vpu->add (-0.1, _("-0.1"));
268 vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
269 vpu->add (-4.1667, _("-4.1667"));
270 vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
272 add_option (_("Sync"), vpu);
276 add_option (_("Misc"), new OptionEditorHeading (_("Audio file format")));
278 ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
279 "native-file-data-format",
281 mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
282 mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
285 sf->add (FormatFloat, _("32-bit floating point"));
286 sf->add (FormatInt24, _("24-bit integer"));
287 sf->add (FormatInt16, _("16-bit integer"));
289 add_option (_("Misc"), sf);
291 ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
292 "native-file-header-format",
294 mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
295 mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
298 hf->add (BWF, _("Broadcast WAVE"));
299 hf->add (WAVE, _("WAVE"));
300 hf->add (WAVE64, _("WAVE-64"));
301 hf->add (CAF, _("CAF"));
303 add_option (_("Misc"), hf);
305 add_option (_("Misc"), new OptionEditorHeading (_("Layering")));
307 ComboOption<LayerModel>* lm = new ComboOption<LayerModel> (
310 mem_fun (*_session_config, &SessionConfiguration::get_layer_model),
311 mem_fun (*_session_config, &SessionConfiguration::set_layer_model)
314 lm->add (LaterHigher, _("later is higher"));
315 lm->add (MoveAddHigher, _("most recently moved or added is higher"));
316 lm->add (AddHigher, _("most recently added is higher"));
318 add_option (_("Misc"), lm);
320 add_option (_("Misc"), new OptionEditorHeading (_("Broadcast WAVE metadata")));
322 add_option (_("Misc"), new EntryOption (
325 mem_fun (*_session_config, &SessionConfiguration::get_bwf_country_code),
326 mem_fun (*_session_config, &SessionConfiguration::set_bwf_country_code)
329 add_option (_("Misc"), new EntryOption (
330 "bwf-organization-code",
331 _("Organization code"),
332 mem_fun (*_session_config, &SessionConfiguration::get_bwf_organization_code),
333 mem_fun (*_session_config, &SessionConfiguration::set_bwf_organization_code)
336 add_option (_("Connections"), new ConnectionOptions (s));