OPTIONS "C_CALL LABELCHECK WINFUNC NOSOURCE"
LIBRARY rexxgui
DO
FUNCDEF("mciSendString", "32u, str, void, 32u, void", "winmm")
FUNCDEF("mciGetErrorString", "32u, 32u, str[260] stor, 32u", "winmm")
CATCH FAILURE
CONDITION("M")
RETURN
END
fn = ''
err = guifile('FN', 'EXISTING', 'Pick out a MIDI file', 'MIDI files (*.mid) | *.mid | All files (*.*) | *.*')
IF err = '' THEN DO
err = mcisendstring('open "' || fn || '" type sequencer alias A_Song', 0, 0, 0)
IF err \== 0 THEN DO
mcigeterrorstring(err, buf, 260)
guisay(buf)
END
ELSE DO
err = mcisendstring("play A_Song from 0 wait", 0, 0, 0)
IF err \== 0 THEN DO
mcigeterrorstring(err, buf, 260)
RXSAY(buf)
END
mcisendstring("close A_Song wait", 0, 0, 0)
END
END
RETURN |