|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
An interface representing a class which generates audio data, and which can be connected to an AudioSink.
| Fields inherited from interface com.cloudgarden.audio.AudioObject |
END_OF_DATA |
| Method Summary | |
AudioSink |
getSink()
Returns the AudioSink set using setSink |
boolean |
isSending()
Returns true if the thread started by the startSending method is still writing data to the AudioSink. |
int |
read(byte[] data,
int len)
Convenience method - should call read(data, 0, len) |
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 |
setSink(AudioSink sink)
Sets the sink for this source - this method should also call the setSource method on the sink object (making sure to avaoid an endless loop) to ensure that source and sink are connected to each other (and not to different sinks/sources). |
void |
startSending()
This method should start a thread which repeatedly writes data to the AudioSink object which this object is connected to, until it writes data with length END_OF_DATA, or until the stopSending method is called. |
void |
stopSending()
|
| Methods inherited from interface com.cloudgarden.audio.AudioObject |
addTransferListener, canSetAudioFormat, drain, getAudioFormat, getContentType, isPaused, isWaiting, removeTransferListener, setAudioFormat, setContentType, setPaused |
| Method Detail |
public int read(byte[] data,
int offset,
int len)
throws java.io.IOException
setSink(com.cloudgarden.audio.AudioSink),
AudioSink#startGetting,
AudioObject.setPaused(boolean)
public int read(byte[] data,
int len)
throws java.io.IOException
public void startSending()
throws java.io.IOException
an - IOException if the source is unable to start sending data - for example,
if an audio file is unable to be opened to supply the data to be sent.setSink(com.cloudgarden.audio.AudioSink),
AudioObject.drain()public void stopSending()
startSending()public boolean isSending()
startSending()
public void setSink(AudioSink sink)
throws java.io.IOException
If the sink's AudioFormat is null or the sink's format differs from this AudioSource's format, then the sink's format is set equal to that of this AudioSource.
If the sink's AudioFormat is not null and this AudioSource's format is null then this AudioSource's format is set equal to the sink's.
The same is done for the ContentType as described above for the AudioFormat.
Note: if the sink is an AudioConverter then the get/setIncomingAudioFormat method is called instead of get/setAudioFormat.
getSink()public AudioSink getSink()
setSink(com.cloudgarden.audio.AudioSink)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||