mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
Piano: Fix roll playback at startup
This is not a bug currently, since the first column immediately starts playing at startup and leaves no time for the user to put notes in it. However, this is needed for exporting.
This commit is contained in:
parent
9a05bbaace
commit
5dc014b261
2 changed files with 7 additions and 0 deletions
|
@ -45,6 +45,9 @@ void AudioEngine::fill_buffer(FixedArray<Sample>& buffer)
|
|||
{
|
||||
memset(buffer.data(), 0, buffer_size);
|
||||
|
||||
if (m_time == 0)
|
||||
set_notes_from_roll();
|
||||
|
||||
for (size_t i = 0; i < buffer.size(); ++i) {
|
||||
for (size_t note = 0; note < note_count; ++note) {
|
||||
switch (m_envelope[note]) {
|
||||
|
@ -224,7 +227,10 @@ void AudioEngine::update_roll()
|
|||
m_current_column = 0;
|
||||
if (++m_previous_column == horizontal_notes)
|
||||
m_previous_column = 0;
|
||||
}
|
||||
|
||||
void AudioEngine::set_notes_from_roll()
|
||||
{
|
||||
for (int note = 0; note < note_count; ++note) {
|
||||
if (m_roll_notes[note][m_previous_column] == On)
|
||||
set_note((note_count - 1) - note, Off);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue