[wdmaudiodev] USB 24bits audiostream descriptors

  • From: Marco Trapman <Marco.Trapman@xxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 18 Dec 2013 09:48:51 +0000

Hello Wdmaudiodev,
I am working on a demo for an USB headset and I have a question about the audio 
endpoint descriptors of the USB. I have a working 8-48kHz 16bit audio stream 
and I can select any sample frequency in the windows properties of an audio 
device. I use the following descriptors:
Code:
// Interface 2: Speaker, alternate setting 1. Type 1 format descriptor.
static const UsbAudioStreamingType1DescriptorType UsbIfd2Format =
{
  sizeof(UsbAudioStreamingType1DescriptorType),                                 
      // uint8 bLength;
  UDESC_CS_INTERFACE,                                                           
      // uint8 bDescriptorType;
  UA_FORMAT_TYPE,                                                               
      // uint8 bDescriptorSubtype;
  UA_FORMAT_TYPE_I,                                                             
      // uint8 bFormatType;
  AUDIO_LSR_NOC,                                                                
      // uint8 bNrChannels;
  AUDIO_LSR_SAMPLE_SIZE,                                                        
      // uint8 bSubFrameSize;
  AUDIO_LSR_SAMPLE_SIZE << 3,                                                   
      // uint8 bBitResolution;
  0x00,                                                                         
      // uint8 bSamFreqType;
  (uint8)((AUDIO_LSR_MIN_SAMPLE_FREQUENCY) & 0xFF),                             
      // uint8 first byte minumum sample frequency
  (uint8)((AUDIO_LSR_MIN_SAMPLE_FREQUENCY >> 8) & 0xFF),                        
      // uint8 second byte minumum sample frequency
  (uint8)(((0x10000000 | AUDIO_LSR_MIN_SAMPLE_FREQUENCY) >> 16) & 0xFF),        
      // uint8 third byte minumum sample frequency
  (uint8)((AUDIO_LSR_MAX_SAMPLE_FREQUENCY) & 0xFF),                             
      // uint8 first byte maximum sample frequency
  (uint8)((AUDIO_LSR_MAX_SAMPLE_FREQUENCY >> 8) & 0xFF),                        
      // uint8 second byte maximum sample frequency
  (uint8)(((0x10000000 | AUDIO_LSR_MAX_SAMPLE_FREQUENCY) >> 16) & 0xFF),        
      // uint8 third byte maximum sample frequency
};

// Interface 2: Speaker, alternate setting 1. Audio endpoint descriptor.
static const UsbAudioEndpointDescriptorType UsbIfd2StdEndpoint =
{
  sizeof(UsbAudioEndpointDescriptorType),                                       
      // uint8 bLength;
  USB_DT_ENDPOINT,                                                              
      // uint8 bDescriptorType;
  USB_DIR_OUT | USB_EP_AUDIO_RX,                                                
      // uint8 bEndpointAddress;
  0x01,                                                                         
      // uint8 bmAttributes;
  ((AUDIO_LSR_MAX_SAMPLE_FREQUENCY / 1000) * AUDIO_LSR_SAMPLE_SIZE) * 
AUDIO_LSR_NOC,  // uint16 wMaxPacketSize;
  0x01,                                                                         
      // uint8 bInterval;
  0x00,                                                                         
      // uint8 bRefresh;
  0x00,                                                                         
      // uint8 bSynchAddress;
};
With these settings:
// Sample frequencies
#define AUDIO_LSR_MIN_SAMPLE_FREQUENCY 0x01F40  // 8kHz
#define AUDIO_LSR_MAX_SAMPLE_FREQUENCY 0x0BB80  // 48kHz

// Sample size
#define AUDIO_LSR_SAMPLE_SIZE 0x02 // in bytes

// Defines for mono/stereo.
#define AUDIO_LSR_NOC 0x02 // Number Of Channels (stereo)
Now I want to change it to a 8-48kHz 24bit stream. By changing the 
AUDIO_LSR_SAMPLE_SIZE to 0x03. When I do this the sample frequency selection 
box in the windows properties window is grayed out at 48kHz so I cannot select 
any other frequency. When I play something to the device the stream is 24bit 
though. I already tried uninstalling the drivers but this does not change 
anything.
Does anyone encounter this problem as well or does anyone have an idea what 
might cause this problem?
Best regards,

Marco Trapman

Legal Disclaimer: This e-mail communication (and any attachment/s) is 
confidential and contains proprietary information, some or all of which may be 
legally privileged. It is intended solely for the use of the individual or 
entity to which it is addressed. Access to this email by anyone else is 
unauthorized. If you are not the intended recipient, any disclosure, copying, 
distribution or any action taken or omitted to be taken in reliance on it, is 
prohibited and may be unlawful.

Please consider the environment before printing this e-mail


Other related posts: