Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


WaveLoop Class Reference

#include <WaveLoop.h>

Inheritance diagram for WaveLoop:

FileWvIn WvIn Stk List of all members.

Detailed Description

STK waveform oscillator class.

This class inherits from FileWvIn and provides audio file looping functionality. Any audio file that can be loaded by FileRead can be looped using this class.

WaveLoop supports multi-channel data. It is important to distinguish the tick() methods, which return samples produced by averaging across sample frames, from the tickFrame() methods, which return references or pointers to multi-channel sample frames.

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


Public Member Functions

 WaveLoop (unsigned long chunkThreshold=1000000, unsigned long chunkSize=1024)
 Default constructor.
 WaveLoop (std::string fileName, bool raw=false, bool doNormalize=true, unsigned long chunkThreshold=1000000, unsigned long chunkSize=1024)
 Class constructor that opens a specified file.
virtual ~WaveLoop ()
 Class destructor.
void openFile (std::string fileName, bool raw=false, bool doNormalize=true)
 Open the specified file and load its data.
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 WaveLoop::openFile std::string  fileName,
bool  raw = false,
bool  doNormalize = true
 

Open the specified file and load its data.

Data from a previously opened file will be overwritten by this function. An StkError will be thrown if the file is not found, its format is unknown, or a read error occurs. If the file data is to be loaded incrementally from disk and normalization is specified, a scaling will be applied with respect to fixed-point limits. If the data format is floating-point, no scaling is performed.

Reimplemented from FileWvIn.

void WaveLoop::setRate StkFloat  rate  ) 
 

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.

Reimplemented from FileWvIn.

void WaveLoop::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 WaveLoop::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 WaveLoop::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.