Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
20 
21 #include <gtkmm/box.h>
22 #include <gtkmm/alignment.h>
23 
24 #include "gtkmm2ext/cairo_widget.h"
25 
26 #include "ardour/circular_buffer.h"
27 #include "ardour/session_handle.h"
28 
29 namespace ArdourWidgets
30 {
31  class FastMeter;
32 }
33 
35 {
36 public:
37  enum Orientation {
40  };
41 
44 
45  void clear ();
46  void update (float, float); // FastMeter
47  void update (float const*); // EventMeter
48  void update (ARDOUR::CircularSampleBuffer&); // InputScope
49  void update (ARDOUR::CircularEventBuffer&); // EventMonitor
50 
51 private:
52  class InputScope : public CairoWidget
53  {
54  public:
57  void clear ();
58  void parameter_changed (std::string const&);
59 
60  protected:
61  void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
64 
65  private:
66  void dpi_reset ();
67 
68  int _pos;
73  float _clip_level;
74  bool _show_clip;
75  bool _logscale;
76 
77  Cairo::RefPtr<Cairo::ImageSurface> _surface;
78  };
79 
80  class EventMeter : public CairoWidget
81  {
82  public:
84  void update (float const*);
85  void clear ();
86 
87  protected:
88  void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
90 
91  private:
92  void dpi_reset ();
93 
94  Glib::RefPtr<Pango::Layout> _layout;
95  float _chn[17];
96  int _length;
97  int _extent;
99  };
100 
101  class EventMonitor : public CairoWidget
102  {
103  public:
106  void clear ();
107 
108  protected:
109  void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
111 
112  private:
113  void dpi_reset ();
114 
116  Glib::RefPtr<Pango::Layout> _layout;
117  int _width;
118  int _height;
120  };
121 
123  void color_handler ();
124  void parameter_changed (std::string const&);
125 
134 };
135 
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