Changeset 89890 in vbox for trunk/src/VBox/Devices/Audio/AudioTest.cpp
- Timestamp:
- Jun 24, 2021 3:56:05 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89889 r89890 128 128 129 129 /** 130 * Returns a random test tone frequency.131 */132 DECLINLINE(double) audioTestToneGetRandomFreq(void)133 {134 return s_aAudioTestToneFreqsHz[RTRandU32Ex(0, RT_ELEMENTS(s_aAudioTestToneFreqsHz) - 1)];135 }136 137 /**138 130 * Initializes a test tone with a specific frequency (in Hz). 139 131 * … … 147 139 { 148 140 if (dbFreq == 0.0) 149 dbFreq = audioTestToneGetRandomFreq();141 dbFreq = AudioTestToneGetRandomFreq(); 150 142 151 143 pTone->rdFreqHz = dbFreq; … … 290 282 291 283 /** 292 * Initializes an audio test tone parameters struct with random values. 293 * @param pToneParams Test tone parameters to initialize. 294 * @param pProps PCM properties to use for the test tone. 295 */ 296 int AudioTestToneParamsInitRandom(PAUDIOTESTTONEPARMS pToneParams, PPDMAUDIOPCMPROPS pProps) 297 { 298 AssertReturn(PDMAudioPropsAreValid(pProps), VERR_INVALID_PARAMETER); 299 300 memcpy(&pToneParams->Props, pProps, sizeof(PDMAUDIOPCMPROPS)); 301 302 /** @todo Make this a bit more sophisticated later, e.g. muting and prequel/sequel are not very balanced. */ 303 304 pToneParams->dbFreqHz = audioTestToneGetRandomFreq(); 305 pToneParams->msPrequel = RTRandU32Ex(0, RT_MS_5SEC); 306 #ifdef DEBUG_andy 307 pToneParams->msDuration = RTRandU32Ex(0, RT_MS_1SEC); 308 #else 309 pToneParams->msDuration = RTRandU32Ex(0, RT_MS_10SEC); /** @todo Probably a bit too long, but let's see. */ 310 #endif 311 pToneParams->msSequel = RTRandU32Ex(0, RT_MS_5SEC); 312 pToneParams->uVolumePercent = RTRandU32Ex(0, 100); 313 314 return VINF_SUCCESS; 284 * Returns a random test tone frequency. 285 */ 286 double AudioTestToneGetRandomFreq(void) 287 { 288 return s_aAudioTestToneFreqsHz[RTRandU32Ex(0, RT_ELEMENTS(s_aAudioTestToneFreqsHz) - 1)]; 315 289 } 316 290 … … 1411 1385 1412 1386 /** 1387 * Returns whether a test set has running (active) tests or not. 1388 * 1389 * @returns \c true if it has running tests, or \c false if not. 1390 * @param pSet Test set to return status for. 1391 */ 1392 bool AudioTestSetIsRunning(PAUDIOTESTSET pSet) 1393 { 1394 return (pSet->cTestsRunning > 0); 1395 } 1396 1397 /** 1413 1398 * Unpacks a formerly packed audio test set. 1414 1399 * … … 1713 1698 rc = RTFileQuerySize(pObjB->File.hFile, &cbSizeB); 1714 1699 AssertRCReturn(rc, rc); 1715 if ( cbSizeA != cbSizeB 1716 || !audioTestFilesCompareBinary(pObjA->File.hFile, pObjB->File.hFile, cbSizeA)) 1700 1701 if (!cbSizeA) 1702 { 1703 int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "File '%s' is empty\n", pObjA->szName); 1704 AssertRC(rc2); 1705 } 1706 1707 if (!cbSizeB) 1708 { 1709 int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "File '%s' is empty\n", pObjB->szName); 1710 AssertRC(rc2); 1711 } 1712 1713 if (cbSizeA != cbSizeB) 1714 { 1715 int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes %s than '%s'\n", 1716 pObjA->szName, 1717 cbSizeA > cbSizeB ? cbSizeA - cbSizeB : cbSizeB - cbSizeA, 1718 cbSizeA > cbSizeB ? "bigger" : "smaller", 1719 pObjB->szName); 1720 AssertRC(rc2); 1721 } 1722 else if (audioTestFilesCompareBinary(pObjA->File.hFile, pObjB->File.hFile, cbSizeA)) 1717 1723 { 1718 1724 /** @todo Add more sophisticated stuff here. */ 1719 1725 1720 int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "Files '%s' and '%s' don't match\n", szObjA, szObjB); 1726 int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "Files '%s' and '%s' have different content\n", 1727 pObjA->szName, pObjB->szName); 1721 1728 AssertRC(rc2); 1722 1729 }
Note:
See TracChangeset
for help on using the changeset viewer.