Closed charlieroberts closed 5 years ago
Hi Charlie, I can reproduce the issue.
It is a tricky one. The code of an AudioWorkletProcessor gets wrapped in an immediately invoked function to cover some minor bugs that exist in Chrome. But an import statement can't be inside of a function it needs to be the first thing in a script. I guess I have to come up with a way to split the import statements from the rest of the code.
Making it usable for the other browsers is difficult as well as the code gets currently evaluated using a Function constructor. That has to change as well.
Long story short. It will maybe take some time. :-)
Hi Charlie, I closed the issue automatically with a commit. Please feel free to reopen it if the problem persists.
I added some tests and tried to cover all possible permutations of an import statement. But the regex is more than 200 characters long. There is a good chance that there is a bug hiding in all those characters. :-)
Fantastic! I will try this out today or tomorrow and keep you posted on how it goes.
That is a ridiculous regex!!! - Charlie
FYI I did finally get to this, and unfortunately while it works for simple examples (nice!), I get an error when I tried to import Gibberish. I will play around some more and see if I can figure out what the problem is.
Thanks for letting me know. Do you maybe have an example I could try? Maybe I can make sense of the error message if it is not too cryptic.
If I include an
import
statement at the top of an AudioWorkletProcessor class file, I get an error using standardized-audio-context. At least in Chrome... in Firefox no error is thrown but all sound stops after adding the import statement.Removing the
import
statement from the AWP gets rid of the error and sound comes through. Also, theimport
statement works fine using AudioWorklets in Chrome without standardized-audio-context. Not sure how hard this would be to fix, but my guess is that it's non-trivial... - Charlietests
index.html
gibberish_worklet.js
gibberish.js