preset-pack

bradzilla84/preset-select/preset-pack

Pack a Preset
preset-pack
@/preset-pack
Pack a Preset
Num1number
Input 1
Num2number
Input 2
Num3number
Input 3
INITpulse
Update Preset/ Pack
preset-pack
OUT
Num1
Num2
Num3
INIT
OUT@/preset-pack
Output Packed Preset
To use the node in your project you should have the bradzilla84/preset-select library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

struct State {
    // this is a regular state related to the patch (i.e. constructor in this case)
};

struct Type {
    uint8_t N1;     // Define the number of inputs and type(add or remove for number of input pins)
    uint8_t N2;
    uint8_t N3;
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {

    if (!isInputDirty<input_INIT>(ctx)){
        return;}


    uint8_t N1 = getValue<input_Num1>(ctx);   //Get the current values if the block recives a pulse...or leave continuously(add or remove for number of input pins)
    uint8_t N2 = getValue<input_Num2>(ctx);
    uint8_t N3 = getValue<input_Num3>(ctx);
    Type Preset = { N1, N2, N3 };   //Pack in to a preset to pass to select node    //Follow the pattern (add or remove for number of input pins)
    emitValue<output_OUT>(ctx, Preset);
}