Ardour  9.7-53-gdd292e0e94
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  /* no fancy bits set */
83  bool is_normal_route () const {
89  return (_presentation_info.flags() & f) && !is_singleton();
90  }
91 
92  int set_state (XMLNode const&, int);
93 
94  bool is_hidden() const { return _presentation_info.flags() & PresentationInfo::Hidden; }
95  bool is_selected() const;
96 
97  PresentationInfo const & presentation_info () const { return _presentation_info; }
98  PresentationInfo& presentation_info () { return _presentation_info; }
99  PresentationInfo* presentation_info_ptr () { return &_presentation_info; }
100 
101  /* set just the order */
102 
104 
106  {
107  const bool _mixer_order; // master is last
108  Sorter (bool mixer_order = false) : _mixer_order (mixer_order) {}
109  bool operator() (std::shared_ptr<ARDOUR::Stripable> a, std::shared_ptr<ARDOUR::Stripable> b) const;
110  };
111 
112  /* gui's call this for their own purposes. */
113 
114  PBD::Signal<void(std::string,void*)> gui_changed;
115 
116  /* *************************************************************
117  * Pure interface begins here
118  ***************************************************************/
119 
120  virtual std::shared_ptr<PeakMeter> peak_meter() = 0;
121  virtual std::shared_ptr<const PeakMeter> peak_meter() const = 0;
122 
123  virtual std::shared_ptr<GainControl> gain_control() const = 0;
124 
125  virtual std::shared_ptr<SoloControl> solo_control() const = 0;
126  virtual std::shared_ptr<SoloIsolateControl> solo_isolate_control() const = 0;
127  virtual std::shared_ptr<SoloSafeControl> solo_safe_control() const = 0;
128  virtual std::shared_ptr<MuteControl> mute_control() const = 0;
129 
130  virtual std::shared_ptr<PhaseControl> phase_control() const = 0;
131  virtual std::shared_ptr<GainControl> trim_control() const = 0;
132 
133  virtual std::shared_ptr<MonitorControl> monitoring_control() const = 0;
134 
135  virtual std::shared_ptr<AutomationControl> rec_enable_control() const { return std::shared_ptr<AutomationControl>(); }
136  virtual std::shared_ptr<AutomationControl> rec_safe_control() const { return std::shared_ptr<AutomationControl>(); }
137 
138  virtual bool slaved_to (std::shared_ptr<VCA>) const = 0;
139  virtual bool slaved () const = 0;
140 
141  /* "well-known" controls for panning. Any or all of these may return
142  * null.
143  */
144  virtual std::shared_ptr<AutomationControl> pan_azimuth_control() const = 0;
145  virtual std::shared_ptr<AutomationControl> pan_elevation_control() const = 0;
146  virtual std::shared_ptr<AutomationControl> pan_width_control() const = 0;
147  virtual std::shared_ptr<AutomationControl> pan_frontback_control() const = 0;
148  virtual std::shared_ptr<AutomationControl> pan_lfe_control() const = 0;
149 
150  /* "well-known" controls. Any or all may NULL. */
151  virtual uint32_t eq_band_cnt () const = 0;
152  virtual std::string eq_band_name (uint32_t) const = 0;
153 
154  virtual std::shared_ptr<AutomationControl> mapped_control (enum WellKnownCtrl, uint32_t band = 0) const = 0;
155  virtual std::shared_ptr<ReadOnlyControl> mapped_output (enum WellKnownData) const = 0;
156 
157  /* ACs mapped to any control have changed. API user is to drop references,
158  * and query mapped ctrl again
159  */
161 
162  /* "well-known" controls for sends to well-known busses in this route. Any or all may
163  * be null.
164  *
165  * In Mixbus, these are the sends that connect to the mixbusses.
166  * In Ardour, these are user-created sends that connect to user-created
167  * Aux busses.
168  */
169  virtual std::shared_ptr<AutomationControl> send_level_controllable (uint32_t n, bool locked = false) const = 0;
170  virtual std::shared_ptr<AutomationControl> send_enable_controllable (uint32_t n) const = 0;
171  virtual std::shared_ptr<AutomationControl> send_pan_azimuth_controllable (uint32_t n) const = 0;
172  virtual std::shared_ptr<AutomationControl> send_pan_azimuth_enable_controllable (uint32_t n) const = 0;
173 
174  /* for the same value of @p n, this returns the name of the send
175  * associated with the pair of controllables returned by the above two methods.
176  */
177  virtual std::string send_name (uint32_t n) const = 0;
178 
179  /* well known control that enables/disables sending to the master bus.
180  *
181  * In Ardour, this returns null.
182  * In Mixbus, it will return a suitable control, or null depending on
183  * the route.
184  */
185  virtual std::shared_ptr<AutomationControl> master_send_enable_controllable () const = 0;
186 
187  virtual bool muted_by_others_soloing () const = 0;
188 
189  virtual std::shared_ptr<MonitorProcessor> monitor_control() const = 0;
190 
191  StripableColorDialog* active_color_picker() const { return _active_color_picker; }
192  void set_active_color_picker (StripableColorDialog* d) { _active_color_picker = d; }
193 
194  protected:
196 
197  private:
199 };
200 
201 }
202 
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:97
bool is_surround_master() const
Definition: stripable.h:79
PresentationInfo _presentation_info
Definition: stripable.h:195
virtual std::shared_ptr< AutomationControl > pan_elevation_control() const =0
virtual std::shared_ptr< AutomationControl > rec_enable_control() const
Definition: stripable.h:135
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:136
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:192
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:98
virtual std::shared_ptr< AutomationControl > send_pan_azimuth_controllable(uint32_t n) const =0
bool is_hidden() const
Definition: stripable.h:94
bool is_normal_route() const
Definition: stripable.h:83
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:191
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:198
PresentationInfo * presentation_info_ptr()
Definition: stripable.h:99
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:114
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:160
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
PBD::PropertyDescriptor< bool > locked
Sorter(bool mixer_order=false)
Definition: stripable.h:108