com.cloudgarden.audio
Class AudioPipe

java.lang.Object
  |
  +--com.cloudgarden.audio.DefaultAudioObject
        |
        +--com.cloudgarden.audio.DefaultAudioSource
              |
              +--com.cloudgarden.audio.DefaultAudioConnector
                    |
                    +--com.cloudgarden.audio.AudioPipe
All Implemented Interfaces:
AudioConnector, AudioObject, AudioSink, AudioSource

public class AudioPipe
extends DefaultAudioConnector

A class which has an internal buffer, which it uses to store data read from it's source (set using the setSource method) before being sent to it's sink (set using the setSink method). Useful in cases where audio buffering is needed.


Fields inherited from class com.cloudgarden.audio.DefaultAudioConnector
source
 
Fields inherited from class com.cloudgarden.audio.DefaultAudioSource
sending, sendThread, sink
 
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
AudioPipe()
           
 
Method Summary
 int getBufferSize()
           
 int getFreeBytes()
           
 boolean getPauseInput()
          Returns the value set by setPauseInput.
 int getUnreadBytes()
           
 int read(byte[] buff, int offset, int nBytes)
          Used to read data from this source - called by the AudioSink which this source is connected to (if its startGetting method is used) so need not be called explicitly by an application.
 void setBufferSize(int size)
           
 void setPauseInput(boolean pause)
          If set to true, this AudioPipe will cause it's source object to wait if the pipe's buffer is full.
 int write(byte[] buff, int offset, int nBytes)
          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.DefaultAudioConnector
getSource, setSource, write
 
Methods inherited from class com.cloudgarden.audio.DefaultAudioSource
drain, getSink, isSending, read, setAudioFormat, setContentType, setSink, startSending, stopSending
 
Methods inherited from class com.cloudgarden.audio.DefaultAudioObject
addTransferListener, blockWhilePaused, blockWhileWaiting, bytesTransferred, canSetAudioFormat, 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.AudioSource
getSink, isSending, read, setSink, startSending, stopSending
 
Methods inherited from interface com.cloudgarden.audio.AudioObject
addTransferListener, canSetAudioFormat, drain, getAudioFormat, getContentType, isPaused, isWaiting, removeTransferListener, setAudioFormat, setContentType, setPaused
 

Constructor Detail

AudioPipe

public AudioPipe()
Method Detail

setBufferSize

public void setBufferSize(int size)
Overrides:
setBufferSize in class DefaultAudioSource

getBufferSize

public int getBufferSize()

getUnreadBytes

public int getUnreadBytes()

getFreeBytes

public int getFreeBytes()

setPauseInput

public void setPauseInput(boolean pause)
If set to true, this AudioPipe will cause it's source object to wait if the pipe's buffer is full. Otherwise audio data will be discarded. The default value is "true".

getPauseInput

public boolean getPauseInput()
Returns the value set by setPauseInput. Default is "true".
See Also:
setPauseInput(boolean)

read

public int read(byte[] buff,
                int offset,
                int nBytes)
         throws java.io.IOException
Description copied from interface: AudioSource
Used to read data from this source - called by the AudioSink which this source is connected to (if its startGetting method is used) so need not be called explicitly by an application. Blocks if this source is paused. Returns the number of bytes read, or END_OF_DATA if all the available data has been read - eg if the end of a file has been reached, or if the stopSending() method has been called.
Following copied from interface: com.cloudgarden.audio.AudioSource
See Also:
AudioSource.setSink(com.cloudgarden.audio.AudioSink), AudioSink#startGetting, AudioObject.setPaused(boolean)

write

public int write(byte[] buff,
                 int offset,
                 int nBytes)
          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)