Fork of Tangara with customizations
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.
tangara-fw/src/audio/include/audio_element.hpp

33 lines
770 B

#pragma once
#include <stdint.h>
#include <cstdint>
#include "freertos/portmacro.h"
#include "types.hpp"
#include "result.hpp"
namespace audio {
extern const std::size_t kMaxFrameSize;
class IAudioElement {
public:
virtual ~IAudioElement();
virtual auto IdleTimeout() -> TickType_t { return portMAX_DELAY; }
virtual auto InputBuffer() -> MessageBufferHandle_t* = 0;
virtual auto OutputBuffer() -> MessageBufferHandle_t* = 0;
enum StreamError {
BAD_FORMAT
};
virtual auto ProcessStreamInfo(StreamInfo &info) -> cpp::result<void, StreamError> = 0;
virtual auto ProcessChunk(uint8_t* data, std::size_t length) -> cpp::result<void, StreamError> = 0;
virtual auto ProcessIdle() -> cpp::result<void, StreamError> = 0;
};
} // namespace audio