OSDN Git Service

#34016 LP使用譜面の読み込み機能を追加。
authoryyagi <yyagi@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Mon, 8 Aug 2016 15:22:30 +0000 (15:22 +0000)
committeryyagi <yyagi@16f42ceb-6dc6-49c8-ba94-f2d53467949d>
Mon, 8 Aug 2016 15:22:30 +0000 (15:22 +0000)
git-svn-id: http://svn.osdn.jp/svnroot/dtxmania/trunk@1028 16f42ceb-6dc6-49c8-ba94-f2d53467949d

DTXManiaプロジェクト/コード/スコア、曲/CChip.cs
DTXManiaプロジェクト/コード/スコア、曲/CDTXInput.cs
DTXManiaプロジェクト/コード/ステージ/06.曲読み込み/CStage曲読み込み.cs
DTXManiaプロジェクト/コード/ステージ/CStage.cs
DTXManiaプロジェクト/コード/全体/C定数.cs
実行時フォルダ/DTXManiaGR.exe

index b48f7a4..4214cb7 100644 (file)
@@ -22,7 +22,7 @@ namespace DTXMania
                public EAVIType eAVI種別 { get; private set; }\r
                public EBGAType eBGA種別 { get; private set; }\r
                public EPart e楽器パート { get; private set; }\r
-               public EChannel eチャンネル番号 { get; private set; }\r
+               public EChannel eチャンネル番号 { get; set; }\r
 \r
                /// <summary>\r
                /// バーからの距離(スクロールスピードを反映したチップの発声時刻)\r
@@ -1265,6 +1265,32 @@ namespace DTXMania
                        return (int)(nDuration / _db再生速度);\r
                }\r
 \r
+               public string GetSoundFilename()\r
+               {\r
+                       if ( this.bWAVを使うチャンネルである )   // WAV\r
+                       {\r
+                               CDTX.CWAV wc;\r
+                               CDTXMania.Instance.DTX.listWAV.TryGetValue( this.n整数値_内部番号, out wc );\r
+                               if ( wc == null )\r
+                               {\r
+                                       return null;\r
+                               }\r
+                               else if ( wc.rSound[ 0 ] == null )\r
+                               {\r
+                                       return null;\r
+                               }\r
+                               else\r
+                               {\r
+                                       return wc.rSound[ 0 ].strファイル名;\r
+                               }\r
+                       }\r
+                       //else if ( this.eチャンネル番号 == EChannel.Movie || this.eチャンネル番号 == EChannel.MovieFull )  // AVI\r
+                       //{\r
+                       //}\r
+\r
+                       return null;\r
+               }\r
+\r
                #region [ IComparable 実装 ]\r
                //-----------------\r
                public int CompareTo(CChip other)\r
index 94e0d9b..848aab6 100644 (file)
@@ -277,7 +277,7 @@ namespace DTXMania
                                                //span = (TimeSpan) ( DateTime.Now - timeBeginLoad );\r
                                                //Trace.TraceInformation( "空打確認時間:             {0}", span.ToString() );\r
                                                //timeBeginLoad = DateTime.Now;\r
-                                               #region [ 拍子・拍線の挿入 ]\r
+                                               #region [ 拍子・拍線の挿入と、クリック音の挿入 ]\r
                                                if (this.listChip.Count > 0)\r
                                                {\r
                                                        this.listChip.Sort();   // 高速化のためにはこれを削りたいが、listChipの最後がn発声位置の終端である必要があるので、\r
@@ -515,7 +515,7 @@ namespace DTXMania
                                                        this.strハッシュofDTXファイル = "00000000000000000000000000000000";\r
                                                }\r
                                                #endregion\r
-                                               \r
+\r
                                                // #36177 使用レーン数の表示 add ikanick 16.03.20\r
                                                #region [ 使用レーン数カウント ]\r
 \r
@@ -559,7 +559,9 @@ namespace DTXMania
                                                                if ( this.n使用レーン数.Bass == EUseLanes.Other ) this.n使用レーン数.Bass = EUseLanes.GB_3;\r
                                                        }\r
                                                }\r
-\r
+                                               Trace.TraceInformation( "LeftPedal使用=" + this.bチップがある.LeftPedal );\r
+                                               Trace.TraceInformation( "LeftBass使用 =" + this.bチップがある.LeftBassDrum );\r
+                                               Trace.TraceInformation( "Lane Type    =" + this.n使用レーン数.Drums );\r
                                                #endregion\r
 \r
                                                //span = (TimeSpan) ( DateTime.Now - timeBeginLoad );\r
@@ -612,6 +614,139 @@ namespace DTXMania
                                }\r
                        }\r
                }\r
+\r
+               /// <summary>\r
+               /// #34016 LP/LBD使用譜面の吸収\r
+               /// </summary>\r
+               public void ReassignLP()\r
+               {\r
+                       if ( this.bチップがある.LeftPedal )\r
+                       {\r
+                               if ( this.bチップがある.LeftBassDrum )\r
+                               {       // LP かつ LBDがある場合\r
+                                       // → * LBDはBDに割り当て\r
+                                       //    * LPは、HO(foot splash)に割り当て。あるいは、HO(foot splash)とHC(close)のいずれかに割り当てる。\r
+                                       //      BPMから4分音符の長さを計算し、それより長いかどうかでHO/HCの仕分けを決定。 \r
+                                       //    * チップ音にサウンドファイルが割り当てられていない場合は、HCに割り当て \r
+                                       //    * HO未使用の譜面の場合は、HCに割り当て\r
+\r
+                                       double bpm = this.BPM + this.BASEBPM;\r
+                                       double dbBarLength = 1.0;\r
+                                       double nLen4thNoteMs = (int) ( ( 60.0 / bpm / dbBarLength ) * 10 * 10 * 10 );\r
+\r
+                                       for ( int i = 0; i < this.listChip.Count; i++ )\r
+                                       {\r
+                                               // switch-caseにすると、listchip[i]の書き換えができないので、if-elseで記述\r
+                                               if ( this.listChip[ i ].eチャンネル番号 == EChannel.LeftBassDrum )\r
+                                               {\r
+                                                       this.listChip[ i ].eチャンネル番号 = EChannel.BassDrum;\r
+                                               }\r
+                                               else if ( this.listChip[ i ].eチャンネル番号 == EChannel.LeftPedal )\r
+                                               {\r
+                                                       int len = this.listChip[ i ].GetDuration();             // WAV未割当の場合は0が返る\r
+                                                                                                                                                       // HHOpen未使用の譜面であれば、無条件にHHCloseに落としこむ\r
+                                                       this.listChip[ i ].eチャンネル番号 = ( len < nLen4thNoteMs || !this.bチップがある.HHOpen ) ? EChannel.HiHatClose : EChannel.HiHatOpen;\r
+                                               }\r
+                                               else if ( this.listChip[ i ].eチャンネル番号 == EChannel.BPM )\r
+                                               {\r
+                                                       bpm = this.BPM + this.BASEBPM;\r
+                                                       nLen4thNoteMs = (int) ( ( 60.0 / bpm / dbBarLength / 2 ) * 10 * 10 * 10 );\r
+                                               }\r
+                                               else if ( this.listChip[ i ].eチャンネル番号 == EChannel.BPMEx )\r
+                                               {\r
+                                                       int n内部番号 = listChip[ i ].n整数値_内部番号;\r
+                                                       if ( listBPM.ContainsKey( n内部番号 ) )\r
+                                                       {\r
+                                                               bpm = ( ( listBPM[ n内部番号 ].n表記上の番号 == 0 ) ? 0.0 : this.BASEBPM ) + listBPM[ n内部番号 ].dbBPM値;\r
+                                                       }\r
+                                               }\r
+                                               else if ( this.listChip[ i ].eチャンネル番号 == EChannel.BarLength )\r
+                                               {\r
+                                                       dbBarLength = this.listChip[ i ].db実数値;\r
+                                               }\r
+                                       }\r
+                               }\r
+                               else\r
+                               {       // LPしかない場合\r
+                                       // → LPを、BD, HO, HCに割り当てる必要がある。\r
+                                       //    * BDへの割り当ては、BDレーンで同じ音を使っているかどうかで決定 \r
+                                       //    * HO, HCへの割り当ては、(BDの可能性を除いた後) HOにアサイン、あるいはチップの長さを見てHC/HOにアサイン\r
+                                       //    * チップ音にサウンドファイルが割り当てられていない場合は、HCに割り当て \r
+                                       //    * HO未使用の譜面の場合は、HCに割り当て\r
+\r
+                                       double bpm = this.BPM + this.BASEBPM;\r
+                                       double dbBarLength = 1.0;\r
+                                       double nLen4thNoteMs = (int) ( ( 60.0 / bpm / dbBarLength ) * 10 * 10 * 10 );\r
+\r
+                                       #region [ BassDrumのファイル名一覧を作成 ]\r
+                                       List<string> listBDFilenames = new List<string>();\r
+                                       foreach ( CChip chip in listChip )\r
+                                       {\r
+                                               if (chip.eチャンネル番号 == EChannel.BassDrum)\r
+                                               {\r
+                                                       string s = chip.GetSoundFilename();\r
+                                                       if (s != null && !listBDFilenames.Contains(s))\r
+                                                       {\r
+                                                               listBDFilenames.Add(s);\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                                       #endregion\r
+\r
+                                       for ( int i = 0; i < this.listChip.Count; i++ )\r
+                                       {\r
+                                               if ( this.listChip[ i ].eチャンネル番号 == EChannel.LeftPedal )\r
+                                               {\r
+                                                       string s = listChip[i].GetSoundFilename();\r
+                                                       if (listBDFilenames.Contains(s))\r
+                                                       {\r
+                                                               this.listChip[i].eチャンネル番号 = EChannel.BassDrum;\r
+                                                       }\r
+                                                       else\r
+                                                       {\r
+                                                               int len = this.listChip[ i ].GetDuration();             // WAV未割当の場合は0が返る\r
+                                                                                                                                                               // HHOpen未使用の譜面であれば、無条件にHHCloseに落としこむ\r
+                                                               this.listChip[ i ].eチャンネル番号 = ( len < nLen4thNoteMs || !this.bチップがある.HHOpen ) ? EChannel.HiHatClose : EChannel.HiHatOpen;\r
+                                                       }\r
+                                               }\r
+                                               else if ( this.listChip[ i ].eチャンネル番号 == EChannel.BPM )\r
+                                               {\r
+                                                       bpm = this.BPM + this.BASEBPM;\r
+                                                       nLen4thNoteMs = (int) ( ( 60.0 / bpm / dbBarLength / 2 ) * 10 * 10 * 10 );\r
+                                               }\r
+                                               else if ( this.listChip[ i ].eチャンネル番号 == EChannel.BPMEx )\r
+                                               {\r
+                                                       int n内部番号 = listChip[ i ].n整数値_内部番号;\r
+                                                       if ( listBPM.ContainsKey( n内部番号 ) )\r
+                                                       {\r
+                                                               bpm = ( ( listBPM[ n内部番号 ].n表記上の番号 == 0 ) ? 0.0 : this.BASEBPM ) + listBPM[ n内部番号 ].dbBPM値;\r
+                                                       }\r
+                                               }\r
+                                               else if ( this.listChip[ i ].eチャンネル番号 == EChannel.BarLength )\r
+                                               {\r
+                                                       dbBarLength = this.listChip[ i ].db実数値;\r
+                                               }\r
+                                       }\r
+                                       listBDFilenames.Clear();\r
+                                       listBDFilenames = null;\r
+                               }\r
+                       }\r
+                       else if ( this.bチップがある.LeftBassDrum )\r
+                       {       // LBDのみがある場合\r
+                               // → そのままBDに割り当て\r
+                               for ( int i = 0; i < this.listChip.Count; i++ )\r
+                               {\r
+                                       if ( this.listChip[ i ].eチャンネル番号 == EChannel.LeftBassDrum )\r
+                                       {\r
+                                               this.listChip[ i ].eチャンネル番号 = EChannel.BassDrum;\r
+                                       }\r
+                               }\r
+                       }\r
+                       else\r
+                       {       // LPもLBDもない場合\r
+                               // → 何もしない\r
+                       }\r
+               }\r
                private bool t入力_コマンド文字列を抜き出す(ref CharEnumerator ce, ref StringBuilder sb文字列)\r
                {\r
                        if (!this.t入力_空白をスキップする(ref ce))\r
index 9b6baa8..26d3eaa 100644 (file)
@@ -460,8 +460,6 @@ namespace DTXMania
                                                span = (TimeSpan)(DateTime.Now - timeBeginLoadBMPAVI);\r
                                                Trace.TraceInformation("BMP/AVI読込所要時間({0,4}): {1}", (CDTXMania.Instance.DTX.listBMP.Count + CDTXMania.Instance.DTX.listBMPTEX.Count + CDTXMania.Instance.DTX.listAVI.Count), span.ToString());\r
 \r
-                                               span = (TimeSpan)(DateTime.Now - timeBeginLoad);\r
-                                               Trace.TraceInformation("総読込時間:                {0}", span.ToString());\r
 \r
                                                if (bitmapFilename != null)\r
                                                {\r
@@ -479,10 +477,25 @@ namespace DTXMania
                                                        ftFilename = null;\r
                                                }\r
                                                CDTXMania.Instance.Timer.t更新();\r
-                                               base.eフェーズID = CStage.Eフェーズ.NOWLOADING_システムサウンドBGMの完了を待つ;\r
+                                               base.eフェーズID = CStage.Eフェーズ.NOWLOADING_LPを再配置する;\r
                                                return (int)E曲読込画面の戻り値.継続;\r
                                        }\r
 \r
+                               case CStage.Eフェーズ.NOWLOADING_LPを再配置する:\r
+                                       {\r
+                                               TimeSpan span;\r
+                                               DateTime timeReassignLP = DateTime.Now;\r
+                                               CDTXMania.Instance.DTX.ReassignLP();\r
+               \r
+                                               span = (TimeSpan) ( DateTime.Now - timeReassignLP );\r
+                                               Trace.TraceInformation( "LP再配置所要時間:          {0}", span.ToString() );\r
+\r
+                                               span = (TimeSpan) ( DateTime.Now - timeBeginLoad );\r
+                                               Trace.TraceInformation( "総読込時間:                {0}", span.ToString() );\r
+\r
+                                               base.eフェーズID = CStage.Eフェーズ.NOWLOADING_システムサウンドBGMの完了を待つ;\r
+                                               return (int) E曲読込画面の戻り値.継続;\r
+                                       }\r
                                case CStage.Eフェーズ.NOWLOADING_システムサウンドBGMの完了を待つ:\r
                                        {\r
                                                long nCurrentTime = CDTXMania.Instance.Timer.n現在時刻;\r
index 8b9038a..8d9aef9 100644 (file)
@@ -58,6 +58,7 @@ namespace DTXMania
                        NOWLOADING_DTXファイルを読み込む,\r
                        NOWLOADING_WAVファイルを読み込む,\r
                        NOWLOADING_BMPファイルを読み込む,\r
+                       NOWLOADING_LPを再配置する,\r
                        NOWLOADING_システムサウンドBGMの完了を待つ,\r
                        演奏_STAGE_FAILED,\r
                        演奏_STAGE_FAILED_フェードアウト,\r
index a0bdbe3..016f30c 100644 (file)
@@ -1333,7 +1333,7 @@ namespace DTXMania
                                case EChannel.HiHatOpen: return ELane.HH;\r
                                case EChannel.RideCymbal: return ELane.CY;\r
                                case EChannel.LeftCymbal: return ELane.LC;\r
-                               case EChannel.LeftPedal: return ELane.HH;               // LPは仮にHHに落とし込む 後日、CDTXInputで別Laneに割り振るようにした後、このcaseは削除する\r
+                               //case EChannel.LeftPedal: return ELane.HH;             // LPは仮にHHに落とし込む 後日、CDTXInputで別Laneに割り振るようにした後、このcaseは削除する\r
                        }\r
                        throw new IndexOutOfRangeException();\r
                }\r
index 3dc4903..ab23e43 100644 (file)
Binary files a/実行時フォルダ/DTXManiaGR.exe and b/実行時フォルダ/DTXManiaGR.exe differ