mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
new class to wrap a pair of set/get methods as a Controllable
git-svn-id: svn://localhost/ardour2/branches/3.0@8824 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
7cf4419d62
commit
c1be28e7b0
1 changed files with 34 additions and 0 deletions
34
libs/ardour/ardour/proxy_controllable.h
Normal file
34
libs/ardour/ardour/proxy_controllable.h
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef __libardour_proxy_controllable_h__
|
||||||
|
#define __libardour_proxy_controllable_h__
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
|
#include "pbd/controllable.h"
|
||||||
|
|
||||||
|
namespace ARDOUR {
|
||||||
|
|
||||||
|
/** this class converts a pair of setter/getter functors into a Controllable
|
||||||
|
so that it can be used like a regular Controllable, bound to MIDI, OSC etc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ProxyControllable : public PBD::Controllable {
|
||||||
|
public:
|
||||||
|
ProxyControllable (const std::string& name, PBD::Controllable::Flag flags,
|
||||||
|
boost::function1<void,double> setter,
|
||||||
|
boost::function0<double> getter)
|
||||||
|
: PBD::Controllable (name, flags)
|
||||||
|
, _setter (setter)
|
||||||
|
, _getter (getter)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void set_value (double v) { _setter (v); }
|
||||||
|
double get_value () const { return _getter (); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::function1<void,double> _setter;
|
||||||
|
boost::function0<double> _getter;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif /* __libardour_proxy_controllable_h__ */
|
||||||
Loading…
Add table
Add a link
Reference in a new issue