SOUND* name = "filename";
Defines a
DirectSound object
from a .wav or .ogg sound file with the given name. Sample rates of 11, 22, or 44 kHz and 8 or 16 bit mono are supported.
Parameters:
"filename" - name of the .wav or .ogg sound file,
or "#nnn" for a 440 Hz sine wave sound of nnn seconds duration.
Remarks:
- Sound objects are permanently stored in memory and can be played or looped without initial delay. For large sounds to be streamed from a file, or sounds in other formats (such as .mp3) and stereo sounds use the media_play function.
- Use snd_create() for creating a sound at runtime.
OpenAL sounds can not be statically defined, but must always be created with snd_createoal() or snd_createstream().
-
Sine wave sounds created with "#nnn" are sampled in 16 bit with 44.1 kHz sample rate. They don't require a sound file and can be used as sound buffers for further manipulation with the snd_tune,
snd_add, or snd_buffer functions.
-
.ogg sounds are shorter in file length than .wav sounds, but take a little longer to load. For creating and editing sounds, a free sound editor like Audacity can be used.
Example:
SOUND* explo_snd = "explo.wav";
function main()
{
snd_play(explo_snd,100,0);
}
See also:
snd_create, snd_buffer, snd_play, media_play
► latest version online