; ChannelPlaying Example ; ---------------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; Load a short explosion - long enough to watch the status lamp snd=LoadSound("media/boom.wav") channel=0 While Not KeyDown(1) ; Space fires the explosion on a fresh channel If KeyHit(57) Then channel=PlaySound(snd) ; ChannelPlaying returns 1 while the channel is still sounding, ; and 0 once it has finished (or was never started) playing=ChannelPlaying(channel) Cls ; Status lamp: lit while the explosion is audible If playing Then Color 80,255,80 Oval 296,190,48,48,True Else Color 70,70,70 Oval 296,190,48,48,False End If Color 255,255,255 Text 320,260,"ChannelPlaying(channel) = "+playing,True Text 0,0,"Space: play explosion, then watch the lamp go out Esc: exit" Flip Wend End