Commit 6a6e1bd5 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

winmm: Support DRVM_MAPPER_PREFERRED_GET in waveXxxMessage.

parent d2348911
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
#include "mmddk.h"
#include "mmsystem.h" #include "mmsystem.h"
#define NOBITMAP #define NOBITMAP
#include "mmreg.h" #include "mmreg.h"
...@@ -639,11 +640,20 @@ static void wave_in_tests(void) ...@@ -639,11 +640,20 @@ static void wave_in_tests(void)
WAVEFORMATEX format; WAVEFORMATEX format;
HWAVEIN win; HWAVEIN win;
MMRESULT rc; MMRESULT rc;
DWORD preferred, status;
UINT ndev,d; UINT ndev,d;
ndev=waveInGetNumDevs(); ndev=waveInGetNumDevs();
trace("found %d WaveIn devices\n",ndev); 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)); rc=waveInGetDevCapsA(ndev+1,&capsA,sizeof(capsA));
ok(rc==MMSYSERR_BADDEVICEID, ok(rc==MMSYSERR_BADDEVICEID,
"waveInGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n", "waveInGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n",
......
...@@ -1378,11 +1378,20 @@ static void wave_out_tests(void) ...@@ -1378,11 +1378,20 @@ static void wave_out_tests(void)
WAVEFORMATEX format; WAVEFORMATEX format;
HWAVEOUT wout; HWAVEOUT wout;
MMRESULT rc; MMRESULT rc;
DWORD preferred, status;
UINT ndev,d; UINT ndev,d;
ndev=waveOutGetNumDevs(); ndev=waveOutGetNumDevs();
trace("found %d WaveOut devices\n",ndev); 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)); rc=waveOutGetDevCapsA(ndev+1,&capsA,sizeof(capsA));
ok(rc==MMSYSERR_BADDEVICEID, ok(rc==MMSYSERR_BADDEVICEID,
"waveOutGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n", "waveOutGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n",
......
...@@ -2797,6 +2797,20 @@ UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, ...@@ -2797,6 +2797,20 @@ UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage,
return WINMM_QueryInstanceID(HandleToULong(hWaveOut), (WCHAR*)dwParam1, dwParam2, TRUE); return WINMM_QueryInstanceID(HandleToULong(hWaveOut), (WCHAR*)dwParam1, dwParam2, TRUE);
case DRV_QUERYMAPPABLE: case DRV_QUERYMAPPABLE:
return MMSYSERR_NOERROR; 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;
} }
TRACE("Message not supported: %u\n", uMessage); TRACE("Message not supported: %u\n", uMessage);
...@@ -3173,6 +3187,20 @@ UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage, ...@@ -3173,6 +3187,20 @@ UINT WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage,
return WINMM_QueryInstanceID(HandleToULong(hWaveIn), (WCHAR*)dwParam1, dwParam2, FALSE); return WINMM_QueryInstanceID(HandleToULong(hWaveIn), (WCHAR*)dwParam1, dwParam2, FALSE);
case DRV_QUERYMAPPABLE: case DRV_QUERYMAPPABLE:
return MMSYSERR_NOERROR; 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;
} }
TRACE("Message not supported: %u\n", uMessage); TRACE("Message not supported: %u\n", uMessage);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment