1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 12:47:35 +00:00

Piano: Highlight pressed key in roll widget

This commit is contained in:
Peter Elliott 2020-10-05 20:31:01 -07:00 committed by Andreas Kling
parent 0c5497829e
commit 01bff0141e
6 changed files with 25 additions and 1 deletions

View file

@ -63,6 +63,17 @@ void KeysWidget::set_key(int key, Switch switch_key)
m_track_manager.set_note_current_octave(key, switch_key);
}
bool KeysWidget::note_is_set(int note) const
{
if (note < m_track_manager.octave_base())
return false;
if (note >= m_track_manager.octave_base() + note_count)
return false;
return m_key_on[note - m_track_manager.octave_base()] != 0;
}
int KeysWidget::key_code_to_key(int key_code) const
{
switch (key_code) {