From 35a218a617418da6e3948986bdec40878f416425 Mon Sep 17 00:00:00 2001 From: yyagi Date: Thu, 24 Mar 2016 15:45:00 +0000 Subject: [PATCH] =?utf8?q?#30333=20rev951=E3=81=AE=E3=82=B3=E3=83=9F?= =?utf8?q?=E3=83=83=E3=83=88=E6=BC=8F=E3=82=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.osdn.jp/svnroot/dtxmania/branches/160321(DTXCreator%20with%20MIDI%20Import)@952 16f42ceb-6dc6-49c8-ba94-f2d53467949d --- .../07.MIDIインポート/CMIDIイベント.cs | 128 +++++++++++++++++++++ .../07.MIDIインポート/CMIDIチップ.cs | 43 ------- 2 files changed, 128 insertions(+), 43 deletions(-) create mode 100644 DTXCreatorプロジェクト/コード/07.MIDIインポート/CMIDIイベント.cs delete mode 100644 DTXCreatorプロジェクト/コード/07.MIDIインポート/CMIDIチップ.cs diff --git a/DTXCreatorプロジェクト/コード/07.MIDIインポート/CMIDIイベント.cs b/DTXCreatorプロジェクト/コード/07.MIDIインポート/CMIDIイベント.cs new file mode 100644 index 00000000..eddfc595 --- /dev/null +++ b/DTXCreatorプロジェクト/コード/07.MIDIインポート/CMIDIイベント.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Diagnostics; + +namespace DTXCreator.MIDIインポート +{ + /// + /// MIDIイベントのbaseクラス + /// 手抜きのため、オリジナルのCMIDIチップクラスをほぼそのまま流用。 + /// + abstract class CMIDIイベント + { + public enum Eイベントタイプ : int + { + NoteOnOff, + BPM, + BarLen, + Unknown + } + + public Eイベントタイプ eイベントタイプ; + public int nレーン番号; + public UInt32 n時間; + public int nWAV; + public int nキー; + public bool b入力; + public string strコメント; + public int nベロシティ; + public int nベロシティ_DTX変換後; + + public string strWAV重複チェック + { + get + { + return "" + nキー.ToString() + " : " + nベロシティ_DTX変換後.ToString(); + } + } + + + public CMIDIイベント() + { + this.eイベントタイプ = Eイベントタイプ.Unknown; + } + + abstract public void 挿入( Cメインフォーム mf, int n四分音符の分解能 ); + } + + + /// + /// NoteOn/OffのMIDIイベント + /// + class CMIDINote: CMIDIイベント + { + public CMIDINote( UInt32 _n時間, int _nキー, int _nベロシティ ) + : base() + { + this.nレーン番号 = 2; + this.n時間 = _n時間; + this.nWAV = 1; + this.nキー = _nキー; + + this.nベロシティ = _nベロシティ; + this.nベロシティ_DTX変換後 = _nベロシティ; + + this.eイベントタイプ = Eイベントタイプ.NoteOnOff; + } + + public override void 挿入( Cメインフォーム mf, int n四分音符の分解能 ) + { + //Debug.WriteLine( "NoteOn: " + (n時間 * ( 192 / 4 ) / n四分音符の分解能).ToString() + "key=" + nキー.ToString("d2") ); + + mf.mgr譜面管理者.tチップを配置または置換する + ( nレーン番号, (int) n時間 * ( 192 / 4 ) / n四分音符の分解能, nWAV, 0f, false ); + + // ★★時間について、要変拍子対応 + + //Debug.WriteLine( " Done." ); + } + } + + /// + /// テンポ変更のメタイベント + /// + class CMIDIBPM : CMIDIイベント + { + float fBPM; + public CMIDIBPM( UInt32 _n時間, float _fBPM ) + : base() + { + this.nレーン番号 = 2; + this.n時間 = _n時間; + this.nWAV = 1; + this.fBPM = _fBPM; + + this.eイベントタイプ = Eイベントタイプ.BPM; + } + + public override void 挿入( Cメインフォーム mf, int n四分音符の分解能 ) + { + //Debug.Write( "BPM : " + ( n時間 * ( 192 / 4 ) / n四分音符の分解能 ).ToString() + ": " + fBPM ); + + int nGrid = (int) n時間 * ( 192 / 4 ) / n四分音符の分解能; // 全音符192tick相当で、曲先頭からのtick数(変拍子がない場合) + mf.mgr編集モード管理者.tBPMチップを配置する( nGrid, fBPM ); + + //Debug.WriteLine( " Done." ); + } + } + + + /// + /// 拍子変更のメタイベント + /// + class CMIDIBARLen : CMIDIイベント + { + public CMIDIBARLen( UInt32 _n時間, int _分子, int _分母 ) + { + } + public override void 挿入( Cメインフォーム mf, int n四分音符の分解能 ) + { + // mf.mgr譜面管理者. public C小節 p譜面先頭からの位置gridを含む小節を返す( int n譜面先頭からの位置grid ) + throw new NotImplementedException(); + } + } +} diff --git a/DTXCreatorプロジェクト/コード/07.MIDIインポート/CMIDIチップ.cs b/DTXCreatorプロジェクト/コード/07.MIDIインポート/CMIDIチップ.cs deleted file mode 100644 index 7db91b7f..00000000 --- a/DTXCreatorプロジェクト/コード/07.MIDIインポート/CMIDIチップ.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace DTXCreator.MIDIインポート -{ - class CMIDIチップ - { - public int nレーン番号; - public int n時間; - public int nWAV; - public int nキー; - public int nベロシティ; - public int nベロシティ_DTX変換後; - public bool b入力; - public string strコメント; - public CMIDI cMIDI; - - public string strWAV重複チェック - { - get - { - return "" + nキー.ToString() + " : " + nベロシティ_DTX変換後.ToString(); - } - } - - public CMIDIチップ( CMIDI _cMIDI, int _n時間, int _nキー, int _nベロシティ ) - { - this.nレーン番号 = 2; - this.n時間 = _n時間; - this.nWAV = 1; - this.nキー = _nキー; - this.cMIDI = _cMIDI; - - this.nベロシティ = _nベロシティ; - this.nベロシティ_DTX変換後 = _nベロシティ; - } - - } -} -- 2.11.0