OSDN Git Service

Merge branch '演奏位置の変更機能の追加' into develop
[strokestylet/CsWin10Desktop3.git] / StrokeStyleT / StrokeStyleT.cs
index 91939f7..4aca79c 100644 (file)
@@ -1,24 +1,34 @@
 using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
-using System.ComponentModel;
 using System.Diagnostics;
+using System.IO;
+using System.IO.Pipes;
 using System.Linq;
 using System.Windows.Forms;
+using FDK;     // for string 拡張
 
 namespace SST
 {
-       class StrokeStyleT : FDK.ApplicationBase
+       class StrokeStyleT
        {
                // グローバルリソース (static) 
-               public static SST.フォルダ フォルダ => StrokeStyleT.bs_フォルダ;
-               public static FDK.入力.Keyboard キーボード入力 => StrokeStyleT.bs_キーボード入力;
-               public static FDK.入力.MidiIn MIDI入力 => StrokeStyleT.bs_MIDI入力;
-               public static FDK.メディア.サウンド.WASAPI排他.ExclusiveDevice Wasapiデバイス => StrokeStyleT.bs_Wasapiデバイス;
-               public static Random 乱数 => StrokeStyleT.bs_乱数;
-               public static SST.ユーザ.ユーザ管理 ユーザ管理 => StrokeStyleT.bs_ユーザ管理;
-               public static SST.曲.曲ツリー管理 曲ツリー管理 => StrokeStyleT.bs_曲ツリー管理;
+               public static SST.フォルダ フォルダ => ( StrokeStyleT.bs_フォルダ );
+               public static FDK.入力.Keyboard キーボード入力 => ( StrokeStyleT.bs_キーボード入力 );
+               public static FDK.入力.MidiIn MIDI入力 => ( StrokeStyleT.bs_MIDI入力 );
+               public static FDK.メディア.サウンド.WASAPI排他.ExclusiveDevice Wasapiデバイス => ( StrokeStyleT.bs_Wasapiデバイス );
+               public static Random 乱数 => ( StrokeStyleT.bs_乱数 );
+               public static SST.ユーザ.ユーザ管理 ユーザ管理 => ( StrokeStyleT.bs_ユーザ管理 );
+               public static SST.曲.曲ツリー管理 曲ツリー管理 => ( StrokeStyleT.bs_曲ツリー管理 );
                public static SSTFormat.スコア 演奏スコア { get; set; } = null;
-
+               public static SST.設定.Config Config => ( StrokeStyleT.bs_Config );
+               public static bool ビュアーモードである { get; set; } = false;
+               public static bool ビュアーモードではない
+               {
+                       get { return !StrokeStyleT.ビュアーモードである; }
+                       set { StrokeStyleT.ビュアーモードである = !value; }
+               }
+               public static ConcurrentQueue<SST.ステージ.演奏.ビュアーメッセージ> ビュアーメッセージキュー => ( StrokeStyleT.bs_ビュアーメッセージキュー );
                public static void すべての入力デバイスをポーリングする()
                {
                        // hack: 追加の入力デバイスができたら、ここにポーリングコードを追加すること。
@@ -26,7 +36,6 @@ namespace SST
                        StrokeStyleT.MIDI入力?.ポーリングする();
                }
 
-               // get only static property の初期化。
                static StrokeStyleT()
                {
                        // フォルダ変数を真っ先に登録する。(ほかのメンバのコンストラクタでフォルダ変数を利用できるようにするため。)
@@ -34,25 +43,79 @@ namespace SST
                        SST.フォルダ.フォルダ変数を追加する( "Static", StrokeStyleT.フォルダ.StaticFolder );
                        SST.フォルダ.フォルダ変数を追加する( "AppData", StrokeStyleT.フォルダ.AppDataFolder );
                        SST.フォルダ.フォルダ変数を追加する( "User", null );
-
-                       // その他の static の生成。
-                       StrokeStyleT.bs_ユーザ管理 = new ユーザ.ユーザ管理();
-                       StrokeStyleT.bs_曲ツリー管理 = new 曲.曲ツリー管理();
                }
+               public StrokeStyleT()
+               {
+                       this.State = ApplicationState.起動;
+                       this.MainForm = new SharpDX.Windows.RenderForm();
+                       this.MainForm.AllowUserResizing = false;        // ユーザはフォームサイズを変更できない。
+                       this.MainForm.UserResized += フォームサイズが変更された;
+               }
+
+               public void Run()
+               {
+                       Debug.Assert( null != this.MainForm );
+                       SharpDX.Windows.RenderLoop.Run( this.MainForm, () => {
+
+                               // アプリケーションの状態に応じて処理分岐。
+                               switch( this.State )
+                               {
+                                       case ApplicationState.起動:
+                                               this.初期化する();
+                                               this.State = ApplicationState.進行描画;
+                                               break;
+
+                                       case ApplicationState.進行描画:
+                                               this.進行描画する();
+                                               if( this.State == ApplicationState.終了 )
+                                                       this.終了する();
+                                               break;
+
+                                       case ApplicationState.終了:
+                                               // 何もしない
+                                               break;
+                               }
 
-               public bool 垂直帰線待ちを行う { get; set; } = true;
+                       } );
+               }
 
-               protected override void 初期化する()
+               protected SharpDX.Windows.RenderForm MainForm = null;
+               protected enum ApplicationState
+               {
+                       起動,
+                       進行描画,
+                       終了,
+               }
+               protected ApplicationState State;
+               protected SharpDX.Size2F 設計画面サイズdpx = SharpDX.Size2F.Empty;
+               protected FDK.メディア.デバイスリソース デバイスリソース = null;
+               protected SST.ステージ.ステージ 最初のダミーステージ = null;
+               protected SST.ステージ.起動.起動ステージ 起動ステージ = null;
+               protected SST.ステージ.タイトル.タイトルステージ タイトルステージ = null;
+               protected SST.ステージ.ログイン.ログインステージ ログインステージ = null;
+               protected SST.ステージ.選曲.選曲ステージ 選曲ステージ = null;
+               protected SST.ステージ.曲読込.曲読込ステージ 曲読込ステージ = null;
+               protected SST.ステージ.演奏.演奏ステージ 演奏ステージ = null;
+               protected SST.ステージ.結果.結果ステージ 結果ステージ = null;
+               protected SST.ステージ.ステージ 現在のステージ = null;
+
+               protected void 初期化する()
                {
+                       FDK.Log.現在のスレッドに名前をつける( "Render" );
                        FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
+                       Debug.Assert( null == this.デバイスリソース, "デバイスリソースの作成前であること。" );
 
-                       Debug.Assert( null == this.スレッド排他領域.デバイスリソース, "デバイスリソースの作成前であること。" );
+                       StrokeStyleT.bs_ユーザ管理 = new ユーザ.ユーザ管理();
+                       StrokeStyleT.bs_曲ツリー管理 = new 曲.曲ツリー管理();
 
-                       this.Window.Text = $"StrokeStyle<T> {System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()}";
-                       this.Window.ClientSize = new System.Drawing.Size( 960, 540 );   // 物理画面サイズpx
-                       this.設計画面サイズdpx = new SharpDX.Size2F( 1920, 1080 );               // 設計画面サイズdpx
+                       #region " コマンドライン引数を解析する。"
+                       //----------------
+                       // 最初の要素は exe ファイル名なのでスキップする。
+                       this.コマンドライン引数を解析する( Environment.GetCommandLineArgs().Skip( 1 ) );
+                       //----------------
+                       #endregion
 
-                       #region " System.Stopwatch が高解像度タイマを使わないならエラー。"
+                       #region " 高解像度タイマを使えないならエラー。"
                        //-----------------
                        if( false == System.Diagnostics.Stopwatch.IsHighResolution )
                                throw new SSTException( "このシステムは、高解像度タイマをサポートしていません。" );
@@ -65,10 +128,60 @@ namespace SST
                        #endregion
                        #region " Sleep 精度を上げる。"
                        //-----------------
-                       StrokeStyleT.timeBeginPeriod( 1 );
+                       Win32.timeBeginPeriod( 1 );
                        //-----------------
                        #endregion
 
+                       #region " コンフィグ を初期化する。"
+                       //----------------
+                       FDK.Log.Info( "コンフィグを初期化します。" );
+                       StrokeStyleT.bs_Config = new 設定.Config();
+                       StrokeStyleT.bs_Config.ConfigXmlを読み込む();
+                       //----------------
+                       #endregion
+
+                       #region " コンフィグで指定されたウィンドウサイズに変更する。"
+                       //----------------
+                       this.MainForm.ClientSize = new System.Drawing.Size( StrokeStyleT.Config.物理画面サイズpx.Width, StrokeStyleT.Config.物理画面サイズpx.Height );
+                       //----------------
+                       #endregion
+                       #region " フォームタイトルと設計画面サイズを設定する。"
+                       //----------------
+                       this.MainForm.Text = $"StrokeStyle<T> {System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()}";
+                       if( StrokeStyleT.ビュアーモードである )
+                               this.MainForm.Text += " (Viewer)";
+
+                       this.設計画面サイズdpx = new SharpDX.Size2F( 1920f, 1080f );
+                       //----------------
+                       #endregion
+
+                       #region " デバイスリソースを作成する。"
+                       //----------------
+                       FDK.Log.BeginInfo( "デバイスリソースを作成します。" );
+                       FDK.Log.Info( $"設計画面サイズ: {this.設計画面サイズdpx}" );
+                       FDK.Log.Info( $"物理画面サイズ: {this.MainForm.ClientSize}" );
+                       this.デバイスリソース = new FDK.メディア.デバイスリソース( this.設計画面サイズdpx );
+                       this.デバイスリソース.すべてのリソースを作成する( this.MainForm.ClientSize, this.MainForm.Handle );
+                       //----------------
+                       #endregion
+
+                       #region " ステージを生成する。"
+                       //----------------
+                       this.最初のダミーステージ = new ステージ.ステージ();
+                       this.起動ステージ = new ステージ.起動.起動ステージ();
+                       this.タイトルステージ = new ステージ.タイトル.タイトルステージ();
+                       this.ログインステージ = new ステージ.ログイン.ログインステージ();
+                       this.選曲ステージ = new ステージ.選曲.選曲ステージ();
+                       this.曲読込ステージ = new ステージ.曲読込.曲読込ステージ();
+                       this.演奏ステージ = new ステージ.演奏.演奏ステージ();
+                       this.結果ステージ = new ステージ.結果.結果ステージ();
+
+                       // 外部依存アクションを接続する。
+                       this.曲読込ステージ.読込曲のファイルパスを取得する = () => ( ( StrokeStyleT.曲ツリー管理.現在選択されているノード as SST.曲.MusicNode )?.sstfファイルパス );
+                       this.結果ステージ.演奏ステージインスタンスを取得する = () => ( this.演奏ステージ );
+                       this.結果ステージ.BGMを終了する = () => { this.演奏ステージ.BGMを解放する(); };
+                       //----------------
+                       #endregion
                        #region " ユーザを初期化する。"
                        //-----------------
                        FDK.Log.Info( "ユーザ情報を初期化します。" );
@@ -88,7 +201,7 @@ namespace SST
                        #region " キーボード入力 を初期化する。"
                        //-----------------
                        FDK.Log.Info( "キーボード入力デバイスを初期化します。" );
-                       StrokeStyleT.bs_キーボード入力 = new FDK.入力.Keyboard( this.Window.Handle );
+                       StrokeStyleT.bs_キーボード入力 = new FDK.入力.Keyboard( this.MainForm.Handle );
                        //-----------------
                        #endregion
                        #region " MIDI入力 を初期化する。"
@@ -98,29 +211,34 @@ namespace SST
                        //-----------------
                        #endregion
 
+                       FDK.Log.Info( "最初のダミーステージを開始します。" );
                        this.現在のステージ = this.最初のダミーステージ;
 
-#warning 全画面モード切替えを KeyDown で仮実装。
-                       this.Window.KeyDown += ( target, arg ) => {
-                               // Alt+Enter → 画面モードの切り替え
-//                             if( ( arg.KeyCode == System.Windows.Forms.Keys.Return ) && ( arg.Modifiers == Keys.Alt ) )
-//                                     this.全画面モードとウィンドウモードを切り替える();
+                       //#warning 全画面モード切替えを KeyDown で仮実装。
+                       this.MainForm.KeyDown += ( target, arg ) => {
+
+                               // F11 → 画面モードの切り替え
+                               if( arg.KeyCode == System.Windows.Forms.Keys.F11 )
+                               {
+                                       this.全画面モードとウィンドウモードを切り替える();
+                                       arg.Handled = true;
+                               }
                        };
 
+                       Debug.Assert( SharpDX.Size2F.Empty != this.設計画面サイズdpx, "初期化メソッド内で設計画面サイズを設定してあること。" );
                        FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
                }
-               protected override void 終了する()
+               protected void 終了する()
                {
                        FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
-
-                       Debug.Assert( null != this.スレッド排他領域.デバイスリソース, "デバイスリソースが解放される前であること。" );
+                       Debug.Assert( null != this.デバイスリソース, "デバイスリソースが解放される前であること。" );
 
                        #region " ステージを終了し、解放する。"
                        //----------------
-                       if( ( null != this.現在のステージ ) && ( this.現在のステージ.活性化している ) )
-                               this.ç\8f¾å\9c¨ã\81®ã\82¹ã\83\86ã\83¼ã\82¸.é\9d\9eæ´»æ\80§å\8c\96ã\81\99ã\82\8b( this.ã\82¹ã\83¬ã\83\83ã\83\89æ\8e\92ä»\96é \98å\9f\9f\83\87ã\83\90ã\82¤ã\82¹ã\83ªã\82½ã\83¼ã\82¹ );
+                       if( ( null != this.現在のステージ ) && ( this.現在のステージ.活性化している ) )      // 念のため
+                               this.現在のステージ.非活性化する( this.デバイスリソース );
 
-                       this.最初のダミーステージ  = null;
+                       this.最初のダミーステージ = null;
                        this.起動ステージ = null;
                        this.タイトルステージ = null;
                        this.ログインステージ = null;
@@ -130,13 +248,20 @@ namespace SST
                        this.結果ステージ = null;
                        //----------------
                        #endregion
-                       #region " MIDI入力 を解放する。"
+
+                       #region " デバイスリソースを解放する。"
+                       //----------------
+                       FDK.Utilities.解放する( ref this.デバイスリソース );
+                       //----------------
+                       #endregion
+
+                       #region " MIDI入力デバイスを解放する。"
                        //-----------------
                        FDK.Log.Info( "MIDI入力デバイスを解放します。" );
                        FDK.Utilities.解放する( ref StrokeStyleT.bs_MIDI入力 );
                        //-----------------
                        #endregion
-                       #region " キーボード入力 を解放する。"
+                       #region " キーボード入力デバイスを解放する。"
                        //-----------------
                        FDK.Log.Info( "キーボード入力デバイスを解放します。" );
                        FDK.Utilities.解放する( ref StrokeStyleT.bs_キーボード入力 );
@@ -144,9 +269,24 @@ namespace SST
                        #endregion
                        #region " WASAPIデバイスを解放する。"
                        //----------------
+                       FDK.Log.Info( "WASAPIデバイスを解放します。" );
                        FDK.Utilities.解放する( ref StrokeStyleT.bs_Wasapiデバイス );
                        //----------------
                        #endregion
+                       
+                       #region " コンフィグを保存し、解放する。"
+                       //----------------
+                       FDK.Log.Info( "コンフィグを解放します。" );
+                       StrokeStyleT.bs_Config.ConfigXmlを保存する();
+                       StrokeStyleT.bs_Config = null;
+                       //----------------
+                       #endregion
+                       #region " フォームを閉じる。"
+                       //----------------
+                       FDK.Utilities.解放する( ref this.MainForm );
+                       //----------------
+                       #endregion
+
                        #region " MediaFoundation を終了する。"
                        //-----------------
                        SharpDX.MediaFoundation.MediaManager.Shutdown();
@@ -155,240 +295,471 @@ namespace SST
 
                        FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
                }
-               protected override void シーンを描画する()
+               protected void 進行描画する()
                {
-                       // このメソッドは、GUIスレッドではなく進行描画スレッドから呼び出されるので注意。
-
-                       this.スレッド排他領域.WriteLock( () => {
-
-                               #region " 描画を準備する。"
-                               //----------------
-                               var dr = this.スレッド排他領域.デバイスリソース;
+                       #region " D3Dデバイスが消失していれば再構築する。"
+                       //----------------
+                       bool 異常発生 = false;
+                       this.デバイスリソース.D3Dデバイスが消失していれば再構築する( out 異常発生 );
+
+                       // 再構築不可能な異常の場合は、即終了する。
+                       if( 異常発生 )
+                       {
+                               this.State = ApplicationState.終了;
+                               return;
+                       }
+                       //----------------
+                       #endregion
+                       #region " 描画の前処理を行う。"
+                       //----------------
+                       {
                                var d3dDevice = (SharpDX.Direct3D11.Device) null;
-                               using( var d3dLock = new FDK.同期.AutoD3DDeviceLock( dr.DXGIDeviceManager, out d3dDevice ) )
+                               using( var d3dLock = new FDK.同期.AutoD3DDeviceLock( this.デバイスリソース.DXGIDeviceManager, out d3dDevice ) )
                                using( d3dDevice )
                                using( var d3dContext = d3dDevice.ImmediateContext )
                                {
                                        // 既定のD3Dレンダーターゲットビューを黒でクリアする。
-                                       d3dContext.ClearRenderTargetView( dr.D3DRenderTargetView, SharpDX.Color4.Black );
+                                       d3dContext.ClearRenderTargetView( this.デバイスリソース.D3DRenderTargetView, SharpDX.Color4.Black );
 
                                        // 深度バッファを 1.0f でクリアする。
                                        d3dContext.ClearDepthStencilView(
-                                               dr.D3DDepthStencilView,
+                                               this.デバイスリソース.D3DDepthStencilView,
                                                SharpDX.Direct3D11.DepthStencilClearFlags.Depth,
                                                depth: 1.0f,
                                                stencil: 0 );
                                }
-                               //----------------
-                               #endregion
-
-                               // 現在のステージを進行描画する。
-                               this.現在のステージ?.進行描画する( this.スレッド排他領域.デバイスリソース );
-
-                       } );
-
-                       // 表示する。垂直帰線待ちなどで時間がかかるのでロックしないこと。
-                       if( false == this.スレッド排他領域.アプリを終了せよ )
-                               this.スレッド排他領域.デバイスリソース.SwapChain.Present(
-                                       ( this.垂直帰線待ちを行う ) ? 1 : 0,
-                                       SharpDX.DXGI.PresentFlags.None );
-
-                       this.スレッド排他領域.WriteLock( () => {
+                       }
+                       //----------------
+                       #endregion
+                       #region " 現在のステージを進行描画する。"
+                       //----------------
+                       this.現在のステージ?.進行描画する( this.デバイスリソース );
+                       //----------------
+                       #endregion
+                       #region " スワップチェーンを表示する。"
+                       //----------------
+                       if( StrokeStyleT.Config.垂直帰線待ちを行う )
+                       {
+                               // We recommend that you use Flush when the CPU waits for an arbitrary amount of time
+                               // ( such as when you call the Sleep function). 
+                               // https://msdn.microsoft.com/ja-jp/library/windows/desktop/ff476425(v=vs.85).aspx
+                               var d3dDevice = (SharpDX.Direct3D11.Device) null;
+                               using( var d3dLock = new FDK.同期.AutoD3DDeviceLock( this.デバイスリソース.DXGIDeviceManager, out d3dDevice ) )
+                               using( d3dDevice )
+                               using( var d3dContext = d3dDevice.ImmediateContext )
+                               {
+                                       d3dContext.Flush();
+                               }
+                       }
 
-                               if( null != this.現在のステージ )
+                       this.デバイスリソース.SwapChain1.Present(
+                               ( StrokeStyleT.Config.垂直帰線待ちを行う ) ? 1 : 0,
+                               SharpDX.DXGI.PresentFlags.None );
+                       //----------------
+                       #endregion
+                       #region " ステージの状態をチェックし、必要あれば遷移またはアプリを終了する。"
+                       //----------------
+                       if( null != this.現在のステージ )
+                       {
+                               switch( this.現在のステージ.GetType().Name )
                                {
-                                       // ステージの状態チェックを行い、必要あれば遷移、またはアプリを終了する。
-                                       switch( this.現在のステージ.GetType().Name )
-                                       {
-                                               case nameof( ステージ.ステージ ):
-                                                       #region " 最初のダミーステージ "
-                                                       //----------------
-                                                       // 起動ステージへ遷移する。
-                                                       this.起動ステージ.活性化する( this.スレッド排他領域.デバイスリソース );
+                                       case nameof( ステージ.ステージ ):
+                                               #region " ビュアーモード → AutoPlayerでログインして曲読込ステージへ。"
+                                               //----------------
+                                               if( StrokeStyleT.ビュアーモードである )
+                                               {
+                                                       FDK.Log.Info( "ビュアーモード: AutoPlayer ユーザでログインします。" );
+                                                       this.ログインする( Properties.Resources.AUTOPLAYER );
+
+                                                       this.曲読込ステージ.読込曲のファイルパスを取得する = () => ( null );  // 今は null 。あとでメッセージキューを見る。
+                                                       this.曲読込ステージ.活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = this.曲読込ステージ;
+                                               }
+                                               //----------------
+                                               #endregion
+                                               #region " 通常モード → 起動ステージへ。"
+                                               //----------------
+                                               else
+                                               {
+                                                       this.起動ステージ.活性化する( this.デバイスリソース );
                                                        this.現在のステージ = this.起動ステージ;
-                                                       //----------------
-                                                       #endregion
-                                                       break;
-
-                                               case nameof( ステージ.起動.起動ステージ ):
-                                                       #region " 終了 → タイトルステージへ。"
-                                                       //---------------
-                                                       if( this.起動ステージ.現在のフェーズ == ステージ.起動.起動ステージ.フェーズ.終了 )
-                                                       {
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = this.タイトルステージ;
-                                                               this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
-                                                       }
-                                                       //---------------
-                                                       #endregion
-                                                       break;
-
-                                               case nameof( ステージ.タイトル.タイトルステージ ):
-                                                       #region " 確定 → ログインステージへ。"
-                                                       //---------------
-                                                       if( this.タイトルステージ.現在のフェーズ == ステージ.タイトル.タイトルステージ.フェーズ.確定 )
+                                               }
+                                               //----------------
+                                               #endregion
+                                               break;
+
+                                       case nameof( ステージ.起動.起動ステージ ):
+                                               #region " 終了 → タイトルステージへ。"
+                                               //---------------
+                                               if( this.起動ステージ.現在のフェーズ == ステージ.起動.起動ステージ.フェーズ.終了 )
+                                               {
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = this.タイトルステージ;
+                                                       this.現在のステージ.活性化する( this.デバイスリソース );
+                                               }
+                                               //---------------
+                                               #endregion
+                                               break;
+
+                                       case nameof( ステージ.タイトル.タイトルステージ ):
+                                               #region " 確定 → ログインステージへ。"
+                                               //---------------
+                                               if( this.タイトルステージ.現在のフェーズ == ステージ.タイトル.タイトルステージ.フェーズ.確定 )
+                                               {
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = this.ログインステージ;
+                                                       this.現在のステージ.活性化する( this.デバイスリソース );
+                                               }
+                                               //---------------
+                                               #endregion
+                                               #region " キャンセル → アプリを終了する。"
+                                               //---------------
+                                               else if( this.タイトルステージ.現在のフェーズ == ステージ.タイトル.タイトルステージ.フェーズ.キャンセル )
+                                               {
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = null;
+                                                       this.State = ApplicationState.終了;
+                                               }
+                                               //---------------
+                                               #endregion
+                                               break;
+
+                                       case nameof( ステージ.ログイン.ログインステージ ):
+                                               #region " 確定 → ログイン処理を行って、選曲ステージへ。"
+                                               //---------------
+                                               if( this.ログインステージ.現在のフェーズ == ステージ.ログイン.ログインステージ.フェーズ.確定 )
+                                               {
+                                                       var user = StrokeStyleT.ユーザ管理.現在選択されているユーザ;
+
+                                                       if( null != user )
                                                        {
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = this.ログインステージ;
-                                                               this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
-                                                       }
-                                                       //---------------
-                                                       #endregion
-                                                       #region " キャンセル → アプリを終了する。"
-                                                       //---------------
-                                                       else if( this.タイトルステージ.現在のフェーズ == ステージ.タイトル.タイトルステージ.フェーズ.キャンセル )
-                                                       {
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = null;
-                                                               this.スレッド排他領域.アプリを終了せよ = true;
-                                                       }
-                                                       //---------------
-                                                       #endregion
-                                                       break;
-
-                                               case nameof( ステージ.ログイン.ログインステージ ):
-                                                       #region " 確定 → ログイン処理を行って、選曲ステージへ。"
-                                                       //---------------
-                                                       if( this.ログインステージ.現在のフェーズ == ステージ.ログイン.ログインステージ.フェーズ.確定 )
-                                                       {
-                                                               // ログイン処理(1) ユーザリストに対してユーザを選択する。
-                                                               StrokeStyleT.ユーザ管理.ユーザを選択する( this.ログインステージ.ユーザインデックス );
-                                                               FDK.Log.Info( $"ユーザが選択されました。[{StrokeStyleT.ユーザ管理.現在選択されているユーザ.名前}]" );
-
-                                                               // ログイン処理(2) 選択ユーザの曲ツリーを構築する。
-                                                               StrokeStyleT.ユーザ管理.現在選択されているユーザ.曲を検索して曲ツリーを構築する();
+                                                               foreach( var path in user.曲の検索元フォルダパスのリスト )
+                                                                       SST.曲.曲ツリー管理.フォルダから曲を再帰的に検索して子ノードリストに追加する( user.曲ツリーのルートノード, path );
 
-                                                               // ログイン処理(3) 構築した曲ツリーを曲リスト管理に登録する。
                                                                StrokeStyleT.曲ツリー管理.現在の管理対象ツリー = StrokeStyleT.ユーザ管理.現在選択されているユーザ.曲ツリーのルートノード;
-
-                                                               // 選曲ステージへ。
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = this.選曲ステージ;
-                                                               this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
-                                                       }
-                                                       //---------------
-                                                       #endregion
-                                                       #region " キャンセル → タイトルステージへ。"
-                                                       //---------------
-                                                       else if( this.ログインステージ.現在のフェーズ == ステージ.ログイン.ログインステージ.フェーズ.キャンセル )
-                                                       {
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = this.タイトルステージ;
-                                                               this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
-                                                       }
-                                                       //---------------
-                                                       #endregion
-                                                       break;
-
-                                               case nameof( ステージ.選曲.選曲ステージ ):
-                                                       #region " 曲確定 → 曲読込ステージへ。"
-                                                       //---------------
-                                                       if( this.選曲ステージ.現在のフェーズ == ステージ.選曲.選曲ステージ.フェーズ.曲確定 )
-                                                       {
-                                                               // 曲ノードが選択されていることを確認。
-                                                               Trace.Assert( null != StrokeStyleT.曲ツリー管理.現在選択されているノード, "[バグあり] 選択曲が null です。" );
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = this.曲読込ステージ;
-                                                               this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
                                                        }
-                                                       //---------------
-                                                       #endregion
-                                                       #region " キャンセル → アプリを終了する。"
-                                                       //---------------
-                                                       else if( this.選曲ステージ.現在のフェーズ == ステージ.選曲.選曲ステージ.フェーズ.キャンセル )
-                                                       {
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = null;
-                                                               this.スレッド排他領域.アプリを終了せよ = true;
-                                                       }
-                                                       //---------------
-                                                       #endregion
-                                                       break;
-
-                                               case nameof( ステージ.曲読込.曲読込ステージ ):
-                                                       #region " 終了 → 演奏ステージへ。"
-                                                       //--------------------
-                                                       if( this.曲読込ステージ.現在のフェーズ == ステージ.曲読込.曲読込ステージ.フェーズ.終了 )
-                                                       {
-                                                               // 演奏スコアインスタンスが作成されていることを確認。
-                                                               Debug.Assert( null != StrokeStyleT.演奏スコア );
 
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = this.演奏ステージ;
-                                                               this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
-                                                       }
-                                                       //--------------------
-                                                       #endregion
-                                                       break;
-
-                                               case nameof( ステージ.演奏.演奏ステージ ):
-                                                       #region " 演奏終了 → 結果ステージへ。"
-                                                       //--------------------
-                                                       if( this.演奏ステージ.現在のフェーズ == ステージ.演奏.演奏ステージ.フェーズ.クリアor失敗 )
-                                                       {
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = this.結果ステージ;
-                                                               this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
-                                                       }
-                                                       //--------------------
-                                                       #endregion
-                                                       #region " キャンセル → 選曲ステージへ。"
-                                                       //--------------------
-                                                       if( this.演奏ステージ.現在のフェーズ == ステージ.演奏.演奏ステージ.フェーズ.キャンセル )
-                                                       {
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = this.選曲ステージ;
-                                                               this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
-                                                       }
-                                                       //--------------------
-                                                       #endregion
-                                                       break;
-
-                                               case nameof( ステージ.結果.結果ステージ ):
-                                                       #region " 終了 → 選曲ステージへ。"
-                                                       //--------------------
-                                                       if( this.結果ステージ.現在のフェーズ == ステージ.結果.結果ステージ.フェーズ.終了 )
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = this.選曲ステージ;
+                                                       this.現在のステージ.活性化する( this.デバイスリソース );
+                                               }
+                                               //---------------
+                                               #endregion
+                                               #region " キャンセル → タイトルステージへ。"
+                                               //---------------
+                                               else if( this.ログインステージ.現在のフェーズ == ステージ.ログイン.ログインステージ.フェーズ.キャンセル )
+                                               {
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = this.タイトルステージ;
+                                                       this.現在のステージ.活性化する( this.デバイスリソース );
+                                               }
+                                               //---------------
+                                               #endregion
+                                               break;
+
+                                       case nameof( ステージ.選曲.選曲ステージ ):
+                                               #region " 曲確定 → 曲読込ステージへ。"
+                                               //---------------
+                                               if( this.選曲ステージ.現在のフェーズ == ステージ.選曲.選曲ステージ.フェーズ.曲確定 )
+                                               {
+                                                       // 曲ノードが選択されていることを確認。
+                                                       Trace.Assert( null != StrokeStyleT.曲ツリー管理.現在選択されているノード, "[バグあり] 選択曲が null です。" );
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = this.曲読込ステージ;
+                                                       this.現在のステージ.活性化する( this.デバイスリソース );
+                                               }
+                                               //---------------
+                                               #endregion
+                                               #region " キャンセル → アプリを終了する。"
+                                               //---------------
+                                               else if( this.選曲ステージ.現在のフェーズ == ステージ.選曲.選曲ステージ.フェーズ.キャンセル )
+                                               {
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = null;
+                                                       this.State = ApplicationState.終了;
+                                               }
+                                               //---------------
+                                               #endregion
+                                               break;
+
+                                       case nameof( ステージ.曲読込.曲読込ステージ ):
+                                               #region " 終了 → 演奏ステージへ。"
+                                               //--------------------
+                                               if( this.曲読込ステージ.現在のフェーズ == ステージ.曲読込.曲読込ステージ.フェーズ.終了 )
+                                               {
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+
+                                                       if( StrokeStyleT.ビュアーモードである )
+                                                               this.デバイス情報を出力する();
+
+                                                       this.現在のステージ = this.演奏ステージ;
+                                                       this.現在のステージ.活性化する( this.デバイスリソース );
+                                               }
+                                               //--------------------
+                                               #endregion
+                                               break;
+
+                                       case nameof( ステージ.演奏.演奏ステージ ):
+                                               #region " 演奏終了 → 結果ステージへ。"
+                                               //--------------------
+                                               if( this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.クリアor失敗 )
+                                               {
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = this.結果ステージ;
+                                                       this.現在のステージ.活性化する( this.デバイスリソース );
+                                               }
+                                               //--------------------
+                                               #endregion
+                                               #region " キャンセル → 選曲ステージへ。"
+                                               //--------------------
+                                               if( this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.キャンセル )
+                                               {
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = this.選曲ステージ;
+                                                       this.現在のステージ.活性化する( this.デバイスリソース );
+                                               }
+                                               //--------------------
+                                               #endregion
+                                               #region " ビュアーメッセージ受信 → 曲読込ステージへ。"
+                                               //--------------------
+                                               if( this.演奏ステージ.現在のフェーズ.Value == ステージ.演奏.演奏ステージ.フェーズ.ビュアーメッセージ待機中 )
+                                               {
+                                                       var msg = (SST.ステージ.演奏.ビュアーメッセージ) null;
+                                                       if( ( 0 < StrokeStyleT.ビュアーメッセージキュー.Count ) &&
+                                                               ( StrokeStyleT.ビュアーメッセージキュー.TryDequeue( out msg ) ) )
                                                        {
-                                                               this.現在のステージ.非活性化する( this.スレッド排他領域.デバイスリソース );
-                                                               this.現在のステージ = this.選曲ステージ;
-                                                               this.現在のステージ.活性化する( this.スレッド排他領域.デバイスリソース );
+                                                               FDK.Log.Info( "ビュアーメッセージを受信しました。" );
+                                                               this.曲読込ステージ.読込曲のファイルパスを取得する = () => { return msg.曲ファイルパス; };
+
+                                                               this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                               this.演奏ステージ.BGMを解放する();
+                                                               this.現在のステージ = this.曲読込ステージ;
+                                                               this.現在のステージ.活性化する( this.デバイスリソース );
                                                        }
-                                                       //--------------------
-                                                       #endregion
-                                                       break;
-                                       }
+                                               }
+                                               //--------------------
+                                               #endregion
+                                               break;
+
+                                       case nameof( ステージ.結果.結果ステージ ):
+                                               #region " 終了 → 選曲ステージへ。"
+                                               //--------------------
+                                               if( this.結果ステージ.現在のフェーズ == ステージ.結果.結果ステージ.フェーズ.終了 )
+                                               {
+                                                       this.現在のステージ.非活性化する( this.デバイスリソース );
+                                                       this.現在のステージ = this.選曲ステージ;
+                                                       this.現在のステージ.活性化する( this.デバイスリソース );
+                                               }
+                                               //--------------------
+                                               #endregion
+                                               break;
                                }
+                       }
+                       //----------------
+                       #endregion
+               }
+               protected void デバイス依存リソースを解放する()
+               {
+                       FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
+                       Debug.Assert( null != this.デバイスリソース );  // 解放前であること。
 
-                       } );
+                       this.現在のステージ?.デバイス依存リソースを解放する( this.デバイスリソース );
+
+                       FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
+               }
+               protected void デバイス依存リソースを再構築する()
+               {
+                       FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
+                       Debug.Assert( null != this.デバイスリソース );  // 再生成済みであること。
+
+                       this.現在のステージ?.デバイス依存リソースを作成する( this.デバイスリソース );
+
+                       FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
+               }
+
+               private void フォームサイズが変更された( object sender, EventArgs e )
+               {
+                       FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
+                       FDK.Log.Info( $"新しいクライアントサイズ = {this.MainForm.ClientSize}" );
+
+                       #region " 実行条件チェック。"
+                       //----------------
+                       if( null == this.デバイスリソース )
+                       {
+                               FDK.Log.Info( " まだ初期化されてないので、何もしません。" );
+                               FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
+                               return;
+                       }
+                       if( this.MainForm.WindowState == FormWindowState.Minimized )
+                       {
+                               FDK.Log.Info( "最小化されました。" );
+                               FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
+                               return; // 何もしない
+                       }
+                       if( this.State != ApplicationState.進行描画 )
+                       {
+                               FDK.Log.Info( " アプリケーションの状態が進行描画じゃないので、何もしません。" );
+                               FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
+                               return;
+                       }
+                       //----------------
+                       #endregion
+
+                       Debug.Assert( null != this.デバイスリソース, "デバイスリソースが作成済みであること。" );
+
+                       // 現在の画面モードを取得しておく。(Alt+TABなど、勝手に全画面を解除されることもあるので。)
+                       SharpDX.Mathematics.Interop.RawBool fullscreen;
+                       SharpDX.DXGI.Output outputTarget;
+                       this.デバイスリソース.SwapChain1.GetFullscreenState( out fullscreen, out outputTarget );
+                       this.MainForm.IsFullscreen = fullscreen;
+                       outputTarget?.Dispose();
+                       FDK.Log.Info( $"現在、全画面モードである = {this.MainForm.IsFullscreen}" );
+
+                       // (1) リソースを解放して、
+                       this.デバイス依存リソースを解放する();
+                       this.デバイスリソース.サイズに依存するリソースを解放する();
+
+                       // (2) 物理画面サイズを変更して、
+                       this.デバイスリソース.物理画面サイズpx = new SharpDX.Size2F( this.MainForm.ClientSize.Width, this.MainForm.ClientSize.Height );
+
+                       // (3) リソースを再構築する。
+                       this.デバイスリソース.サイズに依存するリソースを作成する();
+                       this.デバイス依存リソースを再構築する();
+
+                       FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
                }
-               protected override void デバイス依存リソースを再構築する()
+               private void 全画面モードとウィンドウモードを切り替える()
                {
                        FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
 
-                       this.現在のステージ?.デバイス依存リソースを作成する( this.スレッド排他領域.デバイスリソース );
+                       this.MainForm.IsFullscreen = !this.MainForm.IsFullscreen;
+                       this.デバイスリソース.SwapChain1.SetFullscreenState( this.MainForm.IsFullscreen, null );
 
                        FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
                }
-               protected override void デバイス依存リソースを解放する()
+               private void ログインする( string ユーザ名 )
+               {
+                       StrokeStyleT.ユーザ管理.ユーザを選択する( ユーザ名 );
+                       FDK.Log.Info( $"ユーザが選択されました。[{StrokeStyleT.ユーザ管理.現在選択されているユーザ.名前}]" );
+               }
+               private void デバイス情報を出力する()
+               {
+                       using( var stream = new NamedPipeClientStream( "SSTFEditor Viewer Device Information" ) )
+                       {
+                               try
+                               {
+                                       stream.Connect( 1000 );
+
+                                       using( var writer = new StreamWriter( stream ) )
+                                       {
+                                               writer.WriteLine( $"SoundDevice.Delay={StrokeStyleT.Wasapiデバイス.遅延ms.ToString()}" );
+                                               FDK.Log.Info( "デバイス情報を出力しました。" );
+                                       }
+                               }
+                               catch( TimeoutException )
+                               {
+                                       FDK.Log.WARNING( "SSTFEditor ビュアー用パイプへの接続がタイムアウトしました。SSTFEditor が起動していない可能性があります。" );
+                               }
+                       }
+               }
+               private void 二重起動された( string[] args )
                {
                        FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
 
-                       this.現在のステージ?.デバイス依存リソースを解放する( this.スレッド排他領域.デバイスリソース );
+                       if( StrokeStyleT.ビュアーモードである )
+                       {
+                               this.コマンドライン引数を解析する( args );
+                       }
+                       else
+                       {
+                               FDK.Log.ERROR( "アプリが二重起動されましたが、先行アプリがビュアーモードではないので何もしません。" );
+                       }
 
                        FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
                }
+               /// <param name="args">コマンドライン引数の列挙。exeファイル名は含まない。</param>
+               private void コマンドライン引数を解析する( IEnumerable<string> args )
+               {
+                       FDK.Log.BeginInfo( $"{FDK.Utilities.現在のメソッド名}" );
 
-               // 各ステージの、唯一のインスタンス。
-               protected SST.ステージ.ステージ 最初のダミーステージ = new ステージ.ステージ();
-               protected SST.ステージ.起動.起動ステージ 起動ステージ = new ステージ.起動.起動ステージ();
-               protected SST.ステージ.タイトル.タイトルステージ タイトルステージ = new ステージ.タイトル.タイトルステージ();
-               protected SST.ステージ.ログイン.ログインステージ ログインステージ = new ステージ.ログイン.ログインステージ();
-               protected SST.ステージ.選曲.選曲ステージ 選曲ステージ = new ステージ.選曲.選曲ステージ();
-               protected SST.ステージ.曲読込.曲読込ステージ 曲読込ステージ = new ステージ.曲読込.曲読込ステージ();
-               protected SST.ステージ.演奏.演奏ステージ 演奏ステージ = new ステージ.演奏.演奏ステージ();
-               protected SST.ステージ.結果.結果ステージ 結果ステージ = new ステージ.結果.結果ステージ();
+                       try
+                       {
+                               if( 0 == args.Count() )
+                               {
+                                       FDK.Log.Info( "引数は指定されていません。" );    // ビュアーモードではない。
+                                       return;
+                               }
 
-               private SST.ステージ.ステージ 現在のステージ = null;
+                               StrokeStyleT.ビュアーモードである = true;
+
+                               try
+                               {
+                                       // 新しいメッセージを生成する。
+                                       var msg = new ステージ.演奏.ビュアーメッセージ() {
+                                               種別 = ステージ.演奏.ビュアーメッセージ.E種別.演奏開始,        // 規定値は「演奏開始」
+                                               曲ファイルパス = null,
+                                               演奏開始小節番号 = 0,
+                                               ドラム音を発声する = false,  // 規定値は false
+                                       };
+
+                                       // オプションを定義する。
+                                       var optionSet = new Mono.Options.OptionSet() {
+                                               "Usage: StrokeStyleT [File] [OPTIONS]+",
+                                               "  File\t\t\t\tビュアーモードで表示する曲ファイル名です。",
+                                               { "p=|part=", "ビュアーモードで起動し、指定された小節番号から演奏を開始します。小節番号を省略すると、先頭から再生します。", (int v) => { msg.演奏開始小節番号 = v; }  },
+                                               { "s|stop", "ビュアーモードで演奏中であれば、演奏を停止します。", v => { if ( v != null ) { msg.種別 = ステージ.演奏.ビュアーメッセージ.E種別.演奏停止; } } },
+                                               { "d|drums", "ビュアーモードで、チップヒット時に内蔵のドラム音を再生します。", v => { if( v != null ) { msg.ドラム音を発声する = true; } } },
+                                       };
+
+                                       // オプションを解析する。
+                                       List<string> ファイルパスs = optionSet.Parse( args );
+
+                                       // 解析結果。
+                                       if( msg.種別 == ステージ.演奏.ビュアーメッセージ.E種別.演奏停止 )
+                                       {
+                                               // (A) 演奏停止(曲ファイルパスは省略可。)
+                                               FDK.Log.Info( "ビュアーメッセージ: 演奏停止" );
+                                       }
+                                       else
+                                       {
+                                               // (B) 演奏開始(曲ファイルパスは必須。)
+                                               if( 0 < ファイルパスs.Count )
+                                               {
+                                                       if( File.Exists( ファイルパスs[ 0 ] ) )
+                                                       {
+                                                               msg.曲ファイルパス = ファイルパスs[ 0 ];
+                                                       }
+                                                       else
+                                                       {
+                                                               msg.曲ファイルパス = null;    // ファイルが存在しなかったら null 。
+                                                               throw new Mono.Options.OptionException( $"ファイルが存在しません。[{FDK.フォルダ.絶対パスをフォルダ変数付き絶対パスに変換して返す( ファイルパスs[ 0 ] )}]", "File" );
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       throw new Mono.Options.OptionException( "ファイルの指定がありません。", "File" );
+                                               }
+
+                                               FDK.Log.Info( "ビュアーメッセージ: 演奏開始" );
+                                               FDK.Log.Info( $"曲ファイルパス: {msg.曲ファイルパス}" );
+                                               FDK.Log.Info( $"開始小節番号: {msg.演奏開始小節番号}" );
+                                               FDK.Log.Info( $"ドラム音: {msg.ドラム音を発声する}" );
+                                       }
+
+                                       // キューへ格納。
+                                       StrokeStyleT.ビュアーメッセージキュー.Enqueue( msg );
+                                       FDK.Log.Info( "ビュアーメッセージを送信しました。" );
+                               }
+                               catch( Mono.Options.OptionException e )
+                               {
+                                       FDK.Log.ERROR( $"{e.Message}" );
+                               }
+                       }
+                       finally
+                       {
+                               FDK.Log.EndInfo( $"{FDK.Utilities.現在のメソッド名}" );
+                       }
+               }
 
                #region " バックストア。"
                //----------------
@@ -399,17 +770,9 @@ namespace SST
                private static readonly Random bs_乱数 = new Random( DateTime.Now.Millisecond );
                private static SST.ユーザ.ユーザ管理 bs_ユーザ管理 = null;
                private static SST.曲.曲ツリー管理 bs_曲ツリー管理 = null;
+               private static SST.設定.Config bs_Config = null;
+               private static readonly ConcurrentQueue<SST.ステージ.演奏.ビュアーメッセージ> bs_ビュアーメッセージキュー = new ConcurrentQueue<ステージ.演奏.ビュアーメッセージ>();
                //----------------
                #endregion
-
-               #region " Win32 API "
-               //-----------------
-               [System.Runtime.InteropServices.DllImport( "winmm.dll", EntryPoint = "timeBeginPeriod" )]
-               private static extern uint timeBeginPeriod( uint uMilliseconds );
-
-               [System.Runtime.InteropServices.DllImport( "winmm.dll", EntryPoint = "timeEndPeriod" )]
-               private static extern uint timeEndPeriod( uint uMilliseconds );
-               //-----------------
-               #endregion
        }
 }