- 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

svn path=/trunk/; revision=43933
This commit is contained in:
Johannes Anderwald 2009-11-03 18:54:52 +00:00
parent 489e5eb856
commit e788e7f084
5 changed files with 116 additions and 14 deletions

View file

@ -107,7 +107,7 @@ CDirectSoundCapture_fnCreateCaptureBuffer(
/* 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 @@ NewDirectSoundCapture(
{
*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;
}

View file

@ -15,6 +15,7 @@ typedef struct
LONG ref;
GUID DeviceGUID;
BOOL bInitialized;
BOOL bDirectSound8;
DWORD dwLevel;
LPFILTERINFO Filter;
LPDIRECTSOUNDBUFFER8 PrimaryBuffer;
@ -32,10 +33,9 @@ IDirectSound8_fnQueryInterface(
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 @@ IDirectSound8_fnGetCaps(
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 @@ WINAPI
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 @@ IDirectSound8_fnGetSpeakerConfig(
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 @@ IDirectSound8_fnInitialize(
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 @@ IDirectSound8_fnInitialize(
if (SUCCEEDED(hr))
{
This->bInitialized = TRUE;
return DS_OK;
return DS_OK;
}
DPRINT("Failed to find device\n");
@ -331,7 +380,8 @@ HRESULT
InternalDirectSoundCreate(
LPCGUID lpcGUID,
LPDIRECTSOUND8 *ppDS,
IUnknown *pUnkOuter)
IUnknown *pUnkOuter,
BOOL bDirectSound8)
{
LPCDirectSoundImpl This;
HRESULT hr;
@ -352,6 +402,7 @@ InternalDirectSoundCreate(
/* initialize IDirectSound object */
This->ref = 1;
This->bDirectSound8 = bDirectSound8;
This->lpVtbl = &vt_DirectSound8;
@ -373,6 +424,44 @@ InternalDirectSoundCreate(
return DS_OK;
}
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(
@ -380,7 +469,7 @@ DirectSoundCreate(
LPDIRECTSOUND *ppDS,
IUnknown *pUnkOuter)
{
return InternalDirectSoundCreate(lpcGUID, (LPDIRECTSOUND8*)ppDS, pUnkOuter);
return InternalDirectSoundCreate(lpcGUID, (LPDIRECTSOUND8*)ppDS, pUnkOuter, FALSE);
}
HRESULT
@ -390,5 +479,5 @@ DirectSoundCreate8(
LPDIRECTSOUND8 *ppDS,
IUnknown *pUnkOuter)
{
return InternalDirectSoundCreate(lpcGUID, ppDS, pUnkOuter);
return InternalDirectSoundCreate(lpcGUID, ppDS, pUnkOuter, TRUE);
}

View file

@ -22,6 +22,10 @@ static INTERFACE_TABLE InterfaceTable[] =
&CLSID_DirectSoundCapture,
NewDirectSoundCapture
},
{
&CLSID_DirectSound,
NewDirectSound
},
{
NULL,
NULL

View file

@ -464,12 +464,12 @@ CreateCompatiblePin(
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)
{

View file

@ -98,6 +98,15 @@ GetPinIdFromFilter(
BOOL bCapture,
ULONG Offset);
/* directsound.c */
HRESULT
CALLBACK
NewDirectSound(
IUnknown* pUnkOuter,
REFIID riid,
LPVOID* ppvObject);
/* misc.c */