APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.media.sound

pack-priv final Class RealTimeSequencer

extends AbstractMidiDevice
implements Sequencer, AutoConnectSequencer
Class Inheritance
All Implemented Interfaces
com.sun.media.sound.AutoConnectSequencer, javax.sound.midi.Sequencer, javax.sound.midi.MidiDevice, java.lang.AutoCloseable
Imports
java.io.IOException, .InputStream, java.util.ArrayList, .List, .Map, .WeakHashMap, javax.sound.midi.ControllerEventListener, .InvalidMidiDataException, .MetaEventListener, .MetaMessage, .MidiDevice, .MidiEvent, .MidiMessage, .MidiSystem, .MidiUnavailableException, .Receiver, .Sequence, .Sequencer, .ShortMessage, .Synthesizer, .Track, .Transmitter

A Real Time Sequencer
Author
Florian Bomers

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private class
RealTimeSequencer.DataPump

class that does the actual dispatching of events, used to be in native in MMAPI.

pack-priv class
private static class
pack-priv static class
pack-priv class
private class
RealTimeSequencer.SequencerTransmitter

An own class to distinguish the class name from the transmitter of other devices.

Field Summary

Modifier and TypeField and Description
private boolean
autoConnect

automatic connection support.

pack-priv Receiver
autoConnectedReceiver

the receiver that this device is auto-connected to.

private float
cacheTempoFactor

cache value for tempo factor until sequence is set -1 means not set.

private double
cacheTempoMPQ

Same for setTempoInMPQ...

private final ArrayList<RealTimeSequencer.ControllerListElement>
controllerEventListeners

Control change listeners.

private static final Map<ThreadGroup, EventDispatcher>
dispatchers

Event Dispatcher thread.

private boolean
doAutoConnectAtNextOpen

if we need to autoconnect at next open.

pack-priv static final MidiDevice.Info
info

Hides com.sun.media.sound.AbstractMidiDevice.info.

All RealTimeSequencers share this info object.
private int
private long
private long
private static final Sequencer.SyncMode
private static final Sequencer.SyncMode[]
private final ArrayList<Object>
metaEventListeners

Meta event listeners.

private RealTimeSequencer.PlayThread
playThread

the thread for pushing out the MIDI messages.

private volatile boolean
recording

True if we are recording.

private final List<RealTimeSequencer.RecordingTrack>
recordingTracks

List of tracks to which we're recording.

private volatile boolean
running

True if the sequence is running.

private Sequence
sequence

Sequence on which this sequencer is operating.

private static final Sequencer.SyncMode
private static final Sequencer.SyncMode[]
private final MidiUtils.TempoCache
tempoCache

tempo cache for getMicrosecondPosition

private boolean[]
trackMuted

if a particular track is muted

private boolean[]
trackSolo

if a particular track is solo

Inherited from com.sun.media.sound.AbstractMidiDevice:
id

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int[]
addControllerEventListener(ControllerEventListener listener, int[] controllers)

Implements javax.sound.midi.Sequencer.addControllerEventListener.

Registers a controller event listener to receive notification whenever the sequencer processes a control-change event of the requested type or types.

public boolean
addMetaEventListener(MetaEventListener listener)

Implements javax.sound.midi.Sequencer.addMetaEventListener.

Registers a meta-event listener to receive notification whenever a meta-event is encountered in the sequence and processed by the sequencer.

protected Receiver
protected Transmitter
private void
private static boolean[]
ensureBoolArraySize(boolean[] array, int desiredSize)

private boolean
private RealTimeSequencer.DataPump
getDataPump()

return the data pump instance, owned by play thread if playthread is null, return null.

private static EventDispatcher
public int
getLoopCount()

Implements javax.sound.midi.Sequencer.getLoopCount.

Obtains the number of repetitions for playback.

public long
getLoopEndPoint()

Implements javax.sound.midi.Sequencer.getLoopEndPoint.

Obtains the end position of the loop, in MIDI ticks.

public long
getLoopStartPoint()

Implements javax.sound.midi.Sequencer.getLoopStartPoint.

Obtains the start position of the loop, in MIDI ticks.

public Sequencer.SyncMode
getMasterSyncMode()

Implements javax.sound.midi.Sequencer.getMasterSyncMode.

Obtains the current master synchronization mode for this sequencer.

public Sequencer.SyncMode[]
getMasterSyncModes()

Implements javax.sound.midi.Sequencer.getMasterSyncModes.

Obtains the set of master synchronization modes supported by this sequencer.

public long
getMicrosecondLength()

Implements javax.sound.midi.Sequencer.getMicrosecondLength.

Obtains the length of the current sequence, expressed in microseconds, or 0 if no sequence is set.

public long
public Sequence
getSequence()

Implements javax.sound.midi.Sequencer.getSequence.

Obtains the sequence on which the Sequencer is currently operating.

public Sequencer.SyncMode
getSlaveSyncMode()

Implements javax.sound.midi.Sequencer.getSlaveSyncMode.

Obtains the current slave synchronization mode for this sequencer.

public Sequencer.SyncMode[]
getSlaveSyncModes()

Implements javax.sound.midi.Sequencer.getSlaveSyncModes.

Obtains the set of slave synchronization modes supported by the sequencer.

private MidiUtils.TempoCache
public float
getTempoFactor()

Implements javax.sound.midi.Sequencer.getTempoFactor.

Returns the current tempo factor for the sequencer.

public float
getTempoInBPM()

Implements javax.sound.midi.Sequencer.getTempoInBPM.

Obtains the current tempo, expressed in beats per minute.

public float
getTempoInMPQ()

Implements javax.sound.midi.Sequencer.getTempoInMPQ.

Obtains the current tempo, expressed in microseconds per quarter note.

public long
getTickLength()

Implements javax.sound.midi.Sequencer.getTickLength.

Obtains the length of the current sequence, expressed in MIDI ticks, or 0 if no sequence is set.

public synchronized long
getTickPosition()

Implements javax.sound.midi.Sequencer.getTickPosition.

Obtains the current position in the sequence, expressed in MIDI ticks.

pack-priv int
public synchronized boolean
getTrackMute(int track)

Implements javax.sound.midi.Sequencer.getTrackMute.

Obtains the current mute state for a track.

public synchronized boolean
getTrackSolo(int track)

Implements javax.sound.midi.Sequencer.getTrackSolo.

Obtains the current solo state for a track.

protected boolean
hasReceivers()

Overrides com.sun.media.sound.AbstractMidiDevice.hasReceivers.

Returns if this device supports Receivers.

protected boolean
hasTransmitters()

Overrides com.sun.media.sound.AbstractMidiDevice.hasTransmitters.

Returns if this device supports Transmitters.

protected synchronized void
protected void
pack-priv void
pack-priv void
public boolean
isRecording()

Implements javax.sound.midi.Sequencer.isRecording.

Indicates whether the Sequencer is currently recording.

public boolean
isRunning()

Implements javax.sound.midi.Sequencer.isRunning.

Indicates whether the Sequencer is currently running.

private boolean
private synchronized void
public void
recordDisable(Track track)

Implements javax.sound.midi.Sequencer.recordDisable.

Disables recording to the specified track.

public void
recordEnable(Track track, int channel)

Implements javax.sound.midi.Sequencer.recordEnable.

Prepares the specified track for recording events received on a particular channel.

public int[]
removeControllerEventListener(ControllerEventListener listener, int[] controllers)

Implements javax.sound.midi.Sequencer.removeControllerEventListener.

Removes a controller event listener's interest in one or more types of controller event.

public void
removeMetaEventListener(MetaEventListener listener)

Implements javax.sound.midi.Sequencer.removeMetaEventListener.

Removes the specified meta-event listener from this sequencer's list of registered listeners, if in fact the listener is registered.

pack-priv void
sendControllerEvents(MidiMessage message)

Send midi player events.

pack-priv void
sendMetaEvents(MidiMessage message)

Send midi player events.

public void
setAutoConnect(Receiver autoConnectedReceiver)

Implements com.sun.media.sound.AutoConnectSequencer.setAutoConnect.

Set the receiver that this device is auto-connected.

private synchronized void
setCaches()

populate the caches with the current values.

public void
setLoopCount(int count)

Implements javax.sound.midi.Sequencer.setLoopCount.

Sets the number of repetitions of the loop for playback.

public void
setLoopEndPoint(long tick)

Implements javax.sound.midi.Sequencer.setLoopEndPoint.

Sets the last MIDI tick that will be played in the loop.

public void
setLoopStartPoint(long tick)

Implements javax.sound.midi.Sequencer.setLoopStartPoint.

Sets the first MIDI tick that will be played in the loop.

public void
setMasterSyncMode(Sequencer.SyncMode sync)

Implements javax.sound.midi.Sequencer.setMasterSyncMode.

Sets the source of timing information used by this sequencer.

public void
setMicrosecondPosition(long microseconds)

Implements javax.sound.midi.Sequencer.setMicrosecondPosition.

Sets the current position in the sequence, expressed in microseconds.

public synchronized void
setSequence(Sequence sequence)

Implements javax.sound.midi.Sequencer.setSequence.

Sets the current sequence on which the sequencer operates.

public synchronized void
setSequence(InputStream stream)

Implements javax.sound.midi.Sequencer.setSequence.

Sets the current sequence on which the sequencer operates.

public void
setSlaveSyncMode(Sequencer.SyncMode sync)

Implements javax.sound.midi.Sequencer.setSlaveSyncMode.

Sets the slave synchronization mode for the sequencer.

public void
setTempoFactor(float factor)

Implements javax.sound.midi.Sequencer.setTempoFactor.

Scales the sequencer's actual playback tempo by the factor provided.

public void
setTempoInBPM(float bpm)

Implements javax.sound.midi.Sequencer.setTempoInBPM.

Sets the tempo in beats per minute.

public void
setTempoInMPQ(float mpq)

Implements javax.sound.midi.Sequencer.setTempoInMPQ.

Sets the tempo in microseconds per quarter note.

public synchronized void
setTickPosition(long tick)

Implements javax.sound.midi.Sequencer.setTickPosition.

Sets the current sequencer position in MIDI ticks.

public synchronized void
setTrackMute(int track, boolean mute)

Implements javax.sound.midi.Sequencer.setTrackMute.

Sets the mute state for a track.

public synchronized void
setTrackSolo(int track, boolean solo)

Implements javax.sound.midi.Sequencer.setTrackSolo.

Sets the solo state for a track.

public synchronized void
start()

Implements javax.sound.midi.Sequencer.start.

Starts playback of the MIDI data in the currently loaded sequence.

public void
startRecording()

Implements javax.sound.midi.Sequencer.startRecording.

Starts recording and playback of MIDI data.

public synchronized void
stop()

Implements javax.sound.midi.Sequencer.stop.

Stops recording, if active, and playback of the currently loaded sequence, if any.

public void
stopRecording()

Implements javax.sound.midi.Sequencer.stopRecording.

Stops recording, if active.

Inherited from com.sun.media.sound.AbstractMidiDevice:
closecloseInternaldoClosefinalizegetDeviceInfogetIdgetMaxReceiversgetMaxTransmittersgetReceivergetReceiverReferenceCountinggetReceiversgetTransmittergetTransmitterListgetTransmitterReferenceCountinggetTransmittersisOpenopen