[wdmaudiodev] Re: Question about SYSVAD audio driver

  • From: "Matthew van Eerde" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "Matthew.van.Eerde" for DMARC)
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 24 Jan 2018 20:13:20 +0000

Use the effects discovery tests in the HLK, and the Windows audio effects 
discovery sample, to verify that your effects are being reported properly.

https://docs.microsoft.com/en-us/windows-hardware/test/hlk/testref/9ffe6819-92f8-4cd8-8174-3f74a6468c8a
https://code.msdn.microsoft.com/windowsapps/Audio-effects-discovery-5fd65c15

________________________________
From: wdmaudiodev-bounce@xxxxxxxxxxxxx <wdmaudiodev-bounce@xxxxxxxxxxxxx> on 
behalf of think more <iiiii5322@xxxxxxxxx>
Sent: Wednesday, January 24, 2018 12:08:55 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Question about SYSVAD audio driver

Hi,

I am trying to send audio to Skype from virtual mic, using SYSVAD example. At 
the moment I can successfully send audio to any voip program from mic wxcept 
skype. When I start skype call, music gets muted to silence and white noise 
intensifies. If I listen to mic directly, sound is still coming and it sounds 
perfectly, but skype still removes it (maybe it things it’s noise). I’ve found 
this document: 
https://www.microsoft.com/en-us/download/details.aspx?id=42523<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D42523&data=02%7C01%7Cmatthew.van.eerde%40microsoft.com%7C6a6d8e2fc9fe4ccbc5a408d56366607e%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636524213835842282&sdata=sV2PO4qukP6IZEWVaq785CPaYTxSHSmflP9gJt3qvXo%3D&reserved=0>,
 in which they say, that if driver doesn’t implement NS and AEC, skype adds 
them. I think these two effects destroys my sound, so I want to say to skype, 
that I already applied these effects to RAW mic data. For validating effects, I 
am using this program 
https://code.msdn.microsoft.com/windowsapps/Audio-effects-discovery-5fd65c15<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcode.msdn.microsoft.com%2Fwindowsapps%2FAudio-effects-discovery-5fd65c15&data=02%7C01%7Cmatthew.van.eerde%40microsoft.com%7C6a6d8e2fc9fe4ccbc5a408d56366607e%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636524213835842282&sdata=sOzTalt7yqFkv%2BA6Kv7Xe%2BJrdsS9yD%2FngcKxVR7JBUc%3D&reserved=0>.

In minwavert.cpp I added this function:
NTSTATUS
CMiniportWaveRT::PropertyHandler_MicAudioEffectsDiscoveryEffectsList
(
                _In_ PPCPROPERTY_REQUEST PropertyRequest
)
/*++

Routine Description:

Handles ( 
KSPROPSETID_AudioEffectsDiscovery,KSPROPERTY_AUDIOEFFECTSDISCOVERY_EFFECTSLIST )

Arguments:

PropertyRequest -

Return Value:

NT status code.

--*/
{
                PAGED_CODE();

                
DPF_ENTER(("[PropertyHandler_MicAudioEffectsDiscoveryEffectsList]"));

                NTSTATUS    ntStatus = STATUS_INVALID_PARAMETER;
                ULONG       nPinId = (ULONG)-1;

                //
                // Validate Pin ID.
                //
                if (PropertyRequest->InstanceSize >= sizeof(ULONG))
                {
                                nPinId = *(PULONG(PropertyRequest->Instance));

                                // This prop is valid only on streaming pins.
                                if (IsSystemRenderPin(nPinId) || 
IsSystemCapturePin(nPinId))
                                {
                                                ntStatus = STATUS_SUCCESS;
                                }
                                else if (IsBridgePin(nPinId) ||
                                                IsLoopbackPin(nPinId) ||
                                                IsOffloadPin(nPinId))
                                {
                                                ntStatus = STATUS_NOT_SUPPORTED;
                                }
                }

                IF_FAILED_JUMP(ntStatus, Done);

                //
                // Valid actions: get and basicsupport.
                //
                ntStatus = STATUS_INVALID_PARAMETER;

                if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT)
                {
                                ntStatus =
                                                PropertyHandler_BasicSupport
                                                (
                                                                PropertyRequest,
                                                                
KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET,
                                                                VT_ILLEGAL
                                                );
                }
                else if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET)
                {
                                //ASSERT(m_BthHfpDevice != NULL);

                                //
                                // bHfpNrecPresent is set to TRUE when the HF 
(remote device) handles NR + EC.
                                // Note that GetNRECDisableStatus() returns 
TRUE if the HF notified the AG to disable
                                // the NR + EC locally.
                                //
                                //BOOL bHfpNrecPresent = 
m_BthHfpDevice->IsNRECSupported() && m_BthHfpDevice->GetNRECDisableStatus();

                                // If it is HFP render pin (data flow in) or if 
the NR-EC is not supported,
                                // return size 0 effect list
                                if (IsSystemRenderPin(nPinId)) //|| 
!bHfpNrecPresent)
                                {
                                                PropertyRequest->ValueSize = 0;
                                                ntStatus = STATUS_SUCCESS;
                                }
                                else
                                {
                                                // Compute total size, two 
effects: NS and EC (see below).
                                                ULONG   cbMinSize = 
sizeof(GUID) * 2;

                                                if (PropertyRequest->ValueSize 
== 0)
                                                {
                                                                
PropertyRequest->ValueSize = cbMinSize;
                                                                ntStatus = 
STATUS_BUFFER_OVERFLOW;
                                                }
                                                else if 
(PropertyRequest->ValueSize < cbMinSize)
                                                {
                                                                ntStatus = 
STATUS_BUFFER_TOO_SMALL;
                                                }
                                                else
                                                {
                                                                PGUID 
effectList = PGUID(PropertyRequest->Value);

                                                                *effectList = 
AUDIO_EFFECT_TYPE_ACOUSTIC_ECHO_CANCELLATION;
                                                                *(effectList + 
1) = AUDIO_EFFECT_TYPE_NOISE_SUPPRESSION;

                                                                
PropertyRequest->ValueSize = cbMinSize;
                                                                ntStatus = 
STATUS_SUCCESS;
                                                }
                                }
                }

Done:

                return ntStatus;
}

In minwavert.cpp in PropertyHandler_WaveFilter I added:

else if (IsEqualGUIDAligned(*PropertyRequest->PropertyItem->Set, 
KSPROPSETID_AudioEffectsDiscovery))
                {
                                DbgBreakPoint();
                                switch (PropertyRequest->PropertyItem->Id)
                                {
                                case 
KSPROPERTY_AUDIOEFFECTSDISCOVERY_EFFECTSLIST:
                                                ntStatus = 
pWaveHelper->PropertyHandler_MicAudioEffectsDiscoveryEffectsList(PropertyRequest);
                                                break;
                                }
                }
And in micinwavtable.h, in PropertiesMicInWaveFiler[], I added:

,
                {
                                &KSPROPSETID_AudioEffectsDiscovery,
                                KSPROPERTY_AUDIOEFFECTSDISCOVERY_EFFECTSLIST,
                                KSPROPERTY_TYPE_GET | 
KSPROPERTY_TYPE_BASICSUPPORT,
                                PropertyHandler_WaveFilter
                },


What I am missing? AEC and NS effects doesn’t show up in sample Effect program. 
Also PropertyHandler_MicAudioEffectsDiscoveryEffectsList function never is 
called. How could I say to skype, that I applied these effects myself, so that 
skype doesn’t degrade audio to noise. Thanks in advance.

Other related posts: