Ardour  9.2-79-gba93f2fe52
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 #pragma once
22 
23 #include <memory>
24 #include <string>
25 
26 #include "pbd/controllable.h"
27 #include "pbd/mutex.h"
29 
30 #include "ardour/muteable.h"
31 #include "ardour/monitorable.h"
32 #include "ardour/recordable.h"
33 #include "ardour/soloable.h"
34 #include "ardour/slavable.h"
35 #include "ardour/stripable.h"
36 
37 namespace ARDOUR {
38 
39 class Route;
40 class GainControl;
41 class SoloControl;
42 class MuteControl;
43 class MonitorControl;
44 
45 class LIBARDOUR_API VCA : public Stripable,
46  public Soloable,
47  public Muteable,
48  public Recordable,
49  public Monitorable
50 {
51  public:
52  VCA (Session& session, int32_t num, const std::string& name);
53  ~VCA();
54 
55  int32_t number () const { return _number; }
56  std::string full_name() const;
57 
58  int init ();
59  XMLNode& get_state() const;
60  int set_state (XMLNode const&, int version);
61 
62  PBD::Signal<void()> Drop; /* signal to slaves to drop control by this VCA */
63 
64  /* Slavable API */
65 
66  void assign (std::shared_ptr<VCA>);
67 
68  bool slaved_to (std::shared_ptr<VCA>) const;
69  bool slaved () const;
70 
71  /* Soloable API */
72 
74 
75  bool soloed () const;
76  void push_solo_upstream (int32_t) {}
77  void push_solo_isolate_upstream (int32_t) {}
78  bool can_solo() const { return true; }
79  bool can_monitor() const { return true; }
80  bool is_safe () const { return false; }
81 
82  /* Muteable API */
83 
84  bool can_be_muted_by_others () const { return true; }
85  bool muted_by_others_soloing() const { return false; }
86 
87  /* Recordable API */
88 
89  int prep_record_enabled (bool yn) { return 0; }
90  bool can_be_record_enabled() { return true; }
91  bool can_be_record_safe() { return true; }
92 
93  /* Monitorable API */
94 
96 
97  static std::string default_name_template ();
98  static int32_t next_vca_number ();
99  static std::string xml_node_name;
100 
101  /* used by Session to save/restore the atomic counter */
102  static int32_t get_next_vca_number ();
103  static void set_next_vca_number (int32_t);
104 
105  std::shared_ptr<GainControl> gain_control() const { return _gain_control; }
106  std::shared_ptr<SoloControl> solo_control() const { return _solo_control; }
107  std::shared_ptr<MuteControl> mute_control() const { return _mute_control; }
108 
109  /* null Stripable API, because VCAs don't have any of this */
110 
111  std::shared_ptr<AutomationControl> mapped_control (enum WellKnownCtrl, uint32_t band = 0) const {
112  return std::shared_ptr<AutomationControl>();
113  }
114  std::shared_ptr<ReadOnlyControl> mapped_output (enum WellKnownData) const {
115  return std::shared_ptr<ReadOnlyControl>();
116  }
117 
118  std::shared_ptr<SoloIsolateControl> solo_isolate_control() const { return std::shared_ptr<SoloIsolateControl>(); }
119  std::shared_ptr<SoloSafeControl> solo_safe_control() const { return std::shared_ptr<SoloSafeControl>(); }
120 
121  std::shared_ptr<PeakMeter> peak_meter() { return std::shared_ptr<PeakMeter>(); }
122  std::shared_ptr<const PeakMeter> peak_meter() const { return std::shared_ptr<PeakMeter>(); }
123  std::shared_ptr<PhaseControl> phase_control() const { return std::shared_ptr<PhaseControl>(); }
124  std::shared_ptr<GainControl> trim_control() const { return std::shared_ptr<GainControl>(); }
125 
126  std::shared_ptr<AutomationControl> pan_azimuth_control() const { return std::shared_ptr<AutomationControl>(); }
127  std::shared_ptr<AutomationControl> pan_elevation_control() const { return std::shared_ptr<AutomationControl>(); }
128  std::shared_ptr<AutomationControl> pan_width_control() const { return std::shared_ptr<AutomationControl>(); }
129  std::shared_ptr<AutomationControl> pan_frontback_control() const { return std::shared_ptr<AutomationControl>(); }
130  std::shared_ptr<AutomationControl> pan_lfe_control() const { return std::shared_ptr<AutomationControl>(); }
131 
132  uint32_t eq_band_cnt () const { return 0; }
133  std::string eq_band_name (uint32_t) const { return std::string(); }
134 
135  std::shared_ptr<AutomationControl> send_level_controllable (uint32_t n, bool locked = false) const { return std::shared_ptr<AutomationControl>(); }
136  std::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const { return std::shared_ptr<AutomationControl>(); }
137  std::shared_ptr<AutomationControl> send_pan_azimuth_controllable (uint32_t n) const { return std::shared_ptr<AutomationControl>(); }
138  std::shared_ptr<AutomationControl> send_pan_azimuth_enable_controllable (uint32_t n) const { return std::shared_ptr<AutomationControl>(); }
139  std::string send_name (uint32_t n) const { return std::string(); }
140 
141  std::shared_ptr<AutomationControl> master_send_enable_controllable () const { return std::shared_ptr<AutomationControl>(); }
142  std::shared_ptr<MonitorProcessor> monitor_control() const { return std::shared_ptr<MonitorProcessor>(); }
143  std::shared_ptr<MonitorControl> monitoring_control() const { return std::shared_ptr<MonitorControl>(); }
144 
145  protected:
147 
148  private:
149  int32_t _number;
150 
151  std::shared_ptr<GainControl> _gain_control;
152  std::shared_ptr<SoloControl> _solo_control;
153  std::shared_ptr<MuteControl> _mute_control;
154 
155 
156  static int32_t next_number;
158 
159  void solo_target_going_away (std::weak_ptr<Route>);
160  void mute_target_going_away (std::weak_ptr<Route>);
161  bool soloed_locked () const;
162  bool muted_locked () const;
163 };
164 
165 } /* namespace */
166 
bool soloed() const
bool can_solo() const
Definition: vca.h:78
static int32_t get_next_vca_number()
static std::string default_name_template()
XMLNode & get_state() const
std::shared_ptr< MonitorControl > monitoring_control() const
Definition: vca.h:143
std::shared_ptr< AutomationControl > pan_width_control() const
Definition: vca.h:128
std::shared_ptr< MuteControl > mute_control() const
Definition: vca.h:107
void push_solo_isolate_upstream(int32_t)
Definition: vca.h:77
uint32_t eq_band_cnt() const
Definition: vca.h:132
std::string full_name() const
static std::string xml_node_name
Definition: vca.h:99
bool slaved_to(std::shared_ptr< VCA >) const
std::shared_ptr< PeakMeter > peak_meter()
Definition: vca.h:121
bool slaved() const
PBD::Signal< void()> Drop
Definition: vca.h:62
std::shared_ptr< MuteControl > _mute_control
Definition: vca.h:153
std::shared_ptr< AutomationControl > pan_lfe_control() const
Definition: vca.h:130
std::shared_ptr< AutomationControl > pan_frontback_control() const
Definition: vca.h:129
std::shared_ptr< AutomationControl > pan_elevation_control() const
Definition: vca.h:127
std::shared_ptr< SoloControl > solo_control() const
Definition: vca.h:106
std::shared_ptr< GainControl > trim_control() const
Definition: vca.h:124
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:105
bool can_be_record_enabled()
Definition: vca.h:90
std::shared_ptr< AutomationControl > send_pan_azimuth_enable_controllable(uint32_t n) const
Definition: vca.h:138
void solo_target_going_away(std::weak_ptr< Route >)
std::shared_ptr< AutomationControl > pan_azimuth_control() const
Definition: vca.h:126
static void set_next_vca_number(int32_t)
int prep_record_enabled(bool yn)
Definition: vca.h:89
std::string eq_band_name(uint32_t) const
Definition: vca.h:133
std::shared_ptr< GainControl > _gain_control
Definition: vca.h:151
bool can_monitor() const
Definition: vca.h:79
void push_solo_upstream(int32_t)
Definition: vca.h:76
std::shared_ptr< MonitorProcessor > monitor_control() const
Definition: vca.h:142
static PBD::Mutex number_lock
Definition: vca.h:157
std::shared_ptr< AutomationControl > master_send_enable_controllable() const
Definition: vca.h:141
std::shared_ptr< SoloIsolateControl > solo_isolate_control() const
Definition: vca.h:118
int32_t _number
Definition: vca.h:149
void clear_all_solo_state()
std::string send_name(uint32_t n) const
Definition: vca.h:139
void assign(std::shared_ptr< VCA >)
std::shared_ptr< PhaseControl > phase_control() const
Definition: vca.h:123
bool can_be_record_safe()
Definition: vca.h:91
MonitorState monitoring_state() const
bool is_safe() const
Definition: vca.h:80
std::shared_ptr< const PeakMeter > peak_meter() const
Definition: vca.h:122
void mute_target_going_away(std::weak_ptr< Route >)
std::shared_ptr< SoloControl > _solo_control
Definition: vca.h:152
std::shared_ptr< ReadOnlyControl > mapped_output(enum WellKnownData) const
Definition: vca.h:114
std::shared_ptr< AutomationControl > send_level_controllable(uint32_t n, bool locked=false) const
Definition: vca.h:135
bool soloed_locked() const
bool can_be_muted_by_others() const
Definition: vca.h:84
static int32_t next_vca_number()
std::shared_ptr< AutomationControl > send_enable_controllable(uint32_t n) const
Definition: vca.h:136
bool muted_by_others_soloing() const
Definition: vca.h:85
int32_t number() const
Definition: vca.h:55
bool muted_locked() const
std::shared_ptr< SoloSafeControl > solo_safe_control() const
Definition: vca.h:119
std::shared_ptr< AutomationControl > mapped_control(enum WellKnownCtrl, uint32_t band=0) const
Definition: vca.h:111
static int32_t next_number
Definition: vca.h:156
std::shared_ptr< AutomationControl > send_pan_azimuth_controllable(uint32_t n) const
Definition: vca.h:137
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
PBD::PropertyDescriptor< bool > locked
std::list< std::shared_ptr< SlavableAutomationControl > > SlavableAutomationControlList