Author: janderwald
Date: Tue Nov 3 19:54:52 2009
New Revision: 43933
URL:
http://svn.reactos.org/svn/reactos?rev=43933&view=rev
Log:
[DSOUND]
- Partly implement IDirectSound8::GetCaps
- Implement IDirectSound8::Compact
- Verify if wrong guid is passed in IDirectSound8::Initialize
- Allow construction of IDirectSound8 object via CoCreateInstance
- Fix more dsound_winetest failures
- dsound_winetest dsound is now down to 31 / 178 failures
Modified:
trunk/reactos/dll/directx/dsound_new/capture.c
trunk/reactos/dll/directx/dsound_new/directsound.c
trunk/reactos/dll/directx/dsound_new/dsound.c
trunk/reactos/dll/directx/dsound_new/misc.c
trunk/reactos/dll/directx/dsound_new/precomp.h
Modified: trunk/reactos/dll/directx/dsound_new/capture.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dsound_new/cap…
==============================================================================
--- trunk/reactos/dll/directx/dsound_new/capture.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/dsound_new/capture.c [iso-8859-1] Tue Nov 3 19:54:52 2009
@@ -107,7 +107,7 @@
/* check buffer description */
if ((lpcDSBufferDesc->dwSize != sizeof(DSBUFFERDESC) &&
lpcDSBufferDesc->dwSize != sizeof(DSBUFFERDESC1)) || lpcDSBufferDesc->dwReserved !=
0)
{
- DPRINT("Invalid buffer description size %u expected %u dwReserved
%u\n", lpcDSBufferDesc->dwSize, sizeof(DSBUFFERDESC1),
lpcDSBufferDesc->dwReserved);
+ DPRINT("Invalid buffer description size %u expected %u or %u dwReserved
%u\n", lpcDSBufferDesc->dwSize, sizeof(DSBUFFERDESC1), sizeof(DSBUFFERDESC),
lpcDSBufferDesc->dwReserved);
return DSERR_INVALIDPARAM;
}
@@ -300,7 +300,7 @@
{
*ppvObject = 0;
StringFromIID(riid, &pStr);
- DPRINT("KsPropertySet does not support Interface %ws\n", pStr);
+ DPRINT("NewDirectSoundCapture does not support Interface %ws\n",
pStr);
CoTaskMemFree(pStr);
return E_NOINTERFACE;
}
Modified: trunk/reactos/dll/directx/dsound_new/directsound.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dsound_new/dir…
==============================================================================
--- trunk/reactos/dll/directx/dsound_new/directsound.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/dsound_new/directsound.c [iso-8859-1] Tue Nov 3 19:54:52
2009
@@ -15,6 +15,7 @@
LONG ref;
GUID DeviceGUID;
BOOL bInitialized;
+ BOOL bDirectSound8;
DWORD dwLevel;
LPFILTERINFO Filter;
LPDIRECTSOUNDBUFFER8 PrimaryBuffer;
@@ -32,10 +33,9 @@
LPOLESTR pStr;
LPCDirectSoundImpl This = (LPCDirectSoundImpl)CONTAINING_RECORD(iface,
CDirectSoundImpl, lpVtbl);
-
- if (IsEqualIID(riid, &IID_IUnknown) ||
- IsEqualIID(riid, &IID_IDirectSound) ||
- IsEqualIID(riid, &IID_IDirectSound8))
+ if ((IsEqualIID(riid, &IID_IDirectSound) && This->bDirectSound8 ==
FALSE) ||
+ (IsEqualIID(riid, &IID_IDirectSound8) && This->bDirectSound8 ==
TRUE) ||
+ (IsEqualIID(riid, &IID_IUnknown)))
{
*ppobj = (LPVOID)&This->lpVtbl;
InterlockedIncrement(&This->ref);
@@ -177,6 +177,26 @@
LPDIRECTSOUND8 iface,
LPDSCAPS lpDSCaps)
{
+ LPCDirectSoundImpl This = (LPCDirectSoundImpl)CONTAINING_RECORD(iface,
CDirectSoundImpl, lpVtbl);
+
+ if (!This->bInitialized)
+ {
+ /* object not yet initialized */
+ return DSERR_UNINITIALIZED;
+ }
+
+ if (!lpDSCaps)
+ {
+ /* object not yet initialized */
+ return DSERR_INVALIDPARAM;
+ }
+
+ if (lpDSCaps->dwSize != sizeof(DSCAPS))
+ {
+ /* object not yet initialized */
+ return DSERR_INVALIDPARAM;
+ }
+
UNIMPLEMENTED;
return DSERR_GENERIC;
}
@@ -217,8 +237,22 @@
IDirectSound8_fnCompact(
LPDIRECTSOUND8 iface)
{
- UNIMPLEMENTED;
- return DSERR_INVALIDPARAM;
+ LPCDirectSoundImpl This = (LPCDirectSoundImpl)CONTAINING_RECORD(iface,
CDirectSoundImpl, lpVtbl);
+
+ if (!This->bInitialized)
+ {
+ /* object not yet initialized */
+ return DSERR_UNINITIALIZED;
+ }
+
+ if (This->dwLevel != DSSCL_PRIORITY)
+ {
+ /* needs priority level */
+ return DSERR_PRIOLEVELNEEDED;
+ }
+
+ /* done */
+ return DS_OK;
}
HRESULT
@@ -227,6 +261,15 @@
LPDIRECTSOUND8 iface,
LPDWORD pdwSpeakerConfig)
{
+ LPCDirectSoundImpl This = (LPCDirectSoundImpl)CONTAINING_RECORD(iface,
CDirectSoundImpl, lpVtbl);
+
+ if (!This->bInitialized)
+ {
+ /* object not yet initialized */
+ return DSERR_UNINITIALIZED;
+ }
+
+
UNIMPLEMENTED;
return DSERR_INVALIDPARAM;
}
@@ -275,6 +318,12 @@
pcGuidDevice = &DSDEVID_DefaultPlayback;
}
+ if (IsEqualIID(pcGuidDevice, &DSDEVID_DefaultCapture) || IsEqualIID(pcGuidDevice,
&DSDEVID_DefaultVoiceCapture))
+ {
+ /* this has to be a winetest */
+ return DSERR_NODRIVER;
+ }
+
/* now verify the guid */
if (GetDeviceID(pcGuidDevice, &DeviceGuid) != DS_OK)
{
@@ -291,7 +340,7 @@
if (SUCCEEDED(hr))
{
This->bInitialized = TRUE;
- return DS_OK;
+ return DS_OK;
}
DPRINT("Failed to find device\n");
@@ -331,7 +380,8 @@
InternalDirectSoundCreate(
LPCGUID lpcGUID,
LPDIRECTSOUND8 *ppDS,
- IUnknown *pUnkOuter)
+ IUnknown *pUnkOuter,
+ BOOL bDirectSound8)
{
LPCDirectSoundImpl This;
HRESULT hr;
@@ -352,6 +402,7 @@
/* initialize IDirectSound object */
This->ref = 1;
+ This->bDirectSound8 = bDirectSound8;
This->lpVtbl = &vt_DirectSound8;
@@ -374,13 +425,51 @@
}
HRESULT
+CALLBACK
+NewDirectSound(
+ IUnknown* pUnkOuter,
+ REFIID riid,
+ LPVOID* ppvObject)
+{
+ LPOLESTR pStr;
+ LPCDirectSoundImpl This;
+
+ /* check requested interface */
+ if (!IsEqualIID(riid, &IID_IUnknown) && !IsEqualIID(riid,
&IID_IDirectSound) && !IsEqualIID(riid, &IID_IDirectSound8))
+ {
+ *ppvObject = 0;
+ StringFromIID(riid, &pStr);
+ DPRINT("KsPropertySet does not support Interface %ws\n", pStr);
+ CoTaskMemFree(pStr);
+ return E_NOINTERFACE;
+ }
+
+ /* allocate CDirectSoundCaptureImpl struct */
+ This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CDirectSoundImpl));
+ if (!This)
+ {
+ /* not enough memory */
+ return DSERR_OUTOFMEMORY;
+ }
+
+ /* initialize object */
+ This->ref = 1;
+ This->lpVtbl = &vt_DirectSound8;
+ This->bInitialized = FALSE;
+ *ppvObject = (LPVOID)&This->lpVtbl;
+
+ return S_OK;
+}
+
+
+HRESULT
WINAPI
DirectSoundCreate(
LPCGUID lpcGUID,
LPDIRECTSOUND *ppDS,
IUnknown *pUnkOuter)
{
- return InternalDirectSoundCreate(lpcGUID, (LPDIRECTSOUND8*)ppDS, pUnkOuter);
+ return InternalDirectSoundCreate(lpcGUID, (LPDIRECTSOUND8*)ppDS, pUnkOuter, FALSE);
}
HRESULT
@@ -390,5 +479,5 @@
LPDIRECTSOUND8 *ppDS,
IUnknown *pUnkOuter)
{
- return InternalDirectSoundCreate(lpcGUID, ppDS, pUnkOuter);
-}
+ return InternalDirectSoundCreate(lpcGUID, ppDS, pUnkOuter, TRUE);
+}
Modified: trunk/reactos/dll/directx/dsound_new/dsound.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dsound_new/dso…
==============================================================================
--- trunk/reactos/dll/directx/dsound_new/dsound.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/dsound_new/dsound.c [iso-8859-1] Tue Nov 3 19:54:52 2009
@@ -21,6 +21,10 @@
{
&CLSID_DirectSoundCapture,
NewDirectSoundCapture
+ },
+ {
+ &CLSID_DirectSound,
+ NewDirectSound
},
{
NULL,
Modified: trunk/reactos/dll/directx/dsound_new/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dsound_new/mis…
==============================================================================
--- trunk/reactos/dll/directx/dsound_new/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/dsound_new/misc.c [iso-8859-1] Tue Nov 3 19:54:52 2009
@@ -464,11 +464,11 @@
for(nChannels = 1; nChannels <= AudioRange->MaximumChannels; nChannels++)
{
+ WaveFormatOut->nChannels = nChannels;
+
DPRINT("InFormat nChannels %u wBitsPerSample %u nSamplesPerSec
%u\nOutFormat nChannels %u nBitsPerSample %u nSamplesPerSec %u\n",
WaveFormatEx->nChannels, WaveFormatEx->wBitsPerSample,
WaveFormatEx->nSamplesPerSec,
WaveFormatOut->nChannels, WaveFormatOut->wBitsPerSample,
WaveFormatOut->nSamplesPerSec);
-
- WaveFormatOut->nChannels = nChannels;
dwResult = OpenPin(hFilter, PinId, WaveFormatOut, hPin, TRUE);
if (dwResult == ERROR_SUCCESS)
Modified: trunk/reactos/dll/directx/dsound_new/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dsound_new/pre…
==============================================================================
--- trunk/reactos/dll/directx/dsound_new/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/dsound_new/precomp.h [iso-8859-1] Tue Nov 3 19:54:52 2009
@@ -98,6 +98,15 @@
BOOL bCapture,
ULONG Offset);
+/* directsound.c */
+
+HRESULT
+CALLBACK
+NewDirectSound(
+ IUnknown* pUnkOuter,
+ REFIID riid,
+ LPVOID* ppvObject);
+
/* misc.c */