From 4d9ede3d127572efe2605d28f5930a475137e273 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 5 Nov 2017 13:57:32 +0100 Subject: Add stddev sample selection scalar to UI. --- plugingui/humanizerframecontent.cc | 27 +++++++++++++++++++++++---- plugingui/humanizerframecontent.h | 4 ++++ src/settings.h | 2 +- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/plugingui/humanizerframecontent.cc b/plugingui/humanizerframecontent.cc index 6753836..96b54a8 100644 --- a/plugingui/humanizerframecontent.cc +++ b/plugingui/humanizerframecontent.cc @@ -54,20 +54,29 @@ HumanizerframeContent::HumanizerframeContent(Widget* parent, falloff.setControl(&falloff_knob); layout.addItem(&falloff); + stddev.resize(80, 80); + stddev_knob.resize(30, 30); + stddev_knob.showValue(false); + stddev.setControl(&stddev_knob); + layout.addItem(&stddev); + layout.setPosition(&attack, GridLayout::GridRange{1, 2, 0, 1}); layout.setPosition(&falloff, GridLayout::GridRange{2, 3, 0, 1}); + layout.setPosition(&stddev, GridLayout::GridRange{3, 3, 0, 1}); - CONNECT(this, settings_notifier.velocity_modifier_falloff, - &falloff_knob, &Knob::setValue); CONNECT(this, settings_notifier.velocity_modifier_weight, &attack_knob, &Knob::setValue); + CONNECT(this, settings_notifier.velocity_modifier_falloff, + &falloff_knob, &Knob::setValue); + CONNECT(this, settings_notifier.velocity_stddev, + this, &HumanizerframeContent::stddevSettingsValueChanged); CONNECT(&attack_knob, valueChangedNotifier, this, &HumanizerframeContent::attackValueChanged); - CONNECT(&falloff_knob, valueChangedNotifier, this, &HumanizerframeContent::falloffValueChanged); - + CONNECT(&stddev_knob, valueChangedNotifier, + this, &HumanizerframeContent::stddevKnobValueChanged); } void HumanizerframeContent::attackValueChanged(float value) @@ -80,4 +89,14 @@ void HumanizerframeContent::falloffValueChanged(float value) settings.velocity_modifier_falloff.store(value); } +void HumanizerframeContent::stddevKnobValueChanged(float value) +{ + settings.velocity_stddev.store(value * 3.0f + 0.5f ); +} + +void HumanizerframeContent::stddevSettingsValueChanged(float value) +{ + stddev_knob.setValue((value - 0.5f) / 3.0f); +} + } // GUI:: diff --git a/plugingui/humanizerframecontent.h b/plugingui/humanizerframecontent.h index e13f739..61ba73b 100644 --- a/plugingui/humanizerframecontent.h +++ b/plugingui/humanizerframecontent.h @@ -93,14 +93,18 @@ public: private: void attackValueChanged(float value); void falloffValueChanged(float value); + void stddevKnobValueChanged(float value); + void stddevSettingsValueChanged(float value); GridLayout layout{this, 4, 1}; LabeledControl attack{this, "Attack"}; LabeledControl falloff{this, "Release"}; + LabeledControl stddev{this, "StdDev"}; Knob attack_knob{&attack}; Knob falloff_knob{&falloff}; + Knob stddev_knob{&stddev}; Settings& settings; SettingsNotifier& settings_notifier; diff --git a/src/settings.h b/src/settings.h index 8f7c057..6bba237 100644 --- a/src/settings.h +++ b/src/settings.h @@ -73,7 +73,7 @@ struct Settings Atomic enable_velocity_modifier{true}; Atomic velocity_modifier_falloff{0.5f}; Atomic velocity_modifier_weight{0.25f}; - Atomic velocity_stddev{1.0f}; + Atomic velocity_stddev{1.0f}; // [0.5; 3.0] Atomic enable_velocity_randomiser{false}; Atomic velocity_randomiser_weight{0.1f}; -- cgit v1.2.3