Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


SineWave Class Reference

#include <SineWave.h>

Inheritance diagram for SineWave:

Generator Stk List of all members.

Detailed Description

STK sinusoid oscillator class.

This class computes and saves a static sine "table" that can be shared by multiple instances. It has an interface similar to the WaveLoop class but inherits from the Generator class. Output values are computed using linear interpolation.

The "table" length, set in SineWave.h, is 2048 samples by default.

by Perry R. Cook and Gary P. Scavone, 1995 - 2007.


Public Member Functions

 SineWave (void)
 Default constructor.
virtual ~SineWave (void)
 Class destructor.
void reset (void)
 Clear output and reset time pointer to zero.
void setRate (StkFloat rate)
 Set the data read rate in samples. The rate can be negative.
void setFrequency (StkFloat frequency)
 Set the data interpolation rate based on a looping frequency.
void addTime (StkFloat time)
 Increment the read pointer by time samples, modulo file size.
void addPhase (StkFloat angle)
 Increment current read pointer by angle, relative to a looping frequency.
void addPhaseOffset (StkFloat angle)
 Add a phase offset to the current read pointer.


Member Function Documentation

void SineWave::setRate StkFloat  rate  )  [inline]
 

Set the data read rate in samples. The rate can be negative.

If the rate value is negative, the data is read in reverse order.

void SineWave::setFrequency StkFloat  frequency  ) 
 

Set the data interpolation rate based on a looping frequency.

This function determines the interpolation rate based on the file size and the current Stk::sampleRate. The frequency value corresponds to file cycles per second. The frequency can be negative, in which case the loop is read in reverse order.

void SineWave::addPhase StkFloat  angle  ) 
 

Increment current read pointer by angle, relative to a looping frequency.

This function increments the read pointer based on the file size and the current Stk::sampleRate. The anAngle value is a multiple of file size.

void SineWave::addPhaseOffset StkFloat  angle  ) 
 

Add a phase offset to the current read pointer.

This function determines a time offset based on the file size and the current Stk::sampleRate. The angle value is a multiple of file size.


The documentation for this class was generated from the following file:
The Synthesis ToolKit in C++ (STK)
©1995-2007 Perry R. Cook and Gary P. Scavone. All Rights Reserved.