Now set communication volume to 6 / 5 of the main volume

This commit is contained in:
oupson 2023-10-09 19:01:22 +02:00
parent e8283b0916
commit 6e8c666e75
Signed by: oupson
GPG Key ID: E77389FA244EBE21
1 changed files with 2 additions and 3 deletions

View File

@ -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;
}