| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "cores/AudioEngine/Interfaces/AESink.h" |
| 12 |
#include "cores/AudioEngine/Utils/AEDeviceInfo.h" |
| 13 |
|
| 14 |
#define DO_440HZ_TONE_TEST 0 |
| 15 |
|
| 16 |
#if DO_440HZ_TONE_TEST |
| 17 |
typedef struct |
| 18 |
{ |
| 19 |
float currentPhase; |
| 20 |
float phaseIncrement; |
| 21 |
} SineWaveGenerator; |
| 22 |
#endif |
| 23 |
|
| 24 |
class AERingBuffer; |
| 25 |
class CAAudioUnitSink; |
| 26 |
|
| 27 |
class CAESinkDARWINTVOS : public IAESink |
| 28 |
{ |
| 29 |
public: |
| 30 |
const char* GetName() override { return "DARWINTVOS"; } |
| 31 |
|
| 32 |
CAESinkDARWINTVOS(); |
| 33 |
~CAESinkDARWINTVOS() override = default; |
| 34 |
|
| 35 |
static void Register(); |
| 36 |
static void EnumerateDevicesEx(AEDeviceInfoList& list, bool force); |
| 37 |
static std::unique_ptr<IAESink> Create(std::string& device, AEAudioFormat& desiredFormat); |
| 38 |
|
| 39 |
bool Initialize(AEAudioFormat& format, std::string& device) override; |
| 40 |
void Deinitialize() override; |
| 41 |
|
| 42 |
void GetDelay(AEDelayStatus& status) override; |
| 43 |
double GetCacheTotal() override; |
| 44 |
unsigned int AddPackets(uint8_t** data, unsigned int frames, unsigned int offset) override; |
| 45 |
void Drain() override; |
| 46 |
bool HasVolume() override; |
| 47 |
|
| 48 |
private: |
| 49 |
static AEDeviceInfoList m_devices; |
| 50 |
CAEDeviceInfo m_info; |
| 51 |
AEAudioFormat m_format; |
| 52 |
|
| 53 |
CAAudioUnitSink* m_audioSink = nullptr; |
| 54 |
#if DO_440HZ_TONE_TEST |
| 55 |
SineWaveGenerator m_SineWaveGenerator; |
| 56 |
#endif |
| 57 |
}; |