Piano: Guard against all allocations at top level of the audio pipeline

Therefore, we don't rely on LibDSP Processors to use allocation guards
themselves. It also demonstrates that nested allocation guards work
correctly :^)
This commit is contained in:
kleines Filmröllchen 2022-11-13 17:38:01 +01:00 committed by Linus Groh
parent 59a9f8a958
commit 276be7f8cc
Notes: sideshowbarker 2024-07-17 04:31:44 +09:00

View file

@ -9,6 +9,7 @@
#include "TrackManager.h"
#include "Music.h"
#include <AK/NoAllocationGuard.h>
#include <AK/NonnullRefPtr.h>
#include <AK/TypedTransfer.h>
#include <LibDSP/Effects.h>
@ -35,6 +36,7 @@ void TrackManager::time_forward(int amount)
void TrackManager::fill_buffer(FixedArray<DSP::Sample>& buffer)
{
NoAllocationGuard guard;
VERIFY(buffer.size() == m_temporary_track_buffer.size());
size_t sample_count = buffer.size();
// No need to zero the temp buffer as the track overwrites it anyways.