Ardour  9.0-pre0-582-g084a23a80d
rc_configuration.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2018 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
4  * Copyright (C) 2009-2014 David Robillard <d@drobilla.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
23 #include <map>
24 #include <string>
25 
26 #include "temporal/types.h"
27 
29 #include "ardour/types.h"
30 #include "ardour/utils.h"
31 #include "ardour/types_convert.h"
32 
33 #include "pbd/configuration.h"
34 
35 class XMLNode;
36 
37 namespace ARDOUR {
38 
40 {
41  public:
44 
45  void map_parameters (std::function<void (std::string)>&);
46  int set_state (XMLNode const &, int version);
47  XMLNode& get_state () const;
48  XMLNode& get_variables (std::string const & nodename) const;
49  void set_variables (XMLNode const &);
50 
51  int load_state ();
52  int save_state ();
53 
57  XMLNode * instant_xml (const std::string& str);
58 
59  XMLNode* control_protocol_state () { return _control_protocol_state; }
60  XMLNode* transport_master_state () { return _transport_master_state; }
61 
62  std::map<std::string,PBD::ConfigVariableBase*> _my_variables;
63 
64  /* define accessor methods */
65 
66 #undef CONFIG_VARIABLE
67 #undef CONFIG_VARIABLE_SPECIAL
68 #define CONFIG_VARIABLE(Type,var,name,value) \
69  Type get_##var () const { return var.get(); } \
70  bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
71 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) \
72  Type get_##var () const { return var.get(); } \
73  bool set_##var (Type val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
75 #undef CONFIG_VARIABLE
76 #undef CONFIG_VARIABLE_SPECIAL
77 
78  private:
79 
80  /* declare variables */
81 
82 #undef CONFIG_VARIABLE
83 #undef CONFIG_VARIABLE_SPECIAL
84 #define CONFIG_VARIABLE(Type,var,name,value) PBD::ConfigVariable<Type> var;
85 #define CONFIG_VARIABLE_SPECIAL(Type,var,name,value,mutator) PBD::ConfigVariableWithMutation<Type> var;
87 #undef CONFIG_VARIABLE
88 #undef CONFIG_VARIABLE_SPECIAL
89 
92 
93  void build_metadata ();
94 };
95 
96 /* XXX: rename this */
98 LIBARDOUR_API extern gain_t speed_quietning; /* see comment in configuration.cc */
99 
100 } // namespace ARDOUR
101 
void add_instant_xml(XMLNode &)
XMLNode * transport_master_state()
XMLNode * instant_xml(const std::string &str)
void set_variables(XMLNode const &)
XMLNode * control_protocol_state()
XMLNode & get_variables(std::string const &nodename) const
int set_state(XMLNode const &, int version)
XMLNode & get_state() const
void map_parameters(std::function< void(std::string)> &)
std::map< std::string, PBD::ConfigVariableBase * > _my_variables
Definition: xml++.h:114
#define LIBARDOUR_API
gain_t speed_quietning
RCConfiguration * Config