OAVp5.wiring()#
functionoav-p5OAVp5.wiring([dev])
Lists which controller knob, fader or pad drives which OpenProcessing OPC variable right now: [{ control: 'knob1', name: 'radius' }, …].
With OP Configurator, OPC.slider('radius', 10) declares a variable and oav-p5 wires the controller to the OPC variables in order: knob 1 to the first slider, knob 2 to the second, the faders after the knobs, pad 1 to the first toggle or button. This is the list of who drives what, the same one the panel prints under the controller and the console says once. Use it when a knob moves the wrong thing.
Parameters
| Name | Type | Description |
|---|---|---|
dev | String | Whose numbering to use: 'screen' (the controller shown in the panel) or a profile id such as 'akai-lpd8'. It matters for the faders, which are numbered after the knobs. optional default 'screen' |
Returns
Array<Object> One { control, name } per wired variable: control is 'knob1', 'fader2', 'pad1' …, name is the OPC variable. A control the sketch reads itself also has sketch: true, and its slider no longer follows it. An empty array when there is no OPC on the page or opc is off.
Notes
midi.wiring(…)is the same function.
Examples
function setup() {
createCanvas(400, 300);
}
function draw() {
background(20);
fill(255);
const wired = OAVp5.wiring();
text(wired.length ? wired.map((w) => w.control + ' -> ' + w.name).join('\n') : 'nothing wired (no OPC here)', 20, 30);
}To be confirmed
Not tried with OpenProcessing's real OPC library: it was checked against a stand-in object with the same options shape ({ type: 'slider', name, min, max }). Outside OpenProcessing the result is an empty array.
Related
opcWhether oav-p5 wires the controller to the variables of OP Configurator (OpenProcessing's sliders and buttons):onoroff.knob1The position of a controller knob, from 0 to 1:knob1is the first knob,knob2the second, up toknob8.knob()Returns the position of knob numbern, from 0 to 1: the same asknob1toknob8, for anyn.pad1How hard a drum pad is pressed, from 0 to 1:pad1is the first pad, up topad16; 0 when it is let go.OAVp5.check()Runs the 🩺 check-up: the version, page, browser, microphone, MIDI, sound, drums, recording, wiring and hints, as a card to screenshot and as an object.