📄 ds3d8.c
字号:
!(dscaps.dwFlags & DSCAPS_EMULDRIVER), 1.0,0,NULL,0,0); volume -= ((DSBVOLUME_MAX-DSBVOLUME_MIN) / 40); } pan = DSBPAN_LEFT; for (i = 0; i < 7; i++) { test_buffer8(dso,primary,1,TRUE,0,TRUE,pan, winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0); pan += ((DSBPAN_RIGHT-DSBPAN_LEFT) / 6); } } ref=IDirectSoundBuffer_Release(primary); ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " "should have 0\n",ref); } /* Set the CooperativeLevel back to normal */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: " "%s\n",DXGetErrorString8(rc));EXIT: ref=IDirectSound8_Release(dso); ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref); if (ref!=0) return DSERR_GENERIC; return rc;}static HRESULT test_primary_3d8(LPGUID lpGuid){ HRESULT rc; LPDIRECTSOUND8 dso=NULL; LPDIRECTSOUNDBUFFER primary=NULL; DSBUFFERDESC bufdesc; DSCAPS dscaps; int ref; /* Create the DirectSound object */ rc=pDirectSoundCreate8(lpGuid,&dso,NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n", DXGetErrorString8(rc)); if (rc!=DS_OK) return rc; /* Get the device capabilities */ ZeroMemory(&dscaps, sizeof(dscaps)); dscaps.dwSize=sizeof(dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps); ok(rc==DS_OK,"IDirectSound8_GetCaps failed: %s\n",DXGetErrorString8(rc)); if (rc!=DS_OK) goto EXIT; /* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: " "%s\n",DXGetErrorString8(rc)); if (rc!=DS_OK) goto EXIT; primary=NULL; ZeroMemory(&bufdesc, sizeof(bufdesc)); bufdesc.dwSize=sizeof(bufdesc); bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER; rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed " "to create a primary buffer: %s\n",DXGetErrorString8(rc)); if (rc==DS_OK && primary!=NULL) { ref=IDirectSoundBuffer_Release(primary); ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " "should have 0\n",ref); primary=NULL; ZeroMemory(&bufdesc, sizeof(bufdesc)); bufdesc.dwSize=sizeof(bufdesc); bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D; rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() " "failed to create a 3D primary buffer: %s\n",DXGetErrorString8(rc)); if (rc==DS_OK && primary!=NULL) { test_buffer8(dso,primary,1,FALSE,0,FALSE,0, winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER),1.0,0,0,0,0); ref=IDirectSoundBuffer_Release(primary); ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " "should have 0\n",ref); } } /* Set the CooperativeLevel back to normal */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */ rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL); ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_NORMAL) failed: " "%s\n",DXGetErrorString8(rc));EXIT: ref=IDirectSound8_Release(dso); ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref); if (ref!=0) return DSERR_GENERIC; return rc;}static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid){ HRESULT rc; LPDIRECTSOUND8 dso=NULL; LPDIRECTSOUNDBUFFER primary=NULL; DSBUFFERDESC bufdesc; DSCAPS dscaps; int ref; /* Create the DirectSound object */ rc=pDirectSoundCreate8(lpGuid,&dso,NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %s\n", DXGetErrorString8(rc)); if (rc!=DS_OK) return rc; /* Get the device capabilities */ ZeroMemory(&dscaps, sizeof(dscaps)); dscaps.dwSize=sizeof(dscaps); rc=IDirectSound8_GetCaps(dso,&dscaps); ok(rc==DS_OK,"IDirectSound8_GetCaps() failed: %s\n",DXGetErrorString8(rc)); if (rc!=DS_OK) goto EXIT; /* We must call SetCooperativeLevel before calling CreateSoundBuffer */ /* DSOUND: Setting DirectSound cooperative level to DSSCL_PRIORITY */ rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_PRIORITY); ok(rc==DS_OK,"IDirectSound8_SetCooperativeLevel(DSSCL_PRIORITY) failed: " "%s\n",DXGetErrorString8(rc)); if (rc!=DS_OK) goto EXIT; primary=NULL; ZeroMemory(&bufdesc, sizeof(bufdesc)); bufdesc.dwSize=sizeof(bufdesc); bufdesc.dwFlags=DSBCAPS_PRIMARYBUFFER|DSBCAPS_CTRL3D; rc=IDirectSound8_CreateSoundBuffer(dso,&bufdesc,&primary,NULL); ok(rc==DS_OK && primary!=NULL,"IDirectSound8_CreateSoundBuffer() failed " "to create a 3D primary buffer %s\n",DXGetErrorString8(rc)); if (rc==DS_OK && primary!=NULL) { LPDIRECTSOUND3DLISTENER listener=NULL; rc=IDirectSoundBuffer_QueryInterface(primary, &IID_IDirectSound3DListener, (void **)&listener); ok(rc==DS_OK && listener!=NULL,"IDirectSoundBuffer_QueryInterface() " "failed to get a 3D listener: %s\n",DXGetErrorString8(rc)); if (rc==DS_OK && listener!=NULL) { LPDIRECTSOUNDBUFFER temp_buffer=NULL; /* Checking the COM interface */ rc=IDirectSoundBuffer_QueryInterface(primary, &IID_IDirectSoundBuffer, (LPVOID *)&temp_buffer); ok(rc==DS_OK && temp_buffer!=NULL, "IDirectSoundBuffer_QueryInterface() failed: %s\n", DXGetErrorString8(rc)); ok(temp_buffer==primary,"COM interface broken: %p != %p\n",temp_buffer,primary); if (rc==DS_OK && temp_buffer!=NULL) { ref=IDirectSoundBuffer_Release(temp_buffer); ok(ref==1,"IDirectSoundBuffer_Release() has %d references, " "should have 1\n",ref); temp_buffer=NULL; rc=IDirectSound3DListener_QueryInterface(listener, &IID_IDirectSoundBuffer,(LPVOID *)&temp_buffer); ok(rc==DS_OK && temp_buffer!=NULL, "IDirectSoundBuffer_QueryInterface() failed: %s\n", DXGetErrorString8(rc)); ok(temp_buffer==primary,"COM interface broken: %p != %p\n",temp_buffer,primary); ref=IDirectSoundBuffer_Release(temp_buffer); ok(ref==1,"IDirectSoundBuffer_Release() has %d references, " "should have 1\n",ref); /* Testing the buffer */ test_buffer8(dso,primary,1,FALSE,0,FALSE,0, winetest_interactive && !(dscaps.dwFlags & DSCAPS_EMULDRIVER), 1.0,0,listener,0,0); } /* Testing the reference counting */ ref=IDirectSound3DListener_Release(listener); ok(ref==0,"IDirectSound3DListener_Release() listener has %d " "references, should have 0\n",ref); } /* Testing the reference counting */ ref=IDirectSoundBuffer_Release(primary); ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, " "should have 0\n",ref); }EXIT: ref=IDirectSound8_Release(dso); ok(ref==0,"IDirectSound8_Release() has %d references, should have 0\n",ref); if (ref!=0)return DSERR_GENERIC; return rc;}static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, LPCSTR lpcstrModule, LPVOID lpContext){ HRESULT rc; trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule); rc = test_for_driver8(lpGuid); if (rc == DSERR_NODRIVER) { trace(" No Driver\n"); return 1; } else if (rc == DSERR_ALLOCATED) { trace(" Already In Use\n"); return 1; } else if (rc == E_FAIL) { trace(" No Device\n"); return 1; } trace(" Testing the primary buffer\n"); test_primary8(lpGuid); trace(" Testing 3D primary buffer\n"); test_primary_3d8(lpGuid); trace(" Testing 3D primary buffer with listener\n"); test_primary_3d_with_listener8(lpGuid); /* Testing secondary buffers */ test_secondary8(lpGuid,winetest_interactive,0,0,0,0,0,0); test_secondary8(lpGuid,winetest_interactive,0,0,0,1,0,0); /* Testing 3D secondary buffers */ test_secondary8(lpGuid,winetest_interactive,1,0,0,0,0,0); test_secondary8(lpGuid,winetest_interactive,1,1,0,0,0,0); test_secondary8(lpGuid,winetest_interactive,1,1,0,1,0,0); test_secondary8(lpGuid,winetest_interactive,1,0,1,0,0,0); test_secondary8(lpGuid,winetest_interactive,1,0,1,1,0,0); test_secondary8(lpGuid,winetest_interactive,1,1,1,0,0,0); test_secondary8(lpGuid,winetest_interactive,1,1,1,1,0,0); test_secondary8(lpGuid,winetest_interactive,1,1,1,0,1,0); test_secondary8(lpGuid,winetest_interactive,1,1,1,0,0,1); test_secondary8(lpGuid,winetest_interactive,1,1,1,0,1,1); return 1;}static void ds3d8_tests(void){ HRESULT rc; rc=DirectSoundEnumerateA(&dsenum_callback,NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));}START_TEST(ds3d8){ HMODULE hDsound; CoInitialize(NULL); hDsound = LoadLibraryA("dsound.dll"); if (!hDsound) { trace("dsound.dll not found\n"); return; } trace("DLL Version: %s\n", get_file_version("dsound.dll")); pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8"); if (!pDirectSoundCreate8) { trace("ds3d8 test skipped\n"); return; } ds3d8_tests(); CoUninitialize();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -