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.976"));
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 ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
64 "subframes-per-frame",
65 _("Subframes per frame"),
66 sigc::mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
67 sigc::mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
70 spf->add (80, _("80"));
71 spf->add (100, _("100"));
73 add_option (_("Timecode"), spf);
75 ComboOption<float>* vpu = new ComboOption<float> (
77 _("Pull-up / pull-down"),
78 sigc::mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
79 sigc::mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
82 vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
83 vpu->add (4.1667, _("4.1667"));
84 vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
85 vpu->add (0.1, _("0.1"));
86 vpu->add (0, _("none"));
87 vpu->add (-0.1, _("-0.1"));
88 vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
89 vpu->add (-4.1667, _("-4.1667"));
90 vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
92 add_option (_("Timecode"), vpu);
94 ClockOption* co = new ClockOption (
97 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset),
98 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset)
101 co->set_session (_session);
103 add_option (_("Timecode"), co);
105 add_option (_("Timecode"), new BoolOption (
106 "timecode-offset-negative",
107 _("Timecode Offset Negative"),
108 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset_negative),
109 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset_negative)
112 add_option (_("Timecode"), new OptionEditorHeading (_("JACK Transport/Time Settings")));
114 add_option (_("Timecode"), new BoolOption (
116 string_compose (_("%1 is JACK Time Master (provides Bar|Beat|Tick and other information to JACK)"), PROGRAM_NAME),
117 sigc::mem_fun (*_session_config, &SessionConfiguration::get_jack_time_master),
118 sigc::mem_fun (*_session_config, &SessionConfiguration::set_jack_time_master)
123 ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
125 _("Crossfades are created"),
126 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
127 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
130 cfm->add (FullCrossfade, _("to span entire overlap"));
131 cfm->add (ShortCrossfade, _("short"));
133 add_option (_("Fades"), cfm);
135 ComboOption<CrossfadeChoice>* cfc = new ComboOption<CrossfadeChoice> (
138 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_choice),
139 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_choice)
142 cfc->add (ConstantPowerMinus3dB, _("constant power (-3dB)"));
143 cfc->add (ConstantPowerMinus6dB, _("constant power (-6dB)"));
144 cfc->add (RegionFades, _("use existing region fade shape"));
146 add_option (_("Fades"), cfc);
148 add_option (_("Fades"), new SpinOption<float> (
149 _("short-xfade-seconds"),
150 _("Short crossfade length"),
151 sigc::mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
152 sigc::mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
157 add_option (_("Fades"), new SpinOption<float> (
158 _("destructive-xfade-seconds"),
159 _("Destructive crossfade length"),
160 sigc::mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
161 sigc::mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
166 add_option (_("Fades"), new BoolOption (
168 _("Create crossfades automatically"),
169 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
170 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
173 add_option (_("Fades"), new BoolOption (
175 _("Region fades active"),
176 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
177 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
180 add_option (_("Fades"), new BoolOption (
182 _("Region fades visible"),
183 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
184 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
189 add_option (_("Media"), new OptionEditorHeading (_("Audio file format")));
191 ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
192 "native-file-data-format",
194 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
195 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
198 sf->add (FormatFloat, _("32-bit floating point"));
199 sf->add (FormatInt24, _("24-bit integer"));
200 sf->add (FormatInt16, _("16-bit integer"));
202 add_option (_("Media"), sf);
204 ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
205 "native-file-header-format",
207 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
208 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
211 hf->add (BWF, _("Broadcast WAVE"));
212 hf->add (WAVE, _("WAVE"));
213 hf->add (WAVE64, _("WAVE-64"));
214 hf->add (CAF, _("CAF"));
216 add_option (_("Media"), hf);
218 add_option (_("Media"), new OptionEditorHeading (_("File locations")));
220 SearchPathOption* spo = new SearchPathOption ("audio-search-path", _("Search for audio files in:"),
221 sigc::mem_fun (*_session_config, &SessionConfiguration::get_audio_search_path),
222 sigc::mem_fun (*_session_config, &SessionConfiguration::set_audio_search_path));
223 add_option (_("Media"), spo);
225 spo = new SearchPathOption ("midi-search-path", _("Search for MIDI files in:"),
226 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_search_path),
227 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_search_path));
229 add_option (_("Media"), spo);
233 add_option (_("Monitoring"), new BoolOption (
235 _("Monitoring automatically follows transport state (\"auto-input\")"),
236 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_input),
237 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_input)
240 add_option (_("Monitoring"), new BoolOption (
241 "have-monitor-section",
242 _("Use monitor section in this session"),
243 sigc::mem_fun (*this, &SessionOptionEditor::get_use_monitor_section),
244 sigc::mem_fun (*this, &SessionOptionEditor::set_use_monitor_section)
249 add_option (_("Misc"), new OptionEditorHeading (_("MIDI Options")));
251 add_option (_("Misc"), new BoolOption (
253 _("MIDI region copies are independent"),
254 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_copy_is_fork),
255 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_copy_is_fork)
258 ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
259 "insert-merge-policy",
260 _("Policy for handling overlapping notes\n on the same MIDI channel"),
261 sigc::mem_fun (*_session_config, &SessionConfiguration::get_insert_merge_policy),
262 sigc::mem_fun (*_session_config, &SessionConfiguration::set_insert_merge_policy)
265 li->add (InsertMergeReject, _("never allow them"));
266 li->add (InsertMergeRelax, _("don't do anything in particular"));
267 li->add (InsertMergeReplace, _("replace any overlapped existing note"));
268 li->add (InsertMergeTruncateExisting, _("shorten the overlapped existing note"));
269 li->add (InsertMergeTruncateAddition, _("shorten the overlapping new note"));
270 li->add (InsertMergeExtend, _("replace both overlapping notes with a single note"));
272 add_option (_("Misc"), li);
274 add_option (_("Misc"), new OptionEditorHeading (_("Glue to bars and beats")));
276 add_option (_("Misc"), new BoolOption (
277 "glue-new-markers-to-bars-and-beats",
278 _("Glue new markers to bars and beats"),
279 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_markers_to_bars_and_beats),
280 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_markers_to_bars_and_beats)
283 add_option (_("Misc"), new BoolOption (
284 "glue-new-regions-to-bars-and-beats",
285 _("Glue new regions to bars and beats"),
286 sigc::mem_fun (*_session_config, &SessionConfiguration::get_glue_new_regions_to_bars_and_beats),
287 sigc::mem_fun (*_session_config, &SessionConfiguration::set_glue_new_regions_to_bars_and_beats)
292 SessionOptionEditor::parameter_changed (std::string const & p)
294 OptionEditor::parameter_changed (p);
297 /* the presence of absence of a monitor section is not really a regular session
298 * property so we provide these two functions to act as setter/getter slots
302 SessionOptionEditor::set_use_monitor_section (bool yn)
304 bool had_monitor_section = _session->monitor_out();
307 _session->add_monitor_section ();
309 _session->remove_monitor_section ();
312 return had_monitor_section != yn;
316 SessionOptionEditor::get_use_monitor_section ()
318 return _session->monitor_out() != 0;