#include <OscillatorBank.h>
A class for computing a table-lookup oscillator bank. The internal routine is highly optimized, written in NEON assembly. All oscillators in the bank share the same wavetable. Linear interpolation is used.
- Examples:
- Extras/oscillator-bank/render.cpp.
int OscillatorBank::setup |
( |
float |
newSampleRate, |
|
|
unsigned int |
newWavetableLength, |
|
|
unsigned int |
newNumOscillators |
|
) |
| |
|
inline |
Initialize the oscillator bank, allocating the memory with the appropriate alignment required by the NEON code.
- Parameters
-
newSampleRate | the sampling rate of the output samples. This affects the internal scaling of the oscillator frequencies. |
newWavetableLength | the length of the wavetable. The internal wavetable will have length *(newWavetableLength + 1)*. |
newNumOscillators | the number of oscillators to use. The class will internally increment and store the frequency, amplitude and phase of each oscillator. |
- Returns
- 0 upon success, a negative value otherwise.
- Examples:
- Extras/oscillator-bank/render.cpp.
float* OscillatorBank::getWavetable |
( |
| ) |
|
|
inline |
Get the wavetable. It is the responsibilty of the user to fill it with the waveform that will be played by the oscillators. The internally stored wavetable will have length (getWavetableLength() + 1)
The user should fill the last sample with the same value as the first sample.
- Returns
- a pointer to the wavetable array, of length
(getWavetableLength() + 1)
- Examples:
- Extras/oscillator-bank/render.cpp.
int OscillatorBank::getWavetableLength |
( |
| ) |
|
|
inline |
int OscillatorBank::getNumOscillators |
( |
| ) |
|
|
inline |
Get the number of oscillators.
- Returns
- the number of oscillators.
float* OscillatorBank::getAmplitudes |
( |
| ) |
|
|
inline |
Get the array of amplitudes. This array has length getNumOscillators()
- Returns
- a pointer to the array of amplitudes.
float* OscillatorBank::getPhases |
( |
| ) |
|
|
inline |
Get the internal array of phases which hold the state of the oscillators. This array has length getNumOscillators()
- Returns
- a pointer to the arrat of phases.
void OscillatorBank::setAmplitude |
( |
int |
n, |
|
|
float |
amplitude |
|
) |
| |
|
inline |
void OscillatorBank::setFrequency |
( |
int |
n, |
|
|
float |
frequency |
|
) |
| |
|
inline |
void OscillatorBank::clearArrays |
( |
| ) |
|
|
inline |
Clears the internal arrays which hold the states of the oscillator bank.
void OscillatorBank::process |
( |
unsigned int |
frames, |
|
|
float * |
output |
|
) |
| |
|
inline |
Process the oscillator bank, update the internal states and return the output values .
- Parameters
-
frames | the number of frames to process |
output | the array where the frames output values will be stored. |
- Examples:
- Extras/oscillator-bank/render.cpp.
The documentation for this class was generated from the following file: