I am trying to create a class that can control the windows volume setting. So far I have been succesful in turning the volume up and down, plus muting the volume. This is done following a code sample from dotnetcurry.
The problem is that I need this class to be able to set a specific volume say like 57%. I could make a function that turned the volume down to 0% and then turn it up to 57%, but that would mean I should always assume I have to turn it down from 100% and then go up to 57% even though the start volume was 20% or was already at 57%. I could turn it up first but the same problem exists. I dont know the current volume setting from start.
I have tried to see if there is a function I could call to get the current volume setting, but all I could find was how loud the current sound is, not the setting of the volume control. If I had access to the volume level setting, I could validate it before taking action and make the function a lot nicer.
Is there a way to get the current volume setting in C#/Windows?