|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarytts.util.data.audio.ByteArrayAudioPlayer
public class ByteArrayAudioPlayer
Provides an implementation of AudioPlayer that sends
all audio data to the bit bucket. The ByteArrayAudioPlayer
is a helper, targeted at obtaining a byte array from the audio stream.
| Constructor Summary | |
|---|---|
ByteArrayAudioPlayer()
Constructs a ByteArrayAudioPlayer |
|
| Method Summary | |
|---|---|
void |
begin(int size)
Starts the output of a set of data |
void |
cancel()
Cancels all queued output. |
void |
close()
Waits for all audio playback to stop, and closes this AudioPlayer. |
boolean |
drain()
Waits for all queued audio to be played |
boolean |
end()
Marks the end of a set of data |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Retrieves the audio format for this player |
javax.sound.sampled.AudioInputStream |
getAudioInputStream()
Provide the audio data that has been written to this AudioPlayer since the last call to begin() as a byte array. |
byte[] |
getByteArray()
Provide the audio data that has been written to this AudioPlayer since the last call to begin() as a byte array. |
long |
getTime()
Gets the amount of played since the last resetTime Currently not supported. |
float |
getVolume()
Returns the current volume. |
void |
pause()
Pauses the audio output |
void |
reset()
Prepares for another batch of output. |
void |
resetTime()
Resets the audio clock |
void |
resume()
Resumes audio output |
void |
setAudioFormat(javax.sound.sampled.AudioFormat format)
Sets the audio format for this player |
void |
setVolume(float volume)
Sets the current volume. |
void |
showMetrics()
Shows metrics for this audio player |
void |
startFirstSampleTimer()
Starts the first sample timer |
boolean |
write(byte[] audioData)
Writes the given bytes to the audio stream |
boolean |
write(byte[] bytes,
int offset,
int size)
Writes the given bytes to the audio stream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ByteArrayAudioPlayer()
| Method Detail |
|---|
public void setAudioFormat(javax.sound.sampled.AudioFormat format)
setAudioFormat in interface com.sun.speech.freetts.audio.AudioPlayerformat - the audio formatpublic javax.sound.sampled.AudioFormat getAudioFormat()
getAudioFormat in interface com.sun.speech.freetts.audio.AudioPlayerpublic void cancel()
cancel in interface com.sun.speech.freetts.audio.AudioPlayerpublic void pause()
pause in interface com.sun.speech.freetts.audio.AudioPlayerpublic void reset()
reset in interface com.sun.speech.freetts.audio.AudioPlayerpublic void resume()
resume in interface com.sun.speech.freetts.audio.AudioPlayerpublic void close()
close in interface com.sun.speech.freetts.audio.AudioPlayerpublic float getVolume()
getVolume in interface com.sun.speech.freetts.audio.AudioPlayerpublic void setVolume(float volume)
setVolume in interface com.sun.speech.freetts.audio.AudioPlayervolume - the current volume (between 0 and 1)public boolean write(byte[] audioData)
write in interface com.sun.speech.freetts.audio.AudioPlayeraudioData - array of audio data
true of the write completed successfully,
false if the write was cancelled.public void begin(int size)
begin in interface com.sun.speech.freetts.audio.AudioPlayersize - the size of data between now and the endpublic boolean end()
end in interface com.sun.speech.freetts.audio.AudioPlayer
public boolean write(byte[] bytes,
int offset,
int size)
write in interface com.sun.speech.freetts.audio.AudioPlayerbytes - audio data to write to the deviceoffset - the offset into the buffersize - the size into the buffer
true of the write completed successfully,
false if the write was cancelled.public void startFirstSampleTimer()
startFirstSampleTimer in interface com.sun.speech.freetts.audio.AudioPlayerpublic boolean drain()
drain in interface com.sun.speech.freetts.audio.AudioPlayertrue if the audio played to completion,
false if the audio was stoppedpublic long getTime()
getTime in interface com.sun.speech.freetts.audio.AudioPlayerpublic void resetTime()
resetTime in interface com.sun.speech.freetts.audio.AudioPlayerpublic void showMetrics()
showMetrics in interface com.sun.speech.freetts.audio.AudioPlayerpublic byte[] getByteArray()
public javax.sound.sampled.AudioInputStream getAudioInputStream()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||