[wdmaudiodev] Question about SYSVAD audio driver

  • From: think more <iiiii5322@xxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 24 Jan 2018 22:08:55 +0200

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, ;
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.

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: