GetFreeSound
FreeSoundIndex = GetFreeSound()
 
Parameters: NONE
Returns:

    FreeSoundIndex = The Index of a Sound that is currently not in use
 

The GetFreeSound function returns the Index of a sound that is currently NOT in use. This is particularly useful when you wish to dynamically request and use sound media as you need it. As it takes the burdon of managing what sound indexes are currently available, off your shoulders, and hides it away inside PlayBasic.



FACTS:


* GetFreeSound() will return a ZERO if the max number of Sound Indexes have been exceeded.




Mini Tutorial:


This example uses GetFreeSound() to request a free sound index. Then uses this index it load a sound fx and play it.


  
  
; Ask PlayBASIC for the Sound Index that is currently free for use.
  MySound=GetFreeSound()
  
; Load a Sound File into this Free Sound
  LoadSound "MySuondFile.wav",MySound
  
; Display the Status of MySound
  Print "Sound Status:"+Str$(GetSoundStatus(MySound))
  
; PLay the sound
  PlaySound MySound
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  





 
Related Info: DeleteAllSounds | DeleteSound | GetSoundStatus | LoadNewSound | LoadSound | PlaySound :
 


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