ddf.minim
Class AudioRW

java.lang.Object
  extended byjava.lang.Thread
      extended byddf.minim.AudioRW
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
LineReader, LineWriter

public abstract class AudioRW
extends java.lang.Thread

AudioRW is the base class for classes that either read audio data from the system or send the system audio data. It provides functions for adding listeners and for causing a reader or writer to finish.

Author:
Damien Di Fede

Field Summary
protected  org.tritonus.share.sampled.FloatSampleBuffer sampleBuffer
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AudioRW(javax.sound.sampled.AudioFormat format, int bufferSize)
          Constructs and AudioRW that will read or write the requested AudioFormat and use a buffer of length bufferSize.
 
Method Summary
 void finish()
          Causes the thread of execution to finish.
 int getChannelCount()
          Returns the number of channels contained the audio being read or written.
 javax.sound.sampled.AudioFormat getFormat()
          Returns the AudioFormat of the audio being read or written.
 boolean isFinished()
          Returns true if the thread of execution has finished.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sampleBuffer

protected org.tritonus.share.sampled.FloatSampleBuffer sampleBuffer
Constructor Detail

AudioRW

public AudioRW(javax.sound.sampled.AudioFormat format,
               int bufferSize)
Constructs and AudioRW that will read or write the requested AudioFormat and use a buffer of length bufferSize.

Parameters:
format - the AudioFormat that will be read or written
bufferSize - the buffer size to be used
Method Detail

getFormat

public javax.sound.sampled.AudioFormat getFormat()
Returns the AudioFormat of the audio being read or written.

Returns:
the AudioFormat of the audio being read or written

getChannelCount

public int getChannelCount()
Returns the number of channels contained the audio being read or written.

Returns:
1 for mono audio, 2 for stereo audio

finish

public void finish()
Causes the thread of execution to finish.


isFinished

public boolean isFinished()
Returns true if the thread of execution has finished.

Returns:
true if the thread of execution has finished