How to detect bit depth of USB audio stream?

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Post Reply
kasemann
Member
Posts: 11
Joined: Tue Dec 20, 2016 4:09 pm

How to detect bit depth of USB audio stream?

Post by kasemann »

Hi

We want to implement a high-res file detection into our USB-Audio device (derived from the xmos app_usb_aud_xk_216_mc example application) – an LED shall indicate to the user whether the audio material streamed fulfills the High-Res-Logo requirements or not (more than 16bits per sample OR Fs>= 88200). Samplerate detection is easy since a function to change PLL-configuration is called each time the samplerate changes (audiohw.xc). I’ve implemented that and the LED already indicates streaming formats above 88.2kHz, but how do I detect the bit-depth of the audio stream? Where in the code is this negotioated between the host and the audio device?

Regards

Markus


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

Post by infiniteimprobability »

Hi, the place to pick up this info is in audiohw.xc which contains the user modifiable callback on sample rate change. You can find this in sw_usb_audio. Here's where you can take the appropriate action:

Code: Select all

void AudioHwConfig(unsigned samFreq, unsigned mClk, chanend ?c_codec, unsigned dsdMode,
    unsigned sampRes_DAC, unsigned sampRes_ADC)
sampRes_DAC will contain the bit depth (16, 24, 32 etc..)
Post Reply