/* Copyright (C) 2016 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __ardour_vca_h__ #define __ardour_vca_h__ #include #include #include #include "pbd/controllable.h" #include "pbd/statefuldestructible.h" #include "ardour/automatable.h" #include "ardour/stripable.h" namespace ARDOUR { class GainControl; class Route; class LIBARDOUR_API VCA : public Stripable, public Automatable, public boost::enable_shared_from_this { public: VCA (Session& session, uint32_t num, const std::string& name); ~VCA(); uint32_t number () const { return _number; } uint32_t remote_control_id() const; int init (); XMLNode& get_state(); int set_state (XMLNode const&, int version); void add_solo_mute_target (boost::shared_ptr); void remove_solo_mute_target (boost::shared_ptr); bool soloed () const; bool muted () const; static std::string default_name_template (); static int next_vca_number (); static std::string xml_node_name; /* used by Session to save/restore the atomic counter */ static uint32_t get_next_vca_number (); static void set_next_vca_number (uint32_t); virtual boost::shared_ptr gain_control() const { return _gain_control; } virtual boost::shared_ptr solo_control() const { return _solo_control; } virtual boost::shared_ptr mute_control() const { return _mute_control; } /* null Stripable API, because VCAs don't have any of this */ virtual boost::shared_ptr peak_meter() { return boost::shared_ptr(); } virtual boost::shared_ptr peak_meter() const { return boost::shared_ptr(); } virtual boost::shared_ptr phase_control() const { return boost::shared_ptr(); } virtual boost::shared_ptr trim_control() const { return boost::shared_ptr(); } virtual boost::shared_ptr monitoring_control() const { return boost::shared_ptr(); } virtual boost::shared_ptr recenable_control() const { return boost::shared_ptr(); } virtual boost::shared_ptr pan_azimuth_control() const { return boost::shared_ptr(); } virtual boost::shared_ptr pan_elevation_control() const { return boost::shared_ptr(); } virtual boost::shared_ptr pan_width_control() const { return boost::shared_ptr(); } virtual boost::shared_ptr pan_frontback_control() const { return boost::shared_ptr(); } virtual boost::shared_ptr pan_lfe_control() const { return boost::shared_ptr(); } virtual uint32_t eq_band_cnt () const { return 0; } virtual std::string eq_band_name (uint32_t) const { return std::string(); } virtual boost::shared_ptr eq_gain_controllable (uint32_t band) const { return boost::shared_ptr(); } virtual boost::shared_ptr eq_freq_controllable (uint32_t band) const { return boost::shared_ptr(); } virtual boost::shared_ptr eq_q_controllable (uint32_t band) const { return boost::shared_ptr(); } virtual boost::shared_ptr eq_shape_controllable (uint32_t band) const { return boost::shared_ptr(); } virtual boost::shared_ptr eq_enable_controllable () const { return boost::shared_ptr(); } virtual boost::shared_ptr eq_hpf_controllable () const { return boost::shared_ptr(); } virtual boost::shared_ptr comp_enable_controllable () const { return boost::shared_ptr(); } virtual boost::shared_ptr comp_threshold_controllable () const { return boost::shared_ptr(); } virtual boost::shared_ptr comp_speed_controllable () const { return boost::shared_ptr(); } virtual boost::shared_ptr comp_mode_controllable () const { return boost::shared_ptr(); } virtual boost::shared_ptr comp_makeup_controllable () const { return boost::shared_ptr(); } virtual boost::shared_ptr comp_redux_controllable () const { return boost::shared_ptr(); } virtual std::string comp_mode_name (uint32_t mode) const { return std::string(); } virtual std::string comp_speed_name (uint32_t mode) const { return std::string(); } virtual boost::shared_ptr send_level_controllable (uint32_t n) const { return boost::shared_ptr(); } virtual boost::shared_ptr send_enable_controllable (uint32_t n) const { return boost::shared_ptr(); } virtual std::string send_name (uint32_t n) const { return std::string(); } virtual boost::shared_ptr master_send_enable_controllable () const { return boost::shared_ptr(); } private: class VCASoloControllable : public AutomationControl { public: VCASoloControllable (std::string const & name, boost::shared_ptr vca); void set_value (double, PBD::Controllable::GroupControlDisposition group_override); void set_value_unchecked (double); double get_value () const; private: void _set_value (double, PBD::Controllable::GroupControlDisposition group_override); boost::weak_ptr _vca; }; class VCAMuteControllable : public AutomationControl { public: VCAMuteControllable (std::string const & name, boost::shared_ptr vca); void set_value (double, PBD::Controllable::GroupControlDisposition group_override); void set_value_unchecked (double); double get_value () const; private: void _set_value (double, PBD::Controllable::GroupControlDisposition group_override); boost::weak_ptr _vca; }; friend class VCASoloControllable; friend class VCAMuteControllable; uint32_t _number; RouteList solo_mute_targets; PBD::ScopedConnectionList solo_mute_connections; mutable Glib::Threads::RWLock solo_mute_lock; boost::shared_ptr _gain_control; boost::shared_ptr _solo_control; boost::shared_ptr _mute_control; bool _solo_requested; bool _mute_requested; static gint next_number; void solo_mute_target_going_away (boost::weak_ptr); bool soloed_locked () const; bool muted_locked () const; void set_solo (bool yn); void set_mute (bool yn); }; } /* namespace */ #endif /* __ardour_vca_h__ */