rename old dough function to rawdsp + mock dough in test runtime

This commit is contained in:
Felix Roos
2026-08-18 20:44:35 +02:00
parent f1dd209749
commit d65b24db8f
4 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -67,13 +67,13 @@ if (typeof window !== 'undefined') {
});
}
export const dough = async (code) => {
export const rawdsp = async (code) => {
const ac = getAudioContext();
stop();
worklet = await dspWorklet(ac, code);
worklet.node.connect(ac.destination);
};
export function doughTrigger(hap, currentTime, cps, targetTime) {
export function rawdspTrigger(hap, currentTime, cps, targetTime) {
window.postMessage({ time: targetTime, dough: hap.value, currentTime, duration: hap.duration, cps });
}
+3 -3
View File
@@ -9,7 +9,7 @@ import {
superdough,
getAudioContext,
setLogger,
doughTrigger,
rawdspTrigger,
registerWorklet,
setAudioContext,
initAudio,
@@ -173,8 +173,8 @@ export function webaudioRepl(options = {}) {
return repl(options);
}
Pattern.prototype.dough = function () {
return this.onTrigger(doughTrigger, 1);
Pattern.prototype.rawdsp = function () {
return this.onTrigger(rawdspTrigger, 1);
};
function audioBufferToWav(buffer, opt) {
+1
View File
@@ -99,6 +99,7 @@ const toneHelpersMocked = {
'_spectrum',
'markcss',
'p',
'dough',
].forEach((mock) => {
strudel.Pattern.prototype[mock] = function () {
return this;
+2 -2
View File
@@ -597,8 +597,8 @@
],
"/packages/superdough/dspworklet.mjs": [
"dspWorklet",
"dough",
"doughTrigger"
"rawdsp",
"rawdspTrigger"
],
"/packages/superdough/index.mjs": [],
"/packages/tonal/tonleiter.mjs": [