org.commonreality.sensors.speech
Class DefaultSpeechSensor

java.lang.Object
  extended by org.commonreality.participant.impl.AbstractParticipant
      extended by org.commonreality.sensors.AbstractSensor
          extended by org.commonreality.sensors.speech.DefaultSpeechSensor
All Implemented Interfaces:
java.io.Serializable, IIdentifiable, IParticipant, ISensor, ISpeaker

public class DefaultSpeechSensor
extends AbstractSensor
implements ISpeaker

Default speech generation sensor. For all connected agents, it creates an IEfferentObject that corresponds to the agent's mouth. That IEfferentObject contains at least one IEfferentCommandTemplate that is a VocalizationCommandTemplate which can be used to instantiate a specific IEfferentCommand, that is a VocalizationCommand. This sensor will process all such commands, execute them, and place an IRealObject into the simulation which will likely be picked up by an aural sensor to make the percept available.

Author:
harrison
See Also:
Serialized Form

Field Summary
static java.lang.String VOCALIZATION_DURATION_EQUATION
           
 
Constructor Summary
DefaultSpeechSensor()
           
 
Method Summary
 void configure(java.util.Map<java.lang.String,java.lang.String> options)
          we can accept only a very basic configuration option.
 java.lang.String getName()
          default name for the speech sensor
 void initialize()
          let's initialize.
 void resume()
           
 void shutdown()
           
 void speak(IAgentObject speaker, VocalizationCommand vocalCommand)
          actually speak by creating a new aural event, and posting it.
 void start()
          Start it up by queueing the Runnable _cycle on the Executor
 
Methods inherited from class org.commonreality.sensors.AbstractSensor
connect, disconnect, getAddressingInformation, getAfferentObjectManager, getCredentials, getEfferentObjectManager, getInterfacedAgents, getRealObjectManager, setCredentials, setIdentifier
 
Methods inherited from class org.commonreality.participant.impl.AbstractParticipant
addClientService, addServerService, getAgentObjectManager, getClock, getEfferentCommandManager, getIdentifier, getSensorObjectManager, isConnected, isInitialized, isStarted, isSuspended, reset, send, stop, suspend, waitForConnection, waitForInitialization, waitForResumption, waitForStart, waitForStop, waitForSuspension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.commonreality.participant.IParticipant
getAgentObjectManager, getClock, getEfferentCommandManager, getSensorObjectManager, isConnected, isInitialized, isStarted, isSuspended, reset, send, stop, suspend, waitForConnection, waitForResumption, waitForStart, waitForStop, waitForSuspension
 
Methods inherited from interface org.commonreality.identifier.IIdentifiable
getIdentifier
 

Field Detail

VOCALIZATION_DURATION_EQUATION

public static final java.lang.String VOCALIZATION_DURATION_EQUATION
See Also:
Constant Field Values
Constructor Detail

DefaultSpeechSensor

public DefaultSpeechSensor()
Method Detail

getName

public java.lang.String getName()
default name for the speech sensor

Specified by:
getName in class AbstractParticipant

configure

public void configure(java.util.Map<java.lang.String,java.lang.String> options)
               throws java.lang.Exception
we can accept only a very basic configuration option. The "DurationEquation" computes how long it will take to speak a string. If none is provided, a default instance is created that looks for a parameter CharactersPerSecond which will be used to compue duration times

Specified by:
configure in interface IParticipant
Overrides:
configure in class AbstractParticipant
Throws:
java.lang.Exception

initialize

public void initialize()
                throws java.lang.Exception
let's initialize. this is called before start but after configure. here we create the executor that handles the asynchronous aspects (runs the Runnable _cycle). We also create the default EfferentCommandHandler here.

Specified by:
initialize in interface IParticipant
Overrides:
initialize in class AbstractParticipant
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Start it up by queueing the Runnable _cycle on the Executor

Specified by:
start in interface IParticipant
Overrides:
start in class AbstractParticipant
Throws:
java.lang.Exception
See Also:
AbstractParticipant.start()

shutdown

public void shutdown()
              throws java.lang.Exception
Specified by:
shutdown in interface IParticipant
Overrides:
shutdown in class AbstractParticipant
Throws:
java.lang.Exception

resume

public void resume()
            throws java.lang.Exception
Specified by:
resume in interface IParticipant
Overrides:
resume in class AbstractParticipant
Throws:
java.lang.Exception

speak

public void speak(IAgentObject speaker,
                  VocalizationCommand vocalCommand)
actually speak by creating a new aural event, and posting it. The aural sensor (if installed) will catch the event and create the appropriate IAfferentObject for the connecte agents

Specified by:
speak in interface ISpeaker
Parameters:
vocalCommand -