321{
328
329 if (set_frequency) {
332 "IDirectSoundBuffer_SetFrequency() failed to set frequency %08x\n",rc);
334 return;
335 }
336
337
340 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
341
343
344
347 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
348
349 dsbcaps.
dwSize=
sizeof(dsbcaps);
351 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetCaps() failed: %08x\n", rc);
355 }
356
357
360 ok(rc==
DS_OK &&
size!=0,
"IDirectSoundBuffer_GetFormat() should have "
361 "returned the needed size: rc=%08x size=%d\n",rc,
size);
362
364 "Expected a correct structure size, got %d\n",
size);
365
369 }
375 } else
376 return;
377
379 "IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
381 trace(
" Format: %s tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
382 is_primary ? "Primary" : "Secondary",
385 }
386
387
390 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
391
392
396 "IDirectSoundBuffer_GetFrequency() failed: %08x\n",rc);
399 ok(freq==
f,
"The frequency returned by GetFrequency "
400 "%d does not match the format %d\n",freq,
f);
401 }
402
403
406 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
407
409 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetStatus() failed: %08x\n", rc);
411
412 if (is_primary) {
414
415
417 ok(rc==
DS_OK,
"IDirectSound_SetCooperativeLevel(DSSCL_PRIORITY) failed: %08x\n",rc);
419 return;
420
421
424 "returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
425
428 ok(rc==
DS_OK,
"IDirectSoundBuffer_SetFormat(%s) failed: %08x\n",
430
431
432
433
434
436 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetFormat() failed: %08x\n", rc);
442 trace(
"Requested format tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
445 trace(
"Got tag=0x%04x %dx%dx%d avg.B/s=%d align=%d\n",
448 }
449
450 ZeroMemory(&new_dsbcaps,
sizeof(new_dsbcaps));
451 new_dsbcaps.
dwSize =
sizeof(new_dsbcaps);
453 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetCaps() failed: %08x\n", rc);
455 trace(
" new Caps: flags=0x%08x size=%d\n",new_dsbcaps.
dwFlags,
457 }
458
459
461 " buffer size changed after SetFormat() - "
462 "previous size was %u, current size is %u\n",
465
466
468 " flags changed after SetFormat() - "
469 "previous flags were %08x, current flags are %08x\n",
471
472
473
475 ok(rc==
DS_OK,
"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) failed: %08x\n",rc);
476 }
477
478 if (play) {
486
488 if (set_frequency)
489 trace(
" Playing %g second 440Hz tone at %dx%dx%d with a "
490 "frequency of %d (%dHz)\n", duration,
493 else
494 trace(
" Playing %g second 440Hz tone at %dx%dx%d\n", duration,
496 }
497
498 if (is_primary) {
499
500
501
504 ok(rc==
DS_OK,
"IDirectSound_SetCooperativeLevel(DSSCL_WRITEPRIMARY) "
505 "failed: %08x\n",rc);
507 return;
508 }
509 if (buffer3d) {
511
514 ok(rc==
DS_OK,
"IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
516 return;
517
518
522 "IDirectSoundBuffer_QueryInterface() failed: %08x\n", rc);
523 ok(temp_buffer==*dsbo,
"COM interface broken: %p != %p\n",
524 temp_buffer,*dsbo);
526 ok(
ref==1,
"IDirectSoundBuffer_Release() has %d references, "
527 "should have 1\n",
ref);
528
531 &IID_IDirectSoundBuffer,
534 "IDirectSound3DBuffer_QueryInterface() failed: %08x\n", rc);
535 ok(temp_buffer==*dsbo,
"COM interface broken: %p != %p\n",
536 temp_buffer,*dsbo);
538 ok(
ref==1,
"IDirectSoundBuffer_Release() has %d references, "
539 "should have 1\n",
ref);
540
542 ok(
ref==0,
"IDirectSoundBuffer_Release() has %d references, "
543 "should have 0\n",
ref);
544
546 &IID_IDirectSoundBuffer,
548 ok(rc==
DS_OK && *dsbo!=
NULL,
"IDirectSound3DBuffer_QueryInterface() "
549 "failed: %08x\n",rc);
550
551
554 "failed: %08x\n",rc);
555
556 ZeroMemory(&buffer_param,
sizeof(buffer_param));
557
558
561 "failed: %08x\n",rc);
562
563 buffer_param.
dwSize=
sizeof(buffer_param);
565 ok(rc==
DS_OK,
"IDirectSound3DBuffer_GetAllParameters() failed: %08x\n", rc);
566 }
567 if (set_volume) {
571 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetVolume() failed: %08x\n", rc);
572
574 ok(rc==
DS_OK,
"IDirectSoundBuffer_SetVolume() failed: %08x\n", rc);
575 } else {
576
579 "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc);
580 }
581 }
582
583 if (set_pan) {
587 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetPan() failed: %08x\n", rc);
588
590 ok(rc==
DS_OK,
"IDirectSoundBuffer_SetPan() failed: %08x\n", rc);
591 } else {
592
595 "should have returned DSERR_CONTROLUNAVAIL, returned: %08x\n", rc);
596 }
597 }
598
599
604 "returned DSERR_INVALIDPARAM, returned %08x\n", rc);
605
606
611 "returned DSERR_INVALIDPARAM, returned %08x\n", rc);
612
613 if (set_frequency)
615 else
617
623
625 ok(rc==
DS_OK,
"IDirectSoundBuffer_Play() failed: %08x\n", rc);
626
628 ok(rc==
DS_OK,
"IDirectSoundBuffer_GetStatus() failed: %08x\n", rc);
630 "GetStatus: bad status: %x\n",
status);
631
632 if (listener) {
633 ZeroMemory(&listener_param,
sizeof(listener_param));
634 listener_param.
dwSize=
sizeof(listener_param);
636 &listener_param);
637 ok(rc==
DS_OK,
"IDirectSound3dListener_GetAllParameters() "
638 "failed: %08x\n",rc);
639 if (move_listener) {
642 }
644 &listener_param,
646 ok(rc==
DS_OK,
"IDirectSound3dListener_SetPosition() failed: %08x\n", rc);
647 }
648 if (buffer3d) {
649 if (move_sound) {
652 }
656 ok(rc==
DS_OK,
"IDirectSound3dBuffer_SetPosition() failed: %08x\n", rc);
657 }
658
663 if (listener && move_listener) {
670 ok(rc==
DS_OK,
"IDirectSound3dListener_SetPosition() failed: %08x\n",rc);
671 }
672 if (buffer3d && move_sound) {
679 ok(rc==
DS_OK,
"IDirectSound3dBuffer_SetPosition() failed: %08x\n", rc);
680 }
681 }
682
684 ok(
fabs(1000*duration-
now+start_time)<=100*duration,
685 "The sound played for %d ms instead of %g ms\n",
686 now-start_time,1000*duration);
687
689 if (is_primary) {
690
691
693 ok(rc==
DS_OK,
"IDirectSound_SetCooperativeLevel(DSSCL_NORMAL) "
694 "failed: %08x\n",rc);
695 }
696 if (buffer3d) {
698 ok(
ref==0,
"IDirectSound3DBuffer_Release() has %d references, "
699 "should have 0\n",
ref);
700 }
701 }
702}
#define GetCurrentProcess()
#define HeapFree(x, y, z)
DWORD WINAPI GetTickCount(VOID)
char * wave_generate_la(WAVEFORMATEX *wfx, double duration, DWORD *size, BOOL ieee)
static int buffer_service(play_state_t *state)
void init_format(WAVEFORMATEX *wfx, int format, int rate, int depth, int channels)
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 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 IDirectSoundBuffer_SetFrequency(p, a)
#define IDirectSound3DListener_SetPosition(p, a, b, c, d)
#define IDirectSound_SetCooperativeLevel(p, a, b)
#define IDirectSound3DBuffer_SetPosition(p, a, b, c, d)
#define IDirectSoundBuffer_QueryInterface(p, a, b)
#define IDirectSoundBuffer_Release(p)
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define WAVE_FORMAT_IEEE_FLOAT
const char * format_string(const WAVEFORMATEX *wfx)
static LARGE_INTEGER * frequency
static float(__cdecl *square_half_float)(float x
#define IsEqualGUID(rguid1, rguid2)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)