Conversation
9575b1b to
5f811e6
Compare
… channel-based approach in pico8.
… proper parameterization in and install steps and readme...
|
Spent a good chunk of today troubleshooting why I couldn't get this working on my desktop, as I had been doing my development on my laptop till now; turns out the latest experimental zig version (0.11.whatever) has broken whatever wasm building nuances this branch was relying on; I'm not sure exactly where the rub is, but it's working fine with 0.10, and I'm going to assume they'll work out whatever kinks by the 0.11 stable release. Added basic SDL2 sfx... I think there needs to be a more robust music/sfx loading pattern since it's stuck with just one of each right now, but that'll take a bit more work to crank out. |
|
Major limitations are that the api supports only one track each for music and sfx, 0.mp3 and 0.wav in the assets folder, respectively. It's enough to illustrate how this might work though. Playing music in wasm/native mode by fetching the source each time isn't that great either, so resource management could be improved. The two probably will need to go hand-in-hand. |
This is a draft just to illustrate how adding in music might work
I've commented out some logic in build.zig since I haven't finished implementing the corresponding sdl version of the music function, so you can ignore that for now.
The high level idea is that the music files will be accessible as (mp3|whatever) in the server, and loaded into audio elements by javascript executed by wasm. I've added in a parent div "music" to organize said elements under. Supplying the same
channelMaskmore than once will delete the existing audio element and create a new one.fademsis not implemented yet.One thing to note is that a user needs to interact with the document before any music can be played in this fashion, as most browsers don't look kindly to autoplay-on-load anymore.