2 Copyright (C) 2000-2010 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "ardour/session.h"
22 #include "gui_thread.h"
23 #include "session_option_editor.h"
24 #include "search_path_option.h"
28 using namespace ARDOUR;
29 using namespace Timecode;
31 SessionOptionEditor::SessionOptionEditor (Session* s)
32 : OptionEditor (&(s->config), _("Session Properties"))
33 , _session_config (&(s->config))
37 set_name ("SessionProperties");
41 add_option (_("Timecode"), new OptionEditorHeading (_("Timecode Settings")));
43 ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
45 _("Timecode frames-per-second"),
46 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
47 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
50 smf->add (timecode_23976, _("23.976"));
51 smf->add (timecode_24, _("24"));
52 smf->add (timecode_24976, _("24.975"));
53 smf->add (timecode_25, _("25"));
54 smf->add (timecode_2997, _("29.97"));
55 smf->add (timecode_2997drop, _("29.97 drop"));
56 smf->add (timecode_30, _("30"));
57 smf->add (timecode_30drop, _("30 drop"));
58 smf->add (timecode_5994, _("59.94"));
59 smf->add (timecode_60, _("60"));
61 add_option (_("Timecode"), smf);
63 _vpu = new ComboOption<float> (
65 _("Pull-up / pull-down"),
66 sigc::mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
67 sigc::mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
70 _vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
71 _vpu->add (4.1667, _("4.1667"));
72 _vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
73 _vpu->add (0.1, _("0.1"));
74 _vpu->add (0, _("none"));
75 _vpu->add (-0.1, _("-0.1"));
76 _vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
77 _vpu->add (-4.1667, _("-4.1667"));
78 _vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
80 add_option (_("Timecode"), _vpu);
82 add_option (_("Sync"), new BoolOption (
84 _("Use Video File's FPS Instead of Timecode Value for Timeline and Video Monitor."),
85 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_video_file_fps),
86 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_video_file_fps)
89 add_option (_("Sync"), new BoolOption (
90 "videotimeline-pullup",
91 _("Apply Pull-Up/Down to Video Timeline and Video Monitor (Unless using JACK-sync)."),
92 sigc::mem_fun (*_session_config, &SessionConfiguration::get_videotimeline_pullup),
93 sigc::mem_fun (*_session_config, &SessionConfiguration::set_videotimeline_pullup)
96 add_option (_("Timecode"), new OptionEditorHeading (_("Ext Timecode Offsets")));
98 ClockOption* sco = new ClockOption (
99 "slave-timecode-offset",
100 _("Slave Timecode offset"),
101 sigc::mem_fun (*_session_config, &SessionConfiguration::get_slave_timecode_offset),
102 sigc::mem_fun (*_session_config, &SessionConfiguration::set_slave_timecode_offset)
105 sco->set_session (_session);
106 sco->clock().set_negative_allowed (true);
107 Gtkmm2ext::UI::instance()->set_tip (sco->tip_widget(), _("The specified offset is added to the received timecode (MTC or LTC)."));
109 add_option (_("Timecode"), sco);
111 ClockOption* gco = new ClockOption (
112 "timecode-generator-offset",
113 _("Timecode Generator offset"),
114 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_generator_offset),
115 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_generator_offset)
118 gco->set_session (_session);
119 gco->clock().set_negative_allowed (true);
120 Gtkmm2ext::UI::instance()->set_tip (gco->tip_widget(), _("Specify an offset which is added to the generated timecode (so far only LTC)."));
122 add_option (_("Timecode"), gco);
124 add_option (_("Timecode"), new OptionEditorHeading (_("JACK Transport/Time Settings")));
126 add_option (_("Timecode"), new BoolOption (
128 string_compose (_("%1 is JACK Time Master (provides Bar|Beat|Tick and other information to JACK)"), PROGRAM_NAME),
129 sigc::mem_fun (*_session_config, &SessionConfiguration::get_jack_time_master),
130 sigc::mem_fun (*_session_config, &SessionConfiguration::set_jack_time_master)
135 add_option (_("Fades"), new SpinOption<float> (
136 _("destructive-xfade-seconds"),
137 _("Destructive crossfade length"),
138 sigc::mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
139 sigc::mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
144 add_option (_("Fades"), new BoolOption (
145 "use-transport-fades",
146 _("Declick when transport starts and stops"),
147 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_transport_fades),
148 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_transport_fades)
151 add_option (_("Fades"), new BoolOption (
153 _("Declick when monitor state changes"),
154 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_monitor_fades),
155 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_monitor_fades)
158 add_option (_("Fades"), new BoolOption (
160 _("Region fades active"),
161 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
162 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
165 add_option (_("Fades"), new BoolOption (
167 _("Region fades visible"),
168 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
169 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
174 add_option (_("Media"), new OptionEditorHeading (_("Audio file format")));
176 ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
177 "native-file-data-format",
179 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
180 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
183 sf->add (FormatFloat, _("32-bit floating point"));
184 sf->add (FormatInt24, _("24-bit integer"));
185 sf->add (FormatInt16, _("16-bit integer"));
187 add_option (_("Media"), sf);
189 ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
190 "native-file-header-format",
192 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
193 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
196 hf->add (BWF, _("Broadcast WAVE (4GB size limit)"));
197 #ifdef HAVE_RF64_RIFF
198 hf->add (MBWF, _("Broadcast RF64"));
200 hf->add (WAVE, _("WAVE (4GB size limit)"));
201 hf->add (WAVE64, _("WAVE-64"));
202 hf->add (CAF, _("CAF"));
203 hf->add (RF64, _("RF64"));
204 #ifdef HAVE_RF64_RIFF
205 hf->add (RF64_WAV, _("RF64 (WAV compatible)"));
208 add_option (_("Media"), hf);
210 add_option (_("Locations"), new OptionEditorHeading (_("File locations")));
212 SearchPathOption* spo = new SearchPathOption ("audio-search-path", _("Search for audio files in:"),
214 sigc::mem_fun (*_session_config, &SessionConfiguration::get_audio_search_path),
215 sigc::mem_fun (*_session_config, &SessionConfiguration::set_audio_search_path));
216 add_option (_("Locations"), spo);
218 spo = new SearchPathOption ("midi-search-path", _("Search for MIDI files in:"),
220 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_search_path),
221 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_search_path));
223 add_option (_("Locations"), spo);
227 add_option (_("Filenames"), new OptionEditorHeading (_("File Naming")));
231 bo = new RouteDisplayBoolOption (
233 _("Prefix Track number"),
234 sigc::mem_fun (*_session_config, &SessionConfiguration::get_track_name_number),
235 sigc::mem_fun (*_session_config, &SessionConfiguration::set_track_name_number)
237 Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(),
238 _("Adds the current track number to the beginning of the recorded file name."));
239 add_option (_("Filenames"), bo);
241 bo = new BoolOption (
243 _("Prefix Take Name"),
244 sigc::mem_fun (*_session_config, &SessionConfiguration::get_track_name_take),
245 sigc::mem_fun (*_session_config, &SessionConfiguration::set_track_name_take)
247 Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(),
248 _("Adds the Take Name to the beginning of the recorded file name."));
249 add_option (_("Filenames"), bo);
251 _take_name = new EntryOption (
254 sigc::mem_fun (*_session_config, &SessionConfiguration::get_take_name),
255 sigc::mem_fun (*_session_config, &SessionConfiguration::set_take_name)
257 _take_name->set_invalid_chars(".");
258 _take_name->set_sensitive(_session_config->get_track_name_take());
260 add_option (_("Filenames"), _take_name);
264 add_option (_("Monitoring"), new BoolOption (
266 _("Track Input Monitoring automatically follows transport state (\"auto-input\")"),
267 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_input),
268 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_input)
271 add_option (_("Monitoring"), new BoolOption (
272 "have-monitor-section",
273 _("Use monitor section in this session"),
274 sigc::mem_fun (*this, &SessionOptionEditor::get_use_monitor_section),
275 sigc::mem_fun (*this, &SessionOptionEditor::set_use_monitor_section)
278 add_option (_("Meterbridge"), new OptionEditorHeading (_("Route Display")));
280 add_option (_("Meterbridge"), new BoolOption (
281 "show-midi-on-meterbridge",
282 _("Show Midi Tracks"),
283 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_midi_on_meterbridge),
284 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_midi_on_meterbridge)
287 add_option (_("Meterbridge"), new BoolOption (
288 "show-busses-on-meterbridge",
290 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_busses_on_meterbridge),
291 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_busses_on_meterbridge)
294 add_option (_("Meterbridge"), new BoolOption (
295 "show-master-on-meterbridge",
296 _("Include Master Bus"),
297 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_master_on_meterbridge),
298 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_master_on_meterbridge)
301 add_option (_("Meterbridge"), new OptionEditorHeading (_("Button Area")));
303 add_option (_("Meterbridge"), new BoolOption (
304 "show-rec-on-meterbridge",
305 _("Rec-enable Button"),
306 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_rec_on_meterbridge),
307 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_rec_on_meterbridge)
310 add_option (_("Meterbridge"), new BoolOption (
311 "show-mute-on-meterbridge",
313 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_mute_on_meterbridge),
314 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_mute_on_meterbridge)
317 add_option (_("Meterbridge"), new BoolOption (
318 "show-solo-on-meterbridge",
320 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_solo_on_meterbridge),
321 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_solo_on_meterbridge)
324 add_option (_("Meterbridge"), new BoolOption (
325 "show-monitor-on-meterbridge",
326 _("Monitor Buttons"),
327 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_monitor_on_meterbridge),
328 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_monitor_on_meterbridge)
331 add_option (_("Meterbridge"), new OptionEditorHeading (_("Name Labels")));
333 add_option (_("Meterbridge"), new BoolOption (
334 "show-name-on-meterbridge",
336 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_name_on_meterbridge),
337 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_name_on_meterbridge)
342 add_option (_("Misc"), new OptionEditorHeading (_("MIDI Options")));
344 add_option (_("Misc"), new BoolOption (
346 _("MIDI region copies are independent"),
347 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_copy_is_fork),
348 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_copy_is_fork)
351 ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
352 "insert-merge-policy",
353 _("Policy for handling overlapping notes\n on the same MIDI channel"),
354 sigc::mem_fun (*_session_config, &SessionConfiguration::get_insert_merge_policy),
355 sigc::mem_fun (*_session_config, &SessionConfiguration::set_insert_merge_policy)
358 li->add (InsertMergeReject, _("never allow them"));
359 li->add (InsertMergeRelax, _("don't do anything in particular"));
360 li->add (InsertMergeReplace, _("replace any overlapped existing note"));
361 li->add (InsertMergeTruncateExisting, _("shorten the overlapped existing note"));
362 li->add (InsertMergeTruncateAddition, _("shorten the overlapping new note"));
363 li->add (InsertMergeExtend, _("replace both overlapping notes with a single note"));
365 add_option (_("Misc"), li);
367 add_option (_("Misc"), new OptionEditorHeading (_("Glue to bars and beats")));
369 add_option (_("Misc"), new BoolOption (
370 "glue-new-markers-to-bars-and-beats",
371 _("Glue new markers to bars and beats"),
372 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_markers_to_bars_and_beats),
373 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_markers_to_bars_and_beats)
376 add_option (_("Misc"), new BoolOption (
377 "glue-new-regions-to-bars-and-beats",
378 _("Glue new regions to bars and beats"),
379 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_regions_to_bars_and_beats),
380 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_regions_to_bars_and_beats)
383 add_option (_("Misc"), new OptionEditorHeading (_("Defaults")));
385 Gtk::Button* btn = Gtk::manage (new Gtk::Button (_("Use these settings as defaults")));
386 btn->signal_clicked().connect (sigc::mem_fun (*this, &SessionOptionEditor::save_defaults));
387 add_option (_("Misc"), new FooOption (btn));
392 SessionOptionEditor::parameter_changed (std::string const & p)
394 OptionEditor::parameter_changed (p);
395 if (p == "external-sync") {
396 if (Config->get_sync_source() == Engine) {
397 _vpu->set_sensitive(!_session_config->get_external_sync());
399 _vpu->set_sensitive(true);
402 else if (p == "timecode-format") {
403 /* update offset clocks */
404 parameter_changed("timecode-generator-offset");
405 parameter_changed("slave-timecode-offset");
407 else if (p == "track-name-take") {
408 _take_name->set_sensitive(_session_config->get_track_name_take());
412 /* the presence of absence of a monitor section is not really a regular session
413 * property so we provide these two functions to act as setter/getter slots
417 SessionOptionEditor::set_use_monitor_section (bool yn)
419 bool had_monitor_section = _session->monitor_out() != 0;
422 _session->add_monitor_section ();
424 _session->remove_monitor_section ();
427 /* store this choice for any new sessions */
429 Config->set_use_monitor_bus (yn);
431 return had_monitor_section != (_session->monitor_out() != 0);
435 SessionOptionEditor::get_use_monitor_section ()
437 return _session->monitor_out() != 0;
441 SessionOptionEditor::save_defaults ()
443 _session->save_default_options();