public class JavaSoundAudioDevice extends AudioDeviceBase
JavaSoundAudioDevice implements an audio
device by using the JavaSound API.| Constructor and Description |
|---|
JavaSoundAudioDevice() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeImpl()
Template method to provide the implementation for
closing the audio device.
|
protected void |
createSource() |
protected void |
flushImpl()
Template method to provide the implementation for
flushing any buffered audio data.
|
protected javax.sound.sampled.AudioFormat |
getAudioFormat() |
protected byte[] |
getByteArray(int length) |
int |
getPosition()
Retrieves the current playback position in milliseconds.
|
protected javax.sound.sampled.DataLine.Info |
getSourceLineInfo() |
int |
millisecondsToBytes(javax.sound.sampled.AudioFormat fmt,
int time) |
void |
open(javax.sound.sampled.AudioFormat fmt) |
protected void |
openImpl()
Template method to provide the
implementation for the opening of the audio device.
|
protected void |
setAudioFormat(javax.sound.sampled.AudioFormat fmt0) |
void |
test()
Runs a short test by playing a short silent sound.
|
protected byte[] |
toByteArray(short[] samples,
int offs,
int len) |
protected void |
writeImpl(short[] samples,
int offs,
int len)
Template method to provide the implementation for
writing audio samples to the audio device.
|
close, flush, getDecoder, isOpen, open, setOpen, writeprotected void setAudioFormat(javax.sound.sampled.AudioFormat fmt0)
protected javax.sound.sampled.AudioFormat getAudioFormat()
protected javax.sound.sampled.DataLine.Info getSourceLineInfo()
public void open(javax.sound.sampled.AudioFormat fmt)
throws JavaLayerException
JavaLayerExceptionprotected void openImpl()
throws JavaLayerException
AudioDeviceBaseopenImpl in class AudioDeviceBaseJavaLayerExceptionprotected void createSource()
throws JavaLayerException
JavaLayerExceptionpublic int millisecondsToBytes(javax.sound.sampled.AudioFormat fmt,
int time)
protected void closeImpl()
AudioDeviceBasecloseImpl in class AudioDeviceBaseprotected void writeImpl(short[] samples,
int offs,
int len)
throws JavaLayerException
AudioDeviceBasewriteImpl in class AudioDeviceBaseJavaLayerExceptionprotected byte[] getByteArray(int length)
protected byte[] toByteArray(short[] samples,
int offs,
int len)
protected void flushImpl()
AudioDeviceBaseflushImpl in class AudioDeviceBasepublic int getPosition()
AudioDevicepublic void test()
throws JavaLayerException
JavaLayerException