Changeset 61352 in vbox
- Timestamp:
- Jun 1, 2016 12:58:14 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r61320 r61352 92 92 int64_t i64LSample; 93 93 int64_t i64RSample; 94 } PDMAUDIOSAMPLE, *PPDMAUDIOSAMPLE; 94 } PDMAUDIOSAMPLE; 95 /** Pointer to a single (stereo) audio sample. */ 96 typedef PDMAUDIOSAMPLE *PPDMAUDIOSAMPLE; 97 /** Pointer to a const single (stereo) audio sample. */ 98 typedef PDMAUDIOSAMPLE const *PCPDMAUDIOSAMPLE; 95 99 96 100 typedef enum PDMAUDIOENDIANNESS … … 344 348 * the audioMixBufConvFromXXX / audioMixBufConvToXXX macros. 345 349 */ 346 typedef struct PDMAUDMIXBUF _CONVOPTS350 typedef struct PDMAUDMIXBUFCONVOPTS 347 351 { 348 352 /** Number of audio samples to convert. */ … … 352 356 * all conversion functions. */ 353 357 PDMAUDIOVOLUME Volume; 354 } PDMAUDMIXBUF_CONVOPTS, *PPDMAUDMIXBUF_CONVOPTS; 358 } PDMAUDMIXBUFCONVOPTS; 359 /** Pointer to conversion parameters for the audio mixer. */ 360 typedef PDMAUDMIXBUFCONVOPTS *PPDMAUDMIXBUFCONVOPTS; 361 /** Pointer to const conversion parameters for the audio mixer. */ 362 typedef PDMAUDMIXBUFCONVOPTS const *PCPDMAUDMIXBUFCONVOPTS; 355 363 356 364 /** … … 361 369 typedef PDMAUDIOMIXBUFFMT *PPDMAUDIOMIXBUFFMT; 362 370 363 /** Function pointer definition for a conversion-from routine 364 * used by the PDM audio mixing buffer. */ 365 typedef uint32_t (PDMAUDMIXBUF_FN_CONVFROM) (PPDMAUDIOSAMPLE paDst, const void *pvSrc, uint32_t cbSrc, const PPDMAUDMIXBUF_CONVOPTS pOpts); 366 typedef PDMAUDMIXBUF_FN_CONVFROM *PPDMAUDMIXBUF_FN_CONVFROM; 367 368 /** Function definition for a conversion-to routine 369 * used by the PDM audio mixing buffer. */ 370 typedef void (PDMAUDMIXBUF_FN_CONVTO) (void *pvDst, const PPDMAUDIOSAMPLE paSrc, const PPDMAUDMIXBUF_CONVOPTS pOpts); 371 typedef PDMAUDMIXBUF_FN_CONVTO *PPDMAUDMIXBUF_FN_CONVTO; 371 /** 372 * Convertion-from function used by the PDM audio buffer mixer. 373 * 374 * @returns Number of samples returned. 375 * @param paDst Where to return the converted samples. 376 * @param pvSrc The source samples bytes. 377 * @param cbSrc Number of bytes to convert. 378 * @param pOpts Conversion options. 379 */ 380 typedef DECLCALLBACK(uint32_t) FNPDMAUDIOMIXBUFCONVFROM(PPDMAUDIOSAMPLE paDst, const void *pvSrc, uint32_t cbSrc, 381 PCPDMAUDMIXBUFCONVOPTS pOpts); 382 /** Pointer to a convertion-from function used by the PDM audio buffer mixer. */ 383 typedef FNPDMAUDIOMIXBUFCONVFROM *PFNPDMAUDIOMIXBUFCONVFROM; 384 385 /** 386 * Convertion-to function used by the PDM audio buffer mixer. 387 * 388 * @param pvDst Output buffer. 389 * @param paSrc The input samples. 390 * @param pOpts Conversion options. 391 */ 392 typedef DECLCALLBACK(void) FNPDMAUDIOMIXBUFCONVTO(void *pvDst, PCPDMAUDIOSAMPLE paSrc, PCPDMAUDMIXBUFCONVOPTS pOpts); 393 /** Pointer to a convertion-to function used by the PDM audio buffer mixer. */ 394 typedef FNPDMAUDIOMIXBUFCONVTO *PFNPDMAUDIOMIXBUFCONVTO; 372 395 373 396 typedef struct PDMAUDIOMIXBUF *PPDMAUDIOMIXBUF; … … 408 431 PDMAUDIOMIXBUFFMT AudioFmt; 409 432 /** Standard conversion-to function for set AudioFmt. */ 410 P PDMAUDMIXBUF_FN_CONVTO pConvTo;433 PFNPDMAUDIOMIXBUFCONVTO pfnConvTo; 411 434 /** Standard conversion-from function for set AudioFmt. */ 412 P PDMAUDMIXBUF_FN_CONVFROM pConvFrom;435 PFNPDMAUDIOMIXBUFCONVFROM pfnConvFrom; 413 436 /** 414 437 * Ratio of the associated parent stream's frequency by this stream's -
trunk/src/VBox/Devices/Audio/AudioMixBuffer.cpp
r61346 r61352 132 132 AssertCompile(AUDIOMIXBUF_VOL_0DB == 0x40000000); /* For now -- when only attenuation is used. */ 133 133 134 /*135 * When running the audio testcases we want to verfiy136 * the macro-generated routines separately, so unmark them as being137 * inlined + static.138 */139 #ifdef VBOX_AUDIO_TESTCASE140 # define AUDMIXBUF_MACRO_FN141 #else142 # define AUDMIXBUF_MACRO_FN static inline143 #endif144 145 134 #ifdef DEBUG 146 135 static uint64_t s_cSamplesMixedTotal = 0; … … 385 374 386 375 size_t cbSamples = cSamples * sizeof(PDMAUDIOSAMPLE); 387 if (!cbSamples)388 return VERR_INVALID_PARAMETER;389 390 376 pMixBuf->pSamples = (PPDMAUDIOSAMPLE)RTMemAllocZ(cbSamples); 391 if ( !pMixBuf->pSamples)392 return VERR_NO_MEMORY;393 394 pMixBuf->cSamples = cSamples;395 396 return V INF_SUCCESS;377 if (pMixBuf->pSamples) 378 { 379 pMixBuf->cSamples = cSamples; 380 return VINF_SUCCESS; 381 } 382 return VERR_NO_MEMORY; 397 383 } 398 384 … … 414 400 #define AUDMIXBUF_CONVERT(_aName, _aType, _aMin, _aMax, _aSigned, _aShift) \ 415 401 /* Clips a specific output value to a single sample value. */ \ 416 AUDMIXBUF_MACRO_FN int64_taudioMixBufClipFrom##_aName(_aType aVal) \402 DECLCALLBACK(int64_t) audioMixBufClipFrom##_aName(_aType aVal) \ 417 403 { \ 418 404 if (_aSigned) \ … … 422 408 \ 423 409 /* Clips a single sample value to a specific output value. */ \ 424 AUDMIXBUF_MACRO_FN _aTypeaudioMixBufClipTo##_aName(int64_t iVal) \410 DECLCALLBACK(_aType) audioMixBufClipTo##_aName(int64_t iVal) \ 425 411 { \ 426 412 if (iVal >= 0x7fffffff) \ 427 413 return _aMax; \ 428 elseif (iVal < -INT64_C(0x80000000)) \414 if (iVal < -INT64_C(0x80000000)) \ 429 415 return _aMin; \ 430 416 \ … … 434 420 } \ 435 421 \ 436 AUDMIXBUF_MACRO_FN uint32_taudioMixBufConvFrom##_aName##Stereo(PPDMAUDIOSAMPLE paDst, const void *pvSrc, uint32_t cbSrc, \437 const PPDMAUDMIXBUF_CONVOPTS pOpts) \422 DECLCALLBACK(uint32_t) audioMixBufConvFrom##_aName##Stereo(PPDMAUDIOSAMPLE paDst, const void *pvSrc, uint32_t cbSrc, \ 423 PCPDMAUDMIXBUFCONVOPTS pOpts) \ 438 424 { \ 439 _aType *pSrc = (_aType*)pvSrc; \440 uint32_t cSamples = (uint32_t)RT_MIN(pOpts->cSamples, cbSrc / sizeof(_aType)); \425 _aType const *pSrc = (_aType const *)pvSrc; \ 426 uint32_t cSamples = RT_MIN(pOpts->cSamples, cbSrc / sizeof(_aType)); \ 441 427 AUDMIXBUF_MACRO_LOG(("cSamples=%RU32, BpS=%zu, lVol=%RU32, rVol=%RU32\n", \ 442 428 pOpts->cSamples, sizeof(_aType), pOpts->Volume.uLeft, pOpts->Volume.uRight)); \ … … 453 439 } \ 454 440 \ 455 AUDMIXBUF_MACRO_FN uint32_taudioMixBufConvFrom##_aName##Mono(PPDMAUDIOSAMPLE paDst, const void *pvSrc, uint32_t cbSrc, \456 const PPDMAUDMIXBUF_CONVOPTS pOpts) \441 DECLCALLBACK(uint32_t) audioMixBufConvFrom##_aName##Mono(PPDMAUDIOSAMPLE paDst, const void *pvSrc, uint32_t cbSrc, \ 442 PCPDMAUDMIXBUFCONVOPTS pOpts) \ 457 443 { \ 458 _aType *pSrc = (_aType*)pvSrc; \459 const uint32_t cSamples = (uint32_t)RT_MIN(pOpts->cSamples, cbSrc / sizeof(_aType)); \444 _aType const *pSrc = (_aType const *)pvSrc; \ 445 const uint32_t cSamples = RT_MIN(pOpts->cSamples, cbSrc / sizeof(_aType)); \ 460 446 AUDMIXBUF_MACRO_LOG(("cSamples=%RU32, BpS=%zu, lVol=%RU32, rVol=%RU32\n", \ 461 447 cSamples, sizeof(_aType), pOpts->Volume.uLeft >> 14, pOpts->Volume.uRight)); \ … … 472 458 } \ 473 459 \ 474 AUDMIXBUF_MACRO_FN void audioMixBufConvTo##_aName##Stereo(void *pvDst, const PPDMAUDIOSAMPLE paSrc, \ 475 const PPDMAUDMIXBUF_CONVOPTS pOpts) \ 460 DECLCALLBACK(void) audioMixBufConvTo##_aName##Stereo(void *pvDst, PCPDMAUDIOSAMPLE paSrc, PCPDMAUDMIXBUFCONVOPTS pOpts) \ 476 461 { \ 477 P PDMAUDIOSAMPLE pSrc = paSrc; \462 PCPDMAUDIOSAMPLE pSrc = paSrc; \ 478 463 _aType *pDst = (_aType *)pvDst; \ 479 464 _aType l, r; \ … … 491 476 } \ 492 477 \ 493 AUDMIXBUF_MACRO_FN void audioMixBufConvTo##_aName##Mono(void *pvDst, const PPDMAUDIOSAMPLE paSrc, \ 494 const PPDMAUDMIXBUF_CONVOPTS pOpts) \ 478 DECLCALLBACK(void) audioMixBufConvTo##_aName##Mono(void *pvDst, PCPDMAUDIOSAMPLE paSrc, PCPDMAUDMIXBUFCONVOPTS pOpts) \ 495 479 { \ 496 P PDMAUDIOSAMPLE pSrc = paSrc; \480 PCPDMAUDIOSAMPLE pSrc = paSrc; \ 497 481 _aType *pDst = (_aType *)pvDst; \ 498 482 uint32_t cSamples = pOpts->cSamples; \ … … 520 504 521 505 #define AUDMIXBUF_MIXOP(_aName, _aOp) \ 522 AUDMIXBUF_MACRO_FNvoid audioMixBufOp##_aName(PPDMAUDIOSAMPLE paDst, uint32_t cDstSamples, \523 524 525 506 static void audioMixBufOp##_aName(PPDMAUDIOSAMPLE paDst, uint32_t cDstSamples, \ 507 PPDMAUDIOSAMPLE paSrc, uint32_t cSrcSamples, \ 508 PPDMAUDIOSTRMRATE pRate, \ 509 uint32_t *pcDstWritten, uint32_t *pcSrcRead) \ 526 510 { \ 527 511 AUDMIXBUF_MACRO_LOG(("cSrcSamples=%RU32, cDstSamples=%RU32\n", cSrcSamples, cDstSamples)); \ … … 620 604 621 605 /** Dummy conversion used when the source is muted. */ 622 AUDMIXBUF_MACRO_FN uint32_taudioMixBufConvFromSilence(PPDMAUDIOSAMPLE paDst, const void *pvSrc,623 uint32_t cbSrc, const PPDMAUDMIXBUF_CONVOPTS pOpts)606 static DECLCALLBACK(uint32_t) audioMixBufConvFromSilence(PPDMAUDIOSAMPLE paDst, const void *pvSrc, 607 uint32_t cbSrc, PCPDMAUDMIXBUFCONVOPTS pOpts) 624 608 { 625 609 /* Internally zero always corresponds to silence. */ … … 637 621 * @param enmFmt Audio format to lookup conversion macro for. 638 622 */ 639 static P PDMAUDMIXBUF_FN_CONVFROM audioMixBufConvFromLookup(PDMAUDIOMIXBUFFMT enmFmt)623 static PFNPDMAUDIOMIXBUFCONVFROM audioMixBufConvFromLookup(PDMAUDIOMIXBUFFMT enmFmt) 640 624 { 641 625 if (AUDMIXBUF_FMT_SIGNED(enmFmt)) … … 698 682 * @param enmFmt Audio format to lookup conversion macro for. 699 683 */ 700 static P PDMAUDMIXBUF_FN_CONVTO audioMixBufConvToLookup(PDMAUDIOMIXBUFFMT enmFmt)684 static PFNPDMAUDIOMIXBUFCONVTO audioMixBufConvToLookup(PDMAUDIOMIXBUFFMT enmFmt) 701 685 { 702 686 if (AUDMIXBUF_FMT_SIGNED(enmFmt)) … … 792 776 pProps->fSigned); 793 777 794 pMixBuf->p ConvFrom = audioMixBufConvFromLookup(pMixBuf->AudioFmt);795 pMixBuf->p ConvTo = audioMixBufConvToLookup(pMixBuf->AudioFmt);778 pMixBuf->pfnConvFrom = audioMixBufConvFromLookup(pMixBuf->AudioFmt); 779 pMixBuf->pfnConvTo = audioMixBufConvToLookup(pMixBuf->AudioFmt); 796 780 797 781 pMixBuf->cShift = pProps->cShift; … … 1302 1286 if (cToProcess) 1303 1287 { 1304 P PDMAUDMIXBUF_FN_CONVTO pConv;1288 PFNPDMAUDIOMIXBUFCONVTO pfnConv; 1305 1289 if (pMixBuf->AudioFmt != enmFmt) 1306 p Conv = audioMixBufConvToLookup(enmFmt);1290 pfnConv = audioMixBufConvToLookup(enmFmt); 1307 1291 else 1308 p Conv = pMixBuf->pConvTo;1309 1310 if (p Conv)1292 pfnConv = pMixBuf->pfnConvTo; 1293 1294 if (pfnConv) 1311 1295 { 1312 PDMAUDMIXBUF _CONVOPTS convOpts = { cToProcess, pMixBuf->Volume };1313 1314 AssertPtr(p Conv);1315 p Conv(pvBuf, pMixBuf->pSamples + offSamples, &convOpts);1296 PDMAUDMIXBUFCONVOPTS convOpts = { cToProcess, pMixBuf->Volume }; 1297 1298 AssertPtr(pfnConv); 1299 pfnConv(pvBuf, pMixBuf->pSamples + offSamples, &convOpts); 1316 1300 1317 1301 #ifdef DEBUG … … 1389 1373 } 1390 1374 1391 P PDMAUDMIXBUF_FN_CONVTO pConv = audioMixBufConvToLookup(enmFmt);1392 if (!p Conv) /* Audio format not supported. */1375 PFNPDMAUDIOMIXBUFCONVTO pfnConv = audioMixBufConvToLookup(enmFmt); 1376 if (!pfnConv) /* Audio format not supported. */ 1393 1377 return VERR_NOT_SUPPORTED; 1394 1378 … … 1414 1398 } 1415 1399 1416 PDMAUDMIXBUF _CONVOPTS convOpts;1400 PDMAUDMIXBUFCONVOPTS convOpts; 1417 1401 convOpts.Volume = pMixBuf->Volume; 1418 1402 … … 1424 1408 1425 1409 AUDMIXBUF_LOG(("P1: offRead=%RU32, cToRead=%RU32\n", pMixBuf->offRead, cLenSrc1)); 1426 p Conv(pvBuf, pSamplesSrc1, &convOpts);1410 pfnConv(pvBuf, pSamplesSrc1, &convOpts); 1427 1411 } 1428 1412 … … 1437 1421 AUDMIXBUF_LOG(("P2: cToRead=%RU32, offWrite=%RU32 (%zu bytes)\n", cLenSrc2, cLenSrc1, 1438 1422 AUDIOMIXBUF_S2B(pMixBuf, cLenSrc1))); 1439 p Conv((uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenSrc1), pSamplesSrc2, &convOpts);1423 pfnConv((uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenSrc1), pSamplesSrc2, &convOpts); 1440 1424 } 1441 1425 … … 1593 1577 int AudioMixBufWriteAt(PPDMAUDIOMIXBUF pMixBuf, uint32_t offSamples, const void *pvBuf, uint32_t cbBuf, uint32_t *pcWritten) 1594 1578 { 1595 return AudioMixBufWriteAtEx(pMixBuf, pMixBuf->AudioFmt, 1596 offSamples, pvBuf, cbBuf, pcWritten); 1597 } 1598 1599 /** 1600 * Writes audio samples at a specific offset. The audio sample format1601 * to be written can be different from the audio format the mixing buffer1602 * operates on.1579 return AudioMixBufWriteAtEx(pMixBuf, pMixBuf->AudioFmt, offSamples, pvBuf, cbBuf, pcWritten); 1580 } 1581 1582 /** 1583 * Writes audio samples at a specific offset. 1584 * 1585 * The audio sample format to be written can be different from the audio format 1586 * the mixing buffer operates on. 1603 1587 * 1604 1588 * @return IPRT status code. … … 1619 1603 /* pcWritten is optional. */ 1620 1604 1605 /* 1606 * Adjust cToWrite so we don't overflow our buffers. 1607 */ 1608 int rc; 1621 1609 uint32_t cToWrite = AUDIOMIXBUF_B2S(pMixBuf, cbBuf); 1622 1623 int rc = VINF_SUCCESS; 1624 1625 if (offSamples + cToWrite > pMixBuf->cSamples) 1610 if (offSamples <= pMixBuf->cSamples) 1611 { 1612 if (offSamples + cToWrite <= pMixBuf->cSamples) 1613 rc = VINF_SUCCESS; 1614 else 1615 { 1616 rc = VINF_BUFFER_OVERFLOW; 1617 cToWrite = pMixBuf->cSamples - offSamples; 1618 } 1619 } 1620 else 1621 { 1626 1622 rc = VINF_BUFFER_OVERFLOW; 1627 1628 cToWrite = RT_MIN(cToWrite, pMixBuf->cSamples - offSamples); 1629 1630 PPDMAUDMIXBUF_FN_CONVFROM pConv; 1631 if (pMixBuf->AudioFmt != enmFmt) 1632 pConv = audioMixBufConvFromLookup(enmFmt); 1633 else 1634 { 1635 pConv = pMixBuf->Volume.fMuted 1636 ? &audioMixBufConvFromSilence : pMixBuf->pConvFrom; 1637 } 1638 1639 if (!pConv) 1640 rc = VERR_NOT_SUPPORTED; 1641 1642 uint32_t cWritten; 1623 cToWrite = 0; 1624 } 1643 1625 1644 1626 #ifdef AUDIOMIXBUF_DEBUG_DUMP_PCM_DATA 1645 RTFILE fh; 1646 int rc2 = RTFileOpen(&fh, AUDIOMIXBUF_DEBUG_DUMP_PCM_DATA_PATH "mixbuf_writeat.pcm", 1627 /* 1628 * Now that we know how much we'll be converting we can log it. 1629 */ 1630 RTFILE hFile; 1631 int rc2 = RTFileOpen(&hFile, AUDIOMIXBUF_DEBUG_DUMP_PCM_DATA_PATH "mixbuf_writeat.pcm", 1647 1632 RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 1648 1633 if (RT_SUCCESS(rc2)) 1649 1634 { 1650 RTFileWrite(fh, pvBuf, AUDIOMIXBUF_S2B(pMixBuf, cToWrite), NULL); 1651 RTFileClose(fh); 1652 } 1653 #endif 1654 1655 if ( pConv 1635 RTFileWrite(hFile, pvBuf, AUDIOMIXBUF_S2B(pMixBuf, cToWrite), NULL); 1636 RTFileClose(hFile); 1637 } 1638 #endif 1639 1640 /* 1641 * Pick the conversion function and do the conversion. 1642 */ 1643 PFNPDMAUDIOMIXBUFCONVFROM pfnConv; 1644 if (pMixBuf->AudioFmt != enmFmt) 1645 pfnConv = audioMixBufConvFromLookup(enmFmt); 1646 else 1647 pfnConv = pMixBuf->Volume.fMuted ? &audioMixBufConvFromSilence : pMixBuf->pfnConvFrom; 1648 1649 uint32_t cWritten; 1650 if ( pfnConv 1656 1651 && cToWrite) 1657 1652 { 1658 PDMAUDMIXBUF_CONVOPTS convOpts = { cToWrite, pMixBuf->Volume }; 1659 1660 cWritten = pConv(pMixBuf->pSamples + offSamples, pvBuf, AUDIOMIXBUF_S2B(pMixBuf, cToWrite), &convOpts); 1653 PDMAUDMIXBUFCONVOPTS convOpts = { cToWrite, pMixBuf->Volume }; 1654 cWritten = pfnConv(pMixBuf->pSamples + offSamples, pvBuf, AUDIOMIXBUF_S2B(pMixBuf, cToWrite), &convOpts); 1661 1655 } 1662 1656 else 1657 { 1663 1658 cWritten = 0; 1659 if (!pfnConv) 1660 rc = VERR_NOT_SUPPORTED; 1661 } 1664 1662 1665 1663 #ifdef DEBUG … … 1672 1670 cWritten, AUDIOMIXBUF_S2B(pMixBuf, cWritten), rc)); 1673 1671 1674 if (RT_SUCCESS(rc)) 1675 { 1676 if (pcWritten) 1677 *pcWritten = cWritten; 1678 } 1672 if (RT_SUCCESS(rc) && pcWritten) 1673 *pcWritten = cWritten; 1679 1674 1680 1675 return rc; … … 1682 1677 1683 1678 /** 1684 * Writes audio samples. The sample format being written must match the 1685 * format of the mixing buffer. 1679 * Writes audio samples. 1680 * 1681 * The sample format being written must match the format of the mixing buffer. 1686 1682 * 1687 1683 * @return IPRT status code, or VINF_BUFFER_OVERFLOW if samples which not have … … 1741 1737 } 1742 1738 1743 P PDMAUDMIXBUF_FN_CONVFROM pCnvFrm;1739 PFNPDMAUDIOMIXBUFCONVFROM pfnCnvFrm; 1744 1740 if (pMixBuf->AudioFmt != enmFmt) 1745 p CnvFrm = audioMixBufConvFromLookup(enmFmt);1741 pfnCnvFrm = audioMixBufConvFromLookup(enmFmt); 1746 1742 else 1747 { 1748 pCnvFrm = pMixBuf->Volume.fMuted 1749 ? &audioMixBufConvFromSilence : pMixBuf->pConvFrom; 1750 } 1751 1752 if (!pCnvFrm) 1743 pfnCnvFrm = pMixBuf->Volume.fMuted ? &audioMixBufConvFromSilence : pMixBuf->pfnConvFrom; 1744 1745 if (!pfnCnvFrm) 1753 1746 return VERR_NOT_SUPPORTED; 1754 1747 1755 int rc = VINF_SUCCESS; 1748 int rc = VINF_SUCCESS; /** @todo Move this down to where you actually need it and you'll get somewhat nice code! */ 1756 1749 1757 1750 uint32_t cToWrite = AUDIOMIXBUF_B2S(pMixBuf, cbBuf); … … 1792 1785 uint32_t cWrittenTotal = 0; 1793 1786 1794 PDMAUDMIXBUF _CONVOPTS convOpts;1787 PDMAUDMIXBUFCONVOPTS convOpts; 1795 1788 convOpts.Volume = pMixBuf->Volume; 1796 1789 … … 1799 1792 { 1800 1793 convOpts.cSamples = cLenDst1; 1801 cWrittenTotal = p CnvFrm(pSamplesDst1, pvBuf, AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), &convOpts);1794 cWrittenTotal = pfnCnvFrm(pSamplesDst1, pvBuf, AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), &convOpts); 1802 1795 Assert(cWrittenTotal == cLenDst1); 1803 1796 … … 1808 1801 1809 1802 /* Second part present? */ 1810 if ( RT_LIKELY(RT_SUCCESS(rc)) 1803 if ( RT_LIKELY(RT_SUCCESS(rc)) /** @todo r=bird: RT_SUCCESS implies RT_LIKELY for at least 10 years now. besides, it's actually always VINF_SUCCESS at this point. */ 1811 1804 && cLenDst2) 1812 1805 { … … 1814 1807 1815 1808 convOpts.cSamples = cLenDst2; 1816 cWrittenTotal += p CnvFrm(pSamplesDst2,1817 (uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenDst1),1818 cbBuf - AUDIOMIXBUF_S2B(pMixBuf, cLenDst1),1819 &convOpts);1820 Assert(cWrittenTotal == (cLenDst1 + cLenDst2));1809 cWrittenTotal += pfnCnvFrm(pSamplesDst2, 1810 (uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), 1811 cbBuf - AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), 1812 &convOpts); 1813 Assert(cWrittenTotal == cLenDst1 + cLenDst2); 1821 1814 1822 1815 #ifdef AUDIOMIXBUF_DEBUG_DUMP_PCM_DATA -
trunk/src/VBox/Devices/Audio/testcase/Makefile.kmk
r56085 r61352 25 25 26 26 tstAudioMixBuffer_TEMPLATE = VBOXR3TSTEXE 27 tstAudioMixBuffer_DEFS += TESTCASE 28 tstAudioMixBuffer_SOURCES = \ 27 tstAudioMixBuffer_DEFS = TESTCASE 28 tstAudioMixBuffer_DEFS.debug = VBOX_WITH_EF_WRAPS 29 tstAudioMixBuffer_SOURCES = \ 29 30 tstAudioMixBuffer.cpp \ 30 31 ../AudioMixBuffer.cpp \ 31 32 ../DrvAudioCommon.cpp 32 tstAudioMixBuffer_LIBS 33 tstAudioMixBuffer_LIBS = $(LIB_RUNTIME) 33 34 34 35 $$(tstAudioMixBuffer_0_OUTDIR)/tstAudioMixBuffer.run: $$(tstAudioMixBuffer_1_STAGE_TARGET) -
trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
r61343 r61352 90 90 /* Beyond buffer. */ 91 91 RTTESTI_CHECK_RC(AudioMixBufWriteAt(&mb, AudioMixBufSize(&mb) + 1, &samples16, sizeof(samples16), 92 &written), VERR_BUFFER_OVERFLOW); 92 &written), VINF_BUFFER_OVERFLOW); 93 /** @todo (bird): this was checking for VERR_BUFFER_OVERFLOW, which do you want 94 * the function to actually return? */ 93 95 94 96 /*
Note:
See TracChangeset
for help on using the changeset viewer.