Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Microphone Array Geometry Property #349

Open
5 tasks
xross opened this issue Oct 3, 2023 · 0 comments
Open
5 tasks

Support for Microphone Array Geometry Property #349

xross opened this issue Oct 3, 2023 · 0 comments

Comments

@xross
Copy link
Collaborator

xross commented Oct 3, 2023

Described here: https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/microphone-array-geometry-property

A quick proof of concept has been authored by changing the UAC1 device descriptors to “microphone array” and adding the GET_MEM request as documented. These changes are described below. When done so the Windows host correctly does the GET_MEM request as documented.

Some thought would be required to enable a user to describe their own mic array geometries in the (variable size) descriptor – if they are capable of just authoring the raw bytes then this is relatively simple. Or, do we want to somewhat generate based on channel count? I think traditionally customers would be expected to program a byte array into an external memory.

The example app tested was the MC audio board using the line inputs as “mics”. Running a 2 in/2 out UAC1 device @16kHz.

In conclusion this is a relatively simple extension to the UA code base and we could support it with not too much effort, and a demo could be provided imminently.

Description of how to modify lib_xua for the quick proof of concept demo:

Set input wTerminalType to 0x205 - microphone array, host processing (currently UAC1 descriptors set to 0x201 - microphone). This will cause windows to do the GET_MEM request as documented (so far only tried with UAC1) i.e.

-    0x01, 0x02,                           /* Type - streaming in, mic */
+    0x05, 0x02,                           /* Type - streaming in, mic */

Add an example 2 mic array descriptor as an array:

unsigned char micArrayInfo[] =
{
    0x07, 0xFE, 0x86, 0xC1,
    0x89, 0x48,
    0x4d, 0xb5,
    0xB1, 0x84,
    0xC5, 0x16, 0x2D, 0x4A, 0xD3, 0x14,

    0x00, 0x3C, // wDescriptorLength
    0x10, 0x00, //wVersion
    0x00, 0x00, //bmMicArrayType
    0x00, 0x00,
    0x00, 0x00,
    0xDD, 0xE9,
    0x22, 0x17,
    0x00, 0x50,
    0x1d, 0x4c,
    0x00, 0x02,
    0x00, 0x00,
    0x00, 0x00,
    0xff, 0xce,
    0x00, 0x00,
    0x00, 0x00,
    0x00, 0x00,
    0x00, 0x00,
    0x00, 0x00,
    0x00, 0x32,
    0x00, 0x00,
    0x00, 0x00,
    0x00, 0x00,
};

Add response to GET_MEM request into xua_ep0_uacreqs.xc


XUD_Result_t AudioClassRequests_1(...

...

     switch(sp.bRequest)
    {
        case UAC_B_REQ_GET_MEM:
            int entity = sp.wIndex >> 8;
            int inter = sp.wIndex & 0xff;
            int control = sp.wValue >> 8;
            int channel = sp.wValue & 0xff;

            if((entity == 2) && (!inter) && (!control) && (!channel))
            {
                return XUD_DoGetRequest(ep0_out, ep0_in, buffer, sizeof(micArrayInfo), sp.wLength);
            }
            break;

Questions:

  • Does windows support this for UAC2 or just UAC1?

Things left to do:

  • try it with channel count > stereo
  • try the ms mic array verif tool
  • try uac2 (maybe not a requirement?)
  • tidy up implementation such that customers can add their own microphone geo - maybe add some sort of auto-gen
  • run it on a board with mics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant