From 6e8c666e75c5e5fddfa5d546357f539c0e3f0d79 Mon Sep 17 00:00:00 2001 From: oupson Date: Mon, 9 Oct 2023 19:01:22 +0200 Subject: [PATCH] Now set communication volume to 6 / 5 of the main volume --- AudioManager/CAudioEndpointVolumeCallback.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/AudioManager/CAudioEndpointVolumeCallback.h b/AudioManager/CAudioEndpointVolumeCallback.h index 6d34e38..70bf43b 100644 --- a/AudioManager/CAudioEndpointVolumeCallback.h +++ b/AudioManager/CAudioEndpointVolumeCallback.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include 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; }