mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:07:36 +00:00
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.
This commit is contained in:
parent
a861d2b728
commit
aea8a040b3
11 changed files with 83 additions and 132 deletions
|
@ -10,6 +10,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Music.h"
|
||||
#include <LibDSP/Keyboard.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
|
||||
class AudioPlayerLoop;
|
||||
|
@ -28,7 +29,7 @@ public:
|
|||
|
||||
void add_track_actions(GUI::Menu&);
|
||||
|
||||
void set_octave_and_ensure_note_change(Direction);
|
||||
void set_octave_and_ensure_note_change(LibDSP::Keyboard::Direction);
|
||||
void set_octave_and_ensure_note_change(int);
|
||||
|
||||
private:
|
||||
|
@ -38,7 +39,7 @@ private:
|
|||
virtual void keyup_event(GUI::KeyEvent&) override;
|
||||
virtual void custom_event(Core::CustomEvent&) override;
|
||||
|
||||
void note_key_action(int key_code, Switch);
|
||||
void note_key_action(int key_code, LibDSP::Keyboard::Switch);
|
||||
void special_key_action(int key_code);
|
||||
|
||||
void turn_off_pressed_keys();
|
||||
|
@ -56,5 +57,6 @@ private:
|
|||
RefPtr<KnobsWidget> m_knobs_widget;
|
||||
RefPtr<PlayerWidget> m_player_widget;
|
||||
|
||||
// Not the piano keys, but the computer keyboard keys!
|
||||
bool m_keys_pressed[key_code_count] { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue