Overview | Package | Class | Tree | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
EngineProperties
object defines the set of run-time
properties of an Engine
. This interface is extended for
each type of speech engine. SynthesizerProperties
and
RecognizerProperties
define the additional run-time
properties of synthesizers and recognizers respectively.
The EngineProperties
object for an Engine
is
obtained from the getEngineProperties
method of the engine,
and should be cast appropriately for the type of engine. For example:
Synthesizer synth = ...; SynthesizerProperties props = (SynthesizerProperties)synth.getEngineProperties();Each property of an engine has a set and get method. The method signatures follow the JavaBeans design patterns (outlined below).
The run-time properties of an engine affect the behavior of a
running engine. Technically, properties affect engines in the
ALLOCATED
state. Normally, property changes are made
on an ALLOCATED
engine and take effect immediately
or soon after the change call.
The EngineProperties
object for an engine is, however,
available in all states of an Engine
. Changes
made to the properties of engine in the DEALLOCATED
or
the ALLOCATING_RESOURCES
state take effect when the
engine next enters the ALLOCATED
state. A typical
scenario for setting the properties of a non-allocated is determining
the initial state of the engine. For example, setting the initial
voice of a Synthesizer
, or the initial SpeakerProfile
of a Recognizer
. (Setting these properties prior to
allocation is desirable because allocating the engine and then changing
the voice or the speaker can be computationally expensive.)
When setting any engine property:
PropertyChangeListener
can be
attached to the EngineProperties
object to receive a
property change event when a change takes effect.
For example, a call to the setPitch
method of the
SynthesizerProperties
interface to change pitch from 120Hz to 200Hz
might fail because the value is out-of-range. If it does succeed, the
pitch change might be deferred until the synthesizer can make the
change by waiting to the end of the current word, sentence, paragraph
or text object. When the change does take effect, a PropertyChangeEvent
is issued to all attached listeners with the name of the changed
property ("Pitch"), the old value (120) and the new value (200).
Set calls take effect in the order in which they are received. If multiple changed are requested are requested for a single property, a separate event is issued for each call, even if the multiple changes take place simultaneously.
The properties of an engine are persistent across sessions where possible. It is the engine's responsibility to store and restore the property settings. In multi-user and client-server environments the store/restore policy is at the discretion of the engine.
Control Component
An engine may provide a control object through the getControlComponent
method of its EngineProperties
object.
The control object is an AWT Component
. If provided, that
component can be displayed to a user for customization of the engine.
Because the component is implemented by the engine, the display may
support customization of engine-specific properties that are not
accessible through the standard properties interfaces.
JavaBeans Properties
The JavaBeans property patterns are followed for engine properties. A property is defined by its name and its property type (for example, "Pitch" is a float). The property is accessed through get and set methods. The signature of the property accessor methods are:
public void set<PropertyName>(<PropertyType> value); public <PropertyType> get<PropertyName>();For boolean-valued properties, the
get<PropertyName>()
may also be is<PropertyName>()
For indexed properties (arrays) the signature of the property accessor methods are:
public void set<PropertyName>(<PropertyType>[]; value); public void set<PropertyName>(int i, <PropertyType> value); public <PropertyType>[] get<PropertyName>(); public <PropertyType> get<PropertyName>(int i);For example speaking rate (for a Synthesizer) is a floating value and has the following methods:
public void setSpeakingRate(float value); public float getSpeakingRate();
Method Summary | |
void | addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.
|
Component | getControlComponent()
Obtain the AWT Component that provides the default user interface for setting the properties of this Engine .
|
void | removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
void | reset()
The reset method returns all properties to reasonable defaults for the Engine . |
Method Detail |
public Component getControlComponent()
Engine
.
If this Engine
has no default control panel,
the return is null
public void reset()
Engine
. A property change event is issued
for each engine property that changes as the reset takes effect.public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
to the listener list.
The listener is registered for all properties of the engine..
A PropertyChangeEvent
is fired in response to setting
any bound property.
listener
- - The PropertyChangeListener
to be addedpublic void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
from the listener list.
listener
- - The PropertyChangeListener
to be removedOverview | 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