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