2007-12-20 18:25:19 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2008-2014 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2007-12-20 18:25:19 -05:00
|
|
|
|
|
|
|
#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
|
|
|
|
2017-07-16 16:13:46 -04:00
|
|
|
#include "widgets/fastmeter.h"
|
|
|
|
#include "widgets/focus_entry.h"
|
|
|
|
#include "widgets/slider_controller.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
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2013-07-28 14:43:21 -04:00
|
|
|
LevelMeterBase (ARDOUR::Session*, PBD::EventLoop::InvalidationRecord* ir,
|
2017-07-16 16:13:46 -04:00
|
|
|
ArdourWidgets::FastMeter::Orientation o = ArdourWidgets::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);
|
2016-05-04 11:36:40 -04:00
|
|
|
void set_max_audio_meter_count (uint32_t cnt = 0);
|
2007-12-20 18:25:19 -05:00
|
|
|
|
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;
|
2011-11-13 10:12:34 -05:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
protected:
|
2013-07-25 08:18:39 -04:00
|
|
|
virtual void mtr_pack(Gtk::Widget &w) = 0;
|
|
|
|
virtual void mtr_remove(Gtk::Widget &w) = 0;
|
|
|
|
|
2017-07-01 15:11:14 -04: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;
|
2017-07-16 16:13:46 -04:00
|
|
|
ArdourWidgets::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 {
|
2017-07-16 16:13:46 -04:00
|
|
|
ArdourWidgets::FastMeter* meter;
|
|
|
|
gint16 width;
|
|
|
|
int length;
|
|
|
|
bool packed;
|
|
|
|
float max_peak;
|
2017-07-01 12:42:24 -04:00
|
|
|
|
|
|
|
MeterInfo() {
|
|
|
|
meter = 0;
|
|
|
|
width = 0;
|
|
|
|
length = 0;
|
|
|
|
packed = false;
|
|
|
|
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-24 10:15:06 -04:00
|
|
|
ARDOUR::MeterType visible_meter_type;
|
2016-07-22 06:57:14 -04:00
|
|
|
uint32_t midi_count;
|
2016-05-04 11:36:40 -04:00
|
|
|
uint32_t meter_count;
|
|
|
|
uint32_t max_visible_meters;
|
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
|
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2013-07-25 08:18:39 -04:00
|
|
|
LevelMeterHBox (ARDOUR::Session*);
|
|
|
|
~LevelMeterHBox();
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
protected:
|
2013-07-25 08:18:39 -04:00
|
|
|
void mtr_pack(Gtk::Widget &w);
|
|
|
|
void mtr_remove(Gtk::Widget &w);
|
|
|
|
};
|
|
|
|
|
|
|
|
class LevelMeterVBox : public LevelMeterBase, public Gtk::VBox
|
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2013-07-25 08:18:39 -04:00
|
|
|
LevelMeterVBox (ARDOUR::Session*);
|
|
|
|
~LevelMeterVBox();
|
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
protected:
|
2013-07-25 08:18:39 -04:00
|
|
|
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__ */
|
|
|
|
|