11 #include "cores/AudioEngine/Interfaces/AESink.h" 12 #include "cores/AudioEngine/Sinks/windows/AESinkFactoryWin.h" 13 #include "cores/AudioEngine/Utils/AEDeviceInfo.h" 18 #include <Audioclient.h> 19 #include <mmdeviceapi.h> 20 #include <wrl/client.h> 28 static void Register();
29 static std::unique_ptr<IAESink> Create(std::string& device,
AEAudioFormat& desiredFormat);
30 static void EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList,
bool force =
false);
33 const char *GetName()
override {
return "WASAPI"; }
34 bool Initialize(
AEAudioFormat &format, std::string &device)
override;
35 void Deinitialize()
override;
37 double GetCacheTotal()
override;
38 unsigned int AddPackets(uint8_t **data,
unsigned int frames,
unsigned int offset)
override;
39 void Drain()
override;
43 static void BuildWaveFormatExtensibleIEC61397(
AEAudioFormat &format, WAVEFORMATEXTENSIBLE_IEC61937 &wfxex);
48 Microsoft::WRL::ComPtr<IAudioClient> m_pAudioClient;
49 Microsoft::WRL::ComPtr<IAudioRenderClient> m_pRenderClient;
50 Microsoft::WRL::ComPtr<IAudioClock> m_pAudioClock;
53 unsigned int m_encodedChannels{0};
54 unsigned int m_encodedSampleRate{0};
58 enum AEDataFormat sinkReqFormat = AE_FMT_INVALID;
59 enum AEDataFormat sinkRetFormat = AE_FMT_INVALID;
61 bool m_running{
false};
62 bool m_initialized{
false};
63 bool m_isSuspended{
false};
64 bool m_isDirty{
false};
67 double m_avgTimeWaiting{50.0};
68 double m_sinkLatency{0.0};
70 unsigned int m_uiBufferLen{0};
71 uint64_t m_sinkFrames{0};
72 uint64_t m_clockFreq{0};
74 std::vector<uint8_t> m_buffer;
Definition: AESinkFactoryWin.h:187
void GetDelay(AEDelayStatus &status) override
Return a timestamped status structure with delay and sink info.
Definition: AESinkWASAPI.cpp:222
Definition: AEChannelInfo.h:19
Definition: AESinkWASAPI.h:22
unsigned int AddPackets(uint8_t **data, unsigned int frames, unsigned int offset) override
Adds packets to be sent out, this routine MUST block or sleep.
Definition: AESinkWASAPI.cpp:251