Ardour  8.7-15-gadf511264b
input_port_monitor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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 #ifndef __gtk_ardour_input_port_monitor_h__
20 #define __gtk_ardour_input_port_monitor_h__
21 
22 #include <gtkmm/box.h>
23 #include <gtkmm/alignment.h>
24 
25 #include "gtkmm2ext/cairo_widget.h"
26 
27 #include "ardour/circular_buffer.h"
28 #include "ardour/session_handle.h"
29 
30 namespace ArdourWidgets
31 {
32  class FastMeter;
33 }
34 
36 {
37 public:
38  enum Orientation {
41  };
42 
45 
46  void clear ();
47  void update (float, float); // FastMeter
48  void update (float const*); // EventMeter
49  void update (ARDOUR::CircularSampleBuffer&); // InputScope
50  void update (ARDOUR::CircularEventBuffer&); // EventMonitor
51 
52 private:
53  class InputScope : public CairoWidget
54  {
55  public:
58  void clear ();
59  void parameter_changed (std::string const&);
60 
61  protected:
62  void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
65 
66  private:
67  void dpi_reset ();
68 
69  int _pos;
74  float _clip_level;
75  bool _show_clip;
76  bool _logscale;
77 
78  Cairo::RefPtr<Cairo::ImageSurface> _surface;
79  };
80 
81  class EventMeter : public CairoWidget
82  {
83  public:
85  void update (float const*);
86  void clear ();
87 
88  protected:
89  void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
91 
92  private:
93  void dpi_reset ();
94 
95  Glib::RefPtr<Pango::Layout> _layout;
96  float _chn[17];
97  int _length;
98  int _extent;
100  };
101 
102  class EventMonitor : public CairoWidget
103  {
104  public:
107  void clear ();
108 
109  protected:
110  void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
112 
113  private:
114  void dpi_reset ();
115 
117  Glib::RefPtr<Pango::Layout> _layout;
118  int _width;
119  int _height;
121  };
122 
124  void color_handler ();
125  void parameter_changed (std::string const&);
126 
135 };
136 
137 #endif
std::vector< Event > EventList
Glib::RefPtr< Pango::Layout > _layout
void update(float const *)
void render(Cairo::RefPtr< Cairo::Context > const &, cairo_rectangle_t *)
void on_size_request(Gtk::Requisition *)
This is a default handler for the signal signal_size_request().
Glib::RefPtr< Pango::Layout > _layout
void render(Cairo::RefPtr< Cairo::Context > const &, cairo_rectangle_t *)
void update(ARDOUR::CircularEventBuffer &)
ARDOUR::CircularEventBuffer::EventList _l
void on_size_request(Gtk::Requisition *)
This is a default handler for the signal signal_size_request().
void render(Cairo::RefPtr< Cairo::Context > const &, cairo_rectangle_t *)
Cairo::RefPtr< Cairo::ImageSurface > _surface
void on_size_allocate(Gtk::Allocation &)
This is a default handler for the signal signal_size_allocate().
void on_size_request(Gtk::Requisition *)
This is a default handler for the signal signal_size_request().
void update(ARDOUR::CircularSampleBuffer &)
void parameter_changed(std::string const &)
InputScope(ARDOUR::samplecnt_t, int length, int gauge, Orientation)
Gtk::Alignment _bin
InputPortMonitor(ARDOUR::DataType, ARDOUR::samplecnt_t, Orientation)
EventMeter * _midi_meter
void update(ARDOUR::CircularEventBuffer &)
void update(float, float)
void update(ARDOUR::CircularSampleBuffer &)
void update(float const *)
ARDOUR::DataType _dt
void setup_audio_meter()
Orientation _orientation
EventMonitor * _midi_monitor
InputScope * _audio_scope
ArdourWidgets::FastMeter * _audio_meter
void parameter_changed(std::string const &)
PBD::PropertyDescriptor< timecnt_t > length
Temporal::samplecnt_t samplecnt_t