I'm currently writing a program in Java that I would like to use to control my PC's main speakers with. At the moment I am trying to use a JSlider
. Is there a way that I can use ChangeListener
to do this? If not ChangeListener
, is there another way that I can integrate this into my program? I have tirelessly been searching the web for this.
Asked
Active
Viewed 800 times
0

Alexis Pigeon
- 7,423
- 11
- 39
- 44

Eric after dark
- 1,768
- 4
- 31
- 79
-
Can you post the code you have so far? – rid May 13 '12 at 15:27
-
How are you setting the speaker volume? What method are you using? Are you using JNA or something similar? – Hovercraft Full Of Eels May 13 '12 at 15:45
-
Currently I am not using anything. To be honest, I don't know where to start. Is there some kind of method or API that I can use to do this. I know that it is possible to make OS calls with java, but would the main volume be accessible through an OS command? – Eric after dark May 14 '12 at 04:28
-
http://www.coderanch.com/t/492931/java/java/Adjusting-master-volume-Windows-XP this thread seems to have it covered. i'm assuming you're using windows. – devsnd May 14 '12 at 09:28
1 Answers
0
Warning: the Java Tutorials on sound aren't the easiest read.
http://docs.oracle.com/javase/tutorial/sound/accessing.html This one will show you how to find out what is on your system. You will need to figure out which line or port corresponds to OS speaker outputs.
http://docs.oracle.com/javase/tutorial/sound/controls.html This one will show you how to place a Control on the line or port. You will then be tieing your JSlider output to this Control.
Maybe start with that and come back with more specific questions along the way, if (when!) you run into problems.

Phil Freihofner
- 7,645
- 1
- 20
- 41
-
I hope it helps. I just came across this thread (similar question) and the answer is a bit discouraging. https://forums.oracle.com/forums/thread.jspa?threadID=2388172&tstart=0 I've only had direct experience with working on lines that arise within my apps, not the computer OS as a whole. But the tutorial I cited makes reference to controlling a client computer's mike on/off remotely. So maybe... – Phil Freihofner May 14 '12 at 21:25