This repository has been archived by the owner on Mar 9, 2020. It is now read-only.
forked from kairera0467/TJAP2fPC
-
Notifications
You must be signed in to change notification settings - Fork 546
/
CDTX.cs
8061 lines (7189 loc) · 372 KB
/
CDTX.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Diagnostics;
using System.IO;
using System.Globalization;
using System.Threading;
using System.Text.RegularExpressions;
using FDK;
using FDK.ExtensionMethods;
using TJAPlayer3;
namespace TJAPlayer3
{
internal class CDTX : CActivity
{
// 定数
public enum E種別 { DTX, GDA, G2D, BMS, BME, SMF }
// クラス
public class CAVI : IDisposable
{
public CAvi avi;
private bool bDispose済み;
public int n番号;
public string strコメント文 = "";
public string strファイル名 = "";
public void OnDeviceCreated()
{
#region [ strAVIファイル名の作成。]
//-----------------
string strAVIファイル名;
if (!string.IsNullOrEmpty(TJAPlayer3.DTX.PATH_WAV))
strAVIファイル名 = TJAPlayer3.DTX.PATH_WAV + this.strファイル名;
else
strAVIファイル名 = TJAPlayer3.DTX.strフォルダ名 + this.strファイル名;
//-----------------
#endregion
if (!File.Exists(strAVIファイル名))
{
Trace.TraceWarning("ファイルが存在しません。({0})({1})", this.strコメント文, strAVIファイル名);
this.avi = null;
return;
}
// AVI の生成。
try
{
this.avi = new CAvi(strAVIファイル名);
Trace.TraceInformation("動画を生成しました。({0})({1})({2}frames)", this.strコメント文, strAVIファイル名, this.avi.GetMaxFrameCount());
}
catch (Exception e)
{
Trace.TraceError(e.ToString());
Trace.TraceError("動画の生成に失敗しました。({0})({1})", this.strコメント文, strAVIファイル名);
this.avi = null;
}
}
public override string ToString()
{
return string.Format("CAVI{0}: File:{1}, Comment:{2}", CDTX.tZZ(this.n番号), this.strファイル名, this.strコメント文);
}
#region [ IDisposable 実装 ]
//-----------------
public void Dispose()
{
if (this.bDispose済み)
return;
if (this.avi != null)
{
#region [ strAVIファイル名 の作成。 ]
//-----------------
string strAVIファイル名;
if (!string.IsNullOrEmpty(TJAPlayer3.DTX.PATH_WAV))
strAVIファイル名 = TJAPlayer3.DTX.PATH_WAV + this.strファイル名;
else
strAVIファイル名 = TJAPlayer3.DTX.strフォルダ名 + this.strファイル名;
//-----------------
#endregion
this.avi.Dispose();
this.avi = null;
Trace.TraceInformation("動画を解放しました。({0})({1})", this.strコメント文, strAVIファイル名);
}
this.bDispose済み = true;
}
//-----------------
#endregion
}
public class CAVIPAN
{
public int nAVI番号;
public int n移動時間ct;
public int n番号;
public Point pt動画側開始位置 = new Point(0, 0);
public Point pt動画側終了位置 = new Point(0, 0);
public Point pt表示側開始位置 = new Point(0, 0);
public Point pt表示側終了位置 = new Point(0, 0);
public Size sz開始サイズ = new Size(0, 0);
public Size sz終了サイズ = new Size(0, 0);
public override string ToString()
{
return string.Format("CAVIPAN{0}: AVI:{14}, 開始サイズ:{1}x{2}, 終了サイズ:{3}x{4}, 動画側開始位置:{5}x{6}, 動画側終了位置:{7}x{8}, 表示側開始位置:{9}x{10}, 表示側終了位置:{11}x{12}, 移動時間:{13}ct",
CDTX.tZZ(this.n番号),
this.sz開始サイズ.Width, this.sz開始サイズ.Height,
this.sz終了サイズ.Width, this.sz終了サイズ.Height,
this.pt動画側開始位置.X, this.pt動画側開始位置.Y,
this.pt動画側終了位置.X, this.pt動画側終了位置.Y,
this.pt表示側開始位置.X, this.pt表示側開始位置.Y,
this.pt表示側終了位置.X, this.pt表示側終了位置.Y,
this.n移動時間ct,
CDTX.tZZ(this.nAVI番号));
}
}
public class CDirectShow : IDisposable
{
public FDK.CDirectShow dshow;
private bool bDispose済み;
public int n番号;
public string strコメント文 = "";
public string strファイル名 = "";
public void OnDeviceCreated()
{
#region [ str動画ファイル名の作成。]
//-----------------
string str動画ファイル名;
if (!string.IsNullOrEmpty(TJAPlayer3.DTX.PATH_WAV))
str動画ファイル名 = TJAPlayer3.DTX.PATH_WAV + this.strファイル名;
else
str動画ファイル名 = TJAPlayer3.DTX.strフォルダ名 + this.strファイル名;
//-----------------
#endregion
if (!File.Exists(str動画ファイル名))
{
Trace.TraceWarning("ファイルが存在しません。({0})({1})", this.strコメント文, str動画ファイル名);
this.dshow = null;
}
// AVI の生成。
try
{
this.dshow = new FDK.CDirectShow(TJAPlayer3.stage選曲.r確定されたスコア.ファイル情報.フォルダの絶対パス + this.strファイル名, TJAPlayer3.app.WindowHandle, true);
Trace.TraceInformation("DirectShowを生成しました。({0})({1})({2}byte)", this.strコメント文, str動画ファイル名, this.dshow.nデータサイズbyte);
}
catch (Exception e)
{
Trace.TraceError(e.ToString());
Trace.TraceError("DirectShowの生成に失敗しました。({0})({1})", this.strコメント文, str動画ファイル名);
this.dshow = null;
}
}
public override string ToString()
{
return string.Format("CAVI{0}: File:{1}, Comment:{2}", CDTX.tZZ(this.n番号), this.strファイル名, this.strコメント文);
}
#region [ IDisposable 実装 ]
//-----------------
public void Dispose()
{
if (this.bDispose済み)
return;
if (this.dshow != null)
{
#region [ strAVIファイル名 の作成。 ]
//-----------------
string str動画ファイル名;
if (!string.IsNullOrEmpty(TJAPlayer3.DTX.PATH_WAV))
str動画ファイル名 = TJAPlayer3.DTX.PATH_WAV + this.strファイル名;
else
str動画ファイル名 = TJAPlayer3.DTX.strフォルダ名 + this.strファイル名;
//-----------------
#endregion
this.dshow.Dispose();
this.dshow = null;
Trace.TraceInformation("動画を解放しました。({0})({1})", this.strコメント文, str動画ファイル名);
}
this.bDispose済み = true;
}
//-----------------
#endregion
}
public class CBPM
{
public double dbBPM値;
public double bpm_change_time;
public double bpm_change_bmscroll_time;
public int bpm_change_course;
public int n内部番号;
public int n表記上の番号;
public override string ToString()
{
StringBuilder builder = new StringBuilder(0x80);
if (this.n内部番号 != this.n表記上の番号)
{
builder.Append(string.Format("CBPM{0}(内部{1})", CDTX.tZZ(this.n表記上の番号), this.n内部番号));
}
else
{
builder.Append(string.Format("CBPM{0}", CDTX.tZZ(this.n表記上の番号)));
}
builder.Append(string.Format(", BPM:{0}", this.dbBPM値));
return builder.ToString();
}
}
public class CSCROLL
{
public double dbSCROLL値;
public double dbSCROLL値Y;
public int n内部番号;
public int n表記上の番号;
public override string ToString()
{
StringBuilder builder = new StringBuilder(0x80);
if (this.n内部番号 != this.n表記上の番号)
{
builder.Append(string.Format("CSCROLL{0}(内部{1})", CDTX.tZZ(this.n表記上の番号), this.n内部番号));
}
else
{
builder.Append(string.Format("CSCROLL{0}", CDTX.tZZ(this.n表記上の番号)));
}
builder.Append(string.Format(", SCROLL:{0}", this.dbSCROLL値));
return builder.ToString();
}
}
/// <summary>
/// 判定ライン移動命令
/// </summary>
public class CJPOSSCROLL
{
public double db移動時間;
public int n移動距離px;
public int n移動方向; //移動方向は0(左)、1(右)の2つだけ。
public int n内部番号;
public int n表記上の番号;
public override string ToString()
{
StringBuilder builder = new StringBuilder(0x80);
if (this.n内部番号 != this.n表記上の番号)
{
builder.Append(string.Format("CJPOSSCROLL{0}(内部{1})", CDTX.tZZ(this.n表記上の番号), this.n内部番号));
}
else
{
builder.Append(string.Format("CJPOSSCROLL{0}", CDTX.tZZ(this.n表記上の番号)));
}
builder.Append(string.Format(", JPOSSCROLL:{0}", this.db移動時間));
return builder.ToString();
}
}
public class CDELAY
{
public int nDELAY値; //格納時にはmsになっているため、doubleにはしない。
public int n内部番号;
public int n表記上の番号;
public double delay_time;
public double delay_bmscroll_time;
public double delay_bpm;
public int delay_course;
public override string ToString()
{
StringBuilder builder = new StringBuilder(0x80);
if (this.n内部番号 != this.n表記上の番号)
{
builder.Append(string.Format("CDELAY{0}(内部{1})", CDTX.tZZ(this.n表記上の番号), this.n内部番号));
}
else
{
builder.Append(string.Format("CDELAY{0}", CDTX.tZZ(this.n表記上の番号)));
}
builder.Append(string.Format(", DELAY:{0}", this.nDELAY値));
return builder.ToString();
}
}
public class CBRANCH
{
public int n分岐の種類; //0:精度分岐 1:連打分岐 2:スコア分岐 3:大音符のみの精度分岐
public double n条件数値A;
public double n条件数値B;
public double db分岐時間;
public double db分岐時間ms;
public double db判定時間;
public double dbBMScrollTime;
public double dbBPM;
public double dbSCROLL;
public int n現在の小節;
public int n命令時のChipList番号;
public int n表記上の番号;
public int n内部番号;
public override string ToString()
{
StringBuilder builder = new StringBuilder(0x80);
if (this.n内部番号 != this.n表記上の番号)
{
builder.Append(string.Format("CBRANCH{0}(内部{1})", CDTX.tZZ(this.n表記上の番号), this.n内部番号));
}
else
{
builder.Append(string.Format("CBRANCH{0}", CDTX.tZZ(this.n表記上の番号)));
}
builder.Append(string.Format(", BRANCH:{0}", this.n分岐の種類));
return builder.ToString();
}
}
public class CChip : IComparable<CDTX.CChip>, ICloneable
{
public bool bHit;
public bool b可視 = true;
public bool bShow;
public bool bBranch = false;
public double dbチップサイズ倍率 = 1.0;
public double db実数値;
public double dbBPM;
public double dbSCROLL;
public double dbSCROLL_Y;
public int nコース;
public int nSenote;
public int nState;
public int nRollCount;
public int nBalloon;
public int nProcessTime;
public int nスクロール方向;
public int n描画優先度; //(特殊)現状連打との判断目的で使用
public ENoteState eNoteState;
public EAVI種別 eAVI種別;
public E楽器パート e楽器パート = E楽器パート.UNKNOWN;
public int nチャンネル番号;
public STDGBVALUE<int> nバーからの距離dot;
public STDGBVALUE<int> nバーからのノーツ末端距離dot;
public int n整数値;
public int n整数値_内部番号;
public int n総移動時間;
public int n透明度 = 0xff;
public int n発声位置;
public double db発声位置; // 発声時刻を格納していた変数のうちの1つをfloat型からdouble型に変更。(kairera0467)
public double fBMSCROLLTime;
public double fBMSCROLLTime_end;
public int n発声時刻ms;
public double db発声時刻ms;
public int nノーツ終了位置;
public int nノーツ終了時刻ms;
public int nノーツ出現時刻ms;
public int nノーツ移動開始時刻ms;
public int n分岐回数;
public int n連打音符State;
public int nLag; // 2011.2.1 yyagi
public CDTX.CAVI rAVI;
public CDTX.CAVIPAN rAVIPan;
public CDTX.CDirectShow rDShow;
public double db発声時刻;
public double db判定終了時刻;//連打系音符で使用
public double dbProcess_Time;
public int nPlayerSide;
public bool bGOGOTIME = false; //2018.03.11 k1airera0467 ゴーゴータイム内のチップであるか
public int nList上の位置;
public bool IsFixedSENote;
public bool IsHitted = false;
public bool bBPMチップである
{
get
{
if (this.nチャンネル番号 == 3 || this.nチャンネル番号 == 8)
{
return true;
}
else
{
return false;
}
}
}
public bool bWAVを使うチャンネルである
{
get
{
switch (this.nチャンネル番号)
{
case 0x01:
return true;
}
return false;
}
}
public bool b自動再生音チャンネルである
{
get
{
int num = this.nチャンネル番号;
if ((((num != 1) && ((0x61 > num) || (num > 0x69))) && ((0x70 > num) || (num > 0x79))) && ((0x80 > num) || (num > 0x89)))
{
return ((0x90 <= num) && (num <= 0x92));
}
return true;
}
}
public bool b演奏終了後も再生が続くチップである; // #32248 2013.10.14 yyagi
public CCounter RollDelay; // 18.9.22 AioiLight Add 連打時に赤くなるやつのタイマー
public CCounter RollInputTime; // 18.9.22 AioiLight Add 連打入力後、RollDelayが作動するまでのタイマー
public int RollEffectLevel; // 18.9.22 AioiLight Add 連打時に赤くなるやつの度合い
public CChip()
{
this.nバーからの距離dot = new STDGBVALUE<int>()
{
Drums = 0,
Guitar = 0,
Bass = 0,
};
}
public void t初期化()
{
this.bBranch = false;
this.nチャンネル番号 = 0;
this.n整数値 = 0; //整数値をList上の番号として用いる。
this.n整数値_内部番号 = 0;
this.db実数値 = 0.0;
this.n発声位置 = 0;
this.db発声位置 = 0.0D;
this.n発声時刻ms = 0;
this.db発声時刻ms = 0.0D;
this.fBMSCROLLTime = 0;
this.nノーツ終了位置 = 0;
this.nノーツ終了時刻ms = 0;
this.n描画優先度 = 0;
this.nLag = -999;
this.b演奏終了後も再生が続くチップである = false;
this.nList上の位置 = 0;
this.dbチップサイズ倍率 = 1.0;
this.bHit = false;
this.b可視 = true;
this.e楽器パート = E楽器パート.UNKNOWN;
this.n透明度 = 0xff;
this.nバーからの距離dot.Drums = 0;
this.nバーからの距離dot.Guitar = 0;
this.nバーからの距離dot.Bass = 0;
this.nバーからの距離dot.Taiko = 0;
this.nバーからのノーツ末端距離dot.Drums = 0;
this.nバーからのノーツ末端距離dot.Guitar = 0;
this.nバーからのノーツ末端距離dot.Bass = 0;
this.nバーからのノーツ末端距離dot.Taiko = 0;
this.n総移動時間 = 0;
this.dbBPM = 120.0;
this.nスクロール方向 = 0;
this.dbSCROLL = 1.0;
this.dbSCROLL_Y = 0.0f;
}
public override string ToString()
{
//2016.10.07 kairera0467 近日中に再編成予定
string[] chToStr =
{
//システム
"??", "バックコーラス", "小節長変更", "BPM変更", "??", "??", "??", "??",
"BPM変更(拡張)", "??", "??", "??", "??", "??", "??", "??",
//太鼓1P(移動予定)
"??", "ドン", "カツ", "ドン(大)", "カツ(大)", "連打", "連打(大)", "ふうせん連打",
"連打終点", "芋", "ドン(手)", "カッ(手)", "??", "??", "??", "AD-LIB",
//太鼓予備
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
//太鼓予備
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
//太鼓予備
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
//システム
"小節線", "拍線", "??", "??", "AVI", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
//システム(移動予定)
"SCROLL", "DELAY", "ゴーゴータイム開始", "ゴーゴータイム終了", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
//太鼓1P、システム(現行)
"??", "??", "??", "太鼓_赤", "太鼓_青", "太鼓_赤(大)", "太鼓_青(大)", "太鼓_黄",
"太鼓_黄(大)", "太鼓_風船", "太鼓_連打末端", "太鼓_芋", "??", "SCROLL", "ゴーゴータイム開始", "ゴーゴータイム終了",
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "太鼓 AD-LIB",
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "??", "??", "0xC4", "0xC5", "0xC6", "??",
"??", "??", "0xCA", "??", "??", "??", "??", "0xCF",
//システム(現行)
"0xD0", "??", "??", "??", "??", "??", "??", "??",
"??", "??", "ミキサー追加", "ミキサー削除", "DELAY", "譜面分岐リセット", "譜面分岐アニメ", "譜面分岐内部処理",
//システム(現行)
"小節線ON/OFF", "分岐固定", "判定枠移動", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"0xF0", "歌詞", "??", "SUDDEN", "??", "??", "??", "??",
"??", "??", "??", "??", "??", "??", "??", "??", "譜面終了"
};
return string.Format("CChip: 位置:{0:D4}.{1:D3}, 時刻{2:D6}, Ch:{3:X2}({4}), Pn:{5}({11})(内部{6}), Pd:{7}, Sz:{8}, BMScroll:{9}, Auto:{10}, コース:{11}",
this.n発声位置 / 384, this.n発声位置 % 384,
this.n発声時刻ms,
this.nチャンネル番号, chToStr[this.nチャンネル番号],
this.n整数値, this.n整数値_内部番号,
this.db実数値,
this.dbチップサイズ倍率,
this.fBMSCROLLTime,
this.b自動再生音チャンネルである,
this.nコース,
CDTX.tZZ(this.n整数値));
}
/// <summary>
/// チップの再生長を取得する。現状、WAVチップとBGAチップでのみ使用可能。
/// </summary>
/// <returns>再生長(ms)</returns>
public int GetDuration()
{
int nDuration = 0;
if (this.bWAVを使うチャンネルである) // WAV
{
CDTX.CWAV wc;
TJAPlayer3.DTX.listWAV.TryGetValue(this.n整数値_内部番号, out wc);
if (wc == null)
{
nDuration = 0;
}
else
{
nDuration = (wc.rSound[0] == null) ? 0 : wc.rSound[0].n総演奏時間ms;
}
}
else if (this.nチャンネル番号 == 0x54) // AVI
{
if (this.rAVI != null && this.rAVI.avi != null)
{
int dwRate = (int)this.rAVI.avi.dwレート;
int dwScale = (int)this.rAVI.avi.dwスケール;
nDuration = (int)(1000.0f * dwScale / dwRate * this.rAVI.avi.GetMaxFrameCount());
}
}
double _db再生速度 = (TJAPlayer3.DTXVmode.Enabled) ? TJAPlayer3.DTX.dbDTXVPlaySpeed : TJAPlayer3.DTX.db再生速度;
return (int)(nDuration / _db再生速度);
}
#region [ IComparable 実装 ]
//-----------------
private static readonly byte[] n優先度 = new byte[] {
5, 5, 3, 7, 5, 5, 5, 5, 3, 5, 5, 5, 5, 5, 5, 5, //0x00
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0x10
7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, //0x20
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0x30
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0x40
9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0x50
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0x60
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0x70
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0x80
5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, //0x90
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0xA0
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0xB0
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0xC0
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 4, 4, //0xD0
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0xE0
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, //0xF0
};
public int CompareTo(CDTX.CChip other)
{
// まずは位置で比較。
//BGMチップだけ発声位置
//if( this.nチャンネル番号 == 0x01 || this.nチャンネル番号 == 0x02 )
//{
// if( this.n発声位置 < other.n発声位置 )
// return -1;
// if( this.n発声位置 > other.n発声位置 )
// return 1;
//}
//if( this.n発声位置 < other.n発声位置 )
// return -1;
//if( this.n発声位置 > other.n発声位置 )
// return 1;
//譜面解析メソッドV4では発声時刻msで比較する。
var n発声時刻msCompareToResult = 0;
n発声時刻msCompareToResult = this.n発声時刻ms.CompareTo(other.n発声時刻ms);
if (n発声時刻msCompareToResult != 0)
{
return n発声時刻msCompareToResult;
}
n発声時刻msCompareToResult = this.db発声時刻ms.CompareTo(other.db発声時刻ms);
if (n発声時刻msCompareToResult != 0)
{
return n発声時刻msCompareToResult;
}
// 位置が同じなら優先度で比較。
return n優先度[this.nチャンネル番号].CompareTo(n優先度[other.nチャンネル番号]);
}
//-----------------
#endregion
/// <summary>
/// shallow copyです。
/// </summary>
/// <returns></returns>
public object Clone()
{
return MemberwiseClone();
}
}
public class CWAV : IDisposable
{
public bool bBGMとして使う;
public List<int> listこのWAVを使用するチャンネル番号の集合 = new List<int>(16);
public int nチップサイズ = 100;
public int n位置;
public long[] n一時停止時刻 = new long[TJAPlayer3.ConfigIni.nPoliphonicSounds]; // 4
public int SongVol = CSound.DefaultSongVol;
public LoudnessMetadata? SongLoudnessMetadata = null;
public int n現在再生中のサウンド番号;
public long[] n再生開始時刻 = new long[TJAPlayer3.ConfigIni.nPoliphonicSounds]; // 4
public int n内部番号;
public int n表記上の番号;
public CSound[] rSound = new CSound[TJAPlayer3.ConfigIni.nPoliphonicSounds]; // 4
public string strコメント文 = "";
public string strファイル名 = "";
public bool bBGMとして使わない
{
get
{
return !this.bBGMとして使う;
}
set
{
this.bBGMとして使う = !value;
}
}
public bool bIsBassSound = false;
public bool bIsGuitarSound = false;
public bool bIsDrumsSound = false;
public bool bIsSESound = false;
public bool bIsBGMSound = false;
public override string ToString()
{
var sb = new StringBuilder(128);
if (this.n表記上の番号 == this.n内部番号)
{
sb.Append(string.Format("CWAV{0}: ", CDTX.tZZ(this.n表記上の番号)));
}
else
{
sb.Append(string.Format("CWAV{0}(内部{1}): ", CDTX.tZZ(this.n表記上の番号), this.n内部番号));
}
sb.Append(
$"{nameof(SongVol)}:{this.SongVol}, {nameof(LoudnessMetadata.Integrated)}:{this.SongLoudnessMetadata?.Integrated}, {nameof(LoudnessMetadata.TruePeak)}:{this.SongLoudnessMetadata?.TruePeak}, 位置:{this.n位置}, サイズ:{this.nチップサイズ}, BGM:{(this.bBGMとして使う ? 'Y' : 'N')}, File:{this.strファイル名}, Comment:{this.strコメント文}");
return sb.ToString();
}
#region [ Dispose-Finalize パターン実装 ]
//-----------------
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
public void Dispose(bool bManagedリソースの解放も行う)
{
if (this.bDisposed済み)
return;
if (bManagedリソースの解放も行う)
{
for (int i = 0; i < TJAPlayer3.ConfigIni.nPoliphonicSounds; i++) // 4
{
if (this.rSound[i] != null)
TJAPlayer3.Sound管理.tサウンドを破棄する(this.rSound[i]);
this.rSound[i] = null;
if ((i == 0) && TJAPlayer3.ConfigIni.bLog作成解放ログ出力)
Trace.TraceInformation("サウンドを解放しました。({0})({1})", this.strコメント文, this.strファイル名);
}
}
this.bDisposed済み = true;
}
~CWAV()
{
this.Dispose(false);
}
//-----------------
#endregion
#region [ private ]
//-----------------
private bool bDisposed済み;
//-----------------
#endregion
}
public class DanSongs
{
public CTexture TitleTex;
public CTexture SubTitleTex;
public string Title;
public string SubTitle;
public string FileName;
public string Genre;
public int ScoreInit;
public int ScoreDiff;
public static int Number;
public CWAV Wave;
public DanSongs()
{
Number++;
}
}
// 構造体
public struct STLANEINT
{
public int HH;
public int SD;
public int BD;
public int HT;
public int LT;
public int CY;
public int FT;
public int HHO;
public int RD;
public int LC;
public int LP;
public int LBD;
public int Drums
{
get
{
return this.HH + this.SD + this.BD + this.HT + this.LT + this.CY + this.FT + this.HHO + this.RD + this.LC + this.LP + this.LBD;
}
}
public int Guitar;
public int Bass;
public int Taiko_Red;
public int Taiko_Blue;
public int this[int index]
{
get
{
switch (index)
{
case 0:
return this.HH;
case 1:
return this.SD;
case 2:
return this.BD;
case 3:
return this.HT;
case 4:
return this.LT;
case 5:
return this.CY;
case 6:
return this.FT;
case 7:
return this.HHO;
case 8:
return this.RD;
case 9:
return this.LC;
case 10:
return this.LP;
case 11:
return this.LBD;
case 12:
return this.Guitar;
case 13:
return this.Bass;
case 14:
return this.Taiko_Red;
case 15:
return this.Taiko_Blue;
}
throw new IndexOutOfRangeException();
}
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException();
}
switch (index)
{
case 0:
this.HH = value;
return;
case 1:
this.SD = value;
return;
case 2:
this.BD = value;
return;
case 3:
this.HT = value;
return;
case 4:
this.LT = value;
return;
case 5:
this.CY = value;
return;
case 6:
this.FT = value;
return;
case 7:
this.HHO = value;
return;
case 8:
this.RD = value;
return;
case 9:
this.LC = value;
return;
case 10:
this.LP = value;
return;
case 11:
this.LBD = value;
return;
case 12:
this.Guitar = value;
return;
case 13:
this.Bass = value;
return;
case 14:
this.Taiko_Red = value;
return;
case 15:
this.Taiko_Blue = value;
return;
}
throw new IndexOutOfRangeException();
}
}
}
public struct STRESULT
{
public string SS;
public string S;
public string A;
public string B;
public string C;
public string D;
public string E;
public string this[int index]
{
get
{
switch (index)
{
case 0:
return this.SS;
case 1:
return this.S;
case 2:
return this.A;
case 3:
return this.B;
case 4:
return this.C;
case 5:
return this.D;
case 6:
return this.E;
}
throw new IndexOutOfRangeException();
}
set
{
switch (index)
{
case 0:
this.SS = value;
return;
case 1:
this.S = value;
return;
case 2:
this.A = value;
return;
case 3:
this.B = value;
return;
case 4:
this.C = value;
return;
case 5:
this.D = value;
return;
case 6:
this.E = value;