From 4e27de21e49900963ffa61cc9c0a676bb028f992 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 16 Aug 2023 10:57:55 +1000 Subject: clean up a bunch of obselete audio code --- src/audio/include/fatfs_source.hpp | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/audio/include/fatfs_source.hpp (limited to 'src/audio/include/fatfs_source.hpp') diff --git a/src/audio/include/fatfs_source.hpp b/src/audio/include/fatfs_source.hpp new file mode 100644 index 00000000..e4187d60 --- /dev/null +++ b/src/audio/include/fatfs_source.hpp @@ -0,0 +1,44 @@ +/* + * Copyright 2023 jacqueline + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma once + +#include +#include +#include + +#include "codec.hpp" +#include "ff.h" + +#include "audio_source.hpp" + +namespace audio { + +/* + * Handles coordination with a persistent background task to asynchronously + * read files from disk into a StreamBuffer. + */ +class FatfsSource : public codecs::IStream { + public: + FatfsSource(codecs::StreamType, std::unique_ptr file); + ~FatfsSource(); + + auto Read(cpp::span dest) -> ssize_t override; + + auto CanSeek() -> bool override; + + auto SeekTo(int64_t destination, SeekFrom from) -> void override; + + auto CurrentPosition() -> int64_t override; + + FatfsSource(const FatfsSource&) = delete; + FatfsSource& operator=(const FatfsSource&) = delete; + + private: + std::unique_ptr file_; +}; + +} // namespace audio \ No newline at end of file -- cgit v1.2.3