MIAMEX 100: Play sound

xcall MIAMEX, MX_PLAYSOUND, fspec {status, flags}

(Windows only) MX_PLAYSOUND allows you to play a WAV (sound) file directly. You could also use MX_ERRNOMSG to launch the media player to play a specified sound file, but this method avoids the complication of another application and gives you more control. .

 

Parameters

fspec

must contain the file specification (AMOS or Windows syntax) of the WAV file to play (or the "event label" – see flags value &h10000 below).

status  (Num)  optional

returns 0 (FALSE) if it failed to play, else non-zero (TRUE) for success.

flags  (Num)  optional

may be used to specify flags used by the Windows PlaySound() function:

Value

Meaning

&h00001

Return immediately (while sound still playing). To terminate the playback later, call this function again with fspec="".

&h00008

Play sound continuously. Must be used with flag 1 (1+8=9). To terminate the sound later, call with fspec="".

&h00010

Do not stop a currently playing sound. (Otherwise a request to play a sound file will terminate any sound file currently playing; this is why setting fspec to null terminates the current sound file.)

&h02000

Do not wait if the sound driver is busy.

&h10000

FSPEC is not interpreted as a file specification but as an "event label" defined in the registry. See HKEY_USERS\.Default \AppEvents \EventLabels. These are the "sound events" that you can associate sound files with using the Control Panel Sound applet (only the registry names may differ from the names displayed in that applet). Typical examples are "SystemAsterisk" and "NmainMouseClick".

Hex-Decimal Values