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;
30 SessionOptionEditor::SessionOptionEditor (Session* s)
31 : OptionEditor (&(s->config), _("Session Properties"))
32 , _session_config (&(s->config))
36 set_name ("SessionProperties");
40 _sync_source = new ComboOption<SyncSource> (
42 _("External timecode source"),
43 sigc::mem_fun (*_session_config, &SessionConfiguration::get_sync_source),
44 sigc::mem_fun (*_session_config, &SessionConfiguration::set_sync_source)
47 populate_sync_options ();
48 parameter_changed (string ("external-sync"));
50 add_option (_("Timecode"), _sync_source);
52 add_option (_("Timecode"), new OptionEditorHeading (_("Timecode Settings")));
54 ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
56 _("Timecode frames-per-second"),
57 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
58 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
61 smf->add (timecode_23976, _("23.976"));
62 smf->add (timecode_24, _("24"));
63 smf->add (timecode_24976, _("24.976"));
64 smf->add (timecode_25, _("25"));
65 smf->add (timecode_2997, _("29.97"));
66 smf->add (timecode_2997drop, _("29.97 drop"));
67 smf->add (timecode_30, _("30"));
68 smf->add (timecode_30drop, _("30 drop"));
69 smf->add (timecode_5994, _("59.94"));
70 smf->add (timecode_60, _("60"));
72 add_option (_("Timecode"), smf);
74 ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
75 "subframes-per-frame",
76 _("Subframes per frame"),
77 sigc::mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
78 sigc::mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
81 spf->add (80, _("80"));
82 spf->add (100, _("100"));
84 add_option (_("Timecode"), spf);
86 ComboOption<float>* vpu = new ComboOption<float> (
88 _("Pull-up / pull-down"),
89 sigc::mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
90 sigc::mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
93 vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
94 vpu->add (4.1667, _("4.1667"));
95 vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
96 vpu->add (0.1, _("0.1"));
97 vpu->add (0, _("none"));
98 vpu->add (-0.1, _("-0.1"));
99 vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
100 vpu->add (-4.1667, _("-4.1667"));
101 vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
103 add_option (_("Timecode"), vpu);
105 ClockOption* co = new ClockOption (
107 _("Timecode offset"),
108 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset),
109 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset)
112 co->set_session (_session);
114 add_option (_("Timecode"), co);
116 add_option (_("Timecode"), new BoolOption (
117 "timecode-offset-negative",
118 _("Timecode Offset Negative"),
119 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset_negative),
120 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset_negative)
123 add_option (_("Timecode"), new OptionEditorHeading (_("JACK Transport/Time Settings")));
125 add_option (_("Timecode"), new BoolOption (
127 string_compose (_("%1 is JACK Time Master (provides Bar|Beat|Tick and other information to JACK)"), PROGRAM_NAME),
128 sigc::mem_fun (*_session_config, &SessionConfiguration::get_jack_time_master),
129 sigc::mem_fun (*_session_config, &SessionConfiguration::set_jack_time_master)
134 ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
136 _("Crossfades are created"),
137 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
138 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
141 cfm->add (FullCrossfade, _("to span entire overlap"));
142 cfm->add (ShortCrossfade, _("short"));
144 add_option (_("Fades"), cfm);
146 ComboOption<CrossfadeChoice>* cfc = new ComboOption<CrossfadeChoice> (
149 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_choice),
150 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_choice)
153 cfc->add (ConstantPowerMinus3dB, _("constant power (-3dB)"));
154 cfc->add (ConstantPowerMinus6dB, _("constant power (-6dB)"));
155 cfc->add (RegionFades, _("use existing region fade shape"));
157 add_option (_("Fades"), cfc);
159 add_option (_("Fades"), new SpinOption<float> (
160 _("short-xfade-seconds"),
161 _("Short crossfade length"),
162 sigc::mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
163 sigc::mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
168 add_option (_("Fades"), new SpinOption<float> (
169 _("destructive-xfade-seconds"),
170 _("Destructive crossfade length"),
171 sigc::mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
172 sigc::mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
177 add_option (_("Fades"), new BoolOption (
179 _("Create crossfades automatically"),
180 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
181 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
184 add_option (_("Fades"), new BoolOption (
186 _("Region fades active"),
187 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
188 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
191 add_option (_("Fades"), new BoolOption (
193 _("Region fades visible"),
194 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
195 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
200 add_option (_("Media"), new OptionEditorHeading (_("Audio file format")));
202 ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
203 "native-file-data-format",
205 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
206 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
209 sf->add (FormatFloat, _("32-bit floating point"));
210 sf->add (FormatInt24, _("24-bit integer"));
211 sf->add (FormatInt16, _("16-bit integer"));
213 add_option (_("Media"), sf);
215 ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
216 "native-file-header-format",
218 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
219 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
222 hf->add (BWF, _("Broadcast WAVE"));
223 hf->add (WAVE, _("WAVE"));
224 hf->add (WAVE64, _("WAVE-64"));
225 hf->add (CAF, _("CAF"));
227 add_option (_("Media"), hf);
229 add_option (_("Media"), new OptionEditorHeading (_("File locations")));
231 SearchPathOption* spo = new SearchPathOption ("audio-search-path", _("Search for audio files in:"),
232 sigc::mem_fun (*_session_config, &SessionConfiguration::get_audio_search_path),
233 sigc::mem_fun (*_session_config, &SessionConfiguration::set_audio_search_path));
234 add_option (_("Media"), spo);
236 spo = new SearchPathOption ("midi-search-path", _("Search for MIDI files in:"),
237 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_search_path),
238 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_search_path));
240 add_option (_("Media"), spo);
244 add_option (_("Monitoring"), new BoolOption (
246 _("Monitoring automatically follows transport state (\"auto-input\")"),
247 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_input),
248 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_input)
251 add_option (_("Monitoring"), new BoolOption (
252 "have-monitor-section",
253 _("Use monitor section in this session"),
254 sigc::mem_fun (*this, &SessionOptionEditor::get_use_monitor_section),
255 sigc::mem_fun (*this, &SessionOptionEditor::set_use_monitor_section)
260 add_option (_("Misc"), new OptionEditorHeading (_("MIDI Options")));
262 add_option (_("Misc"), new BoolOption (
264 _("MIDI region copies are independent"),
265 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_copy_is_fork),
266 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_copy_is_fork)
269 ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
270 "insert-merge-policy",
271 _("Policy for handling overlapping notes\n on the same MIDI channel"),
272 sigc::mem_fun (*_session_config, &SessionConfiguration::get_insert_merge_policy),
273 sigc::mem_fun (*_session_config, &SessionConfiguration::set_insert_merge_policy)
276 li->add (InsertMergeReject, _("never allow them"));
277 li->add (InsertMergeRelax, _("don't do anything in particular"));
278 li->add (InsertMergeReplace, _("replace any overlapped existing note"));
279 li->add (InsertMergeTruncateExisting, _("shorten the overlapped existing note"));
280 li->add (InsertMergeTruncateAddition, _("shorten the overlapping new note"));
281 li->add (InsertMergeExtend, _("replace both overlapping notes with a single note"));
283 add_option (_("Misc"), li);
285 add_option (_("Misc"), new OptionEditorHeading (_("Glue to bars and beats")));
287 add_option (_("Misc"), new BoolOption (
288 "glue-new-markers-to-bars-and-beats",
289 _("Glue new markers to bars and beats"),
290 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_markers_to_bars_and_beats),
291 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_markers_to_bars_and_beats)
294 add_option (_("Misc"), new BoolOption (
295 "glue-new-regions-to-bars-and-beats",
296 _("Glue new regions to bars and beats"),
297 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_regions_to_bars_and_beats),
298 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_regions_to_bars_and_beats)
303 SessionOptionEditor::populate_sync_options ()
305 vector<SyncSource> sync_opts = _session->get_available_sync_options ();
307 _sync_source->clear ();
309 for (vector<SyncSource>::iterator i = sync_opts.begin(); i != sync_opts.end(); ++i) {
310 _sync_source->add (*i, sync_source_to_string (*i));
315 SessionOptionEditor::parameter_changed (std::string const & p)
317 OptionEditor::parameter_changed (p);
319 if (p == "external-sync") {
320 _sync_source->set_sensitive (!_session->config.get_external_sync ());
324 /* the presence of absence of a monitor section is not really a regular session
325 * property so we provide these two functions to act as setter/getter slots
329 SessionOptionEditor::set_use_monitor_section (bool yn)
331 bool had_monitor_section = _session->monitor_out();
334 _session->add_monitor_section ();
336 _session->remove_monitor_section ();
339 return had_monitor_section != yn;
343 SessionOptionEditor::get_use_monitor_section ()
345 return _session->monitor_out() != 0;