open-audiovisual
Search GitHub

oav-p5 reference · Loading options

opc#

optionoav-p5
?oav_opc=on | off

Whether oav-p5 wires the controller to the variables of OP Configurator (OpenProcessing's sliders and buttons): on or off.

On OpenProcessing, OPC.slider('radius', 10) declares a variable with a slider. With opc on, oav-p5 then 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. OPC's own panel moves with the knob. OAVp5.wiring() lists who drives what.

off leaves OPC's variables to their own sliders. A control the sketch reads itself (knob1 in draw()) is the sketch's anyway: the slider at that place stops following it.

Type
String
Values
on | off
default
on

Only off turns it off.

Notes

  • Set it before oav-p5 loads. window.OAV_P5 = { opc: … }; above the loader line wins, then ?oav_opc=… on the page address, then ?opc=… on the script's own URL. Values in window.OAV_P5 are turned into text, so write 'off', not false. On OpenProcessing the page address takes ?sketch_oav_opc=… (the project's README says OpenProcessing forwards it to the sketch).

Examples

jsOpenProcessing ↗
window.OAV_P5 = { opc: 'off' };

function setup() {
  createCanvas(400, 300);
}

function draw() {
  background(20);
  fill(255);
  text('opc option: ' + OAVp5.options.opc, 20, 30);
  text('controls wired to OPC variables: ' + OAVp5.wiring().length, 20, 60);   // 0
}
Outside OpenProcessing there is no OPC, so the count is 0 either way. On OpenProcessing with sliders declared, it is 0 with opc: 'off' and the number of sliders and buttons without it.

To be confirmed

Not tried with OpenProcessing's real OPC library. The wiring was checked against a stand-in object with the same options shape, and the example here runs where no OPC exists, so it only shows the option arriving.

Related

  • OAVp5.wiring() Lists which controller knob, fader or pad drives which OpenProcessing OPC variable right now: [{ control: 'knob1', name: 'radius' }, …].
  • knob1 The position of a controller knob, from 0 to 1: knob1 is the first knob, knob2 the second, up to knob8.
  • knob() Returns the position of knob number n, from 0 to 1: the same as knob1 to knob8, for any n.
  • pad1 How hard a drum pad is pressed, from 0 to 1: pad1 is the first pad, up to pad16; 0 when it is let go.

p5/oav-p5.js, line 127

↑ Back to top · All names