Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

Plug-in Block (plugin)

A custom block you write as a sandboxed WebAssembly module.

plugin

Component reference · 繁體中文

Group: Custom blocks · Kind: {"kind":"plugin","module":"gainOffset"}

When to use it

Use it for control logic that no library block provides. Prefer a library control block when one exists, because it is faster.

Pins

Pin Domain Meaning
in1 signal Signal input 1; reads 0 when unconnected
in2 signal Signal input 2; reads 0 when unconnected
out1 signal Signal output 1, written each step
out2 signal Signal output 2, written each step

Model

The module registered under the component's module name runs once per accepted step with the current time t, reads in1 and in2, and writes out1 and out2. Numeric parameters are passed in the order of their names sorted by bytes, at most 16, with upper case before lower case. The module has no access to files, network or clock, and limits on memory and instruction count stop a runaway module with an error.

Common mistakes

  • Register the module under the same name before the circuit runs, because the plug-in is not saved in the circuit file. An unregistered module stops the compile with an error.
  • Parameters arrive in alphabetical order, not the order you typed them, so gain comes before offset. A NaN or infinite output stops the run, and an unconnected input reads 0.

Problems rules: compile.error, pin.unconnected

Datasheet and sources

There is no datasheet. The parameters are your own design constants, such as gains, limits and sample times, and the module reads the time t itself when it needs a fixed sample rate.

Example

Open the example with the command file.openExample and the name demo:plugin.


Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.