Fundamentals

Modules

Lesson 5 of 9

A module is a unit of DSP written in Cmajor. It declares its inputs and outputs, the widgets on its faceplate, and the code that runs per sample. Modules are the only thing in Route that makes or changes signal.

Open one and you get its source in an editor with syntax highlighting. Change it and the patch recompiles while audio keeps running. Compile errors carry a line and a column, and land in the editor next to the code that caused them.

processor Gain [[ main, width: 1, height: 1, titleColor: "blue" ]]
{
    input  stream float32<2> in  [[ pinTop: 5 ]];
    output stream float32<2> out [[ pinTop: 5 ]];

    input value float32 knobValue [[
        widget: "knob", x: 10, y: 3, w: 44, h: 44, default: 0.5
    ]];

    void main()
    {
        loop {
            out <- (in[0] * knobValue, in[1] * knobValue);
            advance();
        }
    }
}

The faceplate lives in the source

Pin positions and knob geometry are annotations on the declarations they belong to, and so are colours and tags. The node art and the signal path come from the same file, so they cannot describe two different modules.