From 8148e68c4c4390208c5d8d8f1a9dab5f18f9066b Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sat, 24 Feb 2024 00:29:48 +0200 Subject: [PATCH] Sleep emulator thread if too many samples queued --- src/core/audio/teakra_core.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/audio/teakra_core.cpp b/src/core/audio/teakra_core.cpp index 454dbb9b..60dd5545 100644 --- a/src/core/audio/teakra_core.cpp +++ b/src/core/audio/teakra_core.cpp @@ -131,6 +131,7 @@ void TeakraDSP::setAudioEnabled(bool enable) { // Wait until we've actually got room to do so while (sampleBuffer.size() + 2 > sampleBuffer.Capacity()) { + std::this_thread::sleep_for(std::chrono::milliseconds{1}); } sampleBuffer.push(audioFrame.data(), audioFrame.size());