kcat / openal-soft

OpenAL Soft is a software implementation of the OpenAL 3D audio API.
Other
2.22k stars 536 forks source link

[Question] How the Desktop OpenAL-Soft works in the browser using WebAssembly? #1016

Closed 8Observer8 closed 4 months ago

8Observer8 commented 4 months ago

I was very surprised that it works. Please, explain how is it possible that OpenAL Soft that was build for Desktop works in the browser? Why it doesn't print unknown file type for libOpenAL32.dll.a when compiling? Why doesn't it show a message that OpenAL32.dll was not found ? But OpenAL-Soft works in the browser using Qt! I just have set up it like this:

CONFIG("windows") {
    INCLUDEPATH += $$PWD/libs/openal-soft-1.23.1-mingw-64-bit/include
    LIBS += -L$$PWD/libs/openal-soft-1.23.1-mingw-64-bit/lib/x64
    LIBS += -lOpenAL32.dll
}

It works for Desktop and WebAssembly without any changes. I just tried to build Desktop demo to WebAssembly to see what errors in will show for OpenAL Soft but it works! You can run my following my demo on itch and click on the sound button on the right button corner. I don't understand how Qt developers have made it.

8Observer8 commented 4 months ago

When building in WASM, what is inside this section is ignored: CONFIG("windows"). Used OpenAL browser implementation using Emscripten: https://emscripten.org/docs/porting/Audio.html All code written in OpenAL, without the need for changes on the part of the programmer, is compiled into WASM. Now it is clear.