< prev index next >

src/java.desktop/share/classes/javax/sound/sampled/Clip.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 161     /**
 162      * Sets the media position in microseconds. When the clip begins playing the
 163      * next time, it will start at this position. The level of precision is not
 164      * guaranteed. For example, an implementation might calculate the
 165      * microsecond position from the current frame position and the audio sample
 166      * frame rate. The precision in microseconds would then be limited to the
 167      * number of microseconds per sample frame.
 168      * <p>
 169      * To obtain the current position in microseconds, use the
 170      * {@link DataLine#getMicrosecondPosition getMicrosecondPosition} method of
 171      * {@code DataLine}.
 172      *
 173      * @param  microseconds the desired new media position, expressed in
 174      *         microseconds
 175      */
 176     void setMicrosecondPosition(long microseconds);
 177 
 178     /**
 179      * Sets the first and last sample frames that will be played in the loop.
 180      * The ending point must be greater than or equal to the starting point, and
 181      * both must fall within the size of the loaded media. A value of 0 for
 182      * the starting point means the beginning of the loaded media. Similarly, a
 183      * value of -1 for the ending point indicates the last frame of the media.
 184      *
 185      * @param  start the loop's starting position, in sample frames (zero-based)
 186      * @param  end the loop's ending position, in sample frames (zero-based),
 187      *         or -1 to indicate the final frame
 188      * @throws IllegalArgumentException if the requested loop points cannot be
 189      *         set, usually because one or both falls outside the media's
 190      *         duration or because the ending point is before the starting point
 191      */
 192     void setLoopPoints(int start, int end);
 193 
 194     /**
 195      * Starts looping playback from the current position. Playback will continue
 196      * to the loop's end point, then loop back to the loop start point
 197      * {@code count} times, and finally continue playback to the end of the
 198      * clip.
 199      * <p>
 200      * If the current position when this method is invoked is greater than the
 201      * loop end point, playback simply continues to the end of the clip without
 202      * looping.
 203      * <p>
 204      * A {@code count} value of 0 indicates that any current looping should
 205      * cease and playback should continue to the end of the clip. The behavior
 206      * is undefined when this method is invoked with any other value during a
 207      * loop operation.
   1 /*
   2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 161     /**
 162      * Sets the media position in microseconds. When the clip begins playing the
 163      * next time, it will start at this position. The level of precision is not
 164      * guaranteed. For example, an implementation might calculate the
 165      * microsecond position from the current frame position and the audio sample
 166      * frame rate. The precision in microseconds would then be limited to the
 167      * number of microseconds per sample frame.
 168      * <p>
 169      * To obtain the current position in microseconds, use the
 170      * {@link DataLine#getMicrosecondPosition getMicrosecondPosition} method of
 171      * {@code DataLine}.
 172      *
 173      * @param  microseconds the desired new media position, expressed in
 174      *         microseconds
 175      */
 176     void setMicrosecondPosition(long microseconds);
 177 
 178     /**
 179      * Sets the first and last sample frames that will be played in the loop.
 180      * The ending point must be greater than or equal to the starting point, and
 181      * both must fall within the size of the loaded media. A value of 0 for the
 182      * starting point means the beginning of the loaded media. Similarly, a
 183      * value of -1 for the ending point indicates the last frame of the media.
 184      *
 185      * @param  start the loop's starting position, in sample frames (zero-based)
 186      * @param  end the loop's ending position, in sample frames (zero-based), or
 187      *         -1 to indicate the final frame
 188      * @throws IllegalArgumentException if the requested loop points cannot be
 189      *         set, usually because one or both falls outside the media's
 190      *         duration or because the ending point is before the starting point
 191      */
 192     void setLoopPoints(int start, int end);
 193 
 194     /**
 195      * Starts looping playback from the current position. Playback will continue
 196      * to the loop's end point, then loop back to the loop start point
 197      * {@code count} times, and finally continue playback to the end of the
 198      * clip.
 199      * <p>
 200      * If the current position when this method is invoked is greater than the
 201      * loop end point, playback simply continues to the end of the clip without
 202      * looping.
 203      * <p>
 204      * A {@code count} value of 0 indicates that any current looping should
 205      * cease and playback should continue to the end of the clip. The behavior
 206      * is undefined when this method is invoked with any other value during a
 207      * loop operation.
< prev index next >