NO-OP: whitespace
[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
29 #include "pbd/signals.h"
30
31 #include "ardour/presentation_info.h"
32 #include "ardour/session_object.h"
33 #include "ardour/libardour_visibility.h"
34
35 class StripableColorDialog;
36
37 namespace ARDOUR {
38
39 class AutomationControl;
40 class ReadOnlyControl;
41 class GainControl;
42 class PeakMeter;
43 class SoloControl;
44 class MuteControl;
45 class PhaseControl;
46 class SoloIsolateControl;
47 class SoloSafeControl;
48 class MonitorControl;
49 class MonitorProcessor;
50 class RecordEnableControl;
51 class RecordSafeControl;
52
53 /* This is a virtual base class for any object that needs to be potentially
54  * represented by a control-centric user interface using the general model of a
55  * mixing console "strip" - a collection of controls that determine the state
56  * and behaviour of the object.
57  */
58
59 class LIBARDOUR_API Stripable : public SessionObject {
60    public:
61         Stripable (Session& session, std::string const & name, PresentationInfo const &);
62         virtual ~Stripable () {}
63
64         /* XXX
65            midi on/off
66          */
67
68         bool is_auditioner() const { return _presentation_info.flags() & PresentationInfo::Auditioner; }
69         bool is_master() const { return _presentation_info.flags() & PresentationInfo::MasterOut; }
70         bool is_monitor() const { return _presentation_info.flags() & PresentationInfo::MonitorOut; }
71
72         int set_state (XMLNode const&, int);
73
74         bool is_hidden() const { return _presentation_info.flags() & PresentationInfo::Hidden; }
75         bool is_selected() const { return _presentation_info.flags() & PresentationInfo::Selected; }
76
77         PresentationInfo const & presentation_info () const { return _presentation_info; }
78         PresentationInfo& presentation_info () { return _presentation_info; }
79         PresentationInfo* presentation_info_ptr () { return &_presentation_info; }
80
81         /* set just the order */
82
83         void  set_presentation_order (PresentationInfo::order_t);
84
85         struct PresentationOrderSorter {
86                 bool operator() (boost::shared_ptr<Stripable> a, boost::shared_ptr<Stripable> b) {
87                         return a->presentation_info().order() < b->presentation_info().order();
88                 }
89         };
90
91         /* gui's call this for their own purposes. */
92
93         PBD::Signal2<void,std::string,void*> gui_changed;
94
95         /***************************************************************
96          * Pure interface begins here
97          ***************************************************************/
98
99         virtual boost::shared_ptr<PeakMeter>       peak_meter() = 0;
100         virtual boost::shared_ptr<const PeakMeter> peak_meter() const = 0;
101
102         virtual boost::shared_ptr<GainControl> gain_control() const = 0;
103
104         virtual boost::shared_ptr<SoloControl> solo_control() const = 0;
105         virtual boost::shared_ptr<SoloIsolateControl> solo_isolate_control() const = 0;
106         virtual boost::shared_ptr<SoloSafeControl> solo_safe_control() const = 0;
107         virtual boost::shared_ptr<MuteControl> mute_control() const = 0;
108
109         virtual boost::shared_ptr<PhaseControl> phase_control() const = 0;
110         virtual boost::shared_ptr<GainControl> trim_control() const = 0;
111
112         virtual boost::shared_ptr<MonitorControl> monitoring_control() const = 0;
113
114         virtual boost::shared_ptr<AutomationControl> rec_enable_control() const { return boost::shared_ptr<AutomationControl>(); }
115         virtual boost::shared_ptr<AutomationControl> rec_safe_control() const { return boost::shared_ptr<AutomationControl>(); }
116
117         /* "well-known" controls for panning. Any or all of these may return
118          * null.
119          */
120         virtual boost::shared_ptr<AutomationControl> pan_azimuth_control() const = 0;
121         virtual boost::shared_ptr<AutomationControl> pan_elevation_control() const = 0;
122         virtual boost::shared_ptr<AutomationControl> pan_width_control() const = 0;
123         virtual boost::shared_ptr<AutomationControl> pan_frontback_control() const = 0;
124         virtual boost::shared_ptr<AutomationControl> pan_lfe_control() const = 0;
125
126         /* "well-known" controls for an EQ in this route. Any or all may
127          * be null. eq_band_cnt() must return 0 if there is no EQ present.
128          * Passing an @param band value >= eq_band_cnt() will guarantee the
129          * return of a null ptr (or an empty string for eq_band_name()).
130          */
131         virtual uint32_t eq_band_cnt () const = 0;
132         virtual std::string eq_band_name (uint32_t) const = 0;
133         virtual boost::shared_ptr<AutomationControl> eq_gain_controllable (uint32_t band) const = 0;
134         virtual boost::shared_ptr<AutomationControl> eq_freq_controllable (uint32_t band) const = 0;
135         virtual boost::shared_ptr<AutomationControl> eq_q_controllable (uint32_t band) const = 0;
136         virtual boost::shared_ptr<AutomationControl> eq_shape_controllable (uint32_t band) const = 0;
137         virtual boost::shared_ptr<AutomationControl> eq_enable_controllable () const = 0;
138         virtual boost::shared_ptr<AutomationControl> eq_hpf_controllable () const = 0;
139
140         /* "well-known" controls for a compressor in this route. Any or all may
141          * be null.
142          */
143         virtual boost::shared_ptr<AutomationControl> comp_enable_controllable () const = 0;
144         virtual boost::shared_ptr<AutomationControl> comp_threshold_controllable () const = 0;
145         virtual boost::shared_ptr<AutomationControl> comp_speed_controllable () const = 0;
146         virtual boost::shared_ptr<AutomationControl> comp_mode_controllable () const = 0;
147         virtual boost::shared_ptr<AutomationControl> comp_makeup_controllable () const = 0;
148         virtual boost::shared_ptr<ReadOnlyControl>   comp_redux_controllable () const = 0;
149
150         /* @param mode must be supplied by the comp_mode_controllable(). All other values
151          * result in undefined behaviour
152          */
153         virtual std::string comp_mode_name (uint32_t mode) const = 0;
154
155         /* @param mode - as for comp mode name. This returns the name for the
156          * parameter/control accessed via comp_speed_controllable(), which can
157          * be mode dependent.
158          */
159         virtual std::string comp_speed_name (uint32_t mode) const = 0;
160
161         /* "well-known" controls for sends to well-known busses in this route. Any or all may
162          * be null.
163          *
164          * In Mixbus, these are the sends that connect to the mixbusses.
165          * In Ardour, these are user-created sends that connect to user-created
166          * Aux busses.
167          */
168         virtual boost::shared_ptr<AutomationControl> send_level_controllable (uint32_t n) const = 0;
169         virtual boost::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const = 0;
170
171         /* for the same value of @param n, this returns the name of the send
172          * associated with the pair of controllables returned by the above two methods.
173          */
174         virtual std::string send_name (uint32_t n) const = 0;
175
176         /* well known control that enables/disables sending to the master bus.
177          *
178          * In Ardour, this returns null.
179          * In Mixbus, it will return a suitable control, or null depending on
180          * the route.
181          */
182         virtual boost::shared_ptr<AutomationControl> master_send_enable_controllable () const = 0;
183
184         virtual bool muted_by_others_soloing () const = 0;
185
186         virtual boost::shared_ptr<MonitorProcessor> monitor_control() const = 0;
187
188         StripableColorDialog* active_color_picker() const { return _active_color_picker; }
189         void set_active_color_picker (StripableColorDialog* d) { _active_color_picker = d; }
190
191   protected:
192         PresentationInfo _presentation_info;
193         private:
194         StripableColorDialog* _active_color_picker;
195 };
196
197 }
198
199 #endif /* __libardour_stripable_h__ */