; StopChannel Example ; ------------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; A short tone looped endlessly - it will hum forever unless stopped snd=LoadSound("media/beep.wav") LoopSound snd channel=PlaySound(snd) While Not KeyDown(1) ; S stops the channel dead. Unlike PauseChannel there is no ; resuming - the channel is finished for good. If KeyHit(31) Then StopChannel channel ; Space starts a fresh looping channel with PlaySound If KeyHit(57) Then StopChannel channel channel=PlaySound(snd) End If ; ChannelPlaying confirms the stop: 1 while humming, 0 after playing=ChannelPlaying(channel) Cls If playing Then Color 80,255,80 Oval 296,190,48,48,True Color 255,255,255 Text 320,260,"channel humming - ChannelPlaying = 1",True Else Color 70,70,70 Oval 296,190,48,48,False Color 160,160,160 Text 320,260,"stopped - ChannelPlaying = 0",True End If Color 255,255,255 Text 0,0,"S: StopChannel Space: start a new loop Esc: exit" Flip Wend StopChannel channel End