javax.sound.sampled

Interface Clip

public interface Clip extends DataLine

A Clip represents some pre-loaded audio data.

Since: 1.3

Field Summary
intLOOP_CONTINUOUSLY
This can be passed to {@link #loop(int)} to indicate that looping should be done continuously.
Method Summary
intgetFrameLength()
Return the frame length of this clip.
longgetMicrosecondLength()
Return the length of the clip in microseconds.
voidloop(int count)
Start looping the clip.
voidopen(AudioFormat fmt, byte[] data, int offset, int len)
Open a clip, given an audio format and some data.
voidopen(AudioInputStream ais)
Open a clip, given an audio input stream.
voidsetFramePosition(int where)
Set the position to the indicated frame.
voidsetLoopPoints(int begin, int end)
Set the loop begin and end points.
voidsetMicrosecondPosition(long ms)
Set the position to the indicated microsecond.

Field Detail

LOOP_CONTINUOUSLY

public int LOOP_CONTINUOUSLY
This can be passed to {@link #loop(int)} to indicate that looping should be done continuously.

Method Detail

getFrameLength

public int getFrameLength()
Return the frame length of this clip.

getMicrosecondLength

public long getMicrosecondLength()
Return the length of the clip in microseconds.

loop

public void loop(int count)
Start looping the clip. Looping will occur count times, or, if count is LOOP_CONTINUOUSLY, will be done continuously. A count of 0 indicates that any current looping should stop.

Parameters: count the number of times to loop

open

public void open(AudioFormat fmt, byte[] data, int offset, int len)
Open a clip, given an audio format and some data.

Parameters: fmt the format of the data data a byte array containing the audio data offset the offset of the first byte of data in the array len the length of the audio data in the array, in bytes

Throws: LineUnavailableException if the line cannot be opened SecurityException if the line cannot be opened for security reasons

open

public void open(AudioInputStream ais)
Open a clip, given an audio input stream.

Parameters: ais the input stream

Throws: LineUnavailableException if the line cannot be opened SecurityException if the line cannot be opened for security reasons IOException if there is an I/O error while reading the stream

setFramePosition

public void setFramePosition(int where)
Set the position to the indicated frame.

Parameters: where new frame position

setLoopPoints

public void setLoopPoints(int begin, int end)
Set the loop begin and end points. These are used by loop(int).

Parameters: begin the starting point end the ending point

setMicrosecondPosition

public void setMicrosecondPosition(long ms)
Set the position to the indicated microsecond.

Parameters: ms the new position in microseconds