mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 05:38:34 +00:00
encapsulate .dough
This commit is contained in:
parent
6e26f39751
commit
52c01abbe9
@ -1,4 +1,3 @@
|
||||
import { Pattern } from '@strudel.cycles/core';
|
||||
import { getAudioContext } from './superdough.mjs';
|
||||
|
||||
let worklet;
|
||||
@ -73,8 +72,6 @@ export const dough = async (code) => {
|
||||
worklet.node.connect(ac.destination);
|
||||
};
|
||||
|
||||
Pattern.prototype.dough = function () {
|
||||
return this.onTrigger((t, hap) => {
|
||||
window.postMessage({ time: t, dough: hap.value });
|
||||
}, 1);
|
||||
};
|
||||
export function doughTrigger(t, hap, currentTime, duration, cps) {
|
||||
window.postMessage({ time: t, dough: hap.value, currentTime, duration, cps });
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
*/
|
||||
|
||||
import * as strudel from '@strudel.cycles/core';
|
||||
import { superdough, getAudioContext, setLogger } from 'superdough';
|
||||
import { superdough, getAudioContext, setLogger, doughTrigger } from 'superdough';
|
||||
const { Pattern, logger } = strudel;
|
||||
|
||||
setLogger(logger);
|
||||
@ -35,3 +35,7 @@ export function webaudioScheduler(options = {}) {
|
||||
onTrigger: strudel.getTrigger({ defaultOutput, getTime }),
|
||||
});
|
||||
}
|
||||
|
||||
Pattern.prototype.dough = function () {
|
||||
return this.onTrigger(doughTrigger, 1);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user