com.confusionists.mjdjApi.util
Class MidiTimerTask
java.lang.Object
java.util.TimerTask
com.confusionists.mjdjApi.util.MidiTimerTask
- All Implemented Interfaces:
- java.lang.Runnable
- Direct Known Subclasses:
- MidiTimerTaskSendToMorphs
public class MidiTimerTask
- extends java.util.TimerTask
| Methods inherited from class java.util.TimerTask |
cancel, scheduledExecutionTime |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MidiTimerTask
public MidiTimerTask()
init
public void init(MjdjService service,
MessageWrapper payload,
Morph morph)
- Parameters:
service - an MjdjService instance (from the Mjdj system)payload - The MessageWrapper to be sent when the task is run.morph - This may be useful if a MidiTimerTask needs to access the
Morph instance.
init
public void init(MjdjService service,
MessageWrapper payload,
Morph morph,
java.util.List<java.lang.String> deviceNames)
- Parameters:
service - payload - morph - deviceNames - The device names for which the message is destined, as a List
of Strings.
runOnBeatBefore
public void runOnBeatBefore()
- Override this to set up future runs. It's too late to do it in the run
method. This is the beat XX ms before the midi message is sent.
run
public void run()
- this method delivers the payload at the proportion of the beat after the
beat as it was scheduled with the MjdjService instance. Subclasses may override this to do fancier
and/or other functionality.
- Specified by:
run in interface java.lang.Runnable- Specified by:
run in class java.util.TimerTask
getPayload
public MessageWrapper getPayload()
- Standard getter
- Returns:
- the MessageWrapper instance.
getPayloadAsShortMessageWrapper
public ShortMessageWrapper getPayloadAsShortMessageWrapper()
- Returns:
- Whatever
MessageWrapper.getAsShortMessageWrapper() returns.
setPayload
public void setPayload(MessageWrapper payload)
setMorph
public void setMorph(Morph morph)
getMorph
public Morph getMorph()
setAfterBeat
public void setAfterBeat(float afterBeat)
- Parameters:
afterBeat - - proportion of a beat after which this task fires
getAfterBeat
public float getAfterBeat()
- Returns:
- the afterBeat returns the proportion of a beat after which this task fires. Useful for rescheduling the next one.