OSDN Git Service

#37271 ドラムとギター/ベースの最大同時発音数を独立して設定できるようにした。CONFIGURATION/System/Sound Option/Polyphoni...
authoryyagi <yyagi.dtxmania@gmail.com>
Mon, 27 Sep 2021 14:03:03 +0000 (23:03 +0900)
committeryyagi <yyagi.dtxmania@gmail.com>
Mon, 27 Sep 2021 14:03:03 +0000 (23:03 +0900)
DTXMania/コード/スコア、曲/CDTX.cs
DTXMania/コード/スコア、曲/CDTXNestedTypes.cs
DTXMania/コード/ステージ/04.コンフィグ/CActConfigList.cs
DTXMania/コード/ステージ/04.コンフィグ/CConfigXml.cs
DTXMania/コード/ステージ/07.演奏/CStage演奏画面共通.cs
DTXMania/コード/全体/CDTXMania.cs

index ae9c38f..b6c77a5 100644 (file)
@@ -216,6 +216,7 @@ namespace DTXMania
                        #endregion
                        this.nBGMAdjust = 0;
                        this.nPolyphonicSounds = CDTXMania.Instance.ConfigIni.nPolyphonicSounds;
+                       this.nPolyphonicSoundsGB = CDTXMania.Instance.ConfigIni.nPolyphonicSoundsGB;
                        this.dbDTXVPlaySpeed = 1.0f;
                        this.bUse556x710BGAAVI = false;
                        this.n使用レーン数 = new STDGBSValue<EUseLanes>();
@@ -505,7 +506,7 @@ namespace DTXMania
                {
                        if (wc.rSound[0] != null && wc.rSound[0].n総演奏時間ms >= 5000)
                        {
-                               for (int i = 0; i < nPolyphonicSounds; i++)
+                               for (int i = 0; i < Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB); i++)
                                {
                                        if ((wc.rSound[i] != null) && (wc.rSound[i].b再生中))
                                        {
@@ -537,7 +538,7 @@ namespace DTXMania
                        {
                                if (wc.rSound[0] != null && wc.rSound[0].n総演奏時間ms >= 5000)
                                {
-                                       for (int i = 0; i < nPolyphonicSounds; i++)
+                                       for (int i = 0; i < Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB); i++)
                                        {
                                                if ((wc.rSound[i] != null) && (wc.rSound[i].b再生中))
                                                {
@@ -560,7 +561,7 @@ namespace DTXMania
             {
                 if (wc.rSound[0] != null)
                 {
-                    for (int i = 0; i < nPolyphonicSounds; i++)
+                    for (int i = 0; i < Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB); i++)
                     {
                         if ((wc.rSound[i] != null) && (wc.rSound[i].b再生中))
                         {
@@ -581,7 +582,7 @@ namespace DTXMania
                        if (this.listWAV.ContainsKey(nWaveの内部番号))
                        {
                                CWAV cwav = this.listWAV[nWaveの内部番号];
-                               for (int i = 0; i < nPolyphonicSounds; i++)
+                               for (int i = 0; i < Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB); i++)
                                {
                                        if (cwav.rSound[i] != null && cwav.rSound[i].b再生中)
                                        {
@@ -643,15 +644,15 @@ namespace DTXMania
                                        }
 
                                        #region [ 同時発音数を、チャンネルによって変える ]
-                                       int nPoly = nPolyphonicSounds;
-                                       if (!bIsDirectSound)  // DShowでの再生の場合はミキシング負荷が高くないため、
-                                       {                                   // チップのライフタイム管理を行わない
-                                               if (cwav.bIsBassSound) nPoly = (nPolyphonicSounds >= 2) ? 2 : 1;
-                                               else if (cwav.bIsGuitarSound) nPoly = (nPolyphonicSounds >= 2) ? 2 : 1;
+                                       int nPoly = Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB);
+                                       //if (!bIsDirectSound)  // DShowでの再生の場合はミキシング負荷が高くないため、
+                                       //{                                   // チップのライフタイム管理を行わない
+                                               if (cwav.bIsBassSound) nPoly = nPolyphonicSoundsGB;                     //(nPolyphonicSounds >= 2) ? 2 : 1;
+                                               else if (cwav.bIsGuitarSound) nPoly = nPolyphonicSoundsGB;      //(nPolyphonicSounds >= 2) ? 2 : 1;
                                                else if (cwav.bIsSESound) nPoly = 1;
                                                else if (cwav.bIsBGMSound) nPoly = 1;
-                                       }
-                                       if (cwav.bIsBGMSound) nPoly = 1;
+                                       //}
+                                       //if (cwav.bIsBGMSound) nPoly = 1;
                                        #endregion
 
                                        // 残りはClone等で登録する
@@ -662,7 +663,7 @@ namespace DTXMania
                                                        cwav.rSound[i] = (CSound)cwav.rSound[0].Clone();    // #24007 2011.9.5 yyagi add: to accelerate loading chip sounds
                                                                                                                                                                // CDTXMania.Instance.app.Sound管理.tサウンドを登録する( cwav.rSound[ j ] );
                                                }
-                                               for (int i = nPoly; i < nPolyphonicSounds; i++)
+                                               for (int i = nPoly; i < Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB); i++)
                                                {
                                                        cwav.rSound[i] = null;
                                                }
@@ -696,7 +697,7 @@ namespace DTXMania
                                catch (Exception exception)
                                {
                                        Trace.TraceError("サウンドの生成に失敗しました。({0})({1})({2})", exception.Message, cwav.strコメント文, str);
-                                       for (int j = 0; j < nPolyphonicSounds; j++)
+                                       for (int j = 0; j < Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB); j++)
                                        {
                                                cwav.rSound[j] = null;
                                        }
@@ -752,7 +753,7 @@ namespace DTXMania
                                if (this.listWAV.ContainsKey(pChip.n整数値_内部番号))
                                {
                                        CWAV wc = this.listWAV[pChip.n整数値_内部番号];
-                                       int index = wc.n現在再生中のサウンド番号 = (wc.n現在再生中のサウンド番号 + 1) % nPolyphonicSounds;
+                                       int index = wc.n現在再生中のサウンド番号 = (wc.n現在再生中のサウンド番号 + 1) % Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB);
                                        if ((wc.rSound[0] != null) &&
                                                (wc.rSound[0].bストリーム再生する || wc.rSound[index] == null))
                                        {
@@ -789,7 +790,7 @@ namespace DTXMania
                        }
                        foreach (CWAV cwav in this.listWAV.Values)
                        {
-                               for (int j = 0; j < nPolyphonicSounds; j++)
+                               for (int j = 0; j < Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB); j++)
                                {
                                        if ((cwav.rSound[j] != null) && cwav.rSound[j].b再生中)
                                        {
@@ -802,7 +803,7 @@ namespace DTXMania
                {
                        foreach (CWAV cwav in this.listWAV.Values)
                        {
-                               for (int i = 0; i < nPolyphonicSounds; i++)
+                               for (int i = 0; i < Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB); i++)
                                {
                                        if ((cwav.rSound[i] != null) && cwav.rSound[i].b再生中)
                                        {
@@ -820,7 +821,7 @@ namespace DTXMania
                {
                        foreach (CWAV cwav in this.listWAV.Values)
                        {
-                               for (int i = 0; i < nPolyphonicSounds; i++)
+                               for (int i = 0; i < Math.Max(nPolyphonicSounds, nPolyphonicSoundsGB); i++)
                                {
                                        if ((cwav.rSound[i] != null) && cwav.rSound[i].b一時停止中)
                                        {
@@ -1265,6 +1266,7 @@ namespace DTXMania
                private int n現在の乱数;
 
                private int nPolyphonicSounds = 4;              // #28228 2012.5.1 yyagi
+               private int nPolyphonicSoundsGB = 4;
 
                private int n内部番号BPM1to;
                private int n内部番号WAV1to;
index 3baa80f..117c169 100644 (file)
@@ -391,13 +391,13 @@ namespace DTXMania
                        public List<EChannel> listこのWAVを使用するチャンネル番号の集合 = new List<EChannel>(16);
                        public int nチップサイズ = 100;
                        public int n位置;
-                       public long[] n一時停止時刻 = new long[CDTXMania.Instance.ConfigIni.nPolyphonicSounds]; // 4
+                       public long[] n一時停止時刻 = new long[ Math.Max( CDTXMania.Instance.ConfigIni.nPolyphonicSounds, CDTXMania.Instance.ConfigIni.nPolyphonicSoundsGB) ]; // 4
                        public int n音量 = 100;
                        public int n現在再生中のサウンド番号;
-                       public long[] n再生開始時刻 = new long[CDTXMania.Instance.ConfigIni.nPolyphonicSounds]; // 4
+                       public long[] n再生開始時刻 = new long[ Math.Max( CDTXMania.Instance.ConfigIni.nPolyphonicSounds, CDTXMania.Instance.ConfigIni.nPolyphonicSoundsGB) ]; // 4
                        public int n内部番号;
                        public int n表記上の番号;
-                       public CSound[] rSound = new CSound[CDTXMania.Instance.ConfigIni.nPolyphonicSounds];    // 4
+                       public CSound[] rSound = new CSound[ Math.Max( CDTXMania.Instance.ConfigIni.nPolyphonicSounds, CDTXMania.Instance.ConfigIni.nPolyphonicSoundsGB) ];    // 4
                        public string strコメント文 = "";
                        public string strファイル名 = "";
                        public bool bBGMとして使わない
@@ -448,7 +448,7 @@ namespace DTXMania
 
                                if (bManagedリソースの解放も行う)
                                {
-                                       for (int i = 0; i < CDTXMania.Instance.ConfigIni.nPolyphonicSounds; i++)  // 4
+                                       for (int i = 0; i < Math.Max(CDTXMania.Instance.ConfigIni.nPolyphonicSounds, CDTXMania.Instance.ConfigIni.nPolyphonicSoundsGB); i++)  // 4
                                        {
                                                if (this.rSound[i] != null)
                                                        CDTXMania.Instance.Sound管理.tサウンドを破棄する(this.rSound[i]);
index c76d090..12f7a77 100644 (file)
@@ -504,6 +504,7 @@ namespace DTXMania
                                list項目リスト.Add( CDTXMania.Instance.ConfigIni.bDynamicBassMixerManagement );
                                list項目リスト.Add( CDTXMania.Instance.ConfigIni.nMasterVolume );
                                list項目リスト.Add( CDTXMania.Instance.ConfigIni.nPolyphonicSounds );
+                               list項目リスト.Add( CDTXMania.Instance.ConfigIni.nPolyphonicSoundsGB );
                                list項目リスト.Add( CDTXMania.Instance.ConfigIni.eClickType );
                                list項目リスト.Add( CDTXMania.Instance.ConfigIni.nClickHighVolume );
                                list項目リスト.Add( CDTXMania.Instance.ConfigIni.nClickLowVolume );
index 88c1a36..cbe64a5 100644 (file)
@@ -415,8 +415,13 @@ namespace DTXMania
                /// 起動時にEnumerate Songsをする/しない
                /// </summary>
                [DataMember(Order = 119)]
-               public COptionBool bEnumerateSongsInBoot;               // #40772 2020.10.12 add yyagi
+               public COptionBool bEnumerateSongsInBoot;       // #40772 2020.10.12 add yyagi
 
+               /// <summary>
+               /// Guitar/BassのnPolyphonicSounds
+               /// </summary>
+               [DataMember(Order = 119)]
+               public COptionInteger nPolyphonicSoundsGB;              // #37271 2021.9.27 add yyagi
 
                public int GetLaneX(ELane e)
                {
@@ -635,7 +640,8 @@ namespace DTXMania
                        nChipFadeoutTimeMs = new COptionInteger(2000);
                        rcViewerWindow = new Coordinates.CRect(100, 100, 640, 360);
                        nMasterVolume = new COptionInteger(100);
-                       nPolyphonicSounds = new COptionInteger(2);                                      // #38474 2018.8.3 yyagi 4 -> 2, to reduce sound mixing load 
+                       nPolyphonicSounds   = new COptionInteger(4);                  // #38474 2018.8.3 yyagi 4 -> 2, to reduce sound mixing load 
+                       nPolyphonicSoundsGB = new COptionInteger(2);
 
                        eClickType = new COptionEnum<EClickType>(EClickType.Off);
                        nClickHighVolume = new COptionInteger(100);
@@ -954,6 +960,7 @@ namespace DTXMania
 
                        nMasterVolume.Initialize( "strCfgSysMasterVolume", 0, 201);
                        nPolyphonicSounds.Initialize( "strCfgSysPolyphonicSounds", 1, 11 );
+                       nPolyphonicSoundsGB.Initialize("strCfgSysPolyphonicSoundsGB", 1, 11);
 
                        // dgb
                        for (EPart i = EPart.Drums; i <= EPart.Unknown; i++)
index 762a0ab..6f04634 100644 (file)
@@ -434,7 +434,7 @@ namespace DTXMania
                                                        if (CDTXMania.Instance.DTX.listWAV.ContainsKey(pChip.n整数値_内部番号))
                                                        {
                                                                CDTX.CWAV wc = CDTXMania.Instance.DTX.listWAV[pChip.n整数値_内部番号];
-                                                               for (int i = 0; i < CDTXMania.Instance.ConfigIni.nPolyphonicSounds; i++)
+                                                               for (int i = 0; i < Math.Max(CDTXMania.Instance.ConfigIni.nPolyphonicSounds, CDTXMania.Instance.ConfigIni.nPolyphonicSoundsGB); i++)
                                                                {
                                                                        if (wc.rSound[i] != null)
                                                                        {
@@ -3257,7 +3257,7 @@ namespace DTXMania
                                                CDTX.CWAV wc = CDTXMania.Instance.DTX.listWAV[pChip.n整数値_内部番号];
                                                //Debug.Write( "[AddMixer] BAR=" + pChip.n発声位置 / 384 + ", wav=" + Path.GetFileName( wc.strファイル名 ) + ", time=" + pChip.n発声時刻ms );
 
-                                               for (int i = 0; i < CDTXMania.Instance.ConfigIni.nPolyphonicSounds; i++)
+                                               for (int i = 0; i < Math.Max(CDTXMania.Instance.ConfigIni.nPolyphonicSounds, CDTXMania.Instance.ConfigIni.nPolyphonicSoundsGB); i++)
                                                {
                                                        if (wc.rSound[i] != null)
                                                        {
@@ -3284,7 +3284,7 @@ namespace DTXMania
                                        {
                                                CDTX.CWAV wc = CDTXMania.Instance.DTX.listWAV[pChip.n整数値_内部番号];
                                                //Debug.Write( "[DelMixer] BAR=" + pChip.n発声位置 / 384 +  ", wav=" + Path.GetFileName( wc.strファイル名 ) + ", time=" + pChip.n発声時刻ms );
-                                               for (int i = 0; i < CDTXMania.Instance.ConfigIni.nPolyphonicSounds; i++)
+                                               for (int i = 0; i < Math.Max(CDTXMania.Instance.ConfigIni.nPolyphonicSounds, CDTXMania.Instance.ConfigIni.nPolyphonicSoundsGB); i++)
                                                {
                                                        if (wc.rSound[i] != null)
                                                        {
index 0b3f05c..556af49 100644 (file)
@@ -433,6 +433,7 @@ namespace DTXMania
 
                                        //多重再生数=4
                                        CDTXMania.instance.ConfigIni.nPolyphonicSounds.Value = 4;
+                                       CDTXMania.instance.ConfigIni.nPolyphonicSoundsGB.Value = 2;
 
                                        //再生速度x1
                                        CDTXMania.instance.ConfigIni.nPlaySpeed.Value = 20;