Change master audio volume from XP to Windows 8 in C#

后端 未结 2 756
花落未央
花落未央 2020-12-06 15:50

I need some general method to change master audio volume from Windows XP to Windows 8 in C# because my application is going to work on those OS.

I h

2条回答
  •  温柔的废话
    2020-12-06 16:26

    For windows 7+:

    There are some problems with the accepted answer. Because the codeproject page is deleted it now has no context.

    1. You need to get NAudio from Nuget

    2. Replace the first with the second

      MMDevice device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);

      MMDevice device = DevEnum.GetDefaultAudioEndpoint((DataFlow)0, (Role)1);

    Just a quick heads-up if you are lost trying to fix the errors with the accepted-answer code.

提交回复
热议问题