- Timestamp:
- May 14, 2021 12:59:51 PM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89014 r89043 48 48 * Defines * 49 49 *********************************************************************************************************************************/ 50 /** The test manifest file . */50 /** The test manifest file name. */ 51 51 #define AUDIOTEST_MANIFEST_FILE_STR "vkat_manifest.ini" 52 /** The current test manifest version. */ 52 53 #define AUDIOTEST_MANIFEST_VER 1 53 54 55 /** Test manifest header name. */ 54 56 #define AUDIOTEST_INI_SEC_HDR_STR "header" 55 57 … … 267 269 } 268 270 271 /** 272 * Writes string data to a test set manifest. 273 * 274 * @returns VBox status code. 275 * @param pSet Test set to write manifest for. 276 * @param pszFormat Format string to write. 277 * @param args Variable arguments for \a pszFormat. 278 */ 269 279 static int audioTestManifestWriteV(PAUDIOTESTSET pSet, const char *pszFormat, va_list args) 270 280 { … … 282 292 } 283 293 294 /** 295 * Writes a terminated string line to a test set manifest. 296 * Convenience function. 297 * 298 * @returns VBox status code. 299 * @param pSet Test set to write manifest for. 300 * @param pszFormat Format string to write. 301 * @param args Variable arguments for \a pszFormat. 302 */ 284 303 static int audioTestManifestWriteLn(PAUDIOTESTSET pSet, const char *pszFormat, ...) 285 304 { … … 299 318 } 300 319 320 /** 321 * Writes a section entry to a test set manifest. 322 * 323 * @returns VBox status code. 324 * @param pSet Test set to write manifest for. 325 * @param pszFormat Format string of section to write. 326 * @param args Variable arguments for \a pszFormat. 327 */ 301 328 static int audioTestManifestWriteSection(PAUDIOTESTSET pSet, const char *pszFormat, ...) 302 329 { … … 319 346 } 320 347 348 /** 349 * Initializes an audio test set, internal function. 350 * @param pSet Test set to initialize. 351 */ 321 352 static void audioTestSetInitInternal(PAUDIOTESTSET pSet) 322 353 { … … 324 355 } 325 356 357 /** 358 * Returns whether a test set's manifest file is open (and thus ready) or not. 359 * 360 * @returns \c true if open (and ready), or \c false if not. 361 * @retval VERR_ 362 * @param pSet Test set to return open status for. 363 */ 326 364 static bool audioTestManifestIsOpen(PAUDIOTESTSET pSet) 327 365 { … … 336 374 } 337 375 376 /** 377 * Initializes an audio test error description. 378 * 379 * @param pErr Test error description to initialize. 380 */ 338 381 static void audioTestErrorDescInit(PAUDIOTESTERRORDESC pErr) 339 382 { … … 342 385 } 343 386 387 /** 388 * Destroys an audio test error description. 389 * 390 * @param pErr Test error description to destroy. 391 */ 344 392 void AudioTestErrorDescDestroy(PAUDIOTESTERRORDESC pErr) 345 393 { … … 361 409 } 362 410 411 /** 412 * Returns if an audio test error description contains any errors or not. 413 * 414 * @returns \c true if it contains errors, or \c false if not. 415 * 416 * @param pErr Test error description to return error status for. 417 */ 363 418 bool AudioTestErrorDescFailed(PAUDIOTESTERRORDESC pErr) 364 419 { … … 372 427 } 373 428 374 static int audioTestErrorDescAddV(PAUDIOTESTERRORDESC pErr, int rc, const char *pszFormat, va_list args) 429 /** 430 * Adds a single error entry to an audio test error description, va_list version. 431 * 432 * @returns VBox status code. 433 * @param pErr Test error description to add entry for. 434 * @param rc Result code of entry to add. 435 * @param pszDesc Error description format string to add. 436 * @param args Optional format arguments of \a pszDesc to add. 437 */ 438 static int audioTestErrorDescAddV(PAUDIOTESTERRORDESC pErr, int rc, const char *pszDesc, va_list args) 375 439 { 376 440 PAUDIOTESTERRORENTRY pEntry = (PAUDIOTESTERRORENTRY)RTMemAlloc(sizeof(AUDIOTESTERRORENTRY)); 377 441 AssertReturn(pEntry, VERR_NO_MEMORY); 378 442 379 if (RTStrPrintf2V(pEntry->szDesc, sizeof(pEntry->szDesc), psz Format, args) < 0)443 if (RTStrPrintf2V(pEntry->szDesc, sizeof(pEntry->szDesc), pszDesc, args) < 0) 380 444 AssertFailedReturn(VERR_BUFFER_OVERFLOW); 381 445 … … 389 453 } 390 454 391 static int audioTestErrorDescAdd(PAUDIOTESTERRORDESC pErr, const char *pszFormat, ...) 455 /** 456 * Adds a single error entry to an audio test error description, va_list version. 457 * 458 * @returns VBox status code. 459 * @param pErr Test error description to add entry for. 460 * @param pszDesc Error description format string to add. 461 * @param ... Optional format arguments of \a pszDesc to add. 462 */ 463 static int audioTestErrorDescAdd(PAUDIOTESTERRORDESC pErr, const char *pszDesc, ...) 464 { 465 va_list va; 466 va_start(va, pszDesc); 467 468 int rc = audioTestErrorDescAddV(pErr, VERR_GENERAL_FAILURE /** @todo Fudge! */, pszDesc, va); 469 470 va_end(va); 471 return rc; 472 } 473 474 #if 0 475 static int audioTestErrorDescAddRc(PAUDIOTESTERRORDESC pErr, int rc, const char *pszFormat, ...) 392 476 { 393 477 va_list va; 394 478 va_start(va, pszFormat); 395 479 396 int rc = audioTestErrorDescAddV(pErr, VERR_GENERAL_FAILURE /** @todo Fudge! */, pszFormat, va);397 398 va_end(va);399 return rc;400 }401 402 #if 0403 static int audioTestErrorDescAddRc(PAUDIOTESTERRORDESC pErr, int rc, const char *pszFormat, ...)404 {405 va_list va;406 va_start(va, pszFormat);407 408 480 int rc2 = audioTestErrorDescAddV(pErr, rc, pszFormat, va); 409 481 … … 413 485 #endif 414 486 487 /** 488 * Creates a new temporary directory with a specific (test) tag. 489 * 490 * @returns VBox status code. 491 * @param pszPath Where to return the path of the created directory on success. 492 * @param cbPath Size (in bytes) of \a pszPath. 493 * @param pszTag Tag name to use for directory creation. 494 */ 415 495 int AudioTestPathCreateTemp(char *pszPath, size_t cbPath, const char *pszTag) 416 496 { 417 int rc = RTPathTemp(pszPath, cbPath); 497 char szPath[RTPATH_MAX]; 498 499 int rc = RTPathTemp(szPath, sizeof(szPath)); 418 500 AssertRCReturn(rc, rc); 419 rc = AudioTestPathCreate( pszPath, cbPath, pszTag);501 rc = AudioTestPathCreate(szPath, sizeof(szPath), pszTag); 420 502 AssertRCReturn(rc, rc); 421 503 422 return rc; 423 } 424 504 return RTStrCopy(pszPath, cbPath, szPath); 505 } 506 507 /** 508 * Creates a new audio test set. 509 * 510 * @returns VBox status code. 511 * @param pSet Test set to create. 512 * @param pszPath Absolute path to use for the test set's temporary directory. 513 * If NULL, the OS' temporary directory will be used. 514 * @param pszTag Tag name to use for this test set. 515 */ 425 516 int AudioTestSetCreate(PAUDIOTESTSET pSet, const char *pszPath, const char *pszTag) 426 517 { … … 495 586 } 496 587 588 /** 589 * Destroys a test set. 590 * 591 * @param pSet Test set to destroy. 592 */ 497 593 void AudioTestSetDestroy(PAUDIOTESTSET pSet) 498 594 { … … 507 603 } 508 604 605 /** 606 * Opens an existing audio test set. 607 * 608 * @returns VBox status code. 609 * @param pSet Test set to open. 610 * @param pszPath Absolute path of the test set to open. 611 */ 509 612 int AudioTestSetOpen(PAUDIOTESTSET pSet, const char *pszPath) 510 613 { … … 532 635 } 533 636 637 /** 638 * Closes an opened audio test set. 639 * 640 * @param pSet Test set to close. 641 */ 534 642 void AudioTestSetClose(PAUDIOTESTSET pSet) 535 643 { … … 537 645 } 538 646 647 /** 648 * Packs an audio test so that it's ready for transmission. 649 * 650 * @returns VBox status code. 651 * @param pSet Test set to pack. 652 * @param pszOutDir Where to store the packed test set. 653 */ 539 654 int AudioTestSetPack(PAUDIOTESTSET pSet, const char *pszOutDir) 540 655 { … … 547 662 } 548 663 664 /** 665 * Unpacks a formerly packed audio test set. 666 * 667 * @returns VBox status code. 668 * @param pszFile Test set file to unpack. 669 * @param pszOutDir Directory where to unpack the test set into. 670 * If the directory does not exist it will be created. 671 */ 549 672 int AudioTestSetUnpack(const char *pszFile, const char *pszOutDir) 550 673 { … … 556 679 } 557 680 681 /** 682 * Verifies an opened audio test set. 683 * 684 * @returns VBox status code. 685 * @param pSet Test set to verify. 686 * @param pszTag Tag to use for verification purpose. 687 * @param pErrDesc Where to return the test verification errors. 688 * 689 * @note Test verification errors have to be checked for errors, regardless of the 690 * actual return code. 691 */ 558 692 int AudioTestSetVerify(PAUDIOTESTSET pSet, const char *pszTag, PAUDIOTESTERRORDESC pErrDesc) 559 693 { -
trunk/src/VBox/Devices/Audio/AudioTest.h
r89019 r89043 24 24 #endif 25 25 26 /** Prefix for audio test (set) directories. */ 26 27 #define AUDIOTEST_PATH_PREFIX_STR "audio-test-" 27 28 … … 120 121 AUDIOTESTTYPE_INVALID = 0, 121 122 /** Play a test tone. */ 122 AUDIOTESTTYPE_TESTTONE 123 AUDIOTESTTYPE_TESTTONE, 124 /** The usual 32-bit hack. */ 125 AUDIOTESTTYPE_32BIT_HACK = 0x7fffffff 123 126 } AUDIOTESTTYPE; 124 127 … … 188 191 typedef struct AUDIOTESTERRORDESC 189 192 { 193 /** List entries containing the (FIFO-style) errors of type AUDIOTESTERRORENTRY. */ 190 194 RTLISTANCHOR List; 195 /** Number of errors in the list. */ 191 196 uint32_t cErrors; 192 197 } AUDIOTESTERRORDESC;
Note:
See TracChangeset
for help on using the changeset viewer.