com.jsyn.io
Class AudioFifo

java.lang.Object
  extended by com.jsyn.io.AudioFifo
All Implemented Interfaces:
AudioInputStream, AudioOutputStream

public class AudioFifo
extends java.lang.Object
implements AudioInputStream, AudioOutputStream

FIFO that implements AudioInputStream, AudioOutputStream interfaces. This can be used to send audio data between different threads. The reads or writes may or may not wait based on flags.


Constructor Summary
AudioFifo()
           
 
Method Summary
 void allocate(int size)
           
 int available()
          How many samples are available for reading without blocking?
 void close()
           
static boolean isPowerOfTwo(int size)
           
 boolean isReadWaitEnabled()
           
 boolean isWriteWaitEnabled()
           
 double read()
           
 int read(double[] buffer)
           
 int read(double[] buffer, int start, int count)
           
 void setReadWaitEnabled(boolean enabled)
          If true then a subsequent read call will wait if there is no data to read.
 void setWriteWaitEnabled(boolean enabled)
          If true then a subsequent write call will wait if there is no room to write.
 int size()
           
 void write(double value)
           
 void write(double[] buffer)
           
 void write(double[] buffer, int start, int count)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioFifo

public AudioFifo()
Method Detail

allocate

public void allocate(int size)

size

public int size()

isPowerOfTwo

public static boolean isPowerOfTwo(int size)

available

public int available()
How many samples are available for reading without blocking?

Specified by:
available in interface AudioInputStream

close

public void close()
Specified by:
close in interface AudioInputStream
Specified by:
close in interface AudioOutputStream

read

public double read()
Specified by:
read in interface AudioInputStream

write

public void write(double value)
Specified by:
write in interface AudioOutputStream

read

public int read(double[] buffer)
Specified by:
read in interface AudioInputStream

read

public int read(double[] buffer,
                int start,
                int count)
Specified by:
read in interface AudioInputStream

write

public void write(double[] buffer)
Specified by:
write in interface AudioOutputStream

write

public void write(double[] buffer,
                  int start,
                  int count)
Specified by:
write in interface AudioOutputStream

setWriteWaitEnabled

public void setWriteWaitEnabled(boolean enabled)
If true then a subsequent write call will wait if there is no room to write.


setReadWaitEnabled

public void setReadWaitEnabled(boolean enabled)
If true then a subsequent read call will wait if there is no data to read.


isWriteWaitEnabled

public boolean isWriteWaitEnabled()

isReadWaitEnabled

public boolean isReadWaitEnabled()