You posted this in the programming area as well and it's already been answered... But I feel like answering anyway.
Const StartKey = 2, StopKey = 3
Sound = LoadSound("Your Sound Here.mp3")
Channel = PlaySound(Sound)
While Not KeyHit(1) ;Repeats until the user presses the escape key
If KeyHit(StopKey) Then PauseChannel Channel ;If the user presses 'StopKey' (which is '2') then pause the sound
If KeyHit(StartKey) Then ResumeChannel Channel ;If the user presses the key 'StartKey' (which is '1') then resume the sound
Wend
End
If you want to control sounds in your program, you will have to use channels. Basically, whenever you play a sound in Blitz, the function PlaySound will return a variable specifying the 'channel' that the sound is using to play. You can then use functions such as PauseChannel and ResumeChannel to modify the sound that is currently playing.
|