hmi.elckerlyc.audioengine
Class AudioUnit

java.lang.Object
  extended by hmi.elckerlyc.planunit.AbstractPlanUnit
      extended by hmi.elckerlyc.audioengine.AudioUnit
All Implemented Interfaces:
PlanUnit
Direct Known Subclasses:
WavAudioUnit

public abstract class AudioUnit
extends AbstractPlanUnit


Field Summary
protected  double bmlStartTime
           
private  double duration
           
private  TimePeg endPeg
           
protected  String fileName
           
private static org.slf4j.Logger logger
           
private  TimePeg startPeg
           
protected  double systemStartTime
           
 
Fields inherited from class hmi.elckerlyc.planunit.AbstractPlanUnit
bmlBlockPeg
 
Constructor Summary
AudioUnit(BMLBlockPeg bbPeg, String fname, String id, String bmlId)
           
 
Method Summary
 TimePeg getEndPeg()
           
 double getEndTime()
          Get the global end time of the PlanUnit, TimePeg.VALUEUNKNOWN if not known (yet)
 double getPreferedDuration()
          0 is unknown/persistent
 TimePeg getStartPeg()
           
 double getStartTime()
          Get the global start time of the PlanUnit, TimePeg.VALUEUNKNOWN if not known (yet)
 TimePeg getTimePeg(String syncId)
          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 sendEndProgress(double time)
          Send the end progress feedback info, should be called only from the AudioPlanPlayer.
abstract  void sendProgress(double playTime, double time)
          Send progress feedback for all bookmarks passed at playTime.
protected  void sendStartProgress(double time)
           
 void setEnd(TimePeg end)
           
 void setEndPeg(TimePeg endSync)
           
abstract  void setParameterValue(String paramater, float value)
          Sets a parameter value
 void setPrefferedDuration(double duration)
           
 void setStart(TimePeg start)
           
 void setStartPeg(TimePeg startSync)
           
 void setTimePeg(String syncId, TimePeg peg)
          Assigns a TimePeg to a sync in the PlanUnit
 void setup()
          Setup the Audiounit.
protected  void setupCache()
          load file, determine timing/duration, etc
 void stop()
           
 
Methods inherited from class hmi.elckerlyc.planunit.AbstractPlanUnit
addFeedbackListener, feedback, getAvailableSyncs, getBMLBlockPeg, getBMLId, getId, getRelativeTime, getReplacementGroup, getState, getTime, isDone, isLurking, isPlaying, isSubUnit, play, playUnit, reset, resetUnit, setState, setSubUnit, start, startUnit, stop, stopUnit
 
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
setParameterValue
 

Field Detail

logger

private static org.slf4j.Logger logger

fileName

protected String fileName

duration

private double duration

systemStartTime

protected double systemStartTime

bmlStartTime

protected double bmlStartTime

startPeg

private TimePeg startPeg

endPeg

private TimePeg endPeg
Constructor Detail

AudioUnit

public AudioUnit(BMLBlockPeg bbPeg,
                 String fname,
                 String id,
                 String bmlId)
Method Detail

getStartPeg

public TimePeg getStartPeg()
Returns:
the startSync

setStartPeg

public void setStartPeg(TimePeg startSync)
Parameters:
startSync - the startSync to set

getEndPeg

public TimePeg getEndPeg()
Returns:
the endSync

setEndPeg

public void setEndPeg(TimePeg endSync)
Parameters:
endSync - the endSync to set

setStart

public void setStart(TimePeg start)

setEnd

public void setEnd(TimePeg end)

setParameterValue

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


stop

public void stop()

getStartTime

public double getStartTime()
Description copied from interface: PlanUnit
Get the global start time of the PlanUnit, TimePeg.VALUEUNKNOWN if not known (yet)


getEndTime

public double getEndTime()
Description copied from interface: PlanUnit
Get the global end time of the PlanUnit, TimePeg.VALUEUNKNOWN if not known (yet)


setTimePeg

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


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

getPreferedDuration

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

Specified by:
getPreferedDuration in interface PlanUnit
Overrides:
getPreferedDuration in class AbstractPlanUnit
Returns:
Preferred duration (in seconds) of this audio unit (call setup before calling this)

setupCache

protected void setupCache()
                   throws AudioUnitPlanningException
load file, determine timing/duration, etc

Throws:
AudioUnitPlanningException

setup

public void setup()
           throws AudioUnitPlanningException
Setup the Audiounit. Calls setupCache

Throws:
AudioUnitPlanningException

sendStartProgress

protected void sendStartProgress(double time)

sendProgress

public abstract void sendProgress(double playTime,
                                  double time)
Send progress feedback for all bookmarks passed at playTime.

Parameters:
playTime - time since start of the audio unit
time - time since start of BML execution

sendEndProgress

public void sendEndProgress(double time)
Send the end progress feedback info, should be called only from the AudioPlanPlayer.

Parameters:
time - time since start of BML execution

setPrefferedDuration

public void setPrefferedDuration(double duration)

getTimePeg

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