libardour added.
[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_use_vst (bool yn);
68         bool get_use_vst();
69
70         bool get_trace_midi_input ();
71         void set_trace_midi_input (bool);
72
73         bool get_trace_midi_output ();
74         void set_trace_midi_output (bool);
75
76         string get_raid_path();
77         void set_raid_path(string);
78
79         uint32_t get_minimum_disk_io(); 
80         void set_minimum_disk_io(uint32_t);
81
82         float get_track_buffer();
83         void set_track_buffer(float);
84
85         bool does_hiding_groups_deactivates_groups();
86         void set_hiding_groups_deactivates_groups(bool);
87
88         string get_auditioner_output_left();
89         void set_auditioner_output_left(string);
90
91         string get_auditioner_output_right();
92         void set_auditioner_output_right(string);
93
94         bool get_mute_affects_pre_fader();
95         void set_mute_affects_pre_fader (bool);
96
97         bool get_mute_affects_post_fader();
98         void set_mute_affects_post_fader (bool);
99
100         bool get_mute_affects_control_outs ();
101         void set_mute_affects_control_outs (bool);
102
103         bool get_mute_affects_main_outs ();
104         void set_mute_affects_main_outs (bool);
105
106         bool get_solo_latch ();
107         void set_solo_latch (bool);
108
109         uint32_t get_disk_choice_space_threshold();
110         void set_disk_choice_space_threshold (uint32_t);
111
112         string get_mmc_port_name();
113         void   set_mmc_port_name(string);
114
115         string get_mtc_port_name();
116         void   set_mtc_port_name(string);
117
118         string get_midi_port_name();
119         void   set_midi_port_name(string);
120         
121         bool get_use_hardware_monitoring();
122         void set_use_hardware_monitoring(bool);
123
124         bool get_jack_time_master();
125         void set_jack_time_master(bool);
126
127         bool get_native_format_is_bwf();
128         void set_native_format_is_bwf(bool);
129
130         bool get_plugins_stop_with_transport();
131         void set_plugins_stop_with_transport(bool);
132
133         bool get_no_sw_monitoring();
134         void set_no_sw_monitoring(bool);
135
136         bool get_stop_recording_on_xrun();
137         void set_stop_recording_on_xrun(bool);
138
139         bool get_verify_remove_last_capture();
140         void set_verify_remove_last_capture(bool);
141         
142         bool get_stop_at_session_end();
143         void set_stop_at_session_end(bool);
144
145         bool get_seamless_looping();
146         void set_seamless_looping(bool);
147
148         bool get_auto_xfade();
149         void set_auto_xfade (bool);
150
151         bool get_no_new_session_dialog();
152         void set_no_new_session_dialog(bool);
153         
154         uint32_t get_timecode_skip_limit ();
155         void set_timecode_skip_limit (uint32_t);
156
157         bool get_timecode_source_is_synced ();
158         void set_timecode_source_is_synced (bool);
159
160         string get_user_ardour_path ();
161         string get_system_ardour_path ();
162
163         gain_t get_quieten_at_speed ();
164         void  set_quieten_at_speed (gain_t);
165         
166   private:
167         void   set_defaults ();
168         string get_system_path();
169         string get_user_path();
170
171         /* this is subject to wordexp, so we need
172            to keep the original (user-entered) form
173            around. e.g. ~/blah-> /home/foo/blah
174         */
175         
176         string raid_path;
177         bool   raid_path_is_user;
178         string orig_raid_path;
179
180         uint32_t minimum_disk_io_bytes;
181         bool          minimum_disk_io_bytes_is_user;
182         float         track_buffer_seconds;
183         bool          track_buffer_seconds_is_user;
184         bool          hiding_groups_deactivates_groups;
185         bool          hiding_groups_deactivates_groups_is_user;
186         string        auditioner_output_left;
187         bool          auditioner_output_left_is_user;
188         string        auditioner_output_right;
189         bool          auditioner_output_right_is_user;
190         bool          mute_affects_pre_fader;
191         bool          mute_affects_pre_fader_is_user;
192         bool          mute_affects_post_fader;
193         bool          mute_affects_post_fader_is_user;
194         bool          mute_affects_control_outs;
195         bool          mute_affects_control_outs_is_user;
196         bool          mute_affects_main_outs;
197         bool          mute_affects_main_outs_is_user;
198         bool          solo_latch;
199         bool          solo_latch_is_user;
200         uint32_t disk_choice_space_threshold;
201         bool          disk_choice_space_threshold_is_user;
202         string        mtc_port_name;
203         bool          mtc_port_name_is_user;
204         string        mmc_port_name;
205         bool          mmc_port_name_is_user;
206         string        midi_port_name;
207         bool          midi_port_name_is_user;
208         bool          use_hardware_monitoring;
209         bool          use_hardware_monitoring_is_user;
210         bool          be_jack_time_master;
211         bool          be_jack_time_master_is_user;
212         bool          native_format_is_bwf;
213         bool          native_format_is_bwf_is_user;
214         bool          trace_midi_input;
215         bool          trace_midi_input_is_user;
216         bool          trace_midi_output;
217         bool          trace_midi_output_is_user;
218         bool          plugins_stop_with_transport;
219         bool          plugins_stop_with_transport_is_user;
220         bool          no_sw_monitoring;
221         bool          no_sw_monitoring_is_user;
222         bool          stop_recording_on_xrun;
223         bool          stop_recording_on_xrun_is_user;
224         bool              verify_remove_last_capture;
225         bool              verify_remove_last_capture_is_user;
226         bool          stop_at_session_end;
227         bool          stop_at_session_end_is_user;
228         bool          seamless_looping;
229         bool          seamless_looping_is_user;
230         bool          auto_xfade;
231         bool          auto_xfade_is_user;
232         bool          no_new_session_dialog;
233         bool          no_new_session_dialog_is_user;
234         uint32_t      timecode_skip_limit;
235         bool          timecode_skip_limit_is_user;
236         bool          timecode_source_is_synced;
237         bool          timecode_source_is_synced_is_user;
238         bool          use_vst; /* always per-user */
239         bool          quieten_at_speed;
240         bool          quieten_at_speed_is_user;
241
242         XMLNode *key_node;
243         bool     user_configuration;
244
245         XMLNode& state (bool user_only);
246 };
247
248 extern Configuration *Config;
249 extern gain_t speed_quietning; /* see comment in configuration.cc */
250
251 }; /* namespace ARDOUR */
252
253 #endif /* __ardour_configuration_h__ */