using System.IO;
using System.Diagnostics;
using System.Threading;
+using System.Threading.Tasks;
+
using SharpDX;
using SharpDX.Direct3D9;
using FDK;
STDGBSValue<CScoreIni.C演奏記録> record;
+ long nLastSendMessageTime;
+
+#if TEST_MEASUREFRAMEDRAWTIME
+ Stopwatch sw = new Stopwatch();
+ List<long> swlist = new List<long>(100000);
+ List<long> tmlist = new List<long>(100000);
+#endif
+
public CStage演奏画面共通()
{
base.eステージID = CStage.Eステージ.演奏;
// 効果音のストリームをミキサーから解除しておく
CDTXMania.Instance.Skin.tRemoveMixerAll();
queueMixerSound = new Queue<STMixer>(64);
- bIsDirectSound = (CDTXMania.Instance.Sound管理.GetCurrentSoundDeviceType() == "DirectSound");
+ bIsDirectSound = (CDTXMania.Instance.Sound管理.CurrentSoundDeviceType == ESoundDeviceType.DirectSound);
this.bPAUSE = false;
if (CDTXMania.Instance.DTXVmode.Enabled)
db再生速度 = ((double)CDTXMania.Instance.ConfigIni.nPlaySpeed) / 20.0;
}
- bValidScore = (CDTXMania.Instance.DTXVmode.Enabled) ? false : true;
+ bValidScore = (CDTXMania.Instance.DTXVmode.Enabled || CDTXMania.Instance.DTX2WAVmode.Enabled) ? false : true;
cWailingChip = new CWailingChip共通[3];
// 0:未使用, 1:Gutiar, 2:Bass
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)
{
}
#endregion
+
if (CDTXMania.Instance.ConfigIni.bIsSwappedGuitarBass) // #24063 2011.1.24 yyagi Gt/Bsの譜面情報入れ替え
{
CDTXMania.Instance.DTX.SwapGuitarBassInfos();
strPanel += " (" + strLabel + ")";
}
this.actPanel.SetPanelString( strPanel );
+
+ nLastSendMessageTime = 0;
+
+#if TEST_MEASUREFRAMEDRAWTIME
+ swlist.Clear();
+ swlist.Capacity = 100000;
+ sw.Reset();
+ sw.Start();
+ tmlist.Clear();
+ tmlist.Capacity = 100000;
+#endif
}
}
public override void On非活性化()
cInvisibleChip.Dispose();
cInvisibleChip = null;
base.On非活性化();
+
+#if TEST_MEASUREFRAMEDRAWTIME
+ sw.Stop();
+ Trace.TraceInformation("Freq={0:F10}", Stopwatch.Frequency);
+ Trace.TraceInformation("IsHighResolution=" + Stopwatch.IsHighResolution);
+ Trace.TraceInformation("Count=" + swlist.Count );
+ double last_d = 0;
+ long last_t = 0;
+ int p = 0;
+ foreach (long l in swlist)
+ {
+ double d = (double)l / Stopwatch.Frequency;
+ double d2 = d - last_d;
+ long t = tmlist[p++];
+ long t2 = t - last_t;
+ Trace.TraceInformation("{0:F10}, {1:F10}, {2:d6}, {3:d3}", d, d2, t, t2);
+ last_d = d;
+ last_t = t;
+ }
+ swlist.Clear();
+#endif
}
}
public override void OnManagedリソースの作成()
}
}
- // AVI / BGA
if (base.eフェーズID != CStage.Eフェーズ.演奏_STAGE_FAILED &&
base.eフェーズID != CStage.Eフェーズ.演奏_STAGE_FAILED_フェードアウト)
{
- actAVI.t進行描画(
- CDTXMania.Instance.ConfigIni.cdMovieX[CDTXMania.Instance.ConfigIni.eActiveInst],
- CDTXMania.Instance.ConfigIni.cdMovieY[CDTXMania.Instance.ConfigIni.eActiveInst],
- CDTXMania.Instance.Coordinates.Movie.W,
- CDTXMania.Instance.Coordinates.Movie.H);
+ // AVI / BGA
+ //actAVI.t進行描画(
+ // CDTXMania.Instance.ConfigIni.cdAVIX[CDTXMania.Instance.ConfigIni.eActiveInst],
+ // CDTXMania.Instance.ConfigIni.cdAVIY[CDTXMania.Instance.ConfigIni.eActiveInst],
+ // CDTXMania.Instance.Coordinates.Movie.W,
+ // CDTXMania.Instance.Coordinates.Movie.H);
+ actAVI.t進行描画();
actBGA.On進行描画();
#region [MIDIBGM 処理?]
if (base.eフェーズID != CStage.Eフェーズ.演奏_STAGE_FAILED)
CStage.Eフェーズ eフェーズid1 = base.eフェーズID;
}
#endregion
- actLane.On進行描画();
- actLaneFlushGB.On進行描画();
- actPanel.On進行描画();
- actScore.On進行描画();
- actOptionPanel.On進行描画();
- actGauge.On進行描画();
- actGraph.On進行描画();
- actLaneFlushD.On進行描画();
- actDANGER.t進行描画(actGauge.IsDanger);
- act譜面スクロール速度.On進行描画();
+ if (!CDTXMania.Instance.DTX2WAVmode.Enabled)
+ {
+ actLane.On進行描画();
+ actLaneFlushGB.On進行描画();
+ actPanel.On進行描画();
+ actScore.On進行描画();
+ actOptionPanel.On進行描画();
+ actGauge.On進行描画();
+ actGraph.On進行描画();
+ actLaneFlushD.On進行描画();
+ if (CDTXMania.Instance.ConfigIni.bStageFailed) // #38693 2018.10.30 yyagi red-flashing only when StageFailed=ON
+ {
+ actDANGER.t進行描画(actGauge.IsDanger);
+ }
+ }
+ act譜面スクロール速度.On進行描画();
t進行描画_判定ライン();
actWailingBonus.On進行描画();
// RGB, Judge, Combo (Priority Under Chip)
if (CDTXMania.Instance.ConfigIni.eJudgePriority == EJudgeDisplayPriority.Under)
{
- actRGB.On進行描画();
actJudgeString.On進行描画();
actCombo.On進行描画();
}
// RGB, Judge, Combo (Priority Over Chip)
if (CDTXMania.Instance.ConfigIni.eJudgePriority == EJudgeDisplayPriority.Over)
{
- actRGB.On進行描画();
actJudgeString.On進行描画();
actCombo.On進行描画();
}
-
- actChipFireD.On進行描画();
- actChipFireGB.On進行描画();
- actPlayInfo.On進行描画();
+ actRGB.On進行描画();
+ if (!CDTXMania.Instance.DTX2WAVmode.Enabled)
+ {
+ actChipFireD.On進行描画();
+ actChipFireGB.On進行描画();
+ actPlayInfo.On進行描画();
+ }
// Wailing
if ((CDTXMania.Instance.ConfigIni.eDark != EDark.Full) &&
Thread.Sleep(5);
// DTXCからの次のメッセージを待ち続ける
}
+ else if (CDTXMania.Instance.DTX2WAVmode.Enabled)
+ {
+ // すべての再生が終わるのを待って、録音を終了し、アプリを終了する
+ bool bPlaying = true;
+ while (bPlaying)
+ {
+ bPlaying = CDTXMania.Instance.DTX.tWavのいずれかが再生中();
+ if (bPlaying)
+ {
+ Thread.Sleep(5);
+ }
+ }
+
+ FDK.CSound管理.t録音終了();
+
+ this.eフェードアウト完了時の戻り値 = E演奏画面の戻り値.演奏中断;
+ base.eフェーズID = CStage.Eフェーズ.共通_終了状態;
+ return (int)this.eフェードアウト完了時の戻り値;
+ }
else
{
this.eフェードアウト完了時の戻り値 = E演奏画面の戻り値.ステージクリア;
return (int)this.eフェードアウト完了時の戻り値;
}
+ // DTX2WAVに進捗状況を送信。1秒ごとに1回ずつ送信する。
+ if (CDTXMania.Instance.DTX2WAVmode.Enabled)
+ {
+ if (nLastSendMessageTime + 1000 < CDTXMania.Instance.Timer.n現在時刻)
+ {
+ int nEstimateTimeMs = (CDTXMania.Instance.DTX.listChip.Count > 0) ? CDTXMania.Instance.DTX.listChip[CDTXMania.Instance.DTX.listChip.Count - 1].n発声時刻ms : 0;
+ CDTXMania.Instance.DTX2WAVmode.SendMessage2DTX2WAV("TIME," + CDTXMania.Instance.Timer.n現在時刻.ToString() + "," + nEstimateTimeMs.ToString());
+ nLastSendMessageTime = CDTXMania.Instance.Timer.n現在時刻;
+ }
+ }
+
ManageMixerQueue();
// キー入力
{
this.tキー入力();
}
+
+#if TEST_MEASUREFRAMEDRAWTIME
+ swlist.Add(sw.ElapsedTicks);
+ tmlist.Add(CSound管理.rc演奏用タイマ.n現在時刻ms);
+#endif
}
return 0;
}
STMixer stm = queueMixerSound.Dequeue();
if (stm.bIsAdd)
{
- CDTXMania.Instance.Sound管理.AddMixer(stm.csound, db再生速度, stm.b演奏終了後も再生が続くチップである);
+ // var task = Task.Run(() =>
+ // {
+ CDTXMania.Instance.Sound管理.AddMixer(stm.csound, db再生速度, stm.b演奏終了後も再生が続くチップである);
+ // });
}
else
{
- CDTXMania.Instance.Sound管理.RemoveMixer(stm.csound);
+ // var task = Task.Run(() =>
+ // {
+ CDTXMania.Instance.Sound管理.RemoveMixer(stm.csound);
+ // });
}
}
}
if (saveLag)
{
pChip.nLag = lag;
+//Trace.TraceInformation($"lag={lag}, chip={pChip.n整数値.ToString("x2")}");
// #23580 2011.1.3 yyagi: add "nInputAdjustTime" to add input timing adjust feature
if (pChip.e楽器パート != EPart.Unknown)
{
{
// 検索対象が過去未来どちらにも見つからなかった
}
- else if (idxPast >= 0)
+ else if (idxPast >= 0 && idxFuture < 0)
{
- // é\81\8eå\8e»æ\96¹å\90\91ã\81«ã\81¯見つかった
+ // é\81\8eå\8e»æ\96¹å\90\91ã\81«ã\81®ã\81¿見つかった
ret = CDTXMania.Instance.DTX.listChip[idxPast];
}
- else if (idxFuture >= 0)
+ else if (idxFuture >= 0 && idxPast < 0)
{
- // æ\9cªæ\9d¥æ\96¹å\90\91ã\81«ã\81¯見つかった
+ // æ\9cªæ\9d¥æ\96¹å\90\91ã\81«ã\81®ã\81¿見つかった
ret = CDTXMania.Instance.DTX.listChip[idxFuture];
}
else
if (nTimeDiff_Future < nTimeDiff_Past)
{
ret = CDTXMania.Instance.DTX.listChip[idxFuture];
+ // ここは、必要に応じて、過去チップを優先させる条件を追加した方がbetter??
}
else
{
private void t入力処理_ドラム()
{
for (EPad ePad = EPad.DrumsPadMin; ePad < EPad.DrumsPadMax; ePad++) // #27029 2012.1.4 from: <10 to <=10; Eパッドの要素が1つ(HP)増えたため。
- // 2012.1.5 yyagi: (int)Eパッド.MAX に変更。Eパッドの要素数への依存を無くすため。
+ // 2012.1.5 yyagi: (int)Eパッド.MAX に変更。Eパッドの要素数への依存を無くすため。
{
List<STInputEvent> listInputEvent = CDTXMania.Instance.Pad.GetEvents(ePad);
}
private int nStartTime_ = 0;
+ private DateTime dtCurrentDateTime = DateTime.MinValue;
protected void tキー入力()
{
CDTXMania.Instance.ConfigIni.nJudgeLinePosOffset.Guitar.Value =
CDTXMania.Instance.ConfigIni.nJudgeLinePosOffset.Bass.Value = nVal;
}
- else if ((base.eフェーズID == CStage.Eフェーズ.共通_通常状態) &&
- (keyboard.bキーが押された((int)SlimDXKey.Escape) ||
- CDTXMania.Instance.Pad.bCancelPadIsPressedGB()))
+ else if (base.eフェーズID == CStage.Eフェーズ.共通_通常状態)
{
- // escape (exit)
- this.actFO.tフェードアウト開始();
- base.eフェーズID = CStage.Eフェーズ.共通_フェードアウト;
- this.eフェードアウト完了時の戻り値 = E演奏画面の戻り値.演奏中断;
+ if (CDTXMania.Instance.Pad.bCancelPadIsPressingGB())
+ {
+ if (dtCurrentDateTime == DateTime.MinValue)
+ {
+ dtCurrentDateTime = DateTime.Now;
+ }
+ else if ( DateTime.Now - dtCurrentDateTime > TimeSpan.FromMilliseconds(1000)) // #40847 keep pushing Cancel 1sec to exit
+ {
+ // escape (exit)
+ this.actFO.tフェードアウト開始();
+ base.eフェーズID = CStage.Eフェーズ.共通_フェードアウト;
+ this.eフェードアウト完了時の戻り値 = E演奏画面の戻り値.演奏中断;
+ }
+ }
+ else
+ {
+ dtCurrentDateTime = DateTime.MinValue;
+ }
+
+ if (keyboard.bキーが押された((int)SlimDXKey.Escape))
+ {
+ // escape (exit)
+ this.actFO.tフェードアウト開始();
+ base.eフェーズID = CStage.Eフェーズ.共通_フェードアウト;
+ this.eフェードアウト完了時の戻り値 = E演奏画面の戻り値.演奏中断;
+ }
}
}
}
{
this.t進行描画_チップ_フィルイン(ref pChip);
}
- else if (pChip.bMovie && !pChip.bHit && (pChip.nバーからの距離dot.Drums < 0))
+ else if (pChip.bMovie && !pChip.bHit && (pChip.nバーからの距離dot.Drums < 0)) // 動画全般
{
pChip.bHit = true;
if (CDTXMania.Instance.ConfigIni.bAVI)
{
this.actAVI.bHasBGA = true;
}
- if (pChip.eチャンネル番号 == EChannel.MovieFull || CDTXMania.Instance.ConfigIni.bFullAVI)
+ //this.actAVI.bFullScreenMovieCentering = (pChip.eチャンネル番号 == EChannel.MovieFull) ? true : CDTXMania.Instance.ConfigIni.bForceFullMovieCentering.Both;
+ //this.actAVI.bFullScreenMovieCentering = true;
+ //if (CDTXMania.Instance.ConfigIni.bForceScalingAVI)
+ //{
+ // //if (!this.actAVI.bFullScreenMovieCentering)
+ // //{
+ // this.actAVI.nFullScreenMovieX = CDTXMania.Instance.ConfigIni.cdForceScaledMovieX.Both;
+ // this.actAVI.nFullScreenMovieY = CDTXMania.Instance.ConfigIni.cdForceScaledMovieY.Both;
+ // //}
+ //}
+ //if (pChip.eチャンネル番号 == EChannel.MovieFull || CDTXMania.Instance.ConfigIni.bForceScalingAVI)
+ if (pChip.eチャンネル番号 == EChannel.MovieFull)
{
this.actAVI.bFullScreenMovie = true;
}
+ else
+ {
+ this.actAVI.bFullScreenMovie = false;
+ }
+
+ this.actAVI.SetXYWH();
+
+ int startWidth = !this.actAVI.bFullScreenMovie ? 278 : SampleFramework.GameWindowSize.Width;
+ int startHeight = !this.actAVI.bFullScreenMovie ? 355 : SampleFramework.GameWindowSize.Height;
+
switch (pChip.eAVI種別)
{
case EAVIType.AVI:
{
- int startWidth = !this.actAVI.bFullScreenMovie ? 278 : SampleFramework.GameWindowSize.Width;
- int startHeight = !this.actAVI.bFullScreenMovie ? 355 : SampleFramework.GameWindowSize.Height;
- this.actAVI.Start(pChip.eチャンネル番号, pChip.rAVI, startWidth, startHeight, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pChip.n発声時刻ms);
+
+ this.actAVI.Start(pChip.eチャンネル番号, pChip.rAVI, startWidth, startHeight, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, pChip.n発声時刻ms, true);
}
break;
case EAVIType.AVIPAN:
if (pChip.rAVIPan != null)
{
- this.actAVI.Start(pChip.eチャンネル番号, pChip.rAVI, pChip.rAVIPan.sz開始サイズ.Width, pChip.rAVIPan.sz開始サイズ.Height, pChip.rAVIPan.sz終了サイズ.Width, pChip.rAVIPan.sz終了サイズ.Height, pChip.rAVIPan.pt動画側開始位置.X, pChip.rAVIPan.pt動画側開始位置.Y, pChip.rAVIPan.pt動画側終了位置.X, pChip.rAVIPan.pt動画側終了位置.Y, pChip.rAVIPan.pt表示側開始位置.X, pChip.rAVIPan.pt表示側開始位置.Y, pChip.rAVIPan.pt表示側終了位置.X, pChip.rAVIPan.pt表示側終了位置.Y, pChip.n総移動時間, pChip.n発声時刻ms);
+ this.actAVI.Start(pChip.eチャンネル番号, pChip.rAVI, pChip.rAVIPan.sz開始サイズ.Width, pChip.rAVIPan.sz開始サイズ.Height, pChip.rAVIPan.sz終了サイズ.Width, pChip.rAVIPan.sz終了サイズ.Height, pChip.rAVIPan.pt動画側開始位置.X, pChip.rAVIPan.pt動画側開始位置.Y, pChip.rAVIPan.pt動画側終了位置.X, pChip.rAVIPan.pt動画側終了位置.Y, pChip.rAVIPan.pt表示側開始位置.X, pChip.rAVIPan.pt表示側開始位置.Y, pChip.rAVIPan.pt表示側終了位置.X, pChip.rAVIPan.pt表示側終了位置.Y, pChip.n総移動時間, pChip.n発声時刻ms, true);
}
break;
}
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)
{
{
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)
{
{
switch (pChip.n整数値)
{
- case 1:
+ case (int)EClickSoundType.High:
CDTXMania.Instance.Skin.soundClickHigh.t再生する();
break;
- case 2:
+ case (int)EClickSoundType.Low:
CDTXMania.Instance.Skin.soundClickLow.t再生する();
break;
+ case (int)EClickSoundType.Bottom:
+ CDTXMania.Instance.Skin.soundClickBottom.t再生する();
+ break;
}
}
}
+ else if (pChip[EChannel.FirstSoundChip] && !pChip.bHit && (pChip.nバーからの距離dot.Drums < 0))
+ {
+ pChip.bHit = true;
+ if (CDTXMania.Instance.DTX2WAVmode.Enabled)
+ {
+ FDK.CSound管理.t録音開始();
+ Trace.TraceInformation("録音を開始しました。");
+ }
+ }
else if ( !pChip.bHit && ( pChip.nバーからの距離dot.Drums < 0 ) )
{
// other chips
return false;
}
+
public void t再読込()
{
CDTXMania.Instance.DTX.t全チップの再生停止とミキサーからの削除();
/// </summary>
protected void tDTXV用の設定()
{
- for (EPad i = EPad.Min; i < EPad.Max; ++i)
+ for (EPad i = EPad.Min; i < EPad.BassPadMax; ++i)
{
CDTXMania.Instance.ConfigIni.bAutoPlay[i].Value = true;
}
CDTXMania.Instance.ConfigIni.bBGMPlay.Value = true;
CDTXMania.Instance.ConfigIni.nRisky.Value = 0;
CDTXMania.Instance.ConfigIni.nShowLagType.Value = EShowLagType.Off;
+ //CDTXMania.Instance.ConfigIni.bForceScalingAVI.Value = false; // DTXVモード時の各種表示要素の表示座標を「譜面制作者のカスタマイズ状態」にするか「DTXMania初期状態」にするかで
+ // 悩みました。
}
private void t進行描画_チップ_ウェイリング(ref CChip pChip)
{
- if (CDTXMania.Instance.ConfigIni.bGuitar有効)
+ if (CDTXMania.Instance.ConfigIni.bGuitar有効 && (!CDTXMania.Instance.DTX2WAVmode.Enabled))
{
EPart indexInst = pChip.bGuitar可視チップ_Wailing含む ? EPart.Guitar : EPart.Bass;
#region [ Sud Hid Inv 処理 ]
rChip = pChip;
}
}
- this.tサウンド再生(rChip, CSound管理.rc演奏用タイマ.nシステム時刻, EPart.Drums, CDTXMania.Instance.ConfigIni.nChipVolume, CDTXMania.Instance.ConfigIni.bEmphasizePlaySound.Drums);
+ if (CDTXMania.Instance.ConfigIni.nStrictHitSoundRange == 0 ||
+ (CDTXMania.Instance.ConfigIni.nStrictHitSoundRange >= Math.Abs(nHitTime + nInputAdjustTime - pChip.n発声時刻ms)))
+ {
+ this.tサウンド再生(rChip, CSound管理.rc演奏用タイマ.nシステム時刻, EPart.Drums, CDTXMania.Instance.ConfigIni.nChipVolume, CDTXMania.Instance.ConfigIni.bEmphasizePlaySound.Drums);
+ }
}
return true;
}