[PATCH 2/4] [v2] midimap: Open lower devices when opening MIDI Mapper.

Andrew Eikum aeikum at codeweavers.com
Thu Apr 5 10:32:02 CDT 2018


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>

On Thu, Apr 05, 2018 at 12:40:44AM +0900, Akihiro Sagawa wrote:
> 
> Without this change, the lower device can't get a long message at the
> beginning.  The mapper didn't open it before receiving a short message
> in modData function.
> 
> In v2, rebased it.
> 
> Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
> ---
>  dlls/midimap/midimap.c  | 27 ++++++++++++++-------------
>  dlls/winmm/tests/midi.c |  2 +-
>  2 files changed, 15 insertions(+), 14 deletions(-)

> diff --git a/dlls/midimap/midimap.c b/dlls/midimap/midimap.c
> index 16707bb..1b35da7 100644
> --- a/dlls/midimap/midimap.c
> +++ b/dlls/midimap/midimap.c
> @@ -283,13 +283,25 @@ static DWORD modOpen(DWORD_PTR *lpdwUser, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
>  
>      if (MIDIMAP_LoadSettings(mom))
>      {
> +	UINT chn;
>  	*lpdwUser = (DWORD_PTR)mom;
>  	mom->self = mom;
> -
>  	mom->wCbFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
>  	mom->midiDesc = *lpDesc;
> -	MIDIMAP_NotifyClient(mom, MOM_OPEN, 0L, 0L);
>  
> +	for (chn = 0; chn < 16; chn++)
> +	{
> +	    if (mom->ChannelMap[chn]->loaded) continue;
> +	    if (midiOutOpen(&mom->ChannelMap[chn]->hMidi, mom->ChannelMap[chn]->uDevID,
> +			    0L, 0L, CALLBACK_NULL) == MMSYSERR_NOERROR)
> +		mom->ChannelMap[chn]->loaded = 1;
> +	    else
> +		mom->ChannelMap[chn]->loaded = -1;
> +	    /* FIXME: should load here the IDF midi data... and allow channel and
> +	     * patch mappings
> +	     */
> +	}
> +	MIDIMAP_NotifyClient(mom, MOM_OPEN, 0L, 0L);
>  	return MMSYSERR_NOERROR;
>      }
>      HeapFree(GetProcessHeap(), 0, mom);
> @@ -381,17 +393,6 @@ static DWORD modData(MIDIMAPDATA* mom, DWORD_PTR dwParam)
>      case 0xC0:
>      case 0xD0:
>      case 0xE0:
> -	if (mom->ChannelMap[chn]->loaded == 0)
> -	{
> -	    if (midiOutOpen(&mom->ChannelMap[chn]->hMidi, mom->ChannelMap[chn]->uDevID,
> -			    0L, 0L, CALLBACK_NULL) == MMSYSERR_NOERROR)
> -		mom->ChannelMap[chn]->loaded = 1;
> -	    else
> -		mom->ChannelMap[chn]->loaded = -1;
> -	    /* FIXME: should load here the IDF midi data... and allow channel and
> -	     * patch mappings
> -	     */
> -	}
>  	if (mom->ChannelMap[chn]->loaded > 0)
>  	{
>  	    /* change channel */
> diff --git a/dlls/winmm/tests/midi.c b/dlls/winmm/tests/midi.c
> index 763ed2f..4805123 100644
> --- a/dlls/winmm/tests/midi.c
> +++ b/dlls/winmm/tests/midi.c
> @@ -461,7 +461,7 @@ static void test_midiOut_device(UINT udev, HWND hwnd)
>          trace("ShortMsg type %x (muted)\n", LOBYTE(LOWORD(e)));
>          rc = midiOutShortMsg(hm, e);
>          ok(!rc, "midiOutShortMsg rc=%s\n", mmsys_error(rc));
> -        /* FIXME (for MIDI Mapper): we shouldn't hear this voice due to volume settings */
> +        /* We can't hear this voice due to volume settings */
>          if (!rc) Sleep(200);
>  
>          rc = midiOutShortMsg(hm, 0x00004593); /* velocity 0 */

> 




More information about the wine-devel mailing list