ReactOS 0.4.16-dev-336-gb667d82
wave.c
Go to the documentation of this file.
1/*
2 * Test winmm sound playback in each sound format
3 *
4 * Copyright (c) 2002 Francois Gouget
5 *
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.
10 *
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.
15 *
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <stdarg.h>
22#include <stdio.h>
23#include <stdlib.h>
24#include <math.h>
25
26#include "wine/test.h"
27#include "windef.h"
28#include "winbase.h"
29#include "winuser.h"
30#include "winnls.h"
31#include "mmsystem.h"
32#define NOBITMAP
33#include "mmddk.h"
34#include "mmreg.h"
35#include "ks.h"
36#include "ksguid.h"
37#ifndef __REACTOS__
38#include "ksmedia.h"
39#endif
40
41#include "winmm_test.h"
42
43#ifdef __REACTOS__ /* FIXME */
44DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
45DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
46#endif
47
48static DWORD g_tid;
49
50static void test_multiple_waveopens(void)
51{
52 HWAVEOUT handle1, handle2;
54 WAVEFORMATEX wfx;
55
57 wfx.nChannels = 1;
58 wfx.nSamplesPerSec = 11025;
59 wfx.nBlockAlign = 1;
61 wfx.wBitsPerSample = 8;
62 wfx.cbSize = 0;
63
64 ret = waveOutOpen(&handle1, 0, &wfx, 0, 0, 0);
65 if (ret != MMSYSERR_NOERROR)
66 {
67 skip("Could not do the duplicate waveopen test\n");
68 return;
69 }
70
71 ret = waveOutOpen(&handle2, 0, &wfx, 0, 0, 0);
72 /* Modern Windows allows for wave-out devices to be opened multiple times.
73 * Some Wine audio drivers allow that and some don't. To avoid false alarms
74 * for those that do, don't "todo_wine ok(...)" on success.
75 */
76 if (ret != MMSYSERR_NOERROR)
77 {
79 "second waveOutOpen returns: %x\n", ret);
80 }
81 else
82 waveOutClose(handle2);
83
84 waveOutClose(handle1);
85}
86
87/*
88 * Note that in most of this test we may get MMSYSERR_BADDEVICEID errors
89 * at about any time if the user starts another application that uses the
90 * sound device. So we should not report these as test failures.
91 *
92 * This test can play a test tone. But this only makes sense if someone
93 * is going to carefully listen to it, and would only bother everyone else.
94 * So this is only done if the test is being run in interactive mode.
95 */
96
97#define PI 3.14159265358979323846
98static char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size)
99{
100 int i,j;
101 int nb_samples;
102 char* buf;
103 char* b;
105
106 nb_samples=(int)(duration*wfx->nSamplesPerSec);
107 *size=nb_samples*wfx->nBlockAlign;
109 for (i=0;i<nb_samples;i++) {
110 double y=sin(440.0*2*PI*i/wfx->nSamplesPerSec);
111 if (wfx->wBitsPerSample==8) {
112 unsigned char sample=(unsigned char)(127.5*(y+1.0));
113 for (j = 0; j < wfx->nChannels; j++)
114 *b++=sample;
115 } else if (wfx->wBitsPerSample==16) {
116 signed short sample=(signed short)(32767.5*y-0.5);
117 for (j = 0; j < wfx->nChannels; j++) {
118 b[0]=sample & 0xff;
119 b[1]=sample >> 8;
120 b+=2;
121 }
122 } else if (wfx->wBitsPerSample==24) {
123 signed int sample=(signed int)(((double)0x7fffff+0.5)*y-0.5);
124 for (j = 0; j < wfx->nChannels; j++) {
125 b[0]=sample & 0xff;
126 b[1]=(sample >> 8) & 0xff;
127 b[2]=(sample >> 16) & 0xff;
128 b+=3;
129 }
130 } else if ((wfx->wBitsPerSample==32) && ((wfx->wFormatTag == WAVE_FORMAT_PCM) ||
133 signed int sample=(signed int)(((double)0x7fffffff+0.5)*y-0.5);
134 for (j = 0; j < wfx->nChannels; j++) {
135 b[0]=sample & 0xff;
136 b[1]=(sample >> 8) & 0xff;
137 b[2]=(sample >> 16) & 0xff;
138 b[3]=(sample >> 24) & 0xff;
139 b+=4;
140 }
141 } else if ((wfx->wBitsPerSample==32) && (wfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) &&
143 union { float f; char c[4]; } sample;
144 sample.f=(float)y;
145 for (j = 0; j < wfx->nChannels; j++) {
146 b[0]=sample.c[0];
147 b[1]=sample.c[1];
148 b[2]=sample.c[2];
149 b[3]=sample.c[3];
150 b+=4;
151 }
152 }
153 }
154 return buf;
155}
156
157static char* wave_generate_silence(WAVEFORMATEX* wfx, double duration, DWORD* size)
158{
159 int i,j;
160 int nb_samples;
161 char* buf;
162 char* b;
164
165 nb_samples=(int)(duration*wfx->nSamplesPerSec);
166 *size=nb_samples*wfx->nBlockAlign;
168 for (i=0;i<nb_samples;i++) {
169 if (wfx->wBitsPerSample==8) {
170 for (j = 0; j < wfx->nChannels; j++)
171 *b++=128;
172 } else if (wfx->wBitsPerSample==16) {
173 for (j = 0; j < wfx->nChannels; j++) {
174 b[0]=0;
175 b[1]=0;
176 b+=2;
177 }
178 } else if (wfx->wBitsPerSample==24) {
179 for (j = 0; j < wfx->nChannels; j++) {
180 b[0]=0;
181 b[1]=0;
182 b[2]=0;
183 b+=3;
184 }
185 } else if ((wfx->wBitsPerSample==32) && ((wfx->wFormatTag == WAVE_FORMAT_PCM) ||
188 for (j = 0; j < wfx->nChannels; j++) {
189 b[0]=0;
190 b[1]=0;
191 b[2]=0;
192 b[3]=0;
193 b+=4;
194 }
195 } else if ((wfx->wBitsPerSample==32) && (wfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) &&
197 union { float f; char c[4]; } sample;
198 sample.f=0;
199 for (j = 0; j < wfx->nChannels; j++) {
200 b[0]=sample.c[0];
201 b[1]=sample.c[1];
202 b[2]=sample.c[2];
203 b[3]=sample.c[3];
204 b+=4;
205 }
206 }
207 }
208 return buf;
209}
210
211const char * dev_name(int device)
212{
213 static char name[16];
214 if (device == WAVE_MAPPER)
215 return "WAVE_MAPPER";
216 sprintf(name, "%d", device);
217 return name;
218}
219
221{
222#define ERR_TO_STR(dev) case dev: return #dev
223 static char unknown[32];
224 switch (error) {
264 }
265 sprintf(unknown, "Unknown(0x%08x)", error);
266 return unknown;
267#undef ERR_TO_STR
268}
269
271{
272 static char msg[1024];
273 static char long_msg[1100];
274 MMRESULT rc;
275
276 rc = waveOutGetErrorTextA(error, msg, sizeof(msg));
277 if (rc != MMSYSERR_NOERROR)
278 sprintf(long_msg, "waveOutGetErrorTextA(%x) failed with error %x", error, rc);
279 else
280 sprintf(long_msg, "%s(%s)", mmsys_error(error), msg);
281 return long_msg;
282}
283
285{
286 static char msg[1024];
287 BOOL first = TRUE;
288 msg[0] = 0;
290 strcat(msg, "CALLBACK_EVENT");
291 first = FALSE;
292 }
294 if (!first) strcat(msg, "|");
295 strcat(msg, "CALLBACK_FUNCTION");
296 first = FALSE;
297 }
299 if (!first) strcat(msg, "|");
300 strcat(msg, "CALLBACK_NULL");
301 first = FALSE;
302 }
304 if (!first) strcat(msg, "|");
305 strcat(msg, "CALLBACK_THREAD");
306 first = FALSE;
307 }
309 if (!first) strcat(msg, "|");
310 strcat(msg, "CALLBACK_WINDOW");
311 first = FALSE;
312 }
314 if (!first) strcat(msg, "|");
315 strcat(msg, "WAVE_ALLOWSYNC");
316 first = FALSE;
317 }
319 if (!first) strcat(msg, "|");
320 strcat(msg, "WAVE_FORMAT_DIRECT");
321 first = FALSE;
322 }
324 if (!first) strcat(msg, "|");
325 strcat(msg, "WAVE_FORMAT_QUERY");
326 first = FALSE;
327 }
328 if ((flags & WAVE_MAPPED) == WAVE_MAPPED) {
329 if (!first) strcat(msg, "|");
330 strcat(msg, "WAVE_MAPPED");
331 }
332 return msg;
333}
334
335static const char * wave_header_flags(DWORD flags)
336{
337#define WHDR_MASK (WHDR_BEGINLOOP|WHDR_DONE|WHDR_ENDLOOP|WHDR_INQUEUE|WHDR_PREPARED)
338 static char msg[1024];
339 BOOL first = TRUE;
340 msg[0] = 0;
341 if (flags & WHDR_BEGINLOOP) {
342 strcat(msg, "WHDR_BEGINLOOP");
343 first = FALSE;
344 }
345 if (flags & WHDR_DONE) {
346 if (!first) strcat(msg, " ");
347 strcat(msg, "WHDR_DONE");
348 first = FALSE;
349 }
350 if (flags & WHDR_ENDLOOP) {
351 if (!first) strcat(msg, " ");
352 strcat(msg, "WHDR_ENDLOOP");
353 first = FALSE;
354 }
355 if (flags & WHDR_INQUEUE) {
356 if (!first) strcat(msg, " ");
357 strcat(msg, "WHDR_INQUEUE");
358 first = FALSE;
359 }
360 if (flags & WHDR_PREPARED) {
361 if (!first) strcat(msg, " ");
362 strcat(msg, "WHDR_PREPARED");
363 first = FALSE;
364 }
365 if (flags & ~WHDR_MASK) {
366 char temp[32];
367 sprintf(temp, "UNKNOWN(0x%08x)", flags & ~WHDR_MASK);
368 if (!first) strcat(msg, " ");
369 strcat(msg, temp);
370 }
371 return msg;
372}
373
374static const char * wave_out_caps(DWORD dwSupport)
375{
376#define ADD_FLAG(f) if (dwSupport & f) strcat(msg, " " #f)
377 static char msg[256];
378 msg[0] = 0;
379
386
387 return msg[0] ? msg + 1 : "";
388#undef ADD_FLAG
389}
390
392{
393 static char msg[32];
394#define TIME_FORMAT(f) case f: return #f
395 switch (type) {
402 }
403#undef TIME_FORMAT
404 sprintf(msg, "Unknown(0x%04x)", type);
405 return msg;
406}
407
409{
410 static char msg[32];
411#define WAVE_FORMAT(f) case f: return #f
412 switch (format) {
455 }
456#undef WAVE_FORMAT
457 sprintf(msg, "Unknown(0x%04x)", format);
458 return msg;
459}
460
462{
463 return bytes / pwfx->nBlockAlign;
464}
465
467{
468 return bytes_to_samples(bytes, pwfx) * 1000 / pwfx->nSamplesPerSec;
469}
470
472{
473 if (mmtime->wType == TIME_BYTES)
474 return mmtime->u.cb;
475 else if (mmtime->wType == TIME_SAMPLES)
476 return mmtime->u.sample * pwfx->nBlockAlign;
477 else if (mmtime->wType == TIME_MS)
478 return mmtime->u.ms * pwfx->nAvgBytesPerSec / 1000;
479 else if (mmtime->wType == TIME_SMPTE)
480 return ((mmtime->u.smpte.hour * 60 * 60) +
481 (mmtime->u.smpte.min * 60) +
482 (mmtime->u.smpte.sec)) * pwfx->nAvgBytesPerSec +
483 mmtime->u.smpte.frame * pwfx->nAvgBytesPerSec / 30;
484
485 trace("FIXME: time_to_bytes() type not supported\n");
486 return -1;
487}
488
489static void check_position(int device, HWAVEOUT wout, DWORD bytes,
490 LPWAVEFORMATEX pwfx )
491{
492 MMTIME mmtime;
493 MMRESULT rc;
494 DWORD returned;
495
496 mmtime.wType = TIME_BYTES;
497 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime) - 1);
498 ok(rc==MMSYSERR_ERROR,
499 "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
500
501 mmtime.wType = TIME_BYTES;
502 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime) + 1);
504 "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
505 if (mmtime.wType != TIME_BYTES && winetest_debug > 1)
506 trace("waveOutGetPosition(%s): TIME_BYTES not supported, returned %s\n",
508 returned = time_to_bytes(&mmtime, pwfx);
509 ok(returned == bytes, "waveOutGetPosition(%s): returned %d bytes, "
510 "should be %d\n", dev_name(device), returned, bytes);
511
512 mmtime.wType = TIME_SAMPLES;
513 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
515 "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
516 if (mmtime.wType != TIME_SAMPLES && winetest_debug > 1)
517 trace("waveOutGetPosition(%s): TIME_SAMPLES not supported, "
518 "returned %s\n",dev_name(device),wave_time_format(mmtime.wType));
519 returned = time_to_bytes(&mmtime, pwfx);
520 ok(returned == bytes, "waveOutGetPosition(%s): returned %d samples "
521 "(%d bytes), should be %d (%d bytes)\n", dev_name(device),
522 bytes_to_samples(returned, pwfx), returned,
524
525 mmtime.wType = TIME_MS;
526 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
528 "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
529 if (mmtime.wType != TIME_MS && winetest_debug > 1)
530 trace("waveOutGetPosition(%s): TIME_MS not supported, returned %s\n",
532 returned = time_to_bytes(&mmtime, pwfx);
533 ok(returned == bytes, "waveOutGetPosition(%s): returned %d ms, "
534 "(%d bytes), should be %d (%d bytes)\n", dev_name(device),
535 bytes_to_ms(returned, pwfx), returned,
536 bytes_to_ms(bytes, pwfx), bytes);
537
538 mmtime.wType = TIME_SMPTE;
539 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
541 "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
542 if (mmtime.wType != TIME_SMPTE && winetest_debug > 1)
543 trace("waveOutGetPosition(%s): TIME_SMPTE not supported, returned %s\n",
545 returned = time_to_bytes(&mmtime, pwfx);
546 ok(returned == bytes, "waveOutGetPosition(%s): SMPTE test failed\n",
548
549 mmtime.wType = TIME_MIDI;
550 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
552 "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
553 if (mmtime.wType != TIME_MIDI && winetest_debug > 1)
554 trace("waveOutGetPosition(%s): TIME_MIDI not supported, returned %s\n",
556 returned = time_to_bytes(&mmtime, pwfx);
557 ok(returned == bytes, "waveOutGetPosition(%s): MIDI test failed\n",
559
560 mmtime.wType = TIME_TICKS;
561 rc=waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
563 "waveOutGetPosition(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
564 if (mmtime.wType != TIME_TICKS && winetest_debug > 1)
565 trace("waveOutGetPosition(%s): TIME_TICKS not supported, returned %s\n",
567 returned = time_to_bytes(&mmtime, pwfx);
568 ok(returned == bytes, "waveOutGetPosition(%s): TICKS test failed\n",
570}
571
572static void CALLBACK callback_func(HWAVEOUT hwo, UINT uMsg,
573 DWORD_PTR dwInstance,
574 DWORD dwParam1, DWORD dwParam2)
575{
576 if(uMsg == WOM_OPEN || uMsg == WOM_CLOSE)
577 ok(GetCurrentThreadId() == g_tid, "Got different thread ID\n");
578 SetEvent((HANDLE)dwInstance);
579}
580
582{
583 MSG msg;
584
585 PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ); /* make sure the thread has a message queue */
586 SetEvent(lpParameter);
587
588 while (GetMessageA(&msg, 0, 0, 0)) {
589 UINT message = msg.message;
590 /* for some reason XP sends a WM_USER message before WOM_OPEN */
591 ok (message == WOM_OPEN || message == WOM_DONE ||
593 "GetMessageA returned unexpected message: %u\n", message);
595 SetEvent(lpParameter);
596 else if (message == WM_APP) {
597 SetEvent(lpParameter);
598 return 0;
599 }
600 }
601
602 return 0;
603}
604
605static void wave_out_test_deviceOut(int device, double duration, int headers, int loops,
607 BOOL sine, BOOL pause)
608{
609 HWAVEOUT wout;
611 WAVEHDR *frags = 0;
612 MMRESULT rc;
614 WORD nChannels = pwfx->nChannels;
615 WORD wBitsPerSample = pwfx->wBitsPerSample;
616 DWORD nSamplesPerSec = pwfx->nSamplesPerSec;
617 BOOL has_volume = (pcaps->dwSupport & WAVECAPS_VOLUME) != 0;
618 double paused = 0.0;
620 DWORD_PTR callback_instance = 0;
621 HANDLE thread = 0;
623 char * buffer;
625 DWORD frag_length;
626 int i, j;
627
630 callback_instance = 0;
631 } else if ((flags & CALLBACK_TYPEMASK) == CALLBACK_FUNCTION) {
633 callback_instance = (DWORD_PTR)hevent;
634 } else if ((flags & CALLBACK_TYPEMASK) == CALLBACK_THREAD) {
636 if (thread) {
637 /* make sure thread is running */
640 callback_instance = 0;
641 } else {
642 trace("CreateThread() failed\n");
644 return;
645 }
646 } else if ((flags & CALLBACK_TYPEMASK) == CALLBACK_WINDOW) {
647 trace("CALLBACK_THREAD not implemented\n");
649 return;
650 } else if (flags & CALLBACK_TYPEMASK) {
651 trace("Undefined callback type!\n");
653 return;
654 } else {
655 trace("CALLBACK_NULL not implemented\n");
657 return;
658 }
659 wout=NULL;
661 rc=waveOutOpen(&wout,device,pwfx,callback,callback_instance,flags);
662 /* Note: Win9x doesn't know WAVE_FORMAT_DIRECT */
663 /* It is acceptable to fail on formats that are not specified to work */
666 rc==MMSYSERR_ALLOCATED ||
668 (flags & WAVE_FORMAT_DIRECT) && !(pcaps->dwFormats & format)) ||
671 !(pcaps->dwFormats & format)) ||
673 "waveOutOpen(%s): format=%dx%2dx%d flags=%x(%s) rc=%s\n",
676 if ((rc==WAVERR_BADFORMAT || rc==MMSYSERR_NOTSUPPORTED) &&
677 (flags & WAVE_FORMAT_DIRECT) && (pcaps->dwFormats & format))
678 trace(" Reason: The device lists this format as supported in its "
679 "capabilities but opening it failed.\n");
680 if ((rc==WAVERR_BADFORMAT || rc==MMSYSERR_NOTSUPPORTED) &&
681 !(pcaps->dwFormats & format))
682 trace("waveOutOpen(%s): format=%dx%2dx%d %s rc=%s failed but format "
683 "not supported so OK.\n", dev_name(device), pwfx->nSamplesPerSec,
684 pwfx->wBitsPerSample,pwfx->nChannels,
685 flags & WAVE_FORMAT_DIRECT ? "flags=WAVE_FORMAT_DIRECT" :
686 flags & WAVE_MAPPED ? "flags=WAVE_MAPPED" : "", mmsys_error(rc));
687 if (rc!=MMSYSERR_NOERROR)
688 goto EXIT;
689
691 ok(rc==WAIT_OBJECT_0, "missing WOM_OPEN notification\n");
692
693 ok(pwfx->nChannels==nChannels &&
694 pwfx->wBitsPerSample==wBitsPerSample &&
695 pwfx->nSamplesPerSec==nSamplesPerSec,
696 "got the wrong format: %dx%2dx%d instead of %dx%2dx%d\n",
697 pwfx->nSamplesPerSec, pwfx->wBitsPerSample,
698 pwfx->nChannels, nSamplesPerSec, wBitsPerSample, nChannels);
699
700 frags = HeapAlloc(GetProcessHeap(), 0, headers * sizeof(WAVEHDR));
701
702 if (sine)
703 buffer=wave_generate_la(pwfx,duration / (loops + 1),&length);
704 else
705 buffer=wave_generate_silence(pwfx,duration / (loops + 1),&length);
706
707 rc=waveOutGetVolume(wout,0);
708 ok(rc==MMSYSERR_INVALPARAM,"waveOutGetVolume(%s,0) expected "
709 "MMSYSERR_INVALPARAM, got %s\n", dev_name(device),wave_out_error(rc));
710 rc=waveOutGetVolume(wout,&volume);
711 if (rc == MMSYSERR_NOTSUPPORTED) has_volume = FALSE;
712 ok(has_volume ? rc==MMSYSERR_NOERROR : rc==MMSYSERR_NOTSUPPORTED,
713 "waveOutGetVolume(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
714
715 /* make sure fragment length is a multiple of block size */
716 frag_length = ((length / headers) / pwfx->nBlockAlign) * pwfx->nBlockAlign;
717
718 for (i = 0; i < headers; i++) {
719 frags[i].lpData=buffer + (i * frag_length);
720 if (i != (headers-1))
721 frags[i].dwBufferLength=frag_length;
722 else {
723 /* use remainder of buffer for last fragment */
724 frags[i].dwBufferLength=length - (i * frag_length);
725 }
726 frags[i].dwFlags=0;
727 frags[i].dwLoops=0;
728 rc=waveOutPrepareHeader(wout, &frags[i], sizeof(frags[0]));
730 "waveOutPrepareHeader(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
731 }
732
733 if (interactive && rc==MMSYSERR_NOERROR) {
734 trace("Playing %g second %s at %5dx%2dx%d %2d header%s %d loop%s %d bytes %s %s\n",duration,
735 sine ? "440 Hz tone" : "silence", pwfx->nSamplesPerSec,
736 pwfx->wBitsPerSample,pwfx->nChannels, headers, headers > 1 ? "s": " ",
737 loops, loops == 1 ? " " : "s", length * (loops + 1),
740 if (sine && has_volume && volume == 0)
741 trace("*** Warning the sound is muted, you will not hear the test\n");
742
743 /* Check that the position is 0 at start */
744 check_position(device, wout, 0, pwfx);
745
746 rc=waveOutSetVolume(wout,0x20002000);
747 ok(has_volume ? rc==MMSYSERR_NOERROR : rc==MMSYSERR_NOTSUPPORTED,
748 "waveOutSetVolume(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
749
750 rc=waveOutSetVolume(wout,volume);
751 ok(has_volume ? rc==MMSYSERR_NOERROR : rc==MMSYSERR_NOTSUPPORTED,
752 "waveOutSetVolume(%s): rc=%s\n",dev_name(device),wave_out_error(rc));
753
754 rc=waveOutWrite(wout, &frags[0], sizeof(frags[0]));
755 ok(rc==MMSYSERR_NOERROR,"waveOutWrite(%s): rc=%s\n",
757
759 "WHDR_INQUEUE WHDR_PREPARED expected, got= %s\n",
760 wave_header_flags(frags[0].dwFlags));
761
762 rc=waveOutWrite(wout, &frags[0], sizeof(frags[0]));
764 "waveOutWrite(%s): WAVE_STILLPLAYING expected, got %s\n",
766
768 "WHDR_INQUEUE WHDR_PREPARED expected, got %s\n",
769 wave_header_flags(frags[0].dwFlags));
770
771 if (headers == 1 && loops == 0 && pause) {
772 paused = duration / 2;
773 Sleep(paused * 1000);
774 rc=waveOutPause(wout);
775 ok(rc==MMSYSERR_NOERROR,"waveOutPause(%s): rc=%s\n",
777 trace("pausing for %g seconds\n", paused);
778 Sleep(paused * 1000);
779 rc=waveOutRestart(wout);
780 ok(rc==MMSYSERR_NOERROR,"waveOutRestart(%s): rc=%s\n",
782 }
783
784 for (j = 0; j <= loops; j++) {
785 for (i = 0; i < headers; i++) {
786 /* don't do last one */
787 if (!((j == loops) && (i == (headers - 1)))) {
788 if (j > 0)
789 frags[(i+1) % headers].dwFlags = WHDR_PREPARED;
790 rc=waveOutWrite(wout, &frags[(i+1) % headers], sizeof(frags[0]));
791 ok(rc==MMSYSERR_NOERROR,"waveOutWrite(%s, header[%d]): rc=%s\n",
793 }
795 ok(rc==WAIT_OBJECT_0, "missing WOM_DONE notification\n");
796 }
797 }
798
799 for (i = 0; i < headers; i++) {
800 ok(frags[i].dwFlags==(WHDR_DONE|WHDR_PREPARED) ||
802 frags[i].dwFlags==(WHDR_DONE|WHDR_PREPARED|0x1000)), /* < NT4 */
803 "(%02d) WHDR_DONE WHDR_PREPARED expected, got %s\n",
804 i, wave_header_flags(frags[i].dwFlags));
805 }
806 check_position(device, wout, length * (loops + 1), pwfx);
807 }
808
809 for (i = 0; i < headers; i++) {
810 rc=waveOutUnprepareHeader(wout, &frags[i], sizeof(frags[0]));
812 "waveOutUnprepareHeader(%s): rc=%s\n",dev_name(device),
813 wave_out_error(rc));
814 }
815
816 ok(frags[0].dwFlags==(interactive ? WHDR_DONE : 0), "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
817
818 frags[0].dwFlags |= WHDR_DONE;
819 rc=waveOutUnprepareHeader(wout, &frags[0], sizeof(frags[0]));
820 ok(rc==MMSYSERR_NOERROR, "waveOutUnprepareHeader(%d): rc=%s\n",device,wave_out_error(rc));
821 ok(frags[0].dwFlags==WHDR_DONE, "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
822
823 frags[0].dwFlags |= WHDR_INQUEUE;
824 rc=waveOutPrepareHeader(wout, &frags[0], sizeof(frags[0]));
825 ok(rc==MMSYSERR_NOERROR, "waveOutPrepareHeader(%d): rc=%s\n",device,wave_out_error(rc));
826 ok(frags[0].dwFlags==WHDR_PREPARED, "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
827
828 frags[0].dwFlags |= WHDR_INQUEUE;
829 rc=waveOutPrepareHeader(wout, &frags[0], sizeof(frags[0]));
830 ok(rc==MMSYSERR_NOERROR, "waveOutPrepareHeader(%d): rc=%s\n",device,wave_out_error(rc));
831 ok(frags[0].dwFlags==(WHDR_PREPARED|WHDR_INQUEUE), "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
832
833 frags[0].dwFlags &= ~(WHDR_INQUEUE|WHDR_DONE);
834 rc=waveOutUnprepareHeader(wout, &frags[0], sizeof(frags[0]));
835 ok(rc==MMSYSERR_NOERROR, "waveOutUnprepareHeader(%d): rc=%s\n",device,wave_out_error(rc));
836 ok(frags[0].dwFlags==0, "dwFlags(%d)=%x\n",device,frags[0].dwFlags);
837
838 rc=waveOutClose(wout);
839 ok(rc==MMSYSERR_NOERROR,"waveOutClose(%s): rc=%s\n",dev_name(device),
840 wave_out_error(rc));
841 if (rc==WAVERR_STILLPLAYING) {
842 /* waveOutReset ought to return all buffers s.t. waveOutClose succeeds */
843 rc=waveOutReset(wout);
844 ok(rc==MMSYSERR_NOERROR,"waveOutReset(%s): rc=%s\n",dev_name(device),
845 wave_out_error(rc));
846
847 for (i = 0; i < headers; i++) {
848 rc=waveOutUnprepareHeader(wout, &frags[i], sizeof(frags[0]));
850 "waveOutUnprepareHeader(%s): rc=%s\n",dev_name(device),
851 wave_out_error(rc));
852 }
853 rc=waveOutClose(wout);
854 ok(rc==MMSYSERR_NOERROR,"waveOutClose(%s): rc=%s\n",dev_name(device),
855 wave_out_error(rc));
856 }
858 ok(rc==WAIT_OBJECT_0, "missing WOM_CLOSE notification\n");
859
860 wout = (HWAVEOUT)0xdeadf00d;
861 rc=waveOutOpen(&wout,device,pwfx,callback,callback_instance,flags|WAVE_FORMAT_QUERY);
862 ok(rc==MMSYSERR_NOERROR, "WAVE_FORMAT_QUERY(%s): rc=%s\n",dev_name(device),
863 wave_out_error(rc));
864 ok(wout==(HWAVEOUT)0xdeadf00d, "WAVE_FORMAT_QUERY handle %p\n", wout);
865
867 ok(rc==WAIT_TIMEOUT, "Notification from %s rc=%x\n",
869
871EXIT:
875 }
877 HeapFree(GetProcessHeap(), 0, frags);
878}
879
881{
882 WAVEOUTCAPSA capsA;
883 WAVEOUTCAPSW capsW;
887 HWAVEOUT wout;
888 MMRESULT rc;
889 UINT f;
890 WCHAR * nameW;
891 CHAR * nameA;
892 DWORD size;
893 DWORD dwPageSize;
894 BYTE * twoPages;
895 SYSTEM_INFO sSysInfo;
896 DWORD flOldProtect;
897 BOOL res;
898
899 GetSystemInfo(&sSysInfo);
900 dwPageSize = sSysInfo.dwPageSize;
901
902 rc=waveOutGetDevCapsA(device,&capsA,sizeof(capsA));
905 "waveOutGetDevCapsA(%s): failed to get capabilities: rc=%s\n",
908 return;
909
910 rc=waveOutGetDevCapsW(device,&capsW,sizeof(capsW));
912 "waveOutGetDevCapsW(%s): MMSYSERR_NOERROR or MMSYSERR_NOTSUPPORTED "
913 "expected, got %s\n",dev_name(device),wave_out_error(rc));
914
915 rc=waveOutGetDevCapsA(device,0,sizeof(capsA));
917 "waveOutGetDevCapsA(%s): MMSYSERR_INVALPARAM expected, "
918 "got %s\n",dev_name(device),wave_out_error(rc));
919
920 rc=waveOutGetDevCapsW(device,0,sizeof(capsW));
922 "waveOutGetDevCapsW(%s): MMSYSERR_INVALPARAM or MMSYSERR_NOTSUPPORTED "
923 "expected, got %s\n",dev_name(device),wave_out_error(rc));
924
925 if (0)
926 {
927 /* FIXME: this works on windows but crashes wine */
928 rc=waveOutGetDevCapsA(device,(LPWAVEOUTCAPSA)1,sizeof(capsA));
930 "waveOutGetDevCapsA(%s): MMSYSERR_INVALPARAM expected, got %s\n",
932
933 rc=waveOutGetDevCapsW(device,(LPWAVEOUTCAPSW)1,sizeof(capsW));
935 "waveOutGetDevCapsW(%s): MMSYSERR_INVALPARAM or MMSYSERR_NOTSUPPORTED "
936 "expected, got %s\n",dev_name(device),wave_out_error(rc));
937 }
938
939 rc=waveOutGetDevCapsA(device,&capsA,4);
941 "waveOutGetDevCapsA(%s): MMSYSERR_NOERROR or MMSYSERR_INVALPARAM "
942 "expected, got %s\n", dev_name(device),wave_out_error(rc));
943
944 rc=waveOutGetDevCapsW(device,&capsW,4);
946 rc==MMSYSERR_INVALPARAM, /* Vista, W2K8 */
947 "waveOutGetDevCapsW(%s): unexpected return value %s\n",
949
950 rc=waveOutMessage((HWAVEOUT)device, DRV_QUERYMAPPABLE, 0, 0);
952 "DRV_QUERYMAPPABLE(%s): unexpected return value %s\n",
954
955 nameA=NULL;
957 (DWORD_PTR)&size, 0);
960 "waveOutMessage(%s): failed to get interface size, rc=%s\n",
962 if (rc==MMSYSERR_NOERROR) {
966 ok(rc==MMSYSERR_NOERROR,"waveOutMessage(%s): failed to get interface "
967 "name, rc=%s\n",dev_name(device),wave_out_error(rc));
968 ok(lstrlenW(nameW)+1==size/sizeof(WCHAR),"got an incorrect size %d\n",size);
969 if (rc==MMSYSERR_NOERROR) {
970 nameA = HeapAlloc(GetProcessHeap(), 0, size/sizeof(WCHAR));
971 WideCharToMultiByte(CP_ACP, 0, nameW, size/sizeof(WCHAR), nameA,
972 size/sizeof(WCHAR), NULL, NULL);
973 }
975 }
976 else if (rc==MMSYSERR_NOTSUPPORTED) {
977 nameA=HeapAlloc(GetProcessHeap(), 0, sizeof("not supported"));
978 strcpy(nameA, "not supported");
979 }
980
981 rc=waveOutGetDevCapsA(device,&capsA,sizeof(capsA));
983 "waveOutGetDevCapsA(%s): MMSYSERR_NOERROR expected, got %s\n",
985 if (rc!=MMSYSERR_NOERROR)
986 {
987 HeapFree(GetProcessHeap(), 0, nameA);
988 return;
989 }
990
991 trace(" %s: \"%s\" (%s) %d.%d (%d:%d)\n",dev_name(device),capsA.szPname,
992 (nameA?nameA:"failed"),capsA.vDriverVersion >> 8,
993 capsA.vDriverVersion & 0xff, capsA.wMid,capsA.wPid);
994 trace(" channels=%d formats=%05x support=%04x\n",
995 capsA.wChannels,capsA.dwFormats,capsA.dwSupport);
996 trace(" %s\n",wave_out_caps(capsA.dwSupport));
997 HeapFree(GetProcessHeap(), 0, nameA);
998
1000 {
1001 trace("Playing a 5 seconds reference tone.\n");
1002 trace("All subsequent tones should be identical to this one.\n");
1003 trace("Listen for stutter, changes in pitch, volume, etc.\n");
1004 format.wFormatTag=WAVE_FORMAT_PCM;
1005 format.nChannels=1;
1006 format.wBitsPerSample=8;
1007 format.nSamplesPerSec=22050;
1008 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
1009 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
1010 format.cbSize=0;
1011
1013 CALLBACK_EVENT,&capsA,TRUE,TRUE,FALSE);
1018
1020 CALLBACK_EVENT,&capsA,TRUE,TRUE,FALSE);
1022 CALLBACK_EVENT,&capsA,TRUE,TRUE,FALSE);
1023 } else {
1024 format.wFormatTag=WAVE_FORMAT_PCM;
1025 format.nChannels=1;
1026 format.wBitsPerSample=8;
1027 format.nSamplesPerSec=22050;
1028 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
1029 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
1030 format.cbSize=0;
1034 CALLBACK_EVENT,&capsA,TRUE,FALSE,TRUE);
1043
1048 }
1049
1050 for (f = 0; f < ARRAY_SIZE(win_formats); f++) {
1051 format.wFormatTag=WAVE_FORMAT_PCM;
1052 format.nChannels=win_formats[f][3];
1053 format.wBitsPerSample=win_formats[f][2];
1054 format.nSamplesPerSec=win_formats[f][1];
1055 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
1056 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
1057 format.cbSize=0;
1060 TRUE,FALSE);
1063 TRUE,FALSE);
1066 TRUE,FALSE);
1067
1070 TRUE,FALSE);
1073 TRUE,FALSE);
1074
1078 TRUE,TRUE);
1081 TRUE,TRUE);
1084 TRUE,TRUE);
1085
1088 TRUE,TRUE);
1091 TRUE,TRUE);
1092 }
1093 if (device != WAVE_MAPPER)
1094 {
1113
1120 }
1121 }
1122
1123 /* Try a PCMWAVEFORMAT aligned next to an unaccessible page for bounds
1124 * checking */
1125 twoPages = VirtualAlloc(NULL, 2 * dwPageSize, MEM_RESERVE | MEM_COMMIT,
1127 ok(twoPages!=NULL,"Failed to allocate 2 pages of memory\n");
1128 if (twoPages) {
1129 res = VirtualProtect(twoPages + dwPageSize, dwPageSize, PAGE_NOACCESS,
1130 &flOldProtect);
1131 ok(res, "Failed to set memory access on second page\n");
1132 if (res) {
1133 LPWAVEFORMATEX pwfx = (LPWAVEFORMATEX)(twoPages + dwPageSize -
1134 sizeof(PCMWAVEFORMAT));
1136 pwfx->nChannels=1;
1137 pwfx->wBitsPerSample=8;
1138 pwfx->nSamplesPerSec=22050;
1139 pwfx->nBlockAlign=pwfx->nChannels*pwfx->wBitsPerSample/8;
1140 pwfx->nAvgBytesPerSec=pwfx->nSamplesPerSec*pwfx->nBlockAlign;
1143 TRUE,FALSE);
1146 TRUE,FALSE);
1149 TRUE,FALSE);
1150 if (device != WAVE_MAPPER)
1151 {
1170 }
1171 }
1172 VirtualFree(twoPages, 0, MEM_RELEASE);
1173 }
1174
1175 /* try some non PCM formats */
1176 format.wFormatTag=WAVE_FORMAT_MULAW;
1177 format.nChannels=1;
1178 format.wBitsPerSample=8;
1179 format.nSamplesPerSec=8000;
1180 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
1181 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
1182 format.cbSize=0;
1186 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1187 if (rc==MMSYSERR_NOERROR) {
1188 waveOutClose(wout);
1195 } else {
1196 MMRESULT query_rc;
1197
1198 trace("waveOutOpen(%s): WAVE_FORMAT_MULAW not supported\n",
1199 dev_name(device));
1200
1202 ok(query_rc==MMSYSERR_NOERROR || query_rc==WAVERR_BADFORMAT || query_rc==MMSYSERR_INVALPARAM,
1203 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1204
1205 rc = waveOutOpen(&wout, device, &format, 0, 0, CALLBACK_NULL);
1206 ok(rc == query_rc,
1207 "waveOutOpen(%s): returned different from query: %s\n",dev_name(device),wave_out_error(rc));
1208 if(rc == MMSYSERR_NOERROR)
1209 waveOutClose(wout);
1210 }
1211
1213 wfa.wfx.nChannels=1;
1214 wfa.wfx.nSamplesPerSec=11025;
1215 wfa.wfx.nAvgBytesPerSec=5588;
1216 wfa.wfx.nBlockAlign=256;
1217 wfa.wfx.wBitsPerSample=4; /* see imaadp32.c */
1218 wfa.wfx.cbSize=2;
1219 wfa.wSamplesPerBlock=505;
1223 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1224 if (rc==MMSYSERR_NOERROR) {
1225 waveOutClose(wout);
1226 /* TODO: teach wave_generate_* ADPCM
1227 wave_out_test_deviceOut(device,1.0,1,0,&wfa.wfx,0,CALLBACK_EVENT,
1228 &capsA,winetest_interactive,TRUE,FALSE);
1229 wave_out_test_deviceOut(device,1.0,10,0,&wfa.wfx,0,CALLBACK_EVENT,
1230 &capsA,winetest_interactive,TRUE,FALSE);
1231 wave_out_test_deviceOut(device,1.0,5,1,&wfa.wfx,0,CALLBACK_EVENT,
1232 &capsA,winetest_interactive,TRUE,FALSE);
1233 */
1234 } else
1235 trace("waveOutOpen(%s): WAVE_FORMAT_IMA_ADPCM not supported\n",
1236 dev_name(device));
1237
1238 /* test if WAVEFORMATEXTENSIBLE supported */
1240 wfex.Format.nChannels=2;
1241 wfex.Format.wBitsPerSample=16;
1242 wfex.Format.nSamplesPerSec=22050;
1245 wfex.Format.nBlockAlign;
1246 wfex.Format.cbSize=22;
1250 rc=waveOutOpen(&wout,device,&wfex.Format,0,0,
1254 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1255 if (rc==MMSYSERR_NOERROR) {
1256 waveOutClose(wout);
1259 TRUE,FALSE);
1262 TRUE,FALSE);
1265 TRUE,FALSE);
1266 } else
1267 trace("waveOutOpen(%s): WAVE_FORMAT_EXTENSIBLE not supported\n",
1268 dev_name(device));
1269
1270 /* test if 4 channels supported */
1272 wfex.Format.nChannels=4;
1273 wfex.Format.wBitsPerSample=16;
1274 wfex.Format.nSamplesPerSec=22050;
1277 wfex.Format.nBlockAlign;
1278 wfex.Format.cbSize=22;
1282 rc=waveOutOpen(&wout,device,&wfex.Format,0,0,
1286 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1287 if (rc==MMSYSERR_NOERROR) {
1288 waveOutClose(wout);
1295 } else
1296 trace("waveOutOpen(%s): 4 channels not supported\n",
1297 dev_name(device));
1298
1299 /* test if 6 channels supported */
1301 wfex.Format.nChannels=6;
1302 wfex.Format.wBitsPerSample=16;
1303 wfex.Format.nSamplesPerSec=22050;
1306 wfex.Format.nBlockAlign;
1307 wfex.Format.cbSize=22;
1311 rc=waveOutOpen(&wout,device,&wfex.Format,0,0,
1315 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1316 if (rc==MMSYSERR_NOERROR) {
1317 waveOutClose(wout);
1320 TRUE,FALSE);
1323 TRUE,FALSE);
1326 TRUE,FALSE);
1327 } else
1328 trace("waveOutOpen(%s): 6 channels not supported\n",
1329 dev_name(device));
1330
1331 if (0)
1332 {
1333 /* FIXME: ALSA doesn't like this format */
1334 /* test if 24 bit samples supported */
1336 wfex.Format.nChannels=2;
1337 wfex.Format.wBitsPerSample=24;
1338 wfex.Format.nSamplesPerSec=22050;
1341 wfex.Format.nBlockAlign;
1342 wfex.Format.cbSize=22;
1346 rc=waveOutOpen(&wout,device,&wfex.Format,0,0,
1350 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1351 if (rc==MMSYSERR_NOERROR) {
1352 waveOutClose(wout);
1355 TRUE,FALSE);
1356 } else
1357 trace("waveOutOpen(%s): 24 bit samples not supported\n",
1358 dev_name(device));
1359 }
1360
1361 /* test if 32 bit samples supported */
1363 wfex.Format.nChannels=2;
1364 wfex.Format.wBitsPerSample=32;
1365 wfex.Format.nSamplesPerSec=22050;
1368 wfex.Format.nBlockAlign;
1369 wfex.Format.cbSize=22;
1373 rc=waveOutOpen(&wout,device,&wfex.Format,0,0,
1377 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1378 if (rc==MMSYSERR_NOERROR) {
1379 waveOutClose(wout);
1382 TRUE,FALSE);
1385 TRUE,FALSE);
1388 TRUE,FALSE);
1389 } else
1390 trace("waveOutOpen(%s): 32 bit samples not supported\n",
1391 dev_name(device));
1392
1393 /* test if 32 bit float samples supported */
1395 wfex.Format.nChannels=2;
1396 wfex.Format.wBitsPerSample=32;
1397 wfex.Format.nSamplesPerSec=22050;
1400 wfex.Format.nBlockAlign;
1401 wfex.Format.cbSize=22;
1405 rc=waveOutOpen(&wout,device,&wfex.Format,0,0,
1409 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1410 if (rc==MMSYSERR_NOERROR) {
1411 waveOutClose(wout);
1414 TRUE,FALSE);
1417 TRUE,FALSE);
1420 TRUE,FALSE);
1421 } else
1422 trace("waveOutOpen(%s): 32 bit float samples not supported\n",
1423 dev_name(device));
1424
1425 /* Test invalid parameters */
1426
1427 format.wFormatTag = WAVE_FORMAT_PCM;
1428 format.nChannels = 1;
1429 format.nSamplesPerSec = 11025;
1430 format.nBlockAlign = 1;
1431 format.nAvgBytesPerSec = 11025 * 1;
1432 format.wBitsPerSample = 8;
1433 format.cbSize = 0;
1434
1435 format.nAvgBytesPerSec = 0;
1436 rc = waveOutOpen(&wout, device, &format, 0, 0, 0);
1437 ok(rc == MMSYSERR_NOERROR,
1438 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1439 waveOutClose(wout);
1440 format.nAvgBytesPerSec = 11025 * 1;
1441
1442 format.nSamplesPerSec = 0;
1443 rc = waveOutOpen(&wout, device, &format, 0, 0, 0);
1444 ok(rc == MMSYSERR_INVALPARAM || rc == WAVERR_BADFORMAT, /* XP and lower return WAVERR_BADFORMAT */
1445 "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc));
1446}
1447
1448static void wave_out_tests(void)
1449{
1450 WAVEOUTCAPSA capsA;
1451 WAVEOUTCAPSW capsW;
1453 HWAVEOUT wout;
1454 MMRESULT rc;
1455 DWORD preferred, status;
1456 UINT ndev,d;
1457
1458 ndev=waveOutGetNumDevs();
1459 trace("found %d WaveOut devices\n",ndev);
1460
1462 (DWORD_PTR)&preferred, (DWORD_PTR)&status);
1463 ok((ndev == 0 && (rc == MMSYSERR_NODRIVER || rc == MMSYSERR_BADDEVICEID)) ||
1464 rc == MMSYSERR_NOTSUPPORTED ||
1465 rc == MMSYSERR_NOERROR, "waveOutMessage(DRVM_MAPPER_PREFERRED_GET) failed: %u\n", rc);
1466
1467 if(rc != MMSYSERR_NOTSUPPORTED)
1468 ok((ndev == 0 && (preferred == -1 || broken(preferred != -1))) ||
1469 preferred < ndev, "Got invalid preferred device: 0x%x\n", preferred);
1470
1472 (DWORD_PTR)-1 , 0);
1473 ok(rc == MMSYSERR_INVALPARAM || rc == MMSYSERR_BADDEVICEID, /* w2008+wvista */
1474 "waveOutMessage(DRVM_MAPPER_PREFERRED_GET) failed: %u\n", rc);
1475
1477 0, (DWORD_PTR)&status);
1478 ok(rc == MMSYSERR_INVALPARAM || rc == MMSYSERR_BADDEVICEID, /* w2008+wvista */
1479 "waveOutMessage(DRVM_MAPPER_PREFERRED_GET) failed: %u\n", rc);
1480
1481 rc=waveOutGetDevCapsA(ndev+1,&capsA,sizeof(capsA));
1483 "waveOutGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n",
1484 dev_name(ndev+1),mmsys_error(rc));
1485
1486 rc=waveOutGetDevCapsW(ndev+1,&capsW,sizeof(capsW));
1488 "waveOutGetDevCapsW(%s): MMSYSERR_BADDEVICEID or MMSYSERR_NOTSUPPORTED "
1489 "expected, got %s\n",dev_name(ndev+1),mmsys_error(rc));
1490
1491 rc=waveOutGetDevCapsA(WAVE_MAPPER,&capsA,sizeof(capsA));
1492 if (ndev>0)
1493 ok(rc==MMSYSERR_NOERROR,
1494 "waveOutGetDevCapsA(%s): MMSYSERR_NOERROR expected, got %s\n",
1496 else
1498 "waveOutGetDevCapsA(%s): MMSYSERR_BADDEVICEID or MMSYSERR_NODRIVER "
1499 "expected, got %s\n",dev_name(WAVE_MAPPER),mmsys_error(rc));
1500
1501 rc=waveOutGetDevCapsW(WAVE_MAPPER,&capsW,sizeof(capsW));
1502 if (ndev>0)
1504 "waveOutGetDevCapsW(%s): MMSYSERR_NOERROR or MMSYSERR_NOTSUPPORTED "
1505 "expected, got %s\n",dev_name(WAVE_MAPPER),mmsys_error(rc));
1506 else
1509 "waveOutGetDevCapsW(%s): MMSYSERR_BADDEVICEID or MMSYSERR_NODRIVER "
1510 " or MMSYSERR_NOTSUPPORTED expected, got %s\n",
1512
1513 format.wFormatTag=WAVE_FORMAT_PCM;
1514 format.nChannels=2;
1515 format.wBitsPerSample=16;
1516 format.nSamplesPerSec=44100;
1517 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
1518 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
1519 format.cbSize=0;
1520 rc=waveOutOpen(&wout,ndev+1,&format,0,0,CALLBACK_NULL);
1522 "waveOutOpen(%s): MMSYSERR_BADDEVICEID expected, got %s\n",
1523 dev_name(ndev+1),mmsys_error(rc));
1524
1526 for (d=0;d<ndev;d++)
1528
1529 if (ndev>0)
1531}
1532
1533static void test_sndPlaySound(void)
1534{
1535 BOOL br;
1536
1537 static const WCHAR not_existW[] = {'C',':','\\','n','o','t','_','e','x','i','s','t','.','w','a','v',0};
1538 static const WCHAR SystemAsteriskW[] = {'S','y','s','t','e','m','A','s','t','e','r','i','s','k',0};
1539
1541 ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
1542
1544 ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
1545
1547 ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
1548
1550 ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
1551
1552 br = sndPlaySoundA("SystemAsterisk", SND_ALIAS|SND_SYNC);
1553 ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
1554
1555 br = sndPlaySoundW(SystemAsteriskW, SND_ALIAS|SND_SYNC);
1556 ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
1557
1558 br = sndPlaySoundA("C:\not_exist.wav", SND_FILENAME|SND_SYNC);
1559 ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
1560
1561 br = sndPlaySoundW(not_existW, SND_FILENAME|SND_SYNC);
1562 ok(br == TRUE || br == FALSE, "sndPlaySound gave strange return: %u\n", br);
1563}
1564
1565static void test_fragmentsize(void)
1566{
1567 MMRESULT rc;
1568 WAVEHDR hdr[2];
1569 HWAVEOUT wout;
1571 MMTIME mmtime;
1572 DWORD wait;
1573 HANDLE hevent;
1574
1575 if(waveOutGetNumDevs() == 0)
1576 return;
1577
1578 fmt.wFormatTag = WAVE_FORMAT_PCM;
1579 fmt.nChannels = 2;
1580 fmt.nSamplesPerSec = 44100;
1581 fmt.wBitsPerSample = 16;
1582 fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8;
1583 fmt.nAvgBytesPerSec = fmt.nBlockAlign * fmt.nSamplesPerSec;
1584 fmt.cbSize = sizeof(WAVEFORMATEX);
1585
1588
1591 ok(rc == MMSYSERR_NOERROR || rc == WAVERR_BADFORMAT ||
1593 "waveOutOpen(%s) failed: %s\n", dev_name(WAVE_MAPPER), wave_out_error(rc));
1594 if(rc != MMSYSERR_NOERROR){
1596 return;
1597 }
1598
1599 wait = WaitForSingleObject(hevent, 1000);
1600 ok(wait == WAIT_OBJECT_0, "wave open callback missed\n");
1601
1602 memset(hdr, 0, sizeof(hdr));
1603 hdr[0].dwBufferLength = (fmt.nSamplesPerSec * fmt.nBlockAlign / 4) + 1;
1604 hdr[1].dwBufferLength = hdr[0].dwBufferLength - 2;
1605 hdr[1].lpData = hdr[0].lpData =
1606 HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, hdr[0].dwBufferLength);
1607
1608 rc = waveOutPrepareHeader(wout, &hdr[0], sizeof(hdr[0]));
1609 ok(rc == MMSYSERR_NOERROR, "waveOutPrepareHeader failed: %s\n", wave_out_error(rc));
1610
1611 rc = waveOutPrepareHeader(wout, &hdr[1], sizeof(hdr[1]));
1612 ok(rc == MMSYSERR_NOERROR, "waveOutPrepareHeader failed: %s\n", wave_out_error(rc));
1613
1614 trace("writing %u bytes then %u bytes\n", hdr[0].dwBufferLength, hdr[1].dwBufferLength);
1615 rc = waveOutWrite(wout, &hdr[0], sizeof(hdr[0]));
1616 ok(rc == MMSYSERR_NOERROR, "waveOutWrite failed: %s\n", wave_out_error(rc));
1617
1618 rc = waveOutWrite(wout, &hdr[1], sizeof(hdr[1]));
1619 ok(rc == MMSYSERR_NOERROR, "waveOutWrite failed: %s\n", wave_out_error(rc));
1620
1621 wait = WaitForSingleObject(hevent, 1000);
1622 ok(wait == WAIT_OBJECT_0, "header 1 callback missed\n");
1623
1624 wait = WaitForSingleObject(hevent, 1000);
1625 ok(wait == WAIT_OBJECT_0, "header 2 callback missed\n");
1626
1627 memset(&mmtime, 0, sizeof(mmtime));
1628 mmtime.wType = TIME_BYTES;
1629
1630 rc = waveOutGetPosition(wout, &mmtime, sizeof(mmtime));
1631 ok(rc == MMSYSERR_NOERROR, "waveOutGetPosition failed: %s\n", wave_out_error(rc));
1632
1633 /* windows behavior is inconsistent */
1634 ok(mmtime.u.cb == 88200 ||
1635 mmtime.u.cb == 88196, "after position: %u\n", mmtime.u.cb);
1636
1637 rc = waveOutClose(wout);
1638 ok(rc == MMSYSERR_NOERROR, "waveOutClose failed: %s\n", wave_out_error(rc));
1639
1640 HeapFree(GetProcessHeap(), 0, hdr[0].lpData);
1642}
1643
1644static void create_wav_file(char *temp_file)
1645{
1647 HMMIO h;
1648 MMCKINFO riff_chunk, chunk;
1649 MMRESULT rc;
1650 LONG written;
1651 DWORD length;
1652 char *buffer;
1653
1654 format.wFormatTag=WAVE_FORMAT_PCM;
1655 format.cbSize = 0;
1656 format.nChannels=1;
1657 format.wBitsPerSample=8;
1658 format.nSamplesPerSec=8000;
1659 format.nBlockAlign=format.nChannels*format.wBitsPerSample/8;
1660 format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign;
1661
1663 ok(h != NULL, "Can't open temp_file\n");
1664
1665 riff_chunk.fccType = mmioFOURCC('W','A','V','E');
1666 riff_chunk.cksize = 0;
1667 rc = mmioCreateChunk(h, &riff_chunk, MMIO_CREATERIFF);
1668 ok(rc == MMSYSERR_NOERROR, "mmioCreateChunk failed, got %u\n", rc);
1669
1670 chunk.ckid = mmioFOURCC('f','m','t',' ');
1671 chunk.cksize = 0;
1672 rc = mmioCreateChunk(h, &chunk, 0);
1673 ok(rc == MMSYSERR_NOERROR, "mmioCreateChunk failed, got %u\n", rc);
1674 written = mmioWrite(h, (char*)&format, sizeof(format));
1675 ok(written == sizeof(format), "mmioWrite failed, got %d\n", written);
1676 rc = mmioAscend(h, &chunk, 0);
1677 ok(rc == MMSYSERR_NOERROR, "mmioAscend failed, got %d\n", rc);
1678
1679 chunk.ckid = mmioFOURCC('d','a','t','a');
1680 rc = mmioCreateChunk(h, &chunk, 0);
1681 ok(rc == MMSYSERR_NOERROR, "mmioCreateChunk failed, got %u\n", rc);
1683 written = mmioWrite(h, buffer, length);
1684 ok(written == length, "mmioWrite failed, got %d\n", written);
1685 rc = mmioAscend(h, &chunk, 0);
1686 ok(rc == MMSYSERR_NOERROR, "mmioAscend failed, got %d\n", rc);
1688
1689 rc = mmioAscend(h, &riff_chunk, 0);
1690 ok(rc == MMSYSERR_NOERROR, "mmioAscend failed, got %d\n", rc);
1691
1692 rc = mmioClose(h, 0);
1693 ok(rc == MMSYSERR_NOERROR, "mmioClose failed, got %u\n", rc);
1694}
1695
1696static void test_PlaySound(void)
1697{
1698 BOOL br;
1700 void *psound_ordinal, *psound_name;
1701 HMODULE dll = GetModuleHandleA("winmm.dll");
1702
1703 psound_name = GetProcAddress(dll, "PlaySound");
1704 psound_ordinal = GetProcAddress(dll, (LPCSTR) 2);
1705 ok(psound_name == psound_ordinal, "Expected ordinal 2 to be PlaySound function\n");
1706
1707 if(waveOutGetNumDevs() == 0) {
1708 skip("No output devices available\n");
1709 return;
1710 }
1711
1713 strcat(test_file, "mysound.wav");
1715
1717 ok(br, "PlaySound failed, got %d\n", br);
1718
1719 /* SND_ALIAS fallbacks to SND_FILENAME */
1721 ok(br, "PlaySound failed, got %d\n", br);
1722
1724 exts = strrchr(temp, '.');
1725
1726 /* no extensions */
1727 *exts = '\0';
1729 ok(br, "PlaySound failed, got %d\n", br);
1730
1731 /* ends with a dot */
1732 strcpy(exts, ".");
1734 ok(!br || broken(br), "PlaySound succeeded, got %d\n", br);
1735
1737}
1738
1740{
1746}
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define msg(x)
Definition: auth_time.c:54
static const WCHAR nameW[]
Definition: main.c:49
#define WAVE_FORMAT_MULAW
Definition: constants.h:428
#define WAVE_FORMAT_ADPCM
Definition: constants.h:426
#define WAVE_FORMAT_ALAW
Definition: constants.h:427
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define ARRAY_SIZE(A)
Definition: main.h:20
static HANDLE thread
Definition: service.c:33
static HANDLE hevent
Definition: broadcast.c:34
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define WideCharToMultiByte
Definition: compat.h:111
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2054
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define DRV_QUERYDEVICEINTERFACESIZE
Definition: mmddk.h:97
#define DRV_QUERYMAPPABLE
Definition: mmddk.h:93
#define DRV_QUERYDEVICEINTERFACE
Definition: mmddk.h:96
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned char
Definition: typeof.h:29
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
MMRESULT WINAPI mmioAscend(HMMIO hmmio, LPMMCKINFO lpck, UINT uFlags)
Definition: mmio.c:1205
HMMIO WINAPI mmioOpenA(LPSTR szFileName, MMIOINFO *lpmmioinfo, DWORD dwOpenFlags)
Definition: mmio.c:693
MMRESULT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
Definition: mmio.c:702
LONG WINAPI mmioWrite(HMMIO hmmio, HPCSTR pch, LONG cch)
Definition: mmio.c:782
MMRESULT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO *lpck, UINT uFlags)
Definition: mmio.c:1239
#define WM_APP
Definition: eventvwr.h:73
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
const GLubyte * c
Definition: glext.h:8905
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
const GLint * first
Definition: glext.h:5794
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
unsigned char wave[]
Definition: in.h:3
#define bytes_to_samples
Definition: intsym.h:226
char hdr[14]
Definition: iptest.cpp:33
#define d
Definition: ke_i.h:81
#define f
Definition: ke_i.h:83
#define b
Definition: ke_i.h:79
#define KSDATAFORMAT_SUBTYPE_PCM
Definition: ksmedia.h:1021
#define WAVE_FORMAT_EXTENSIBLE
Definition: ksmedia.h:651
#define SPEAKER_ALL
Definition: ksmedia.h:1445
#define KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
Definition: ksmedia.h:1026
#define error(str)
Definition: mkdosfs.c:1605
#define WAVE_FORMAT_YAMAHA_ADPCM
Definition: mmreg.h:110
#define WAVE_FORMAT_DSPGROUP_TRUESPEECH
Definition: mmreg.h:112
#define WAVE_FORMAT_MEDIASPACE_ADPCM
Definition: mmreg.h:104
#define WAVE_FORMAT_OLIGSM
Definition: mmreg.h:134
#define WAVE_FORMAT_IBM_CVSD
Definition: mmreg.h:98
#define WAVE_FORMAT_CREATIVE_FASTSPEECH10
Definition: mmreg.h:132
#define WAVE_FORMAT_IMA_ADPCM
Definition: mmreg.h:103
#define WAVE_FORMAT_OLISBC
Definition: mmreg.h:137
#define WAVE_FORMAT_ECHOSC1
Definition: mmreg.h:113
#define WAVE_FORMAT_G721_ADPCM
Definition: mmreg.h:125
#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM
Definition: mmreg.h:109
#define WAVE_FORMAT_OLIADPCM
Definition: mmreg.h:135
#define WAVE_FORMAT_CONTROL_RES_CR10
Definition: mmreg.h:123
#define WAVE_FORMAT_APTX
Definition: mmreg.h:115
#define WAVE_FORMAT_GSM610
Definition: mmreg.h:118
#define WAVE_FORMAT_FM_TOWNS_SND
Definition: mmreg.h:133
#define WAVE_FORMAT_AUDIOFILE_AF10
Definition: mmreg.h:116
#define WAVE_FORMAT_OLIOPR
Definition: mmreg.h:138
#define WAVE_FORMAT_MPEG
Definition: mmreg.h:126
#define WAVE_FORMAT_DEVELOPMENT
Definition: mmreg.h:160
struct _WAVEFORMATEX * LPWAVEFORMATEX
#define WAVE_FORMAT_DIGISTD
Definition: mmreg.h:107
#define WAVE_FORMAT_AUDIOFILE_AF36
Definition: mmreg.h:114
#define WAVE_FORMAT_SIERRA_ADPCM
Definition: mmreg.h:105
#define WAVE_FORMAT_DIGIFIX
Definition: mmreg.h:108
#define WAVE_FORMAT_MPEGLAYER3
Definition: mmreg.h:127
#define WAVE_FORMAT_DIGIADPCM
Definition: mmreg.h:122
#define WAVE_FORMAT_NMS_VBXADPCM
Definition: mmreg.h:124
#define WAVE_FORMAT_ANTEX_ADPCME
Definition: mmreg.h:119
#define WAVE_FORMAT_OLICELP
Definition: mmreg.h:136
#define WAVE_FORMAT_CREATIVE_ADPCM
Definition: mmreg.h:130
#define WAVE_FORMAT_SONARC
Definition: mmreg.h:111
#define WAVE_FORMAT_OKI_ADPCM
Definition: mmreg.h:101
#define WAVE_FORMAT_CREATIVE_FASTSPEECH8
Definition: mmreg.h:131
#define WAVE_FORMAT_DOLBY_AC2
Definition: mmreg.h:117
#define WAVE_FORMAT_G723_ADPCM
Definition: mmreg.h:106
#define WAVE_FORMAT_CONTROL_RES_VQLPC
Definition: mmreg.h:120
#define WAVE_FORMAT_DIGIREAL
Definition: mmreg.h:121
#define DRVM_MAPPER_PREFERRED_GET
Definition: mmsys.h:39
#define CALLBACK_WINDOW
Definition: mmsystem.h:148
#define WAVERR_STILLPLAYING
Definition: mmsystem.h:177
#define WOM_DONE
Definition: mmsystem.h:183
#define TIME_BYTES
Definition: mmsystem.h:30
#define sndAlias(c0, c1)
Definition: mmsystem.h:167
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
#define MMIO_ALLOCBUF
Definition: mmsystem.h:532
#define TIME_TICKS
Definition: mmsystem.h:33
#define MMIOERR_CHUNKNOTFOUND
Definition: mmsystem.h:517
UINT MMRESULT
Definition: mmsystem.h:962
#define MMIOERR_CANNOTEXPAND
Definition: mmsystem.h:516
#define CALLBACK_TYPEMASK
Definition: mmsystem.h:146
#define WOM_OPEN
Definition: mmsystem.h:181
#define MMIOERR_FILENOTFOUND
Definition: mmsystem.h:509
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
#define WAVE_FORMAT_QUERY
Definition: mmsystem.h:188
#define MIDIERR_INVALIDSETUP
Definition: mmsystem.h:236
#define CALLBACK_THREAD
Definition: mmsystem.h:151
#define MMIOERR_OUTOFMEMORY
Definition: mmsystem.h:510
#define WOM_CLOSE
Definition: mmsystem.h:182
#define WAVE_FORMAT_2M08
Definition: mmsystem.h:210
#define WAVE_FORMAT_2M16
Definition: mmsystem.h:212
#define MMIO_CREATE
Definition: mmsystem.h:528
#define WAVE_ALLOWSYNC
Definition: mmsystem.h:189
#define MIDIERR_NODEVICE
Definition: mmsystem.h:235
#define MMSYSERR_NODRIVER
Definition: mmsystem.h:102
#define JOYERR_NOCANDO
Definition: mmsystem.h:431
#define MMIOERR_CANNOTREAD
Definition: mmsystem.h:513
#define MIDIERR_UNPREPARED
Definition: mmsystem.h:231
#define WAVE_MAPPER
Definition: mmsystem.h:187
#define MIDIERR_NOTREADY
Definition: mmsystem.h:234
#define MMIOERR_CANNOTSEEK
Definition: mmsystem.h:515
#define WHDR_ENDLOOP
Definition: mmsystem.h:196
#define TIMERR_STRUCT
Definition: mmsystem.h:420
#define MIXERR_INVALVALUE
Definition: mmsystem.h:297
#define JOYERR_UNPLUGGED
Definition: mmsystem.h:432
#define WHDR_INQUEUE
Definition: mmsystem.h:197
#define CALLBACK_EVENT
Definition: mmsystem.h:152
#define WHDR_BEGINLOOP
Definition: mmsystem.h:195
#define WAVECAPS_SYNC
Definition: mmsystem.h:202
#define WAVECAPS_VOLUME
Definition: mmsystem.h:200
#define SND_FILENAME
Definition: mmsystem.h:162
#define MMSYSERR_INVALHANDLE
Definition: mmsystem.h:101
#define MMIO_WRITE
Definition: mmsystem.h:536
#define SND_SYNC
Definition: mmsystem.h:153
#define SND_ALIAS_ID
Definition: mmsystem.h:161
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define MMIOERR_CANNOTOPEN
Definition: mmsystem.h:511
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define WAVECAPS_LRVOLUME
Definition: mmsystem.h:201
#define WAVERR_BADFORMAT
Definition: mmsystem.h:176
#define TIME_SAMPLES
Definition: mmsystem.h:29
#define MMSYSERR_ALLOCATED
Definition: mmsystem.h:100
#define WAVECAPS_SAMPLEACCURATE
Definition: mmsystem.h:203
#define WAVE_MAPPED
Definition: mmsystem.h:190
#define SND_ALIAS
Definition: mmsystem.h:160
#define MIXERR_INVALLINE
Definition: mmsystem.h:295
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
#define MIDIERR_STILLPLAYING
Definition: mmsystem.h:232
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
#define WAVECAPS_PITCH
Definition: mmsystem.h:198
#define TIME_MIDI
Definition: mmsystem.h:32
#define WHDR_PREPARED
Definition: mmsystem.h:194
#define MMSYSERR_INVALFLAG
Definition: mmsystem.h:106
#define CALLBACK_FUNCTION
Definition: mmsystem.h:150
#define MMIO_CREATERIFF
Definition: mmsystem.h:554
#define WAVECAPS_PLAYBACKRATE
Definition: mmsystem.h:199
#define TIME_MS
Definition: mmsystem.h:28
#define MMIOERR_UNBUFFERED
Definition: mmsystem.h:518
#define SND_NODEFAULT
Definition: mmsystem.h:155
#define MMSYSERR_BADDEVICEID
Definition: mmsystem.h:98
#define WAVERR_UNPREPARED
Definition: mmsystem.h:178
#define MMIOERR_CANNOTCLOSE
Definition: mmsystem.h:512
#define JOYERR_PARMS
Definition: mmsystem.h:430
#define WHDR_DONE
Definition: mmsystem.h:193
#define MMIOERR_CANNOTWRITE
Definition: mmsystem.h:514
#define MIXERR_INVALCONTROL
Definition: mmsystem.h:296
#define WAVE_FORMAT_DIRECT
Definition: mmsystem.h:191
#define MMSYSERR_NOTENABLED
Definition: mmsystem.h:99
#define CALLBACK_NULL
Definition: mmsystem.h:147
#define TIMERR_NOCANDO
Definition: mmsystem.h:419
#define TIME_SMPTE
Definition: mmsystem.h:31
#define WAVERR_SYNC
Definition: mmsystem.h:179
#define SND_ALIAS_SYSTEMASTERISK
Definition: mmsystem.h:168
#define MMSYSERR_BADERRNUM
Definition: mmsystem.h:105
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static IPrintDialogCallback callback
Definition: printdlg.c:326
static const struct encodedExtensions exts[]
Definition: encode.c:2703
static HMODULE dll
Definition: str.c:188
static const unsigned int win_formats[][4]
Definition: render.c:47
#define todo_wine
Definition: custom.c:89
static IBackgroundCopyFile * test_file
Definition: file.c:39
static float(__cdecl *square_half_float)(float x
static DWORD thread_id
Definition: protocol.c:159
static void wave_out_test_deviceOut(int device, double duration, int headers, int loops, WAVEFORMATEX *pwfx, DWORD format, DWORD flags, WAVEOUTCAPSA *pcaps, BOOL interactive, BOOL sine, BOOL pause)
Definition: wave.c:605
static void wave_out_test_device(UINT_PTR device)
Definition: wave.c:880
static char * wave_generate_la(WAVEFORMATEX *wfx, double duration, DWORD *size)
Definition: wave.c:98
static void test_fragmentsize(void)
Definition: wave.c:1565
static const char * wave_out_caps(DWORD dwSupport)
Definition: wave.c:374
static void test_sndPlaySound(void)
Definition: wave.c:1533
static void test_multiple_waveopens(void)
Definition: wave.c:50
const char * get_format_str(WORD format)
Definition: wave.c:408
#define PI
Definition: wave.c:97
static DWORD WINAPI callback_thread(LPVOID lpParameter)
Definition: wave.c:581
static void create_wav_file(char *temp_file)
Definition: wave.c:1644
const char * dev_name(int device)
Definition: wave.c:211
static DWORD g_tid
Definition: wave.c:48
#define TIME_FORMAT(f)
#define ADD_FLAG(f)
const char * wave_time_format(UINT type)
Definition: wave.c:391
#define WHDR_MASK
static void wave_out_tests(void)
Definition: wave.c:1448
#define WAVE_FORMAT(f)
static char * wave_generate_silence(WAVEFORMATEX *wfx, double duration, DWORD *size)
Definition: wave.c:157
static const char * wave_header_flags(DWORD flags)
Definition: wave.c:335
static void check_position(int device, HWAVEOUT wout, DWORD bytes, LPWAVEFORMATEX pwfx)
Definition: wave.c:489
#define ERR_TO_STR(dev)
static void test_PlaySound(void)
Definition: wave.c:1696
const char * mmsys_error(MMRESULT error)
Definition: wave.c:220
static void CALLBACK callback_func(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD dwParam1, DWORD dwParam2)
Definition: wave.c:572
const char * wave_out_error(MMRESULT error)
Definition: wave.c:270
DWORD time_to_bytes(LPMMTIME mmtime, LPWAVEFORMATEX pwfx)
Definition: wave.c:471
const char * wave_open_flags(DWORD flags)
Definition: wave.c:284
DWORD bytes_to_ms(DWORD bytes, LPWAVEFORMATEX pwfx)
Definition: wave.c:466
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define PAGE_READWRITE
Definition: nt_native.h:1304
#define MEM_RESERVE
Definition: nt_native.h:1314
#define MEM_RELEASE
Definition: nt_native.h:1316
#define MEM_COMMIT
Definition: nt_native.h:1313
#define PAGE_NOACCESS
Definition: nt_native.h:1302
int nChannels
Definition: pcmconverter.c:95
long LONG
Definition: pedump.c:60
BOOL WINAPI sndPlaySoundW(LPCWSTR pszSound, UINT uFlags)
Definition: playsound.c:726
BOOL WINAPI sndPlaySoundA(LPCSTR pszSoundA, UINT uFlags)
Definition: playsound.c:717
BOOL WINAPI PlaySoundA(LPCSTR pszSoundA, HMODULE hmod, DWORD fdwSound)
Definition: playsound.c:701
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define interactive
Definition: rosglue.h:34
static calc_node_t temp
Definition: rpn_ieee.c:38
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
int winetest_debug
int winetest_interactive
#define memset(x, y, z)
Definition: compat.h:39
vector< Header * > headers
Definition: sdkparse.cpp:39
WAVEFORMATEX Format
Definition: ksmedia.h:638
WORD wValidBitsPerSample
Definition: ksmedia.h:641
union WAVEFORMATEXTENSIBLE::@3024 Samples
DWORD nAvgBytesPerSec
Definition: audioclient.idl:43
WORD wBitsPerSample
Definition: audioclient.idl:45
DWORD nSamplesPerSec
Definition: audioclient.idl:42
DWORD cksize
Definition: mmsystem.h:1508
FOURCC fccType
Definition: mmsystem.h:1509
DWORD dwPageSize
Definition: winbase.h:1198
WORD nBlockAlign
Definition: mmreg.h:82
WORD cbSize
Definition: mmreg.h:84
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nChannels
Definition: mmreg.h:79
WORD wFormatTag
Definition: mmreg.h:78
WORD wBitsPerSample
Definition: mmreg.h:83
Definition: devices.h:37
Definition: dsound.c:943
Definition: format.c:58
WAVEFORMATEX wfx
Definition: mmreg.h:187
Definition: tftpd.h:60
struct mmtime_tag::@3037::@3038 smpte
union mmtime_tag::@3037 u
DWORD ms
Definition: mmsystem.h:967
DWORD cb
Definition: mmsystem.h:969
DWORD sample
Definition: mmsystem.h:968
UINT wType
Definition: mmsystem.h:965
Definition: name.c:39
Definition: ps.c:97
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1028
MMVERSION vDriverVersion
Definition: mmsystem.h:1027
Definition: fci.c:110
DWORD dwBufferLength
Definition: mmsystem.h:1015
DWORD dwLoops
Definition: mmsystem.h:1019
DWORD dwFlags
Definition: mmsystem.h:1018
LPSTR lpData
Definition: mmsystem.h:1014
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define DWORD_PTR
Definition: treelist.c:76
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t DWORD_PTR
Definition: typedefs.h:65
int ret
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:65
BOOL NTAPI VirtualProtect(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flNewProtect, OUT PDWORD lpflOldProtect)
Definition: virtmem.c:135
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:119
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define WAIT_OBJECT_0
Definition: winbase.h:432
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define WINAPI
Definition: msvc.h:6
UINT WINAPI waveOutGetDevCapsA(UINT_PTR uDeviceID, LPWAVEOUTCAPSA lpCaps, UINT uSize)
Definition: winmm.c:2145
UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
Definition: winmm.c:2385
UINT WINAPI waveOutGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
Definition: winmm.c:2198
UINT WINAPI waveOutSetVolume(HWAVEOUT hWaveOut, DWORD dw)
Definition: winmm.c:2505
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2137
UINT WINAPI waveOutGetPosition(HWAVEOUT hWaveOut, LPMMTIME lpTime, UINT uSize)
Definition: winmm.c:2413
UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, LPWAVEHDR lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2341
UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut, LPWAVEHDR lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2307
MMRESULT WINAPI waveOutOpen(LPHWAVEOUT lphWaveOut, UINT uDeviceID, LPCWAVEFORMATEX lpFormat, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:2246
UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut)
Definition: winmm.c:2399
UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps, UINT uSize)
Definition: winmm.c:2173
UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut, WAVEHDR *lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2277
UINT WINAPI waveOutPause(HWAVEOUT hWaveOut)
Definition: winmm.c:2371
UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
Definition: winmm.c:2538
UINT WINAPI waveOutGetVolume(HWAVEOUT hWaveOut, LPDWORD lpdw)
Definition: winmm.c:2485
UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
Definition: winmm.c:2257
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1898
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define PM_NOREMOVE
Definition: winuser.h:1198
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193