FutureBasic Logo

<<    Index    >> FutureBasic 5

sound <snd>   statement



Syntax:
sound soundIDPascalString
sound %resIDNumber
sound &soundHandle&


Description:
This statement plays a synthesized sound which is in the "snd" format. The soundIDPascalString parameter identifies the sound you want to play; you can construct this string in any of the following ways:
If FutureBasic needs to load a resource to play the sound, it does not automatically release the resource after the sound stops. In this case, you should either use purgeable "snd " resources, or you should execute the sound end statement to force the resource to be released.
Sounds played using the sound <snd> statement are always played asynchronously; that is, your program continues to the next statement immediately, while the sound is playing in the background. However, if you execute a second sound <snd> statement while a previous sound is still playing in the background, the new sound won't start playing until the first sound finishes.

Example:
If you want your program to "wait" until a sound finishes before continuing, you can use
the sound% function:
sound "reallyLongSound"
while sound%
   '(stays in this loop until sound finishes)
wend


See Also:
sound%; sound <frequency>; sound end