• R/O
  • HTTP
  • SSH
  • HTTPS

dtxmania: 提交


Commit MetaInfo

修订版15ced175e0578d4219008381b15299d47da23c89 (tree)
时间2023-03-24 01:46:20
作者yyagi <yyagi.dtxmania@gmai...>
Commiteryyagi

Log Message

#47668 DTXC内で扱う分解能を下辺にするための布石。

更改概述

差异

--- a/DTXCreator/DTXCreator.csproj
+++ b/DTXCreator/DTXCreator.csproj
@@ -116,6 +116,7 @@
116116 </ItemGroup>
117117 <ItemGroup>
118118 <Compile Include="コード\00.全体\AppSetting.cs" />
119+ <Compile Include="コード\05.譜面\CWholeNoteDivision.cs" />
119120 <Compile Include="コード\06.汎用\CDialog.cs">
120121 <SubType>Form</SubType>
121122 </Compile>
--- a/DTXCreator/コード/00.全体/CDTX入出力.cs
+++ b/DTXCreator/コード/00.全体/CDTX入出力.cs
@@ -533,7 +533,7 @@ namespace DTXCreator
533533 }
534534 #endregion
535535 //Debug.WriteLine( "入力: n小節番号=" + n小節番号 + ", nGrid=" + nGrid + ", f値=" + f値 + ", strParam=" + strParams[i] );
536- this.dicBEATチップf値.Add( n小節番号 * 192 + nGrid, (float) f値 );
536+ this.dicBEATチップf値.Add( n小節番号 * CWholeNoteDivision.n分解能 + nGrid, (float) f値 );
537537
538538 return true;
539539 }
@@ -1437,7 +1437,7 @@ namespace DTXCreator
14371437 cチップ.b裏 = flag;
14381438 float f;
14391439 if ( ( nCh == 0xF8 || nCh == 0xF3 ) && // BEATチップの場合
1440- dicBEATチップf値.TryGetValue( nBar * 192 + (i * 192 / nChips ), out f ) )
1440+ dicBEATチップf値.TryGetValue( nBar * CWholeNoteDivision.n分解能 + (i * CWholeNoteDivision.n分解能 / nChips ), out f ) )
14411441 {
14421442 cチップ.f値_浮動小数 = f;
14431443 //Debug.WriteLine( "f値: nBar=" + nBar + ", f値=" + f );
--- a/DTXCreator/コード/00.全体/Cメインフォーム.cs
+++ b/DTXCreator/コード/00.全体/Cメインフォーム.cs
@@ -1206,8 +1206,8 @@ namespace DTXCreator
12061206 }
12071207 #endregion
12081208
1209- int n旧Grid数 = (int) ( c小節.f小節長倍率 * 192 + 0.5 );
1210- int n新Grid数 = (int) ( dlg.f倍率 * 192 + 0.5 );
1209+ int n旧Grid数 = (int) ( c小節.f小節長倍率 * CWholeNoteDivision.n分解能 + 0.5 );
1210+ int n新Grid数 = (int) ( dlg.f倍率 * CWholeNoteDivision.n分解能 + 0.5 );
12111211 int nGrid増減 = n旧Grid数 - n新Grid数;
12121212
12131213 this.t小節長を変更する_小節単位( n小節番号, dlg.f倍率 );
@@ -5431,7 +5431,7 @@ namespace DTXCreator
54315431 }
54325432 private void toolStripComboBox譜面拡大率_SelectedIndexChanged( object sender, EventArgs e )
54335433 {
5434- C小節.n基準の高さdot = 192 * ( this.toolStripComboBox譜面拡大率.SelectedIndex + 1 );
5434+ C小節.n基準の高さdot = CWholeNoteDivision.n分解能_表示用 * ( this.toolStripComboBox譜面拡大率.SelectedIndex + 1 );
54355435
54365436 this.pictureBox譜面パネル.Refresh();
54375437 }
@@ -5642,11 +5642,11 @@ namespace DTXCreator
56425642 // float f小節長倍率 = 1.0f;
56435643 C小節 c小節_0小節目 = this.mgr譜面管理者.dic小節[ nBGMチップの小節番号 ];
56445644 Cチップ cチップBGM = c小節_0小節目.listチップ[ nBGMチップのindex ];
5645- nBGM位置grid = (int) ( 192f * c小節_0小節目.f小節長倍率 * listBeatPositions[ n1拍目のBeatPositionIndex ].fBeatTime / ( ( 60 * 4 ) / tempo ) + 0.5 );
5645+ nBGM位置grid = (int) ( CWholeNoteDivision.n分解能 * c小節_0小節目.f小節長倍率 * listBeatPositions[ n1拍目のBeatPositionIndex ].fBeatTime / ( ( 60 * 4 ) / tempo ) + 0.5 );
56465646 // ここでnBGM位置Gridが192(x小節長)を超えることがある
56475647 // → 192(x小節長)をひいて、次の小節に回す。(小節ごとに小節長倍率が変化する可能性があることに注意)
56485648 // → スマン、この実装ではまだ、DTXデータの最初はしばらく小節倍率が一定である前提になっちゃってる・・
5649- cチップBGM.n位置grid = (int) ( 192 * c小節_0小節目.f小節長倍率 + 0.5f ) - ( nBGM位置grid % 192 ); // "192-" が必要なことに注意
5649+ cチップBGM.n位置grid = (int) ( CWholeNoteDivision.n分解能 * c小節_0小節目.f小節長倍率 + 0.5f ) - ( nBGM位置grid % CWholeNoteDivision.n分解能 ); // "192-" が必要なことに注意
56505650 c小節_0小節目.listチップ[ nBGMチップのindex ] = cチップBGM;
56515651 this.mgr譜面管理者.dic小節[ nBGMチップの小節番号 ] = c小節_0小節目;
56525652 }
@@ -5654,15 +5654,15 @@ namespace DTXCreator
56545654
56555655 #region [ 0小節目のBPMを設定し、1つ目の拍が1小節目の頭に来るようにする。]
56565656 // まず、0小節の頭にBPM設定を追加する。
5657- this.mgr編集モード管理者.tBPMチップを配置する( 0 * 192, tempo ); // 既にBPMチップが配置されている場合の処理は????????????????
5657+ this.mgr編集モード管理者.tBPMチップを配置する( 0 * CWholeNoteDivision.n分解能, tempo ); // 既にBPMチップが配置されている場合の処理は????????????????
56585658 this.numericUpDownBPM.Value = (decimal) ( (int) ( tempo + 0.5 ) );
56595659 numericUpDownBPM_ValueChanged( null, null );
56605660 numericUpDownBPM_Leave( null, null );
56615661
56625662 // 更に、先の1グリッド分の誤差をなくすために、BGMチップの位置だけでなく、0小節目のBPMも微調整する。
56635663 float f小節長倍率_ = this.mgr譜面管理者.dic小節[ nBGMチップの小節番号 ].f小節長倍率; // 手抜き。すまん。
5664- float fBGM再生直後のBPM = ( 60 * 4 ) * nBGM位置grid / ( 192.0f * f小節長倍率_ ) / listBeatPositions[ n1拍目のBeatPositionIndex ].fBeatTime;
5665- this.mgr編集モード管理者.tBPMチップを配置する( 192 - ( nBGM位置grid % 192 ), fBGM再生直後のBPM );
5664+ float fBGM再生直後のBPM = ( 60 * 4 ) * nBGM位置grid / ( CWholeNoteDivision.n分解能 * f小節長倍率_ ) / listBeatPositions[ n1拍目のBeatPositionIndex ].fBeatTime;
5665+ this.mgr編集モード管理者.tBPMチップを配置する( CWholeNoteDivision.n分解能 - ( nBGM位置grid % CWholeNoteDivision.n分解能 ), fBGM再生直後のBPM );
56665666 #endregion
56675667
56685668
@@ -5675,7 +5675,7 @@ namespace DTXCreator
56755675 // int lastGrid = (int) ( 192 * this.mgr譜面管理者.dic小節[ 0 ].f小節長倍率 ); // 0小節目の倍率
56765676 //int last小節内Grid = 0;
56775677 //int last小節番号 = nBGMチップの小節番号;
5678- int n最初の拍のある小節番号 = 1 + ( nBGM位置grid / 192 );
5678+ int n最初の拍のある小節番号 = 1 + ( nBGM位置grid / CWholeNoteDivision.n分解能 );
56795679 float lastBeatTime = listBeatPositions[ n1拍目のBeatPositionIndex ].fBeatTime;
56805680 int lastnGrid = -1;
56815681
@@ -5749,7 +5749,7 @@ namespace DTXCreator
57495749
57505750 #region [ BEATチップを置く ]
57515751 float f小節長倍率 = this.mgr譜面管理者.dic小節[ n小節番号 ].f小節長倍率;
5752- int n小節内Grid = (int) ( 192f * f小節長倍率 * deltatime / ( ( 60 * 4 ) / tempo ) + 0.5 );
5752+ int n小節内Grid = (int) ( CWholeNoteDivision.n分解能 * f小節長倍率 * deltatime / ( ( 60 * 4 ) / tempo ) + 0.5 );
57535753
57545754 #region [ Gridを16分音符単位(==12grid単位)でquantizeする ]
57555755 //Debug.Write( "nGrid: " + n小節内Grid + " -> " );
--- /dev/null
+++ b/DTXCreator/コード/05.譜面/CWholeNoteDivision.cs
@@ -0,0 +1,14 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using System.Threading.Tasks;
6+
7+namespace DTXCreator
8+{
9+ public static class CWholeNoteDivision
10+ {
11+ public static int n分解能 = 192;
12+ public static int n分解能_表示用 = 192;
13+ }
14+}
--- a/DTXCreator/コード/05.譜面/C小節.cs
+++ b/DTXCreator/コード/05.譜面/C小節.cs
@@ -1,6 +1,7 @@
11 using System;
22 using System.Collections.Generic;
33 using System.Text;
4+using System.Diagnostics;
45
56 namespace DTXCreator.譜面
67 {
@@ -8,12 +9,13 @@ namespace DTXCreator.譜面
89 {
910 public float f小節長倍率 = 1f;
1011 public List<Cチップ> listチップ = new List<Cチップ>();
11- public static int n基準の高さdot = 0xc0;
12- public static readonly int n基準の高さgrid = 0xc0;
13- public static int n1グリッドの高さdot
12+ public static int n基準の高さdot = CWholeNoteDivision.n分解能_表示用; //0xc0;
13+ public static int n基準の高さgrid = CWholeNoteDivision.n分解能; //0xc0;
14+ public static float n1グリッドの高さdot
1415 {
1516 get
1617 {
18+ //return ( n基準の高さdot < n基準の高さgrid ) ? 1 : (n基準の高さdot / n基準の高さgrid);
1719 return ( n基準の高さdot / n基準の高さgrid );
1820 }
1921 }
@@ -57,7 +59,7 @@ namespace DTXCreator.譜面
5759 }
5860 public int n位置変換count2grid( int nCount )
5961 {
60- return (int) ( ( ( n基準の高さgrid * this.f小節長倍率 ) * nCount ) / 384f );
62+ return (int) ( ( ( n基準の高さgrid * this.f小節長倍率 ) * nCount ) / CWholeNoteDivision.n分解能*2f );
6163 }
6264 public static int n位置変換dot2grid( int nDot )
6365 {
@@ -65,7 +67,7 @@ namespace DTXCreator.譜面
6567 }
6668 public int n位置変換grid2count( int nGrid )
6769 {
68- return (int) ( ( nGrid * 384f ) / ( n基準の高さgrid * this.f小節長倍率 ) );
70+ return (int) ( ( nGrid * CWholeNoteDivision.n分解能*2f ) / ( n基準の高さgrid * this.f小節長倍率 ) );
6971 }
7072 public static int n位置変換grid2dot( int nGrid )
7173 {
--- a/DTXCreator/コード/05.譜面/C譜面管理.cs
+++ b/DTXCreator/コード/05.譜面/C譜面管理.cs
@@ -102,7 +102,7 @@ namespace DTXCreator.譜面
102102 public int nY座標dotが位置するgridを返す_最高解像度( int nY )
103103 {
104104 int num = this._Form.pictureBox譜面パネル.ClientSize.Height - nY;
105- return ( ( num / C小節.n1グリッドの高さdot ) + this.n現在の譜面表示下辺の譜面先頭からの位置grid );
105+ return (int)( ( num / C小節.n1グリッドの高さdot ) + this.n現在の譜面表示下辺の譜面先頭からの位置grid );
106106 }
107107 public int nレーンの左端X座標dotを返す( int nレーン番号0to )
108108 {
@@ -159,7 +159,7 @@ namespace DTXCreator.譜面
159159 public int n譜面先頭からの位置gridから描画領域内のY座標dotを返す( int n譜面先頭からの位置grid, Size sz描画領域dot )
160160 {
161161 int num = n譜面先頭からの位置grid - this.n現在の譜面表示下辺の譜面先頭からの位置grid;
162- return ( sz描画領域dot.Height - ( num * C小節.n1グリッドの高さdot ) );
162+ return (int)( sz描画領域dot.Height - ( num * C小節.n1グリッドの高さdot ) );
163163 }
164164 public int n譜面先頭からみた小節先頭の位置gridを返す( int n小節番号0to3599 )
165165 {
@@ -648,7 +648,7 @@ namespace DTXCreator.譜面
648648 this.strfmtレーン割付チップ番号文字フォーマット.Alignment = StringAlignment.Near;
649649 int h = 0;
650650 int num2 = 0;
651- int num3 = this.n現在の譜面表示下辺の譜面先頭からの位置grid * C小節.n1グリッドの高さdot;
651+ int num3 = (int)(this.n現在の譜面表示下辺の譜面先頭からの位置grid * C小節.n1グリッドの高さdot);
652652 int num4 = num3 + rc可視領域dot.Height;
653653 int maxBar = this.n現在の最大の小節番号を返す();
654654 int bar = 0;
@@ -917,7 +917,7 @@ namespace DTXCreator.譜面
917917 int num = cs.n小節長倍率を考慮した現在の小節の高さgrid;
918918 for( int i = 0; i < num; i += this.n現在のガイド幅grid )
919919 {
920- int num3 = rc小節のPicBox内描画領域.Bottom - ( i * C小節.n1グリッドの高さdot );
920+ int num3 = (int)(rc小節のPicBox内描画領域.Bottom - ( i * C小節.n1グリッドの高さdot ));
921921 g.DrawLine( this.penガイド線ペン, rc小節のPicBox内描画領域.X, num3, rc小節のPicBox内描画領域.Right, num3 );
922922 }
923923 }
@@ -939,7 +939,7 @@ namespace DTXCreator.譜面
939939 continue;
940940 }
941941 rectangle.X = cレーン.n位置Xdot;
942- rectangle.Y = ( rc小節のPicBox内描画領域.Bottom - ( num * C小節.n1グリッドの高さdot ) ) - cチップの高さ.nチップの高さdot;
942+ rectangle.Y = (int)(( rc小節のPicBox内描画領域.Bottom - ( num * C小節.n1グリッドの高さdot ) ) - cチップの高さ.nチップの高さdot);
943943 rectangle.Width = cレーン.n幅dot;
944944 rectangle.Height = cチップの高さ.nチップの高さdot;
945945 if( !cチップ.b裏 )
@@ -1017,7 +1017,7 @@ namespace DTXCreator.譜面
10171017 int num = cs.n小節長倍率を考慮した現在の小節の高さgrid;
10181018 for( int i = 0; i < num; i += C小節.n基準の高さgrid / 4 )
10191019 {
1020- int num3 = rc小節のPicBox内描画領域.Bottom - ( i * C小節.n1グリッドの高さdot );
1020+ int num3 = (int)(rc小節のPicBox内描画領域.Bottom - ( i * C小節.n1グリッドの高さdot ));
10211021 g.DrawLine( this.pen拍線ペン, rc小節のPicBox内描画領域.X, num3, rc小節のPicBox内描画領域.Right, num3 );
10221022 }
10231023 }
--- a/DTXCreator/コード/07.MIDIインポート/CMIDIイベント.cs
+++ b/DTXCreator/コード/07.MIDIインポート/CMIDIイベント.cs
@@ -78,7 +78,7 @@ namespace DTXCreator.MIDIインポート
7878 public override void 挿入( Cメインフォーム mf, int n四分音符の分解能 )
7979 {
8080 mf.mgr譜面管理者.tチップを配置または置換する
81- ( nレーン番号, (int) n時間 * ( 192 / 4 ) / n四分音符の分解能, nWAV, 0f, b裏チャンネル );
81+ ( nレーン番号, (int) n時間 * ( CWholeNoteDivision.n分解能 / 4 ) / n四分音符の分解能, nWAV, 0f, b裏チャンネル );
8282 }
8383 }
8484
@@ -100,7 +100,7 @@ namespace DTXCreator.MIDIインポート
100100
101101 public override void 挿入( Cメインフォーム mf, int n四分音符の分解能 )
102102 {
103- int nGrid = (int) n時間 * ( 192 / 4 ) / n四分音符の分解能;
103+ int nGrid = (int) n時間 * ( CWholeNoteDivision.n分解能 / 4 ) / n四分音符の分解能;
104104 mf.mgr編集モード管理者.tBPMチップを配置する( nGrid, fBPM );
105105 }
106106 }
--- a/DTXCreator/コード/07.MIDIインポート/CMIDIインポートダイアログ.cs
+++ b/DTXCreator/コード/07.MIDIインポート/CMIDIインポートダイアログ.cs
@@ -644,13 +644,13 @@ namespace DTXCreator.MIDIインポート
644644
645645 C小節 c最終小節 = this.formメインフォーム.mgr譜面管理者.p譜面先頭からの位置gridを含む小節を返す( nCurremtMaxBar_FirstGrid );
646646 float fCurrent小節倍率 = (c最終小節 == null) ? 1.0f : c最終小節.f小節長倍率;
647- int nCurrentMaxGrid = nCurremtMaxBar_FirstGrid + (int) ( 192 * fCurrent小節倍率 ) - 1;
647+ int nCurrentMaxGrid = nCurremtMaxBar_FirstGrid + (int) ( CWholeNoteDivision.n分解能 * fCurrent小節倍率 ) - 1;
648648 if ( nCurrentMaxBar < 0 ) nCurrentMaxGrid = -1;
649649
650650 // 拍子変更イベントの絶対時間が、小節外にあれば、新規に小節を一つ追加する。
651651 // 小節長は前の小節長を継承するか、MIDIイベント指定による新しい値にするか。
652652 // 小節を1つ追加しただけでは足りないのであれば、whileループで繰り返し追加し続ける。
653- int nEvent時間 = (int)cm.n時間 * ( 192 / 4 ) / n四分音符の分解能;
653+ int nEvent時間 = (int)cm.n時間 * ( CWholeNoteDivision.n分解能 / 4 ) / n四分音符の分解能;
654654 if ( nCurrentMaxGrid < (int) nEvent時間 )
655655 {
656656 ++nCurrentMaxBar;
--- a/DTXCreator/コード/08.MIDIExport/CMIDIExportDialog.cs
+++ b/DTXCreator/コード/08.MIDIExport/CMIDIExportDialog.cs
@@ -404,7 +404,7 @@ namespace DTXCreator.MIDIExport
404404 #endregion
405405
406406 // 次の小節へ
407- basetick += (ulong)(192.0 * cBAR.f小節長倍率);
407+ basetick += (ulong)(CWholeNoteDivision.n分解能 * cBAR.f小節長倍率);
408408
409409 if (existChipInnerBar) EoTtick = basetick; // 小節内に有意なチップがある限り、その小節は演奏データに含まれるものとする(→データ末尾を定義するtickを更新する)
410410 }
@@ -480,7 +480,7 @@ namespace DTXCreator.MIDIExport
480480 bw.Write(new byte[] { 0x00, 0x01 }); // tracks = 1
481481
482482 {
483- Int16 division = (Int16)(192 / 4);
483+ Int16 division = (Int16)( CWholeNoteDivision.n分解能 / 4);
484484 byte[] b = BitConverter.GetBytes(division);
485485 if (BitConverter.IsLittleEndian) Array.Reverse(b);
486486 bw.Write(new byte[] { b[0], b[1] }); // division of quarter note
Show on old repository browser