Hi, i’ve been trying to reverse engineer the source code of some Fundamental modules with the aim to learn more about how they work, and hopefully use this knowledge to eventually be able to build my own, but have come up against some roadblocks…
For example, to start off simple I tried to add 2 separate sine outputs (with two separate knobs obviously) to the Template module… To do this I attempted to just add another Pitch param:
struct MyModule : Module {
enum ParamId {
PITCH_PARAM,
PITCH_PARAM2,
NUM_PARAMS
and clone every instance of PITCH_PARAM with a duplicate line of code for PITCH2_PARAM
void process(const ProcessArgs &args) override {
// Implement a simple sine oscillator
// Compute the frequency from the pitch parameter and input
float pitch = params[PITCH_PARAM].getValue();
params[PITCH2_PARAM].getValue();
And the same for:
outputs[SINE_OUTPUT].setVoltage(5.f * sine);
outputs[SINE2_OUTPUT].setVoltage(5.f * sine);
etc…
I knew this would be very crude, and probably wouldn’t work, but I haven’t been able to figure out why. I can post detailed build errors if you want them.
If someone could help I would appreciate it very much.