com.softsynth.jsyn
Class SynthChannelData

java.lang.Object
  extended by java.util.Observable
      extended by com.softsynth.jsyn.SynthObject
          extended by com.softsynth.jsyn.SynthChannelData
Direct Known Subclasses:
SynthEnvelope, SynthSample

public class SynthChannelData
extends SynthObject

The SynthChannelData class is a container for digital audio data. 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, SynthSample, SynthEnvelope

Field Summary
 java.util.Vector cuePoints
           
 
Constructor Summary
SynthChannelData()
           
SynthChannelData(int maxFrames)
           
SynthChannelData(SynthContext synthContext, int maxFrames)
           
 
Method Summary
 CuePoint findCuePoint(int uniqueID)
           
 int findCuePosition(int uniqueID)
          FIXME - document findCuePosition(), add query for numCues, or add Iterater
 int getMaxFrames()
           
 int getNumFrames()
           
 int getReleaseBegin()
           
 int getReleaseEnd()
           
 int getReleaseSize()
           
 int getSustainBegin()
           
 int getSustainEnd()
           
 int getSustainSize()
           
 void insertSortedCue(CuePoint cuePoint)
           
 void setNumFrames(int numFrames)
          Set number of frames of data.
 void setReleaseLoop(int startFrame, int endFrame)
          Set location of Release Loop in units of Frames.
 void setSustainLoop(int startFrame, int endFrame)
          Set location of Sustain Loop in units of Frames.
 
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
 

Field Detail

cuePoints

public java.util.Vector cuePoints
Constructor Detail

SynthChannelData

public SynthChannelData()

SynthChannelData

public SynthChannelData(int maxFrames)

SynthChannelData

public SynthChannelData(SynthContext synthContext,
                        int maxFrames)
Method Detail

getNumFrames

public int getNumFrames()
Returns:
Current number of frames of data.

getMaxFrames

public int getMaxFrames()
Returns:
Maximum number of frames of data.

setNumFrames

public void setNumFrames(int numFrames)
Set number of frames of data. Input will be clipped to maxFrames. This is useful when changing the contents of a sample or envelope.


setSustainLoop

public void setSustainLoop(int startFrame,
                           int endFrame)
Set location of Sustain Loop in units of Frames. Set SustainBegin to -1 if no Sustain Loop. SustainEnd value is the frame index of the frame just past the end of the loop. The number of frames included in the loop is (SustainEnd - SustainBegin).


getSustainBegin

public int getSustainBegin()
Returns:
Beginning of sustain loop or -1 if no loop.

getSustainEnd

public int getSustainEnd()
Returns:
End of sustain loop or -1 if no loop.

getSustainSize

public int getSustainSize()
Returns:
Size of sustain loop in frames, 0 if no loop.

setReleaseLoop

public void setReleaseLoop(int startFrame,
                           int endFrame)
Set location of Release Loop in units of Frames. Set ReleaseBegin to -1 if no ReleaseLoop. ReleaseEnd value is the frame index of the frame just past the end of the loop. The number of frames included in the loop is (ReleaseEnd - ReleaseBegin).
Why would anyone use a Release Loop? Imagine that you want to build a circuit with a complex LFO type filter modulation that starts when a "note" is released and continues as the sound dies away. To do this, hook a regular envelope with no release loop up to the circuit's amplitude. Then hook another envelope with a release loop up to the circuit's filter cutoff. Also put a sustain point or loop before it so that it doesn't modulate before the note off occurs. Then when you call queueOff() for the two envelopes the sound will fade away because of the first envelope, while being complex modulated by the second envelope with the release loop.


getReleaseBegin

public int getReleaseBegin()
Returns:
Beginning of release loop or -1 if no loop.

getReleaseEnd

public int getReleaseEnd()
Returns:
End of release loop or -1 if no loop.

getReleaseSize

public int getReleaseSize()
Returns:
Size of release loop in frames, 0 if no loop.

insertSortedCue

public void insertSortedCue(CuePoint cuePoint)

findCuePoint

public CuePoint findCuePoint(int uniqueID)

findCuePosition

public int findCuePosition(int uniqueID)
FIXME - document findCuePosition(), add query for numCues, or add Iterater