DECLARE FUNCTION Elapsed AS STRING
DIM L AS STRING
L = SPACE$(30)
DIM Mins AS INTEGER
DIM Sec AS INTEGER
DIM QueryStr AS STRING
QueryStr = SPACE$(30)
FUNCTION Elapsed()
mciSendString("set music time format ms", "", 0, 0)
mciSendString("Status music position",VARPTR(QueryStr),30,0)
sec = ROUND(VAL(MID$(QueryStr, 1, LEN(QueryStr))) / 1000)
IF sec < 60 THEN Elapsed = "00:" & RIGHT$("0"+STR$(Sec),2)
IF sec > 59 THEN
mins = INT(sec / 60)
sec = sec - (mins * 60)
Elapsed = RIGHT$("0"+STR$(Mins),2) & ":" & RIGHT$("0"+STR$(Sec),2)
END IF
END FUNCTION
DECLARE FUNCTION midiOutShortMsg LIB "winmm.dll" ALIAS "midiOutShortMsg" _
(hMidiOut AS LONG, dwMsg AS LONG) AS LONG
DECLARE FUNCTION midiOutClose LIB "winmm.dll" ALIAS "midiOutClose" _
(hMidiOut AS LONG) AS LONG
DECLARE FUNCTION midiOutOpen LIB "winmm.dll" ALIAS "midiOutOpen" _
(byref lphMidiOut AS LONG, uDeviceID AS LONG, dwCallback_
AS LONG, dwInstance AS LONG, dwFlags AS LONG) AS LONG
DECLARE FUNCTION packdword (i1 AS INTEGER, i2 AS INTEGER, i3 AS INTEGER, i4 AS INTEGER) AS LONG
DECLARE SUB sendmsg
DIM hmidiout AS LONG
DIM device AS INTEGER
device = 0
CREATE Form AS QFORM
CAPTION = "MCI test, send arpeggio"
Width = 246
Height = 124
Center
CREATE Button1 AS QBUTTON
CAPTION = "Send message to MCI"
Left = 32
Top = 40
Width = 171
Onclick = sendmsg
END CREATE
CREATE led AS QPANEL
top = 80
left = 32
width = 16
height = 8
COLOR = &h000040
END CREATE
CREATE label1 AS QLABEL
top = 76
left = 50
CAPTION = "Sending message"
END CREATE
END CREATE
SUB sendmsg
led.COLOR = &h0000ff
midiOutOpen hMidiOut, device, 0, 0, 0
FOR x = 1 TO 16
DOEVENTS
midiOutShortMsg hMidiOut, packdword(0, 100, 64+x, &h90)
SLEEP 0.2
midiOutShortMsg hMidiOut, packdword(0, 0, 64+x, &h90)
NEXT
midiOutClose hMidiOut
led.COLOR = &h000040
END SUB
FUNCTION packdword (i1 AS INTEGER, i2 AS INTEGER, i3 AS INTEGER, i4 AS INTEGER) AS LONG
packdword = i2 * &H10000 + i3 * &H100 + i4
END FUNCTION
Form.SHOWMODAL
|