working
This commit is contained in:
parent
b312ff63a9
commit
df923174ed
2 changed files with 56 additions and 0 deletions
|
|
@ -3192,6 +3192,25 @@ export const slice = register(
|
||||||
false, // turns off auto-patternification
|
false, // turns off auto-patternification
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* make something happen on event time
|
||||||
|
* uses browser timeout which is innacurate for audio tasks
|
||||||
|
* @name onTriggerTime
|
||||||
|
* @memberof Pattern
|
||||||
|
* @returns Pattern
|
||||||
|
* @example
|
||||||
|
* s("bd!8").onTriggerTime((hap) => {console.info(hap)})
|
||||||
|
*/
|
||||||
|
Pattern.prototype.onTriggerTime = function (func) {
|
||||||
|
return this.onTrigger((t_deprecate, hap, currentTime, cps = 1, targetTime) => {
|
||||||
|
const diff = targetTime - currentTime;
|
||||||
|
window.setTimeout(() => {
|
||||||
|
func(hap);
|
||||||
|
}, diff * 1000);
|
||||||
|
}, false);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Works the same as slice, but changes the playback speed of each slice to match the duration of its step.
|
* Works the same as slice, but changes the playback speed of each slice to match the duration of its step.
|
||||||
* @name splice
|
* @name splice
|
||||||
|
|
|
||||||
|
|
@ -5950,6 +5950,43 @@ exports[`runs examples > example "often" example index 0 1`] = `
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "onTriggerTime" example index 0 1`] = `
|
||||||
|
[
|
||||||
|
"[ 0/1 → 1/8 | s:bd ]",
|
||||||
|
"[ 1/8 → 1/4 | s:bd ]",
|
||||||
|
"[ 1/4 → 3/8 | s:bd ]",
|
||||||
|
"[ 3/8 → 1/2 | s:bd ]",
|
||||||
|
"[ 1/2 → 5/8 | s:bd ]",
|
||||||
|
"[ 5/8 → 3/4 | s:bd ]",
|
||||||
|
"[ 3/4 → 7/8 | s:bd ]",
|
||||||
|
"[ 7/8 → 1/1 | s:bd ]",
|
||||||
|
"[ 1/1 → 9/8 | s:bd ]",
|
||||||
|
"[ 9/8 → 5/4 | s:bd ]",
|
||||||
|
"[ 5/4 → 11/8 | s:bd ]",
|
||||||
|
"[ 11/8 → 3/2 | s:bd ]",
|
||||||
|
"[ 3/2 → 13/8 | s:bd ]",
|
||||||
|
"[ 13/8 → 7/4 | s:bd ]",
|
||||||
|
"[ 7/4 → 15/8 | s:bd ]",
|
||||||
|
"[ 15/8 → 2/1 | s:bd ]",
|
||||||
|
"[ 2/1 → 17/8 | s:bd ]",
|
||||||
|
"[ 17/8 → 9/4 | s:bd ]",
|
||||||
|
"[ 9/4 → 19/8 | s:bd ]",
|
||||||
|
"[ 19/8 → 5/2 | s:bd ]",
|
||||||
|
"[ 5/2 → 21/8 | s:bd ]",
|
||||||
|
"[ 21/8 → 11/4 | s:bd ]",
|
||||||
|
"[ 11/4 → 23/8 | s:bd ]",
|
||||||
|
"[ 23/8 → 3/1 | s:bd ]",
|
||||||
|
"[ 3/1 → 25/8 | s:bd ]",
|
||||||
|
"[ 25/8 → 13/4 | s:bd ]",
|
||||||
|
"[ 13/4 → 27/8 | s:bd ]",
|
||||||
|
"[ 27/8 → 7/2 | s:bd ]",
|
||||||
|
"[ 7/2 → 29/8 | s:bd ]",
|
||||||
|
"[ 29/8 → 15/4 | s:bd ]",
|
||||||
|
"[ 15/4 → 31/8 | s:bd ]",
|
||||||
|
"[ 31/8 → 4/1 | s:bd ]",
|
||||||
|
]
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "orbit" example index 0 1`] = `
|
exports[`runs examples > example "orbit" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/6 | s:hh delay:0.5 delaytime:0.25 orbit:1 ]",
|
"[ 0/1 → 1/6 | s:hh delay:0.5 delaytime:0.25 orbit:1 ]",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue