|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.sound.midi.Track
A MIDI track is an independent stream of MIDI events (time-stamped MIDI data) that can be stored along with other tracks in a standard MIDI file. The MIDI specification allows only 16 channels of MIDI data, but tracks are a way to get around this limitation. A MIDI file can contain any number of tracks, each containing its own stream of up to 16 channels of MIDI data.
A Track
occupies a middle level in the hierarchy of data played
by a
: sequencers play sequences, which contain tracks,
which contain MIDI events. A sequencer may provide controls that mute
or solo individual tracks.
Sequencer
The timing information and resolution for a track is controlled by and stored
in the sequence containing the track. A given Track
is considered to belong to the particular
that
maintains its timing. For this reason, a new (empty) track is created by calling the
Sequence
method, rather than by directly invoking a
Sequence.createTrack()
Track
constructor.
The Track
class provides methods to edit the track by adding
or removing MidiEvent
objects from it. These operations keep
the event list in the correct time order. Methods are also
included to obtain the track's size, in terms of either the number of events
it contains or its duration in ticks.
Sequencer.setTrackMute(int, boolean)
,
Sequencer.setTrackSolo(int, boolean)
Field Summary | |
protected Vector |
events
The list of MidiEvents contained in this track. |
Method Summary | |
boolean |
add(MidiEvent event)
Adds a new event to the track. |
MidiEvent |
get(int index)
Obtains the event at the specified index. |
boolean |
remove(MidiEvent event)
Removes the specified event from the track. |
int |
size()
Obtains the number of events in this track. |
long |
ticks()
Obtains the length of the track, expressed in MIDI ticks. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Vector events
MidiEvents
contained in this track.Method Detail |
public boolean add(MidiEvent event)
event
- the event to addtrue
if the event did not already exist in the
track and was added, otherwise false
public boolean remove(MidiEvent event)
event
- the event to removetrue
if the event existed in the track and was removed,
otherwise false
public MidiEvent get(int index) throws ArrayIndexOutOfBoundsException
index
- the location of the desired event in the event vectorArrayIndexOutOfBoundsException
- if the
specified index is negative or not less than the current size of
this track.size()
public int size()
public long ticks()
Sequence
containing this track, and also by
the tempo of the music as set by the sequencer.)Sequence.Sequence(float, int)
,
Sequencer.setTempoInBPM(float)
,
Sequencer.getTickPosition()
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.