2006-01-17 16:19:14 +01:00
|
|
|
/*
|
|
|
|
* Unit tests for duplex functions
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006 Robert Reif
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-01-17 16:19:14 +01:00
|
|
|
*/
|
|
|
|
|
2012-08-16 01:24:23 +02:00
|
|
|
#define COBJMACROS
|
2006-01-17 16:19:14 +01:00
|
|
|
#include <windows.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
2013-10-14 23:19:31 +02:00
|
|
|
#include "mmsystem.h"
|
2006-01-17 16:19:14 +01:00
|
|
|
#include "dsound.h"
|
|
|
|
#include "dsconf.h"
|
|
|
|
|
|
|
|
#include "dsound_test.h"
|
|
|
|
|
|
|
|
static HRESULT (WINAPI *pDirectSoundFullDuplexCreate)(LPCGUID, LPCGUID,
|
|
|
|
LPCDSCBUFFERDESC, LPCDSBUFFERDESC, HWND, DWORD, LPDIRECTSOUNDFULLDUPLEX *,
|
|
|
|
LPDIRECTSOUNDCAPTUREBUFFER8*, LPDIRECTSOUNDBUFFER8*, LPUNKNOWN)=NULL;
|
|
|
|
|
|
|
|
static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
|
|
|
|
BOOL initialized, LPCGUID lpGuidCapture,
|
|
|
|
LPCGUID lpGuidRender)
|
|
|
|
{
|
|
|
|
HRESULT rc;
|
|
|
|
int ref;
|
|
|
|
IUnknown * unknown;
|
|
|
|
IDirectSound * ds;
|
|
|
|
IDirectSound8 * ds8;
|
|
|
|
IDirectSoundCapture * dsc;
|
|
|
|
IDirectSoundFullDuplex * dsfd;
|
|
|
|
|
|
|
|
/* Try to Query for objects */
|
|
|
|
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IUnknown,(LPVOID*)&unknown);
|
2008-07-08 17:49:20 +02:00
|
|
|
ok(rc==DS_OK,"IDirectSoundFullDuplex_QueryInterface(IID_IUnknown) failed: %08x\n", rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==DS_OK) {
|
2018-03-30 07:05:28 +02:00
|
|
|
ref = IUnknown_Release(unknown);
|
2006-01-17 16:19:14 +01:00
|
|
|
ok(ref==0, "IDirectSoundFullDuplex_Release() has %d references, "
|
|
|
|
"should have 0\n", ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSound,(LPVOID*)&ds);
|
2008-07-08 17:49:20 +02:00
|
|
|
ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSound) failed: %08x\n", rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==DS_OK) {
|
|
|
|
ref=IDirectSound_Release(ds);
|
|
|
|
ok(ref==0, "IDirectSound_Release() has %d references, "
|
|
|
|
"should have 0\n", ref);
|
|
|
|
}
|
2006-08-18 07:14:12 +02:00
|
|
|
|
2006-01-17 16:19:14 +01:00
|
|
|
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSound8,(LPVOID*)&ds8);
|
|
|
|
ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSound8) "
|
2008-07-08 17:49:20 +02:00
|
|
|
"failed: %08x\n",rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==DS_OK) {
|
|
|
|
IDirectSoundFullDuplex * dsfd1;
|
|
|
|
rc=IDirectSound8_QueryInterface(ds8,&IID_IDirectSoundFullDuplex,(LPVOID*)&dsfd1);
|
|
|
|
ok(rc==DS_OK,"IDirectSound8_QueryInterface(IID_IDirectSoundFullDuplex) "
|
2008-07-08 17:49:20 +02:00
|
|
|
"failed: %08x\n",rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==DS_OK) {
|
|
|
|
ref=IDirectSoundFullDuplex_Release(dsfd1);
|
|
|
|
ok(ref==1, "IDirectSoundFullDuplex_Release() has %d references, "
|
|
|
|
"should have 1\n", ref);
|
|
|
|
}
|
|
|
|
ref=IDirectSound8_Release(ds8);
|
|
|
|
ok(ref==0, "IDirectSound8_Release() has %d references, "
|
|
|
|
"should have 0\n", ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSoundCapture,(LPVOID*)&dsc);
|
|
|
|
ok(rc==(initialized?DS_OK:E_NOINTERFACE),"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSoundCapture) "
|
2008-07-08 17:49:20 +02:00
|
|
|
"failed: %08x\n",rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==DS_OK) {
|
|
|
|
ref=IDirectSoundCapture_Release(dsc);
|
|
|
|
ok(ref==0, "IDirectSoundCapture_Release() has %d references, "
|
|
|
|
"should have 0\n", ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
rc=IDirectSoundFullDuplex_QueryInterface(dsfdo,&IID_IDirectSoundFullDuplex,(LPVOID*)&dsfd);
|
|
|
|
ok(rc==DS_OK,"IDirectSoundFullDuplex_QueryInterface(IID_IDirectSoundFullDuplex) "
|
2008-07-08 17:49:20 +02:00
|
|
|
"failed: %08x\n",rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==DS_OK) {
|
2011-02-09 22:44:22 +01:00
|
|
|
ok(dsfdo==dsfd, "different interfaces\n");
|
2018-03-30 07:05:28 +02:00
|
|
|
ref=IDirectSoundFullDuplex_Release(dsfd);
|
2011-02-09 22:44:22 +01:00
|
|
|
ok(ref==1, "IDirectSoundFullDuplex_Release() has %d references, should have 1\n", ref);
|
2006-01-17 16:19:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ref=IDirectSoundFullDuplex_Release(dsfdo);
|
|
|
|
ok(ref==0, "IDirectSoundFullDuplex_Release() has %d references, "
|
|
|
|
"should have 0\n", ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void IDirectSoundFullDuplex_tests(void)
|
|
|
|
{
|
|
|
|
HRESULT rc;
|
|
|
|
LPDIRECTSOUNDFULLDUPLEX dsfdo = NULL;
|
|
|
|
DSCBUFFERDESC DSCBufferDesc;
|
|
|
|
DSBUFFERDESC DSBufferDesc;
|
|
|
|
LPDIRECTSOUNDCAPTUREBUFFER8 pDSCBuffer8;
|
|
|
|
LPDIRECTSOUNDBUFFER8 pDSBuffer8;
|
|
|
|
WAVEFORMATEX wfex;
|
|
|
|
|
|
|
|
trace("Testing IDirectSoundFullDuplex\n");
|
|
|
|
|
|
|
|
/* try the COM class factory method of creation with no devices specified */
|
|
|
|
rc=CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL,
|
|
|
|
CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex,
|
|
|
|
(void**)&dsfdo);
|
2006-02-09 12:08:05 +01:00
|
|
|
ok(rc==S_OK||rc==REGDB_E_CLASSNOTREG||rc==CLASS_E_CLASSNOTAVAILABLE,
|
2008-07-08 17:49:20 +02:00
|
|
|
"CoCreateInstance(CLSID_DirectSoundFullDuplex) failed: 0x%08x\n", rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==REGDB_E_CLASSNOTREG) {
|
|
|
|
trace(" Class Not Registered\n");
|
|
|
|
return;
|
2006-02-09 12:08:05 +01:00
|
|
|
} else if (rc==CLASS_E_CLASSNOTAVAILABLE) {
|
|
|
|
trace(" Class Not Available\n");
|
|
|
|
return;
|
2006-01-17 16:19:14 +01:00
|
|
|
}
|
|
|
|
if (dsfdo)
|
|
|
|
IDirectSoundFullDuplex_test(dsfdo, FALSE, NULL, NULL);
|
|
|
|
|
2006-08-18 07:14:12 +02:00
|
|
|
/* try the COM class factory method of creation with default devices
|
2006-01-17 16:19:14 +01:00
|
|
|
* specified */
|
|
|
|
rc=CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL,
|
|
|
|
CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex,
|
|
|
|
(void**)&dsfdo);
|
2008-07-08 17:49:20 +02:00
|
|
|
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundFullDuplex) failed: 0x%08x\n", rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (dsfdo)
|
|
|
|
IDirectSoundFullDuplex_test(dsfdo, FALSE, &DSDEVID_DefaultCapture,
|
|
|
|
&DSDEVID_DefaultPlayback);
|
|
|
|
|
|
|
|
/* try the COM class factory method of creation with default voice
|
|
|
|
* devices specified */
|
|
|
|
rc=CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL,
|
|
|
|
CLSCTX_INPROC_SERVER, &IID_IDirectSoundFullDuplex,
|
|
|
|
(void**)&dsfdo);
|
2008-07-08 17:49:20 +02:00
|
|
|
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSoundFullDuplex) failed: 0x%08x\n", rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (dsfdo)
|
|
|
|
IDirectSoundFullDuplex_test(dsfdo, FALSE, &DSDEVID_DefaultVoiceCapture,
|
|
|
|
&DSDEVID_DefaultVoicePlayback);
|
|
|
|
|
|
|
|
/* try the COM class factory method of creation with a bad
|
|
|
|
* IID specified */
|
|
|
|
rc=CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL,
|
|
|
|
CLSCTX_INPROC_SERVER, &CLSID_DirectSoundPrivate,
|
|
|
|
(void**)&dsfdo);
|
|
|
|
ok(rc==E_NOINTERFACE,
|
|
|
|
"CoCreateInstance(CLSID_DirectSoundFullDuplex,CLSID_DirectSoundPrivate) "
|
2008-07-08 17:49:20 +02:00
|
|
|
"should have failed: 0x%08x\n", rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
|
|
|
|
ZeroMemory(&wfex, sizeof(wfex));
|
|
|
|
wfex.wFormatTag = WAVE_FORMAT_PCM;
|
|
|
|
wfex.nChannels = 1;
|
|
|
|
wfex.nSamplesPerSec = 8000;
|
|
|
|
wfex.wBitsPerSample = 16;
|
|
|
|
wfex.nBlockAlign = (wfex.wBitsPerSample * wfex.nChannels) / 8;
|
|
|
|
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
|
|
|
|
|
|
|
|
ZeroMemory(&DSCBufferDesc, sizeof(DSCBufferDesc));
|
|
|
|
DSCBufferDesc.dwSize = sizeof(DSCBufferDesc);
|
|
|
|
DSCBufferDesc.dwFlags = DSCBCAPS_WAVEMAPPED;
|
|
|
|
DSCBufferDesc.dwBufferBytes = 8192;
|
|
|
|
DSCBufferDesc.lpwfxFormat = &wfex;
|
|
|
|
|
|
|
|
ZeroMemory(&DSBufferDesc, sizeof(DSBufferDesc));
|
|
|
|
DSBufferDesc.dwSize = sizeof(DSBufferDesc);
|
|
|
|
DSBufferDesc.dwFlags = DSBCAPS_GLOBALFOCUS;
|
|
|
|
DSBufferDesc.dwBufferBytes = 8192;
|
|
|
|
DSBufferDesc.lpwfxFormat = &wfex;
|
|
|
|
|
|
|
|
/* try with no device specified */
|
|
|
|
rc=pDirectSoundFullDuplexCreate(NULL,NULL,&DSCBufferDesc,&DSBufferDesc,
|
|
|
|
get_hwnd(),DSSCL_EXCLUSIVE ,&dsfdo,&pDSCBuffer8,
|
|
|
|
&pDSBuffer8,NULL);
|
2006-01-25 13:15:25 +01:00
|
|
|
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL,
|
2008-07-08 17:49:20 +02:00
|
|
|
"DirectSoundFullDuplexCreate(NULL,NULL) failed: %08x\n",rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==S_OK && dsfdo)
|
|
|
|
IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
|
|
|
|
|
|
|
|
/* try with default devices specified */
|
|
|
|
rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultCapture,
|
|
|
|
&DSDEVID_DefaultPlayback,&DSCBufferDesc,
|
|
|
|
&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE,&dsfdo,
|
|
|
|
&pDSCBuffer8,&pDSBuffer8,NULL);
|
2006-01-25 13:15:25 +01:00
|
|
|
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL,
|
2006-01-17 16:19:14 +01:00
|
|
|
"DirectSoundFullDuplexCreate(DSDEVID_DefaultCapture,"
|
2008-07-08 17:49:20 +02:00
|
|
|
"DSDEVID_DefaultPlayback) failed: %08x\n", rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==DS_OK && dsfdo)
|
|
|
|
IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
|
|
|
|
|
|
|
|
/* try with default voice devices specified */
|
|
|
|
rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultVoiceCapture,
|
|
|
|
&DSDEVID_DefaultVoicePlayback,
|
|
|
|
&DSCBufferDesc,&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE,
|
|
|
|
&dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL);
|
2006-01-25 13:15:25 +01:00
|
|
|
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL,
|
2006-01-17 16:19:14 +01:00
|
|
|
"DirectSoundFullDuplexCreate(DSDEVID_DefaultVoiceCapture,"
|
2008-07-08 17:49:20 +02:00
|
|
|
"DSDEVID_DefaultVoicePlayback) failed: %08x\n", rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==DS_OK && dsfdo)
|
|
|
|
IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
|
|
|
|
|
|
|
|
/* try with bad devices specified */
|
|
|
|
rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultVoicePlayback,
|
|
|
|
&DSDEVID_DefaultVoiceCapture,
|
|
|
|
&DSCBufferDesc,&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE,
|
|
|
|
&dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL);
|
2006-01-25 13:15:25 +01:00
|
|
|
ok(rc==DSERR_NODRIVER||rc==DSERR_INVALIDCALL,
|
2006-01-17 16:19:14 +01:00
|
|
|
"DirectSoundFullDuplexCreate(DSDEVID_DefaultVoicePlayback,"
|
2008-07-08 17:49:20 +02:00
|
|
|
"DSDEVID_DefaultVoiceCapture) should have failed: %08x\n", rc);
|
2006-01-17 16:19:14 +01:00
|
|
|
if (rc==DS_OK && dsfdo)
|
|
|
|
IDirectSoundFullDuplex_Release(dsfdo);
|
|
|
|
}
|
|
|
|
|
2012-08-16 01:24:23 +02:00
|
|
|
static void test_COM(void)
|
|
|
|
{
|
|
|
|
IDirectSoundFullDuplex *dsfd = (IDirectSoundFullDuplex*)0xdeadbeef;
|
|
|
|
IDirectSound *ds;
|
|
|
|
IDirectSound8 *ds8;
|
|
|
|
IDirectSoundCapture *dsc;
|
|
|
|
IUnknown *unk, *unk8;
|
|
|
|
IDirectSoundBuffer8 *dsb8;
|
|
|
|
IDirectSoundCaptureBuffer8 *dscb8;
|
|
|
|
DSBUFFERDESC bufdesc;
|
|
|
|
DSCBUFFERDESC cbufdesc;
|
|
|
|
WAVEFORMATEX wfx;
|
|
|
|
ULONG refcount;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
/* COM aggregation */
|
2017-04-25 13:49:06 +02:00
|
|
|
hr = CoCreateInstance(&CLSID_DirectSoundFullDuplex, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER,
|
2012-08-16 01:24:23 +02:00
|
|
|
&IID_IUnknown, (void**)&dsfd);
|
|
|
|
ok(hr == CLASS_E_NOAGGREGATION,
|
|
|
|
"DirectSoundFullDuplex create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
|
|
|
|
ok(!dsfd, "dsfd = %p\n", dsfd);
|
|
|
|
|
|
|
|
/* Invalid RIID */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectSound3DBuffer, (void**)&dsfd);
|
|
|
|
ok(hr == E_NOINTERFACE,
|
|
|
|
"DirectSoundFullDuplex create failed: %08x, expected E_NOINTERFACE\n", hr);
|
|
|
|
|
|
|
|
/* Different refcount for IDirectSoundFullDuplex and for IUnknown */
|
|
|
|
hr = CoCreateInstance(&CLSID_DirectSoundFullDuplex, NULL, CLSCTX_INPROC_SERVER,
|
|
|
|
&IID_IDirectSoundFullDuplex, (void**)&dsfd);
|
|
|
|
ok(hr == S_OK, "DirectSoundFullDuplex create failed: %08x, expected S_OK\n", hr);
|
|
|
|
refcount = IDirectSoundFullDuplex_AddRef(dsfd);
|
|
|
|
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
hr = IDirectSoundFullDuplex_QueryInterface(dsfd, &IID_IUnknown, (void**)&unk);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
|
|
|
refcount = IUnknown_AddRef(unk);
|
|
|
|
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
|
|
|
|
/* Not initialized */
|
|
|
|
hr = IDirectSoundFullDuplex_QueryInterface(dsfd, &IID_IDirectSound8, (void**)&ds8);
|
|
|
|
ok(hr == E_NOINTERFACE,
|
|
|
|
"QueryInterface for IID_IDirectSound8 failed: %08x, expected E_NOINTERFACE\n", hr);
|
|
|
|
hr = IDirectSoundFullDuplex_QueryInterface(dsfd, &IID_IDirectSoundCapture, (void**)&dsc);
|
|
|
|
ok(hr == E_NOINTERFACE,
|
|
|
|
"QueryInterface for IID_IDirectSoundCapture failed: %08x, expected E_NOINTERFACE\n", hr);
|
|
|
|
|
|
|
|
init_format(&wfx, WAVE_FORMAT_PCM, 44100, 16, 1);
|
|
|
|
ZeroMemory(&bufdesc, sizeof(bufdesc));
|
|
|
|
bufdesc.dwSize = sizeof(bufdesc);
|
|
|
|
bufdesc.dwBufferBytes = wfx.nAvgBytesPerSec;
|
|
|
|
bufdesc.lpwfxFormat = &wfx;
|
|
|
|
ZeroMemory(&cbufdesc, sizeof(cbufdesc));
|
|
|
|
cbufdesc.dwSize = sizeof(cbufdesc);
|
|
|
|
cbufdesc.dwBufferBytes = wfx.nAvgBytesPerSec;
|
|
|
|
cbufdesc.lpwfxFormat = &wfx;
|
2012-08-16 01:30:16 +02:00
|
|
|
hr = IDirectSoundFullDuplex_Initialize(dsfd, NULL, NULL, &cbufdesc, &bufdesc, get_hwnd(),
|
|
|
|
DSSCL_EXCLUSIVE, NULL, NULL);
|
|
|
|
ok(hr == E_INVALIDARG,
|
|
|
|
"IDirectSoundFullDuplex_Initialize failed: %08x, expected E_INVALIDARG\n", hr);
|
2012-08-16 01:24:23 +02:00
|
|
|
hr = IDirectSoundFullDuplex_Initialize(dsfd, NULL, NULL, &cbufdesc, &bufdesc, get_hwnd(),
|
|
|
|
DSSCL_EXCLUSIVE, &dscb8, &dsb8);
|
2012-09-17 21:08:05 +02:00
|
|
|
if (hr == DSERR_NODRIVER || hr == DSERR_INVALIDCALL) {
|
2012-08-16 01:24:23 +02:00
|
|
|
skip("No driver\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(hr == S_OK, "IDirectSoundFullDuplex_Initialize failed: %08x\n", hr);
|
|
|
|
|
|
|
|
/* IDirectSound and IDirectSound8 */
|
|
|
|
hr = IDirectSoundFullDuplex_QueryInterface(dsfd, &IID_IDirectSound8, (void**)&ds8);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IDirectSound8 failed: %08x\n", hr);
|
|
|
|
refcount = IDirectSound8_AddRef(ds8);
|
|
|
|
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
hr = IDirectSoundFullDuplex_QueryInterface(dsfd, &IID_IDirectSound, (void**)&ds);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IDirectSound failed: %08x\n", hr);
|
|
|
|
refcount = IDirectSound8_AddRef(ds8);
|
|
|
|
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
|
|
|
|
refcount = IDirectSound_AddRef(ds);
|
|
|
|
ok(refcount == 5, "refcount == %u, expected 5\n", refcount);
|
|
|
|
hr = IDirectSound8_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
|
|
|
ok(unk == unk8, "Got different IUnknown when QI'ing IDirectSoundFullDuplex and IDirectSound\n");
|
|
|
|
refcount = IUnknown_AddRef(unk8);
|
|
|
|
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
|
|
|
|
refcount = IDirectSound_AddRef(ds);
|
|
|
|
ok(refcount == 6, "refcount == %u, expected 6\n", refcount);
|
|
|
|
refcount = IDirectSoundFullDuplex_AddRef(dsfd);
|
|
|
|
ok(refcount == 3, "refcount == %u, expected 3\n", refcount);
|
|
|
|
|
|
|
|
/* IDirectSoundCapture */
|
|
|
|
hr = IDirectSoundFullDuplex_QueryInterface(dsfd, &IID_IDirectSoundCapture, (void**)&dsc);
|
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IDirectSoundCapture failed: %08x\n", hr);
|
|
|
|
refcount = IDirectSoundCapture_AddRef(dsc);
|
|
|
|
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
|
|
|
|
refcount = IDirectSoundFullDuplex_AddRef(dsfd);
|
|
|
|
ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
|
2018-03-30 07:05:28 +02:00
|
|
|
hr = IDirectSound8_QueryInterface(ds8, &IID_IUnknown, (void**)&unk8);
|
2012-08-16 01:24:23 +02:00
|
|
|
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
|
|
|
|
ok(unk == unk8,
|
|
|
|
"Got different IUnknown when QI'ing IDirectSoundFullDuplex and IDirectSoundCapture\n");
|
|
|
|
refcount = IUnknown_AddRef(unk8);
|
|
|
|
ok(refcount == 6, "refcount == %u, expected 6\n", refcount);
|
|
|
|
|
|
|
|
IDirectSoundBuffer8_Release(dsb8);
|
|
|
|
IDirectSoundCaptureBuffer8_Release(dscb8);
|
|
|
|
while (IDirectSound8_Release(ds8));
|
|
|
|
while (IDirectSoundCapture_Release(dsc));
|
|
|
|
while (IDirectSoundFullDuplex_Release(dsfd));
|
|
|
|
while (IUnknown_Release(unk));
|
|
|
|
}
|
|
|
|
|
2006-01-17 16:19:14 +01:00
|
|
|
START_TEST(duplex)
|
|
|
|
{
|
|
|
|
HMODULE hDsound;
|
|
|
|
|
|
|
|
CoInitialize(NULL);
|
|
|
|
|
2013-10-01 23:09:53 +02:00
|
|
|
hDsound = LoadLibraryA("dsound.dll");
|
2007-01-15 15:00:39 +01:00
|
|
|
if (hDsound)
|
2006-01-17 16:19:14 +01:00
|
|
|
{
|
|
|
|
|
2007-01-15 15:00:39 +01:00
|
|
|
pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound,
|
|
|
|
"DirectSoundFullDuplexCreate");
|
2012-08-16 01:24:23 +02:00
|
|
|
if (pDirectSoundFullDuplexCreate) {
|
|
|
|
test_COM();
|
2007-01-15 15:00:39 +01:00
|
|
|
IDirectSoundFullDuplex_tests();
|
2012-08-16 01:24:23 +02:00
|
|
|
} else
|
2012-08-13 00:15:33 +02:00
|
|
|
skip("DirectSoundFullDuplexCreate missing - skipping all tests\n");
|
2007-01-15 15:00:39 +01:00
|
|
|
|
|
|
|
FreeLibrary(hDsound);
|
|
|
|
}
|
|
|
|
else
|
2012-08-13 00:15:33 +02:00
|
|
|
skip("dsound.dll not found - skipping all tests\n");
|
2006-01-17 16:19:14 +01:00
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
}
|