PlaySound
PlaySound SoundIndex
 
Parameters:

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

PlaySound will play the requested sound. The sound will be played using it's current volume, panning and playback frequency. Each of which you can be assign at will using the SoundVolume,SoundFreq,SoundPan commands.




FACTS:


* Attempting to play a sound that is already playing, will result in the sound that is being currently played, being cut off replace by the newer play sound request. If you want to overcome this, by either using the GetSoundPlaying command to monitor a sounds playback status or using the PlayDynamicSound command.




Mini Tutorial:


This simple example shows how you would load a sound file as sound #1, then play it.

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
  
; play the sound file
  PlaySound 1
  
; Display a message to the screen
  Print "Sound has been loaded & Played"
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  


This example would output.

  
  Sound has been loaded & Played
  

 
Example Source: Download This Example
; Load a sound file
  LoadSound "YourSoundFile.wav",1
  
;Start of loop
  Do
   ; Clear The Screen
     Cls 0
     
   ; Display a message
     Print "Space Key To Play Sound"
     
   ; If the space key is pressed then PLay sound #1
     If SpaceKey()=true Then PlaySound 1
     
   ; Display the screen and loop back to the DO statement
     Sync
  Loop
  
  
  
 
Related Info: :
 


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