PlayDynamicSound
PlayDynamicSound SoundIndex, PanningValue, VolumeLevel, FreqValue
 
Parameters:

    SoundIndex = The Index of the sound you wish to play
    PanningValue = The panning of this sound. (range -255 to 255)
    VolumeLevel = The volume of this sound. (range 0 to 255)
    FreqValue = The play back frequency of this sound (range 0 to 44000)
Returns: NONE
 

PlayDynamicSound will send the play sound request to play basics internal sound manager. Unlike the 'PlaySound' command, sounds played dynamically, can be played multiple times without cutting previous play sound requests off. Not only that, each dynamically played sound, uses it's own play back parameters for volume, panning and sound frequency.



FACTS:


* The FreqValue Paremeter will override the sounds default play back frequency. If you wish to use the sounds playback frequency then set this parameter to zero.

* Sounds played with PlayDyanmicSound can't be manually stopped, paused, or have their play back parameters altered while their playing.

* The max number of sounds that can be played together is 255. This is a limitation of the sound device in your computer. In practice, you'll be lucky to ever use more than a 5 or 10 sounds at the same time. So it's really nothing to really worry about.




Mini Tutorial:


This simple example loads a sound file as sound #1, then lets the user play the sound using either PlaySound or PlayDynamicSound, so you can hear the difference.

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: PlaySound :
 


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