Clean up white spaces.

Fix spelling error.
Improve capture error messages.
Fix error reporting when capturing from nonexistent device.
This commit is contained in:
Robert Reif 2004-03-27 20:42:57 +00:00 committed by Alexandre Julliard
parent 62437ad81d
commit 7c112c918d
1 changed files with 58 additions and 52 deletions

View File

@ -420,7 +420,7 @@ static void wave_in_test_deviceIn(int device, int format, DWORD flags, LPWAVEINC
frag.lpNext=0; frag.lpNext=0;
rc=waveInPrepareHeader(win, &frag, sizeof(frag)); rc=waveInPrepareHeader(win, &frag, sizeof(frag));
ok(rc==MMSYSERR_NOERROR, "waveInPrepareHeader: device=%d rc=%d\n",device,rc); ok(rc==MMSYSERR_NOERROR, "waveInPrepareHeader: device=%d rc=%d(%s)\n",device,rc,wave_in_error(rc));
ok(frag.dwFlags&WHDR_PREPARED,"waveInPrepareHeader: prepared flag not set\n"); ok(frag.dwFlags&WHDR_PREPARED,"waveInPrepareHeader: prepared flag not set\n");
if (winetest_interactive && rc==MMSYSERR_NOERROR) { if (winetest_interactive && rc==MMSYSERR_NOERROR) {
@ -428,21 +428,27 @@ static void wave_in_test_deviceIn(int device, int format, DWORD flags, LPWAVEINC
wfx.nSamplesPerSec, wfx.wBitsPerSample,wfx.nChannels,flags); wfx.nSamplesPerSec, wfx.wBitsPerSample,wfx.nChannels,flags);
rc=waveInAddBuffer(win, &frag, sizeof(frag)); rc=waveInAddBuffer(win, &frag, sizeof(frag));
ok(rc==MMSYSERR_NOERROR,"waveInAddBuffer: device=%d rc=%d\n",device,rc); ok(rc==MMSYSERR_NOERROR,"waveInAddBuffer: device=%d rc=%d(%s)\n",device,rc,wave_in_error(rc));
rc=waveInStart(win); rc=waveInStart(win);
ok(rc==MMSYSERR_NOERROR,"waveInStart: device=%d rc=%d\n",device,rc); ok(rc==MMSYSERR_NOERROR,"waveInStart: device=%d rc=%d(%s)\n",device,rc,wave_in_error(rc));
res = WaitForSingleObject(hevent,1200); res = WaitForSingleObject(hevent,1200);
ok(res==WAIT_OBJECT_0,"WaitForSingleObject failed for header\n"); ok(res==WAIT_OBJECT_0,"WaitForSingleObject failed for header\n");
ok(frag.dwFlags&WHDR_DONE,"WHDR_DONE not set in frag.dwFlags\n");
ok(frag.dwFlags&WHDR_DONE,"WHDR_DONE no set in frag.dwFlags\n");
ok(frag.dwBytesRecorded==wfx.nAvgBytesPerSec,"frag.dwBytesRecorded=%ld, should=%ld\n", ok(frag.dwBytesRecorded==wfx.nAvgBytesPerSec,"frag.dwBytesRecorded=%ld, should=%ld\n",
frag.dwBytesRecorded,wfx.nAvgBytesPerSec); frag.dwBytesRecorded,wfx.nAvgBytesPerSec);
/* stop playing on error */
if (res!=WAIT_OBJECT_0) {
rc=waveInStop(win);
ok(rc==MMSYSERR_NOERROR,
"waveInStop: device=%d rc=%d(%s)\n",device,rc,wave_in_error(rc));
}
} }
rc=waveInUnprepareHeader(win, &frag, sizeof(frag)); rc=waveInUnprepareHeader(win, &frag, sizeof(frag));
ok(rc==MMSYSERR_NOERROR, ok(rc==MMSYSERR_NOERROR,
"waveInUnprepareHeader: device=%d rc=%d\n",device,rc); "waveInUnprepareHeader: device=%d rc=%d(%s)\n",device,rc,wave_in_error(rc));
waveInClose(win); waveInClose(win);
res=WaitForSingleObject(hevent,1000); res=WaitForSingleObject(hevent,1000);
@ -467,7 +473,7 @@ static void wave_in_tests()
rc=waveInGetDevCapsA(ndev+1,&caps,sizeof(caps)); rc=waveInGetDevCapsA(ndev+1,&caps,sizeof(caps));
ok(rc==MMSYSERR_BADDEVICEID, ok(rc==MMSYSERR_BADDEVICEID,
"waveInGetDevCapsA: MMSYSERR_BADDEVICEID expected, got %d\n",rc); "waveInGetDevCapsA: MMSYSERR_BADDEVICEID expected, got %d(%s)\n",rc,wave_in_error(rc));
format.wFormatTag=WAVE_FORMAT_PCM; format.wFormatTag=WAVE_FORMAT_PCM;
format.nChannels=2; format.nChannels=2;
@ -478,21 +484,21 @@ static void wave_in_tests()
format.cbSize=0; format.cbSize=0;
rc=waveInOpen(&win,ndev+1,&format,0,0,CALLBACK_NULL); rc=waveInOpen(&win,ndev+1,&format,0,0,CALLBACK_NULL);
ok(rc==MMSYSERR_BADDEVICEID, ok(rc==MMSYSERR_BADDEVICEID,
"waveInOpen: MMSYSERR_BADDEVICEID expected, got %d\n",rc); "waveInOpen: MMSYSERR_BADDEVICEID expected, got %d(%s)\n",rc,wave_in_error(rc));
for (d=0;d<ndev;d++) { for (d=0;d<ndev;d++) {
rc=waveInGetDevCapsA(d,&caps,sizeof(caps)); rc=waveInGetDevCapsA(d,&caps,sizeof(caps));
ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID, ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID,
"waveInGetDevCapsA: failed to get capabilities of device %d: rc=%d\n",d,rc); "waveInGetDevCapsA: failed to get capabilities of device %d: rc=%d(%s)\n",d,rc,wave_in_error(rc));
if (rc==MMSYSERR_BADDEVICEID) if (rc==MMSYSERR_BADDEVICEID)
continue; continue;
rc=waveInMessage((HWAVEIN)d, DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0); rc=waveInMessage((HWAVEIN)d, DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0);
ok(rc==MMSYSERR_NOERROR, "waveInMessage: failed to get interface size for device: %d rc=%d\n",d,rc); ok(rc==MMSYSERR_NOERROR, "waveInMessage: failed to get interface size for device: %d rc=%d(%s)\n",d,rc,wave_in_error(rc));
if (rc==MMSYSERR_NOERROR) { if (rc==MMSYSERR_NOERROR) {
wname = (WCHAR *)malloc(size); wname = (WCHAR *)malloc(size);
rc=waveInMessage((HWAVEIN)d, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wname, size); rc=waveInMessage((HWAVEIN)d, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wname, size);
ok(rc==MMSYSERR_NOERROR,"waveInMessage: failed to get interface name for device:: %d rc=%d\n",d,rc); ok(rc==MMSYSERR_NOERROR,"waveInMessage: failed to get interface name for device:: %d rc=%d(%s)\n",d,rc,wave_in_error(rc));
if (rc==MMSYSERR_NOERROR) { if (rc==MMSYSERR_NOERROR) {
name = malloc(size/sizeof(WCHAR)); name = malloc(size/sizeof(WCHAR));
WideCharToMultiByte(CP_ACP, 0, wname, size/sizeof(WCHAR), name, size/sizeof(WCHAR), NULL, NULL); WideCharToMultiByte(CP_ACP, 0, wname, size/sizeof(WCHAR), name, size/sizeof(WCHAR), NULL, NULL);