Kode / Kha

Ultra-portable, high performance, open source multimedia framework.
http://kha.tech
zlib License
1.49k stars 173 forks source link

uncompress() not implemented for MobileWebAudioSound, but compressed sounds possible on mobile html5 #1489

Open MoritzBrueckner opened 7 months ago

MoritzBrueckner commented 7 months ago

Describe the bug MobileWebAudioSound.uncompress immediately calls done without any actual decompression, but the LoaderImpl might create MobileWebAudioSound objects with compressed audio files such as Ogg Vorbis: https://github.com/Kode/Kha/blob/9cd3174ee62510efc9bd807b698b1993938fabd7/Backends/HTML5/kha/js/MobileWebAudioSound.hx#L34-L36 https://github.com/Kode/Kha/blob/9cd3174ee62510efc9bd807b698b1993938fabd7/Backends/HTML5/kha/LoaderImpl.hx#L134-L135

Thus, on mobile browsers you might get a compressed sound that you can't use with Audio2.play() because there is no way to uncompress them (apart from manually doing this, of course).

To Reproduce Load an .ogg Vorbis sound on the html5 target in a mobile browser (or in a desktop web browser with mobile emulation).

Execution Environment:

Additional context It would probably work to copy uncompress() from WebAudioSound, although (slightly off-topic) this definitely needs some work as well, as distributing the work over many frames even if the frame's workload is small is needlessly slow (sometimes > 10 seconds for music, for example).