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>
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.
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.
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.
22 #ifndef __ardour_gtk_track_meter_h__
23 #define __ardour_gtk_track_meter_h__
27 #include <gtkmm/box.h>
28 #include <gtkmm/adjustment.h>
29 #include <gtkmm/frame.h>
30 #include <gtkmm/eventbox.h>
31 #include <gtkmm/button.h>
32 #include <gtkmm/table.h>
33 #include <gtkmm/drawingarea.h>
35 #include "ardour/types.h"
36 #include "ardour/chan_count.h"
37 #include "ardour/session_handle.h"
39 #include "widgets/fastmeter.h"
40 #include "widgets/focus_entry.h"
41 #include "widgets/slider_controller.h"
53 class LevelMeterBase : public ARDOUR::SessionHandlePtr, virtual public sigc::trackable
56 LevelMeterBase (ARDOUR::Session*, PBD::EventLoop::InvalidationRecord* ir,
57 ArdourWidgets::FastMeter::Orientation o = ArdourWidgets::FastMeter::Vertical);
58 virtual ~LevelMeterBase ();
60 virtual void set_meter (ARDOUR::PeakMeter* meter);
62 void update_gain_sensitive ();
64 float update_meters ();
65 void update_meters_falloff ();
66 void clear_meters (bool reset_highlight = true);
68 void setup_meters (int len=0, int width=3, int thin=2);
69 void set_max_audio_meter_count (uint32_t cnt = 0);
71 /** Emitted in the GUI thread when a button is pressed over the meter */
72 PBD::Signal1<bool, GdkEventButton *> ButtonPress;
73 PBD::Signal1<bool, GdkEventButton *> ButtonRelease;
76 virtual void mtr_pack(Gtk::Widget &w) = 0;
77 virtual void mtr_remove(Gtk::Widget &w) = 0;
80 PBD::EventLoop::InvalidationRecord* parent_invalidator;
81 ARDOUR::PeakMeter* _meter;
82 ArdourWidgets::FastMeter::Orientation _meter_orientation;
87 ArdourWidgets::FastMeter* meter;
102 guint16 regular_meter_width;
104 guint16 thin_meter_width;
105 std::vector<MeterInfo> meters;
107 ARDOUR::MeterType visible_meter_type;
109 uint32_t meter_count;
110 uint32_t max_visible_meters;
112 PBD::ScopedConnection _configuration_connection;
113 PBD::ScopedConnection _meter_type_connection;
114 PBD::ScopedConnection _parameter_connection;
116 void hide_all_meters ();
117 bool meter_button_press (GdkEventButton *);
118 bool meter_button_release (GdkEventButton *);
120 void parameter_changed (std::string);
121 void configuration_changed (ARDOUR::ChanCount in, ARDOUR::ChanCount out);
122 void meter_type_changed (ARDOUR::MeterType);
125 void color_handler ();
128 class LevelMeterHBox : public LevelMeterBase, public Gtk::HBox
131 LevelMeterHBox (ARDOUR::Session*);
135 void mtr_pack(Gtk::Widget &w);
136 void mtr_remove(Gtk::Widget &w);
139 class LevelMeterVBox : public LevelMeterBase, public Gtk::VBox
142 LevelMeterVBox (ARDOUR::Session*);
146 void mtr_pack(Gtk::Widget &w);
147 void mtr_remove(Gtk::Widget &w);
150 #endif /* __ardour_gtk_track_meter_h__ */