c0a1301318802ee31dcb900ef6e603dc315d90b4
[ardour.git] / libs / ardour / ardour / configuration.h
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 #ifndef __ardour_configuration_h__
22 #define __ardour_configuration_h__
23
24 #include <map>
25
26 #include <sys/types.h>
27 #include <string>
28
29 #include <ardour/types.h>
30 #include <ardour/stateful.h>
31
32 using std::string;
33
34 class XMLNode;
35
36 namespace ARDOUR {
37
38 class Configuration : public Stateful
39 {
40   public:
41         Configuration();
42         virtual ~Configuration();
43
44         struct MidiPortDescriptor {
45             string tag;
46             string device;
47             string type;
48             string mode;
49
50             MidiPortDescriptor (const XMLNode&);
51             XMLNode& get_state();
52         };
53
54         std::map<string,MidiPortDescriptor *> midi_ports;
55
56         int load_state ();
57         int save_state ();
58
59         XMLNode& option_node (const string &, const string &);
60         
61         int set_state (const XMLNode&);
62         XMLNode& get_state (void);
63
64         XMLNode * get_keys() const;
65         void set_keys(XMLNode *);
66
67         void set_latched_record_enable (bool yn);
68         bool get_latched_record_enable();
69
70         void set_use_vst (bool yn);
71         bool get_use_vst();
72
73         bool get_trace_midi_input ();
74         void set_trace_midi_input (bool);
75
76         bool get_trace_midi_output ();
77         void set_trace_midi_output (bool);
78
79         string get_raid_path();
80         void set_raid_path(string);
81
82         uint32_t get_minimum_disk_io(); 
83         void set_minimum_disk_io(uint32_t);
84
85         float get_track_buffer();
86         void set_track_buffer(float);
87
88         bool does_hiding_groups_deactivates_groups();
89         void set_hiding_groups_deactivates_groups(bool);
90
91         string get_auditioner_output_left();
92         void set_auditioner_output_left(string);
93
94         string get_auditioner_output_right();
95         void set_auditioner_output_right(string);
96
97         bool get_mute_affects_pre_fader();
98         void set_mute_affects_pre_fader (bool);
99
100         bool get_mute_affects_post_fader();
101         void set_mute_affects_post_fader (bool);
102
103         bool get_mute_affects_control_outs ();
104         void set_mute_affects_control_outs (bool);
105
106         bool get_mute_affects_main_outs ();
107         void set_mute_affects_main_outs (bool);
108
109         bool get_solo_latch ();
110         void set_solo_latch (bool);
111
112         uint32_t get_disk_choice_space_threshold();
113         void set_disk_choice_space_threshold (uint32_t);
114
115         string get_mmc_port_name();
116         void   set_mmc_port_name(string);
117
118         string get_mtc_port_name();
119         void   set_mtc_port_name(string);
120
121         string get_midi_port_name();
122         void   set_midi_port_name(string);
123
124         uint32_t get_midi_feedback_interval_ms();
125         void set_midi_feedback_interval_ms (uint32_t);
126         
127         bool get_use_hardware_monitoring();
128         void set_use_hardware_monitoring(bool);
129
130         bool get_use_sw_monitoring();
131         void set_use_sw_monitoring(bool);
132
133         bool get_jack_time_master();
134         void set_jack_time_master(bool);
135
136         bool get_native_format_is_bwf();
137         void set_native_format_is_bwf(bool);
138
139         bool get_plugins_stop_with_transport();
140         void set_plugins_stop_with_transport(bool);
141
142         bool get_stop_recording_on_xrun();
143         void set_stop_recording_on_xrun(bool);
144
145         bool get_verify_remove_last_capture();
146         void set_verify_remove_last_capture(bool);
147         
148         bool get_stop_at_session_end();
149         void set_stop_at_session_end(bool);
150
151         bool get_seamless_looping();
152         void set_seamless_looping(bool);
153
154         bool get_auto_xfade();
155         void set_auto_xfade (bool);
156
157         bool get_no_new_session_dialog();
158         void set_no_new_session_dialog(bool);
159         
160         uint32_t get_timecode_skip_limit ();
161         void set_timecode_skip_limit (uint32_t);
162
163         bool get_timecode_source_is_synced ();
164         void set_timecode_source_is_synced (bool);
165
166         string get_user_ardour_path ();
167         string get_system_ardour_path ();
168
169         gain_t get_quieten_at_speed ();
170         void  set_quieten_at_speed (gain_t);
171         
172   private:
173         void   set_defaults ();
174         string get_system_path();
175         string get_user_path();
176
177         /* this is subject to wordexp, so we need
178            to keep the original (user-entered) form
179            around. e.g. ~/blah-> /home/foo/blah
180         */
181         
182         string raid_path;
183         bool   raid_path_is_user;
184         string orig_raid_path;
185
186         uint32_t minimum_disk_io_bytes;
187         bool          minimum_disk_io_bytes_is_user;
188         float         track_buffer_seconds;
189         bool          track_buffer_seconds_is_user;
190         bool          hiding_groups_deactivates_groups;
191         bool          hiding_groups_deactivates_groups_is_user;
192         string        auditioner_output_left;
193         bool          auditioner_output_left_is_user;
194         string        auditioner_output_right;
195         bool          auditioner_output_right_is_user;
196         bool          mute_affects_pre_fader;
197         bool          mute_affects_pre_fader_is_user;
198         bool          mute_affects_post_fader;
199         bool          mute_affects_post_fader_is_user;
200         bool          mute_affects_control_outs;
201         bool          mute_affects_control_outs_is_user;
202         bool          mute_affects_main_outs;
203         bool          mute_affects_main_outs_is_user;
204         bool          solo_latch;
205         bool          solo_latch_is_user;
206         uint32_t disk_choice_space_threshold;
207         bool          disk_choice_space_threshold_is_user;
208         string        mtc_port_name;
209         bool          mtc_port_name_is_user;
210         string        mmc_port_name;
211         bool          mmc_port_name_is_user;
212         string        midi_port_name;
213         bool          midi_port_name_is_user;
214         bool          use_hardware_monitoring;
215         bool          use_hardware_monitoring_is_user;
216         bool          be_jack_time_master;
217         bool          be_jack_time_master_is_user;
218         bool          native_format_is_bwf;
219         bool          native_format_is_bwf_is_user;
220         bool          trace_midi_input;
221         bool          trace_midi_input_is_user;
222         bool          trace_midi_output;
223         bool          trace_midi_output_is_user;
224         bool          plugins_stop_with_transport;
225         bool          plugins_stop_with_transport_is_user;
226         bool          use_sw_monitoring;
227         bool          use_sw_monitoring_is_user;
228         bool          stop_recording_on_xrun;
229         bool          stop_recording_on_xrun_is_user;
230         bool          verify_remove_last_capture;
231         bool          verify_remove_last_capture_is_user;
232         bool          stop_at_session_end;
233         bool          stop_at_session_end_is_user;
234         bool          seamless_looping;
235         bool          seamless_looping_is_user;
236         bool          auto_xfade;
237         bool          auto_xfade_is_user;
238         bool          no_new_session_dialog;
239         bool          no_new_session_dialog_is_user;
240         uint32_t      timecode_skip_limit;
241         bool          timecode_skip_limit_is_user;
242         bool          timecode_source_is_synced;
243         bool          timecode_source_is_synced_is_user;
244         bool          use_vst; /* always per-user */
245         bool          quieten_at_speed;
246         bool          quieten_at_speed_is_user;
247         uint32_t      midi_feedback_interval_ms;
248         bool          midi_feedback_interval_ms_is_user;
249         bool          latched_record_enable;
250         bool          latched_record_enable_is_user;
251
252         XMLNode *key_node;
253         bool     user_configuration;
254
255         XMLNode& state (bool user_only);
256 };
257
258 extern Configuration *Config;
259 extern gain_t speed_quietning; /* see comment in configuration.cc */
260
261 }; /* namespace ARDOUR */
262
263 #endif /* __ardour_configuration_h__ */