Package javazoom.jl.player
Class JavaSoundAudioDevice
java.lang.Object
javazoom.jl.player.AudioDeviceBase
javazoom.jl.player.JavaSoundAudioDevice
- All Implemented Interfaces:
AudioDevice
The
JavaSoundAudioDevice
implements an audio
device by using the JavaSound API.- Since:
- 0.0.8
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Template method to provide the implementation for closing the audio device.protected void
protected void
Template method to provide the implementation for flushing any buffered audio data.protected AudioFormat
protected byte[]
getByteArray
(int length) int
Retrieves the current playback position in milliseconds.protected DataLine.Info
int
millisecondsToBytes
(AudioFormat fmt, int time) void
open
(AudioFormat fmt) protected void
openImpl()
Template method to provide the implementation for the opening of the audio device.protected void
setAudioFormat
(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.Methods inherited from class javazoom.jl.player.AudioDeviceBase
close, flush, getDecoder, isOpen, open, setOpen, write
-
Constructor Details
-
JavaSoundAudioDevice
public JavaSoundAudioDevice()
-
-
Method Details
-
setAudioFormat
-
getAudioFormat
-
getSourceLineInfo
-
open
- Throws:
JavaLayerException
-
openImpl
Description copied from class:AudioDeviceBase
Template method to provide the implementation for the opening of the audio device.- Overrides:
openImpl
in classAudioDeviceBase
- Throws:
JavaLayerException
-
createSource
- Throws:
JavaLayerException
-
millisecondsToBytes
-
closeImpl
protected void closeImpl()Description copied from class:AudioDeviceBase
Template method to provide the implementation for closing the audio device.- Overrides:
closeImpl
in classAudioDeviceBase
-
writeImpl
Description copied from class:AudioDeviceBase
Template method to provide the implementation for writing audio samples to the audio device.- Overrides:
writeImpl
in classAudioDeviceBase
- Throws:
JavaLayerException
-
getByteArray
protected byte[] getByteArray(int length) -
toByteArray
protected byte[] toByteArray(short[] samples, int offs, int len) -
flushImpl
protected void flushImpl()Description copied from class:AudioDeviceBase
Template method to provide the implementation for flushing any buffered audio data.- Overrides:
flushImpl
in classAudioDeviceBase
-
getPosition
public int getPosition()Description copied from interface:AudioDevice
Retrieves the current playback position in milliseconds. -
test
Runs a short test by playing a short silent sound.- Throws:
JavaLayerException
-