silver2row am I allowed to use more than one boot setup class in the source?
you can only have one setup()
function in a project.
silver2row I looked up the math_neon.h file and there is nothing in it on the docs. Is that on purpose?
there is not much to know about it. It contains fast implementations of some of the math functions available in the standard C library. See, e.g.: https://github.com/BelaPlatform/Bela/wiki/Fast-math-functions, or The Source https://github.com/giuliomoro/math-neon.
silver2row Anyway, do I need to make the bool class in .cpp file aware of my interactions/source within render?
I have no idea what this means.
The full file would look like this:
#include <Bela.h>
#include <libraries/math_neon/math_neon.h>
bool setup(BelaContext *context, void *userData)
{
return true;
}
void render(BelaContext *context, void *userData)
{
for(unsigned int n = 0; n < context->audioFrames; ++n)
{
for(unsigned int c = 0; c < context->audioInChannels && c < context->audioOutChannels; ++c)
{
float gain = 1;
float in = audioRead(context, n, c);
float out = tanhf_neon(in * gain); // using tanh for distortion. Experiment with other functions here
audioWrite(context, n, c, out);
}
}
}
void cleanup(BelaContext *context, void *userData)
{}