OSDN Git Service

#38358 USB-AUDIO使用時に警告を表示する機能を追加。
authoryyagi <yyagi.dtxmania@gmail.com>
Thu, 31 Jan 2019 17:26:42 +0000 (02:26 +0900)
committeryyagi <yyagi.dtxmania@gmail.com>
Thu, 31 Jan 2019 17:26:42 +0000 (02:26 +0900)
#xxxxx 起動時のログ出力強化。(サウンドデバイス関連)

DTXMania/コード/ステージ/04.コンフィグ/CConfigXml.cs
DTXMania/コード/全体/CDTXMania.cs
FDK/コード/03.サウンド/CSound.cs
FDK/コード/03.サウンド/CSoundDeviceASIO.cs
FDK/コード/03.サウンド/CSoundDeviceDirectSound.cs
FDK/コード/03.サウンド/CSoundDeviceWASAPI.cs
FDK/コード/03.サウンド/ISoundDevice.cs
RuntimeResources/System/resources.csv
RuntimeResources/System/resources.xlsx

index 8b76970..6a1ae94 100644 (file)
@@ -394,11 +394,16 @@ namespace DTXMania
                public STInstValue<COptionInteger> cdForceScaledMovieH;   // #38362 2018.1.8 add yyagi
 
                /// <summary>
-               /// 旧AVIを強制的にウインドウ全体に表示するときの、Y座標
-               /// (114で...FullMovieYから...ScalewdMovieYに改名)
+               /// USBケーブル「MIDI2.0-USB」を使用しているときの警告表示有無
+               /// </summary>
+               [DataMember(Order = 115)]
+               public COptionBool bWarnMIDI20USB;      // #37961 2019.1.21 add yyagi
+
+               /// <summary>
+               /// USB接続のサウンドデバイスを使用しているときの警告表示有無
                /// </summary>
                [DataMember(Order = 115)]
-               public COptionBool bWarnMIDI20USB;              // #37961 2019.1.21 add yyagi
+               public COptionBool bWarnSoundDeviceOnUSB;               // #38358 2019.2.1 add yyagi
 
 
                public int GetLaneX(ELane e)
@@ -557,6 +562,7 @@ namespace DTXMania
                        bShowSongPath = new COptionBool( false );
 
                        bWarnMIDI20USB = new COptionBool(true);
+                       bWarnSoundDeviceOnUSB = new COptionBool(true);
 
                        // string
                        strSongDataPath = new COptionString(@".\");
index 2dcd168..dd6949c 100644 (file)
@@ -867,6 +867,24 @@ namespace DTXMania
                                FDK.CSound管理.bIsTimeStretch = CDTXMania.Instance.ConfigIni.bTimeStretch;
                                Sound管理.nMasterVolume = CDTXMania.Instance.ConfigIni.nMasterVolume;
                                //FDK.CSound管理.bIsMP3DecodeByWindowsCodec = CDTXMania.Instance.ConfigIni.bNoMP3Streaming;
+
+
+                               string strDefaultSoundDeviceBusType = CSound管理.strDefaultDeviceBusType;
+                               Trace.TraceInformation($"Bus type of the default sound device = {strDefaultSoundDeviceBusType}");
+
+                               if (strDefaultSoundDeviceBusType.ToUpper().Equals("USB"))
+                               {
+                                       if (CDTXMania.Instance.ConfigIni.bWarnSoundDeviceOnUSB.Value)
+                                       {
+                                               string strWarnMes = CDTXMania.Instance.Resources.Explanation("strWarnSoundDeviceOnUSB");
+                                               var ret = MessageBox.Show(strWarnMes, "DTXMania Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
+                                               if (ret == DialogResult.OK)
+                                               {
+                                                       CDTXMania.Instance.ConfigIni.bWarnSoundDeviceOnUSB.Value = false;
+                                               }
+                                       }
+                               }
+
                                Trace.TraceInformation("サウンドデバイスの初期化を完了しました。");
                        }
                        catch (Exception e)
@@ -3260,10 +3278,15 @@ namespace DTXMania
                        foreach (System.Management.ManagementObject mo in moc)
                        {
                                Trace.TraceInformation("-------------------------");
-                               Trace.TraceInformation("Sound Information:");
+                               Trace.TraceInformation("Audio Information:");
                                //Trace.TraceInformation("Caption: " + mo["Caption"]);
-                               Trace.TraceInformation("ProductName: " + mo["ProductName"]);
+                               //Trace.TraceInformation("ProductName: " + mo["ProductName"]);
                                //Trace.TraceInformation("DMABufferSize: " + mo["DMABufferSize"]);
+
+                               foreach (PropertyData property in mo.Properties)
+                               {
+                                       Trace.TraceInformation("{0}:{1}", property.Name, property.Value);
+                               }
                        }
                        moc.Dispose();
                        mc.Dispose();
index 80ada1e..15c6275 100644 (file)
@@ -41,6 +41,14 @@ namespace FDK
 
                public static bool bIsTimeStretch = false;
 
+               public static string strDefaultDeviceBusType
+               {
+                       get
+                       {
+                               return SoundDevice.strDefaultSoundDeviceBusType;
+                       }
+               }
+       
                private static int _nMasterVolume;
                public int nMasterVolume
                {
@@ -359,7 +367,7 @@ namespace FDK
                                Bass.BASS_SetConfig( BASSConfig.BASS_CONFIG_UPDATETHREADS, nCPUCores );
                                //Bass.BASS_SetConfig( BASSConfig.BASS_CONFIG_UPDATEPERIOD, 0 );
 
-                               Trace.TraceInformation( "BASS_CONFIG_UpdatePeriod=" + Bass.BASS_GetConfig( BASSConfig.BASS_CONFIG_UPDATEPERIOD ) );
+                               //Trace.TraceInformation( "BASS_CONFIG_UpdatePeriod=" + Bass.BASS_GetConfig( BASSConfig.BASS_CONFIG_UPDATEPERIOD ) );
                                Trace.TraceInformation( "BASS_CONFIG_UpdateThreads=" + Bass.BASS_GetConfig( BASSConfig.BASS_CONFIG_UPDATETHREADS ) );
                        }
                }
index bd81467..3aa574c 100644 (file)
@@ -117,6 +117,11 @@ namespace FDK
                        }
                }
 
+               public string strDefaultSoundDeviceBusType {
+                       get;
+                       protected set;
+               }
+
                // メソッド
 
                public CSoundDeviceASIO( long n希望バッファサイズms, int _nASIODevice )
@@ -231,7 +236,9 @@ namespace FDK
                                #endregion
                        }
 
+                       strDefaultSoundDeviceBusType = "";              // ASIOは低遅延前提のはずなので、deafult sound device(のバスタイプ)を気に掛けないことにする
 
+                       
                        // ASIO 出力チャンネルの初期化。
 
                        this.tAsioProc = new ASIOPROC( this.tAsio処理 );              // アンマネージに渡す delegate は、フィールドとして保持しておかないとGCでアドレスが変わってしまう。
index 4179d3f..9694f4b 100644 (file)
@@ -104,6 +104,12 @@ namespace FDK
                        }
                }
 
+               public string strDefaultSoundDeviceBusType
+               {
+                       get;
+                       protected set;
+               }
+
 
                // メソッド
 
@@ -191,6 +197,9 @@ namespace FDK
                        {
                                ctimer = new CTimer( CTimer.E種別.MultiMedia );
                        }
+
+                       strDefaultSoundDeviceBusType = "";              // DirectSoundの処理負荷は軽いので、deafult sound device(のバスタイプ)を気に掛ける必要なし
+
                        Trace.TraceInformation( "DirectSound を初期化しました。({0})({1})", ( priority ) ? "Priority" : "Normal", bUseOSTimer? "OStimer" : "FDKtimer" );
                }
 
index 4c93aae..f273f83 100644 (file)
@@ -104,6 +104,13 @@ namespace FDK
                                }
                        }
                }
+
+               public string strDefaultSoundDeviceBusType {
+                       get;
+                       protected set;
+               }
+
+               
                // メソッド
 
                /// <summary>
@@ -184,22 +191,30 @@ namespace FDK
                        //(デバッグ用)
                        Trace.TraceInformation("サウンドデバイス一覧:");
                        int a;
-                       string strDefaultSoundDeviceName = "";
+                       string strDefaultSoundDeviceName = null;
                        BASS_DEVICEINFO[] bassDevInfos = Bass.BASS_GetDeviceInfos();
                        for (a = 0; a < bassDevInfos.GetLength(0); a++)
                        {
                                {
-                                       Trace.TraceInformation("Sound Device #{0}: {1}: IsDefault={2}, isEnabled={3}, flags={4}, driver={5}",
+                                       Trace.TraceInformation("Sound Device #{0}: {1}: IsDefault={2}, isEnabled={3}, flags={4}, id={5}",
                                                a,
                                                bassDevInfos[a].name,
                                                bassDevInfos[a].IsDefault,
                                                bassDevInfos[a].IsEnabled,
                                                bassDevInfos[a].flags,
-                                               bassDevInfos[a].driver
+                                               bassDevInfos[a].id
                                        );
                                        if (bassDevInfos[a].IsDefault)
                                        {
+                                               // これはOS標準のdefault device。後でWASAPIのdefault deviceと比較する。
                                                strDefaultSoundDeviceName = bassDevInfos[a].name;
+                                               
+                                               // 以下はOS標準 default deviceのbus type (PNPIDの頭の文字列)。上位側で使用する。
+                                               string[] s = bassDevInfos[a].id.ToString().ToUpper().Split(new char[] { '#' });
+                                               if (s != null && s[0] != null)
+                                               {
+                                                       strDefaultSoundDeviceBusType = s[0];
+                                               }
                                        }
                                }
                        }
index 5679be1..6093350 100644 (file)
@@ -18,6 +18,7 @@ namespace FDK
                long n経過時間ms { get; }
                long n経過時間を更新したシステム時刻ms { get; }
                CTimer tmシステムタイマ { get; }
+               string strDefaultSoundDeviceBusType { get; }
 
                CSound tサウンドを作成する( string strファイル名 );
                CSound tサウンドを作成する( string strファイル名, CSound.EInstType einstType );
index 06216b7..375c50c 100644 (file)
Binary files a/RuntimeResources/System/resources.csv and b/RuntimeResources/System/resources.csv differ
index 28875b1..f54b5bc 100644 (file)
Binary files a/RuntimeResources/System/resources.xlsx and b/RuntimeResources/System/resources.xlsx differ