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

public final Class DataPusher

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable
Imports
java.util.Arrays, javax.sound.sampled.AudioFormat, .AudioInputStream, .SourceDataLine

Class to write an AudioInputStream to a SourceDataLine. Was previously an inner class in various classes like JavaSoundAudioClip and sun.audio.AudioDevice. It auto-opens and closes the SourceDataLine.
Authors
Kara Kytle, Florian Bomers

Field Summary

Modifier and TypeField and Description
private final AudioInputStream
private final byte[]
private final int
private static final int
private final int
pack-priv boolean
private final AudioFormat
private boolean
private int
private int
private Thread
private final SourceDataLine
private final int
private final int
private final int
private final int
private final int
private int
private int

Constructor Summary

AccessConstructor and Description
public
DataPusher(SourceDataLine sourceLine, AudioFormat format, byte[] audioData, int byteLength)

public
DataPusher(SourceDataLine sourceLine, AudioFormat format, byte[] audioData, int byteLength, boolean daemon)

public
private
DataPusher(final SourceDataLine source, final AudioFormat format, final AudioInputStream ais, final byte[] audioData, final int audioDataByteLength, final boolean daemon)

Method Summary

Modifier and TypeMethod and Description
pack-priv synchronized void
public synchronized boolean
public void
run()

Implements java.lang.Runnable.run.

Write data to the source data line.

public synchronized void
public synchronized void
start(boolean loop)

public synchronized void
stop()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aisback to summary
private final AudioInputStream ais
audioDataback to summary
private final byte[] audioData
audioDataByteLengthback to summary
private final int audioDataByteLength
AUTO_CLOSE_TIMEback to summary
private static final int AUTO_CLOSE_TIME
BUFFER_SIZEback to summary
private final int BUFFER_SIZE
daemonThreadback to summary
pack-priv boolean daemonThread
formatback to summary
private final AudioFormat format
loopingback to summary
private boolean looping
newPosback to summary
private int newPos
posback to summary
private int pos
pushThreadback to summary
private Thread pushThread
sourceback to summary
private final SourceDataLine source
STATE_NONEback to summary
private final int STATE_NONE
STATE_PLAYINGback to summary
private final int STATE_PLAYING
STATE_STOPPEDback to summary
private final int STATE_STOPPED
STATE_STOPPINGback to summary
private final int STATE_STOPPING
STATE_WAITINGback to summary
private final int STATE_WAITING
threadStateback to summary
private int threadState
wantedStateback to summary
private int wantedState

Constructor Detail

DataPusherback to summary
public DataPusher(SourceDataLine sourceLine, AudioFormat format, byte[] audioData, int byteLength)
DataPusherback to summary
public DataPusher(SourceDataLine sourceLine, AudioFormat format, byte[] audioData, int byteLength, boolean daemon)
DataPusherback to summary
public DataPusher(SourceDataLine sourceLine, AudioInputStream ais)
DataPusherback to summary
private DataPusher(final SourceDataLine source, final AudioFormat format, final AudioInputStream ais, final byte[] audioData, final int audioDataByteLength, final boolean daemon)

Method Detail

closeback to summary
pack-priv synchronized void close()
isPlayingback to summary
public synchronized boolean isPlaying()
runback to summary
public void run()

Implements java.lang.Runnable.run.

Write data to the source data line.

Annotations
@Override
startback to summary
public synchronized void start()
startback to summary
public synchronized void start(boolean loop)
stopback to summary
public synchronized void stop()