hmi.elckerlyc.speechengine
Class TTSPlanner

java.lang.Object
  extended by hmi.elckerlyc.AbstractPlanner
      extended by hmi.elckerlyc.speechengine.TTSPlanner
All Implemented Interfaces:
Planner, SpeechPlanner

public class TTSPlanner
extends AbstractPlanner
implements SpeechPlanner


Field Summary
private  AnimationPlanner animationPlanner
           
private  FacePlanner facePlanner
          needed to send visimes for speech!
private static org.slf4j.Logger logger
           
private  VerbalPlayer player
           
private  TTSUnitFactory suFactory
           
private static double TIMEPEG_TOLERANCE
           
private  TTSBinding ttsBinding
           
 
Constructor Summary
TTSPlanner(TTSUnitFactory suf, VerbalPlayer p, TTSBinding ttsGen)
           
TTSPlanner(TTSUnitFactory suf, VerbalPlayer p, TTSBinding ttsBin, FacePlanner fp, AnimationPlanner ap)
           
 
Method Summary
 List<SyncAndTimePeg> addBehaviour(BMLBlockPeg bbPeg, Behaviour b, List<TimePegAndConstraint> sacs, PlanUnit planElement)
          Creates a SpeechUnit that satisfies sacs and adds it to the motion plan.
 void addExceptionListener(BMLExceptionListener war)
           
private  void addFaceUnits(BMLBlockPeg bbPeg, Behaviour beh, TTSUnit bs)
           
private  void addJawMovement(BMLBlockPeg bbPeg, Behaviour beh, TTSUnit bs)
           
 void clearAll(double time)
          Removes all behaviors from the plan
private  TTSUnit createSpeechUnit(BMLBlockPeg bbPeg, Behaviour b)
           
 Set<String> getInvalidBehaviours()
          Checks if the behavior plan is still consistent (e.g. after modifying the timing of some TimePegs).
 Player getPlayer()
          Returns the Player for this planner. useful for, e.g., resetting the player of any planner (see BMLRealizer.reset).
 List<Class<? extends Behaviour>> getSupportedBehaviours()
           
 List<Class<? extends Behaviour>> getSupportedDescriptionExtensions()
           
 String getType()
           
 VerbalPlayer getVerbalPlayer()
          Addition on getPlayer to save on class casting
 String[] getVoices()
           
 void interruptBehaviour(String behaviourId, String BMLId, double globalTime)
          Interrupts the behavior, sending the appropiate feedback callbacks if the behavior was running, just removes it otherwise.
private  void linkBookmarks(TTSUnit su, List<TimePegAndConstraint> sacs, double startTime, Behaviour b)
           
 void removeAllExceptionListeners()
           
 void removeBehaviour(String behaviourId, String BMLId)
          Removes behavior with behaviourId and bmlId from the plan Callback behavior is unspecified
 void reset()
          Resets the player, that is: stops running behavior and returns the player to its startup state (default pose etc) This does not clear any behaviours from the plans.
 PlanUnit resolveSynchs(BMLBlockPeg bbPeg, Behaviour b, List<TimePegAndConstraint> sacs)
          Resolves TimePegs for behavior b, given some known time pegs and constraints
 void setParameterValue(String behId, String bmlId, String paramId, float value)
           
 void setParameterValue(String behId, String bmlId, String paramId, String value)
           
 void setSpeaker(String speaker)
           
 void shutdown()
          Clean up resources constructed with the planner (e.g. for native stuff, spawned threads, ...).
 
Methods inherited from class hmi.elckerlyc.AbstractPlanner
addFeedbackListener, getBehaviours, getEndTime, getFeedbackListeners, interruptBehaviourBlock, removeAllFeedbackListeners, removeFeedbackListener, setBMLBlockState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hmi.elckerlyc.Planner
addFeedbackListener, getBehaviours, getEndTime, getFeedbackListeners, interruptBehaviourBlock, removeAllFeedbackListeners, removeFeedbackListener, setBMLBlockState
 

Field Detail

logger

private static org.slf4j.Logger logger

player

private VerbalPlayer player

ttsBinding

private final TTSBinding ttsBinding

suFactory

private final TTSUnitFactory suFactory

TIMEPEG_TOLERANCE

private static final double TIMEPEG_TOLERANCE
See Also:
Constant Field Values

facePlanner

private FacePlanner facePlanner
needed to send visimes for speech!


animationPlanner

private AnimationPlanner animationPlanner
Constructor Detail

TTSPlanner

public TTSPlanner(TTSUnitFactory suf,
                  VerbalPlayer p,
                  TTSBinding ttsGen)

TTSPlanner

public TTSPlanner(TTSUnitFactory suf,
                  VerbalPlayer p,
                  TTSBinding ttsBin,
                  FacePlanner fp,
                  AnimationPlanner ap)
Method Detail

getType

public String getType()
Specified by:
getType in interface SpeechPlanner

shutdown

public void shutdown()
Description copied from interface: Planner
Clean up resources constructed with the planner (e.g. for native stuff, spawned threads, ...). A planner should not be (re)used after shutting it down.

Specified by:
shutdown in interface Planner
Overrides:
shutdown in class AbstractPlanner

setSpeaker

public void setSpeaker(String speaker)

getVoices

public String[] getVoices()

createSpeechUnit

private TTSUnit createSpeechUnit(BMLBlockPeg bbPeg,
                                 Behaviour b)
                          throws SpeechUnitPlanningException
Throws:
SpeechUnitPlanningException

addBehaviour

public List<SyncAndTimePeg> addBehaviour(BMLBlockPeg bbPeg,
                                         Behaviour b,
                                         List<TimePegAndConstraint> sacs,
                                         PlanUnit planElement)
                                  throws BehaviourPlanningException
Creates a SpeechUnit that satisfies sacs and adds it to the motion plan. All registered BMLFeedbackListeners are linked to this SpeechUnit.

Specified by:
addBehaviour in interface Planner
planElement - planElement obtained from resolveSynchs, null to create a new planElement
Returns:
a list of all syncs of the behavior and their linked TimePegs
Throws:
BehaviourPlanningException - if no behavior satisfying sac can be constructed

addJawMovement

private void addJawMovement(BMLBlockPeg bbPeg,
                            Behaviour beh,
                            TTSUnit bs)

addFaceUnits

private void addFaceUnits(BMLBlockPeg bbPeg,
                          Behaviour beh,
                          TTSUnit bs)

resolveSynchs

public PlanUnit resolveSynchs(BMLBlockPeg bbPeg,
                              Behaviour b,
                              List<TimePegAndConstraint> sacs)
                       throws BehaviourPlanningException
Description copied from interface: Planner
Resolves TimePegs for behavior b, given some known time pegs and constraints

Specified by:
resolveSynchs in interface Planner
b - the behavior
sacs - the provided time pegs and constraints, missing constraints are filled out by this method
Returns:
the object to be placed in the plan (a TimedMotionUnit, SpeechUnit, ...)
Throws:
BehaviourPlanningException - if no behavior satisfying sac can be constructed

getInvalidBehaviours

public Set<String> getInvalidBehaviours()
Description copied from interface: Planner
Checks if the behavior plan is still consistent (e.g. after modifying the timing of some TimePegs). Returns id's of behaviors with invalid timing

Specified by:
getInvalidBehaviours in interface Planner

clearAll

public void clearAll(double time)
Description copied from interface: Planner
Removes all behaviors from the plan

Specified by:
clearAll in interface Planner

linkBookmarks

private void linkBookmarks(TTSUnit su,
                           List<TimePegAndConstraint> sacs,
                           double startTime,
                           Behaviour b)
                    throws BehaviourPlanningException
Throws:
BehaviourPlanningException

removeBehaviour

public void removeBehaviour(String behaviourId,
                            String BMLId)
Description copied from interface: Planner
Removes behavior with behaviourId and bmlId from the plan Callback behavior is unspecified

Specified by:
removeBehaviour in interface Planner

interruptBehaviour

public void interruptBehaviour(String behaviourId,
                               String BMLId,
                               double globalTime)
Description copied from interface: Planner
Interrupts the behavior, sending the appropiate feedback callbacks if the behavior was running, just removes it otherwise.

Specified by:
interruptBehaviour in interface Planner

getVerbalPlayer

public VerbalPlayer getVerbalPlayer()
Addition on getPlayer to save on class casting

Specified by:
getVerbalPlayer in interface SpeechPlanner
Returns:
the player

getPlayer

public Player getPlayer()
Description copied from interface: Planner
Returns the Player for this planner. useful for, e.g., resetting the player of any planner (see BMLRealizer.reset).

Specified by:
getPlayer in interface Planner

addExceptionListener

public void addExceptionListener(BMLExceptionListener war)
Specified by:
addExceptionListener in interface Planner

removeAllExceptionListeners

public void removeAllExceptionListeners()
Specified by:
removeAllExceptionListeners in interface Planner

getSupportedBehaviours

public List<Class<? extends Behaviour>> getSupportedBehaviours()
Specified by:
getSupportedBehaviours in interface Planner

getSupportedDescriptionExtensions

public List<Class<? extends Behaviour>> getSupportedDescriptionExtensions()
Specified by:
getSupportedDescriptionExtensions in interface Planner

reset

public void reset()
Description copied from interface: Planner
Resets the player, that is: stops running behavior and returns the player to its startup state (default pose etc) This does not clear any behaviours from the plans.

Specified by:
reset in interface Planner

setParameterValue

public void setParameterValue(String behId,
                              String bmlId,
                              String paramId,
                              float value)
Specified by:
setParameterValue in interface Planner

setParameterValue

public void setParameterValue(String behId,
                              String bmlId,
                              String paramId,
                              String value)
Specified by:
setParameterValue in interface Planner