none
VAD_NORMAL fails with FEATURE_MODE enabled RRS feed

  • Question

  • Hello,

    I was trying to use the VAD in Kinect. I have tried both source mode and filter mode. I enabled the feature mode as well. The following is one of the settings I have tried:

     

    HRESULT hr = S_OK;
        CoInitialize(NULL);
        IMediaObject* pDMO = NULL;  
        IPropertyStore* pPS = NULL;
        IMFTransform* pMFT = NULL;
        HANDLE mmHandle = NULL;
        DWORD mmTaskIndex = 0;
        LPCTSTR szOutputFile = _T("MFAudioFilter.wma");
    
        // Set high priority to avoid getting preempted while capturing sound
        mmHandle = AvSetMmThreadCharacteristics(L"Audio", &mmTaskIndex);
        CHECK_BOOL(mmHandle != NULL, "failed to set thread priority\n");
    
        // DMO initialization
        CHECKHR(CoCreateInstance(CLSID_CMSRKinectAudio, NULL, CLSCTX_INPROC_SERVER, IID_IMediaObject, (void**)&pDMO));
        CHECKHR(pDMO->QueryInterface(IID_IPropertyStore, (void**)&pPS));
        CHECKHR(pDMO->QueryInterface(IID_IMFTransform, (void**)&pMFT));
    
        // Set MicArray DMO system mode with no echo cancellation.
        // This must be set for the DMO to work properly
        PROPVARIANT pvSysMode;
        PropVariantInit(&pvSysMode);
        pvSysMode.vt = VT_I4;
        //   SINGLE_CHANNEL_AEC = 0
        //   OPTIBEAM_ARRAY_ONLY = 2
        //   OPTIBEAM_ARRAY_AND_AEC = 4
        //   SINGLE_CHANNEL_NSAGC = 5
        pvSysMode.lVal = (LONG)(2);
        CHECKHR(pPS->SetValue(MFPKEY_WMAAECMA_SYSTEM_MODE, pvSysMode));
        PropVariantClear(&pvSysMode);
    
        // Put media object into filter mode so it can be used as a Media Foundation transform
        PROPVARIANT pvSourceMode;
        PropVariantInit(&pvSourceMode);    
        pvSourceMode.vt = VT_BOOL;
        pvSourceMode.boolVal = VARIANT_FALSE;
        CHECKHR(pPS->SetValue(MFPKEY_WMAAECMA_DMO_SOURCE_MODE, pvSourceMode));
    
        // geometry of input has to be specified in filter mode since media object can't
        // get it directly from driver as it does in source mode.
        PROPVARIANT pvGeometry;
        PropVariantInit(&pvGeometry);    
        pvGeometry.vt = VT_BLOB;
        pvGeometry.blob.cbSize = sizeof(maKinectGeometry);
        pvGeometry.blob.pBlobData = (BYTE*)&maKinectGeometry;
        CHECKHR(pPS->SetValue(MFPKEY_WMAAECMA_MICARRAY_DESCPTR, pvGeometry));
    
        // Turn on feature mode (required to change value of noise suppression and automatic gain control)
        PROPVARIANT pvFeatrModeOn;
        PropVariantInit(&pvFeatrModeOn);
        pvFeatrModeOn.vt = VT_BOOL;
        pvFeatrModeOn.boolVal = VARIANT_TRUE;
        CHECKHR(pPS->SetValue(MFPKEY_WMAAECMA_FEATURE_MODE, pvFeatrModeOn));
        PropVariantClear(&pvFeatrModeOn);
    
        // Turn on noise suppression
        PROPVARIANT pvNoiseSup;
        PropVariantInit(&pvNoiseSup);
        pvNoiseSup.vt = VT_I4;
        pvNoiseSup.lVal = 1;
        CHECKHR(pPS->SetValue(MFPKEY_WMAAECMA_FEATR_NS, pvNoiseSup));
        PropVariantClear(&pvNoiseSup);
    
        // Turn off AGC
        PROPVARIANT pvAGC;
        PropVariantInit(&pvAGC);
        pvAGC.vt = VT_BOOL;
        pvAGC.boolVal = VARIANT_FALSE;
        CHECKHR(pPS->SetValue(MFPKEY_WMAAECMA_FEATR_AGC, pvAGC));
        PropVariantClear(&pvAGC);
    
    	printf("setting vad mode\n");
    	// Turn on VAD
    	 PROPVARIANT pvNormalVAD;
        PropVariantInit(&pvNormalVAD);
        pvNormalVAD.vt = VT_I4;
        pvNormalVAD.lVal = AEC_VAD_NORMAL;
        CHECKHR(pPS->SetValue(MFPKEY_WMAAECMA_FEATR_VAD, pvNormalVAD));
        PropVariantClear(&pvNormalVAD);
    

     


    The program complies correctly. In the run time, it fails here: 

    CHECKHR(pPS->SetValue(MFPKEY_WMAAECMA_FEATR_VAD, pvNormalVAD));

    Can somebody give some suggestions on how to correctly configure the VAD?

    Thanks!

    Friday, November 4, 2011 8:39 PM

Answers

  • Unfortunately, MFPKEY_WMAAECMMA_FEATR_VAD is not supported by the Kinect audio DMO. The only supported value for this property is AEC_VAD_DISABLED.

    Sorry about that.
    Eddy


    I'm here to help
    Friday, November 4, 2011 9:42 PM