| Introduction | MTB Statements | File System | Compiler | Applications | Reference Guide | Index |
| Language Structure | Data Division | I/O Format Division | Procedure Division | Mnemonics |
| Mnemonic: | (Play Sound=WavFileName,Flags) | |||||||||||||||||||||||||||
| Discussion: |
The (Play Sound) mnemonic plays a sound file.
The WavFileName parameter is specified using the full path name, such as c:\comet\dlg.tada.wav. If this parameter is null, any currently playing waveform sound is stopped.
The second parameter, Flags, is a numeric value that describes how the sound file is to be played. This parameter is the sum of the numeric values listed in the following chart. For example, if Flags is equal to 3, the driver interprets this as:
The following chart includes 3 columns. The left column contains the numeric values for the Flag parameter. The middle column contains a reference name for each value (which is used in some of the sample code below). The right column contains a description of the value.
| |||||||||||||||||||||||||||
| Example 1: |
Print (PlaySound = "c:\comet\dlg\tada.wav",3)In this example, the WAV file named c:\comet\dlg\tada.wav is played. The flag is equal to 3, which indicates that the sound is to be played asynchronously (1) and that there will be silence if the WAV file is not found (2). | |||||||||||||||||||||||||||
| Example 2: |
SET SND.ASYNC=1 SET SND.NODEFAULT=2 Length 10.0 & Local SoundFlags SoundFlags = SND.ASYNC + SND.NODEFAULT Print (PlaySound = "c:\comet\dlg\tada.wav", SoundFlags) | |||||||||||||||||||||||||||
| Example 3: |
SET SND.ASYNC=1 SET SND.NODEFAULT=2 Length 10.0 & Local SoundFlags IF OPTION$ = "QUIT" THEN SoundFile$ = "c:\sound files\goodbye.wav" SoundFlags = SND.ASYNC + SND.NODEFAULT Print (PlaySound = SoundFile$, SoundFlags) STOP ENDIFThis code segment shows how to play a WAV file named c:\sound files\goodbye.wav when the user chooses the QUIT option. |