2 * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
3 * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
4 * Copyright (C) 2009-2018 Paul Davis <paul@linuxaudiosystems.com>
5 * Copyright (C) 2012-2019 Robin Gareus <robin@gareus.org>
6 * Copyright (C) 2012 Ben Loftis <ben@harrisonconsoles.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "ardour/session.h"
24 #include "ardour/transport_master_manager.h"
27 #include "gui_thread.h"
28 #include "session_option_editor.h"
29 #include "search_path_option.h"
33 using namespace ARDOUR;
34 using namespace Timecode;
36 SessionOptionEditor::SessionOptionEditor (Session* s)
37 : OptionEditorWindow (&(s->config), _("Session Properties"))
38 , _session_config (&(s->config))
42 set_name ("SessionProperties");
46 add_option (_("Timecode"), new OptionEditorHeading (_("Timecode Settings")));
48 ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
50 _("Timecode frames-per-second"),
51 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
52 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
55 smf->add (timecode_23976, _("23.976"));
56 smf->add (timecode_24, _("24"));
57 smf->add (timecode_24976, _("24.975"));
58 smf->add (timecode_25, _("25"));
59 smf->add (timecode_2997, _("29.97"));
60 smf->add (timecode_2997drop, _("29.97 drop"));
61 smf->add (timecode_30, _("30"));
62 smf->add (timecode_30drop, _("30 drop"));
63 smf->add (timecode_5994, _("59.94"));
64 smf->add (timecode_60, _("60"));
66 add_option (_("Timecode"), smf);
68 _vpu = new ComboOption<float> (
70 _("Pull-up / pull-down"),
71 sigc::mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
72 sigc::mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
75 _vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
76 _vpu->add (4.1667, _("4.1667"));
77 _vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
78 _vpu->add (0.1, _("0.1"));
79 _vpu->add (0, _("none"));
80 _vpu->add (-0.1, _("-0.1"));
81 _vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
82 _vpu->add (-4.1667, _("-4.1667"));
83 _vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
85 add_option (_("Timecode"), _vpu);
86 add_option (_("Timecode"), new OptionEditorHeading (_("Ext Timecode Offsets")));
88 ClockOption* sco = new ClockOption (
89 "slave-timecode-offset",
90 _("Slave Timecode offset"),
91 sigc::mem_fun (*_session_config, &SessionConfiguration::get_slave_timecode_offset),
92 sigc::mem_fun (*_session_config, &SessionConfiguration::set_slave_timecode_offset)
95 sco->set_session (_session);
96 sco->clock().set_negative_allowed (true);
97 Gtkmm2ext::UI::instance()->set_tip (sco->tip_widget(), _("The specified offset is added to the received timecode (MTC or LTC)."));
99 add_option (_("Timecode"), sco);
101 ClockOption* gco = new ClockOption (
102 "timecode-generator-offset",
103 _("Timecode Generator offset"),
104 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_generator_offset),
105 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_generator_offset)
108 gco->set_session (_session);
109 gco->clock().set_negative_allowed (true);
110 Gtkmm2ext::UI::instance()->set_tip (gco->tip_widget(), _("Specify an offset which is added to the generated timecode (so far only LTC)."));
112 add_option (_("Timecode"), gco);
114 add_option (_("Timecode"), new OptionEditorHeading (_("JACK Transport/Time Settings")));
116 add_option (_("Timecode"), new BoolOption (
118 string_compose (_("%1 is JACK Time Master (provides Bar|Beat|Tick and other information to JACK)"), PROGRAM_NAME),
119 sigc::mem_fun (*_session_config, &SessionConfiguration::get_jack_time_master),
120 sigc::mem_fun (*_session_config, &SessionConfiguration::set_jack_time_master)
125 add_option (_("Sync"), new OptionEditorHeading (_("A/V Synchronization")));
126 add_option (_("Sync"), new BoolOption (
127 "use-video-file-fps",
128 _("Use Video File's FPS Instead of Timecode Value for Timeline and Video Monitor."),
129 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_video_file_fps),
130 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_video_file_fps)
133 add_option (_("Sync"), new BoolOption (
134 "videotimeline-pullup",
135 _("Apply Pull-Up/Down to Video Timeline and Video Monitor (Unless using JACK-sync)."),
136 sigc::mem_fun (*_session_config, &SessionConfiguration::get_videotimeline_pullup),
137 sigc::mem_fun (*_session_config, &SessionConfiguration::set_videotimeline_pullup)
140 add_option (_("Sync"), new OptionEditorBlank ());
144 add_option (_("Fades"), new OptionEditorHeading (_("Audio Fades")));
145 add_option (_("Fades"), new SpinOption<float> (
146 _("destructive-xfade-seconds"),
147 _("Destructive crossfade length"),
148 sigc::mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
149 sigc::mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
154 add_option (_("Fades"), new BoolOption (
155 "use-transport-fades",
156 _("Declick when transport starts and stops"),
157 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_transport_fades),
158 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_transport_fades)
161 add_option (_("Fades"), new BoolOption (
163 _("Declick when monitor state changes"),
164 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_monitor_fades),
165 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_monitor_fades)
168 add_option (_("Fades"), new BoolOption (
170 _("Region fades active"),
171 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
172 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
175 add_option (_("Fades"), new BoolOption (
177 _("Region fades visible"),
178 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
179 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
184 add_option (_("Media"), new OptionEditorHeading (_("Audio File Format")));
186 _sf = new ComboOption<SampleFormat> (
187 "native-file-data-format",
189 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
190 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
192 add_option (_("Media"), _sf);
193 /* refill available sample-formats, depening on file-format */
194 parameter_changed ("native-file-header-format");
196 ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
197 "native-file-header-format",
199 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
200 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
203 hf->add (BWF, _("Broadcast WAVE (4GB size limit)"));
204 #ifdef HAVE_RF64_RIFF
205 hf->add (MBWF, _("Broadcast RF64"));
207 hf->add (WAVE, _("WAVE (4GB size limit)"));
208 hf->add (WAVE64, _("WAVE-64"));
209 hf->add (CAF, _("CAF"));
210 hf->add (RF64, _("RF64"));
211 #ifdef HAVE_RF64_RIFF
212 hf->add (RF64_WAV, _("RF64 (WAV compatible)"));
214 hf->add (FLAC, _("FLAC"));
216 add_option (_("Media"), hf);
218 add_option (S_("Files|Locations"), new OptionEditorHeading (_("File Locations")));
220 SearchPathOption* spo = new SearchPathOption ("audio-search-path", _("Search for audio files in:"),
222 sigc::mem_fun (*_session_config, &SessionConfiguration::get_audio_search_path),
223 sigc::mem_fun (*_session_config, &SessionConfiguration::set_audio_search_path));
224 add_option (S_("Files|Locations"), spo);
226 spo = new SearchPathOption ("midi-search-path", _("Search for MIDI files in:"),
228 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_search_path),
229 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_search_path));
231 add_option (S_("Files|Locations"), spo);
235 add_option (_("Filenames"), new OptionEditorHeading (_("File Naming")));
239 bo = new RouteDisplayBoolOption (
241 _("Prefix Track number"),
242 sigc::mem_fun (*_session_config, &SessionConfiguration::get_track_name_number),
243 sigc::mem_fun (*_session_config, &SessionConfiguration::set_track_name_number)
245 Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(),
246 _("Adds the current track number to the beginning of the recorded file name."));
247 add_option (_("Filenames"), bo);
249 bo = new BoolOption (
251 _("Prefix Take Name"),
252 sigc::mem_fun (*_session_config, &SessionConfiguration::get_track_name_take),
253 sigc::mem_fun (*_session_config, &SessionConfiguration::set_track_name_take)
255 Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(),
256 _("Adds the Take Name to the beginning of the recorded file name."));
257 add_option (_("Filenames"), bo);
259 _take_name = new EntryOption (
262 sigc::mem_fun (*_session_config, &SessionConfiguration::get_take_name),
263 sigc::mem_fun (*_session_config, &SessionConfiguration::set_take_name)
265 _take_name->set_invalid_chars(".");
266 _take_name->set_sensitive(_session_config->get_track_name_take());
268 add_option (_("Filenames"), _take_name);
272 add_option (_("Monitoring"), new OptionEditorHeading (_("Monitoring")));
273 add_option (_("Monitoring"), new BoolOption (
275 _("Track Input Monitoring automatically follows transport state (\"auto-input\")"),
276 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_input),
277 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_input)
280 add_option (_("Monitoring"), new CheckOption (
282 _("Use monitor section in this session"),
283 ActionManager::get_action(X_("Monitor"), "UseMonitorSection")
286 add_option (_("Monitoring"), new OptionEditorBlank ());
289 add_option (_("Meterbridge"), new OptionEditorHeading (_("Route Display")));
291 add_option (_("Meterbridge"), new BoolOption (
292 "show-midi-on-meterbridge",
293 _("Show Midi Tracks"),
294 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_midi_on_meterbridge),
295 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_midi_on_meterbridge)
298 add_option (_("Meterbridge"), new BoolOption (
299 "show-busses-on-meterbridge",
301 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_busses_on_meterbridge),
302 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_busses_on_meterbridge)
305 add_option (_("Meterbridge"), new BoolOption (
306 "show-master-on-meterbridge",
307 _("Include Master Bus"),
308 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_master_on_meterbridge),
309 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_master_on_meterbridge)
312 add_option (_("Meterbridge"), new OptionEditorHeading (_("Button Area")));
314 add_option (_("Meterbridge"), new BoolOption (
315 "show-rec-on-meterbridge",
316 _("Rec-enable Button"),
317 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_rec_on_meterbridge),
318 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_rec_on_meterbridge)
321 add_option (_("Meterbridge"), new BoolOption (
322 "show-mute-on-meterbridge",
324 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_mute_on_meterbridge),
325 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_mute_on_meterbridge)
328 add_option (_("Meterbridge"), new BoolOption (
329 "show-solo-on-meterbridge",
331 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_solo_on_meterbridge),
332 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_solo_on_meterbridge)
335 add_option (_("Meterbridge"), new BoolOption (
336 "show-monitor-on-meterbridge",
337 _("Monitor Buttons"),
338 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_monitor_on_meterbridge),
339 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_monitor_on_meterbridge)
342 add_option (_("Meterbridge"), new OptionEditorHeading (_("Name Labels")));
344 add_option (_("Meterbridge"), new BoolOption (
345 "show-name-on-meterbridge",
347 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_name_on_meterbridge),
348 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_name_on_meterbridge)
351 add_option (_("Meterbridge"), new OptionEditorBlank ());
355 add_option (_("Misc"), new OptionEditorHeading (_("MIDI Options")));
357 add_option (_("Misc"), new BoolOption (
359 _("MIDI region copies are independent"),
360 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_copy_is_fork),
361 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_copy_is_fork)
364 ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
365 "insert-merge-policy",
366 _("Policy for handling overlapping notes\n on the same MIDI channel"),
367 sigc::mem_fun (*_session_config, &SessionConfiguration::get_insert_merge_policy),
368 sigc::mem_fun (*_session_config, &SessionConfiguration::set_insert_merge_policy)
371 li->add (InsertMergeReject, _("never allow them"));
372 li->add (InsertMergeRelax, _("don't do anything in particular"));
373 li->add (InsertMergeReplace, _("replace any overlapped existing note"));
374 li->add (InsertMergeTruncateExisting, _("shorten the overlapped existing note"));
375 li->add (InsertMergeTruncateAddition, _("shorten the overlapping new note"));
376 li->add (InsertMergeExtend, _("replace both overlapping notes with a single note"));
378 add_option (_("Misc"), li);
380 add_option (_("Misc"), new OptionEditorHeading (_("Glue to Bars and Beats")));
382 add_option (_("Misc"), new BoolOption (
383 "glue-new-markers-to-bars-and-beats",
384 _("Glue new markers to bars and beats"),
385 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_markers_to_bars_and_beats),
386 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_markers_to_bars_and_beats)
389 add_option (_("Misc"), new BoolOption (
390 "glue-new-regions-to-bars-and-beats",
391 _("Glue new regions to bars and beats"),
392 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_regions_to_bars_and_beats),
393 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_regions_to_bars_and_beats)
396 add_option (_("Misc"), new OptionEditorHeading (_("Metronome")));
398 add_option (_("Misc"), new BoolOption (
400 _("Always count-in when recording"),
401 sigc::mem_fun (*_session_config, &SessionConfiguration::get_count_in),
402 sigc::mem_fun (*_session_config, &SessionConfiguration::set_count_in)
405 add_option (_("Misc"), new OptionEditorHeading (_("Defaults")));
407 Gtk::Button* btn = Gtk::manage (new Gtk::Button (_("Use these settings as defaults")));
408 btn->signal_clicked().connect (sigc::mem_fun (*this, &SessionOptionEditor::save_defaults));
409 add_option (_("Misc"), new FooOption (btn));
411 set_current_page (_("Timecode"));
415 SessionOptionEditor::parameter_changed (std::string const & p)
417 OptionEditor::parameter_changed (p);
418 if (p == "external-sync") {
419 if (TransportMasterManager::instance().current()->type() == Engine) {
420 _vpu->set_sensitive(!_session_config->get_external_sync());
422 _vpu->set_sensitive(true);
425 else if (p == "timecode-format") {
426 /* update offset clocks */
427 parameter_changed("timecode-generator-offset");
428 parameter_changed("slave-timecode-offset");
430 else if (p == "track-name-take") {
431 _take_name->set_sensitive(_session_config->get_track_name_take());
433 else if (p == "native-file-header-format") {
434 bool need_refill = true;
436 if (_session_config->get_native_file_header_format() == FLAC) {
437 _sf->add (FormatInt24, _("24-bit integer"));
438 _sf->add (FormatInt16, _("16-bit integer"));
439 if (_session_config->get_native_file_data_format() == FormatFloat) {
440 _session_config->set_native_file_data_format (FormatInt24);
444 _sf->add (FormatFloat, _("32-bit floating point"));
445 _sf->add (FormatInt24, _("24-bit integer"));
446 _sf->add (FormatInt16, _("16-bit integer"));
449 parameter_changed ("native-file-data-format");
455 SessionOptionEditor::save_defaults ()
457 _session->save_default_options();