hardware#
optionoav-p5?oav_hardware=auto | click | off
When oav-p5 asks the browser for Web MIDI, which a real controller needs: auto at load, click when the 🎹 panel opens, or off.
With auto, oav-p5 asks for Web MIDI as soon as it loads, so a plugged-in controller plays the sketch without anyone pressing anything. The browser remembers your answer per site. With click, it asks only when the 🎹 panel is first opened. With off, it never asks by itself, and the on-screen controller and a phone still play the sketch.
OAVp5.connectHardware() asks whatever the option says, and OAVp5.hardware tells you the state: 'off' until it has been asked.
- Type
String- Values
auto | click | off- default
auto (click in Strudel)
Only auto and click ask. Any other value acts like off.
Notes
- On strudel.cc (or a page where Strudel's own functions are present) the default is
click, because Strudel'smidin()asks for MIDI itself. Settinghardwareyourself wins. - Safari and iPad have no Web MIDI at all: when oav-p5 asks (or you call
OAVp5.connectHardware()), the state there becomes'unavailable'. - Set it before oav-p5 loads.
window.OAV_P5 = { hardware: … };above the loader line wins, then?oav_hardware=…on the page address, then?hardware=…on the script's own URL. Values inwindow.OAV_P5are turned into text, so write'off', notfalse. On OpenProcessing the page address takes?sketch_oav_hardware=…(the project's README says OpenProcessing forwards it to the sketch).
Examples
window.OAV_P5 = { hardware: 'click' };
function setup() {
createCanvas(400, 300);
}
function draw() {
background(20);
fill(255);
text('hardware option: ' + OAVp5.options.hardware, 20, 30);
text('Web MIDI state: ' + OAVp5.hardware, 20, 60); // stays "off" until you open the 🎹 panel
}Related
OAVp5.hardwareWhere Web MIDI stands:'off','asking','connected','waiting','denied'or'unavailable'.OAVp5.connectHardware()Asks the browser for Web MIDI now, and returns a promise that says whether a real controller can be heard.OAVp5.devicesThe names of the MIDI controllers plugged in, as the browser reports them: an array of text, empty when there is none.panelWhether the 🎹 panel starts shut, open, or does not exist:closed,openoroff.strudelWhether oav-p5 treats the page as Strudel, the live-coding editor, and behaves politely beside it:auto,onoroff.