winmm: Support DRVM_MAPPER_PREFERRED_GET in waveXxxMessage.

This commit is contained in:
Andrew Eikum 2012-03-27 12:41:04 -05:00 committed by Alexandre Julliard
parent d2348911b7
commit 6a6e1bd50e
3 changed files with 47 additions and 0 deletions

View File

@ -27,6 +27,7 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "mmddk.h"
#include "mmsystem.h"
#define NOBITMAP
#include "mmreg.h"
@ -639,11 +640,20 @@ static void wave_in_tests(void)
WAVEFORMATEX format;
HWAVEIN win;
MMRESULT rc;
DWORD preferred, status;
UINT ndev,d;
ndev=waveInGetNumDevs();
trace("found %d WaveIn devices\n",ndev);
rc = waveInMessage((HWAVEIN)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET,
(DWORD_PTR)&preferred, (DWORD_PTR)&status);
ok((ndev == 0 && rc == MMSYSERR_NODRIVER) ||
rc == MMSYSERR_NOERROR, "waveInMessage(DRVM_MAPPER_PREFERRED_GET) failed: %u\n", rc);
ok((ndev == 0 && (preferred == -1 || broken(preferred != -1))) ||
preferred < ndev, "Got invalid preferred device: 0x%x\n", preferred);
rc=waveInGetDevCapsA(ndev+1,&capsA,sizeof(capsA));
ok(rc==MMSYSERR_BADDEVICEID,
"waveInGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n",

View File

@ -1378,11 +1378,20 @@ static void wave_out_tests(void)
WAVEFORMATEX format;
HWAVEOUT wout;
MMRESULT rc;
DWORD preferred, status;
UINT ndev,d;
ndev=waveOutGetNumDevs();
trace("found %d WaveOut devices\n",ndev);
rc = waveOutMessage((HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET,
(DWORD_PTR)&preferred, (DWORD_PTR)&status);
ok((ndev == 0 && rc == MMSYSERR_NODRIVER) ||
rc == MMSYSERR_NOERROR, "waveOutMessage(DRVM_MAPPER_PREFERRED_GET) failed: %u\n", rc);
ok((ndev == 0 && (preferred == -1 || broken(preferred != -1))) ||
preferred < ndev, "Got invalid preferred device: 0x%x\n", preferred);
rc=waveOutGetDevCapsA(ndev+1,&capsA,sizeof(capsA));
ok(rc==MMSYSERR_BADDEVICEID,
"waveOutGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n",

View File

@ -2796,6 +2796,20 @@ UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage,
case DRV_QUERYFUNCTIONINSTANCEID:
return WINMM_QueryInstanceID(HandleToULong(hWaveOut), (WCHAR*)dwParam1, dwParam2, TRUE);
case DRV_QUERYMAPPABLE:
return MMSYSERR_NOERROR;
case DRVM_MAPPER_PREFERRED_GET:
if(dwParam1) {
if(g_outmmdevices_count > 0)
/* Device 0 is always the default device */
*(DWORD *)dwParam1 = 0;
else
*(DWORD *)dwParam1 = -1;
}
if(dwParam2)
/* Status flags */
*(DWORD *)dwParam2 = 0;
return MMSYSERR_NOERROR;
}
@ -3172,6 +3186,20 @@ UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage,
case DRV_QUERYFUNCTIONINSTANCEID:
return WINMM_QueryInstanceID(HandleToULong(hWaveIn), (WCHAR*)dwParam1, dwParam2, FALSE);
case DRV_QUERYMAPPABLE:
return MMSYSERR_NOERROR;
case DRVM_MAPPER_PREFERRED_GET:
if(dwParam1) {
if(g_inmmdevices_count > 0)
/* Device 0 is always the default device */
*(DWORD *)dwParam1 = 0;
else
*(DWORD *)dwParam1 = -1;
}
if(dwParam2)
/* Status flags */
*(DWORD *)dwParam2 = 0;
return MMSYSERR_NOERROR;
}