2024-02-05 22:25:30 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ehs/EHS.h"
|
|
|
|
#include "BaseAudioDevice.h"
|
|
|
|
|
|
|
|
#include <initguid.h>
|
|
|
|
#include <mmdeviceapi.h>
|
|
|
|
#include <functiondiscoverykeys_devpkey.h>
|
|
|
|
#include <Audioclient.h>
|
|
|
|
|
|
|
|
struct IMMDevice;
|
|
|
|
|
|
|
|
namespace ehs
|
|
|
|
{
|
2024-09-16 16:18:49 -07:00
|
|
|
class EHS_LIB_IO AudioDevice final : public BaseAudioDevice
|
2024-02-05 22:25:30 -08:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
IMMDevice* hdl;
|
|
|
|
IAudioClient* client;
|
|
|
|
IAudioRenderClient* playbackClient;
|
|
|
|
IAudioCaptureClient* captureClient;
|
|
|
|
|
|
|
|
public:
|
|
|
|
~AudioDevice() override;
|
|
|
|
|
|
|
|
AudioDevice();
|
|
|
|
|
|
|
|
AudioDevice(AudioDevice&& device) noexcept;
|
|
|
|
|
|
|
|
AudioDevice(const AudioDevice& device);
|
|
|
|
|
|
|
|
AudioDevice& operator=(AudioDevice&& device) noexcept;
|
|
|
|
|
|
|
|
AudioDevice& operator=(const AudioDevice& device);
|
|
|
|
|
|
|
|
void OpenStream() override;
|
|
|
|
|
|
|
|
void CloseStream() override;
|
|
|
|
|
2024-10-01 18:58:15 -07:00
|
|
|
UInt_64 SendStream(const void *data, UInt_64 outFrameSize) override;
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-10-01 18:58:15 -07:00
|
|
|
UInt_64 ReceiveStream(void *data, UInt_64 inFrameSize) override;
|
2024-02-05 22:25:30 -08:00
|
|
|
|
|
|
|
Str_32 GetInterfaceName_32() const;
|
|
|
|
|
|
|
|
Str_16 GetInterfaceName_16() const;
|
|
|
|
|
|
|
|
Str_8 GetInterfaceName_8() const;
|
|
|
|
|
|
|
|
Str_32 GetName_32() const;
|
|
|
|
|
|
|
|
Str_16 GetName_16() const;
|
|
|
|
|
|
|
|
Str_8 GetName_8() const;
|
|
|
|
|
2024-09-30 20:24:25 -07:00
|
|
|
bool IsStreaming() const override;
|
|
|
|
|
2024-02-05 22:25:30 -08:00
|
|
|
bool IsValid() const override;
|
|
|
|
|
2024-10-01 18:58:15 -07:00
|
|
|
static AudioDevice GetDefault(AudioDeviceType type);
|
2024-02-05 22:25:30 -08:00
|
|
|
|
2024-10-01 18:58:15 -07:00
|
|
|
static Array<AudioDevice> Get(AudioDeviceType type, AudioDeviceState state);
|
2024-02-05 22:25:30 -08:00
|
|
|
};
|
|
|
|
}
|