mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03:00
Piano: Add velocity and pitch support
As Piano will later move to the RollNote defintions of LibDSP, it's a good idea to already insert velocity and pitch support, even though it's currently not used.
This commit is contained in:
parent
fdef6e5f76
commit
ad6a332268
Notes:
sideshowbarker
2024-07-18 05:02:20 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/ad6a332268d Pull-request: https://github.com/SerenityOS/serenity/pull/9638 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/alimpfard
@ -42,6 +42,8 @@ struct RollNote {
|
||||
|
||||
u32 on_sample;
|
||||
u32 off_sample;
|
||||
u8 pitch;
|
||||
i8 velocity;
|
||||
};
|
||||
|
||||
enum Direction {
|
||||
|
@ -228,7 +228,7 @@ void RollWidget::mousemove_event(GUI::MouseEvent& event)
|
||||
u32 on_sample = roll_length * (static_cast<double>(min(x0, x1)) / m_num_notes);
|
||||
u32 off_sample = (roll_length * (static_cast<double>(max(x0, x1) + 1) / m_num_notes)) - 1;
|
||||
m_track_manager.current_track().set_roll_note(m_drag_note, on_sample, off_sample);
|
||||
m_note_drag_location = RollNote({ on_sample, off_sample });
|
||||
m_note_drag_location = RollNote { on_sample, off_sample, (u8)m_drag_note, 0 };
|
||||
|
||||
update();
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ void Track::sync_roll(int note)
|
||||
|
||||
void Track::set_roll_note(int note, u32 on_sample, u32 off_sample)
|
||||
{
|
||||
RollNote new_roll_note = { on_sample, off_sample };
|
||||
RollNote new_roll_note = { on_sample, off_sample, (u8)note, 0 };
|
||||
|
||||
VERIFY(note >= 0 && note < note_count);
|
||||
VERIFY(new_roll_note.off_sample < roll_length);
|
||||
|
Loading…
Reference in New Issue
Block a user