more explicit and sensible error handling

This commit is contained in:
goeiecool9999 2024-02-12 12:24:32 +01:00
parent e0f5a9f98e
commit f1d4c399a2
2 changed files with 22 additions and 4 deletions

View file

@ -862,7 +862,15 @@ void LatteShaderCache_StreamBootSound()
while(audiothread_keeprunning)
{
while (bootSndAudioDev->NeedAdditionalBlocks())
bootSndAudioDev->FeedBlock(bootSndFileReader->getSamples());
{
sint16* data = bootSndFileReader->getSamples();
if(data == nullptr)
{
audiothread_keeprunning = false;
break;
}
bootSndAudioDev->FeedBlock(data);
}
// sleep for the duration of a single block
std::this_thread::sleep_for(std::chrono::milliseconds(samplesPerBlock / (sampleRate/ 1'000)));
}