Class TPreloadingSequencer

  extended byorg.tritonus.share.midi.TMidiDevice
      extended byorg.tritonus.share.midi.TSequencer
          extended byorg.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 inherited from class org.tritonus.share.midi.TMidiDevice
TMidiDevice.Info, TMidiDevice.TReceiver, TMidiDevice.TTransmitter
Nested classes inherited from class javax.sound.midi.Sequencer
Nested classes inherited from class javax.sound.midi.MidiDevice
Field Summary
Fields inherited from interface javax.sound.midi.Sequencer
Constructor Summary
protected TPreloadingSequencer(MidiDevice.Info info, Collection masterSyncModes, Collection slaveSyncModes)
          Sets the latency to the default value.
Method Summary
 int getLatency()
          Get the preloading intervall.
protected  void openImpl()
          Subclasses have to override this method to be notified of opening.
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, checkOpen, getLoopCount, getLoopEndPoint, getLoopStartPoint, getMasterSyncMode, getMasterSyncModes, getMetaEventListeners, getMicrosecondLength, getResolution, getSequence, getSlaveSyncMode, getSlaveSyncModes, getTempoFactor, getTempoInBPM, getTempoInMPQ, getTickLength, getTrackMute, getTrackSolo, isRunning, isTrackEnabled, notifyListeners, removeControllerEventListener, removeMetaEventListener, sendControllerEvent, sendMetaMessage, setLoopCount, setLoopEndPoint, setLoopStartPoint, setMasterSyncMode, setMasterSyncModeImpl, setRealTempo, setSequence, setSequence, setSequenceImpl, setSlaveSyncMode, setSlaveSyncModeImpl, setTempoFactor, setTempoImpl, setTempoInBPM, setTempoInMPQ, setTrackEnabledImpl, setTrackMute, setTrackMuteImpl, setTrackSolo, setTrackSoloImpl, start, startImpl, stop, stopImpl
Methods inherited from class org.tritonus.share.midi.TMidiDevice
close, closeImpl, getDeviceInfo, getMaxReceivers, getMaxTransmitters, getMicrosecondPosition, getReceiver, getReceivers, getTransmitter, getTransmitters, getUseIn, getUseOut, isOpen, open, receive, sendImpl
Methods inherited from class java.lang.Object
clone, equals, finalize, 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

Constructor Detail


protected TPreloadingSequencer(MidiDevice.Info info,
                               Collection masterSyncModes,
                               Collection slaveSyncModes)
Sets the latency to the default value.

Method Detail


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.

setLatency in class TSequencer


public int getLatency()
Get the preloading intervall.

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


protected void openImpl()
Description copied from class: TMidiDevice
Subclasses have to override this method to be notified of opening.

openImpl in class TMidiDevice


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.

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