Commit 7c80f993 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Restore the 2 MHz sample rate test and fix the winealsa driver for

reasonable limits.
parent 74f583ed
......@@ -324,12 +324,12 @@ static void wave_out_tests()
}
}
/* Try an invalid format to test error handling */
trace("Testing invalid format\n");
/* Try invalid formats to test error handling */
trace("Testing invalid format: 11 bits per sample\n");
format.wFormatTag=WAVE_FORMAT_PCM;
format.nChannels=2;
format.wBitsPerSample=11;
format.nSamplesPerSec=8000;
format.nSamplesPerSec=22050;
format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
format.cbSize=0;
......@@ -345,6 +345,27 @@ static void wave_out_tests()
oformat.nChannels);
waveOutClose(wout);
}
trace("Testing invalid format: 2 MHz sample rate\n");
format.wFormatTag=WAVE_FORMAT_PCM;
format.nChannels=2;
format.wBitsPerSample=16;
format.nSamplesPerSec=2000000;
format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
format.cbSize=0;
oformat=format;
rc=waveOutOpen(&wout,d,&format,0,0,CALLBACK_NULL|WAVE_FORMAT_DIRECT);
ok(rc==WAVERR_BADFORMAT || rc==MMSYSERR_INVALFLAG,
"waveOutOpen: opening the device at 2 MHz sample rate should fail %d: rc=%d\n",d,rc);
if (rc==MMSYSERR_NOERROR) {
trace(" got %ldx%2dx%d for %ldx%2dx%d\n",
format.nSamplesPerSec, format.wBitsPerSample,
format.nChannels,
oformat.nSamplesPerSec, oformat.wBitsPerSample,
oformat.nChannels);
waveOutClose(wout);
}
}
}
......@@ -525,12 +546,12 @@ static void wave_in_tests()
}
}
/* Try an invalid format to test error handling */
trace("Testing invalid format\n");
/* Try invalid formats to test error handling */
trace("Testing invalid format: 11 bits per sample\n");
format.wFormatTag=WAVE_FORMAT_PCM;
format.nChannels=2;
format.wBitsPerSample=11;
format.nSamplesPerSec=8000;
format.nSamplesPerSec=22050;
format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
format.cbSize=0;
......@@ -546,6 +567,27 @@ static void wave_in_tests()
oformat.nChannels);
waveInClose(win);
}
trace("Testing invalid format: 2 MHz sample rate\n");
format.wFormatTag=WAVE_FORMAT_PCM;
format.nChannels=2;
format.wBitsPerSample=16;
format.nSamplesPerSec=2000000;
format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
format.cbSize=0;
oformat=format;
rc=waveInOpen(&win,d,&format,0,0,CALLBACK_NULL|WAVE_FORMAT_DIRECT);
ok(rc==WAVERR_BADFORMAT || rc==MMSYSERR_INVALFLAG,
"waveInOpen: opening the device with 2 MHz sample rate should fail %d: rc=%d\n",d,rc);
if (rc==MMSYSERR_NOERROR) {
trace(" got %ldx%2dx%d for %ldx%2dx%d\n",
format.nSamplesPerSec, format.wBitsPerSample,
format.nChannels,
oformat.nSamplesPerSec, oformat.wBitsPerSample,
oformat.nChannels);
waveInClose(win);
}
}
}
......
......@@ -1438,7 +1438,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
/* only PCM format is supported so far... */
if (lpDesc->lpFormat->wFormatTag != WAVE_FORMAT_PCM ||
lpDesc->lpFormat->nChannels == 0 ||
lpDesc->lpFormat->nSamplesPerSec == 0 ||
lpDesc->lpFormat->nSamplesPerSec < DSBFREQUENCY_MIN ||
lpDesc->lpFormat->nSamplesPerSec > DSBFREQUENCY_MAX ||
(lpDesc->lpFormat->wBitsPerSample!=8 && lpDesc->lpFormat->wBitsPerSample!=16)) {
WARN("Bad format: tag=%04X nChannels=%d nSamplesPerSec=%ld !\n",
lpDesc->lpFormat->wFormatTag, lpDesc->lpFormat->nChannels,
......
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