removed the following environment variables:
[ardour.git] / libs / ardour / configuration.cc
1 /*
2     Copyright (C) 1999 Paul Davis 
3
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.
8
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.
13
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.
17
18     $Id$
19 */
20
21 #include <unistd.h>
22 #include <cstdio> /* for snprintf, grrr */
23
24 #ifdef HAVE_WORDEXP
25 #include <wordexp.h>
26 #endif
27
28 #include <pbd/failed_constructor.h>
29 #include <pbd/xml++.h>
30
31 #include <ardour/ardour.h>
32 #include <ardour/configuration.h>
33 #include <ardour/diskstream.h>
34
35 #include "i18n.h"
36
37 using namespace ARDOUR;
38 using namespace std;
39
40 /* this is global so that we do not have to indirect through an object pointer
41    to reference it.
42 */
43
44 namespace ARDOUR {
45     float speed_quietning = 0.251189; // -12dB reduction for ffwd or rewind
46 }
47
48 Configuration::Configuration ()
49 {
50         key_node = 0;
51         user_configuration = false;
52         set_defaults ();
53 }
54
55 Configuration::~Configuration ()
56 {
57 }
58         
59 string
60 Configuration::get_user_path()
61 {
62         return find_config_file ("ardour.rc");
63 }
64
65 string
66 Configuration::get_system_path()
67 {
68         return find_config_file ("ardour_system.rc");
69 }
70
71 int
72 Configuration::load_state ()
73 {
74         string rcfile;
75         
76         /* load system configuration first */
77
78         rcfile = get_system_path ();
79
80         if (rcfile.length()) {
81
82                 XMLTree tree;
83                 
84                 if (!tree.read (rcfile.c_str())) {
85                         error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg;
86                         return -1;
87                 }
88
89                 if (set_state (*tree.root())) {
90                         error << string_compose(_("Ardour: system configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
91                         return -1;
92                 }
93         }
94
95         /* from this point on, all configuration changes are user driven */
96
97         user_configuration = true;
98
99         /* now load configuration file for user */
100         
101         rcfile = get_user_path ();
102
103         if (rcfile.length()) {
104
105                 XMLTree tree;
106                 
107                 if (!tree.read (rcfile)) {
108                         error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg;
109                         return -1;
110                 }
111                 
112                 
113                 if (set_state (*tree.root())) {
114                         error << string_compose(_("Ardour: configuration file \"%1\" not loaded successfully."), rcfile) << endmsg;
115                         return -1;
116                 }
117         }
118
119         return 0;
120 }
121
122 int
123 Configuration::save_state()
124 {
125         XMLTree tree;
126         string rcfile;
127
128         /* Note: this only writes the per-user file, and therefore
129            only saves variables marked as user-set or modified
130         */
131
132         rcfile = find_config_file("ardour.rc");
133
134         if (rcfile.length()) {
135                 tree.set_root (&state (true));
136                 if (!tree.write (rcfile.c_str())){
137                         error << _("Config file not saved") << endmsg;
138                         return -1;
139                 }
140         }
141
142         return 0;
143 }
144
145 XMLNode&
146 Configuration::get_state ()
147 {
148         return state (false);
149 }
150
151 XMLNode&
152 Configuration::state (bool user_only)
153 {
154         XMLNode* root = new XMLNode("Ardour");
155         LocaleGuard lg (X_("POSIX"));
156
157         typedef map<string, MidiPortDescriptor*>::const_iterator CI;
158         for(CI m = midi_ports.begin(); m != midi_ports.end(); ++m){
159                 root->add_child_nocopy(m->second->get_state());
160         }
161
162         XMLNode* node = new XMLNode("Config");
163         char buf[32];
164         
165         if (!user_only || minimum_disk_io_bytes_is_user) {
166                 snprintf(buf, sizeof(buf), "%" PRIu32 , minimum_disk_io_bytes);
167                 node->add_child_nocopy(option_node("minimum-disk-io-bytes", string(buf)));
168         }
169         if (!user_only || track_buffer_seconds_is_user) {
170                 snprintf(buf, sizeof(buf), "%f", track_buffer_seconds);
171                 node->add_child_nocopy(option_node("track-buffer-seconds", string(buf)));
172         }
173         if (!user_only || disk_choice_space_threshold_is_user) {
174                 snprintf(buf, sizeof(buf), "%" PRIu32, disk_choice_space_threshold);
175                 node->add_child_nocopy(option_node("disk-choice-space-threshold", string(buf)));
176         }
177
178         if (!user_only || midi_feedback_interval_ms_is_user) {
179                 snprintf(buf, sizeof(buf), "%" PRIu32, midi_feedback_interval_ms);
180                 node->add_child_nocopy(option_node("midi-feedback-interval-ms", string(buf)));
181         }
182
183         if (!user_only || mute_affects_pre_fader_is_user) {
184                 node->add_child_nocopy(option_node("mute-affects-pre-fader", mute_affects_pre_fader?"yes":"no"));
185         }
186         if (!user_only || mute_affects_post_fader_is_user) {
187                 node->add_child_nocopy(option_node("mute-affects-post-fader", mute_affects_post_fader?"yes":"no"));
188         }
189         if (!user_only || mute_affects_control_outs_is_user) {
190                 node->add_child_nocopy(option_node("mute-affects-control-outs", mute_affects_control_outs?"yes":"no"));
191         }
192         if (!user_only || mute_affects_main_outs_is_user) {
193                 node->add_child_nocopy(option_node("mute-affects-main-outs", mute_affects_main_outs?"yes":"no"));
194         }
195         if (!user_only || solo_latch_is_user) {
196                 node->add_child_nocopy(option_node("solo-latch", solo_latch?"yes":"no"));
197         }
198         if (!user_only || raid_path_is_user) {
199                 node->add_child_nocopy(option_node("raid-path", orig_raid_path));
200         }
201         if (!user_only || mtc_port_name_is_user) {
202                 node->add_child_nocopy(option_node("mtc-port", mtc_port_name));
203         }
204         if (!user_only || mmc_port_name_is_user) {
205                 node->add_child_nocopy(option_node("mmc-port", mmc_port_name));
206         }
207         if (!user_only || midi_port_name_is_user) {
208                 node->add_child_nocopy(option_node("midi-port", midi_port_name));
209         }
210         if (!user_only || use_hardware_monitoring_is_user) {
211                 node->add_child_nocopy(option_node("hardware-monitoring", use_hardware_monitoring?"yes":"no"));
212         }
213         if (!user_only || be_jack_time_master_is_user) {
214                 node->add_child_nocopy(option_node("jack-time-master", be_jack_time_master?"yes":"no"));
215         }
216         if (!user_only || native_format_is_bwf_is_user) {
217                 node->add_child_nocopy(option_node("native-format-bwf", native_format_is_bwf?"yes":"no"));
218         }
219         if (!user_only || trace_midi_input_is_user) {
220                 node->add_child_nocopy(option_node("trace-midi-input", trace_midi_input?"yes":"no"));
221         }
222         if (!user_only || trace_midi_output_is_user) {
223                 node->add_child_nocopy(option_node("trace-midi-output", trace_midi_output?"yes":"no"));
224         }
225         if (!user_only || plugins_stop_with_transport_is_user) {
226                 node->add_child_nocopy(option_node("plugins-stop-with-transport", plugins_stop_with_transport?"yes":"no"));
227         }
228         if (!user_only || use_sw_monitoring_is_user) {
229                 node->add_child_nocopy(option_node("use-sw-monitoring", use_sw_monitoring?"yes":"no"));
230         }
231         if (!user_only || stop_recording_on_xrun_is_user) {
232                 node->add_child_nocopy(option_node("stop-recording-on-xrun", stop_recording_on_xrun?"yes":"no"));
233         }
234         if (!user_only || verify_remove_last_capture_is_user) {
235                 node->add_child_nocopy(option_node("verify-remove-last-capture", verify_remove_last_capture?"yes":"no"));
236         }
237         if (!user_only || stop_at_session_end_is_user) {
238                 node->add_child_nocopy(option_node("stop-at-session-end", stop_at_session_end?"yes":"no"));
239         }
240         if (!user_only || seamless_looping_is_user) {
241                 node->add_child_nocopy(option_node("seamless-loop", seamless_looping?"yes":"no"));
242         }
243         if (!user_only || auto_xfade_is_user) {
244                 node->add_child_nocopy(option_node("auto-xfade", auto_xfade?"yes":"no"));
245         }
246         if (!user_only || no_new_session_dialog_is_user) {
247                 node->add_child_nocopy(option_node("no-new-session-dialog", no_new_session_dialog?"yes":"no"));
248         }
249         if (!user_only || timecode_source_is_synced_is_user) {
250                 node->add_child_nocopy(option_node("timecode-source-is-synced", timecode_source_is_synced?"yes":"no"));
251         }
252         if (!user_only || auditioner_output_left_is_user) {
253                 node->add_child_nocopy(option_node("auditioner-left-out", auditioner_output_left));
254         }
255         if (!user_only || auditioner_output_right_is_user) {
256                 node->add_child_nocopy(option_node("auditioner-right-out", auditioner_output_right));
257         }
258         if (!user_only || quieten_at_speed_is_user) {
259                 snprintf (buf, sizeof (buf), "%f", speed_quietning);
260                 node->add_child_nocopy(option_node("quieten-at-speed", buf));
261         }
262         if (!user_only || latched_record_enable_is_user) {
263                 node->add_child_nocopy(option_node("latched-record-enable", latched_record_enable?"yes":"no"));
264         }
265         if (!user_only || tape_dir_is_user) {
266                 if (!tape_dir.empty()) {
267                         node->add_child_nocopy(option_node("tape-dir", tape_dir));
268                 }
269         }
270
271         /* use-vst is always per-user */
272         node->add_child_nocopy (option_node ("use-vst", use_vst?"yes":"no"));
273
274         root->add_child_nocopy (*node);
275
276         if (key_node) {
277                 root->add_child_copy (*key_node);
278         }
279
280         if (_extra_xml) {
281                 root->add_child_copy (*_extra_xml);
282         }
283
284         return *root;
285 }
286
287 int
288 Configuration::set_state (const XMLNode& root)
289 {
290         if (root.name() != "Ardour") {
291                 return -1;
292         }
293
294         XMLNodeList nlist = root.children();
295         XMLNodeConstIterator niter;
296         XMLNode *node;
297         XMLProperty *prop;
298
299         for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
300
301                 node = *niter;
302
303                 if (node->name() == "MIDI-port") {
304
305                         try {
306                                 pair<string,MidiPortDescriptor*> newpair;
307                                 newpair.second = new MidiPortDescriptor (*node);
308                                 newpair.first = newpair.second->tag;
309                                 midi_ports.insert (newpair);
310                         }
311
312                         catch (failed_constructor& err) {
313                                 warning << _("ill-formed MIDI port specification in ardour rcfile (ignored)") << endmsg;
314                         }
315
316                 } else if (node->name() == "Config") {
317                         
318                         XMLNodeList option_list = node->children();
319                         XMLNodeConstIterator option_iter;
320                         XMLNode *option_node;
321
322                         string option_name;
323                         string option_value;
324
325                         for (option_iter = option_list.begin(); option_iter != option_list.end(); ++option_iter) {
326
327                                 option_node = *option_iter;
328
329                                 if (option_node->name() != "Option") {
330                                         continue;
331                                 }
332
333                                 if ((prop = option_node->property ("name")) != 0) {
334                                         option_name = prop->value();
335                                 } else {
336                                         throw failed_constructor ();
337                                 }
338                                 
339                                 if ((prop = option_node->property ("value")) != 0) {
340                                         option_value = prop->value();
341                                 } else {
342                                         throw failed_constructor ();
343                                 }
344                                 
345                                 if (option_name == "minimum-disk-io-bytes") {
346                                         set_minimum_disk_io (atoi (option_value.c_str()));
347                                 } else if (option_name == "track-buffer-seconds") {
348                                         set_track_buffer (atof (option_value.c_str()));
349                                 } else if (option_name == "raid-path") {
350                                         set_raid_path (option_value);
351                                 } else if (option_name == "hiding-groups-deactivates-groups") {
352                                         set_hiding_groups_deactivates_groups (option_value == "yes");
353                                 } else if (option_name == "mute-affects-pre-fader") {
354                                         set_mute_affects_pre_fader (option_value == "yes");
355                                 } else if (option_name == "mute-affects-post-fader") {
356                                         set_mute_affects_post_fader (option_value == "yes");
357                                 } else if (option_name == "mute-affects-control-outs") {
358                                         set_mute_affects_control_outs (option_value == "yes");
359                                 } else if (option_name == "mute-affects-main-outs") {
360                                         set_mute_affects_main_outs (option_value == "yes");
361                                 } else if (option_name == "solo-latch") {
362                                         set_solo_latch (option_value == "yes");
363                                 } else if (option_name == "mtc-port") {
364                                         set_mtc_port_name (option_value);
365                                 } else if (option_name == "mmc-port") {
366                                         set_mmc_port_name (option_value);
367                                 } else if (option_name == "midi-port") {
368                                         set_midi_port_name (option_value);
369                                 } else if (option_name == "hardware-monitoring") {
370                                         set_use_hardware_monitoring (option_value == "yes");
371                                 } else if (option_name == "jack-time-master") {
372                                         set_jack_time_master (option_value == "yes");
373                                 } else if (option_name == "trace-midi-input") {
374                                         set_trace_midi_input (option_value == "yes");
375                                 } else if (option_name == "trace-midi-output") {
376                                         set_trace_midi_output (option_value == "yes");
377                                 } else if (option_name == "plugins-stop-with-transport") {
378                                         set_plugins_stop_with_transport (option_value == "yes");
379                                 } else if (option_name == "use-sw-monitoring") {
380                                         set_use_sw_monitoring (option_value == "yes");
381                                 } else if (option_name == "no-sw-monitoring") {     /* DEPRECATED */
382                                         set_use_sw_monitoring (option_value != "yes");
383                                 } else if (option_name == "stop-recording-on-xrun") {
384                                         set_stop_recording_on_xrun (option_value == "yes");
385                                 } else if (option_name == "verify-remove-last-capture") {
386                                         set_verify_remove_last_capture (option_value == "yes");
387                                 } else if (option_name == "stop-at-session-end") {
388                                         set_stop_at_session_end (option_value == "yes");
389                                 } else if (option_name == "seamless-loop") {
390                                         set_seamless_looping (option_value == "yes");
391                                 } else if (option_name == "auto-xfade") {
392                                         set_auto_xfade (option_value == "yes");
393                                 } else if (option_name == "no-new-session-dialog") {
394                                         set_no_new_session_dialog (option_value == "yes");
395                                 } else if (option_name == "timecode-source-is-synced") {
396                                         set_timecode_source_is_synced (option_value == "yes");
397                                 } else if (option_name == "auditioner-left-out") {
398                                         set_auditioner_output_left (option_value);
399                                 } else if (option_name == "auditioner-right-out") {
400                                         set_auditioner_output_right (option_value);
401                                 } else if (option_name == "use-vst") {
402                                         set_use_vst (option_value == "yes");
403                                 } else if (option_name == "quieten-at-speed") {
404                                         float v;
405                                         if (sscanf (option_value.c_str(), "%f", &v) == 1) {
406                                                 set_quieten_at_speed (v);
407                                         }
408                                 } else if (option_name == "midi-feedback-interval-ms") {
409                                         set_midi_feedback_interval_ms (atoi (option_value.c_str()));
410                                 } else if (option_name == "latched-record-enable") {
411                                         set_latched_record_enable (option_value == "yes");
412                                 } else if (option_name == "tape-dir") {
413                                         set_tape_dir (option_value);
414                                 }
415                         }
416                         
417                 } else if (node->name() == "Keys") {
418                         /* defer handling of this for UI objects */
419                         key_node = new XMLNode (*node);
420                 } else if (node->name() == "extra") {
421                         _extra_xml = new XMLNode (*node);
422                 }
423         }
424
425         DiskStream::set_disk_io_chunk_frames (minimum_disk_io_bytes / sizeof (Sample));
426
427         return 0;
428 }
429
430 void
431 Configuration::set_defaults ()
432 {
433         raid_path = "";
434         orig_raid_path = raid_path;
435
436         mtc_port_name = N_("default");
437         mmc_port_name = N_("default");
438         midi_port_name = N_("default");
439 #ifdef __APPLE__
440         auditioner_output_left = N_("coreaudio:Built-in Audio:in1");
441         auditioner_output_right = N_("coreaudio:Built-in Audio:in2");
442 #else
443         auditioner_output_left = N_("alsa_pcm:playback_1");
444         auditioner_output_right = N_("alsa_pcm:playback_2");
445 #endif
446         minimum_disk_io_bytes = 1024 * 256;
447         track_buffer_seconds = 5.0;
448         hiding_groups_deactivates_groups = true;
449         mute_affects_pre_fader = 1;
450         mute_affects_post_fader = 1;
451         mute_affects_control_outs = 1;
452         mute_affects_main_outs = 1;
453         solo_latch = 1;
454         use_hardware_monitoring = true;
455         be_jack_time_master = true;
456         native_format_is_bwf = true;
457         trace_midi_input = false;
458         trace_midi_output = false;
459         plugins_stop_with_transport = false;
460         use_sw_monitoring = true;
461         stop_recording_on_xrun = false;
462         verify_remove_last_capture = true;
463         stop_at_session_end = true;
464         seamless_looping = true;
465         auto_xfade = true;
466         no_new_session_dialog = false;
467         timecode_source_is_synced = true;
468         use_vst = true; /* if we build with VST_SUPPORT, otherwise no effect */
469         quieten_at_speed = true;
470         tape_dir = "";
471
472         midi_feedback_interval_ms = 100;
473         
474         // this is about 5 minutes at 48kHz, 4 bytes/sample
475         disk_choice_space_threshold = 57600000;
476
477         /* at this point, no variables from from the user */
478
479         raid_path_is_user = false;
480         minimum_disk_io_bytes_is_user = false;
481         track_buffer_seconds_is_user = false;
482         hiding_groups_deactivates_groups_is_user = false;
483         auditioner_output_left_is_user = false;
484         auditioner_output_right_is_user = false;
485         mute_affects_pre_fader_is_user = false;
486         mute_affects_post_fader_is_user = false;
487         mute_affects_control_outs_is_user = false;
488         mute_affects_main_outs_is_user = false;
489         solo_latch_is_user = false;
490         disk_choice_space_threshold_is_user = false;
491         mtc_port_name_is_user = false;
492         mmc_port_name_is_user = false;
493         midi_port_name_is_user = false;
494         use_hardware_monitoring_is_user = false;
495         be_jack_time_master_is_user = false;
496         native_format_is_bwf_is_user = false;
497         trace_midi_input_is_user = false;
498         trace_midi_output_is_user = false;
499         plugins_stop_with_transport_is_user = false;
500         use_sw_monitoring_is_user = false;
501         stop_recording_on_xrun_is_user = false;
502         verify_remove_last_capture_is_user = false;
503         stop_at_session_end_is_user = false;
504         seamless_looping_is_user = false;
505         auto_xfade_is_user = false;
506         no_new_session_dialog_is_user = false;
507         timecode_source_is_synced_is_user = false;
508         quieten_at_speed_is_user = false;
509         midi_feedback_interval_ms_is_user = false;
510         latched_record_enable_is_user = false;
511         tape_dir_is_user = false;
512 }
513
514 Configuration::MidiPortDescriptor::MidiPortDescriptor (const XMLNode& node)
515 {
516         const XMLProperty *prop;
517         bool have_tag = false;
518         bool have_device = false;
519         bool have_type = false;
520         bool have_mode = false;
521
522         if ((prop = node.property ("tag")) != 0) {
523                 tag = prop->value();
524                 have_tag = true;
525         }
526
527         if ((prop = node.property ("device")) != 0) {
528                 device = prop->value();
529                 have_device = true;
530         }
531
532         if ((prop = node.property ("type")) != 0) {
533                 type = prop->value();
534                 have_type = true;
535         }
536
537         if ((prop = node.property ("mode")) != 0) {
538                 mode = prop->value();
539                 have_mode = true;
540         }
541
542         if (!have_tag || !have_device || !have_type || !have_mode) {
543                 throw failed_constructor();
544         }
545 }
546
547 XMLNode&
548 Configuration::MidiPortDescriptor::get_state()
549 {
550         XMLNode* root = new XMLNode("MIDI-port");
551
552         root->add_property("tag", tag);
553         root->add_property("device", device);
554         root->add_property("type", type);
555         root->add_property("mode", mode);
556
557         return *root;
558 }
559
560 XMLNode&
561 Configuration::option_node(const string & name, const string & value)
562 {
563         XMLNode* root = new XMLNode("Option");
564
565         root->add_property("name", name);
566         root->add_property("value", value);
567         
568         return *root;
569 }
570
571 string
572 Configuration::get_raid_path()
573 {
574         return raid_path;
575 }
576
577 void
578 Configuration::set_raid_path(string path)
579 {
580 #ifdef HAVE_WORDEXP
581         /* Handle tilde and environment variable expansion in session path */
582         wordexp_t expansion;
583         switch (wordexp (path.c_str(), &expansion, WRDE_NOCMD|WRDE_UNDEF)) {
584         case 0:
585                 break;
586         default:
587                 error << _("illegal or badly-formed string used for RAID path") << endmsg;
588                 return;
589         }
590
591         if (expansion.we_wordc > 1) {
592                 error << _("RAID search path is ambiguous") << endmsg;
593                 return;
594         }
595
596         raid_path = expansion.we_wordv[0];
597         orig_raid_path = path;
598         wordfree (&expansion);
599 #else
600         raid_path = orig_raid_path = path;
601 #endif
602
603         if (user_configuration) {
604                 raid_path_is_user = true;
605         }
606 }
607
608 uint32_t
609 Configuration::get_minimum_disk_io()
610 {
611         return minimum_disk_io_bytes;
612 }
613         
614 void
615 Configuration::set_minimum_disk_io(uint32_t min)
616 {
617         minimum_disk_io_bytes = min;
618         if (user_configuration) {
619                 minimum_disk_io_bytes_is_user = true;
620         }
621 }
622
623 float
624 Configuration::get_track_buffer()
625 {
626         return track_buffer_seconds;
627 }
628
629 void 
630 Configuration::set_track_buffer(float buffer)
631 {
632         track_buffer_seconds = buffer;
633         if (user_configuration) {
634                 track_buffer_seconds_is_user = true;
635         }
636 }
637
638 bool 
639 Configuration::does_hiding_groups_deactivates_groups()
640 {
641         return hiding_groups_deactivates_groups;
642 }
643
644 void 
645 Configuration::set_hiding_groups_deactivates_groups(bool hiding)
646 {
647         hiding_groups_deactivates_groups = hiding;
648         if (user_configuration) {
649                 hiding_groups_deactivates_groups_is_user = true;
650         }
651 }
652
653 string
654 Configuration::get_auditioner_output_left ()
655 {
656         return auditioner_output_left;
657 }
658
659 void
660 Configuration::set_auditioner_output_left (string str)
661 {
662         auditioner_output_left = str;
663         if (user_configuration) {
664                 auditioner_output_left_is_user = true;
665         }
666 }
667
668 string
669 Configuration::get_auditioner_output_right ()
670 {
671         return auditioner_output_right;
672 }
673
674 void
675 Configuration::set_auditioner_output_right (string str)
676 {
677         auditioner_output_right = str;
678         if (user_configuration) {
679                 auditioner_output_right_is_user = true;
680         }
681 }
682
683 bool
684 Configuration::get_mute_affects_pre_fader()
685 {
686         return mute_affects_pre_fader;
687 }
688
689 void 
690 Configuration::set_mute_affects_pre_fader (bool affects)
691 {
692         mute_affects_pre_fader = affects;
693         if (user_configuration) {
694                 mute_affects_pre_fader_is_user = true;
695         }
696 }
697
698 bool 
699 Configuration::get_mute_affects_post_fader()
700 {
701         return mute_affects_post_fader;
702 }
703
704 void 
705 Configuration::set_mute_affects_post_fader (bool affects)
706 {
707         mute_affects_post_fader = affects;
708         if (user_configuration) {
709                 mute_affects_post_fader_is_user = true;
710         }
711 }
712
713 bool 
714 Configuration::get_mute_affects_control_outs()
715 {
716         return mute_affects_control_outs;
717 }
718
719 void 
720 Configuration::set_mute_affects_control_outs (bool affects)
721 {
722         mute_affects_control_outs = affects;
723         if (user_configuration) {
724                 mute_affects_control_outs_is_user = true;
725         }
726 }
727
728 bool 
729 Configuration::get_mute_affects_main_outs()
730 {
731         return mute_affects_main_outs;
732 }
733
734 void 
735 Configuration::set_mute_affects_main_outs (bool affects)
736 {
737         mute_affects_main_outs = affects;
738         if (user_configuration) {
739                 mute_affects_main_outs_is_user = true;
740         }
741 }
742
743 bool 
744 Configuration::get_solo_latch()
745 {
746         return solo_latch;
747 }
748
749 void 
750 Configuration::set_solo_latch (bool latch)
751 {
752         solo_latch = latch;
753         if (user_configuration) {
754                 solo_latch_is_user = true;
755         }
756 }
757
758 XMLNode *
759 Configuration::get_keys () const
760 {
761         return key_node;
762 }
763
764 void
765 Configuration::set_keys (XMLNode* keys)
766 {
767         key_node = keys;
768 }
769
770 uint32_t
771 Configuration::get_disk_choice_space_threshold ()
772 {
773         return disk_choice_space_threshold;
774 }
775
776 void
777 Configuration::set_disk_choice_space_threshold (uint32_t val)
778 {
779         disk_choice_space_threshold = val;
780         if (user_configuration) {
781                 disk_choice_space_threshold_is_user = true;
782         }
783 }
784
785 string
786 Configuration::get_mmc_port_name ()
787 {
788         return mmc_port_name;
789 }
790
791 void
792 Configuration::set_mmc_port_name (string name)
793 {
794         mmc_port_name = name;
795         if (user_configuration) {
796                 mmc_port_name_is_user = true;
797         }
798 }
799
800 string
801 Configuration::get_mtc_port_name ()
802 {
803         return mtc_port_name;
804 }
805
806 void
807 Configuration::set_mtc_port_name (string name)
808 {
809         mtc_port_name = name;
810         if (user_configuration) {
811                 mtc_port_name_is_user = true;
812         }
813 }
814
815 string
816 Configuration::get_midi_port_name ()
817 {
818         return midi_port_name;
819 }
820
821 void
822 Configuration::set_midi_port_name (string name)
823 {
824         midi_port_name = name;
825         if (user_configuration) {
826                 midi_port_name_is_user = true;
827         }
828 }
829
830 uint32_t
831 Configuration::get_midi_feedback_interval_ms ()
832 {
833         return midi_feedback_interval_ms;
834 }
835
836 void
837 Configuration::set_midi_feedback_interval_ms (uint32_t val)
838 {
839         midi_feedback_interval_ms = val;
840         if (user_configuration) {
841                 midi_feedback_interval_ms_is_user = true;
842         }
843 }
844
845 bool
846 Configuration::get_use_hardware_monitoring()
847 {
848         return use_hardware_monitoring;
849 }
850
851 void
852 Configuration::set_use_hardware_monitoring(bool yn)
853 {
854         use_hardware_monitoring = yn;
855         if (user_configuration) {
856                 use_hardware_monitoring_is_user = true;
857         }
858 }
859
860 bool
861 Configuration::get_jack_time_master()
862 {
863         return be_jack_time_master;
864 }
865
866 void
867 Configuration::set_jack_time_master(bool yn)
868 {
869         be_jack_time_master = yn;
870         if (user_configuration) {
871                 be_jack_time_master_is_user = true;
872         }
873 }
874
875 bool
876 Configuration::get_native_format_is_bwf()
877 {
878         return native_format_is_bwf;
879 }
880
881 void
882 Configuration::set_native_format_is_bwf(bool yn)
883 {
884         native_format_is_bwf = yn;
885         if (user_configuration) {
886                 native_format_is_bwf_is_user = true;
887         }
888 }
889
890 bool
891 Configuration::get_trace_midi_input ()
892 {
893         return trace_midi_input;
894 }
895
896 void
897 Configuration::set_trace_midi_input (bool yn)
898 {
899         trace_midi_input = yn;
900         if (user_configuration) {
901                 trace_midi_input_is_user = true;
902         }
903 }
904
905 bool
906 Configuration::get_trace_midi_output ()
907 {
908         return trace_midi_output;
909 }
910
911 void
912 Configuration::set_trace_midi_output (bool yn)
913 {
914         trace_midi_output = yn;
915         if (user_configuration) {
916                 trace_midi_output_is_user = true;
917         }
918 }
919
920 bool
921 Configuration::get_plugins_stop_with_transport ()
922 {
923         return plugins_stop_with_transport;
924 }
925
926 void
927 Configuration::set_plugins_stop_with_transport (bool yn)
928 {
929         plugins_stop_with_transport = yn;
930         if (user_configuration) {
931                 plugins_stop_with_transport_is_user = true;
932         }
933 }
934
935 bool
936 Configuration::get_use_sw_monitoring ()
937 {
938         return use_sw_monitoring;
939 }
940
941 void
942 Configuration::set_use_sw_monitoring (bool yn)
943 {
944         use_sw_monitoring = yn;
945         if (user_configuration) {
946                 use_sw_monitoring_is_user = true;
947         }
948 }
949
950 bool
951 Configuration::get_stop_recording_on_xrun ()
952 {
953         return stop_recording_on_xrun;
954 }
955
956 void
957 Configuration::set_stop_recording_on_xrun (bool yn)
958 {
959         stop_recording_on_xrun = yn;
960         if (user_configuration) {
961                 stop_recording_on_xrun_is_user = true;
962         }
963 }
964
965 bool
966 Configuration::get_verify_remove_last_capture ()
967 {
968         return verify_remove_last_capture;
969 }
970
971 void
972 Configuration::set_verify_remove_last_capture (bool yn)
973 {
974         verify_remove_last_capture = yn;
975         if (user_configuration) {
976                 verify_remove_last_capture_is_user = true;
977         }
978 }
979
980 bool
981 Configuration::get_stop_at_session_end ()
982 {
983         return stop_at_session_end;
984 }
985
986 void
987 Configuration::set_stop_at_session_end (bool yn)
988 {
989         stop_at_session_end = yn;
990         if (user_configuration) {
991                 stop_at_session_end_is_user = true;
992         }
993 }
994
995 bool
996 Configuration::get_seamless_looping ()
997 {
998         return seamless_looping;
999 }
1000
1001 void
1002 Configuration::set_seamless_looping (bool yn)
1003 {
1004         seamless_looping = yn;
1005         if (user_configuration) {
1006                 seamless_looping_is_user = true;
1007         }
1008 }
1009
1010 bool
1011 Configuration::get_auto_xfade ()
1012 {
1013         return auto_xfade;
1014 }
1015
1016 void
1017 Configuration::set_auto_xfade (bool yn)
1018 {
1019         auto_xfade = yn;
1020         if (user_configuration) {
1021                 auto_xfade_is_user = true;
1022         }
1023 }
1024
1025 bool 
1026 Configuration::get_no_new_session_dialog()
1027 {
1028         return no_new_session_dialog;
1029 }
1030
1031 void 
1032 Configuration::set_no_new_session_dialog(bool yn)
1033 {
1034         no_new_session_dialog = yn;
1035         if (user_configuration) {
1036                 no_new_session_dialog_is_user = true;
1037         }
1038 }
1039
1040 bool
1041 Configuration::get_timecode_source_is_synced()
1042 {
1043         return timecode_source_is_synced;
1044 }
1045
1046 void
1047 Configuration::set_timecode_source_is_synced (bool yn)
1048 {
1049         timecode_source_is_synced = yn;
1050         if (user_configuration) {
1051                 timecode_source_is_synced_is_user = true;
1052         }
1053 }
1054
1055 bool
1056 Configuration::get_use_vst ()
1057 {
1058         return use_vst;
1059 }
1060
1061 void
1062 Configuration::set_use_vst (bool yn)
1063 {
1064         use_vst = yn;
1065 }
1066
1067 gain_t
1068 Configuration::get_quieten_at_speed()
1069 {
1070         return speed_quietning;
1071 }
1072
1073 void
1074 Configuration::set_quieten_at_speed (float gain_coefficient)
1075 {
1076         speed_quietning = gain_coefficient;
1077         if (user_configuration) {
1078                 quieten_at_speed_is_user = true;
1079         }
1080 }
1081
1082 void
1083 Configuration::set_latched_record_enable (bool yn)
1084 {
1085         latched_record_enable = yn;
1086         if (user_configuration) {
1087                 latched_record_enable_is_user = true;
1088         }
1089 }
1090
1091 bool
1092 Configuration::get_latched_record_enable ()
1093 {
1094         return latched_record_enable;
1095 }
1096
1097 string
1098 Configuration::get_tape_dir () 
1099 {
1100         return tape_dir;
1101 }
1102
1103 void
1104 Configuration::set_tape_dir (string path)
1105 {
1106         tape_dir = path;
1107 }