ResumeSound will resume playing previously paused sound.
FACTS:
* none
Mini Tutorial:
This larger example shows how you would load a sound file as sound #1, enable automatic looping and then play it.
During the main Do/loop section of this program, the code allows the user to selectively pause/resume the playing sound with a tap of the spacekey()
Note: In order for this example to work you would need a sound file for it to load.
SetFPS 50 ; Load the sound file into memory LoadSound "MySoundFile.wav",1 ; Set sound to loop automatically once played LoopSound 1 ; Begin playing the looped sound. PlaySound 1 ; Start a Do/loop Do ;Clear the Screen to black Cls RGB(0,0,0) ; display a message Print "Hit Space Bar to Pause/Resume Looping Sound" ; Check for Space Bar is pressed and the delay variable ; equals zero, then we'll pause or resume sound 1 If delay=0 If SpaceKey()=true ; Check if the SOUND 1 is playing ? Select GetSoundPlaying(1) Case 1 ; the sound 1 is playing, so we'll pause it PauseSound 1 Case 1+2 ; if sound 1 is PLaying but PAUSED, so we'll ; resume it ResumeSound 1 EndSelect ; Set the Delay variable to 20 Delay=20 EndIf Else ; Subtract 1 from Delay variable Dec delay EndIf ; Check if the SOUND 1 is playing ? Select GetSoundPlaying(1) Case 0 ; if sound 1 is NOT playing than display a message Print "No Sound" Case 1 ; If the sound 1 is still playing, then display a message Print "Sound is playing" Case 2 Print "Sound is Paused but Not playing" Case 3 Print "Sound is playing but is paused" EndSelect ; display the screen Sync ; Loop back to the DO statement. Loop |
|