PauseSound
PauseSound SoundIndex, PanningValue
 
Parameters:

    SoundIndex = The Index of the sound you wish to pause
    PanningValue
Returns: NONE
 

PauseSound will pause a sound from playing. The sound can be resumed later with the ResumeSound command



FACTS:


* When a played sound is paused, the GetSoundPlaying() function will return a true, enough though the sound is paused.




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
  
; 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 "Use the LEFT Arrow to play sound 1 with PlaySOUND"
     Print "Use the RIGHT Arrow to play sound 1 with PlayDyanmicSOUND"
     
   ; IF the LEFT Arrow key is pressed, THEN it will play sound 1
   ; using the playSound command
     If LeftKey() Then PlaySound 1
     
   ; IF the RIGHT Arrow key is pressed, THEN it will play sound 1
   ; using the PlayDynamicSound command
     
     If RightKey()
      ; Play the sound dynamically, with random Panning,
      ; random Volume and random play back Frequency
        PlayDynamicSound 1,RndRange(-255,255),255,RndRange(2000,44000)
     EndIf
     
     
   ; display the screen
     Sync
   ; Loop back to the DO statement.
  Loop
  

 
Related Info: GetSoundPlaying | PlaySound | ResumeSound | StopSound :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com