|
java getting audio stream from an application
I am trying to write a program in Java that will take the audio data being given to the sound card and trying to record it.
I have found huge amounts of examples on how to take in audio from a microphone and save it as a file, but what I want to do is record any sound that an application may be making, such as xmms or any other audio player.
The examples that I have to record data from a microphone get a TargetDataLine(). Am I correct in assuming that this not what I want, as this will be the audio that has come into the sound card via the line-in and is now being output?
I think I am on the right track in saying that what I want is a SourceDataLine() - that being the audio that is being given to the sound card.
If I am on the right track, how then will it work, as a SourceDataLine() can only be opened once, so if an application has opened it to send its audio data to the sound card my program will then give an error as it is already open.
Do I need to somehow hijack the SourceDataLine() that is being used, and redirect it to my program. How would I go about doing this?
I have looked at :
jsresources.org
java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/contents.html
but they do not seem to be able to answer my questions!!
Thank you for your time
Meercat
|