2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2005-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2006 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2007-2011 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2007 Doug McLain <doug@nostar.net>
|
|
|
|
* Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2014 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#ifndef __ardour_gtk_gain_meter_h__
|
|
|
|
#define __ardour_gtk_gain_meter_h__
|
|
|
|
|
|
|
|
#include <vector>
|
2006-03-12 13:21:48 -05:00
|
|
|
#include <map>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-28 23:41:15 -05:00
|
|
|
#include <gtkmm/adjustment.h>
|
2017-07-16 21:48:18 -04:00
|
|
|
#include <gtkmm/alignment.h>
|
|
|
|
#include <gtkmm/box.h>
|
2005-11-28 23:41:15 -05:00
|
|
|
#include <gtkmm/button.h>
|
|
|
|
#include <gtkmm/drawingarea.h>
|
2017-07-16 21:48:18 -04:00
|
|
|
#include <gtkmm/eventbox.h>
|
|
|
|
#include <gtkmm/frame.h>
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
|
|
|
|
//#include <gdkmm/colormap.h>
|
2005-11-28 23:41:15 -05:00
|
|
|
|
2009-12-19 15:26:31 -05:00
|
|
|
#include "pbd/signals.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2010-03-10 12:31:16 -05:00
|
|
|
#include "ardour/chan_count.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/types.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
#include "ardour/session_handle.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
#include "widgets/ardour_button.h"
|
2017-07-16 16:13:46 -04:00
|
|
|
#include "widgets/focus_entry.h"
|
|
|
|
#include "widgets/slider_controller.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "enums.h"
|
2008-04-11 10:06:50 -04:00
|
|
|
#include "level_meter.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class IO;
|
2016-01-25 11:47:44 -05:00
|
|
|
class GainControl;
|
2005-09-25 14:42:24 -04:00
|
|
|
class Session;
|
|
|
|
class Route;
|
|
|
|
class RouteGroup;
|
2009-06-09 16:21:19 -04:00
|
|
|
class PeakMeter;
|
2009-07-21 10:39:21 -04:00
|
|
|
class Amp;
|
2009-06-09 16:21:19 -04:00
|
|
|
class Automatable;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2017-07-16 16:13:46 -04:00
|
|
|
|
2005-11-28 23:41:15 -05:00
|
|
|
namespace Gtk {
|
|
|
|
class Menu;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2017-01-22 20:00:16 -05:00
|
|
|
enum MeterPointChangeTarget {
|
|
|
|
MeterPointChangeAll,
|
|
|
|
MeterPointChangeGroup,
|
|
|
|
MeterPointChangeSingle
|
|
|
|
};
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
|
|
|
GainMeterBase (ARDOUR::Session*, bool horizontal, int, int);
|
2008-09-10 11:03:30 -04:00
|
|
|
virtual ~GainMeterBase ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
|
2017-07-01 15:11:14 -04:00
|
|
|
boost::shared_ptr<ARDOUR::PeakMeter> meter,
|
2016-01-25 11:47:44 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Amp> amp,
|
|
|
|
boost::shared_ptr<ARDOUR::GainControl> control);
|
2008-12-08 11:07:28 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void update_gain_sensitive ();
|
|
|
|
void update_meters ();
|
|
|
|
|
2014-10-23 08:25:05 -04:00
|
|
|
const ARDOUR::ChanCount meter_channels () const;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void effective_gain_display ();
|
2007-12-20 18:25:19 -05:00
|
|
|
void set_width (Width, int len=0);
|
2005-12-24 08:07:36 -05:00
|
|
|
void set_meter_strip_name (const char * name);
|
|
|
|
void set_fader_name (const char * name);
|
2022-08-11 00:34:33 -04:00
|
|
|
void set_fader_fg (uint32_t);
|
|
|
|
void set_fader_bg (uint32_t);
|
|
|
|
void unset_fader_fg ();
|
|
|
|
void unset_fader_bg ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
virtual void setup_meters (int len=0);
|
2008-04-11 10:06:50 -04:00
|
|
|
|
2009-01-30 15:18:31 -05:00
|
|
|
boost::shared_ptr<PBD::Controllable> get_controllable();
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2013-07-25 08:18:39 -04:00
|
|
|
LevelMeterHBox& get_level_meter() const { return *level_meter; }
|
2017-07-16 16:13:46 -04:00
|
|
|
ArdourWidgets::SliderController& get_gain_slider() const { return *gain_slider; }
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2011-11-13 10:12:34 -05:00
|
|
|
/** Emitted in the GUI thread when a button is pressed over the level meter;
|
|
|
|
* return true if the event is handled.
|
|
|
|
*/
|
|
|
|
PBD::Signal1<bool, GdkEventButton *> LevelMeterButtonPress;
|
|
|
|
|
2019-10-31 10:55:46 -04:00
|
|
|
static std::string meterpt_string (ARDOUR::MeterPoint);
|
2016-07-08 12:17:21 -04:00
|
|
|
static std::string astate_string (ARDOUR::AutoState);
|
|
|
|
static std::string short_astate_string (ARDOUR::AutoState);
|
|
|
|
static std::string _astate_string (ARDOUR::AutoState, bool);
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
protected:
|
2006-05-19 13:29:05 -04:00
|
|
|
|
|
|
|
friend class MixerStrip;
|
2013-06-23 10:05:52 -04:00
|
|
|
friend class MeterStrip;
|
2013-11-20 12:54:34 -05:00
|
|
|
friend class RouteTimeAxisView;
|
2017-07-20 20:10:21 -04:00
|
|
|
friend class VCAMasterStrip;
|
2009-06-09 16:21:19 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Route> _route;
|
|
|
|
boost::shared_ptr<ARDOUR::PeakMeter> _meter;
|
2009-07-21 10:39:21 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Amp> _amp;
|
2016-01-25 11:47:44 -05:00
|
|
|
boost::shared_ptr<ARDOUR::GainControl> _control;
|
2008-12-08 11:07:28 -05:00
|
|
|
std::vector<sigc::connection> connections;
|
2009-12-17 13:24:23 -05:00
|
|
|
PBD::ScopedConnectionList model_connections;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
bool ignore_toggle;
|
2006-11-29 23:21:32 -05:00
|
|
|
bool next_release_selects;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2017-07-16 16:13:46 -04:00
|
|
|
ArdourWidgets::SliderController* gain_slider;
|
|
|
|
Gtk::Adjustment gain_adjustment;
|
|
|
|
ArdourWidgets::FocusEntry gain_display;
|
|
|
|
ArdourWidgets::FocusEntry peak_display;
|
|
|
|
Gtk::DrawingArea meter_metric_area;
|
|
|
|
Gtk::DrawingArea meter_ticks1_area;
|
|
|
|
Gtk::DrawingArea meter_ticks2_area;
|
|
|
|
LevelMeterHBox* level_meter;
|
2006-05-19 13:29:05 -04:00
|
|
|
|
|
|
|
sigc::connection gain_watching;
|
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
ArdourWidgets::ArdourButton gain_automation_state_button;
|
2006-05-19 13:29:05 -04:00
|
|
|
|
|
|
|
Gtk::Menu gain_astate_menu;
|
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
ArdourWidgets::ArdourButton meter_point_button;
|
2017-01-22 20:00:16 -05:00
|
|
|
|
|
|
|
Gtk::Menu meter_point_menu;
|
|
|
|
|
2016-06-27 18:09:00 -04:00
|
|
|
void set_gain_astate (ARDOUR::AutoState);
|
|
|
|
bool gain_astate_propagate;
|
|
|
|
static sigc::signal<void, ARDOUR::AutoState> ChangeGainAutomationState;
|
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
gint gain_automation_state_button_event (GdkEventButton *);
|
|
|
|
gint pan_automation_state_button_event (GdkEventButton *);
|
|
|
|
|
|
|
|
void gain_automation_state_changed();
|
|
|
|
|
2011-08-19 13:52:32 -04:00
|
|
|
void setup_gain_adjustment ();
|
2008-03-17 16:54:03 -04:00
|
|
|
Width _width;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-11-27 14:31:33 -05:00
|
|
|
void show_gain ();
|
2006-11-29 23:21:32 -05:00
|
|
|
void gain_activated ();
|
|
|
|
bool gain_focused (GdkEventFocus*);
|
2006-11-27 14:31:33 -05:00
|
|
|
|
2009-05-04 13:05:55 -04:00
|
|
|
float max_peak;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-03-02 23:45:32 -05:00
|
|
|
void fader_moved ();
|
2007-06-29 00:02:58 -04:00
|
|
|
void gain_changed ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-01-22 20:00:16 -05:00
|
|
|
void meter_point_clicked (ARDOUR::MeterPoint);
|
2005-09-25 14:42:24 -04:00
|
|
|
void gain_unit_changed ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
virtual void hide_all_meters ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
gint meter_button_press (GdkEventButton*, uint32_t);
|
|
|
|
|
2017-03-22 20:53:31 -04:00
|
|
|
bool peak_button_press (GdkEventButton*);
|
2006-11-27 14:31:33 -05:00
|
|
|
bool peak_button_release (GdkEventButton*);
|
|
|
|
bool gain_key_press (GdkEventKey*);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
Gtk::Menu* meter_menu;
|
|
|
|
void popup_meter_menu (GdkEventButton*);
|
|
|
|
|
2014-09-04 20:38:24 -04:00
|
|
|
void amp_stop_touch ();
|
|
|
|
void amp_start_touch ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-01-09 10:10:59 -05:00
|
|
|
void set_route_group_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);
|
2005-09-25 14:42:24 -04:00
|
|
|
void set_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);
|
|
|
|
gint meter_press (GdkEventButton*);
|
|
|
|
ARDOUR::MeterPoint old_meter_point;
|
|
|
|
|
2017-01-22 20:00:16 -05:00
|
|
|
MeterPointChangeTarget meter_point_change_target;
|
|
|
|
|
2006-09-25 17:24:00 -04:00
|
|
|
void parameter_changed (const char*);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
void reset_peak_display ();
|
2013-07-05 11:42:47 -04:00
|
|
|
void reset_route_peak_display (ARDOUR::Route*);
|
2005-09-25 14:42:24 -04:00
|
|
|
void reset_group_peak_display (ARDOUR::RouteGroup*);
|
|
|
|
|
2013-07-05 16:18:04 -04:00
|
|
|
void redraw_metrics ();
|
2007-06-27 08:12:34 -04:00
|
|
|
void on_theme_changed ();
|
2008-03-17 16:54:03 -04:00
|
|
|
void color_handler(bool);
|
2011-10-19 05:56:00 -04:00
|
|
|
ARDOUR::DataType _data_type;
|
2011-08-19 13:52:32 -04:00
|
|
|
ARDOUR::ChanCount _previous_amp_output_streams;
|
2011-11-13 10:12:34 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
bool level_meter_button_press (GdkEventButton *);
|
|
|
|
PBD::ScopedConnection _level_meter_connection;
|
2020-04-10 17:36:17 -04:00
|
|
|
|
|
|
|
bool _clear_meters;
|
|
|
|
bool _meter_peaked;
|
2005-09-25 14:42:24 -04:00
|
|
|
};
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
class GainMeter : public GainMeterBase, public Gtk::VBox
|
|
|
|
{
|
|
|
|
public:
|
2013-01-11 13:33:57 -05:00
|
|
|
GainMeter (ARDOUR::Session*, int);
|
2013-07-18 03:00:24 -04:00
|
|
|
virtual ~GainMeter ();
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2009-06-09 16:21:19 -04:00
|
|
|
virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
|
2017-07-01 15:11:14 -04:00
|
|
|
boost::shared_ptr<ARDOUR::PeakMeter> meter,
|
2016-01-25 11:47:44 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Amp> amp,
|
2017-07-01 15:11:14 -04:00
|
|
|
boost::shared_ptr<ARDOUR::GainControl> control);
|
2008-12-08 11:07:28 -05:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
int get_gm_width ();
|
|
|
|
void setup_meters (int len=0);
|
2013-07-18 03:00:24 -04:00
|
|
|
void route_active_changed ();
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void hide_all_meters ();
|
|
|
|
|
|
|
|
gint meter_metrics_expose (GdkEventExpose *);
|
2013-07-05 08:55:07 -04:00
|
|
|
gint meter_ticks1_expose (GdkEventExpose *);
|
|
|
|
gint meter_ticks2_expose (GdkEventExpose *);
|
2014-08-29 22:17:10 -04:00
|
|
|
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
|
2019-07-13 08:57:57 -04:00
|
|
|
void redraw_metrics ();
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
private:
|
2010-12-28 19:55:25 -05:00
|
|
|
|
|
|
|
void meter_configuration_changed (ARDOUR::ChanCount);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
Gtk::HBox gain_display_box;
|
|
|
|
Gtk::HBox fader_box;
|
2016-03-08 14:56:07 -05:00
|
|
|
Gtk::VBox fader_vbox;
|
2008-09-10 11:03:30 -04:00
|
|
|
Gtk::HBox hbox;
|
2013-07-05 08:55:07 -04:00
|
|
|
Gtk::HBox meter_hbox;
|
2011-05-18 02:53:24 -04:00
|
|
|
Gtk::Alignment fader_alignment;
|
|
|
|
Gtk::Alignment meter_alignment;
|
2010-12-28 19:55:25 -05:00
|
|
|
std::vector<ARDOUR::DataType> _types;
|
2008-09-10 11:03:30 -04:00
|
|
|
};
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#endif /* __ardour_gtk_gain_meter_h__ */
|
|
|
|
|