|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jvoicexml.implementation.jsapi10.AudioOutput
public final class AudioOutput
Audio output that uses the JSAPI 1.0 to address the TTS engine.
Handle all JSAPI calls to the TTS engine to make JSAPI transparent to the interpreter.
Copyright © 2005-2007 JVoiceXML group - http://jvoicexml.sourceforge.net/
| Constructor Summary | |
|---|---|
AudioOutput(SynthesizerModeDesc defaultDescriptor)
Constructs a new audio output. |
|
| Method Summary | |
|---|---|
void |
activate()
Activates this resource, when it is retrieved from the pool. |
void |
cancelOutput()
Cancels the current output from the TTS engine and queued audio for all entries in the queue that allow bargein. |
void |
close()
Closes and releases the acquired resources. |
void |
connect(RemoteClient client)
Establishes a connection from the given RemoteClient to this
object. |
String |
getType()
Retrieves a unique identifier for this external resource. |
void |
open()
Initializes and and acquires the needed resources. |
void |
passivate()
Passivates this resource, when it is returned to the pool. |
void |
queueAudio(AudioInputStream audio)
The audio, delivered by the audio stream is queued after
the last element in the speaking queue. |
void |
queuePlaintext(String text)
Speaks a plain text string. |
void |
queuePlaintextMessage(String text)
Speaks a plain text string. |
void |
queueSpeakable(SpeakableText speakable,
boolean bargein,
DocumentServer documentServer)
The Speakable object is added to the end of the speaking queue and will be spoken once it reaches the top of the queue. Checks the type of the given speakable and forwards it either as for SSML output or for plain text output. |
void |
reachedMark(String mark)
A mark in an SSML output has been reached. |
void |
setSystemOutputListener(SystemOutputListener outputListener)
Sets the listener for system output events. |
void |
setVoice(String name)
Use the given voice for the synthesizer. |
void |
waitEngineState(long state)
Blocks the calling thread until the Engine is in a specified state. |
void |
waitQueueEmpty()
Convenient method to wait until all output is being played. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AudioOutput(SynthesizerModeDesc defaultDescriptor)
defaultDescriptor - the default synthesizer mode descriptor.| Method Detail |
|---|
public void open()
throws NoresourceError
open in interface ExternalResourceNoresourceError - The resource could not be opened.public void close()
close in interface ExternalResourcepublic void setSystemOutputListener(SystemOutputListener outputListener)
The implementation of this interface must notify the listener about all events.
setSystemOutputListener in interface ObservableSystemOutputoutputListener - The listener.
public void queueSpeakable(SpeakableText speakable,
boolean bargein,
DocumentServer documentServer)
throws NoresourceError,
BadFetchError
queueSpeakable in interface SystemOutputspeakable - Text to be spoken.bargein - true if the output can be cancelled.documentServer - The document server to use.
NoresourceError - The output resource is not available.
BadFetchError - A URI within the speakable could not be obtained or a parsing
error occured.
public void queuePlaintextMessage(String text)
throws NoresourceError,
BadFetchError
The source of a SpeakableEvent issued to the SpeakableListener is the String object.
The speak methods operate as defined only when a Synthesizer is in the ALLOCATED state. The call blocks if the Synthesizer in the ALLOCATING_RESOURCES state and completes when the engine reaches the ALLOCATED state. An error is thrown for synthesizers in the DEALLOCATED or DEALLOCATING_RESOURCES states.
text - String contains plaing text to be spoken.
NoresourceError - No recognizer allocated.
BadFetchError - Recognizer in wrong state.
public void queuePlaintext(String text)
throws NoresourceError,
BadFetchError
text - String contains plain text to be spoken.
NoresourceError - No recognizer allocated.
BadFetchError - Recognizer in wrong state.
public void queueAudio(AudioInputStream audio)
throws NoresourceError,
BadFetchError
audio stream is queued after
the last element in the speaking queue.
If bargein can be used while queuing the audio depends on the surrounding
<prompt>.
queueAudio in interface SystemOutputaudio - Stream with audio data.
NoresourceError - The output resource is not available.
BadFetchError - Error reading from the AudioStream.
public void cancelOutput()
throws NoresourceError
The implementation has to maintain a list of cancellable outputs
dependingon the bargein flag.
cancelOutput in interface SystemOutputNoresourceError - The output resource is not available.
public void waitEngineState(long state)
throws InterruptedException
All state bits specified in the state parameter must be set in order for the method to return, as defined for the testEngineState method. If the state parameter defines an unreachable state (e.g. PAUSED | RESUMED) an exception is thrown.
The waitEngineState method can be called successfully in any Engine state.
state - State to wait for.
InterruptedException - If another thread has interrupted this thread.public void waitQueueEmpty()
public void setVoice(String name)
throws PropertyVetoException
name - Name of the voice to use
PropertyVetoException - Error in assigning the voice.public void reachedMark(String mark)
mark - Name of the mark.public void activate()
activate in interface ExternalResourceactivate in interface SystemOutputpublic void passivate()
passivate in interface ExternalResourcepassivate in interface SystemOutput
public void connect(RemoteClient client)
throws IOException
RemoteClient to this
object.
connect in interface RemoteConnectableclient - data container with connection relevant data.
IOException - error establishing the connection.public String getType()
getType in interface ExternalResource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||