Add ListenBus to stripable types
[ardour.git] / libs / ardour / ardour / stripable.h
1 /*
2   Copyright (C) 2016 Paul Davis
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13
14   You should have received a copy of the GNU General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __libardour_stripable_h__
21 #define __libardour_stripable_h__
22
23 #include <stdint.h>
24
25 #include <string>
26 #include <boost/utility.hpp>
27 #include <boost/shared_ptr.hpp>
28 #include <boost/enable_shared_from_this.hpp>
29
30 #include "pbd/signals.h"
31
32 #include "ardour/automatable.h"
33 #include "ardour/presentation_info.h"
34 #include "ardour/session_object.h"
35 #include "ardour/libardour_visibility.h"
36
37 class StripableColorDialog;
38
39 namespace ARDOUR {
40
41 class AutomationControl;
42 class ReadOnlyControl;
43 class GainControl;
44 class PeakMeter;
45 class SoloControl;
46 class MuteControl;
47 class PhaseControl;
48 class SoloIsolateControl;
49 class SoloSafeControl;
50 class MonitorControl;
51 class MonitorProcessor;
52 class RecordEnableControl;
53 class RecordSafeControl;
54
55 /* This is a virtual base class for any object that needs to be potentially
56  * represented by a control-centric user interface using the general model of a
57  * mixing console "strip" - a collection of controls that determine the state
58  * and behaviour of the object.
59  */
60
61 class LIBARDOUR_API Stripable : public SessionObject,
62                                 public Automatable,
63                                 public boost::enable_shared_from_this<Stripable>
64 {
65   public:
66         Stripable (Session& session, std::string const & name, PresentationInfo const &);
67         virtual ~Stripable ();
68
69         /* XXX
70            midi on/off
71          */
72
73         bool is_auditioner() const { return _presentation_info.flags() & PresentationInfo::Auditioner; }
74         bool is_private_route() const { return is_auditioner(); }
75         bool is_master() const { return _presentation_info.flags() & PresentationInfo::MasterOut; }
76         bool is_monitor() const { return _presentation_info.flags() & PresentationInfo::MonitorOut; }
77         bool is_listenbus() const { return _presentation_info.flags() & PresentationInfo::ListenBus; }
78
79         int set_state (XMLNode const&, int);
80
81         bool is_hidden() const { return _presentation_info.flags() & PresentationInfo::Hidden; }
82         bool is_selected() const;
83
84         PresentationInfo const & presentation_info () const { return _presentation_info; }
85         PresentationInfo& presentation_info () { return _presentation_info; }
86         PresentationInfo* presentation_info_ptr () { return &_presentation_info; }
87
88         /* set just the order */
89
90         void  set_presentation_order (PresentationInfo::order_t);
91
92         struct LIBARDOUR_API Sorter
93         {
94                 bool _mixer_order; // master is last
95                 Sorter (bool mixer_order = false) : _mixer_order (mixer_order) {}
96                 bool operator() (boost::shared_ptr<ARDOUR::Stripable> a, boost::shared_ptr<ARDOUR::Stripable> b);
97         };
98
99         /* gui's call this for their own purposes. */
100
101         PBD::Signal2<void,std::string,void*> gui_changed;
102
103         /***************************************************************
104          * Pure interface begins here
105          ***************************************************************/
106
107         virtual boost::shared_ptr<PeakMeter>       peak_meter() = 0;
108         virtual boost::shared_ptr<const PeakMeter> peak_meter() const = 0;
109
110         virtual boost::shared_ptr<GainControl> gain_control() const = 0;
111
112         virtual boost::shared_ptr<SoloControl> solo_control() const = 0;
113         virtual boost::shared_ptr<SoloIsolateControl> solo_isolate_control() const = 0;
114         virtual boost::shared_ptr<SoloSafeControl> solo_safe_control() const = 0;
115         virtual boost::shared_ptr<MuteControl> mute_control() const = 0;
116
117         virtual boost::shared_ptr<PhaseControl> phase_control() const = 0;
118         virtual boost::shared_ptr<GainControl> trim_control() const = 0;
119
120         virtual boost::shared_ptr<MonitorControl> monitoring_control() const = 0;
121
122         virtual boost::shared_ptr<AutomationControl> rec_enable_control() const { return boost::shared_ptr<AutomationControl>(); }
123         virtual boost::shared_ptr<AutomationControl> rec_safe_control() const { return boost::shared_ptr<AutomationControl>(); }
124
125         virtual bool slaved_to (boost::shared_ptr<VCA>) const = 0;
126         virtual bool slaved () const = 0;
127
128         /* "well-known" controls for panning. Any or all of these may return
129          * null.
130          */
131         virtual boost::shared_ptr<AutomationControl> pan_azimuth_control() const = 0;
132         virtual boost::shared_ptr<AutomationControl> pan_elevation_control() const = 0;
133         virtual boost::shared_ptr<AutomationControl> pan_width_control() const = 0;
134         virtual boost::shared_ptr<AutomationControl> pan_frontback_control() const = 0;
135         virtual boost::shared_ptr<AutomationControl> pan_lfe_control() const = 0;
136
137         /* "well-known" controls for an EQ in this route. Any or all may
138          * be null. eq_band_cnt() must return 0 if there is no EQ present.
139          * Passing an @param band value >= eq_band_cnt() will guarantee the
140          * return of a null ptr (or an empty string for eq_band_name()).
141          */
142         virtual uint32_t eq_band_cnt () const = 0;
143         virtual boost::shared_ptr<AutomationControl> eq_enable_controllable () const = 0;
144         virtual std::string eq_band_name (uint32_t) const = 0;
145         virtual boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t band) const = 0;
146         virtual boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t band) const = 0;
147         virtual boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t band) const = 0;
148         virtual boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t band) const = 0;
149
150         virtual boost::shared_ptr<AutomationControl> filter_freq_controllable (bool hp /* false for LPF*/) const = 0;
151         virtual boost::shared_ptr<AutomationControl> filter_slope_controllable (bool hp) const = 0;
152         virtual boost::shared_ptr<AutomationControl> filter_enable_controllable (bool hp) const = 0;
153
154         virtual boost::shared_ptr<AutomationControl> tape_drive_controllable () const { return boost::shared_ptr<AutomationControl>(); }
155
156         /* "well-known" controls for a compressor in this route. Any or all may
157          * be null.
158          */
159         virtual boost::shared_ptr<AutomationControl> comp_enable_controllable () const = 0;
160         virtual boost::shared_ptr<AutomationControl> comp_threshold_controllable () const = 0;
161         virtual boost::shared_ptr<AutomationControl> comp_speed_controllable () const = 0;
162         virtual boost::shared_ptr<AutomationControl> comp_mode_controllable () const = 0;
163         virtual boost::shared_ptr<AutomationControl> comp_makeup_controllable () const = 0;
164         virtual boost::shared_ptr<ReadOnlyControl>   comp_redux_controllable () const = 0;
165
166         /* @param mode must be supplied by the comp_mode_controllable(). All other values
167          * result in undefined behaviour
168          */
169         virtual std::string comp_mode_name (uint32_t mode) const = 0;
170
171         /* @param mode - as for comp mode name. This returns the name for the
172          * parameter/control accessed via comp_speed_controllable(), which can
173          * be mode dependent.
174          */
175         virtual std::string comp_speed_name (uint32_t mode) const = 0;
176
177         /* "well-known" controls for sends to well-known busses in this route. Any or all may
178          * be null.
179          *
180          * In Mixbus, these are the sends that connect to the mixbusses.
181          * In Ardour, these are user-created sends that connect to user-created
182          * Aux busses.
183          */
184         virtual boost::shared_ptr<AutomationControl> send_level_controllable (uint32_t n) const = 0;
185         virtual boost::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const = 0;
186         virtual boost::shared_ptr<AutomationControl> send_pan_azi_controllable (uint32_t n) const = 0;
187
188         /* for the same value of @param n, this returns the name of the send
189          * associated with the pair of controllables returned by the above two methods.
190          */
191         virtual std::string send_name (uint32_t n) const = 0;
192
193         /* well known control that enables/disables sending to the master bus.
194          *
195          * In Ardour, this returns null.
196          * In Mixbus, it will return a suitable control, or null depending on
197          * the route.
198          */
199         virtual boost::shared_ptr<AutomationControl> master_send_enable_controllable () const = 0;
200
201         virtual bool muted_by_others_soloing () const = 0;
202
203         virtual boost::shared_ptr<MonitorProcessor> monitor_control() const = 0;
204
205         StripableColorDialog* active_color_picker() const { return _active_color_picker; }
206         void set_active_color_picker (StripableColorDialog* d) { _active_color_picker = d; }
207
208   protected:
209         PresentationInfo _presentation_info;
210         private:
211         StripableColorDialog* _active_color_picker;
212 };
213
214 }
215
216 #endif /* __libardour_stripable_h__ */