1 #ifndef USB_AUDIO_H 2 #define USB_AUDIO_H 3 4 // (Partial) USB Class Definitions for Audio Devices, version 1.0 5 // Reference: http://www.usb.org/developers/devclass_docs/audio10.pdf 6 7 #include <BeBuild.h> // for _PACKED definition 8 9 #define USB_AUDIO_DEVICE_CLASS 0x01 10 #define USB_AUDIO_CLASS_VERSION 0x0100 11 12 enum { 13 USB_AUDIO_INTERFACE_AUDIO_CLASS = 0x01 14 }; 15 16 enum { // Audio Interface Subclasses 17 USB_AUDIO_INTERFACE_AUDIOCONTROL_SUBCLASS = 0x01, // 18 USB_AUDIO_INTERFACE_AUDIOSTREAMING_SUBCLASS, // 19 USB_AUDIO_INTERFACE_MIDISTREAMING_SUBCLASS // 20 }; 21 22 enum { // Audio Class-Specific AudioControl Interface descriptor subtypes 23 USB_AUDIO_AC_HEADER = 0x01, 24 USB_AUDIO_AC_INPUT_TERMINAL, 25 USB_AUDIO_AC_OUTPUT_TERMINAL, 26 USB_AUDIO_AC_MIXER_UNIT, 27 USB_AUDIO_AC_SELECTOR_UNIT, 28 USB_AUDIO_AC_FEATURE_UNIT, 29 USB_AUDIO_AC_PROCESSING_UNIT, 30 USB_AUDIO_AC_EXTENSION_UNIT 31 }; 32 33 enum { // Audio Class-Specific AudioStreaming Interface descriptor subtypes 34 USB_AUDIO_AS_GENERAL = 0x01, 35 USB_AUDIO_AS_FORMAT_TYPE, 36 USB_AUDIO_AS_FORMAT_SPECIFIC 37 }; 38 39 enum { // Processing Unit Process Types (for USB_AUDIO_AC_PROCESSING_UNIT) 40 USB_AUDIO_UPDOWNMIX_PROCESS = 0x01, 41 USB_AUDIO_DOLBY_PROLOGIC_PROCESS, 42 USB_AUDIO_3D_STEREO_EXTENDER_PROCESS, 43 USB_AUDIO_REVERBERATION_PROCESS, 44 USB_AUDIO_CHORUS_PROCESS, 45 USB_AUDIO_DYN_RANGE_COMP_PROCESS 46 }; 47 48 // AudioControl request codes 49 #define USB_AUDIO_SET_CURRENT 0x01 50 #define USB_AUDIO_GET_CURRENT 0x81 51 #define USB_AUDIO_SET_MIN 0x02 52 #define USB_AUDIO_GET_MIN 0x82 53 #define USB_AUDIO_SET_MAX 0x03 54 #define USB_AUDIO_GET_MAX 0x83 55 #define USB_AUDIO_SET_RES 0x04 56 #define USB_AUDIO_GET_RES 0x84 57 #define USB_AUDIO_SET_MEM 0x05 58 #define USB_AUDIO_GET_MEM 0x85 59 #define USB_AUDIO_GET_STATUS 0xFF 60 61 enum { // Terminal Control Selectors 62 USB_AUDIO_COPY_PROTECT_CONTROL = 0x01 63 }; 64 65 /* A.10.2 Feature Unit Control Selectors */ 66 #define AC_FU_CONTROL_UNDEFINED 0x00 67 #define USB_AUDIO_MUTE_CONTROL 0x01 68 #define USB_AUDIO_VOLUME_CONTROL 0x02 69 #define USB_AUDIO_BASS_CONTROL 0x03 70 #define USB_AUDIO_MID_CONTROL 0x04 71 #define USB_AUDIO_TREBLE_CONTROL 0x05 72 #define USB_AUDIO_GRAPHIC_EQUALIZER_CONTROL 0x06 73 #define USB_AUDIO_AUTOMATIC_GAIN_CONTROL 0x07 74 #define USB_AUDIO_DELAY_CONTROL 0x08 75 #define USB_AUDIO_BASS_BOOST_CONTROL 0x09 76 #define USB_AUDIO_LOUDNESS_CONTROL 0x0A 77 78 /* A.10.3.1 Up/Down-mix Processing Unit Control Selectors */ 79 #define USB_AUDIO_UD_CONTROL_UNDEFINED 0x00 80 #define USB_AUDIO_UD_ENABLED_CONTROL 0x01 81 #define USB_AUDIO_UD_MODE_SELECT_CONTROL 0x02 82 83 /* A.10.3.2 Dolby Prologic(tm) Processing Unit Control Selectors */ 84 #define USB_AUDIO_DP_CONTROL_UNDEFINED 0x00 85 #define USB_AUDIO_DP_ENABLE_CONTROL 0x01 86 #define USB_AUDIO_DP_MODE_SELECT_CONTROL 0x02 87 88 /* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */ 89 #define USB_AUDIO_3D_CONTROL_UNDEFINED 0x00 90 #define USB_AUDIO_3D_ENABLED_CONTROL 0x01 91 #define USB_AUDIO_3D_SPACIOUSNESS_CONTROL 0x03 92 93 /* A.10.3.4 Reverberation Processing Unit Control Selectors */ 94 #define USB_AUDIO_RV_CONTROL_UNDEFINED 0x00 95 #define USB_AUDIO_RV_ENABLE_CONTROL 0x01 96 #define USB_AUDIO_RV_REVERB_LEVEL_CONTROL 0x02 97 #define USB_AUDIO_RV_REVERB_TIME_CONTROL 0x03 98 #define USB_AUDIO_RV_REVERB_FEEDBACK_CONTROL 0x04 99 100 /* A.10.3.5 Chorus Processing Unit Control Selectors */ 101 #define USB_AUDIO_CH_CONTROL_UNDEFINED 0x00 102 #define USB_AUDIO_CH_ENABLE_CONTROL 0x01 103 #define USB_AUDIO_CHORUS_LEVEL_CONTROL 0x02 104 #define USB_AUDIO_CHORUS_RATE_CONTROL 0x03 105 #define USB_AUDIO_CHORUS_DETH_CONTROL 0x04 106 107 /* A.10.3.6 Dynamic Range Compressor Processing Unit Control Selectors */ 108 #define USB_AUDIO_DR_CONTROL_UNDEFINED 0x00 109 #define USB_AUDIO_DR_ENABLE_CONTROL 0x01 110 #define USB_AUDIO_COMPRESSION_RATE_CONTROL 0x02 111 #define USB_AUDIO_MAXAMPL_CONTROL 0x03 112 #define USB_AUDIO_THRESHOLD_CONTROL 0x04 113 #define USB_AUDIO_ATTACK_TIME 0x05 114 #define USB_AUDIO_RELEASE_TIME 0x06 115 116 /* A.10.4 Extension Unit Control Selectors */ 117 #define USB_AUDIO_XU_CONTROL_UNDEFINED 0x00 118 #define USB_AUDIO_XU_ENABLE_CONTROL 0x01 119 120 /* A.10.5 Endpoint Control Selectors */ 121 #define USB_AUDIO_EP_CONTROL_UNDEFINED 0x00 122 #define USB_AUDIO_SAMPLING_FREQ_CONTROL 0x01 123 #define USB_AUDIO_PITCH_CONTROL 0x02 124 125 typedef struct { 126 uint8 length; 127 uint8 type; 128 uint8 subtype; 129 uint8 format_type; 130 uint8 num_channels; 131 uint8 subframe_size; 132 uint8 bit_resolution; 133 uint8 sample_freq_type; 134 uint8 sample_freq[3]; // [0] + [1] << 8 + [2] << 16 135 // if sample_freq_type != 1, 136 // (sample_freq_type - 1) x uint8 sample_freq[3] follows... 137 } _PACKED usb_audio_format_type_descriptor; 138 139 #define USB_AUDIO_FORMAT_TYPE_UNDEFINED 0x00 140 #define USB_AUDIO_FORMAT_TYPE_I 0x01 141 #define USB_AUDIO_FORMAT_TYPE_II 0x02 142 #define USB_AUDIO_FORMAT_TYPE_III 0x03 143 144 #endif // USB_AUDIO_H 145