StopSound
StopSound SoundIndex
 
Parameters:

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

StopSound will stop a sound from playing immediately.



FACTS:


* none



Mini Tutorial:


This simple 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 displays a message to the user to press a key to stop the playing sound.

Note: In order for this example to work you would need a sound file for it to load.


  
; 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 Stop Looping Sound"
   ; Check for Space Bar press
     If SpaceKey()=true
        
      ; Stop the sound from playing
        StopSound 1
     EndIf
     
   ; Check if the SOUND 1 is playing ?
     If GetSoundPlaying(1)=true
      ; If the sound 1 is still playing, then display a message
        Print "Sound is playing"
     Else
      ; if sound 1 is NOT playing than display a message
        Print "No sound"
     EndIf
     
     
   ; display the screen
     Sync
   ; Loop back to the DO statement.
  Loop
  

 
Related Info: LoadSound | PauseSound | PlayDynamicSound | PlaySound | ResumeSound :
 


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