From acae2301bdfd11d60f46eb6e7d3e5f526e176792 Mon Sep 17 00:00:00 2001 From: Ying Chyi Gooi <25574844+YingCGooi@users.noreply.github.com> Date: Thu, 25 Dec 2025 15:08:37 -0600 Subject: [PATCH] minor refactoring of window.track --- prebake.strudel | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/prebake.strudel b/prebake.strudel index d4db8c6..917a262 100644 --- a/prebake.strudel +++ b/prebake.strudel @@ -1,4 +1,3 @@ - // tb303 style filter envelope control between 0 & 1 values for useful range register('acidenv', (x, pat) => pat.lpf(100) .lpenv(x * 9).lps(.2).lpd(.12).lpq(2) @@ -27,18 +26,16 @@ window.track = function(...input) { const pats = [] str.split(/-+/).forEach((val, index) => { - if (val == false ){ - return + if (!val) { + return } let newPat = patterns.at(index) - mods?.forEach(([mod, callback]) => { - if (val != mod) { - return - } + mods?.forEach(([mod, callback]) => { + if (val == mod) { newPat = callback(newPat) - }) - - pats.push(newPat) + } + }) + pats.push(newPat) }) return stack(...pats) }); @@ -438,4 +435,4 @@ register('stxt', (text, pat) => { }) return pat -}) \ No newline at end of file +})