$INCLUDE "rapidq.inc"
DIM file AS QFILESTREAM
bpmnum01=0
bpmnum02=0
bpmnum03=0
DECLARE SUB makefile
DECLARE SUB bpmfix
DECLARE SUB closeprog
file.OPEN ("midi01_file.mid", fmcreate)
CREATE form AS QFORM
height=180
width=450
center
borderstyle=bsdialog
CREATE songname AS QEDIT
top=10
left=10
width=100
height=26
END CREATE
CREATE bpm AS QEDIT
top=50
left=10
width=50
height=26
END CREATE
CREATE playbutton AS QBUTTON
CAPTION="make"
top=50
left=150
height=22
onclick=makefile
END CREATE
CREATE closebutton AS QBUTTON
CAPTION="close"
top=10
left=150
height=22
onclick=closeprog
END CREATE
SHOWMODAL
END CREATE
SUB makefile
file.writestr("MThd",4)
file.writenum(0,1)
file.writenum(0,1)
file.writenum(0,1)
file.writenum(6,1)
file.writenum(0,1)
file.writenum(1,1)
file.writenum(0,1)
file.writenum(2,1)
file.writenum(0,1)
file.writenum(96,1)
file.writestr("MTrk",4)
file.writenum(0,1)
file.writenum(0,1)
file.writenum(0,1)
file.writenum(19,1)
bpmfix
file.writenum(0,1)
file.writenum(255,1)
file.writenum(81,1)
file.writenum(3,1)
file.writenum(bpmnum01,1)
file.writenum(bpmnum02,1)
file.writenum(bpmnum03,1)
file.writenum(0,1)
file.writenum(255,1)
file.writenum(88,1)
file.writenum(4,1)
file.writenum(4,1)
file.writenum(2,1)
file.writenum(24,1)
file.writenum(8,1)
file.writenum(0,1)
file.writenum(255,1)
file.writenum(47,1)
file.writenum(0,1)
file.writestr("MTrk",4)
file.writenum(0,1)
file.writenum(0,1)
file.writenum(0,1)
file.writenum(68,1)
file.writenum(0,1)
file.writenum(145,1)
file.writenum(63,1)
file.writenum(100,1)
file.writenum(48,1)
file.writenum(129,1)
file.writenum(63,1)
file.writenum(100,1)
FOR t=1 TO 7
file.writenum(0,1)
file.writenum(145,1)
file.writenum(63,1)
file.writenum(100,1)
file.writenum(48,1)
file.writenum(129,1)
file.writenum(63,1)
file.writenum(100,1)
NEXT t
file.writenum(0,1)
file.writenum(255,1)
file.writenum(47,1)
file.writenum(0,1)
file.CLOSE
RENAME (DIR$("midi01_file.mid",faanyfile),songname.text+".mid")
END SUB
SUB bpmfix
bpmnum=INT(VAL(bpm.text))
IF bpmnum<1 THEN bpmnum=1
IF bpmnum>2048 THEN bpmnum=2048
bpmnum=INT((60/bpmnum)*1000000)
bpmhex$=HEX$(bpmnum)
bpmhex01$=RIGHT$(LEFT$(bpmhex$,4),2)
bpmhex02$=RIGHT$(LEFT$(bpmhex$,6),2)
bpmhex03$=RIGHT$(bpmhex$,2)
bpmnum01=VAL(CONVBASE$(bpmhex01$,16,10))
bpmnum02=VAL(CONVBASE$(bpmhex02$,16,10))
bpmnum03=VAL(CONVBASE$(bpmhex03$,16,10))
END SUB
SUB closeprog
form.CLOSE
END
END SUB
|
|