华为UAC耳机 音频流接口
2021-02-08
1473
0
音频流接口分为麦克风和耳机(headphone)。
由于音频流传输只能是同步/等时传输方式进行,故在音频流接口描述符中,接口bAlternateSetting=0时为默认的无音频输出接口即无端点描述符,从bAlternateSetting=1开始有数据传输,即应该有等时传输端点描述符。
麦克风
在麦克风下只有一个音频转换接口,音频接口的采样率为48000HZ,格式为PCM.包的最大数据长度为192字节,即1ms,数据支持的是2通道(左右),每个通道16字节。
在UAC中,固定采用时间间隔是1ms.
所以48000/1000ms=48*2(通道)*2(字节) = 192字节/ms
---------------- Interface Descriptor ----------------- 麦克风关闭 1
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x01
bAlternateSetting : 0x00
bNumEndpoints : 0x00 (Default Control Pipe only)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 01 00 00 01 02 00 00 .........
---------------- Interface Descriptor ----------------- 打开
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x01
bAlternateSetting : 0x01
bNumEndpoints : 0x01 (1 Endpoint)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 01 01 01 01 02 00 00 .........
-------- Audio Streaming Interface Descriptor ---------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x01
bTerminalLink : 0x05
bDelay : 0x00
wFormatTag : 0x0001 (PCM)
Data (HexDump) : 07 24 01 05 00 01 00 .$.....
------- Audio Streaming Format Type Descriptor -------- 麦克风
bLength : 0x0B (11 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x02 (Format Type)
bFormatType : 0x01 (FORMAT_TYPE_I)
bNrChannels : 0x02 (2 channels)
bSubframeSize : 0x02 (2 bytes per subframe)
bBitResolution : 0x10 (16 bits per sample)
bSamFreqType : 0x01 (supports 1 sample frequence)
tSamFreq[1] : 0x0BB80 (48000 Hz)
Data (HexDump) : 0B 24 02 01 02 02 10 01 80 BB 00 .$.........
----------------- Endpoint Descriptor ----------------- 麦克风 输入数据
bLength : 0x09 (9 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x83 (Direction=IN EndpointID=3)
bmAttributes : 0x0D (TransferType=Isochronous SyncType=Synchronous EndpointType=Data)
wMaxPacketSize : 0x00C0 (192 bytes) //192/48=4
bInterval : 0x01 (1 ms)
bRefresh : 0x00
bSynchAddress : 0x00
Data (HexDump) : 09 05 83 0D C0 00 01 00 00 .........
----------- Audio Data Endpoint Descriptor ------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x25 (Audio Endpoint Descriptor)
bDescriptorSubtype : 0x01 (General)
bmAttributes : 0x01
D0 : Sampling Freq : 0x01 (supported)
D1 : Pitch : 0x00 (not supported)
D6..2: Reserved : 0x00
D7 : MaxPacketsOnly : 0x00 (no)
bLockDelayUnits : 0x00 (Undefined)
wLockDelay : 0x0000
Data (HexDump) : 07 25 01 01 00 00 00 .%.....
耳机
耳机支持2个转换接口,按每通道的字节数分为2字节和3字节,分别对应的是转换接口2和3。
---------------- Interface Descriptor ----------------- 耳机关闭 2
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x02
bAlternateSetting : 0x00
bNumEndpoints : 0x00 (Default Control Pipe only)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 02 00 00 01 02 00 00 .........
---------------- Interface Descriptor ----------------- 耳机打开 2
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x02
bAlternateSetting : 0x01
bNumEndpoints : 0x01 (1 Endpoint)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 02 01 01 01 02 00 00 .........
-------- Audio Streaming Interface Descriptor ---------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x01
bTerminalLink : 0x01
bDelay : 0x00
wFormatTag : 0x0001 (PCM)
Data (HexDump) : 07 24 01 01 00 01 00 .$.....
------- Audio Streaming Format Type Descriptor --------
bLength : 0x11 (17 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x02 (Format Type)
bFormatType : 0x01 (FORMAT_TYPE_I)
bNrChannels : 0x02 (2 channels)
bSubframeSize : 0x02 (2 bytes per subframe)
bBitResolution : 0x10 (16 bits per sample)
bSamFreqType : 0x03 (supports 3 sample frequencies)
tSamFreq[1] : 0x0AC44 (44100 Hz)
tSamFreq[2] : 0x0BB80 (48000 Hz)
tSamFreq[3] : 0x17700 (96000 Hz)
Data (HexDump) : 11 24 02 01 02 02 10 03 44 AC 00 80 BB 00 00 77 .$......D......w
01 .
----------------- Endpoint Descriptor ----------------- 耳机输出数据=====1
bLength : 0x09 (9 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x03 (Direction=OUT EndpointID=3)
bmAttributes : 0x0D (TransferType=Isochronous SyncType=Synchronous EndpointType=Data)
wMaxPacketSize : 0x0180 (384 bytes) 384/96=4
bInterval : 0x01 (1 ms)
bRefresh : 0x00
bSynchAddress : 0x00
Data (HexDump) : 09 05 03 0D 80 01 01 00 00 .........
----------- Audio Data Endpoint Descriptor ------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x25 (Audio Endpoint Descriptor)
bDescriptorSubtype : 0x01 (General)
bmAttributes : 0x01
D0 : Sampling Freq : 0x01 (supported)
D1 : Pitch : 0x00 (not supported)
D6..2: Reserved : 0x00
D7 : MaxPacketsOnly : 0x00 (no)
bLockDelayUnits : 0x00 (Undefined)
wLockDelay : 0x0000
Data (HexDump) : 07 25 01 01 00 00 00 .%.....
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x02
bAlternateSetting : 0x02
bNumEndpoints : 0x01 (1 Endpoint)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 02 02 01 01 02 00 00 .........
-------- Audio Streaming Interface Descriptor ---------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x01
bTerminalLink : 0x01
bDelay : 0x00
wFormatTag : 0x0001 (PCM)
Data (HexDump) : 07 24 01 01 00 01 00 .$.....
------- Audio Streaming Format Type Descriptor --------
bLength : 0x11 (17 bytes)
bDescriptorType : 0x24 (Audio Interface Descriptor)
bDescriptorSubtype : 0x02 (Format Type)
bFormatType : 0x01 (FORMAT_TYPE_I)
bNrChannels : 0x02 (2 channels)
bSubframeSize : 0x03 (3 bytes per subframe)
bBitResolution : 0x18 (24 bits per sample)
bSamFreqType : 0x03 (supports 3 sample frequencies)
tSamFreq[1] : 0x0AC44 (44100 Hz)
tSamFreq[2] : 0x0BB80 (48000 Hz)
tSamFreq[3] : 0x17700 (96000 Hz)
Data (HexDump) : 11 24 02 01 02 03 18 03 44 AC 00 80 BB 00 00 77 .$......D......w
01 .
----------------- Endpoint Descriptor ----------------- =====2
bLength : 0x09 (9 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x03 (Direction=OUT EndpointID=3)
bmAttributes : 0x0D (TransferType=Isochronous SyncType=Synchronous EndpointType=Data)
wMaxPacketSize : 0x0240 (576 bytes) 576/96=6
bInterval : 0x01 (1 ms)
bRefresh : 0x00
bSynchAddress : 0x00
Data (HexDump) : 09 05 03 0D 40 02 01 00 00 ....@....
----------- Audio Data Endpoint Descriptor ------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x25 (Audio Endpoint Descriptor)
bDescriptorSubtype : 0x01 (General)
bmAttributes : 0x01
D0 : Sampling Freq : 0x01 (supported)
D1 : Pitch : 0x00 (not supported)
D6..2: Reserved : 0x00
D7 : MaxPacketsOnly : 0x00 (no)
bLockDelayUnits : 0x00 (Undefined)
wLockDelay : 0x0000
Data (HexDump) : 07 25 01 01 00 00 00 .%.....
HID人机交互QQ群:564808376
UAC音频QQ群:218581009
UVC相机QQ群:331552032
BOT&UASP大容量存储QQ群:258159197
STC-USB单片机QQ群:315457461
USB技术交流QQ群2:580684376
USB技术交流QQ群:952873936