Changeset 61399 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jun 2, 2016 8:54:51 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r61386 r61399 302 302 typedef struct AC97INPUTSTREAM 303 303 { 304 /** PCM line input stream. */ 305 R3PTRTYPE(PPDMAUDIOSTREAM) pStream; 306 /** Mixer handle for line input stream. */ 307 R3PTRTYPE(PAUDMIXSTREAM) pMixStrm; 304 /** Mixer handle for input stream. */ 305 R3PTRTYPE(PAUDMIXSTREAM) pMixStrm; 308 306 } AC97INPUTSTREAM, *PAC97INPUTSTREAM; 309 307 310 308 typedef struct AC97OUTPUTSTREAM 311 309 { 312 /** PCM output stream. */313 R3PTRTYPE(PPDMAUDIOSTREAM) pStream;314 310 /** Mixer handle for output stream. */ 315 R3PTRTYPE(PAUDMIXSTREAM) 311 R3PTRTYPE(PAUDMIXSTREAM) pMixStrm; 316 312 } AC97OUTPUTSTREAM, *PAC97OUTPUTSTREAM; 317 313 … … 531 527 } 532 528 529 static bool ichac97StreamIsActive(PAC97STATE pThis, PAC97STREAM pStream) 530 { 531 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 532 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 533 534 bool fActive = AudioMixerSinkHasData(ichac97IndexToSink(pThis, pStream->u8Strm)); 535 536 LogFlowFunc(("SD=%RU8, fActive=%RTbool\n", pStream->u8Strm, fActive)); 537 return fActive; 538 } 539 533 540 static int ichac97StreamSetActive(PAC97STATE pThis, PAC97STREAM pStream, bool fActive) 534 541 { … … 1246 1253 uint32_t cbToWrite = RT_MIN(cbElapsed, (uint32_t)sizeof(pThis->silence)); 1247 1254 uint32_t cbWrittenToStream; 1248 int rc2; 1249 1250 PAC97DRIVER pDrv; 1251 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 1252 { 1253 if (pDrv->pConnector->pfnStreamGetStatus(pDrv->pConnector, pDrv->Out.pStream) == PDMAUDIOSTRMSTS_FLAG_ENABLED) 1254 { 1255 rc2 = pDrv->pConnector->pfnStreamWrite(pDrv->pConnector, pDrv->Out.pStream, 1256 pThis->silence, cbToWrite, &cbWrittenToStream); 1257 if (RT_SUCCESS(rc2)) 1258 { 1259 if (cbWrittenToStream < cbToWrite) /* Lagging behind? */ 1260 LogFlowFunc(("\tLUN#%RU8: Warning: Only written %RU32 / %RU32 bytes, expect lags\n", 1261 pDrv->uLUN, cbWrittenToStream, cbToWrite)); 1262 } 1263 } 1264 else /* Stream disabled, not fatal. */ 1265 { 1266 cbWrittenToStream = 0; 1267 rc2 = VERR_NOT_AVAILABLE; 1268 /* Keep going. */ 1269 } 1255 1256 int rc2 = AudioMixerSinkWrite(pThis->pSinkOutput, AUDMIXOP_COPY, 1257 pThis->silence, cbToWrite, &cbWrittenToStream); 1258 if (RT_SUCCESS(rc2)) 1259 { 1260 if (cbWrittenToStream < cbToWrite) /* Lagging behind? */ 1261 LogFlowFunc(("Warning: Only written %RU32 / %RU32 bytes, expect lags\n", cbWrittenToStream, cbToWrite)); 1270 1262 } 1271 1263 … … 2089 2081 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 2090 2082 2083 LogFlowFuncEnter(); 2084 2091 2085 SSMR3PutU32(pSSM, pThis->glob_cnt); 2092 2086 SSMR3PutU32(pSSM, pThis->glob_sta); … … 2106 2100 uint8_t active[LAST_INDEX]; 2107 2101 2108 PAC97DRIVER pDrv; 2109 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 2110 { 2111 PPDMIAUDIOCONNECTOR pCon = pDrv->pConnector; 2112 AssertPtr(pCon); 2113 active[PI_INDEX] = (pCon->pfnStreamGetStatus(pCon, pDrv->LineIn.pStream) & PDMAUDIOSTRMSTS_FLAG_ENABLED) ? 1 : 0; 2114 active[PO_INDEX] = (pCon->pfnStreamGetStatus(pCon, pDrv->Out.pStream) & PDMAUDIOSTRMSTS_FLAG_ENABLED) ? 1 : 0; 2115 active[MC_INDEX] = (pCon->pfnStreamGetStatus(pCon, pDrv->MicIn.pStream) & PDMAUDIOSTRMSTS_FLAG_ENABLED) ? 1 : 0; 2116 } 2102 active[PI_INDEX] = ichac97StreamIsActive(pThis, &pThis->StreamLineIn) ? 1 : 0; 2103 active[PO_INDEX] = ichac97StreamIsActive(pThis, &pThis->StreamOut) ? 1 : 0; 2104 active[MC_INDEX] = ichac97StreamIsActive(pThis, &pThis->StreamMicIn) ? 1 : 0; 2117 2105 2118 2106 SSMR3PutMem(pSSM, active, sizeof(active)); 2119 2107 2108 LogFlowFuncLeaveRC(VINF_SUCCESS); 2120 2109 return VINF_SUCCESS; 2121 2110 } … … 2146 2135 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 2147 2136 2137 LogRel2(("ichac97LoadExec: uVersion=%RU32, uPass=0x%x\n", uVersion, uPass)); 2138 2148 2139 AssertMsgReturn (uVersion == AC97_SSM_VERSION, ("%RU32\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION); 2149 2140 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); … … 2180 2171 2181 2172 int rc = ichac97StreamsInit(pThis); 2182 AssertRC(rc);2183 2184 /** @todo r=andy Stream IDs are hardcoded to certain streams. */2185 rc = ichac97StreamSetActive(pThis, &pThis->StreamLineIn,RT_BOOL(uaStrmsActive[PI_INDEX]));2186 AssertRC(rc);2187 rc = ichac97StreamSetActive(pThis, &pThis->StreamMicIn,RT_BOOL(uaStrmsActive[MC_INDEX]));2188 AssertRC(rc);2189 rc = ichac97StreamSetActive(pThis, &pThis->StreamOut,RT_BOOL(uaStrmsActive[PO_INDEX]));2190 AssertRC(rc);2191 2192 pThis->bup_flag = 0;2173 if (RT_SUCCESS(rc)) 2174 { 2175 /** @todo r=andy Stream IDs are hardcoded to certain streams. */ 2176 rc = ichac97StreamSetActive(pThis, &pThis->StreamLineIn, RT_BOOL(uaStrmsActive[PI_INDEX])); 2177 if (RT_SUCCESS(rc)) 2178 rc = ichac97StreamSetActive(pThis, &pThis->StreamMicIn, RT_BOOL(uaStrmsActive[MC_INDEX])); 2179 if (RT_SUCCESS(rc)) 2180 rc = ichac97StreamSetActive(pThis, &pThis->StreamOut, RT_BOOL(uaStrmsActive[PO_INDEX])); 2181 } 2182 2183 pThis->bup_flag = 0; 2193 2184 pThis->last_samp = 0; 2194 2185 2195 return VINF_SUCCESS; 2186 LogFlowFuncLeaveRC(rc); 2187 return rc; 2196 2188 } 2197 2189
Note:
See TracChangeset
for help on using the changeset viewer.