001package net.kreatious.pianoleopard.midi.track;
002
003import net.kreatious.pianoleopard.midi.event.EventPair;
004import net.kreatious.pianoleopard.midi.event.NoteEvent;
005import net.kreatious.pianoleopard.midi.event.PedalEvent;
006
007
008/**
009 * Provides an immutable view of a MIDI track with efficient retrieval by time
010 * range.
011 *
012 * @author Jay-R Studer
013 */
014public interface ParsedTrack {
015    /**
016     * Gets the note event pairs overlapping with the specified interval
017     *
018     * @param low
019     *            the lower inclusive bound to return events for in microseconds
020     * @param high
021     *            the upper inclusive bound to return events for in microseconds
022     * @throws IllegalArgumentException
023     *             if {@code low} is greater than {@code high}
024     * @return a read only view of the portion of events overlapping the
025     *         specified interval.
026     */
027    Iterable<EventPair<NoteEvent>> getNotePairs(long low, long high);
028
029    /**
030     * Gets the pedal event pairs overlapping with the specified interval
031     *
032     * @param low
033     *            the lower inclusive bound to return events for in microseconds
034     * @param high
035     *            the upper inclusive bound to return events for in microseconds
036     * @throws IllegalArgumentException
037     *             if {@code low} is greater than {@code high}
038     * @return a read only view of the portion of events overlapping the
039     *         specified interval.
040     */
041    Iterable<EventPair<PedalEvent>> getPedalPairs(long low, long high);
042}