-
-
Notifications
You must be signed in to change notification settings - Fork 501
/
AudioDeviceService.h
45 lines (40 loc) · 1.3 KB
/
AudioDeviceService.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
namespace EarTrumpet
{
namespace Interop
{
struct EarTrumpetAudioDevice
{
LPWSTR Id;
LPWSTR DisplayName;
bool IsDefault;
bool IsMuted;
};
class AudioDeviceService
{
private:
static AudioDeviceService* __instance;
std::vector<EarTrumpetAudioDevice> _devices;
void CleanUpAudioDevices();
HRESULT GetDeviceByDeviceId(PWSTR deviceId, IMMDevice** device);
HRESULT SetMuteBoolForDevice(LPWSTR deviceId, BOOL value);
public:
static AudioDeviceService* instance()
{
if (!__instance)
{
__instance = new AudioDeviceService;
}
return __instance;
}
HRESULT GetAudioDevices(void** audioDevices);
HRESULT GetAudioDeviceVolume(LPWSTR deviceId, float* volume);
HRESULT SetAudioDeviceVolume(LPWSTR deviceId, float volume);
HRESULT SetDefaultAudioDevice(LPWSTR deviceId);
HRESULT MuteAudioDevice(LPWSTR deviceId);
HRESULT UnmuteAudioDevice(LPWSTR deviceId);
HRESULT RefreshAudioDevices();
int GetAudioDeviceCount();
};
}
}