1

I need to control the left & right speaker balance level on Windows 10 using my C# application.

I was able to control the master volume level of speaker and microphone using Windows IAudioEndpointVolume interface through the Audio Manager C# wrapper which is also mentioned in http://stackoverflow.com/questions/14306048/controling-volume-mixer.

But still, I'm unable to control the L/R balance. Is there any specific interface or property I should use?

windows-audio-speaker-balance settings

I'm building Console Application using Windows 10 SDK & .NET 4.6.1 framework through Visual Studio 15

1 Answers1

1

Use SetChannelVolumeLevel (or SetChannelVolumeLevelScalar) method from IAudioEndpointVolume.

SetChannelVolumeLevel: https://learn.microsoft.com/en-us/windows/desktop/api/endpointvolume/nf-endpointvolume-iaudioendpointvolume-setchannelvolumelevel

SetChannelVolumeLevelScalar: https://learn.microsoft.com/en-us/windows/desktop/api/endpointvolume/nf-endpointvolume-iaudioendpointvolume-setchannelvolumelevelscalar

Wokuo
  • 206
  • 1
  • 8
  • Thanks, @Wokuo. I've tried this endpoint before posting, but I've given a wrong value for `LPCGUID pguidEventContext` then. It worked after passing **Guid.Empty** for EventContext. Also, channel 0 indicates left and 1 right – Dhammika Marasinghe Oct 01 '18 at 15:26
  • @DhammikaMarasinghe This solution will work, but it is little bit ugly. Better solution would be using static Guid. This guid is used to identify who changed the volume, specially you can define if volume was changed by your application or by system settings. More details you will find here: https://learn.microsoft.com/pl-pl/windows/desktop/api/endpointvolume/nn-endpointvolume-iaudioendpointvolumecallback – Wokuo Oct 01 '18 at 15:38