mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:27:35 +00:00
Piano: Fix insertion and deletion of notes
On mouse move the pressed button is not present in the event argument which causes the corresponding code to never fire. Instead it now stores the original mouse down event and acts according to that on mouse move.
This commit is contained in:
parent
4ab7216827
commit
815442b2b5
6 changed files with 71 additions and 46 deletions
|
@ -14,6 +14,15 @@ Sample AudioClip::sample_at(u32 time)
|
|||
return m_samples[time];
|
||||
}
|
||||
|
||||
Optional<RollNote> NoteClip::note_at(u32 time, u8 pitch) const
|
||||
{
|
||||
for (auto& note : m_notes) {
|
||||
if (time >= note.on_sample && time <= note.off_sample && pitch == note.pitch)
|
||||
return note;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void NoteClip::set_note(RollNote note)
|
||||
{
|
||||
m_notes.remove_all_matching([&](auto const& other) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue