APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.media.sound

public final Class JavaSoundAudioClipDelegate

extends Object
implements MetaEventListener, LineListener
Class Inheritance
All Implemented Interfaces
javax.sound.sampled.LineListener, java.util.EventListener, javax.sound.midi.MetaEventListener
Imports
java.io.BufferedInputStream, .ByteArrayOutputStream, .File, .FileInputStream, .IOException, .InputStream, javax.sound.SoundClip, javax.sound.midi.InvalidMidiDataException, .MetaEventListener, .MetaMessage, .MidiFileFormat, .MidiSystem, .MidiUnavailableException, .Sequence, .Sequencer, javax.sound.sampled.AudioFormat, .AudioInputStream, .AudioSystem, .Clip, .DataLine, .LineEvent, .LineListener, .SourceDataLine, .UnsupportedAudioFileException, com.sun.media.sound.JavaSoundAudioClip.AudioClipDisposerRecord

Java Sound audio clip;

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private AutoClosingClip
private static final long
CLIP_THRESHOLD

used for determining how many samples is the threshold between playing as a Clip and streaming from the file.

private boolean
private boolean
private DataPusher
private JavaSoundAudioClip.AudioClipDisposerRecord
private long
private byte[]
private int
private AudioFormat
private static final int
private Sequence
private Sequencer
private boolean
private static final int
private volatile boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public synchronized boolean
private boolean
private boolean
private boolean
private void
public synchronized boolean
private boolean
public synchronized void
loop()

public synchronized void
meta(MetaMessage message)

Implements javax.sound.midi.MetaEventListener.meta.

Invoked when a Sequencer has encountered and processed a MetaMessage in the Sequence it is processing.

public synchronized void
play()

private void
readStream(AudioInputStream as, long byteLen)

private void
private synchronized void
startImpl(boolean loop)

public synchronized void
stop()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public synchronized void
update(LineEvent event)

Implements javax.sound.sampled.LineListener.update.

Informs the listener that a line's state has changed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

clipback to summary
private AutoClosingClip clip
CLIP_THRESHOLDback to summary
private static final long CLIP_THRESHOLD

used for determining how many samples is the threshold between playing as a Clip and streaming from the file. $$jb: 11.07.99: the engine has a limit of 1M samples to play as a Clip, so compare this number with the number of samples in the stream.

clipLoopingback to summary
private boolean clipLooping
clipPlayingback to summary
private boolean clipPlaying
datapusherback to summary
private DataPusher datapusher
disposerRecordback to summary
private JavaSoundAudioClip.AudioClipDisposerRecord disposerRecord
lastPlayCallback to summary
private long lastPlayCall
loadedAudioback to summary
private byte[] loadedAudio
loadedAudioByteLengthback to summary
private int loadedAudioByteLength
loadedAudioFormatback to summary
private AudioFormat loadedAudioFormat
MINIMUM_PLAY_DELAYback to summary
private static final int MINIMUM_PLAY_DELAY
sequenceback to summary
private Sequence sequence
sequencerback to summary
private Sequencer sequencer
sequencerloopback to summary
private boolean sequencerloop
STREAM_BUFFER_SIZEback to summary
private static final int STREAM_BUFFER_SIZE
successback to summary
private volatile boolean success

Constructor Detail

JavaSoundAudioClipDelegateback to summary
pack-priv JavaSoundAudioClipDelegate(File file, JavaSoundAudioClip.AudioClipDisposerRecord record) throws IOException

Method Detail

canPlayback to summary
public synchronized boolean canPlay()
createClipback to summary
private boolean createClip()
createSequencerback to summary
private boolean createSequencer(BufferedInputStream in) throws IOException
createSourceDataLineback to summary
private boolean createSourceDataLine()
initback to summary
private void init(InputStream in) throws IOException
isPlayingback to summary
public synchronized boolean isPlaying()
loadAudioDataback to summary
private boolean loadAudioData(AudioInputStream as) throws IOException, UnsupportedAudioFileException
loopback to summary
public synchronized void loop()
metaback to summary
public synchronized void meta(MetaMessage message)

Implements javax.sound.midi.MetaEventListener.meta.

Doc from javax.sound.midi.MetaEventListener.meta.

Invoked when a Sequencer has encountered and processed a MetaMessage in the Sequence it is processing.

Annotations
@Override
playback to summary
public synchronized void play()
readStreamback to summary
private void readStream(AudioInputStream as, long byteLen) throws IOException
readStreamback to summary
private void readStream(AudioInputStream as) throws IOException
startImplback to summary
private synchronized void startImpl(boolean loop)
stopback to summary
public synchronized void stop()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
updateback to summary
public synchronized void update(LineEvent event)

Implements javax.sound.sampled.LineListener.update.

Doc from javax.sound.sampled.LineListener.update.

Informs the listener that a line's state has changed. The listener can then invoke LineEvent methods to obtain information about the event.

Annotations
@Override
com.sun.media.sound back to summary

private Class JavaSoundAudioClipDelegate.DirectBAOS

extends ByteArrayOutputStream
Class Inheritance

Field Summary

Inherited from java.io.ByteArrayOutputStream:
bufcount

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public byte[]
Inherited from java.io.ByteArrayOutputStream:
closeresetsizetoByteArraytoStringtoStringtoStringtoStringwritewritewriteByteswriteTo

Constructor Detail

DirectBAOSback to summary
pack-priv DirectBAOS()

Method Detail

getInternalBufferback to summary
public byte[] getInternalBuffer()