snex_shaper
A SNEX node that can be used to implement waveshaping algorithms.
If you're writing a waveshaper that transforms the audio signal, you can use this class. It gives you a special callback and also a display that shows the waveshaper function.
Be aware that if you export this node to C++, it will use this class as template to create a full node, but in SNEX you don't need to supply the ShaperType template parameter.
The default code template forwards all rendering functions to a single getSample(float input) method. As long as you your algorithm is stateless, you can just implement the logic there, otherwise you have to adapt the boilerplate process calls accordingly:
// this will be called for every sample in every channel
float getSample(float input)
{
return input;
}
// these callbacks just forward to the method above
template void process(T& data)
{
for(auto ch: data)
{
for(auto& s: data.toChannelData(ch))
{
s = getSample(s);
}
}
}
template void processFrame(T& data)
{
for(auto& s: data)
s = getSample(s);
}
Class methods
prepare
void prepare(PrepareSpecs ps)
reset
void reset()
process
template void process(ProcessDataType &data)
processFrame
template void processFrame(FrameDataType &data)
setExternalData
void setExternalData(const ExternalData &d, int index)
snex_node::setExternalData().
setParameter
template void setParameter(double v)
snex_node::setParameter
()