Copyright 2013-01-06 Werner Randelshofer

org.monte.media.eightsvx
Class JDK10AudioClip

java.lang.Object
  extended by org.monte.media.eightsvx.JDK10AudioClip
All Implemented Interfaces:
java.applet.AudioClip, LoopableAudioClip

public class JDK10AudioClip
extends java.lang.Object
implements LoopableAudioClip

A JDK 1.0 compatible audio clip for signed linear 8 encoded audio PCM samples.

Version:
1.1 2003-04-23 Use com.sun.media.sound.JavaSoundAudioClip instead of sun.applet.AppletAudioClip because applets may not access classes in the 'sun.applet' package.
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Goldau, Switzerland

Field Summary
 
Fields inherited from interface org.monte.media.eightsvx.LoopableAudioClip
LOOP_CONTINUOUSLY
 
Constructor Summary
JDK10AudioClip(byte[] samples, int sampleRate)
          For constructing directly from Jar entries, or any other raw Audio data.
 
Method Summary
 void loop()
           
 void loop(int count)
          Starts looping playback from the current position.
 void play()
           
 void stop()
           
static void writeSunAudioHeader(byte[] data, int sampleRate, int datasize)
          Overwrites the 24 first bites of the provided data array with a sun audio header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDK10AudioClip

public JDK10AudioClip(byte[] samples,
                      int sampleRate)
For constructing directly from Jar entries, or any other raw Audio data. Note that the data provided must include the format header.

Method Detail

play

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

loop

public void loop()
Specified by:
loop 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

stop

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

writeSunAudioHeader

public static void writeSunAudioHeader(byte[] data,
                                       int sampleRate,
                                       int datasize)
Overwrites the 24 first bites of the provided data array with a sun audio header.


Copyright 2013-01-06 Werner Randelshofer