Overview | Package | Class | Tree | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.EventObject | +--javax.speech.SpeechEvent | +--javax.speech.EngineEvent | +--javax.speech.recognition.RecognizerEvent
Recognizer
through RecognizerListener
.
Inherits the following event types from EngineEvent
:
ENGINE_ALLOCATED
,
ENGINE_DEALLOCATED
,
ENGINE_ALLOCATING_RESOURCES
,
ENGINE_DEALLOCATING_RESOURCES
,
ENGINE_PAUSED
,
ENGINE_RESUMED
.
The source object for any RecognizerEvent
is the
Recognizer
.
Field Summary | |
static int | CHANGES_COMMITTED
CHANGES_COMMITTED event is issued when a
Recognizer changes from the SUSPENDED
state to the LISTENING state.
|
static int | FOCUS_GAINED
FOCUS_GAINED event is issued when a
Recognizer changes from the FOCUS_OFF
state to the FOCUS_ON state. |
static int | FOCUS_LOST
FOCUS_LOST event is issued when a
Recognizer changes from the FOCUS_ON
state to the FOCUS_OFF state. |
GrammarException | grammarException
Non-null if any error is detected in a grammar's definition while producing a CHANGES_COMMITTED event.
|
static int | RECOGNIZER_PROCESSING
RECOGNIZER_PROCESSING event is issued when a
Recognizer changes from the LISTENING
state to the PROCESSING state to indicate that
it is actively processing a recognition Result .
|
static int | RECOGNIZER_SUSPENDED
RECOGNIZER_SUSPENDED event is issued when a
Recognizer changes from either the LISTENING
state or the PROCESSING state to the
SUSPENDED state.
|
Fields inherited from class javax.speech.EngineEvent | |
ENGINE_ALLOCATED, ENGINE_ALLOCATING_RESOURCES, ENGINE_DEALLOCATED, ENGINE_DEALLOCATING_RESOURCES, ENGINE_PAUSED, ENGINE_RESUMED, newEngineState, oldEngineState |
Fields inherited from class javax.speech.SpeechEvent | |
id |
Fields inherited from class java.util.EventObject | |
source |
Constructor Summary | |
RecognizerEvent(Recognizer source,
int id,
long oldEngineState,
long newEngineState,
GrammarException grammarException)
Construct a RecognizerEvent with a specified event source,
event identifier, old and new states, and optionally a
GrammarException for a CHANGES_COMMITTED event.
|
Method Summary | |
GrammarException | getGrammarException()
Returns non-null for a CHANGES_COMMITTED
event if an error is found in the grammar definition.
|
String | paramString()
Returns a parameter string identifying this event. |
Methods inherited from class javax.speech.EngineEvent | |
getNewEngineState, getOldEngineState, paramString |
Methods inherited from class javax.speech.SpeechEvent | |
getId, paramString, toString |
Methods inherited from class java.util.EventObject | |
getSource, toString |
Methods inherited from class java.lang.Object | |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
Field Detail |
public static final int RECOGNIZER_PROCESSING
RECOGNIZER_PROCESSING
event is issued when a
Recognizer
changes from the LISTENING
state to the PROCESSING
state to indicate that
it is actively processing a recognition Result
.
The transition is triggered when the recognizer detects
speech in the incoming audio stream that may match
and active grammar. The transition occurs immediately
before the RESULT_CREATED
is issued to
ResultListeners
.
public static final int RECOGNIZER_SUSPENDED
RECOGNIZER_SUSPENDED
event is issued when a
Recognizer
changes from either the LISTENING
state or the PROCESSING
state to the
SUSPENDED
state.
A transition from the LISTENING
state to the
SUSPENDED
state is triggered by a call to either the
suspend
method or the commitChanges
method.
A transition from the PROCESSING
state to the
SUSPENDED
state is triggered by the finalization
of the result currently being recognized.
In this instance, the RECOGNIZER_SUSPENDED
event is
followed immediately by either the RESULT_ACCEPTED
or RESULT_REJECTED
event that finalizes the result.
public static final int CHANGES_COMMITTED
CHANGES_COMMITTED
event is issued when a
Recognizer
changes from the SUSPENDED
state to the LISTENING
state.
This state transition takes place when changes to the definition
and enabled state of all a recognizer's grammars have been applied.
The new grammar definitions are used as incoming speech is
recognized in the LISTENING
and PROCESSING
states of the Recognizer
.
Immediately following the CHANGES_COMMITTED
event,
GRAMMAR_CHANGES_COMMITTED
events are issued to
the GrammarListeners
of each changed Grammar
.
If any errors are detected in any grammar's definition during
the commit, a GrammarException
is provided with this
event. The GrammarException
is also included with
the GRAMMAR_CHANGES_COMMITTED
event to Grammar
with the error. The GrammarException
has the same
function as the GrammarException
thrown on the
commitChanges
method.
The causes and timing of the CHANGES_COMMITTED
event
are described with the
state transition documentation for a Recognizer
with the the committing changes
documentation for a Grammar
.
public static final int FOCUS_GAINED
FOCUS_GAINED
event is issued when a
Recognizer
changes from the FOCUS_OFF
state to the FOCUS_ON
state. This event
typically occurs as a result of a call the the
requestFocus
method of the Recognizer
.
The event indicates that the FOCUS_ON
bit
of the engine state is set.
Since recognizer focus is a key factor in the activation
policy for grammars, a FOCUS_GAINED
event is followed
by a GRAMMAR_ACTIVATED
event to the
GrammarListeners
of each Grammar
that is activated. Activation conditions and the role
of recognizer focus are detailed in the documentation for
the Grammar
interface.
public static final int FOCUS_LOST
FOCUS_LOST
event is issued when a
Recognizer
changes from the FOCUS_ON
state to the FOCUS_OFF
state. This event
may occur as a result of a call to the releaseFocus
method of the Recognizer
or because another application
has requested recognizer focus.
The event indicates that the FOCUS_OFF
bit
of the engine state is set.
Since recognizer focus is a key factor in the activation
policy for grammars, a FOCUS_LOST
event is followed
by a GRAMMAR_DEACTIVATED
event to the
GrammarListeners
of each Grammar
that loses activatation. Activation conditions and the role
of recognizer focus are detailed in the documentation for
the Grammar
interface.
protected GrammarException grammarException
CHANGES_COMMITTED
event.
null
for other event types.
The exception serves the same functional role as the
GrammarException
thrown on the commitChanges
method.
Constructor Detail |
public RecognizerEvent(Recognizer source, int id, long oldEngineState, long newEngineState, GrammarException grammarException)
RecognizerEvent
with a specified event source,
event identifier, old and new states, and optionally a
GrammarException
for a CHANGES_COMMITTED
event.
source
- the Recognizer
that issued the event
id
- the identifier for the event type
oldEngineState
- engine state prior to this event
newEngineState
- engine state following this event
grammarException
- non-null if an error is detected during CHANGES_COMMITTED
Method Detail |
public GrammarException getGrammarException()
CHANGES_COMMITTED
event if an error is found in the grammar definition.
The exception serves the same functional role as the
GrammarException
thrown on the commitChanges
method.
public String paramString()
Overview | Package | Class | Tree | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Speech API
Copyright 1997-1998 Sun Microsystems, Inc. All rights reserved
Send comments to javaspeech-comments@sun.com