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"
31 using namespace ARDOUR;
33 SessionOptionEditor::SessionOptionEditor (Session* s)
34 : OptionEditor (&(s->config), _("Session Properties"))
35 , _session_config (&(s->config))
37 set_name ("SessionProperties");
41 ComboOption<uint32_t>* spf = new ComboOption<uint32_t> (
42 "subframes-per-frame",
43 _("Subframes per frame"),
44 sigc::mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame),
45 sigc::mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame)
48 spf->add (80, _("80"));
49 spf->add (100, _("100"));
51 add_option (_("Sync"), spf);
53 ComboOption<SyncSource>* ssrc = new ComboOption<SyncSource> (
55 _("External sync source"),
56 sigc::mem_fun (*_session_config, &SessionConfiguration::get_sync_source),
57 sigc::mem_fun (*_session_config, &SessionConfiguration::set_sync_source)
60 s->config.ParameterChanged.connect (_session_connections, invalidator (*this), ui_bind (&SessionOptionEditor::follow_sync_state, this, _1, s, ssrc), gui_context());
62 populate_sync_options (s, ssrc);
63 follow_sync_state (string ("external-sync"), s, ssrc);
65 add_option (_("Sync"), ssrc);
67 ComboOption<TimecodeFormat>* smf = new ComboOption<TimecodeFormat> (
69 _("Timecode frames-per-second"),
70 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_format),
71 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_format)
74 smf->add (timecode_23976, _("23.976"));
75 smf->add (timecode_24, _("24"));
76 smf->add (timecode_24976, _("24.976"));
77 smf->add (timecode_25, _("25"));
78 smf->add (timecode_2997, _("29.97"));
79 smf->add (timecode_2997drop, _("29.97 drop"));
80 smf->add (timecode_30, _("30"));
81 smf->add (timecode_30drop, _("30 drop"));
82 smf->add (timecode_5994, _("59.94"));
83 smf->add (timecode_60, _("60"));
85 add_option (_("Sync"), smf);
87 add_option (_("Sync"), new BoolOption (
88 "timecode-source-is-synced",
89 _("Timecode source shares sample clock with audio interface"),
90 sigc::mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
91 sigc::mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
94 ComboOption<float>* vpu = new ComboOption<float> (
96 _("Pull-up / pull-down"),
97 sigc::mem_fun (*_session_config, &SessionConfiguration::get_video_pullup),
98 sigc::mem_fun (*_session_config, &SessionConfiguration::set_video_pullup)
101 vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%"));
102 vpu->add (4.1667, _("4.1667"));
103 vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%"));
104 vpu->add (0.1, _("0.1"));
105 vpu->add (0, _("none"));
106 vpu->add (-0.1, _("-0.1"));
107 vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%"));
108 vpu->add (-4.1667, _("-4.1667"));
109 vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%"));
111 add_option (_("Sync"), vpu);
115 ComboOption<CrossfadeModel>* cfm = new ComboOption<CrossfadeModel> (
117 _("Crossfades are created"),
118 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfade_model),
119 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfade_model)
122 cfm->add (FullCrossfade, _("to span entire overlap"));
123 cfm->add (ShortCrossfade, _("short"));
125 add_option (_("Fades"), cfm);
127 add_option (_("Fades"), new SpinOption<float> (
128 _("short-xfade-seconds"),
129 _("Short crossfade length"),
130 sigc::mem_fun (*_session_config, &SessionConfiguration::get_short_xfade_seconds),
131 sigc::mem_fun (*_session_config, &SessionConfiguration::set_short_xfade_seconds),
136 add_option (_("Fades"), new SpinOption<float> (
137 _("destructive-xfade-seconds"),
138 _("Destructive crossfade length"),
139 sigc::mem_fun (*_session_config, &SessionConfiguration::get_destructive_xfade_msecs),
140 sigc::mem_fun (*_session_config, &SessionConfiguration::set_destructive_xfade_msecs),
145 add_option (_("Fades"), new BoolOption (
147 _("Create crossfades automatically"),
148 sigc::mem_fun (*_session_config, &SessionConfiguration::get_auto_xfade),
149 sigc::mem_fun (*_session_config, &SessionConfiguration::set_auto_xfade)
152 add_option (_("Fades"), new BoolOption (
154 _("Crossfades active"),
155 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfades_active),
156 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfades_active)
159 add_option (_("Fades"), new BoolOption (
161 _("Crossfades visible"),
162 sigc::mem_fun (*_session_config, &SessionConfiguration::get_xfades_visible),
163 sigc::mem_fun (*_session_config, &SessionConfiguration::set_xfades_visible)
166 add_option (_("Fades"), new BoolOption (
168 _("Region fades active"),
169 sigc::mem_fun (*_session_config, &SessionConfiguration::get_use_region_fades),
170 sigc::mem_fun (*_session_config, &SessionConfiguration::set_use_region_fades)
173 add_option (_("Fades"), new BoolOption (
175 _("Region fades visible"),
176 sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_region_fades),
177 sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades)
182 add_option (_("Misc"), new OptionEditorHeading (_("Audio file format")));
184 ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
185 "native-file-data-format",
187 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
188 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
191 sf->add (FormatFloat, _("32-bit floating point"));
192 sf->add (FormatInt24, _("24-bit integer"));
193 sf->add (FormatInt16, _("16-bit integer"));
195 add_option (_("Misc"), sf);
197 ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
198 "native-file-header-format",
200 sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_header_format),
201 sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_header_format)
204 hf->add (BWF, _("Broadcast WAVE"));
205 hf->add (WAVE, _("WAVE"));
206 hf->add (WAVE64, _("WAVE-64"));
207 hf->add (CAF, _("CAF"));
209 add_option (_("Misc"), hf);
211 add_option (_("Misc"), new OptionEditorHeading (_("Layering")));
213 ComboOption<LayerModel>* lm = new ComboOption<LayerModel> (
215 _("Layering model in overlaid mode"),
216 sigc::mem_fun (*_session_config, &SessionConfiguration::get_layer_model),
217 sigc::mem_fun (*_session_config, &SessionConfiguration::set_layer_model)
220 lm->add (LaterHigher, _("later is higher"));
221 lm->add (MoveAddHigher, _("most recently moved or added is higher"));
222 lm->add (AddHigher, _("most recently added is higher"));
224 add_option (_("Misc"), lm);
226 add_option (_("Misc"), new OptionEditorHeading (_("MIDI Note Overlaps")));
228 ComboOption<InsertMergePolicy>* li = new ComboOption<InsertMergePolicy> (
229 "insert-merge-policy",
230 _("Policy for handling same note and channel overlaps"),
231 sigc::mem_fun (*_session_config, &SessionConfiguration::get_insert_merge_policy),
232 sigc::mem_fun (*_session_config, &SessionConfiguration::set_insert_merge_policy)
235 li->add (InsertMergeReject, _("never allow them"));
236 li->add (InsertMergeRelax, _("don't do anything in particular"));
237 li->add (InsertMergeReplace, _("replace any overlapped existing note"));
238 li->add (InsertMergeTruncateExisting, _("shorten the overlapped existing note"));
239 li->add (InsertMergeTruncateAddition, _("shorten the overlapping new note"));
240 li->add (InsertMergeExtend, _("replace both overlapping notes with a single note"));
242 add_option (_("Misc"), li);
244 add_option (_("Misc"), new OptionEditorHeading (_("Broadcast WAVE metadata")));
246 add_option (_("Misc"), new EntryOption (
249 sigc::mem_fun (*_session_config, &SessionConfiguration::get_bwf_country_code),
250 sigc::mem_fun (*_session_config, &SessionConfiguration::set_bwf_country_code)
253 add_option (_("Misc"), new EntryOption (
254 "bwf-organization-code",
255 _("Organization code"),
256 sigc::mem_fun (*_session_config, &SessionConfiguration::get_bwf_organization_code),
257 sigc::mem_fun (*_session_config, &SessionConfiguration::set_bwf_organization_code)
262 SessionOptionEditor::populate_sync_options (Session* s, Option* opt)
264 ComboOption<SyncSource>* sync_opt = dynamic_cast<ComboOption<SyncSource>* > (opt);
266 vector<SyncSource> sync_opts = s->get_available_sync_options ();
270 for (vector<SyncSource>::iterator i = sync_opts.begin(); i != sync_opts.end(); ++i) {
271 sync_opt->add (*i, sync_source_to_string (*i));
276 SessionOptionEditor::follow_sync_state (std::string p, Session* s, Option* opt)
278 ComboOption<SyncSource>* sync_opt = dynamic_cast<ComboOption<SyncSource>* > (opt);
279 if (p == "external-sync") {
280 if (s->config.get_external_sync()) {
281 sync_opt->set_sensitive (false);
283 sync_opt->set_sensitive (true);