You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.0 KiB
45 lines
1.0 KiB
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "arena.hpp"
|
|
#include "chunk.hpp"
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#include "freertos/message_buffer.h"
|
|
#include "freertos/queue.h"
|
|
#include "span.hpp"
|
|
|
|
#include "audio_element.hpp"
|
|
#include "storage.hpp"
|
|
#include "stream_buffer.hpp"
|
|
|
|
namespace audio {
|
|
|
|
class FatfsAudioInput : public IAudioElement {
|
|
public:
|
|
explicit FatfsAudioInput(std::shared_ptr<drivers::SdStorage> storage);
|
|
~FatfsAudioInput();
|
|
|
|
auto HasUnprocessedInput() -> bool override;
|
|
auto IsOverBuffered() -> bool override;
|
|
|
|
auto ProcessStreamInfo(const StreamInfo& info) -> void override;
|
|
auto ProcessChunk(const cpp::span<std::byte>& chunk) -> void override;
|
|
auto ProcessEndOfStream() -> void override;
|
|
auto Process() -> void override;
|
|
|
|
FatfsAudioInput(const FatfsAudioInput&) = delete;
|
|
FatfsAudioInput& operator=(const FatfsAudioInput&) = delete;
|
|
|
|
private:
|
|
memory::Arena arena_;
|
|
std::shared_ptr<drivers::SdStorage> storage_;
|
|
|
|
FIL current_file_;
|
|
bool is_file_open_;
|
|
};
|
|
|
|
} // namespace audio
|
|
|