Runtime is not defined

117 views
Skip to first unread message

phi...@blastbay.com

unread,
Dec 28, 2014, 9:25:23 AM12/28/14
to emscripte...@googlegroups.com

Hi all,

I am new to Emscripten, and am really impressed with it so far! The setup procedure on Windows was smooth, and hello world built just fine. I wanted to see if I could get audio working through SDL2,, so I downloaded the SDL2 port by way of the automatic setup command. Then, I ran the following from the Emscripten console:

emcc loopwave.cpp -o loopwave.html -DNDEBUG --preload-file sample.wav -O2 -s USE_SDL=2 --closure 1

loopwave.cpp is basically loopwave.c from the SDL distribution, pulled from the repo so that I get the emscriptin loop etc. I only made one minor change; making it so that sample.wav is always used and no command line input is considered. The file can be found at:
https://dl.dropboxusercontent.com/u/5121962/loopwave.cpp

sample.wav is here:
https://dl.dropboxusercontent.com/u/5121962/sample.wav

The program compiled without errors, letting me know that it was using SDL2. I uploaded all the files to the server (the HTML, the .js, the .mem and the .data files), and tried running it in both Firefox and IE. In IE I saw nothing, but in Firefox I received what looks like UTF-8 strings and then a ton of exceptions. They are basically all the same, looking as follows:

"[post-exception status] Exception thrown, see JavaScript console"12
loopwave.html:1245
ReferenceError: Runtime is not defined
loopwave.js line 14 > eval:1
"[post-exception status] Exception thrown, see JavaScript console"
loopwave.html:1245
ReferenceError: Runtime is not defined
loopwave.js line 14 > eval:1
"[post-exception status] Exception thrown, see JavaScript console"2
loopwave.html:1245
ReferenceError: Runtime is not defined2
loopwave.js line 14 > eval:1
"[post-exception status] Exception thrown, see JavaScript console"
loopwave.html:1245
ReferenceError: Runtime is not defined
loopwave.js line 14 > eval:1

Etc. I have no idea what these errors mean, could anyone shed some light?

Thanks in advance for any help!

Kind regards,

Philip Bennefall

Jukka Jylänki

unread,
Dec 29, 2014, 9:42:01 AM12/29/14
to emscripte...@googlegroups.com
Does it occur with all compilation flags? If you remove -O2 and/or --closure 1, does it still occur? How about if you add -g to the build?

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Philip Bennefall

unread,
Dec 29, 2014, 10:42:34 AM12/29/14
to emscripte...@googlegroups.com
Hi there,

When I remove the closure call, I actually get audio output! However, I still see the huge UTF-8 string output and I get crackling audio fairly frequently. The audio crackles more than usual if, for instance, I set focus to the textarea. I have tried setting the samples in the spec structure both to a high value like 4096, and to a lower one like 1024 with roughly the same results. Is there a way to get low latency audio without crackling, and is it possible to get rid of the UTF-8 output?

Kind regards,

Philip Bennefall
P.S. The script does not seem to work in IE. Is this a known limitation?
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/2IQ28VucwDQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.

Jukka Jylänki

unread,
Dec 29, 2014, 10:59:55 AM12/29/14
to emscripte...@googlegroups.com
IE11 does not unfortunately support Web Audio at all. If that is what you're seeing, then it is expected. If it's failing on some other reason than audio, then it may be a web api issue that IE doesn't have, in which case we may be able to find a IE11-specific workaround. Log output and a minimal testcase might help here.

Typically audio crackling comes from due to starvation when JS code executes for too long. To improve audio performance, the general best strategy is to use a browser profiler to find hotspots in the code and try to optimize those as much as possible. If you are seeing crackling while the JS workload is very low, then it might be something else.

I'm not sure what you mean by UTF-8 output?
Reply all
Reply to author
Forward
0 new messages