Ardour  9.0-pre0-582-g084a23a80d
stripable.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
4  * Copyright (C) 2017 Ben Loftis <ben@harrisonconsoles.com>
5  * Copyright (C) 2018 Len Ovens <len@ovenwerks.net>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #pragma once
23 
24 #include <cstdint>
25 #include <memory>
26 #include <string>
27 
28 #include "pbd/signals.h"
29 
30 #include "ardour/automatable.h"
32 #include "ardour/session_object.h"
34 
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 enum WellKnownCtrl : int;
54 enum WellKnownData : int;
55 
56 /* This is a virtual base class for any object that needs to be potentially
57  * represented by a control-centric user interface using the general model of a
58  * mixing console "strip" - a collection of controls that determine the state
59  * and behaviour of the object.
60  */
61 
63  public Automatable,
64  public std::enable_shared_from_this<Stripable>
65 {
66  public:
67  Stripable (Session& session, std::string const & name, PresentationInfo const &);
68  virtual ~Stripable ();
69 
70  /* XXX
71  midi on/off
72  */
73 
74  bool is_auditioner() const { return _presentation_info.flags() & PresentationInfo::Auditioner; }
75  bool is_private_route() const { return is_auditioner(); }
76  bool is_master() const { return _presentation_info.flags() & PresentationInfo::MasterOut; }
77  bool is_monitor() const { return _presentation_info.flags() & PresentationInfo::MonitorOut; }
78  bool is_foldbackbus() const { return _presentation_info.flags() & PresentationInfo::FoldbackBus; }
79  bool is_surround_master() const { return _presentation_info.flags() & PresentationInfo::SurroundMaster; }
80  bool is_main_bus() const { return _presentation_info.flags() & PresentationInfo::MainBus; }
81  bool is_singleton () const { return _presentation_info.flags() & PresentationInfo::Singleton; }
82 
83  int set_state (XMLNode const&, int);
84 
85  bool is_hidden() const { return _presentation_info.flags() & PresentationInfo::Hidden; }
86  bool is_selected() const;
87 
88  PresentationInfo const & presentation_info () const { return _presentation_info; }
89  PresentationInfo& presentation_info () { return _presentation_info; }
90  PresentationInfo* presentation_info_ptr () { return &_presentation_info; }
91 
92  /* set just the order */
93 
95 
97  {
98  bool _mixer_order; // master is last
99  Sorter (bool mixer_order = false) : _mixer_order (mixer_order) {}
100  bool operator() (std::shared_ptr<ARDOUR::Stripable> a, std::shared_ptr<ARDOUR::Stripable> b);
101  };
102 
103  /* gui's call this for their own purposes. */
104 
105  PBD::Signal<void(std::string,void*)> gui_changed;
106 
107  /* *************************************************************
108  * Pure interface begins here
109  ***************************************************************/
110 
111  virtual std::shared_ptr<PeakMeter> peak_meter() = 0;
112  virtual std::shared_ptr<const PeakMeter> peak_meter() const = 0;
113 
114  virtual std::shared_ptr<GainControl> gain_control() const = 0;
115 
116  virtual std::shared_ptr<SoloControl> solo_control() const = 0;
117  virtual std::shared_ptr<SoloIsolateControl> solo_isolate_control() const = 0;
118  virtual std::shared_ptr<SoloSafeControl> solo_safe_control() const = 0;
119  virtual std::shared_ptr<MuteControl> mute_control() const = 0;
120 
121  virtual std::shared_ptr<PhaseControl> phase_control() const = 0;
122  virtual std::shared_ptr<GainControl> trim_control() const = 0;
123 
124  virtual std::shared_ptr<MonitorControl> monitoring_control() const = 0;
125 
126  virtual std::shared_ptr<AutomationControl> rec_enable_control() const { return std::shared_ptr<AutomationControl>(); }
127  virtual std::shared_ptr<AutomationControl> rec_safe_control() const { return std::shared_ptr<AutomationControl>(); }
128 
129  virtual bool slaved_to (std::shared_ptr<VCA>) const = 0;
130  virtual bool slaved () const = 0;
131 
132  /* "well-known" controls for panning. Any or all of these may return
133  * null.
134  */
135  virtual std::shared_ptr<AutomationControl> pan_azimuth_control() const = 0;
136  virtual std::shared_ptr<AutomationControl> pan_elevation_control() const = 0;
137  virtual std::shared_ptr<AutomationControl> pan_width_control() const = 0;
138  virtual std::shared_ptr<AutomationControl> pan_frontback_control() const = 0;
139  virtual std::shared_ptr<AutomationControl> pan_lfe_control() const = 0;
140 
141  /* "well-known" controls. Any or all may NULL. */
142  virtual uint32_t eq_band_cnt () const = 0;
143  virtual std::string eq_band_name (uint32_t) const = 0;
144 
145  virtual std::shared_ptr<AutomationControl> mapped_control (enum WellKnownCtrl, uint32_t band = 0) const = 0;
146  virtual std::shared_ptr<ReadOnlyControl> mapped_output (enum WellKnownData) const = 0;
147 
148  /* ACs mapped to any control have changed. API user is to drop references,
149  * and query mapped ctrl again
150  */
152 
153  /* "well-known" controls for sends to well-known busses in this route. Any or all may
154  * be null.
155  *
156  * In Mixbus, these are the sends that connect to the mixbusses.
157  * In Ardour, these are user-created sends that connect to user-created
158  * Aux busses.
159  */
160  virtual std::shared_ptr<AutomationControl> send_level_controllable (uint32_t n, bool locked = false) const = 0;
161  virtual std::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const = 0;
162  virtual std::shared_ptr<AutomationControl> send_pan_azimuth_controllable (uint32_t n) const = 0;
163  virtual std::shared_ptr<AutomationControl> send_pan_azimuth_enable_controllable (uint32_t n) const = 0;
164 
165  /* for the same value of @p n, this returns the name of the send
166  * associated with the pair of controllables returned by the above two methods.
167  */
168  virtual std::string send_name (uint32_t n) const = 0;
169 
170  /* well known control that enables/disables sending to the master bus.
171  *
172  * In Ardour, this returns null.
173  * In Mixbus, it will return a suitable control, or null depending on
174  * the route.
175  */
176  virtual std::shared_ptr<AutomationControl> master_send_enable_controllable () const = 0;
177 
178  virtual bool muted_by_others_soloing () const = 0;
179 
180  virtual std::shared_ptr<MonitorProcessor> monitor_control() const = 0;
181 
182  StripableColorDialog* active_color_picker() const { return _active_color_picker; }
183  void set_active_color_picker (StripableColorDialog* d) { _active_color_picker = d; }
184 
185  protected:
187 
188  private:
190 };
191 
192 }
193 
virtual std::shared_ptr< AutomationControl > master_send_enable_controllable() const =0
virtual std::shared_ptr< SoloIsolateControl > solo_isolate_control() const =0
virtual std::shared_ptr< GainControl > trim_control() const =0
virtual std::shared_ptr< MonitorControl > monitoring_control() const =0
virtual std::string send_name(uint32_t n) const =0
virtual std::shared_ptr< AutomationControl > pan_width_control() const =0
int set_state(XMLNode const &, int)
virtual bool slaved() const =0
bool is_monitor() const
Definition: stripable.h:77
bool is_private_route() const
Definition: stripable.h:75
PresentationInfo const & presentation_info() const
Definition: stripable.h:88
bool is_surround_master() const
Definition: stripable.h:79
PresentationInfo _presentation_info
Definition: stripable.h:186
virtual std::shared_ptr< AutomationControl > pan_elevation_control() const =0
virtual std::shared_ptr< AutomationControl > rec_enable_control() const
Definition: stripable.h:126
virtual std::shared_ptr< AutomationControl > send_enable_controllable(uint32_t n) const =0
virtual std::shared_ptr< AutomationControl > send_pan_azimuth_enable_controllable(uint32_t n) const =0
virtual std::shared_ptr< AutomationControl > rec_safe_control() const
Definition: stripable.h:127
virtual std::shared_ptr< SoloSafeControl > solo_safe_control() const =0
virtual std::shared_ptr< const PeakMeter > peak_meter() const =0
void set_active_color_picker(StripableColorDialog *d)
Definition: stripable.h:183
virtual std::shared_ptr< AutomationControl > pan_lfe_control() const =0
virtual std::shared_ptr< AutomationControl > pan_azimuth_control() const =0
PresentationInfo & presentation_info()
Definition: stripable.h:89
virtual std::shared_ptr< AutomationControl > send_pan_azimuth_controllable(uint32_t n) const =0
bool is_hidden() const
Definition: stripable.h:85
bool is_selected() const
bool is_foldbackbus() const
Definition: stripable.h:78
virtual std::shared_ptr< AutomationControl > mapped_control(enum WellKnownCtrl, uint32_t band=0) const =0
virtual std::shared_ptr< AutomationControl > pan_frontback_control() const =0
virtual uint32_t eq_band_cnt() const =0
StripableColorDialog * active_color_picker() const
Definition: stripable.h:182
virtual std::shared_ptr< GainControl > gain_control() const =0
virtual std::shared_ptr< PeakMeter > peak_meter()=0
bool is_master() const
Definition: stripable.h:76
virtual ~Stripable()
virtual std::shared_ptr< AutomationControl > send_level_controllable(uint32_t n, bool locked=false) const =0
virtual std::shared_ptr< SoloControl > solo_control() const =0
Stripable(Session &session, std::string const &name, PresentationInfo const &)
virtual std::shared_ptr< PhaseControl > phase_control() const =0
bool is_singleton() const
Definition: stripable.h:81
virtual std::string eq_band_name(uint32_t) const =0
virtual bool slaved_to(std::shared_ptr< VCA >) const =0
StripableColorDialog * _active_color_picker
Definition: stripable.h:189
PresentationInfo * presentation_info_ptr()
Definition: stripable.h:90
bool is_main_bus() const
Definition: stripable.h:80
bool is_auditioner() const
Definition: stripable.h:74
void set_presentation_order(PresentationInfo::order_t)
virtual std::shared_ptr< MuteControl > mute_control() const =0
virtual bool muted_by_others_soloing() const =0
PBD::Signal< void(std::string, void *)> gui_changed
Definition: stripable.h:105
virtual std::shared_ptr< MonitorProcessor > monitor_control() const =0
virtual std::shared_ptr< ReadOnlyControl > mapped_output(enum WellKnownData) const =0
PBD::Signal< void()> MappedControlsChanged
Definition: stripable.h:151
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
void session(lua_State *L)
PBD::PropertyDescriptor< bool > locked
Sorter(bool mixer_order=false)
Definition: stripable.h:99