Ardour  9.0-pre0-1699-gfaebc7ab35
subview.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2007 John Anderson
3  * Copyright (C) 2012-2015 Paul Davis <paul@linuxaudiosystems.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __ardour_mackie_control_protocol_subview_h__
21 #define __ardour_mackie_control_protocol_subview_h__
22 
23 #include "pbd/signals.h"
24 #include "ardour/types.h"
25 
26 namespace ARDOUR {
27  struct ParameterDescriptor;
28  class Plugin;
29  class PluginInsert;
30 }
31 
32 namespace ArdourSurface { namespace MACKIE_NAMESPACE {
33 
34 class MackieControlProtocol;
35 
36 class Pot;
37 class Strip;
38 class Subview;
39 class Surface;
40 class SubviewFactory;
41 
45 class Subview {
46  public:
47 
48  enum Mode {
50  EQ,
55  };
56 
57 
58  Subview(MackieControlProtocol& mcp, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
59  virtual ~Subview();
60 
61  virtual Mode subview_mode () const = 0;
62  virtual void update_global_buttons() = 0;
63  virtual bool permit_flipping_faders_and_pots() { return false; }
64  virtual void init_params(){}
65  virtual void setup_vpot(
66  Strip* strip,
67  Pot* vpot,
68  std::string pending_display[2]) = 0;
69  virtual void handle_vselect_event(uint32_t global_strip_position);
70  // returns true if press was handled in the subview, default is false
71  virtual bool handle_cursor_right_press() { return false; }
72  // returns true if press was handled in the subview, default is false
73  virtual bool handle_cursor_left_press() { return false; }
74 
75  static bool subview_mode_would_be_ok (Subview::Mode, std::shared_ptr<ARDOUR::Stripable>, std::string& reason_why_not);
76  std::shared_ptr<ARDOUR::Stripable> subview_stripable() const { return _subview_stripable; }
77 
79  MackieControlProtocol& mcp() { return _mcp; }
80 
83 
84  void do_parameter_display(std::string& display, const ARDOUR::ParameterDescriptor& pd, float param_val, Strip* strip, bool screen_hold);
85 
86  protected:
88  void store_pointers(Strip* strip, Pot* vpot, std::string* pending_display, uint32_t global_strip_position);
89  bool retrieve_pointers(Strip** strip, Pot** vpot, std::string** pending_display, uint32_t global_strip_position);
90 
91  MackieControlProtocol& _mcp;
92  std::shared_ptr<ARDOUR::Stripable> _subview_stripable;
94 
95  std::vector<Strip*> _strips_over_all_surfaces;
96  std::vector<Pot*> _strip_vpots_over_all_surfaces;
97  std::vector<std::string*> _strip_pending_displays_over_all_surfaces;
99  private:
101 };
102 
103 class NoneSubview : public Subview {
104  public:
105  NoneSubview(MackieControlProtocol& mcp, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
106  virtual ~NoneSubview();
107 
108  virtual Mode subview_mode () const { return Subview::None; }
109  static bool subview_mode_would_be_ok (std::shared_ptr<ARDOUR::Stripable> r, std::string& reason_why_not);
110 
111  virtual void update_global_buttons();
112  virtual void setup_vpot(
113  Strip* strip,
114  Pot* vpot,
115  std::string pending_display[2]);
116 };
117 
118 class EQSubview : public Subview {
119  public:
120  EQSubview(MackieControlProtocol& mcp, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
121  virtual ~EQSubview();
122 
123  virtual Mode subview_mode () const { return Subview::EQ; }
124  static bool subview_mode_would_be_ok (std::shared_ptr<ARDOUR::Stripable> r, std::string& reason_why_not);
125  virtual void update_global_buttons();
126  virtual void init_params();
127  virtual void setup_vpot(
128  Strip* strip,
129  Pot* vpot,
130  std::string pending_display[2]);
131  void notify_change (std::weak_ptr<ARDOUR::AutomationControl>, uint32_t global_strip_position, bool force);
132  virtual bool handle_cursor_left_press();
134  protected:
135  uint32_t _current_bank;
136  std::vector<std::pair<std::shared_ptr<ARDOUR::AutomationControl>, std::string>> available;
137 };
138 
139 class DynamicsSubview : public Subview {
140  public:
141  DynamicsSubview(MackieControlProtocol& mcp, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
142  virtual ~DynamicsSubview();
143 
144  virtual Subview::Mode subview_mode () const { return Subview::Dynamics; }
145  static bool subview_mode_would_be_ok (std::shared_ptr<ARDOUR::Stripable> r, std::string& reason_why_not);
146  virtual void update_global_buttons();
147  virtual void init_params();
148  virtual void setup_vpot(
149  Strip* strip,
150  Pot* vpot,
151  std::string pending_display[2]);
152  void notify_change (std::weak_ptr<ARDOUR::AutomationControl>, uint32_t global_strip_position, bool force, bool propagate_mode_change);
153  virtual bool handle_cursor_left_press();
155  protected:
156  uint32_t _current_bank;
157  std::vector<std::pair<std::shared_ptr<ARDOUR::AutomationControl>, std::string>> available;
158 };
159 
160 class SendsSubview : public Subview {
161  public:
162  SendsSubview(MackieControlProtocol& mcp, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
163  virtual ~SendsSubview();
164 
165  virtual Subview::Mode subview_mode () const { return Subview::Sends; }
166  static bool subview_mode_would_be_ok (std::shared_ptr<ARDOUR::Stripable> r, std::string& reason_why_not);
167  virtual void update_global_buttons();
168  virtual bool permit_flipping_faders_and_pots() { return true; }
169  virtual void setup_vpot(
170  Strip* strip,
171  Pot* vpot,
172  std::string pending_display[2]);
173  void notify_send_level_change (uint32_t global_strip_position, bool force);
174 
175  virtual void handle_vselect_event(uint32_t global_strip_position);
177  virtual bool handle_cursor_left_press();
178  protected:
179  uint32_t _current_bank;
180 
181 };
182 
183 class TrackViewSubview : public Subview {
184  public:
185  TrackViewSubview(MackieControlProtocol& mcp, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
186  virtual ~TrackViewSubview();
187 
188  virtual Subview::Mode subview_mode () const { return Subview::TrackView; }
189  static bool subview_mode_would_be_ok (std::shared_ptr<ARDOUR::Stripable> r, std::string& reason_why_not);
190  virtual void update_global_buttons();
191  virtual void setup_vpot(
192  Strip* strip,
193  Pot* vpot,
194  std::string pending_display[2]);
195  void notify_change (ARDOUR::AutomationType, uint32_t global_strip_position, bool force);
196 };
197 
198 class PluginSubviewState;
199 
200 class PluginSubview : public Subview {
201  public:
202  PluginSubview(MackieControlProtocol& mcp, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
203  virtual ~PluginSubview();
204 
205  virtual Subview::Mode subview_mode () const { return Subview::Plugin; }
206  static bool subview_mode_would_be_ok (std::shared_ptr<ARDOUR::Stripable> r, std::string& reason_why_not);
207  virtual void update_global_buttons();
209  virtual void setup_vpot(
210  Strip* strip,
211  Pot* vpot,
212  std::string pending_display[2]);
213  virtual void handle_vselect_event(uint32_t global_strip_position);
215  virtual bool handle_cursor_left_press();
216 
217  void set_state(std::shared_ptr<PluginSubviewState> new_state);
218 
219  protected:
222 
223  std::shared_ptr<PluginSubviewState> _plugin_subview_state;
224 };
225 
227  public:
230 
231  virtual bool permit_flipping_faders_and_pots() { return false; }
232  virtual void setup_vpot(
233  Strip* strip,
234  Pot* vpot,
235  std::string pending_display[2],
236  uint32_t global_strip_position,
237  std::shared_ptr<ARDOUR::Stripable> subview_stripable) = 0;
238  virtual void handle_vselect_event(uint32_t global_strip_position, std::shared_ptr<ARDOUR::Stripable> subview_stripable) = 0;
239  static std::string shorten_display_text(const std::string& text, std::string::size_type target_length);
240  virtual bool handle_cursor_right_press() = 0;
241  virtual bool handle_cursor_left_press();
242  virtual void bank_changed() = 0;
243 
244  protected:
245  uint32_t calculate_virtual_strip_position(uint32_t strip_index) const;
246 
248  const uint32_t _bank_size;
249  uint32_t _current_bank;
250 };
251 
253  public:
255  virtual ~PluginSelect();
256 
257  virtual void setup_vpot(
258  Strip* strip,
259  Pot* vpot,
260  std::string pending_display[2],
261  uint32_t global_strip_position,
262  std::shared_ptr<ARDOUR::Stripable> subview_stripable);
263  virtual void handle_vselect_event(uint32_t global_strip_position, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
265  virtual void bank_changed();
266  private:
267  const uint32_t _bank_size;
268 };
269 
271  public:
272  PluginEdit(PluginSubview& context, std::weak_ptr<ARDOUR::PluginInsert> weak_subview_plugin);
273  virtual ~PluginEdit();
274 
275  virtual bool permit_flipping_faders_and_pots() { return true; }
276  virtual void setup_vpot(
277  Strip* strip,
278  Pot* vpot,
279  std::string pending_display[2],
280  uint32_t global_strip_position,
281  std::shared_ptr<ARDOUR::Stripable> subview_stripable);
282  virtual void handle_vselect_event(uint32_t global_strip_position, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
284  virtual void bank_changed();
285 
286  void notify_parameter_change(Strip* strip, Pot* vpot, std::string pending_display[2], uint32_t global_strip_position);
287  void init();
288  bool plugin_went_away() const;
290 
291  std::shared_ptr<ARDOUR::AutomationControl> parameter_control(uint32_t global_strip_position) const;
292 
293  std::weak_ptr<ARDOUR::PluginInsert> _weak_subview_plugin_insert;
294  std::weak_ptr<ARDOUR::Plugin> _weak_subview_plugin;
295  std::vector<uint32_t> _plugin_input_parameter_indices;
296 };
297 
299  public:
301 
302  std::shared_ptr<Subview> create_subview(Subview::Mode svm,
303  MackieControlProtocol& mcp, std::shared_ptr<ARDOUR::Stripable> subview_stripable);
304  protected:
306  private:
308 };
309 
310 } /* namespace Mackie */
311 } /* namespace ArdourSurface */
312 
313 #endif /* __ardour_mackie_control_protocol_subview_h__ */
std::vector< std::pair< std::shared_ptr< ARDOUR::AutomationControl >, std::string > > available
Definition: subview.h:157
DynamicsSubview(MackieControlProtocol &mcp, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
void notify_change(std::weak_ptr< ARDOUR::AutomationControl >, uint32_t global_strip_position, bool force, bool propagate_mode_change)
static bool subview_mode_would_be_ok(std::shared_ptr< ARDOUR::Stripable > r, std::string &reason_why_not)
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2])
virtual Subview::Mode subview_mode() const
Definition: subview.h:144
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2])
static bool subview_mode_would_be_ok(std::shared_ptr< ARDOUR::Stripable > r, std::string &reason_why_not)
std::vector< std::pair< std::shared_ptr< ARDOUR::AutomationControl >, std::string > > available
Definition: subview.h:136
EQSubview(MackieControlProtocol &mcp, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
void notify_change(std::weak_ptr< ARDOUR::AutomationControl >, uint32_t global_strip_position, bool force)
static bool subview_mode_would_be_ok(std::shared_ptr< ARDOUR::Stripable > r, std::string &reason_why_not)
NoneSubview(MackieControlProtocol &mcp, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2])
std::shared_ptr< ARDOUR::AutomationControl > parameter_control(uint32_t global_strip_position) const
std::weak_ptr< ARDOUR::Plugin > _weak_subview_plugin
Definition: subview.h:294
std::vector< uint32_t > _plugin_input_parameter_indices
Definition: subview.h:295
void notify_parameter_change(Strip *strip, Pot *vpot, std::string pending_display[2], uint32_t global_strip_position)
virtual void handle_vselect_event(uint32_t global_strip_position, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
PluginEdit(PluginSubview &context, std::weak_ptr< ARDOUR::PluginInsert > weak_subview_plugin)
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2], uint32_t global_strip_position, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
std::weak_ptr< ARDOUR::PluginInsert > _weak_subview_plugin_insert
Definition: subview.h:293
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2], uint32_t global_strip_position, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
virtual void handle_vselect_event(uint32_t global_strip_position, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2], uint32_t global_strip_position, std::shared_ptr< ARDOUR::Stripable > subview_stripable)=0
static std::string shorten_display_text(const std::string &text, std::string::size_type target_length)
virtual void handle_vselect_event(uint32_t global_strip_position, std::shared_ptr< ARDOUR::Stripable > subview_stripable)=0
uint32_t calculate_virtual_strip_position(uint32_t strip_index) const
void set_state(std::shared_ptr< PluginSubviewState > new_state)
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2])
static bool subview_mode_would_be_ok(std::shared_ptr< ARDOUR::Stripable > r, std::string &reason_why_not)
virtual Subview::Mode subview_mode() const
Definition: subview.h:205
std::shared_ptr< PluginSubviewState > _plugin_subview_state
Definition: subview.h:223
virtual void handle_vselect_event(uint32_t global_strip_position)
PluginSubview(MackieControlProtocol &mcp, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
virtual Subview::Mode subview_mode() const
Definition: subview.h:165
SendsSubview(MackieControlProtocol &mcp, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
virtual void handle_vselect_event(uint32_t global_strip_position)
static bool subview_mode_would_be_ok(std::shared_ptr< ARDOUR::Stripable > r, std::string &reason_why_not)
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2])
void notify_send_level_change(uint32_t global_strip_position, bool force)
std::shared_ptr< Subview > create_subview(Subview::Mode svm, MackieControlProtocol &mcp, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
std::vector< std::string * > _strip_pending_displays_over_all_surfaces
Definition: subview.h:97
PBD::ScopedConnectionList & subview_connections()
Definition: subview.h:82
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2])=0
bool retrieve_pointers(Strip **strip, Pot **vpot, std::string **pending_display, uint32_t global_strip_position)
PBD::ScopedConnectionList _subview_stripable_connections
Definition: subview.h:93
std::vector< Strip * > _strips_over_all_surfaces
Definition: subview.h:95
virtual Mode subview_mode() const =0
void do_parameter_display(std::string &display, const ARDOUR::ParameterDescriptor &pd, float param_val, Strip *strip, bool screen_hold)
MackieControlProtocol & _mcp
Definition: subview.h:91
PBD::ScopedConnectionList _subview_connections
Definition: subview.h:98
PBD::ScopedConnectionList & subview_stripable_connections()
Definition: subview.h:81
virtual bool permit_flipping_faders_and_pots()
Definition: subview.h:63
std::shared_ptr< ARDOUR::Stripable > _subview_stripable
Definition: subview.h:92
virtual void handle_vselect_event(uint32_t global_strip_position)
static bool subview_mode_would_be_ok(Subview::Mode, std::shared_ptr< ARDOUR::Stripable >, std::string &reason_why_not)
std::vector< Pot * > _strip_vpots_over_all_surfaces
Definition: subview.h:96
void store_pointers(Strip *strip, Pot *vpot, std::string *pending_display, uint32_t global_strip_position)
std::shared_ptr< ARDOUR::Stripable > subview_stripable() const
Definition: subview.h:76
Subview(MackieControlProtocol &mcp, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
MackieControlProtocol & mcp()
Definition: subview.h:79
virtual void setup_vpot(Strip *strip, Pot *vpot, std::string pending_display[2])
static bool subview_mode_would_be_ok(std::shared_ptr< ARDOUR::Stripable > r, std::string &reason_why_not)
TrackViewSubview(MackieControlProtocol &mcp, std::shared_ptr< ARDOUR::Stripable > subview_stripable)
void notify_change(ARDOUR::AutomationType, uint32_t global_strip_position, bool force)
virtual Subview::Mode subview_mode() const
Definition: subview.h:188
#define MACKIE_NAMESPACE