summaryrefslogtreecommitdiff
path: root/plugingui/humanizerframecontent.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2019-03-22 01:09:15 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2019-05-11 14:58:45 +0200
commit9c5efc23764522597a53a8745860cec54ea55d69 (patch)
treed672afdf2e11553d36370cc1abbef5033557f85e /plugingui/humanizerframecontent.cc
parent50b011c4740a5ec5338903b1d8b5fbb4b42f3df3 (diff)
Add settings and GUI for new sampling algorithm.
Diffstat (limited to 'plugingui/humanizerframecontent.cc')
-rw-r--r--plugingui/humanizerframecontent.cc82
1 files changed, 68 insertions, 14 deletions
diff --git a/plugingui/humanizerframecontent.cc b/plugingui/humanizerframecontent.cc
index 206d77d..db3fd97 100644
--- a/plugingui/humanizerframecontent.cc
+++ b/plugingui/humanizerframecontent.cc
@@ -59,13 +59,37 @@ HumanizerframeContent::HumanizerframeContent(Widget* parent,
stddev.resize(80, 80);
stddev_knob.resize(30, 30);
stddev_knob.showValue(false);
- stddev_knob.setDefaultValue(stddevSettingsToKnob(Settings::velocity_stddev_default));
+ stddev_knob.setDefaultValue(Settings::velocity_stddev_default/stddev_factor);
stddev.setControl(&stddev_knob);
layout.addItem(&stddev);
+ f_distance.resize(80, 80);
+ f_distance_knob.resize(30, 30);
+ f_distance_knob.showValue(false);
+ f_distance_knob.setDefaultValue(Settings::sample_selection_f_distance_default/f_distance_factor);
+ f_distance.setControl(&f_distance_knob);
+ layout.addItem(&f_distance);
+
+ f_recent.resize(80, 80);
+ f_recent_knob.resize(30, 30);
+ f_recent_knob.showValue(false);
+ f_recent_knob.setDefaultValue(Settings::sample_selection_f_recent_default/f_recent_factor);
+ f_recent.setControl(&f_recent_knob);
+ layout.addItem(&f_recent);
+
+ f_random.resize(80, 80);
+ f_random_knob.resize(30, 30);
+ f_random_knob.showValue(false);
+ f_random_knob.setDefaultValue(Settings::sample_selection_f_random_default/f_random_factor);
+ f_random.setControl(&f_random_knob);
+ layout.addItem(&f_random);
+
layout.setPosition(&attack, GridLayout::GridRange{0, 1, 0, 1});
layout.setPosition(&falloff, GridLayout::GridRange{1, 2, 0, 1});
layout.setPosition(&stddev, GridLayout::GridRange{2, 3, 0, 1});
+ layout.setPosition(&f_distance, GridLayout::GridRange{0, 1, 1, 2});
+ layout.setPosition(&f_recent, GridLayout::GridRange{1, 2, 1, 2});
+ layout.setPosition(&f_random, GridLayout::GridRange{2, 3, 1, 2});
CONNECT(this, settings_notifier.velocity_modifier_weight,
&attack_knob, &Knob::setValue);
@@ -73,6 +97,12 @@ HumanizerframeContent::HumanizerframeContent(Widget* parent,
&falloff_knob, &Knob::setValue);
CONNECT(this, settings_notifier.velocity_stddev,
this, &HumanizerframeContent::stddevSettingsValueChanged);
+ CONNECT(this, settings_notifier.sample_selection_f_distance,
+ this, &HumanizerframeContent::fDistanceSettingsValueChanged);
+ CONNECT(this, settings_notifier.sample_selection_f_recent,
+ this, &HumanizerframeContent::fRecentSettingsValueChanged);
+ CONNECT(this, settings_notifier.sample_selection_f_random,
+ this, &HumanizerframeContent::fRandomSettingsValueChanged);
CONNECT(&attack_knob, valueChangedNotifier,
this, &HumanizerframeContent::attackValueChanged);
@@ -80,38 +110,62 @@ HumanizerframeContent::HumanizerframeContent(Widget* parent,
this, &HumanizerframeContent::falloffValueChanged);
CONNECT(&stddev_knob, valueChangedNotifier,
this, &HumanizerframeContent::stddevKnobValueChanged);
+ CONNECT(&f_distance_knob, valueChangedNotifier,
+ this, &HumanizerframeContent::fDistanceKnobValueChanged);
+ CONNECT(&f_recent_knob, valueChangedNotifier,
+ this, &HumanizerframeContent::fRecentKnobValueChanged);
+ CONNECT(&f_random_knob, valueChangedNotifier,
+ this, &HumanizerframeContent::fRandomKnobValueChanged);
}
-float HumanizerframeContent::stddevSettingsToKnob(float value) const
+void HumanizerframeContent::attackValueChanged(float value)
{
- return value / 4.5f;
+ settings.velocity_modifier_weight.store(value);
}
-float HumanizerframeContent::stddevKnobToSettings(float value) const
+void HumanizerframeContent::falloffValueChanged(float value)
{
- return value * 4.5f;
+ settings.velocity_modifier_falloff.store(value);
}
-void HumanizerframeContent::attackValueChanged(float value)
+void HumanizerframeContent::stddevKnobValueChanged(float value)
{
- settings.velocity_modifier_weight.store(value);
+ settings.velocity_stddev.store(value*stddev_factor);
}
-void HumanizerframeContent::falloffValueChanged(float value)
+void HumanizerframeContent::fDistanceKnobValueChanged(float value)
{
- settings.velocity_modifier_falloff.store(value);
+ settings.sample_selection_f_distance.store(value*f_distance_factor);
}
-void HumanizerframeContent::stddevKnobValueChanged(float value)
+void HumanizerframeContent::fRecentKnobValueChanged(float value)
{
- auto settings_value = stddevKnobToSettings(value);
- settings.velocity_stddev.store(settings_value);
+ settings.sample_selection_f_recent.store(value*f_recent_factor);
+}
+
+void HumanizerframeContent::fRandomKnobValueChanged(float value)
+{
+ settings.sample_selection_f_random.store(value*f_random_factor);
}
void HumanizerframeContent::stddevSettingsValueChanged(float value)
{
- auto knob_value = stddevSettingsToKnob(value);
- stddev_knob.setValue(knob_value);
+ stddev_knob.setValue(value/stddev_factor);
+}
+
+void HumanizerframeContent::fDistanceSettingsValueChanged(float value)
+{
+ f_distance_knob.setValue(value/f_distance_factor);
+}
+
+void HumanizerframeContent::fRecentSettingsValueChanged(float value)
+{
+ f_recent_knob.setValue(value/f_recent_factor);
+}
+
+void HumanizerframeContent::fRandomSettingsValueChanged(float value)
+{
+ f_random_knob.setValue(value/f_random_factor);
}
} // GUI::