tags:

views:

100

answers:

1

I'm writing a simple piece of software that streams audio over LAN. I have all of the network parts implemented, but what I'm stumbling on is using the Java Sound API. I have successfully captured audio from the microphone, and line-in, but I can't seem to capture from any target ports, like the speakers. My question is, is it possible to capture from the Master target port? Here is the piece of code that works on initializing the line.

private boolean startCapture(){
    try{
        DataLine.Info info = new DataLine.Info( TargetDataLine.class, format);
        line = (TargetDataLine)AudioSystem.getLine(info);
        audioBuffer = new byte[bufferSize];
        line.open(format);
        line.start();
        return true;
    }catch(Exception e){
        System.out.println("Exception thrown when capturing audio:\n" + e);
        return false;
    }
}

Running the code like this will just use the microphone as my line. Here is info about my sound system. Most important is probably the fact that I'm running Linux.

Thanks in advance for any and all help you can give me.

A: 

speakers are SourceDataLine, not TargetDataLine. I don't understand how you can "capture" from a speaker?

Samuel Yung
It's still a port on the mixer. My understanding is that you can still get it from the mixer, before it actually is out on its way to the speakers. There has got to be a way to get the data flowing through that port.
Kyle Kamperschroer