Ardour  8.7-14-g57a6773833
vca.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2017 Ben Loftis <ben@harrisonconsoles.com>
4  * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef __ardour_vca_h__
22 #define __ardour_vca_h__
23 
24 #include <memory>
25 #include <string>
26 
27 #include <glibmm/threads.h>
28 
29 #include "pbd/controllable.h"
31 
32 #include "ardour/muteable.h"
33 #include "ardour/monitorable.h"
34 #include "ardour/recordable.h"
35 #include "ardour/soloable.h"
36 #include "ardour/slavable.h"
37 #include "ardour/stripable.h"
38 
39 namespace ARDOUR {
40 
41 class Route;
42 class GainControl;
43 class SoloControl;
44 class MuteControl;
45 class MonitorControl;
46 
47 class LIBARDOUR_API VCA : public Stripable,
48  public Soloable,
49  public Muteable,
50  public Recordable,
51  public Monitorable
52 {
53  public:
54  VCA (Session& session, int32_t num, const std::string& name);
55  ~VCA();
56 
57  int32_t number () const { return _number; }
58  std::string full_name() const;
59 
60  int init ();
61  XMLNode& get_state() const;
62  int set_state (XMLNode const&, int version);
63 
64  PBD::Signal0<void> Drop; /* signal to slaves to drop control by this VCA */
65 
66  /* Slavable API */
67 
68  void assign (std::shared_ptr<VCA>);
69 
70  bool slaved_to (std::shared_ptr<VCA>) const;
71  bool slaved () const;
72 
73  /* Soloable API */
74 
76 
77  bool soloed () const;
78  void push_solo_upstream (int32_t) {}
79  void push_solo_isolate_upstream (int32_t) {}
80  bool can_solo() const { return true; }
81  bool can_monitor() const { return true; }
82  bool is_safe () const { return false; }
83 
84  /* Muteable API */
85 
86  bool can_be_muted_by_others () const { return true; }
87  bool muted_by_others_soloing() const { return false; }
88 
89  /* Recordable API */
90 
91  int prep_record_enabled (bool yn) { return 0; }
92  bool can_be_record_enabled() { return true; }
93  bool can_be_record_safe() { return true; }
94 
95  /* Monitorable API */
96 
98 
99  static std::string default_name_template ();
100  static int32_t next_vca_number ();
101  static std::string xml_node_name;
102 
103  /* used by Session to save/restore the atomic counter */
104  static int32_t get_next_vca_number ();
105  static void set_next_vca_number (int32_t);
106 
107  std::shared_ptr<GainControl> gain_control() const { return _gain_control; }
108  std::shared_ptr<SoloControl> solo_control() const { return _solo_control; }
109  std::shared_ptr<MuteControl> mute_control() const { return _mute_control; }
110 
111  /* null Stripable API, because VCAs don't have any of this */
112 
113  std::shared_ptr<AutomationControl> mapped_control (enum WellKnownCtrl, uint32_t band = 0) const {
114  return std::shared_ptr<AutomationControl>();
115  }
116  std::shared_ptr<ReadOnlyControl> mapped_output (enum WellKnownData) const {
117  return std::shared_ptr<ReadOnlyControl>();
118  }
119 
120  std::shared_ptr<SoloIsolateControl> solo_isolate_control() const { return std::shared_ptr<SoloIsolateControl>(); }
121  std::shared_ptr<SoloSafeControl> solo_safe_control() const { return std::shared_ptr<SoloSafeControl>(); }
122 
123  std::shared_ptr<PeakMeter> peak_meter() { return std::shared_ptr<PeakMeter>(); }
124  std::shared_ptr<const PeakMeter> peak_meter() const { return std::shared_ptr<PeakMeter>(); }
125  std::shared_ptr<PhaseControl> phase_control() const { return std::shared_ptr<PhaseControl>(); }
126  std::shared_ptr<GainControl> trim_control() const { return std::shared_ptr<GainControl>(); }
127 
128  std::shared_ptr<AutomationControl> pan_azimuth_control() const { return std::shared_ptr<AutomationControl>(); }
129  std::shared_ptr<AutomationControl> pan_elevation_control() const { return std::shared_ptr<AutomationControl>(); }
130  std::shared_ptr<AutomationControl> pan_width_control() const { return std::shared_ptr<AutomationControl>(); }
131  std::shared_ptr<AutomationControl> pan_frontback_control() const { return std::shared_ptr<AutomationControl>(); }
132  std::shared_ptr<AutomationControl> pan_lfe_control() const { return std::shared_ptr<AutomationControl>(); }
133 
134  uint32_t eq_band_cnt () const { return 0; }
135  std::string eq_band_name (uint32_t) const { return std::string(); }
136 
137  std::shared_ptr<AutomationControl> send_level_controllable (uint32_t n) const { return std::shared_ptr<AutomationControl>(); }
138  std::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const { return std::shared_ptr<AutomationControl>(); }
139  std::shared_ptr<AutomationControl> send_pan_azimuth_controllable (uint32_t n) const { return std::shared_ptr<AutomationControl>(); }
140  std::shared_ptr<AutomationControl> send_pan_azimuth_enable_controllable (uint32_t n) const { return std::shared_ptr<AutomationControl>(); }
141  std::string send_name (uint32_t n) const { return std::string(); }
142 
143  std::shared_ptr<AutomationControl> master_send_enable_controllable () const { return std::shared_ptr<AutomationControl>(); }
144  std::shared_ptr<MonitorProcessor> monitor_control() const { return std::shared_ptr<MonitorProcessor>(); }
145  std::shared_ptr<MonitorControl> monitoring_control() const { return std::shared_ptr<MonitorControl>(); }
146 
147  protected:
149 
150  private:
151  int32_t _number;
152 
153  std::shared_ptr<GainControl> _gain_control;
154  std::shared_ptr<SoloControl> _solo_control;
155  std::shared_ptr<MuteControl> _mute_control;
156 
157 
158  static int32_t next_number;
159  static Glib::Threads::Mutex number_lock;
160 
161  void solo_target_going_away (std::weak_ptr<Route>);
162  void mute_target_going_away (std::weak_ptr<Route>);
163  bool soloed_locked () const;
164  bool muted_locked () const;
165 };
166 
167 } /* namespace */
168 
169 #endif /* __ardour_vca_h__ */
bool soloed() const
bool can_solo() const
Definition: vca.h:80
static int32_t get_next_vca_number()
static std::string default_name_template()
static Glib::Threads::Mutex number_lock
Definition: vca.h:159
XMLNode & get_state() const
std::shared_ptr< MonitorControl > monitoring_control() const
Definition: vca.h:145
std::shared_ptr< AutomationControl > pan_width_control() const
Definition: vca.h:130
std::shared_ptr< MuteControl > mute_control() const
Definition: vca.h:109
void push_solo_isolate_upstream(int32_t)
Definition: vca.h:79
uint32_t eq_band_cnt() const
Definition: vca.h:134
std::string full_name() const
static std::string xml_node_name
Definition: vca.h:101
bool slaved_to(std::shared_ptr< VCA >) const
std::shared_ptr< PeakMeter > peak_meter()
Definition: vca.h:123
bool slaved() const
std::shared_ptr< MuteControl > _mute_control
Definition: vca.h:155
std::shared_ptr< AutomationControl > pan_lfe_control() const
Definition: vca.h:132
std::shared_ptr< AutomationControl > pan_frontback_control() const
Definition: vca.h:131
std::shared_ptr< AutomationControl > pan_elevation_control() const
Definition: vca.h:129
std::shared_ptr< SoloControl > solo_control() const
Definition: vca.h:108
std::shared_ptr< GainControl > trim_control() const
Definition: vca.h:126
int set_state(XMLNode const &, int version)
VCA(Session &session, int32_t num, const std::string &name)
SlavableAutomationControlList slavables() const
std::shared_ptr< GainControl > gain_control() const
Definition: vca.h:107
bool can_be_record_enabled()
Definition: vca.h:92
std::shared_ptr< AutomationControl > send_pan_azimuth_enable_controllable(uint32_t n) const
Definition: vca.h:140
void solo_target_going_away(std::weak_ptr< Route >)
std::shared_ptr< AutomationControl > pan_azimuth_control() const
Definition: vca.h:128
static void set_next_vca_number(int32_t)
int prep_record_enabled(bool yn)
Definition: vca.h:91
std::string eq_band_name(uint32_t) const
Definition: vca.h:135
std::shared_ptr< GainControl > _gain_control
Definition: vca.h:153
bool can_monitor() const
Definition: vca.h:81
void push_solo_upstream(int32_t)
Definition: vca.h:78
std::shared_ptr< AutomationControl > send_level_controllable(uint32_t n) const
Definition: vca.h:137
std::shared_ptr< MonitorProcessor > monitor_control() const
Definition: vca.h:144
std::shared_ptr< AutomationControl > master_send_enable_controllable() const
Definition: vca.h:143
std::shared_ptr< SoloIsolateControl > solo_isolate_control() const
Definition: vca.h:120
int32_t _number
Definition: vca.h:151
void clear_all_solo_state()
std::string send_name(uint32_t n) const
Definition: vca.h:141
void assign(std::shared_ptr< VCA >)
std::shared_ptr< PhaseControl > phase_control() const
Definition: vca.h:125
bool can_be_record_safe()
Definition: vca.h:93
MonitorState monitoring_state() const
bool is_safe() const
Definition: vca.h:82
std::shared_ptr< const PeakMeter > peak_meter() const
Definition: vca.h:124
void mute_target_going_away(std::weak_ptr< Route >)
std::shared_ptr< SoloControl > _solo_control
Definition: vca.h:154
std::shared_ptr< ReadOnlyControl > mapped_output(enum WellKnownData) const
Definition: vca.h:116
bool soloed_locked() const
bool can_be_muted_by_others() const
Definition: vca.h:86
static int32_t next_vca_number()
std::shared_ptr< AutomationControl > send_enable_controllable(uint32_t n) const
Definition: vca.h:138
bool muted_by_others_soloing() const
Definition: vca.h:87
int32_t number() const
Definition: vca.h:57
PBD::Signal0< void > Drop
Definition: vca.h:64
bool muted_locked() const
std::shared_ptr< SoloSafeControl > solo_safe_control() const
Definition: vca.h:121
std::shared_ptr< AutomationControl > mapped_control(enum WellKnownCtrl, uint32_t band=0) const
Definition: vca.h:113
static int32_t next_number
Definition: vca.h:158
std::shared_ptr< AutomationControl > send_pan_azimuth_controllable(uint32_t n) const
Definition: vca.h:139
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
void session(lua_State *L)
std::list< std::shared_ptr< SlavableAutomationControl > > SlavableAutomationControlList