1 ! Copyright (C) 2013 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.c-types alien.syntax byte-arrays formatting kernel
11 FUNCTION: MCIERROR mciSendStringW (
13 LPTSTR lpszReturnString,
18 ALIAS: mciSendString mciSendStringW
22 : check-mci-error ( n -- )
23 [ mci-error ] unless-zero ;
25 : open-command ( path -- )
26 "open \"%s\" type mpegvideo alias MediaFile" sprintf f 0 f
27 mciSendString check-mci-error ;
30 "play MediaFile" f 0 f mciSendString check-mci-error ;
32 : pause-command ( -- )
33 "pause MediaFile" f 0 f mciSendString check-mci-error ;
35 : status-command ( -- bytes )
36 "status MediaFile mode" 128 <byte-array> [ 0 f mciSendString check-mci-error ] keep ;
39 : close-command ( -- )
40 "close MediaFile" f 0 f mciSendString check-mci-error ;