命令・関数名 | パラメータ | パラメータの説明 |
midi_Open
MIDIデバイスをオープンします。
オープン中はMIDIの各操作を実行することができます。 |
(stat) | 0以外 (OK) 0 (NG) |
midi_Close
MIDIデバイスをクローズします。
開いたものは閉じましょう。 |
(無し) | (無し) |
midi_Note int, int, int
音を出す/止める
|
int |
0〜15 (チャネル番号)
9はドラム・パーカッション(打楽器)となる
|
int |
0〜127 (音階)
中央のドが60
|
|
int |
0〜127 (音の強さ、大きさ)
この値を0にすると音を止めることができる
|
|
midi_InstChange int, int
音色を変更する
|
int | 0〜15 (チャネル番号) |
int | 0〜127 (音色) |
/*================================================================= MIDIを扱うためのモジュール for HSP 3.0a 2006.11.22 ------------------------------------------------------------------- MIDIデバイスを開く midi_Open stat == 0 : 失敗 MIDIデバイスを閉じる midi_Close 音を出す midi_Note チャンネル番号 0〜15 但し 9 は ドラム 音階 0〜127 中央のドを 60 強さ 0〜127 0で音を止める 音色を変える midi_InstChange チャンネル 0〜15 音色 0〜127 =================================================================*/ #module MidiControl #uselib "winmm.dll" #cfunc midichk "midiOutGetNumDevs" #func midiOpen "midiOutOpen" var , int , nullptr , nullptr , nullptr #func midiMsg "midiOutShortMsg" int , int #func midiReset "midiOutReset" int #func midiClose "midiOutClose" int #deffunc midi_Open // midiデバイスの数を検出 if opened == 1 : return 1 // 開いている if midichk() == 0 : return 0 //MIDIデバイスが検出されない midiOpen hmo , -1 //MIDIデバイスオープン失敗しなさった。 if stat != 0 : return 0 opened = 1 // デバイスオープン完了 return 1 #deffunc midi_Close if opened == 0 : return // 開いてない midiReset hmo : if stat : dialog "midiReset Erorr" midiClose hmo : if stat : dialog "midiClose Erorr" opened = 0// とじました return #deffunc midi_InstChange int c , int i midiMsg hmo , $C0 | c | i << 8 return #deffunc midi_Note int c , int h , int v midiMsg hmo , $90 | c | h << 8 | v << 16 return ; http://www.tvg.ne.jp/menyukko/ ; Copyright(C) 2006-2012 衣日和 All rights reserved. #global