Second format for input/recording stream in USB Audio projec

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
ffomich
Experienced Member
Posts: 119
Joined: Mon Sep 15, 2014 1:32 pm

Second format for input/recording stream in USB Audio projec

Post by ffomich »

Hi! USB Audio Design supports 3 format for output/playback (24, 16, 32 bits) and only one format for input/recording (24 bits). Is it possible to add second format for input/recording in UAC1 mode? 
What I do:
1. Change STREAM_FORMAT_INPUT_2_RESOLUTION_BITS from 24 to 16.
2. Add Alternate Settings 2 for input interface in descriptors.h file.
I missed something?


User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

HI,
looks like the UAC1 configuration currently only supports a single format, whereas UAC2 can support it simply by modifying INPUT_FORMAT_COUNT and the appropriate defines for slot size, bits etc. in devicedefines.h

Looking at cfgDesc_Audio1[] in descriptors.h, it only presents a descriptor for one format. Endpoint0 code should handle the set alternate command OK (it handles FS ie. UAC1 requests by the looks of things) and the rest of the ref design will handle things OK.

So I think it's likely, after adding the extra stream format defines as you said, you can just extend the UAC1 descriptor to make this work. The UAC1 descriptor is not quite as nicely written at the UAC2 one (using sizeof etc.) so you will need to keep a tally of lengths so you present the correct device descriptor which contains the total length.

So, overall a bit fiddly, but doable! You can use the UAC2 descriptors as a guide, but of course you should ensure compliance to this spec document http://www.usb.org/developers/docs/devc ... udio10.pdf