+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/lib/sampload.js b/src/lib/sampload.js
index db3e223..eecd9d0 100644
--- a/src/lib/sampload.js
+++ b/src/lib/sampload.js
@@ -1,8 +1,12 @@
import { Sample } from 'jsnes';
export async function loadSample(url, toneHz, gain) {
- const audioCtx = new AudioContext();
const response = await fetch(url);
- const buffer = await audioCtx.decodeAudioData(await response.arrayBuffer());
+ return await decodeSample(await response.arrayBuffer(), toneHz, gain);
+}
+
+export async function decodeSample(arraybuffer, toneHz, gain) {
+ const audioCtx = new AudioContext();
+ const buffer = await audioCtx.decodeAudioData(arraybuffer);
return new Sample(buffer, toneHz, gain);
-}
\ No newline at end of file
+}
diff --git a/yarn.lock b/yarn.lock
index 7ba2cc7..7ca0dbb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -254,10 +254,10 @@
dependencies:
debug "^4.3.7"
-"@sveltejs/vite-plugin-svelte@^4.0.0":
- version "4.0.1"
- resolved "https://registry.yarnpkg.com/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-4.0.1.tgz#d6a36caf09eca00249add71fde17b1d01fdd89a2"
- integrity sha512-prXoAE/GleD2C4pKgHa9vkdjpzdYwCSw/kmjw6adIyu0vk5YKCfqIztkLg10m+kOYnzZu3bb0NaPTxlWre2a9Q==
+"@sveltejs/vite-plugin-svelte@^4.0.2":
+ version "4.0.2"
+ resolved "https://registry.yarnpkg.com/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-4.0.2.tgz#b2106ce4e77f074f2f4542d33413bdcad3529863"
+ integrity sha512-Y9r/fWy539XlAC7+5wfNJ4zH6TygUYoQ0Eegzp0zDDqhJ54+92gOyOX1l4MO1cJSx0O+Gp13YePT5XEa3+kX0w==
dependencies:
"@sveltejs/vite-plugin-svelte-inspector" "^3.0.0-next.0||^3.0.0"
debug "^4.3.7"
@@ -332,10 +332,10 @@ esbuild@^0.21.3:
"@esbuild/win32-ia32" "0.21.5"
"@esbuild/win32-x64" "0.21.5"
-esm-env@^1.0.0:
- version "1.1.4"
- resolved "https://registry.yarnpkg.com/esm-env/-/esm-env-1.1.4.tgz#340c78b03ee2298d31c5b9fab9793468ede828b0"
- integrity sha512-oO82nKPHKkzIj/hbtuDYy/JHqBHFlMIW36SDiPCVsj87ntDLcWN+sJ1erdVryd4NxODacFTsdrIE3b7IamqbOg==
+esm-env@^1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/esm-env/-/esm-env-1.2.0.tgz#637c0586244c0eb14bfd7f5e96a6b43b9e8f5c2b"
+ integrity sha512-OhSQuHL3mUcaQHjGe8UMG8GsJIJHYYz0flR0h9fiTPNMupLMkb7TvcRD0EeJXW5a8GHBgfz08b6FDLNK7kkPQA==
esrap@^1.2.2:
version "1.2.2"
@@ -433,10 +433,10 @@ source-map-js@^1.2.1:
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46"
integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==
-svelte@^5.1.3:
- version "5.2.2"
- resolved "https://registry.yarnpkg.com/svelte/-/svelte-5.2.2.tgz#a9d28dd6942e59f303298902c546909161452b45"
- integrity sha512-eHIJRcvA6iuXdRGMESTmBtWTQCcCiol4gyH9DA60ybS35W1x27cvtbndNvWDqX72blyf+AYeQ4gzZ0XGg3L8sw==
+svelte@^5.2.10:
+ version "5.2.10"
+ resolved "https://registry.yarnpkg.com/svelte/-/svelte-5.2.10.tgz#d35399550de09e86f5344fe8e221c667bbbac68e"
+ integrity sha512-ON0OyO7vOmSjTc9mLjusu3vf1I7BvjovbiRB7j84F1WZMXV6dR+Tj4btIzxQxMHfzbGskaFmRa7qjgmBSVBnhQ==
dependencies:
"@ampproject/remapping" "^2.3.0"
"@jridgewell/sourcemap-codec" "^1.5.0"
@@ -445,14 +445,14 @@ svelte@^5.1.3:
acorn-typescript "^1.4.13"
aria-query "^5.3.1"
axobject-query "^4.1.0"
- esm-env "^1.0.0"
+ esm-env "^1.2.0"
esrap "^1.2.2"
is-reference "^3.0.3"
locate-character "^3.0.0"
magic-string "^0.30.11"
zimmerframe "^1.1.2"
-vite@^5.4.10:
+vite@^5.4.11:
version "5.4.11"
resolved "https://registry.yarnpkg.com/vite/-/vite-5.4.11.tgz#3b415cd4aed781a356c1de5a9ebafb837715f6e5"
integrity sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==