2 using System.Collections.Concurrent;
3 using System.Collections.Generic;
4 using System.Diagnostics;
6 using System.ServiceModel;
7 using System.Windows.Forms;
12 [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] // サービスインターフェースをシングルスレッドで呼び出す。
13 class StrokeStyleT : SST.IStrokeStyleTService
17 public static SST.フォルダ フォルダ
19 get { return StrokeStyleT.bs_フォルダ; }
21 public static FDK.メディア.サウンド.WASAPI排他.ExclusiveDevice Wasapiデバイス
23 get { return StrokeStyleT.bs_Wasapiデバイス; }
25 public static System.Random 乱数
27 get { return StrokeStyleT.bs_乱数; }
29 public static SST.ユーザ.ユーザ管理 ユーザ管理
31 get { return StrokeStyleT.bs_ユーザ管理; }
33 public static SST.曲.曲ツリー管理 曲ツリー管理
35 get { return StrokeStyleT.bs_曲ツリー管理; }
37 public static SSTFormat.スコア 演奏スコア
42 public static SST.設定.Config Config
44 get { return StrokeStyleT.bs_Config; }
46 public static bool ビュアーモードである
51 public static bool ビュアーモードではない
53 get { return !StrokeStyleT.ビュアーモードである; }
54 set { StrokeStyleT.ビュアーモードである = !value; }
56 public static FDK.入力.Keyboard キーボード入力
58 get { return StrokeStyleT.bs_キーボード入力; }
60 public static FDK.入力.MidiIn MIDI入力
62 get { return StrokeStyleT.bs_MIDI入力; }
65 public static void すべての入力デバイスをポーリングする()
67 // hack: 追加の入力デバイスができたら、ここにポーリングコードを追加すること。
68 StrokeStyleT.キーボード入力?.ポーリングする();
69 StrokeStyleT.MIDI入力?.ポーリングする();
74 // フォルダ変数を真っ先に登録する。(ほかのメンバのコンストラクタでフォルダ変数を利用できるようにするため。)
75 StrokeStyleT.bs_フォルダ = new SST.フォルダ();
76 SST.フォルダ.フォルダ変数を追加する( "Static", StrokeStyleT.フォルダ.StaticFolder );
77 SST.フォルダ.フォルダ変数を追加する( "AppData", StrokeStyleT.フォルダ.AppDataFolder );
78 SST.フォルダ.フォルダ変数を追加する( "User", null );
82 #region " ビュアーモードかどうかを確認する。"
84 foreach( var arg in Environment.GetCommandLineArgs() )
86 if( ( "-v" == arg.ToLower() ) || ( "-viewer" == arg.ToLower() ) )
88 StrokeStyleT.ビュアーモードである = true;
95 this.State = ApplicationState.起動;
97 this.MainForm = new SharpDX.Windows.RenderForm();
98 this.MainForm.AllowUserResizing = false; // ユーザはフォームサイズを変更できない。
99 this.MainForm.UserResized += フォームサイズが変更された;
104 Debug.Assert( null != this.MainForm );
106 SharpDX.Windows.RenderLoop.Run( this.MainForm, () => {
108 // アプリケーションの状態に応じて処理分岐。
111 case ApplicationState.起動:
113 this.State = ApplicationState.進行描画;
116 case ApplicationState.進行描画:
118 if( this.State == ApplicationState.終了 )
122 case ApplicationState.終了:
130 #region " WCF サービスインターフェースの実装 "
132 // ・このサービスインターフェースは、シングルスレッド(GUIスレッド)で同期実行される。(StrokeStyleT クラスの ServiceBehavior属性を参照。)
133 // ・このサービスホストはシングルトンであり、すべてのクライアントセッションは同一(単一)のサービスインスタンスへ接続される。(Program.Main() を参照。)
135 public void ViewerPlay( string path, int startPart = 0, bool drumsSound = true )
137 if( StrokeStyleT.ビュアーモードではない )
140 this.ビュアーメッセージキュー.Enqueue( new ViewerMessage() {
141 種別 = ViewerMessageType.演奏開始,
143 演奏開始小節番号 = startPart,
144 ドラムチップ発声 = drumsSound,
147 public void ViewerStop()
149 if( StrokeStyleT.ビュアーモードではない )
152 this.ビュアーメッセージキュー.Enqueue( new ViewerMessage() {
153 種別 = ViewerMessageType.演奏停止,
156 public float GetSoundDelay()
158 if( StrokeStyleT.ビュアーモードではない )
161 return ( null != StrokeStyleT.Wasapiデバイス ) ? StrokeStyleT.Wasapiデバイス.遅延ms : 0f;
166 protected enum ApplicationState { 起動, 進行描画, 終了 }
167 protected ApplicationState State;
168 protected SharpDX.Windows.RenderForm MainForm = null;
169 protected SharpDX.Size2F 設計画面サイズdpx = SharpDX.Size2F.Empty;
170 protected ConcurrentQueue<ViewerMessage> ビュアーメッセージキュー = new ConcurrentQueue<ViewerMessage>();
171 protected FDK.メディア.デバイスリソース デバイスリソース = null;
172 protected SST.ステージ.ステージ 最初のダミーステージ = null;
173 protected SST.ステージ.起動.起動ステージ 起動ステージ = null;
174 protected SST.ステージ.タイトル.タイトルステージ タイトルステージ = null;
175 protected SST.ステージ.ログイン.ログインステージ ログインステージ = null;
176 protected SST.ステージ.選曲.選曲ステージ 選曲ステージ = null;
177 protected SST.ステージ.曲読込.曲読込ステージ 曲読込ステージ = null;
178 protected SST.ステージ.演奏.演奏ステージ 演奏ステージ = null;
179 protected SST.ステージ.結果.結果ステージ 結果ステージ = null;
180 protected SST.ステージ.ステージ 現在のステージ = null;
182 protected void 初期化する()
184 FDK.Log.現在のスレッドに名前をつける( "Render" );
185 FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
188 Debug.Assert( null == this.デバイスリソース, "デバイスリソースの作成前であること。" );
190 StrokeStyleT.bs_ユーザ管理 = new ユーザ.ユーザ管理();
191 StrokeStyleT.bs_曲ツリー管理 = new 曲.曲ツリー管理();
193 #region " 高解像度タイマを使えないならエラー。"
195 if( false == System.Diagnostics.Stopwatch.IsHighResolution )
196 throw new SSTException( "このシステムは、高解像度タイマをサポートしていません。" );
199 #region " MediaFoundation を起動する。"
201 SharpDX.MediaFoundation.MediaManager.Startup();
204 #region " Sleep 精度を上げる。"
206 Win32.timeBeginPeriod( 1 );
210 #region " コンフィグ を初期化する。"
212 StrokeStyleT.bs_Config = new 設定.Config();
213 StrokeStyleT.bs_Config.ConfigXmlを読み込む();
217 #region " コンフィグで指定されたウィンドウサイズに変更する。"
219 this.MainForm.ClientSize = new System.Drawing.Size( StrokeStyleT.Config.物理画面サイズpx.Width, StrokeStyleT.Config.物理画面サイズpx.Height );
222 #region " フォームタイトルと設計画面サイズを設定する。"
224 this.MainForm.Text = $"StrokeStyle<T> {System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()}";
225 if( StrokeStyleT.ビュアーモードである )
226 this.MainForm.Text += " (Viewer)";
228 this.設計画面サイズdpx = new SharpDX.Size2F( 1920f, 1080f );
232 #region " デバイスリソースを作成する。"
234 FDK.Log.Info( $"設計画面サイズ: {this.設計画面サイズdpx}" );
235 FDK.Log.Info( $"物理画面サイズ: {this.MainForm.ClientSize}" );
236 this.デバイスリソース = new FDK.メディア.デバイスリソース( this.設計画面サイズdpx );
237 this.デバイスリソース.すべてのリソースを作成する( this.MainForm.ClientSize, this.MainForm.Handle );
241 #region " ステージを生成する。"
243 this.最初のダミーステージ = new ステージ.ステージ();
244 this.起動ステージ = new ステージ.起動.起動ステージ();
245 this.タイトルステージ = new ステージ.タイトル.タイトルステージ();
246 this.ログインステージ = new ステージ.ログイン.ログインステージ();
247 this.選曲ステージ = new ステージ.選曲.選曲ステージ();
248 this.曲読込ステージ = new ステージ.曲読込.曲読込ステージ();
249 this.演奏ステージ = new ステージ.演奏.演奏ステージ();
250 this.結果ステージ = new ステージ.結果.結果ステージ();
253 this.曲読込ステージ.読込曲のファイルパスを取得する = () => ( ( StrokeStyleT.曲ツリー管理.現在選択されているノード as SST.曲.MusicNode )?.sstfファイルパス );
254 this.結果ステージ.演奏ステージインスタンスを取得する = () => ( this.演奏ステージ );
255 this.結果ステージ.BGMを終了する = () => { this.演奏ステージ.BGMを解放する(); };
258 #region " ユーザを初期化する。"
261 StrokeStyleT.ユーザ管理.UsersXmlを読み込む();
264 foreach( var ユーザ in StrokeStyleT.ユーザ管理.ユーザリスト )
265 ユーザ.SourcesXmlを読み込む();
268 #region " WASAPI デバイスを初期化する。"
270 StrokeStyleT.bs_Wasapiデバイス = new FDK.メディア.サウンド.WASAPI排他.ExclusiveDevice();
271 StrokeStyleT.bs_Wasapiデバイス.初期化する( 15.0f );
274 #region " キーボード入力 を初期化する。"
276 StrokeStyleT.bs_キーボード入力 = new FDK.入力.Keyboard( this.MainForm.Handle );
279 #region " MIDI入力 を初期化する。"
281 StrokeStyleT.bs_MIDI入力 = new FDK.入力.MidiIn();
285 FDK.Log.Info( "最初のダミーステージを開始します。" );
286 this.現在のステージ = this.最初のダミーステージ;
288 //#warning 全画面モード切替えを仮実装。
289 this.MainForm.KeyDown += ( target, arg ) => {
292 if( arg.KeyCode == System.Windows.Forms.Keys.F11 )
294 this.全画面モードとウィンドウモードを切り替える();
300 Debug.Assert( SharpDX.Size2F.Empty != this.設計画面サイズdpx, "設計画面サイズが設定されていません。" );
302 FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
304 protected void 終了する()
306 FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
307 Debug.Assert( null != this.デバイスリソース, "デバイスリソースが解放される前であること。" );
309 #region " ステージを終了し、解放する。"
311 if( ( null != this.現在のステージ ) && ( this.現在のステージ.活性化している ) ) // 念のため
312 this.現在のステージ.非活性化する( this.デバイスリソース );
314 this.最初のダミーステージ = null;
316 this.タイトルステージ = null;
317 this.ログインステージ = null;
325 #region " デバイスリソースを解放する。"
327 FDK.Utilities.解放する( ref this.デバイスリソース );
331 #region " MIDI入力デバイスを解放する。"
333 FDK.Log.Info( "MIDI入力デバイスを解放します。" );
334 FDK.Utilities.解放する( ref StrokeStyleT.bs_MIDI入力 );
337 #region " キーボード入力デバイスを解放する。"
339 FDK.Log.Info( "キーボード入力デバイスを解放します。" );
340 FDK.Utilities.解放する( ref StrokeStyleT.bs_キーボード入力 );
343 #region " WASAPIデバイスを解放する。"
345 FDK.Log.Info( "WASAPIデバイスを解放します。" );
346 FDK.Utilities.解放する( ref StrokeStyleT.bs_Wasapiデバイス );
350 #region " コンフィグを保存し、解放する。"
352 FDK.Log.Info( "コンフィグを解放します。" );
353 StrokeStyleT.bs_Config.ConfigXmlを保存する();
354 StrokeStyleT.bs_Config = null;
359 FDK.Utilities.解放する( ref this.MainForm );
363 #region " MediaFoundation を終了する。"
365 SharpDX.MediaFoundation.MediaManager.Shutdown();
369 FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
371 protected void 進行描画する()
373 #region " D3Dデバイスが消失していれば再構築する。"
376 this.デバイスリソース.D3Dデバイスが消失していれば再構築する( out 異常発生 );
378 // 再構築不可能な異常の場合は、即終了する。
381 this.State = ApplicationState.終了;
386 #region " 描画の前処理を行う。"
389 var d3dDevice = (SharpDX.Direct3D11.Device) null;
390 using( var d3dLock = new FDK.同期.AutoD3DDeviceLock( this.デバイスリソース.DXGIDeviceManager, out d3dDevice ) )
392 using( var d3dContext = d3dDevice.ImmediateContext )
394 // 既定のD3Dレンダーターゲットビューを黒でクリアする。
395 d3dContext.ClearRenderTargetView( this.デバイスリソース.D3DRenderTargetView, SharpDX.Color4.Black );
397 // 深度バッファを 1.0f でクリアする。
398 d3dContext.ClearDepthStencilView(
399 this.デバイスリソース.D3DDepthStencilView,
400 SharpDX.Direct3D11.DepthStencilClearFlags.Depth,
407 #region " 現在のステージを進行描画する。"
409 this.現在のステージ?.進行描画する( this.デバイスリソース );
412 #region " スワップチェーンを表示する。"
414 if( StrokeStyleT.Config.垂直帰線待ちを行う )
416 // We recommend that you use Flush when the CPU waits for an arbitrary amount of time
417 // (such as when you call the Sleep function).
418 // → https://msdn.microsoft.com/ja-jp/library/windows/desktop/ff476425(v=vs.85).aspx
420 var d3dDevice = (SharpDX.Direct3D11.Device) null;
421 using( var d3dLock = new FDK.同期.AutoD3DDeviceLock( this.デバイスリソース.DXGIDeviceManager, out d3dDevice ) )
423 using( var d3dContext = d3dDevice.ImmediateContext )
429 this.デバイスリソース.SwapChain1.Present(
430 ( StrokeStyleT.Config.垂直帰線待ちを行う ) ? 1 : 0,
431 SharpDX.DXGI.PresentFlags.None );
435 #region " ステージの状態をチェックし、必要あれば遷移またはアプリを終了する。"
437 if( null != this.現在のステージ )
439 switch( this.現在のステージ.GetType().Name )
441 case nameof( ステージ.ステージ ):
442 #region " ビュアーモード → AutoPlayerでログインして演奏ステージへ。"
444 if( StrokeStyleT.ビュアーモードである )
447 FDK.Log.Info( "ビュアーモード: AutoPlayer ユーザでログインします。" );
448 this.ログインする( Properties.Resources.AUTOPLAYER );
451 StrokeStyleT.曲ツリー管理.現在の管理対象ツリー = null;
452 StrokeStyleT.曲ツリー管理.現在選択されているノード = null;
455 StrokeStyleT.演奏スコア = null;
458 this.演奏ステージ.活性化する( this.デバイスリソース );
459 this.現在のステージ = this.演奏ステージ;
463 #region " 通常モード → 起動ステージへ。"
467 this.起動ステージ.活性化する( this.デバイスリソース );
468 this.現在のステージ = this.起動ステージ;
474 case nameof( ステージ.起動.起動ステージ ):
475 #region " 終了 → タイトルステージへ。"
477 if( this.起動ステージ.現在のフェーズ == ステージ.起動.起動ステージ.フェーズ.終了 )
479 this.現在のステージ.非活性化する( this.デバイスリソース );
480 this.現在のステージ = this.タイトルステージ;
481 this.現在のステージ.活性化する( this.デバイスリソース );
487 case nameof( ステージ.タイトル.タイトルステージ ):
488 #region " 確定 → ログインステージへ。"
490 if( this.タイトルステージ.現在のフェーズ == ステージ.タイトル.タイトルステージ.フェーズ.確定 )
492 this.現在のステージ.非活性化する( this.デバイスリソース );
493 this.現在のステージ = this.ログインステージ;
494 this.現在のステージ.活性化する( this.デバイスリソース );
498 #region " キャンセル → アプリを終了する。"
500 else if( this.タイトルステージ.現在のフェーズ == ステージ.タイトル.タイトルステージ.フェーズ.キャンセル )
502 this.現在のステージ.非活性化する( this.デバイスリソース );
504 this.State = ApplicationState.終了;
510 case nameof( ステージ.ログイン.ログインステージ ):
511 #region " 確定 → ログイン処理を行って、選曲ステージへ。"
513 if( this.ログインステージ.現在のフェーズ == ステージ.ログイン.ログインステージ.フェーズ.確定 )
515 var user = StrokeStyleT.ユーザ管理.現在選択されているユーザ;
519 foreach( var path in user.曲の検索元フォルダパスのリスト )
520 SST.曲.曲ツリー管理.フォルダから曲を再帰的に検索して子ノードリストに追加する( user.曲ツリーのルートノード, path );
522 StrokeStyleT.曲ツリー管理.現在の管理対象ツリー = StrokeStyleT.ユーザ管理.現在選択されているユーザ.曲ツリーのルートノード;
525 this.現在のステージ.非活性化する( this.デバイスリソース );
526 this.現在のステージ = this.選曲ステージ;
527 this.現在のステージ.活性化する( this.デバイスリソース );
531 #region " キャンセル → タイトルステージへ。"
533 else if( this.ログインステージ.現在のフェーズ == ステージ.ログイン.ログインステージ.フェーズ.キャンセル )
535 this.現在のステージ.非活性化する( this.デバイスリソース );
536 this.現在のステージ = this.タイトルステージ;
537 this.現在のステージ.活性化する( this.デバイスリソース );
543 case nameof( ステージ.選曲.選曲ステージ ):
544 #region " 曲確定 → 曲読込ステージへ。"
546 if( this.選曲ステージ.現在のフェーズ == ステージ.選曲.選曲ステージ.フェーズ.曲確定 )
548 // 曲ノードが選択されていることを確認。
549 Trace.Assert( null != StrokeStyleT.曲ツリー管理.現在選択されているノード, "[バグあり] 選択曲が null です。" );
550 this.現在のステージ.非活性化する( this.デバイスリソース );
551 this.現在のステージ = this.曲読込ステージ;
552 this.現在のステージ.活性化する( this.デバイスリソース );
556 #region " キャンセル → アプリを終了する。"
558 else if( this.選曲ステージ.現在のフェーズ == ステージ.選曲.選曲ステージ.フェーズ.キャンセル )
560 this.現在のステージ.非活性化する( this.デバイスリソース );
562 this.State = ApplicationState.終了;
568 case nameof( ステージ.曲読込.曲読込ステージ ):
569 #region " 終了 → 演奏ステージへ。"
570 //--------------------
571 if( this.曲読込ステージ.現在のフェーズ == ステージ.曲読込.曲読込ステージ.フェーズ.終了 )
573 this.現在のステージ.非活性化する( this.デバイスリソース );
574 this.現在のステージ = this.演奏ステージ;
575 this.現在のステージ.活性化する( this.デバイスリソース );
577 //--------------------
581 case nameof( ステージ.演奏.演奏ステージ ):
582 if( StrokeStyleT.ビュアーモードである )
586 #region " ビュアーメッセージがあれば処理する。"
588 var msg = this.ビュアーメッセージを取得する();
594 if( msg.種別 == ViewerMessageType.演奏開始 && (
595 this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.ビュアーメッセージ待機中 ||
596 this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.演奏中 )
600 var node = (SST.曲.MusicNode) null;
603 node = new 曲.MusicNode( msg.曲ファイルパス );
607 FDK.Log.ERROR( $"MusicNode の作成に失敗しました。" );
615 this.演奏ステージ.非活性化する( this.デバイスリソース );
616 this.演奏ステージ.BGMを解放する();
618 // 現在選択されているノードとして登録する。
619 StrokeStyleT.曲ツリー管理.現在選択されているノード = node;
621 // todo: 演奏開始小節番号を保存し、反映する。
624 this.現在のステージ = this.曲読込ステージ;
625 this.曲読込ステージ.活性化する( this.デバイスリソース );
632 else if( msg.種別 == ViewerMessageType.演奏停止 && (
633 this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.ビュアーメッセージ待機中 ||
634 this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.演奏中 )
637 this.演奏ステージ.演奏を停止する();
638 this.演奏ステージ.現在のフェーズ.Value = ステージ.演奏.演奏ステージ.フェーズ.ビュアーメッセージ待機中;
653 #region " クリア/キャンセル → メッセージ待機へ。"
655 if( this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.クリアor失敗 ||
656 this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.キャンセル )
658 // フェーズのみ変更。BGM は止めない。
659 this.演奏ステージ.現在のフェーズ.Value = ステージ.演奏.演奏ステージ.フェーズ.ビュアーメッセージ待機中;
668 #region " 演奏終了 → 結果ステージへ。"
669 //--------------------
670 if( this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.クリアor失敗 )
672 this.現在のステージ.非活性化する( this.デバイスリソース );
673 this.現在のステージ = this.結果ステージ;
674 this.現在のステージ.活性化する( this.デバイスリソース );
676 //--------------------
678 #region " キャンセル → 選曲ステージへ。"
679 //--------------------
680 if( this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.キャンセル )
682 this.現在のステージ.非活性化する( this.デバイスリソース );
683 this.現在のステージ = this.選曲ステージ;
684 this.現在のステージ.活性化する( this.デバイスリソース );
686 //--------------------
691 case nameof( ステージ.結果.結果ステージ ):
692 #region " 終了 → 選曲ステージへ。"
693 //--------------------
694 if( this.結果ステージ.現在のフェーズ == ステージ.結果.結果ステージ.フェーズ.終了 )
696 this.現在のステージ.非活性化する( this.デバイスリソース );
697 this.現在のステージ = this.選曲ステージ;
698 this.現在のステージ.活性化する( this.デバイスリソース );
700 //--------------------
708 protected void デバイス依存リソースを解放する()
710 FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
711 Debug.Assert( null != this.デバイスリソース ); // 解放前であること。
713 this.現在のステージ?.デバイス依存リソースを解放する( this.デバイスリソース );
715 FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
717 protected void デバイス依存リソースを再構築する()
719 FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
720 Debug.Assert( null != this.デバイスリソース ); // 再生成済みであること。
722 this.現在のステージ?.デバイス依存リソースを作成する( this.デバイスリソース );
724 FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
727 private void フォームサイズが変更された( object sender, EventArgs e )
729 FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
730 FDK.Log.Info( $"新しいクライアントサイズ = {this.MainForm.ClientSize}" );
734 if( null == this.デバイスリソース )
736 FDK.Log.Info( " まだ初期化されてないので、何もしません。" );
737 FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
740 if( this.MainForm.WindowState == FormWindowState.Minimized )
742 FDK.Log.Info( "最小化されました。" );
743 FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
746 if( this.State != ApplicationState.進行描画 )
748 FDK.Log.Info( " アプリケーションの状態が進行描画じゃないので、何もしません。" );
749 FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
755 Debug.Assert( null != this.デバイスリソース, "デバイスリソースが作成済みであること。" );
757 // 現在の画面モードを取得しておく。(Alt+TABなど、勝手に全画面を解除されることもあるので。)
758 SharpDX.Mathematics.Interop.RawBool fullscreen;
759 SharpDX.DXGI.Output outputTarget;
760 this.デバイスリソース.SwapChain1.GetFullscreenState( out fullscreen, out outputTarget );
761 this.MainForm.IsFullscreen = fullscreen;
762 outputTarget?.Dispose();
763 FDK.Log.Info( $"現在、全画面モードである = {this.MainForm.IsFullscreen}" );
766 this.デバイス依存リソースを解放する();
767 this.デバイスリソース.サイズに依存するリソースを解放する();
770 this.デバイスリソース.物理画面サイズpx = new SharpDX.Size2F( this.MainForm.ClientSize.Width, this.MainForm.ClientSize.Height );
773 this.デバイスリソース.サイズに依存するリソースを作成する();
774 this.デバイス依存リソースを再構築する();
776 FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
778 private void 全画面モードとウィンドウモードを切り替える()
780 FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
782 this.MainForm.IsFullscreen = !this.MainForm.IsFullscreen; // 切り替え
783 this.デバイスリソース.SwapChain1.SetFullscreenState( this.MainForm.IsFullscreen, null );
785 FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
787 private void ログインする( string ユーザ名 )
789 StrokeStyleT.ユーザ管理.ユーザを選択する( ユーザ名 );
790 FDK.Log.Info( $"ユーザが選択されました。[{StrokeStyleT.ユーザ管理.現在選択されているユーザ.名前}]" );
792 /// <returns>メッセージがない場合は null を返す。</returns>
793 private ViewerMessage ビュアーメッセージを取得する()
795 var msg = (ViewerMessage) null;
797 if( StrokeStyleT.ビュアーモードである &&
798 ( 0 < this.ビュアーメッセージキュー.Count ) &&
799 this.ビュアーメッセージキュー.TryDequeue( out msg ) )
809 private static SST.フォルダ bs_フォルダ = null;
810 private static FDK.入力.Keyboard bs_キーボード入力 = null;
811 private static FDK.入力.MidiIn bs_MIDI入力 = null;
812 private static FDK.メディア.サウンド.WASAPI排他.ExclusiveDevice bs_Wasapiデバイス = null;
813 private static readonly System.Random bs_乱数 = new Random( DateTime.Now.Millisecond );
814 private static SST.ユーザ.ユーザ管理 bs_ユーザ管理 = null;
815 private static SST.曲.曲ツリー管理 bs_曲ツリー管理 = null;
816 private static SST.設定.Config bs_Config = null;