本文介绍了USB 24位语音串流描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个USB耳机的演示,我有一个关于USB的音频端点描述符的问题。
我有一个工作8-48KHZ 16bit的音频流,我可以选择一个音频设备的窗口属性,任何采样频率。我用下面的描述:

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; 
};

使用这些设置:

// 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)

现在我想将其更改为24位8-48KHZ流。通过改变AUDIO_LSR_SAMPLE_SIZE为0x03。当我这样做的采样频率选择框在窗口属性窗口在48kHz的变灰,所以我不能选择其他的频率。当我玩的东西给设备的数据流是24位,但。
我已经尝试卸载驱动程序,但这个不会改变任何东西。

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?

推荐答案

原来,这个问题是不是在这些描述符但在输入端子描述那里的通道配置错了。

It turned out that the problem was not in these descriptors but in the Input Terminal Descriptor where the channel configuration was wrong.

这篇关于USB 24位语音串流描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 15:49