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.
Parameters
fspec (String) [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) [out]
returns 0 (FALSE) if it failed to play, else non-zero (TRUE) for success.
flags (Bitmap 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". |
See Also