|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

public interface Sequencer

A hardware or software device that plays back a MIDI
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.
sequence

The Sequencer interface includes methods for the following
basic MIDI sequencer operations:
Sequencer has access to:
Sequencer.SyncMode
,
addMetaEventListener(javax.sound.midi.MetaEventListener)
,
ControllerEventListener
,
Receiver
,
Transmitter
,
MidiDevice

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

static final int LOOP_CONTINUOUSLY
setLoopCount(int)
,
Constant Field Values| Method Detail |
|---|

void setSequence(Sequence![]()
![]()
sequence) throws InvalidMidiDataException
![]()
![]()
This method can be called even if the
Sequencer is closed.
sequence - the sequence to be loaded.
InvalidMidiDataException

- if the sequence contains invalid
MIDI data, or is not supported.

void setSequence(InputStream![]()
![]()
stream) throws IOException
![]()
![]()
, InvalidMidiDataException
![]()
![]()
This method can be called even if the
Sequencer is closed.
stream - stream containing MIDI file data.
IOException

- if an I/O exception occurs during reading of the stream.
InvalidMidiDataException

- if invalid data is encountered
in the stream, or the stream is not supported.

Sequence![]()
![]()
getSequence()
This method can be called even if the
Sequencer is closed.
null if no sequence is currently set.

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

- if the Sequencer is
closed.setLoopStartPoint(long)
,
setLoopEndPoint(long)
,
setLoopCount(int)
,
stop()


void stop()
IllegalStateException

- if the Sequencer is
closed.start()
,
isRunning()


boolean isRunning()
false.
The Sequencer starts running when either start()

or startRecording()

is called. isRunning then returns true until playback of the
sequence completes or stop()

is called.
true if the Sequencer is running, otherwise false

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

- if the Sequencer is
closed.startRecording()
,
recordEnable(javax.sound.midi.Track, int)
,
recordDisable(javax.sound.midi.Track)


void stopRecording()
IllegalStateException

- if the Sequencer is
closed.startRecording()
,
isRecording()


boolean isRecording()
false.
The Sequencer begins recording when startRecording()

is called,
and then returns true until stop()

or stopRecording()

is called.
true if the Sequencer is recording, otherwise false

void recordEnable(Track![]()
![]()
track, int channel)
track - the track to which events will be recordedchannel - the channel on which events will be received. If -1 is specified
for the channel value, the track will receive data from all channels.
IllegalArgumentException

- thrown if the track is not part of the current
sequence.

void recordDisable(Track![]()
![]()
track)
track - the track to disable for recording, or null to disable
recording for all tracks.

float getTempoInBPM()
getTempoFactor()
,
setTempoInBPM(float)
,
getTempoInMPQ()


void setTempoInBPM(float bpm)
bpm - desired new tempo in beats per minutegetTempoFactor()
,
setTempoInMPQ(float)
,
getTempoInBPM()


float getTempoInMPQ()
getTempoFactor()
,
setTempoInMPQ(float)
,
getTempoInBPM()


void setTempoInMPQ(float mpq)
mpq - desired new tempo in microseconds per quarter note.getTempoFactor()
