Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
27 
28 #include <vector>
29 #include <map>
30 
31 #include <gtkmm/adjustment.h>
32 #include <gtkmm/alignment.h>
33 #include <gtkmm/box.h>
34 #include <gtkmm/button.h>
35 #include <gtkmm/drawingarea.h>
36 #include <gtkmm/eventbox.h>
37 #include <gtkmm/frame.h>
38 #include <gtkmm/table.h>
39 
40 //#include <gdkmm/colormap.h>
41 
42 #include "pbd/signals.h"
43 
44 #include "ardour/chan_count.h"
45 #include "ardour/types.h"
46 #include "ardour/session_handle.h"
47 
48 #include "widgets/ardour_button.h"
49 #include "widgets/focus_entry.h"
50 
51 #include "enums.h"
52 #include "level_meter.h"
53 
54 namespace ARDOUR {
55  class IO;
56  class ControlGroup;
57  class GainControl;
58  class Session;
59  class Stripable;
60  class Route;
61  class RouteGroup;
62  class PeakMeter;
63  class Amp;
64  class Automatable;
65 }
66 
67 namespace Gtk {
68  class Menu;
69 }
70 
71 namespace ArdourWidgets {
72  class SliderController;
73 }
74 
79 };
80 
81 class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
82 {
83 public:
84  GainMeterBase (ARDOUR::Session*, bool horizontal, int, int);
85  virtual ~GainMeterBase ();
86 
87  virtual void set_controls (std::shared_ptr<ARDOUR::Stripable> stripable,
88  std::shared_ptr<ARDOUR::PeakMeter> meter,
89  std::shared_ptr<ARDOUR::Amp> amp,
90  std::shared_ptr<ARDOUR::GainControl> control);
91 
93  void update_meters ();
94 
96 
98  void set_width (Width, int len=0);
99  void set_meter_strip_name (const char * name);
100  void set_fader_name (const char * name);
101  void set_fader_fg (uint32_t);
102  void set_fader_bg (uint32_t);
103  void unset_fader_fg ();
104  void unset_fader_bg ();
105 
106  virtual void setup_meters (int len=0);
107 
108  std::shared_ptr<PBD::Controllable> get_controllable();
109 
112 
117 
118  static std::string meterpt_string (ARDOUR::MeterPoint);
119  static std::string astate_string (ARDOUR::AutoState);
121  static std::string _astate_string (ARDOUR::AutoState, bool);
122 
123 protected:
124 
125  friend class MixerStrip;
126  friend class MeterStrip;
127  friend class RouteTimeAxisView;
128  friend class VCAMasterStrip;
129  std::shared_ptr<ARDOUR::Stripable> _stripable;
130  std::shared_ptr<ARDOUR::PeakMeter> _meter;
131  std::shared_ptr<ARDOUR::Amp> _amp;
132  std::shared_ptr<ARDOUR::GainControl> _control;
133  std::vector<sigc::connection> connections;
135 
138 
147 
148  sigc::connection gain_watching;
149 
151 
153 
155 
157 
160  static sigc::signal<void, ARDOUR::AutoState> ChangeGainAutomationState;
161 
164 
166 
169 
170  void show_gain ();
171  void gain_activated ();
173 
174  float max_peak;
175 
176  void fader_moved ();
177  void gain_changed ();
178 
181 
182  virtual void hide_all_meters ();
183 
185 
189 
192 
193  void amp_stop_touch (int);
194  void amp_start_touch (int);
195 
196  std::shared_ptr<ARDOUR::ControlGroup> _touch_control_group;
197 
202 
204 
205  void parameter_changed (const char*);
206 
210 
211  void redraw_metrics ();
213  void color_handler(bool);
216 
217  std::shared_ptr<ARDOUR::Route> route();
218 
219 private:
220 
223 
226 };
227 
228 class GainMeter : public GainMeterBase, public Gtk::VBox
229 {
230  public:
232  virtual ~GainMeter ();
233 
234  virtual void set_controls (std::shared_ptr<ARDOUR::Stripable> stripable,
235  std::shared_ptr<ARDOUR::PeakMeter> meter,
236  std::shared_ptr<ARDOUR::Amp> amp,
237  std::shared_ptr<ARDOUR::GainControl> control);
238 
239  int get_gm_width ();
240  void setup_meters (int len=0);
242 
243  protected:
245 
249  void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
250  void redraw_metrics ();
251 
252  private:
253 
255 
263  std::vector<ARDOUR::DataType> _types;
264 };
265 
266 
void show_gain()
ARDOUR::ChanCount _previous_amp_output_streams
Definition: gain_meter.h:215
void unset_fader_bg()
Gtk::Menu * meter_menu
Definition: gain_meter.h:190
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:136
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:222
std::shared_ptr< PBD::Controllable > get_controllable()
bool _meter_peaked
Definition: gain_meter.h:225
static std::string meterpt_string(ARDOUR::MeterPoint)
Gtk::Menu meter_point_menu
Definition: gain_meter.h:156
Gtk::Adjustment gain_adjustment
Definition: gain_meter.h:140
bool peak_button_press(GdkEventButton *)
MeterPointChangeTarget meter_point_change_target
Definition: gain_meter.h:203
bool next_release_selects
Definition: gain_meter.h:137
void update_gain_sensitive()
void setup_gain_adjustment()
static sigc::signal< void, ARDOUR::AutoState > ChangeGainAutomationState
Definition: gain_meter.h:160
ARDOUR::MeterPoint old_meter_point
Definition: gain_meter.h:201
void meter_point_clicked(ARDOUR::MeterPoint)
void set_fader_bg(uint32_t)
std::shared_ptr< ARDOUR::Stripable > _stripable
Definition: gain_meter.h:129
bool _clear_meters
Definition: gain_meter.h:224
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:143
virtual void hide_all_meters()
bool gain_focused(GdkEventFocus *)
void reset_group_peak_display(ARDOUR::RouteGroup *)
PBD::Signal< bool(GdkEventButton *)> LevelMeterButtonPress
Definition: gain_meter.h:116
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:139
std::shared_ptr< ARDOUR::ControlGroup > _touch_control_group
Definition: gain_meter.h:196
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:144
void gain_unit_changed()
void set_gain_astate(ARDOUR::AutoState)
Gtk::Menu gain_astate_menu
Definition: gain_meter.h:152
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:134
void gain_automation_state_changed()
ARDOUR::DataType _data_type
Definition: gain_meter.h:214
static std::string astate_string(ARDOUR::AutoState)
void redraw_metrics()
ArdourWidgets::FocusEntry peak_display
Definition: gain_meter.h:142
void reset_peak_display()
std::vector< sigc::connection > connections
Definition: gain_meter.h:133
LevelMeterHBox * level_meter
Definition: gain_meter.h:146
ArdourWidgets::ArdourButton gain_automation_state_button
Definition: gain_meter.h:150
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:145
std::shared_ptr< ARDOUR::PeakMeter > _meter
Definition: gain_meter.h:130
virtual ~GainMeterBase()
std::shared_ptr< ARDOUR::Route > route()
void gain_changed()
void on_theme_changed()
bool gain_astate_propagate
Definition: gain_meter.h:159
void unset_fader_fg()
ArdourWidgets::FocusEntry gain_display
Definition: gain_meter.h:141
std::shared_ptr< ARDOUR::Amp > _amp
Definition: gain_meter.h:131
float max_peak
Definition: gain_meter.h:174
ArdourWidgets::ArdourButton meter_point_button
Definition: gain_meter.h:154
sigc::connection gain_watching
Definition: gain_meter.h:148
void effective_gain_display()
void update_meters()
std::shared_ptr< ARDOUR::GainControl > _control
Definition: gain_meter.h:132
LevelMeterHBox & get_level_meter() const
Definition: gain_meter.h:110
gint meter_ticks2_expose(GdkEventExpose *)
void meter_configuration_changed(ARDOUR::ChanCount)
int get_gm_width()
Gtk::HBox fader_box
Definition: gain_meter.h:257
void on_style_changed(const Glib::RefPtr< Gtk::Style > &)
Gtk::HBox hbox
Definition: gain_meter.h:259
Gtk::HBox gain_display_box
Definition: gain_meter.h:256
Gtk::HBox meter_hbox
Definition: gain_meter.h:260
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:261
void hide_all_meters()
void setup_meters(int len=0)
std::vector< ARDOUR::DataType > _types
Definition: gain_meter.h:263
Gtk::VBox fader_vbox
Definition: gain_meter.h:258
Gtk::Alignment meter_alignment
Definition: gain_meter.h:262
void redraw_metrics()
MeterPointChangeTarget
Definition: gain_meter.h:75
@ MeterPointChangeGroup
Definition: gain_meter.h:77
@ MeterPointChangeSingle
Definition: gain_meter.h:78
@ MeterPointChangeAll
Definition: gain_meter.h:76
GtkImageIconNameData name
Definition: gtkimage.h:6
Definition: ardour_ui.h:188