作ってみた。
#include "winmm.as"
#const MIDIMAPPER 0xFFFFFFFF
#define ctype MIDIMSG(%1,%2,%3) ((%1) | ((%2)<<8) | ((%3)<<16))
onexit goto *on_exit
midiOutOpen varptr(hMidi), MIDIMAPPER , 0 , 0 , 0
color 127,127,127 : boxf
w = 30 : h = 100
ox = 50 : oy = 50
color 250,250,250
repeat 15
boxf ox+w*cnt, oy, ox+w*cnt+w-2, oy+h
loop
color 0,0,0
repeat 13
if( cnt == 2 || cnt == 6 || cnt == 9 ) { continue }
boxf ox+w*cnt+w/2, oy, ox+w*cnt+w-2+w/2, oy+h/2
loop
tmp = ""
repeat 128
if( tmp != "" ) { tmp += "\n" }
tmp += "音色 "+cnt
loop
objsize 100,24 : pos 50, 10 : combox tone,,tmp
tone = 0
objprm stat, tone
tmp = ""
repeat 128
if( tmp != "" ) { tmp += "\n" }
tmp += "音量 "+cnt
loop
objsize 100,24 : pos 180, 10 : combox volume,,tmp
volume = 100
objprm stat, volume
s_kuro = 61, 63, 0, 66, 68, 70, 0, 73, 75, 0, 78, 80, 82, 0
s_siro = 60, 62, 64, 65, 67, 69, 71, 72, 74, 76, 77, 79, 81, 83, 84
scale = -1
*main
stick key,256,1
if( mouseLButton ) {
if( (key & 256) == 0 ) {
mouseLButton = 0
gosub *on_release
}
}
else {
if( (key & 256) != 0 ) {
mouseLButton = 1
gosub *on_push
}
}
wait 1
goto *main
*on_push
mx = mousex
my = mousey
s = -1
repeat 13
if( cnt == 2 || cnt == 6 || cnt == 9 ) { continue }
if( ox+w*cnt+w/2 <= mx & mx <= ox+w*cnt+w-2+w/2 & oy <= my & my <= oy+h/2 ) {
s = s_kuro(cnt)
break
}
loop
if( s < 0 ) {
repeat 15
if( ox+w*cnt <= mx & mx <= ox+w*cnt+w-2 & oy <= my & my <= oy+h ) {
s = s_siro(cnt)
break
}
loop
}
if( s >= 0 ) {
scale = s //音階
midiOutShortMsg hMidi, MIDIMSG(0xC0, tone, 0) //音色設定
midiOutShortMsg hMidi, MIDIMSG(0x90, scale, volume) //鳴らす
title "tone:"+tone+" scale:"+scale+" volume"+volume
}
return
*on_release
if( scale >= 0 ) {
midiOutShortMsg hMidi, MIDIMSG(0x80, scale, 0) //消す
scale = -1
title ""
}
return
*on_exit
if( hMidi ) {
midiOutReset hMidi
midiOutClose hMidi
}
end