# MX\_PLAYSOUND

> [HTML Version](mx_playsound.htm)

**xcall MIAMEX, MX\_PLAYSOUND, fspec \{status, flags\}**

(Windows only) MX\_PLAYSOUND (MIAMEX 100) allows you to play a WAV (sound) file directly. You could also use MX\_SHELLLEX 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.

This function has both a [subroutine and a print tab implementation](subroutine-print-pairs.md).

**Parameters**

_fspec  _([String](string.md))  \[in\]

must contain the file specification (AMOS or Windows syntax) of the WAV file to play (or the "event label" – see _flags_ value \&h00010000 below).

_status_  ([Integer](integer.md))  \[out\]

returns 0 (FALSE) if it failed to play, else non-zero (TRUE) for success.

_flags_  ([Bitmap](bitmap.md) 32)  \[in\]

may be used to specify zero or more flags used by the Windows PlaySound() function:

| **Value** | **Meaning** |
|------|------|
| \&h00000001 | Return immediately (while sound still playing). To terminate the playback later, call this function again with _fspec_="". |
| \&h00000008 | Play sound continuously. Must be used with flag 1 (1+8=9). To terminate the sound later, call with _fspec_="". |
| \&h00000010 | 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.) |
| \&h00002000 | Do not wait if the sound driver is busy. |
| \&h00010000 | 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](hex-decimalvalues.md)



**See Also**

•	[AG\_PLAYSOUND](ag_playsound.md)