2 * Test winmm sound playback in each sound format
4 * Copyright (c) 2002 Francois Gouget
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "wine/test.h"
33 #include "winmm_test.h"
36 * Note that in most of this test we may get MMSYSERR_BADDEVICEID errors
37 * at about any time if the user starts another application that uses the
38 * sound device. So we should not report these as test failures.
40 * This test can play a test tone. But this only makes sense if someone
41 * is going to carefully listen to it, and would only bother everyone else.
42 * So this is only done if the test is being run in interactive mode.
45 #define PI 3.14159265358979323846
46 static char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size)
53 nb_samples=(int)(duration*wfx->nSamplesPerSec);
54 *size=nb_samples*wfx->nBlockAlign;
56 for (i=0;i<nb_samples;i++) {
57 double y=sin(440.0*2*PI*i/wfx->nSamplesPerSec);
58 if (wfx->wBitsPerSample==8) {
59 unsigned char sample=(unsigned char)((double)127.5*(y+1.0));
61 if (wfx->nChannels==2)
64 signed short sample=(signed short)((double)32767.5*y-0.5);
68 if (wfx->nChannels==2) {
78 const char * dev_name(int device)
81 if (device == WAVE_MAPPER)
83 sprintf(name, "%d", device);
87 const char* mmsys_error(MMRESULT error)
89 #define ERR_TO_STR(dev) case dev: return #dev
90 static char unknown[32];
92 ERR_TO_STR(MMSYSERR_NOERROR);
93 ERR_TO_STR(MMSYSERR_ERROR);
94 ERR_TO_STR(MMSYSERR_BADDEVICEID);
95 ERR_TO_STR(MMSYSERR_NOTENABLED);
96 ERR_TO_STR(MMSYSERR_ALLOCATED);
97 ERR_TO_STR(MMSYSERR_INVALHANDLE);
98 ERR_TO_STR(MMSYSERR_NODRIVER);
99 ERR_TO_STR(MMSYSERR_NOMEM);
100 ERR_TO_STR(MMSYSERR_NOTSUPPORTED);
101 ERR_TO_STR(MMSYSERR_BADERRNUM);
102 ERR_TO_STR(MMSYSERR_INVALFLAG);
103 ERR_TO_STR(MMSYSERR_INVALPARAM);
104 ERR_TO_STR(WAVERR_BADFORMAT);
105 ERR_TO_STR(WAVERR_STILLPLAYING);
106 ERR_TO_STR(WAVERR_UNPREPARED);
107 ERR_TO_STR(WAVERR_SYNC);
109 sprintf(unknown, "Unknown(0x%08x)", error);
114 static const char * wave_out_error(MMRESULT error)
116 static char msg[1024];
117 static char long_msg[1100];
120 rc = waveOutGetErrorText(error, msg, sizeof(msg));
121 if (rc != MMSYSERR_NOERROR)
122 sprintf(long_msg, "waveOutGetErrorText(%x) failed with error %x", error, rc);
124 sprintf(long_msg, "%s(%s)", mmsys_error(error), msg);
128 const char * wave_open_flags(DWORD flags)
130 static char msg[1024];
133 if ((flags & CALLBACK_TYPEMASK) == CALLBACK_EVENT) {
134 strcat(msg, "CALLBACK_EVENT");
137 if ((flags & CALLBACK_TYPEMASK) == CALLBACK_FUNCTION) {
138 if (!first) strcat(msg, "|");
139 strcat(msg, "CALLBACK_FUNCTION");
142 if ((flags & CALLBACK_TYPEMASK) == CALLBACK_NULL) {
143 if (!first) strcat(msg, "|");
144 strcat(msg, "CALLBACK_NULL");
147 if ((flags & CALLBACK_TYPEMASK) == CALLBACK_THREAD) {
148 if (!first) strcat(msg, "|");
149 strcat(msg, "CALLBACK_THREAD");
152 if ((flags & CALLBACK_TYPEMASK) == CALLBACK_WINDOW) {
153 if (!first) strcat(msg, "|");
154 strcat(msg, "CALLBACK_WINDOW");
157 if ((flags & WAVE_ALLOWSYNC) == WAVE_ALLOWSYNC) {
158 if (!first) strcat(msg, "|");
159 strcat(msg, "WAVE_ALLOWSYNC");
162 if ((flags & WAVE_FORMAT_DIRECT) == WAVE_FORMAT_DIRECT) {
163 if (!first) strcat(msg, "|");
164 strcat(msg, "WAVE_FORMAT_DIRECT");
167 if ((flags & WAVE_FORMAT_QUERY) == WAVE_FORMAT_QUERY) {
168 if (!first) strcat(msg, "|");
169 strcat(msg, "WAVE_FORMAT_QUERY");
172 if ((flags & WAVE_MAPPED) == WAVE_MAPPED) {
173 if (!first) strcat(msg, "|");
174 strcat(msg, "WAVE_MAPPED");
180 static const char * wave_out_caps(DWORD dwSupport)
182 #define ADD_FLAG(f) if (dwSupport & f) strcat(msg, " " #f)
183 static char msg[256];
186 ADD_FLAG(WAVECAPS_PITCH);
187 ADD_FLAG(WAVECAPS_PLAYBACKRATE);
188 ADD_FLAG(WAVECAPS_VOLUME);
189 ADD_FLAG(WAVECAPS_LRVOLUME);
190 ADD_FLAG(WAVECAPS_SYNC);
191 ADD_FLAG(WAVECAPS_SAMPLEACCURATE);
193 return msg[0] ? msg + 1 : "";
197 static void check_position(int device, HWAVEOUT wout, double duration, LPWAVEFORMATEX pwfx)
202 mmtime.wType = TIME_BYTES;
203 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
204 ok(rc==MMSYSERR_NOERROR,
205 "waveOutGetPosition: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
206 if (mmtime.wType == TIME_BYTES)
207 ok(mmtime.u.cb==duration*pwfx->nAvgBytesPerSec+pwfx->wBitsPerSample/8,
208 "waveOutGetPosition returned %ld bytes, should be %ld\n",
209 mmtime.u.cb, (DWORD)(duration*pwfx->nAvgBytesPerSec)+pwfx->wBitsPerSample/8);
211 mmtime.wType = TIME_SAMPLES;
212 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
213 ok(rc==MMSYSERR_NOERROR,
214 "waveOutGetPosition: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
215 if (mmtime.wType == TIME_SAMPLES)
216 ok(mmtime.u.sample==duration*pwfx->nSamplesPerSec+1,
217 "waveOutGetPosition returned %ld samples, should be %ld\n",
218 mmtime.u.sample, (DWORD)(duration*pwfx->nSamplesPerSec)+1);
220 mmtime.wType = TIME_MS;
221 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
222 ok(rc==MMSYSERR_NOERROR,
223 "waveOutGetPosition: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
224 if (mmtime.wType == TIME_MS)
225 ok(mmtime.u.ms==(DWORD)(duration*1000),
226 "waveOutGetPosition returned %ld ms, should be %ld\n",
227 mmtime.u.ms, (DWORD)(duration*1000));
229 mmtime.wType = TIME_SMPTE;
230 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
231 ok(rc==MMSYSERR_NOERROR,
232 "waveOutGetPosition: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
233 if (mmtime.wType == TIME_SMPTE)
234 ok(mmtime.u.smpte.hour==(BYTE)(floor(duration/(60*60))) &&
235 mmtime.u.smpte.min==(BYTE)(fmod(floor(duration/60), 60)) &&
236 mmtime.u.smpte.sec==(BYTE)(fmod(duration,60)) &&
237 mmtime.u.smpte.frame==(BYTE)(fmod(duration*mmtime.u.smpte.fps, mmtime.u.smpte.fps)),
238 "waveOutGetPosition returned %d:%d:%d %d, should be %d:%d:%d %d\n",
239 mmtime.u.smpte.hour, mmtime.u.smpte.min, mmtime.u.smpte.sec, mmtime.u.smpte.frame,
240 (BYTE)(floor(duration/(60*60))),
241 (BYTE)(fmod(floor(duration/60), 60)),
242 (BYTE)(fmod(duration,60)),
243 (BYTE)(fmod(duration*mmtime.u.smpte.fps, mmtime.u.smpte.fps)));
246 static void wave_out_test_deviceOut(int device, double duration, LPWAVEFORMATEX pwfx, DWORD format, DWORD flags, LPWAVEOUTCAPS pcaps)
253 WORD nChannels = pwfx->nChannels;
254 WORD wBitsPerSample = pwfx->wBitsPerSample;
255 DWORD nSamplesPerSec = pwfx->nSamplesPerSec;
257 hevent=CreateEvent(NULL,FALSE,FALSE,NULL);
258 ok(hevent!=NULL,"CreateEvent: error=%ld\n",GetLastError());
263 rc=waveOutOpen(&wout,device,pwfx,(DWORD)hevent,0,CALLBACK_EVENT|flags);
264 /* Note: Win9x doesn't know WAVE_FORMAT_DIRECT */
265 /* It is acceptable to fail on formats that are not specified to work */
266 ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID ||
267 rc==MMSYSERR_NOTENABLED || rc==MMSYSERR_NODRIVER || rc==MMSYSERR_ALLOCATED ||
268 ((rc==WAVERR_BADFORMAT || rc==MMSYSERR_NOTSUPPORTED) &&
269 (flags & WAVE_FORMAT_DIRECT) && !(pcaps->dwFormats & format)) ||
270 ((rc==WAVERR_BADFORMAT || rc==MMSYSERR_NOTSUPPORTED) &&
271 (!(flags & WAVE_FORMAT_DIRECT) || (flags & WAVE_MAPPED)) && !(pcaps->dwFormats & format)) ||
272 (rc==MMSYSERR_INVALFLAG && (flags & WAVE_FORMAT_DIRECT)),
273 "waveOutOpen: device=%s format=%ldx%2dx%d flags=%lx(%s) rc=%s\n",dev_name(device),
274 pwfx->nSamplesPerSec,pwfx->wBitsPerSample,pwfx->nChannels,CALLBACK_EVENT|flags,
275 wave_open_flags(CALLBACK_EVENT|flags),wave_out_error(rc));
276 if ((rc==WAVERR_BADFORMAT || rc==MMSYSERR_NOTSUPPORTED) &&
277 (flags & WAVE_FORMAT_DIRECT) && (pcaps->dwFormats & format))
278 trace(" Reason: The device lists this format as supported in it's capabilities but opening it failed.\n");
279 if ((rc==WAVERR_BADFORMAT || rc==MMSYSERR_NOTSUPPORTED) &&
280 !(pcaps->dwFormats & format))
281 trace("waveOutOpen: device=%s format=%ldx%2dx%d %s rc=%s failed but format not supported so OK.\n",
282 dev_name(device), pwfx->nSamplesPerSec,pwfx->wBitsPerSample,pwfx->nChannels,
283 flags & WAVE_FORMAT_DIRECT ? "flags=WAVE_FORMAT_DIRECT" :
284 flags & WAVE_MAPPED ? "flags=WAVE_MAPPED" : "", mmsys_error(rc));
285 if (rc!=MMSYSERR_NOERROR) {
290 ok(pwfx->nChannels==nChannels &&
291 pwfx->wBitsPerSample==wBitsPerSample &&
292 pwfx->nSamplesPerSec==nSamplesPerSec,
293 "got the wrong format: %ldx%2dx%d instead of %ldx%2dx%d\n",
294 pwfx->nSamplesPerSec, pwfx->wBitsPerSample,
295 pwfx->nChannels, nSamplesPerSec, wBitsPerSample, nChannels);
297 frag.lpData=wave_generate_la(pwfx,duration,&frag.dwBufferLength);
301 rc=waveOutGetVolume(wout,&volume);
302 ok(rc==MMSYSERR_NOERROR,"waveOutGetVolume: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
304 rc=waveOutPrepareHeader(wout, &frag, sizeof(frag));
305 ok(rc==MMSYSERR_NOERROR,
306 "waveOutPrepareHeader: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
308 if (winetest_interactive && rc==MMSYSERR_NOERROR) {
309 trace("Playing %g second 440Hz tone at %5ldx%2dx%d %s\n",duration,
310 pwfx->nSamplesPerSec, pwfx->wBitsPerSample,pwfx->nChannels,
311 flags & WAVE_FORMAT_DIRECT ? "WAVE_FORMAT_DIRECT" :
312 flags & WAVE_MAPPED ? "WAVE_MAPPED" : "");
313 rc=waveOutSetVolume(wout,0x20002000);
314 ok(rc==MMSYSERR_NOERROR,"waveOutSetVolume: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
315 WaitForSingleObject(hevent,INFINITE);
317 rc=waveOutWrite(wout, &frag, sizeof(frag));
318 ok(rc==MMSYSERR_NOERROR,"waveOutWrite: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
319 WaitForSingleObject(hevent,INFINITE);
321 rc=waveOutSetVolume(wout,volume);
322 ok(rc==MMSYSERR_NOERROR,"waveOutSetVolume: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
324 check_position(device, wout, duration, pwfx);
327 rc=waveOutUnprepareHeader(wout, &frag, sizeof(frag));
328 ok(rc==MMSYSERR_NOERROR,
329 "waveOutUnprepareHeader: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
333 rc=waveOutClose(wout);
334 ok(rc==MMSYSERR_NOERROR,"waveOutClose: device=%s rc=%s\n",dev_name(device),wave_out_error(rc));
337 static void wave_out_test_device(int device)
340 WAVEFORMATEX format, oformat;
349 SYSTEM_INFO sSysInfo;
353 GetSystemInfo(&sSysInfo);
354 dwPageSize = sSysInfo.dwPageSize;
356 rc=waveOutGetDevCapsA(device,&caps,sizeof(caps));
357 ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID || rc==MMSYSERR_NODRIVER,
358 "waveOutGetDevCapsA: failed to get capabilities of device %s: rc=%s\n",dev_name(device),wave_out_error(rc));
359 if (rc==MMSYSERR_BADDEVICEID || rc==MMSYSERR_NODRIVER)
362 rc=waveOutGetDevCapsA(device,0,sizeof(caps));
363 ok(rc==MMSYSERR_INVALPARAM,
364 "waveOutGetDevCapsA: MMSYSERR_INVALPARAM expected, got %s\n",wave_out_error(rc));
366 #if 0 /* FIXME: this works on windows but crashes wine */
367 rc=waveOutGetDevCapsA(device,(LPWAVEOUTCAPS)1,sizeof(caps));
368 ok(rc==MMSYSERR_INVALPARAM,
369 "waveOutGetDevCapsA: MMSYSERR_INVALPARAM expected, got %s\n",wave_out_error(rc));
372 rc=waveOutGetDevCapsA(device,&caps,4);
373 ok(rc==MMSYSERR_NOERROR,
374 "waveOutGetDevCapsA: MMSYSERR_NOERROR expected, got %s\n",wave_out_error(rc));
377 rc=waveOutMessage((HWAVEOUT)device, DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0);
378 ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_INVALPARAM || rc==MMSYSERR_NOTSUPPORTED,
379 "waveOutMessage: failed to get interface size for device: %s rc=%s\n",dev_name(device),wave_out_error(rc));
380 if (rc==MMSYSERR_NOERROR) {
381 wname = (WCHAR *)malloc(size);
382 rc=waveOutMessage((HWAVEOUT)device, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wname, size);
383 ok(rc==MMSYSERR_NOERROR,"waveOutMessage: failed to get interface name for device: %s rc=%s\n",dev_name(device),wave_out_error(rc));
384 ok(lstrlenW(wname)+1==size/sizeof(WCHAR),"got an incorrect size: %ld instead of %d\n",size,(lstrlenW(wname)+1)*sizeof(WCHAR));
385 if (rc==MMSYSERR_NOERROR) {
386 name = malloc(size/sizeof(WCHAR));
387 WideCharToMultiByte(CP_ACP, 0, wname, size/sizeof(WCHAR), name, size/sizeof(WCHAR), NULL, NULL);
391 else if (rc==MMSYSERR_NOTSUPPORTED) {
392 name=strdup("not supported");
395 trace(" %s: \"%s\" (%s) %d.%d (%d:%d): channels=%d formats=%05lx support=%04lx(%s)\n",
396 dev_name(device),caps.szPname,(name?name:"failed"),caps.vDriverVersion >> 8,
397 caps.vDriverVersion & 0xff,
399 caps.wChannels,caps.dwFormats,caps.dwSupport,wave_out_caps(caps.dwSupport));
402 if (winetest_interactive && (device != WAVE_MAPPER))
404 trace("Playing a 5 seconds reference tone.\n");
405 trace("All subsequent tones should be identical to this one.\n");
406 trace("Listen for stutter, changes in pitch, volume, etc.\n");
407 format.wFormatTag=WAVE_FORMAT_PCM;
409 format.wBitsPerSample=8;
410 format.nSamplesPerSec=22050;
411 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
412 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
414 wave_out_test_deviceOut(device,5.0,&format,WAVE_FORMAT_2M08,0,&caps);
417 for (f=0;f<NB_WIN_FORMATS;f++) {
418 format.wFormatTag=WAVE_FORMAT_PCM;
419 format.nChannels=win_formats[f][3];
420 format.wBitsPerSample=win_formats[f][2];
421 format.nSamplesPerSec=win_formats[f][1];
422 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
423 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
425 wave_out_test_deviceOut(device,1.0,&format,win_formats[f][0],0,&caps);
426 wave_out_test_deviceOut(device,1.0,&format,win_formats[f][0],WAVE_FORMAT_DIRECT,&caps);
427 if (device != WAVE_MAPPER)
428 wave_out_test_deviceOut(device,1.0,&format,win_formats[f][0],WAVE_MAPPED,&caps);
431 /* Try a PCMWAVEFORMAT aligned next to an unaccessable page for bounds checking */
432 twoPages = VirtualAlloc(NULL, 2 * dwPageSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
433 ok(twoPages!=NULL,"Failed to allocate 2 pages of memory\n");
435 res = VirtualProtect(twoPages + dwPageSize, dwPageSize, PAGE_NOACCESS, &flOldProtect);
436 ok(res, "Failed to set memory access on second page\n");
438 LPWAVEFORMATEX pwfx = (LPWAVEFORMATEX)(twoPages + dwPageSize - sizeof(PCMWAVEFORMAT));
439 pwfx->wFormatTag=WAVE_FORMAT_PCM;
441 pwfx->wBitsPerSample=8;
442 pwfx->nSamplesPerSec=22050;
443 pwfx->nBlockAlign=pwfx->nChannels*pwfx->wBitsPerSample/8;
444 pwfx->nAvgBytesPerSec=pwfx->nSamplesPerSec*pwfx->nBlockAlign;
445 wave_out_test_deviceOut(device,1.0,pwfx,WAVE_FORMAT_2M08,0,&caps);
446 wave_out_test_deviceOut(device,1.0,pwfx,WAVE_FORMAT_2M08,WAVE_FORMAT_DIRECT,&caps);
447 if (device != WAVE_MAPPER)
448 wave_out_test_deviceOut(device,1.0,pwfx,WAVE_FORMAT_2M08,WAVE_MAPPED,&caps);
450 VirtualFree(twoPages, 2 * dwPageSize, MEM_RELEASE);
453 /* Try invalid formats to test error handling */
454 trace("Testing invalid format: 11 bits per sample\n");
455 format.wFormatTag=WAVE_FORMAT_PCM;
457 format.wBitsPerSample=11;
458 format.nSamplesPerSec=22050;
459 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
460 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
463 rc=waveOutOpen(&wout,device,&format,0,0,CALLBACK_NULL|WAVE_FORMAT_DIRECT);
464 ok(rc==WAVERR_BADFORMAT || rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM,
465 "waveOutOpen: opening the device in 11 bits mode should fail %s: rc=%s\n",dev_name(device),wave_out_error(rc));
466 if (rc==MMSYSERR_NOERROR) {
467 trace(" got %ldx%2dx%d for %ldx%2dx%d\n",
468 format.nSamplesPerSec, format.wBitsPerSample,
470 oformat.nSamplesPerSec, oformat.wBitsPerSample,
475 trace("Testing invalid format: 2 MHz sample rate\n");
476 format.wFormatTag=WAVE_FORMAT_PCM;
478 format.wBitsPerSample=16;
479 format.nSamplesPerSec=2000000;
480 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
481 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
484 rc=waveOutOpen(&wout,device,&format,0,0,CALLBACK_NULL|WAVE_FORMAT_DIRECT);
485 ok(rc==WAVERR_BADFORMAT || rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM,
486 "waveOutOpen: opening the device at 2 MHz sample rate should fail %s: rc=%s\n",dev_name(device),wave_out_error(rc));
487 if (rc==MMSYSERR_NOERROR) {
488 trace(" got %ldx%2dx%d for %ldx%2dx%d\n",
489 format.nSamplesPerSec, format.wBitsPerSample,
491 oformat.nSamplesPerSec, oformat.wBitsPerSample,
497 static void wave_out_tests()
505 ndev=waveOutGetNumDevs();
506 trace("found %d WaveOut devices\n",ndev);
508 rc=waveOutGetDevCapsA(ndev+1,&caps,sizeof(caps));
509 ok(rc==MMSYSERR_BADDEVICEID,
510 "waveOutGetDevCapsA: MMSYSERR_BADDEVICEID expected, got %s\n",mmsys_error(rc));
512 rc=waveOutGetDevCapsA(WAVE_MAPPER,&caps,sizeof(caps));
514 ok(rc==MMSYSERR_NOERROR,
515 "waveOutGetDevCapsA: MMSYSERR_NOERROR expected, got %s\n",mmsys_error(rc));
517 ok(rc==MMSYSERR_BADDEVICEID || rc==MMSYSERR_NODRIVER,
518 "waveOutGetDevCapsA: MMSYSERR_BADDEVICEID or MMSYSERR_NODRIVER expected, got %s\n",mmsys_error(rc));
520 format.wFormatTag=WAVE_FORMAT_PCM;
522 format.wBitsPerSample=16;
523 format.nSamplesPerSec=44100;
524 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
525 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
527 rc=waveOutOpen(&wout,ndev+1,&format,0,0,CALLBACK_NULL);
528 ok(rc==MMSYSERR_BADDEVICEID,
529 "waveOutOpen: MMSYSERR_BADDEVICEID expected, got %s\n",mmsys_error(rc));
532 wave_out_test_device(d);
535 wave_out_test_device(WAVE_MAPPER);