|
8 months ago | |
---|---|---|
efsw @ 36f27d7ccf | 3 years ago | |
examples | 2 years ago | |
faust_libraries | 2 years ago | |
res | 2 years ago | |
src | 2 years ago | |
support/supercollider_extensions | 2 years ago | |
tests | 4 years ago | |
.gitignore | 2 years ago | |
.gitmodules | 3 years ago | |
CHANGELOG.md | 3 years ago | |
Faust.md | 2 years ago | |
LICENSE-GPLv3.txt | 4 years ago | |
LICENSE-dist.txt | 4 years ago | |
LICENSE.md | 3 years ago | |
Makefile | 2 years ago | |
README.md | 2 years ago | |
plugin.json | 3 years ago |
Scripting language host for VCV Rack containing:
Supported scripting languages:
This is the reference API for the JavaScript script engine, along with default property values.
Other script engines may vary in their syntax (e.g. block.inputs[i][j]
vs block.getInput(i, j)
vs input(i, j)
), but the functionality should be similar.
/** Display message on LED display.
*/
display(message)
/** Skip this many sample frames before running process().
For CV generators and processors, 256 is reasonable.
For sequencers, 32 is reasonable since process() will be called every 0.7ms with
a 44100kHz sample rate, which will capture 1ms-long triggers.
For audio generators and processors, 1 is recommended, but use `bufferSize` below.
If this is too slow for your purposes, consider writing a C++ plugin, since
native VCV Rack plugins have 10-100x better performance.
*/
config.frameDivider // 32
/** Instead of calling process() every sample frame, hold this many input/output
voltages in a buffer and call process() when it is full.
This decreases CPU usage, since processing buffers is faster than processing one
frame at a time.
The total latency of your script in seconds is
`config.frameDivider * config.bufferSize * block.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
/** Engine sample timestep in seconds. Equal to `1 / sampleRate`. Read-only.
Note that the actual time between process() calls is
`block.sampleTime * config.frameDivider`.
*/
block.sampleTime
/** The actual size of the input/output buffers.
*/
block.bufferSize
/** Voltage of the input port of column `i`. Read-only.
*/
block.inputs[i][bufferIndex] // 0.0
/** Voltage of the output port of column `i`. Read/write.
*/
block.outputs[i][bufferIndex] // 0.0
/** Value of the knob of column `i`. Between 0 and 1. Read/write.
*/
block.knobs[i] // 0.0
/** Pressed state of the switch of column `i`. Read-only.
*/
block.switches[i] // false
/** Brightness of the RGB LED of column `i`, between 0 and 1. Read/write.
*/
block.lights[i][0] // 0.0 (red)
block.lights[i][1] // 0.0 (green)
block.lights[i][2] // 0.0 (blue)
/** Brightness of the switch RGB LED of column `i`. Read/write.
*/
block.switchLights[i][0] // 0.0 (red)
block.switchLights[i][1] // 0.0 (green)
block.switchLights[i][2] // 0.0 (blue)
}
The Vult API is slightly different than Prototype's scripting API.
See examples/template.vult
for a reference of the Vult API.
Set up your build environment like described here, including the dependencies: https://vcvrack.com/manual/Building
Additionally:
pacman -S mingw-w64-x86_64-premake
brew install premake
sudo apt install premake4
sudo pacman -S premake
export RACK_DIR=/set/path/to/Rack-SDK/
git submodule update --init --recursive
make dep
make
make dep
, following the Duktape example in Makefile
.MyEngine.cpp
file (for example) in src/
with a ScriptEngine
subclass defining the virtual methods, using src/DuktapeEngine.cpp
as an example.examples/
. These will be included in the plugin package for the user.