OSDN Git Service

DTXManiaソリューション、DTXManiaプロジェクト、DTXCreatorプロジェクト、FDKプロジェクトについて英語化。
[dtxmania/dtxmania.git] / DTXCreator / コード / 07.MIDIインポート / CMIDIイベント.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6 using System.Windows.Forms;
7 using System.Diagnostics;
8
9 namespace DTXCreator.MIDIインポート
10 {
11         /// <summary>
12         /// MIDIイベントのbaseクラス
13         /// 手抜きのため、オリジナルのCMIDIチップクラスをほぼそのまま流用。
14         /// </summary>
15         abstract class CMIDIイベント
16     {
17                 public enum Eイベントタイプ : int
18                 {
19                         NoteOnOff,
20                         BPM,
21                         BarLen,
22                         Unknown
23                 }
24
25                 public Eイベントタイプ eイベントタイプ;
26                 public int nレーン番号;
27         public UInt32 n時間;
28         public int nWAV;
29         public int nキー;
30         public bool b入力;
31         public bool b裏チャンネル;
32         public string strコメント;
33                 public int nベロシティ;
34                 public int nベロシティ_DTX変換後;
35                 public int nチャンネル0to15;
36                 public int n拍子分子;
37                 public int n拍子分母;
38
39                 public string strWAV重複チェック
40                 {
41                         get
42                         {
43                                 return "" + nキー.ToString() + " : " + nベロシティ_DTX変換後.ToString();
44                         }
45                 }
46
47
48                 public CMIDIイベント()
49                 {
50                         this.eイベントタイプ = Eイベントタイプ.Unknown;
51                 }
52
53                 abstract public void 挿入( Cメインフォーム mf, int n四分音符の分解能 );
54     }
55
56
57         /// <summary>
58         /// NoteOn/OffのMIDIイベント
59         /// </summary>
60         class CMIDINote: CMIDIイベント
61         {
62                 public CMIDINote( UInt32 _n時間, int _nキー, int _nベロシティ, int _nチャンネル0to15 )
63         {
64             this.nレーン番号 = 2;
65             this.n時間 = _n時間;
66             this.nWAV = 1;
67             this.nキー = _nキー;
68             this.b裏チャンネル = false;
69                         
70             this.nベロシティ = _nベロシティ;
71             this.nベロシティ_DTX変換後 = _nベロシティ;
72
73                         this.nチャンネル0to15 = _nチャンネル0to15;
74
75                         this.eイベントタイプ = Eイベントタイプ.NoteOnOff;
76                 }
77
78                 public override void 挿入( Cメインフォーム mf, int n四分音符の分解能 )
79                 {
80                         mf.mgr譜面管理者.tチップを配置または置換する
81                                 ( nレーン番号, (int) n時間 * ( 192 / 4 ) / n四分音符の分解能, nWAV, 0f, b裏チャンネル );
82                 }
83         }
84
85         /// <summary>
86         /// テンポ変更のメタイベント
87         /// </summary>
88         class CMIDIBPM : CMIDIイベント
89         {
90                 float fBPM;
91                 public CMIDIBPM( UInt32 _n時間, float _fBPM )
92                 {
93                         this.nレーン番号 = 2;
94                         this.n時間 = _n時間;
95                         this.nWAV = 1;
96                         this.fBPM = _fBPM;
97
98                         this.eイベントタイプ = Eイベントタイプ.BPM;
99                 }
100
101                 public override void 挿入( Cメインフォーム mf, int n四分音符の分解能 )
102                 {
103                         int nGrid = (int) n時間 * ( 192 / 4 ) / n四分音符の分解能;
104                         mf.mgr編集モード管理者.tBPMチップを配置する( nGrid, fBPM );
105                 }
106         }
107
108
109         /// <summary>
110         /// 拍子変更のメタイベント
111         /// </summary>
112         class CMIDIBARLen : CMIDIイベント
113         {
114                 public CMIDIBARLen( UInt32 _n時間, int _分子, int _分母 )
115                 {
116                         this.n時間 = _n時間;
117                         this.n拍子分子 = _分子;
118                         this.n拍子分母 = _分母;
119                         this.eイベントタイプ = Eイベントタイプ.BarLen;
120                 }
121                 public override void 挿入( Cメインフォーム mf, int n四分音符の分解能 )
122                 {
123                         //      事前の小節構築過程で拍子変更処理は完了しているため、ここでは何もしない
124                 }
125         }
126 }