|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jvoicexml.implementation.jsapi10.AudioInput
public final class AudioInput
Audio input that uses the JSAPI 1.0 to address the recognition engine.
Handle all JSAPI calls to the recognizer to make JSAPI transparent to the interpreter.
Copyright © 2005 JVoiceXML group - http://jvoicexml.sourceforge.net/
| Field Summary | |
|---|---|
private RecognitionEngine |
engine
The implementation of a recognition engine. |
private static Logger |
LOGGER
Logger for this class. |
private Recognizer |
recognizer
The speech recognizer. |
private TimerThread |
timer
A timer to get the noinput timeout. |
| Constructor Summary | |
|---|---|
AudioInput(Platform platform)
Constructs a new audio input. |
|
| Method Summary | |
|---|---|
private boolean |
activateGrammar(String name,
boolean activate)
Activates the given grammar. |
void |
activateGrammars(Collection<RuleGrammar> grammars)
Activates the given grammar. |
void |
close()
Closes and releases the acquired resources. |
void |
deactivateGrammars(Collection<RuleGrammar> grammars)
Dectivates the given grammar. |
RuleGrammar |
loadGrammar(Reader reader)
Creates a RuleGrammar from Java Speech Grammar Format text provided by the Reader. |
RuleGrammar |
newGrammar(String name)
Create a new RuleGrammar for this recognizer with a specified grammar name. |
void |
open()
Initializes and and acquires the needed resources. |
void |
record(OutputStream out)
Records audio received from the user. |
void |
setInputStream(InputStream in)
Sets the input stream, where the input should be obtained. |
void |
startRecognition(EventHandler handler)
Detects and reports character and/or spoken input simultaneously. |
void |
stopRecognition()
Stops a previously started recognition. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final Logger LOGGER
private Recognizer recognizer
private final RecognitionEngine engine
private TimerThread timer
| Constructor Detail |
|---|
public AudioInput(Platform platform)
platform - The platform that manages the TTSEngine.| Method Detail |
|---|
public void open()
throws NoresourceError
open in interface ExternalResourceNoresourceError - The resource could not be opened.public void close()
close in interface ExternalResource
public RuleGrammar newGrammar(String name)
throws NoresourceError
newGrammar in interface UserInputname - Name of the grammar to be created.
RuleGrammar.
NoresourceError - If the input device is not available.
public RuleGrammar loadGrammar(Reader reader)
throws NoresourceError,
BadFetchError,
UnsupportedFormatError
loadGrammar in interface UserInputreader - The Reader from which the grammar text is loaded
NoresourceError - The input resource is not available.
BadFetchError - Error reading the grammar.
UnsupportedFormatError - Invalid grammar format.
private boolean activateGrammar(String name,
boolean activate)
throws BadFetchError
name - Name of the grammar.activate - true if the grammar should be activated.
BadFetchError - Error creating the grammar.
public void activateGrammars(Collection<RuleGrammar> grammars)
throws BadFetchError,
UnsupportedLanguageError,
NoresourceError
activateGrammars in interface UserInputgrammars - Grammars to activate.
BadFetchError - Grammar is not know by the recognizer.
UnsupportedLanguageError - The specified language is not supported.
NoresourceError - The input resource is not available.
public void deactivateGrammars(Collection<RuleGrammar> grammars)
throws BadFetchError
deactivateGrammars in interface UserInputgrammars - Grammars to deactivate.
BadFetchError - Grammar is not know by the recognizer.
public void record(OutputStream out)
throws NoresourceError
record in interface UserInputout - OutputStream to write the recorded audio.
NoresourceError - The input resource is not available.
public void startRecognition(EventHandler handler)
throws NoresourceError,
BadFetchError
startRecognition in interface UserInputhandler - The event handler to notify about the recognition result.
NoresourceError - The input resource is not available.
BadFetchError - The active grammar contains some errors.public void stopRecognition()
stopRecognition in interface UserInputUserInput.startRecognition(org.jvoicexml.interpreter.EventHandler)
public void setInputStream(InputStream in)
throws NoresourceError
Note: Unfortunately this is not a feature of all TTS engines. If
no InputStream is returned, the default input of the
recognizer engine is used. This may have consequences on the usability
with a calling device.
setInputStream in interface UserInputin - The input to use.
NoresourceError - The input resource is not available.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||