Re: Audio games in the Web Browser

This is only a very thin layer over WebAudio, because I wanted to keep the flexibility of the audio nodes. It's possible to add a simpler layer with a specific aim.

I'm not sure yet about the efficiency. The code creates a Brython function as a callback for each sound file. Maybe some more _javascript_ will be necessary. I don't exclude to write all the game in _javascript_ if necessary either, now that I start to understand the "this" keyword and the "prototype" property. I'll try Brython a bit more though.

The good thing is that it's possible to give a Brython function to a _javascript_ function as a parameter for a callback. _javascript_ and WebAudio seem to use a lot of callbacks. I have sent the example to the Brython list and mentioned the problem with Ajax. It isn't really a problem because the lower layer can be in _javascript_ as long as it is possible to make callbacks. Reading the documentation, I first thought that ca llbacks wouldn't be possible, but they are.

In a first version without callbacks the whole loading code was in _javascript_ and a variable was set when the loading was over. The Brython part was polling this variable using the timer module and the function set_timeout(function, ms). Note that, contrary to Python, using time.sleep() isn't really possible in Brython because it would use 100% CPU. The underlying _javascript_ prefers callbacks.

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Trenton Goldshark via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Trenton Goldshark via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : SoundMUD via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Trenton Goldshark via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : SoundMUD via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Trenton Goldshark via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : SoundMUD via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Trenton Goldshark via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : SoundMUD via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : SoundMUD via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : SoundMUD via Audiogames-reflector

Reply via email to