Add a meter to Foldback bus

Spaces got replaced by tabs as well.
This commit is contained in:
Len Ovens 2020-05-07 17:12:36 -07:00
parent 21bb10238e
commit 8e1e271eba
3 changed files with 117 additions and 49 deletions

View file

@ -26,11 +26,14 @@
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/user_bundle.h" #include "ardour/user_bundle.h"
#include "ardour/value_as_string.h" #include "ardour/value_as_string.h"
#include "ardour/meter.h"
#include "ardour/logmeter.h"
#include "gtkmm2ext/gtk_ui.h" #include "gtkmm2ext/gtk_ui.h"
#include "gtkmm2ext/menu_elems.h" #include "gtkmm2ext/menu_elems.h"
#include "gtkmm2ext/utils.h" #include "gtkmm2ext/utils.h"
#include "gtkmm2ext/doi.h" #include "gtkmm2ext/doi.h"
#include "pbd/fastlog.h"
#include "widgets/tooltips.h" #include "widgets/tooltips.h"
@ -298,11 +301,13 @@ FoldbackStrip::FoldbackStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr<Rou
, _mixer_owned (true) , _mixer_owned (true)
, _showing_sends (false) , _showing_sends (false)
, _width (80) , _width (80)
, _peak_meter (0)
, _pr_selection () , _pr_selection ()
, panners (sess) , panners (sess)
, _plugin_insert_cnt (0) , _plugin_insert_cnt (0)
, _comment_button (_("Comments")) , _comment_button (_("Comments"))
, fb_level_control (0) , fb_level_control (0)
, _meter (0)
{ {
_session = sess; _session = sess;
init (); init ();
@ -365,6 +370,27 @@ FoldbackStrip::init ()
insert_box->set_width (Wide); insert_box->set_width (Wide);
insert_box->set_size_request (PX_SCALE(_width + 34), PX_SCALE(160)); insert_box->set_size_request (PX_SCALE(_width + 34), PX_SCALE(160));
_meter = new FastMeter ((uint32_t) floor (UIConfiguration::instance().get_meter_hold()),
8, FastMeter::Horizontal, PX_SCALE(100),
UIConfiguration::instance().color ("meter color0"),
UIConfiguration::instance().color ("meter color1"),
UIConfiguration::instance().color ("meter color2"),
UIConfiguration::instance().color ("meter color3"),
UIConfiguration::instance().color ("meter color4"),
UIConfiguration::instance().color ("meter color5"),
UIConfiguration::instance().color ("meter color6"),
UIConfiguration::instance().color ("meter color7"),
UIConfiguration::instance().color ("meter color8"),
UIConfiguration::instance().color ("meter color9"),
UIConfiguration::instance().color ("meter background bottom"),
UIConfiguration::instance().color ("meter background top"),
0x991122ff, 0x551111ff,
(115.0 * log_meter0dB(-15)),
89.125,
106.375,
115.0,
(UIConfiguration::instance().get_meter_style_led() ? 3 : 1));
fb_level_control = new ArdourKnob (ArdourKnob::default_elements, ArdourKnob::Detent); fb_level_control = new ArdourKnob (ArdourKnob::default_elements, ArdourKnob::Detent);
fb_level_control->set_size_request (PX_SCALE(50), PX_SCALE(50)); fb_level_control->set_size_request (PX_SCALE(50), PX_SCALE(50));
fb_level_control->set_tooltip_prefix (_("Level: ")); fb_level_control->set_tooltip_prefix (_("Level: "));
@ -421,6 +447,7 @@ FoldbackStrip::init ()
global_vpacker.pack_end (_comment_button, Gtk::PACK_SHRINK); global_vpacker.pack_end (_comment_button, Gtk::PACK_SHRINK);
global_vpacker.pack_end (output_button, Gtk::PACK_SHRINK); global_vpacker.pack_end (output_button, Gtk::PACK_SHRINK);
global_vpacker.pack_end (master_box, Gtk::PACK_SHRINK); global_vpacker.pack_end (master_box, Gtk::PACK_SHRINK);
global_vpacker.pack_end (*_meter, false, false);
global_vpacker.pack_end (*insert_box, Gtk::PACK_SHRINK); global_vpacker.pack_end (*insert_box, Gtk::PACK_SHRINK);
global_vpacker.pack_end (panners, Gtk::PACK_SHRINK); global_vpacker.pack_end (panners, Gtk::PACK_SHRINK);
@ -543,6 +570,7 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
return; return;
} }
if (_route) { if (_route) {
// just in case
_route->solo_control()->set_value (0.0, Controllable::NoGroup); _route->solo_control()->set_value (0.0, Controllable::NoGroup);
} }
@ -562,6 +590,12 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
_route->panner_shell()->Changed.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::connect_to_pan, this), gui_context()); _route->panner_shell()->Changed.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::connect_to_pan, this), gui_context());
} }
// set up metering
_peak_meter = _route->shared_peak_meter().get();
_route->set_meter_point (MeterPostFader);
// _route->set_meter_point (MeterPreFader);
_route->set_meter_type (MeterPeak0dB);
_route->output()->changed.connect (*this, invalidator (*this), boost::bind (&FoldbackStrip::update_output_display, this), gui_context()); _route->output()->changed.connect (*this, invalidator (*this), boost::bind (&FoldbackStrip::update_output_display, this), gui_context());
_route->io_changed.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::io_changed_proxy, this), gui_context ()); _route->io_changed.connect (route_connections, invalidator (*this), boost::bind (&FoldbackStrip::io_changed_proxy, this), gui_context ());
@ -589,6 +623,7 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
send_scroller.show (); send_scroller.show ();
_show_sends_button.show(); _show_sends_button.show();
insert_box->show (); insert_box->show ();
_meter->show ();
master_box.show(); master_box.show();
output_button.show(); output_button.show();
_comment_button.show(); _comment_button.show();
@ -1316,6 +1351,29 @@ FoldbackStrip::show_sends_clicked ()
} }
} }
void
FoldbackStrip::fast_update ()
{
/*
* As this is the output level to a DAC, peak level is what is important
* So, much like the mackie control, we just want the highest peak from
* all channels in the route.
*/
float meter_level = -199.0;
uint32_t mn = _peak_meter->input_streams().n_audio();
for (uint32_t n = 0; n != mn; ++n) {
const float peak = _peak_meter->meter_level(n, MeterPeak0dB);
if (peak > meter_level) {
meter_level = peak;
}
}
_meter->set (log_meter0dB (meter_level));
}
void void
FoldbackStrip::send_blink (bool onoff) FoldbackStrip::send_blink (bool onoff)
{ {

View file

@ -40,11 +40,13 @@
#include "ardour/types.h" #include "ardour/types.h"
#include "ardour/ardour.h" #include "ardour/ardour.h"
#include "ardour/processor.h" #include "ardour/processor.h"
#include "ardour/meter.h"
#include "pbd/fastlog.h" #include "pbd/fastlog.h"
#include "widgets/ardour_button.h" #include "widgets/ardour_button.h"
#include "widgets/ardour_knob.h" #include "widgets/ardour_knob.h"
#include "widgets/fastmeter.h"
#include "route_ui.h" #include "route_ui.h"
#include "panner_ui.h" #include "panner_ui.h"
@ -60,6 +62,7 @@ namespace ARDOUR {
class PortInsert; class PortInsert;
class Bundle; class Bundle;
class Plugin; class Plugin;
class PeakMeter;
} }
namespace Gtk { namespace Gtk {
class Window; class Window;
@ -126,6 +129,8 @@ public:
void set_embedded (bool); void set_embedded (bool);
void fast_update ();
void set_route (boost::shared_ptr<ARDOUR::Route>); void set_route (boost::shared_ptr<ARDOUR::Route>);
void set_button_names (); void set_button_names ();
void revert_to_default_display (); void revert_to_default_display ();
@ -176,6 +181,7 @@ private:
ARDOUR::Session* _session; ARDOUR::Session* _session;
bool _showing_sends; bool _showing_sends;
uint32_t _width; uint32_t _width;
ARDOUR::PeakMeter* _peak_meter;
Gtk::EventBox spacer; Gtk::EventBox spacer;
Gtk::VBox send_display; Gtk::VBox send_display;
@ -204,6 +210,7 @@ private:
ArdourWidgets::ArdourButton _hide_button; ArdourWidgets::ArdourButton _hide_button;
ArdourWidgets::ArdourButton _comment_button; ArdourWidgets::ArdourButton _comment_button;
ArdourWidgets::ArdourKnob* fb_level_control; ArdourWidgets::ArdourKnob* fb_level_control;
ArdourWidgets::FastMeter* _meter;
void setup_comment_button (); void setup_comment_button ();
void hide_clicked(); void hide_clicked();

View file

@ -1388,6 +1388,9 @@ Mixer_UI::fast_update_strips ()
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) { for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
(*i)->fast_update (); (*i)->fast_update ();
} }
if (foldback_strip) {
foldback_strip->fast_update ();
}
} }
} }