Just a general suggestion, when I was first learning how to develop plugins and modules, I found it invaluable to download a number of open source plugins’ code from GitHub in order to see what functioning code looks like.
I have made some modules a few years ago, just quit it for a while. I am not a programmer, but I have made a bunch of modules before
I do also have a bunch of modules to look at, but none of the ones I have has functions in separate cpp files. If you can recommend some, Ill gladly look at them. I did make a basic function that works, as I mentioned.
No I am in a separate cpp file. So that makes sense.
Is there any way to use the args.sampleRate, or to get the sample rate outside of the process block?
I did also try to add the #include <samplerate.h>
to the functions.cpp and functions.hpp files. That didn’t work either.
Anyway, it’s not something that can’t be done without the samplerate, but I just like to be able to use it for timing related stuff, like for a button, that I would like to turn on and off for 0,5 seconds. It just seemed rational to use the samplerate for that, so it’s consistent, no matter what samplerate you use.
I’d recommend propagating the sampleRate or sampleTime from your Module::process() method to your DSP classes and functions, instead of calling a Rack function from your DSP code. This makes your DSP code isolated from Rack functions and allows the compiler to better inline your code.