3#include "AUI/Audio/ISoundPipe.h"
4#include "AUI/IO/ADynamicPipe.h"
6typedef struct OpusDecoder OpusDecoder;
14 static constexpr uint32_t SAMPLE_RATE = 48000;
15 static constexpr AChannelFormat CHANNEL_COUNT = AChannelFormat::STEREO;
20 void write(
const char *src,
size_t size)
override;
22 size_t read(
char* dst,
size_t size)
override;
27 bool isLastWriteSuccessful()
const {
28 return mLastWriteSuccessful;
32 static constexpr size_t HEADER_SIZE = 19;
33 static constexpr size_t MAX_UNPACKED_SIZE = 11520;
38 uint8_t outputChannelCount;
40 uint32_t inputSampleRate;
46 static_assert(
sizeof(OpusHead) == 20);
49 ADynamicPipe mDecodedSamples;
50 bool mHeaderHasRead =
false;
51 bool mLastWriteSuccessful =
true;
54 OpusDecoder* mDecoder;
55 char mSampleBuffer[MAX_UNPACKED_SIZE];
56 size_t mPreSkipped = 0;
Sound pipe for OPUS format, decodes OPUS packets.
Definition AOpusSoundPipe.h:12
size_t read(char *dst, size_t size) override
Reads up to size bytes from stream. Blocking (waiting for new data) is allowed.
void write(const char *src, size_t size) override
Writes exact size bytes to stream. Blocking (waiting for write all data) is allowed.
AAudioFormat info() override
Get general info about sound stream.
ISoundPipe accepts sound data and outputs sound samples, useful for decoded audio passed in packets.
Definition ISoundPipe.h:10
ASampleFormat
Sample formats supported for mixing.
Definition ASampleFormat.h:12
@ I16
Signed 16-bit integer.
Definition ASampleFormat.h:16