ll_libload winmm, "winmm.dll"
ll_getproc midiOutOpen, "midiOutOpen", winmm
ll_getproc midiOutShortMsg, "midiOutShortMsg", winmm
ll_getproc midiOutReset, "midiOutReset", winmm
ll_getproc midiOutClose, "midiOutClose", winmm
#module
#deffunc midiopen
ll_getptr midh : ll_ret ptr
prm = ptr, -1, 0, 0, 0
ll_callfunc prm, 4, midiOutOpen@
return
#deffunc midisetkey int, int, int
mref key, 0 : mref velocity, 1 : mref channel, 2
if midh = 0 : midiopen
prm = midh, velocity * 0x10000 + 0x3C90 + (key * 0x100) + channel
ll_callfunc prm, 2, midiOutShortMsg@
return
#deffunc midireset
if midh : ll_callfunc midh, 1, midiOutReset@ // 全て停止
return
#deffunc midiclose onexit
if midh : ll_callfunc midh, 1, midiOutClose@
return
#global
sdim key, 8, 13
dim select, 13
key = "ド", "ド#", "レ", "レ#", "ミ", "ファ", "ファ#", "ソ", "ソ#", "ラ", "ラ#", "シ", "ド"
randomize
objsize 40, 25
pos 10, 10 : mes "Do you understand what sound you are?"
pos 10, 40 : button "OK", *start
lv = 1
stop
*start
color 255, 255, 255 : boxf , 40 : color
clrobj
pos 10, 70 : mes "Lv" + lv
mes "Ready..."
wait 100
repeat 13
play.cnt = 0
select.cnt = 0
loop
repeat lv
rnd r, 13
if play.r : continue cnt
play.r = 1
midisetkey r, 0x7F, cnt
loop
wait 50
mes "End..."
midireset
repeat 13
pos cnt * 45 + 10, 160 : button key.cnt, *note
loop
pos 10, 250 : button "OK", *ok
stop
*note
color 255, 255, 255 : boxf stat * 45 + 10, 130, (stat + 1) * 45, 150 : color 255
select.stat = 1 - select.stat
if select.stat : pos stat * 45 + 20, 130 : mes "◎"
stop
*ok
ng = 0
repeat 13
if play.cnt {
pos cnt * 45 + 20, 150 : mes "◎"
if select.cnt = 0 : pos cnt * 45 + 20, 130 : mes "×" : ng = 1
} else {
if select.cnt ! 0 : pos cnt * 45 + 20, 150 : mes "×" : ng = 1
}
loop
color
pos 10, 180
clrobj
if ng {
lv--
if lv < 1 : mes "You are Dead ! See you !" : goto *exit
mes "Error ! Level Down (xox)"
} else {
lv++
if lv > 10 : mes "All Clear ! Thank you !" : goto *exit
mes "Good Job ! Level Up (^o^)"
}
pos 10, 40 : button "OK", *start
stop
*exit
wait 300
|