From e5fb1759b16d2c99487acc4fb0a2711afa3aa1dc Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 24 Jan 2023 16:39:52 +1100 Subject: Add a bunch of logging from playback stream investigatons --- src/audio/fatfs_audio_input.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/audio/fatfs_audio_input.cpp') diff --git a/src/audio/fatfs_audio_input.cpp b/src/audio/fatfs_audio_input.cpp index fc623d86..7f11805e 100644 --- a/src/audio/fatfs_audio_input.cpp +++ b/src/audio/fatfs_audio_input.cpp @@ -131,6 +131,10 @@ auto FatfsAudioInput::ProcessIdle() -> cpp::result { file_buffer_write_pos_ = file_buffer_.begin(); } } + } else if (GetRingBufferDistance() == 0) { + // We have no file open, and no data waiting to be written. We're out of + // stuff to do, so signal a pause. + return cpp::fail(OUT_OF_DATA); } // Now stream data into the output buffer until it's full. @@ -152,6 +156,8 @@ auto FatfsAudioInput::ProcessIdle() -> cpp::result { } } + // We've finished writing out chunks, but there may be more of the file to + // read. Return, and begin again in the next idle call. return {}; } -- cgit v1.2.3