com.e1.mxdublin.core
Interface Sequencer

All Known Implementing Classes:
Seq24, Seq24Clock

public interface Sequencer

The Sequencer interface for mxdublin. Since it will take time to make a perfect scheduler in Java, the sequencer implementation will be easily changed in mxdublin. Each sequencer will have to implement this interface.

Seq24Clock is the default sequencer in mxdublin 0.6. When the first mxdublin object is instantiated, mxdublin will try to load the implementation from key name "sequencer.impl" in the mxdublin properties file.

Any calls that needs to be synchronized with the event queue can be done on the sequencer instance.


Field Summary
static int PPQ_RESOLUTION
          The internal sequencer part per quarter note resolution.
 
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.
 

Field Detail

PPQ_RESOLUTION

static final int PPQ_RESOLUTION
The internal sequencer part per quarter note resolution. mxdublin uses a PPQ resolution of 480.

See Also:
Constant Field Values
Method Detail

sched

void sched(SeqEvent event,
           int ppq)
Schedule a event into the sequencer.

Parameters:
event - the event to schedule
ppq - the time to schedule the event in ppq

purge

int purge()
Cleans the sequencer of unused event.

Returns:
the number of event that have been purged

flush

void flush()
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.


clock

void clock()
This is called when the external clock sends a 24ppq tick; E.G. a midi clock device.


tempo

void tempo(float tempo)
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


getTempo

float getTempo()
Returns the current tempo of this sequencer. This method will return -1 if this sequencer is externally clocked.

Returns:
current tempo of this sequencer.

getCurrentTime

int getCurrentTime(SeqEvent event)
Returns the current time of this event compared with an event

Parameters:
event - the time to compare with
Returns:
the current time based on this event

getCurrentTime

int getCurrentTime()
Returns the current time of this sequencer in ppq since it has been started.