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
WinAudioDS.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"
6#include <dsound.h>
7
10namespace HephAudio
11{
12 namespace Native
13 {
18 class HEPH_API WinAudioDS final : public WinAudioBase
19 {
20 public:
21 using NativeAudio::InitializeRender;
22 using NativeAudio::InitializeCapture;
23
24 private:
25 HWND hwnd;
26
27 public:
30
31 WinAudioDS(const WinAudioDS&) = delete;
32 WinAudioDS& operator=(const WinAudioDS&) = delete;
33
36
37 void SetMasterVolume(double volume) override;
38 double GetMasterVolume() const override;
39 void InitializeRender(AudioDevice* device, AudioFormatInfo format) override;
40 void StopRendering() override;
41 void InitializeCapture(AudioDevice* device, AudioFormatInfo format) override;
42 void StopCapturing() override;
43 void GetNativeParams(NativeAudioParams& nativeParams) const override;
44 void SetNativeParams(const NativeAudioParams& nativeParams) override;
45 private:
46 bool EnumerateAudioDevices() override;
47 void CheckAudioDevices() override;
48 void RenderData(GUID deviceId);
49 void CaptureData(GUID deviceId);
50 static BOOL CALLBACK RenderDeviceEnumerationCallback(LPGUID lpGuid, LPCWSTR lpcstrDescription, LPCWSTR lpcstrModule, LPVOID pWinAudioDS);
51 static BOOL CALLBACK CaptureDeviceEnumerationCallback(LPGUID lpGuid, LPCWSTR lpcstrDescription, LPCWSTR lpcstrModule, LPVOID pWinAudioDS);
52 static std::string GuidToString(LPGUID guid);
53 static GUID StringToGuid(const std::string& str);
54 static void RestrictAudioFormatInfo(AudioFormatInfo& afi, const DSCAPS& dsCaps);
55 static void RestrictAudioFormatInfo(AudioFormatInfo& afi, const DSCCAPS& dscCaps);
56 };
57 }
58}
59#endif
#define HEPH_API
Definition HephShared.h:132
base class for classes that interact with the Windows audio APIs.
Definition WinAudioBase.h:24
uses DirectSound
Definition WinAudioDS.h:19
void InitializeCapture(AudioDevice *device, AudioFormatInfo format) override
double GetMasterVolume() const override
void GetNativeParams(NativeAudioParams &nativeParams) const override
void SetNativeParams(const NativeAudioParams &nativeParams) override
void SetMasterVolume(double volume) override
void InitializeRender(AudioDevice *device, AudioFormatInfo format) override
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