summaryrefslogtreecommitdiff
path: root/Applications/Piano
diff options
context:
space:
mode:
authorWilliam McPherson <willmcpherson2@gmail.com>2020-02-05 01:04:32 +1100
committerAndreas Kling <kling@serenityos.org>2020-02-05 17:52:10 +0100
commitf9090959816f5cde565c2931b2bf9af1cf5b889a (patch)
tree129322ea7461b32723328eaca45cfebf4e42f3cd /Applications/Piano
parent47978a5828eaaf5150fa347b8499b1a2b78a9e36 (diff)
downloadserenity-f9090959816f5cde565c2931b2bf9af1cf5b889a.zip
Piano: Fix default knob values
Now you can change the defaults in AudioEngine and not be totally confused. 1. The default for m_octave_knob was actually upside-down. 2. The default for m_decay_knob wasn't respecting AudioEngine. 3. The default for m_delay_knob wasn't respecting AudioEngine.
Diffstat (limited to 'Applications/Piano')
-rw-r--r--Applications/Piano/KnobsWidget.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Applications/Piano/KnobsWidget.cpp b/Applications/Piano/KnobsWidget.cpp
index f543281edc..4ec786ebad 100644
--- a/Applications/Piano/KnobsWidget.cpp
+++ b/Applications/Piano/KnobsWidget.cpp
@@ -71,7 +71,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid
m_octave_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container);
m_octave_knob->set_tooltip("Z: octave down, X: octave up");
m_octave_knob->set_range(octave_min - 1, octave_max - 1);
- m_octave_knob->set_value(m_audio_engine.octave() - 1);
+ m_octave_knob->set_value((octave_max - 1) - (m_audio_engine.octave() - 1));
m_octave_knob->on_value_changed = [this](int value) {
int new_octave = octave_max - value;
if (m_change_octave)
@@ -94,7 +94,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid
constexpr int max_decay = 20;
m_decay_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container);
m_decay_knob->set_range(0, max_decay);
- m_decay_knob->set_value(max_decay);
+ m_decay_knob->set_value(max_decay - m_audio_engine.decay());
m_decay_knob->on_value_changed = [this](int value) {
int new_decay = max_decay - value;
m_audio_engine.set_decay(new_decay);
@@ -105,7 +105,7 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid
constexpr int max_delay = 8;
m_delay_knob = GUI::Slider::construct(Orientation::Vertical, m_knobs_container);
m_delay_knob->set_range(0, max_delay);
- m_delay_knob->set_value(max_delay);
+ m_delay_knob->set_value(max_delay - (m_audio_engine.delay() / m_audio_engine.tick()));
m_delay_knob->on_value_changed = [this](int value) {
int new_delay = m_audio_engine.tick() * (max_delay - value);
m_audio_engine.set_delay(new_delay);