Ardour  9.0-pre0-386-g96ef4d20f2
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 #include <glibmm/threads.h>
31 #include "pbd/signals.h"
32 
33 #include "temporal/domain_swap.h"
34 #include "temporal/types.h"
35 
36 #include "evoral/visibility.h"
37 #include "evoral/Parameter.h"
38 #include "evoral/ControlList.h"
39 
40 namespace Evoral {
41 
42 class Control;
43 class ControlEvent;
44 
45 class LIBEVORAL_API ControlSet : public boost::noncopyable, public Temporal::TimeDomainSwapper
46 {
47 public:
50  virtual ~ControlSet() {}
51 
52  virtual std::shared_ptr<Evoral::Control> control_factory(const Evoral::Parameter& id) = 0;
53 
54  std::shared_ptr<Control>
55  control (const Parameter& id, bool create_if_missing=false);
56 
57  inline std::shared_ptr<const Control>
58  control (const Parameter& id) const {
59  const Controls::const_iterator i = _controls.find(id);
60  return (i != _controls.end() ? i->second : std::shared_ptr<Control>());
61  }
62 
63  typedef std::map< Parameter, std::shared_ptr<Control> > Controls;
64  inline Controls& controls() { return _controls; }
65  inline const Controls& controls() const { return _controls; }
66 
67  virtual void add_control(std::shared_ptr<Control>);
68 
69  virtual bool controls_empty() const { return _controls.size() == 0; }
70  virtual void clear_controls();
71 
72  void what_has_data(std::set<Parameter>&) const;
73 
74  Glib::Threads::Mutex& control_lock() const { return _control_lock; }
75 
78 
79 protected:
80  virtual void control_list_marked_dirty () {}
82 
83  mutable Glib::Threads::Mutex _control_lock;
85 
87 
88 private:
89 
91 };
92 
93 
94 } // namespace Evoral
95 
96 #endif // EVORAL_CONTROLLABLE_HPP
Controls _controls
Definition: ControlSet.h:84
virtual void control_list_marked_dirty()
Definition: ControlSet.h:80
ControlSet(const ControlSet &)
PBD::ScopedConnectionList _list_connections
Definition: ControlSet.h:86
std::shared_ptr< const Control > control(const Parameter &id) const
Definition: ControlSet.h:58
virtual void control_list_interpolation_changed(Parameter const &, ControlList::InterpolationStyle)
Definition: ControlSet.h:81
void start_domain_bounce(Temporal::DomainBounceInfo &)
Glib::Threads::Mutex _control_lock
Definition: ControlSet.h:83
virtual void clear_controls()
std::map< Parameter, std::shared_ptr< Control > > Controls
Definition: ControlSet.h:63
Controls & controls()
Definition: ControlSet.h:64
PBD::ScopedConnectionList _control_connections
Definition: ControlSet.h:90
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:50
virtual bool controls_empty() const
Definition: ControlSet.h:69
void what_has_data(std::set< Parameter > &) const
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:65
Glib::Threads::Mutex & control_lock() const
Definition: ControlSet.h:74
#define LIBEVORAL_API
Definition: editor.h:85