Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get and set audio volume level for a Universal Windows application

The title says it all, I would like to get and set audio volume level for a Universal Windows (iot) application.

It can be either the sound level associated with my particular application - which would be ideal; or it can be the system sound level - if necessary / possible.

I am using visual studio 2015

I've been searching for examples / samples but have come up dry.

Any help would be appreciated.

(of note this is not a duplicate question - I want to get and set audio volume level for a Universal Windows application - this can not be done via a COM object in uwp - nor do uwp apps use VBScript or JScript)

like image 400
Rob Avatar asked Jan 02 '16 05:01

Rob


1 Answers

There's no need to make a WinRT component. Instead you can use P/Invoke to access the win32 audio interfaces.

Take a look at my code (Gist) for how to do this in C#.

like image 125
Wim Bokkers Avatar answered Sep 20 '22 08:09

Wim Bokkers