Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: USB AUDIO_INTERFACE explanations please!

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    16

    USB AUDIO_INTERFACE explanations please!

    Hello,

    I'm working with a Teensy 4.0 with the USB as AUDIO (USB_AUDIO in usb_desc.h) trying to update the descriptors (final goal to increase the number of output channels), and I'm struggling to understand how the AUDIO_INTERFACE is configured and structured in usb_desc.c:

    Code:
    #ifdef AUDIO_INTERFACE
    	// configuration for 480 Mbit/sec speed
            // interface association descriptor, USB ECN, Table 9-Z
            8,                                      // bLength
            11,                                     // bDescriptorType
            AUDIO_INTERFACE,                        // bFirstInterface
            3,                                      // bInterfaceCount
            0x01,                                   // bFunctionClass
            0x01,                                   // bFunctionSubClass
            0x00,                                   // bFunctionProtocol
            0,                                      // iFunction
             .......................
    (full code at https://github.com/PaulStoffregen/co...sy4/usb_desc.c)

    - Why do we have 3 audio interfaces? Could you please describe each of them?
    - Why do we have 2 "Input Terminal Descriptor" and 3 "Output Terminal Descriptor"? How do they relate to each interface?
    - What is the logic in the succession of items?

    I managed to update bNrChannels on line 1574 for "Type I Format Descriptor":

    Code:
    // Type I Format Descriptor
    	// USB DCD for Audio Data Formats 1.0, Section 2.2.5, Table 2-1, page 10
    	11,					// bLength
    	0x24,					// bDescriptorType = CS_INTERFACE
    	2,					// bDescriptorSubtype = FORMAT_TYPE
    	1,					// bFormatType = FORMAT_TYPE_I
    	4,					// bNrChannels: WAS 2 I UPDATED TO 4
    	2,					// bSubFrameSize = 2 byte
    	16,					// bBitResolution = 16 bits
    	1,					// bSamFreqType = 1 frequency
    	LSB(44100), MSB(44100), 0,		// tSamFreq
    Some softwares on Windows recognize the update and I can play 4 tracks (eg Reaper), Windows can also manage to play stereo, but other softwares like VLC crash probably because they cannot understand the descriptor. (got some logs from VLC: "directsound debug: Windows speaker config: Unknown and stream has 2 channels, using 2 channels").

    I tried also to update the "wChannelConfig" param to 0x00FF which seems to be 7.1 (instead of 0x0003 = Left & Right Front) but this doesn't make a difference.

    Also if I've compared the usb descriptor with another 8 tracks audio interface I have (using Thesycon USB descriptor dumper) and it is much simpler than the Teensy one.

    Just understanding the main logic around the descriptors for Teensy would help a lot, thanks!

    Ben

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,650
    All this stuff comes from the USB audio class specification. Sorry, I don't have time to write a lengthy explanation, but here is a direct link to the PDF spec.

    https://www.usb.org/sites/default/files/audio10.pdf

    It's lengthy, like most of these specs, but a lot of it is long lists of optional stuff. The key to reading it is skipping over all that stuff we're not using and just focus on the important parts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •