#include "llmod.as"
#module
#deffunc deviceopen ;MIDIデバイスオープン
ll_libload winmm,"winmm.dll" ;winmm.dllのロード
getptr phdevice,hdevice
prm=phdevice,-1,0,0,0
dllproc "midiOutOpen",prm,5,winmm ;MIDIデバイスオープン
return
#deffunc instrument int,int ;楽器の設定
mref channel,0 ;設定するチャンネル
mref inst,1 ;音色番号
prm=hdevice,inst<<8+$C0+channel
dllproc "midiOutShortMsg",prm,2,winmm ;楽器の設定
return
#deffunc sound int,int,int,int ;音を鳴らす・消す
mref channel,0 ;鳴らすチャンネル
mref scale,1 ;音程
mref volume,2 ;音量
mref silence,3 ;消音の場合は1を指定
prm=hdevice,volume<<16+(scale<<8)+($90-(silence*$10))+channel
dllproc "midiOutShortMsg",prm,2,winmm
return
#deffunc deviceclose onexit ;MIDIデバイスクローズ
dllproc "midiOutClose",hdevice,1,winmm
ll_libfree winmm
return
#global
deviceopen ;MIDIデバイスをオープン
instrument 0,0 ;楽器No.1(グランドピアノ?)
sound 0,60,127 : wait 30 : sound 0,60,,1 ;ド
sound 0,62,127 : wait 30 : sound 0,62,,1 ;レ
sound 0,64,127 : wait 30 : sound 0,64,,1 ;ミ
sound 0,65,127 : wait 30 : sound 0,65,,1 ;ファ
sound 0,67,127 : wait 30 : sound 0,67,,1 ;ソ
sound 0,69,127 : wait 30 : sound 0,69,,1 ;ラ
sound 0,71,127 : wait 30 : sound 0,71,,1 ;シ
sound 0,72,127 : wait 30 : sound 0,72,,1 ;ド
|