a simplified macro-usable wav file player

1 view
Skip to first unread message

Larry

unread,
Nov 15, 2009, 8:34:48 PM11/15/09
to GoogleSemWare TSE, TsePro
// jigwav.s - use wav files for sound effects in macros

/***
This is the simplified wav file player that can be called from another
macro when a named wav file might provide a useful sound effect.

Anywhere in a macro, add this line:

execmacro("jigwav wavfilename")

where 'wavfilename' is the name of the wav file to use. (Do NOT add the
extension.)

You can also play a wav file by executing this macro manually, like so:

jigwav wavfilename

from the Execute Macro prompt. (Again, no .wav extension.)

The macro and the wav files must be located in the TSE \mac\ directory.

(The "uh-oh-.wav file mentioned in the main() procedure was attached to
a previous message, or is available on the internet, or can be changed
to an available wav file of your choice.)

Thanks to Rob and Carlo for making this macro possible.

***/

// macro starts here

// Carlo's mystery enabler
constant SND_ASYNC = 0x0001
constant SND_FILENAME = 0x00020000

dll "<winmm.dll>"

// play the wav
integer proc sysPlaySound(string fn:CStrVal,
integer hModule,
integer fuSound) : "PlaySound"
end

proc Main()

string fn[_maxpath_]=loaddir()+"mac\"+Lower(Query(MacroCmdLine))+".wav"

if fileexists(fn)
sysPlaySound(fn, 0, SND_FILENAME|SND_ASYNC)
else
fn=loaddir()+"mac\uh-oh-.wav"
sysPlaySound(fn, 0, SND_FILENAME|SND_ASYNC)
endif

goto ending
ending:

end

jigwav.mac
jigwav.s
Reply all
Reply to author
Forward
0 new messages