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 <string> 25 #include <boost/shared_ptr.hpp> 26 #include <boost/enable_shared_from_this.hpp> 27 28 #include <glibmm/threads.h> 29 30 #include "pbd/controllable.h" 31 #include "pbd/statefuldestructible.h" 32 33 #include "ardour/muteable.h" 34 #include "ardour/monitorable.h" 35 #include "ardour/recordable.h" 36 #include "ardour/soloable.h" 37 #include "ardour/slavable.h" 38 #include "ardour/stripable.h" 39 40 namespace ARDOUR { 41 42 class Route; 43 class GainControl; 44 class SoloControl; 45 class MuteControl; 46 class MonitorControl; 47 48 class LIBARDOUR_API VCA : public Stripable, 49 public Soloable, 50 public Muteable, 51 public Recordable, 52 public Monitorable 53 { 54 public: 55 VCA (Session& session, int32_t num, const std::string& name); 56 ~VCA(); 57 number()58 int32_t number () const { return _number; } 59 std::string full_name() const; 60 61 int init (); 62 XMLNode& get_state(); 63 int set_state (XMLNode const&, int version); 64 65 PBD::Signal0<void> Drop; /* signal to slaves to drop control by this VCA */ 66 67 /* Slavable API */ 68 69 void assign (boost::shared_ptr<VCA>); 70 71 bool slaved_to (boost::shared_ptr<VCA>) const; 72 bool slaved () const; 73 74 /* Soloable API */ 75 76 void clear_all_solo_state (); 77 78 bool soloed () const; push_solo_upstream(int32_t)79 void push_solo_upstream (int32_t) {} push_solo_isolate_upstream(int32_t)80 void push_solo_isolate_upstream (int32_t) {} can_solo()81 bool can_solo() const { return true; } can_monitor()82 bool can_monitor() const { return false; } is_safe()83 bool is_safe () const { return false; } 84 85 /* Muteable API */ 86 can_be_muted_by_others()87 bool can_be_muted_by_others () const { return true; } muted_by_others_soloing()88 bool muted_by_others_soloing() const { return false; } 89 90 /* Recordable API */ 91 prep_record_enabled(bool yn)92 int prep_record_enabled (bool yn) { return 0; } can_be_record_enabled()93 bool can_be_record_enabled() { return true; } can_be_record_safe()94 bool can_be_record_safe() { return true; } 95 96 /* Monitorable API */ 97 98 MonitorState monitoring_state() const; 99 100 static std::string default_name_template (); 101 static int32_t next_vca_number (); 102 static std::string xml_node_name; 103 104 /* used by Session to save/restore the atomic counter */ 105 static int32_t get_next_vca_number (); 106 static void set_next_vca_number (int32_t); 107 gain_control()108 boost::shared_ptr<GainControl> gain_control() const { return _gain_control; } solo_control()109 boost::shared_ptr<SoloControl> solo_control() const { return _solo_control; } mute_control()110 boost::shared_ptr<MuteControl> mute_control() const { return _mute_control; } 111 112 /* null Stripable API, because VCAs don't have any of this */ 113 solo_isolate_control()114 boost::shared_ptr<SoloIsolateControl> solo_isolate_control() const { return boost::shared_ptr<SoloIsolateControl>(); } solo_safe_control()115 boost::shared_ptr<SoloSafeControl> solo_safe_control() const { return boost::shared_ptr<SoloSafeControl>(); } peak_meter()116 boost::shared_ptr<PeakMeter> peak_meter() { return boost::shared_ptr<PeakMeter>(); } peak_meter()117 boost::shared_ptr<const PeakMeter> peak_meter() const { return boost::shared_ptr<PeakMeter>(); } phase_control()118 boost::shared_ptr<PhaseControl> phase_control() const { return boost::shared_ptr<PhaseControl>(); } trim_control()119 boost::shared_ptr<GainControl> trim_control() const { return boost::shared_ptr<GainControl>(); } pan_azimuth_control()120 boost::shared_ptr<AutomationControl> pan_azimuth_control() const { return boost::shared_ptr<AutomationControl>(); } pan_elevation_control()121 boost::shared_ptr<AutomationControl> pan_elevation_control() const { return boost::shared_ptr<AutomationControl>(); } pan_width_control()122 boost::shared_ptr<AutomationControl> pan_width_control() const { return boost::shared_ptr<AutomationControl>(); } pan_frontback_control()123 boost::shared_ptr<AutomationControl> pan_frontback_control() const { return boost::shared_ptr<AutomationControl>(); } pan_lfe_control()124 boost::shared_ptr<AutomationControl> pan_lfe_control() const { return boost::shared_ptr<AutomationControl>(); } eq_band_cnt()125 uint32_t eq_band_cnt () const { return 0; } eq_band_name(uint32_t)126 std::string eq_band_name (uint32_t) const { return std::string(); } eq_enable_controllable()127 boost::shared_ptr<AutomationControl> eq_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); } eq_gain_controllable(uint32_t)128 boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); } eq_freq_controllable(uint32_t)129 boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); } eq_q_controllable(uint32_t)130 boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); } eq_shape_controllable(uint32_t)131 boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); } filter_freq_controllable(bool)132 boost::shared_ptr<AutomationControl> filter_freq_controllable (bool) const { return boost::shared_ptr<AutomationControl>(); } filter_slope_controllable(bool)133 boost::shared_ptr<AutomationControl> filter_slope_controllable (bool) const { return boost::shared_ptr<AutomationControl>(); } filter_enable_controllable(bool)134 boost::shared_ptr<AutomationControl> filter_enable_controllable (bool) const { return boost::shared_ptr<AutomationControl>(); } comp_enable_controllable()135 boost::shared_ptr<AutomationControl> comp_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); } comp_threshold_controllable()136 boost::shared_ptr<AutomationControl> comp_threshold_controllable () const { return boost::shared_ptr<AutomationControl>(); } comp_speed_controllable()137 boost::shared_ptr<AutomationControl> comp_speed_controllable () const { return boost::shared_ptr<AutomationControl>(); } comp_mode_controllable()138 boost::shared_ptr<AutomationControl> comp_mode_controllable () const { return boost::shared_ptr<AutomationControl>(); } comp_makeup_controllable()139 boost::shared_ptr<AutomationControl> comp_makeup_controllable () const { return boost::shared_ptr<AutomationControl>(); } comp_redux_controllable()140 boost::shared_ptr<ReadOnlyControl> comp_redux_controllable () const { return boost::shared_ptr<ReadOnlyControl>(); } comp_mode_name(uint32_t mode)141 std::string comp_mode_name (uint32_t mode) const { return std::string(); } comp_speed_name(uint32_t mode)142 std::string comp_speed_name (uint32_t mode) const { return std::string(); } send_level_controllable(uint32_t n)143 boost::shared_ptr<AutomationControl> send_level_controllable (uint32_t n) const { return boost::shared_ptr<AutomationControl>(); } send_enable_controllable(uint32_t n)144 boost::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const { return boost::shared_ptr<AutomationControl>(); } send_pan_azimuth_controllable(uint32_t n)145 boost::shared_ptr<AutomationControl> send_pan_azimuth_controllable (uint32_t n) const { return boost::shared_ptr<AutomationControl>(); } send_pan_azimuth_enable_controllable(uint32_t n)146 boost::shared_ptr<AutomationControl> send_pan_azimuth_enable_controllable (uint32_t n) const { return boost::shared_ptr<AutomationControl>(); } send_name(uint32_t n)147 std::string send_name (uint32_t n) const { return std::string(); } master_send_enable_controllable()148 boost::shared_ptr<AutomationControl> master_send_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); } monitor_control()149 boost::shared_ptr<MonitorProcessor> monitor_control() const { return boost::shared_ptr<MonitorProcessor>(); } monitoring_control()150 boost::shared_ptr<MonitorControl> monitoring_control() const { return boost::shared_ptr<MonitorControl>(); } 151 152 //additional filter params (currently 32C only ) eq_lpf_controllable()153 boost::shared_ptr<AutomationControl> eq_lpf_controllable () const { return boost::shared_ptr<AutomationControl>(); } filter_enable_controllable()154 boost::shared_ptr<AutomationControl> filter_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); } 155 156 protected: 157 SlavableControlList slavables () const; 158 159 private: 160 int32_t _number; 161 162 boost::shared_ptr<GainControl> _gain_control; 163 boost::shared_ptr<SoloControl> _solo_control; 164 boost::shared_ptr<MuteControl> _mute_control; 165 166 167 static int32_t next_number; 168 static Glib::Threads::Mutex number_lock; 169 170 void solo_target_going_away (boost::weak_ptr<Route>); 171 void mute_target_going_away (boost::weak_ptr<Route>); 172 bool soloed_locked () const; 173 bool muted_locked () const; 174 }; 175 176 } /* namespace */ 177 178 #endif /* __ardour_vca_h__ */ 179