2005-09-25 14:42:24 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2002 Paul Davis
|
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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/box.h>
|
|
|
|
#include <gtkmm/adjustment.h>
|
|
|
|
#include <gtkmm/frame.h>
|
|
|
|
#include <gtkmm/eventbox.h>
|
|
|
|
#include <gtkmm/button.h>
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
#include <gtkmm/drawingarea.h>
|
2007-05-25 16:29:12 -04:00
|
|
|
#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
|
|
|
|
2012-12-07 17:38:49 -05:00
|
|
|
#include "ardour_button.h"
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
#include "gtkmm2ext/click_box.h"
|
|
|
|
#include "gtkmm2ext/focus_entry.h"
|
|
|
|
#include "gtkmm2ext/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;
|
|
|
|
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
|
|
|
}
|
2005-09-25 18:26:56 -04:00
|
|
|
namespace Gtkmm2ext {
|
2005-09-25 14:42:24 -04:00
|
|
|
class FastMeter;
|
|
|
|
class BarController;
|
|
|
|
}
|
2005-11-28 23:41:15 -05:00
|
|
|
namespace Gtk {
|
|
|
|
class Menu;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
public:
|
2013-01-11 13:33:57 -05:00
|
|
|
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,
|
|
|
|
boost::shared_ptr<ARDOUR::PeakMeter> meter,
|
2009-07-21 10:39:21 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Amp> amp);
|
2008-12-08 11:07:28 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void update_gain_sensitive ();
|
|
|
|
void update_meters ();
|
|
|
|
|
|
|
|
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);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2012-12-07 17:38:49 -05:00
|
|
|
void set_flat_buttons ();
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
virtual void setup_meters (int len=0);
|
2013-07-07 00:17:02 -04:00
|
|
|
virtual void set_type (ARDOUR::MeterType);
|
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; }
|
2008-09-10 11:03:30 -04:00
|
|
|
Gtkmm2ext::SliderController& get_gain_slider() const { return *gain_slider; }
|
|
|
|
|
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;
|
|
|
|
|
2008-09-10 11:03:30 -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;
|
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;
|
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
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
Gtkmm2ext::SliderController *gain_slider;
|
2005-09-25 14:42:24 -04:00
|
|
|
Gtk::Adjustment gain_adjustment;
|
2006-11-29 23:21:32 -05:00
|
|
|
Gtkmm2ext::FocusEntry gain_display;
|
2007-03-12 10:24:05 -04:00
|
|
|
Gtk::Button peak_display;
|
2005-09-25 14:42:24 -04:00
|
|
|
Gtk::DrawingArea meter_metric_area;
|
2013-07-05 08:55:07 -04:00
|
|
|
Gtk::DrawingArea meter_ticks1_area;
|
|
|
|
Gtk::DrawingArea meter_ticks2_area;
|
2013-07-25 08:18:39 -04:00
|
|
|
LevelMeterHBox *level_meter;
|
2006-05-19 13:29:05 -04:00
|
|
|
|
|
|
|
sigc::connection gain_watching;
|
|
|
|
|
2012-12-07 17:38:49 -05:00
|
|
|
ArdourButton gain_automation_style_button;
|
|
|
|
ArdourButton gain_automation_state_button;
|
2006-05-19 13:29:05 -04:00
|
|
|
|
|
|
|
Gtk::Menu gain_astate_menu;
|
|
|
|
Gtk::Menu gain_astyle_menu;
|
|
|
|
|
|
|
|
gint gain_automation_style_button_event (GdkEventButton *);
|
|
|
|
gint gain_automation_state_button_event (GdkEventButton *);
|
|
|
|
gint pan_automation_style_button_event (GdkEventButton *);
|
|
|
|
gint pan_automation_state_button_event (GdkEventButton *);
|
|
|
|
|
|
|
|
void gain_automation_state_changed();
|
|
|
|
void gain_automation_style_changed();
|
|
|
|
|
2011-08-19 13:52:32 -04:00
|
|
|
void setup_gain_adjustment ();
|
|
|
|
|
2006-05-19 13:29:05 -04:00
|
|
|
std::string astate_string (ARDOUR::AutoState);
|
|
|
|
std::string short_astate_string (ARDOUR::AutoState);
|
|
|
|
std::string _astate_string (ARDOUR::AutoState, bool);
|
|
|
|
|
|
|
|
std::string astyle_string (ARDOUR::AutoStyle);
|
|
|
|
std::string short_astyle_string (ARDOUR::AutoStyle);
|
|
|
|
std::string _astyle_string (ARDOUR::AutoStyle, bool);
|
|
|
|
|
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
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void gain_adjusted ();
|
2007-06-29 00:02:58 -04:00
|
|
|
void gain_changed ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void meter_point_clicked ();
|
|
|
|
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);
|
|
|
|
|
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*);
|
|
|
|
|
2011-01-10 18:33:26 -05:00
|
|
|
bool gain_slider_button_press (GdkEventButton *);
|
|
|
|
bool gain_slider_button_release (GdkEventButton *);
|
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_release (GdkEventButton*);
|
|
|
|
gint meter_press (GdkEventButton*);
|
|
|
|
bool wait_for_release;
|
|
|
|
ARDOUR::MeterPoint old_meter_point;
|
|
|
|
|
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;
|
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,
|
|
|
|
boost::shared_ptr<ARDOUR::PeakMeter> meter,
|
2009-07-21 10:39:21 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Amp> amp);
|
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-07 00:17:02 -04:00
|
|
|
void set_type (ARDOUR::MeterType);
|
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 *);
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
private:
|
2010-12-28 19:55:25 -05:00
|
|
|
|
|
|
|
void meter_configuration_changed (ARDOUR::ChanCount);
|
2013-07-07 08:39:26 -04:00
|
|
|
void meter_type_changed (ARDOUR::MeterType);
|
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;
|
|
|
|
Gtk::VBox* fader_vbox;
|
|
|
|
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__ */
|
|
|
|
|