views:

58

answers:

2

I'd like to check my systemmixers for volume in Java.

So I loop through all mixers and create a line. Is there a possibility to get an integer of the volume currently active on that line? I only seem to find adjustments to the systemvolume or linevolume but not the current actual volume.

Or should I try to record a little part of every mixer and check for volume?

Help is really bad appreciated.

Thanks!

+2  A: 

You can get get a Mixer from the AudioSystem, then get a Line from the Mixer, then get a Control you need (I guess, FloatControl.Type.VOLUME). The Control has getValue() method.

unbeli
Yeah but this way you get the value of the volume that is set in the mixer. I need the actual output of the moment. Some mixers don't do anything and some are playbacking audio. I need to check what mixer plays the audio.
baklap
ah ok, that was not clear from the question. It's good you've found the answer.
unbeli
A: 

Ok I just found the class DataLine which has the method getLevel()

This way I'm able to get the current volume. Thanks unbeli!

baklap