From 8de36d1ee51dafca3839498a1e426be3f2a942d6 Mon Sep 17 00:00:00 2001 From: Charlie Birks Date: Fri, 20 Nov 2020 11:47:16 +0000 Subject: [PATCH] Avoid debug prints in the audio callback Since this is an interrupt, the CDC code will hang if nothing is reading --- mp3-stream.cpp | 7 ++++--- vorbis-stream.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mp3-stream.cpp b/mp3-stream.cpp index ee818b9..9a337dd 100644 --- a/mp3-stream.cpp +++ b/mp3-stream.cpp @@ -385,8 +385,8 @@ void MP3Stream::callback() { if(dataSize[curAudioBuf]) { + // recover from underrun endSample = audioBuf[curAudioBuf] + dataSize[curAudioBuf]; - blit::debug("recovered\n"); } else { @@ -414,8 +414,9 @@ void MP3Stream::callback() { currentSample = audioBuf[curAudioBuf]; endSample = currentSample + dataSize[curAudioBuf]; - if(currentSample == endSample) - blit::debug("underrun!\n"); + + // if(currentSample == endSample) + // no more samples available - underrun } } diff --git a/vorbis-stream.cpp b/vorbis-stream.cpp index 4ced942..66f1d95 100644 --- a/vorbis-stream.cpp +++ b/vorbis-stream.cpp @@ -255,8 +255,8 @@ void VorbisStream::callback() { if(dataSize[curAudioBuf]) { + // recover from underrun endSample = audioBuf[curAudioBuf] + dataSize[curAudioBuf]; - blit::debug("recovered\n"); } else { @@ -283,8 +283,9 @@ void VorbisStream::callback() { currentSample = audioBuf[curAudioBuf]; endSample = currentSample + dataSize[curAudioBuf]; - if(currentSample == endSample) - blit::debug("underrun!\n"); + + // if(currentSample == endSample) + // no more samples available - underrun } }