Ardour  9.2-70-g6916ee188f
ControlSet.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2015 David Robillard <d@drobilla.net>
3  * Copyright (C) 2010-2017 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
5  * Copyright (C) 2015 Robin Gareus <robin@gareus.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #ifndef EVORAL_CONTROLLABLE_HPP
23 #define EVORAL_CONTROLLABLE_HPP
24 
25 #include <set>
26 #include <map>
27 #include <memory>
28 
29 #include <boost/noncopyable.hpp>
30 
31 #include "pbd/mutex.h"
32 #include "pbd/signals.h"
33 
34 #include "temporal/domain_swap.h"
35 #include "temporal/types.h"
36 
37 #include "evoral/visibility.h"
38 #include "evoral/Parameter.h"
39 #include "evoral/ControlList.h"
40 
41 namespace Evoral {
42 
43 class Control;
44 class ControlEvent;
45 
46 class LIBEVORAL_API ControlSet : public boost::noncopyable, public Temporal::TimeDomainSwapper
47 {
48 public:
51  virtual ~ControlSet() {}
52 
53  virtual std::shared_ptr<Evoral::Control> control_factory(const Evoral::Parameter& id) = 0;
54 
55  std::shared_ptr<Control>
56  control (const Parameter& id, bool create_if_missing=false);
57 
58  inline std::shared_ptr<const Control>
59  control (const Parameter& id) const {
60  const Controls::const_iterator i = _controls.find(id);
61  return (i != _controls.end() ? i->second : std::shared_ptr<Control>());
62  }
63 
64  typedef std::map< Parameter, std::shared_ptr<Control> > Controls;
65  inline Controls& controls() { return _controls; }
66  inline const Controls& controls() const { return _controls; }
67 
68  virtual void add_control(std::shared_ptr<Control>);
69 
70  virtual bool controls_empty() const { return _controls.size() == 0; }
71  virtual void clear_controls();
72 
73  void what_has_data(std::set<Parameter>&) const;
74 
75  PBD::Mutex& control_lock() const { return _control_lock; }
76 
79 
80 protected:
81  virtual void control_list_marked_dirty () {}
83 
86 
88 
89 private:
90 
92 };
93 
94 
95 } // namespace Evoral
96 
97 #endif // EVORAL_CONTROLLABLE_HPP
Controls _controls
Definition: ControlSet.h:85
virtual void control_list_marked_dirty()
Definition: ControlSet.h:81
ControlSet(const ControlSet &)
PBD::ScopedConnectionList _list_connections
Definition: ControlSet.h:87
std::shared_ptr< const Control > control(const Parameter &id) const
Definition: ControlSet.h:59
virtual void control_list_interpolation_changed(Parameter const &, ControlList::InterpolationStyle)
Definition: ControlSet.h:82
void start_domain_bounce(Temporal::DomainBounceInfo &)
virtual void clear_controls()
std::map< Parameter, std::shared_ptr< Control > > Controls
Definition: ControlSet.h:64
Controls & controls()
Definition: ControlSet.h:65
PBD::ScopedConnectionList _control_connections
Definition: ControlSet.h:91
PBD::Mutex & control_lock() const
Definition: ControlSet.h:75
virtual std::shared_ptr< Evoral::Control > control_factory(const Evoral::Parameter &id)=0
virtual void add_control(std::shared_ptr< Control >)
virtual ~ControlSet()
Definition: ControlSet.h:51
virtual bool controls_empty() const
Definition: ControlSet.h:70
void what_has_data(std::set< Parameter > &) const
PBD::Mutex _control_lock
Definition: ControlSet.h:84
void finish_domain_bounce(Temporal::DomainBounceInfo &)
std::shared_ptr< Control > control(const Parameter &id, bool create_if_missing=false)
const Controls & controls() const
Definition: ControlSet.h:66
#define LIBEVORAL_API
Definition: editor.h:87