|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.speech.freetts.audio.JavaClipAudioPlayer
Provides an implementation of AudioPlayer
that creates
javax.sound.sampled audio clips and outputs them via the
javax.sound API. The interface provides a highly reliable audio
output package. Since audio is batched and not sent to the audio
layer until an entire utterance has been processed, this player has
higher latency (50 msecs for a typical 4 second utterance).
The system property:
com.sun.speech.freetts.audio.AudioPlayer.debug;
if set to true
will cause this
class to emit debugging information (useful to a developer).
Constructor Summary | |
JavaClipAudioPlayer()
Constructs a default JavaClipAudioPlayer |
Method Summary | |
void |
begin(int size)
Starts the output of a set of data. |
void |
cancel()
Cancels all queued audio. |
void |
close()
Closes this audio player |
boolean |
drain()
Waits for all queued audio to be played |
boolean |
end()
Marks the end a set of data. |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Retrieves the audio format for this player |
long |
getTime()
Returns the current position in the output stream since the last resetTime
Currently not supported. |
float |
getVolume()
Returns the current volume. |
void |
pause()
Pauses audio output. |
void |
reset()
Prepares for another batch of output. |
void |
resetTime()
Resets the time for this audio stream to zero |
void |
resume()
Resumes playing audio after a pause. |
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 |
java.lang.String |
toString()
Returns the name of this audio player |
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, wait, wait, wait |
Constructor Detail |
public JavaClipAudioPlayer()
Method Detail |
public void setAudioFormat(javax.sound.sampled.AudioFormat format)
setAudioFormat
in interface AudioPlayer
format
- the audio format
java.lang.UnsupportedOperationException
- if the line cannot be opened with
the given formatpublic javax.sound.sampled.AudioFormat getAudioFormat()
getAudioFormat
in interface AudioPlayer
public void pause()
resume
. Output can be
aborted by calling cancel
pause
in interface AudioPlayer
public void resume()
resume
in interface AudioPlayer
public void cancel()
cancel
in interface AudioPlayer
public void reset()
reset
in interface AudioPlayer
public boolean drain()
drain
in interface AudioPlayer
true
if the write completed successfully,
false
if the write was cancelled.public void close()
close
in interface AudioPlayer
public float getVolume()
getVolume
in interface AudioPlayer
public void setVolume(float volume)
setVolume
in interface AudioPlayer
volume
- the current volume (between 0 and 1)public long getTime()
resetTime
Currently not supported.
getTime
in interface AudioPlayer
public void resetTime()
resetTime
in interface AudioPlayer
public void begin(int size)
begin
in interface AudioPlayer
size
- the size of data between now and the endpublic boolean end()
end
in interface AudioPlayer
true
if the audio was output properly,
false
if the output was cancelled
or interrupted.public boolean write(byte[] audioData)
write
in interface AudioPlayer
audioData
- audio data to write to the device
true
if the write completed successfully,
false
if the write was cancelled.public boolean write(byte[] bytes, int offset, int size)
write
in interface AudioPlayer
bytes
- audio data to write to the deviceoffset
- the offset into the buffersize
- the size into the buffer
true
if the write completed successfully,
false
if the write was cancelled.public java.lang.String toString()
public void showMetrics()
showMetrics
in interface AudioPlayer
public void startFirstSampleTimer()
startFirstSampleTimer
in interface AudioPlayer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |