javazoom.jl.player
Class JavaSoundAudioDevice

java.lang.Object
  extended by javazoom.jl.player.AudioDeviceBase
      extended by javazoom.jl.player.JavaSoundAudioDevice
All Implemented Interfaces:
AudioDevice

public class JavaSoundAudioDevice
extends AudioDeviceBase

The JavaSoundAudioDevice implements an audio device by using the JavaSound API.

Since:
0.0.8

Constructor Summary
JavaSoundAudioDevice()
           
 
Method Summary
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.
 
Methods inherited from class javazoom.jl.player.AudioDeviceBase
close, flush, getDecoder, isOpen, open, setOpen, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaSoundAudioDevice

public JavaSoundAudioDevice()
Method Detail

setAudioFormat

protected void setAudioFormat(javax.sound.sampled.AudioFormat fmt0)

getAudioFormat

protected javax.sound.sampled.AudioFormat getAudioFormat()

getSourceLineInfo

protected javax.sound.sampled.DataLine.Info getSourceLineInfo()

open

public void open(javax.sound.sampled.AudioFormat fmt)
          throws JavaLayerException
Throws:
JavaLayerException

openImpl

protected void openImpl()
                 throws JavaLayerException
Description copied from class: AudioDeviceBase
Template method to provide the implementation for the opening of the audio device.

Overrides:
openImpl in class AudioDeviceBase
Throws:
JavaLayerException

createSource

protected void createSource()
                     throws JavaLayerException
Throws:
JavaLayerException

millisecondsToBytes

public int millisecondsToBytes(javax.sound.sampled.AudioFormat fmt,
                               int time)

closeImpl

protected void closeImpl()
Description copied from class: AudioDeviceBase
Template method to provide the implementation for closing the audio device.

Overrides:
closeImpl in class AudioDeviceBase

writeImpl

protected void writeImpl(short[] samples,
                         int offs,
                         int len)
                  throws JavaLayerException
Description copied from class: AudioDeviceBase
Template method to provide the implementation for writing audio samples to the audio device.

Overrides:
writeImpl in class AudioDeviceBase
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 class AudioDeviceBase

getPosition

public int getPosition()
Description copied from interface: AudioDevice
Retrieves the current playback position in milliseconds.


test

public void test()
          throws JavaLayerException
Runs a short test by playing a short silent sound.

Throws:
JavaLayerException


JavaZOOM 1999-2008