views:

107

answers:

2

Hi All,

I want to manipulate the system loudness (the global volume, or whatever it is called) from within my program. This might seem ridiculous, but I need to do some measurements, so I am interested in not only attenuating the sound via an internal loudness, but also amplify it, which is only possible using the system loudness. Since I am using Qt, a C++-solution would be greatly appreciated.

Would anyone know how to do this on either Windows or OSX? (Cross-platform development, you see...)

Thank you in advance!

A: 

One possibility on OSX is to use a terminal command:

#include <cstdlib>
system("osascript -e \"set Volume 5\"\n");

(Of course, you may change '5' to whatever you like; The range seems to be between 0 and about 7.5 (?))

Admittedly, this is not a pretty solution and I am still interested in a better one, but at least it works, although at a hefty performance cost while executing the command.

BastiBechtold
+1  A: 

Check out this post. CocoaDev: SoundVolume

Craig Williams
You're a hero! Thank you!
BastiBechtold
You're welcome!
Craig Williams