ll_libload winmm, "winmm.dll"
ll_getproc midiOutOpen, "midiOutOpen", winmm
ll_getproc midiOutShortMsg, "midiOutShortMsg", 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@ // MIDIデバイスオープン
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 midiclose onexit
if midh : ll_callfunc midh, 1, midiOutClose@ // MIDIデバイスクローズ
return
#global
sdim key, 8, 13
key = "ド", "ド#", "レ", "レ#", "ミ", "ファ", "ファ#", "ソ", "ソ#", "ラ", "ラ#", "シ", "ド"
push = 0, 2, 4, 5, 7, 9, 11, 12
repeat 8
tmp = push.cnt
midisetkey tmp, 0x7F
mes key.tmp
wait 100
loop
stop
|