Ardour  9.2-129-gdf5e1050bd
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 #pragma once
20 
21 #include <map>
22 #include <memory>
23 #include <vector>
24 
25 #include "pbd/controllable.h"
26 #include "pbd/rwlock.h"
27 
28 #include "evoral/Parameter.h"
29 
31 #include "ardour/types.h"
32 
33 namespace ARDOUR {
34 
35 class CoreSelection;
36 class RouteGroup;
37 class Stripable;
38 
39 class LIBARDOUR_API ControlGroup : public std::enable_shared_from_this<ControlGroup>
40 {
41  public:
43  virtual ~ControlGroup ();
44 
45  enum Mode {
46  Relative = 0x1,
47  Inverted = 0x2,
48  };
49 
51 
52  int add_control (std::shared_ptr<AutomationControl>, bool push = false);
53  int remove_control (std::shared_ptr<AutomationControl>, bool pop = false);
54 
55  void pop_all ();
56 
58 
59  void clear (bool pop = false);
60 
61  void set_active (bool);
62  bool active() const { return _active; }
63 
64  void set_mode (Mode m);
65  Mode mode () const { return _mode; }
66 
67  Evoral::Parameter parameter() const { return _parameter; }
68 
69  virtual void set_group_value (std::shared_ptr<AutomationControl>, double val);
70  virtual void pre_realtime_queue_stuff (double val);
71 
73  switch (gcd) {
75  return false;
77  return false;
79  return !_active;
80  default:
81  return _active;
82  }
83  }
84 
85  typedef std::map<PBD::ID,std::shared_ptr<AutomationControl> > ControlMap;
86  ControlMap::size_type size() const { PBD::RWLock::ReaderLock lm (controls_lock); return _controls.size(); }
87 
88  protected:
92  bool _active;
96 
97  void control_going_away (std::weak_ptr<AutomationControl>);
98 };
99 
100 
102 {
103  public:
105 
106  void set_group_value (std::shared_ptr<AutomationControl>, double val);
107 
108  private:
111 };
112 
113 } /* namespace */
114 
void set_mode(Mode m)
bool use_me(PBD::Controllable::GroupControlDisposition gcd) const
void control_going_away(std::weak_ptr< AutomationControl >)
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:159