com.softsynth.jsyn
Class SynthEnvelope

java.lang.Object
  extended by java.util.Observable
      extended by com.softsynth.jsyn.SynthObject
          extended by com.softsynth.jsyn.SynthChannelData
              extended by com.softsynth.jsyn.SynthEnvelope

public class SynthEnvelope
extends SynthChannelData

The SynthEnvelope contains a set of duration value pairs that describe a contour, or a function in time. It can be used to shape the amplitude of notes or provide complex modulation of any parameter.
The actual data may need to reside in memory that is accessible to DMA or to a DSP so we cannot assume that it is in main memory. We also need to maintain cache coherence if the data is going to be read or written by hardware other than the CPU. For this reason, Envelopes cannot use memory allocated by, or accessable to, the application.

Version:
JSyn Version 005
Author:
(C) 1997 Phil Burk, SoftSynth.com, All Rights Reserved
See Also:
Synth, EnvelopePlayer, SynthEnvelopeQueue, SynthSample

Field Summary
 
Fields inherited from class com.softsynth.jsyn.SynthChannelData
cuePoints
 
Constructor Summary
SynthEnvelope(double[] data)
           
SynthEnvelope(int maxFrames)
          Create an Envelope with the specified number of frames.
SynthEnvelope(SynthContext synthContext, double[] data)
          Create an Envelope that will contain the contents of the double array.
SynthEnvelope(SynthContext context, int maxFrames)
           
 
Method Summary
 void read(double[] data)
           
 void read(int firstEnvelopeFrame, double[] data, int firstDataFrame, int numFrames)
          Read from the Envelope into an array of doubles.
 void write(double[] data)
           
 void write(int firstEnvelopeFrame, double[] data, int firstDataFrame, int numFrames)
          Write data from an array of doubles to the Envelopes internal storage area.
 
Methods inherited from class com.softsynth.jsyn.SynthChannelData
findCuePoint, findCuePosition, getMaxFrames, getNumFrames, getReleaseBegin, getReleaseEnd, getReleaseSize, getSustainBegin, getSustainEnd, getSustainSize, insertSortedCue, setNumFrames, setReleaseLoop, setSustainLoop
 
Methods inherited from class com.softsynth.jsyn.SynthObject
delete, deleteAll, enableDeletionByGarbageCollector, enableTracking, getPeer, getSynthContext, isTrackingEnabled, toString, track
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SynthEnvelope

public SynthEnvelope(int maxFrames)
              throws SynthException
Create an Envelope with the specified number of frames.

Throws:
SynthException - If memory allocation fails.

SynthEnvelope

public SynthEnvelope(SynthContext context,
                     int maxFrames)
              throws SynthException
Throws:
SynthException

SynthEnvelope

public SynthEnvelope(SynthContext synthContext,
                     double[] data)
              throws SynthException
Create an Envelope that will contain the contents of the double array.

Throws:
SynthException - If memory allocation fails.

SynthEnvelope

public SynthEnvelope(double[] data)
              throws SynthException
Throws:
SynthException
Method Detail

write

public void write(int firstEnvelopeFrame,
                  double[] data,
                  int firstDataFrame,
                  int numFrames)
           throws SynthException

Write data from an array of doubles to the Envelopes internal storage area. The internal storage may be in main memory or it could be located on the sound card and only accessable by DMA.

Parameters:
firstEnvelopeFrame - = Index of first frame of envelope to be written to. A frame consists of two double numbers,a duration and a value.
data - = array of doubles containing duration and value pairs.
firstDataFrame - = index of first frame in data array to write from. Note that because a frame is two values, the firstDataFrame is half the the array index.
numFrames - = number of frames to write.
Throws:
SynthException - If frames are out of range.

write

public void write(double[] data)
           throws SynthException
Throws:
SynthException

read

public void read(int firstEnvelopeFrame,
                 double[] data,
                 int firstDataFrame,
                 int numFrames)
          throws SynthException
Read from the Envelope into an array of doubles.

Parameters:
firstEnvelopeFrame - = Index of first frame of envelope to be read from. A frame consists of two double numbers,a duration and a value.
data - = array of doubles duration and value pairs.
firstDataFrame - = index of first frame in data array to read in to. Note that because a frame is two values, the firstDataFrame is half the the array index.
numFrames - = number of frames to read.
Throws:
SynthException - If frames are out of range.

read

public void read(double[] data)
          throws SynthException
Throws:
SynthException