javax.sound.midi
Interface Sequencer

All Superinterfaces:
MidiDevice sample code for javax.sound.midi.MidiDevice definition code for javax.sound.midi.MidiDevice

public interface Sequencer
extends MidiDevice sample code for javax.sound.midi.MidiDevice definition code for javax.sound.midi.MidiDevice

A hardware or software device that plays back a MIDI sequence sample code for javax.sound.midi.Sequence definition code for javax.sound.midi.Sequence is known as a sequencer. A MIDI sequence contains lists of time-stamped MIDI data, such as might be read from a standard MIDI file. Most sequencers also provide functions for creating and editing sequences.

The Sequencer interface includes methods for the following basic MIDI sequencer operations:

In addition, the following operations are supported, either directly, or indirectly through objects that the Sequencer has access to:

See Also:
Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode , addMetaEventListener(javax.sound.midi.MetaEventListener) sample code for javax.sound.midi.Sequencer.addMetaEventListener(javax.sound.midi.MetaEventListener) definition code for javax.sound.midi.Sequencer.addMetaEventListener(javax.sound.midi.MetaEventListener) , ControllerEventListener sample code for javax.sound.midi.ControllerEventListener definition code for javax.sound.midi.ControllerEventListener , Receiver sample code for javax.sound.midi.Receiver definition code for javax.sound.midi.Receiver , Transmitter sample code for javax.sound.midi.Transmitter definition code for javax.sound.midi.Transmitter , MidiDevice sample code for javax.sound.midi.MidiDevice definition code for javax.sound.midi.MidiDevice

Nested Class Summary
static class Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode
          A SyncMode object represents one of the ways in which a MIDI sequencer's notion of time can be synchronized with a master or slave device.
 
Nested classes/interfaces inherited from interface javax.sound.midi.MidiDevice sample code for javax.sound.midi.MidiDevice definition code for javax.sound.midi.MidiDevice
MidiDevice.Info sample code for javax.sound.midi.MidiDevice.Info definition code for javax.sound.midi.MidiDevice.Info
 
Field Summary
static int LOOP_CONTINUOUSLY sample code for javax.sound.midi.Sequencer.LOOP_CONTINUOUSLY definition code for javax.sound.midi.Sequencer.LOOP_CONTINUOUSLY
          A value indicating that looping should continue indefinitely rather than complete after a specific number of loops.
 
Method Summary
 int[] addControllerEventListener sample code for javax.sound.midi.Sequencer.addControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) definition code for javax.sound.midi.Sequencer.addControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) (ControllerEventListener sample code for javax.sound.midi.ControllerEventListener definition code for javax.sound.midi.ControllerEventListener  listener, int[] controllers)
          Registers a controller event listener to receive notification whenever the sequencer processes a control-change event of the requested type or types.
 boolean addMetaEventListener sample code for javax.sound.midi.Sequencer.addMetaEventListener(javax.sound.midi.MetaEventListener) definition code for javax.sound.midi.Sequencer.addMetaEventListener(javax.sound.midi.MetaEventListener) (MetaEventListener sample code for javax.sound.midi.MetaEventListener definition code for javax.sound.midi.MetaEventListener  listener)
          Registers a meta-event listener to receive notification whenever a meta-event is encountered in the sequence and processed by the sequencer.
 int getLoopCount sample code for javax.sound.midi.Sequencer.getLoopCount() definition code for javax.sound.midi.Sequencer.getLoopCount() ()
          Obtains the number of repetitions for playback.
 long getLoopEndPoint sample code for javax.sound.midi.Sequencer.getLoopEndPoint() definition code for javax.sound.midi.Sequencer.getLoopEndPoint() ()
          Obtains the end position of the loop, in MIDI ticks.
 long getLoopStartPoint sample code for javax.sound.midi.Sequencer.getLoopStartPoint() definition code for javax.sound.midi.Sequencer.getLoopStartPoint() ()
          Obtains the start position of the loop, in MIDI ticks.
 Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode getMasterSyncMode sample code for javax.sound.midi.Sequencer.getMasterSyncMode() definition code for javax.sound.midi.Sequencer.getMasterSyncMode() ()
          Obtains the current master synchronization mode for this sequencer.
 Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode [] getMasterSyncModes sample code for javax.sound.midi.Sequencer.getMasterSyncModes() definition code for javax.sound.midi.Sequencer.getMasterSyncModes() ()
          Obtains the set of master synchronization modes supported by this sequencer.
 long getMicrosecondLength sample code for javax.sound.midi.Sequencer.getMicrosecondLength() definition code for javax.sound.midi.Sequencer.getMicrosecondLength() ()
          Obtains the length of the current sequence, expressed in microseconds, or 0 if no sequence is set.
 long getMicrosecondPosition sample code for javax.sound.midi.Sequencer.getMicrosecondPosition() definition code for javax.sound.midi.Sequencer.getMicrosecondPosition() ()
          Obtains the current position in the sequence, expressed in microseconds.
 Sequence sample code for javax.sound.midi.Sequence definition code for javax.sound.midi.Sequence getSequence sample code for javax.sound.midi.Sequencer.getSequence() definition code for javax.sound.midi.Sequencer.getSequence() ()
          Obtains the sequence on which the Sequencer is currently operating.
 Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode getSlaveSyncMode sample code for javax.sound.midi.Sequencer.getSlaveSyncMode() definition code for javax.sound.midi.Sequencer.getSlaveSyncMode() ()
          Obtains the current slave synchronization mode for this sequencer.
 Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode [] getSlaveSyncModes sample code for javax.sound.midi.Sequencer.getSlaveSyncModes() definition code for javax.sound.midi.Sequencer.getSlaveSyncModes() ()
          Obtains the set of slave synchronization modes supported by the sequencer.
 float getTempoFactor sample code for javax.sound.midi.Sequencer.getTempoFactor() definition code for javax.sound.midi.Sequencer.getTempoFactor() ()
          Returns the current tempo factor for the sequencer.
 float getTempoInBPM sample code for javax.sound.midi.Sequencer.getTempoInBPM() definition code for javax.sound.midi.Sequencer.getTempoInBPM() ()
          Obtains the current tempo, expressed in beats per minute.
 float getTempoInMPQ sample code for javax.sound.midi.Sequencer.getTempoInMPQ() definition code for javax.sound.midi.Sequencer.getTempoInMPQ() ()
          Obtains the current tempo, expressed in microseconds per quarter note.
 long getTickLength sample code for javax.sound.midi.Sequencer.getTickLength() definition code for javax.sound.midi.Sequencer.getTickLength() ()
          Obtains the length of the current sequence, expressed in MIDI ticks, or 0 if no sequence is set.
 long getTickPosition sample code for javax.sound.midi.Sequencer.getTickPosition() definition code for javax.sound.midi.Sequencer.getTickPosition() ()
          Obtains the current position in the sequence, expressed in MIDI ticks.
 boolean getTrackMute sample code for javax.sound.midi.Sequencer.getTrackMute(int) definition code for javax.sound.midi.Sequencer.getTrackMute(int) (int track)
          Obtains the current mute state for a track.
 boolean getTrackSolo sample code for javax.sound.midi.Sequencer.getTrackSolo(int) definition code for javax.sound.midi.Sequencer.getTrackSolo(int) (int track)
          Obtains the current solo state for a track.
 boolean isRecording sample code for javax.sound.midi.Sequencer.isRecording() definition code for javax.sound.midi.Sequencer.isRecording() ()
          Indicates whether the Sequencer is currently recording.
 boolean isRunning sample code for javax.sound.midi.Sequencer.isRunning() definition code for javax.sound.midi.Sequencer.isRunning() ()
          Indicates whether the Sequencer is currently running.
 void recordDisable sample code for javax.sound.midi.Sequencer.recordDisable(javax.sound.midi.Track) definition code for javax.sound.midi.Sequencer.recordDisable(javax.sound.midi.Track) (Track sample code for javax.sound.midi.Track definition code for javax.sound.midi.Track  track)
          Disables recording to the specified track.
 void recordEnable sample code for javax.sound.midi.Sequencer.recordEnable(javax.sound.midi.Track, int) definition code for javax.sound.midi.Sequencer.recordEnable(javax.sound.midi.Track, int) (Track sample code for javax.sound.midi.Track definition code for javax.sound.midi.Track  track, int channel)
          Prepares the specified track for recording events received on a particular channel.
 int[] removeControllerEventListener sample code for javax.sound.midi.Sequencer.removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) definition code for javax.sound.midi.Sequencer.removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) (ControllerEventListener sample code for javax.sound.midi.ControllerEventListener definition code for javax.sound.midi.ControllerEventListener  listener, int[] controllers)
          Removes a controller event listener's interest in one or more types of controller event.
 void removeMetaEventListener sample code for javax.sound.midi.Sequencer.removeMetaEventListener(javax.sound.midi.MetaEventListener) definition code for javax.sound.midi.Sequencer.removeMetaEventListener(javax.sound.midi.MetaEventListener) (MetaEventListener sample code for javax.sound.midi.MetaEventListener definition code for javax.sound.midi.MetaEventListener  listener)
          Removes the specified meta-event listener from this sequencer's list of registered listeners, if in fact the listener is registered.
 void setLoopCount sample code for javax.sound.midi.Sequencer.setLoopCount(int) definition code for javax.sound.midi.Sequencer.setLoopCount(int) (int count)
          Sets the number of repetitions of the loop for playback.
 void setLoopEndPoint sample code for javax.sound.midi.Sequencer.setLoopEndPoint(long) definition code for javax.sound.midi.Sequencer.setLoopEndPoint(long) (long tick)
          Sets the last MIDI tick that will be played in the loop.
 void setLoopStartPoint sample code for javax.sound.midi.Sequencer.setLoopStartPoint(long) definition code for javax.sound.midi.Sequencer.setLoopStartPoint(long) (long tick)
          Sets the first MIDI tick that will be played in the loop.
 void setMasterSyncMode sample code for javax.sound.midi.Sequencer.setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode) definition code for javax.sound.midi.Sequencer.setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode) (Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode  sync)
          Sets the source of timing information used by this sequencer.
 void setMicrosecondPosition sample code for javax.sound.midi.Sequencer.setMicrosecondPosition(long) definition code for javax.sound.midi.Sequencer.setMicrosecondPosition(long) (long microseconds)
          Sets the current position in the sequence, expressed in microseconds
 void setSequence sample code for javax.sound.midi.Sequencer.setSequence(java.io.InputStream) definition code for javax.sound.midi.Sequencer.setSequence(java.io.InputStream) (InputStream sample code for java.io.InputStream definition code for java.io.InputStream  stream)
          Sets the current sequence on which the sequencer operates.
 void setSequence sample code for javax.sound.midi.Sequencer.setSequence(javax.sound.midi.Sequence) definition code for javax.sound.midi.Sequencer.setSequence(javax.sound.midi.Sequence) (Sequence sample code for javax.sound.midi.Sequence definition code for javax.sound.midi.Sequence  sequence)
          Sets the current sequence on which the sequencer operates.
 void setSlaveSyncMode sample code for javax.sound.midi.Sequencer.setSlaveSyncMode(javax.sound.midi.Sequencer.SyncMode) definition code for javax.sound.midi.Sequencer.setSlaveSyncMode(javax.sound.midi.Sequencer.SyncMode) (Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode  sync)
          Sets the slave synchronization mode for the sequencer.
 void setTempoFactor sample code for javax.sound.midi.Sequencer.setTempoFactor(float) definition code for javax.sound.midi.Sequencer.setTempoFactor(float) (float factor)
          Scales the sequencer's actual playback tempo by the factor provided.
 void setTempoInBPM sample code for javax.sound.midi.Sequencer.setTempoInBPM(float) definition code for javax.sound.midi.Sequencer.setTempoInBPM(float) (float bpm)
          Sets the tempo in beats per minute.
 void setTempoInMPQ sample code for javax.sound.midi.Sequencer.setTempoInMPQ(float) definition code for javax.sound.midi.Sequencer.setTempoInMPQ(float) (float mpq)
          Sets the tempo in microseconds per quarter note.
 void setTickPosition sample code for javax.sound.midi.Sequencer.setTickPosition(long) definition code for javax.sound.midi.Sequencer.setTickPosition(long) (long tick)
          Sets the current sequencer position in MIDI ticks
 void setTrackMute sample code for javax.sound.midi.Sequencer.setTrackMute(int, boolean) definition code for javax.sound.midi.Sequencer.setTrackMute(int, boolean) (int track, boolean mute)
          Sets the mute state for a track.
 void setTrackSolo sample code for javax.sound.midi.Sequencer.setTrackSolo(int, boolean) definition code for javax.sound.midi.Sequencer.setTrackSolo(int, boolean) (int track, boolean solo)
          Sets the solo state for a track.
 void start sample code for javax.sound.midi.Sequencer.start() definition code for javax.sound.midi.Sequencer.start() ()
          Starts playback of the MIDI data in the currently loaded sequence.
 void startRecording sample code for javax.sound.midi.Sequencer.startRecording() definition code for javax.sound.midi.Sequencer.startRecording() ()
          Starts recording and playback of MIDI data.
 void stop sample code for javax.sound.midi.Sequencer.stop() definition code for javax.sound.midi.Sequencer.stop() ()
          Stops recording, if active, and playback of the currently loaded sequence, if any.
 void stopRecording sample code for javax.sound.midi.Sequencer.stopRecording() definition code for javax.sound.midi.Sequencer.stopRecording() ()
          Stops recording, if active.
 
Methods inherited from interface javax.sound.midi.MidiDevice sample code for javax.sound.midi.MidiDevice definition code for javax.sound.midi.MidiDevice
close sample code for javax.sound.midi.MidiDevice.close() definition code for javax.sound.midi.MidiDevice.close() , getDeviceInfo sample code for javax.sound.midi.MidiDevice.getDeviceInfo() definition code for javax.sound.midi.MidiDevice.getDeviceInfo() , getMaxReceivers sample code for javax.sound.midi.MidiDevice.getMaxReceivers() definition code for javax.sound.midi.MidiDevice.getMaxReceivers() , getMaxTransmitters sample code for javax.sound.midi.MidiDevice.getMaxTransmitters() definition code for javax.sound.midi.MidiDevice.getMaxTransmitters() , getReceiver sample code for javax.sound.midi.MidiDevice.getReceiver() definition code for javax.sound.midi.MidiDevice.getReceiver() , getReceivers sample code for javax.sound.midi.MidiDevice.getReceivers() definition code for javax.sound.midi.MidiDevice.getReceivers() , getTransmitter sample code for javax.sound.midi.MidiDevice.getTransmitter() definition code for javax.sound.midi.MidiDevice.getTransmitter() , getTransmitters sample code for javax.sound.midi.MidiDevice.getTransmitters() definition code for javax.sound.midi.MidiDevice.getTransmitters() , isOpen sample code for javax.sound.midi.MidiDevice.isOpen() definition code for javax.sound.midi.MidiDevice.isOpen() , open sample code for javax.sound.midi.MidiDevice.open() definition code for javax.sound.midi.MidiDevice.open()
 

Field Detail

LOOP_CONTINUOUSLY sample code for javax.sound.midi.Sequencer.LOOP_CONTINUOUSLY

static final int LOOP_CONTINUOUSLY
A value indicating that looping should continue indefinitely rather than complete after a specific number of loops.

Since:
1.5
See Also:
setLoopCount(int) sample code for javax.sound.midi.Sequencer.setLoopCount(int) definition code for javax.sound.midi.Sequencer.setLoopCount(int) , Constant Field Values
Method Detail

setSequence sample code for javax.sound.midi.Sequencer.setSequence(javax.sound.midi.Sequence) definition code for javax.sound.midi.Sequencer.setSequence(javax.sound.midi.Sequence)

void setSequence(Sequence sample code for javax.sound.midi.Sequence definition code for javax.sound.midi.Sequence  sequence)
                 throws InvalidMidiDataException sample code for javax.sound.midi.InvalidMidiDataException definition code for javax.sound.midi.InvalidMidiDataException 
Sets the current sequence on which the sequencer operates.

This method can be called even if the Sequencer is closed.

Parameters:
sequence - the sequence to be loaded.
Throws:
InvalidMidiDataException sample code for javax.sound.midi.InvalidMidiDataException definition code for javax.sound.midi.InvalidMidiDataException - if the sequence contains invalid MIDI data, or is not supported.

setSequence sample code for javax.sound.midi.Sequencer.setSequence(java.io.InputStream) definition code for javax.sound.midi.Sequencer.setSequence(java.io.InputStream)

void setSequence(InputStream sample code for java.io.InputStream definition code for java.io.InputStream  stream)
                 throws IOException sample code for java.io.IOException definition code for java.io.IOException ,
                        InvalidMidiDataException sample code for javax.sound.midi.InvalidMidiDataException definition code for javax.sound.midi.InvalidMidiDataException 
Sets the current sequence on which the sequencer operates. The stream must point to MIDI file data.

This method can be called even if the Sequencer is closed.

Parameters:
stream - stream containing MIDI file data.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O exception occurs during reading of the stream.
InvalidMidiDataException sample code for javax.sound.midi.InvalidMidiDataException definition code for javax.sound.midi.InvalidMidiDataException - if invalid data is encountered in the stream, or the stream is not supported.

getSequence sample code for javax.sound.midi.Sequencer.getSequence() definition code for javax.sound.midi.Sequencer.getSequence()

Sequence sample code for javax.sound.midi.Sequence definition code for javax.sound.midi.Sequence  getSequence()
Obtains the sequence on which the Sequencer is currently operating.

This method can be called even if the Sequencer is closed.

Returns:
the current sequence, or null if no sequence is currently set.

start sample code for javax.sound.midi.Sequencer.start() definition code for javax.sound.midi.Sequencer.start()

void start()
Starts playback of the MIDI data in the currently loaded sequence. Playback will begin from the current position. If the playback position reaches the loop end point, and the loop count is greater than 0, playback will resume at the loop start point for the number of repetitions set with setLoopCount. After that, or if the loop count is 0, playback will continue to play to the end of the sequence.

The implementation ensures that the synthesizer is brought to a consistent state when jumping to the loop start point by sending appropriate controllers, pitch bend, and program change events.

Throws:
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the Sequencer is closed.
See Also:
setLoopStartPoint(long) sample code for javax.sound.midi.Sequencer.setLoopStartPoint(long) definition code for javax.sound.midi.Sequencer.setLoopStartPoint(long) , setLoopEndPoint(long) sample code for javax.sound.midi.Sequencer.setLoopEndPoint(long) definition code for javax.sound.midi.Sequencer.setLoopEndPoint(long) , setLoopCount(int) sample code for javax.sound.midi.Sequencer.setLoopCount(int) definition code for javax.sound.midi.Sequencer.setLoopCount(int) , stop() sample code for javax.sound.midi.Sequencer.stop() definition code for javax.sound.midi.Sequencer.stop()

stop sample code for javax.sound.midi.Sequencer.stop() definition code for javax.sound.midi.Sequencer.stop()

void stop()
Stops recording, if active, and playback of the currently loaded sequence, if any.

Throws:
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the Sequencer is closed.
See Also:
start() sample code for javax.sound.midi.Sequencer.start() definition code for javax.sound.midi.Sequencer.start() , isRunning() sample code for javax.sound.midi.Sequencer.isRunning() definition code for javax.sound.midi.Sequencer.isRunning()

isRunning sample code for javax.sound.midi.Sequencer.isRunning() definition code for javax.sound.midi.Sequencer.isRunning()

boolean isRunning()
Indicates whether the Sequencer is currently running. The default is false. The Sequencer starts running when either start() sample code for javax.sound.midi.Sequencer.start() definition code for javax.sound.midi.Sequencer.start() or startRecording() sample code for javax.sound.midi.Sequencer.startRecording() definition code for javax.sound.midi.Sequencer.startRecording() is called. isRunning then returns true until playback of the sequence completes or stop() sample code for javax.sound.midi.Sequencer.stop() definition code for javax.sound.midi.Sequencer.stop() is called.

Returns:
true if the Sequencer is running, otherwise false

startRecording sample code for javax.sound.midi.Sequencer.startRecording() definition code for javax.sound.midi.Sequencer.startRecording()

void startRecording()
Starts recording and playback of MIDI data. Data is recorded to all enabled tracks, on the channel(s) for which they were enabled. Recording begins at the current position of the sequencer. Any events already in the track are overwritten for the duration of the recording session. Events from the currently loaded sequence, if any, are delivered to the sequencer's transmitter(s) along with messages received during recording.

Note that tracks are not by default enabled for recording. In order to record MIDI data, at least one track must be specifically enabled for recording.

Throws:
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the Sequencer is closed.
See Also:
startRecording() sample code for javax.sound.midi.Sequencer.startRecording() definition code for javax.sound.midi.Sequencer.startRecording() , recordEnable(javax.sound.midi.Track, int) sample code for javax.sound.midi.Sequencer.recordEnable(javax.sound.midi.Track, int) definition code for javax.sound.midi.Sequencer.recordEnable(javax.sound.midi.Track, int) , recordDisable(javax.sound.midi.Track) sample code for javax.sound.midi.Sequencer.recordDisable(javax.sound.midi.Track) definition code for javax.sound.midi.Sequencer.recordDisable(javax.sound.midi.Track)

stopRecording sample code for javax.sound.midi.Sequencer.stopRecording() definition code for javax.sound.midi.Sequencer.stopRecording()

void stopRecording()
Stops recording, if active. Playback of the current sequence continues.

Throws:
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the Sequencer is closed.
See Also:
startRecording() sample code for javax.sound.midi.Sequencer.startRecording() definition code for javax.sound.midi.Sequencer.startRecording() , isRecording() sample code for javax.sound.midi.Sequencer.isRecording() definition code for javax.sound.midi.Sequencer.isRecording()

isRecording sample code for javax.sound.midi.Sequencer.isRecording() definition code for javax.sound.midi.Sequencer.isRecording()

boolean isRecording()
Indicates whether the Sequencer is currently recording. The default is false. The Sequencer begins recording when startRecording() sample code for javax.sound.midi.Sequencer.startRecording() definition code for javax.sound.midi.Sequencer.startRecording() is called, and then returns true until stop() sample code for javax.sound.midi.Sequencer.stop() definition code for javax.sound.midi.Sequencer.stop() or stopRecording() sample code for javax.sound.midi.Sequencer.stopRecording() definition code for javax.sound.midi.Sequencer.stopRecording() is called.

Returns:
true if the Sequencer is recording, otherwise false

recordEnable sample code for javax.sound.midi.Sequencer.recordEnable(javax.sound.midi.Track, int) definition code for javax.sound.midi.Sequencer.recordEnable(javax.sound.midi.Track, int)

void recordEnable(Track sample code for javax.sound.midi.Track definition code for javax.sound.midi.Track  track,
                  int channel)
Prepares the specified track for recording events received on a particular channel. Once enabled, a track will receive events when recording is active.

Parameters:
track - the track to which events will be recorded
channel - the channel on which events will be received. If -1 is specified for the channel value, the track will receive data from all channels.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - thrown if the track is not part of the current sequence.

recordDisable sample code for javax.sound.midi.Sequencer.recordDisable(javax.sound.midi.Track) definition code for javax.sound.midi.Sequencer.recordDisable(javax.sound.midi.Track)

void recordDisable(Track sample code for javax.sound.midi.Track definition code for javax.sound.midi.Track  track)
Disables recording to the specified track. Events will no longer be recorded into this track.

Parameters:
track - the track to disable for recording, or null to disable recording for all tracks.

getTempoInBPM sample code for javax.sound.midi.Sequencer.getTempoInBPM() definition code for javax.sound.midi.Sequencer.getTempoInBPM()

float getTempoInBPM()
Obtains the current tempo, expressed in beats per minute. The actual tempo of playback is the product of the returned value and the tempo factor.

Returns:
the current tempo in beats per minute
See Also:
getTempoFactor() sample code for javax.sound.midi.Sequencer.getTempoFactor() definition code for javax.sound.midi.Sequencer.getTempoFactor() , setTempoInBPM(float) sample code for javax.sound.midi.Sequencer.setTempoInBPM(float) definition code for javax.sound.midi.Sequencer.setTempoInBPM(float) , getTempoInMPQ() sample code for javax.sound.midi.Sequencer.getTempoInMPQ() definition code for javax.sound.midi.Sequencer.getTempoInMPQ()

setTempoInBPM sample code for javax.sound.midi.Sequencer.setTempoInBPM(float) definition code for javax.sound.midi.Sequencer.setTempoInBPM(float)

void setTempoInBPM(float bpm)
Sets the tempo in beats per minute. The actual tempo of playback is the product of the specified value and the tempo factor.

Parameters:
bpm - desired new tempo in beats per minute
See Also:
getTempoFactor() sample code for javax.sound.midi.Sequencer.getTempoFactor() definition code for javax.sound.midi.Sequencer.getTempoFactor() , setTempoInMPQ(float) sample code for javax.sound.midi.Sequencer.setTempoInMPQ(float) definition code for javax.sound.midi.Sequencer.setTempoInMPQ(float) , getTempoInBPM() sample code for javax.sound.midi.Sequencer.getTempoInBPM() definition code for javax.sound.midi.Sequencer.getTempoInBPM()

getTempoInMPQ sample code for javax.sound.midi.Sequencer.getTempoInMPQ() definition code for javax.sound.midi.Sequencer.getTempoInMPQ()

float getTempoInMPQ()
Obtains the current tempo, expressed in microseconds per quarter note. The actual tempo of playback is the product of the returned value and the tempo factor.

Returns:
the current tempo in microseconds per quarter note
See Also:
getTempoFactor() sample code for javax.sound.midi.Sequencer.getTempoFactor() definition code for javax.sound.midi.Sequencer.getTempoFactor() , setTempoInMPQ(float) sample code for javax.sound.midi.Sequencer.setTempoInMPQ(float) definition code for javax.sound.midi.Sequencer.setTempoInMPQ(float) , getTempoInBPM() sample code for javax.sound.midi.Sequencer.getTempoInBPM() definition code for javax.sound.midi.Sequencer.getTempoInBPM()

setTempoInMPQ sample code for javax.sound.midi.Sequencer.setTempoInMPQ(float) definition code for javax.sound.midi.Sequencer.setTempoInMPQ(float)

void setTempoInMPQ(float mpq)
Sets the tempo in microseconds per quarter note. The actual tempo of playback is the product of the specified value and the tempo factor.

Parameters:
mpq - desired new tempo in microseconds per quarter note.
See Also:
getTempoFactor() sample code for javax.sound.midi.Sequencer.getTempoFactor() definition code for javax.sound.midi.Sequencer.getTempoFactor() , setTempoInBPM(float) sample code for javax.sound.midi.Sequencer.setTempoInBPM(float) definition code for javax.sound.midi.Sequencer.setTempoInBPM(float) , getTempoInMPQ() sample code for javax.sound.midi.Sequencer.getTempoInMPQ() definition code for javax.sound.midi.Sequencer.getTempoInMPQ()

setTempoFactor sample code for javax.sound.midi.Sequencer.setTempoFactor(float) definition code for javax.sound.midi.Sequencer.setTempoFactor(float)

void setTempoFactor(float factor)
Scales the sequencer's actual playback tempo by the factor provided. The default is 1.0. A value of 1.0 represents the natural rate (the tempo specified in the sequence), 2.0 means twice as fast, etc. The tempo factor does not affect the values returned by getTempoInMPQ() sample code for javax.sound.midi.Sequencer.getTempoInMPQ() definition code for javax.sound.midi.Sequencer.getTempoInMPQ() and getTempoInBPM() sample code for javax.sound.midi.Sequencer.getTempoInBPM() definition code for javax.sound.midi.Sequencer.getTempoInBPM() . Those values indicate the tempo prior to scaling.

Note that the tempo factor cannot be adjusted when external synchronization is used. In that situation, setTempoFactor always sets the tempo factor to 1.0.

Parameters:
factor - the requested tempo scalar
See Also:
getTempoFactor() sample code for javax.sound.midi.Sequencer.getTempoFactor() definition code for javax.sound.midi.Sequencer.getTempoFactor()

getTempoFactor sample code for javax.sound.midi.Sequencer.getTempoFactor() definition code for javax.sound.midi.Sequencer.getTempoFactor()

float getTempoFactor()
Returns the current tempo factor for the sequencer. The default is 1.0.

Returns:
tempo factor.
See Also:
setTempoFactor(float) sample code for javax.sound.midi.Sequencer.setTempoFactor(float) definition code for javax.sound.midi.Sequencer.setTempoFactor(float)

getTickLength sample code for javax.sound.midi.Sequencer.getTickLength() definition code for javax.sound.midi.Sequencer.getTickLength()

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

Returns:
length of the sequence in ticks

getTickPosition sample code for javax.sound.midi.Sequencer.getTickPosition() definition code for javax.sound.midi.Sequencer.getTickPosition()

long getTickPosition()
Obtains the current position in the sequence, expressed in MIDI ticks. (The duration of a tick in seconds is determined both by the tempo and by the timing resolution stored in the Sequence sample code for javax.sound.midi.Sequence definition code for javax.sound.midi.Sequence .)

Returns:
current tick
See Also:
setTickPosition(long) sample code for javax.sound.midi.Sequencer.setTickPosition(long) definition code for javax.sound.midi.Sequencer.setTickPosition(long)

setTickPosition sample code for javax.sound.midi.Sequencer.setTickPosition(long) definition code for javax.sound.midi.Sequencer.setTickPosition(long)

void setTickPosition(long tick)
Sets the current sequencer position in MIDI ticks

Parameters:
tick - the desired tick position
See Also:
getTickPosition() sample code for javax.sound.midi.Sequencer.getTickPosition() definition code for javax.sound.midi.Sequencer.getTickPosition()

getMicrosecondLength sample code for javax.sound.midi.Sequencer.getMicrosecondLength() definition code for javax.sound.midi.Sequencer.getMicrosecondLength()

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

Returns:
length of the sequence in microseconds.

getMicrosecondPosition sample code for javax.sound.midi.Sequencer.getMicrosecondPosition() definition code for javax.sound.midi.Sequencer.getMicrosecondPosition()

long getMicrosecondPosition()
Obtains the current position in the sequence, expressed in microseconds.

Specified by:
getMicrosecondPosition sample code for javax.sound.midi.MidiDevice.getMicrosecondPosition() definition code for javax.sound.midi.MidiDevice.getMicrosecondPosition() in interface MidiDevice sample code for javax.sound.midi.MidiDevice definition code for javax.sound.midi.MidiDevice
Returns:
the current position in microseconds
See Also:
setMicrosecondPosition(long) sample code for javax.sound.midi.Sequencer.setMicrosecondPosition(long) definition code for javax.sound.midi.Sequencer.setMicrosecondPosition(long)

setMicrosecondPosition sample code for javax.sound.midi.Sequencer.setMicrosecondPosition(long) definition code for javax.sound.midi.Sequencer.setMicrosecondPosition(long)

void setMicrosecondPosition(long microseconds)
Sets the current position in the sequence, expressed in microseconds

Parameters:
microseconds - desired position in microseconds
See Also:
getMicrosecondPosition() sample code for javax.sound.midi.Sequencer.getMicrosecondPosition() definition code for javax.sound.midi.Sequencer.getMicrosecondPosition()

setMasterSyncMode sample code for javax.sound.midi.Sequencer.setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode) definition code for javax.sound.midi.Sequencer.setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode)

void setMasterSyncMode(Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode  sync)
Sets the source of timing information used by this sequencer. The sequencer synchronizes to the master, which is the internal clock, MIDI clock, or MIDI time code, depending on the value of sync. The sync argument must be one of the supported modes, as returned by getMasterSyncModes() sample code for javax.sound.midi.Sequencer.getMasterSyncModes() definition code for javax.sound.midi.Sequencer.getMasterSyncModes() .

Parameters:
sync - the desired master synchronization mode
See Also:
Sequencer.SyncMode.INTERNAL_CLOCK sample code for javax.sound.midi.Sequencer.SyncMode.INTERNAL_CLOCK definition code for javax.sound.midi.Sequencer.SyncMode.INTERNAL_CLOCK , Sequencer.SyncMode.MIDI_SYNC sample code for javax.sound.midi.Sequencer.SyncMode.MIDI_SYNC definition code for javax.sound.midi.Sequencer.SyncMode.MIDI_SYNC , Sequencer.SyncMode.MIDI_TIME_CODE sample code for javax.sound.midi.Sequencer.SyncMode.MIDI_TIME_CODE definition code for javax.sound.midi.Sequencer.SyncMode.MIDI_TIME_CODE , getMasterSyncMode() sample code for javax.sound.midi.Sequencer.getMasterSyncMode() definition code for javax.sound.midi.Sequencer.getMasterSyncMode()

getMasterSyncMode sample code for javax.sound.midi.Sequencer.getMasterSyncMode() definition code for javax.sound.midi.Sequencer.getMasterSyncMode()

Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode  getMasterSyncMode()
Obtains the current master synchronization mode for this sequencer.

Returns:
the current master synchronization mode
See Also:
setMasterSyncMode(Sequencer.SyncMode) sample code for javax.sound.midi.Sequencer.setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode) definition code for javax.sound.midi.Sequencer.setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode) , getMasterSyncModes() sample code for javax.sound.midi.Sequencer.getMasterSyncModes() definition code for javax.sound.midi.Sequencer.getMasterSyncModes()

getMasterSyncModes sample code for javax.sound.midi.Sequencer.getMasterSyncModes() definition code for javax.sound.midi.Sequencer.getMasterSyncModes()

Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode [] getMasterSyncModes()
Obtains the set of master synchronization modes supported by this sequencer.

Returns:
the available master synchronization modes
See Also:
Sequencer.SyncMode.INTERNAL_CLOCK sample code for javax.sound.midi.Sequencer.SyncMode.INTERNAL_CLOCK definition code for javax.sound.midi.Sequencer.SyncMode.INTERNAL_CLOCK , Sequencer.SyncMode.MIDI_SYNC sample code for javax.sound.midi.Sequencer.SyncMode.MIDI_SYNC definition code for javax.sound.midi.Sequencer.SyncMode.MIDI_SYNC , Sequencer.SyncMode.MIDI_TIME_CODE sample code for javax.sound.midi.Sequencer.SyncMode.MIDI_TIME_CODE definition code for javax.sound.midi.Sequencer.SyncMode.MIDI_TIME_CODE , getMasterSyncMode() sample code for javax.sound.midi.Sequencer.getMasterSyncMode() definition code for javax.sound.midi.Sequencer.getMasterSyncMode() , setMasterSyncMode(Sequencer.SyncMode) sample code for javax.sound.midi.Sequencer.setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode) definition code for javax.sound.midi.Sequencer.setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode)

setSlaveSyncMode sample code for javax.sound.midi.Sequencer.setSlaveSyncMode(javax.sound.midi.Sequencer.SyncMode) definition code for javax.sound.midi.Sequencer.setSlaveSyncMode(javax.sound.midi.Sequencer.SyncMode)

void setSlaveSyncMode(Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode  sync)
Sets the slave synchronization mode for the sequencer. This indicates the type of timing information sent by the sequencer to its receiver. The sync argument must be one of the supported modes, as returned by getSlaveSyncModes() sample code for javax.sound.midi.Sequencer.getSlaveSyncModes() definition code for javax.sound.midi.Sequencer.getSlaveSyncModes() .

Parameters:
sync - the desired slave synchronization mode
See Also:
Sequencer.SyncMode.MIDI_SYNC sample code for javax.sound.midi.Sequencer.SyncMode.MIDI_SYNC definition code for javax.sound.midi.Sequencer.SyncMode.MIDI_SYNC , Sequencer.SyncMode.MIDI_TIME_CODE sample code for javax.sound.midi.Sequencer.SyncMode.MIDI_TIME_CODE definition code for javax.sound.midi.Sequencer.SyncMode.MIDI_TIME_CODE , Sequencer.SyncMode.NO_SYNC sample code for javax.sound.midi.Sequencer.SyncMode.NO_SYNC definition code for javax.sound.midi.Sequencer.SyncMode.NO_SYNC , getSlaveSyncModes() sample code for javax.sound.midi.Sequencer.getSlaveSyncModes() definition code for javax.sound.midi.Sequencer.getSlaveSyncModes()

getSlaveSyncMode sample code for javax.sound.midi.Sequencer.getSlaveSyncMode() definition code for javax.sound.midi.Sequencer.getSlaveSyncMode()

Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode  getSlaveSyncMode()
Obtains the current slave synchronization mode for this sequencer.

Returns:
the current slave synchronization mode
See Also:
setSlaveSyncMode(Sequencer.SyncMode) sample code for javax.sound.midi.Sequencer.setSlaveSyncMode(javax.sound.midi.Sequencer.SyncMode) definition code for javax.sound.midi.Sequencer.setSlaveSyncMode(javax.sound.midi.Sequencer.SyncMode) , getSlaveSyncModes() sample code for javax.sound.midi.Sequencer.getSlaveSyncModes() definition code for javax.sound.midi.Sequencer.getSlaveSyncModes()

getSlaveSyncModes sample code for javax.sound.midi.Sequencer.getSlaveSyncModes() definition code for javax.sound.midi.Sequencer.getSlaveSyncModes()

Sequencer.SyncMode sample code for javax.sound.midi.Sequencer.SyncMode definition code for javax.sound.midi.Sequencer.SyncMode [] getSlaveSyncModes()
Obtains the set of slave synchronization modes supported by the sequencer.

Returns:
the available slave synchronization modes
See Also:
Sequencer.SyncMode.MIDI_SYNC sample code for javax.sound.midi.Sequencer.SyncMode.MIDI_SYNC definition code for javax.sound.midi.Sequencer.SyncMode.MIDI_SYNC , Sequencer.SyncMode.MIDI_TIME_CODE sample code for javax.sound.midi.Sequencer.SyncMode.MIDI_TIME_CODE definition code for javax.sound.midi.Sequencer.SyncMode.MIDI_TIME_CODE , Sequencer.SyncMode.NO_SYNC sample code for javax.sound.midi.Sequencer.SyncMode.NO_SYNC definition code for javax.sound.midi.Sequencer.SyncMode.NO_SYNC

setTrackMute sample code for javax.sound.midi.Sequencer.setTrackMute(int, boolean) definition code for javax.sound.midi.Sequencer.setTrackMute(int, boolean)

void setTrackMute(int track,
                  boolean mute)
Sets the mute state for a track. This method may fail for a number of reasons. For example, the track number specified may not be valid for the current sequence, or the sequencer may not support this functionality. An application which needs to verify whether this operation succeeded should follow this call with a call to getTrackMute(int) sample code for javax.sound.midi.Sequencer.getTrackMute(int) definition code for javax.sound.midi.Sequencer.getTrackMute(int) .

Parameters:
track - the track number. Tracks in the current sequence are numbered from 0 to the number of tracks in the sequence minus 1.
mute - the new mute state for the track. true implies the track should be muted, false implies the track should be unmuted.
See Also:
getSequence() sample code for javax.sound.midi.Sequencer.getSequence() definition code for javax.sound.midi.Sequencer.getSequence()

getTrackMute sample code for javax.sound.midi.Sequencer.getTrackMute(int) definition code for javax.sound.midi.Sequencer.getTrackMute(int)

boolean getTrackMute(int track)
Obtains the current mute state for a track. The default mute state for all tracks which have not been muted is false. In any case where the specified track has not been muted, this method should return false. This applies if the sequencer does not support muting of tracks, and if the specified track index is not valid.

Parameters:
track - the track number. Tracks in the current sequence are numbered from 0 to the number of tracks in the sequence minus 1.
Returns:
true if muted, false if not.

setTrackSolo sample code for javax.sound.midi.Sequencer.setTrackSolo(int, boolean) definition code for javax.sound.midi.Sequencer.setTrackSolo(int, boolean)

void setTrackSolo(int track,
                  boolean solo)
Sets the solo state for a track. If solo is true only this track and other solo'd tracks will sound. If solo is false then only other solo'd tracks will sound, unless no tracks are solo'd in which case all un-muted tracks will sound.

This method may fail for a number of reasons. For example, the track number specified may not be valid for the current sequence, or the sequencer may not support this functionality. An application which needs to verify whether this operation succeeded should follow this call with a call to getTrackSolo(int) sample code for javax.sound.midi.Sequencer.getTrackSolo(int) definition code for javax.sound.midi.Sequencer.getTrackSolo(int) .

Parameters:
track - the track number. Tracks in the current sequence are numbered from 0 to the number of tracks in the sequence minus 1.
solo - the new solo state for the track. true implies the track should be solo'd, false implies the track should not be solo'd.
See Also:
getSequence() sample code for javax.sound.midi.Sequencer.getSequence() definition code for javax.sound.midi.Sequencer.getSequence()

getTrackSolo sample code for javax.sound.midi.Sequencer.getTrackSolo(int) definition code for javax.sound.midi.Sequencer.getTrackSolo(int)

boolean getTrackSolo(int track)
Obtains the current solo state for a track. The default mute state for all tracks which have not been solo'd is false. In any case where the specified track has not been solo'd, this method should return false. This applies if the sequencer does not support soloing of tracks, and if the specified track index is not valid.

Parameters:
track - the track number. Tracks in the current sequence are numbered from 0 to the number of tracks in the sequence minus 1.
Returns:
true if solo'd, false if not.

addMetaEventListener sample code for javax.sound.midi.Sequencer.addMetaEventListener(javax.sound.midi.MetaEventListener) definition code for javax.sound.midi.Sequencer.addMetaEventListener(javax.sound.midi.MetaEventListener)

boolean addMetaEventListener(MetaEventListener sample code for javax.sound.midi.MetaEventListener definition code for javax.sound.midi.MetaEventListener  listener)
Registers a meta-event listener to receive notification whenever a meta-event is encountered in the sequence and processed by the sequencer. This method can fail if, for instance,this class of sequencer does not support meta-event notification.

Parameters:
listener - listener to add
Returns:
true if the listener was successfully added, otherwise false
See Also:
removeMetaEventListener(javax.sound.midi.MetaEventListener) sample code for javax.sound.midi.Sequencer.removeMetaEventListener(javax.sound.midi.MetaEventListener) definition code for javax.sound.midi.Sequencer.removeMetaEventListener(javax.sound.midi.MetaEventListener) , MetaEventListener sample code for javax.sound.midi.MetaEventListener definition code for javax.sound.midi.MetaEventListener , MetaMessage sample code for javax.sound.midi.MetaMessage definition code for javax.sound.midi.MetaMessage

removeMetaEventListener sample code for javax.sound.midi.Sequencer.removeMetaEventListener(javax.sound.midi.MetaEventListener) definition code for javax.sound.midi.Sequencer.removeMetaEventListener(javax.sound.midi.MetaEventListener)

void removeMetaEventListener(MetaEventListener sample code for javax.sound.midi.MetaEventListener definition code for javax.sound.midi.MetaEventListener  listener)
Removes the specified meta-event listener from this sequencer's list of registered listeners, if in fact the listener is registered.

Parameters:
listener - the meta-event listener to remove
See Also:
addMetaEventListener(javax.sound.midi.MetaEventListener) sample code for javax.sound.midi.Sequencer.addMetaEventListener(javax.sound.midi.MetaEventListener) definition code for javax.sound.midi.Sequencer.addMetaEventListener(javax.sound.midi.MetaEventListener)

addControllerEventListener sample code for javax.sound.midi.Sequencer.addControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) definition code for javax.sound.midi.Sequencer.addControllerEventListener(javax.sound.midi.ControllerEventListener, int[])

int[] addControllerEventListener(ControllerEventListener sample code for javax.sound.midi.ControllerEventListener definition code for javax.sound.midi.ControllerEventListener  listener,
                                 int[] controllers)
Registers a controller event listener to receive notification whenever the sequencer processes a control-change event of the requested type or types. The types are specified by the controllers argument, which should contain an array of MIDI controller numbers. (Each number should be between 0 and 127, inclusive. See the MIDI 1.0 Specification for the numbers that correspond to various types of controllers.)

The returned array contains the MIDI controller numbers for which the listener will now receive events. Some sequencers might not support controller event notification, in which case the array has a length of 0. Other sequencers might support notification for some controllers but not all. This method may be invoked repeatedly. Each time, the returned array indicates all the controllers that the listener will be notified about, not only the controllers requested in that particular invocation.

Parameters:
listener - the controller event listener to add to the list of registered listeners
controllers - the MIDI controller numbers for which change notification is requested
Returns:
the numbers of all the MIDI controllers whose changes will now be reported to the specified listener
See Also:
removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) sample code for javax.sound.midi.Sequencer.removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) definition code for javax.sound.midi.Sequencer.removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) , ControllerEventListener sample code for javax.sound.midi.ControllerEventListener definition code for javax.sound.midi.ControllerEventListener

removeControllerEventListener sample code for javax.sound.midi.Sequencer.removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) definition code for javax.sound.midi.Sequencer.removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[])

int[] removeControllerEventListener(ControllerEventListener sample code for javax.sound.midi.ControllerEventListener definition code for javax.sound.midi.ControllerEventListener  listener,
                                    int[] controllers)
Removes a controller event listener's interest in one or more types of controller event. The controllers argument is an array of MIDI numbers corresponding to the controllers for which the listener should no longer receive change notifications. To completely remove this listener from the list of registered listeners, pass in null for controllers. The returned array contains the MIDI controller numbers for which the listener will now receive events. The array has a length of 0 if the listener will not receive change notifications for any controllers.

Parameters:
listener - old listener
controllers - the MIDI controller numbers for which change notification should be cancelled, or null to cancel for all controllers
Returns:
the numbers of all the MIDI controllers whose changes will now be reported to the specified listener
See Also:
addControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) sample code for javax.sound.midi.Sequencer.addControllerEventListener(javax.sound.midi.ControllerEventListener, int[]) definition code for javax.sound.midi.Sequencer.addControllerEventListener(javax.sound.midi.ControllerEventListener, int[])

setLoopStartPoint sample code for javax.sound.midi.Sequencer.setLoopStartPoint(long) definition code for javax.sound.midi.Sequencer.setLoopStartPoint(long)

void setLoopStartPoint(long tick)
Sets the first MIDI tick that will be played in the loop. If the loop count is greater than 0, playback will jump to this point when reaching the loop end point.

A value of 0 for the starting point means the beginning of the loaded sequence. The starting point must be lower than or equal to the ending point, and it must fall within the size of the loaded sequence.

A sequencer's loop start point defaults to start of the sequence.

Parameters:
tick - the loop's starting position, in MIDI ticks (zero-based)
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the requested loop start point cannot be set, usually because it falls outside the sequence's duration or because the start point is after the end point
Since:
1.5
See Also:
setLoopEndPoint(long) sample code for javax.sound.midi.Sequencer.setLoopEndPoint(long) definition code for javax.sound.midi.Sequencer.setLoopEndPoint(long) , setLoopCount(int) sample code for javax.sound.midi.Sequencer.setLoopCount(int) definition code for javax.sound.midi.Sequencer.setLoopCount(int) , getLoopStartPoint() sample code for javax.sound.midi.Sequencer.getLoopStartPoint() definition code for javax.sound.midi.Sequencer.getLoopStartPoint() , start() sample code for javax.sound.midi.Sequencer.start() definition code for javax.sound.midi.Sequencer.start()

getLoopStartPoint sample code for javax.sound.midi.Sequencer.getLoopStartPoint() definition code for javax.sound.midi.Sequencer.getLoopStartPoint()

long getLoopStartPoint()
Obtains the start position of the loop, in MIDI ticks.

Returns:
the start position of the loop, in MIDI ticks (zero-based)
Since:
1.5
See Also:
setLoopStartPoint(long) sample code for javax.sound.midi.Sequencer.setLoopStartPoint(long) definition code for javax.sound.midi.Sequencer.setLoopStartPoint(long)

setLoopEndPoint sample code for javax.sound.midi.Sequencer.setLoopEndPoint(long) definition code for javax.sound.midi.Sequencer.setLoopEndPoint(long)

void setLoopEndPoint(long tick)
Sets the last MIDI tick that will be played in the loop. If the loop count is 0, the loop end point has no effect and playback continues to play when reaching the loop end point.

A value of -1 for the ending point indicates the last tick of the sequence. Otherwise, the ending point must be greater than or equal to the starting point, and it must fall within the size of the loaded sequence.

A sequencer's loop end point defaults to -1, meaning the end of the sequence.

Parameters:
tick - the loop's ending position, in MIDI ticks (zero-based), or -1 to indicate the final tick
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the requested loop point cannot be set, usually because it falls outside the sequence's duration or because the ending point is before the starting point
Since:
1.5
See Also:
setLoopStartPoint(long) sample code for javax.sound.midi.Sequencer.setLoopStartPoint(long) definition code for javax.sound.midi.Sequencer.setLoopStartPoint(long) , setLoopCount(int) sample code for javax.sound.midi.Sequencer.setLoopCount(int) definition code for javax.sound.midi.Sequencer.setLoopCount(int) , getLoopEndPoint() sample code for javax.sound.midi.Sequencer.getLoopEndPoint() definition code for javax.sound.midi.Sequencer.getLoopEndPoint() , start() sample code for javax.sound.midi.Sequencer.start() definition code for javax.sound.midi.Sequencer.start()

getLoopEndPoint sample code for javax.sound.midi.Sequencer.getLoopEndPoint() definition code for javax.sound.midi.Sequencer.getLoopEndPoint()

long getLoopEndPoint()
Obtains the end position of the loop, in MIDI ticks.

Returns:
the end position of the loop, in MIDI ticks (zero-based), or -1 to indicate the end of the sequence
Since:
1.5
See Also:
setLoopEndPoint(long) sample code for javax.sound.midi.Sequencer.setLoopEndPoint(long) definition code for javax.sound.midi.Sequencer.setLoopEndPoint(long)

setLoopCount sample code for javax.sound.midi.Sequencer.setLoopCount(int) definition code for javax.sound.midi.Sequencer.setLoopCount(int)

void setLoopCount(int count)
Sets the number of repetitions of the loop for playback. When the playback position reaches the loop end point, it will loop back to the loop start point count times, after which playback will continue to play to the end of the sequence.

If the current position when this method is invoked is greater than the loop end point, playback continues to the end of the sequence without looping, unless the loop end point is changed subsequently.

A count value of 0 disables looping: playback will continue at the loop end point, and it will not loop back to the loop start point. This is a sequencer's default.

If playback is stopped during looping, the current loop status is cleared; subsequent start requests are not affected by an interrupted loop operation.

Parameters:
count - the number of times playback should loop back from the loop's end position to the loop's start position, or LOOP_CONTINUOUSLY sample code for javax.sound.midi.Sequencer.LOOP_CONTINUOUSLY definition code for javax.sound.midi.Sequencer.LOOP_CONTINUOUSLY to indicate that looping should continue until interrupted
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if count is negative and not equal to LOOP_CONTINUOUSLY sample code for javax.sound.midi.Sequencer.LOOP_CONTINUOUSLY definition code for javax.sound.midi.Sequencer.LOOP_CONTINUOUSLY
Since:
1.5
See Also:
setLoopStartPoint(long) sample code for javax.sound.midi.Sequencer.setLoopStartPoint(long) definition code for javax.sound.midi.Sequencer.setLoopStartPoint(long) , setLoopEndPoint(long) sample code for javax.sound.midi.Sequencer.setLoopEndPoint(long) definition code for javax.sound.midi.Sequencer.setLoopEndPoint(long) , getLoopCount() sample code for javax.sound.midi.Sequencer.getLoopCount() definition code for javax.sound.midi.Sequencer.getLoopCount() , start() sample code for javax.sound.midi.Sequencer.start() definition code for javax.sound.midi.Sequencer.start()

getLoopCount sample code for javax.sound.midi.Sequencer.getLoopCount() definition code for javax.sound.midi.Sequencer.getLoopCount()

int getLoopCount()
Obtains the number of repetitions for playback.

Returns:
the number of loops after which playback plays to the end of the sequence
Since:
1.5
See Also:
setLoopCount(int) sample code for javax.sound.midi.Sequencer.setLoopCount(int) definition code for javax.sound.midi.Sequencer.setLoopCount(int) , start() sample code for javax.sound.midi.Sequencer.start() definition code for javax.sound.midi.Sequencer.start()