OAVp5.drums.cue()#
functionoav-p5OAVp5.drums.cue(bar, name, [every])
The same as cue(bar, name, every), but it returns the cue it made (or the one that was already there), and null when bar is not valid.
Use it when you want to hold on to the cue, for example to find out which step it fires at. For a plain plan, cue() is shorter. The list of every cue is OAVp5.drums.cues.
Parameters
| Name | Type | Description |
|---|---|---|
bar | Number | The bar, counted from 1; 4.5 is halfway through bar 4. See cue(). |
name | Any | What to call the cue. |
every | Number | Repeat every this many bars; 0 or left out: once. optional |
Returns
Object | null The cue: { bar, name, every, at, period, key } with at and period counted in steps. null if bar is below 1 or not a number. A repeat of an earlier call gives back the cue that exists.
Examples
let c = null;
function setup() {
createCanvas(400, 300);
startDrums('four on floor', 120);
c = OAVp5.drums.cue(3.5, 'half', 4);
textAlign(CENTER, CENTER);
}
function draw() {
background(20);
fill(255);
text(c ? 'cue "' + c.name + '" at step ' + c.at + ', every ' + c.period + ' steps' : 'no cue', width / 2, height / 2);
}Related
cue()Plans something for a bar: at barbarthe functioncueFired(name, bar)is called andcueNamebecomesname; withevery, again every that many bars.OAVp5.drums.cuesThe list of every cue declared so far, in the order they were declared.cueFired()An event you define: it is called when the bar of a cue declared withcue()has come, with the cue's name and the bar.