From 43ab0002e3048684b5661a5c341fc5f0e0f49f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Thu, 30 Apr 2020 22:25:44 +0200 Subject: Mark last input and output in powermap widget. --- plugingui/powerwidget.cc | 14 ++++++++++++++ src/powermapfilter.cc | 2 ++ src/settings.h | 15 +++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/plugingui/powerwidget.cc b/plugingui/powerwidget.cc index 2d24fa0..7e8a904 100644 --- a/plugingui/powerwidget.cc +++ b/plugingui/powerwidget.cc @@ -105,6 +105,10 @@ PowerWidget::Canvas::Canvas(GUI::Widget* parent, this, &PowerWidget::Canvas::parameterChangedFloat); CONNECT(this, settings_notifier.powermap_shelf, this, &PowerWidget::Canvas::parameterChangedBool); + CONNECT(this, settings_notifier.powermap_input, + this, &PowerWidget::Canvas::parameterChangedFloat); + CONNECT(this, settings_notifier.powermap_output, + this, &PowerWidget::Canvas::parameterChangedFloat); parameterChangedFloat(0); } @@ -170,6 +174,16 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) p.drawLine(x0, y0 + height0, x0 + width0, y0); } + // draw the input/output of the last hit + if(settings.powermap_input.load() != -1 && settings.powermap_output.load() != -1) + { + p.setColour(GUI::Colour(.8f, 0.0f, .2f, .5f)); + p.drawLine(x0 + settings.powermap_input.load()*width0, y0 + height0, + x0 + settings.powermap_input.load()*width0, y0); + p.drawLine(x0, y0 + height0 - settings.powermap_output.load()*height0, + x0 + width0, y0 + height0 - settings.powermap_output.load()*height0); + } + // draw the fixed nodes of the spline float rad = radius * width(); p.setColour(GUI::Colour{0.0f, 1.0f, 0.0f, 0.7f}); diff --git a/src/powermapfilter.cc b/src/powermapfilter.cc index 702a837..45df51e 100644 --- a/src/powermapfilter.cc +++ b/src/powermapfilter.cc @@ -38,6 +38,7 @@ bool PowermapFilter::filter(event_t& event, size_t pos) // the position is irrelevant for this filter (void) pos; + settings.powermap_input.store(event.velocity); if (settings.enable_powermap.load()) { powermap.setFixed0({settings.powermap_fixed0_x.load(), settings.powermap_fixed0_y.load()}); @@ -47,6 +48,7 @@ bool PowermapFilter::filter(event_t& event, size_t pos) event.velocity = powermap.map(event.velocity); } + settings.powermap_output.store(event.velocity); return true; } diff --git a/src/settings.h b/src/settings.h index 471d730..a3d21d0 100644 --- a/src/settings.h +++ b/src/settings.h @@ -154,6 +154,10 @@ struct Settings Atomic powermap_fixed2_y{1.}; Atomic powermap_shelf{true}; + // Powermap visualizer; -1 is "none" + Atomic powermap_input{-1.}; + Atomic powermap_output{-1.}; + Atomic audition_counter{0}; Atomic audition_instrument; Atomic audition_velocity; @@ -228,6 +232,9 @@ struct SettingsGetter SettingRef powermap_fixed2_y; SettingRef powermap_shelf; + SettingRef powermap_input; + SettingRef powermap_output; + SettingRef audition_counter; SettingRef audition_instrument; SettingRef audition_velocity; @@ -284,6 +291,8 @@ struct SettingsGetter , powermap_fixed2_x{settings.powermap_fixed2_x} , powermap_fixed2_y{settings.powermap_fixed2_y} , powermap_shelf{settings.powermap_shelf} + , powermap_input{settings.powermap_input} + , powermap_output{settings.powermap_output} , audition_counter{settings.audition_counter} , audition_instrument{settings.audition_instrument} , audition_velocity{settings.audition_velocity} @@ -357,6 +366,9 @@ public: Notifier powermap_fixed2_y; Notifier powermap_shelf; + Notifier powermap_input; + Notifier powermap_output; + Notifier audition_counter; Notifier audition_instrument; Notifier audition_velocity; @@ -428,6 +440,9 @@ public: EVAL(powermap_fixed2_y); EVAL(powermap_shelf); + EVAL(powermap_input); + EVAL(powermap_output); + EVAL(audition_counter); EVAL(audition_instrument); EVAL(audition_velocity); -- cgit v1.2.3