You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Andrew Belt 785b7b4c78 Initial commit 5 years ago
examples Initial commit 5 years ago
res Initial commit 5 years ago
src Initial commit 5 years ago
.gitignore Initial commit 5 years ago
LICENSE-dist.txt Initial commit 5 years ago
LICENSE.txt Initial commit 5 years ago
Makefile Initial commit 5 years ago
README.md Initial commit 5 years ago
plugin.json Initial commit 5 years ago

README.md

VCV Prototype

Scripting language host for VCV Rack containing:

  • 6 inputs
  • 6 outputs
  • 6 knobs
  • 6 lights (RGB LEDs)
  • 6 switches with RGB LEDs

Scripting API

This is a reference API for the DuktapeEngine (JavaScript). Other script engines may vary in their syntax (e.g. block.inputs[i][j] vs block.getInput(i, j) vs input(i, j)).

// Display message on LED display.
display(message)
// Skip this many sample frames before running process().
// For sequencers, 32 is reasonable since process() will be called every 0.7ms with a 44100kHz sample rate.
// For audio generators and processors, 1 is recommended. If this is too slow for your purposes, write a C++ plugin.
config.frameDivider = 1
// Number of samples to store each block passed to process().
// Latency introduced by buffers is `bufferSize * frameDivider * sampleTime`.
config.bufferSize = 1

// Called when the next block is ready to be processed.
function process(block) {
	// Engine sample rate in Hz. Read-only.
	block.sampleRate
	// Equal to `1 / sampleRate`. Read-only.
	block.sampleTime
	// The actual buffer size, requested by `config.bufferSize`. Read-only.
	block.bufferSize
	// Voltage of the input port of row `i` and buffer index `j`. Read-only.
	block.inputs[i][j]
	// Voltage of the output port of row `i` and buffer index `j`. Writable.
	block.outputs[i][j]
	// Value of the knob of row `i`. Between 0 and 1. Read-only.
	block.knobs[i]
	// Pressed state of the switch of row `i`. Read-only.
	block.switches[i]
	// Brightness of the RGB LED of row `i` and color index `c`. Writable.
	// `c=0` for red, `c=1` for green, `c=2` for blue.
	block.lights[i][c]
	// Brightness of the switch RGB LED of row `i` and color index `c`. Writable.
	block.switchLights[i][c]
}

Adding a script engine

  • Add your scripting language library to the build system so it builds with make dep, following the Duktape example in the Makefile.
  • Create a MyEngine.cpp file in src/ with a ScriptEngine subclass defining the virtual methods, following src/DuktapeEngine.cpp as an example.
  • Add your engine to the “List of ScriptEngines” in src/ScriptEngine.cpp.
  • Build and test VCV Prototype.
  • Add a few example scripts and tests to examples/. These will be included in the plugin package for the user.
  • Add your name to the Contributers list below.
  • Send a pull request. Once merged, you will be added as a repo maintainer. Be sure to “watch” this repo to be notified of bugs in your engine.

Maintainers