; LoadSound Example ; ----------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; LoadSound reads a whole sound file into memory and returns a handle. ; Load once at startup, then play the handle as often as you like. snd_beep=LoadSound("media/beep.wav") snd_boom=LoadSound("media/boom.wav") snd_shoot=LoadSound("media/shoot.wav") last_played$="(none yet)" While Not KeyDown(1) ; Keys 1-3 play the loaded sounds If KeyHit(2) Then PlaySound snd_beep last_played$="beep" End If If KeyHit(3) Then PlaySound snd_boom last_played$="boom" End If If KeyHit(4) Then PlaySound snd_shoot last_played$="shoot" End If Cls Text 0,0,"1: beep 2: boom 3: shoot Esc: exit" Text 0,30,"snd_beep = LoadSound(media/beep.wav) -> handle "+snd_beep Text 0,50,"snd_boom = LoadSound(media/boom.wav) -> handle "+snd_boom Text 0,70,"snd_shoot = LoadSound(media/shoot.wav) -> handle "+snd_shoot Text 0,110,"Last played: "+last_played$ Flip Wend End