EHS/include/ehs/io/audio/AudioDevice_W32.h
Karutoh 1f5299ad1b
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 8s
Build & Release / Linux-AARCH64-Build (push) Failing after 14s
Build & Release / Windows-AMD64-Build (push) Failing after 5m56s
Fixed Win32 audio.
2024-10-01 18:58:15 -07:00

65 lines
1.3 KiB
C++

#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
{
class EHS_LIB_IO AudioDevice final : 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 OpenStream() override;
void CloseStream() override;
UInt_64 SendStream(const void *data, UInt_64 outFrameSize) override;
UInt_64 ReceiveStream(void *data, UInt_64 inFrameSize) 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 IsStreaming() const override;
bool IsValid() const override;
static AudioDevice GetDefault(AudioDeviceType type);
static Array<AudioDevice> Get(AudioDeviceType type, AudioDeviceState state);
};
}