2 Copyright (C) 2016 Paul Davis
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2 of the License, or (at your option)
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __libardour_control_group_h__
20 #define __libardour_control_group_h__
25 #include <boost/shared_ptr.hpp>
26 #include <boost/enable_shared_from_this.hpp>
28 #include <glibmm/threads.h>
30 #include "pbd/controllable.h"
32 #include "evoral/Parameter.hpp"
34 #include "ardour/automation_control.h"
35 #include "ardour/types.h"
39 class LIBARDOUR_API ControlGroup : public boost::enable_shared_from_this<ControlGroup>
42 ControlGroup (Evoral::Parameter p);
43 virtual ~ControlGroup ();
50 int add_control (boost::shared_ptr<AutomationControl>);
51 int remove_control (boost::shared_ptr<AutomationControl>);
53 ControlList controls () const;
57 void set_active (bool);
58 bool active() const { return _active; }
60 void set_mode (Mode m);
61 Mode mode () const { return _mode; }
63 Evoral::Parameter parameter() const { return _parameter; }
65 virtual void set_group_value (boost::shared_ptr<AutomationControl>, double val);
66 virtual void pre_realtime_queue_stuff (double val);
68 bool use_me (PBD::Controllable::GroupControlDisposition gcd) const {
70 case PBD::Controllable::ForGroup:
72 case PBD::Controllable::NoGroup:
74 case PBD::Controllable::InverseGroup:
82 typedef std::map<PBD::ID,boost::shared_ptr<AutomationControl> > ControlMap;
83 Evoral::Parameter _parameter;
84 mutable Glib::Threads::RWLock controls_lock;
88 PBD::ScopedConnectionList member_connections;
91 void control_going_away (boost::weak_ptr<AutomationControl>);
95 class LIBARDOUR_API GainControlGroup : public ControlGroup
100 void set_group_value (boost::shared_ptr<AutomationControl>, double val);
103 gain_t get_max_factor (gain_t);
104 gain_t get_min_factor (gain_t);
109 #endif /* __libardour_control_group_h__ */