UAC2 Interrupt Endpoint for Volume/Mute Feature Units Topic is solved

Discussions about USB Audio on XMOS devices
bobbylala
Junior Member
Posts: 6
Joined: Wed Apr 17, 2019 12:53 pm

UAC2 Interrupt Endpoint for Volume/Mute Feature Units

Post by bobbylala »

Hello,

I am working on an Audio Class 2.0 design and would like to implement Volume and Mute control using the UAC2 Feature Units. I can use the macros to add the Feature Units:

Code: Select all

#define INPUT_VOLUME_CONTROL       (1)
#define OUTPUT_VOLUME_CONTROL       (1)

#define OUT_VOLUME_IN_MIXER (1)
#define IN_VOLUME_IN_MIXER (1)
This works fine for control from the Host PC to the Device, I can drag a volume slider (Thesycon Driver or Windows 10 Driver) and see the XMOS handling the requests in audiorequests.xc.

I would like Device to Host communication too though, e.g. to allow a hardware volume slider on the device being perfectly ganged to the Host PC slider.

From what I've read, the way to do this is to use interrupts to tell the USB Audio driver to retrieve the state of the Volume/Mute which has changed locally. Right now I'm having trouble with this but am unsure if it is a firmware (xmos) or software (driver) issue.

In usb_buffer.xc, I'm now sending these interrupt messages to XUD_Manager:

Code: Select all

unsigned char g_intData[8] =
{
    0,    // bInfo: Class-specific, caused by interface
    1,    // bAttribute: CUR
    0,    // wValue: CN/ MCN
    0,    // wValue: CS
    0,    // wIndex: interface
    0,    // wIndex: ID of entity causing interrupt - this will get modified;
    0,    // Spare
    0,    // Spare
};
For the Entity ID, I use FU_USBIN or FU_USBOUT, which are the unit IDs for the Feature Units for input and output volume control. For CS, I have tried:
USB Audio Class 2.0 Spec - Appendix A.17.7
FU_CONTROL_UNDEFINED 0x00
FU_MUTE_CONTROL 0x01
FU_VOLUME_CONTROL 0x02

but I don't get reliable results. Right now I have a situation where I send interrupt requests every 10 seconds, for the first 2 or 3mins I get no response from the Thesycon Driver. but then I might get responses to 4 or 5 interrupts and then nothing again for a while.

Anyone got any tips for this kind of thing?

I have tried using HID but found that Windows only applies HID to the output playback stream. For me it is important to Mute the microphone and would really like it to be picked up by the PC. Microsoft do imply that their driver will pick up interrupt messages for Volume and Mute on the Feature Units so I'm a bit stumped why nothing's happening.

References:
http://xcore.com/viewtopic.php?f=8&t=6806
https://docs.microsoft.com/en-us/window ... io-drivers
https://developer.apple.com/library/arc ... CH1-TNTAG8
View Solution
bobbylala
Junior Member
Posts: 6
Joined: Wed Apr 17, 2019 12:53 pm

Post by bobbylala »

Oops, I hadn't set the endpoint type properly to XUD_EPTYPE_INT... My endpoint type table didn't even have a field for that endpoint so can't say for sure what the XUD_Manager function thought it was dealing with...

If the memory just after my endpoint type table was 0, then it would be treated as an isochronous endpoint and I was getting lucky every now and then that my interrupt requests were matching the timing for iso requests...
User avatar
pangdi
Member
Posts: 11
Joined: Tue Nov 15, 2022 9:58 am

Post by pangdi »

How do you control the windows volume ? I still can't understand.