2023-12-17 03:29:08 -08:00
|
|
|
#pragma once
|
|
|
|
|
2023-12-17 15:00:08 -08:00
|
|
|
#include "EHS.h"
|
2023-12-17 03:29:08 -08:00
|
|
|
#include "BaseAudioDevice.h"
|
|
|
|
|
|
|
|
#include <initguid.h>
|
|
|
|
#include <mmdeviceapi.h>
|
|
|
|
#include <functiondiscoverykeys_devpkey.h>
|
|
|
|
#include <Audioclient.h>
|
|
|
|
|
|
|
|
struct IMMDevice;
|
|
|
|
|
2023-12-17 15:56:13 -08:00
|
|
|
namespace ehs
|
2023-12-17 03:29:08 -08:00
|
|
|
{
|
|
|
|
class AudioDevice : public BaseAudioDevice
|
|
|
|
{
|
|
|
|
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 Release() override;
|
|
|
|
|
|
|
|
void OpenStream() override;
|
|
|
|
|
|
|
|
void CloseStream() override;
|
|
|
|
|
|
|
|
UInt_64 GetAvailFrames() const override;
|
|
|
|
|
|
|
|
Byte* Map(UInt_64* offset, UInt_64* frames) override;
|
|
|
|
|
|
|
|
void UnMap(const UInt_64 offset, const UInt_64 frames) override;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
bool IsValid() const override;
|
|
|
|
|
|
|
|
static AudioDevice GetDefault(const AudioDeviceType type);
|
|
|
|
|
|
|
|
static Array<AudioDevice> Get(const AudioDeviceType type, const AudioDeviceState state);
|
|
|
|
};
|
|
|
|
}
|