HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
WinAudio.h
Go to the documentation of this file.
1#pragma once
2#ifdef _WIN32
3#include "HephAudioShared.h"
4#include "NativeAudio.h"
5#include "WinAudioBase.h"
7#include <wrl.h>
8#include <Mmdeviceapi.h>
9#include <audiopolicy.h>
10
13namespace HephAudio
14{
15 namespace Native
16 {
21 class HEPH_API WinAudio final : public WinAudioBase
22 {
23 public:
24 using NativeAudio::InitializeRender;
25 using NativeAudio::InitializeCapture;
26
27 private:
28 WasapiParams params;
29 Microsoft::WRL::ComPtr<IMMDeviceEnumerator> pEnumerator;
30 Microsoft::WRL::ComPtr<IAudioSessionManager> pRenderSessionManager;
31 Microsoft::WRL::ComPtr<IAudioSessionControl> pRenderSessionControl;
32
33 public:
36
37 WinAudio(const WinAudio&) = delete;
38 WinAudio& operator=(const WinAudio&) = delete;
39
42
43 void SetMasterVolume(double volume) override;
44 double GetMasterVolume() const override;
45 void InitializeRender(AudioDevice* device, AudioFormatInfo format) override;
46 void StopRendering() override;
47 void InitializeCapture(AudioDevice* device, AudioFormatInfo format) override;
48 void StopCapturing() override;
49 void GetNativeParams(NativeAudioParams& nativeParams) const override;
50 void SetNativeParams(const NativeAudioParams& nativeParams) override;
51
56 void SetDisplayName(const std::string& displayName);
57
62 void SetIconPath(const std::filesystem::path& iconPath);
63
64 private:
65 bool EnumerateAudioDevices() override;
66 void CheckAudioDevices() override;
67 void RenderData(AudioDevice* device, AudioFormatInfo format);
68 void CaptureData(AudioDevice* device, AudioFormatInfo format);
69 static AudioDeviceType DataFlowToDeviceType(EDataFlow dataFlow);
70 };
71 }
72}
73#endif
AudioDeviceType
Definition AudioDevice.h:11
#define HEPH_API
Definition HephShared.h:132
base class for classes that interact with the Windows audio APIs.
Definition WinAudioBase.h:24
uses WASAPI.
Definition WinAudio.h:22
void InitializeRender(AudioDevice *device, AudioFormatInfo format) override
void SetNativeParams(const NativeAudioParams &nativeParams) override
void StopCapturing() override
void SetMasterVolume(double volume) override
void SetIconPath(const std::filesystem::path &iconPath)
void StopRendering() override
void InitializeCapture(AudioDevice *device, AudioFormatInfo format) override
void GetNativeParams(NativeAudioParams &nativeParams) const override
double GetMasterVolume() const override
void SetDisplayName(const std::string &displayName)
stores information about an audio device.
Definition AudioDevice.h:76
stores the properties of the audio signals
Definition AudioFormatInfo.h:20
base class for storing the native audio API specific parameters.
Definition NativeAudioParams.h:15
struct for storing the WASAPI specific parameters.
Definition WasapiParams.h:18