|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.cloudgarden.audio.DefaultAudioObject
The base class which implements the functionality of a generic AudioObject.
| Field Summary | |
protected java.lang.String |
contentType
|
protected java.io.IOException |
exception
|
protected javax.sound.sampled.AudioFormat |
format
|
protected java.util.Vector |
listeners
|
protected boolean |
paused
|
protected java.lang.Object |
pauseSync
|
protected boolean |
running
|
protected boolean |
waiting
|
| Fields inherited from interface com.cloudgarden.audio.AudioObject |
END_OF_DATA |
| Constructor Summary | |
DefaultAudioObject()
|
|
| Method Summary | |
void |
addTransferListener(TransferListener listener)
Adds a TransferListener to receive notification when data is passed to or from this AudioObject |
protected void |
blockWhilePaused()
Blocks while paused is true - should be used by classes extending this class to block in the write method. |
void |
blockWhileWaiting()
Blocks while isWaiting returns false |
protected void |
bytesTransferred(byte[] data,
int offset,
int numBytes,
int direction)
Notifies any TransferListeners that bytes are about to be transferred (either read or written). |
boolean |
canSetAudioFormat()
Returns false if the AudioFormat cannot be set - eg some Recognizers may not be able to change their input format, so the CGAudioManager (which is an AudioSink) for that Recognizer will return false here. |
void |
drain()
Blocks until END_OF_DATA is written to or read from this AudioObject. |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Returns the AudioFormat for this AudioObject. |
java.lang.String |
getContentType()
|
java.lang.Exception |
getLastException()
|
boolean |
isPaused()
|
boolean |
isWaiting()
Returns true if no data has yet been written or read from this AudioObject |
void |
removeTransferListener(TransferListener listener)
|
void |
setAudioFormat(javax.sound.sampled.AudioFormat format)
Sets the AudioFormat for this AudioObject. |
void |
setContentType(java.lang.String contentType)
Sets the content type for this AudioObject - contentType must be one of the FileTypeDescriptor String fields, eg MPEG_AUDIO. |
void |
setPaused(boolean paused)
If paused is true, writing or reading data to or from this AudioObject will block until setPaused(false) is called. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean running
protected boolean waiting
protected boolean paused
protected javax.sound.sampled.AudioFormat format
protected java.io.IOException exception
protected java.lang.String contentType
protected java.lang.Object pauseSync
protected java.util.Vector listeners
| Constructor Detail |
public DefaultAudioObject()
| Method Detail |
public void drain()
throws java.io.IOException
AudioObjectdrain in interface AudioObject
public void setAudioFormat(javax.sound.sampled.AudioFormat format)
throws java.io.IOException
AudioObjectThis ensures that the AudioFormat is uniform along a set of connected AudioObjects until the format is changed by an AudioConverter.
setAudioFormat in interface AudioObjectcom.cloudgarden.audio.AudioObjectjava.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).AudioObject.getAudioFormat()public boolean canSetAudioFormat()
AudioObjectcanSetAudioFormat in interface AudioObjectpublic javax.sound.sampled.AudioFormat getAudioFormat()
AudioObjectgetAudioFormat in interface AudioObjectcom.cloudgarden.audio.AudioObjectAudioObject.setAudioFormat(javax.sound.sampled.AudioFormat)public boolean isWaiting()
isWaiting in interface AudioObjectpublic void blockWhileWaiting()
protected void blockWhilePaused()
AudioSink.write(byte[], int, int),
AudioObject.setPaused(boolean)public void setPaused(boolean paused)
AudioObjectsetPaused in interface AudioObjectpublic boolean isPaused()
isPaused in interface AudioObjectpublic java.lang.Exception getLastException()
public java.lang.String getContentType()
getContentType in interface AudioObjectcom.cloudgarden.audio.AudioObjectsetContentType
public void setContentType(java.lang.String contentType)
throws java.io.IOException
AudioObjectsetContentType in interface AudioObjectpublic void addTransferListener(TransferListener listener)
AudioObjectaddTransferListener in interface AudioObjectpublic void removeTransferListener(TransferListener listener)
removeTransferListener in interface AudioObjectcom.cloudgarden.audio.AudioObjectaddTransferListener
protected void bytesTransferred(byte[] data,
int offset,
int numBytes,
int direction)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||