public class AudioFifo extends java.lang.Object implements AudioInputStream, AudioOutputStream
Constructor and Description |
---|
AudioFifo() |
Modifier and Type | Method and Description |
---|---|
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)
Try to fill the entire buffer.
|
int |
read(double[] buffer,
int start,
int count)
Read from the stream.
|
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) |
public void allocate(int size)
size
- Number of doubles in the FIFO. Must be a power of 2. Eg. 1024.public int size()
public static boolean isPowerOfTwo(int size)
public int available()
available
in interface AudioInputStream
public void close()
close
in interface AudioInputStream
close
in interface AudioOutputStream
public double read()
read
in interface AudioInputStream
public void write(double value)
write
in interface AudioOutputStream
public int read(double[] buffer)
AudioInputStream
read
in interface AudioInputStream
public int read(double[] buffer, int start, int count)
AudioInputStream
read
in interface AudioInputStream
start
- index of first sample in buffercount
- number of samples to read, for example count=8 for 4 stereo framespublic void write(double[] buffer)
write
in interface AudioOutputStream
public void write(double[] buffer, int start, int count)
write
in interface AudioOutputStream
public void setWriteWaitEnabled(boolean enabled)
public void setReadWaitEnabled(boolean enabled)
public boolean isWriteWaitEnabled()
public boolean isReadWaitEnabled()