ofxPDSP
|
plays SampleBuffer More...
#include <Sampler.h>
Public Member Functions | |
Patchable & | in_trig () |
Sets "trig" as selected input and returns this Unit ready to be patched. This is the default input. Each time a trigger on value is received in_select(), in_start() and in_direction() are processed, the sample is selected and retriggered from the in_start() value and played in the in_direction() direction. | |
Patchable & | in_pitch () |
Sets "pitch" as selected input and returns this Unit ready to be patched. This input change the sample pitch (and speed). | |
Patchable & | in_select () |
Sets "select" as selected input and returns this Unit ready to be patched. This input change the sample selected from the one added to this Sampler. | |
Patchable & | in_start () |
Sets "start" as selected input and returns this Unit ready to be patched. This input change the starting position of the sample playing, from 0.0f (plays from start) to 1.0f (plays from the last sample). 0.0f is the standard value. If you are not hearing any sound probably the start position is not correct. Remember to set it to 1.0f if you want to play the sample backwards (-1.0f >> in_direction() ). | |
Patchable & | in_start_mod () |
Sets "start_mod" as selected input and returns this Unit ready to be patched. This input change how much the dynamic of the trigger will change the start position, lower dynamics will offset the position away from the start (softening the sound). Default value is 0.0f (no trigger influence on start position). | |
Patchable & | in_direction () |
Sets "direction" as selected input and returns this Unit ready to be patched. A positive value will set the sampler to play forward and a negative value will set it to play in reverse. Remember to patch a value greater than 0.0f to in_start() if you want to play in reverse. | |
Patchable & | out_signal () |
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default output. This is the sampler output. | |
void | addSample (SampleBuffer *newSample, int channel=0) |
adds a pointer to a SampleBuffer to an internal array of SampleBuffer pointers More... | |
bool | setSample (SampleBuffer *newSample, int index, int channel=0) |
Sets the SampleBuffer pointer at the given index to a new pointer. More... | |
float | meter_position () const |
returns a value from 0.0f to 1.0f that broadly rapresent the "playhead" of the current sample. This method is thread-safe. | |
Public Member Functions inherited from pdsp::Unit | |
Unit (const Unit &other) | |
Unit & | operator= (const Unit &other) |
Unit (Unit &&other) | |
Unit & | operator= (Unit &&other) |
virtual void | setOversampleLevel (int newOversampleLevel) |
sets the unit oversample level More... | |
int | getOversampleLevel () const |
returns the Unit oversample level | |
Public Member Functions inherited from pdsp::Patchable | |
void | resetInputToDefault () |
resets the selected input to the default. | |
void | resetOutputToDefault () |
resets the selected output to the default. | |
Patchable & | in (const char *tag) |
sets the selected input to the one tagged with "tag", if tag is a valid string, and returns this Patchable ready to be patched. More... | |
Patchable & | out (const char *tag) |
sets the selected output to the one tagged with "tag", if tag is a valid string, and returns this Patchable ready to be patched. More... | |
void | disconnectIn () |
disconnects all the outputs connected to the selected input, then resets the selected input to the default. | |
void | disconnectOut () |
disconnects all the inputs connected to the selected output, then resets the selected output to the default. | |
void | disconnectAll () |
disconnects all the inputs and outputs to their connected outputs and inputs. Also resets the selected input and output to the default. | |
InputNode & | getSelectedInput () |
returns the selected input, you can patch a Patchable or OutputNode to it with the >> operator. | |
OutputNode & | getSelectedOutput () |
returns the selected output, you can patch it to another Patchable or InputNode with the >> operator. | |
std::vector< std::string > | getInputsList () |
returns a vector of the valid input tags | |
std::vector< std::string > | getOutputsList () |
returns a vector of the valid input tags | |
Additional Inherited Members | |
Static Public Member Functions inherited from pdsp::Preparable | |
static double | getGlobalSampleRate () |
Protected Member Functions inherited from pdsp::Unit | |
void | prepareToPlay (int expectedBufferSize, double sampleRate) override |
you have to use this method only in the constructor, inside if(dynamicConstruction){ } More... | |
const float * | processInput (InputNode &node, int &stateNow) |
process the given input, gives you a pointer to the processed buffer as result and its state More... | |
float | processAndGetSingleValue (InputNode &input, int pos) |
process the given input, gives you a pointer to the processed buffer as result and its state More... | |
float * | getOutputBufferToFill (OutputNode &node) |
gets a pointer to the output buffer for rendering audio to it, and sets the OutputNode state to AudioRate More... | |
void | setControlRateOutput (OutputNode &node, float scalarValue) |
sets the OutputNode buffer to "Changed" and its first value to scalarValue More... | |
void | setOutputToZero (OutputNode &node) |
sets the OutputNode buffer to "Changed" and its first value to 0.0f More... | |
void | updateOutputNodes () |
call this method in the Unit constructor after adding all the Outputs, this is mandatory for the inner working of the patching framework. | |
Protected Member Functions inherited from pdsp::Patchable | |
void | addOutput (const char *tag, OutputNode &output) |
method to add outputs when constructing a Unit More... | |
void | addInput (const char *tag, InputNode &input) |
method to add inputs when constructing a Unit More... | |
void | addModuleOutput (const char *tag, Patchable &unit) |
method to add outputs when constructing a module More... | |
void | addModuleInput (const char *tag, Patchable &unit) |
method to add outputs when constructing a module More... | |
plays SampleBuffer
This class plays SampleBuffers, it can change the sample pitch, change the start position, play in revers, and select a different sample when is triggered with in_select().
void pdsp::Sampler::addSample | ( | SampleBuffer * | newSample, |
int | channel = 0 |
||
) |
adds a pointer to a SampleBuffer to an internal array of SampleBuffer pointers
[in] | newSample | pointer to a SampleBuffer |
[in] | channel | selelect channel, usually 0 is left and 1 right, if not given 0 is used |
bool pdsp::Sampler::setSample | ( | SampleBuffer * | newSample, |
int | index, | ||
int | channel = 0 |
||
) |
Sets the SampleBuffer pointer at the given index to a new pointer.
[in] | newSample | pointer to a SampleBuffer |
[in] | index | sample index |
[in] | channel | selelect channel, usually 0 is left and 1 right, if not given 0 is used |