emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.67k stars 3.29k forks source link

The value of alGetSourcei(_source, AL_BYTE_OFFSET, &sampleBytes); seems not smoothly on playing audio. #17641

Open eminor1988 opened 2 years ago

eminor1988 commented 2 years ago

Version of emscripten/emsdk: emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.18 (d5ca9bba6513763d5bdddbd0efff759332bd85d7) clang version 16.0.0 (https://github.com/llvm/llvm-project 48129cf0ed5053ed3fdf4f928180635e84892614) Target: wasm32-unknown-emscripten Thread model: posix

Situation Sorry for my bad English skill... I am porting my rhythm game to web.

ALint sampleBytes;
alGetSourcei(_source, AL_BYTE_OFFSET, &sampleBytes);

I calculated the translation of camera by the value - "sampleBytes" to ensure camera offset is sync to playing time of audio. But it seems not smoothly in the Emscripten version compare to PC version.

I recorded the two versions of video: PC on Windows 10 Web by Emscripten

You can see the problem on the notes, it seems stop-and-go in web version.

I tried to modify the library_openal.js But I still cannot get it right. Does anyone know what is the cause of the problem?

sbc100 commented 2 years ago

it doesn't like like we have any test for AL_BYTE_OFFSET so maybe its not a commonly used thing and there could be a bugs there. If you come up with a solution a PR would be most welcome.