Port Access
Is this code any intialisation, Please help
In Java How can we control System Sound output. For Example if I am playing a sound clip
using AudioClip API and I want to control its volume and so other clips which are played next uses that volume to play.
The code:
Line.Info lines[] = AudioSystem.getTargetLineInfo(Port.Info.SPEAKER);
returns no lines.
Additionally, the code:
if (AudioSystem.isLineSupported(Port.Info.SPEAKER)) {
Port line = (Port)AudioSystem.getLine(Port.Info.SPEAKER);
}
else {
System.out.println("No speaker");
}
if (AudioSystem.isLineSupported(Port.Info.HEADPHONE)) {
Port line = (Port)AudioSystem.getLine(Port.Info.HEADPHONE);
}
else {
System.out.println("No headphone");
}
if (AudioSystem.isLineSupported(Port.Info.LINE_OUT)) {
Port line = (Port)AudioSystem.getLine(Port.Info.LINE_OUT);
}
else {
System.out.println("No LINE_OUT");
}
Tells me I have no speaker, no headphone, and no LINE_OUT. I clearly have
sound support on this computer.
Is there something I have to do first to initialize this stuff?

