hmi.elckerlyc.audioengine
Class AudioPlanPlayer

java.lang.Object
  extended by hmi.elckerlyc.audioengine.AudioPlanPlayer

public class AudioPlanPlayer
extends Object

Runs the VerbalPlan. For rapid execution of new audio, the AudioPlanPlayer always has a thread available in which the plan can be run. Use shutdown to close the VerbalPlanPlayer completely and get rid of this thread. The AudioPlanPlayer should not be reused after shutdown.

Author:
reidsma, welberge TODO: merge with VerbalPlanPlayer into a generic multithreaded plan player?

Nested Class Summary
(package private)  class AudioPlanPlayer.AudioRunner
           
 
Field Summary
private  Future<?> audioRunner
           
private  ArrayList<AudioUnit> audioUnits
           
private  boolean doStop
           
private  List<BMLExceptionListener> exceptionListeners
           
private  ExecutorService exec
           
private static org.slf4j.Logger logger
           
private  double time
           
 
Constructor Summary
AudioPlanPlayer()
           
 
Method Summary
 void addAudioUnit(AudioUnit au)
           
 void addExceptionListener(BMLExceptionListener es)
           
private  void auException(AudioUnit au, String message, double time)
          Callback for behaviors
 void clearAll(double absoluteTime)
           
 void exception(BMLExceptionFeedback e)
           
private  AudioUnit getAudioUnit(String id, String bmlId)
           
 Set<String> getBehaviours(String bmlId)
           
 double getEndTime(String behId, String bmlId)
           
 Set<String> getInvalidBehaviors()
           
 int getNumberOfAudioUnits()
           
 void interruptBehaviourBlock(String bmlId, double time)
           
 void play(double t)
           
 void removeAllExceptionListeners()
           
private  void removeAudioUnit(AudioUnit au)
           
 void removeAudioUnit(String id, String bmlId)
           
private  void removeAudioUnits(List<AudioUnit> auList)
           
 void reset()
           
 void scheduleStop()
           
 void setBMLBlockState(String bmlId, PlanUnitState state)
           
 void setParameterValue(String behId, String bmlId, String paramId, float value)
           
 void setParameterValue(String behId, String bmlId, String paramId, String value)
           
 void shutdown()
          Shutdown the AudioPlanPlayer thread
 void stop()
          Stop playing speech units
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.slf4j.Logger logger

time

private double time

audioUnits

private ArrayList<AudioUnit> audioUnits

doStop

private boolean doStop

audioRunner

private Future<?> audioRunner

exec

private final ExecutorService exec

exceptionListeners

private List<BMLExceptionListener> exceptionListeners
Constructor Detail

AudioPlanPlayer

public AudioPlanPlayer()
Method Detail

exception

public void exception(BMLExceptionFeedback e)

addExceptionListener

public void addExceptionListener(BMLExceptionListener es)

removeAllExceptionListeners

public void removeAllExceptionListeners()

auException

private void auException(AudioUnit au,
                         String message,
                         double time)
Callback for behaviors


getAudioUnit

private AudioUnit getAudioUnit(String id,
                               String bmlId)

addAudioUnit

public void addAudioUnit(AudioUnit au)

getNumberOfAudioUnits

public int getNumberOfAudioUnits()

removeAudioUnit

private void removeAudioUnit(AudioUnit au)

removeAudioUnit

public void removeAudioUnit(String id,
                            String bmlId)

play

public void play(double t)

scheduleStop

public void scheduleStop()

removeAudioUnits

private void removeAudioUnits(List<AudioUnit> auList)

shutdown

public void shutdown()
              throws InterruptedException
Shutdown the AudioPlanPlayer thread

Throws:
InterruptedException

stop

public void stop()
Stop playing speech units


reset

public void reset()

getInvalidBehaviors

public Set<String> getInvalidBehaviors()

clearAll

public void clearAll(double absoluteTime)

setBMLBlockState

public void setBMLBlockState(String bmlId,
                             PlanUnitState state)

getEndTime

public double getEndTime(String behId,
                         String bmlId)

getBehaviours

public Set<String> getBehaviours(String bmlId)

interruptBehaviourBlock

public void interruptBehaviourBlock(String bmlId,
                                    double time)

setParameterValue

public void setParameterValue(String behId,
                              String bmlId,
                              String paramId,
                              float value)

setParameterValue

public void setParameterValue(String behId,
                              String bmlId,
                              String paramId,
                              String value)