Ardour  9.0-pre0-582-g084a23a80d
libs/surfaces/push2/level_meter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2019 Robin Gareus <robin@gareus.org>
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_push2_level_meter_h__
21 #define __ardour_push2_level_meter_h__
22 
23 #include "canvas/container.h"
24 #include "canvas/meter.h"
25 
26 #include "ardour/chan_count.h"
27 #include "ardour/types.h"
28 
29 namespace ARDOUR {
30  class PeakMeter;
31 }
32 
33 namespace ArdourCanvas {
34  class Box;
35 }
36 
37 namespace ArdourSurface
38 {
39 
40 class Push2;
41 
42 class LevelMeter : public ArdourCanvas::Container, public sigc::trackable
43 {
44  public:
46  virtual ~LevelMeter ();
47 
48  virtual void set_meter (ARDOUR::PeakMeter* meter);
49 
51 
52  float update_meters ();
54  void clear_meters (bool reset_highlight = true);
55  void hide_meters ();
56  void setup_meters (int len=0, int width=3, int thin=2);
57  void set_max_audio_meter_count (uint32_t cnt = 0);
58 
59 
60  private:
65 
66  struct MeterInfo {
68  gint16 width;
69  int length;
70  bool packed;
71  float max_peak;
72 
74  meter = 0;
75  width = 0;
76  length = 0;
77  packed = false;
78  max_peak = -INFINITY;
79  }
80  };
81 
85  std::vector<MeterInfo> _meters;
86  float _max_peak;
88  uint32_t _midi_count;
89  uint32_t _meter_count;
91 
95 
96  void hide_all_meters ();
97 
98  void parameter_changed (std::string);
101 };
102 
103 }
104 
105 #endif /* __ardour_push2_level_meter_h__ */
Coord width() const
void setup_meters(int len=0, int width=3, int thin=2)
ArdourCanvas::Meter::Orientation _meter_orientation
void meter_type_changed(ARDOUR::MeterType)
void configuration_changed(ARDOUR::ChanCount in, ARDOUR::ChanCount out)
virtual void set_meter(ARDOUR::PeakMeter *meter)
LevelMeter(Push2 &p2, Item *parent, int len, ArdourCanvas::Meter::Orientation o=ArdourCanvas::Meter::Vertical)
void parameter_changed(std::string)
void set_max_audio_meter_count(uint32_t cnt=0)
void clear_meters(bool reset_highlight=true)
PBD::ScopedConnection _configuration_connection
DebugBits Push2