How should I correctly set the MFPKEY_WMRESAMP_CHANNELMTX property of the Audio Resampler DSP?

Neal Mayer 1 Reputation point
2021-06-14T22:36:27.74+00:00

I am creating a Audio Resampler DSP transform node in a Media Foundation topology. When I try to set the MFPKEY_WMRESAMP_CHANNELMTX property I get an error: 0xc00d6d6b : The property value is out of range for this transform.

Here is my code:

HRESULT hr;
IMFTransform* pResamplerMFT = nullptr;
IPropertyStore* pResamplerProperties = nullptr;
CoCreateInstance(CLSID_CResamplerMediaObject, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&pResamplerMFT);
pResamplerMFT->QueryInterface(IID_PPV_ARGS(&pResamplerProperties));

SAFEARRAY* pMixMatrix = SafeArrayCreateVector(VT_I4, 0, 4); // VT_I4 is a signed integer, i.e. INT32
for (long i = 0; i < 4; i++)
{
INT32 temp = 65536;
hr = SafeArrayPutElement(pMixMatrix, &i, &temp);
}
PROPVARIANT propVar;
propVar.vt = VT_I4 | VT_ARRAY;
propVar.parray = pMixMatrix;
hr = pResamplerProperties->SetValue(MFPKEY_WMRESAMP_CHANNELMTX, propVar);
// hr = 0xc00d6d6b : The property value is out of range for this transform.

(Note: The INT32 values in the SAFEARRAY are just place holders for now until I can get this code working.)

I tried using IWMResamplerProps::SetUserChannelMtx but that returned E_FAIL.

I have spent 3 days searching the web for any code examples of using this transform and setting this property and have found nothing.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,412 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,518 questions
{count} votes