tesselode / kira

Library for expressive game audio.
https://crates.io/crates/kira
Apache License 2.0
856 stars 43 forks source link

wasm32 support #5

Closed Moxinilian closed 3 years ago

Moxinilian commented 3 years ago

File loading does not work and is kind of out of the scope for now I think, audio data should be loaded as frames (the best way to do this is download the audio data using fetch, decode it using WebAudio and play).

This is blocked by aspenluxxxy/nanorand-rs#19. [NO LONGER THE CASE, see below]

Demo: https://first-kira-web-demo.surge.sh/ (wasm file and audio data loading start when clicking on play)

Moxinilian commented 3 years ago

In wasm, nanorand uses the default time-based entropy generator. However, it provides the ability to use the getrandom dependency to obtain higher quality entropy from the browser. While it is not absolutely needed in our context, it is better practice to have good entropy and using getrandom allows us to not have to wait for a new nanorand release with the fix in the PR mentioned above, hence why I added it.

Absolucy commented 3 years ago

Honestly, it's usually recommended to use getrandom anyways. It's just not default because it's not a required dependency.