[v2] midimap: Add warning for user in case midi won't work

Fabian Maurer dark.shadow4 at web.de
Sat Sep 30 15:07:08 CDT 2017


When no midi port or only the midi-through port
is found, we can inform the user that midi
won't work as expected.

v2: Check all ports since there can be multiple midi through ports.

Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
 dlls/midimap/midimap.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dlls/midimap/midimap.c b/dlls/midimap/midimap.c
index 64b4dc8546..7091b26160 100644
--- a/dlls/midimap/midimap.c
+++ b/dlls/midimap/midimap.c
@@ -77,6 +77,7 @@
  */
 
 WINE_DEFAULT_DEBUG_CHANNEL(msacm);
+WINE_DECLARE_DEBUG_CHANNEL(winediag);
 
 typedef struct tagMIDIOUTPORT
 {
@@ -553,6 +554,8 @@ static LRESULT MIDIMAP_drvOpen(void)
 {
     MIDIOUTCAPSW	moc;
     unsigned		dev, i;
+    WCHAR               throughportW[] = {'M','i','d','i',' ','T','h','r','o','u','g','h',0};
+    BOOL                found_valid_port = FALSE;
 
     if (midiOutPorts)
 	return 0;
@@ -571,6 +574,8 @@ static LRESULT MIDIMAP_drvOpen(void)
 	    midiOutPorts[dev].lpbPatch = NULL;
 	    for (i = 0; i < 16; i++)
 		midiOutPorts[dev].aChn[i] = i;
+	    if (strncmpW(midiOutPorts[0].name, throughportW, strlenW(throughportW)) != 0)
+	        found_valid_port = TRUE;
 	}
 	else
 	{
@@ -578,6 +583,9 @@ static LRESULT MIDIMAP_drvOpen(void)
 	}
     }
 
+    if (!found_valid_port)
+        ERR_(winediag)("Midi sound output probably won't work - No software synthesizer midi port found. Make sure your setup is correct.\n");
+
     return 1;
 }
 
-- 
2.14.2




More information about the wine-patches mailing list