summaryrefslogtreecommitdiff
path: root/Userland/Applications/Piano/KnobsWidget.cpp
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2022-05-14 01:11:23 +0200
committerLinus Groh <mail@linusgroh.de>2022-05-26 10:24:43 +0100
commitaea8a040b350243b4c8f5e50a9c44e58e18c0288 (patch)
treeb327b39d0eb4e0db273332d8a1a1501dd80dc3d6 /Userland/Applications/Piano/KnobsWidget.cpp
parenta861d2b7285bf8bad44d824db311966a0b3fe606 (diff)
downloadserenity-aea8a040b350243b4c8f5e50a9c44e58e18c0288.zip
Piano: Use LibDSP::Keyboard for all keyboard-playing logic
The only major functional change is that the Track now needs to know whether it's active or not, in order to listen to the keyboard (or not). There are some bugs exposed/created by this, mainly: * KeysWidget sometimes shows phantom notes. Those do not actually exist as far as debugging has revealed and do not play in the synth. * The keyboard can lock up Piano when rapidly pressing keys. This appears to be a HashMap bug; I invested significant time in bugfixing but got nowhere.
Diffstat (limited to 'Userland/Applications/Piano/KnobsWidget.cpp')
-rw-r--r--Userland/Applications/Piano/KnobsWidget.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Applications/Piano/KnobsWidget.cpp b/Userland/Applications/Piano/KnobsWidget.cpp
index 17fe3486fa..74281af578 100644
--- a/Userland/Applications/Piano/KnobsWidget.cpp
+++ b/Userland/Applications/Piano/KnobsWidget.cpp
@@ -35,7 +35,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget)
m_values_container->set_fixed_height(10);
m_volume_value = m_values_container->add<GUI::Label>(String::number(m_track_manager.current_track().volume()));
- m_octave_value = m_values_container->add<GUI::Label>(String::number(m_track_manager.octave()));
+ m_octave_value = m_values_container->add<GUI::Label>(String::number(m_track_manager.keyboard()->virtual_keyboard_octave()));
m_knobs_container = add<GUI::Widget>();
m_knobs_container->set_layout<GUI::HorizontalBoxLayout>();
@@ -57,13 +57,13 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget)
m_octave_knob = m_knobs_container->add<GUI::VerticalSlider>();
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((octave_max - 1) - (m_track_manager.octave() - 1));
+ m_octave_knob->set_value((octave_max - 1) - (m_track_manager.keyboard()->virtual_keyboard_octave() - 1));
m_octave_knob->set_step(1);
m_octave_knob->on_change = [this](int value) {
int new_octave = octave_max - value;
if (m_change_underlying)
m_main_widget.set_octave_and_ensure_note_change(new_octave);
- VERIFY(new_octave == m_track_manager.octave());
+ VERIFY(new_octave == m_track_manager.keyboard()->virtual_keyboard_octave());
m_octave_value->set_text(String::number(new_octave));
};
@@ -117,7 +117,7 @@ void KnobsWidget::update_knobs()
m_change_underlying = false;
m_volume_knob->set_value(volume_max - m_track_manager.current_track().volume());
- m_octave_knob->set_value(octave_max - m_track_manager.octave());
+ m_octave_knob->set_value(octave_max - m_track_manager.keyboard()->virtual_keyboard_octave());
m_change_underlying = true;
}