Question

I wrote some code to capture sound with JavaSound API.
It starts like this:

        DataLine.Info info = new DataLine.Info(TargetDataLine.class,
            audioFormat);

        TargetDataLine line = (TargetDataLine) AudioSystem.getLine(info);
        line.open();

However, once getLine() gets called, other applications cannot start capturing sound any-more.

The other way round, getLine() will fail if some other sound-capturing-applications are running.

Generally I can use the sound recorder during a Skype session, that means that capturing sound doesn't have to be exclusive.

I would like my application to be non exclusive as well. I don't want to limit the user on what he can do with it.

In the JavaSound API tutorial it reads:

Commonly, only one input port can be open at a time, but an audio-input mixer that mixes audio from multiple ports is also possible.

Does it mean that JavaSound can only capture in an exclusive mode or that JavaSound itself can handle only one input port?

If the former is true, does any-one know how to work around this issue in Java?

Was it helpful?

Solution

I think, this is a linux/ubuntu related problem. I found a few site on the web that mention and/or solve this issue, here is two of them:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top