summaryrefslogtreecommitdiff
path: root/src/audio/fatfs_audio_input.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/fatfs_audio_input.cpp')
-rw-r--r--src/audio/fatfs_audio_input.cpp6
1 files changed, 6 insertions, 0 deletions
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<void, AudioProcessingError> {
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<void, AudioProcessingError> {
}
}
+ // 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 {};
}