OSDN Git Service

#24280 ベースの入力デバイス記録がギターのそれになる問題の修正
[dtxmania/dtxmania.git] / DTXManiaプロジェクト / コード / スコア、曲 / CDTX.cs
index a899943..c27418f 100644 (file)
@@ -6,6 +6,8 @@ using System.Drawing;
 using System.Diagnostics;\r
 using System.IO;\r
 using System.Security.Cryptography;\r
+using System.Reflection;\r
+using System.Globalization;\r
 using FDK;\r
 \r
 namespace DTXMania\r
@@ -391,11 +393,11 @@ namespace DTXMania
                        {\r
                                get\r
                                {\r
-                                       if( this.nチャンネル番号 != 3 )\r
-                                       {\r
-                                               return ( this.nチャンネル番号 == 8 );\r
+                                       if (this.nチャンネル番号 == 3 || this.nチャンネル番号 == 8) {\r
+                                               return true;\r
+                                       } else {\r
+                                               return false;\r
                                        }\r
-                                       return true;\r
                                }\r
                        }\r
                        public bool bWAVを使うチャンネルである\r
@@ -404,11 +406,11 @@ namespace DTXMania
                                {\r
                                        switch( this.nチャンネル番号 )\r
                                        {\r
-                                               case 1:\r
+                                               case 0x01:\r
                                                case 0x11:\r
                                                case 0x12:\r
                                                case 0x13:\r
-                                               case 20:\r
+                                               case 0x14:\r
                                                case 0x15:\r
                                                case 0x16:\r
                                                case 0x17:\r
@@ -426,7 +428,7 @@ namespace DTXMania
                                                case 0x27:\r
                                                case 0x2f:\r
                                                case 0x31:\r
-                                               case 50:\r
+                                               case 0x32:\r
                                                case 0x33:\r
                                                case 0x34:\r
                                                case 0x35:\r
@@ -438,7 +440,7 @@ namespace DTXMania
                                                case 0x61:\r
                                                case 0x62:\r
                                                case 0x63:\r
-                                               case 100:\r
+                                               case 0x64:\r
                                                case 0x65:\r
                                                case 0x66:\r
                                                case 0x67:\r
@@ -452,11 +454,11 @@ namespace DTXMania
                                                case 0x75:\r
                                                case 0x76:\r
                                                case 0x77:\r
-                                               case 120:\r
+                                               case 0x78:\r
                                                case 0x79:\r
                                                case 0x80:\r
                                                case 0x81:\r
-                                               case 130:\r
+                                               case 0x82:\r
                                                case 0x83:\r
                                                case 0x84:\r
                                                case 0x85:\r
@@ -467,7 +469,7 @@ namespace DTXMania
                                                case 0x90:\r
                                                case 0x91:\r
                                                case 0x92:\r
-                                               case 160:\r
+                                               case 0xa0:\r
                                                case 0xa1:\r
                                                case 0xa2:\r
                                                case 0xa3:\r
@@ -479,7 +481,7 @@ namespace DTXMania
                                                case 0xb1:\r
                                                case 0xb2:\r
                                                case 0xb3:\r
-                                               case 180:\r
+                                               case 0xb4:\r
                                                case 0xb5:\r
                                                case 0xb6:\r
                                                case 0xb7:\r
@@ -981,7 +983,7 @@ namespace DTXMania
                                                str = "??";\r
                                                break;\r
                                }\r
-                               return string.Format( "CChip: 位置:{0:D4}.{1:D3}, 時刻{2:D6}, Ch:{3:X2}({4}), Pn:{5}({11})(内部{6}), Pd:{7}, Sz:{8}, UseWav:{9}, Auto:{10}", new object[] { this.n発声位置 / 0x180, this.n発声位置 % 0x180, this.n発声時刻ms, this.nチャンネル番号, str, this.n整数値, this.n整数値・内部番号, this.db実数値, this.dbチップサイズ倍率, this.bWAVを使うチャンネルである, this.b自動再生音チャンネルである, CDTX.tZZ( this.n整数値 ) } );\r
+                               return string.Format( "CChip: 位置:{0:D4}.{1:D3}, 時刻{2:D6}, Ch:{3:X2}({4}), Pn:{5}({11})(内部{6}), Pd:{7}, Sz:{8}, UseWav:{9}, Auto:{10}", new object[] { this.n発声位置 / 384, this.n発声位置 % 384, this.n発声時刻ms, this.nチャンネル番号, str, this.n整数値, this.n整数値・内部番号, this.db実数値, this.dbチップサイズ倍率, this.bWAVを使うチャンネルである, this.b自動再生音チャンネルである, CDTX.tZZ( this.n整数値 ) } );\r
                        }\r
 \r
                        #region [ IComparable 実装 ]\r
@@ -1229,7 +1231,7 @@ namespace DTXMania
                        {\r
                                get\r
                                {\r
-                                       return ( ( ( ( ( ( ( ( ( this.HH + this.SD ) + this.BD ) + this.HT ) + this.LT ) + this.CY ) + this.FT ) + this.HHO ) + this.RD ) + this.LC );\r
+                                       return this.HH + this.SD + this.BD + this.HT + this.LT + this.CY + this.FT + this.HHO + this.RD + this.LC;\r
                                }\r
                        }\r
                }\r
@@ -1429,7 +1431,7 @@ namespace DTXMania
                public int MIDIレベル;\r
                public STLANEINT n可視チップ数;\r
                public const int n最大音数 = 4;\r
-               public const int n小節の解像度 = 0x180;\r
+               public const int n小節の解像度 = 384;\r
                public string PANEL;\r
                public string PATH_WAV;\r
                public string PREIMAGE;\r
@@ -1448,8 +1450,11 @@ namespace DTXMania
                public string strファイル名の絶対パス;\r
                public string strフォルダ名;\r
                public string TITLE;\r
-\r
-\r
+#if TEST_NOTEOFFMODE\r
+               public bool bHH演奏で直前のHHを消音する;\r
+               public bool bGUITAR演奏で直前のGUITARを消音する;\r
+               public bool bBASS演奏で直前のBASSを消音する;\r
+#endif\r
                // コンストラクタ\r
 \r
                public CDTX()\r
@@ -1478,6 +1483,14 @@ namespace DTXMania
                        stdgbvalue.Guitar = 0;\r
                        stdgbvalue.Bass = 0;\r
                        this.LEVEL = stdgbvalue;\r
+\r
+#if true       // 2010.12.31 yyagi #RESULTxxxのリファクタ後。ここはnew()して参照渡ししなくてもいいよね?\r
+                       for (int i = 0; i < 7; i++) {\r
+                               this.RESULTIMAGE[i] = "";\r
+                               this.RESULTMOVIE[i] = "";\r
+                               this.RESULTSOUND[i] = "";\r
+                       }\r
+#else          // #RESULTxxxのリファクタ前\r
                        STRESULT stresult4 = new STRESULT();\r
                        STRESULT stresult = stresult4;\r
                        stresult.SS = "";\r
@@ -1507,6 +1520,7 @@ namespace DTXMania
                        stresult3.D = "";\r
                        stresult3.E = "";\r
                        this.RESULTSOUND = stresult3;\r
+#endif\r
                        this.db再生速度 = 1.0;\r
                        this.strハッシュofDTXファイル = "";\r
                        STチップがある stチップがある = new STチップがある();\r
@@ -1522,15 +1536,41 @@ namespace DTXMania
                        this.strファイル名 = "";\r
                        this.strフォルダ名 = "";\r
                        this.strファイル名の絶対パス = "";\r
-                       this.n無限管理WAV = new int[ 0x510 ];\r
-                       this.n無限管理BPM = new int[ 0x510 ];\r
-                       this.n無限管理VOL = new int[ 0x510 ];\r
-                       this.n無限管理PAN = new int[ 0x510 ];\r
-                       this.n無限管理SIZE = new int[ 0x510 ];\r
+                       this.n無限管理WAV = new int[ 36 * 36 ];\r
+                       this.n無限管理BPM = new int[ 36 * 36 ];\r
+                       this.n無限管理VOL = new int[ 36 * 36 ];\r
+                       this.n無限管理PAN = new int[ 36 * 36 ];\r
+                       this.n無限管理SIZE = new int[ 36 * 36 ];\r
                        this.nRESULTIMAGE用優先順位 = new int[ 7 ];\r
                        this.nRESULTMOVIE用優先順位 = new int[ 7 ];\r
                        this.nRESULTSOUND用優先順位 = new int[ 7 ];\r
-                       STGDAPARAM[] stgdaparamArray = new STGDAPARAM[ 0x3d ];\r
+\r
+#if true       // 2011.1.1 yyagi GDA->DTX変換テーブル リファクタ後\r
+                       STGDAPARAM[] stgdaparamArray = new STGDAPARAM[] {               // GDA->DTX conversion table\r
+                               new STGDAPARAM("TC", 0x03),     new STGDAPARAM("BL", 0x02),     new STGDAPARAM("GS", 0x29),\r
+                               new STGDAPARAM("DS", 0x30),     new STGDAPARAM("FI", 0x53),     new STGDAPARAM("HH", 0x11),\r
+                               new STGDAPARAM("SD", 0x12),     new STGDAPARAM("BD", 0x13),     new STGDAPARAM("HT", 0x14),\r
+                               new STGDAPARAM("LT", 0x15),     new STGDAPARAM("CY", 0x16),     new STGDAPARAM("G1", 0x21),\r
+                               new STGDAPARAM("G2", 0x22),     new STGDAPARAM("G3", 0x23),     new STGDAPARAM("G4", 0x24),\r
+                               new STGDAPARAM("G5", 0x25),     new STGDAPARAM("G6", 0x26),     new STGDAPARAM("G7", 0x27),\r
+                               new STGDAPARAM("GW", 0x28),     new STGDAPARAM("01", 0x61),     new STGDAPARAM("02", 0x62),\r
+                               new STGDAPARAM("03", 0x63),     new STGDAPARAM("04", 0x64),     new STGDAPARAM("05", 0x65),\r
+                               new STGDAPARAM("06", 0x66),     new STGDAPARAM("07", 0x67),     new STGDAPARAM("08", 0x68),\r
+                               new STGDAPARAM("09", 0x69),     new STGDAPARAM("0A", 0x70),     new STGDAPARAM("0B", 0x71),\r
+                               new STGDAPARAM("0C", 0x72),     new STGDAPARAM("0D", 0x73),     new STGDAPARAM("0E", 0x74),\r
+                               new STGDAPARAM("0F", 0x75),     new STGDAPARAM("10", 0x76),     new STGDAPARAM("11", 0x77),\r
+                               new STGDAPARAM("12", 0x78),     new STGDAPARAM("13", 0x79),     new STGDAPARAM("14", 0x80),\r
+                               new STGDAPARAM("15", 0x81),     new STGDAPARAM("16", 0x82),     new STGDAPARAM("17", 0x83),\r
+                               new STGDAPARAM("18", 0x84),     new STGDAPARAM("19", 0x85),     new STGDAPARAM("1A", 0x86),\r
+                               new STGDAPARAM("1B", 0x87),     new STGDAPARAM("1C", 0x88),     new STGDAPARAM("1D", 0x89),\r
+                               new STGDAPARAM("1E", 0x90),     new STGDAPARAM("1F", 0x91),     new STGDAPARAM("20", 0x92),\r
+                               new STGDAPARAM("B1", 0xA1),     new STGDAPARAM("B2", 0xA2),     new STGDAPARAM("B3", 0xA3),\r
+                               new STGDAPARAM("B4", 0xA4),     new STGDAPARAM("B5", 0xA5),     new STGDAPARAM("B6", 0xA6),\r
+                               new STGDAPARAM("B7", 0xA7),     new STGDAPARAM("BW", 0xA8),     new STGDAPARAM("G0", 0x20),\r
+                               new STGDAPARAM("B0", 0xA0)\r
+                       };\r
+#else  // 2011.1.1 yyagi GDA->DTX変換テーブル リファクタ前\r
+                       STGDAPARAM[] stgdaparamArray = new STGDAPARAM[62];\r
                        STGDAPARAM stgdaparam62 = new STGDAPARAM();\r
                        STGDAPARAM stgdaparam = stgdaparam62;\r
                        stgdaparam.s = "TC";\r
@@ -1835,8 +1875,16 @@ namespace DTXMania
                        stgdaparam61.s = "B0";\r
                        stgdaparam61.c = 160;\r
                        stgdaparamArray[ 60 ] = stgdaparam61;\r
+#endif\r
                        this.stGDAParam = stgdaparamArray;\r
                        this.nBGMAdjust = 0;\r
+\r
+#if TEST_NOTEOFFMODE\r
+                       this.bHH演奏で直前のHHを消音する = true;\r
+                       this.bGUITAR演奏で直前のGUITARを消音する = true;\r
+                       this.bBASS演奏で直前のBASSを消音する = true;\r
+#endif\r
+       \r
                }\r
                public CDTX( string str全入力文字列 )\r
                        : this()\r
@@ -2044,13 +2092,13 @@ namespace DTXMania
                {\r
                        for( int i = 0; i < 4; i++ )\r
                        {\r
-                               if( ( ( wc.rSound[ i ] != null ) && wc.rSound[ i ].b再生中 ) && ( wc.rSound[ i ].n総演奏時間ms >= 0x1388 ) )\r
+                               if( ( ( wc.rSound[ i ] != null ) && wc.rSound[ i ].b再生中 ) && ( wc.rSound[ i ].n総演奏時間ms >= 5000 ) )\r
                                {\r
-                                       long num2 = CDTXMania.Timer.nシステム時刻;\r
-                                       if( num2 > wc.n再生開始時刻[ i ] )\r
+                                       long nCurrentTime = CDTXMania.Timer.nシステム時刻;\r
+                                       if( nCurrentTime > wc.n再生開始時刻[ i ] )\r
                                        {\r
-                                               long num3 = num2 - wc.n再生開始時刻[ i ];\r
-                                               wc.rSound[ i ].t再生位置を変更する( wc.rSound[ i ].t時刻から位置を返す( num3 ) );\r
+                                               long nAbsTimeFromStartPlaying = nCurrentTime - wc.n再生開始時刻[ i ];\r
+                                               wc.rSound[ i ].t再生位置を変更する( wc.rSound[ i ].t時刻から位置を返す( nAbsTimeFromStartPlaying ) );\r
                                        }\r
                                }\r
                        }\r
@@ -2071,9 +2119,16 @@ namespace DTXMania
                }\r
                public void tWAVの読み込み()\r
                {\r
-                       foreach( CWAV cwav in this.listWAV.Values )\r
+//                     Trace.TraceInformation("WAV files={0}", this.listWAV.Count);\r
+//                     int count = 0;\r
+                       foreach (CWAV cwav in this.listWAV.Values)\r
                        {\r
-                               string str = string.IsNullOrEmpty( this.PATH_WAV ) ? this.strフォルダ名 : this.PATH_WAV;\r
+//                             string strCount = count.ToString() + " / " + this.listWAV.Count.ToString();\r
+//                             Debug.WriteLine(strCount);\r
+//                             CDTXMania.act文字コンソール.tPrint(0, 0, C文字コンソール.Eフォント種別.白, strCount);\r
+//                             count++;\r
+\r
+                               string str = string.IsNullOrEmpty(this.PATH_WAV) ? this.strフォルダ名 : this.PATH_WAV;\r
                                str = str + cwav.strファイル名;\r
                                try\r
                                {\r
@@ -2081,7 +2136,7 @@ namespace DTXMania
                                        {\r
                                                try\r
                                                {\r
-                                                       cwav.rSound[ i ] = CDTXMania.Sound管理.tサウンドを生成する( str );\r
+                                                       cwav.rSound[i] = CDTXMania.Sound管理.tサウンドを生成する(str);\r
                                                        cwav.rSound[ i ].n音量 = 100;\r
                                                        if( ( i == 0 ) && CDTXMania.ConfigIni.bLog作成解放ログ出力 )\r
                                                        {\r
@@ -2100,6 +2155,30 @@ namespace DTXMania
                                                {\r
                                                        break;\r
                                                }\r
+//                                             Type t = typeof(CSound);\r
+//                                             MethodInfo[] methods = t.GetMethods(\r
+//                                                     BindingFlags.Public | BindingFlags.NonPublic |\r
+//                                                     BindingFlags.Instance | BindingFlags.Static\r
+//                                             );\r
+\r
+//                                             for (int j = 1; j < 3; j++)\r
+//                                             {\r
+//                                                     SlimDX.DirectSound.SoundBuffer result;\r
+//                                                     CDTXMania.Sound管理.Device.DuplicateSoundBuffer(\r
+//                                                             cwav.rSound[0].Buffer,\r
+//                                                             out result);\r
+//                                                     cwav.rSound[j].Buffer = (SlimDX.DirectSound.SecondarySoundBuffer)result;\r
+//                                                     cwav.rSound[j].bストリーム再生する = cwav.rSound[0].bストリーム再生する;\r
+//                                                     cwav.rSound[j].bループする\r
+//                                                     foreach(MethodInfo m in methods) {\r
+//                                                             if (m cwav..rSound[j].\r
+//                                             }\r
+//                                             cwav.rSound[0].Buffer.\r
+\r
+                                               cwav.rSound[1] = cwav.rSound[0];                // #24007 2010.11.23 yyagi add: to accelerate loading chip sounds\r
+                                               cwav.rSound[2] = cwav.rSound[0];                //\r
+                                               cwav.rSound[3] = cwav.rSound[0];                //\r
+                                               break;                                                                  //\r
                                        }\r
                                        continue;\r
                                }\r
@@ -2116,12 +2195,12 @@ namespace DTXMania
                }\r
                public static string tZZ( int n )\r
                {\r
-                       if( ( n < 0 ) || ( n >= 0x510 ) )\r
+                       if( ( n < 0 ) || ( n >= 36 * 36) )\r
                        {\r
                                return "!!";\r
                        }\r
                        string str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";\r
-                       return new string( new char[] { str[ n / 0x24 ], str[ n % 0x24 ] } );\r
+                       return new string( new char[] { str[ n / 36 ], str[ n % 36 ] } );\r
                }\r
 \r
                /// <summary>\r
@@ -2193,7 +2272,7 @@ namespace DTXMania
                                                case (int)Eレーンビットパターン.RxB:  // RxB\r
                                                case (int)Eレーンビットパターン.RGx:  // RGx\r
                                                        n新RGBレーンビットパターン = flag ? CDTXMania.Random.Next( 8 ) : ( CDTXMania.Random.Next( 7 ) + 1 ); // OPENあり譜面ならOPENを含むランダム, OPENなし譜面ならOPENを含まないランダム\r
-                                                       goto Label_02B2;\r
+                                                       break;  // goto Label_02B2;\r
 \r
                                                default:\r
                                                        if( nRGBレーンビットパターン == (int)Eレーンビットパターン.RGB )    // RGB レーン3本相当\r
@@ -2215,11 +2294,11 @@ namespace DTXMania
                                                                                {\r
                                                                                        case 0:\r
                                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.xGB;\r
-                                                                                               goto Label_02B2;\r
+                                                                                               break;  // goto Label_02B2;\r
 \r
                                                                                        case 1:\r
                                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.RxB;\r
-                                                                                               goto Label_02B2;\r
+                                                                                               break;  // goto Label_02B2;\r
                                                                                }\r
                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.RGx;\r
                                                                        }\r
@@ -2229,11 +2308,11 @@ namespace DTXMania
                                                                                {\r
                                                                                        case 0:\r
                                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.xxB;\r
-                                                                                               goto Label_02B2;\r
+                                                                                               break;  // goto Label_02B2;\r
 \r
                                                                                        case 1:\r
                                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.xGx;\r
-                                                                                               goto Label_02B2;\r
+                                                                                               break;  // goto Label_02B2;\r
                                                                                }\r
                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.Rxx;\r
                                                                        }\r
@@ -2251,11 +2330,11 @@ namespace DTXMania
                                                                                {\r
                                                                                        case 0:\r
                                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.xGB;\r
-                                                                                               goto Label_02B2;\r
+                                                                                               break;  // goto Label_02B2;\r
 \r
                                                                                        case 1:\r
                                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.RxB;\r
-                                                                                               goto Label_02B2;\r
+                                                                                               break;  // goto Label_02B2;\r
                                                                                }\r
                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.RGx;\r
                                                                        }\r
@@ -2265,17 +2344,17 @@ namespace DTXMania
                                                                                {\r
                                                                                        case 0:\r
                                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.xxB;\r
-                                                                                               goto Label_02B2;\r
+                                                                                               break;  // goto Label_02B2;\r
 \r
                                                                                        case 1:\r
                                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.xGx;\r
-                                                                                               goto Label_02B2;\r
+                                                                                               break;  // goto Label_02B2;\r
                                                                                }\r
                                                                                n新RGBレーンビットパターン = (int)Eレーンビットパターン.Rxx;\r
                                                                        }\r
                                                                }\r
                                                        }\r
-                                                       goto Label_02B2;\r
+                                                       break;  // goto Label_02B2;\r
                                        }\r
                                Label_02B2:\r
                                        chip.nチャンネル番号 = ( nランダム化前チャンネル番号 & 0xF0 ) | n新RGBレーンビットパターン;\r
@@ -2338,11 +2417,17 @@ namespace DTXMania
                        this.nBGMAdjust += nBGMAdjustの増減値;\r
                        for( int i = 0; i < this.listChip.Count; i++ )\r
                        {\r
-                               int num2 = this.listChip[ i ].nチャンネル番号;\r
-                               if( ( ( ( num2 == 1 ) || ( ( 0x61 <= num2 ) && ( num2 <= 0x69 ) ) ) || ( ( 0x70 <= num2 ) && ( num2 <= 0x79 ) ) ) || ( ( ( 0x80 <= num2 ) && ( num2 <= 0x89 ) ) || ( ( 0x90 <= num2 ) && ( num2 <= 0x92 ) ) ) )\r
+                               int nChannelNumber = this.listChip[ i ].nチャンネル番号;\r
+                               if( ( (\r
+                                               ( nChannelNumber == 1 ) ||\r
+                                               ( ( 0x61 <= nChannelNumber ) && ( nChannelNumber <= 0x69 ) )\r
+                                         ) ||\r
+                                               ( ( 0x70 <= nChannelNumber ) && ( nChannelNumber <= 0x79 ) )\r
+                                       ) ||\r
+                                       ( ( ( 0x80 <= nChannelNumber ) && ( nChannelNumber <= 0x89 ) ) || ( ( 0x90 <= nChannelNumber ) && ( nChannelNumber <= 0x92 ) ) )\r
+                                 )\r
                                {\r
-                                       CChip local1 = this.listChip[ i ];\r
-                                       local1.n発声時刻ms += nBGMAdjustの増減値;\r
+                                       this.listChip[ i ].n発声時刻ms += nBGMAdjustの増減値;\r
                                }\r
                        }\r
                        foreach( CWAV cwav in this.listWAV.Values )\r
@@ -2458,7 +2543,7 @@ namespace DTXMania
                                str全入力文字列 = str全入力文字列.Replace( Environment.NewLine, "\n" );\r
                                str全入力文字列 = str全入力文字列.Replace( '\t', ' ' );\r
                                str全入力文字列 = str全入力文字列 + "\n";\r
-                               for( int j = 0; j < 0x510; j++ )\r
+                               for( int j = 0; j < 36 * 36; j++ )\r
                                {\r
                                        this.n無限管理WAV[ j ] = -j;\r
                                        this.n無限管理BPM[ j ] = -j;\r
@@ -2606,8 +2691,8 @@ namespace DTXMania
                                                {\r
                                                        this.listChip.Sort();\r
                                                        double num4 = 1.0;\r
-                                                       int num5 = ( this.listChip[ this.listChip.Count - 1 ].n発声位置 + 0x180 ) - ( this.listChip[ this.listChip.Count - 1 ].n発声位置 % 0x180 );\r
-                                                       for( int num6 = 0; num6 <= num5; num6 += 0x180 )\r
+                                                       int num5 = ( this.listChip[ this.listChip.Count - 1 ].n発声位置 + 384 ) - ( this.listChip[ this.listChip.Count - 1 ].n発声位置 % 384 );\r
+                                                       for( int num6 = 0; num6 <= num5; num6 += 384 )\r
                                                        {\r
                                                                CChip chip8 = new CChip();\r
                                                                chip8.n発声位置 = num6;\r
@@ -2618,10 +2703,10 @@ namespace DTXMania
                                                        this.listChip.Sort();\r
                                                        int num7 = 0;\r
                                                        int num8 = 0;\r
-                                                       for( int num9 = 0; num9 < num5; num9 += 0x180 )\r
+                                                       for( int num9 = 0; num9 < num5; num9 += 384 )\r
                                                        {\r
                                                                int num10 = 0;\r
-                                                               while( ( num8 < this.listChip.Count ) && ( this.listChip[ num8 ].n発声位置 < ( num9 + 0x180 ) ) )\r
+                                                               while( ( num8 < this.listChip.Count ) && ( this.listChip[ num8 ].n発声位置 < ( num9 + 384 ) ) )\r
                                                                {\r
                                                                        if( this.listChip[ num8 ].nチャンネル番号 == 0xc1 )\r
                                                                        {\r
@@ -2643,17 +2728,17 @@ namespace DTXMania
                                                                }\r
                                                                for( int num11 = 0; num11 < 100; num11++ )\r
                                                                {\r
-                                                                       int num12 = (int) ( ( (double) ( 0x180 * num11 ) ) / ( 4.0 * num4 ) );\r
-                                                                       if( ( num12 + num10 ) >= 0x180 )\r
+                                                                       int num12 = (int) ( ( (double) ( 384 * num11 ) ) / ( 4.0 * num4 ) );\r
+                                                                       if( ( num12 + num10 ) >= 384 )\r
                                                                        {\r
                                                                                break;\r
                                                                        }\r
-                                                                       if( ( ( num12 + num10 ) % 0x180 ) != 0 )\r
+                                                                       if( ( ( num12 + num10 ) % 384 ) != 0 )\r
                                                                        {\r
                                                                                CChip chip9 = new CChip();\r
                                                                                chip9.n発声位置 = ( num9 + num12 ) + num10;\r
                                                                                chip9.nチャンネル番号 = 0x51;\r
-                                                                               chip9.n整数値 = 0x50f;\r
+                                                                               chip9.n整数値 = 36 * 36 - 1;\r
                                                                                this.listChip.Add( chip9 );\r
                                                                        }\r
                                                                }\r
@@ -2694,40 +2779,40 @@ namespace DTXMania
                                                                this.listChip[ i ].b可視 = flag;\r
                                                        }\r
                                                }\r
-                                               double num14 = 120.0;\r
+                                               double bpm = 120.0;\r
                                                double num15 = 1.0;\r
                                                int num16 = 0;\r
                                                int num17 = 0;\r
                                                int num18 = 0;\r
                                                foreach( CChip chip10 in this.listChip )\r
                                                {\r
-                                                       chip10.n発声時刻ms = num17 + ( (int) ( ( ( 0x271 * ( chip10.n発声位置 - num16 ) ) * num15 ) / num14 ) );\r
-                                                       if( ( ( this.e種別 == E種別.BMS ) || ( this.e種別 == E種別.BME ) ) && ( ( num15 != 1.0 ) && ( ( chip10.n発声位置 / 0x180 ) != num18 ) ) )\r
+                                                       chip10.n発声時刻ms = num17 + ( (int) ( ( ( 0x271 * ( chip10.n発声位置 - num16 ) ) * num15 ) / bpm ) );\r
+                                                       if( ( ( this.e種別 == E種別.BMS ) || ( this.e種別 == E種別.BME ) ) && ( ( num15 != 1.0 ) && ( ( chip10.n発声位置 / 384) != num18 ) ) )\r
                                                        {\r
                                                                num16 = chip10.n発声位置;\r
                                                                num17 = chip10.n発声時刻ms;\r
                                                                num15 = 1.0;\r
                                                        }\r
-                                                       num18 = chip10.n発声位置 / 0x180;\r
+                                                       num18 = chip10.n発声位置 / 384;\r
                                                        num26 = chip10.nチャンネル番号;\r
                                                        switch( num26 )\r
                                                        {\r
-                                                               case 2:\r
+                                                               case 0x02:\r
                                                                        {\r
                                                                                num16 = chip10.n発声位置;\r
                                                                                num17 = chip10.n発声時刻ms;\r
                                                                                num15 = chip10.db実数値;\r
                                                                                continue;\r
                                                                        }\r
-                                                               case 3:\r
+                                                               case 0x03:\r
                                                                        {\r
                                                                                num16 = chip10.n発声位置;\r
                                                                                num17 = chip10.n発声時刻ms;\r
-                                                                               num14 = this.BASEBPM + chip10.n整数値;\r
+                                                                               bpm = this.BASEBPM + chip10.n整数値;\r
                                                                                continue;\r
                                                                        }\r
-                                                               case 4:\r
-                                                               case 7:\r
+                                                               case 0x04:\r
+                                                               case 0x07:\r
                                                                case 0x55:\r
                                                                case 0x56:\r
                                                                case 0x57:\r
@@ -2736,9 +2821,9 @@ namespace DTXMania
                                                                case 0x60:\r
                                                                        break;\r
 \r
-                                                               case 5:\r
-                                                               case 6:\r
-                                                               case 90:\r
+                                                               case 0x05:\r
+                                                               case 0x06:\r
+                                                               case 0x5A:\r
                                                                case 0x5b:\r
                                                                case 0x5c:\r
                                                                case 0x5d:\r
@@ -2753,7 +2838,7 @@ namespace DTXMania
                                                                                num17 = chip10.n発声時刻ms;\r
                                                                                if( this.listBPM.ContainsKey( chip10.n整数値・内部番号 ) )\r
                                                                                {\r
-                                                                                       num14 = ( ( this.listBPM[ chip10.n整数値・内部番号 ].n表記上の番号 == 0 ) ? 0.0 : this.BASEBPM ) + this.listBPM[ chip10.n整数値・内部番号 ].dbBPM値;\r
+                                                                                       bpm = ( ( this.listBPM[ chip10.n整数値・内部番号 ].n表記上の番号 == 0 ) ? 0.0 : this.BASEBPM ) + this.listBPM[ chip10.n整数値・内部番号 ].dbBPM値;\r
                                                                                }\r
                                                                                continue;\r
                                                                        }\r
@@ -2761,8 +2846,8 @@ namespace DTXMania
                                                                        {\r
                                                                                if( this.listAVIPAN.ContainsKey( chip10.n整数値 ) )\r
                                                                                {\r
-                                                                                       int num21 = num17 + ( (int) ( ( ( 0x271 * ( chip10.n発声位置 - num16 ) ) * num15 ) / num14 ) );\r
-                                                                                       int num22 = num17 + ( (int) ( ( ( 0x271 * ( ( chip10.n発声位置 + this.listAVIPAN[ chip10.n整数値 ].n移動時間ct ) - num16 ) ) * num15 ) / num14 ) );\r
+                                                                                       int num21 = num17 + ( (int) ( ( ( 0x271 * ( chip10.n発声位置 - num16 ) ) * num15 ) / bpm ) );\r
+                                                                                       int num22 = num17 + ( (int) ( ( ( 0x271 * ( ( chip10.n発声位置 + this.listAVIPAN[ chip10.n整数値 ].n移動時間ct ) - num16 ) ) * num15 ) / bpm ) );\r
                                                                                        chip10.n総移動時間 = num22 - num21;\r
                                                                                }\r
                                                                                continue;\r
@@ -2774,8 +2859,8 @@ namespace DTXMania
                                                        }\r
                                                        if( this.listBGAPAN.ContainsKey( chip10.n整数値 ) )\r
                                                        {\r
-                                                               int num19 = num17 + ( (int) ( ( ( 0x271 * ( chip10.n発声位置 - num16 ) ) * num15 ) / num14 ) );\r
-                                                               int num20 = num17 + ( (int) ( ( ( 0x271 * ( ( chip10.n発声位置 + this.listBGAPAN[ chip10.n整数値 ].n移動時間ct ) - num16 ) ) * num15 ) / num14 ) );\r
+                                                               int num19 = num17 + ( (int) ( ( ( 0x271 * ( chip10.n発声位置 - num16 ) ) * num15 ) / bpm ) );\r
+                                                               int num20 = num17 + ( (int) ( ( ( 0x271 * ( ( chip10.n発声位置 + this.listBGAPAN[ chip10.n整数値 ].n移動時間ct ) - num16 ) ) * num15 ) / bpm ) );\r
                                                                chip10.n総移動時間 = num20 - num19;\r
                                                        }\r
                                                }\r
@@ -2803,7 +2888,7 @@ namespace DTXMania
                                                        {\r
                                                                this.n可視チップ数.Guitar++;\r
                                                        }\r
-                                                       if( ( 160 <= num24 ) && ( num24 <= 0xa7 ) )\r
+                                                       if( ( 0xA0 <= num24 ) && ( num24 <= 0xa7 ) )\r
                                                        {\r
                                                                this.n可視チップ数.Bass++;\r
                                                        }\r
@@ -2886,6 +2971,36 @@ namespace DTXMania
                        }\r
                }\r
 \r
+               /// <summary>\r
+               /// Swap infos between Guitar and Bass\r
+               /// </summary>\r
+               public void SwapGuitarBassInfos()                                               // #24063 2011.1.24 yyagi ギターとベースの譜面情報入替\r
+               {\r
+                       for (int i = this.listChip.Count - 1; i >= 0; i--) {\r
+                               if (listChip[i].e楽器パート == E楽器パート.BASS) {\r
+                                       listChip[i].e楽器パート = E楽器パート.GUITAR;\r
+                                       listChip[i].nチャンネル番号 -= ( 0xA0 - 0x20 );\r
+                               }\r
+                               else if ( listChip[i].e楽器パート == E楽器パート.GUITAR )\r
+                               {\r
+                                       listChip[i].e楽器パート = E楽器パート.BASS;\r
+                                       listChip[i].nチャンネル番号 += ( 0xA0 - 0x20 );\r
+                               }\r
+                       }\r
+\r
+                       int t = this.LEVEL.Bass;\r
+                       this.LEVEL.Bass = this.LEVEL.Guitar;\r
+                       this.LEVEL.Guitar = t;\r
+\r
+                       t = this.n可視チップ数.Bass;\r
+                       this.n可視チップ数.Bass = this.n可視チップ数.Guitar;\r
+                       this.n可視チップ数.Guitar = t;\r
+\r
+                       bool ts = this.bチップがある.Bass;\r
+                       this.bチップがある.Bass = this.bチップがある.Guitar;\r
+                       this.bチップがある.Guitar = ts;\r
+\r
+               }\r
 \r
                // CActivity 実装\r
 \r
@@ -3006,10 +3121,15 @@ namespace DTXMania
                #region [ private ]\r
                //-----------------\r
                [StructLayout( LayoutKind.Sequential )]\r
-               private struct STGDAPARAM\r
+               private struct STGDAPARAM                               // GDAチャンネル番号に対応するDTXチャンネル番号\r
                {\r
-                       public string s;\r
-                       public int c;\r
+                       public string s;                                        // GDAチャンネル番号\r
+                       public int c;                                           // DTXチャンネル番号\r
+\r
+                       public STGDAPARAM(string _s, int _c) {          // 2011.1.1 yyagi 構造体のコンストラクタ追加(初期化簡易化のため)\r
+                               s = _s;\r
+                               c = _c;\r
+                       }\r
                }\r
 \r
                private readonly STGDAPARAM[] stGDAParam;\r
@@ -3200,169 +3320,167 @@ namespace DTXMania
                                }\r
                                else if( str.StartsWith( "DLEVEL", StringComparison.OrdinalIgnoreCase ) || str.StartsWith( "PLAYLEVEL", StringComparison.OrdinalIgnoreCase ) )\r
                                {\r
-                                       int num2;\r
+                                       int dlevel;\r
                                        this.t入力・パラメータ食い込みチェック( "DLEVEL", ref str, ref str2 );\r
                                        this.t入力・パラメータ食い込みチェック( "PLAYLEVEL", ref str, ref str2 );\r
-                                       if( int.TryParse( str2, out num2 ) )\r
+                                       if( int.TryParse( str2, out dlevel ) )\r
                                        {\r
-                                               if( num2 < 0 )\r
+                                               if( dlevel < 0 )\r
                                                {\r
-                                                       num2 = 0;\r
+                                                       dlevel = 0;\r
                                                }\r
-                                               else if( num2 > 100 )\r
+                                               else if( dlevel > 100 )\r
                                                {\r
-                                                       num2 = 100;\r
+                                                       dlevel = 100;\r
                                                }\r
-                                               this.LEVEL.Drums = num2;\r
+                                               this.LEVEL.Drums = dlevel;\r
                                        }\r
                                }\r
                                else if( str.StartsWith( "GLEVEL", StringComparison.OrdinalIgnoreCase ) )\r
                                {\r
-                                       int num3;\r
+                                       int glevel;\r
                                        this.t入力・パラメータ食い込みチェック( "GLEVEL", ref str, ref str2 );\r
-                                       if( int.TryParse( str2, out num3 ) )\r
+                                       if( int.TryParse( str2, out glevel ) )\r
                                        {\r
-                                               if( num3 < 0 )\r
+                                               if( glevel < 0 )\r
                                                {\r
-                                                       num3 = 0;\r
+                                                       glevel = 0;\r
                                                }\r
-                                               else if( num3 > 100 )\r
+                                               else if( glevel > 100 )\r
                                                {\r
-                                                       num3 = 100;\r
+                                                       glevel = 100;\r
                                                }\r
-                                               this.LEVEL.Guitar = num3;\r
+                                               this.LEVEL.Guitar = glevel;\r
                                        }\r
                                }\r
                                else if( str.StartsWith( "BLEVEL", StringComparison.OrdinalIgnoreCase ) )\r
                                {\r
-                                       int num4;\r
+                                       int blevel;\r
                                        this.t入力・パラメータ食い込みチェック( "BLEVEL", ref str, ref str2 );\r
-                                       if( int.TryParse( str2, out num4 ) )\r
+                                       if( int.TryParse( str2, out blevel ) )\r
                                        {\r
-                                               if( num4 < 0 )\r
+                                               if( blevel < 0 )\r
                                                {\r
-                                                       num4 = 0;\r
+                                                       blevel = 0;\r
                                                }\r
-                                               else if( num4 > 100 )\r
+                                               else if( blevel > 100 )\r
                                                {\r
-                                                       num4 = 100;\r
+                                                       blevel = 100;\r
                                                }\r
-                                               this.LEVEL.Bass = num4;\r
+                                               this.LEVEL.Bass = blevel;\r
                                        }\r
                                }\r
-                               else if( str.StartsWith( "GENRE", StringComparison.OrdinalIgnoreCase ) )\r
-                               {\r
-                                       this.t入力・パラメータ食い込みチェック( "GENRE", ref str, ref str2 );\r
-                                       this.GENRE = str2;\r
+#if TEST_NOTEOFFMODE\r
+                               else if (str.StartsWith("SUPRESSNOTEOFF_HIHAT", StringComparison.OrdinalIgnoreCase)) {\r
+                                       this.t入力・パラメータ食い込みチェック("SUPRESSNOTEOFF_HIHAT", ref str, ref str2);\r
+                                       this.bHH演奏で直前のHHを消音する = !str2.ToLower().Equals("on");\r
+                               } \r
+                               else if (str.StartsWith("SUPRESSNOTEOFF_GUITAR", StringComparison.OrdinalIgnoreCase)) {\r
+                                       this.t入力・パラメータ食い込みチェック("SUPRESSNOTEOFF_GUITAR", ref str, ref str2);\r
+                                       this.bGUITAR演奏で直前のGUITARを消音する = !str2.ToLower().Equals("on");\r
                                }\r
-                               else\r
-                               {\r
-                                       if( str.StartsWith( "HIDDENLEVEL", StringComparison.OrdinalIgnoreCase ) )\r
-                                       {\r
-                                               this.t入力・パラメータ食い込みチェック( "HIDDENLEVEL", ref str, ref str2 );\r
-                                               this.HIDDENLEVEL = str2.ToLower().Equals( "on" );\r
+                               else if (str.StartsWith("SUPRESSNOTEOFF_BASS", StringComparison.OrdinalIgnoreCase)) {\r
+                                       this.t入力・パラメータ食い込みチェック("SUPRESSNOTEOFF_BASS", ref str, ref str2);\r
+                                       this.bBASS演奏で直前のBASSを消音する = !str2.ToLower().Equals("on");\r
+                               }\r
+#endif\r
+                               else if (str.StartsWith("GENRE", StringComparison.OrdinalIgnoreCase)) {\r
+                                       this.t入力・パラメータ食い込みチェック("GENRE", ref str, ref str2);\r
+                                       this.GENRE = str2;\r
+                               } else {\r
+                                       if (str.StartsWith("HIDDENLEVEL", StringComparison.OrdinalIgnoreCase)) {\r
+                                               this.t入力・パラメータ食い込みチェック("HIDDENLEVEL", ref str, ref str2);\r
+                                               this.HIDDENLEVEL = str2.ToLower().Equals("on");\r
                                        }\r
-                                       if( str.StartsWith( "STAGEFILE", StringComparison.OrdinalIgnoreCase ) )\r
-                                       {\r
-                                               this.t入力・パラメータ食い込みチェック( "STAGEFILE", ref str, ref str2 );\r
+                                       if (str.StartsWith("STAGEFILE", StringComparison.OrdinalIgnoreCase)) {\r
+                                               this.t入力・パラメータ食い込みチェック("STAGEFILE", ref str, ref str2);\r
                                                this.STAGEFILE = str2;\r
-                                       }\r
-                                       else if( str.StartsWith( "PREVIEW", StringComparison.OrdinalIgnoreCase ) )\r
-                                       {\r
-                                               this.t入力・パラメータ食い込みチェック( "PREVIEW", ref str, ref str2 );\r
+                                       } else if (str.StartsWith("PREVIEW", StringComparison.OrdinalIgnoreCase)) {\r
+                                               this.t入力・パラメータ食い込みチェック("PREVIEW", ref str, ref str2);\r
                                                this.PREVIEW = str2;\r
-                                       }\r
-                                       else if( str.StartsWith( "PREIMAGE", StringComparison.OrdinalIgnoreCase ) )\r
-                                       {\r
-                                               this.t入力・パラメータ食い込みチェック( "PREIMAGE", ref str, ref str2 );\r
+                                       } else if (str.StartsWith("PREIMAGE", StringComparison.OrdinalIgnoreCase)) {\r
+                                               this.t入力・パラメータ食い込みチェック("PREIMAGE", ref str, ref str2);\r
                                                this.PREIMAGE = str2;\r
-                                       }\r
-                                       else if( str.StartsWith( "PREMOVIE", StringComparison.OrdinalIgnoreCase ) )\r
-                                       {\r
-                                               this.t入力・パラメータ食い込みチェック( "PREMOVIE", ref str, ref str2 );\r
+                                       } else if (str.StartsWith("PREMOVIE", StringComparison.OrdinalIgnoreCase)) {\r
+                                               this.t入力・パラメータ食い込みチェック("PREMOVIE", ref str, ref str2);\r
                                                this.PREMOVIE = str2;\r
-                                       }\r
-                                       else if( str.StartsWith( "BACKGROUND_GR", StringComparison.OrdinalIgnoreCase ) )\r
-                                       {\r
-                                               this.t入力・パラメータ食い込みチェック( "BACKGROUND_GR", ref str, ref str2 );\r
+                                       } else if (str.StartsWith("BACKGROUND_GR", StringComparison.OrdinalIgnoreCase)) {\r
+                                               this.t入力・パラメータ食い込みチェック("BACKGROUND_GR", ref str, ref str2);\r
                                                this.BACKGROUND_GR = str2;\r
-                                       }\r
-                                       else if( str.StartsWith( "BACKGROUND", StringComparison.OrdinalIgnoreCase ) || str.StartsWith( "WALL", StringComparison.OrdinalIgnoreCase ) )\r
-                                       {\r
-                                               this.t入力・パラメータ食い込みチェック( "BACKGROUND", ref str, ref str2 );\r
-                                               this.t入力・パラメータ食い込みチェック( "WALL", ref str, ref str2 );\r
+                                       } else if (str.StartsWith("BACKGROUND", StringComparison.OrdinalIgnoreCase) || str.StartsWith("WALL", StringComparison.OrdinalIgnoreCase)) {\r
+                                               this.t入力・パラメータ食い込みチェック("BACKGROUND", ref str, ref str2);\r
+                                               this.t入力・パラメータ食い込みチェック("WALL", ref str, ref str2);\r
                                                this.BACKGROUND = str2;\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               if( str.StartsWith( "RANDOM", StringComparison.OrdinalIgnoreCase ) )\r
-                                               {\r
-                                                       this.t入力・パラメータ食い込みチェック( "RANDOM", ref str, ref str2 );\r
+                                       } else {\r
+                                               if (str.StartsWith("RANDOM", StringComparison.OrdinalIgnoreCase)) {\r
+                                                       this.t入力・パラメータ食い込みチェック("RANDOM", ref str, ref str2);\r
                                                        int num5 = 1;\r
-                                                       if( !int.TryParse( str2, out num5 ) )\r
-                                                       {\r
+                                                       if (!int.TryParse(str2, out num5)) {\r
                                                                num5 = 1;\r
                                                        }\r
-                                                       this.n現在の乱数 = CDTXMania.Random.Next( num5 ) + 1;\r
+                                                       this.n現在の乱数 = CDTXMania.Random.Next(num5) + 1;\r
                                                }\r
-                                               if( str.StartsWith( "SOUND_NOWLOADING", StringComparison.OrdinalIgnoreCase ) )\r
-                                               {\r
-                                                       this.t入力・パラメータ食い込みチェック( "SOUND_NOWLOADING", ref str, ref str2 );\r
+                                               if (str.StartsWith("SOUND_NOWLOADING", StringComparison.OrdinalIgnoreCase)) {\r
+                                                       this.t入力・パラメータ食い込みチェック("SOUND_NOWLOADING", ref str, ref str2);\r
                                                        this.SOUND_NOWLOADING = str2;\r
-                                               }\r
-                                               else if( !this.bヘッダのみ )\r
-                                               {\r
-                                                       if( str.StartsWith( "MIDIFILE", StringComparison.OrdinalIgnoreCase ) )\r
-                                                       {\r
-                                                               this.t入力・パラメータ食い込みチェック( "MIDIFILE", ref str, ref str2 );\r
-                                                               this.MIDIFILE = str2;\r
-                                                       }\r
-                                                       else if( str.StartsWith( "PANEL", StringComparison.OrdinalIgnoreCase ) )\r
-                                                       {\r
-                                                               this.t入力・パラメータ食い込みチェック( "PANEL", ref str, ref str2 );\r
-                                                               this.PANEL = str2;\r
+                                               } else if (!this.bヘッダのみ) {\r
+                                                       if (str.StartsWith("PANEL", StringComparison.OrdinalIgnoreCase)) {\r
+                                                               this.t入力・パラメータ食い込みチェック("PANEL", ref str, ref str2);\r
+                                                               int dummyResult;                                                                // #23885 2010.12.12 yyagi: not to confuse "#PANEL strings (panel)" and "#PANEL int (panpot of EL)"\r
+                                                               if (!int.TryParse(str2, out dummyResult)) {             // 数値じゃないならPANELとみなす\r
+                                                                       this.PANEL = str2;                                                      //\r
+                                                                       goto EOL;                                                                       //\r
+                                                               }                                                                                               // 数値ならPAN ELとみなす\r
+\r
                                                        }\r
-                                                       else\r
-                                                       {\r
-                                                               if( str.StartsWith( "MIDINOTE", StringComparison.OrdinalIgnoreCase ) )\r
-                                                               {\r
-                                                                       this.t入力・パラメータ食い込みチェック( "MIDINOTE", ref str, ref str2 );\r
-                                                                       this.MIDINOTE = str2.ToLower().Equals( "on" );\r
+                                                       if (str.StartsWith("MIDIFILE", StringComparison.OrdinalIgnoreCase)) {\r
+                                                               this.t入力・パラメータ食い込みチェック("MIDIFILE", ref str, ref str2);\r
+                                                               this.MIDIFILE = str2;\r
+                                                       } else {\r
+                                                               if (str.StartsWith("MIDINOTE", StringComparison.OrdinalIgnoreCase)) {\r
+                                                                       this.t入力・パラメータ食い込みチェック("MIDINOTE", ref str, ref str2);\r
+                                                                       this.MIDINOTE = str2.ToLower().Equals("on");\r
                                                                }\r
-                                                               if( str.StartsWith( "BLACKCOLORKEY", StringComparison.OrdinalIgnoreCase ) )\r
-                                                               {\r
-                                                                       this.t入力・パラメータ食い込みチェック( "BLACKCOLORKEY", ref str, ref str2 );\r
-                                                                       this.BLACKCOLORKEY = str2.ToLower().Equals( "on" );\r
+                                                               if (str.StartsWith("BLACKCOLORKEY", StringComparison.OrdinalIgnoreCase)) {\r
+                                                                       this.t入力・パラメータ食い込みチェック("BLACKCOLORKEY", ref str, ref str2);\r
+                                                                       this.BLACKCOLORKEY = str2.ToLower().Equals("on");\r
                                                                }\r
-                                                               if( str.StartsWith( "BASEBPM", StringComparison.OrdinalIgnoreCase ) )\r
-                                                               {\r
-                                                                       this.t入力・パラメータ食い込みチェック( "BASEBPM", ref str, ref str2 );\r
-                                                                       double num6 = 0.0;\r
-                                                                       if( double.TryParse( str2, out num6 ) && ( num6 > 0.0 ) )\r
-                                                                       {\r
-                                                                               this.BASEBPM = num6;\r
+                                                               if (str.StartsWith("BASEBPM", StringComparison.OrdinalIgnoreCase)) {\r
+                                                                       this.t入力・パラメータ食い込みチェック("BASEBPM", ref str, ref str2);\r
+                                                                       double basebpm = 0.0;\r
+                                                                       //if( double.TryParse( str2, out num6 ) && ( num6 > 0.0 ) )\r
+                                                                       if (TryParse(str2, out basebpm) && basebpm > 0.0)       // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point\r
+                                                                       {                                                                                                       // #24204 2011.01.21 yyagi: Fix the condition correctly\r
+                                                                               this.BASEBPM = basebpm;\r
                                                                        }\r
-                                                               }\r
-                                                               else if( str.StartsWith( "SOUND_STAGEFAILED", StringComparison.OrdinalIgnoreCase ) )\r
-                                                               {\r
-                                                                       this.t入力・パラメータ食い込みチェック( "SOUND_STAGEFAILED", ref str, ref str2 );\r
+                                                               } else if (str.StartsWith("SOUND_STAGEFAILED", StringComparison.OrdinalIgnoreCase)) {\r
+                                                                       this.t入力・パラメータ食い込みチェック("SOUND_STAGEFAILED", ref str, ref str2);\r
                                                                        this.SOUND_STAGEFAILED = str2;\r
-                                                               }\r
-                                                               else if( str.StartsWith( "SOUND_FULLCOMBO", StringComparison.OrdinalIgnoreCase ) )\r
-                                                               {\r
-                                                                       this.t入力・パラメータ食い込みチェック( "SOUND_FULLCOMBO", ref str, ref str2 );\r
+                                                               } else if (str.StartsWith("SOUND_FULLCOMBO", StringComparison.OrdinalIgnoreCase)) {\r
+                                                                       this.t入力・パラメータ食い込みチェック("SOUND_FULLCOMBO", ref str, ref str2);\r
                                                                        this.SOUND_FULLCOMBO = str2;\r
-                                                               }\r
-                                                               else if( str.StartsWith( "SOUND_AUDIENCE", StringComparison.OrdinalIgnoreCase ) )\r
-                                                               {\r
-                                                                       this.t入力・パラメータ食い込みチェック( "SOUND_AUDIENCE", ref str, ref str2 );\r
+                                                               } else if (str.StartsWith("SOUND_AUDIENCE", StringComparison.OrdinalIgnoreCase)) {\r
+                                                                       this.t入力・パラメータ食い込みチェック("SOUND_AUDIENCE", ref str, ref str2);\r
                                                                        this.SOUND_AUDIENCE = str2;\r
-                                                               }\r
-                                                               else if( ( ( ( ( ( ( ( ( ( ( ( ( !this.t入力・行解析・WAVVOL_VOLUME( str, str2, str3 ) && !this.t入力・行解析・WAVPAN_PAN( str, str2, str3 ) ) && !this.t入力・行解析・WAV( str, str2, str3 ) ) && !this.t入力・行解析・BMPTEX( str, str2, str3 ) ) && !this.t入力・行解析・BMP( str, str2, str3 ) ) && !this.t入力・行解析・BGAPAN( str, str2, str3 ) ) && !this.t入力・行解析・BGA( str, str2, str3 ) ) && !this.t入力・行解析・AVIPAN( str, str2, str3 ) ) && !this.t入力・行解析・AVI_VIDEO( str, str2, str3 ) ) && !this.t入力・行解析・BPM_BPMzz( str, str2, str3 ) ) && !this.t入力・行解析・RESULTIMAGE( str, str2, str3 ) ) && !this.t入力・行解析・RESULTMOVIE( str, str2, str3 ) ) && !this.t入力・行解析・RESULTSOUND( str, str2, str3 ) ) && !this.t入力・行解析・SIZE( str, str2, str3 ) )\r
-                                                               {\r
-                                                                       this.t入力・行解析・チップ配置( str, str2, str3 );\r
+                                                               } else if (!this.t入力・行解析・WAVVOL_VOLUME(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・WAVPAN_PAN(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・WAV(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・BMPTEX(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・BMP(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・BGAPAN(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・BGA(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・AVIPAN(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・AVI_VIDEO(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・BPM_BPMzz(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・RESULTIMAGE(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・RESULTMOVIE(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・RESULTSOUND(str, str2, str3) &&\r
+                                                                         !this.t入力・行解析・SIZE(str, str2, str3)) {\r
+                                                                       this.t入力・行解析・チップ配置(str, str2, str3);\r
                                                                }\r
                                                        }\r
+                                               EOL:\r
+                                                       int xx = 0;             // #23885 2010.12.12 yyagi: dummy line to exit parsing the line\r
                                                }\r
                                        }\r
                                }\r
@@ -3387,7 +3505,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                       if( ( key < 0 ) || ( key >= 0x510 ) )\r
+                       if( ( key < 0 ) || ( key >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "AVI(VIDEO)番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                return false;\r
@@ -3418,7 +3536,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                       if( ( key < 0 ) || ( key >= 0x510 ) )\r
+                       if( ( key < 0 ) || ( key >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "AVIPAN番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                return false;\r
@@ -3439,7 +3557,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        cavipan.nAVI番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strArray[ index ] );\r
-                       if( ( cavipan.nAVI番号 < 1 ) || ( cavipan.nAVI番号 >= 0x510 ) )\r
+                       if( ( cavipan.nAVI番号 < 1 ) || ( cavipan.nAVI番号 >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "AVIPAN: {2}番目の数(AVI番号)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } );\r
                                return false;\r
@@ -3575,7 +3693,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                       if( ( key < 0 ) || ( key >= 0x510 ) )\r
+                       if( ( key < 0 ) || ( key >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "BGA番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                return false;\r
@@ -3596,7 +3714,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        cbga.nBMP番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strArray[ index ] );\r
-                       if( ( cbga.nBMP番号 < 1 ) || ( cbga.nBMP番号 >= 0x510 ) )\r
+                       if( ( cbga.nBMP番号 < 1 ) || ( cbga.nBMP番号 >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } );\r
                                return false;\r
@@ -3684,7 +3802,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                       if( ( key < 0 ) || ( key >= 0x510 ) )\r
+                       if( ( key < 0 ) || ( key >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "BGAPAN番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                return false;\r
@@ -3705,7 +3823,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        cbgapan.nBMP番号 = C変換.n36進数2桁の文字列を数値に変換して返す( strArray[ index ] );\r
-                       if( ( cbgapan.nBMP番号 < 1 ) || ( cbgapan.nBMP番号 >= 0x510 ) )\r
+                       if( ( cbgapan.nBMP番号 < 1 ) || ( cbgapan.nBMP番号 >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "BGAPAN: {2}番目の数(BMP番号)が異常です。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数, index + 1 } );\r
                                return false;\r
@@ -3844,7 +3962,7 @@ namespace DTXMania
                        else\r
                        {\r
                                key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                               if( ( key < 0 ) || ( key >= 0x510 ) )\r
+                               if( ( key < 0 ) || ( key >= 36 * 36 ) )\r
                                {\r
                                        Trace.TraceError( "BMP番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                        return false;\r
@@ -3876,7 +3994,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        int key = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                       if( ( key < 0 ) || ( key >= 0x510 ) )\r
+                       if( ( key < 0 ) || ( key >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "BMPTEX番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                return false;\r
@@ -3910,14 +4028,15 @@ namespace DTXMania
                        else\r
                        {\r
                                index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                               if( ( index < 0 ) || ( index >= 0x510 ) )\r
+                               if( ( index < 0 ) || ( index >= 36 * 36 ) )\r
                                {\r
                                        Trace.TraceError( "BPM番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                        return false;\r
                                }\r
                        }\r
                        double result = 0.0;\r
-                       if( !double.TryParse( strパラメータ, out result ) )\r
+//                     if( !double.TryParse( strパラメータ, out result ) )\r
+                       if ( !TryParse( strパラメータ, out result) )                       // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point\r
                        {\r
                                return false;\r
                        }\r
@@ -3975,34 +4094,33 @@ namespace DTXMania
                                {\r
                                        case "_SS":\r
                                                this.t入力・行解析・RESULTIMAGE・ファイルを設定する( 0, strパラメータ );\r
-                                               goto Label_0142;\r
+                                               break;\r
 \r
                                        case "_S":\r
                                                this.t入力・行解析・RESULTIMAGE・ファイルを設定する( 1, strパラメータ );\r
-                                               goto Label_0142;\r
+                                               break;\r
 \r
                                        case "_A":\r
                                                this.t入力・行解析・RESULTIMAGE・ファイルを設定する( 2, strパラメータ );\r
-                                               goto Label_0142;\r
+                                               break;\r
 \r
                                        case "_B":\r
                                                this.t入力・行解析・RESULTIMAGE・ファイルを設定する( 3, strパラメータ );\r
-                                               goto Label_0142;\r
+                                               break;\r
 \r
                                        case "_C":\r
                                                this.t入力・行解析・RESULTIMAGE・ファイルを設定する( 4, strパラメータ );\r
-                                               goto Label_0142;\r
+                                               break;\r
 \r
                                        case "_D":\r
                                                this.t入力・行解析・RESULTIMAGE・ファイルを設定する( 5, strパラメータ );\r
-                                               goto Label_0142;\r
+                                               break;\r
 \r
                                        case "_E":\r
                                                this.t入力・行解析・RESULTIMAGE・ファイルを設定する( 6, strパラメータ );\r
-                                               goto Label_0142;\r
+                                               break;\r
                                }\r
                        }\r
-               Label_0142:\r
                        return true;\r
                }\r
                private void t入力・行解析・RESULTIMAGE・ファイルを設定する( int nランク0to6, string strファイル名 )\r
@@ -4175,7 +4293,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        int index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                       if( ( index < 0 ) || ( index >= 0x510 ) )\r
+                       if( ( index < 0 ) || ( index >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "SIZE番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                return false;\r
@@ -4219,7 +4337,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        int index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                       if( ( index < 0 ) || ( index >= 0x510 ) )\r
+                       if( ( index < 0 ) || ( index >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "WAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                return false;\r
@@ -4253,11 +4371,11 @@ namespace DTXMania
                        int num2;\r
                        if( strコマンド.StartsWith( "WAVPAN", StringComparison.OrdinalIgnoreCase ) )\r
                        {\r
-                               strコマンド = strコマンド.Substring( 6 );\r
+                               strコマンド = strコマンド.Substring(6);\r
                        }\r
                        else if( strコマンド.StartsWith( "PAN", StringComparison.OrdinalIgnoreCase ) )\r
                        {\r
-                               strコマンド = strコマンド.Substring( 3 );\r
+                               strコマンド = strコマンド.Substring(3);\r
                        }\r
                        else\r
                        {\r
@@ -4268,7 +4386,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        int index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                       if( ( index < 0 ) || ( index >= 0x510 ) )\r
+                       if( ( index < 0 ) || ( index >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "WAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                return false;\r
@@ -4317,7 +4435,7 @@ namespace DTXMania
                                return false;\r
                        }\r
                        int index = C変換.n36進数2桁の文字列を数値に変換して返す( strコマンド.Substring( 0, 2 ) );\r
-                       if( ( index < 0 ) || ( index >= 0x510 ) )\r
+                       if( ( index < 0 ) || ( index >= 36 * 36 ) )\r
                        {\r
                                Trace.TraceError( "WAV番号に 00~ZZ 以外の値または不正な文字列が指定されました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                return false;\r
@@ -4391,16 +4509,16 @@ namespace DTXMania
                        {\r
                                this.bチップがある.Guitar = true;\r
                        }\r
-                       else if( ( c >= 160 ) && ( c <= 0xa7 ) )\r
+                       else if( ( c >= 0xA0 ) && ( c <= 0xa7 ) )\r
                        {\r
                                this.bチップがある.Bass = true;\r
                        }\r
-                       if( c == 0x18 )\r
-                       {\r
-                               this.bチップがある.HHOpen = true;\r
-                       }\r
                        switch( c )\r
                        {\r
+                               case 0x18:\r
+                                       this.bチップがある.HHOpen = true;\r
+                                       break;\r
+\r
                                case 0x19:\r
                                        this.bチップがある.Ride = true;\r
                                        break;\r
@@ -4413,20 +4531,21 @@ namespace DTXMania
                                        this.bチップがある.OpenGuitar = true;\r
                                        break;\r
 \r
-                               case 160:\r
+                               case 0xA0:\r
                                        this.bチップがある.OpenBass = true;\r
                                        break;\r
 \r
-                               case 2:\r
+                               case 0x02:                      // 小節長変更\r
                                        {\r
                                                double result = 0.0;\r
-                                               if( !double.TryParse( strパラメータ, out result ) )\r
+                                               //if( !double.TryParse( strパラメータ, out result ) )\r
+                                               if (!TryParse(strパラメータ, out result))                  // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point\r
                                                {\r
                                                        Trace.TraceError( "小節長倍率に不正な値を指定しました。[{0}: {1}行]", new object[] { this.strファイル名の絶対パス, this.n現在の行数 } );\r
                                                        return false;\r
                                                }\r
                                                CChip item = new CChip();\r
-                                               item.n発声位置 = num * 0x180;\r
+                                               item.n発声位置 = num * 384;\r
                                                item.nチャンネル番号 = c;\r
                                                item.db実数値 = result;\r
                                                this.listChip.Add( item );\r
@@ -4472,7 +4591,7 @@ namespace DTXMania
                                if( index != 0 )\r
                                {\r
                                        CChip chip2 = new CChip();\r
-                                       chip2.n発声位置 = ( num * 0x180 ) + ( ( 0x180 * i ) / ( num4 / 2 ) );\r
+                                       chip2.n発声位置 = ( num * 384 ) + ( ( 384 * i ) / ( num4 / 2 ) );\r
                                        chip2.nチャンネル番号 = c;\r
                                        chip2.n整数値 = index;\r
                                        chip2.n整数値・内部番号 = index;\r
@@ -4512,6 +4631,59 @@ namespace DTXMania
                        }\r
                        return true;\r
                }\r
+\r
+               #region [#23880 2010.12.30 yyagi: コンマとスペースの両方を小数点として扱うTryParse]\r
+               /// <summary>\r
+               /// 小数点としてコンマとピリオドの両方を受け付けるTryParse()\r
+               /// </summary>\r
+               /// <param name="s">strings convert to double</param>\r
+               /// <param name="result">parsed double value</param>\r
+               /// <returns>s が正常に変換された場合は true。それ以外の場合は false。</returns>\r
+               /// <exception cref="ArgumentException">style が NumberStyles 値でないか、style に NumberStyles.AllowHexSpecifier 値が含まれている</exception>\r
+               private bool TryParse(string s, out double result) {    // #23880 2010.12.30 yyagi: alternative TryParse to permit both '.' and ',' for decimal point\r
+                                                                                                                               // EU諸国での #BPM 123,45 のような記述に対応するため、\r
+                                                                                                                               // 小数点の最終位置を検出して、それをlocaleにあった\r
+                                                                                                                               // 文字に置き換えてからTryParse()する\r
+                                                                                                                               // 桁区切りの文字はスキップする\r
+\r
+                       const string DecimalSeparators = ".,";                          // 小数点文字\r
+                       const string GroupSeparators = ".,' ";                          // 桁区切り文字\r
+                       const string NumberSymbols = "0123456789";                      // 数値文字\r
+\r
+                       int len = s.Length;                                                                     // 文字列長\r
+                       int decimalPosition = len;                                                      // 真の小数点の位置 最初は文字列終端位置に仮置きする\r
+\r
+                       for (int i = 0; i < len; i++) {                                                 // まず、真の小数点(一番最後に現れる小数点)の位置を求める\r
+                               char c = s[i];\r
+                               if (NumberSymbols.IndexOf(c) >= 0) {                            // 数値だったらスキップ\r
+                                       continue;\r
+                               } else if (DecimalSeparators.IndexOf(c) >= 0) {         // 小数点文字だったら、その都度位置を上書き記憶\r
+                                       decimalPosition = i;\r
+                               } else if (GroupSeparators.IndexOf(c) >= 0) {           // 桁区切り文字の場合もスキップ\r
+                                       continue;\r
+                               } else {                                                                                        // 数値・小数点・区切り文字以外がきたらループ終了\r
+                                       break;\r
+                               }\r
+                       }\r
+\r
+                       StringBuilder decimalStr = new StringBuilder(16);\r
+                       for (int i = 0; i < len; i++) {                                                 // 次に、localeにあった数値文字列を生成する\r
+                               char c = s[i];\r
+                               if (NumberSymbols.IndexOf(c) >= 0) {                            // 数値だったら\r
+                                       decimalStr.Append(c);                                                   // そのままコピー\r
+                               } else if (DecimalSeparators.IndexOf(c) >= 0) {         // 小数点文字だったら\r
+                                       if (i == decimalPosition) {                                             // 最後に出現した小数点文字なら、localeに合った小数点を出力する\r
+                                               decimalStr.Append(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);\r
+                                       }\r
+                               } else if (GroupSeparators.IndexOf(c) >= 0) {           // 桁区切り文字だったら\r
+                                       continue;                                                                               // 何もしない(スキップ)\r
+                               } else {\r
+                                       break;\r
+                               }\r
+                       }\r
+                       return double.TryParse(decimalStr.ToString(), out result);      // 最後に、自分のlocale向けの文字列に対してTryParse実行\r
+               }\r
+               #endregion\r
                //-----------------\r
                #endregion\r
        }\r