4#include "AUI/Audio/ISoundInputStream.h"
5#include "AUI/Util/APimpl.h"
6#include "AUI/Traits/platform.h"
8typedef struct soxr * soxr_t;
10class ASampleRateConverter {
31 struct SoxrProcessResult {
36 SoxrProcessResult soxrProcess(std::span<std::byte> src, std::span<std::byte> dst);
38 static constexpr size_t BUFFER_SIZE = 0x3000;
39 static constexpr size_t INT32_BUFFER_SIZE = (BUFFER_SIZE / 3);
42 size_t read(
char* dst,
size_t size);
44 void write(
const _<IInputStream>& source,
size_t bytesToRead = BUFFER_SIZE);
49 std::span<std::byte> span();
55 void convertFormatToInt32();
57 char buffer[BUFFER_SIZE];
64 soxr_t mContext =
nullptr;
65 _<ISoundInputStream> mSource;
66 AAudioFormat mInputFormat;
67 AAudioFormat mOutputFormat;
68 AuxBuffer mSourceBuffer;
Definition ASampleRateConverter.h:10
size_t convert(std::span< std::byte > dst)
Performs sample rate converting.
static constexpr ASampleFormat outputSampleFormat()
Definition ASampleRateConverter.h:24
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179
ASampleFormat
Sample formats supported for mixing.
Definition ASampleFormat.h:12
@ I16
Signed 16-bit integer.
Definition ASampleFormat.h:16
@ I32
Signed 32-bit integer.
Definition ASampleFormat.h:26