|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.cloudgarden.audio.DefaultAudioObject
|
+--com.cloudgarden.audio.DefaultAudioSource
|
+--com.cloudgarden.audio.AudioLineSource
AudioSource wrapper for a TargetDataLine.
| Fields inherited from class com.cloudgarden.audio.DefaultAudioSource |
sending, sendThread, sink |
| Fields inherited from class com.cloudgarden.audio.DefaultAudioObject |
contentType, exception, format, listeners, paused, pauseSync, running, waiting |
| Fields inherited from interface com.cloudgarden.audio.AudioObject |
END_OF_DATA |
| Constructor Summary | |
AudioLineSource(javax.sound.sampled.AudioFormat format)
Creates a TargetDataLine with the given AudioFormat, opens and starts it. |
|
AudioLineSource(AudioSink sink)
Creates an AudioLineSource to push data to the given AudioSink, with the same AudioFormat as the AudioSink. |
|
AudioLineSource(int rate,
int bits,
int chans,
boolean signed,
boolean bigEndian)
Creates a TargetDataLine with the given AudioFormat parameters and opens it. |
|
AudioLineSource(javax.sound.sampled.TargetDataLine line)
Creates new AudioLineSource using the given line, opens and starts the line. |
|
| Method Summary | |
boolean |
canSetAudioFormat()
The AudioFormat is set when the AudioLineSource is created and cannot be changed, since the TargetDataLine cannot change its format once created. |
void |
close()
Closes the line |
void |
drain()
Calls DefaultAudioSource.drain, then drains and stops the line. |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Returns the AudioFormat for this AudioObject. |
javax.sound.sampled.TargetDataLine |
getLine()
Returns the TargetDataLine used by this AudioSource |
void |
open()
Opens the line. |
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. |
void |
startSending()
Opens the TargetDataLine, if not already open, starts it, and calls DefaultAudioSource's startSending method. |
void |
stopSending()
Stops the line and calls DefaultAudioSource.stopSending(); |
| Methods inherited from class com.cloudgarden.audio.DefaultAudioSource |
getSink, isSending, read, setBufferSize, setContentType, setSink |
| Methods inherited from class com.cloudgarden.audio.DefaultAudioObject |
addTransferListener, blockWhilePaused, blockWhileWaiting, bytesTransferred, getContentType, getLastException, isPaused, isWaiting, removeTransferListener, setPaused |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.cloudgarden.audio.AudioObject |
addTransferListener, getContentType, isPaused, isWaiting, removeTransferListener, setPaused |
| Constructor Detail |
public AudioLineSource(javax.sound.sampled.TargetDataLine line)
throws javax.sound.sampled.LineUnavailableException
public AudioLineSource(int rate,
int bits,
int chans,
boolean signed,
boolean bigEndian)
throws javax.sound.sampled.LineUnavailableException
public AudioLineSource(javax.sound.sampled.AudioFormat format)
throws javax.sound.sampled.LineUnavailableException
public AudioLineSource(AudioSink sink)
throws javax.sound.sampled.LineUnavailableException,
java.io.IOException
| Method Detail |
public javax.sound.sampled.AudioFormat getAudioFormat()
AudioObjectgetAudioFormat in class DefaultAudioObjectcom.cloudgarden.audio.AudioObjectAudioObject.setAudioFormat(javax.sound.sampled.AudioFormat)public javax.sound.sampled.TargetDataLine getLine()
public boolean canSetAudioFormat()
canSetAudioFormat in class DefaultAudioObject
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 class DefaultAudioSourcecom.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 int read(byte[] data,
int offset,
int len)
throws java.io.IOException
AudioSourcecom.cloudgarden.audio.AudioSourceAudioSource.setSink(com.cloudgarden.audio.AudioSink),
AudioSink#startGetting,
AudioObject.setPaused(boolean)
public void startSending()
throws java.io.IOException
startSending in class DefaultAudioSourcecom.cloudgarden.audio.AudioSourcean - 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.AudioSource.setSink(com.cloudgarden.audio.AudioSink),
AudioObject.drain()
public void drain()
throws java.io.IOException
drain in class DefaultAudioSourcepublic void stopSending()
stopSending in class DefaultAudioSourcecom.cloudgarden.audio.AudioSourceAudioSource.startSending()public void close()
public void open()
throws javax.sound.sampled.LineUnavailableException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||