Changeset 33749 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Nov 3, 2010 7:41:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevCodec.cpp
r33748 r33749 124 124 #define CODEC_F00_09_CAP_LSB RT_BIT(0) 125 125 126 /* Supported PCM size, rates (7.3.4.7) */ 127 #define CODEC_F00_0A_32_BIT RT_BIT(20) 128 #define CODEC_F00_0A_24_BIT RT_BIT(19) 129 #define CODEC_F00_0A_16_BIT RT_BIT(18) 130 #define CODEC_F00_0A_8_BIT RT_BIT(17) 131 132 #define CODEC_F00_0A_48KHZ_MULT_8X RT_BIT(11) 133 #define CODEC_F00_0A_48KHZ_MULT_4X RT_BIT(10) 134 #define CODEC_F00_0A_44_1KHZ_MULT_4X RT_BIT(9) 135 #define CODEC_F00_0A_48KHZ_MULT_2X RT_BIT(8) 136 #define CODEC_F00_0A_44_1KHZ_MULT_2X RT_BIT(7) 137 #define CODEC_F00_0A_48KHZ RT_BIT(6) 138 #define CODEC_F00_0A_44_1KHZ RT_BIT(5) 139 /* 2/3 * 48kHz */ 140 #define CODEC_F00_0A_48KHZ_2_3X RT_BIT(4) 141 /* 1/2 * 44.1kHz */ 142 #define CODEC_F00_0A_44_1KHZ_1_2X RT_BIT(3) 143 /* 1/3 * 48kHz */ 144 #define CODEC_F00_0A_48KHZ_1_3X RT_BIT(2) 145 /* 1/4 * 44.1kHz */ 146 #define CODEC_F00_0A_44_1KHZ_1_4X RT_BIT(1) 147 /* 1/6 * 48kHz */ 148 #define CODEC_F00_0A_48KHZ_1_6X RT_BIT(0) 149 126 150 /* Pin Capabilities (7.3.4.9)*/ 127 151 #define CODEC_MAKE_F00_0C(vref_ctrl) (((vref_ctrl) & 0xFF) << 8) … … 137 161 #define CODEC_F00_0C_CAP_TRIGGER_REQUIRED RT_BIT(1) 138 162 #define CODEC_F00_0C_CAP_IMPENDANCE_SENSE RT_BIT(0) 163 139 164 140 165 /* HDA spec 7.3.3.31 defines layout of configuration registers/verbs (0xF1C) */ … … 2194 2219 AssertMsgFailed(("Unsupported Codec")); 2195 2220 } 2196 uint8_t i;2197 Assert(pState->pNodes);2198 Assert(pState->pfnCodecNodeReset);2199 for (i = 0; i < pState->cTotalNodes; ++i)2200 {2201 pState->pfnCodecNodeReset(pState, i, &pState->pNodes[i]);2202 }2203 2221 /* common root node initializers */ 2204 2222 pState->pNodes[0].node.au32F00_param[0] = CODEC_MAKE_F00_00(pState->u16VendorId, pState->u16DeviceId); … … 2230 2248 && AUDIO_FORMAT_SELECTOR((pState), In, (base), (mult), (div))) 2231 2249 2232 pState->pNodes[1].node.au32F00_param[0xA] = RT_BIT(17); /* 16-bit samples */2250 pState->pNodes[1].node.au32F00_param[0xA] = CODEC_F00_0A_16_BIT; 2233 2251 SETUP_AUDIO_FORMAT(pState, AFMT_HZ_44_1K, AFMT_MULT_X1, AFMT_DIV_X1, "hda44_1", as, pi_callback, po_callback); 2234 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_44_1K, AFMT_MULT_X1, AFMT_DIV_X1) ? RT_BIT(5): 0;2252 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_44_1K, AFMT_MULT_X1, AFMT_DIV_X1) ? CODEC_F00_0A_44_1KHZ : 0; 2235 2253 2236 2254 #ifdef VBOX_WITH_AUDIO_FLEXIBLE_FORMAT 2237 2255 as.freq *= 2; /* 2 * 44.1kHz */ 2238 2256 SETUP_AUDIO_FORMAT(pState, AFMT_HZ_44_1K, AFMT_MULT_X2, AFMT_DIV_X1, "hda44_1_2x", as, pi_callback, po_callback); 2239 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_44_1K, AFMT_MULT_X2, AFMT_DIV_X1) ? RT_BIT(7): 0;2257 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_44_1K, AFMT_MULT_X2, AFMT_DIV_X1) ? CODEC_F00_0A_44_1KHZ_MULT_2X : 0; 2240 2258 2241 2259 as.freq *= 2; /* 4 * 44.1kHz */ 2242 2260 SETUP_AUDIO_FORMAT(pState, AFMT_HZ_44_1K, AFMT_MULT_X4, AFMT_DIV_X1, "hda44_1_4x", as, pi_callback, po_callback); 2243 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_44_1K, AFMT_MULT_X4, AFMT_DIV_X1) ? RT_BIT(9): 0;2261 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_44_1K, AFMT_MULT_X4, AFMT_DIV_X1) ? CODEC_F00_0A_44_1KHZ_MULT_4X : 0; 2244 2262 2245 2263 as.freq = 48000; 2246 2264 SETUP_AUDIO_FORMAT(pState, AFMT_HZ_48K, AFMT_MULT_X1, AFMT_DIV_X1, "hda48", as, pi_callback, po_callback); 2247 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_48K, AFMT_MULT_X1, AFMT_DIV_X1) ? RT_BIT(6): 0;2265 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_48K, AFMT_MULT_X1, AFMT_DIV_X1) ? CODEC_F00_0A_48KHZ : 0; 2248 2266 2249 2267 # if 0 2250 2268 as.freq *= 2; /* 2 * 48kHz */ 2251 2269 SETUP_AUDIO_FORMAT(pState, AFMT_HZ_48K, AFMT_MULT_X2, AFMT_DIV_X1, "hda48_2x", as, pi_callback, po_callback); 2252 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_48K, AFMT_MULT_X2, AFMT_DIV_X1) ? RT_BIT(8): 0;2270 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_48K, AFMT_MULT_X2, AFMT_DIV_X1) ? CODEC_F00_0A_48KHZ_MULT_2X : 0; 2253 2271 2254 2272 as.freq *= 2; /* 4 * 48kHz */ 2255 2273 SETUP_AUDIO_FORMAT(pState, AFMT_HZ_48K, AFMT_MULT_X4, AFMT_DIV_X1, "hda48_4x", as, pi_callback, po_callback); 2256 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_48K, AFMT_MULT_X4, AFMT_DIV_X1) ? RT_BIT(10): 0;2274 pState->pNodes[1].node.au32F00_param[0xA] |= IS_FORMAT_SUPPORTED_BY_HOST(pState, AFMT_HZ_48K, AFMT_MULT_X4, AFMT_DIV_X1) ? CODEC_F00_0A_48KHZ_MULT_4X : 0; 2257 2275 # endif 2258 2276 #endif 2259 2277 #undef SETUP_AUDIO_FORMAT 2260 2278 #undef IS_FORMAT_SUPPORTED_BY_HOST 2279 2280 uint8_t i; 2281 Assert(pState->pNodes); 2282 Assert(pState->pfnCodecNodeReset); 2283 for (i = 0; i < pState->cTotalNodes; ++i) 2284 { 2285 pState->pfnCodecNodeReset(pState, i, &pState->pNodes[i]); 2286 } 2261 2287 2262 2288 codecToAudVolume(&pState->pNodes[pState->u8DacLineOut].dac.B_params, AUD_MIXER_VOLUME);
Note:
See TracChangeset
for help on using the changeset viewer.