I have a C# UWP application using Windows IoT Core on Raspberry Pi 3. Is there a way to control the master volume output level of the pi from C# code?
-
Does this [link](https://learn.microsoft.com/en-ca/windows/uwp/design/style/sound?f=255&MSPPError=-2147217396) help with your issue? I haven't worked with the windows iot on a pi so I'm interested in your findings. – KevinLamb Jun 13 '19 at 21:08
-
@Kevin, Thank you for your response but my understanding is this will only control application volume but not the master volume of the Pi. So if master is set at 0.4 and your code tries setting the volume at 0.5 the effective volume level will be 0.4. I am looking for a method to control the master volume level of the device. – pleslie Jun 13 '19 at 22:18
1 Answers
As far as i know, there is no API in UWP used to change the System's Volume directly. It's all about the ecosystem of the app itself being managed by the system. You may try to find Win32 API to control master volume.
Here is an answer to changing the master volume from C++, also includes SetMute, etc. You can call the api in C#.Maybe it is helpful for you. Changing master volume level
In addition, WASAPI provides client-specified volume and mute settings uniformly to all of the streams in the session. Users can adjust the volume and mute settings for all of the sessions in the system. But WASAPI is only available in C++. if you want to do it from a C# UWP App, you can create a RuntimeComponent in C++CX that will provide this feature to your app.
https://learn.microsoft.com/en-us/windows/desktop/coreaudio/audio-sessions

- 4,382
- 1
- 8
- 16