Ardour  8.12
ardour/ardour/control_group.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __libardour_control_group_h__
20 #define __libardour_control_group_h__
21 
22 #include <map>
23 #include <memory>
24 #include <vector>
25 
26 #include <glibmm/threads.h>
27 
28 #include "pbd/controllable.h"
29 
30 #include "evoral/Parameter.h"
31 
33 #include "ardour/types.h"
34 
35 namespace ARDOUR {
36 
37 class CoreSelection;
38 class RouteGroup;
39 class Stripable;
40 
41 class LIBARDOUR_API ControlGroup : public std::enable_shared_from_this<ControlGroup>
42 {
43  public:
45  virtual ~ControlGroup ();
46 
47  enum Mode {
48  Relative = 0x1,
49  Inverted = 0x2,
50  };
51 
53 
54  int add_control (std::shared_ptr<AutomationControl>, bool push = false);
55  int remove_control (std::shared_ptr<AutomationControl>, bool pop = false);
56 
57  void pop_all ();
58 
60 
61  void clear (bool pop = false);
62 
63  void set_active (bool);
64  bool active() const { return _active; }
65 
66  void set_mode (Mode m);
67  Mode mode () const { return _mode; }
68 
69  Evoral::Parameter parameter() const { return _parameter; }
70 
71  virtual void set_group_value (std::shared_ptr<AutomationControl>, double val);
72  virtual void pre_realtime_queue_stuff (double val);
73 
75  switch (gcd) {
77  return false;
79  return false;
81  return !_active;
82  default:
83  return _active;
84  }
85  }
86 
87  typedef std::map<PBD::ID,std::shared_ptr<AutomationControl> > ControlMap;
88  ControlMap::size_type size() const { Glib::Threads::RWLock::ReaderLock lm (controls_lock); return _controls.size(); }
89 
90  protected:
92  mutable Glib::Threads::RWLock controls_lock;
94  bool _active;
98 
99  void control_going_away (std::weak_ptr<AutomationControl>);
100 };
101 
102 
104 {
105  public:
107 
108  void set_group_value (std::shared_ptr<AutomationControl>, double val);
109 
110  private:
113 };
114 
115 } /* namespace */
116 
117 #endif /* __libardour_control_group_h__ */
void set_mode(Mode m)
bool use_me(PBD::Controllable::GroupControlDisposition gcd) const
void control_going_away(std::weak_ptr< AutomationControl >)
Glib::Threads::RWLock controls_lock
virtual void set_group_value(std::shared_ptr< AutomationControl >, double val)
void clear(bool pop=false)
int add_control(std::shared_ptr< AutomationControl >, bool push=false)
int remove_control(std::shared_ptr< AutomationControl >, bool pop=false)
virtual void pre_realtime_queue_stuff(double val)
PBD::ScopedConnectionList member_connections
Evoral::Parameter parameter() const
ControlGroup(Evoral::Parameter p)
std::map< PBD::ID, std::shared_ptr< AutomationControl > > ControlMap
ControlMap::size_type size() const
void fill_from_stripable_list(StripableList &, Evoral::Parameter const &)
AutomationControlList controls() const
void set_group_value(std::shared_ptr< AutomationControl >, double val)
gain_t get_min_factor(gain_t)
GainControlGroup(ARDOUR::AutomationType=GainAutomation)
gain_t get_max_factor(gain_t)
#define LIBARDOUR_API
std::list< std::shared_ptr< AutomationControl > > AutomationControlList
std::list< std::shared_ptr< Stripable > > StripableList
void push(lua_State *L, T t)
Definition: LuaBridge.h:160