mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
4.07k stars 361 forks source link

[emscripten] `ccall()` function has been disabled by default #569

Closed raysan5 closed 2 years ago

raysan5 commented 2 years ago

emscripten 3.1.21 has disabled LEGACY_RUNTIME and ccall() function has become not available by default.

miniaudio uses that function for the WebAudio backend on ma_device_init_by_type__webaudio() function.

It is possible to force -s LEGACY_RUNTIME=1 on compilation or just -s EXPORTED_RUNTIME_METHODS=ccall but I was wondering if it was possible to remove/replace ccall() usage in the future to avoid depending on legacy functionality (I'm not aware of the cost or future implications of using legacy).

Related issue: https://github.com/raysan5/raylib/issues/2739

mackron commented 2 years ago

Thanks for the report. I wasn't aware of this. Certainly it should "Just Work" without any need for compiler options so I'll have a look at getting this cleaned up. It looks like you can just call the function directly so hopefully it won't actually be too much of an issue.

mackron commented 2 years ago

I've made a change to the dev branch to hopefully fix this. I tested with Emscripten version 3.1.24 and it seems to be working here. Are you able to give that a try?

raysan5 commented 2 years ago

@mackron Thank you very much for the fast review! I will try it tomorrow and let you know.

raysan5 commented 2 years ago

@mackron I tested it and it works perfectly!

mackron commented 2 years ago

Thanks for testing that. I've released this fix. Version 0.11.11.