[wdmaudiodev] Re: [EXTERNAL] Problem with Friendly Names in Audio Driver

  • From: Jamie Finch <jfi@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Fri, 7 Jan 2022 14:36:36 -0800

I have an implementation detail question.

I am having a problem with adding "public IPinName" to a class with "public IMiniportTopology".
To verify the project setup, I went back to the sysvad sample driver code and the same compiler error happens in that project.
It seem to be missing some detail.  It seems to be simple enough to do.

I get the following compiler error:
Error (active) E0287 derived class "CMicArrayMiniportTopology" contains more than one instance of class "IUnknown"

From this piece of code:
class CMicArrayMiniportTopology :
    public CMiniportTopologySYSVAD,
    public IMiniportTopology,
    public IPinName,
    public CUnknown
{
 I added the public IPinName, to micarraytopo.h in the sysvad.
That is when I get the IUnkown error.
I download the sysvad from the github, in case there is a better place to find it.
I search for GetPinName() in that source, and I did not find it.

Jamie Finch



On 1/4/2022 1:03 PM, Matthew van Eerde (Matthew.van.Eerde) wrote:
Caution: External email

I see, the problem is that there are multiple audio endpoints named “Line (NDI Webcam Audio)”.

 

If there are multiple audio adapters (KSCATEGORY_AUDIO interface instances) on the system that have the same name as each other, Windows will take care of disambiguating the names of these interfaces. (It will add a “2-“ before the audio adapter name.)

 

If a single audio adapter exposes multiple audio endpoints, the audio driver is on the hook to make sure that the audio endpoints on that adapter have different names. If the audio endpoints are of different KSPIN_Descriptor.Category types, this is free, because (e.g.) KSNODETYPE_MICROPHONE and KSNODETYPE_LINELEVEL will be mapped to different strings.

 

Since your adapter has multiple KSNODETYPE_LINELEVEL endpoints being exposed from the same kernel streaming filter instance, your driver should implement IPinName to give each of the endpoints its own unique name.

 

See IPinName::GetPinName (portcls.h) - Windows drivers | Microsoft Docs for documentation, and the SysVad sample for an example implementation.

 

From: wdmaudiodev-bounce@xxxxxxxxxxxxx <wdmaudiodev-bounce@xxxxxxxxxxxxx> On Behalf Of David A. Hoatson
Sent: Tuesday, January 4, 2022 1:00 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: [EXTERNAL] Problem with Friendly Names in Audio Driver

 

I am assuming that you are wanting to create multiple WAVE devices within the same physical device (as opposed to just plugging a second device of the same type into a single computer). 

 

There are multiple places you need to specify the correct device name to get it to show a “custom” name:

 

 

This is also teams showing our two 8-channel devices.  On the play side the first device would always be “Speakers” if you want to support more than 2-channels (and requires a topology driver).

 

Obviously it starts with creating multiple wave devices in CAdapter::Init by calling InstallSubdevice multiple times with the whatever internal device name you choose: “Wave1”, “Wave 2”… and so on.

 

In CWaveRTMiniport::GetDescription() return a custom FilterDescriptor for each device, where each of the gMiniportPins are using a custom GUID for each device name.

 

Same thing for CTopologyMiniport::GetDescription() return a custom FilterDescriptor for each device, where each of the gTopologyPins are using a custom GUID for each device name.

 

Follow the example INF file but just create multiple interfaces.

 

[MyDevice_Install.NTAMD64.Interfaces]

AddInterface=%KSCATEGORY_AUDIO%,  "Wave1",            MyDevice.Interface.Wave1

AddInterface=%KSCATEGORY_RENDER%, "Wave1",            MyDevice.Interface.Wave1

AddInterface=%KSCATEGORY_CAPTURE%, "Wave1",            MyDevice.Interface.Wave1

AddInterface=%KSCATEGORY_AUDIO%,  "Wave2",            MyDevice.Interface.Wave2

AddInterface=%KSCATEGORY_RENDER%, "Wave2",            MyDevice.Interface.Wave2

AddInterface=%KSCATEGORY_CAPTURE%, "Wave2",            MyDevice.Interface.Wave2

 

[MyDevice.I.Wave1.AddReg]

HKR,,CLSID,,%Proxy.CLSID%

HKR,,FriendlyName,,%MyDevice1.Name%

 

[MyDevice.I.Wave2.AddReg]

HKR,,CLSID,,%Proxy.CLSID%

HKR,,FriendlyName,,%MyDevice2.Name%

 

[MyDevice.AddReg]

HKLM,%MediaCategories%\%MyDevice1.NameGuid%,Name,,%MyDevice1.Name%

HKLM,%MediaCategories%\%MyDevice2.NameGuid%,Name,,%MyDevice2.Name%

 

I have left out a few steps in the INF file, but hopefully those are obvious by looking at complete examples of other INF files.

 

Hopefully this helps.

 

Thank you,

David A. Hoatson

 

From: wdmaudiodev-bounce@xxxxxxxxxxxxx <wdmaudiodev-bounce@xxxxxxxxxxxxx> On Behalf Of Jamie Finch
Sent: Tuesday, January 4, 2022 12:12 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: [EXTERNAL] Problem with Friendly Names in Audio Driver

 

I am trying to use the friendly name in the popup to select the audio channel.
A picture will really help.  This is a picture from Microsoft Teams.

Where it says "Line (NDI Webcam Audio)", which is the name of the description:

HKR,Drivers\wave\wdmaud.drv,Description,,%NewTek_AudioPortClass_Multi.Description%
HKR,Drivers\mixer\wdmaud.drv,Description,,%NewTek_AudioPortClass_Multi.Description%

I need the channel selection text.
The goal is to have it say:

"NDI Webcam Audio 1"
"NDI Webcam Audio 2"
"NDI Webcam Audio 3"
"NDI Webcam Audio 4"

Can anyone direct me to an example of how to do this?
For our video driver, it uses the Friendly Name exactly as I need it.

The sample code I used is from Windows-driver-samples-master/audio/SimpleAudioSample.
I am not in control of the application we are running in, could be Skype, Teams, Google Hangout...

Jamie Finch

 

On 12/22/2021 9:46 AM, Matthew van Eerde (Matthew.van.Eerde) wrote:

Caution: External email
 
Here's a sample that shows how to enumerate all kinds of devices:
 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FWindows-universal-samples%2Ftree%2Fmain%2FSamples%2FDeviceEnumerationAndPairing&amp;data=04%7C01%7Cjfinch%40newtek.com%7C8e05d4d228ce42336a1d08d9c572fc6e%7Cc63c3ba740db460ebdf1e63a02a3ad59%7C0%7C0%7C637757919921320038%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=KNYcXH9e8oKYpgvjq%2B%2FnqgHyXTWjj5zJndiPWH20JSg%3D&amp;reserved=0
 
To enumerate audio devices, use one of the selectors from the Windows.Media.Device.MediaDevice class
 
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fuwp%2Fapi%2Fwindows.media.devices.mediadevice%3Fview%3Dwinrt-22000&amp;data=04%7C01%7Cjfinch%40newtek.com%7C8e05d4d228ce42336a1d08d9c572fc6e%7Cc63c3ba740db460ebdf1e63a02a3ad59%7C0%7C0%7C637757919921320038%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=FkOXrz8B9V0Wad8vlIkyPUc0VGoRZtK%2BibJ%2B9SNv9dE%3D&amp;reserved=0
 
-----Original Message-----
From: wdmaudiodev-bounce@xxxxxxxxxxxxx <wdmaudiodev-bounce@xxxxxxxxxxxxx> On Behalf Of Jamie Finch
Sent: Monday, December 20, 2021 10:49 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [EXTERNAL] [wdmaudiodev] Problem with Friendly Names in Audio Driver
 
[Some people who received this message don't often get email from jfi@xxxxxxxxx. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
 
We have a video and audio software only drivers we use to send data from our main application to Skype, Teams, VLC, Zoom, Google Hangout.... ect.
 
We have channels set up so that the source from our application can be different.
Presently the channels can be from 0 to 3.  Set by a data item when you send the IOCTL.
 
The video driver has a FriendlyName section that works as expected.
In the applicatons the selection for the video will be Video #1 to Video #4, the FriendlyNames.
 
The desired affect in the application popups for the microphone is:
Audio #1, Audio #2, Audio #3, Audio #4.
 
This article indicates we can do the same thing for the audio.
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-hardware%2Fdrivers%2Faudio%2Fmultiple-audio-subdevices&amp;data=04%7C01%7Cjfinch%40newtek.com%7C8e05d4d228ce42336a1d08d9c572fc6e%7Cc63c3ba740db460ebdf1e63a02a3ad59%7C0%7C0%7C637757919921320038%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=NKRUgmKSEUY3N1mBiwZwTzCOUINf%2B6M5WFcGesSF%2Btc%3D&amp;reserved=0
What we see instead of the FriendlyNames, is the device name.
 
When we call InstallSubdevice() we are using sting constants, so we cannot be tripping the bug that it only remembers the address, reported on your forums.
static wchar_t* szNameWave[4]     = { L"Wave_0", L"Wave_1",
L"Wave_2",     L"Wave_3"     };
static wchar_t* szNameTopology[4] = { L"Topology_0", L"Topology_1", L"Topology_2", L"Topology_3" };
 
We have as expected, interface sections in the INF file that look like:
 
[NewTek_AudioPortClass.NT$ARCH$.Interfaces]
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave0%,NewTek_AudioPortClass.AddInterfaceSection.Aud0
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave1%,NewTek_AudioPortClass.AddInterfaceSection.Aud1
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave2%,NewTek_AudioPortClass.AddInterfaceSection.Aud2
AddInterface=%KSCATEGORY_AUDIO%,%KSNAME_Wave3%,NewTek_AudioPortClass.AddInterfaceSection.Aud3
ect....
 
[NewTek_AudioPortClass.AddInterfaceSection.Aud0]
AddReg=NewTek_AudioPortClass.AddInterfaceSection.Aud0.AddReg
[NewTek_AudioPortClass.AddInterfaceSection.Aud0.AddReg]
HKR,,CLSID,,%Proxy.CLSID%
HKR,,FriendlyName,,%NewTek_AudioPortClass.Aud0.FriendlyName%
ect...
 
I have been looking at the DDK audio samples and they have FriendlyNames, but the device name seems to show up instead of them.
In the DDK SimpleAudioSample, it has a FriendlyName of "Simple Audio Sample Wave Microphone Array - Front", but what I see in the Zoom popup is "Virutal Audio Device (WDM) - Simple Audio Sample".
 
Can you point me to an audio example, where the FriendlyName is used when selecting the device?
Also is there another method that I can accomplish the same thing?
It appears I am missing something.
 
 
******************
 
WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx
 
URL to WDMAUDIODEV page:
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.wdmaudiodev.com%2F&amp;data=04%7C01%7Cjfinch%40newtek.com%7C8e05d4d228ce42336a1d08d9c572fc6e%7Cc63c3ba740db460ebdf1e63a02a3ad59%7C0%7C0%7C637757919921320038%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=EUPf%2B%2FmHxHB%2BkP9EwSMZFrrJQMUxDza9CO561YlMhbs%3D&amp;reserved=0
 
******************
 
WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx
 
URL to WDMAUDIODEV page:
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.wdmaudiodev.com%2F&amp;data=04%7C01%7Cjfinch%40newtek.com%7C8e05d4d228ce42336a1d08d9c572fc6e%7Cc63c3ba740db460ebdf1e63a02a3ad59%7C0%7C0%7C637757919921320038%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=EUPf%2B%2FmHxHB%2BkP9EwSMZFrrJQMUxDza9CO561YlMhbs%3D&amp;reserved=0
 
.

JPEG image

JPEG image

Other related posts: