How to determine system audio volume?

is there a way to read the system volume?
Background is that I’m using a virtual audio channel (Virtual Cable) to send data from a program to vvvv, which is being influenced by the Window’s volume.
AudioMixer (System) isn’t working under Windows 8/10 btw.

the windows CoreAudio API is quite extensive. here is a .net wrapper for it which you can access writing a c# plugin.

attached is a simple c# plugin that only does exactly what you asked for with code copypasted from here. (2.9 KB)


Thank you so much Joreg! It works like a charm.

And maybe a good exercise/starting point into C#. Will try to extend it to be able to set the volume (ooph, API/interfacing looks complicated).

indeed probably not the easiest way to getting started with c# since calling native apis is a rather special thing. but still…shouldn’t be too hard to figure out what needs to be done from the links i provided.

According to the CoreAudio API the IAudioEndpointVolume object (variable FSpeakers) should have a SetMasterVolumeLevelScalar() function - but vvvv outputs an error saying IAudioEndpointVolume doesn’t contain that definition. Mayb it doesn’t exists in the Wrapper (which seems to have no documentation)??
Anyway, you are right, its not the easiest topic to start with ;)

exactly. the wrapper used in the little example does only expose GetMasterVolumeLevelScalar() but none of the other methos of IAudioEndpointVolume.

the .net wrapper i linked to seems complete though. and it doesn’t need a documentation because you can get all the info from the CoreAudio API i linked to. makes sense?

Ok, tried to dynamically load the external DLL, but can’t get it to work. (I placed it in the “bin” folder of the plugin and used Assembly.LoadFile.) Kind of ready to give up.

to reference a third party dlll in a dynamic plugin you need to add it to the project explorer (CTRL+J) under references. then you can import the functions with a using statement.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.