mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:17:46 +00:00
Piano: Add Play/Pause, Forward and Back buttons
Piano now has a toolbar allowing the playback to be paused, or to be stepped forward or back a note.
This commit is contained in:
parent
54c005754a
commit
74f1f2b5e2
10 changed files with 234 additions and 69 deletions
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2019-2020, William McPherson <willmcpherson2@gmail.com>
|
||||
* Copyright (c) 2021 JJ Roberts-White <computerfido@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -16,6 +17,17 @@ TrackManager::~TrackManager()
|
|||
{
|
||||
}
|
||||
|
||||
void TrackManager::time_forward(int amount)
|
||||
{
|
||||
int new_value = (static_cast<int>(m_time) + amount) % roll_length;
|
||||
|
||||
if (new_value < 0) { // If the new time value is negaive add roll_length to wrap around
|
||||
m_time = roll_length + new_value;
|
||||
} else {
|
||||
m_time = new_value;
|
||||
}
|
||||
}
|
||||
|
||||
void TrackManager::fill_buffer(Span<Sample> buffer)
|
||||
{
|
||||
memset(buffer.data(), 0, buffer_size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue