Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/libwebaudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ let LibraryWebAudio = {

// TODO: In MINIMAL_RUNTIME builds, read this file off of a preloaded Blob,
// and/or embed from a string like with WASM_WORKERS==2 mode.
audioWorklet.addModule('{{{ TARGET_BASENAME }}}.aw.js').then(() => {
audioWorklet.addModule(locateFile('{{{ TARGET_BASENAME }}}.aw.js')).then(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

audioWorklet.addModule(
#if MINIMAL_RUNTIME
  '{{{ TARGET_BASENAME }}}.aw.js'
#else
  locateFile('{{{ TARGET_BASENAME }}}.aw.js')
#endif
).then(() => {

The locateFile function does not currently exist in MINIMAL_RUNTIME.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also need the new URL(...) pattern here as well for ES6 bundlers.

Essentially copy the pattern from regular ww.js workers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbc100 At this point, maybe this should be a parseTools macro for arbitrary resources?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can think of way to express that that SGTM

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since original PR author might not be around, I posted a PR #24044 to gate the MINIMAL_RUNTIME part, and add a test.

parseTools macro and ES6 bundlers are good ideas that can be added in later PRs.

#if WEBAUDIO_DEBUG
console.log(`emscripten_start_wasm_audio_worklet_thread_async() addModule('audioworklet.js') completed`);
#endif
Expand Down