javax.sound.midi
Interface Sequencer
- AutoCloseable, MidiDevice
- AlsaMidiSequencerDevice
A Sequencer object plays MIDI sequences described as Sequence objects.
This class provides methods for loading and unloading sequences, as well
as basic transport controls.
static class | Sequencer.SyncMode - A SyncMode object represents the mechanism by which a MIDI sequencer
synchronizes time with a master or slave device.
|
addControllerEventListener
public int[] addControllerEventListener(ControllerEventListener listener,
controllers[] )
Add a controller event listening object to this sequencer. It will
receive notification whenever the sequencer processes a controller
event for a specified controller number..
listener
- the listener to add
- the controller numbers being listened to
addMetaEventListener
public boolean addMetaEventListener(MetaEventListener listener)
Add a meta event listening object to this sequencer. It will receive
notification whenever the sequencer processes a meta event.
A listener may fail to get added if this sequencer doesn't support
meta events.
listener
- the listener to add
- true if listener was added, false othewise
getMasterSyncModes
public Sequencer.SyncMode[] getMasterSyncModes()
Get an array of timing sources supported by this sequencer.
- an array of timing sources supported by this sequencer
getMicrosecondLength
public long getMicrosecondLength()
Get the length of the current sequence in microseconds.
- the length of the current sequence in microseconds
getSequence
public Sequence getSequence()
Get the current sequence object for this sequencer.
- the current sequence object. May be null.
getSlaveSyncModes
public Sequencer.SyncMode[] getSlaveSyncModes()
Get an array of slave sync modes supported by this sequencer.
- an array of slave sync modes supported by this sequencer
getTempoFactor
public float getTempoFactor()
Get the current scaling factor for the playback tempo.
- the current tempo scaling factor
getTempoInBPM
public float getTempoInBPM()
Get the current tempo in beats per minute.
- the current tempo in beats per minute
getTempoInMPQ
public float getTempoInMPQ()
Get the current tempo in microseconds per quarter note.
- the current tempo in microseconds per quarter note.
getTickLength
public long getTickLength()
Get the length of the current sequence in MIDI ticks.
- the length of the current sequence in MIDI ticks
getTickPosition
public long getTickPosition()
Get the current playback position of the sequencer in MIDI ticks.
- the current playback position of the sequencer in MIDI ticks
getTrackMute
public boolean getTrackMute(int track)
Get the mute state of a specific track.
track
- the track to query
getTrackSolo
public boolean getTrackSolo(int track)
Get the solo state for a specific track.
track
- the track to query
isRecording
public boolean isRecording()
Returns true if sequence is recording.
- true if the sequence is recording and false otherwise
isRunning
public boolean isRunning()
Returns true if the sequence is playing.
- true if the sequence is playing and false otherwise
recordDisable
public void recordDisable(Track track)
Disable recording for a specific track.
track
- the track to disable recording for
recordEnable
public void recordEnable(Track track,
int channel)
Enable recording for a specific track using data from a specific channel.
track
- the track to enable for recordingchannel
- the channel from which to record
removeControllerEventListener
public int[] removeControllerEventListener(ControllerEventListener listener,
controllers[] )
Remove a controller listener from this sequencer for the specified
controller numbers.
listener
- the listener to remove
- the controller numbers being unlistened
setMasterSyncMode
public void setMasterSyncMode(Sequencer.SyncMode sync)
Set the source of timing information. sync must be found in the array
returned by getMasterSyncModes().
FIXME: What happens if it isn't?
sync
- the new source of timing information
setMicrosecondPosition
public void setMicrosecondPosition(long microsecond)
Set the current playback position of the sequencer in microseconds.
microsecond
- the new playback position of the sequencer in microseconds
setSlaveSyncMode
public void setSlaveSyncMode(Sequencer.SyncMode sync)
Set the slave synchronization mode for this sequencer. sync must be
found in the array returned by getSlaveSyncModes().
FIXME: What happens if it isn't?
sync
- the new slave sync mode for this sequencer
setTempoFactor
public void setTempoFactor(float factor)
Set a scaling factor for the playback tempo, which is 1.0 by default.
factor
- the new tempo scaling factor
setTempoInBPM
public void setTempoInBPM(float bpm)
Sets the current tempo in beats per minute.
bpm
- the new tempo in bears per minutes
setTempoInMPQ
public void setTempoInMPQ(float mpq)
Sets the current tempo in microseconds per quarter note.
mpq
- the new tempo in microseconds per quarter note.
setTickPosition
public void setTickPosition(long tick)
Set the current playback position of the sequencer in MIDI ticks.
tick
- the new playback position of the sequencer in MIDI ticks
setTrackMute
public void setTrackMute(int track,
boolean mute)
Sets the mute state for a specific track.
track
- the track to modifymute
- the new mute state
setTrackSolo
public void setTrackSolo(int track,
boolean solo)
Sets the solo state for a specific track.
track
- the track to modifysolo
- the new solo state
start
public void start()
Start playback of the current sequence.
startRecording
public void startRecording()
Start playback and record of MIDI events.
Any tracks enabled for recording will have their events replaced.
Any newly recorded events, and all events from non-recording tracks
will be sent to the sequencer's transmitter.
stop
public void stop()
Stop playback of the current sequence.
stopRecording
public void stopRecording()
Stop recording, although continue playing.
Sequencer.java -- A MIDI sequencer object
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.