4 * Copyright 2006 Jan Zerebecki
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/test.h"
28 /* The tests use the MCI's own save capability to create the tempfile.wav to play.
29 * To use a pre-existing file, write-protect it. */
30 static MCIERROR ok_saved
= MCIERR_FILE_NOT_FOUND
;
33 MCI_STATUS_PARMS status
;
34 MCI_WAVE_SET_PARMS set
;
35 MCI_WAVE_OPEN_PARMS open
;
39 static const char* dbg_mcierr(MCIERROR err
)
42 case 0: return "0=NOERROR";
43 #define X(label) case label: return #label ;
44 X(MCIERR_INVALID_DEVICE_ID
)
45 X(MCIERR_UNRECOGNIZED_KEYWORD
)
46 X(MCIERR_UNRECOGNIZED_COMMAND
)
48 X(MCIERR_INVALID_DEVICE_NAME
)
49 X(MCIERR_OUT_OF_MEMORY
)
51 X(MCIERR_CANNOT_LOAD_DRIVER
)
52 X(MCIERR_MISSING_COMMAND_STRING
)
53 X(MCIERR_PARAM_OVERFLOW
)
54 X(MCIERR_MISSING_STRING_ARGUMENT
)
56 X(MCIERR_PARSER_INTERNAL
)
57 X(MCIERR_DRIVER_INTERNAL
)
58 X(MCIERR_MISSING_PARAMETER
)
59 X(MCIERR_UNSUPPORTED_FUNCTION
)
60 X(MCIERR_FILE_NOT_FOUND
)
61 X(MCIERR_DEVICE_NOT_READY
)
64 X(MCIERR_CANNOT_USE_ALL
)
66 X(MCIERR_EXTENSION_NOT_FOUND
)
68 X(MCIERR_FLAGS_NOT_COMPATIBLE
)
69 X(MCIERR_FILE_NOT_SAVED
)
70 X(MCIERR_DEVICE_TYPE_REQUIRED
)
71 X(MCIERR_DEVICE_LOCKED
)
72 X(MCIERR_DUPLICATE_ALIAS
)
73 X(MCIERR_BAD_CONSTANT
)
74 X(MCIERR_MUST_USE_SHAREABLE
)
75 X(MCIERR_MISSING_DEVICE_NAME
)
76 X(MCIERR_BAD_TIME_FORMAT
)
77 X(MCIERR_NO_CLOSING_QUOTE
)
78 X(MCIERR_DUPLICATE_FLAGS
)
79 X(MCIERR_INVALID_FILE
)
80 X(MCIERR_NULL_PARAMETER_BLOCK
)
81 X(MCIERR_UNNAMED_RESOURCE
)
82 X(MCIERR_NEW_REQUIRES_ALIAS
)
83 X(MCIERR_NOTIFY_ON_AUTO_OPEN
)
84 X(MCIERR_NO_ELEMENT_ALLOWED
)
85 X(MCIERR_NONAPPLICABLE_FUNCTION
)
86 X(MCIERR_ILLEGAL_FOR_AUTO_OPEN
)
87 X(MCIERR_FILENAME_REQUIRED
)
88 X(MCIERR_EXTRA_CHARACTERS
)
89 X(MCIERR_DEVICE_NOT_INSTALLED
)
93 X(MCIERR_DEVICE_LENGTH
)
94 X(MCIERR_DEVICE_ORD_LENGTH
)
96 X(MCIERR_WAVE_OUTPUTSINUSE
)
97 X(MCIERR_WAVE_SETOUTPUTINUSE
)
98 X(MCIERR_WAVE_INPUTSINUSE
)
99 X(MCIERR_WAVE_SETINPUTINUSE
)
100 X(MCIERR_WAVE_OUTPUTUNSPECIFIED
)
101 X(MCIERR_WAVE_INPUTUNSPECIFIED
)
102 X(MCIERR_WAVE_OUTPUTSUNSUITABLE
)
103 X(MCIERR_WAVE_SETOUTPUTUNSUITABLE
)
104 X(MCIERR_WAVE_INPUTSUNSUITABLE
)
105 X(MCIERR_WAVE_SETINPUTUNSUITABLE
)
106 X(MCIERR_SEQ_DIV_INCOMPATIBLE
)
107 X(MCIERR_SEQ_PORT_INUSE
)
108 X(MCIERR_SEQ_PORT_NONEXISTENT
)
109 X(MCIERR_SEQ_PORT_MAPNODEVICE
)
110 X(MCIERR_SEQ_PORT_MISCERROR
)
112 X(MCIERR_SEQ_PORTUNSPECIFIED
)
113 X(MCIERR_SEQ_NOMIDIPRESENT
)
115 X(MCIERR_CREATEWINDOW
)
118 X(MCIERR_NO_IDENTITY
)
121 static char name
[20]; /* Not to be called twice in a parameter list! */
122 sprintf(name
, "MMSYSERR %u", err
);
128 static BOOL
spurious_message(LPMSG msg
)
130 /* WM_DEVICECHANGE 0x0219 appears randomly */
131 if(msg
->message
!= MM_MCINOTIFY
) {
132 trace("skipping spurious message %04x\n",msg
->message
);
138 /* A single ok() in each code path allows to prefix this with todo_wine */
139 #define test_notification(hwnd, command, type) test_notification_dbg(hwnd, command, type, __LINE__)
140 static void test_notification_dbg(HWND hwnd
, const char* command
, WPARAM type
, int line
)
141 { /* Use type 0 as meaning no message */
144 do { seen
= PeekMessageA(&msg
, hwnd
, 0, 0, PM_REMOVE
); }
145 while(seen
&& spurious_message(&msg
));
147 /* We observe transient delayed notification, mostly on native.
148 * Notification is not always present right when mciSend returns. */
149 trace_(__FILE__
,line
)("Waiting for delayed notification from %s\n", command
);
150 MsgWaitForMultipleObjects(0, NULL
, FALSE
, 3000, QS_POSTMESSAGE
);
151 seen
= PeekMessageA(&msg
, hwnd
, MM_MCINOTIFY
, MM_MCINOTIFY
, PM_REMOVE
);
154 ok_(__FILE__
,line
)(type
==0, "Expect message %04lx from %s\n", type
, command
);
155 else if(msg
.hwnd
!= hwnd
)
156 ok_(__FILE__
,line
)(msg
.hwnd
== hwnd
, "Didn't get the handle to our test window\n");
157 else if(msg
.message
!= MM_MCINOTIFY
)
158 ok_(__FILE__
,line
)(msg
.message
== MM_MCINOTIFY
, "got %04x instead of MM_MCINOTIFY from command %s\n", msg
.message
, command
);
159 else ok_(__FILE__
,line
)(msg
.wParam
== type
, "got %04lx instead of MCI_NOTIFY_xyz %04lx from command %s\n", msg
.wParam
, type
, command
);
162 static void test_openCloseWAVE(HWND hwnd
)
165 MCI_GENERIC_PARMS parm
;
166 const char command_open
[] = "open new type waveaudio alias mysound notify";
167 const char command_close_my
[] = "close mysound notify";
168 const char command_close_all
[] = "close all notify";
169 const char command_sysinfo
[] = "sysinfo waveaudio quantity open";
171 memset(buf
, 0, sizeof(buf
));
172 test_notification(hwnd
, "-prior to any command-", 0);
174 err
= mciSendString("sysinfo all quantity", buf
, sizeof(buf
), hwnd
);
175 todo_wine
ok(!err
,"mci %s returned %s\n", command_open
, dbg_mcierr(err
));
176 if(!err
) trace("[MCI] with %s drivers\n", buf
);
178 err
= mciSendString("open new type waveaudio alias r shareable", buf
, sizeof(buf
), NULL
);
179 ok(err
==MCIERR_UNSUPPORTED_FUNCTION
,"mci open new shareable returned %s\n", dbg_mcierr(err
));
181 err
= mciSendString("close r", NULL
, 0, NULL
);
182 ok(!err
,"mci close shareable returned %s\n", dbg_mcierr(err
));
185 err
= mciSendString(command_open
, buf
, sizeof(buf
), hwnd
);
186 ok(!err
,"mci %s returned %s\n", command_open
, dbg_mcierr(err
));
187 ok(!strcmp(buf
,"1"), "mci open deviceId: %s, expected 1\n", buf
);
188 /* Wine<=1.1.33 used to ignore anything past alias XY */
189 test_notification(hwnd
,"open new alias notify",MCI_NOTIFY_SUCCESSFUL
);
191 err
= mciSendString("status mysound time format", buf
, sizeof(buf
), hwnd
);
192 ok(!err
,"mci status time format returned %s\n", dbg_mcierr(err
));
194 if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) == LANG_ENGLISH
)
195 ok(!strcmp(buf
,"milliseconds"), "mci status time format: %s\n", buf
);
196 else trace("locale-dependent time format: %s (ms)\n", buf
);
199 err
= mciSendString(command_close_my
, NULL
, 0, hwnd
);
200 ok(!err
,"mci %s returned %s\n", command_close_my
, dbg_mcierr(err
));
201 test_notification(hwnd
, command_close_my
, MCI_NOTIFY_SUCCESSFUL
);
203 test_notification(hwnd
, command_close_my
, 0);
205 err
= mciSendString("open no-such-file-exists.wav alias y", buf
, sizeof(buf
), NULL
);
206 ok(err
==MCIERR_FILE_NOT_FOUND
,"open no-such-file.wav returned %s\n", dbg_mcierr(err
));
208 err
= mciSendString("close y", NULL
, 0, NULL
);
209 ok(!err
,"close y returned %s\n", dbg_mcierr(err
));
212 err
= mciSendString("open no-such-dir\\file.wav alias y type waveaudio", buf
, sizeof(buf
), NULL
);
213 ok(err
==MCIERR_FILE_NOT_FOUND
|| broken(err
==MCIERR_INVALID_FILE
/* Win9X */),"open no-such-dir/file.wav returned %s\n", dbg_mcierr(err
));
215 err
= mciSendString("close y", NULL
, 0, NULL
);
216 ok(!err
,"close y returned %s\n", dbg_mcierr(err
));
219 err
= mciSendString(command_close_all
, NULL
, 0, NULL
);
220 ok(!err
,"mci %s (without buffer) returned %s\n", command_close_all
, dbg_mcierr(err
));
222 memset(buf
, 0, sizeof(buf
));
223 err
= mciSendString(command_close_all
, buf
, sizeof(buf
), hwnd
);
224 ok(!err
,"mci %s (with output buffer) returned %s\n", command_close_all
, dbg_mcierr(err
));
225 ok(buf
[0] == 0, "mci %s changed output buffer: %s\n", command_close_all
, buf
);
226 /* No notification left, everything closed already */
227 test_notification(hwnd
, command_close_all
, 0);
228 /* TODO test close all sends one notification per open device */
230 memset(buf
, 0, sizeof(buf
));
231 err
= mciSendString(command_sysinfo
, buf
, sizeof(buf
), NULL
);
232 ok(!err
,"mci %s returned %s\n", command_sysinfo
, dbg_mcierr(err
));
233 todo_wine
ok(buf
[0] == '0' && buf
[1] == 0, "mci %s, expected output buffer '0', got: '%s'\n", command_sysinfo
, buf
);
235 err
= mciSendString("open new type waveaudio", buf
, sizeof(buf
), NULL
);
236 ok(err
==MCIERR_NEW_REQUIRES_ALIAS
,"mci open new without alias returned %s\n", dbg_mcierr(err
));
238 err
= mciSendCommand(MCI_ALL_DEVICE_ID
, MCI_CLOSE
, MCI_WAIT
, 0); /* from MSDN */
239 ok(!err
,"mciSendCommand(MCI_ALL_DEVICE_ID, MCI_CLOSE, MCI_NOTIFY, 0) returned %s\n", dbg_mcierr(err
));
241 err
= mciSendCommand(MCI_ALL_DEVICE_ID
, MCI_CLOSE
, MCI_NOTIFY
, 0);
242 ok(!err
,"mciSendCommand(MCI_ALL_DEVICE_ID, MCI_CLOSE, MCI_NOTIFY, 0) returned %s\n", dbg_mcierr(err
));
244 parm
.dwCallback
= (DWORD_PTR
)hwnd
;
245 err
= mciSendCommand(MCI_ALL_DEVICE_ID
, MCI_CLOSE
, MCI_NOTIFY
, (DWORD_PTR
)&parm
);
246 ok(!err
,"mciSendCommand(MCI_ALL_DEVICE_ID, MCI_CLOSE, MCI_NOTIFY, hwnd) returned %s\n", dbg_mcierr(err
));
247 test_notification(hwnd
, command_close_all
, 0); /* None left */
250 static void test_recordWAVE(HWND hwnd
)
254 DWORD nsamp
= 16000, expect
;
255 UINT ndevs
= waveInGetNumDevs();
256 MCIERROR err
, ok_pcm
;
257 MCIDEVICEID wDeviceID
;
258 MCI_PARMS_UNION parm
;
260 memset(buf
, 0, sizeof(buf
));
261 test_notification(hwnd
, "-prior to recording-", 0);
263 parm
.open
.lpstrDeviceType
= "waveaudio";
264 parm
.open
.lpstrElementName
= ""; /* "new" at the command level */
265 parm
.open
.lpstrAlias
= "x"; /* to enable mciSendString */
266 parm
.open
.dwCallback
= (DWORD_PTR
)hwnd
;
267 err
= mciSendCommand(0, MCI_OPEN
,
268 MCI_OPEN_ELEMENT
| MCI_OPEN_TYPE
| MCI_OPEN_ALIAS
| MCI_NOTIFY
,
270 ok(!err
,"mciCommand open new type waveaudio alias x notify: %s\n", dbg_mcierr(err
));
271 wDeviceID
= parm
.open
.wDeviceID
;
273 /* In Wine, both MCI_Open and the individual drivers send notifications. */
274 test_notification(hwnd
, "open new", MCI_NOTIFY_SUCCESSFUL
);
275 todo_wine
test_notification(hwnd
, "open new no #2", 0);
277 /* Do not query time format as string because result depends on locale! */
278 parm
.status
.dwItem
= MCI_STATUS_TIME_FORMAT
;
279 err
= mciSendCommand(wDeviceID
, MCI_STATUS
, MCI_STATUS_ITEM
, (DWORD_PTR
)&parm
);
280 ok(!err
,"mciCommand status time format: %s\n", dbg_mcierr(err
));
281 ok(parm
.status
.dwReturn
==MCI_FORMAT_MILLISECONDS
,"status time format: %ld\n",parm
.status
.dwReturn
);
283 /* Info file fails until named in Open or Save. */
284 err
= mciSendString("info x file", buf
, sizeof(buf
), NULL
);
285 todo_wine
ok(err
==MCIERR_NONAPPLICABLE_FUNCTION
,"mci info new file returned %s\n", dbg_mcierr(err
));
287 /* Check the default recording: 8-bits per sample, mono, 11kHz */
288 err
= mciSendString("status x samplespersec", buf
, sizeof(buf
), NULL
);
289 ok(!err
,"mci status samplespersec returned %s\n", dbg_mcierr(err
));
290 if(!err
) ok(!strcmp(buf
,"11025"), "mci status samplespersec expected 11025, got: %s\n", buf
);
292 /* MCI seems to solely support PCM, no need for ACM conversion. */
293 err
= mciSendString("set x format tag 2", NULL
, 0, NULL
);
294 ok(err
==MCIERR_OUTOFRANGE
,"mci set format tag 2 returned %s\n", dbg_mcierr(err
));
296 /* MCI appears to scan the available devices for support of this format,
297 * returning MCIERR_OUTOFRANGE on machines with no sound.
298 * However some w2k8/w7 machines return no error when there's no wave
299 * input device (perhaps querying waveOutGetNumDevs instead of waveIn?),
300 * still the record command below fails with MCIERR_WAVE_INPUTSUNSUITABLE.
301 * Don't skip here, record will fail below. */
302 err
= mciSendString("set x format tag pcm", NULL
, 0, NULL
);
303 ok(!err
|| err
==MCIERR_OUTOFRANGE
,"mci set format tag pcm returned %s\n", dbg_mcierr(err
));
306 /* MSDN warns against not setting all wave format parameters.
307 * Indeed, it produces strange results, incl.
308 * inconsistent PCMWAVEFORMAT headers in the saved file.
310 err
= mciSendString("set x bytespersec 22050 alignment 2 samplespersec 11025 channels 1 bitspersample 16", NULL
, 0, NULL
);
311 ok(err
==ok_pcm
,"mci set 5 wave parameters returned %s\n", dbg_mcierr(err
));
312 /* Investigate: on w2k, set samplespersec 22050 sets nChannels to 2!
313 * err = mciSendString("set x samplespersec 22050", NULL, 0, NULL);
314 * ok(!err,"mci set samplespersec returned %s\n", dbg_mcierr(err));
317 /* Checks are generally performed immediately. */
318 err
= mciSendString("set x bitspersample 4", NULL
, 0, NULL
);
319 todo_wine
ok(err
==MCIERR_OUTOFRANGE
,"mci set bitspersample 4 returned %s\n", dbg_mcierr(err
));
321 parm
.set
.wFormatTag
= WAVE_FORMAT_PCM
;
322 parm
.set
.nSamplesPerSec
= nsamp
;
323 parm
.set
.wBitsPerSample
= nbits
;
324 parm
.set
.nChannels
= nch
;
325 parm
.set
.nBlockAlign
= parm
.set
.nChannels
* parm
.set
.wBitsPerSample
/8;
326 parm
.set
.nAvgBytesPerSec
= parm
.set
.nSamplesPerSec
* parm
.set
.nBlockAlign
;
327 err
= mciSendCommand(wDeviceID
, MCI_SET
,
328 MCI_WAVE_SET_SAMPLESPERSEC
| MCI_WAVE_SET_CHANNELS
|
329 MCI_WAVE_SET_BITSPERSAMPLE
| MCI_WAVE_SET_BLOCKALIGN
|
330 MCI_WAVE_SET_AVGBYTESPERSEC
| MCI_WAVE_SET_FORMATTAG
, (DWORD_PTR
)&parm
);
331 ok(err
==ok_pcm
,"mciCommand set wave format: %s\n", dbg_mcierr(err
));
333 /* A few ME machines pass all tests except set format tag pcm! */
334 err
= mciSendString("record x to 2000 wait", NULL
, 0, hwnd
);
335 ok(err
|| !ok_pcm
,"can record yet set wave format pcm returned %s\n", dbg_mcierr(ok_pcm
));
336 if(!ndevs
) todo_wine
/* with sound disabled */
337 ok(ndevs
>0 ? !err
: err
==MCIERR_WAVE_INPUTSUNSUITABLE
,"mci record to 2000 returned %s\n", dbg_mcierr(err
));
339 ok(ndevs
>0 ? !err
: err
==MCIERR_WAVE_INPUTSUNSUITABLE
,"mci record to 2000 returned %s\n", dbg_mcierr(err
));
341 if (err
==MCIERR_WAVE_INPUTSUNSUITABLE
)
342 skip("Please install audio driver. Everything is skipped.\n");
343 else skip("Cannot record cause %s. Everything is skipped.\n", dbg_mcierr(err
));
345 err
= mciSendString("close x", NULL
, 0, NULL
);
346 ok(!err
,"mci close returned %s\n", dbg_mcierr(err
));
347 test_notification(hwnd
,"record skipped",0);
351 /* Query some wave format parameters depending on the time format. */
352 err
= mciSendString("status x position", buf
, sizeof(buf
), NULL
);
353 ok(!err
,"mci status position returned %s\n", dbg_mcierr(err
));
354 if(!err
) todo_wine
ok(!strcmp(buf
,"2000"), "mci status position gave %s, expected 2000, some tests will fail\n", buf
);
356 err
= mciSendString("set x time format 8", NULL
, 0, NULL
); /* bytes */
357 ok(!err
,"mci returned %s\n", dbg_mcierr(err
));
359 parm
.status
.dwItem
= MCI_STATUS_POSITION
;
360 err
= mciSendCommand(wDeviceID
, MCI_STATUS
, MCI_STATUS_ITEM
, (DWORD_PTR
)&parm
);
361 ok(!err
,"mciCommand status position: %s\n", dbg_mcierr(err
));
362 expect
= 2 * nsamp
* nch
* nbits
/8;
363 if(!err
) todo_wine
ok(parm
.status
.dwReturn
==expect
,"recorded %lu bytes, expected %u\n",parm
.status
.dwReturn
,expect
);
365 parm
.set
.dwTimeFormat
= MCI_FORMAT_SAMPLES
;
366 err
= mciSendCommand(wDeviceID
, MCI_SET
, MCI_SET_TIME_FORMAT
, (DWORD_PTR
)&parm
);
367 ok(!err
,"mciCommand set time format samples: %s\n", dbg_mcierr(err
));
369 parm
.status
.dwItem
= MCI_STATUS_POSITION
;
370 err
= mciSendCommand(wDeviceID
, MCI_STATUS
, MCI_STATUS_ITEM
, (DWORD_PTR
)&parm
);
371 ok(!err
,"mciCommand status position: %s\n", dbg_mcierr(err
));
373 if(!err
) todo_wine
ok(parm
.status
.dwReturn
==expect
,"recorded %lu samples, expected %u\n",parm
.status
.dwReturn
,expect
);
375 err
= mciSendString("set x time format milliseconds", NULL
, 0, NULL
);
376 ok(!err
,"mci set time format milliseconds returned %s\n", dbg_mcierr(err
));
378 err
= mciSendString("save x tempfile1.wav", NULL
, 0, NULL
);
379 ok(!err
,"mci save returned %s\n", dbg_mcierr(err
));
381 err
= mciSendString("save x tempfile.wav", NULL
, 0, NULL
);
382 ok(!err
,"mci save returned %s\n", dbg_mcierr(err
));
383 if(!err
) ok_saved
= 0;
385 /* Save must not rename the original file. */
386 if (!DeleteFile("tempfile1.wav"))
387 todo_wine
ok(FALSE
, "Save must not rename the original file; DeleteFile returned %d\n", GetLastError());
389 err
= mciSendString("set x channels 2", NULL
, 0, NULL
);
390 ok(err
==MCIERR_NONAPPLICABLE_FUNCTION
,"mci set channels after saving returned %s\n", dbg_mcierr(err
));
392 parm
.seek
.dwTo
= 600;
393 err
= mciSendCommand(wDeviceID
, MCI_SEEK
, MCI_TO
| MCI_WAIT
, (DWORD_PTR
)&parm
);
394 ok(!err
,"mciCommand seek to 600: %s\n", dbg_mcierr(err
));
396 /* Truncate to current position */
397 err
= mciSendString("delete x", NULL
, 0, NULL
);
398 todo_wine
ok(!err
,"mci delete returned %s\n", dbg_mcierr(err
));
401 err
= mciSendString("status x length", buf
, sizeof(buf
), NULL
);
402 ok(!err
,"mci status length returned %s\n", dbg_mcierr(err
));
403 todo_wine
ok(!strcmp(buf
,"600"), "mci status length after delete gave %s, expected 600\n", buf
);
405 err
= mciSendString("close x", NULL
, 0, NULL
);
406 ok(!err
,"mci close returned %s\n", dbg_mcierr(err
));
407 test_notification(hwnd
,"record complete",0);
410 static void test_playWAVE(HWND hwnd
)
414 memset(buf
, 0, sizeof(buf
));
416 err
= mciSendString("open waveaudio!tempfile.wav alias mysound", NULL
, 0, NULL
);
417 ok(err
==ok_saved
,"mci open waveaudio!tempfile.wav returned %s\n", dbg_mcierr(err
));
419 skip("Cannot open waveaudio!tempfile.wav for playing (%s), skipping\n", dbg_mcierr(err
));
423 err
= mciSendString("status mysound length", buf
, sizeof(buf
), NULL
);
424 ok(!err
,"mci status length returned %s\n", dbg_mcierr(err
));
425 todo_wine
ok(!strcmp(buf
,"2000"), "mci status length gave %s, expected 2000, some tests will fail.\n", buf
);
427 err
= mciSendString("cue output", NULL
, 0, NULL
);
428 todo_wine
ok(err
==MCIERR_UNRECOGNIZED_COMMAND
,"mci incorrect cue output returned %s\n", dbg_mcierr(err
));
430 /* Test MCI to the bones -- Some todo_wine from Cue and
431 * from Play from 0 to 0 are not worth fixing. */
432 err
= mciSendString("cue mysound output notify", NULL
, 0, hwnd
);
433 ok(!err
,"mci cue output after open file returned %s\n", dbg_mcierr(err
));
434 /* Notification is delayed as a play thread is started. */
435 todo_wine
test_notification(hwnd
, "cue immediate", 0);
437 /* Cue pretends to put the MCI into paused state. */
438 err
= mciSendString("status mysound mode", buf
, sizeof(buf
), hwnd
);
439 ok(!err
,"mci status mode returned %s\n", dbg_mcierr(err
));
440 todo_wine
ok(!strcmp(buf
,"paused"), "mci status mode: %s, expected (pseudo)paused\n", buf
);
442 /* Strange pause where Pause is rejected, unlike Play; Pause; Pause tested below */
443 err
= mciSendString("pause mysound", NULL
, 0, hwnd
);
444 ok(err
==MCIERR_NONAPPLICABLE_FUNCTION
,"mci pause after cue returned %s\n", dbg_mcierr(err
));
446 /* MCI appears to start the play thread in this border case.
447 * Guessed that from (flaky) status mode and late notification arrival. */
448 err
= mciSendString("play mysound from 0 to 0 notify", NULL
, 0, hwnd
);
449 ok(!err
,"mci play from 0 to 0 returned %s\n", dbg_mcierr(err
));
450 todo_wine
test_notification(hwnd
, "cue aborted by play", MCI_NOTIFY_ABORTED
);
451 /* play's own notification follows below */
453 err
= mciSendString("play mysound from 250 to 0", NULL
, 0, NULL
);
454 ok(err
==MCIERR_OUTOFRANGE
,"mci play from 250 to 0 returned %s\n", dbg_mcierr(err
));
456 Sleep(50); /* Give play from 0 to 0 time to finish. */
457 todo_wine
test_notification(hwnd
, "play from 0 to 0", MCI_NOTIFY_SUCCESSFUL
);
459 err
= mciSendString("status mysound mode", buf
, sizeof(buf
), hwnd
);
460 ok(!err
,"mci status mode returned %s\n", dbg_mcierr(err
));
461 ok(!strcmp(buf
,"stopped"), "mci status mode: %s after play from 0 to 0\n", buf
);
463 err
= mciSendString("play MYSOUND from 250 to 0 notify", NULL
, 0, hwnd
);
464 ok(err
==MCIERR_OUTOFRANGE
,"mci play from 250 to 0 notify returned %s\n", dbg_mcierr(err
));
465 /* No notification (checked below) sent if error */
467 /* A second play caused Wine<1.1.33 to hang */
468 err
= mciSendString("play mysound from 500 to 1500 wait", NULL
, 0, NULL
);
469 ok(!err
,"mci play from 500 to 1500 returned %s\n", dbg_mcierr(err
));
471 memset(buf
, 0, sizeof(buf
));
472 err
= mciSendString("status mysound position", buf
, sizeof(buf
), hwnd
);
473 ok(!err
,"mci status position returned %s\n", dbg_mcierr(err
));
474 if(!err
) ok(!strcmp(buf
,"1500"), "mci status position: %s\n", buf
);
476 /* mci will not play position < current */
477 err
= mciSendString("play mysound to 1000", NULL
, 0, NULL
);
478 ok(err
==MCIERR_OUTOFRANGE
,"mci play to 1000 returned %s\n", dbg_mcierr(err
));
480 /* mci will not play to > end */
481 err
= mciSendString("play mysound TO 3000 notify", NULL
, 0, hwnd
);
482 ok(err
==MCIERR_OUTOFRANGE
,"mci play to 3000 notify returned %s\n", dbg_mcierr(err
));
484 err
= mciSendString("play mysound to 2000", NULL
, 0, NULL
);
485 ok(!err
,"mci play to 2000 returned %s\n", dbg_mcierr(err
));
487 /* Rejected while playing */
488 err
= mciSendString("cue mysound output", NULL
, 0, NULL
);
489 ok(err
==MCIERR_NONAPPLICABLE_FUNCTION
,"mci cue output while playing returned %s\n", dbg_mcierr(err
));
491 err
= mciSendString("play mysound to 3000", NULL
, 0, NULL
);
492 ok(err
==MCIERR_OUTOFRANGE
,"mci play to 3000 returned %s\n", dbg_mcierr(err
));
494 err
= mciSendString("stop mysound Wait", NULL
, 0, NULL
);
495 ok(!err
,"mci stop wait returned %s\n", dbg_mcierr(err
));
496 test_notification(hwnd
, "play/cue/pause/stop", 0);
498 err
= mciSendString("Seek Mysound to 250 wait Notify", NULL
, 0, hwnd
);
499 ok(!err
,"mci seek to 250 wait notify returned %s\n", dbg_mcierr(err
));
500 test_notification(hwnd
,"seek wait notify",MCI_NOTIFY_SUCCESSFUL
);
502 memset(buf
, 0, sizeof(buf
));
503 err
= mciSendString("status mysound position notify", buf
, sizeof(buf
), hwnd
);
504 ok(!err
,"mci status position notify returned %s\n", dbg_mcierr(err
));
505 if(!err
) ok(!strcmp(buf
,"250"), "mci status position: %s\n", buf
);
506 /* Immediate commands like status also send notifications. */
507 test_notification(hwnd
,"status position",MCI_NOTIFY_SUCCESSFUL
);
509 memset(buf
, 0, sizeof(buf
));
510 err
= mciSendString("status mysound mode", buf
, sizeof(buf
), hwnd
);
511 ok(!err
,"mci status mode returned %s\n", dbg_mcierr(err
));
512 ok(!strcmp(buf
,"stopped"), "mci status mode: %s\n", buf
);
514 /* Another play from == to testcase */
515 err
= mciSendString("play mysound to 250 wait notify", NULL
, 0, hwnd
);
516 ok(!err
,"mci play (from 250) to 250 returned %s\n", dbg_mcierr(err
));
517 todo_wine
test_notification(hwnd
,"play to 250 wait notify",MCI_NOTIFY_SUCCESSFUL
);
519 err
= mciSendString("cue mysound output", NULL
, 0, NULL
);
520 ok(!err
,"mci cue output after play returned %s\n", dbg_mcierr(err
));
522 err
= mciSendString("close mysound", NULL
, 0, NULL
);
523 ok(!err
,"mci close returned %s\n", dbg_mcierr(err
));
524 test_notification(hwnd
,"after close",0);
527 static void test_asyncWAVE(HWND hwnd
)
529 MCIDEVICEID wDeviceID
;
530 MCI_PARMS_UNION parm
;
533 memset(buf
, 0, sizeof(buf
));
535 err
= mciSendString("open tempfile.wav alias mysound notify", buf
, sizeof(buf
), hwnd
);
536 ok(err
==ok_saved
,"mci open tempfile.wav returned %s\n", dbg_mcierr(err
));
538 skip("Cannot open tempfile.wav for playing (%s), skipping\n", dbg_mcierr(err
));
541 ok(!strcmp(buf
,"1"), "mci open deviceId: %s, expected 1\n", buf
);
542 wDeviceID
= atoi(buf
);
543 ok(wDeviceID
,"mci open DeviceID: %d\n", wDeviceID
);
544 test_notification(hwnd
,"open alias notify",MCI_NOTIFY_SUCCESSFUL
);
546 err
= mciSendString("status mysound mode", buf
, sizeof(buf
), hwnd
);
547 ok(!err
,"mci status mode returned %s\n", dbg_mcierr(err
));
548 ok(!strcmp(buf
,"stopped"), "mci status mode: %s\n", buf
);
550 err
= mciSendString("play mysound notify", NULL
, 0, hwnd
);
551 ok(!err
,"mci play returned %s\n", dbg_mcierr(err
));
553 /* Give Wine's asynchronous thread time to start up. Furthermore,
554 * it uses 3 buffers per second, so that the positions reported
555 * will be 333ms, 667ms etc. at best. */
556 Sleep(100); /* milliseconds */
558 /* Do not query time format as string because result depends on locale! */
559 parm
.status
.dwItem
= MCI_STATUS_TIME_FORMAT
;
560 err
= mciSendCommand(wDeviceID
, MCI_STATUS
, MCI_STATUS_ITEM
, (DWORD_PTR
)&parm
);
561 ok(!err
,"mciCommand status time format: %s\n", dbg_mcierr(err
));
562 if(!err
) ok(parm
.status
.dwReturn
==MCI_FORMAT_MILLISECONDS
,"status time format: %ld\n",parm
.status
.dwReturn
);
564 parm
.set
.dwTimeFormat
= MCI_FORMAT_MILLISECONDS
;
565 err
= mciSendCommand(wDeviceID
, MCI_SET
, MCI_SET_TIME_FORMAT
, (DWORD_PTR
)&parm
);
566 ok(!err
,"mciCommand set time format ms: %s\n", dbg_mcierr(err
));
569 err
= mciSendString("status mysound position", buf
, sizeof(buf
), hwnd
);
570 ok(!err
,"mci status position returned %s\n", dbg_mcierr(err
));
571 ok(strcmp(buf
,"2000"), "mci status position: %s, expected 2000\n", buf
);
572 trace("position after Sleep: %sms\n",buf
);
574 /* Some machines reach 79ms only during the 100ms sleep. */
575 ok(p2
>=67,"not enough time elapsed %ums\n",p2
);
576 test_notification(hwnd
,"play (nowait)",0);
578 err
= mciSendString("pause mysound wait", NULL
, 0, hwnd
);
579 ok(!err
,"mci pause wait returned %s\n", dbg_mcierr(err
));
582 err
= mciSendString("status mysound mode notify", buf
, sizeof(buf
), hwnd
);
583 ok(!err
,"mci status mode returned %s\n", dbg_mcierr(err
));
584 if(!err
) ok(!strcmp(buf
,"paused"), "mci status mode: %s\n", buf
);
585 test_notification(hwnd
,"play",MCI_NOTIFY_SUPERSEDED
);
586 test_notification(hwnd
,"status",MCI_NOTIFY_SUCCESSFUL
);
589 err
= mciSendString("status mysound position", buf
, sizeof(buf
), hwnd
);
590 ok(!err
,"mci status position returned %s\n", dbg_mcierr(err
));
591 trace("position while paused: %sms\n",buf
);
593 ok(p1
>=p2
, "position not increasing: %u > %u\n", p2
, p1
);
595 err
= mciSendString("stop mysound wait", NULL
, 0, NULL
);
596 ok(!err
,"mci stop returned %s\n", dbg_mcierr(err
));
599 err
= mciSendString("info mysound file notify", buf
, sizeof(buf
), hwnd
);
600 ok(!err
,"mci info file returned %s\n", dbg_mcierr(err
));
601 if(!err
) { /* fully qualified name */
602 int len
= strlen(buf
);
603 todo_wine
ok(len
>2 && buf
[1]==':',"Expected full pathname from info file: %s\n", buf
);
604 ok(len
>=12 && !strcmp(&buf
[len
-12],"tempfile.wav"), "info file returned: %s\n", buf
);
606 test_notification(hwnd
,"info file",MCI_NOTIFY_SUCCESSFUL
);
609 err
= mciSendString("status mysound mode", buf
, sizeof(buf
), hwnd
);
610 ok(!err
,"mci status mode returned %s\n", dbg_mcierr(err
));
611 ok(!strcmp(buf
,"stopped"), "mci status mode: %s\n", buf
);
614 err
= mciSendString("status mysound position", buf
, sizeof(buf
), hwnd
);
615 ok(!err
,"mci status position returned %s\n", dbg_mcierr(err
));
616 trace("position once stopped: %sms\n",buf
);
618 /* An XP machine let the position increase slightly after pause. */
619 ok(p2
>=p1
&& p2
<=p1
+16,"position changed from %ums to %ums\n",p1
,p2
);
621 /* No Resume once stopped (waveaudio, sequencer and cdaudio differ). */
622 err
= mciSendString("resume mysound wait", NULL
, 0, NULL
);
623 ok(err
==MCIERR_NONAPPLICABLE_FUNCTION
,"mci resume wait returned %s\n", dbg_mcierr(err
));
625 err
= mciSendString("play mysound wait", NULL
, 0, NULL
);
626 ok(!err
,"mci play wait returned %s\n", dbg_mcierr(err
));
629 err
= mciSendString("status mysound position", buf
, sizeof(buf
), hwnd
);
630 ok(!err
,"mci status position returned %s\n", dbg_mcierr(err
));
631 todo_wine
ok(!strcmp(buf
,"2000"), "mci status position: %s\n", buf
);
633 err
= mciSendString("seek mysound to start wait", NULL
, 0, NULL
);
634 ok(!err
,"mci seek to start wait returned %s\n", dbg_mcierr(err
));
636 err
= mciSendString("play mysound to 1000 notify", NULL
, 0, hwnd
);
637 ok(!err
,"mci play returned %s\n", dbg_mcierr(err
));
639 /* Sleep(200); not needed with Wine any more. */
641 err
= mciSendString("pause mysound notify", NULL
, 0, NULL
); /* notify no callback */
642 ok(!err
,"mci pause notify returned %s\n", dbg_mcierr(err
));
643 /* Supersede even though pause cannot notify given no callback */
644 test_notification(hwnd
,"pause aborted play #1 notification",MCI_NOTIFY_SUPERSEDED
);
645 test_notification(hwnd
,"impossible pause notification",0);
647 err
= mciSendString("cue mysound output notify", NULL
, 0, hwnd
);
648 ok(err
==MCIERR_NONAPPLICABLE_FUNCTION
,"mci cue output while paused returned %s\n", dbg_mcierr(err
));
649 test_notification(hwnd
,"cue output notify #2",0);
651 err
= mciSendString("resume mysound notify", NULL
, 0, hwnd
);
652 ok(!err
,"mci resume notify returned %s\n", dbg_mcierr(err
));
653 test_notification(hwnd
, "resume notify", MCI_NOTIFY_SUCCESSFUL
);
655 /* Seek or even Stop used to hang Wine<1.1.32 on MacOS. */
656 err
= mciSendString("seek mysound to 0 wait", NULL
, 0, NULL
);
657 ok(!err
,"mci seek to start returned %s\n", dbg_mcierr(err
));
660 err
= mciSendString("status mysound mode", buf
, sizeof(buf
), NULL
);
661 ok(!err
,"mci status mode returned %s\n", dbg_mcierr(err
));
662 if(!err
) ok(!strcmp(buf
,"stopped"), "mci status mode: %s\n", buf
);
664 err
= mciSendString("seek mysound wait", NULL
, 0, NULL
);
665 ok(err
==MCIERR_MISSING_PARAMETER
,"mci seek to nowhere returned %s\n", dbg_mcierr(err
));
667 /* cdaudio does not detect to start to end as error */
668 err
= mciSendString("seek mysound to start to 0", NULL
, 0, NULL
);
669 ok(err
==MCIERR_FLAGS_NOT_COMPATIBLE
,"mci seek to start to 0 returned %s\n", dbg_mcierr(err
));
671 err
= mciSendString("PLAY mysound to 1000 notify", NULL
, 0, hwnd
);
672 ok(!err
,"mci play to 1000 notify returned %s\n", dbg_mcierr(err
));
674 /* Sleep(200); not needed with Wine any more. */
675 /* Give it 400ms and resume will appear to complete below. */
677 err
= mciSendString("pause mysound wait", NULL
, 0, NULL
);
678 ok(!err
,"mci pause wait returned %s\n", dbg_mcierr(err
));
679 /* Unlike sequencer and cdaudio, waveaudio's pause does not abort. */
680 test_notification(hwnd
,"pause aborted play #2 notification",0);
682 err
= mciSendString("resume mysound wait", NULL
, 0, NULL
);
683 ok(!err
,"mci resume wait returned %s\n", dbg_mcierr(err
));
684 /* Resume is a short asynchronous call, something else is playing. */
686 err
= mciSendString("status mysound mode", buf
, sizeof(buf
), NULL
);
687 ok(!err
,"mci status mode returned %s\n", dbg_mcierr(err
));
688 if(!err
) ok(!strcmp(buf
,"playing"), "mci status mode: %s\n", buf
);
690 /* Note extra space before alias */
691 err
= mciSendString("pause mysound wait", NULL
, 0, NULL
);
692 todo_wine
ok(!err
,"mci pause (space) wait returned %s\n", dbg_mcierr(err
));
694 err
= mciSendString("pause mysound wait", NULL
, 0, NULL
);
695 ok(!err
,"mci pause wait returned %s\n", dbg_mcierr(err
));
697 /* Better ask position only when paused, is it updated while playing? */
699 err
= mciSendString("status mysound position", buf
, sizeof(buf
), NULL
);
700 ok(!err
,"mci status position returned %s\n", dbg_mcierr(err
));
701 /* TODO compare position < 900 */
702 ok(strcmp(buf
,"1000"), "mci resume waited\n");
703 ok(strcmp(buf
,"2000"), "mci resume played to end\n");
704 trace("position after resume: %sms\n",buf
);
705 test_notification(hwnd
,"play (aborted by pause/resume/pause)",0);
707 err
= mciSendString("close mysound wait", NULL
, 0, NULL
);
708 ok(!err
,"mci close wait returned %s\n", dbg_mcierr(err
));
709 test_notification(hwnd
,"play (aborted by close)",MCI_NOTIFY_ABORTED
);
712 static void test_AutoOpenWAVE(HWND hwnd
)
714 /* This test used(?) to cause intermittent crashes when Wine exits, after
715 * fixme:winmm:MMDRV_Exit Closing while ll-driver open
717 MCIERROR err
, ok_snd
= waveOutGetNumDevs() ? 0 : MCIERR_HARDWARE
;
718 char buf
[512], path
[300], command
[330];
719 memset(buf
, 0, sizeof(buf
)); memset(path
, 0, sizeof(path
));
721 /* Do not crash on NULL buffer pointer */
722 err
= mciSendString("sysinfo waveaudio quantity open", NULL
, 0, NULL
);
723 ok(err
==MCIERR_PARAM_OVERFLOW
,"mci sysinfo without buffer returned %s\n", dbg_mcierr(err
));
725 err
= mciSendString("sysinfo waveaudio quantity open", buf
, sizeof(buf
), NULL
);
726 ok(!err
,"mci sysinfo waveaudio quantity open returned %s\n", dbg_mcierr(err
));
727 if(!err
) todo_wine
ok(!strcmp(buf
,"0"), "sysinfo quantity open expected 0, got: %s, some more tests will fail.\n", buf
);
729 /* Who knows why some machines pass all tests but return MCIERR_HARDWARE here? */
730 err
= mciSendString("sound NoSuchSoundDefined wait", NULL
, 0, NULL
);
731 todo_wine
ok(err
==ok_snd
|| broken(err
==MCIERR_HARDWARE
),"mci sound NoSuchSoundDefined returned %s\n", dbg_mcierr(err
));
733 err
= mciSendString("sound SystemExclamation notify wait", NULL
, 0, hwnd
);
734 todo_wine
ok(err
==ok_snd
|| broken(err
==MCIERR_HARDWARE
),"mci sound SystemExclamation returned %s\n", dbg_mcierr(err
));
735 test_notification(hwnd
, "sound notify", err
? 0 : MCI_NOTIFY_SUCCESSFUL
);
738 err
= mciSendString("sysinfo waveaudio name 1 open", buf
, sizeof(buf
), NULL
);
739 todo_wine
ok(err
==MCIERR_OUTOFRANGE
,"sysinfo waveaudio name 1 returned %s\n", dbg_mcierr(err
));
740 if(!err
) trace("sysinfo dangling open alias: %s\n", buf
);
742 err
= mciSendString("play no-such-file-exists.wav notify", buf
, sizeof(buf
), NULL
);
743 if(err
==MCIERR_FILE_NOT_FOUND
) { /* a Wine detector */
744 /* Unsupported auto-open leaves the file open, preventing clean-up */
745 skip("Skipping auto-open tests in Wine\n");
749 err
= mciSendString("play tempfile.wav notify", buf
, sizeof(buf
), hwnd
);
750 todo_wine
ok(err
==MCIERR_NOTIFY_ON_AUTO_OPEN
,"mci auto-open play notify returned %s\n", dbg_mcierr(err
));
752 if(err
) /* FIXME: don't open twice yet, it confuses Wine. */
753 err
= mciSendString("play tempfile.wav", buf
, sizeof(buf
), hwnd
);
754 ok(err
==ok_saved
,"mci auto-open play returned %s\n", dbg_mcierr(err
));
756 if(err
==MCIERR_FILE_NOT_FOUND
) {
757 skip("Cannot open tempfile.wav for auto-play, skipping\n");
762 err
= mciSendString("sysinfo waveaudio quantity open", buf
, sizeof(buf
), NULL
);
763 ok(!err
,"mci sysinfo waveaudio quantity after auto-open returned %s\n", dbg_mcierr(err
));
764 if(!err
) todo_wine
ok(!strcmp(buf
,"1"), "sysinfo quantity open expected 1, got: %s\n", buf
);
767 err
= mciSendString("sysinfo waveaudio name 1 open", buf
, sizeof(buf
), NULL
);
768 todo_wine
ok(!err
,"mci sysinfo waveaudio name after auto-open returned %s\n", dbg_mcierr(err
));
769 /* This is the alias, not necessarily a file name. */
770 if(!err
) ok(!strcmp(buf
,"tempfile.wav"), "sysinfo name 1 open: %s\n", buf
);
772 /* Save the full pathname to the file. */
773 err
= mciSendString("info tempfile.wav file", path
, sizeof(path
), NULL
);
774 ok(!err
,"mci info tempfile.wav file returned %s\n", dbg_mcierr(err
));
775 if(err
) strcpy(path
,"tempfile.wav");
777 err
= mciSendString("status tempfile.wav mode", NULL
, 0, hwnd
);
778 ok(!err
,"mci status tempfile.wav mode without buffer returned %s\n", dbg_mcierr(err
));
780 sprintf(command
,"status \"%s\" mode",path
);
781 err
= mciSendString(command
, buf
, sizeof(buf
), hwnd
);
782 ok(!err
,"mci status \"%s\" mode returned %s\n", path
, dbg_mcierr(err
));
785 err
= mciSendString("status tempfile.wav mode", buf
, sizeof(buf
), hwnd
);
786 ok(!err
,"mci status tempfile.wav mode returned %s\n", dbg_mcierr(err
));
787 if(!err
) ok(!strcmp(buf
,"playing"), "mci auto-open status mode, got: %s\n", buf
);
789 err
= mciSendString("open tempfile.wav", buf
, sizeof(buf
), NULL
);
790 todo_wine
ok(err
==MCIERR_DEVICE_OPEN
, "mci open from auto-open returned %s\n", dbg_mcierr(err
));
792 /* w2k/xp and Wine differ. While the device is busy playing, it is
793 * regularly open and accessible via the filename: subsequent
794 * commands must not cause auto-open each. In Wine, a subsequent
795 * command with notify request may cause the initial play
796 * notification to be superseded, in turn causing MCI to close the
797 * device. I.e. MCI uses the auto-open notification for itself,
798 * that's why it's not available to the app. On w2k/xp,
799 * subsequent commands with notify requests are returned with
800 * MCIERR_NOTIFY_ON_AUTO_OPEN and thus don't abort the original
803 err
= mciSendString("status tempfile.wav mode notify", buf
, sizeof(buf
), hwnd
);
804 todo_wine
ok(err
==MCIERR_NOTIFY_ON_AUTO_OPEN
, "mci status auto-open notify returned %s\n", dbg_mcierr(err
));
806 trace("Wine style MCI auto-close upon notification\n");
808 /* "playing" because auto-close comes after the status call. */
809 todo_wine
ok(!strcmp(buf
,"playing"), "mci auto-open status mode notify, got: %s\n", buf
);
810 /* fixme:winmm:MMDRV_Exit Closing while ll-driver open
811 * is explained by failure to auto-close a device. */
812 test_notification(hwnd
,"status notify",MCI_NOTIFY_SUCCESSFUL
);
813 /* MCI received NOTIFY_SUPERSEDED and auto-closed the device. */
815 test_notification(hwnd
,"auto-open",0);
816 } else if(err
==MCIERR_NOTIFY_ON_AUTO_OPEN
) { /* MS style */
817 trace("MS style MCI auto-open forbids notification\n");
819 err
= mciSendString("pause tempfile.wav", NULL
, 0, hwnd
);
820 ok(!err
,"mci auto-still-open pause returned %s\n", dbg_mcierr(err
));
822 err
= mciSendString("status tempfile.wav mode", buf
, sizeof(buf
), hwnd
);
823 ok(!err
,"mci status mode returned %s\n", dbg_mcierr(err
));
824 if(!err
) ok(!strcmp(buf
,"paused"), "mci auto-open status mode, got: %s\n", buf
);
827 err
= mciSendString("stop tempfile.wav", NULL
, 0, hwnd
);
828 ok(!err
,"mci auto-still-open stop returned %s\n", dbg_mcierr(err
));
829 Sleep(16); /* makes sysinfo quantity open below succeed */
832 err
= mciSendString("sysinfo waveaudio quantity open", buf
, sizeof(buf
), NULL
);
833 ok(!err
,"mci sysinfo waveaudio quantity open after close returned %s\n", dbg_mcierr(err
));
834 if(!err
) todo_wine
ok(!strcmp(buf
,"0"), "sysinfo quantity open expected 0 after auto-close, got: %s\n", buf
);
836 /* w95-WinME (not w2k/XP) switch to C:\ after auto-playing once. Prevent
837 * MCIERR_FILE_NOT_FOUND by using the full path name from the Info file command.
839 sprintf(command
,"status \"%s\" mode wait",path
);
840 err
= mciSendString(command
, buf
, sizeof(buf
), hwnd
);
841 ok(!err
,"mci re-auto-open status mode returned %s\n", dbg_mcierr(err
));
842 if(!err
) ok(!strcmp(buf
,"stopped"), "mci re-auto-open status mode, got: %s\n", buf
);
844 err
= mciSendString("capability waveaudio device type", buf
, sizeof(buf
), hwnd
);
845 ok(!err
,"mci capability device type returned %s\n", dbg_mcierr(err
));
846 if(!err
) ok(!strcmp(buf
,"waveaudio"), "mci capability device type response: %s\n", buf
);
848 /* waveaudio forbids Pause without Play. */
849 sprintf(command
,"pause \"%s\"",path
);
850 err
= mciSendString(command
, NULL
, 0, hwnd
);
851 ok(err
==MCIERR_NONAPPLICABLE_FUNCTION
,"mci auto-open pause returned %s\n", dbg_mcierr(err
));
858 hwnd
= CreateWindowExA(0, "static", "winmm test", WS_POPUP
, 0,0,100,100,
860 test_openCloseWAVE(hwnd
);
861 test_recordWAVE(hwnd
);
863 test_asyncWAVE(hwnd
);
864 test_AutoOpenWAVE(hwnd
);
865 /* Win9X hangs when exiting with something still open. */
866 err
= mciSendString("close all", NULL
, 0, hwnd
);
867 ok(!err
,"final close all returned %s\n", dbg_mcierr(err
));
868 ok(DeleteFile("tempfile.wav")||ok_saved
,"Delete tempfile.wav (cause auto-open?)\n");