Use XMLNode::get/set_property API in ARDOUR::SoloControl class
[ardour.git] / libs / ardour / readonly_control.cc
1 /*
2  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
3  * Copyright (C) 2000, 2007 Paul Davis
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #include "pbd/destructible.h"
21
22 #include "ardour/plugin.h"
23 #include "ardour/readonly_control.h"
24
25 using namespace ARDOUR;
26
27 ReadOnlyControl::ReadOnlyControl (boost::shared_ptr<Plugin> p, uint32_t pnum)
28                 : _plugin (boost::weak_ptr<Plugin> (p))
29                 , _parameter_num (pnum)
30 { }
31
32 double
33 ReadOnlyControl::get_parameter () const
34 {
35         boost::shared_ptr<Plugin> p = _plugin.lock();
36         if (p) {
37                 return p->get_parameter (_parameter_num);
38         }
39         return 0;
40 }
41
42 std::string
43 ReadOnlyControl::describe_parameter ()
44 {
45         boost::shared_ptr<Plugin> p = _plugin.lock();
46         if (p) {
47                 return p->describe_parameter (Evoral::Parameter (ARDOUR::PluginAutomation, 0, _parameter_num));
48         }
49         return "";
50 }