mirror of
https://codeberg.org/uzu/strudel
synced 2026-08-19 10:36:42 -04:00
rename old dough function to rawdsp + mock dough in test runtime
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -99,6 +99,7 @@ const toneHelpersMocked = {
|
||||
'_spectrum',
|
||||
'markcss',
|
||||
'p',
|
||||
'dough',
|
||||
].forEach((mock) => {
|
||||
strudel.Pattern.prototype[mock] = function () {
|
||||
return this;
|
||||
|
||||
+2
-2
@@ -597,8 +597,8 @@
|
||||
],
|
||||
"/packages/superdough/dspworklet.mjs": [
|
||||
"dspWorklet",
|
||||
"dough",
|
||||
"doughTrigger"
|
||||
"rawdsp",
|
||||
"rawdspTrigger"
|
||||
],
|
||||
"/packages/superdough/index.mjs": [],
|
||||
"/packages/tonal/tonleiter.mjs": [
|
||||
|
||||
Reference in New Issue
Block a user