172{
179
180
183 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
184
186
187
190 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
191
192 dsbcaps.
dwSize=
sizeof(dsbcaps);
194 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetCaps() failed: %08x\n", rc);
198 }
199
200
203 ok(rc==
DS_OK &&
size!=0,
"IDirectSoundBuffer_GetFormat() should have "
204 "returned the needed size: rc=%08x size=%d\n",rc,
size);
205
207 "Expected a correct structure size, got %d\n",
size);
208
217 } else
218 return;
219
220 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
222 trace(
" Format: %s tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
223 is_primary ? "Primary" : "Secondary",
226 }
227
228
231 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
232
233
237 "IDirectSoundBuffer_GetFrequency() failed: %08x\n",rc);
241 }
242
243
246 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
247
249 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetStatus() failed: %08x\n", rc);
251
252 if (is_primary) {
254
255
257 ok(rc==
DS_OK,
"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) "
258 "failed: %08x\n",rc);
260 return;
261
262
265 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
266
269 ok(rc==
DS_OK,
"IDirectSoundBuffer_SetFormat(%s) failed: %08x\n",
271
272
273
274
275
277 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
283 trace(
"Requested format tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
286 trace(
"Got tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
289 }
290
291 ZeroMemory(&new_dsbcaps,
sizeof(new_dsbcaps));
292 new_dsbcaps.
dwSize =
sizeof(new_dsbcaps);
294 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetCaps() failed: %08x\n", rc);
296 trace(
" new Caps: flags=0x%08x size=%d\n",new_dsbcaps.
dwFlags,
298 }
299
300
302 " buffer size changed after SetFormat() - "
303 "previous size was %u, current size is %u\n",
306
307
309 " flags changed after SetFormat() - "
310 "previous flags were %08x, current flags are %08x\n",
312
313
314
316 ok(rc==
DS_OK,
"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) "
317 "failed: %08x\n",rc);
318 }
319
320 if (play) {
328
330 trace(
" Playing %g second 440Hz tone at %dx%dx%d\n", duration,
332 }
333
334 if (is_primary) {
335
336
337
341 "IDirectSound8_SetCooperativeLevel(DSSCL_WRITEPRIMARY) failed: %08x\n",rc);
343 return;
344 }
345 if (buffer3d) {
347
350 ok(rc==
DS_OK,
"IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
352 return;
353
354
358 "IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
359 ok(temp_buffer==*dsbo,
"COM interface broken: %p != %p\n",
360 temp_buffer,*dsbo);
362 ok(
ref==1,
"IDirectSoundBuffer_Release() has %d references, "
363 "should have 1\n",
ref);
364
369 "IDirectSound3DBuffer_QueryInterface() failed: %08x\n", rc);
370 ok(temp_buffer==*dsbo,
"COM interface broken: %p != %p\n",
371 temp_buffer,*dsbo);
373 ok(
ref==1,
"IDirectSoundBuffer_Release() has %d references, "
374 "should have 1\n",
ref);
375
377 ok(
ref==0,
"IDirectSoundBuffer_Release() has %d references, "
378 "should have 0\n",
ref);
379
381 &IID_IDirectSoundBuffer,
383 ok(rc==
DS_OK && *dsbo!=
NULL,
"IDirectSound3DBuffer_QueryInterface() "
384 "failed: %08x\n",rc);
385
386
389 "failed: %08x\n",rc);
390
391 ZeroMemory(&buffer_param,
sizeof(buffer_param));
392
393
396 "failed: %08x\n",rc);
397
398 buffer_param.
dwSize=
sizeof(buffer_param);
400 ok(rc==
DS_OK,
"IDirectSound3DBuffer_GetAllParameters() failed: %08x\n", rc);
401 }
402 if (set_volume) {
406 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetVolume() failed: %08x\n", rc);
407
409 ok(rc==
DS_OK,
"IDirectSoundBuffer_SetVolume() failed: %08x\n", rc);
410 } else {
411
414 "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc);
415 }
416 }
417
418 if (set_pan) {
422 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetPan() failed: %08x\n", rc);
423
425 ok(rc==
DS_OK,
"IDirectSoundBuffer_SetPan() failed: %08x\n", rc);
426 } else {
427
430 "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc);
431 }
432 }
433
434
439 "returned DSERR_INVALIDPARAM, returned %08x\n", rc);
440
441
446 "returned DSERR_INVALIDPARAM, returned %08x\n", rc);
447
449
455
457 ok(rc==
DS_OK,
"IDirectSoundBuffer_Play() failed: %08x\n", rc);
458
460 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetStatus() failed: %08x\n", rc);
462 "GetStatus: bad status: %x\n",
status);
463
464 if (listener) {
465 ZeroMemory(&listener_param,
sizeof(listener_param));
466 listener_param.
dwSize=
sizeof(listener_param);
468 ok(rc==
DS_OK,
"IDirectSound3dListener_GetAllParameters() "
469 "failed: %08x\n",rc);
470 if (move_listener) {
473 }
475 &listener_param,
477 ok(rc==
DS_OK,
"IDirectSound3dListener_SetPosition() failed: %08x\n", rc);
478 }
479 if (buffer3d) {
480 if (move_sound) {
483 }
487 ok(rc==
DS_OK,
"IDirectSound3dBuffer_SetPosition() failed: %08x\n", rc);
488 }
489
494 if (listener && move_listener) {
501 ok(rc==
DS_OK,
"IDirectSound3dListener_SetPosition() failed: %08x\n",rc);
502 }
503 if (buffer3d && move_sound) {
510 ok(rc==
DS_OK,
"IDirectSound3dBuffer_SetPosition() failed: %08x\n", rc);
511 }
512 }
513
515 ok(
fabs(1000*duration-
now+start_time)<=100*duration,
516 "The sound played for %d ms instead of %g ms\n",
517 now-start_time,1000*duration);
518
520 if (is_primary) {
521
522
524 ok(rc==
DS_OK,
"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) "
525 "failed: %08x\n",rc);
526 }
527 if (buffer3d) {
529 ok(
ref==0,
"IDirectSound3DBuffer_Release() has %d references, "
530 "should have 0\n",
ref);
531 }
532 }
533}
#define GetCurrentProcess()
#define HeapFree(x, y, z)
DWORD WINAPI GetTickCount(VOID)
static int buffer_service8(play_state_t *state)
char * wave_generate_la(WAVEFORMATEX *wfx, double duration, DWORD *size, BOOL ieee)
void init_format(WAVEFORMATEX *wfx, int format, int rate, int depth, int channels)
#define DSBCAPS_CTRLVOLUME
struct IDirectSoundBuffer * LPDIRECTSOUNDBUFFER
#define IDirectSound3DListener_SetAllParameters(p, a, b)
#define DSERR_CONTROLUNAVAIL
struct IDirectSound3DBuffer * LPDIRECTSOUND3DBUFFER
#define IDirectSoundBuffer_GetFormat(p, a, b, c)
#define IDirectSoundBuffer_GetVolume(p, a)
#define IDirectSoundBuffer_GetStatus(p, a)
#define DSBLOCK_ENTIREBUFFER
#define DSBLOCK_FROMWRITECURSOR
#define DSBSTATUS_LOOPING
#define IDirectSoundBuffer_GetPan(p, a)
#define DSSCL_WRITEPRIMARY
#define IDirectSoundBuffer_SetFormat(p, a)
#define DSBSTATUS_PLAYING
#define IDirectSound3DBuffer_QueryInterface(p, a, b)
#define IDirectSoundBuffer_SetPan(p, a)
#define DSERR_INVALIDPARAM
#define DSBCAPS_CTRLFREQUENCY
#define IDirectSoundBuffer_GetFrequency(p, a)
#define IDirectSound3DBuffer_GetAllParameters(p, a)
#define IDirectSoundBuffer_Play(p, a, b, c)
#define IDirectSoundBuffer_GetCaps(p, a)
#define IDirectSound3DBuffer_SetAllParameters(p, a, b)
#define IDirectSound3DListener_GetAllParameters(p, a)
#define IDirectSound3DBuffer_Release(p)
#define IDirectSoundBuffer_SetVolume(p, a)
#define IDirectSound3DListener_SetPosition(p, a, b, c, d)
#define IDirectSound3DBuffer_SetPosition(p, a, b, c, d)
#define IDirectSoundBuffer_QueryInterface(p, a, b)
#define IDirectSoundBuffer_Release(p)
#define IDirectSound8_SetCooperativeLevel(p, a, b)
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define WAVE_FORMAT_IEEE_FLOAT
const char * format_string(const WAVEFORMATEX *wfx)
static float(__cdecl *square_half_float)(float x
#define IsEqualGUID(rguid1, rguid2)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)