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"
21 #include "ardour/io.h"
22 #include "ardour/auditioner.h"
23 #include "ardour/audioengine.h"
24 #include "ardour/port.h"
26 #include "gui_thread.h"
27 #include "session_option_editor.h"
28 #include "search_path_option.h"
32 using namespace ARDOUR;
34 SessionOptionEditor::SessionOptionEditor (Session* s)
35 : OptionEditor (&(s->config), _("Session Properties"))
36 , _session_config (&(s->config))
40 set_name ("SessionProperties");
44 _sync_source = new ComboOption<SyncSource> (
46 _("External timecode source"),
47 sigc::mem_fun (*_session_config, &SessionConfiguration::get_sync_source),
48 sigc::mem_fun (*_session_config, &SessionConfiguration::set_sync_source)
51 populate_sync_options ();
52 parameter_changed (string ("external-sync"));
54 add_option (_("Timecode"), _sync_source);
56 add_option (_("Timecode"), new OptionEditorHeading (_("Timecode Settings")));
58 ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
60 _("Timecode frames-per-second"),
61 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
62 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
65 smf->add (timecode_23976, _("23.976"));
66 smf->add (timecode_24, _("24"));
67 smf->add (timecode_24976, _("24.976"));
68 smf->add (timecode_25, _("25"));
69 smf->add (timecode_2997, _("29.97"));
70 smf->add (timecode_2997drop, _("29.97 drop"));
71 smf->add (timecode_30, _("30"));
72 smf->add (timecode_30drop, _("30 drop"));
73 smf->add (timecode_5994, _("59.94"));
74 smf->add (timecode_60, _("60"));
76 add_option (_("Timecode"), smf);
78 ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
79 "subframes-per-frame",
80 _("Subframes per frame"),
81 sigc::mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
82 sigc::mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
85 spf->add (80, _("80"));
86 spf->add (100, _("100"));
88 add_option (_("Timecode"), spf);
90 add_option (_("Timecode"), new BoolOption (
91 "timecode-source-is-synced",
92 _("Timecode source shares sample clock with audio interface"),
93 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
94 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
97 ComboOption<float>* vpu = new ComboOption<float> (
99 _("Pull-up / pull-down"),
100 sigc::mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
101 sigc::mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
104 vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
105 vpu->add (4.1667, _("4.1667"));
106 vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
107 vpu->add (0.1, _("0.1"));
108 vpu->add (0, _("none"));
109 vpu->add (-0.1, _("-0.1"));
110 vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
111 vpu->add (-4.1667, _("-4.1667"));
112 vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
114 add_option (_("Timecode"), vpu);
116 ClockOption* co = new ClockOption (
118 _("Timecode offset"),
119 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset),
120 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset)
123 co->set_session (_session);
125 add_option (_("Timecode"), co);
127 add_option (_("Timecode"), new BoolOption (
128 "timecode-offset-negative",
129 _("Timecode Offset Negative"),
130 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset_negative),
131 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset_negative)
134 add_option (_("Timecode"), new OptionEditorHeading (_("JACK Transport/Time Settings")));
136 add_option (_("Timecode"), new BoolOption (
138 string_compose (_("%1 is JACK Time Master (provides Bar|Beat|Tick and other information to JACK)"), PROGRAM_NAME),
139 sigc::mem_fun (*_session_config, &SessionConfiguration::get_jack_time_master),
140 sigc::mem_fun (*_session_config, &SessionConfiguration::set_jack_time_master)
145 ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
147 _("Crossfades are created"),
148 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
149 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
152 cfm->add (FullCrossfade, _("to span entire overlap"));
153 cfm->add (ShortCrossfade, _("short"));
155 add_option (_("Fades"), cfm);
157 ComboOption<CrossfadeChoice>* cfc = new ComboOption<CrossfadeChoice> (
160 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_choice),
161 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_choice)
164 cfc->add (ConstantPowerMinus3dB, _("Constant Power (-3dB)"));
165 cfc->add (ConstantPowerMinus6dB, _("Constant Power (-6dB)"));
166 cfc->add (RegionFades, _("Use existing Region fade shape"));
168 add_option (_("Fades"), cfc);
170 add_option (_("Fades"), new SpinOption<float> (
171 _("short-xfade-seconds"),
172 _("Short crossfade length"),
173 sigc::mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
174 sigc::mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
179 add_option (_("Fades"), new SpinOption<float> (
180 _("destructive-xfade-seconds"),
181 _("Destructive crossfade length"),
182 sigc::mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
183 sigc::mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
188 add_option (_("Fades"), new BoolOption (
190 _("Create crossfades automatically"),
191 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
192 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
195 add_option (_("Fades"), new BoolOption (
197 _("Region fades active"),
198 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
199 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
202 add_option (_("Fades"), new BoolOption (
204 _("Region fades visible"),
205 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
206 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
211 add_option (_("Media"), new OptionEditorHeading (_("Audio file format")));
213 ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
214 "native-file-data-format",
216 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
217 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
220 sf->add (FormatFloat, _("32-bit floating point"));
221 sf->add (FormatInt24, _("24-bit integer"));
222 sf->add (FormatInt16, _("16-bit integer"));
224 add_option (_("Media"), sf);
226 ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
227 "native-file-header-format",
229 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
230 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
233 hf->add (BWF, _("Broadcast WAVE"));
234 hf->add (WAVE, _("WAVE"));
235 hf->add (WAVE64, _("WAVE-64"));
236 hf->add (CAF, _("CAF"));
238 add_option (_("Media"), hf);
240 add_option (_("Media"), new OptionEditorHeading (_("File locations")));
242 SearchPathOption* spo = new SearchPathOption ("audio-search-path", _("Search for audio files in:"),
243 sigc::mem_fun (*_session_config, &SessionConfiguration::get_audio_search_path),
244 sigc::mem_fun (*_session_config, &SessionConfiguration::set_audio_search_path));
245 add_option (_("Media"), spo);
247 spo = new SearchPathOption ("midi-search-path", _("Search for MIDI files in:"),
248 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_search_path),
249 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_search_path));
251 add_option (_("Media"), spo);
255 add_option (_("Monitoring"), new BoolOption (
257 _("Monitoring automatically follows transport state (\"auto-input\")"),
258 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_input),
259 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_input)
262 add_option (_("Monitoring"), new BoolOption (
263 "have-monitor-section",
264 _("Use monitor section in this session"),
265 sigc::mem_fun (*this, &SessionOptionEditor::get_use_monitor_section),
266 sigc::mem_fun (*this, &SessionOptionEditor::set_use_monitor_section)
271 add_option (_("Misc"), new OptionEditorHeading (_("MIDI Options")));
273 add_option (_("Misc"), new BoolOption (
275 _("MIDI region copies are independent"),
276 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_copy_is_fork),
277 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_copy_is_fork)
280 ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
281 "insert-merge-policy",
282 _("Policy for handling overlapping notes\n on the same MIDI channel"),
283 sigc::mem_fun (*_session_config, &SessionConfiguration::get_insert_merge_policy),
284 sigc::mem_fun (*_session_config, &SessionConfiguration::set_insert_merge_policy)
287 li->add (InsertMergeReject, _("never allow them"));
288 li->add (InsertMergeRelax, _("don't do anything in particular"));
289 li->add (InsertMergeReplace, _("replace any overlapped existing note"));
290 li->add (InsertMergeTruncateExisting, _("shorten the overlapped existing note"));
291 li->add (InsertMergeTruncateAddition, _("shorten the overlapping new note"));
292 li->add (InsertMergeExtend, _("replace both overlapping notes with a single note"));
294 add_option (_("Misc"), li);
296 add_option (_("Misc"), new OptionEditorHeading (_("Glue to bars and beats")));
298 add_option (_("Misc"), new BoolOption (
299 "glue-new-markers-to-bars-and-beats",
300 _("Glue new markers to bars and beats"),
301 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_markers_to_bars_and_beats),
302 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_markers_to_bars_and_beats)
305 add_option (_("Misc"), new BoolOption (
306 "glue-new-regions-to-bars-and-beats",
307 _("Glue new regions to bars and beats"),
308 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_regions_to_bars_and_beats),
309 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_regions_to_bars_and_beats)
314 SessionOptionEditor::populate_sync_options ()
316 vector<SyncSource> sync_opts = _session->get_available_sync_options ();
318 _sync_source->clear ();
320 for (vector<SyncSource>::iterator i = sync_opts.begin(); i != sync_opts.end(); ++i) {
321 _sync_source->add (*i, sync_source_to_string (*i));
326 SessionOptionEditor::parameter_changed (std::string const & p)
328 OptionEditor::parameter_changed (p);
330 if (p == "external-sync") {
331 _sync_source->set_sensitive (!_session->config.get_external_sync ());
335 /* the presence of absence of a monitor section is not really a regular session
336 * property so we provide these two functions to act as setter/getter slots
340 SessionOptionEditor::set_use_monitor_section (bool yn)
342 bool had_monitor_section = _session->monitor_out();
345 _session->add_monitor_section ();
347 _session->remove_monitor_section ();
350 return had_monitor_section != yn;
354 SessionOptionEditor::get_use_monitor_section ()
356 return _session->monitor_out() != 0;