Logo Search packages:      
Sourcecode: csound version File versions  Download package

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 - 2005.

Definition at line 23 of file SineWave.h.


Public Types

typedef unsigned long StkFormat

Public Member Functions

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.
void addTime (StkFloat time)
 Increment the read pointer by time samples, modulo file size.
virtual StkFloat lastOut (void) const
 Return the last output value.
void reset (void)
 Clear output and reset time pointer to zero.
void setFrequency (StkFloat frequency)
 Set the data interpolation rate based on a looping frequency.
void setRate (StkFloat rate)
 Set the data read rate in samples. The rate can be negative.
 SineWave (void)
 Default constructor.
StkFramestick (StkFrames &frames, unsigned int channel=0)
 Fill a channel of the StkFrames object with computed outputs.
StkFloat tick (void)
 Compute one sample and output.
virtual ~SineWave (void)
 Class destructor.

Static Public Member Functions

static void handleError (std::string message, StkError::Type type)
 Static function for error reporting and handling using c++ strings.
static void handleError (const char *message, StkError::Type type)
 Static function for error reporting and handling using c-strings.
static void printErrors (bool status)
 Toggle display of error messages before throwing exceptions.
static std::string rawwavePath (void)
 Static method which returns the current rawwave path.
static StkFloat sampleRate (void)
 Static method which returns the current STK sample rate.
static void setRawwavePath (std::string path)
 Static method which sets the STK rawwave path.
static void setSampleRate (StkFloat rate)
 Static method which sets the STK sample rate.
static void showWarnings (bool status)
 Toggle display of WARNING and STATUS messages.
static void sleep (unsigned long milliseconds)
 Static cross-platform method to sleep for a number of milliseconds.
static void swap16 (unsigned char *ptr)
 Static method which byte-swaps a 16-bit data type.
static void swap32 (unsigned char *ptr)
 Static method which byte-swaps a 32-bit data type.
static void swap64 (unsigned char *ptr)
 Static method which byte-swaps a 64-bit data type.

Static Public Attributes

static const StkFormat STK_FLOAT32 = 0x10
static const StkFormat STK_FLOAT64 = 0x20
static const StkFormat STK_SINT16 = 0x2
static const StkFormat STK_SINT24 = 0x4
static const StkFormat STK_SINT32 = 0x8
static const StkFormat STK_SINT8 = 0x1

Protected Member Functions

StkFloat computeSample (void)
void handleError (StkError::Type type)
 Internal function for error reporting which assumes message in errorString_ variable.

Protected Attributes

std::ostringstream errorString_
StkFloat lastOutput_
StkFloat phaseOffset_
StkFloat rate_
StkFloat time_

Static Protected Attributes

static StkFrames table_

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index