Only show user-presets in favorite sidebar
[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 <glibmm/threads.h>
27
28 #include "pbd/controllable.h"
29 #include "pbd/statefuldestructible.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();
61         int set_state (XMLNode const&, int version);
62
63         PBD::Signal0<void> Drop; /* signal to slaves to drop control by this VCA */
64
65         /* Slavable API */
66
67         void assign (boost::shared_ptr<VCA>);
68
69         bool slaved_to (boost::shared_ptr<VCA>) const;
70         bool slaved () const;
71
72         /* Soloable API */
73
74         void clear_all_solo_state ();
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 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
95         MonitorState monitoring_state() const;
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         boost::shared_ptr<GainControl> gain_control() const { return _gain_control; }
106         boost::shared_ptr<SoloControl> solo_control() const { return _solo_control; }
107         boost::shared_ptr<MuteControl> mute_control() const { return _mute_control; }
108
109         /* null Stripable API, because VCAs don't have any of this */
110
111         boost::shared_ptr<SoloIsolateControl> solo_isolate_control() const { return boost::shared_ptr<SoloIsolateControl>(); }
112         boost::shared_ptr<SoloSafeControl> solo_safe_control() const { return boost::shared_ptr<SoloSafeControl>(); }
113         boost::shared_ptr<PeakMeter>         peak_meter() { return boost::shared_ptr<PeakMeter>(); }
114         boost::shared_ptr<const PeakMeter>   peak_meter() const { return boost::shared_ptr<PeakMeter>(); }
115         boost::shared_ptr<PhaseControl>      phase_control() const { return boost::shared_ptr<PhaseControl>(); }
116         boost::shared_ptr<GainControl>       trim_control() const { return boost::shared_ptr<GainControl>(); }
117         boost::shared_ptr<AutomationControl> pan_azimuth_control() const { return boost::shared_ptr<AutomationControl>(); }
118         boost::shared_ptr<AutomationControl> pan_elevation_control() const { return boost::shared_ptr<AutomationControl>(); }
119         boost::shared_ptr<AutomationControl> pan_width_control() const { return boost::shared_ptr<AutomationControl>(); }
120         boost::shared_ptr<AutomationControl> pan_frontback_control() const { return boost::shared_ptr<AutomationControl>(); }
121         boost::shared_ptr<AutomationControl> pan_lfe_control() const { return boost::shared_ptr<AutomationControl>(); }
122         uint32_t eq_band_cnt () const { return 0; }
123         std::string eq_band_name (uint32_t) const { return std::string(); }
124         boost::shared_ptr<AutomationControl> eq_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
125         boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); }
126         boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); }
127         boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); }
128         boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t) const { return boost::shared_ptr<AutomationControl>(); }
129         boost::shared_ptr<AutomationControl> filter_freq_controllable (bool) const { return boost::shared_ptr<AutomationControl>(); }
130         boost::shared_ptr<AutomationControl> filter_slope_controllable (bool) const { return boost::shared_ptr<AutomationControl>(); }
131         boost::shared_ptr<AutomationControl> filter_enable_controllable (bool) const { return boost::shared_ptr<AutomationControl>(); }
132         boost::shared_ptr<AutomationControl> comp_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
133         boost::shared_ptr<AutomationControl> comp_threshold_controllable () const { return boost::shared_ptr<AutomationControl>(); }
134         boost::shared_ptr<AutomationControl> comp_speed_controllable () const { return boost::shared_ptr<AutomationControl>(); }
135         boost::shared_ptr<AutomationControl> comp_mode_controllable () const { return boost::shared_ptr<AutomationControl>(); }
136         boost::shared_ptr<AutomationControl> comp_makeup_controllable () const { return boost::shared_ptr<AutomationControl>(); }
137         boost::shared_ptr<ReadOnlyControl>   comp_redux_controllable () const { return boost::shared_ptr<ReadOnlyControl>(); }
138         std::string comp_mode_name (uint32_t mode) const { return std::string(); }
139         std::string comp_speed_name (uint32_t mode) const { return std::string(); }
140         boost::shared_ptr<AutomationControl> send_level_controllable (uint32_t n) const { return boost::shared_ptr<AutomationControl>(); }
141         boost::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const { return boost::shared_ptr<AutomationControl>(); }
142         boost::shared_ptr<AutomationControl> send_pan_azi_controllable (uint32_t n) const { return boost::shared_ptr<AutomationControl>(); }
143         std::string send_name (uint32_t n) const { return std::string(); }
144         boost::shared_ptr<AutomationControl> master_send_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
145         boost::shared_ptr<MonitorProcessor> monitor_control() const { return boost::shared_ptr<MonitorProcessor>(); }
146         boost::shared_ptr<MonitorControl> monitoring_control() const { return boost::shared_ptr<MonitorControl>(); }
147
148         //additional filter params (currently 32C only )
149         boost::shared_ptr<AutomationControl> eq_lpf_controllable () const { return boost::shared_ptr<AutomationControl>(); }
150         boost::shared_ptr<AutomationControl> filter_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
151
152         protected:
153         SlavableControlList slavables () const;
154
155   private:
156         int32_t _number;
157
158         boost::shared_ptr<GainControl> _gain_control;
159         boost::shared_ptr<SoloControl> _solo_control;
160         boost::shared_ptr<MuteControl> _mute_control;
161
162
163         static int32_t next_number;
164         static Glib::Threads::Mutex number_lock;
165
166         void solo_target_going_away (boost::weak_ptr<Route>);
167         void mute_target_going_away (boost::weak_ptr<Route>);
168         bool soloed_locked () const;
169         bool muted_locked () const;
170 };
171
172 } /* namespace */
173
174 #endif /* __ardour_vca_h__ */