[MMDEVAPI] Sync with Wine Staging 1.7.37. CORE-9246

svn path=/trunk/; revision=67085
This commit is contained in:
Amine Khaldi 2015-04-08 17:10:40 +00:00
parent de68cb4069
commit 05597627e0
6 changed files with 107 additions and 19 deletions

View file

@ -23,4 +23,5 @@ set_module_type(mmdevapi win32dll)
target_link_libraries(mmdevapi uuid wine)
add_importlibs(mmdevapi ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll)
add_pch(mmdevapi mmdevapi.h SOURCE)
add_dependencies(mmdevapi dxsdk)
add_cd_file(TARGET mmdevapi DESTINATION reactos/system32 FOR all)

View file

@ -23,6 +23,8 @@ static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl;
typedef struct AEVImpl {
IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface;
LONG ref;
float level;
BOOL mute;
} AEVImpl;
static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *iface)
@ -39,6 +41,8 @@ HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
return E_OUTOFMEMORY;
This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
This->ref = 1;
This->level = 1.0f;
This->mute = FALSE;
return S_OK;
}
@ -112,9 +116,13 @@ static HRESULT WINAPI AEV_GetChannelCount(IAudioEndpointVolumeEx *iface, UINT *c
static HRESULT WINAPI AEV_SetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float leveldb, const GUID *ctx)
{
TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
FIXME("stub\n");
return E_NOTIMPL;
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
FIXME("(%p)->(%f,%s): stub\n", iface, leveldb, debugstr_guid(ctx));
This->level = leveldb;
return S_OK;
}
static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float level, const GUID *ctx)
@ -126,11 +134,16 @@ static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *ifa
static HRESULT WINAPI AEV_GetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float *leveldb)
{
TRACE("(%p)->(%p)\n", iface, leveldb);
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
FIXME("(%p)->(%p): stub\n", iface, leveldb);
if (!leveldb)
return E_POINTER;
FIXME("stub\n");
return E_NOTIMPL;
*leveldb = This->level;
return S_OK;
}
static HRESULT WINAPI AEV_GetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float *level)
@ -176,18 +189,27 @@ static HRESULT WINAPI AEV_GetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *if
static HRESULT WINAPI AEV_SetMute(IAudioEndpointVolumeEx *iface, BOOL mute, const GUID *ctx)
{
TRACE("(%p)->(%u,%s)\n", iface, mute, debugstr_guid(ctx));
FIXME("stub\n");
return E_NOTIMPL;
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
FIXME("(%p)->(%u,%s): stub\n", iface, mute, debugstr_guid(ctx));
This->mute = mute;
return S_OK;
}
static HRESULT WINAPI AEV_GetMute(IAudioEndpointVolumeEx *iface, BOOL *mute)
{
TRACE("(%p)->(%p)\n", iface, mute);
AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
FIXME("(%p)->(%p): stub\n", iface, mute);
if (!mute)
return E_POINTER;
FIXME("stub\n");
return E_NOTIMPL;
*mute = This->mute;
return S_OK;
}
static HRESULT WINAPI AEV_GetVolumeStepInfo(IAudioEndpointVolumeEx *iface, UINT *stepsize, UINT *stepcount)
@ -224,11 +246,16 @@ static HRESULT WINAPI AEV_QueryHardwareSupport(IAudioEndpointVolumeEx *iface, DW
static HRESULT WINAPI AEV_GetVolumeRange(IAudioEndpointVolumeEx *iface, float *mindb, float *maxdb, float *inc)
{
TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
FIXME("(%p)->(%p,%p,%p): stub\n", iface, mindb, maxdb, inc);
if (!mindb || !maxdb || !inc)
return E_POINTER;
FIXME("stub\n");
return E_NOTIMPL;
*mindb = 0.0f;
*maxdb = 1.0f;
*inc = 0.1f;
return S_OK;
}
static HRESULT WINAPI AEV_GetVolumeRangeChannel(IAudioEndpointVolumeEx *iface, UINT chan, float *mindb, float *maxdb, float *inc)

View file

@ -246,6 +246,25 @@ static HRESULT MMDevice_SetPropValue(const GUID *devguid, DWORD flow, REFPROPERT
return hr;
}
static HRESULT set_driver_prop_value(GUID *id, const EDataFlow flow, const PROPERTYKEY *prop)
{
HRESULT hr;
PROPVARIANT pv;
if (!drvs.pGetPropValue)
return E_NOTIMPL;
hr = drvs.pGetPropValue(id, prop, &pv);
if (SUCCEEDED(hr))
{
MMDevice_SetPropValue(id, flow, prop, &pv);
PropVariantClear(&pv);
}
return hr;
}
/* Creates or updates the state of a device
* If GUID is null, a random guid will be assigned
* and the device will be created
@ -261,6 +280,10 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st
{0x233164c8, 0x1b2c, 0x4c7d, {0xbc, 0x68, 0xb6, 0x71, 0x68, 0x7a, 0x25, 0x67}}, 1
};
static const PROPERTYKEY devicepath_key = {
{0xb3f8fa53, 0x0004, 0x438e, {0x90, 0x03, 0x51, 0xa4, 0x6e, 0x13, 0x9b, 0xfc}}, 2
};
for (i = 0; i < MMDevice_count; ++i)
{
MMDevice *device = MMDevice_head[i];
@ -320,6 +343,29 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st
pv.u.pwszVal = guidstr;
MMDevice_SetPropValue(id, flow, &deviceinterface_key, &pv);
set_driver_prop_value(id, flow, &devicepath_key);
if (FAILED(set_driver_prop_value(id, flow, &PKEY_AudioEndpoint_FormFactor)))
{
pv.vt = VT_UI4;
pv.u.ulVal = (flow == eCapture) ? Microphone : Speakers;
MMDevice_SetPropValue(id, flow, &PKEY_AudioEndpoint_FormFactor, &pv);
}
if (flow != eCapture)
{
PROPVARIANT pv2;
PropVariantInit(&pv2);
/* make read-write by not overwriting if already set */
if (FAILED(MMDevice_GetPropValue(id, flow, &PKEY_AudioEndpoint_PhysicalSpeakers, &pv2)) || pv2.vt != VT_UI4)
set_driver_prop_value(id, flow, &PKEY_AudioEndpoint_PhysicalSpeakers);
PropVariantClear(&pv2);
}
RegCloseKey(keyprop);
}
RegCloseKey(key);
@ -1405,8 +1451,17 @@ static HRESULT WINAPI MMDevPropStore_SetValue(IPropertyStore *iface, REFPROPERTY
static HRESULT WINAPI MMDevPropStore_Commit(IPropertyStore *iface)
{
FIXME("stub\n");
return E_NOTIMPL;
MMDevPropStore *This = impl_from_IPropertyStore(iface);
TRACE("(%p)\n", iface);
if (This->access != STGM_WRITE
&& This->access != STGM_READWRITE)
return STG_E_ACCESSDENIED;
/* Does nothing - for mmdevapi, the propstore values are written on SetValue,
* not on Commit. */
return S_OK;
}
static const IPropertyStoreVtbl MMDevPropVtbl =

View file

@ -70,6 +70,9 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
LDFC(GetAudioSessionManager);
#undef LDFC
/* optional - do not fail if not found */
driver->pGetPropValue = (void*)GetProcAddress(driver->module, "GetPropValue");
driver->priority = driver->pGetPriority();
lstrcpyW(driver->module_name, driver_module);
@ -83,7 +86,7 @@ static BOOL init_driver(void)
{
static const WCHAR drv_value[] = {'A','u','d','i','o',0};
static WCHAR default_list[] = {'a','l','s','a',',','o','s','s',',',
static WCHAR default_list[] = {'p','u','l','s','e',',','a','l','s','a',',','o','s','s',',',
'c','o','r','e','a','u','d','i','o',0};
DriverFuncs driver;

View file

@ -79,6 +79,8 @@ typedef struct _DriverFuncs {
IAudioClient **out);
HRESULT (WINAPI *pGetAudioSessionManager)(IMMDevice *device,
IAudioSessionManager2 **out);
HRESULT (WINAPI *pGetPropValue)(GUID *guid,
const PROPERTYKEY *prop, PROPVARIANT *out);
} DriverFuncs;
extern DriverFuncs drvs DECLSPEC_HIDDEN;

View file

@ -108,7 +108,7 @@ reactos/dll/win32/mciseq # Synced to WineStaging-1.7.37
reactos/dll/win32/mciwave # Synced to WineStaging-1.7.37
reactos/dll/win32/mgmtapi # Synced to Wine-1.7.27
reactos/dll/win32/mlang # Synced to WineStaging-1.7.37
reactos/dll/win32/mmdevapi # Synced to Wine-1.7.27
reactos/dll/win32/mmdevapi # Synced to WineStaging-1.7.37
reactos/dll/win32/mpr # Synced to Wine-1.7.27
reactos/dll/win32/mprapi # Synced to Wine-1.7.27
reactos/dll/win32/msacm32 # Synced to Wine-1.7.27