• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

dtxmania 中文


Commit MetaInfo

Revision172e5fbb32f1dd2477e2297dcf40c844dbf065ac (tree)
Zeit2018-01-18 23:39:52
Autoryyagi <yyagi.dtxmania@gmai...>
Commiteryyagi

Log Message

#28263 DTX2WAV機能の実現のため、まずコマンドラインのパーサをDTXVmodeクラスから分離し、CommandParseクラスに移動した。

Ändern Zusammenfassung

  • delete: "DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/CDTXVmode.cs"
  • delete: "DTXMania/\343\202\263\343\203\274\343\203\211/\345\205\250\344\275\223/CDTX2WAVmode.cs"
  • delete: "DTXMania/\343\202\263\343\203\274\343\203\211/\345\205\250\344\275\223/CDTXMania.cs"
  • delete: "DTXMania/\343\202\263\343\203\274\343\203\211/\345\205\250\344\275\223/cmdparse.cs"
  • modified: DTXMania/DTXMania.csproj (diff)

Diff

--- a/DTXMania/DTXMania.csproj
+++ b/DTXMania/DTXMania.csproj
@@ -108,8 +108,10 @@
108108 <Compile Include="コード\ステージ\07.演奏\CStage演奏画面共通_描画.cs" />
109109 <Compile Include="コード\ステージ\07.演奏\TypesForPlayStage.cs" />
110110 <Compile Include="コード\ステージ\CActDigit.cs" />
111+ <Compile Include="コード\全体\cmdparse.cs" />
111112 <Compile Include="コード\全体\CResources.cs" />
112113 <Compile Include="コード\全体\Coordinates.cs" />
114+ <Compile Include="コード\全体\CDTX2WAVmode.cs" />
113115 <Compile Include="コード\全体\FileStreamSSD.cs" />
114116 <Compile Include="コード\全体\STPlugin.cs" />
115117 <Compile Include="コード\全体\TextureFactory.cs" />
--- "a/DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/CDTXVmode.cs"
+++ "b/DTXMania/\343\202\263\343\203\274\343\203\211/\343\202\271\343\203\206\343\203\274\343\202\270/CDTXVmode.cs"
@@ -70,18 +70,18 @@ namespace DTXMania
7070 public ECommand Command
7171 {
7272 get;
73- private set;
73+ set;
7474 }
7575
7676 public ESoundDeviceType soundDeviceType
7777 {
7878 get;
79- private set;
79+ set;
8080 }
8181 public int nASIOdevice
8282 {
8383 get;
84- private set;
84+ set;
8585 }
8686 /// <summary>
8787 /// 前回からサウンドデバイスが変更されたか
@@ -89,7 +89,7 @@ namespace DTXMania
8989 public bool ChangedSoundDevice
9090 {
9191 get;
92- private set;
92+ set;
9393 }
9494
9595 public string filename
@@ -103,22 +103,22 @@ namespace DTXMania
103103 public string previewFilename
104104 {
105105 get;
106- private set;
106+ set;
107107 }
108108 public int previewVolume
109109 {
110110 get;
111- private set;
111+ set;
112112 }
113113 public int previewPan
114114 {
115115 get;
116- private set;
116+ set;
117117 }
118118 public bool GRmode
119119 {
120120 get;
121- private set;
121+ set;
122122 }
123123 public bool lastGRmode
124124 {
@@ -128,7 +128,7 @@ namespace DTXMania
128128 public bool TimeStretch
129129 {
130130 get;
131- private set;
131+ set;
132132 }
133133 public bool lastTimeStretch
134134 {
@@ -138,7 +138,7 @@ namespace DTXMania
138138 public bool VSyncWait
139139 {
140140 get;
141- private set;
141+ set;
142142 }
143143 public bool lastVSyncWait
144144 {
@@ -206,196 +206,6 @@ namespace DTXMania
206206 return false;
207207 }
208208
209- /// <summary>
210- ///
211- /// </summary>
212- /// <param name="arg"></param>
213- /// <param name="nStartBar"></param>
214- /// <param name="command"></param>
215- /// <returns>DTXV用の引数であればtrue</returns>
216- /// <remarks>内部でEnabled, nStartBar, Command, NeedReload, filename, last_path, last_timestampを設定する</remarks>
217- public bool ParseArguments(string arg)
218- {
219- bool ret = false, analyzing = true;
220- this.nStartBar = 0;
221-
222- if (arg != null)
223- {
224- while (analyzing)
225- {
226- if (arg == "")
227- {
228- analyzing = false;
229- }
230- else if (arg.StartsWith("-V", StringComparison.OrdinalIgnoreCase)) // サウンド再生
231- {
232- // -Vvvv,ppp,"filename"の形式。 vvv=volume, ppp=pan.
233- this.Enabled = true;
234- this.Command = ECommand.Preview;
235- this.Refreshed = true;
236- ret = true;
237- arg = arg.Substring(2);
238-
239- int pVol = arg.IndexOf(','); //Trace.TraceInformation( "pVol=" + pVol );
240- string strVol = arg.Substring(0, pVol); //Trace.TraceInformation( "strVol=" + strVol );
241- this.previewVolume = Convert.ToInt32(strVol); //Trace.TraceInformation( "previewVolume=" + previewVolume );
242- int pPan = arg.IndexOf(',', pVol + 1); //Trace.TraceInformation( "pPan=" + pPan );
243- string strPan = arg.Substring(pVol + 1, pPan - pVol - 1); //Trace.TraceInformation( "strPan=" + strPan );
244- this.previewPan = Convert.ToInt32(strPan); //Trace.TraceInformation( "previewPan=" + previewPan );
245-
246- arg = arg.Substring(pPan + 1);
247- arg = arg.Trim(new char[] { '\"' });
248- this.previewFilename = arg;
249- analyzing = false;
250- }
251- // -S -Nxxx filename
252- else if (arg.StartsWith("-S", StringComparison.OrdinalIgnoreCase)) // DTXV再生停止
253- {
254- this.Enabled = true;
255- this.Command = ECommand.Stop;
256- this.Refreshed = true;
257- ret = true;
258- arg = arg.Substring(2);
259- }
260- else if (arg.StartsWith("-D", StringComparison.OrdinalIgnoreCase))
261- {
262- // -DWE, -DWS, -DA1など
263- arg = arg.Substring(2); // -D を削除
264- switch (arg[0])
265- {
266- #region [ DirectSound ]
267- case 'D':
268- if (this.soundDeviceType != ESoundDeviceType.DirectSound)
269- {
270- this.ChangedSoundDevice = true;
271- this.soundDeviceType = ESoundDeviceType.DirectSound;
272- }
273- else
274- {
275- this.ChangedSoundDevice = false;
276- }
277- arg = arg.Substring(1);
278- break;
279- #endregion
280- #region [ WASAPI(Exclusive/Shared) ]
281- case 'W':
282- {
283- ESoundDeviceType new_sounddevicetype;
284- arg = arg.Substring(1);
285- char c = arg[0];
286- //arg = arg.Substring(1);
287-
288- switch (c)
289- {
290- case 'E':
291- new_sounddevicetype = ESoundDeviceType.ExclusiveWASAPI;
292- break;
293- case 'S':
294- new_sounddevicetype = ESoundDeviceType.SharedWASAPI;
295- break;
296- default:
297- new_sounddevicetype = ESoundDeviceType.Unknown;
298- break;
299- }
300- if (this.soundDeviceType != new_sounddevicetype)
301- {
302- this.ChangedSoundDevice = true;
303- this.soundDeviceType = new_sounddevicetype;
304- }
305- else
306- {
307- this.ChangedSoundDevice = false;
308- }
309- }
310- arg = arg.Substring(1);
311- break;
312- #endregion
313- #region [ ASIO ]
314- case 'A':
315- if (this.soundDeviceType != ESoundDeviceType.ASIO)
316- {
317- this.ChangedSoundDevice = true;
318- this.soundDeviceType = ESoundDeviceType.ASIO;
319- }
320- else
321- {
322- this.ChangedSoundDevice = false;
323- }
324- arg = arg.Substring(1);
325-
326- int nAsioDev = 0, p = 0;
327- while (true)
328- {
329- char c = arg[0];
330- if ('0' <= c && c <= '9')
331- {
332- nAsioDev *= 10;
333- nAsioDev += c - '0';
334- p++;
335- arg = arg.Substring(1);
336- continue;
337- }
338- else
339- {
340- break;
341- }
342- }
343- if (this.nASIOdevice != nAsioDev)
344- {
345- this.ChangedSoundDevice = true;
346- this.nASIOdevice = nAsioDev;
347- }
348- break;
349- #endregion
350- }
351- #region [ GRmode, TimeStretch, VSyncWait ]
352- {
353- // Reload判定は、-Nのところで行う
354- this.GRmode = (arg[0] == 'Y');
355- this.TimeStretch = (arg[1] == 'Y');
356- this.VSyncWait = (arg[2] == 'Y');
357-
358- arg = arg.Substring(3);
359- }
360- #endregion
361- }
362- else if (arg.StartsWith("-N", StringComparison.OrdinalIgnoreCase))
363- {
364- this.Enabled = true;
365- this.Command = ECommand.Play;
366- ret = true;
367-
368- arg = arg.Substring(2); // "-N"を除去
369- string[] p = arg.Split(new char[] { ' ' });
370- this.nStartBar = int.Parse(p[0]); // 再生開始小節
371- if (this.nStartBar < 0)
372- {
373- this.nStartBar = -1;
374- }
375-
376- int startIndex = arg.IndexOf(' ');
377- string filename = arg.Substring(startIndex + 1); // 再生ファイル名(フルパス) これで引数が終わっていることを想定
378- try
379- {
380- filename = filename.Trim(new char[] { '\"' });
381- bIsNeedReloadDTX(filename);
382- }
383- catch // 指定ファイルが存在しない
384- {
385- }
386- arg = "";
387- analyzing = false;
388- }
389- else
390- {
391- analyzing = false;
392- }
393- }
394- }
395- //string[] s = { "Stop", "Play", "Preview" };
396- //Trace.TraceInformation( "Command: " + s[ (int) this.Command ] );
397- return ret;
398- }
399209
400210 /// <summary>
401211 /// Viewer関連の設定のみを更新して、Config.iniに書き出す
--- /dev/null
+++ "b/DTXMania/\343\202\263\343\203\274\343\203\211/\345\205\250\344\275\223/CDTX2WAVmode.cs"
@@ -0,0 +1,18 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using System.Threading.Tasks;
6+
7+using System.Diagnostics;
8+using System.IO;
9+using System.Threading;
10+using FDK;
11+
12+namespace DTXMania
13+{
14+ public class CDTX2WAVmode
15+ {
16+
17+ }
18+}
--- "a/DTXMania/\343\202\263\343\203\274\343\203\211/\345\205\250\344\275\223/CDTXMania.cs"
+++ "b/DTXMania/\343\202\263\343\203\274\343\203\211/\345\205\250\344\275\223/CDTXMania.cs"
@@ -175,12 +175,14 @@ namespace DTXMania
175175 return base.Window.Handle;
176176 }
177177 }
178- public CDTXVmode DTXVmode { get; set; }// #28821 2014.1.23 yyagi
179- #endregion
178+ public CDTXVmode DTXVmode; // #28821 2014.1.23 yyagi
179+ public CDTX2WAVmode DTX2WAVmode;
180+ public CCommandParse CommandParse;
181+ #endregion
180182
181- // コンストラクタ
183+ // コンストラクタ
182184
183- private CDTXMania()
185+ private CDTXMania()
184186 {
185187 }
186188
@@ -273,16 +275,22 @@ namespace DTXMania
273275
274276 #endregion
275277
276- #region [ DTXVmodeクラス の初期化 ]
278+ #region [ DTXVmodeクラス, DTX2WAVmodeクラス, CommandParseクラス の初期化 ]
277279 //Trace.TraceInformation( "DTXVモードの初期化を行います。" );
278280 //Trace.Indent();
279281 try
280282 {
281283 DTXVmode = new CDTXVmode();
282284 DTXVmode.Enabled = false;
283- //Trace.TraceInformation( "DTXVモードの初期化を完了しました。" );
284- }
285- finally
285+ //Trace.TraceInformation( "DTXVモードの初期化を完了しました。" );
286+
287+ DTX2WAVmode = new CDTX2WAVmode();
288+ //Trace.TraceInformation( "DTX2WAVモードの初期化を完了しました。" );
289+
290+ CommandParse = new CCommandParse();
291+ //Trace.TraceInformation( "CommandParseの初期化を完了しました。" );
292+ }
293+ finally
286294 {
287295 //Trace.Unindent();
288296 }
@@ -307,7 +315,7 @@ namespace DTXMania
307315 arg += commandLineArgs[i];
308316 }
309317 }
310- DTXVmode.ParseArguments(arg);
318+ CommandParse.ParseArguments(arg, ref DTXVmode, ref DTX2WAVmode);
311319 if (DTXVmode.Enabled)
312320 {
313321 DTXVmode.Refreshed = false; // 初回起動時は再読み込みに走らせない
@@ -1067,7 +1075,7 @@ namespace DTXMania
10671075
10681076 if (strMes != null)
10691077 {
1070- DTXVmode.ParseArguments(strMes);
1078+ CommandParse.ParseArguments(strMes, ref DTXVmode, ref DTX2WAVmode);
10711079
10721080 if (DTXVmode.Enabled)
10731081 {
--- /dev/null
+++ "b/DTXMania/\343\202\263\343\203\274\343\203\211/\345\205\250\344\275\223/cmdparse.cs"
@@ -0,0 +1,234 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Text;
4+using System.Diagnostics;
5+using System.IO;
6+using System.Threading;
7+using FDK;
8+
9+
10+namespace DTXMania
11+{
12+ public class CCommandParse
13+ {
14+ public enum ECommandType
15+ {
16+ DTXMania,
17+ DTXV,
18+ DTX2WAV
19+ }
20+
21+
22+ /// <summary>
23+ /// コンストラクタ
24+ /// </summary>
25+ public CCommandParse()
26+ {
27+ }
28+
29+
30+ /// <summary>
31+ /// DTXManiaGR.exe 引数の分析
32+ /// </summary>
33+ /// <param name="arg"></param>
34+ /// <returns>DTXMania/DTXV/DTX2WAV どのモードで起動されたかを返す</returns>
35+ /// <remarks>DTXモードとして使う場合、内部でEnabled, nStartBar, Command, NeedReload, filename, last_path, last_timestampを設定する</remarks>
36+ public ECommandType ParseArguments(string arg, ref CDTXVmode cdtxv, ref CDTX2WAVmode cdtx2wav)
37+ {
38+ // -Vvvv,ppp,"filename" サウンドファイルの再生 vvv=volume, ppp=pan
39+ // -S DTXV再生停止
40+ // -D(サウンドモード)(YかNが3文字続く) Viewerの設定
41+ // (サウンドモード) WE=WASAPI Exclusive, WS=WASAPI Shared, A1=ASIO(数値はデバイス番号), D=DSound
42+ // YYY, YNYなど 1文字目=GRmode, 2文字目=TmeStretch, 3文字目=VSyncWait
43+ // -Nxxx 再生開始小節番号
44+ // -Etype,freq,bitrate,"filename" DTX2WAVとして使用 type="WAV"or"MP3"or"OGG", freq=48000など, bitrate=192 (kHzなど)
45+
46+ ECommandType ret = ECommandType.DTXMania;
47+ bool analyzing = true;
48+ cdtxv.nStartBar = 0;
49+
50+ if (arg != null)
51+ {
52+ while (analyzing)
53+ {
54+ if (arg == "")
55+ {
56+ analyzing = false;
57+ }
58+ #region [ DTXVmode ]
59+ else if (arg.StartsWith("-V", StringComparison.OrdinalIgnoreCase)) // サウンド再生
60+ {
61+ // -Vvvv,ppp,"filename"の形式。 vvv=volume, ppp=pan.
62+ cdtxv.Enabled = true;
63+ cdtxv.Command = CDTXVmode.ECommand.Preview;
64+ cdtxv.Refreshed = true;
65+ ret = ECommandType.DTXV;
66+ arg = arg.Substring(2);
67+
68+ int pVol = arg.IndexOf(','); //Trace.TraceInformation( "pVol=" + pVol );
69+ string strVol = arg.Substring(0, pVol); //Trace.TraceInformation( "strVol=" + strVol );
70+ cdtxv.previewVolume = Convert.ToInt32(strVol); //Trace.TraceInformation( "previewVolume=" + previewVolume );
71+ int pPan = arg.IndexOf(',', pVol + 1); //Trace.TraceInformation( "pPan=" + pPan );
72+ string strPan = arg.Substring(pVol + 1, pPan - pVol - 1); //Trace.TraceInformation( "strPan=" + strPan );
73+ cdtxv.previewPan = Convert.ToInt32(strPan); //Trace.TraceInformation( "previewPan=" + previewPan );
74+
75+ arg = arg.Substring(pPan + 1);
76+ arg = arg.Trim(new char[] { '\"' });
77+ cdtxv.previewFilename = arg;
78+ analyzing = false;
79+ }
80+ // -S -Nxxx filename
81+ else if (arg.StartsWith("-S", StringComparison.OrdinalIgnoreCase)) // DTXV再生停止
82+ {
83+ cdtxv.Enabled = true;
84+ cdtxv.Command = CDTXVmode.ECommand.Stop;
85+ cdtxv.Refreshed = true;
86+ ret = ECommandType.DTXV;
87+ arg = arg.Substring(2);
88+ }
89+ else if (arg.StartsWith("-D", StringComparison.OrdinalIgnoreCase))
90+ {
91+ // -DWE, -DWS, -DA1など
92+ arg = arg.Substring(2); // -D を削除
93+ switch (arg[0])
94+ {
95+ #region [ DirectSound ]
96+ case 'D':
97+ if (cdtxv.soundDeviceType != ESoundDeviceType.DirectSound)
98+ {
99+ cdtxv.ChangedSoundDevice = true;
100+ cdtxv.soundDeviceType = ESoundDeviceType.DirectSound;
101+ }
102+ else
103+ {
104+ cdtxv.ChangedSoundDevice = false;
105+ }
106+ arg = arg.Substring(1);
107+ break;
108+ #endregion
109+ #region [ WASAPI(Exclusive/Shared) ]
110+ case 'W':
111+ {
112+ ESoundDeviceType new_sounddevicetype;
113+ arg = arg.Substring(1);
114+ char c = arg[0];
115+ //arg = arg.Substring(1);
116+
117+ switch (c)
118+ {
119+ case 'E':
120+ new_sounddevicetype = ESoundDeviceType.ExclusiveWASAPI;
121+ break;
122+ case 'S':
123+ new_sounddevicetype = ESoundDeviceType.SharedWASAPI;
124+ break;
125+ default:
126+ new_sounddevicetype = ESoundDeviceType.Unknown;
127+ break;
128+ }
129+ if (cdtxv.soundDeviceType != new_sounddevicetype)
130+ {
131+ cdtxv.ChangedSoundDevice = true;
132+ cdtxv.soundDeviceType = new_sounddevicetype;
133+ }
134+ else
135+ {
136+ cdtxv.ChangedSoundDevice = false;
137+ }
138+ }
139+ arg = arg.Substring(1);
140+ break;
141+ #endregion
142+ #region [ ASIO ]
143+ case 'A':
144+ if (cdtxv.soundDeviceType != ESoundDeviceType.ASIO)
145+ {
146+ cdtxv.ChangedSoundDevice = true;
147+ cdtxv.soundDeviceType = ESoundDeviceType.ASIO;
148+ }
149+ else
150+ {
151+ cdtxv.ChangedSoundDevice = false;
152+ }
153+ arg = arg.Substring(1);
154+
155+ int nAsioDev = 0, p = 0;
156+ while (true)
157+ {
158+ char c = arg[0];
159+ if ('0' <= c && c <= '9')
160+ {
161+ nAsioDev *= 10;
162+ nAsioDev += c - '0';
163+ p++;
164+ arg = arg.Substring(1);
165+ continue;
166+ }
167+ else
168+ {
169+ break;
170+ }
171+ }
172+ if (cdtxv.nASIOdevice != nAsioDev)
173+ {
174+ cdtxv.ChangedSoundDevice = true;
175+ cdtxv.nASIOdevice = nAsioDev;
176+ }
177+ break;
178+ #endregion
179+ }
180+ #region [ GRmode, TimeStretch, VSyncWait ]
181+ {
182+ // Reload判定は、-Nのところで行う
183+ cdtxv.GRmode = (arg[0] == 'Y');
184+ cdtxv.TimeStretch = (arg[1] == 'Y');
185+ cdtxv.VSyncWait = (arg[2] == 'Y');
186+
187+ arg = arg.Substring(3);
188+ }
189+ #endregion
190+ }
191+ else if (arg.StartsWith("-N", StringComparison.OrdinalIgnoreCase))
192+ {
193+ cdtxv.Enabled = true;
194+ cdtxv.Command = CDTXVmode.ECommand.Play;
195+ ret = ECommandType.DTXV;
196+
197+ arg = arg.Substring(2); // "-N"を除去
198+ string[] p = arg.Split(new char[] { ' ' });
199+ cdtxv.nStartBar = int.Parse(p[0]); // 再生開始小節
200+ if (cdtxv.nStartBar < 0)
201+ {
202+ cdtxv.nStartBar = -1;
203+ }
204+
205+ int startIndex = arg.IndexOf(' ');
206+ string filename = arg.Substring(startIndex + 1); // 再生ファイル名(フルパス) これで引数が終わっていることを想定
207+ try
208+ {
209+ filename = filename.Trim(new char[] { '\"' });
210+ cdtxv.bIsNeedReloadDTX(filename);
211+ }
212+ catch // 指定ファイルが存在しない
213+ {
214+ }
215+ arg = "";
216+ analyzing = false;
217+ }
218+ #endregion
219+ #region [ DTX2WAV mode]
220+ //
221+ #endregion
222+ else
223+ {
224+ analyzing = false;
225+ }
226+ }
227+ }
228+ //string[] s = { "Stop", "Play", "Preview" };
229+ //Trace.TraceInformation( "Command: " + s[ (int) this.Command ] );
230+ return ret;
231+ }
232+
233+ }
234+}