per channel peak meters
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <functiondiscoverykeys.h>
|
||||
#include <endpointvolume.h>
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -156,13 +157,18 @@ void setVolume(IAudioEndpointVolume* volumeInterface, float newVolume)
|
||||
isError(hr, "Failed to set volume level: ");
|
||||
}
|
||||
|
||||
float getMeterValue(IAudioMeterInformation* meterInterface)
|
||||
UINT getMeterValues(IAudioMeterInformation* meterInterface, std::array<float, 2>& outLevels)
|
||||
{
|
||||
float volume;
|
||||
if (FAILED(meterInterface->GetPeakValue(&volume)))
|
||||
{
|
||||
volume = 0.;
|
||||
}
|
||||
UINT channelCount;
|
||||
if (FAILED(meterInterface->GetMeteringChannelCount(&channelCount)) || channelCount > 2) return 0;
|
||||
|
||||
return volume;
|
||||
if (FAILED(meterInterface->GetChannelsPeakValues(channelCount, &outLevels[0]))) return 0;
|
||||
|
||||
return channelCount;
|
||||
}
|
||||
|
||||
void getVolumeLimit(IAudioEndpointVolume* volumeInterface, float* outMin, float* outMax)
|
||||
{
|
||||
float dummy;
|
||||
volumeInterface->GetVolumeRange(outMin, outMax, &dummy);
|
||||
}
|
||||
Reference in New Issue
Block a user