OSDN Git Service

#37961 PCとMIDI機器をつなぐケーブルとして「MIDI2.0-USB」を使用している場合に警告を表示する機能を追加。このケーブルを通すと、PCからのMIDI出力...
authoryyagi <yyagi.dtxmania@gmail.com>
Mon, 21 Jan 2019 12:42:10 +0000 (21:42 +0900)
committeryyagi <yyagi.dtxmania@gmail.com>
Mon, 21 Jan 2019 12:42:10 +0000 (21:42 +0900)
DTXMania/コード/ステージ/04.コンフィグ/CConfigXml.cs
DTXMania/コード/全体/CDTXMania.cs
FDK/コード/02.入力/CInputJoystick.cs
FDK/コード/02.入力/CInputKeyboard.cs
FDK/コード/02.入力/CInputMIDI.cs
FDK/コード/02.入力/CInputMouse.cs
FDK/コード/02.入力/CInput管理.cs
FDK/コード/02.入力/IInputDevice.cs
RuntimeResources/System/resources.csv
RuntimeResources/System/resources.xlsx

index 01da1df..8b76970 100644 (file)
@@ -393,6 +393,13 @@ namespace DTXMania
                [DataMember(Order = 114)]
                public STInstValue<COptionInteger> cdForceScaledMovieH;   // #38362 2018.1.8 add yyagi
 
+               /// <summary>
+               /// 旧AVIを強制的にウインドウ全体に表示するときの、Y座標
+               /// (114で...FullMovieYから...ScalewdMovieYに改名)
+               /// </summary>
+               [DataMember(Order = 115)]
+               public COptionBool bWarnMIDI20USB;              // #37961 2019.1.21 add yyagi
+
 
                public int GetLaneX(ELane e)
                {
@@ -549,6 +556,8 @@ namespace DTXMania
                        bLoadDTXDetail = new COptionBool( false );
                        bShowSongPath = new COptionBool( false );
 
+                       bWarnMIDI20USB = new COptionBool(true);
+
                        // string
                        strSongDataPath = new COptionString(@".\");
                        strFontSongSelect = new COptionString("MS PGothic");
index a78ace1..8b99803 100644 (file)
@@ -546,6 +546,26 @@ namespace DTXMania
                        {
                                bool bUseMIDIIn = !DTXVmode.Enabled;
                                Input管理 = new CInput管理(base.Window.Handle, bUseMIDIIn);
+
+                               // If the users uses MIDI2.0-USB cable, then warn it
+                               if (bUseMIDIIn && CDTXMania.Instance.ConfigIni.bWarnMIDI20USB.Value)
+                               {
+                                       foreach (IInputDevice device in Input管理.list入力デバイス)
+                                       {
+                                               if ((device.e入力デバイス種別 == E入力デバイス種別.MidiIn) && (device.strDeviceName == "USB2.0-MIDI"))
+                                               {
+                                                       string strWarnMes = CDTXMania.Instance.Resources.Explanation("strWarnMIDI20USB");
+                                                       var ret = MessageBox.Show(strWarnMes, "DTXMania Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
+                                                       if (ret == DialogResult.OK)
+                                                       {
+                                                               CDTXMania.Instance.ConfigIni.bWarnMIDI20USB.Value = false;
+                                                       }
+                                               }
+                                       }
+                               }
+
+
+
                                foreach (IInputDevice device in Input管理.list入力デバイス)
                                {
                                        if ((device.e入力デバイス種別 == E入力デバイス種別.Joystick) && !ConfigIni.dicJoystick.Value.ContainsValue(device.GUID))
index f90a302..bab9b74 100644 (file)
@@ -22,6 +22,7 @@ namespace FDK
                                this.devJoystick.SetCooperativeLevel( hWnd, CooperativeLevel.Foreground | CooperativeLevel.Exclusive );
                                this.devJoystick.Properties.BufferSize = 32;
                                Trace.TraceInformation( this.devJoystick.Information.InstanceName + "を生成しました。" );
+                               this.strDeviceName = this.devJoystick.Information.InstanceName;
                        }
                        catch
                        {
@@ -90,6 +91,11 @@ namespace FDK
                        get;
                        private set; 
                }
+               public string strDeviceName
+               {
+                       get;
+                       set;
+               }
 
                public void tポーリング( bool bWindowがアクティブ中, bool bバッファ入力を使用する )
                {
index fa17f94..ebfbf0b 100644 (file)
@@ -25,6 +25,7 @@ namespace FDK
                                this.devKeyboard.SetCooperativeLevel( hWnd, CooperativeLevel.NoWinKey | CooperativeLevel.Foreground | CooperativeLevel.NonExclusive );
                                this.devKeyboard.Properties.BufferSize = 32;
                                Trace.TraceInformation( this.devKeyboard.Information.ProductName.Trim(new char[] { '\0' } ) + " を生成しました。" );    // なぜか0x00のゴミが出るので削除
+                               this.strDeviceName = this.devKeyboard.Information.ProductName.Trim(new char[] { '\0' });
                        }
                        catch
                        {
@@ -61,6 +62,7 @@ namespace FDK
                public string GUID { get; private set; }
                public int ID { get; private set; }
                public List<STInputEvent> list入力イベント { get; private set; }
+               public string strDeviceName { get; set; }
 
                public void tポーリング( bool bWindowがアクティブ中, bool bバッファ入力を使用する )
                {
index 009d2d3..ebb6346 100644 (file)
@@ -12,7 +12,6 @@ namespace FDK
                public uint hMidiIn;
                public List<STInputEvent> listEventBuffer;
 
-
                // コンストラクタ
 
                public CInputMIDI( uint nID )
@@ -23,6 +22,7 @@ namespace FDK
                        this.e入力デバイス種別 = E入力デバイス種別.MidiIn;
                        this.GUID = "";
                        this.ID = (int) nID;
+                       this.strDeviceName = "";        // CInput管理で初期化する
                }
 
 
@@ -65,6 +65,7 @@ namespace FDK
                public string GUID { get; private set; }
                public int ID { get; private set; }
                public List<STInputEvent> list入力イベント { get; private set; }
+               public string strDeviceName { get; set; }
 
                public void tポーリング( bool bWindowがアクティブ中, bool bバッファ入力を使用する )
                {
index 90dc4bc..7fbb5dd 100644 (file)
@@ -16,26 +16,27 @@ namespace FDK
 
                // コンストラクタ
 
-               public CInputMouse( IntPtr hWnd, DirectInput directInput )
+               public CInputMouse(IntPtr hWnd, DirectInput directInput)
                {
                        this.e入力デバイス種別 = E入力デバイス種別.Mouse;
                        this.GUID = "";
                        this.ID = 0;
                        try
                        {
-                               this.devMouse = new Mouse( directInput );
-                               this.devMouse.SetCooperativeLevel( hWnd, CooperativeLevel.Foreground | CooperativeLevel.NonExclusive );
+                               this.devMouse = new Mouse(directInput);
+                               this.devMouse.SetCooperativeLevel(hWnd, CooperativeLevel.Foreground | CooperativeLevel.NonExclusive);
                                this.devMouse.Properties.BufferSize = 0x20;
-                               Trace.TraceInformation( this.devMouse.Information.ProductName.Trim(new char[] { '\0' }) + " を生成しました。" );        // なぜか0x00のゴミが出るので削除
+                               Trace.TraceInformation(this.devMouse.Information.ProductName.Trim(new char[] { '\0' }) + " を生成しました。");  // なぜか0x00のゴミが出るので削除
+                               this.strDeviceName = this.devMouse.Information.ProductName.Trim(new char[] { '\0' });
                        }
                        catch
                        {
-                               if( this.devMouse != null )
+                               if (this.devMouse != null)
                                {
                                        this.devMouse.Dispose();
                                        this.devMouse = null;
                                }
-                               Trace.TraceWarning( "Mouse デバイスの生成に失敗しました。" );
+                               Trace.TraceWarning("Mouse デバイスの生成に失敗しました。");
                                throw;
                        }
                        try
@@ -46,11 +47,11 @@ namespace FDK
                        {
                        }
 
-                       for( int i = 0; i < this.bMouseState.Length; i++ )
-                               this.bMouseState[ i ] = false;
+                       for (int i = 0; i < this.bMouseState.Length; i++)
+                               this.bMouseState[i] = false;
 
                        //this.timer = new CTimer( CTimer.E種別.MultiMedia );
-                       this.list入力イベント = new List<STInputEvent>( 32 );
+                       this.list入力イベント = new List<STInputEvent>(32);
                }
 
 
@@ -62,6 +63,7 @@ namespace FDK
                public string GUID { get; private set; }
                public int ID { get; private set; }
                public List<STInputEvent> list入力イベント { get; private set; }
+               public string strDeviceName {get; set; }
 
                public void tポーリング( bool bWindowがアクティブ中, bool bバッファ入力を使用する )
                {
index 148ddbe..87ad390 100644 (file)
@@ -111,7 +111,6 @@ namespace FDK
                                for ( uint i = 0; i < nMidiDevices; i++ )
                                {
                                        CInputMIDI item = new CInputMIDI( i );
-                                       this.list入力デバイス.Add( item );
                                        CWin32.MIDIINCAPS lpMidiInCaps = new CWin32.MIDIINCAPS();
                                        uint num3 = CWin32.midiInGetDevCaps( i, ref lpMidiInCaps, (uint) Marshal.SizeOf( lpMidiInCaps ) );
                                        if ( num3 != 0 )
@@ -127,6 +126,8 @@ namespace FDK
                                        {
                                                Trace.TraceError( "MIDI In: [{0}] \"{1}\" の入力受付の開始に失敗しました。", i, lpMidiInCaps.szPname );
                                        }
+                                       item.strDeviceName = lpMidiInCaps.szPname;
+                                       this.list入力デバイス.Add(item);
                                }
                        }
                        else
index 7b42faa..9703f5c 100644 (file)
@@ -24,7 +24,10 @@ namespace FDK
                {
                        get;
                }
-
+               string strDeviceName
+               {
+                       get;
+               }
 
                // メソッドインターフェース
 
index 855c7c8..06216b7 100644 (file)
Binary files a/RuntimeResources/System/resources.csv and b/RuntimeResources/System/resources.csv differ
index f8e7127..28875b1 100644 (file)
Binary files a/RuntimeResources/System/resources.xlsx and b/RuntimeResources/System/resources.xlsx differ