Skip to content

Commit

Permalink
Move function
Browse files Browse the repository at this point in the history
  • Loading branch information
steeelydan committed Sep 30, 2023
1 parent ddb9fef commit 03971a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions compiler/src/js2eel/test/examplePlugins/05_lowpass.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions examples/05_lowpass.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] +
Expand All @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions gui/src/components/js2eel/examples/05_lowpass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] +
Expand All @@ -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) {
Expand Down

0 comments on commit 03971a8

Please sign in to comment.