2
votes

I'm dealing with sound software and I'm setting the default Audio device using nircmd.exe perfectly, but I also need to adjust the balance levels, either using a similar tool (since nircmd.exe doesn't handle that) or programatically using C#.

enter image description here

I've seen NAudio has a read-only property that reads the values

defaultDevice.AudioMeterInformation.PeakValues[0]; //i.e. left channel

But there's no setter for that.

Is there any familiar way to achieve this? Any help is appreciated, thanks.

1

1 Answers

5
votes

Ok, found the answer.

using NAudio.CoreAudioApi;

MMDeviceEnumerator devEnum = new MMDeviceEnumerator();

MMDevice defaultDevice = devEnum.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Communications);

defaultDevice.AudioEndpointVolume.Channels[0].VolumeLevel = 10;
defaultDevice.AudioEndpointVolume.Channels[1].VolumeLevel = 6;