ofxPDSP
|
Utility class for storing and loading buffers of waveforms. More...
#include <WaveTable.h>
Public Member Functions | |
void | setEmpty (int index) |
clears the table at the given index. More... | |
void | setSample (int index, std::string path) |
sets the table at the given index to a sine waveform a waveform from a sample file located at path More... | |
void | setAdditiveWave (int index, std::initializer_list< float > partials, bool harmonicScale=false) |
generate a waveform from an inlined list of partials. This function is not thread safe, avoid access to the given index while you set wave, More... | |
void | setAdditiveWave (int index, const std::vector< float > &partials, bool harmonicScale=false) |
sets the table at the given index to a waveform from a given vector of partials. This function is not thread safe, avoid access to the given index while you set wave, More... | |
void | setSawWave (int index, int partials) |
sets the table at the given index to a sine waveform a sawtooth waveform with the given number of of partials. This function is not thread safe, avoid access to the given index while you set wave, More... | |
void | setSquareWave (int index, int partials) |
sets the table at the given index to a sine waveform a square waveform with the given number of of partials. This function is not thread safe, avoid access to the given index while you set wave, More... | |
void | setTriangleWave (int index, int partials) |
sets the table at the given index to a sine waveform a triangle waveform with the given number of of partials. This function is not thread safe, avoid access to the given index while you set wave, More... | |
void | setSineWave (int index) |
sets the table at the given index to a sine waveform. This function is not thread safe, avoid access to the given index while you set wave, More... | |
void | addEmpty (int numberOfWavesToAdd=1) |
adds an empty waveform. This function reallocate all the internal pointers, never access the wavetable while you call it. More... | |
void | addSample (std::string path) |
add a waveform from a sample file located at a given path. This function reallocate all the internal pointers, never access the wavetable while you call it. More... | |
void | addAdditiveWave (std::initializer_list< float > partials, bool harmonicScale=false) |
generate a waveform from an inlined list of partials. This function reallocate all the internal pointers, never access the wavetable while you call it. More... | |
void | addAdditiveWave (const std::vector< float > &partials, bool harmonicScale=false) |
generate a waveform from a given vector of partials. This function reallocate all the internal pointers, NEVER access the wavetable while you call it. More... | |
void | addSawWave (int partials) |
generate a sawtooth waveform with the given number of of partials. This function reallocate all the internal pointers, NEVER access the wavetable while you call it. More... | |
void | addSquareWave (int partials) |
generate a square waveform with the given number of of partials. This function reallocate all the internal pointers, NEVER access the wavetable while you call it. More... | |
void | addTriangleWave (int partials) |
generate a triangle waveform with the given number of of partials. This function reallocate all the internal pointers, NEVER access the wavetable while you call it. More... | |
void | addSineWave () |
generate a sine waveform. This function reallocate all the internal pointers, NEVER access the wavetable while you call it. | |
float * | table (int index) |
returns an handle to the buffer of the wave at the given index, avoid accessing the given index while you modify the wave values. More... | |
int | tableLength () const |
returns the lenght of each wave buffer | |
void | setup (int len, int maxPartials=64) |
sets the table length, and the maximum number of partial. More... | |
void | initLength (int len) |
int | size () const |
returns the size of the wavetable | |
void | setVerbose (bool verbose) |
enables logs for file loading | |
Friends | |
class | WaveTableOsc |
Utility class for storing and loading buffers of waveforms.
void pdsp::WaveTable::addAdditiveWave | ( | std::initializer_list< float > | partials, |
bool | harmonicScale = false |
||
) |
generate a waveform from an inlined list of partials. This function reallocate all the internal pointers, never access the wavetable while you call it.
[in] | partials | inlined array of partials |
[in] | harmonicScale | if true each value is multiplied by a saw wave corresponding partial |
void pdsp::WaveTable::addAdditiveWave | ( | const std::vector< float > & | partials, |
bool | harmonicScale = false |
||
) |
generate a waveform from a given vector of partials. This function reallocate all the internal pointers, NEVER access the wavetable while you call it.
[in] | harmonicScale | if true each value is multiplied by a saw wave corresponding partial |
void pdsp::WaveTable::addEmpty | ( | int | numberOfWavesToAdd = 1 | ) |
adds an empty waveform. This function reallocate all the internal pointers, never access the wavetable while you call it.
[in] | numberOfWavesToAdd | number of empty waveforms to add. 1 if not given. |
void pdsp::WaveTable::addSample | ( | std::string | path | ) |
add a waveform from a sample file located at a given path. This function reallocate all the internal pointers, never access the wavetable while you call it.
[in] | path | absolute or relative path to audio file |
void pdsp::WaveTable::addSawWave | ( | int | partials | ) |
generate a sawtooth waveform with the given number of of partials. This function reallocate all the internal pointers, NEVER access the wavetable while you call it.
[in] | partials | number of partials |
void pdsp::WaveTable::addSquareWave | ( | int | partials | ) |
generate a square waveform with the given number of of partials. This function reallocate all the internal pointers, NEVER access the wavetable while you call it.
[in] | partials | number of partials |
void pdsp::WaveTable::addTriangleWave | ( | int | partials | ) |
generate a triangle waveform with the given number of of partials. This function reallocate all the internal pointers, NEVER access the wavetable while you call it.
[in] | partials | number of partials |
void pdsp::WaveTable::setAdditiveWave | ( | int | index, |
std::initializer_list< float > | partials, | ||
bool | harmonicScale = false |
||
) |
generate a waveform from an inlined list of partials. This function is not thread safe, avoid access to the given index while you set wave,
[in] | index | index of the wavetable |
[in] | partials | inlined array of partials |
[in] | harmonicScale | if true each value is multiplied by a saw wave corresponding partial |
void pdsp::WaveTable::setAdditiveWave | ( | int | index, |
const std::vector< float > & | partials, | ||
bool | harmonicScale = false |
||
) |
sets the table at the given index to a waveform from a given vector of partials. This function is not thread safe, avoid access to the given index while you set wave,
[in] | index | index of the wavetable |
[in] | partials | inlined array of partials |
[in] | harmonicScale | if true each value is multiplied by a saw wave corresponding partial |
void pdsp::WaveTable::setEmpty | ( | int | index | ) |
clears the table at the given index.
[in] | index | index of the wavetable |
void pdsp::WaveTable::setSample | ( | int | index, |
std::string | path | ||
) |
sets the table at the given index to a sine waveform a waveform from a sample file located at path
[in] | index | index of the wavetable |
[in] | path | absolute or relative path to audio file |
void pdsp::WaveTable::setSawWave | ( | int | index, |
int | partials | ||
) |
sets the table at the given index to a sine waveform a sawtooth waveform with the given number of of partials. This function is not thread safe, avoid access to the given index while you set wave,
[in] | index | index of the wavetable |
[in] | partials | number of partials |
void pdsp::WaveTable::setSineWave | ( | int | index | ) |
sets the table at the given index to a sine waveform. This function is not thread safe, avoid access to the given index while you set wave,
[in] | index | index of the wavetable |
void pdsp::WaveTable::setSquareWave | ( | int | index, |
int | partials | ||
) |
sets the table at the given index to a sine waveform a square waveform with the given number of of partials. This function is not thread safe, avoid access to the given index while you set wave,
[in] | index | index of the wavetable |
[in] | partials | number of partials |
void pdsp::WaveTable::setTriangleWave | ( | int | index, |
int | partials | ||
) |
sets the table at the given index to a sine waveform a triangle waveform with the given number of of partials. This function is not thread safe, avoid access to the given index while you set wave,
[in] | index | index of the wavetable |
[in] | partials | number of partials |
void pdsp::WaveTable::setup | ( | int | len, |
int | maxPartials = 64 |
||
) |
sets the table length, and the maximum number of partial.
[in] | len | length of each wave sample buffer |
[in] | maxPartials | max number of partials available for the waves. 64 if not given. |
It is called automatically if you add samples as first waves, maxPartial default is 64. Keeping the partial number low will use less memory, 128-256 is enough, the old Waldorf synths sounded good with just 64 partial waves.
float * pdsp::WaveTable::table | ( | int | index | ) |
returns an handle to the buffer of the wave at the given index, avoid accessing the given index while you modify the wave values.
[in] | index | index of the wavetable |