jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java
author chegar
Sun, 17 Aug 2014 15:54:13 +0100
changeset 25859 3317bb8137f4
parent 5506 jdk/src/share/classes/javax/sound/midi/Sequencer.java@202f599c92aa
child 26037 508779ce6619
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.sound.midi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * A hardware or software device that plays back a MIDI
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <code>{@link Sequence sequence}</code> is known as a <em>sequencer</em>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * A MIDI sequence contains lists of time-stamped MIDI data, such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * might be read from a standard MIDI file.  Most
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * sequencers also provide functions for creating and editing sequences.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * The <code>Sequencer</code> interface includes methods for the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * basic MIDI sequencer operations:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <li>obtaining a sequence from MIDI file data</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <li>starting and stopping playback</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <li>moving to an arbitrary position in the sequence</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <li>changing the tempo (speed) of playback</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <li>synchronizing playback to an internal clock or to received MIDI
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * messages</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * <li>controlling the timing of another device</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * In addition, the following operations are supported, either directly, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * indirectly through objects that the <code>Sequencer</code> has access to:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <li>editing the data by adding or deleting individual MIDI events or entire
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * tracks</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <li>muting or soloing individual tracks in the sequence</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * <li>notifying listener objects about any meta-events or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * control-change events encountered while playing back the sequence.</li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @see Sequencer.SyncMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * @see #addMetaEventListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * @see ControllerEventListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * @see Receiver
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * @see Transmitter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * @see MidiDevice
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * @author Kara Kytle
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * @author Florian Bomers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
public interface Sequencer extends MidiDevice {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * A value indicating that looping should continue
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * indefinitely rather than complete after a specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * number of loops.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @see #setLoopCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public static final int LOOP_CONTINUOUSLY = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * Sets the current sequence on which the sequencer operates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * <p>This method can be called even if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * <code>Sequencer</code> is closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @param sequence the sequence to be loaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @throws InvalidMidiDataException if the sequence contains invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * MIDI data, or is not supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public void setSequence(Sequence sequence) throws InvalidMidiDataException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * Sets the current sequence on which the sequencer operates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * The stream must point to MIDI file data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <p>This method can be called even if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * <code>Sequencer</code> is closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param stream stream containing MIDI file data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @throws IOException if an I/O exception occurs during reading of the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @throws InvalidMidiDataException if invalid data is encountered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * in the stream, or the stream is not supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    public void setSequence(InputStream stream) throws IOException, InvalidMidiDataException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * Obtains the sequence on which the Sequencer is currently operating.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * <p>This method can be called even if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * <code>Sequencer</code> is closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @return the current sequence, or <code>null</code> if no sequence is currently set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    public Sequence getSequence();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Starts playback of the MIDI data in the currently
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * loaded sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * Playback will begin from the current position.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * If the playback position reaches the loop end point,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * and the loop count is greater than 0, playback will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * resume at the loop start point for the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * repetitions set with <code>setLoopCount</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * After that, or if the loop count is 0, playback will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * continue to play to the end of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * <p>The implementation ensures that the synthesizer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * is brought to a consistent state when jumping
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * to the loop start point by sending appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * controllers, pitch bend, and program change events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * @throws IllegalStateException if the <code>Sequencer</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * @see #setLoopStartPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * @see #setLoopEndPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @see #setLoopCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * @see #stop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    public void start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * Stops recording, if active, and playback of the currently loaded sequence,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * if any.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @throws IllegalStateException if the <code>Sequencer</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @see #start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * @see #isRunning
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    public void stop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * Indicates whether the Sequencer is currently running.  The default is <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * The Sequencer starts running when either <code>{@link #start}</code> or <code>{@link #startRecording}</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * is called.  <code>isRunning</code> then returns <code>true</code> until playback of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * sequence completes or <code>{@link #stop}</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @return <code>true</code> if the Sequencer is running, otherwise <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    public boolean isRunning();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * Starts recording and playback of MIDI data.  Data is recorded to all enabled tracks,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * on the channel(s) for which they were enabled.  Recording begins at the current position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * of the sequencer.   Any events already in the track are overwritten for the duration
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * of the recording session.  Events from the currently loaded sequence,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * if any, are delivered to the sequencer's transmitter(s) along with messages
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * received during recording.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * Note that tracks are not by default enabled for recording.  In order to record MIDI data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * at least one track must be specifically enabled for recording.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * @throws IllegalStateException if the <code>Sequencer</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @see #startRecording
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @see #recordEnable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @see #recordDisable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    public void startRecording();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * Stops recording, if active.  Playback of the current sequence continues.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * @throws IllegalStateException if the <code>Sequencer</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * @see #startRecording
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * @see #isRecording
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    public void stopRecording();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * Indicates whether the Sequencer is currently recording.  The default is <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * The Sequencer begins recording when <code>{@link #startRecording}</code> is called,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * and then returns <code>true</code> until <code>{@link #stop}</code> or <code>{@link #stopRecording}</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * @return <code>true</code> if the Sequencer is recording, otherwise <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public boolean isRecording();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * Prepares the specified track for recording events received on a particular channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * Once enabled, a track will receive events when recording is active.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @param track the track to which events will be recorded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @param channel the channel on which events will be received.  If -1 is specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * for the channel value, the track will receive data from all channels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @throws IllegalArgumentException thrown if the track is not part of the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    public void recordEnable(Track track, int channel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * Disables recording to the specified track.  Events will no longer be recorded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * into this track.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * @param track the track to disable for recording, or <code>null</code> to disable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * recording for all tracks.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    public void recordDisable(Track track);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * Obtains the current tempo, expressed in beats per minute.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * actual tempo of playback is the product of the returned value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * and the tempo factor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @return the current tempo in beats per minute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @see #getTempoFactor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * @see #setTempoInBPM(float)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * @see #getTempoInMPQ
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    public float getTempoInBPM();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * Sets the tempo in beats per minute.   The actual tempo of playback
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * is the product of the specified value and the tempo factor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * @param bpm desired new tempo in beats per minute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * @see #getTempoFactor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @see #setTempoInMPQ(float)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * @see #getTempoInBPM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    public void setTempoInBPM(float bpm);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * Obtains the current tempo, expressed in microseconds per quarter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * note.  The actual tempo of playback is the product of the returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * value and the tempo factor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * @return the current tempo in microseconds per quarter note
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * @see #getTempoFactor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * @see #setTempoInMPQ(float)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * @see #getTempoInBPM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    public float getTempoInMPQ();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * Sets the tempo in microseconds per quarter note.  The actual tempo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * of playback is the product of the specified value and the tempo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * factor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @param mpq desired new tempo in microseconds per quarter note.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @see #getTempoFactor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * @see #setTempoInBPM(float)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @see #getTempoInMPQ
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    public void setTempoInMPQ(float mpq);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * Scales the sequencer's actual playback tempo by the factor provided.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * The default is 1.0.  A value of 1.0 represents the natural rate (the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * tempo specified in the sequence), 2.0 means twice as fast, etc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * The tempo factor does not affect the values returned by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * <code>{@link #getTempoInMPQ}</code> and <code>{@link #getTempoInBPM}</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * Those values indicate the tempo prior to scaling.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * Note that the tempo factor cannot be adjusted when external
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * synchronization is used.  In that situation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * <code>setTempoFactor</code> always sets the tempo factor to 1.0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * @param factor the requested tempo scalar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @see #getTempoFactor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    public void setTempoFactor(float factor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * Returns the current tempo factor for the sequencer.  The default is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * 1.0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * @return tempo factor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * @see #setTempoFactor(float)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    public float getTempoFactor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * Obtains the length of the current sequence, expressed in MIDI ticks,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * or 0 if no sequence is set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @return length of the sequence in ticks
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    public long getTickLength();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * Obtains the current position in the sequence, expressed in MIDI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * ticks.  (The duration of a tick in seconds is determined both by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * the tempo and by the timing resolution stored in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * <code>{@link Sequence}</code>.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * @return current tick
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * @see #setTickPosition
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    public long getTickPosition();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * Sets the current sequencer position in MIDI ticks
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * @param tick the desired tick position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * @see #getTickPosition
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    public void setTickPosition(long tick);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * Obtains the length of the current sequence, expressed in microseconds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * or 0 if no sequence is set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * @return length of the sequence in microseconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    public long getMicrosecondLength();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * Obtains the current position in the sequence, expressed in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * microseconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @return the current position in microseconds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * @see #setMicrosecondPosition
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    public long getMicrosecondPosition();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * Sets the current position in the sequence, expressed in microseconds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * @param microseconds desired position in microseconds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * @see #getMicrosecondPosition
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    public void setMicrosecondPosition(long microseconds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * Sets the source of timing information used by this sequencer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * The sequencer synchronizes to the master, which is the internal clock,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * MIDI clock, or MIDI time code, depending on the value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * <code>sync</code>.  The <code>sync</code> argument must be one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * of the supported modes, as returned by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * <code>{@link #getMasterSyncModes}</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @param sync the desired master synchronization mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @see SyncMode#INTERNAL_CLOCK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * @see SyncMode#MIDI_SYNC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * @see SyncMode#MIDI_TIME_CODE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * @see #getMasterSyncMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    public void setMasterSyncMode(SyncMode sync);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * Obtains the current master synchronization mode for this sequencer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * @return the current master synchronization mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * @see #setMasterSyncMode(Sequencer.SyncMode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * @see #getMasterSyncModes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    public SyncMode getMasterSyncMode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * Obtains the set of master synchronization modes supported by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * sequencer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * @return the available master synchronization modes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * @see SyncMode#INTERNAL_CLOCK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * @see SyncMode#MIDI_SYNC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * @see SyncMode#MIDI_TIME_CODE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * @see #getMasterSyncMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * @see #setMasterSyncMode(Sequencer.SyncMode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    public SyncMode[] getMasterSyncModes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * Sets the slave synchronization mode for the sequencer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * This indicates the type of timing information sent by the sequencer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * to its receiver.  The <code>sync</code> argument must be one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * of the supported modes, as returned by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * <code>{@link #getSlaveSyncModes}</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * @param sync the desired slave synchronization mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * @see SyncMode#MIDI_SYNC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @see SyncMode#MIDI_TIME_CODE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * @see SyncMode#NO_SYNC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * @see #getSlaveSyncModes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    public void setSlaveSyncMode(SyncMode sync);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * Obtains the current slave synchronization mode for this sequencer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * @return the current slave synchronization mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * @see #setSlaveSyncMode(Sequencer.SyncMode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * @see #getSlaveSyncModes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    public SyncMode getSlaveSyncMode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * Obtains the set of slave synchronization modes supported by the sequencer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * @return the available slave synchronization modes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * @see SyncMode#MIDI_SYNC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     * @see SyncMode#MIDI_TIME_CODE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * @see SyncMode#NO_SYNC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    public SyncMode[] getSlaveSyncModes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     * Sets the mute state for a track.  This method may fail for a number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     * of reasons.  For example, the track number specified may not be valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * for the current sequence, or the sequencer may not support this functionality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * An application which needs to verify whether this operation succeeded should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * follow this call with a call to <code>{@link #getTrackMute}</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * @param track the track number.  Tracks in the current sequence are numbered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * from 0 to the number of tracks in the sequence minus 1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * @param mute the new mute state for the track.  <code>true</code> implies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * track should be muted, <code>false</code> implies the track should be unmuted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * @see #getSequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    public void setTrackMute(int track, boolean mute);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * Obtains the current mute state for a track.  The default mute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * state for all tracks which have not been muted is false.  In any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * case where the specified track has not been muted, this method should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * return false.  This applies if the sequencer does not support muting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * of tracks, and if the specified track index is not valid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     * @param track the track number.  Tracks in the current sequence are numbered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * from 0 to the number of tracks in the sequence minus 1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * @return <code>true</code> if muted, <code>false</code> if not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
    public boolean getTrackMute(int track);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     * Sets the solo state for a track.  If <code>solo</code> is <code>true</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     * only this track and other solo'd tracks will sound. If <code>solo</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     * is <code>false</code> then only other solo'd tracks will sound, unless no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     * tracks are solo'd in which case all un-muted tracks will sound.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * This method may fail for a number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     * of reasons.  For example, the track number specified may not be valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     * for the current sequence, or the sequencer may not support this functionality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * An application which needs to verify whether this operation succeeded should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     * follow this call with a call to <code>{@link #getTrackSolo}</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     * @param track the track number.  Tracks in the current sequence are numbered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * from 0 to the number of tracks in the sequence minus 1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     * @param solo the new solo state for the track.  <code>true</code> implies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * track should be solo'd, <code>false</code> implies the track should not be solo'd.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * @see #getSequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    public void setTrackSolo(int track, boolean solo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     * Obtains the current solo state for a track.  The default mute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     * state for all tracks which have not been solo'd is false.  In any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
     * case where the specified track has not been solo'd, this method should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     * return false.  This applies if the sequencer does not support soloing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * of tracks, and if the specified track index is not valid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * @param track the track number.  Tracks in the current sequence are numbered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * from 0 to the number of tracks in the sequence minus 1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * @return <code>true</code> if solo'd, <code>false</code> if not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
    public boolean getTrackSolo(int track);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * Registers a meta-event listener to receive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * notification whenever a meta-event is encountered in the sequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * and processed by the sequencer. This method can fail if, for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     * instance,this class of sequencer does not support meta-event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     * notification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     * @param listener listener to add
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     * @return <code>true</code> if the listener was successfully added,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     * otherwise <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
     * @see #removeMetaEventListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     * @see MetaEventListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * @see MetaMessage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    public boolean addMetaEventListener(MetaEventListener listener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     * Removes the specified meta-event listener from this sequencer's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     * list of registered listeners, if in fact the listener is registered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * @param listener the meta-event listener to remove
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * @see #addMetaEventListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    public void removeMetaEventListener(MetaEventListener listener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     * Registers a controller event listener to receive notification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     * whenever the sequencer processes a control-change event of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     * requested type or types.  The types are specified by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     * <code>controllers</code> argument, which should contain an array of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     * MIDI controller numbers.  (Each number should be between 0 and 127,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     * inclusive.  See the MIDI 1.0 Specification for the numbers that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     * correspond to various types of controllers.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     * The returned array contains the MIDI controller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     * numbers for which the listener will now receive events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     * Some sequencers might not support controller event notification, in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     * which case the array has a length of 0.  Other sequencers might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     * support notification for some controllers but not all.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     * This method may be invoked repeatedly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * Each time, the returned array indicates all the controllers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * that the listener will be notified about, not only the controllers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     * requested in that particular invocation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     * @param listener the controller event listener to add to the list of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     * registered listeners
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     * @param controllers the MIDI controller numbers for which change
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     * notification is requested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * @return the numbers of all the MIDI controllers whose changes will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     * now be reported to the specified listener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
     * @see #removeControllerEventListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
     * @see ControllerEventListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    public int[] addControllerEventListener(ControllerEventListener listener, int[] controllers);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     * Removes a controller event listener's interest in one or more
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     * types of controller event. The <code>controllers</code> argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * is an array of MIDI numbers corresponding to the  controllers for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     * which the listener should no longer receive change notifications.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     * To completely remove this listener from the list of registered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     * listeners, pass in <code>null</code> for <code>controllers</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * The returned array contains the MIDI controller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * numbers for which the listener will now receive events.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     * array has a length of 0 if the listener will not receive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     * change notifications for any controllers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     * @param listener old listener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     * @param controllers the MIDI controller numbers for which change
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * notification should be cancelled, or <code>null</code> to cancel
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     * for all controllers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     * @return the numbers of all the MIDI controllers whose changes will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * now be reported to the specified listener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * @see #addControllerEventListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
    public int[] removeControllerEventListener(ControllerEventListener listener, int[] controllers);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
     * Sets the first MIDI tick that will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     * played in the loop. If the loop count is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
     * greater than 0, playback will jump to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * point when reaching the loop end point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * <p>A value of 0 for the starting point means the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * beginning of the loaded sequence. The starting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     * point must be lower than or equal to the ending
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     * point, and it must fall within the size of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     * loaded sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     * <p>A sequencer's loop start point defaults to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * start of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     * @param tick the loop's starting position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     *        in MIDI ticks (zero-based)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * @throws IllegalArgumentException if the requested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     *         loop start point cannot be set, usually because
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     *         it falls outside the sequence's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     *         duration or because the start point is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     *         after the end point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     * @see #setLoopEndPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     * @see #setLoopCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     * @see #getLoopStartPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     * @see #start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
    public void setLoopStartPoint(long tick);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     * Obtains the start position of the loop,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
     * in MIDI ticks.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     * @return the start position of the loop,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
               in MIDI ticks (zero-based)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     * @see #setLoopStartPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
    public long getLoopStartPoint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
     * Sets the last MIDI tick that will be played in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
     * the loop. If the loop count is 0, the loop end
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     * point has no effect and playback continues to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     * play when reaching the loop end point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     * <p>A value of -1 for the ending point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     * indicates the last tick of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
     * Otherwise, the ending point must be greater
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
     * than or equal to the starting point, and it must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
     * fall within the size of the loaded sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     * <p>A sequencer's loop end point defaults to -1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     * meaning the end of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     * @param tick the loop's ending position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
     *        in MIDI ticks (zero-based), or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     *        -1 to indicate the final tick
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     * @throws IllegalArgumentException if the requested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
     *         loop point cannot be set, usually because
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     *         it falls outside the sequence's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     *         duration or because the ending point is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     *         before the starting point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * @see #setLoopStartPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * @see #setLoopCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * @see #getLoopEndPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     * @see #start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
    public void setLoopEndPoint(long tick);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     * Obtains the end position of the loop,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     * in MIDI ticks.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     * @return the end position of the loop, in MIDI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     *         ticks (zero-based), or -1 to indicate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     *         the end of the sequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * @see #setLoopEndPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
    public long getLoopEndPoint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
     * Sets the number of repetitions of the loop for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * playback.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     * When the playback position reaches the loop end point,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     * it will loop back to the loop start point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     * <code>count</code> times, after which playback will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
     * continue to play to the end of the sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
     * If the current position when this method is invoked
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
     * is greater than the loop end point, playback
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
     * continues to the end of the sequence without looping,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
     * unless the loop end point is changed subsequently.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * A <code>count</code> value of 0 disables looping:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * playback will continue at the loop end point, and it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * will not loop back to the loop start point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * This is a sequencer's default.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * <p>If playback is stopped during looping, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     * current loop status is cleared; subsequent start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * requests are not affected by an interrupted loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     * @param count the number of times playback should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     *        loop back from the loop's end position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     *        to the loop's start position, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
     *        <code>{@link #LOOP_CONTINUOUSLY}</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
     *        to indicate that looping should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
     *        continue until interrupted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
     * @throws IllegalArgumentException if <code>count</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
     * negative and not equal to {@link #LOOP_CONTINUOUSLY}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
     * @see #setLoopStartPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
     * @see #setLoopEndPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * @see #getLoopCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     * @see #start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
    public void setLoopCount(int count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
     * Obtains the number of repetitions for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * playback.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     * @return the number of loops after which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     *         playback plays to the end of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     *         sequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     * @see #setLoopCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     * @see #start
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
    public int getLoopCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     * A <code>SyncMode</code> object represents one of the ways in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     * a MIDI sequencer's notion of time can be synchronized with a master
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * or slave device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     * If the sequencer is being synchronized to a master, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     * sequencer revises its current time in response to messages from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     * the master.  If the sequencer has a slave, the sequencer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
     * similarly sends messages to control the slave's timing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     * There are three predefined modes that specify possible masters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     * for a sequencer: <code>INTERNAL_CLOCK</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     * <code>MIDI_SYNC</code>, and <code>MIDI_TIME_CODE</code>.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
     * latter two work if the sequencer receives MIDI messages from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
     * another device.  In these two modes, the sequencer's time gets reset
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     * based on system real-time timing clock messages or MIDI time code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
     * (MTC) messages, respectively.  These two modes can also be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     * as slave modes, in which case the sequencer sends the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     * types of MIDI messages to its receiver (whether or not the sequencer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     * is also receiving them from a master).  A fourth mode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     * <code>NO_SYNC</code>, is used to indicate that the sequencer should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     * not control its receiver's timing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     * @see Sequencer#setMasterSyncMode(Sequencer.SyncMode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     * @see Sequencer#setSlaveSyncMode(Sequencer.SyncMode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
    public static class SyncMode {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
         * Synchronization mode name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
        private String name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
         * Constructs a synchronization mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
         * @param name name of the synchronization mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
        protected SyncMode(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
            this.name = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
         * Determines whether two objects are equal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
         * Returns <code>true</code> if the objects are identical
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
         * @param obj the reference object with which to compare
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
         * @return <code>true</code> if this object is the same as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
         * <code>obj</code> argument, <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
        public final boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
            return super.equals(obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
         * Finalizes the hashcode method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
        public final int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
            return super.hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
         * Provides this synchronization mode's name as the string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
         * representation of the mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
         * @return the name of this synchronization mode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
        public final String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
            return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
         * A master synchronization mode that makes the sequencer get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
         * its timing information from its internal clock.  This is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
         * a legal slave sync mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
        public static final SyncMode INTERNAL_CLOCK             = new SyncMode("Internal Clock");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
         * A master or slave synchronization mode that specifies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
         * use of MIDI clock
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
         * messages.  If this mode is used as the master sync mode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
         * the sequencer gets its timing information from system real-time
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
         * MIDI clock messages.  This mode only applies as the master sync
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
         * mode for sequencers that are also MIDI receivers.  If this is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
         * slave sync mode, the sequencer sends system real-time MIDI clock
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
         * messages to its receiver.  MIDI clock messages are sent at a rate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
         * of 24 per quarter note.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
        public static final SyncMode MIDI_SYNC                  = new SyncMode("MIDI Sync");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
         * A master or slave synchronization mode that specifies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
         * use of MIDI Time Code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
         * If this mode is used as the master sync mode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
         * the sequencer gets its timing information from MIDI Time Code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
         * messages.  This mode only applies as the master sync
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
         * mode to sequencers that are also MIDI receivers.  If this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
         * mode is used as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
         * slave sync mode, the sequencer sends MIDI Time Code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
         * messages to its receiver.  (See the MIDI 1.0 Detailed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
         * Specification for a description of MIDI Time Code.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
        public static final SyncMode MIDI_TIME_CODE             = new SyncMode("MIDI Time Code");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
         * A slave synchronization mode indicating that no timing information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
         * should be sent to the receiver.  This is not a legal master sync
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
         * mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
        public static final SyncMode NO_SYNC                            = new SyncMode("No Timing");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
    } // class SyncMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
}