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

Matteo Bruni matteo.mystral at gmail.com
Thu Sep 28 16:08:38 CDT 2017


2017-09-23 22:52 GMT+02:00 Fabian Maurer <dark.shadow4 at web.de>:
> When no midi port or only the midi-through port
> is found, we can inform the user that midi
> won't work as expected.
>
> 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..c80834515b 100644
> --- a/dlls/midimap/midimap.c
> +++ b/dlls/midimap/midimap.c
> @@ -553,6 +553,7 @@ static LRESULT MIDIMAP_drvOpen(void)
>  {
>      MIDIOUTCAPSW       moc;
>      unsigned           dev, i;
> +    WCHAR               throughportW[] = {'M','i','d','i',' ','T','h','r','o','u','g','h',0};
>
>      if (midiOutPorts)
>         return 0;
> @@ -578,6 +579,13 @@ static LRESULT MIDIMAP_drvOpen(void)
>         }
>      }
>
> +    if(numMidiOutPorts == 0)
> +        MESSAGE("Midi sound output won't work - No midi port found.\n");
> +    else if(numMidiOutPorts == 1 && midiOutPorts[0].loaded == -1)
> +        MESSAGE("Midi sound output won't work - No working midi port found.\n");
> +    else if(numMidiOutPorts == 1 && strncmpW(midiOutPorts[0].name, throughportW, strlenW(throughportW)) == 0)
> +        MESSAGE("Midi sound output probably won't work - Only 'midi through' port found. Make sure your setup is correct.\n");
> +
>      return 1;
>  }

Since you have to resend anyway...

The string comparison doesn't look correct to me, I think that breaks
if the midi port name has a prefix matching the throughportW string. I
guess it's not going to be a problem in practice but it seems better
to do it right anyway.
There should be a space between 'if' and the '(', like elsewhere in
the function and source file.



More information about the wine-devel mailing list