-
Notifications
You must be signed in to change notification settings - Fork 0
/
main3.cpp
28 lines (23 loc) · 803 Bytes
/
main3.cpp
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
#include <windows.h>
#include <mmdeviceapi.h>
#include "endpointvolume.h"
#include <iostream>
int main() {
CoInitialize(NULL);
IMMDeviceEnumerator *pEnum = NULL;
IMMDevice *pDevice = NULL;
IAudioMeterInformation *pMeter = NULL;
float peak;
HRESULT hr;
hr = CoCreateInstance(__uuidof(MMDeviceEnumerator),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IMMDeviceEnumerator),
(void **)&pEnum);
hr = pEnum->GetDefaultAudioEndpoint(eRender, eConsole, &pDevice);
pDevice->Activate(__uuidof(IAudioMeterInformation),
CLSCTX_ALL,
NULL,
(void **)&pMeter);
pMeter->GetPeakValue(&peak); // I need this value
}