PlaySound Command

Purpose

Play a WAV-file.

Syntax

PlaySound wav$ [, flag = 0]

wav$sexp
flagiexp

Description

The PlaySound command plays the WAV (-file) requested by the user. wav$ may specify a filename or a string containing WAV data. If wav$ = "", any currently playing waveform sound is stopped.

flag Meaning
SND_SYNC (0) the sound plays synchronously and waits untill the playing event ends.
SND_ASYNC (1) The sound starts asynchronously and immediately returns to the program (doesn't wait).
SND_NODEFAULT (2) when the sound file cannot be found, the function returns to the program without playing a predefined default sound (usually a warning)
SND_MEMORY (4) A sound is started whose file is loaded in string memory.
SND_LOOP (8) The sound plays repeatedly until PlaySound "" is called You must also specify the SND_ASYNC flag to indicate an asynchronous sound event.
SND_NOSTOP (16) if another song is just being played; the new sound is put in a queue and will be played after completion of the current sound.

If it cannot find the specified sound, PlaySound uses the default system event sound entry instead.

Example

OpenW 1

Print "Playing Tada.wav"

PlaySound WinDir + "\media\tada.wav", SND_SYNC

Print "Playing Notify.wav"

PlaySound WinDir + "\media\notify.wav", SND_NOSTOP

Remarks

The PlaySound command uses the installed sound-driver.

See Also

{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}