jdk/src/share/classes/javax/sound/sampled/Clip.java
author prr
Wed, 18 Jun 2014 13:14:15 -0700
changeset 25144 e2bf17cee34b
parent 25128 2dfdfa369071
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
     2
 * Copyright (c) 1999, 2014, 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.sampled;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    31
 * The {@code Clip} interface represents a special kind of data line whose audio
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    32
 * data can be loaded prior to playback, instead of being streamed in real time.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    34
 * Because the data is pre-loaded and has a known length, you can set a clip to
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    35
 * start playing at any position in its audio data. You can also create a loop,
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    36
 * so that when the clip is played it will cycle repeatedly. Loops are specified
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    37
 * with a starting and ending sample frame, along with the number of times that
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    38
 * the loop should be played.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    40
 * Clips may be obtained from a {@link Mixer} that supports lines of this type.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    41
 * Data is loaded into a clip when it is opened.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    43
 * Playback of an audio clip may be started and stopped using the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    44
 * {@link #start start} and {@link #stop stop} methods. These methods do not
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    45
 * reset the media position; {@code start} causes playback to continue from the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    46
 * position where playback was last stopped. To restart playback from the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    47
 * beginning of the clip's audio data, simply follow the invocation of
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    48
 * {@code stop} with {@code setFramePosition(0)}, which rewinds the media to the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    49
 * beginning of the clip.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @author Kara Kytle
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
public interface Clip extends DataLine {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * A value indicating that looping should continue indefinitely rather than
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * complete after a specific number of loops.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    59
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @see #loop
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    62
    int LOOP_CONTINUOUSLY = -1;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    65
     * Opens the clip, meaning that it should acquire any required system
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    66
     * resources and become operational. The clip is opened with the format and
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    67
     * audio data indicated. If this operation succeeds, the line is marked as
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    68
     * open and an {@link LineEvent.Type#OPEN OPEN} event is dispatched to the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    69
     * line's listeners.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    71
     * Invoking this method on a line which is already open is illegal and may
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    72
     * result in an {@code IllegalStateException}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    74
     * Note that some lines, once closed, cannot be reopened. Attempts to reopen
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    75
     * such a line will always result in a {@code LineUnavailableException}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     *
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    77
     * @param  format the format of the supplied audio data
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    78
     * @param  data a byte array containing audio data to load into the clip
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    79
     * @param  offset the point at which to start copying, expressed in
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    80
     *         <em>bytes</em> from the beginning of the array
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    81
     * @param  bufferSize the number of <em>bytes</em> of data to load into the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    82
     *         clip from the array
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    83
     * @throws LineUnavailableException if the line cannot be opened due to
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    84
     *         resource restrictions
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    85
     * @throws IllegalArgumentException if the buffer size does not represent an
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    86
     *         integral number of sample frames, or if {@code format} is not
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    87
     *         fully specified or invalid
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * @throws IllegalStateException if the line is already open
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    89
     * @throws SecurityException if the line cannot be opened due to security
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    90
     *         restrictions
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @see #close
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @see #isOpen
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * @see LineListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    95
    void open(AudioFormat format, byte[] data, int offset, int bufferSize)
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    96
            throws LineUnavailableException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
    99
     * Opens the clip with the format and audio data present in the provided
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   100
     * audio input stream. Opening a clip means that it should acquire any
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   101
     * required system resources and become operational. If this operation input
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   102
     * stream. If this operation succeeds, the line is marked open and an
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   103
     * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   104
     * listeners.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   106
     * Invoking this method on a line which is already open is illegal and may
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   107
     * result in an {@code IllegalStateException}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   109
     * Note that some lines, once closed, cannot be reopened. Attempts to reopen
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   110
     * such a line will always result in a {@code LineUnavailableException}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   112
     * @param  stream an audio input stream from which audio data will be read
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   113
     *         into the clip
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   114
     * @throws LineUnavailableException if the line cannot be opened due to
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   115
     *         resource restrictions
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   116
     * @throws IOException if an I/O exception occurs during reading of the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   117
     *         stream
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   118
     * @throws IllegalArgumentException if the stream's audio format is not
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   119
     *         fully specified or invalid
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @throws IllegalStateException if the line is already open
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   121
     * @throws SecurityException if the line cannot be opened due to security
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   122
     *         restrictions
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @see #close
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @see #isOpen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * @see LineListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   127
    void open(AudioInputStream stream)
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   128
            throws LineUnavailableException, IOException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * Obtains the media length in sample frames.
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   132
     *
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   133
     * @return the media length, expressed in sample frames, or
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   134
     *         {@code AudioSystem.NOT_SPECIFIED} if the line is not open
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @see AudioSystem#NOT_SPECIFIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   137
    int getFrameLength();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   140
     * Obtains the media duration in microseconds.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   141
     *
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   142
     * @return the media duration, expressed in microseconds, or
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   143
     *         {@code AudioSystem.NOT_SPECIFIED} if the line is not open
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * @see AudioSystem#NOT_SPECIFIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   146
    long getMicrosecondLength();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   149
     * Sets the media position in sample frames. The position is zero-based; the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   150
     * first frame is frame number zero. When the clip begins playing the next
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   151
     * time, it will start by playing the frame at this position.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * To obtain the current position in sample frames, use the
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   154
     * {@link DataLine#getFramePosition getFramePosition} method of
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   155
     * {@code DataLine}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     *
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   157
     * @param  frames the desired new media position, expressed in sample frames
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   159
    void setFramePosition(int frames);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   162
     * Sets the media position in microseconds. When the clip begins playing the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   163
     * next time, it will start at this position. The level of precision is not
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   164
     * guaranteed. For example, an implementation might calculate the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   165
     * microsecond position from the current frame position and the audio sample
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   166
     * frame rate. The precision in microseconds would then be limited to the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   167
     * number of microseconds per sample frame.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * To obtain the current position in microseconds, use the
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   170
     * {@link DataLine#getMicrosecondPosition getMicrosecondPosition} method of
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   171
     * {@code DataLine}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     *
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   173
     * @param  microseconds the desired new media position, expressed in
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   174
     *         microseconds
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   176
    void setMicrosecondPosition(long microseconds);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   179
     * Sets the first and last sample frames that will be played in the loop.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   180
     * The ending point must be greater than or equal to the starting point, and
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   181
     * both must fall within the the size of the loaded media. A value of 0 for
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   182
     * the starting point means the beginning of the loaded media. Similarly, a
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   183
     * value of -1 for the ending point indicates the last frame of the media.
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   184
     *
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   185
     * @param  start the loop's starting position, in sample frames (zero-based)
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   186
     * @param  end the loop's ending position, in sample frames (zero-based),
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   187
     *         or -1 to indicate the final frame
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   188
     * @throws IllegalArgumentException if the requested loop points cannot be
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   189
     *         set, usually because one or both falls outside the media's
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   190
     *         duration or because the ending point is before the starting point
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   192
    void setLoopPoints(int start, int end);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    /**
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   195
     * Starts looping playback from the current position. Playback will continue
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   196
     * to the loop's end point, then loop back to the loop start point
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   197
     * {@code count} times, and finally continue playback to the end of the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   198
     * clip.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * If the current position when this method is invoked is greater than the
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   201
     * loop end point, playback simply continues to the end of the clip without
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   202
     * looping.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * <p>
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   204
     * A {@code count} value of 0 indicates that any current looping should
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   205
     * cease and playback should continue to the end of the clip. The behavior
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * is undefined when this method is invoked with any other value during a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * loop operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * If playback is stopped during looping, the current loop status is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * cleared; the behavior of subsequent loop and start requests is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * affected by an interrupted loop operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     *
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   213
     * @param  count the number of times playback should loop back from the
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   214
     *         loop's end position to the loop's start position, or
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   215
     *         {@link #LOOP_CONTINUOUSLY} to indicate that looping should
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   216
     *         continue until interrupted
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
25128
2dfdfa369071 8043979: Javadoc cleanup of javax.sound.sampled package
serb
parents: 5506
diff changeset
   218
    void loop(int count);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
}