Fix infinite loop in InstrumentPlayHandle::play (#7176)

This commit is contained in:
saker
2024-03-29 12:36:20 -04:00
committed by GitHub
parent b2f2fc4ad1
commit bad57356d7

View File

@@ -47,22 +47,21 @@ void InstrumentPlayHandle::play(sampleFrame * working_buffer)
// ensure that all our nph's have been processed first
auto nphv = NotePlayHandle::nphsOfInstrumentTrack(instrumentTrack, true);
bool nphsLeft = false;
bool nphsLeft;
do
{
for (const NotePlayHandle * constNotePlayHandle : nphv)
nphsLeft = false;
for (const auto& handle : nphv)
{
if (constNotePlayHandle->state() != ThreadableJob::ProcessingState::Done &&
!constNotePlayHandle->isFinished())
if (handle->state() != ThreadableJob::ProcessingState::Done && !handle->isFinished())
{
nphsLeft = true;
NotePlayHandle * notePlayHandle = const_cast<NotePlayHandle *>(constNotePlayHandle);
notePlayHandle->process();
const_cast<NotePlayHandle*>(handle)->process();
}
}
}
while (nphsLeft);
m_instrument->play(working_buffer);
// Process the audio buffer that the instrument has just worked on...