From 805bd7e93004946ad931587b4d53f12a6d6fa1c0 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 24 Nov 2022 20:56:09 +0100 Subject: [PATCH] simplify without-audio example --- packages/core/examples/without-audio.html | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/core/examples/without-audio.html b/packages/core/examples/without-audio.html index 87ffc8de..9db37c5c 100644 --- a/packages/core/examples/without-audio.html +++ b/packages/core/examples/without-audio.html @@ -44,30 +44,22 @@ const input = document.getElementById('text'); Promise.all(modules).then(() => { - input.innerHTML = getTune(); + input.innerHTML = `note("").cutoff(1000)`; + document.getElementById('start').addEventListener('click', () => { + evaluate(input.value); + }); }); evalScope(controls, ...modules); const { evaluate } = repl({ - defaultOutput: (...args) => { - console.log(args); + defaultOutput: (hap, deadline, duration) => { + console.log(deadline, duration, hap.value); }, getTime: () => Date.now() / 1000, transpiler, beforeEval: (code) => console.log('evaluate', code), afterEval: (code) => {}, }); - document.getElementById('start').addEventListener('click', () => { - evaluate(input.value); - }); - - function getTune() { - return `const output = (deadline, hap, now) => { - const { whole: { begin, end }, value } = hap; - console.log(deadline, begin+0, end+0, value); -} -note("").cutoff(1000).onTrigger(output)`; - }