Ardour  9.0-pre0-384-ga76afae0e9
slavable.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #pragma once
21 
22 #include <memory>
23 #include <set>
24 #include <string>
25 #include <stdint.h>
26 
27 
28 #include "pbd/signals.h"
29 
30 #include "evoral/Parameter.h"
31 
32 #include "ardour/types.h"
34 
35 class XMLNode;
36 
37 namespace ARDOUR {
38 
39 class VCA;
40 class VCAManager;
41 class AutomationControl;
42 class SlavableAutomationControl;
43 
45 {
46 public:
48  virtual ~Slavable() {}
49 
50  XMLNode& get_state () const;
51  int set_state (XMLNode const&, int);
52 
53  virtual void assign (std::shared_ptr<VCA>);
54  void unassign (std::shared_ptr<VCA>);
55 
56  PBD::Signal<void(std::shared_ptr<VCA>,bool)> AssignmentChange;
57 
58  virtual std::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter&) = 0;
59 
60  static std::string xml_node_name;
61 
62  /* signal sent VCAManager once assignment is possible */
63  static PBD::Signal<void(VCAManager*)> Assign;
64 
65  std::vector<std::shared_ptr<VCA> > masters (VCAManager*) const;
66 
68  bool assigned_to (VCAManager*, std::shared_ptr<VCA>) const;
69 
70 protected:
72 
73 private:
74  bool assign_controls (std::shared_ptr<VCA>);
75  void unassign_controls (std::shared_ptr<VCA>);
76 
77  bool assign_control (std::shared_ptr<VCA>, std::shared_ptr<SlavableAutomationControl>);
78  void unassign_control (std::shared_ptr<VCA>, std::shared_ptr<SlavableAutomationControl>);
79 
80  mutable Glib::Threads::RWLock master_lock;
81  std::set<uint32_t> _masters;
84 
86  void weak_unassign (std::weak_ptr<VCA>);
87 };
88 
89 } // namespace ARDOUR
90 
virtual SlavableAutomationControlList slavables() const =0
bool assign_controls(std::shared_ptr< VCA >)
int set_state(XMLNode const &, int)
PBD::ScopedConnection assign_connection
Definition: slavable.h:82
std::vector< std::shared_ptr< VCA > > masters(VCAManager *) const
PBD::Signal< void(std::shared_ptr< VCA >, bool)> AssignmentChange
Definition: slavable.h:56
int do_assign(VCAManager *s)
bool assigned_to(VCAManager *, std::shared_ptr< VCA >) const
static PBD::Signal< void(VCAManager *)> Assign
Definition: slavable.h:63
void unassign(std::shared_ptr< VCA >)
void unassign_control(std::shared_ptr< VCA >, std::shared_ptr< SlavableAutomationControl >)
virtual ~Slavable()
Definition: slavable.h:48
virtual std::shared_ptr< AutomationControl > automation_control(const Evoral::Parameter &)=0
static std::string xml_node_name
Definition: slavable.h:60
virtual void assign(std::shared_ptr< VCA >)
void unassign_controls(std::shared_ptr< VCA >)
bool assign_control(std::shared_ptr< VCA >, std::shared_ptr< SlavableAutomationControl >)
Glib::Threads::RWLock master_lock
Definition: slavable.h:80
PBD::ScopedConnectionList unassign_connections
Definition: slavable.h:83
XMLNode & get_state() const
void weak_unassign(std::weak_ptr< VCA >)
std::set< uint32_t > _masters
Definition: slavable.h:81
Definition: xml++.h:114
#define LIBARDOUR_API
std::list< std::shared_ptr< SlavableAutomationControl > > SlavableAutomationControlList
DebugBits VCA