DspPlaySound
- Last UpdatedJul 18, 2023
- 2 minute read
Plays a waveform (sound). Wave form sound files *.wav are provided with Windows and by third-party developers, or you can record them yourself to play long (and complex) sound sequences.
|
|
|
LOSS OF CONTROL
Failure to follow these instructions can result in death, serious injury, or equipment damage. |
When the sSoundname is a sound file path and "Mode is "0", this function loads the .wav file from the specified path (Sound Files) and plays the associated waveform. If the specified sound file is not available in the mentioned path, an error message will be returned and a hardware alarm will be reported. Use of a system sound in this mode is not supported and will result in an error message and a hardware alarm.
When the sSoundname is a system sound name and nMode is "1", this function searches the system for the entry with the specified name and plays the associated waveform. If the name cannot be found, there is no error message indicated as either a return value or hardware alarm. For this reason, the use of mode 0 with waveform files is recommended over mode 1 with system sounds. Further, use of a valid wave form sound file in this mode instead of mode "0" will result in an error message and a hardware alarm informing the wrong mode is in use.
Syntax
DspPlaySound(sSoundname, nMode)
sSoundname:
Sound File Path: Sound file to be played from the specified path.
System Sound Name: The predefined system waveform to be played. Examples of predefined sounds include:
• SystemAsterisk
• SystemExclamation
• SystemQuestion
• SystemDefault
• SystemHand
• SystemExit
• SystemStart
nMode:
• Mode 0: For use when the "sSoundname" is a sound file path.
• Mode 1: For use when the "sSoundname" is a system sound name.
Return Value
TRUE if successful, otherwise FALSE (if an error is detected).
Related Functions
Example
DspPlaySound("C:\WINNT\MEDIA\Notify.wav",0);
DspPlaySound("SystemStart",1);
