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 ~ASampleRateConverter();
34 struct SoxrProcessResult {
39 SoxrProcessResult soxrProcess(std::span<std::byte> src, std::span<std::byte> dst);
41 static constexpr size_t BUFFER_SIZE = 0x3000;
42 static constexpr size_t INT32_BUFFER_SIZE = (BUFFER_SIZE / 3);
45 size_t read(
char* dst,
size_t size);
47 void write(
const _<IInputStream>& source,
size_t bytesToRead = BUFFER_SIZE);
52 std::span<std::byte> span();
58 void convertFormatToInt32();
60 char buffer[BUFFER_SIZE];
67 soxr_t mContext =
nullptr;
68 _<ISoundInputStream> mSource;
69 AAudioFormat mInputFormat;
70 AAudioFormat mOutputFormat;
71 AuxBuffer mSourceBuffer;
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