Closed darrencruse closed 9 years ago
I worked with the FileAudio code Emmanuel added and got play-sound working.
Nice work.
I'm using it in my pong game so you can see it in action here: http://htmlpreview.github.io/?https://github.com/darrencruse/pong-world-racket/blob/master/pongsong/build/pong.html
FWIW I had an easy time getting it working in chrome, but then I realized Firefox was broken and ended up refactoring it more heavily. It took quite a bit of trial and error in the end. I've tried it in recent versions of chrome, firefox, safari, and IE.
Great that it works in all browsers.
I merged your changes. For a more thorough code review you'll need someone more knowledgeable of JavaScript than me. Perhaps Emmanuel has some some comments?
/Jens Axel
I worked with the FileAudio code Emmanuel added and got play-sound working.
I'm using it in my pong game so you can see it in action here: http://htmlpreview.github.io/?https://github.com/darrencruse/pong-world-racket/blob/master/pongsong/build/pong.html
FWIW I had an easy time getting it working in chrome, but then I realized Firefox was broken and ended up refactoring it more heavily. It took quite a bit of trial and error in the end. I've tried it in recent versions of chrome, firefox, safari, and IE.
I think this code deserves a good review - I was new to the html5 audio api, and I don't really know why some of the patterns I see in js-impl.js are used (i.e. MACHINE/makeClosure/PAUSE/restart/finalizeClosure). I just tried to maintain the patterns already there without fully knowing how those work or why they're there so please double check me. If there's any docs about those calls I'd love a link btw.
Otherwise as I said it seems to be working for my use case for game sound effects. I noticed the original racket/gui/base "play-sound" has an additional "async" parameter this version doesn't have - I'm assuming the WeScheme code doesn't support that parameter either but I didn't check it's code.