Ardour  9.0-pre0-350-gf17a656217
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 <glibmm/threads.h>
26 
27 #include "pbd/controllable.h"
28 
29 #include "evoral/Parameter.h"
30 
32 #include "ardour/types.h"
33 
34 namespace ARDOUR {
35 
36 class CoreSelection;
37 class RouteGroup;
38 class Stripable;
39 
40 class LIBARDOUR_API ControlGroup : public std::enable_shared_from_this<ControlGroup>
41 {
42  public:
44  virtual ~ControlGroup ();
45 
46  enum Mode {
47  Relative = 0x1,
48  Inverted = 0x2,
49  };
50 
52 
53  int add_control (std::shared_ptr<AutomationControl>, bool push = false);
54  int remove_control (std::shared_ptr<AutomationControl>, bool pop = false);
55 
56  void pop_all ();
57 
59 
60  void clear (bool pop = false);
61 
62  void set_active (bool);
63  bool active() const { return _active; }
64 
65  void set_mode (Mode m);
66  Mode mode () const { return _mode; }
67 
68  Evoral::Parameter parameter() const { return _parameter; }
69 
70  virtual void set_group_value (std::shared_ptr<AutomationControl>, double val);
71  virtual void pre_realtime_queue_stuff (double val);
72 
74  switch (gcd) {
76  return false;
78  return false;
80  return !_active;
81  default:
82  return _active;
83  }
84  }
85 
86  typedef std::map<PBD::ID,std::shared_ptr<AutomationControl> > ControlMap;
87  ControlMap::size_type size() const { Glib::Threads::RWLock::ReaderLock lm (controls_lock); return _controls.size(); }
88 
89  protected:
91  mutable Glib::Threads::RWLock controls_lock;
93  bool _active;
97 
98  void control_going_away (std::weak_ptr<AutomationControl>);
99 };
100 
101 
103 {
104  public:
106 
107  void set_group_value (std::shared_ptr<AutomationControl>, double val);
108 
109  private:
112 };
113 
114 } /* namespace */
115 
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:159