com.e1.mxdublin.core
Class Seq24

java.lang.Object
  extended by com.e1.mxdublin.core.Seq24
All Implemented Interfaces:
Sequencer
Direct Known Subclasses:
Seq24Clock

public class Seq24
extends Object
implements Sequencer

Basic sequencer for mxdublin that plays the events with a PPQ resolution of 24, just like a midi clock. This sequencer doesn't really sequence events, it simply wait for the clock to tick to play all the events within the 24 PPQ range.

While 24 PPQ can be pretty weak, but at 120 bpm it can give a resolution of 1.02 millisecond.


Field Summary
 
Fields inherited from interface com.e1.mxdublin.core.Sequencer
PPQ_RESOLUTION
 
Constructor Summary
Seq24()
           
 
Method Summary
 void clock()
          This is called when the external clock sends a 24ppq tick; E.G.
 void flush()
          Execute pending event that needs to be flush.
 int getCurrentTime()
          Returns the current time of this sequencer in ppq since it has been started.
 int getCurrentTime(SeqEvent event)
          Returns the current time of this event compared with an event
 float getTempo()
          Returns the current tempo of this sequencer.
 int purge()
          Cleans the sequencer of unused event.
 void sched(SeqEvent event, int ppq)
          Schedule a event into the sequencer.
 void tempo(float tempo)
          Set the tempo for this sequencer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Seq24

public Seq24()
Method Detail

flush

public void flush()
Description copied from interface: Sequencer
Execute pending event that needs to be flush. All event in the queue will be removed. If this event is "mandatory", it will be played.

Specified by:
flush in interface Sequencer

purge

public int purge()
Description copied from interface: Sequencer
Cleans the sequencer of unused event.

Specified by:
purge in interface Sequencer
Returns:
the number of event that have been purged

sched

public void sched(SeqEvent event,
                  int ppq)
Description copied from interface: Sequencer
Schedule a event into the sequencer.

Specified by:
sched in interface Sequencer
Parameters:
event - the event to schedule
ppq - the time to schedule the event in ppq

clock

public void clock()
Description copied from interface: Sequencer
This is called when the external clock sends a 24ppq tick; E.G. a midi clock device.

Specified by:
clock in interface Sequencer

tempo

public void tempo(float tempo)
Description copied from interface: Sequencer
Set the tempo for this sequencer. Setting a tempo to -1 will tell this sequencer to be depend on a external clock that will send a 'clock' at each 24 PPQ. If the sequencer doesn't clock it self, it can throw an exception

Specified by:
tempo in interface Sequencer

getTempo

public float getTempo()
Description copied from interface: Sequencer
Returns the current tempo of this sequencer. This method will return -1 if this sequencer is externally clocked.

Specified by:
getTempo in interface Sequencer
Returns:
current tempo of this sequencer.

getCurrentTime

public int getCurrentTime(SeqEvent event)
Description copied from interface: Sequencer
Returns the current time of this event compared with an event

Specified by:
getCurrentTime in interface Sequencer
Parameters:
event - the time to compare with
Returns:
the current time based on this event

getCurrentTime

public int getCurrentTime()
Description copied from interface: Sequencer
Returns the current time of this sequencer in ppq since it has been started.

Specified by:
getCurrentTime in interface Sequencer