com.cloudgarden.audio
Class AudioMediaLineSource
java.lang.Object
|
+--com.cloudgarden.audio.DefaultAudioObject
|
+--com.cloudgarden.audio.DefaultAudioSource
|
+--com.cloudgarden.audio.AudioMediaLineSource
- All Implemented Interfaces:
- AudioObject, AudioSource
- public class AudioMediaLineSource
- extends DefaultAudioSource
AudioSource wrapper for a javax.media capture device, enabling audio data to be
captured from a microphone etc (avoiding the bugs encountered by the
javax.sound.sampled capture devices when a SourceDataLine is running at
the same time). Requires the JMF to be installed.
|
Constructor Summary |
AudioMediaLineSource(javax.sound.sampled.AudioFormat format)
Creates new AudioMediaFileSource. |
|
Method Summary |
int |
read(byte[] data,
int offset,
int len)
Used to read data from this source - called by the AudioSink which this
source is connected to (if its startGetting method is used) so need
not be called explicitly by an application. |
void |
startSending()
Starts a thread which reads audio data from the file. |
| Methods inherited from class com.cloudgarden.audio.DefaultAudioObject |
addTransferListener, blockWhilePaused, blockWhileWaiting, bytesTransferred, canSetAudioFormat, getAudioFormat, getContentType, getLastException, isPaused, isWaiting, removeTransferListener, setPaused |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AudioMediaLineSource
public AudioMediaLineSource(javax.sound.sampled.AudioFormat format)
throws javax.sound.sampled.UnsupportedAudioFileException,
java.io.IOException
- Creates new AudioMediaFileSource. Reads data from the file (which can be in any
format readable by the JMF) and converts it to the format determined by the 'format' parameter.
read
public int read(byte[] data,
int offset,
int len)
throws java.io.IOException
- Description copied from interface:
AudioSource
- Used to read data from this source - called by the AudioSink which this
source is connected to (if its startGetting method is used) so need
not be called explicitly by an application. Blocks if this source is paused.
Returns the number of bytes read, or END_OF_DATA if all the available
data has been read - eg if the end of a file has been reached, or if
the stopSending() method has been called.
- Following copied from interface:
com.cloudgarden.audio.AudioSource
- See Also:
AudioSource.setSink(com.cloudgarden.audio.AudioSink),
AudioSink#startGetting,
AudioObject.setPaused(boolean)
startSending
public void startSending()
throws java.io.IOException
- Starts a thread which reads audio data from the file.
- Overrides:
startSending in class DefaultAudioSource
- Throws:
an - IOException if the file cannot be opened for reading