
|
<<
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:
- By resource name: Set
soundIDPascalString
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
%myResID
is the resource ID number of an "snd
" resource in a currently open resource file, you can prefix the number with a percent sign:
sound %myResID
- By "
snd
" handle: If &mySoundHandle&
is a handle to a sound in "snd
" format, you can construct the soundIDPascalString
parameter as follows:
sound &mySoundHandle&
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