From 03971a8c7a3d0ec8176ee90d7b2b74223a651dca Mon Sep 17 00:00:00 2001 From: Steeely Dan Date: Sun, 1 Oct 2023 00:21:19 +0200 Subject: [PATCH] Move function --- .../js2eel/test/examplePlugins/05_lowpass.spec.ts | 10 +++++----- examples/05_lowpass.js | 12 ++++++------ gui/src/components/js2eel/examples/05_lowpass.ts | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/compiler/src/js2eel/test/examplePlugins/05_lowpass.spec.ts b/compiler/src/js2eel/test/examplePlugins/05_lowpass.spec.ts index 319e769..608e99e 100644 --- a/compiler/src/js2eel/test/examplePlugins/05_lowpass.spec.ts +++ b/compiler/src/js2eel/test/examplePlugins/05_lowpass.spec.ts @@ -6,7 +6,7 @@ import { testEelSrc } from '../helpers.js'; const JS_LOWPASS_SRC = fs.readFileSync(path.resolve('../examples/05_lowpass.js'), 'utf-8'); -const EEL_LOWPASS_SRC_EXPECTED = `/* Compiled with JS2EEL v0.7.0 */ +const EEL_LOWPASS_SRC_EXPECTED = `/* Compiled with JS2EEL v0.8.0 */ desc:lowpass @@ -62,8 +62,8 @@ lpYStore__D0__1 = lpYStore__D0__0; lpXStore__D0__2 = lpXStore__D0__1; lpXStore__D0__1 = lpXStore__D0__0; lpXStore__D0__0 = spl0; -R__S4__0 = lpYStore__D0__0; -spl0 = R__S4__0; +R__S2__0 = lpYStore__D0__0; +spl0 = R__S2__0; ); spl0 = spl0 * outputGain; @@ -76,8 +76,8 @@ lpYStore__D1__1 = lpYStore__D1__0; lpXStore__D1__2 = lpXStore__D1__1; lpXStore__D1__1 = lpXStore__D1__0; lpXStore__D1__0 = spl1; -R__S4__0 = lpYStore__D0__0; -spl1 = R__S4__0; +R__S2__0 = lpYStore__D0__0; +spl1 = R__S2__0; ); spl1 = spl1 * outputGain; diff --git a/examples/05_lowpass.js b/examples/05_lowpass.js index 0bdf9e3..d38d686 100644 --- a/examples/05_lowpass.js +++ b/examples/05_lowpass.js @@ -41,12 +41,6 @@ function setLpCoefs() { lpCoefs.b2x = b2 / a0; } -onSlider(() => { - setLpCoefs(); - - outputGain = 10 ** (outputGainDb / 20); -}); - function processSample(value, ch, coefs, xStore, yStore) { yStore[ch][0] = coefs.b0x * xStore[ch][0] + @@ -64,6 +58,12 @@ function processSample(value, ch, coefs, xStore, yStore) { return yStore[ch][0]; } +onSlider(() => { + setLpCoefs(); + + outputGain = 10 ** (outputGainDb / 20); +}); + onSample(() => { eachChannel((sample, ch) => { if (lpFreq < 22000) { diff --git a/gui/src/components/js2eel/examples/05_lowpass.ts b/gui/src/components/js2eel/examples/05_lowpass.ts index 4ed78ea..106d5f3 100644 --- a/gui/src/components/js2eel/examples/05_lowpass.ts +++ b/gui/src/components/js2eel/examples/05_lowpass.ts @@ -43,12 +43,6 @@ function setLpCoefs() { lpCoefs.b2x = b2 / a0; } -onSlider(() => { - setLpCoefs(); - - outputGain = 10 ** (outputGainDb / 20); -}); - function processSample(value, ch, coefs, xStore, yStore) { yStore[ch][0] = coefs.b0x * xStore[ch][0] + @@ -66,6 +60,12 @@ function processSample(value, ch, coefs, xStore, yStore) { return yStore[ch][0]; } +onSlider(() => { + setLpCoefs(); + + outputGain = 10 ** (outputGainDb / 20); +}); + onSample(() => { eachChannel((sample, ch) => { if (lpFreq < 22000) {