Xbasic

PLAY_SOUND Function

Syntax

L PLAY_SOUND(C wave file[, N setting flags])

Arguments

wave

The name of a sound file. The .WAV extension is assumed. Character

setting

Numeric

Description

PLAY_SOUND() plays a sound file (.WAV extension).

Example 

This script plays a sound file.

play_sound("c:\windows\sounds\kaboom.wav")

Look in the Xbasic Explorer under constants for the following values.

UI_LOOP_SOUND
UI_SYSTEM_SOUND
UI_WAIT_SOUND
 ' Play the windows XP startup sound
play_sound("Windows XP Startup", UI_SYSTEM_SOUND)
' Play Chimes continuously
play_sound("Chimes", UI_SYSTEM_SOUND + UI_LOOP_SOUND)
' If you want to play two sounds back to back, the second sound will preempt the first sound
play_sound("Windows XP Startup", UI_SYSTEM_SOUND)
play_sound("Chimes", UI_SYSTEM_SOUND)
' Unless you wait for the first sound to finish with the wait flag
play_sound("Windows XP Startup", UI_SYSTEM_SOUND + UI_WAIT_SOUND)
play_sound("Chimes", UI_SYSTEM_SOUND)

Limitations

Desktop applications only.

See Also