com.softsynth.jsyn.util
Class SampleQueueInputStream
java.lang.Object
com.softsynth.jsyn.util.SampleQueueStream
com.softsynth.jsyn.util.SampleQueueInputStream
public class SampleQueueInputStream
- extends SampleQueueStream
Adds streaming read capabilities to a SynthSampleQueue.
The queue must be on a unit that will write data to the queue
such as a SampleWriter_16F1. The SampleWriter will write data to the sample that is then
read by this stream via the queue.
- Author:
- (C) 1997 Phil Burk, SoftSynth.com, All Rights Reserved
- See Also:
StreamRecorder
Method Summary |
boolean |
getOverflowed()
Return true if the buffer has overflowed and data has been lost. |
int |
read(short[] data,
int offset,
int numFrames)
Read an array of short data from sample. |
void |
start(int time)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SampleQueueInputStream
public SampleQueueInputStream(SynthSampleQueue queue,
int bufferSizeInFrames,
int channelsPerFrame)
start
public void start(int time)
- Overrides:
start
in class SampleQueueStream
getOverflowed
public boolean getOverflowed()
- Return true if the buffer has overflowed and data has been lost.
To prevent this, use a larger buffer, or read the data more often.
read
public int read(short[] data,
int offset,
int numFrames)
- Read an array of short data from sample.
If there is not enough data available, block until all of the data can be read.
To avoid blocking, call available() first to see how much can be read without blocking.
- Parameters:
data
- Array of shorts containing PCM sample dataoffset
- index of array to start reading data fromnumFrames
- number of frames to read from sample
- Returns:
- number of frames read