2007-12-20 18:25:19 -05: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_track_meter_h__
|
|
|
|
#define __ardour_gtk_track_meter_h__
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#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>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/types.h"
|
2010-03-18 22:49:01 -04:00
|
|
|
#include "ardour/chan_count.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
#include "ardour/session_handle.h"
|
2007-12-20 18:25:19 -05:00
|
|
|
|
|
|
|
#include <gtkmm2ext/click_box.h>
|
|
|
|
#include <gtkmm2ext/focus_entry.h>
|
|
|
|
#include <gtkmm2ext/slider_controller.h>
|
2013-07-25 08:18:39 -04:00
|
|
|
#include <gtkmm2ext/fastmeter.h>
|
2007-12-20 18:25:19 -05:00
|
|
|
|
|
|
|
#include "enums.h"
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
2009-05-04 13:05:55 -04:00
|
|
|
class PeakMeter;
|
2007-12-20 18:25:19 -05:00
|
|
|
}
|
|
|
|
namespace Gtk {
|
|
|
|
class Menu;
|
|
|
|
}
|
|
|
|
|
2014-09-27 13:17:13 -04:00
|
|
|
class LevelMeterBase : public ARDOUR::SessionHandlePtr, virtual public sigc::trackable
|
2007-12-20 18:25:19 -05:00
|
|
|
{
|
|
|
|
public:
|
2013-07-28 14:43:21 -04:00
|
|
|
LevelMeterBase (ARDOUR::Session*, PBD::EventLoop::InvalidationRecord* ir,
|
2013-07-25 08:18:39 -04:00
|
|
|
Gtkmm2ext::FastMeter::Orientation o = Gtkmm2ext::FastMeter::Vertical);
|
2013-07-28 14:43:21 -04:00
|
|
|
virtual ~LevelMeterBase ();
|
2007-12-20 18:25:19 -05:00
|
|
|
|
2009-05-16 22:08:13 -04:00
|
|
|
virtual void set_meter (ARDOUR::PeakMeter* meter);
|
2008-12-08 11:07:28 -05:00
|
|
|
|
2007-12-20 18:25:19 -05:00
|
|
|
void update_gain_sensitive ();
|
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
float update_meters ();
|
2007-12-20 18:25:19 -05:00
|
|
|
void update_meters_falloff ();
|
2013-07-06 20:52:37 -04:00
|
|
|
void clear_meters (bool reset_highlight = true);
|
2007-12-20 18:25:19 -05:00
|
|
|
void hide_meters ();
|
2013-06-28 14:22:09 -04:00
|
|
|
void setup_meters (int len=0, int width=3, int thin=2);
|
2007-12-20 18:25:19 -05:00
|
|
|
|
2013-07-06 20:00:43 -04:00
|
|
|
void set_type (ARDOUR::MeterType);
|
|
|
|
ARDOUR::MeterType get_type () { return meter_type; }
|
|
|
|
|
2011-11-13 10:12:34 -05:00
|
|
|
/** Emitted in the GUI thread when a button is pressed over the meter */
|
|
|
|
PBD::Signal1<bool, GdkEventButton *> ButtonPress;
|
2013-07-29 13:42:41 -04:00
|
|
|
PBD::Signal1<bool, GdkEventButton *> ButtonRelease;
|
2013-07-07 07:34:36 -04:00
|
|
|
PBD::Signal1<void, ARDOUR::MeterType> MeterTypeChanged;
|
2011-11-13 10:12:34 -05:00
|
|
|
|
2013-07-25 08:18:39 -04:00
|
|
|
protected:
|
|
|
|
virtual void mtr_pack(Gtk::Widget &w) = 0;
|
|
|
|
virtual void mtr_remove(Gtk::Widget &w) = 0;
|
|
|
|
|
2007-12-20 18:25:19 -05:00
|
|
|
private:
|
2013-07-28 14:43:21 -04:00
|
|
|
PBD::EventLoop::InvalidationRecord* parent_invalidator;
|
2009-05-04 13:05:55 -04:00
|
|
|
ARDOUR::PeakMeter* _meter;
|
2013-07-25 08:18:39 -04:00
|
|
|
Gtkmm2ext::FastMeter::Orientation _meter_orientation;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
Width _width;
|
2007-12-20 18:25:19 -05:00
|
|
|
|
|
|
|
struct MeterInfo {
|
|
|
|
Gtkmm2ext::FastMeter *meter;
|
2009-05-04 13:05:55 -04:00
|
|
|
gint16 width;
|
2010-03-10 12:31:16 -05:00
|
|
|
int length;
|
2009-05-04 13:05:55 -04:00
|
|
|
bool packed;
|
2013-07-06 10:32:36 -04:00
|
|
|
float max_peak;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
|
|
|
MeterInfo() {
|
2007-12-20 18:25:19 -05:00
|
|
|
meter = 0;
|
|
|
|
width = 0;
|
2010-03-10 12:31:16 -05:00
|
|
|
length = 0;
|
2007-12-20 18:25:19 -05:00
|
|
|
packed = false;
|
2013-07-06 10:32:36 -04:00
|
|
|
max_peak = -INFINITY;
|
2007-12-20 18:25:19 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-05-04 13:05:55 -04:00
|
|
|
guint16 regular_meter_width;
|
|
|
|
int meter_length;
|
2013-06-28 14:22:09 -04:00
|
|
|
guint16 thin_meter_width;
|
2009-05-04 13:05:55 -04:00
|
|
|
std::vector<MeterInfo> meters;
|
|
|
|
float max_peak;
|
2013-07-06 20:00:43 -04:00
|
|
|
ARDOUR::MeterType meter_type;
|
2013-07-24 10:15:06 -04:00
|
|
|
ARDOUR::MeterType visible_meter_type;
|
2009-05-04 13:05:55 -04:00
|
|
|
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::ScopedConnection _configuration_connection;
|
2013-07-07 07:34:36 -04:00
|
|
|
PBD::ScopedConnection _meter_type_connection;
|
2009-12-19 15:26:31 -05:00
|
|
|
PBD::ScopedConnection _parameter_connection;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-12-20 18:25:19 -05:00
|
|
|
void hide_all_meters ();
|
2011-11-13 10:12:34 -05:00
|
|
|
bool meter_button_press (GdkEventButton *);
|
|
|
|
bool meter_button_release (GdkEventButton *);
|
2007-12-20 18:25:19 -05:00
|
|
|
|
2009-05-15 21:22:43 -04:00
|
|
|
void parameter_changed (std::string);
|
2009-05-04 13:05:55 -04:00
|
|
|
void configuration_changed (ARDOUR::ChanCount in, ARDOUR::ChanCount out);
|
2013-07-07 07:34:36 -04:00
|
|
|
void meter_type_changed (ARDOUR::MeterType);
|
2007-12-20 18:25:19 -05:00
|
|
|
|
|
|
|
bool color_changed;
|
|
|
|
void color_handler ();
|
|
|
|
};
|
|
|
|
|
2013-07-25 08:18:39 -04:00
|
|
|
class LevelMeterHBox : public LevelMeterBase, public Gtk::HBox
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LevelMeterHBox (ARDOUR::Session*);
|
|
|
|
~LevelMeterHBox();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void mtr_pack(Gtk::Widget &w);
|
|
|
|
void mtr_remove(Gtk::Widget &w);
|
|
|
|
};
|
|
|
|
|
|
|
|
class LevelMeterVBox : public LevelMeterBase, public Gtk::VBox
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
LevelMeterVBox (ARDOUR::Session*);
|
|
|
|
~LevelMeterVBox();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void mtr_pack(Gtk::Widget &w);
|
|
|
|
void mtr_remove(Gtk::Widget &w);
|
|
|
|
};
|
|
|
|
|
2007-12-20 18:25:19 -05:00
|
|
|
#endif /* __ardour_gtk_track_meter_h__ */
|
|
|
|
|