diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-08-16 10:57:55 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-08-16 10:57:55 +1000 |
| commit | 4e27de21e49900963ffa61cc9c0a676bb028f992 (patch) | |
| tree | 8123994d33bc2ff8b5d58a38155b53e401669ae8 /src/audio/include/stream_buffer.hpp | |
| parent | 62dce8d9fcc139ca6dc2041c86723d19faab304f (diff) | |
| download | tangara-fw-4e27de21e49900963ffa61cc9c0a676bb028f992.tar.gz | |
clean up a bunch of obselete audio code
Diffstat (limited to 'src/audio/include/stream_buffer.hpp')
| -rw-r--r-- | src/audio/include/stream_buffer.hpp | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/src/audio/include/stream_buffer.hpp b/src/audio/include/stream_buffer.hpp deleted file mode 100644 index 06fe8af5..00000000 --- a/src/audio/include/stream_buffer.hpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2023 jacqueline <me@jacqueline.id.au> - * - * SPDX-License-Identifier: GPL-3.0-only - */ - -#pragma once - -#include <cstddef> -#include <cstdint> - -#include "freertos/FreeRTOS.h" - -#include "freertos/message_buffer.h" -#include "span.hpp" - -namespace audio { - -/* - * A collection of the buffers required for two IAudioElement implementations to - * stream data between each other. - * - * Currently, we use a FreeRTOS MessageBuffer to hold the byte stream, and also - * maintain two chunk-sized buffers for the elements to stage their read and - * write operations (as MessageBuffer copies the given data into its memory - * space). A future optimisation here could be to instead post himem memory - * addresses to the message buffer, and then maintain address spaces into which - * we map these messages, rather than 'real' allocated buffers as we do now. - */ -class StreamBuffer { - public: - explicit StreamBuffer(std::size_t chunk_size, std::size_t buffer_size); - ~StreamBuffer(); - - /* Returns the handle for the underlying message buffer. */ - auto Handle() -> MessageBufferHandle_t* { return &handle_; } - - /* - * Returns a chunk-sized staging buffer that should be used *only* by the - * reader (sink) element. - */ - auto ReadBuffer() -> cpp::span<std::byte> { return input_chunk_; } - - /* - * Returns a chunk-sized staging buffer that should be used *only* by the - * writer (source) element. - */ - auto WriteBuffer() -> cpp::span<std::byte> { return output_chunk_; } - - StreamBuffer(const StreamBuffer&) = delete; - StreamBuffer& operator=(const StreamBuffer&) = delete; - - private: - std::byte* raw_memory_; - StaticMessageBuffer_t metadata_; - MessageBufferHandle_t handle_; - - std::byte* raw_input_chunk_; - cpp::span<std::byte> input_chunk_; - - std::byte* raw_output_chunk_; - cpp::span<std::byte> output_chunk_; -}; - -} // namespace audio |
