com.jsyn.data
Class AudioSample

java.lang.Object
  extended by com.jsyn.data.SequentialDataCommon
      extended by com.jsyn.data.AudioSample
All Implemented Interfaces:
SequentialData
Direct Known Subclasses:
FloatSample, ShortSample

public abstract class AudioSample
extends SequentialDataCommon

Base class for FloatSample and ShortSample.


Constructor Summary
AudioSample()
           
 
Method Summary
abstract  void allocate(int numFrames, int channelsPerFrame)
           
 int getChannelsPerFrame()
           
 double getFrameRate()
           
 int getNumFrames()
           
 double getRateScaler(int index, double synthesisRate)
          Get rate to play the data.
 void setFrameRate(double f)
           
 
Methods inherited from class com.jsyn.data.SequentialDataCommon
getReleaseBegin, getReleaseEnd, getSustainBegin, getSustainEnd, readDouble, setReleaseBegin, setReleaseEnd, setSustainBegin, setSustainEnd, writeDouble
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioSample

public AudioSample()
Method Detail

allocate

public abstract void allocate(int numFrames,
                              int channelsPerFrame)

getRateScaler

public double getRateScaler(int index,
                            double synthesisRate)
Description copied from interface: SequentialData
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.

Specified by:
getRateScaler in interface SequentialData
Specified by:
getRateScaler in class SequentialDataCommon
Returns:
rate to scale the playback speed.

getFrameRate

public double getFrameRate()

setFrameRate

public void setFrameRate(double f)

getNumFrames

public int getNumFrames()
Specified by:
getNumFrames in interface SequentialData
Overrides:
getNumFrames in class SequentialDataCommon
Returns:
The number of valid frames that can be read.

getChannelsPerFrame

public int getChannelsPerFrame()
Specified by:
getChannelsPerFrame in interface SequentialData
Specified by:
getChannelsPerFrame in class SequentialDataCommon
Returns:
For a stereo sample, return 2.