OAVp5.drums.state#
variableoav-p5OAVp5.drums.state
Where the drum machine is: 'off', 'loading', 'on', 'stopped' or 'error'.
'loading' is the moment after startDrums() while the module arrives, 'on' is playing, 'stopped' is a grid that is up but not playing (its checkbox is unticked), 'off' is where it starts and where stopDrums() leaves it, and 'error' means @openav/drums could not be loaded. drumsAreOn is state === 'on'.
- Type
String- Range
off | loading | on | stopped | error
Starts as 'off' and changes when the machine loads, plays, is stopped or fails.
Examples
function setup() {
createCanvas(400, 300);
startDrums('sparse', 90);
textAlign(CENTER, CENTER);
textSize(28);
}
function draw() {
background(20);
fill(255);
text(OAVp5.drums.state, width / 2, height / 2);
}To be confirmed
After stopDrums() and a second startDrums() the state stayed 'off' while the machine played again (Chromium, oav-p5 0.8.0). Not confirmed whether that is intended.
Related
drumsAreOnWhether the drum machine is playing right now.startDrums()Starts a drum machine: a 16-step grid on the page that plays a preset, your own grid or one line of rhythm, and counts the bars for your sketch.stopDrums()Stops the drum machine and hides its card.OAVp5.drumsThe object behind the drum names: the state of the machine, its counters, the line of rhythm, its history and the loaded machine.