org.tritonus.share.midi
Class TPreloadingSequencer

java.lang.Object
  extended by org.tritonus.share.midi.TMidiDevice
      extended by org.tritonus.share.midi.TSequencer
          extended by org.tritonus.share.midi.TPreloadingSequencer
All Implemented Interfaces:
MidiDevice, Sequencer

public abstract class TPreloadingSequencer
extends TSequencer

Base class for sequencers that work with an internal queue. To be more precise, this is the base class for sequencers that do not load the complete Sequence to internal data structures before start, but take single events from the Sequence and put them to the sequencing queue while running.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.tritonus.share.midi.TMidiDevice
TMidiDevice.Info, TMidiDevice.TReceiver, TMidiDevice.TTransmitter
 
Nested classes/interfaces inherited from interface javax.sound.midi.Sequencer
Sequencer.SyncMode
 
Nested classes/interfaces inherited from interface javax.sound.midi.MidiDevice
MidiDevice.Info
 
Field Summary
 
Fields inherited from interface javax.sound.midi.Sequencer
LOOP_CONTINUOUSLY
 
Method Summary
 int getLatency()
          Get the preloading intervall.
abstract  void sendMessageTick(MidiMessage message, long lTick)
          Put a message into the queue.
 void setLatency(int nLatency)
          Sets the preloading intervall.
 
Methods inherited from class org.tritonus.share.midi.TSequencer
addControllerEventListener, addMetaEventListener, getLoopCount, getLoopEndPoint, getLoopStartPoint, getMasterSyncMode, getMasterSyncModes, getMicrosecondLength, getSequence, getSlaveSyncMode, getSlaveSyncModes, getTempoFactor, getTempoInBPM, getTempoInMPQ, getTickLength, getTrackMute, getTrackSolo, isRunning, removeControllerEventListener, removeMetaEventListener, setLoopCount, setLoopEndPoint, setLoopStartPoint, setMasterSyncMode, setSequence, setSequence, setSlaveSyncMode, setTempoFactor, setTempoInBPM, setTempoInMPQ, setTrackMute, setTrackSolo, start, stop
 
Methods inherited from class org.tritonus.share.midi.TMidiDevice
close, getDeviceInfo, getMaxReceivers, getMaxTransmitters, getMicrosecondPosition, getReceiver, getReceivers, getTransmitter, getTransmitters, isOpen, open
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.sound.midi.Sequencer
getMicrosecondPosition, getTickPosition, isRecording, recordDisable, recordEnable, setMicrosecondPosition, setTickPosition, startRecording, stopRecording
 
Methods inherited from interface javax.sound.midi.MidiDevice
close, getDeviceInfo, getMaxReceivers, getMaxTransmitters, getReceiver, getReceivers, getTransmitter, getTransmitters, isOpen, open
 

Method Detail

setLatency

public void setLatency(int nLatency)
Sets the preloading intervall. This is the time span between preloading events to an internal queue and playing them. This intervall should be kept constant by the implementation. However, this cannot be guaranteed.

Overrides:
setLatency in class TSequencer

getLatency

public int getLatency()
Get the preloading intervall.

Overrides:
getLatency in class TSequencer
Returns:
the preloading intervall in milliseconds, or -1 if the sequencer doesn't repond to changes in the Sequence at all.

sendMessageTick

public abstract void sendMessageTick(MidiMessage message,
                                     long lTick)
Put a message into the queue. This is Claus-Dieter's special method: it puts the message to the ALSA queue for delivery at the specified time. The time has to be given in ticks according to the resolution of the currently active Sequence. For this method to work, the Sequencer has to be started. The message is delivered the same way as messages from a Sequence, i.e. to all registered Transmitters. If the current queue position (as returned by getTickPosition()) is already behind the desired schedule time, the message is ignored.

Parameters:
message - the MidiMessage to put into the queue.
lTick - the desired schedule time in ticks.