1
0
mirror of synced 2024-11-14 10:57:36 +01:00

delete CDTXVmode references

This commit is contained in:
0auBSQ 2024-10-22 05:16:30 +09:00
parent b20302627f
commit b28c2f6c56
5 changed files with 434 additions and 885 deletions

View File

@ -395,11 +395,6 @@ namespace OpenTaiko {
get;
set;
}
public static CDTXVmode DTXVmode // #28821 2014.1.23 yyagi
{
get;
set;
}
public static DiscordRpcClient DiscordClient;
// 0 : 1P, 1 : 2P
@ -1297,7 +1292,6 @@ namespace OpenTaiko {
case CStage.EStage.SongLoading:
#region [ *** ]
//-----------------------------
DTXVmode.Refreshed = false; // 曲のリロード中に発生した再リロードは、無視する。
if (this.n進行描画の戻り値 != 0) {
OpenTaiko.Pad.st検知したデバイス.Clear(); // 入力デバイスフラグクリア(2010.9.11)
r現在のステージ.DeActivate();
@ -1388,65 +1382,6 @@ for (int i = 0; i < 3; i++) {
case CStage.EStage.Game:
#region [ *** ]
#region [ DTXVモード中にDTXCreatorから指示を受けた場合の処理 ]
if (DTXVmode.Enabled && DTXVmode.Refreshed) {
DTXVmode.Refreshed = false;
if (DTXVmode.Command == CDTXVmode.ECommand.Stop) {
OpenTaiko.stage演奏ドラム画面.t停止();
if (previewSound != null) {
this.previewSound.tStopSound();
this.previewSound.Dispose();
this.previewSound = null;
}
//{
// int lastd = 0;
// int f = 0;
// for ( int i = 0; i < swlist1.Count; i++ )
// {
// int d1 = swlist1[ i ];
// int d2 = swlist2[ i ];
// int d3 = swlist3[ i ];
// int d4 = swlist4[ i ];
// int d5 = swlist5[ i ];
// int dif = d1 - lastd;
// string s = "";
// if ( 16 <= dif && dif <= 17 )
// {
// }
// else
// {
// s = "★";
// }
// Trace.TraceInformation( "frame {0:D4}: {1:D3} ( {2:D3}, {3:D3} - {7:D3}, {4:D3} ) {5}, n現在時刻={6}", f, dif, d1, d2, d3, s, d4, d5 );
// lastd = d1;
// f++;
// }
// swlist1.Clear();
// swlist2.Clear();
// swlist3.Clear();
// swlist4.Clear();
// swlist5.Clear();
//}
} else if (DTXVmode.Command == CDTXVmode.ECommand.Play) {
if (DTXVmode.NeedReload) {
OpenTaiko.stage演奏ドラム画面.t再読込();
OpenTaiko.ConfigIni.bTimeStretch = DTXVmode.TimeStretch;
SoundManager.bIsTimeStretch = DTXVmode.TimeStretch;
if (OpenTaiko.ConfigIni.bEnableVSync != DTXVmode.VSyncWait) {
OpenTaiko.ConfigIni.bEnableVSync = DTXVmode.VSyncWait;
OpenTaiko.app.b次のタイミングで垂直帰線同期切り替えを行う = true;
}
} else {
OpenTaiko.stage演奏ドラム画面.t演奏位置の変更(OpenTaiko.DTXVmode.nStartBar, 0);
}
}
}
#endregion
switch (this.n進行描画の戻り値) {
case (int)EGameplayScreenReturnValue.ReloadAndReplay:
#region [ DTXファイルを再読み込みして ]
@ -2133,11 +2068,7 @@ for (int i = 0; i < 3; i++) {
// ayo komi isn't this useless code? - tfd500
{
get {
if (DTXVmode.Enabled) {
return "DTXViewer release " + VERSION;
} else {
return "OpenTaiko";
}
return "OpenTaiko";
}
}
private CSound previewSound;
@ -2203,14 +2134,6 @@ for (int i = 0; i < 3; i++) {
//---------------------
#endregion
#region [ DTXVmodeクラス ]
//---------------------
DTXVmode = new CDTXVmode();
DTXVmode.Enabled = false;
//---------------------
#endregion
DTX = null;
#region [ Skin ]
@ -2294,7 +2217,7 @@ for (int i = 0; i < 3; i++) {
Trace.TraceInformation("Initializing DirectInput and MIDI input...");
Trace.Indent();
try {
bool bUseMIDIIn = !DTXVmode.Enabled;
bool bUseMIDIIn = true;
InputManager = new CInputManager(Window_);
foreach (IInputDevice device in InputManager.InputDevices) {
if ((device.CurrentType == InputDeviceType.Joystick) && !ConfigIni.dicJoystick.ContainsValue(device.GUID)) {
@ -2793,13 +2716,8 @@ for (int i = 0; i < 3; i++) {
string str = strEXEのあるフォルダ + "Config.ini";
Trace.Indent();
try {
if (DTXVmode.Enabled) {
DTXVmode.tUpdateConfigIni();
Trace.TraceInformation("Configuration information for DTXV mode has been saved in Config.ini.");
} else {
ConfigIni.t書き出し(str);
Trace.TraceInformation("Saved succesfully. ({0})", str);
}
ConfigIni.t書き出し(str);
Trace.TraceInformation("Saved succesfully. ({0})", str);
} catch (Exception e) {
Trace.TraceError(e.ToString());
Trace.TraceError("Config.ini failed to create. ({0})", str);
@ -2826,13 +2744,6 @@ for (int i = 0; i < 3; i++) {
ConfigIni = null;
//---------------------
#endregion
#region [ DTXVmodeの終了処理 ]
//---------------------
if (DTXVmode != null) {
DTXVmode = null;
}
//---------------------
#endregion
Trace.TraceInformation("OpenTaiko has closed down successfully.");

View File

@ -431,7 +431,7 @@ namespace OpenTaiko {
}
}
double _db再生速度 = (OpenTaiko.DTXVmode.Enabled) ? OpenTaiko.DTX.dbDTXVPlaySpeed : OpenTaiko.DTX.db再生速度;
double _db再生速度 = OpenTaiko.DTX.db再生速度;
return (int)(nDuration / _db再生速度);
}
@ -2043,7 +2043,7 @@ namespace OpenTaiko {
}
}
if (this.db再生速度 > 0.0) {
double _db再生速度 = (OpenTaiko.DTXVmode.Enabled) ? this.dbDTXVPlaySpeed : this.db再生速度;
double _db再生速度 = this.db再生速度;
foreach (CChip chip in this.listChip) {
chip.n発声時刻ms = (int)(((double)chip.n発声時刻ms) / _db再生速度);
chip.db発声時刻ms = (((double)chip.n発声時刻ms) / _db再生速度);
@ -6614,7 +6614,7 @@ namespace OpenTaiko {
int duration = 0;
if (listWAV.TryGetValue(pChip.n整数値_内部番号, out CDTX.CWAV wc)) {
double _db再生速度 = (OpenTaiko.DTXVmode.Enabled) ? this.dbDTXVPlaySpeed : this.db再生速度;
double _db再生速度 = this.db再生速度;
duration = (wc.rSound[0] == null) ? 0 : (int)(wc.rSound[0].TotalPlayTime / _db再生速度); // #23664 durationに再生速度が加味されておらず、低速再生でBGMが途切れる問題を修正 (発声時刻msは、DTX読み込み時に再生速度加味済)
}
int n新RemoveMixer時刻ms, n新RemoveMixer位置;

View File

@ -378,13 +378,8 @@ namespace OpenTaiko {
bIsDirectSound = (OpenTaiko.SoundManager.GetCurrentSoundDeviceType() == "DirectSound");
bUseOSTimer = OpenTaiko.ConfigIni.bUseOSTimer;
this.bPAUSE = false;
if (OpenTaiko.DTXVmode.Enabled) {
db再生速度 = OpenTaiko.DTX.dbDTXVPlaySpeed;
OpenTaiko.ConfigIni.nSongSpeed = (int)(OpenTaiko.DTX.dbDTXVPlaySpeed * 20 + 0.5);
} else {
db再生速度 = OpenTaiko.ConfigIni.SongPlaybackSpeed;
}
bValidScore = (OpenTaiko.DTXVmode.Enabled) ? false : true;
db再生速度 = OpenTaiko.ConfigIni.SongPlaybackSpeed;
bValidScore = true;
#region [ mixer登録しておくべきサウンド() ]
foreach (CDTX.CChip pChip in listChip[0]) {

View File

@ -1,349 +0,0 @@
using System.Diagnostics;
using FDK;
namespace OpenTaiko {
public class CDTXVmode {
public enum ECommand {
Stop,
Play,
Preview
}
/// <summary>
/// DTXVモードかどうか
/// </summary>
public bool Enabled {
get;
set;
}
/// <summary>
/// プレビューサウンドの再生が発生した
/// </summary>
public bool Preview {
get;
set;
}
/// <summary>
/// 外部から再指示が発生したか
/// </summary>
public bool Refreshed {
get;
set;
}
/// <summary>
/// 演奏開始小節番号
/// </summary>
public int nStartBar {
get;
set;
}
/// <summary>
/// DTXファイルの再読み込みが必要かどうか
/// </summary>
public bool NeedReload {
get;
private set;
// private set; // 本来はprivate setにすべきだが、デバッグが簡単になるので、しばらくはprivateなしのままにする。
}
/// <summary>
/// DTXCからのコマンド
/// </summary>
public ECommand Command {
get;
private set;
}
public ESoundDeviceType soundDeviceType {
get;
private set;
}
public int nASIOdevice {
get;
private set;
}
/// <summary>
/// 前回からサウンドデバイスが変更されたか
/// </summary>
public bool ChangedSoundDevice {
get;
private set;
}
public string filename {
get {
return last_path;
}
}
public string previewFilename {
get;
private set;
}
public int previewVolume {
get;
private set;
}
public int previewPan {
get;
private set;
}
public bool GRmode {
get;
private set;
}
public bool lastGRmode {
get;
private set;
}
public bool TimeStretch {
get;
private set;
}
public bool lastTimeStretch {
get;
private set;
}
public bool VSyncWait {
get;
private set;
}
public bool lastVSyncWait {
get;
private set;
}
/// <summary>
/// コンストラクタ
/// </summary>
public CDTXVmode() {
this.last_path = "";
this.last_timestamp = DateTime.MinValue;
this.Enabled = false;
this.nStartBar = 0;
this.Refreshed = false;
this.NeedReload = false;
this.previewFilename = "";
this.GRmode = false;
this.lastGRmode = false;
this.TimeStretch = false;
this.lastTimeStretch = false;
this.VSyncWait = true;
this.lastVSyncWait = true;
}
/// <summary>
/// DTXファイルのリロードが必要かどうか判定する
/// </summary>
/// <param name="filename">DTXファイル名</param>
/// <returns>再読込が必要ならtrue</returns>
/// <remarks>プロパティNeedReloadにも結果が入る</remarks>
/// <remarks>これを呼び出すたびに、Refreshedをtrueにする</remarks>
/// <exception cref="FileNotFoundException"></exception>
public bool bIsNeedReloadDTX(string filename) {
if (!File.Exists(filename)) // 指定したファイルが存在しないなら例外終了
{
Trace.TraceError("ファイルが見つかりません。({0})", filename);
throw new FileNotFoundException();
//return false;
}
this.Refreshed = true;
// 前回とファイル名が異なるか、タイムスタンプが更新されているか、
// GRmode等の設定を変更したなら、DTX要更新
DateTime current_timestamp = File.GetLastWriteTime(filename);
if (last_path != filename || current_timestamp > last_timestamp ||
this.lastGRmode != this.GRmode || this.lastTimeStretch != this.TimeStretch || this.lastVSyncWait != this.VSyncWait) {
this.last_path = filename;
this.last_timestamp = current_timestamp;
this.lastGRmode = this.GRmode;
this.lastTimeStretch = this.TimeStretch;
this.lastVSyncWait = this.VSyncWait;
this.NeedReload = true;
return true;
}
this.NeedReload = false;
return false;
}
/// <summary>
///
/// </summary>
/// <param name="arg"></param>
/// <param name="nStartBar"></param>
/// <param name="command"></param>
/// <returns>DTXV用の引数であればtrue</returns>
/// <remarks>内部でEnabled, nStartBar, Command, NeedReload, filename, last_path, last_timestampを設定する</remarks>
public bool ParseArguments(string arg) {
bool ret = false, analyzing = true;
this.nStartBar = 0;
if (arg != null) {
while (analyzing) {
if (arg == "") {
analyzing = false;
} else if (arg.StartsWith("-V", StringComparison.OrdinalIgnoreCase)) // サウンド再生
{
// -Vvvv,ppp,"filename"の形式。 vvv=volume, ppp=pan.
this.Enabled = true;
this.Command = ECommand.Preview;
this.Refreshed = true;
ret = true;
arg = arg.Substring(2);
int pVol = arg.IndexOf(','); //Trace.TraceInformation( "pVol=" + pVol );
string strVol = arg.Substring(0, pVol); //Trace.TraceInformation( "strVol=" + strVol );
this.previewVolume = Convert.ToInt32(strVol); //Trace.TraceInformation( "previewVolume=" + previewVolume );
int pPan = arg.IndexOf(',', pVol + 1); //Trace.TraceInformation( "pPan=" + pPan );
string strPan = arg.Substring(pVol + 1, pPan - pVol - 1); //Trace.TraceInformation( "strPan=" + strPan );
this.previewPan = Convert.ToInt32(strPan); //Trace.TraceInformation( "previewPan=" + previewPan );
arg = arg.Substring(pPan + 1);
arg = arg.Trim(new char[] { '\"' });
this.previewFilename = arg;
analyzing = false;
}
// -S -Nxxx filename
else if (arg.StartsWith("-S", StringComparison.OrdinalIgnoreCase)) // DTXV再生停止
{
this.Enabled = true;
this.Command = ECommand.Stop;
this.Refreshed = true;
ret = true;
arg = arg.Substring(2);
} else if (arg.StartsWith("-D", StringComparison.OrdinalIgnoreCase)) {
// -DW, -DA1など
arg = arg.Substring(2); // -D を削除
switch (arg[0]) {
#region [ DirectSound ]
case 'D':
this.ChangedSoundDevice = false;
arg = arg.Substring(1);
break;
#endregion
#region [ WASAPI ]
case 'W':
if (this.soundDeviceType != ESoundDeviceType.ExclusiveWASAPI) {
this.ChangedSoundDevice = true;
this.soundDeviceType = ESoundDeviceType.ExclusiveWASAPI;
} else {
this.ChangedSoundDevice = false;
}
arg = arg.Substring(1);
break;
#endregion
#region [ ASIO ]
case 'A':
if (this.soundDeviceType != ESoundDeviceType.ASIO) {
this.ChangedSoundDevice = true;
this.soundDeviceType = ESoundDeviceType.ASIO;
} else {
this.ChangedSoundDevice = false;
}
arg = arg.Substring(1);
int nAsioDev = 0, p = 0;
while (true) {
char c = arg[0];
if ('0' <= c && c <= '9') {
nAsioDev *= 10;
nAsioDev += c - '0';
p++;
arg = arg.Substring(1);
continue;
} else {
break;
}
}
if (this.nASIOdevice != nAsioDev) {
this.ChangedSoundDevice = true;
this.nASIOdevice = nAsioDev;
}
break;
#endregion
}
#region [ GRmode, TimeStretch, VSyncWait ]
{
// Reload判定は、-Nのところで行う
this.GRmode = (arg[0] == 'Y');
this.TimeStretch = (arg[1] == 'Y');
this.VSyncWait = (arg[2] == 'Y');
arg = arg.Substring(3);
}
#endregion
} else if (arg.StartsWith("-N", StringComparison.OrdinalIgnoreCase)) {
this.Enabled = true;
this.Command = ECommand.Play;
ret = true;
arg = arg.Substring(2); // "-N"を除去
string[] p = arg.Split(new char[] { ' ' });
this.nStartBar = int.Parse(p[0]); // 再生開始小節
if (this.nStartBar < 0) {
this.nStartBar = -1;
}
int startIndex = arg.IndexOf(' ');
string filename = arg.Substring(startIndex + 1); // 再生ファイル名(フルパス) これで引数が終わっていることを想定
try {
filename = filename.Trim(new char[] { '\"' });
bIsNeedReloadDTX(filename);
} catch (Exception e) // 指定ファイルが存在しない
{
Trace.TraceError(e.ToString());
Trace.TraceError("例外が発生しましたが処理を継続します。 (d309a608-7311-411e-a565-19226c3116c2)");
}
arg = "";
analyzing = false;
}
}
}
string[] s = { "Stop", "Play", "Preview" };
Trace.TraceInformation("Command: " + s[(int)this.Command]);
return ret;
}
/// <summary>
/// Viewer関連の設定のみを更新して、Config.iniに書き出す
/// </summary>
public void tUpdateConfigIni() {
CConfigIni cc = new CConfigIni();
string path = OpenTaiko.strEXEのあるフォルダ + "Config.ini";
if (File.Exists(path)) {
FileInfo fi = new FileInfo(path);
if (fi.Length > 0) // Config.iniが0byteだったなら、読み込まない
{
try {
cc.LoadFromFile(path);
} catch (Exception e) {
//ConfigIni = new CConfigIni(); // 存在してなければ新規生成
Trace.TraceError(e.ToString());
Trace.TraceError("例外が発生しましたが処理を継続します。 (825f9ba6-9164-4f2e-8c41-edf4d73c06c9)");
}
}
fi = null;
}
//cc.nViewerScrollSpeed[0] = TJAPlayer3.ConfigIni.nScrollSpeed[TJAPlayer3.SaveFile];
cc.bViewerShowDebugStatus = OpenTaiko.ConfigIni.bDisplayDebugInfo;
cc.bViewerVSyncWait = OpenTaiko.ConfigIni.bEnableVSync;
cc.bViewerTimeStretch = OpenTaiko.ConfigIni.bTimeStretch;
cc.bViewerDrums有効 = true;
cc.t書き出し(path);
}
private string last_path;
private DateTime last_timestamp;
}
}