2018-10-06 02:22:57 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "renderer.h"
|
|
|
|
|
|
|
|
#include <soundio/soundio.h>
|
|
|
|
|
|
|
|
class SoundIoAudioRenderer : public IAudioRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SoundIoAudioRenderer();
|
|
|
|
|
|
|
|
~SoundIoAudioRenderer();
|
|
|
|
|
|
|
|
virtual bool prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION* opusConfig);
|
|
|
|
|
2019-05-02 04:27:41 +00:00
|
|
|
virtual void* getAudioBuffer(int* size);
|
|
|
|
|
|
|
|
virtual bool submitAudio(int bytesWritten);
|
2018-10-06 02:22:57 +00:00
|
|
|
|
2019-06-23 19:49:37 +00:00
|
|
|
virtual int getCapabilities();
|
|
|
|
|
2018-10-06 02:22:57 +00:00
|
|
|
private:
|
|
|
|
int scoreChannelLayout(const struct SoundIoChannelLayout* layout, const OPUS_MULTISTREAM_CONFIGURATION* opusConfig);
|
|
|
|
|
|
|
|
static void sioErrorCallback(struct SoundIoOutStream* stream, int err);
|
|
|
|
|
|
|
|
static void sioWriteCallback(struct SoundIoOutStream* stream, int frameCountMin, int frameCountMax);
|
|
|
|
|
|
|
|
static void sioBackendDisconnect(struct SoundIo* soundio, int err);
|
|
|
|
|
|
|
|
static void sioDevicesChanged(SoundIo* soundio);
|
|
|
|
|
|
|
|
int m_OpusChannelCount;
|
|
|
|
struct SoundIo* m_SoundIo;
|
|
|
|
struct SoundIoDevice* m_Device;
|
|
|
|
struct SoundIoOutStream* m_OutputStream;
|
|
|
|
struct SoundIoRingBuffer* m_RingBuffer;
|
|
|
|
struct SoundIoChannelLayout m_EffectiveLayout;
|
2018-12-25 22:05:17 +00:00
|
|
|
double m_Latency;
|
2018-10-06 02:22:57 +00:00
|
|
|
bool m_Errored;
|
2018-11-28 07:43:31 +00:00
|
|
|
|
|
|
|
static const double k_RawSampleLengthSec;
|
2018-12-26 01:54:18 +00:00
|
|
|
static const double k_MinSampleLengthSec;
|
2018-10-06 02:22:57 +00:00
|
|
|
};
|