Remove erroneous assert which I added earlier.
[ardour2.git] / gtk2_ardour / session_option_editor.cc
blob73663ebe2228da6aebe53c7f1ed4b0c250ea08ea
1 /*
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"
29 #include "i18n.h"
31 using namespace std;
32 using namespace ARDOUR;
34 SessionOptionEditor::SessionOptionEditor (Session* s)
35 : OptionEditor (&(s->config), _("Session Properties"))
36 , _session_config (&(s->config))
38 set_session (s);
40 set_name ("SessionProperties");
42 /* TIMECODE*/
44 _sync_source = new ComboOption<SyncSource> (
45 "sync-source",
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")));
59 ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
60 "timecode-format",
61 _("Timecode frames-per-second"),
62 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
63 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
66 smf->add (timecode_23976, _("23.976"));
67 smf->add (timecode_24, _("24"));
68 smf->add (timecode_24976, _("24.976"));
69 smf->add (timecode_25, _("25"));
70 smf->add (timecode_2997, _("29.97"));
71 smf->add (timecode_2997drop, _("29.97 drop"));
72 smf->add (timecode_30, _("30"));
73 smf->add (timecode_30drop, _("30 drop"));
74 smf->add (timecode_5994, _("59.94"));
75 smf->add (timecode_60, _("60"));
77 add_option (_("Timecode"), smf);
79 ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
80 "subframes-per-frame",
81 _("Subframes per frame"),
82 sigc::mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
83 sigc::mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
86 spf->add (80, _("80"));
87 spf->add (100, _("100"));
89 add_option (_("Timecode"), spf);
91 add_option (_("Timecode"), new BoolOption (
92 "timecode-source-is-synced",
93 _("Timecode source shares sample clock with audio interface"),
94 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
95 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
96 ));
98 ComboOption<float>* vpu = new ComboOption<float> (
99 "video-pullup",
100 _("Pull-up / pull-down"),
101 sigc::mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
102 sigc::mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
105 vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
106 vpu->add (4.1667, _("4.1667"));
107 vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
108 vpu->add (0.1, _("0.1"));
109 vpu->add (0, _("none"));
110 vpu->add (-0.1, _("-0.1"));
111 vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
112 vpu->add (-4.1667, _("-4.1667"));
113 vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
115 add_option (_("Timecode"), vpu);
117 ClockOption* co = new ClockOption (
118 "timecode-offset",
119 _("Timecode Offset"),
120 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset),
121 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset)
124 co->set_session (_session);
126 add_option (_("Timecode"), co);
128 add_option (_("Timecode"), new BoolOption (
129 "timecode-offset-negative",
130 _("Timecode Offset Negative"),
131 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_offset_negative),
132 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_offset_negative)
135 /* FADES */
137 ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
138 "xfade-model",
139 _("Crossfades are created"),
140 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
141 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
144 cfm->add (FullCrossfade, _("to span entire overlap"));
145 cfm->add (ShortCrossfade, _("short"));
147 add_option (_("Fades"), cfm);
149 add_option (_("Fades"), new SpinOption<float> (
150 _("short-xfade-seconds"),
151 _("Short crossfade length"),
152 sigc::mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
153 sigc::mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
154 0, 1000, 1, 10,
155 _("ms"), 0.001
158 add_option (_("Fades"), new SpinOption<float> (
159 _("destructive-xfade-seconds"),
160 _("Destructive crossfade length"),
161 sigc::mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
162 sigc::mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
163 0, 1000, 1, 10,
164 _("ms")
167 add_option (_("Fades"), new BoolOption (
168 "auto-xfade",
169 _("Create crossfades automatically"),
170 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
171 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
174 add_option (_("Fades"), new BoolOption (
175 "xfades-active",
176 _("Crossfades active"),
177 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfades_active),
178 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfades_active)
181 add_option (_("Fades"), new BoolOption (
182 "xfades-visible",
183 _("Crossfades visible"),
184 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfades_visible),
185 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfades_visible)
188 add_option (_("Fades"), new BoolOption (
189 "use-region-fades",
190 _("Region fades active"),
191 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
192 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
195 add_option (_("Fades"), new BoolOption (
196 "show-region-fades",
197 _("Region fades visible"),
198 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
199 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
202 /* Media */
204 add_option (_("Media"), new OptionEditorHeading (_("Audio file format")));
206 ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
207 "native-file-data-format",
208 _("Sample format"),
209 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
210 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
213 sf->add (FormatFloat, _("32-bit floating point"));
214 sf->add (FormatInt24, _("24-bit integer"));
215 sf->add (FormatInt16, _("16-bit integer"));
217 add_option (_("Media"), sf);
219 ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
220 "native-file-header-format",
221 _("File type"),
222 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
223 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
226 hf->add (BWF, _("Broadcast WAVE"));
227 hf->add (WAVE, _("WAVE"));
228 hf->add (WAVE64, _("WAVE-64"));
229 hf->add (CAF, _("CAF"));
231 add_option (_("Media"), hf);
233 add_option (_("Media"), new OptionEditorHeading (_("File locations")));
235 SearchPathOption* spo = new SearchPathOption ("audio-search-path", _("Search for audio files in:"),
236 sigc::mem_fun (*_session_config, &SessionConfiguration::get_audio_search_path),
237 sigc::mem_fun (*_session_config, &SessionConfiguration::set_audio_search_path));
238 add_option (_("Media"), spo);
240 spo = new SearchPathOption ("midi-search-path", _("Search for MIDI files in:"),
241 sigc::mem_fun (*_session_config, &SessionConfiguration::get_midi_search_path),
242 sigc::mem_fun (*_session_config, &SessionConfiguration::set_midi_search_path));
244 add_option (_("Media"), spo);
246 /* Misc */
248 add_option (_("Misc"), new OptionEditorHeading (_("Layering (in overlaid mode)")));
250 ComboOption<LayerModel>* lm = new ComboOption<LayerModel> (
251 "layer-model",
252 _("Layering model"),
253 sigc::mem_fun (*_session_config, &SessionConfiguration::get_layer_model),
254 sigc::mem_fun (*_session_config, &SessionConfiguration::set_layer_model)
257 lm->add (LaterHigher, _("later is higher"));
258 lm->add (MoveAddHigher, _("most recently moved or added is higher"));
259 lm->add (AddHigher, _("most recently added is higher"));
261 add_option (_("Misc"), lm);
263 add_option (_("Misc"), new OptionEditorHeading (_("MIDI Note Overlaps")));
265 ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
266 "insert-merge-policy",
267 _("Policy for handling same note\nand channel overlaps"),
268 sigc::mem_fun (*_session_config, &SessionConfiguration::get_insert_merge_policy),
269 sigc::mem_fun (*_session_config, &SessionConfiguration::set_insert_merge_policy)
272 li->add (InsertMergeReject, _("never allow them"));
273 li->add (InsertMergeRelax, _("don't do anything in particular"));
274 li->add (InsertMergeReplace, _("replace any overlapped existing note"));
275 li->add (InsertMergeTruncateExisting, _("shorten the overlapped existing note"));
276 li->add (InsertMergeTruncateAddition, _("shorten the overlapping new note"));
277 li->add (InsertMergeExtend, _("replace both overlapping notes with a single note"));
279 add_option (_("Misc"), li);
281 add_option (_("Misc"), new OptionEditorHeading (_("Broadcast WAVE metadata")));
283 add_option (_("Misc"), new EntryOption (
284 "bwf-country-code",
285 _("Country code"),
286 sigc::mem_fun (*_session_config, &SessionConfiguration::get_bwf_country_code),
287 sigc::mem_fun (*_session_config, &SessionConfiguration::set_bwf_country_code)
290 add_option (_("Misc"), new EntryOption (
291 "bwf-organization-code",
292 _("Organization code"),
293 sigc::mem_fun (*_session_config, &SessionConfiguration::get_bwf_organization_code),
294 sigc::mem_fun (*_session_config, &SessionConfiguration::set_bwf_organization_code)
298 void
299 SessionOptionEditor::populate_sync_options ()
301 vector<SyncSource> sync_opts = _session->get_available_sync_options ();
303 _sync_source->clear ();
305 for (vector<SyncSource>::iterator i = sync_opts.begin(); i != sync_opts.end(); ++i) {
306 _sync_source->add (*i, sync_source_to_string (*i));
310 void
311 SessionOptionEditor::parameter_changed (std::string const & p)
313 OptionEditor::parameter_changed (p);
315 if (p == "external-sync") {
316 _sync_source->set_sensitive (!_session->config.get_external_sync ());