문제

How can I check and change the system volume in Windows using C#, like so:

if(SystemVolume.vol == 0){
    SystemVolume.vol = 100;
}
도움이 되었습니까?

해결책 2

Look into the concept of "audio sessions" in windows. There are some interfaces suggested by the following link, namely ISimpleAudioVolume, IChannelAudioVolume, and IAudioStreamVolume interfaces.

The code examples given are in C++ though, but it should be useful.

다른 팁

For Windows 10 I created a package called AudioControl.

//Returns a float containing the value (ranging from 0 to 1.0f)
var volume = AudioControl.GetMasterVolume();

//Set the volume (use values between 0 and 1.0f)
AudioControl.SetMasterVolume(1.0f); 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top