public class Track extends Object
Track occupies a middle level in the hierarchy of data played
: sequencers play sequences, which contain tracks,
which contain MIDI events. A sequencer may provide controls that mute
or solo individual tracks.
The timing information and resolution for a track is controlled by and stored
in the sequence containing the track. A given
is considered to belong to the particular
maintains its timing. For this reason, a new (empty) track is created by calling the
method, rather than by directly invoking a
Track class provides methods to edit the track by adding
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.
|Modifier and Type||Method and Description|
Adds a new event to the track.
Obtains the event at the specified index.
Removes the specified event from the track.
Obtains the number of events in this track.
Obtains the length of the track, expressed in MIDI ticks.
public boolean add(MidiEvent event)
event- the event to add
trueif the event did not already exist in the track and was added, otherwise
public boolean remove(MidiEvent event)
event- the event to remove
trueif the event existed in the track and was removed, otherwise
public MidiEvent get(int index) throws ArrayIndexOutOfBoundsException
public int size()
public long ticks()
Sequencecontaining this track, and also by the tempo of the music as set by the sequencer.)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.