We've fixed that, and now you can play sounds on Mac, Windows and Linux.
make player sound device
make fileData string
when start
.set fileData to "chainsaw.wav"
.tell player to "load sound"
.forever
..tell player to "play"
..wait 10 secs
The code is about as simple as it gets: we make a sound device (called player in this case), and tell the player the name of the sound file we want it to play. With that out of the way, we can just tell it to play whenever we want to hear that sound.
If you want to play multiple sounds then you can either create multiple devices, or create one device, and keep telling it to load different sounds. Use whichever approach makes most sense for your app.
Because each system handles sound file slightly differently there are minor variations in behaviour across platforms. On Mac and JS you should be able to use most types of sound files, while on windows and Linux it must be a WAV. On Windows if the file can't be loaded a default "ping" sound is played instead. The Linux version uses the external program "aplay" to actually play the sound. This is standard in most distributions. Some Linux variants give a warning that a return value is ignored when you compile the Sniff program - this is harmless, and we've fixed it in new versions so if you do see it, just ignore it.
That's about it - get out there, play some music, and add some sound effects to your Sniff games!
No comments:
Post a Comment