Frage

I'm currently fetching the master level fine with this:

MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
MMDevice defaultDevice = devEnum.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
Console.WriteLine("Sending Volume level through " + port.PortName);
Console.WriteLine("\rCurrent Level: " + defaultDevice.AudioMeterInformation.MasterPeakValue.ToString());

But is it possible to get the Left and Right levels from all sound passing through?

I've looked around and have not found anything on this.

War es hilfreich?

Lösung

Nevermind, Found out its:

defaultDevice.AudioMeterInformation.PeakValues[0] // left defaultDevice.AudioMeterInformation.PeakValues[1] // right

Andere Tipps

Old question, but I don't think this is the correct answer for balance.

Should be the following:

defaultDevice.AudioEndpointVolume.Channels[0]  // left
defaultDevice.AudioEndpointVolume.Channels[1]  // right

Correct! The Code Given Below Helped Me!

VB.NET:-

Dim MDE As New MMDeviceEnumerator
Dim MD As MMDevice = MDE.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia)
Dim CurrentSession = MD.AudioSessionManager.AudioSessionControl  REM Or Simply MD.AudioMeterInformation

ProgressBar1.Value = CurrentSession.AudioMeterInformation.PeakValues(0) * 100 REM Left
ProgressBar2.Value = CurrentSession.AudioMeterInformation.PeakValues(1) * 100 REM Right

VCSharp (C#):-

MMDeviceEnumerator MDE = new MMDeviceEnumerator();
MMDevice MD = MDE.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia);
var CurrentSession = MD.AudioSessionManager.AudioSessionControl; // Or Simply MD.AudioMeterInformation

progressBar1.Value = CurrentSession.AudioMeterInformation.PeakValues[0] * 100; // Left
progressBar2.Value = CurrentSession.AudioMeterInformation.PeakValues[1] * 100; // Right

Such A Helpful DLL (NAudio)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top