Now set communication volume to 6 / 5 of the main volume
This commit is contained in:
parent
e8283b0916
commit
6e8c666e75
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <endpointvolume.h>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
class CAudioEndpointVolumeCallback : public IAudioEndpointVolumeCallback
|
||||
|
@ -69,18 +70,16 @@ public:
|
|||
}
|
||||
if (pNotify->guidEventContext != this->g_guidContext)
|
||||
{
|
||||
HRESULT hr = this->g_cEndptVol->SetMasterVolumeLevelScalar(pNotify->fMasterVolume, &this->g_guidContext);
|
||||
HRESULT hr = this->g_cEndptVol->SetMasterVolumeLevelScalar(min(pNotify->fMasterVolume * 6 / 5, 1.0), &this->g_guidContext);
|
||||
if (hr != S_OK) {
|
||||
std::cerr << "Error while setting volume" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
float commVolume;
|
||||
hr = g_cEndptVol->GetMasterVolumeLevelScalar(&commVolume);
|
||||
if (hr == S_OK) {
|
||||
std::cout << "\r\033[2KMain Volume : " << pNotify->fMasterVolume * 100 << ", Communication Volume : " << commVolume * 100;
|
||||
}
|
||||
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue