SOUND <snd>[edit | edit source]
Syntax[edit | edit source]
SOUND soundIDstring$ SOUND %resIDNumber SOUND &soundHandle&
Description[edit | edit source]
This statement plays a synthesized sound which is in the "snd" format. The
soundIDstring$ parameter identifies the sound you want to play; you can construct this string in any of the following ways:
- By resource name: Set
soundIDstring$to the name of an "
snd" resource in a currently open resource file. Don't use a resource name that begins with "%" or with "&", or it will be confused with the other forms discussed below.
- By resource ID number: If
%myResIDis the resource ID number of an "
snd" resource in a currently open resource file, you can prefix the number with a percent sign:
- By "
snd" handle: If
&mySoundHandle&is a handle to a sound in "
snd" format, you can construct the
soundIDstring$parameter as follows:
If FB 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[edit | edit source]
If you want your program to "wait" until a sound finishes before continuing, you can use the function:
"reallyLongSound" '(stays in this loop until sound finishes)'
See Also[edit | edit source]
SOUND%; SOUND <frequency>; SOUND END