com.softsynth.jsyn
Class SynthDataQueue

java.lang.Object
  extended by com.softsynth.jsyn.SynthPort
      extended by com.softsynth.jsyn.SynthDataQueue
Direct Known Subclasses:
SynthEnvelopeQueue, SynthSampleQueue

public class SynthDataQueue
extends SynthPort

SynthDataQueue class for Java Audio Synthesis. Root class for SynthEnvelopeQueue and SynthSampleQueue.

Author:
(C) 1997 Phil Burk, SoftSynth.com, All Rights Reserved

Method Summary
 void clear()
          Clear any data on this queue.
 void clear(int time)
           
 int getNumFramesMoved()
           
 int getNumFramesMoved(int partIndex)
          The SynthDataQueue tallies the number of frames played.
 void queue(int time, SynthChannelData channelData, int startFrame, int numFrames)
           
 void queue(int time, SynthChannelData channelData, int startFrame, int numFrames, int flags)
           
 void queue(SynthChannelData channelData, int startFrame, int numFrames)
           
 void queue(SynthChannelData channelData, int startFrame, int numFrames, int flags)
           
 void queueLoop(int time, SynthChannelData channelData, int startFrame, int numFrames)
           
 void queueLoop(SynthChannelData channelData, int startFrame, int numFrames)
           
 void queueOff(int time, SynthChannelData channelData)
          Passes false to queueOff for ifStop
 void queueOff(int time, SynthChannelData channelData, boolean ifStop)
          Convenience method that will queue the decay portion of a channelData, or the gap and release loop portions if they exist.
 void queueOff(SynthChannelData channelData)
           
 void queueOn(int time, SynthChannelData channelData)
          Convenience method that will queue the attack portion of a channelData and the sustain loop if it exists.
 void queueOn(SynthChannelData channelData)
           
 
Methods inherited from class com.softsynth.jsyn.SynthPort
getAlias, getName, getNumParts, getSignalType, getSignalType, getSound, setAlias, setSignalType, setSignalType, setSignalType, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

clear

public void clear()
           throws SynthException
Clear any data on this queue.

Throws:
SynthException - If queue name is not recognized.

clear

public void clear(int time)
           throws SynthException
Throws:
SynthException

queue

public void queue(SynthChannelData channelData,
                  int startFrame,
                  int numFrames,
                  int flags)
           throws SynthException
Throws:
SynthException

queue

public void queue(SynthChannelData channelData,
                  int startFrame,
                  int numFrames)
           throws SynthException
Throws:
SynthException

queueLoop

public void queueLoop(SynthChannelData channelData,
                      int startFrame,
                      int numFrames)
               throws SynthException
Throws:
SynthException

queue

public void queue(int time,
                  SynthChannelData channelData,
                  int startFrame,
                  int numFrames,
                  int flags)
           throws SynthException
Throws:
SynthException

queue

public void queue(int time,
                  SynthChannelData channelData,
                  int startFrame,
                  int numFrames)
           throws SynthException
Throws:
SynthException

queueLoop

public void queueLoop(int time,
                      SynthChannelData channelData,
                      int startFrame,
                      int numFrames)
               throws SynthException
Throws:
SynthException

queueOn

public void queueOn(int time,
                    SynthChannelData channelData)
             throws SynthException
Convenience method that will queue the attack portion of a channelData and the sustain loop if it exists. This could be used to implement a NoteOn method.

Throws:
SynthException - When placement in the queue fails.

queueOn

public void queueOn(SynthChannelData channelData)
             throws SynthException
Throws:
SynthException

queueOff

public void queueOff(int time,
                     SynthChannelData channelData,
                     boolean ifStop)
              throws SynthException
Convenience method that will queue the decay portion of a channelData, or the gap and release loop portions if they exist. This could be used to implement a NoteOff method.

Throws:
SynthException - When placement in the queue fails.

queueOff

public void queueOff(int time,
                     SynthChannelData channelData)
              throws SynthException
Passes false to queueOff for ifStop

Throws:
SynthException - When placement in the queue fails.

queueOff

public void queueOff(SynthChannelData channelData)
              throws SynthException
Throws:
SynthException

getNumFramesMoved

public int getNumFramesMoved(int partIndex)
                      throws SynthException
The SynthDataQueue tallies the number of frames played. If you are playing a non-looping envelope or sample, you can poll to see if it has played all the frames.
    int framesWhenDone = 0;
When you queue an envelope with numFrames, then:
    framesWhenDone += numFrames;
To check for completion:
   boolean stillPlaying = ((myEnvPlayer.envelopePort.getNumFramesMoved()
           - framesWhenDone) < 0);

Returns:
number of frames read or written by a port
Throws:
SynthException - If port name is not recognized, or index out of range.

getNumFramesMoved

public int getNumFramesMoved()
                      throws SynthException
Throws:
SynthException