1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:07:45 +00:00

Piano: Allow per-track controls (again)

This makes Piano exactly as usable as when I started the large refactor
some years ago, which *sounds* like I'm a terrible person but now it (1)
looks nicer and (2) has a flexible backend that can already deal with
aribtrary kinds of processors on any track.
This commit is contained in:
kleines Filmröllchen 2023-02-27 15:31:43 +01:00 committed by Jelle Raaijmakers
parent d757027638
commit 0ab19dc4cd
9 changed files with 92 additions and 45 deletions

View file

@ -8,6 +8,7 @@
*/
#include "RollWidget.h"
#include "LibDSP/Music.h"
#include "TrackManager.h"
#include <AK/IntegralMath.h>
#include <LibGUI/Event.h>
@ -127,7 +128,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event)
int distance_to_next_x = next_x_pos - x_pos;
Gfx::IntRect rect(x_pos, y_pos, distance_to_next_x, note_height);
if (m_track_manager.keyboard()->is_pressed(note))
if (static_cast<size_t>(note) < DSP::note_frequencies.size() && m_track_manager.keyboard()->is_pressed(note))
painter.fill_rect(rect, note_pressed_color.with_alpha(128));
}
}