Ardour  8.12
gain_meter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2016 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
4  * Copyright (C) 2006 Nick Mainsbridge <mainsbridge@gmail.com>
5  * Copyright (C) 2007-2011 David Robillard <d@drobilla.net>
6  * Copyright (C) 2007 Doug McLain <doug@nostar.net>
7  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
8  * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
9  * Copyright (C) 2014 Ben Loftis <ben@harrisonconsoles.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25 
26 #ifndef __ardour_gtk_gain_meter_h__
27 #define __ardour_gtk_gain_meter_h__
28 
29 #include <vector>
30 #include <map>
31 
32 #include <gtkmm/adjustment.h>
33 #include <gtkmm/alignment.h>
34 #include <gtkmm/box.h>
35 #include <gtkmm/button.h>
36 #include <gtkmm/drawingarea.h>
37 #include <gtkmm/eventbox.h>
38 #include <gtkmm/frame.h>
39 #include <gtkmm/table.h>
40 
41 //#include <gdkmm/colormap.h>
42 
43 #include "pbd/signals.h"
44 
45 #include "ardour/chan_count.h"
46 #include "ardour/types.h"
47 #include "ardour/session_handle.h"
48 
49 #include "widgets/ardour_button.h"
50 #include "widgets/focus_entry.h"
51 
52 #include "enums.h"
53 #include "level_meter.h"
54 
55 namespace ARDOUR {
56  class IO;
57  class ControlGroup;
58  class GainControl;
59  class Session;
60  class Stripable;
61  class Route;
62  class RouteGroup;
63  class PeakMeter;
64  class Amp;
65  class Automatable;
66 }
67 
68 namespace Gtk {
69  class Menu;
70 }
71 
72 namespace ArdourWidgets {
73  class SliderController;
74 }
75 
80 };
81 
82 class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
83 {
84 public:
85  GainMeterBase (ARDOUR::Session*, bool horizontal, int, int);
86  virtual ~GainMeterBase ();
87 
88  virtual void set_controls (std::shared_ptr<ARDOUR::Stripable> stripable,
89  std::shared_ptr<ARDOUR::PeakMeter> meter,
90  std::shared_ptr<ARDOUR::Amp> amp,
91  std::shared_ptr<ARDOUR::GainControl> control);
92 
94  void update_meters ();
95 
97 
99  void set_width (Width, int len=0);
100  void set_meter_strip_name (const char * name);
101  void set_fader_name (const char * name);
102  void set_fader_fg (uint32_t);
103  void set_fader_bg (uint32_t);
104  void unset_fader_fg ();
105  void unset_fader_bg ();
106 
107  virtual void setup_meters (int len=0);
108 
109  std::shared_ptr<PBD::Controllable> get_controllable();
110 
113 
117  PBD::Signal1<bool, GdkEventButton *> LevelMeterButtonPress;
118 
119  static std::string meterpt_string (ARDOUR::MeterPoint);
120  static std::string astate_string (ARDOUR::AutoState);
122  static std::string _astate_string (ARDOUR::AutoState, bool);
123 
124 protected:
125 
126  friend class MixerStrip;
127  friend class MeterStrip;
128  friend class RouteTimeAxisView;
129  friend class VCAMasterStrip;
130  std::shared_ptr<ARDOUR::Stripable> _stripable;
131  std::shared_ptr<ARDOUR::PeakMeter> _meter;
132  std::shared_ptr<ARDOUR::Amp> _amp;
133  std::shared_ptr<ARDOUR::GainControl> _control;
134  std::vector<sigc::connection> connections;
136 
139 
148 
149  sigc::connection gain_watching;
150 
152 
154 
156 
158 
161  static sigc::signal<void, ARDOUR::AutoState> ChangeGainAutomationState;
162 
165 
167 
170 
171  void show_gain ();
172  void gain_activated ();
174 
175  float max_peak;
176 
177  void fader_moved ();
178  void gain_changed ();
179 
182 
183  virtual void hide_all_meters ();
184 
186 
190 
193 
194  void amp_stop_touch (int);
195  void amp_start_touch (int);
196 
197  std::shared_ptr<ARDOUR::ControlGroup> _touch_control_group;
198 
203 
205 
206  void parameter_changed (const char*);
207 
211 
212  void redraw_metrics ();
214  void color_handler(bool);
217 
218  std::shared_ptr<ARDOUR::Route> route();
219 
220 private:
221 
224 
227 };
228 
229 class GainMeter : public GainMeterBase, public Gtk::VBox
230 {
231  public:
233  virtual ~GainMeter ();
234 
235  virtual void set_controls (std::shared_ptr<ARDOUR::Stripable> stripable,
236  std::shared_ptr<ARDOUR::PeakMeter> meter,
237  std::shared_ptr<ARDOUR::Amp> amp,
238  std::shared_ptr<ARDOUR::GainControl> control);
239 
240  int get_gm_width ();
241  void setup_meters (int len=0);
243 
244  protected:
246 
250  void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
251  void redraw_metrics ();
252 
253  private:
254 
256 
264  std::vector<ARDOUR::DataType> _types;
265 };
266 
267 #endif /* __ardour_gtk_gain_meter_h__ */
268 
void show_gain()
ARDOUR::ChanCount _previous_amp_output_streams
Definition: gain_meter.h:216
void unset_fader_bg()
Gtk::Menu * meter_menu
Definition: gain_meter.h:191
void set_route_group_meter_point(ARDOUR::Route &, ARDOUR::MeterPoint)
void fader_moved()
void set_meter_point(ARDOUR::Route &, ARDOUR::MeterPoint)
bool ignore_toggle
Definition: gain_meter.h:137
bool peak_button_release(GdkEventButton *)
static std::string _astate_string(ARDOUR::AutoState, bool)
void parameter_changed(const char *)
CairoWidget & get_gain_slider() const
void amp_stop_touch(int)
gint gain_automation_state_button_event(GdkEventButton *)
void gain_activated()
gint meter_press(GdkEventButton *)
PBD::ScopedConnection _level_meter_connection
Definition: gain_meter.h:223
PBD::Signal1< bool, GdkEventButton * > LevelMeterButtonPress
Definition: gain_meter.h:117
std::shared_ptr< PBD::Controllable > get_controllable()
bool _meter_peaked
Definition: gain_meter.h:226
static std::string meterpt_string(ARDOUR::MeterPoint)
Gtk::Menu meter_point_menu
Definition: gain_meter.h:157
Gtk::Adjustment gain_adjustment
Definition: gain_meter.h:141
bool peak_button_press(GdkEventButton *)
MeterPointChangeTarget meter_point_change_target
Definition: gain_meter.h:204
bool next_release_selects
Definition: gain_meter.h:138
void update_gain_sensitive()
void setup_gain_adjustment()
static sigc::signal< void, ARDOUR::AutoState > ChangeGainAutomationState
Definition: gain_meter.h:161
ARDOUR::MeterPoint old_meter_point
Definition: gain_meter.h:202
void meter_point_clicked(ARDOUR::MeterPoint)
void set_fader_bg(uint32_t)
std::shared_ptr< ARDOUR::Stripable > _stripable
Definition: gain_meter.h:130
bool _clear_meters
Definition: gain_meter.h:225
bool level_meter_button_press(GdkEventButton *)
GainMeterBase(ARDOUR::Session *, bool horizontal, int, int)
static std::string short_astate_string(ARDOUR::AutoState)
void set_meter_strip_name(const char *name)
void set_fader_name(const char *name)
Gtk::DrawingArea meter_metric_area
Definition: gain_meter.h:144
virtual void hide_all_meters()
bool gain_focused(GdkEventFocus *)
void reset_group_peak_display(ARDOUR::RouteGroup *)
virtual void set_controls(std::shared_ptr< ARDOUR::Stripable > stripable, std::shared_ptr< ARDOUR::PeakMeter > meter, std::shared_ptr< ARDOUR::Amp > amp, std::shared_ptr< ARDOUR::GainControl > control)
ArdourWidgets::SliderController * gain_slider
Definition: gain_meter.h:140
std::shared_ptr< ARDOUR::ControlGroup > _touch_control_group
Definition: gain_meter.h:197
gint meter_button_press(GdkEventButton *, uint32_t)
void reset_route_peak_display(ARDOUR::Route *)
void popup_meter_menu(GdkEventButton *)
Gtk::DrawingArea meter_ticks1_area
Definition: gain_meter.h:145
void gain_unit_changed()
void set_gain_astate(ARDOUR::AutoState)
Gtk::Menu gain_astate_menu
Definition: gain_meter.h:153
virtual void setup_meters(int len=0)
gint pan_automation_state_button_event(GdkEventButton *)
void set_fader_fg(uint32_t)
PBD::ScopedConnectionList model_connections
Definition: gain_meter.h:135
void gain_automation_state_changed()
ARDOUR::DataType _data_type
Definition: gain_meter.h:215
static std::string astate_string(ARDOUR::AutoState)
void redraw_metrics()
ArdourWidgets::FocusEntry peak_display
Definition: gain_meter.h:143
void reset_peak_display()
std::vector< sigc::connection > connections
Definition: gain_meter.h:134
LevelMeterHBox * level_meter
Definition: gain_meter.h:147
ArdourWidgets::ArdourButton gain_automation_state_button
Definition: gain_meter.h:151
void color_handler(bool)
void set_width(Width, int len=0)
bool gain_key_press(GdkEventKey *)
void amp_start_touch(int)
const ARDOUR::ChanCount meter_channels() const
Gtk::DrawingArea meter_ticks2_area
Definition: gain_meter.h:146
std::shared_ptr< ARDOUR::PeakMeter > _meter
Definition: gain_meter.h:131
virtual ~GainMeterBase()
std::shared_ptr< ARDOUR::Route > route()
void gain_changed()
void on_theme_changed()
bool gain_astate_propagate
Definition: gain_meter.h:160
void unset_fader_fg()
ArdourWidgets::FocusEntry gain_display
Definition: gain_meter.h:142
std::shared_ptr< ARDOUR::Amp > _amp
Definition: gain_meter.h:132
float max_peak
Definition: gain_meter.h:175
ArdourWidgets::ArdourButton meter_point_button
Definition: gain_meter.h:155
sigc::connection gain_watching
Definition: gain_meter.h:149
void effective_gain_display()
void update_meters()
std::shared_ptr< ARDOUR::GainControl > _control
Definition: gain_meter.h:133
LevelMeterHBox & get_level_meter() const
Definition: gain_meter.h:111
gint meter_ticks2_expose(GdkEventExpose *)
void meter_configuration_changed(ARDOUR::ChanCount)
int get_gm_width()
Gtk::HBox fader_box
Definition: gain_meter.h:258
void on_style_changed(const Glib::RefPtr< Gtk::Style > &)
Gtk::HBox hbox
Definition: gain_meter.h:260
Gtk::HBox gain_display_box
Definition: gain_meter.h:257
Gtk::HBox meter_hbox
Definition: gain_meter.h:261
GainMeter(ARDOUR::Session *, int)
virtual void set_controls(std::shared_ptr< ARDOUR::Stripable > stripable, std::shared_ptr< ARDOUR::PeakMeter > meter, std::shared_ptr< ARDOUR::Amp > amp, std::shared_ptr< ARDOUR::GainControl > control)
virtual ~GainMeter()
void route_active_changed()
gint meter_metrics_expose(GdkEventExpose *)
gint meter_ticks1_expose(GdkEventExpose *)
Gtk::Alignment fader_alignment
Definition: gain_meter.h:262
void hide_all_meters()
void setup_meters(int len=0)
std::vector< ARDOUR::DataType > _types
Definition: gain_meter.h:264
Gtk::VBox fader_vbox
Definition: gain_meter.h:259
Gtk::Alignment meter_alignment
Definition: gain_meter.h:263
void redraw_metrics()
MeterPointChangeTarget
Definition: gain_meter.h:76
@ MeterPointChangeGroup
Definition: gain_meter.h:78
@ MeterPointChangeSingle
Definition: gain_meter.h:79
@ MeterPointChangeAll
Definition: gain_meter.h:77
GtkImageIconNameData name
Definition: gtkimage.h:6
Definition: ardour_ui.h:188