hmi.elckerlyc.speechengine
Class TextSpeechUnit

java.lang.Object
  extended by hmi.elckerlyc.planunit.AbstractPlanUnit
      extended by hmi.elckerlyc.speechengine.AbstractSpeechUnit
          extended by hmi.elckerlyc.speechengine.TextSpeechUnit
All Implemented Interfaces:
PlanUnit, SpeechUnit

public class TextSpeechUnit
extends AbstractSpeechUnit


Field Summary
private  org.slf4j.Logger logger
           
private  TextOutput output
           
private  Map<String,TimePeg> pegs
           
private  ArrayList<String> progressHandled
           
private static double SPEECH_RATE
           
private  Map<String,Integer> syncMap
           
private  ArrayList<String> syncs
           
private  String[] words
           
 
Fields inherited from class hmi.elckerlyc.speechengine.AbstractSpeechUnit
bmlStartTime, speechText
 
Fields inherited from class hmi.elckerlyc.planunit.AbstractPlanUnit
bmlBlockPeg
 
Constructor Summary
TextSpeechUnit(BMLBlockPeg bbPeg, String text, String id, String bmlId, TextOutput output)
           
 
Method Summary
 List<String> getAvailableSyncs()
          Get the list of sync ids that can be used in this behavior.
 double getPreferedDuration()
          0 is unknown/persistent
 double getRelativeTime(double time)
           
 double getRelativeTime(String sync)
          Assumes that sync is a valid synchronization point (could also be start/end)
 List<String> getSyncs()
           
 double getTime(String s)
          Get the global time of sync syncId of the PlanUnit, TimePeg.VALUEUNKNOWN if not known (yet)
 TimePeg getTimePeg(String s)
          null is not set
 boolean hasValidTiming()
          Checks if the timing of this plan unit is 'valid' (e.g. stuff like start is earlier than end, but also planunit specific stuff like biomechanically possible timing).
 void playUnit(double time)
           
 void resetUnit()
           
 void sendEndProgress(double time)
          Send the end progress feedback info, should be called only from the VerbalPlanPlayer.
 void sendProgress(double playTime, double time)
           
protected  void sendStartProgress(double time)
           
 void setParameterValue(String paramater, float value)
          Sets a parameter value
 void setParameterValue(String paramId, String value)
          Sets a parameter value
 void setTimePeg(String sync, TimePeg sp)
          Assigns a TimePeg to a sync in the PlanUnit
protected  void startUnit(double time)
          Starts the PlanUnit, is only called once at start
 void stopUnit(double time)
           
 
Methods inherited from class hmi.elckerlyc.speechengine.AbstractSpeechUnit
getEndPeg, getEndTime, getStartPeg, getStartTime, setEnd, setStart
 
Methods inherited from class hmi.elckerlyc.planunit.AbstractPlanUnit
addFeedbackListener, feedback, getBMLBlockPeg, getBMLId, getId, getReplacementGroup, getState, isDone, isLurking, isPlaying, isSubUnit, play, reset, setState, setSubUnit, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hmi.elckerlyc.planunit.PlanUnit
addFeedbackListener, feedback, getBMLBlockPeg, getBMLId, getId, getReplacementGroup, getState, isDone, isLurking, isPlaying, isSubUnit, play, reset, setState, start, stop
 

Field Detail

words

private final String[] words

output

private TextOutput output

syncMap

private final Map<String,Integer> syncMap

pegs

private Map<String,TimePeg> pegs

SPEECH_RATE

private static final double SPEECH_RATE
See Also:
Constant Field Values

progressHandled

private ArrayList<String> progressHandled

syncs

private ArrayList<String> syncs

logger

private org.slf4j.Logger logger
Constructor Detail

TextSpeechUnit

public TextSpeechUnit(BMLBlockPeg bbPeg,
                      String text,
                      String id,
                      String bmlId,
                      TextOutput output)
Method Detail

getSyncs

public List<String> getSyncs()
Returns:
the syncs

getTimePeg

public TimePeg getTimePeg(String s)
Description copied from interface: PlanUnit
null is not set


getAvailableSyncs

public List<String> getAvailableSyncs()
Description copied from interface: PlanUnit
Get the list of sync ids that can be used in this behavior. The list is ordered in relative time and maintains the BML order for BML syncIds. All BML syncs should be present in this list.

Specified by:
getAvailableSyncs in interface PlanUnit
Overrides:
getAvailableSyncs in class AbstractPlanUnit

getTime

public double getTime(String s)
Description copied from interface: PlanUnit
Get the global time of sync syncId of the PlanUnit, TimePeg.VALUEUNKNOWN if not known (yet)

Specified by:
getTime in interface PlanUnit
Overrides:
getTime in class AbstractPlanUnit

setTimePeg

public void setTimePeg(String sync,
                       TimePeg sp)
Description copied from interface: PlanUnit
Assigns a TimePeg to a sync in the PlanUnit


getPreferedDuration

public double getPreferedDuration()
Description copied from interface: PlanUnit
0 is unknown/persistent

Specified by:
getPreferedDuration in interface PlanUnit
Overrides:
getPreferedDuration in class AbstractPlanUnit

hasValidTiming

public boolean hasValidTiming()
Description copied from interface: PlanUnit
Checks if the timing of this plan unit is 'valid' (e.g. stuff like start is earlier than end, but also planunit specific stuff like biomechanically possible timing).

Returns:
true if valid

resetUnit

public void resetUnit()
Overrides:
resetUnit in class AbstractPlanUnit

setParameterValue

public void setParameterValue(String paramater,
                              float value)
Description copied from interface: PlanUnit
Sets a parameter value


setParameterValue

public void setParameterValue(String paramId,
                              String value)
Description copied from interface: PlanUnit
Sets a parameter value


stopUnit

public void stopUnit(double time)
Specified by:
stopUnit in class AbstractPlanUnit

getRelativeTime

public double getRelativeTime(double time)

getRelativeTime

public double getRelativeTime(String sync)
Assumes that sync is a valid synchronization point (could also be start/end)

Specified by:
getRelativeTime in interface PlanUnit
Overrides:
getRelativeTime in class AbstractPlanUnit
Returns:
relative time in range [0..1]

playUnit

public void playUnit(double time)
Specified by:
playUnit in class AbstractPlanUnit

sendProgress

public void sendProgress(double playTime,
                         double time)

sendStartProgress

protected void sendStartProgress(double time)
Overrides:
sendStartProgress in class AbstractSpeechUnit

sendEndProgress

public void sendEndProgress(double time)
Description copied from class: AbstractSpeechUnit
Send the end progress feedback info, should be called only from the VerbalPlanPlayer.

Specified by:
sendEndProgress in interface SpeechUnit
Overrides:
sendEndProgress in class AbstractSpeechUnit
Parameters:
time - time since start of BML execution

startUnit

protected void startUnit(double time)
                  throws PlayException
Description copied from class: AbstractPlanUnit
Starts the PlanUnit, is only called once at start

Overrides:
startUnit in class AbstractPlanUnit
Parameters:
time - global start time
Throws:
PlayException