Skip to content

Instantly share code, notes, and snippets.

@modlfo
Last active April 17, 2020 08:57
Show Gist options
  • Select an option

  • Save modlfo/a9fe307f179370c05779fb23d0fc4bf1 to your computer and use it in GitHub Desktop.

Select an option

Save modlfo/a9fe307f179370c05779fb23d0fc4bf1 to your computer and use it in GitHub Desktop.
# General
All parameters range from 0.0 to 1.0
All inputs accept -1.0 to 1.0 (corresponding to -10V and 10V in VCV Rack). Same for the outputs
# Parameters
- parameter1: "Parameter 1" : controls the .... of the module
- parameter2: "Parameter 2" : controls the .... of the module
# Inputs
- input1: "Input 1" : receives the .... signal
- input2: "Input 2" : receives the .... signal
# Outputs
- output1: "Output 1" : produces ....
- output2: "Output 2" : produces ....
// Generated by the Vult compiler
// This file is acompanied by MyDSP.cpp, MyDSP.tables.h, vultin.cpp and vultin.h
// State
struct MyProcessor {
float other_data;
float output1;
float output2;
};
// Function that initialises the state
void MyProcessor_init(MyProcessor & processor);
// Function to process a single sample (when there’s more than one output, they are returned inside the MyProcessor struct)
void MyProcessor_process(MyProcessor &processor, float input1, input2);
// Functions to set parameters
void MyProcessor_setParameter1(MyProcessor &processor, float value);
void MyProcessor_setParameter2(MyProcessor &processor, float value);
// This file will be generated by the Vult compiler
#include "MyDSP.h"
class MyDSPEngine {
MyProcessor processor;
MyDSPEngine() {
MyProcessor_init(processor);
};
public:
struct Block {
float parameter1;
float parameter2;
};
struct Frame {
float input1;
float input2;
float output1;
float output2;
};
void process(Block& block, Frame* frames, int numFrames) {
MyProcessor_setParameter1(processor, block.parameter1);
MyProcessor_setParameter2(processor, block.parameter2);
for(int i = 0; i < numFrames; i++) {
MyProcessor_process(processor, frame[i].input1. frame[i].input2);
frame[i].output1 = processor.returned_output1;
frame[i].output2 = processor.returned_output2;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment