nothings / stb

stb single-file public domain libraries for C/C++
https://twitter.com/nothings
Other
25.99k stars 7.67k forks source link

Complete silence (no audio) when porting to JavaScript using clang 13 or later #1492

Open Bonmera opened 1 year ago

Bonmera commented 1 year ago

For some reason (not sure if it's related to updating the JavaScript implementation at https://github.com/hajimehoshi/stbvorbis.js independently of where the original author left off, or just a general issue with clang 13 or later) but with 1.22 and emscripten I get nothing but silence in my project (absolutely no audio at all). I'm compiling the JavaScript port on Ubuntu using the files provided by the original author (with the exception of stb_vorbis.c which I patched to the most recent version). Other than that, everything compiles properly (but I read that emscripten currently uses clang 13 and stb_vorbis.c is updated only through clang 12... or correct me otherwise). Any thoughts, or anyone who can look at the code of both projects and figure out what the heck is going on?

EDIT: Forgot to mention but the original author used Docker containers as a part of the porting process which I was unable to automatically replicate, so I'm having to configure things manually.

metiscus commented 1 year ago

So that project is not part of the main stb project and I don't know if anyone around here can support it. The best advice I have for you is to bisect the problem. Check to see if the file is being loaded properly, then dump the output sound out or inspect it using the debugger and see if it is all zeroes or not. Make sure that something hasn't changed on the browser side in the meantime. Good luck.