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