diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-07-26 17:11:23 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-07-26 17:11:23 +1000 |
| commit | 9b1b401dcb986a26d10bcc898be670653acc2d3f (patch) | |
| tree | 697b14553dc75ddaab060406cd62ee4b08f05e9e /src/audio/include/audio_source.hpp | |
| parent | f94be3db2f2bb6c1b359744cb915683095e4ee80 (diff) | |
| download | tangara-fw-9b1b401dcb986a26d10bcc898be670653acc2d3f.tar.gz | |
big cleanup of new encoder + stream buffer types
Diffstat (limited to 'src/audio/include/audio_source.hpp')
| -rw-r--r-- | src/audio/include/audio_source.hpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/audio/include/audio_source.hpp b/src/audio/include/audio_source.hpp index e062fd1a..115f8bf4 100644 --- a/src/audio/include/audio_source.hpp +++ b/src/audio/include/audio_source.hpp @@ -8,6 +8,7 @@ #include <stdint.h> +#include <bitset> #include <memory> #include "freertos/FreeRTOS.h" @@ -22,12 +23,25 @@ class IAudioSource { public: virtual ~IAudioSource() {} + class Flags { + public: + Flags(bool is_start, bool is_end) { + flags_[0] = is_start; + flags_[1] = is_start; + } + + auto is_start() -> bool { return flags_[0]; } + auto is_end() -> bool { return flags_[1]; } + + private: + std::bitset<2> flags_; + }; + /* * Synchronously fetches data from this source. */ - virtual auto Read(std::function<bool(StreamInfo::Format)>, - std::function<size_t(cpp::span<const std::byte>)>, - TickType_t) -> void = 0; + virtual auto Read(std::function<void(Flags, InputStream&)>, TickType_t) + -> void = 0; }; } // namespace audio |
