com.jsyn.data
Interface SequentialData

All Known Implementing Classes:
AudioSample, FloatSample, SegmentedEnvelope, SequentialDataCommon, ShortSample

public interface SequentialData

Interface for objects that can be read and/or written by index. The index is not stored internally so they can be shared by multiple readers.

See Also:
FixedRateMonoReader, FixedRateStereoReader, FixedRateMonoWriter, FixedRateStereoWriter, VariableRateMonoReader, VariableRateStereoReader

Method Summary
 int getChannelsPerFrame()
           
 int getNumFrames()
           
 double getRateScaler(int index, double synthesisRate)
          Get rate to play the data.
 int getReleaseBegin()
           
 int getReleaseEnd()
           
 int getSustainBegin()
           
 int getSustainEnd()
           
 double readDouble(int index)
          Read a value at the given index.
 void writeDouble(int index, double value)
          Write a value at the given index.
 

Method Detail

writeDouble

void writeDouble(int index,
                 double value)
Write a value at the given index. Values are organized by frame. So index = ((channelsPerFrame*frameIndex)+channelIndex)


readDouble

double readDouble(int index)
Read a value at the given index.


getSustainBegin

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

getSustainEnd

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

getReleaseBegin

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

getReleaseEnd

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

getRateScaler

double getRateScaler(int index,
                     double synthesisRate)
Get rate to play the data. In an envelope this correspond to the inverse of the frame duration and would vary frame to frame. For an audio sample it is 1.0.

Parameters:
index -
synthesisRate -
Returns:
rate to scale the playback speed.

getChannelsPerFrame

int getChannelsPerFrame()
Returns:
For a stereo sample, return 2.

getNumFrames

int getNumFrames()
Returns:
The number of valid frames that can be read.