From 47cd770a9e162d7cfd789c0c0a44a64fe5b2a056 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Thu, 28 Nov 2024 20:02:11 -0500 Subject: [PATCH] Cache samples, fix frequency display --- jsnes/src/sample.js | 2 +- samples/QUACK.WAV | Bin 0 -> 2084 bytes src/App.svelte | 15 ++----------- src/lib/SampleTweak.svelte | 42 +++++++++++++++++++++++-------------- 4 files changed, 29 insertions(+), 30 deletions(-) create mode 100644 samples/QUACK.WAV diff --git a/jsnes/src/sample.js b/jsnes/src/sample.js index fbdd328..a1b0886 100644 --- a/jsnes/src/sample.js +++ b/jsnes/src/sample.js @@ -28,7 +28,7 @@ Sample.prototype = { return copy; }, get frequency() { - return this.sampleRate / this.increment; + return Math.round(this.sampleRate / this.increment); }, set frequency(toneHz) { this.increment = this.sampleRate / toneHz; diff --git a/samples/QUACK.WAV b/samples/QUACK.WAV new file mode 100644 index 0000000000000000000000000000000000000000..6458622d13f1f8d142b1317be3da4c44863e4958 GIT binary patch literal 2084 zcmW-iS!^4}8ON2U=CME@iUvj6CIO1TZ5jtjourB5qmq2fmaK!+Nr|L*E|<$aX0O?q zJ-NHQB$7I)`wDfquw=`YZ5Vc1r-4(~so`8m>*FPf(KaoNxQaGJODg2++w*>87(*lMp(<{ z%C-5G_4T#Ik}%lO*-PNk?9$3y0SvUYv<4`gE00(5Djgdd45t{tvt%q37#fZxQ>jEO z91Moyl%TuC>Ugy>QY@Bd>f0aOx%anQ^U-~K-U$~k{QmmRyxjiM^DpdAjBjq8nQ|aa z(x^DUJX1nc8erRXP^zctwcW2abw?>O;y-!fgg?q#g>t!+&yP$jZ{NEA&39k!BzFDi z<>=~PAKa+X?QiXV{Yb1ZTZ6GkCckuUYptSFNdixA?QD(-1MMxxS~|MgTaPpzY(Cc3 z>F@39?hg`jer9EDYy0Z^pFe*5NBH*7_HjFR{<0!Q{D<~7c7>9Wp3_5Sef!*;MaC(! zx_WMFv66RkE>88e9XocsrM;``bnA(h_U^u5N` zLq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