Ardour  9.0-pre0-582-g084a23a80d
gtk2_ardour/level_meter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2014 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
4  * Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
5  * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
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 <vector>
25 
26 #include <gtkmm/box.h>
27 #include <gtkmm/adjustment.h>
28 #include <gtkmm/frame.h>
29 #include <gtkmm/eventbox.h>
30 #include <gtkmm/button.h>
31 #include <gtkmm/table.h>
32 #include <gtkmm/drawingarea.h>
33 
34 #include "ardour/types.h"
35 #include "ardour/chan_count.h"
36 #include "ardour/session_handle.h"
37 
38 #include "widgets/fastmeter.h"
39 
40 #include "enums.h"
41 
42 namespace ARDOUR {
43  class Session;
44  class PeakMeter;
45 }
46 namespace Gtk {
47  class Menu;
48 }
49 
50 class LevelMeterBase : public ARDOUR::SessionHandlePtr, virtual public sigc::trackable
51 {
52 public:
55  virtual ~LevelMeterBase ();
56 
57  virtual void set_meter (ARDOUR::PeakMeter* meter);
58 
60 
61  float update_meters ();
63  void clear_meters (bool reset_highlight = true);
64  void hide_meters ();
65  void setup_meters (int len=0, int width=3, int thin=2);
66  void set_max_audio_meter_count (uint32_t cnt = 0);
67 
71 
72 protected:
73  virtual void mtr_pack(Gtk::Widget &w) = 0;
74  virtual void mtr_remove(Gtk::Widget &w) = 0;
75 
76 private:
80 
82 
83  struct MeterInfo {
85  gint16 width;
86  int length;
87  bool packed;
88  float max_peak;
89 
91  meter = 0;
92  width = 0;
93  length = 0;
94  packed = false;
95  max_peak = -INFINITY;
96  }
97  };
98 
102  std::vector<MeterInfo> meters;
103  float max_peak;
105  uint32_t midi_count;
106  uint32_t meter_count;
108 
112 
116 
117  void parameter_changed (std::string);
120 
122  void color_handler ();
123 };
124 
126 {
127 public:
130 
131 protected:
134 };
135 
137 {
138 public:
141 
142 protected:
145 };
146 
147 
PBD::Signal< bool(GdkEventButton *)> ButtonPress
void update_meters_falloff()
void hide_all_meters()
ARDOUR::MeterType visible_meter_type
std::vector< MeterInfo > meters
PBD::ScopedConnection _configuration_connection
virtual void set_meter(ARDOUR::PeakMeter *meter)
bool meter_button_release(GdkEventButton *)
PBD::Signal< bool(GdkEventButton *)> ButtonRelease
void meter_type_changed(ARDOUR::MeterType)
float update_meters()
void set_max_audio_meter_count(uint32_t cnt=0)
PBD::ScopedConnection _meter_type_connection
ArdourWidgets::FastMeter::Orientation _meter_orientation
void color_handler()
bool meter_button_press(GdkEventButton *)
PBD::EventLoop::InvalidationRecord * parent_invalidator
void update_gain_sensitive()
void configuration_changed(ARDOUR::ChanCount in, ARDOUR::ChanCount out)
virtual ~LevelMeterBase()
virtual void mtr_remove(Gtk::Widget &w)=0
PBD::ScopedConnection _parameter_connection
void hide_meters()
virtual void mtr_pack(Gtk::Widget &w)=0
ARDOUR::PeakMeter * _meter
void parameter_changed(std::string)
void clear_meters(bool reset_highlight=true)
void setup_meters(int len=0, int width=3, int thin=2)
LevelMeterBase(ARDOUR::Session *, PBD::EventLoop::InvalidationRecord *ir, ArdourWidgets::FastMeter::Orientation o=ArdourWidgets::FastMeter::Vertical)
void mtr_pack(Gtk::Widget &w)
void mtr_remove(Gtk::Widget &w)
LevelMeterHBox(ARDOUR::Session *)
LevelMeterVBox(ARDOUR::Session *)
void mtr_pack(Gtk::Widget &w)
void mtr_remove(Gtk::Widget &w)
Definition: ardour_ui.h:188
ArdourWidgets::FastMeter * meter
gint width
Definition: xcursors.h:1