Ardour  8.7-14-g57a6773833
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 namespace ARDOUR {
27  class PeakMeter;
28 }
29 
30 namespace ArdourCanvas {
31  class Box;
32 }
33 
34 namespace ArdourSurface
35 {
36 
37 class Push2;
38 
39 class LevelMeter : public ArdourCanvas::Container, public sigc::trackable
40 {
41  public:
43  virtual ~LevelMeter ();
44 
45  virtual void set_meter (ARDOUR::PeakMeter* meter);
46 
48 
49  float update_meters ();
51  void clear_meters (bool reset_highlight = true);
52  void hide_meters ();
53  void setup_meters (int len=0, int width=3, int thin=2);
54  void set_max_audio_meter_count (uint32_t cnt = 0);
55 
56 
57  private:
62 
63  struct MeterInfo {
65  gint16 width;
66  int length;
67  bool packed;
68  float max_peak;
69 
71  meter = 0;
72  width = 0;
73  length = 0;
74  packed = false;
75  max_peak = -INFINITY;
76  }
77  };
78 
82  std::vector<MeterInfo> _meters;
83  float _max_peak;
85  uint32_t _midi_count;
86  uint32_t _meter_count;
88 
92 
93  void hide_all_meters ();
94 
95  void parameter_changed (std::string);
98 };
99 
100 }
101 
102 #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