Skip to content

Instantly share code, notes, and snippets.

@michaellindahl
Created December 4, 2013 05:48
Show Gist options
  • Save michaellindahl/7782978 to your computer and use it in GitHub Desktop.
Save michaellindahl/7782978 to your computer and use it in GitHub Desktop.
MASM Assembly code that uses the Windows PlaySound function to play .wav files
TITLE MASM PlaySound (PlaySoundExample.asm)
; Description: MASM Assembly code that uses the Windows PlaySound function to play .wav files
; Revision date: Created Dec 3, 2013 by Michael Lindahl
includelib Winmm.lib
PlaySound PROTO,
pszSound:PTR BYTE,
hmod:DWORD,
fdwSound:DWORD
.data
deviceConnect BYTE "DeviceConnect",0
SND_ALIAS DWORD 00010000h
SND_RESOURCE DWORD 00040005h
SND_FILENAME DWORD 00020000h
file BYTE "c:\\clap.wav",0
.code
main PROC
INVOKE PlaySound, OFFSET deviceConnect, NULL, SND_ALIAS
INVOKE PlaySound, OFFSET file, NULL, SND_FILENAME
exit
main ENDP
END main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment