fr.emn.reactiveinput.devices
Class DSpeechCommand

java.lang.Object
  extended byfr.emn.reactiveinput.AbstractDevice
      extended byfr.emn.reactiveinput.devices.DSpeechCommand
All Implemented Interfaces:
Device, Processor

public class DSpeechCommand
extends AbstractDevice


Field Summary
 Out command
           
 Out commandstring
           
 Out signal
           
 Out volume
           
 
Fields inherited from class fr.emn.reactiveinput.AbstractDevice
currIndex, ins, outs
 
Fields inherited from interface fr.emn.reactiveinput.Device
AUTO_PROPERTIES
 
Constructor Summary
DSpeechCommand()
          (Options regionales = Francais)
 
Method Summary
 void close()
          Add closing code here if needed.
protected  void closeSpeech()
           
 void doDisable()
          Add device disabling code here (does nothing by default).
 void doEnable()
          Add device enabling code here (does nothing by default).
 java.lang.String[] getCommands()
           
 boolean getSendUnrecognized()
           
protected  java.lang.String getUniqueGrammarName()
           
 boolean hasExternalInput()
          Specifies whether this device has external (implicit) input or not.
protected  boolean initSpeech()
           
static void main(java.lang.String[] args)
          Test
 Processor open(OpenContext context)
          Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.
protected  void processCommand(java.lang.String[] tags, long startTime)
           
static void releaseEngine(javax.speech.Engine engine)
           
 void setCommands(java.lang.String[] commands)
           
 void setSendUnrecognized(boolean val)
           
protected  void speechStarted()
           
protected  void speechStopped()
           
static void testCentral()
           
 void update()
          Updates device's output values.
protected  void updateCommandVal(int val)
           
protected  void updateGrammar()
          Update the grammar after a setCommands()
protected  void updateSpeechVal(boolean val)
           
protected  void updateVolumeVal(double val)
           
static void useEngine(javax.speech.Engine engine)
           
 
Methods inherited from class fr.emn.reactiveinput.AbstractDevice
addIn, addIn, addOut, copy, finalize, getError, getIndex, getInfo, getIns, getName, getOuts, getProperties, hasExternalOutput, init, insertAt, insertAtEnd, insertBefore, isCopiable, isEnabled, isOpenable, setEnabled, setInfo, setInfo, setLastError, setName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

signal

public Out signal

volume

public Out volume

command

public Out command

commandstring

public Out commandstring
Constructor Detail

DSpeechCommand

public DSpeechCommand()
(Options regionales = Francais)

Method Detail

useEngine

public static void useEngine(javax.speech.Engine engine)

releaseEngine

public static void releaseEngine(javax.speech.Engine engine)

main

public static void main(java.lang.String[] args)
Test


open

public Processor open(OpenContext context)
Description copied from class: AbstractDevice
Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.

By default, open() does nothing and returns the device itself as the Processor (or null if it is not openable): AbstractDevice implements both Device and Processor interfaces, so that you can add processing code directly into the device.

If you want to add specialization features, subclass this method to return a specific processor implementation depending on your device configuration.

Example :

public Processor getProcessor() { if (super.open() == null) return null; // Select the right processor if (in2.isValid()) { return new twoParamProcessor(in1, in2, out); else return new oneParamProcessor(in1, out); }

In this method, you may also perform all necessary pre-running initialization. If initialization fails, return null even if isOpenable() returns true.

In all cases, return null if isOpenable() returns false.

Specified by:
open in interface Device
Overrides:
open in class AbstractDevice
See Also:
Processor, Device.open()

close

public void close()
Description copied from class: AbstractDevice
Add closing code here if needed.

Specified by:
close in interface Device
Overrides:
close in class AbstractDevice

doEnable

public void doEnable()
Description copied from class: AbstractDevice
Add device enabling code here (does nothing by default).

Overrides:
doEnable in class AbstractDevice

doDisable

public void doDisable()
Description copied from class: AbstractDevice
Add device disabling code here (does nothing by default).

Overrides:
doDisable in class AbstractDevice

updateSpeechVal

protected void updateSpeechVal(boolean val)

updateCommandVal

protected void updateCommandVal(int val)

updateVolumeVal

protected void updateVolumeVal(double val)

getCommands

public java.lang.String[] getCommands()

setCommands

public void setCommands(java.lang.String[] commands)

update

public void update()
Description copied from class: AbstractDevice
Updates device's output values.

Subclass init() and update() methods if you want the device to process the data itself. Otherwise, subclass getProcessor() method to use extern processors.

Specified by:
update in interface Processor
Overrides:
update in class AbstractDevice
See Also:
Processor.update()

hasExternalInput

public boolean hasExternalInput()
Description copied from class: AbstractDevice
Specifies whether this device has external (implicit) input or not. Returns false by default.

Return false if the device is deterministic from the data & time points of view, i.e. if its output production only depend on the explicit input history (input slots) and device's initial configuration. This is the case of most of the processing devices.

Return true if output values not only depend on the values of input slots, or if output production takes undefined time. Examples of devices with external input are input peripherals and asynchronous devices.

This method is used by the reactive machine to determine if this device is triggered by its input slots, or if it must be triggered continuously (i.e. each tick). This method can also be used by the editor for the device's graphical representation.

Specified by:
hasExternalInput in interface Device
Overrides:
hasExternalInput in class AbstractDevice

processCommand

protected void processCommand(java.lang.String[] tags,
                              long startTime)

speechStarted

protected void speechStarted()

speechStopped

protected void speechStopped()

updateGrammar

protected void updateGrammar()
Update the grammar after a setCommands()


getUniqueGrammarName

protected java.lang.String getUniqueGrammarName()

initSpeech

protected boolean initSpeech()

closeSpeech

protected void closeSpeech()

testCentral

public static void testCentral()

setSendUnrecognized

public void setSendUnrecognized(boolean val)

getSendUnrecognized

public boolean getSendUnrecognized()