spierce7
10/24/2022, 6:59 AMspierce7
10/24/2022, 7:00 AMmemScoped {
var hr: HRESULT = S_OK
val attribute : CPointerVarOf<CPointer<IMFAttributes>> = alloc()
val devices: CPointerVarOf<CPointer<CPointerVarOf<CPointer<IMFActivate>>>> = alloc()
val devicesCount: UINT32Var = alloc()
hr = MFCreateAttributes(attribute.ptr, 1)
if (hr == S_OK) {
hr = attribute.value!!.pointed.lpVtbl!!.pointed.SetGUID!!.invoke(
attribute.value,
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE.ptr,
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_GUID.ptr,
)
}
if (hr == S_OK) {
hr = MFEnumDeviceSources(attribute.value, devices.ptr, devicesCount.ptr)
} else {
println("MFEnumDeviceSources was not called")
}
println("Audio Device Count: ${devicesCount.value}")
}
Always returns 0 devices. The final MFEnumDeviceSources
call is returning an error, I’m working on trying to get the error.spierce7
10/24/2022, 7:05 AMHRESULT hr = S_OK;
IMFAttributes *pAttributes = NULL;
// Initialize an attribute store to specify enumeration parameters.
hr = MFCreateAttributes(&pAttributes, 1);
// Ask for source type = audio capture devices
if (SUCCEEDED(hr))
{
// Set the device attribute.
hr = pAttributes->SetGUID(
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_GUID
);
}
// Enumerate devices.
if (SUCCEEDED(hr))
{
// Enumerate the device list.
hr = MFEnumDeviceSources(pAttributes, &(*param).ppDevices, &(*param).count);
}
// Safe release.
SafeRelease(&pAttributes);