Copyright 2011-01-06 Werner Randelshofer

ch.randelshofer.media.eightsvx
Class JDK13ShortAudioClip

java.lang.Object
  extended by ch.randelshofer.media.eightsvx.JDK13ShortAudioClip
All Implemented Interfaces:
LoopableAudioClip, java.applet.AudioClip

public class JDK13ShortAudioClip
extends java.lang.Object
implements LoopableAudioClip

JDK13ShortAudioClip.

Version:
1.0.1 2005-07-09 Removed unnecessary System.out.println call.
1.0 April 21, 2003 Created.
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland

Field Summary
 
Fields inherited from interface ch.randelshofer.media.eightsvx.LoopableAudioClip
LOOP_CONTINUOUSLY
 
Constructor Summary
JDK13ShortAudioClip(byte[] samples, int sampleRate, int volume, float pan)
          Creates a new instance.
 
Method Summary
 void loop()
           
 void loop(int count)
          Starts looping playback from the current position.
 void play()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDK13ShortAudioClip

public JDK13ShortAudioClip(byte[] samples,
                           int sampleRate,
                           int volume,
                           float pan)
Creates a new instance.

Parameters:
samples - Array of signed linear 8-bit encoded audio samples.
sampleRate - sampleRate of the audio samples.
volume - The volume setting controls the loudness of the sound. range 0 (mute) to 64 (maximal volume).
pan - The relative pan of a stereo signal between two stereo speakers. The valid range of values is -1.0 (left channel only) to 1.0 (right channel only). The default is 0.0 (centered).
Method Detail

loop

public void loop()
Specified by:
loop in interface java.applet.AudioClip

play

public void play()
Specified by:
play in interface java.applet.AudioClip

stop

public void stop()
Specified by:
stop in interface java.applet.AudioClip

loop

public void loop(int count)
Starts looping playback from the current position. Playback will continue to the loop's end point, then loop back to the loop start point count times, and finally continue playback to the end of the clip.

If the current position when this method is invoked is greater than the loop end point, playback simply continues to the end of the clip without looping.

A count value of 0 indicates that any current looping should cease and playback should continue to the end of the clip. The behavior is undefined when this method is invoked with any other value during a loop operation.

If playback is stopped during looping, the current loop status is cleared; the behavior of subsequent loop and start requests is not affected by an interrupted loop operation.

Specified by:
loop in interface LoopableAudioClip
Parameters:
count - the number of times playback should loop back from the loop's end position to the loop's start position, or LoopableAudioClip.LOOP_CONTINUOUSLY to indicate that looping should continue until interrupted

Copyright 2011-01-06 Werner Randelshofer