Class SampleQueueInputStream

  extended by com.softsynth.jsyn.util.SampleQueueStream
      extended by 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.

(C) 1997 Phil Burk,, All Rights Reserved
See Also:

Constructor Summary
SampleQueueInputStream(SynthSampleQueue queue, int bufferSizeInFrames, int channelsPerFrame)
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 com.softsynth.jsyn.util.SampleQueueStream
available, getSample, move, stop
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public SampleQueueInputStream(SynthSampleQueue queue,
                              int bufferSizeInFrames,
                              int channelsPerFrame)
Method Detail


public void start(int time)
start in class SampleQueueStream


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.


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.

data - Array of shorts containing PCM sample data
offset - index of array to start reading data from
numFrames - number of frames to read from sample
number of frames read