; PauseChannel Example ; -------------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; A short tone looped endlessly gives us a steady engine hum snd=LoadSound("media/beep.wav") LoopSound snd channel=PlaySound(snd) paused=0 angle#=0 While Not KeyDown(1) ; P pauses the channel: playback freezes but the channel survives If KeyHit(25) And paused=0 Then PauseChannel channel paused=1 End If ; R resumes it exactly where it left off (see ResumeChannel) If KeyHit(19) And paused=1 Then ResumeChannel channel paused=0 End If ; The fan only spins while the engine hum is running If paused=0 Then angle=angle+4 Cls Color 100,100,100 Oval 250,170,140,140,False Color 255,255,255 Line 320,240,320+Cos(angle)*60,240+Sin(angle)*60 Line 320,240,320-Cos(angle)*60,240-Sin(angle)*60 If paused Then Color 255,180,80 Text 320,340,"PAUSED - PauseChannel channel",True Else Color 80,255,80 Text 320,340,"RUNNING",True End If Color 255,255,255 Text 0,0,"P: pause R: resume Esc: exit" Flip Wend StopChannel channel End