Ardour  9.0-pre0-582-g084a23a80d
recorder_ui.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #pragma once
20 
21 #include <list>
22 #include <memory>
23 #include <vector>
24 
25 #include <gtkmm/alignment.h>
26 #include <gtkmm/box.h>
27 #include <gtkmm/scrolledwindow.h>
28 #include <gtkmm/sizegroup.h>
29 #include <gtkmm/table.h>
30 
31 #include "pbd/natsort.h"
32 
33 #include "ardour/session_handle.h"
34 #include "ardour/circular_buffer.h"
35 #include "ardour/types.h"
36 
37 #include "gtkmm2ext/bindings.h"
38 #include "gtkmm2ext/cairo_widget.h"
39 
40 #include "widgets/ardour_button.h"
41 #include "widgets/ardour_spacer.h"
42 #include "widgets/frame.h"
43 #include "widgets/pane.h"
44 #include "widgets/tabbable.h"
45 
46 #include "application_bar.h"
47 #include "input_port_monitor.h"
48 #include "rec_info_box.h"
49 #include "shuttle_control.h"
50 
51 namespace ARDOUR {
52  class SoloMuteRelease;
53  class IOPlug;
54 }
55 
56 class TrackRecordAxis;
57 class RecorderGroupTabs;
58 
60 {
61 public:
64 
66  void cleanup ();
67 
68  XMLNode& get_state () const;
69  int set_state (const XMLNode&, int /* version */);
70 
71  Gtk::Window* use_own_window (bool and_fill_it);
72 
73  void spill_port (std::string const&);
74  void add_track (std::string const&);
75 
77 
78 private:
79  void load_bindings ();
81  void update_title ();
83  void parameter_changed (std::string const&);
86  void regions_changed (std::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const&);
87 
88  void start_updating ();
89  void stop_updating ();
90  bool update_meters ();
91  void add_or_remove_io (ARDOUR::DataType, std::vector<std::string>, bool);
93  void io_plugin_add (std::shared_ptr<ARDOUR::IOPlug>);
94  void io_plugin_going_away (std::weak_ptr<ARDOUR::IOPlug>);
95  void post_add_remove (bool);
97 
104 
105  void set_connections (std::string const&);
106  void port_connected_or_disconnected (std::string, std::string);
107  void port_pretty_name_changed (std::string);
108 
112 
114 
115  void arm_all ();
116  void arm_none ();
117 
118  void rec_undo ();
119  void rec_redo ();
120 
121  void peak_reset ();
122 
125  void update_monitorstate (std::string, bool);
126  void new_track_for_port (ARDOUR::DataType, std::string const&);
127 
128  static int calc_columns (int child_width, int parent_width);
129 
142 
158  Glib::RefPtr<Gtk::SizeGroup> _toolbar_button_height;
159  Glib::RefPtr<Gtk::SizeGroup> _toolbar_recarm_width;
160  Glib::RefPtr<Gtk::SizeGroup> _toolbar_monitoring_width;
161 
164  bool _vertical;
165 
166  std::set<std::string> _spill_port_names;
167 
169  {
170  public:
172 
175  void set_right_edge (int);
176 
177  protected:
178  void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
181 
182  private:
183  Glib::RefPtr<Pango::Layout> _layout;
186  int _width;
189  };
190 
191  class InputPort : public Gtk::EventBox
192  {
193  public:
194  InputPort (std::string const&, ARDOUR::DataType, RecorderUI*, bool vertical = false, bool ioplug = false);
196 
197  void set_frame_label (std::string const&);
199  void setup_name ();
200  bool spill (bool);
201  bool spilled () const;
202  void allow_monitoring (bool);
203  void update_monitorstate (bool);
205 
207  bool ioplug () const { return _ioplug; }
208  std::string const& name () const;
209 
210  void update (float, float); // FastMeter
211  void update (float const*); // EventMeter
212  void update (ARDOUR::CircularSampleBuffer&); // InputScope
213  void update (ARDOUR::CircularEventBuffer&); // EventMonitor
214  void clear ();
215 
216  bool operator< (InputPort const& o) const {
217  if (_ioplug != o._ioplug) {
218  return !_ioplug;
219  }
220  if (_dt == o._dt) {
221  return PBD::naturally_less (_port_name.c_str (), o._port_name.c_str ());
222  }
223  return _dt < (uint32_t) o._dt;
224  }
225 
226  private:
227  void rename_port ();
230 
240  std::string _port_name;
241  bool _ioplug;
244 
246  static Glib::RefPtr<Gtk::SizeGroup> _name_size_group;
247  static Glib::RefPtr<Gtk::SizeGroup> _ctrl_size_group;
248  static Glib::RefPtr<Gtk::SizeGroup> _monitor_size_group;
249  };
250 
252  bool operator() (std::shared_ptr<InputPort> const& a, std::shared_ptr<InputPort> const& b) const {
253  return *a < *b;
254  }
255  };
256 
257  typedef std::map<std::string, std::shared_ptr<InputPort> > InputPortMap;
258  typedef std::set<std::shared_ptr<InputPort>, InputPortPtrSort> InputPortSet;
259  typedef std::set<std::shared_ptr<ARDOUR::IOPlug>> IOPlugSet;
260 
266 
268  std::list<TrackRecordAxis*> _recorders;
269  std::list<TrackRecordAxis*> _visible_recorders;
271 
277 
278 public:
279  /* only for RecorderGroupTab */
280  std::list<TrackRecordAxis*> visible_recorders () const;
281 };
282 
Gtk::Label _name_label
Definition: recorder_ui.h:238
InputPortMonitor _monitor
Definition: recorder_ui.h:232
ARDOUR::WeakRouteList _connected_routes
Definition: recorder_ui.h:242
ARDOUR::DataType data_type() const
void update(ARDOUR::CircularSampleBuffer &)
std::string _port_name
Definition: recorder_ui.h:240
void set_frame_label(std::string const &)
void update(float const *)
void update(ARDOUR::CircularEventBuffer &)
std::string const & name() const
bool ioplug() const
Definition: recorder_ui.h:207
ArdourWidgets::ArdourButton _name_button
Definition: recorder_ui.h:237
ARDOUR::DataType _dt
Definition: recorder_ui.h:231
bool monitor_release(GdkEventButton *)
ArdourWidgets::ArdourButton _add_button
Definition: recorder_ui.h:239
ARDOUR::SoloMuteRelease * _solo_release
Definition: recorder_ui.h:243
static Glib::RefPtr< Gtk::SizeGroup > _ctrl_size_group
Definition: recorder_ui.h:247
static Glib::RefPtr< Gtk::SizeGroup > _monitor_size_group
Definition: recorder_ui.h:248
bool spilled() const
void update_monitorstate(bool)
void set_connections(ARDOUR::WeakRouteList)
ArdourWidgets::ArdourButton _spill_button
Definition: recorder_ui.h:235
void update(float, float)
ArdourWidgets::Frame _frame
Definition: recorder_ui.h:234
void allow_monitoring(bool)
Gtk::Alignment _alignment
Definition: recorder_ui.h:233
bool monitor_press(GdkEventButton *)
static bool _size_groups_initialized
Definition: recorder_ui.h:245
bool operator<(InputPort const &o) const
Definition: recorder_ui.h:216
InputPort(std::string const &, ARDOUR::DataType, RecorderUI *, bool vertical=false, bool ioplug=false)
ArdourWidgets::ArdourButton _monitor_button
Definition: recorder_ui.h:236
static Glib::RefPtr< Gtk::SizeGroup > _name_size_group
Definition: recorder_ui.h:246
Glib::RefPtr< Pango::Layout > _layout
Definition: recorder_ui.h:183
void on_size_request(Gtk::Requisition *)
This is a default handler for the signal signal_size_request().
ARDOUR::samplecnt_t _left
Definition: recorder_ui.h:187
void render(Cairo::RefPtr< Cairo::Context > const &, cairo_rectangle_t *)
void playhead_position_changed(ARDOUR::samplepos_t)
ARDOUR::samplecnt_t _right
Definition: recorder_ui.h:188
void set_right_edge(int)
void set_gui_extents(samplepos_t, samplepos_t)
bool on_button_press_event(GdkEventButton *)
This is a default handler for the signal signal_button_press_event().
IOPlugSet _ioplugins
Definition: recorder_ui.h:270
ArdourWidgets::ArdourHSpacer _ruler_sep
Definition: recorder_ui.h:264
Gtk::ScrolledWindow _meter_scroller
Definition: recorder_ui.h:138
void spill_port(std::string const &)
ArdourWidgets::ArdourButton _monitor_disk_button
Definition: recorder_ui.h:150
void update_io_widget_labels()
void update_sensitivity()
void arm_none()
ArdourWidgets::VPane _pane
Definition: recorder_ui.h:133
void update_spacer_width(Gtk::Allocation &, TrackRecordAxis *)
std::list< TrackRecordAxis * > visible_recorders() const
void post_add_remove(bool)
int _meter_area_cols
Definition: recorder_ui.h:163
ArdourWidgets::ArdourHSpacer _toolbar_sep
Definition: recorder_ui.h:143
ArdourWidgets::ArdourButton _btn_peak_reset
Definition: recorder_ui.h:148
Gtk::EventBox _scroller_base
Definition: recorder_ui.h:141
Gtk::Label _recs_label
Definition: recorder_ui.h:144
void port_pretty_name_changed(std::string)
std::set< std::string > _spill_port_names
Definition: recorder_ui.h:166
ArdourWidgets::ArdourButton _btn_rec_forget
Definition: recorder_ui.h:147
void rec_redo()
PBD::ScopedConnectionList _going_away_connections
Definition: recorder_ui.h:276
Gtk::Table _button_table
Definition: recorder_ui.h:132
static int calc_columns(int child_width, int parent_width)
void update_rec_table_layout()
void regions_changed(std::shared_ptr< ARDOUR::RegionList >, PBD::PropertyChange const &)
Gtkmm2ext::Bindings * bindings
Definition: recorder_ui.h:130
void peak_reset()
XMLNode & get_state() const
void meter_area_size_request(GtkRequisition *)
Gtk::VBox _rec_area
Definition: recorder_ui.h:137
void focus_on_clock()
Glib::RefPtr< Gtk::SizeGroup > _toolbar_recarm_width
Definition: recorder_ui.h:159
void arm_all()
Gtk::EventBox _space
Definition: recorder_ui.h:262
void io_plugins_changed()
bool _vertical
Definition: recorder_ui.h:164
void meter_area_size_allocate(Gtk::Allocation &)
int _meter_box_width
Definition: recorder_ui.h:162
ArdourWidgets::ArdourButton _monitor_in_button
Definition: recorder_ui.h:149
XrunInfoBox _xrun_info_box
Definition: recorder_ui.h:155
RemainInfoBox _remain_info_box
Definition: recorder_ui.h:156
PBD::ScopedConnectionList _engine_connections
Definition: recorder_ui.h:274
void meter_area_layout()
void add_or_remove_io(ARDOUR::DataType, std::vector< std::string >, bool)
void initial_track_display()
Glib::RefPtr< Gtk::SizeGroup > _toolbar_button_height
Definition: recorder_ui.h:158
void set_session(ARDOUR::Session *)
Gtk::HBox _ruler_box
Definition: recorder_ui.h:263
ApplicationBar _application_bar
Definition: recorder_ui.h:157
void add_routes(ARDOUR::RouteList &)
void new_track_for_port(ARDOUR::DataType, std::string const &)
void load_bindings()
std::set< std::shared_ptr< ARDOUR::IOPlug > > IOPlugSet
Definition: recorder_ui.h:259
void io_plugin_add(std::shared_ptr< ARDOUR::IOPlug >)
ArdourWidgets::ArdourButton _btn_rec_all
Definition: recorder_ui.h:145
InputPortMap _input_ports
Definition: recorder_ui.h:267
void remove_route(TrackRecordAxis *)
Gtk::Window * use_own_window(bool and_fill_it)
void presentation_info_changed(PBD::PropertyChange const &)
sigc::connection _ruler_width_update_connection
Definition: recorder_ui.h:273
void io_plugin_going_away(std::weak_ptr< ARDOUR::IOPlug >)
DurationInfoBox _duration_info_box
Definition: recorder_ui.h:154
int set_state(const XMLNode &, int)
void start_updating()
bool update_meters()
Glib::RefPtr< Gtk::SizeGroup > _toolbar_monitoring_width
Definition: recorder_ui.h:160
Gtk::Table _meter_table
Definition: recorder_ui.h:140
ArdourWidgets::ArdourButton _auto_input_button
Definition: recorder_ui.h:153
bool scroller_button_event(GdkEventButton *)
void parameter_changed(std::string const &)
void add_track(std::string const &)
Gtk::HBox _rec_groups
Definition: recorder_ui.h:136
void update_monitorstate(std::string, bool)
Gtk::VBox _rec_container
Definition: recorder_ui.h:135
void cleanup()
std::map< std::string, std::shared_ptr< InputPort > > InputPortMap
Definition: recorder_ui.h:257
Gtk::ScrolledWindow _rec_scroller
Definition: recorder_ui.h:134
void rec_undo()
Gtk::HBox _toolbar
Definition: recorder_ui.h:131
RecorderGroupTabs * _rec_group_tabs
Definition: recorder_ui.h:265
Gtk::VBox _meter_area
Definition: recorder_ui.h:139
void register_actions()
sigc::connection _fast_screen_update_connection
Definition: recorder_ui.h:272
void port_connected_or_disconnected(std::string, std::string)
ArdourWidgets::ArdourButton _btn_new_plist
Definition: recorder_ui.h:151
PBD::ScopedConnection _monitor_connection
Definition: recorder_ui.h:275
void update_title()
RecRuler _ruler
Definition: recorder_ui.h:261
void session_going_away()
void update_recordstate()
ArdourWidgets::ArdourButton _btn_rec_none
Definition: recorder_ui.h:146
void gui_extents_changed()
void stop_updating()
std::list< TrackRecordAxis * > _recorders
Definition: recorder_ui.h:268
void set_connections(std::string const &)
std::set< std::shared_ptr< InputPort >, InputPortPtrSort > InputPortSet
Definition: recorder_ui.h:258
void tra_name_edit(TrackRecordAxis *, bool)
std::list< TrackRecordAxis * > _visible_recorders
Definition: recorder_ui.h:269
ArdourWidgets::ArdourButton _btn_new_plist_rec
Definition: recorder_ui.h:152
Definition: xml++.h:114
Temporal::samplecnt_t samplecnt_t
std::list< std::shared_ptr< Route > > RouteList
Temporal::samplepos_t samplepos_t
std::list< std::weak_ptr< Route > > WeakRouteList
bool naturally_less(const char *a, const char *b)
Definition: natsort.h:174
bool operator()(std::shared_ptr< InputPort > const &a, std::shared_ptr< InputPort > const &b) const
Definition: recorder_ui.h:252