This project has moved. For the latest updates, please go here.

Cannot get live volume for recoding device

Jan 21, 2011 at 1:28 PM

Using the following code I can get the current output volume for the default playback device:
selectedDevice = devEnum.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
while (true)
{
	VolumeLeft = (int)(selectedDevice.AudioMeterInformation.PeakValues[0] * 100);
	VolumeRight = (int)(selectedDevice.AudioMeterInformation.PeakValues[1] * 100);
	Thread.Sleep(sampleDelay);
}

However, when replacing the device to the default recording device I do not get any values except 0.
selectedDevice = devEnum.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Multimedia);
while (true)
{
	VolumeLeft = (int)(selectedDevice.AudioMeterInformation.PeakValues[0] * 100);
	VolumeRight = (int)(selectedDevice.AudioMeterInformation.PeakValues[1] * 100);
	Thread.Sleep(sampleDelay);
}

I've verified that the correct recoding device is returned and I can see the volume bar changing in the Windows Sound property page.

Is this supposed to just work?

Coordinator
Jan 24, 2011 at 10:56 AM

I'm afraid I don't know, it might even be dependent on your drivers. It might be best to find a forum that answers questions specifically about WASAPI to get an answer to this question.

Mark