Ardour  8.7-14-g57a6773833
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 #ifndef __libardour_stripable_h__
23 #define __libardour_stripable_h__
24 
25 #include <cstdint>
26 #include <memory>
27 #include <string>
28 
29 #include "pbd/signals.h"
30 
31 #include "ardour/automatable.h"
33 #include "ardour/session_object.h"
35 
37 
38 namespace ARDOUR {
39 
40 class AutomationControl;
41 class ReadOnlyControl;
42 class GainControl;
43 class PeakMeter;
44 class SoloControl;
45 class MuteControl;
46 class PhaseControl;
47 class SoloIsolateControl;
48 class SoloSafeControl;
49 class MonitorControl;
50 class MonitorProcessor;
51 class RecordEnableControl;
52 class RecordSafeControl;
53 
54 enum WellKnownCtrl : int;
55 enum WellKnownData : int;
56 
57 /* This is a virtual base class for any object that needs to be potentially
58  * represented by a control-centric user interface using the general model of a
59  * mixing console "strip" - a collection of controls that determine the state
60  * and behaviour of the object.
61  */
62 
64  public Automatable,
65  public std::enable_shared_from_this<Stripable>
66 {
67  public:
68  Stripable (Session& session, std::string const & name, PresentationInfo const &);
69  virtual ~Stripable ();
70 
71  /* XXX
72  midi on/off
73  */
74 
75  bool is_auditioner() const { return _presentation_info.flags() & PresentationInfo::Auditioner; }
76  bool is_private_route() const { return is_auditioner(); }
77  bool is_master() const { return _presentation_info.flags() & PresentationInfo::MasterOut; }
78  bool is_monitor() const { return _presentation_info.flags() & PresentationInfo::MonitorOut; }
79  bool is_foldbackbus() const { return _presentation_info.flags() & PresentationInfo::FoldbackBus; }
80  bool is_surround_master() const { return _presentation_info.flags() & PresentationInfo::SurroundMaster; }
81  bool is_main_bus() const { return _presentation_info.flags() & PresentationInfo::MainBus; }
82  bool is_singleton () const { return _presentation_info.flags() & PresentationInfo::Singleton; }
83 
84  int set_state (XMLNode const&, int);
85 
86  bool is_hidden() const { return _presentation_info.flags() & PresentationInfo::Hidden; }
87  bool is_selected() const;
88 
89  PresentationInfo const & presentation_info () const { return _presentation_info; }
90  PresentationInfo& presentation_info () { return _presentation_info; }
91  PresentationInfo* presentation_info_ptr () { return &_presentation_info; }
92 
93  /* set just the order */
94 
96 
98  {
99  bool _mixer_order; // master is last
100  Sorter (bool mixer_order = false) : _mixer_order (mixer_order) {}
101  bool operator() (std::shared_ptr<ARDOUR::Stripable> a, std::shared_ptr<ARDOUR::Stripable> b);
102  };
103 
104  /* gui's call this for their own purposes. */
105 
106  PBD::Signal2<void,std::string,void*> gui_changed;
107 
108  /* *************************************************************
109  * Pure interface begins here
110  ***************************************************************/
111 
112  virtual std::shared_ptr<PeakMeter> peak_meter() = 0;
113  virtual std::shared_ptr<const PeakMeter> peak_meter() const = 0;
114 
115  virtual std::shared_ptr<GainControl> gain_control() const = 0;
116 
117  virtual std::shared_ptr<SoloControl> solo_control() const = 0;
118  virtual std::shared_ptr<SoloIsolateControl> solo_isolate_control() const = 0;
119  virtual std::shared_ptr<SoloSafeControl> solo_safe_control() const = 0;
120  virtual std::shared_ptr<MuteControl> mute_control() const = 0;
121 
122  virtual std::shared_ptr<PhaseControl> phase_control() const = 0;
123  virtual std::shared_ptr<GainControl> trim_control() const = 0;
124 
125  virtual std::shared_ptr<MonitorControl> monitoring_control() const = 0;
126 
127  virtual std::shared_ptr<AutomationControl> rec_enable_control() const { return std::shared_ptr<AutomationControl>(); }
128  virtual std::shared_ptr<AutomationControl> rec_safe_control() const { return std::shared_ptr<AutomationControl>(); }
129 
130  virtual bool slaved_to (std::shared_ptr<VCA>) const = 0;
131  virtual bool slaved () const = 0;
132 
133  /* "well-known" controls for panning. Any or all of these may return
134  * null.
135  */
136  virtual std::shared_ptr<AutomationControl> pan_azimuth_control() const = 0;
137  virtual std::shared_ptr<AutomationControl> pan_elevation_control() const = 0;
138  virtual std::shared_ptr<AutomationControl> pan_width_control() const = 0;
139  virtual std::shared_ptr<AutomationControl> pan_frontback_control() const = 0;
140  virtual std::shared_ptr<AutomationControl> pan_lfe_control() const = 0;
141 
142  /* "well-known" controls. Any or all may NULL. */
143  virtual uint32_t eq_band_cnt () const = 0;
144  virtual std::string eq_band_name (uint32_t) const = 0;
145 
146  virtual std::shared_ptr<AutomationControl> mapped_control (enum WellKnownCtrl, uint32_t band = 0) const = 0;
147  virtual std::shared_ptr<ReadOnlyControl> mapped_output (enum WellKnownData) const = 0;
148 
149  /* ACs mapped to any control have changed. API user is to drop references,
150  * and query mapped ctrl again
151  */
152  PBD::Signal0<void> MappedControlsChanged;
153 
154  /* "well-known" controls for sends to well-known busses in this route. Any or all may
155  * be null.
156  *
157  * In Mixbus, these are the sends that connect to the mixbusses.
158  * In Ardour, these are user-created sends that connect to user-created
159  * Aux busses.
160  */
161  virtual std::shared_ptr<AutomationControl> send_level_controllable (uint32_t n) const = 0;
162  virtual std::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const = 0;
163  virtual std::shared_ptr<AutomationControl> send_pan_azimuth_controllable (uint32_t n) const = 0;
164  virtual std::shared_ptr<AutomationControl> send_pan_azimuth_enable_controllable (uint32_t n) const = 0;
165 
166  /* for the same value of @p n, this returns the name of the send
167  * associated with the pair of controllables returned by the above two methods.
168  */
169  virtual std::string send_name (uint32_t n) const = 0;
170 
171  /* well known control that enables/disables sending to the master bus.
172  *
173  * In Ardour, this returns null.
174  * In Mixbus, it will return a suitable control, or null depending on
175  * the route.
176  */
177  virtual std::shared_ptr<AutomationControl> master_send_enable_controllable () const = 0;
178 
179  virtual bool muted_by_others_soloing () const = 0;
180 
181  virtual std::shared_ptr<MonitorProcessor> monitor_control() const = 0;
182 
183  StripableColorDialog* active_color_picker() const { return _active_color_picker; }
184  void set_active_color_picker (StripableColorDialog* d) { _active_color_picker = d; }
185 
186  protected:
188 
189  private:
191 };
192 
193 }
194 
195 #endif /* __libardour_stripable_h__ */
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)
PBD::Signal0< void > MappedControlsChanged
Definition: stripable.h:152
virtual bool slaved() const =0
bool is_monitor() const
Definition: stripable.h:78
bool is_private_route() const
Definition: stripable.h:76
PresentationInfo const & presentation_info() const
Definition: stripable.h:89
bool is_surround_master() const
Definition: stripable.h:80
PBD::Signal2< void, std::string, void * > gui_changed
Definition: stripable.h:106
PresentationInfo _presentation_info
Definition: stripable.h:187
virtual std::shared_ptr< AutomationControl > pan_elevation_control() const =0
virtual std::shared_ptr< AutomationControl > rec_enable_control() const
Definition: stripable.h:127
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:128
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:184
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:90
virtual std::shared_ptr< AutomationControl > send_pan_azimuth_controllable(uint32_t n) const =0
bool is_hidden() const
Definition: stripable.h:86
bool is_selected() const
bool is_foldbackbus() const
Definition: stripable.h:79
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:183
virtual std::shared_ptr< GainControl > gain_control() const =0
virtual std::shared_ptr< PeakMeter > peak_meter()=0
bool is_master() const
Definition: stripable.h:77
virtual ~Stripable()
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:82
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:190
PresentationInfo * presentation_info_ptr()
Definition: stripable.h:91
bool is_main_bus() const
Definition: stripable.h:81
bool is_auditioner() const
Definition: stripable.h:75
void set_presentation_order(PresentationInfo::order_t)
virtual std::shared_ptr< MuteControl > mute_control() const =0
virtual std::shared_ptr< AutomationControl > send_level_controllable(uint32_t n) const =0
virtual bool muted_by_others_soloing() const =0
virtual std::shared_ptr< MonitorProcessor > monitor_control() const =0
virtual std::shared_ptr< ReadOnlyControl > mapped_output(enum WellKnownData) const =0
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
void session(lua_State *L)
Sorter(bool mixer_order=false)
Definition: stripable.h:100