Commit 56c449b9 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Don't flag failed opens of unsupported formats as an error.

parent 75101add
...@@ -171,7 +171,7 @@ static const char * wave_open_flags(DWORD flags) ...@@ -171,7 +171,7 @@ static const char * wave_open_flags(DWORD flags)
return msg; return msg;
} }
static void wave_out_test_deviceOut(int device, int format, DWORD flags) static void wave_out_test_deviceOut(int device, int format, DWORD flags, LPWAVEOUTCAPS pcaps)
{ {
WAVEFORMATEX wfx; WAVEFORMATEX wfx;
HWAVEOUT wout; HWAVEOUT wout;
...@@ -197,6 +197,7 @@ static void wave_out_test_deviceOut(int device, int format, DWORD flags) ...@@ -197,6 +197,7 @@ static void wave_out_test_deviceOut(int device, int format, DWORD flags)
rc=waveOutOpen(&wout,device,&wfx,(DWORD)hevent,0,CALLBACK_EVENT|flags); rc=waveOutOpen(&wout,device,&wfx,(DWORD)hevent,0,CALLBACK_EVENT|flags);
/* Note: Win9x doesn't know WAVE_FORMAT_DIRECT */ /* Note: Win9x doesn't know WAVE_FORMAT_DIRECT */
ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID || ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID ||
(rc==WAVERR_BADFORMAT && (flags & WAVE_FORMAT_DIRECT) && (pcaps->dwFormats & win_formats[format][0])) ||
(rc==MMSYSERR_INVALFLAG && (flags & WAVE_FORMAT_DIRECT)), (rc==MMSYSERR_INVALFLAG && (flags & WAVE_FORMAT_DIRECT)),
"waveOutOpen: device=%d format=%ldx%2dx%d flags=%lx(%s) rc=%d(%s)\n",device, "waveOutOpen: device=%d format=%ldx%2dx%d flags=%lx(%s) rc=%d(%s)\n",device,
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,CALLBACK_EVENT|flags, wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,CALLBACK_EVENT|flags,
...@@ -305,8 +306,8 @@ static void wave_out_tests() ...@@ -305,8 +306,8 @@ static void wave_out_tests()
for (f=0;f<NB_WIN_FORMATS;f++) { for (f=0;f<NB_WIN_FORMATS;f++) {
if (caps.dwFormats & win_formats[f][0]) { if (caps.dwFormats & win_formats[f][0]) {
wave_out_test_deviceOut(d,f,0); wave_out_test_deviceOut(d,f,0,&caps);
wave_out_test_deviceOut(d,f,WAVE_FORMAT_DIRECT); wave_out_test_deviceOut(d,f,WAVE_FORMAT_DIRECT,&caps);
} }
} }
...@@ -364,7 +365,7 @@ static const char * wave_in_error(MMRESULT error) ...@@ -364,7 +365,7 @@ static const char * wave_in_error(MMRESULT error)
return msg; return msg;
} }
static void wave_in_test_deviceIn(int device, int format, DWORD flags) static void wave_in_test_deviceIn(int device, int format, DWORD flags, LPWAVEINCAPS pcaps)
{ {
WAVEFORMATEX wfx; WAVEFORMATEX wfx;
HWAVEIN win; HWAVEIN win;
...@@ -390,6 +391,7 @@ static void wave_in_test_deviceIn(int device, int format, DWORD flags) ...@@ -390,6 +391,7 @@ static void wave_in_test_deviceIn(int device, int format, DWORD flags)
rc=waveInOpen(&win,device,&wfx,(DWORD)hevent,0,CALLBACK_EVENT|flags); rc=waveInOpen(&win,device,&wfx,(DWORD)hevent,0,CALLBACK_EVENT|flags);
/* Note: Win9x doesn't know WAVE_FORMAT_DIRECT */ /* Note: Win9x doesn't know WAVE_FORMAT_DIRECT */
ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID || ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID ||
(rc==WAVERR_BADFORMAT && (flags & WAVE_FORMAT_DIRECT) && (pcaps->dwFormats & win_formats[format][0])) ||
(rc==MMSYSERR_INVALFLAG && (flags & WAVE_FORMAT_DIRECT)), (rc==MMSYSERR_INVALFLAG && (flags & WAVE_FORMAT_DIRECT)),
"waveInOpen: device=%d format=%ldx%2dx%d flags=%lx(%s) rc=%d(%s)\n",device, "waveInOpen: device=%d format=%ldx%2dx%d flags=%lx(%s) rc=%d(%s)\n",device,
wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,CALLBACK_EVENT|flags, wfx.nSamplesPerSec,wfx.wBitsPerSample,wfx.nChannels,CALLBACK_EVENT|flags,
...@@ -411,11 +413,15 @@ static void wave_in_test_deviceIn(int device, int format, DWORD flags) ...@@ -411,11 +413,15 @@ static void wave_in_test_deviceIn(int device, int format, DWORD flags)
frag.lpData=malloc(wfx.nAvgBytesPerSec); frag.lpData=malloc(wfx.nAvgBytesPerSec);
frag.dwBufferLength=wfx.nAvgBytesPerSec; frag.dwBufferLength=wfx.nAvgBytesPerSec;
frag.dwBytesRecorded=0;
frag.dwUser=0;
frag.dwFlags=0; frag.dwFlags=0;
frag.dwLoops=0; frag.dwLoops=0;
frag.lpNext=0;
rc=waveInPrepareHeader(win, &frag, sizeof(frag)); rc=waveInPrepareHeader(win, &frag, sizeof(frag));
ok(rc==MMSYSERR_NOERROR, "waveOutPrepareHeader: device=%d rc=%d\n",device,rc); ok(rc==MMSYSERR_NOERROR, "waveInPrepareHeader: device=%d rc=%d\n",device,rc);
ok(frag.dwFlags&WHDR_PREPARED,"waveInPrepareHeader: prepared flag not set\n");
if (winetest_interactive && rc==MMSYSERR_NOERROR) { if (winetest_interactive && rc==MMSYSERR_NOERROR) {
trace("Recording at %ldx%2dx%d %04lx\n", trace("Recording at %ldx%2dx%d %04lx\n",
...@@ -501,8 +507,8 @@ static void wave_in_tests() ...@@ -501,8 +507,8 @@ static void wave_in_tests()
for (f=0;f<NB_WIN_FORMATS;f++) { for (f=0;f<NB_WIN_FORMATS;f++) {
if (caps.dwFormats & win_formats[f][0]) { if (caps.dwFormats & win_formats[f][0]) {
wave_in_test_deviceIn(d,f,0); wave_in_test_deviceIn(d,f,0, &caps);
wave_in_test_deviceIn(d,f,WAVE_FORMAT_DIRECT); wave_in_test_deviceIn(d,f,WAVE_FORMAT_DIRECT, &caps);
} }
} }
......
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