com.cloudgarden.audio
Class AudioStreamSource
java.lang.Object
|
+--com.cloudgarden.audio.DefaultAudioObject
|
+--com.cloudgarden.audio.DefaultAudioSource
|
+--com.cloudgarden.audio.AudioStreamSource
- All Implemented Interfaces:
- AudioObject, AudioSource
- public class AudioStreamSource
- extends DefaultAudioSource
AudioSource wrapper for an AudioInputStream
Method Summary |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Returns the AudioFormat for this AudioObject. |
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 |
setAudioFormat(javax.sound.sampled.AudioFormat format)
Sets the AudioFormat for this AudioObject. |
Methods inherited from class com.cloudgarden.audio.DefaultAudioObject |
addTransferListener, blockWhilePaused, blockWhileWaiting, bytesTransferred, canSetAudioFormat, getContentType, getLastException, isPaused, isWaiting, removeTransferListener, setPaused |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AudioStreamSource
public AudioStreamSource(javax.sound.sampled.AudioInputStream stream)
getAudioFormat
public javax.sound.sampled.AudioFormat getAudioFormat()
- Description copied from interface:
AudioObject
- Returns the AudioFormat for this AudioObject.
- Overrides:
getAudioFormat
in class DefaultAudioObject
- Following copied from interface:
com.cloudgarden.audio.AudioObject
- See Also:
AudioObject.setAudioFormat(javax.sound.sampled.AudioFormat)
setAudioFormat
public void setAudioFormat(javax.sound.sampled.AudioFormat format)
throws java.io.IOException
- Description copied from interface:
AudioObject
- Sets the AudioFormat for this AudioObject.
If this object is connected to an AudioSource or an AudioSink, then the
source/sink's AudioFormat is set equal to that of this AudioObject.
Note: if the sink is an AudioConverter then the
setIncomingAudioFormat method is called instead of setAudioFormat.
This ensures that the AudioFormat is uniform along a set of connected
AudioObjects until the format is changed by an AudioConverter.
- Overrides:
setAudioFormat
in class DefaultAudioSource
- Following copied from interface:
com.cloudgarden.audio.AudioObject
- Throws:
java.io.IOException
- if unable to set the AudioFormat for any reason
(eg. if canSetAudioFormat returns false and setAudioFormat is used
to try to change the AudioFormat).- See Also:
AudioObject.getAudioFormat()
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)