MeiZX
驱动牛犊
驱动牛犊
  • 注册日期2001-07-21
  • 最后登录2002-05-09
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:2805回复:6

如何使usb microphone支持音量控制?

楼主#
更多 发布于:2001-11-28 22:36
MeiZX
znsoft
管理员
管理员
  • 注册日期2001-03-23
  • 最后登录2023-10-25
  • 粉丝300
  • 关注6
  • 积分910分
  • 威望14796点
  • 贡献值7点
  • 好评度2410点
  • 原创分5分
  • 专家分100分
  • 社区居民
  • 最爱沙发
  • 社区明星
沙发#
发布于:2001-11-29 17:49
什么东东?usb 的
http://www.zndev.com 免费源码交换网 ----------------------------- 软件创造价值,驱动提供力量! 淡泊以明志,宁静以致远。 ---------------------------------- 勤用搜索,多查资料,先搜再问。
MeiZX
驱动牛犊
驱动牛犊
  • 注册日期2001-07-21
  • 最后登录2002-05-09
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2001-11-30 13:17
我用2131开发usb microphone,现在该产品除了音量不能得到控制之外,其他功能均能够符合windows sound recorder的要求,请各位大虾指点
MeiZX
MeiZX
驱动牛犊
驱动牛犊
  • 注册日期2001-07-21
  • 最后登录2002-05-09
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2001-11-30 13:25
请各位大虾帮我检查一下描述符文件,欢迎纠正错误!
;;-----------------------------------------------------------------------------
;; File: dscr.a51
;; Contents: This file contains descriptor data tables.  
;;
;; Copyright (c) 1997 AnchorChips, Inc. All rights reserved
;;-----------------------------------------------------------------------------

;;-----------------------------------------------------------------------------
;;Descriptor Types
DEVICE equ 1 ;; Descriptor type: Device
CONFIGURATION equ 2 ;; Descriptor type: Configuration
STRING equ 3 ;; Descriptor type: String
INTERFACE equ 4 ;; Descriptor type: Interface
ENDPOINT equ 5 ;; Descriptor type: Endpoint

;;Endpoint Types
ET_CONTROL equ 0 ;; Endpoint type: Control
ET_ISO equ 1 ;; Endpoint type: Isochronous
ET_BULK equ 2 ;; Endpoint type: Bulk
ET_INT equ 3 ;; Endpoint type: Interrupt

;;------------------------------------------------------------------------------
;;USB Device Class Definition for Terminal Types
;;------------------------------------------------------------------------------
;;USB Terminal Types
USB_Undefined equ 0x0100
USB_Streaming equ 0x0101
USB_Vend_Specific equ 0x01ff
;;------------------------------------------------------------------------------
;;Input Terminal Types
Input_Undefined equ 0x0200
Microphone equ 0x0201
Desktop_Microphone equ 0x0202
Personal_Microphone equ 0x0203
Omni_directional_Microphone equ 0x0204
Microphone_Array equ 0x0205
Processing_Microphone_Array equ 0x0206

;;------------------------------------------------------------------------------
;;USB Device Class Definition for Audio Data Format
;;------------------------------------------------------------------------------
;;Audio Data Format Type 1 Codes
TYPE_1_UNDEFINED equ 0x0000
PCM equ 0x0001
PCM8 equ 0x0002
IEEE_FLOAT equ 0x0003
ALAW equ 0x0004
MULAW equ 0x0005
;;------------------------------------------------------------------------------
;;Format Type Codes
FORMAT_TYPE_UNDEFINED equ 0x00
FORMAT_TYPE_1 equ 0x01
FORMAT_TYPE_2 equ 0x02
FORMAT_TYPE_3 equ 0x03

;;------------------------------------------------------------------------------
;;USB Device Class Definition for Audio Device
;;------------------------------------------------------------------------------
;;Audio Interface Class Code
AUDIO equ 0x01
;;-----------------------------------------------------------------------------
;;Audio Interface Subclass Codes
SUBCLASS_UNDEFINED equ 0x00
AUDIO_CONTROL equ 0x01
AUDIO_STREAMING equ 0x02
MIDI_STREAMING equ 0x03
;;-----------------------------------------------------------------------------
;;Audio Interface Protocol Codes
PR_PROTOCOL_UNDEFINED equ 0x00
;;-----------------------------------------------------------------------------
;;Adudio Class_Specific Descriptor Types
CS_UNDEFINED equ 0x20
CS_DEVICE equ 0x21
CS_CONFIGURATION equ 0x22
CS_STRING equ 0x23
CS_INTERFACE equ 0x24
CS_ENDPOINT equ 0x25
;;-----------------------------------------------------------------------------
;;Audio Class_Specific AC Interface Descriptor Subtypes
AC_DESCRIPPTOR_UNDEFINED equ 0x00
HEADER equ 0x01
INPUT_TERMINAL equ 0x02
OUTPUT_TERMINAL equ 0x03
MIXER_UNIT equ 0x04
SELECTOR_UNIT equ 0x05
FEATURE_UNIT equ 0x06
PROCESSING_UNIT equ 0x07
EXTENSION_UNIT equ 0x08
;;-----------------------------------------------------------------------------
;;Audio Class-Specific AS Interface Descriptor Subtypes
AS_DESCRIPTOR_UNDEFINED equ 0x00
AS_GENERAL equ 0x01
FORMAT_TYPE equ 0x02
FORMAT_SPECIFIC equ 0x03
;;-----------------------------------------------------------------------------
;;Audio Class-Specific Endpoint Descriptor Subtypes
DESCRIPTOR_UNDEFINED equ 0x00
EP_GENERAL equ 0x01
;;-----------------------------------------------------------------------------
;;Audio Class-Specific Request Codes
;REQUEST_CODE_UNDEFINED equ 0x00
;SET_CUR equ 0x01
;GET_CUR equ 0x81
;SET_MIN equ 0x02
;GET_MIN equ 0x82
;SET_MAX equ 0x03
;GET_MAX equ 0x83
;SET_RES equ 0x04
;GET_RES equ 0x84
;SET_MEM equ 0x05
;GET_MEM equ 0x85
;GET_STAT equ 0xFF
;;-----------------------------------------------------------------------------
;;Control Selector Codes
;;Terminal Control Selectors
;TE_CONTROL_UNDEFINED equ 0x00
;COPY_PROTECT_CONTROL equ 0x01
;;Feature Unit Control Selectors
;FU_CONTROL_UNDEFINED equ 0x00
;MUTE_CONTROL equ 0x01
;VOLUME_CONTROL equ 0x02
;BASS_CONTROL equ 0x03
;MID_CONTROL equ 0x04
;TREBLE_CONTROL equ 0x05
;GRAPHIC_EQUALIZER_CONTROL equ 0x06
;AUTOMATIC_GAIN_CONTROL equ 0x07
;DELAY_CONTROL equ 0x08
;BASS_BOOST_CONTROL equ 0x09
;LOUDNESS_CONTROL equ 0x0A

public DeviceDescriptor, ConfigDescriptor, StringDescriptor, UserDscr

DSCR SEGMENT CODE

;;-----------------------------------------------------------------------------
;; Global Variables
;;-----------------------------------------------------------------------------
rseg DSCR ;; locate the descriptor table in on-part memory.

DeviceDescriptor:
db deviceDscrEnd-DeviceDescriptor ;; Descriptor length
db DEVICE ;; Decriptor type
db 0x10,0x01 ;; Specification Version (BCD) -1.1
db 0   ;; Device class
db 0 ;; Device sub-class
db 0 ;; Protocol : Device sub-sub-class
db 64 ;; Maximum packet size
db 0xa8,0x08 ;; Vendor ID
db 0x04,0x00 ;; Product ID
db 0x00,0x01 ;; Product version ID
db 1 ;; Manufacturer string index
db 2 ;; Product string index
db 0 ;; Serial number string index
db 1 ;; Numder of configurations
deviceDscrEnd:

ConfigDescriptor:
db ConfigDscrEnd-ConfigDescriptor ;; Descriptor length
db CONFIGURATION ;; Descriptor type
db low(ConfigLength) ;; Configuration + Interface + End Points length (LSB)
db high(ConfigLength) ;; Configuration + Interface + End Points length (MSB)
db 2 ;; Number of interfaces
db 1 ;; ID of this configuration
db 0 ;; Configuration string
db 10100000b ;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
db 0xc8 ;; Power requirement (div 2 ma)(200 * 2 ma)
ConfigDscrEnd:

AudioControlInterface:
db IntrfcDscrEnd-AudioControlInterface ;; Descriptor length
db INTERFACE ;; Descriptor type
db 0 ;; Zero-based index of this interface
db 0 ;; Alternate setting
db 0 ;; Number of end points used by this interface
db AUDIO ;; Interface class
db AUDIO_CONTROL ;; Interface sub class
db 00H ;; Interface sub sub class
db 3 ;; Interface descriptor string index
IntrfcDscrEnd:

AudioControlClassInterface:
db ACIntrfcDscrEnd-AudioControlClassInterface ;; Descriptor length
db CS_INTERFACE ;; Descriptor type
db HEADER ;; HEADER subtype
db 0x10,0x01 ;; Revision of Adudio Device Class Specification -1.1
db low(ClassLength) ;; Total size of class specific descriptors (LSB)
db high(ClassLength) ;; Total size of class specific descriptors (MSB)
db 1 ;; Number of AudioStreaming interfaces
db 1 ;; AudioStreaming interface ID
ACIntrfcDscrEnd:

InputTerminalDescriptor:
db InputTerminalEnd-InputTerminalDescriptor ; Length
db CS_INTERFACE ; Type = CS_INTERFACE
db INPUT_TERMINAL ; Subtype = INPUT_TERMINAL
db 1 ; Terminal ID
; dw Microphone ; Terminal type = Microphone
db 0x01,0x02 ; Terminal type = Microphone
db 0 ; Terminal association (none)
DB 1 ; Number of logical output channels
DW 0 ; Channel configuration = mono
DB 0 ; Channel name
DB 0 ; Terminal name
InputTerminalEnd:

FeatureDescriptor:
db FeatureEnd-FeatureDescriptor ; Length
db CS_INTERFACE ; Type = CS_INTERFACE
db FEATURE_UNIT ; Subtype = FEATURE_UNIT
db 2 ; Unit ID
db 1 ; bSourceID : TerminalID to which this feature is connected
db 2 ; bControlSize : Size in bytes of an element of bmaControls array
db 0x00 ; bmaControls[0] : D0-Mute,D1-Volume,D2-Bass,D3-Mid,D4-Treble,D5-Graphic,D6-Gain,D7-Delay
db 0x00 ; bmaControls[1] : D8-Bass Boost,D9-Loudness
db 0 ; Feature name
FeatureEnd:

OutputTerminalDescriptor:
DB OutputTerminalEnd-OutputTerminalDescriptor ; Length
db CS_INTERFACE ; Type = CS_INTERFACE
DB OUTPUT_TERMINAL ; Subtype = OUTPUT_TERMINAL
DB 3 ; Terminal ID
dw USB_Streaming ; Terminal type
DB 0 ; Terminal association (none)
DB 2 ; ID of the source terminal
DB 0 ; Terminal name
OutputTerminalEnd:

ClassLength EQU $-AudioControlClassInterface

AudioStreamingInterfaceAlt0:
DB ASInterfaceAlt0End-AudioStreamingInterfaceAlt0 ; Length
DB INTERFACE ; Type
DB 1 ; Interface ID
DB 0 ; Alternate setting
DB 0 ; NO endpoint is used for this interface
DB AUDIO ; Class = Audio
DB AUDIO_STREAMING ; Sub-class = Audio Streaming
DB 0 ; Protocol
DB 4 ; Interface name
ASInterfaceAlt0End:

AudioStreamingInterfaceAlt1:
DB ASInterfaceAlt1End-AudioStreamingInterfaceAlt1 ; Length
DB INTERFACE ; Type
DB 1 ; Interface ID
DB 1 ; Alternate setting
DB 1 ; Number of endpoint used by this interface:iso endpoint
DB AUDIO ; Class = Audio
DB AUDIO_STREAMING ; Sub-class = Audio Streaming
DB 0 ; Protocol
DB 4 ; Interface name
ASInterfaceAlt1End:

AudioStreamingClassInterface:
DB ASCSInterfaceEnd-AudioStreamingClassInterface ; Length
DB CS_INTERFACE ; Type
DB AS_GENERAL ; Subtype = AS_GENERAL
DB 3 ; Terminal connected to
DB 1 ; Interface delay
DB low(PCM) ; Audio Data Format = PCM
DB high(PCM) ; Audio Data Format = PCM
ASCSInterfaceEnd:

FormatTypeDescriptor:
DB FormatTypeEnd-FormatTypeDescriptor ; Length
DB CS_INTERFACE ; Type
DB FORMAT_TYPE ; Subtype = FORMAT_TYPE
DB FORMAT_TYPE_1 ; Type 1
DB 1 ; Number of physical channelsc
DB 2 ; Number of bytes in an audio subframe
DB 16 ; Number of bits per sample
DB 4 ; bSamFreqType : Number of discrete frequencies supported
DB 0x80,0x3e,0 ; 16000Hz
DB 0x22,0x56,0 ; 22050Hz
DB 0x00,0x7d,0 ; 32000Hz
DB 0x44,0xac,0 ; 44100Hz
FormatTypeEnd:

EndpointDescriptor:
DB EndpointDescEnd-EndpointDescriptor ; Length
DB ENDPOINT ; Type
DB 10001000B ; IN Endpoint 1
DB ET_ISO ; Transfer type = ISOCHRONOUS
DB 0x00,0x04       ; Maximum packet size
DB 1 ; Polling interval
DB 0 ; Refresh (unused)
DB 0 ; Endpoint used for syschronization info (unused)
EndpointDescEnd:

ClassEndpointDescriptor:
DB ClassEndpointEnd-ClassEndpointDescriptor ; Length
DB CS_ENDPOINT ; Type
DB EP_GENERAL ; Subtype = EP_GENERAL
DB 0 ; Attributes : support sampling frequence control
DB 0 ; Lock delay units (unused)
DW 0 ; Lock delay  (unused)
ClassEndpointEnd:

Configlength EQU $-ConfigDescriptor

StringDescriptor:

String0:
db String0End-String0 ;; String descriptor length
db STRING
db 09H,04H
String0End:

String1:
db String2-String1 ;; String descriptor length
db STRING
db \'I\',0,\'n\',0,\'t\',0,\'e\',0,\'l\',0,\' \',0
db \'C\',0,\'h\',0,\'i\',0,\'n\',0,\'a\',0

String2:
db String3-String2
db STRING
db \'8\',0,\'-\',0,\'C\',0,\'h\',0,\'a\',0,\'n\',0,\'n\',0,\'e\',0,\'l\',0,\' \',0
db \'M\',0,\'i\',0,\'c\',0,\'r\',0,\'o\',0,\'p\',0,\'h\',0,\'o\',0,\'n\',0,\'e\',0

String3:
DB (String4-String3)
db STRING
DB \"A\",0,\"u\",0,\"d\",0,\"i\",0,\"o\",0
DB \"C\",0,\"o\",0,\"n\",0,\"t\",0,\"r\",0,\"o\",0,\"l\",0
String4:
DB (UserDscr-String4)
       db STRING
DB \"A\",0,\"u\",0,\"d\",0,\"i\",0,\"o\",0
DB \"S\",0,\"t\",0,\"r\",0,\"e\",0,\"a\",0,\"m\",0,\"i\",0,\"n\",0,\"g\",0

UserDscr:
dw 0000H
end



[编辑 -  11/30/01 作者: MeiZX]
MeiZX
MeiZX
驱动牛犊
驱动牛犊
  • 注册日期2001-07-21
  • 最后登录2002-05-09
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2001-12-02 20:07
各位大虾帮帮我吧!
MeiZX
SDK
SDK
驱动小牛
驱动小牛
  • 注册日期2001-03-23
  • 最后登录2007-11-26
  • 粉丝0
  • 关注0
  • 积分61分
  • 威望7点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2001-12-03 07:56
其实你只要选用声卡类驱动程序,就不用自己写怎么复杂。如何实现请看些范例,当然也要看些书
MeiZX
驱动牛犊
驱动牛犊
  • 注册日期2001-07-21
  • 最后登录2002-05-09
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2001-12-03 13:20
在当前的firmware下,我的设备已经是一个标准的音频设备,现在缺的是音量不能控制,也就是说使用Windows的Sound Recorder仅仅不能调整音量,Host那一端不用写驱动程序,所有的工作都集中在firmware,现在我找不出其中的问题之所在,初步怀疑是否在描述表的Topology有问题?
MeiZX
游客

返回顶部