universal change in the design of the way Route/Track controls are designed and used...
[ardour.git] / libs / ardour / ardour / vca.h
1 /*
2     Copyright (C) 2016 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify it
5     under the terms of the GNU General Public License as published by the Free
6     Software Foundation; either version 2 of the License, or (at your option)
7     any later version.
8
9     This program is distributed in the hope that it will be useful, but WITHOUT
10     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12     for more details.
13
14     You should have received a copy of the GNU General Public License along
15     with this program; if not, write to the Free Software Foundation, Inc.,
16     675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 #ifndef __ardour_vca_h__
20 #define __ardour_vca_h__
21
22 #include <string>
23 #include <boost/shared_ptr.hpp>
24 #include <boost/enable_shared_from_this.hpp>
25
26 #include "pbd/controllable.h"
27 #include "pbd/statefuldestructible.h"
28
29 #include "ardour/automatable.h"
30 #include "ardour/muteable.h"
31 #include "ardour/soloable.h"
32 #include "ardour/stripable.h"
33
34 namespace ARDOUR {
35
36 class Route;
37 class GainControl;
38 class SoloControl;
39 class MuteControl;
40 class MonitorControl;
41
42 class LIBARDOUR_API VCA : public Stripable, public Soloable, public Muteable, public Automatable, public boost::enable_shared_from_this<VCA> {
43   public:
44         VCA (Session& session,  uint32_t num, const std::string& name);
45         ~VCA();
46
47         uint32_t number () const { return _number; }
48         uint32_t remote_control_id() const;
49
50         int init ();
51         XMLNode& get_state();
52         int set_state (XMLNode const&, int version);
53
54         bool soloed () const;
55         void push_solo_upstream (int32_t) {}
56         void push_solo_isolate_upstream (int32_t) {}
57         bool can_solo() const { return true; }
58         bool is_safe () const { return false; }
59
60         bool muted () const;
61         bool can_be_muted_by_others () const { return true; }
62         bool muted_by_others_soloing() const { return false; }
63         bool muted_by_others() const { return false; }
64
65         static std::string default_name_template ();
66         static int next_vca_number ();
67         static std::string xml_node_name;
68
69         /* used by Session to save/restore the atomic counter */
70         static uint32_t get_next_vca_number ();
71         static void set_next_vca_number (uint32_t);
72
73         virtual boost::shared_ptr<GainControl> gain_control() const { return _gain_control; }
74         virtual boost::shared_ptr<SoloControl> solo_control() const { return _solo_control; }
75         virtual boost::shared_ptr<MuteControl> mute_control() const { return _mute_control; }
76
77         /* null Stripable API, because VCAs don't have any of this */
78
79         virtual boost::shared_ptr<PeakMeter>         peak_meter() { return boost::shared_ptr<PeakMeter>(); }
80         virtual boost::shared_ptr<const PeakMeter>   peak_meter() const { return boost::shared_ptr<PeakMeter>(); }
81         virtual boost::shared_ptr<PhaseControl>      phase_control() const { return boost::shared_ptr<PhaseControl>(); }
82         virtual boost::shared_ptr<GainControl>       trim_control() const { return boost::shared_ptr<GainControl>(); }
83         virtual boost::shared_ptr<MonitorControl>    monitoring_control() const { return boost::shared_ptr<MonitorControl>(); }
84         virtual boost::shared_ptr<AutomationControl> recenable_control() const { return boost::shared_ptr<AutomationControl>(); }
85         virtual boost::shared_ptr<AutomationControl> pan_azimuth_control() const { return boost::shared_ptr<AutomationControl>(); }
86         virtual boost::shared_ptr<AutomationControl> pan_elevation_control() const { return boost::shared_ptr<AutomationControl>(); }
87         virtual boost::shared_ptr<AutomationControl> pan_width_control() const { return boost::shared_ptr<AutomationControl>(); }
88         virtual boost::shared_ptr<AutomationControl> pan_frontback_control() const { return boost::shared_ptr<AutomationControl>(); }
89         virtual boost::shared_ptr<AutomationControl> pan_lfe_control() const { return boost::shared_ptr<AutomationControl>(); }
90         virtual uint32_t eq_band_cnt () const { return 0; }
91         virtual std::string eq_band_name (uint32_t) const { return std::string(); }
92         virtual boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t band) const { return boost::shared_ptr<AutomationControl>(); }
93         virtual boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t band) const { return boost::shared_ptr<AutomationControl>(); }
94         virtual boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t band) const { return boost::shared_ptr<AutomationControl>(); }
95         virtual boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t band) const { return boost::shared_ptr<AutomationControl>(); }
96         virtual boost::shared_ptr<AutomationControl> eq_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
97         virtual boost::shared_ptr<AutomationControl> eq_hpf_controllable () const { return boost::shared_ptr<AutomationControl>(); }
98         virtual boost::shared_ptr<AutomationControl> comp_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
99         virtual boost::shared_ptr<AutomationControl> comp_threshold_controllable () const { return boost::shared_ptr<AutomationControl>(); }
100         virtual boost::shared_ptr<AutomationControl> comp_speed_controllable () const { return boost::shared_ptr<AutomationControl>(); }
101         virtual boost::shared_ptr<AutomationControl> comp_mode_controllable () const { return boost::shared_ptr<AutomationControl>(); }
102         virtual boost::shared_ptr<AutomationControl> comp_makeup_controllable () const { return boost::shared_ptr<AutomationControl>(); }
103         virtual boost::shared_ptr<AutomationControl> comp_redux_controllable () const { return boost::shared_ptr<AutomationControl>(); }
104         virtual std::string comp_mode_name (uint32_t mode) const { return std::string(); }
105         virtual std::string comp_speed_name (uint32_t mode) const { return std::string(); }
106         virtual boost::shared_ptr<AutomationControl> send_level_controllable (uint32_t n) const { return boost::shared_ptr<AutomationControl>(); }
107         virtual boost::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const { return boost::shared_ptr<AutomationControl>(); }
108         virtual std::string send_name (uint32_t n) const { return std::string(); }
109         virtual boost::shared_ptr<AutomationControl> master_send_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
110
111   private:
112         uint32_t    _number;
113
114         boost::shared_ptr<GainControl> _gain_control;
115         boost::shared_ptr<SoloControl> _solo_control;
116         boost::shared_ptr<MuteControl> _mute_control;
117
118         bool _solo_requested;
119         bool _mute_requested;
120
121         static gint next_number;
122
123         void solo_target_going_away (boost::weak_ptr<Route>);
124         void mute_target_going_away (boost::weak_ptr<Route>);
125         bool soloed_locked () const;
126         bool muted_locked () const;
127
128         void set_solo (bool yn);
129         void set_mute (bool yn);
130
131 };
132
133 } /* namespace */
134
135 #endif /* __ardour_vca_h__ */