com.cloudgarden.audio
Class AudioMediaLineSink

java.lang.Object
  |
  +--com.cloudgarden.audio.DefaultAudioObject
        |
        +--com.cloudgarden.audio.DefaultAudioSink
              |
              +--com.cloudgarden.audio.AudioMediaLineSink
All Implemented Interfaces:
AudioObject, AudioSink, javax.media.ControllerListener, javax.media.datasink.DataSinkListener

public class AudioMediaLineSink
extends DefaultAudioSink
implements javax.media.ControllerListener, javax.media.datasink.DataSinkListener

AudioSink wrapper for a javax.media playback device, enabling audio data to be played to speakers etc (avoiding the bugs encountered by the javax.sound.sampled playback devices when a TargetDataLine is running at the same time). Requires the JMF to be installed.


Field Summary
protected  java.net.URL url
           
 
Fields inherited from class com.cloudgarden.audio.DefaultAudioSink
getThread, getting, source
 
Fields inherited from class com.cloudgarden.audio.DefaultAudioObject
contentType, exception, format, listeners, paused, pauseSync, running, waiting
 
Fields inherited from interface com.cloudgarden.audio.AudioObject
END_OF_DATA
 
Constructor Summary
AudioMediaLineSink(javax.sound.sampled.AudioFormat format)
           
AudioMediaLineSink(AudioSource src)
          Creates an AudioLineSink to receive data from the given AudioSource, with the same AudioFormat as the AudioSource.
AudioMediaLineSink(int rate, int bits, int chans, boolean signed, boolean bigEndian)
           
 
Method Summary
 void controllerUpdate(javax.media.ControllerEvent evt)
           
 void dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
           
 int write(byte[] data, int offset, int length)
          Used to write data to this sink - called by the AudioSource which this sink is connected to (if its startSending method is used) so need not be called explicitly by an application.
 
Methods inherited from class com.cloudgarden.audio.DefaultAudioSink
getSource, setAudioFormat, setContentType, setSource, write
 
Methods inherited from class com.cloudgarden.audio.DefaultAudioObject
addTransferListener, blockWhilePaused, blockWhileWaiting, bytesTransferred, canSetAudioFormat, drain, getAudioFormat, getContentType, getLastException, isPaused, isWaiting, removeTransferListener, setPaused
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cloudgarden.audio.AudioObject
addTransferListener, canSetAudioFormat, drain, getAudioFormat, getContentType, isPaused, isWaiting, removeTransferListener, setPaused
 

Field Detail

url

protected java.net.URL url
Constructor Detail

AudioMediaLineSink

public AudioMediaLineSink(int rate,
                          int bits,
                          int chans,
                          boolean signed,
                          boolean bigEndian)
                   throws javax.sound.sampled.LineUnavailableException,
                          java.io.IOException

AudioMediaLineSink

public AudioMediaLineSink(javax.sound.sampled.AudioFormat format)
                   throws javax.sound.sampled.LineUnavailableException,
                          java.io.IOException

AudioMediaLineSink

public AudioMediaLineSink(AudioSource src)
                   throws javax.sound.sampled.LineUnavailableException,
                          java.io.IOException
Creates an AudioLineSink to receive data from the given AudioSource, with the same AudioFormat as the AudioSource.
Method Detail

dataSinkUpdate

public void dataSinkUpdate(javax.media.datasink.DataSinkEvent evt)
Specified by:
dataSinkUpdate in interface javax.media.datasink.DataSinkListener

controllerUpdate

public void controllerUpdate(javax.media.ControllerEvent evt)
Specified by:
controllerUpdate in interface javax.media.ControllerListener

write

public int write(byte[] data,
                 int offset,
                 int length)
          throws java.io.IOException
Description copied from interface: AudioSink
Used to write data to this sink - called by the AudioSource which this sink is connected to (if its startSending method is used) so need not be called explicitly by an application. Blocks if this sink is paused.
Following copied from interface: com.cloudgarden.audio.AudioSink
See Also:
AudioSink.setSource(com.cloudgarden.audio.AudioSource), AudioSource.startSending(), AudioObject.setPaused(boolean)