open-audiovisual
Search GitHub

oav-p5 reference · MIDI: knobs, faders, pads, keys

OAVp5.panel.open()#

functionoav-p5
OAVp5.panel.open()

Also: OAVp5.panel.close OAVp5.panel.toggle

Opens the 🎹 panel (open()), closes it (close()) or flips it (toggle()).

Same as pressing the 🎹 button. The first time the panel opens, oav-p5 loads the on-screen controller (a few seconds on a slow connection, which the panel says while it loads), and if hardware is click it asks for Web MIDI then. OAVp5.panel.open() when it is already open does nothing new.

Returns

Promise<Element | null> A promise. open() (and toggle() when it opens) resolves to the panel's element once the on-screen controller inside it has loaded, and the panel is on screen at once, before that. close() (and toggle() when it closes) resolves to null, and so does everything when the panel option is off.

Notes

  • The three are listed together here: OAVp5.panel.close and OAVp5.panel.toggle take no arguments either. midi.panel.open() is the same function.

Examples

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

function keyPressed() {
  if (key === 'o') OAVp5.panel.open();
  if (key === 'c') OAVp5.panel.close();
}

function draw() {
  background(20);
  fill(255);
  text('o: open the 🎹 panel,  c: close it', 20, 30);
}
Press o to open the 🎹 panel and c to close it.
jsOpenProcessing ↗
function setup() {
  createCanvas(400, 300);
}

function mousePressed() {
  OAVp5.panel.open().then((panel) => console.log('the panel is', panel ? 'open and loaded' : 'not available'));
}

function draw() {
  background(20);
  fill(255);
  text('click the canvas to open the panel', 20, 30);
}
Click the canvas: the panel opens at once, and the console says when the controller inside it has loaded.

Related

  • OAVp5.panel The 🎹 panel as an object: open(), close() and toggle() show and hide it from code.
  • panel Whether the 🎹 panel starts shut, open, or does not exist: closed, open or off.
  • OAVp5.phone() Shows the 📱 card: a QR code that sends a phone to the remote page, whose MIDI tab then plays this sketch. Returns the room name.
  • 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.

p5/oav-p5.js, line 275

↑ Back to top · All names