Skip to content

Commit

Permalink
maybe this will work
Browse files Browse the repository at this point in the history
  • Loading branch information
BlinkyStitt committed Apr 19, 2024
1 parent 3101927 commit e06ca59
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
# will obviously return error 404 not found.
# run: cd musical-leptos && ./trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"
# run: echo "${GITHUB_REPOSITORY#*/}" && cd musical-leptos && ./trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"
run: cd musical-leptos && ./trunk build --release --public-url "musical-lights-rs"
run: cd musical-leptos && ./trunk build --release --public-url "https://blinkystitt.github.io/musical-lights-rs"

# Deploy with Github Static Pages

Expand Down
7 changes: 5 additions & 2 deletions musical-leptos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>

<head>
<!-- <base data-trunk-public-url /> -->
<base data-trunk-public-url />

<!-- Add a plain CSS file: see https://trunkrs.dev/assets/#css -->
<!-- If using Tailwind with Leptos CSR, see https://trunkrs.dev/assets/#tailwind instead-->
Expand All @@ -13,8 +13,11 @@

<!-- include support for `wasm-bindgen --weak-refs` - see: https://rustwasm.github.io/docs/wasm-bindgen/reference/weak-references.html -->
<link data-trunk rel="rust" data-wasm-opt="z" data-weak-refs />

<!-- include a data loader shim for -->
<!-- <link data-trunk rel="rust" data-loader-shim data-type="worker" /> -->
</head>

<body>Loading...</body>
<body></body>

</html>
12 changes: 6 additions & 6 deletions musical-leptos/src/audio_worklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ class WasmProcessor extends AudioWorkletProcessor {
console.log("handle:", handle);

// // TODO: we aren't allowed to do this because they are read-only
// bindgen.TextDecoder = globalThis.TextDecoder;
// bindgen.TextEncoder = globalThis.TextEncoder;
// bindings.TextDecoder = globalThis.TextDecoder;
// bindings.TextEncoder = globalThis.TextEncoder;

// // TODO: this currently fails because TextDecoder is not available inside an AudioWorklet
// // TODO: some examples use message passing for the wasm setup
// bindgen.initSync(module);
// this.processor = bindgen.WasmAudioProcessor.unpack(handle);
// bindings.initSync(module);
// this.processor = bindings.WasmAudioProcessor.unpack(handle);
}
process(inputs, outputs) {
// let sum = inputs[0][0].reduce((accumulator, currentValue) => accumulator + currentValue, 0);
// console.log("sum:", sum);
let sum = inputs[0][0].reduce((accumulator, currentValue) => accumulator + currentValue, 0);
console.log("sum:", sum);

return true;

Expand Down
2 changes: 1 addition & 1 deletion musical-leptos/src/dependent_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn on_the_fly(code: &str) -> Result<String, JsValue> {
// TODO: get the EncoderDecoderTogether from <https://github.com/anonyco/FastestSmallestTextEncoderDecoder>.
// TODO: this doesn't seem to work. we still get TextDecoder not found
let header = format!(
"{}\n\nimport init, * as bindgen from '{}';\n\n",
"{}\n\nimport init, * as bindings from '{}';\n\n",
include_str!("./audio_polyfill.js"),
// wasm_bindgen::link_to!(module = "/src/audio_polyfill.js"),
IMPORT_META.url(),
Expand Down

0 comments on commit e06ca59

Please sign in to comment.