#include <gapefunctionunit.h>
Inheritance diagram for GapeFunctionUnit::
Public Slots | |
virtual void | receiveTick (const GapeFloat *values, int numValues) |
If a function unit recieves a NULL tick it will emit a mono tick with the next sample in their waveform, otherwise it will add the next sample (scaled by the current gain) to as many channels of as it receives. | |
Public Methods | |
GapeFunctionUnit (GapeController *c=NULL, int nChannels=1) | |
virtual | ~GapeFunctionUnit () |
Protected Methods | |
virtual void | fillBuffer ()=0 |
Pure virtual function which fills the FunctionUnit's internal buffer with data representing one period of a waveform. More... | |
void | normalize () |
Protected Attributes | |
GapeFloat* | sampleData |
int | dataLength |
bool | initialized |
double | period |
double | timeScalar |
double | oldFrequency |
double | currentTime |
char | errorBuffer [255] |
The can function as either sources, in which case they recieve a NULL tick in receiveTick and emit a tick with the next sample in their waveform (the number of channels is determined by the parameter in the constructor, or by using set/getNumChannels) Or the can act as filters, in which case they will add the next sample in their waveform (scaled by the current gain) to the signal. The function unit will add its waveform to as many channels of incoming audio as it's numChannels is set to - for instance, if a sine unit is set to one channel, and it receives a stereo sample, it will only add a sine wave to the first channel. Subclasses must implement the fillBuffer function, which simply creates a buffer of data corresponding to one period of the waveform. This class takes care of all the things like interpolation for different frequencies and sample rates, cleaning up the buffer upon destruction, etc.
Definition at line 34 of file gapefunctionunit.h.
|
Pure virtual function which fills the FunctionUnit's internal buffer with data representing one period of a waveform. You must allocate storage for this buffer (which is designated by the sampleData pointer) and also set the length of the data (in samples) in the variable dataLength. Deallocation of the data is taken care of by the destructor. Reimplemented in GapeSineUnit, GapeSquareUnit, GapeSawtoothUnit, GapeTriangleUnit, GapeHalfwaveUnit, GapeDrawnWaveformUnit, and GapeFileSampleUnit. Referenced by receiveTick().
|