Changeset 91632 in vbox for trunk/src/VBox/ValidationKit/utils
- Timestamp:
- Oct 8, 2021 6:59:29 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 147357
- Location:
- trunk/src/VBox/ValidationKit/utils/audio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r91454 r91632 122 122 VKAT_TEST_OPT_COUNT = 900, 123 123 VKAT_TEST_OPT_DEV, 124 VKAT_TEST_OPT_TONE_DURATION_MS,125 124 VKAT_TEST_OPT_GUEST_ATS_ADDR, 126 125 VKAT_TEST_OPT_GUEST_ATS_PORT, … … 142 141 VKAT_TEST_OPT_TCP_BIND_PORT, 143 142 VKAT_TEST_OPT_TCP_CONNECT_ADDRESS, 144 VKAT_TEST_OPT_TCP_CONNECT_PORT 143 VKAT_TEST_OPT_TCP_CONNECT_PORT, 144 VKAT_TEST_OPT_TONE_DURATION_MS, 145 VKAT_TEST_OPT_TONE_VOL_PERCENT 145 146 }; 146 147 … … 195 196 { "--tag", VKAT_TEST_OPT_TAG, RTGETOPT_REQ_STRING }, 196 197 { "--tempdir", VKAT_TEST_OPT_TEMPDIR, RTGETOPT_REQ_STRING }, 197 { "--vol ume",VKAT_TEST_OPT_VOL, RTGETOPT_REQ_UINT8 },198 { "--vol", VKAT_TEST_OPT_VOL, RTGETOPT_REQ_UINT8 }, 198 199 { "--tcp-bind-addr", VKAT_TEST_OPT_TCP_BIND_ADDRESS, RTGETOPT_REQ_STRING }, 199 200 { "--tcp-bind-port", VKAT_TEST_OPT_TCP_BIND_PORT, RTGETOPT_REQ_UINT16 }, 200 201 { "--tcp-connect-addr", VKAT_TEST_OPT_TCP_CONNECT_ADDRESS, RTGETOPT_REQ_STRING }, 201 202 { "--tcp-connect-port", VKAT_TEST_OPT_TCP_CONNECT_PORT, RTGETOPT_REQ_UINT16 }, 202 { "--tone-duration", VKAT_TEST_OPT_TONE_DURATION_MS, RTGETOPT_REQ_UINT32 } 203 { "--tone-duration", VKAT_TEST_OPT_TONE_DURATION_MS, RTGETOPT_REQ_UINT32 }, 204 { "--tone-vol", VKAT_TEST_OPT_TONE_VOL_PERCENT, RTGETOPT_REQ_UINT8 } 203 205 }; 204 206 … … 275 277 276 278 pTstParmsAcq->enmType = AUDIOTESTTYPE_TESTTONE_PLAY; 277 pTstParmsAcq->Props = pTstEnv->Props;278 279 pTstParmsAcq->enmDir = PDMAUDIODIR_OUT; 279 280 pTstParmsAcq->cIterations = pTstEnv->cIterations == 0 ? RTRandU32Ex(1, 10) : pTstEnv->cIterations; 280 281 pTstParmsAcq->idxCurrent = 0; 281 282 282 PAUDIOTESTTONEPARMS pToneParms = &pTstParmsAcq->TestTone; 283 284 pToneParms->Props = pTstParmsAcq->Props; 285 pToneParms->dbFreqHz = AudioTestToneGetRandomFreq(); 286 pToneParms->msPrequel = 0; /** @todo Implement analyzing this first! */ 287 pToneParms->msDuration = pTstEnv->cMsToneDuration == 0 ? RTRandU32Ex(200, RT_MS_30SEC) : pTstEnv->cMsToneDuration; 288 pToneParms->msSequel = 0; /** @todo Implement analyzing this first! */ 289 pToneParms->uVolumePercent = 100; /** @todo Implement analyzing this first! */ 283 pTstParmsAcq->TestTone = pTstEnv->ToneParms; 290 284 291 285 return rc; … … 381 375 382 376 pTstParmsAcq->enmType = AUDIOTESTTYPE_TESTTONE_RECORD; 383 pTstParmsAcq->Props = pTstEnv->Props;384 377 pTstParmsAcq->enmDir = PDMAUDIODIR_IN; 385 378 pTstParmsAcq->cIterations = pTstEnv->cIterations == 0 ? RTRandU32Ex(1, 10) : pTstEnv->cIterations; 386 379 pTstParmsAcq->idxCurrent = 0; 387 380 388 PAUDIOTESTTONEPARMS pToneParms = &pTstParmsAcq->TestTone; 389 390 pToneParms->Props = pTstParmsAcq->Props; 391 pToneParms->dbFreqHz = AudioTestToneGetRandomFreq(); 392 pToneParms->msPrequel = 0; /** @todo Implement analyzing this first! */ 393 pToneParms->Props = pTstParmsAcq->Props; 394 pToneParms->msDuration = pTstEnv->cMsToneDuration == 0 ? RTRandU32Ex(200, RT_MS_30SEC) : pTstEnv->cMsToneDuration; 395 pToneParms->msSequel = 0; /** @todo Implement analyzing this first! */ 396 pToneParms->uVolumePercent = 100; /** @todo Implement analyzing this first! */ 381 pTstParmsAcq->TestTone = pTstEnv->ToneParms; 397 382 398 383 return rc; … … 717 702 case VKAT_TEST_OPT_DEV: return "Name of the input/output device to use\n" 718 703 " Default: default device"; 719 case VKAT_TEST_OPT_TONE_DURATION_MS: return "Duration (in ms) of test tone to play / record for selected tests\n" 720 " Default: random number"; 704 case VKAT_TEST_OPT_TONE_DURATION_MS: return "Test tone duration to play / record (ms)\n" 705 " Default: random duration"; 706 case VKAT_TEST_OPT_TONE_VOL_PERCENT: return "Test tone volume (percent)\n" 707 " Default: 100"; 721 708 case VKAT_TEST_OPT_GUEST_ATS_ADDR: return "Address of guest ATS to connect to\n" 722 709 " Default: " ATS_TCP_DEF_CONNECT_GUEST_STR; … … 727 714 case VKAT_TEST_OPT_HOST_ATS_PORT: return "Port of host ATS to connect to\n" 728 715 " Default: 6052"; /* ATS_TCP_DEF_BIND_PORT_VALKIT */ 729 case VKAT_TEST_OPT_MODE: return " Specifies the test mode to use when running the tests";716 case VKAT_TEST_OPT_MODE: return "Test mode to use when running the tests"; 730 717 case VKAT_TEST_OPT_NO_VERIFY: return "Skips the verification step"; 731 case VKAT_TEST_OPT_OUTDIR: return " Specifies the output directory to use";718 case VKAT_TEST_OPT_OUTDIR: return "Output directory to use"; 732 719 case VKAT_TEST_OPT_PAUSE: return "Not yet implemented"; 733 case VKAT_TEST_OPT_PCM_HZ: return " Specifies the PCM Hetz (Hz) rate to use\n"720 case VKAT_TEST_OPT_PCM_HZ: return "PCM Hertz (Hz) rate to use\n" 734 721 " Default: 44100"; 735 case VKAT_TEST_OPT_PCM_BIT: return " Specifies thePCM sample bits (i.e. 16) to use\n"722 case VKAT_TEST_OPT_PCM_BIT: return "PCM sample bits (i.e. 16) to use\n" 736 723 " Default: 16"; 737 case VKAT_TEST_OPT_PCM_CHAN: return " Specifies the number ofPCM channels to use\n"724 case VKAT_TEST_OPT_PCM_CHAN: return "PCM channels to use\n" 738 725 " Default: 2"; 739 case VKAT_TEST_OPT_PCM_SIGNED: return " Specifies whether to use signed (true) or unsigned (false) samples\n"726 case VKAT_TEST_OPT_PCM_SIGNED: return "PCM samples to use (signed = true, unsigned = false)\n" 740 727 " Default: true"; 741 case VKAT_TEST_OPT_PROBE_BACKENDS: return " Specifies whether to probe all (available) backends until a working one is found\n"728 case VKAT_TEST_OPT_PROBE_BACKENDS: return "Whether to probe all (available) backends until a working one is found\n" 742 729 " Default: false"; 743 case VKAT_TEST_OPT_TAG: return " Specifies the test set tag to use";744 case VKAT_TEST_OPT_TEMPDIR: return " Specifies the temporary directory to use";745 case VKAT_TEST_OPT_VOL: return " Specifies the audio volume (in percent, 0-100) to use";746 case VKAT_TEST_OPT_TCP_BIND_ADDRESS: return " Specifies theTCP address listening to (server mode)";747 case VKAT_TEST_OPT_TCP_BIND_PORT: return " Specifies theTCP port listening to (server mode)";748 case VKAT_TEST_OPT_TCP_CONNECT_ADDRESS: return " Specifies theTCP address to connect to (client mode)";749 case VKAT_TEST_OPT_TCP_CONNECT_PORT: return " Specifies theTCP port to connect to (client mode)";730 case VKAT_TEST_OPT_TAG: return "Test set tag to use"; 731 case VKAT_TEST_OPT_TEMPDIR: return "Temporary directory to use"; 732 case VKAT_TEST_OPT_VOL: return "Audio volume (percent) to use"; 733 case VKAT_TEST_OPT_TCP_BIND_ADDRESS: return "TCP address listening to (server mode)"; 734 case VKAT_TEST_OPT_TCP_BIND_PORT: return "TCP port listening to (server mode)"; 735 case VKAT_TEST_OPT_TCP_CONNECT_ADDRESS: return "TCP address to connect to (client mode)"; 736 case VKAT_TEST_OPT_TCP_CONNECT_PORT: return "TCP port to connect to (client mode)"; 750 737 default: 751 738 break; … … 763 750 { 764 751 AUDIOTESTENV TstEnv; 765 RT_ZERO(TstEnv);752 audioTestEnvInit(&TstEnv); 766 753 767 754 int rc; 768 755 769 PCPDMDRVREG pDrvReg = AudioTestGetDefaultBackend(); 770 bool fWithDrvAudio = false; 771 uint8_t cPcmSampleBit = 0; 772 uint8_t cPcmChannels = 0; 773 uint32_t uPcmHz = 0; 774 bool fPcmSigned = true; 756 PCPDMDRVREG pDrvReg = AudioTestGetDefaultBackend(); 757 uint8_t cPcmSampleBit = 0; 758 uint8_t cPcmChannels = 0; 759 uint32_t uPcmHz = 0; 760 bool fPcmSigned = true; 775 761 bool fProbeBackends = false; 776 762 … … 798 784 799 785 case 'd': 800 fWithDrvAudio = true;786 TstEnv.IoOpts.fWithDrvAudio = true; 801 787 break; 802 788 … … 850 836 851 837 case VKAT_TEST_OPT_TONE_DURATION_MS: 852 TstEnv.cMsToneDuration = ValueUnion.u32; 838 TstEnv.ToneParms.msDuration = ValueUnion.u32; 839 break; 840 841 case VKAT_TEST_OPT_TONE_VOL_PERCENT: 842 TstEnv.ToneParms.uVolumePercent = ValueUnion.u8; 853 843 break; 854 844 … … 895 885 896 886 case VKAT_TEST_OPT_VOL: 897 TstEnv. uVolumePercent = ValueUnion.u8;887 TstEnv.IoOpts.uVolumePercent = ValueUnion.u8; 898 888 break; 899 889 … … 930 920 RTTestBanner(g_hTest); 931 921 932 /* Initialize the custom test parameters with sensible defaults if nothing else is given. */933 PDMAudioPropsInit(&TstEnv.Props,934 cPcmSampleBit ? cPcmSampleBit / 8 : 2 /* 16-bit */, fPcmSigned, cPcmChannels ? cPcmChannels : 2,935 uPcmHz ? uPcmHz : 44100);936 937 922 if (TstEnv.enmMode == AUDIOTESTMODE_UNKNOWN) 938 923 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "No test mode (--mode) specified!\n"); … … 943 928 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Only one TCP connection mode (connect as client *or* bind as server) can be specified) at a time!\n"); 944 929 930 /* Set new (override standard) I/O PCM properties if set by the user. */ 931 if ( cPcmSampleBit 932 || cPcmChannels 933 || uPcmHz) 934 { 935 PDMAudioPropsInit(&TstEnv.IoOpts.Props, 936 cPcmSampleBit ? cPcmSampleBit / 2 : 2 /* 16-bit */, fPcmSigned /* fSigned */, 937 cPcmChannels ? cPcmChannels : 2 /* Stereo */, uPcmHz ? uPcmHz : 44100); 938 } 939 945 940 AUDIOTESTDRVSTACK DrvStack; 946 941 if (fProbeBackends) 947 942 rc = audioTestDriverStackProbe(&DrvStack, pDrvReg, 948 true /* fEnabledIn */, true /* fEnabledOut */, fWithDrvAudio); /** @todo Make in/out configurable, too. */943 true /* fEnabledIn */, true /* fEnabledOut */, TstEnv.IoOpts.fWithDrvAudio); /** @todo Make in/out configurable, too. */ 949 944 else 950 945 rc = audioTestDriverStackInitEx(&DrvStack, pDrvReg, 951 true /* fEnabledIn */, true /* fEnabledOut */, fWithDrvAudio); /** @todo Make in/out configurable, too. */946 true /* fEnabledIn */, true /* fEnabledOut */, TstEnv.IoOpts.fWithDrvAudio); /** @todo Make in/out configurable, too. */ 952 947 if (RT_FAILURE(rc)) 953 948 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unable to init driver stack: %Rrc\n", rc); … … 959 954 960 955 /* For now all tests have the same test environment and driver stack. */ 961 rc = audioTestEnv Init(&TstEnv, &DrvStack);956 rc = audioTestEnvCreate(&TstEnv, &DrvStack); 962 957 if (RT_SUCCESS(rc)) 963 958 rc = audioTestWorker(&TstEnv); -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdGeneric.cpp
r91453 r91632 67 67 { 68 68 case 'b': return "The audio backend to use."; 69 case VKAT_ENUM_OPT_PROBE_BACKENDS: return " Specifies whether to probe all (available) backends until a working one is found\n"69 case VKAT_ENUM_OPT_PROBE_BACKENDS: return "Whether to probe all (available) backends until a working one is found\n" 70 70 " Default: false"; 71 71 default: return NULL; … … 191 191 * Command: play * 192 192 *********************************************************************************************************************************/ 193 194 /**195 * Structure holding additional playback options.196 */197 typedef struct AUDIOTESTPLAYOPTS198 {199 /** Whether to use the audio connector or not. */200 bool fWithDrvAudio;201 /** Whether to use a mixing buffer or not. */202 bool fWithMixer;203 /** Buffer size (in ms). */204 uint32_t cMsBufferSize;205 /** Pre-buffering size (in ms). */206 uint32_t cMsPreBuffer;207 /** Scheduling (in ms). */208 uint32_t cMsSchedulingHint;209 /** Audio vlume to use (in percent). */210 uint8_t uVolumePercent;211 /** PCM audio properties to use. */212 PDMAUDIOPCMPROPS Props;213 } AUDIOTESTPLAYOPTS;214 /** Pointer to additional playback options. */215 typedef AUDIOTESTPLAYOPTS *PAUDIOTESTPLAYOPTS;216 193 217 194 /** … … 304 281 */ 305 282 static RTEXITCODE audioTestPlayOne(const char *pszFile, PCPDMDRVREG pDrvReg, const char *pszDevId, 306 PAUDIOTEST PLAYOPTS pOpts)283 PAUDIOTESTIOOPTS pIoOpts) 307 284 { 308 285 char szTmp[128]; … … 332 309 RTEXITCODE rcExit = RTEXITCODE_FAILURE; 333 310 AUDIOTESTDRVSTACK DrvStack; 334 rc = audioTestDriverStackInit(&DrvStack, pDrvReg, p Opts->fWithDrvAudio);311 rc = audioTestDriverStackInit(&DrvStack, pDrvReg, pIoOpts->fWithDrvAudio); 335 312 if (RT_SUCCESS(rc)) 336 313 { … … 344 321 * Open a stream for the output. 345 322 */ 346 uint8_t const cChannels = PDMAudioPropsChannels(&p Opts->Props);323 uint8_t const cChannels = PDMAudioPropsChannels(&pIoOpts->Props); 347 324 348 325 PDMAUDIOPCMPROPS ReqProps = WaveFile.Props; … … 350 327 PDMAudioPropsSetChannels(&ReqProps, cChannels); 351 328 352 uint8_t const cbSample = PDMAudioPropsSampleSize(&p Opts->Props);329 uint8_t const cbSample = PDMAudioPropsSampleSize(&pIoOpts->Props); 353 330 if (cbSample != 0) 354 331 PDMAudioPropsSetSampleSize(&ReqProps, cbSample); 355 332 356 uint32_t const uHz = PDMAudioPropsHz(&p Opts->Props);333 uint32_t const uHz = PDMAudioPropsHz(&pIoOpts->Props); 357 334 if (uHz != 0) 358 335 ReqProps.uHz = uHz; … … 360 337 PDMAUDIOSTREAMCFG CfgAcq; 361 338 PPDMAUDIOSTREAM pStream = NULL; 362 rc = audioTestDriverStackStreamCreateOutput(&DrvStack, &ReqProps, p Opts->cMsBufferSize,363 p Opts->cMsPreBuffer, pOpts->cMsSchedulingHint, &pStream, &CfgAcq);339 rc = audioTestDriverStackStreamCreateOutput(&DrvStack, &ReqProps, pIoOpts->cMsBufferSize, 340 pIoOpts->cMsPreBuffer, pIoOpts->cMsSchedulingHint, &pStream, &CfgAcq); 364 341 if (RT_SUCCESS(rc)) 365 342 { … … 368 345 * output parameters doesn't match. 369 346 */ 370 if ( !p Opts->fWithMixer347 if ( !pIoOpts->fWithMixer 371 348 && ( !PDMAudioPropsAreEqual(&WaveFile.Props, &pStream->Cfg.Props) 372 || p Opts->uVolumePercent != 100)349 || pIoOpts->uVolumePercent != 100) 373 350 ) 374 351 { 375 352 RTMsgInfo("Enabling the mixer buffer.\n"); 376 p Opts->fWithMixer = true;353 pIoOpts->fWithMixer = true; 377 354 } 378 355 … … 382 359 */ 383 360 AUDIOTESTDRVMIXSTREAM Mix; 384 rc = AudioTestMixStreamInit(&Mix, &DrvStack, pStream, p Opts->fWithMixer ? &WaveFile.Props : NULL, 100 /*ms*/);361 rc = AudioTestMixStreamInit(&Mix, &DrvStack, pStream, pIoOpts->fWithMixer ? &WaveFile.Props : NULL, 100 /*ms*/); 385 362 if (RT_SUCCESS(rc)) 386 363 { … … 388 365 RTMsgInfo("Stream: %s cbBackend=%#RX32%s\n", 389 366 PDMAudioPropsToString(&pStream->Cfg.Props, szTmp, sizeof(szTmp)), 390 pStream->cbBackend, p Opts->fWithMixer ? " mixed" : "");391 392 if (p Opts->fWithMixer)393 AudioTestMixStreamSetVolume(&Mix, p Opts->uVolumePercent);367 pStream->cbBackend, pIoOpts->fWithMixer ? " mixed" : ""); 368 369 if (pIoOpts->fWithMixer) 370 AudioTestMixStreamSetVolume(&Mix, pIoOpts->uVolumePercent); 394 371 395 372 /* … … 427 404 static RTEXITCODE audioTestPlayTestToneOne(PAUDIOTESTTONEPARMS pToneParms, 428 405 PCPDMDRVREG pDrvReg, const char *pszDevId, 429 PAUDIOTEST PLAYOPTS pOpts)406 PAUDIOTESTIOOPTS pIoOpts) 430 407 { 431 408 char szTmp[128]; … … 439 416 RTEXITCODE rcExit = RTEXITCODE_FAILURE; 440 417 AUDIOTESTDRVSTACK DrvStack; 441 int rc = audioTestDriverStackInit(&DrvStack, pDrvReg, p Opts->fWithDrvAudio);418 int rc = audioTestDriverStackInit(&DrvStack, pDrvReg, pIoOpts->fWithDrvAudio); 442 419 if (RT_SUCCESS(rc)) 443 420 { … … 451 428 * Open a stream for the output. 452 429 */ 453 uint8_t const cChannels = PDMAudioPropsChannels(&p Opts->Props);430 uint8_t const cChannels = PDMAudioPropsChannels(&pIoOpts->Props); 454 431 455 432 PDMAUDIOPCMPROPS ReqProps = pToneParms->Props; … … 457 434 PDMAudioPropsSetChannels(&ReqProps, cChannels); 458 435 459 uint8_t const cbSample = PDMAudioPropsSampleSize(&p Opts->Props);436 uint8_t const cbSample = PDMAudioPropsSampleSize(&pIoOpts->Props); 460 437 if (cbSample != 0) 461 438 PDMAudioPropsSetSampleSize(&ReqProps, cbSample); 462 439 463 uint32_t const uHz = PDMAudioPropsHz(&p Opts->Props);440 uint32_t const uHz = PDMAudioPropsHz(&pIoOpts->Props); 464 441 if (uHz != 0) 465 442 ReqProps.uHz = uHz; 466 443 467 rc = audioTestDriverStackStreamCreateOutput(&DrvStack, &ReqProps, p Opts->cMsBufferSize,468 p Opts->cMsPreBuffer, pOpts->cMsSchedulingHint, &TstStream.pStream, &TstStream.Cfg);444 rc = audioTestDriverStackStreamCreateOutput(&DrvStack, &ReqProps, pIoOpts->cMsBufferSize, 445 pIoOpts->cMsPreBuffer, pIoOpts->cMsSchedulingHint, &TstStream.pStream, &TstStream.Cfg); 469 446 if (RT_SUCCESS(rc)) 470 447 { … … 473 450 * output parameters doesn't match. 474 451 */ 475 if ( !p Opts->fWithMixer452 if ( !pIoOpts->fWithMixer 476 453 && ( !PDMAudioPropsAreEqual(&pToneParms->Props, &TstStream.pStream->Cfg.Props) 477 454 || pToneParms->uVolumePercent != 100) … … 479 456 { 480 457 RTMsgInfo("Enabling the mixer buffer.\n"); 481 p Opts->fWithMixer = true;458 pIoOpts->fWithMixer = true; 482 459 } 483 460 … … 487 464 */ 488 465 rc = AudioTestMixStreamInit(&TstStream.Mix, &DrvStack, TstStream.pStream, 489 p Opts->fWithMixer ? &pToneParms->Props : NULL, 100 /*ms*/);466 pIoOpts->fWithMixer ? &pToneParms->Props : NULL, 100 /*ms*/); 490 467 if (RT_SUCCESS(rc)) 491 468 { … … 493 470 RTMsgInfo("Stream: %s cbBackend=%#RX32%s\n", 494 471 PDMAudioPropsToString(&TstStream.pStream->Cfg.Props, szTmp, sizeof(szTmp)), 495 TstStream.pStream->cbBackend, p Opts->fWithMixer ? " mixed" : "");472 TstStream.pStream->cbBackend, pIoOpts->fWithMixer ? " mixed" : ""); 496 473 497 474 /* … … 501 478 if (RT_SUCCESS(rc)) 502 479 { 503 if (p Opts->fWithMixer)480 if (pIoOpts->fWithMixer) 504 481 AudioTestMixStreamSetVolume(&TstStream.Mix, pToneParms->uVolumePercent); 505 482 506 rc = audioTestPlayTone( NULL /* pTstEnv */, &TstStream, pToneParms);483 rc = audioTestPlayTone(pIoOpts, NULL /* pTstEnv */, &TstStream, pToneParms); 507 484 if (RT_SUCCESS(rc)) 508 485 rcExit = RTEXITCODE_SUCCESS; … … 538 515 VKAT_PLAY_OPT_TONE_DUR = 900, 539 516 VKAT_PLAY_OPT_TONE_FREQ, 517 VKAT_PLAY_OPT_TONE_VOL, 540 518 VKAT_PLAY_OPT_VOL 541 519 }; … … 555 533 { "--tone-dur", VKAT_PLAY_OPT_TONE_DUR, RTGETOPT_REQ_UINT32 }, 556 534 { "--tone-freq", VKAT_PLAY_OPT_TONE_FREQ, RTGETOPT_REQ_UINT32 }, 535 { "--tone-vol", VKAT_PLAY_OPT_TONE_VOL, RTGETOPT_REQ_UINT32 }, 557 536 { "--output-device", 'o', RTGETOPT_REQ_STRING }, 558 537 { "--with-drv-audio", 'd', RTGETOPT_REQ_NOTHING }, … … 577 556 case VKAT_PLAY_OPT_TONE_DUR: return "Test tone duration (ms)"; 578 557 case VKAT_PLAY_OPT_TONE_FREQ: return "Test tone frequency (Hz)"; 579 case VKAT_PLAY_OPT_VOL: return "Volume (in percent, 0-100) to use"; 558 case VKAT_PLAY_OPT_TONE_VOL: return "Test tone volume (percent)"; 559 case VKAT_PLAY_OPT_VOL: return "Playback volume (percent)"; 580 560 default: return NULL; 581 561 } … … 599 579 uint32_t uHz = 0; 600 580 601 AUDIOTESTPLAYOPTS PlayOpts; 602 RT_ZERO(PlayOpts); 603 604 PlayOpts.uVolumePercent = 100; /* Use maximum volume by default. */ 581 AUDIOTESTIOOPTS IoOpts; 582 audioTestIoOptsInitDefaults(&IoOpts); 605 583 606 584 AUDIOTESTTONEPARMS ToneParms; 607 RT_ZERO(ToneParms); 608 609 ToneParms.dbFreqHz = AudioTestToneGetRandomFreq(); 610 ToneParms.msDuration = RTRandU32Ex(0, RT_MS_10SEC); /** @todo Probably a bit too long, but let's see. */ 585 audioTestToneParmsInit(&ToneParms); 611 586 612 587 /* Argument processing loop: */ … … 628 603 629 604 case 'd': 630 PlayOpts.fWithDrvAudio = true;605 IoOpts.fWithDrvAudio = true; 631 606 break; 632 607 … … 636 611 637 612 case 'm': 638 PlayOpts.fWithMixer = true;613 IoOpts.fWithMixer = true; 639 614 break; 640 615 … … 659 634 break; 660 635 636 case VKAT_PLAY_OPT_TONE_VOL: 637 ToneParms.uVolumePercent = ValueUnion.u8; 638 if (ToneParms.uVolumePercent > 100) 639 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid tonevolume (0-100)"); 640 break; 641 661 642 case VKAT_PLAY_OPT_VOL: 662 PlayOpts.uVolumePercent = ValueUnion.u8;663 if ( PlayOpts.uVolumePercent > 100)664 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid volume (0-100)");643 IoOpts.uVolumePercent = ValueUnion.u8; 644 if (IoOpts.uVolumePercent > 100) 645 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid playback volume (0-100)"); 665 646 break; 666 647 … … 670 651 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Playing test tones (-t) cannot be combined with playing files"); 671 652 672 /* Use some sane defaults if no PCM props areset by the user. */673 PDMAudioPropsInit(& PlayOpts.Props,653 /* Set new (override standard) I/O PCM properties if set by the user. */ 654 PDMAudioPropsInit(&IoOpts.Props, 674 655 cbSample ? cbSample : 2 /* 16-bit */, true /* fSigned */, 675 656 cChannels ? cChannels : 2 /* Stereo */, uHz ? uHz : 44100); 676 657 677 RTEXITCODE rcExit = audioTestPlayOne(ValueUnion.psz, pDrvReg, pszDevId, & PlayOpts);658 RTEXITCODE rcExit = audioTestPlayOne(ValueUnion.psz, pDrvReg, pszDevId, &IoOpts); 678 659 if (rcExit != RTEXITCODE_SUCCESS) 679 660 return rcExit; … … 695 676 cChannels ? cChannels : 2 /* Stereo */, uHz ? uHz : 44100); 696 677 697 ToneParms.uVolumePercent = PlayOpts.uVolumePercent; 698 699 RTEXITCODE rcExit = audioTestPlayTestToneOne(&ToneParms, pDrvReg, pszDevId, &PlayOpts); 678 RTEXITCODE rcExit = audioTestPlayTestToneOne(&ToneParms, pDrvReg, pszDevId, &IoOpts); 700 679 if (rcExit != RTEXITCODE_SUCCESS) 701 680 return rcExit; … … 800 779 */ 801 780 static RTEXITCODE audioTestRecOne(const char *pszFile, uint8_t cWaveChannels, uint8_t cbWaveSample, uint32_t uWaveHz, 802 PCPDMDRVREG pDrvReg, const char *pszDevId, uint32_t cMsBufferSize, 803 uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint, 804 uint8_t cChannels, uint8_t cbSample, uint32_t uHz, bool fWithDrvAudio, bool fWithMixer, 781 PCPDMDRVREG pDrvReg, const char *pszDevId, PAUDIOTESTIOOPTS pIoOpts, 805 782 uint64_t cMaxFrames, uint64_t cNsMaxDuration) 806 783 { … … 810 787 RTEXITCODE rcExit = RTEXITCODE_FAILURE; 811 788 AUDIOTESTDRVSTACK DrvStack; 812 int rc = audioTestDriverStackInit(&DrvStack, pDrvReg, fWithDrvAudio);789 int rc = audioTestDriverStackInit(&DrvStack, pDrvReg, pIoOpts->fWithDrvAudio); 813 790 if (RT_SUCCESS(rc)) 814 791 { … … 824 801 PDMAUDIOPCMPROPS ReqProps; 825 802 PDMAudioPropsInit(&ReqProps, 826 cbSample ? cbSample : cbWaveSample ? cbWaveSample : 2, 827 true /*fSigned*/, 828 cChannels ? cChannels : cWaveChannels ? cWaveChannels : 2, 829 uHz ? uHz : uWaveHz ? uWaveHz : 44100); 803 pIoOpts->Props.cbSampleX ? pIoOpts->Props.cbSampleX : cbWaveSample ? cbWaveSample : 2, 804 pIoOpts->Props.fSigned, 805 pIoOpts->Props.cChannelsX ? pIoOpts->Props.cChannelsX : cWaveChannels ? cWaveChannels : 2, 806 pIoOpts->Props.uHz ? pIoOpts->Props.uHz : uWaveHz ? uWaveHz : 44100); 807 830 808 PDMAUDIOSTREAMCFG CfgAcq; 831 809 PPDMAUDIOSTREAM pStream = NULL; 832 rc = audioTestDriverStackStreamCreateInput(&DrvStack, &ReqProps, cMsBufferSize,833 cMsPreBuffer,cMsSchedulingHint, &pStream, &CfgAcq);810 rc = audioTestDriverStackStreamCreateInput(&DrvStack, &ReqProps, pIoOpts->cMsBufferSize, 811 pIoOpts->cMsPreBuffer, pIoOpts->cMsSchedulingHint, &pStream, &CfgAcq); 834 812 if (RT_SUCCESS(rc)) 835 813 { … … 844 822 cWaveChannels ? cWaveChannels : PDMAudioPropsChannels(&CfgAcq.Props), 845 823 uWaveHz ? uWaveHz : PDMAudioPropsHz(&CfgAcq.Props)); 846 if (! fWithMixer && !PDMAudioPropsAreEqual(&WaveProps, &CfgAcq.Props))824 if (!pIoOpts->fWithMixer && !PDMAudioPropsAreEqual(&WaveProps, &CfgAcq.Props)) 847 825 { 848 826 RTMsgInfo("Enabling the mixer buffer.\n"); 849 fWithMixer = true;827 pIoOpts->fWithMixer = true; 850 828 } 851 829 … … 864 842 */ 865 843 AUDIOTESTDRVMIXSTREAM Mix; 866 rc = AudioTestMixStreamInit(&Mix, &DrvStack, pStream, fWithMixer ? &WaveProps : NULL, 100 /*ms*/);844 rc = AudioTestMixStreamInit(&Mix, &DrvStack, pStream, pIoOpts->fWithMixer ? &WaveProps : NULL, 100 /*ms*/); 867 845 if (RT_SUCCESS(rc)) 868 846 { … … 871 849 RTMsgInfo("Stream: %s cbBackend=%#RX32%s\n", 872 850 PDMAudioPropsToString(&pStream->Cfg.Props, szTmp, sizeof(szTmp)), 873 pStream->cbBackend, fWithMixer ? " mixed" : "");851 pStream->cbBackend, pIoOpts->fWithMixer ? " mixed" : ""); 874 852 875 853 /* … … 986 964 /* Option values: */ 987 965 PCPDMDRVREG pDrvReg = AudioTestGetDefaultBackend(); 988 uint32_t cMsBufferSize = UINT32_MAX;989 uint32_t cMsPreBuffer = UINT32_MAX;990 uint32_t cMsSchedulingHint = UINT32_MAX;991 966 const char *pszDevId = NULL; 992 bool fWithDrvAudio = false;993 bool fWithMixer = false;994 967 uint8_t cbSample = 0; 995 968 uint8_t cChannels = 0; … … 1001 974 uint64_t cNsMaxDuration = UINT64_MAX; 1002 975 976 AUDIOTESTIOOPTS IoOpts; 977 audioTestIoOptsInitDefaults(&IoOpts); 978 1003 979 /* Argument processing loop: */ 1004 980 int ch; … … 1023 999 1024 1000 case 'd': 1025 fWithDrvAudio = true;1001 IoOpts.fWithDrvAudio = true; 1026 1002 break; 1027 1003 … … 1039 1015 1040 1016 case 'm': 1041 fWithMixer = true;1017 IoOpts.fWithMixer = true; 1042 1018 break; 1043 1019 … … 1068 1044 case VINF_GETOPT_NOT_OPTION: 1069 1045 { 1046 if ( cbSample 1047 || cChannels 1048 || uHz) 1049 { 1050 /* Set new (override standard) I/O PCM properties if set by the user. */ 1051 PDMAudioPropsInit(&IoOpts.Props, 1052 cbSample ? cbSample : 2 /* 16-bit */, true /* fSigned */, 1053 cChannels ? cChannels : 2 /* Stereo */, uHz ? uHz : 44100); 1054 } 1055 1070 1056 RTEXITCODE rcExit = audioTestRecOne(ValueUnion.psz, cWaveChannels, cbWaveSample, uWaveHz, 1071 pDrvReg, pszDevId, cMsBufferSize, cMsPreBuffer, cMsSchedulingHint, 1072 cChannels, cbSample, uHz, fWithDrvAudio, fWithMixer, 1057 pDrvReg, pszDevId, &IoOpts, 1073 1058 cMaxFrames, cNsMaxDuration); 1074 1059 if (rcExit != RTEXITCODE_SUCCESS) -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp
r90918 r91632 131 131 PAUDIOTESTENV pTstEnvGst = &pCtx->Guest.TstEnv; 132 132 133 audioTestEnvInit(pTstEnvGst); 134 133 135 /* Flag the environment for self test mode. */ 134 136 pTstEnvGst->fSelftest = true; … … 151 153 pTstEnvGst->enmMode = AUDIOTESTMODE_GUEST; 152 154 153 /** @todo Make this customizable. */ 154 PDMAudioPropsInit(&pTstEnvGst->Props, 155 2 /* 16-bit */, true /* fSigned */, 2 /* cChannels */, 44100 /* uHz */); 156 157 rc = audioTestEnvInit(pTstEnvGst, &pCtx->DrvStack); 155 rc = audioTestEnvCreate(pTstEnvGst, &pCtx->DrvStack); 158 156 if (RT_SUCCESS(rc)) 159 157 { … … 183 181 PAUDIOTESTENV pTstEnvHst = &pCtx->Host.TstEnv; 184 182 183 audioTestEnvInit(pTstEnvHst); 184 185 185 /* Flag the environment for self test mode. */ 186 186 pTstEnvHst->fSelftest = true; … … 195 195 rc = AudioTestPathCreateTemp(pTstEnvHst->szPathOut, sizeof(pTstEnvHst->szPathOut), "selftest-out"); 196 196 AssertRCReturn(rc, RTEXITCODE_FAILURE); 197 198 /* Initialize the PCM properties to some sane values. */199 PDMAudioPropsInit(&pTstEnvHst->Props,200 2 /* 16-bit */, true /* fPcmSigned */, 2 /* cPcmChannels */, 44100 /* uPcmHz */);201 197 202 198 /* … … 224 220 pTstEnvHst->enmMode = AUDIOTESTMODE_HOST; 225 221 226 rc = audioTestEnv Init(pTstEnvHst, &pCtx->DrvStack);222 rc = audioTestEnvCreate(pTstEnvHst, &pCtx->DrvStack); 227 223 if (RT_SUCCESS(rc)) 228 224 { -
trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
r91619 r91632 80 80 * Internal Functions * 81 81 *********************************************************************************************************************************/ 82 static int audioTestStreamInit(PAUDIOTESTDRVSTACK pDrvStack, PAUDIOTESTSTREAM pStream, PDMAUDIODIR enmDir, P CPDMAUDIOPCMPROPS pProps, bool fWithMixer, uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint);82 static int audioTestStreamInit(PAUDIOTESTDRVSTACK pDrvStack, PAUDIOTESTSTREAM pStream, PDMAUDIODIR enmDir, PAUDIOTESTIOOPTS pPlayOpt); 83 83 static int audioTestStreamDestroy(PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream); 84 84 … … 334 334 335 335 static int audioTestStreamInit(PAUDIOTESTDRVSTACK pDrvStack, PAUDIOTESTSTREAM pStream, 336 PDMAUDIODIR enmDir, PCPDMAUDIOPCMPROPS pProps, bool fWithMixer, 337 uint32_t cMsBufferSize, uint32_t cMsPreBuffer, uint32_t cMsSchedulingHint) 336 PDMAUDIODIR enmDir, PAUDIOTESTIOOPTS pIoOpts) 338 337 { 339 338 int rc; 340 339 341 340 if (enmDir == PDMAUDIODIR_IN) 342 rc = audioTestDriverStackStreamCreateInput(pDrvStack, pProps,cMsBufferSize,343 cMsPreBuffer,cMsSchedulingHint, &pStream->pStream, &pStream->Cfg);341 rc = audioTestDriverStackStreamCreateInput(pDrvStack, &pIoOpts->Props, pIoOpts->cMsBufferSize, 342 pIoOpts->cMsPreBuffer, pIoOpts->cMsSchedulingHint, &pStream->pStream, &pStream->Cfg); 344 343 else if (enmDir == PDMAUDIODIR_OUT) 345 rc = audioTestDriverStackStreamCreateOutput(pDrvStack, pProps,cMsBufferSize,346 cMsPreBuffer,cMsSchedulingHint, &pStream->pStream, &pStream->Cfg);344 rc = audioTestDriverStackStreamCreateOutput(pDrvStack, &pIoOpts->Props, pIoOpts->cMsBufferSize, 345 pIoOpts->cMsPreBuffer, pIoOpts->cMsSchedulingHint, &pStream->pStream, &pStream->Cfg); 347 346 else 348 347 rc = VERR_NOT_SUPPORTED; … … 360 359 * Automatically enable the mixer if the PCM properties don't match. 361 360 */ 362 if ( ! fWithMixer363 && !PDMAudioPropsAreEqual( pProps, &pStream->Cfg.Props))361 if ( !pIoOpts->fWithMixer 362 && !PDMAudioPropsAreEqual(&pIoOpts->Props, &pStream->Cfg.Props)) 364 363 { 365 364 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Enabling stream mixer\n"); 366 fWithMixer = true;365 pIoOpts->fWithMixer = true; 367 366 } 368 367 369 368 rc = AudioTestMixStreamInit(&pStream->Mix, pDrvStack, pStream->pStream, 370 fWithMixer ? pProps : NULL, 100 /* ms */); /** @todo Configure mixer buffer? */369 pIoOpts->fWithMixer ? &pIoOpts->Props : NULL, 100 /* ms */); /** @todo Configure mixer buffer? */ 371 370 } 372 371 … … 405 404 * Test Primitives * 406 405 *********************************************************************************************************************************/ 406 407 /** 408 * Initializes test tone parameters (partly with random values). 409 410 * @param pToneParms Test tone parameters to initialize. 411 */ 412 void audioTestToneParmsInit(PAUDIOTESTTONEPARMS pToneParms) 413 { 414 RT_BZERO(pToneParms, sizeof(AUDIOTESTTONEPARMS)); 415 416 /** 417 * Set default (randomized) test tone parameters if not set explicitly. 418 */ 419 pToneParms->dbFreqHz = AudioTestToneGetRandomFreq(); 420 pToneParms->msDuration = RTRandU32Ex(200, RT_MS_30SEC); 421 pToneParms->uVolumePercent = 100; /* We always go with maximum volume for now. */ 422 423 PDMAudioPropsInit(&pToneParms->Props, 424 2 /* 16-bit */, true /* fPcmSigned */, 2 /* cPcmChannels */, 44100 /* uPcmHz */); 425 } 426 427 /** 428 * Initializes I/O options with some sane default values. 429 * 430 * @param pIoOpts I/O options to initialize. 431 */ 432 void audioTestIoOptsInitDefaults(PAUDIOTESTIOOPTS pIoOpts) 433 { 434 RT_BZERO(pIoOpts, sizeof(AUDIOTESTIOOPTS)); 435 436 /* Initialize the PCM properties to some sane values. */ 437 PDMAudioPropsInit(&pIoOpts->Props, 438 2 /* 16-bit */, true /* fPcmSigned */, 2 /* cPcmChannels */, 44100 /* uPcmHz */); 439 440 pIoOpts->cMsBufferSize = UINT32_MAX; 441 pIoOpts->cMsPreBuffer = UINT32_MAX; 442 pIoOpts->cMsSchedulingHint = UINT32_MAX; 443 pIoOpts->uVolumePercent = 100; /* Use maximum volume by default. */ 444 } 407 445 408 446 #if 0 /* Unused */ … … 430 468 * 431 469 * @returns VBox status code. 470 * @param pIoOpts I/O options to use. 432 471 * @param pTstEnv Test environment to use for running the test. 433 472 * Optional and can be NULL (for simple playback only). … … 437 476 * @note Blocking function. 438 477 */ 439 int audioTestPlayTone(PAUDIOTEST ENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms)478 int audioTestPlayTone(PAUDIOTESTIOOPTS pIoOpts, PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms) 440 479 { 441 480 AUDIOTESTTONE TstTone; … … 446 485 pcszPathOut = pTstEnv->Set.szPathAbs; 447 486 448 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Playing test tone (tone frequency is %RU16Hz, %RU32ms)\n", (uint16_t)pParms->dbFreqHz, pParms->msDuration); 487 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Playing test tone (tone frequency is %RU16Hz, %RU32ms, %RU8%% volume)\n", 488 (uint16_t)pParms->dbFreqHz, pParms->msDuration, pParms->uVolumePercent); 449 489 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using %RU32ms stream scheduling hint\n", pStream->Cfg.Device.cMsSchedulingHint); 450 490 if (pcszPathOut) … … 462 502 } 463 503 464 /* Try to crank up the system's master volume up to 100% so that we (hopefully) play the test tone always at the same leve. 465 * Not supported on all platforms yet, therefore not critical for overall testing (yet). */ 466 unsigned const uVolPercent = 100; 504 uint8_t const uVolPercent = pIoOpts->uVolumePercent; 467 505 int rc2 = audioTestSetMasterVolume(uVolPercent); 468 506 if (RT_FAILURE(rc2)) … … 666 704 * 667 705 * @returns VBox status code. 706 * @param pIoOpts I/O options to use. 668 707 * @param pTstEnv Test environment to use for running the test. 669 708 * @param pStream Stream to use for recording the tone. … … 672 711 * @note Blocking function. 673 712 */ 674 static int audioTestRecordTone(PAUDIOTEST ENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms)713 static int audioTestRecordTone(PAUDIOTESTIOOPTS pIoOpts, PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms) 675 714 { 676 715 const char *pcszPathOut = pTstEnv->Set.szPathAbs; … … 694 733 695 734 AudioTestObjAddMetadataStr(Obj, "stream_to_record_bytes=%RU32\n", cbToRecTotal); 696 AudioTestObjAddMetadataStr(Obj, "stream_buffer_size_ms=%RU32\n", p TstEnv->cMsBufferSize);697 AudioTestObjAddMetadataStr(Obj, "stream_prebuf_size_ms=%RU32\n", p TstEnv->cMsPreBuffer);735 AudioTestObjAddMetadataStr(Obj, "stream_buffer_size_ms=%RU32\n", pIoOpts->cMsBufferSize); 736 AudioTestObjAddMetadataStr(Obj, "stream_prebuf_size_ms=%RU32\n", pIoOpts->cMsPreBuffer); 698 737 /* Note: This mostly is provided by backend (e.g. PulseAudio / ALSA / ++) and 699 738 * has nothing to do with the device emulation scheduling hint. */ 700 AudioTestObjAddMetadataStr(Obj, "device_scheduling_hint_ms=%RU32\n", p TstEnv->cMsSchedulingHint);739 AudioTestObjAddMetadataStr(Obj, "device_scheduling_hint_ms=%RU32\n", pIoOpts->cMsSchedulingHint); 701 740 702 741 uint8_t abSamples[16384]; … … 862 901 static DECLCALLBACK(int) audioTestGstAtsTonePlayCallback(void const *pvUser, PAUDIOTESTTONEPARMS pToneParms) 863 902 { 864 PATSCALLBACKCTX pCtx = (PATSCALLBACKCTX)pvUser; 865 PAUDIOTESTENV pTstEnv = pCtx->pTstEnv; 903 PATSCALLBACKCTX pCtx = (PATSCALLBACKCTX)pvUser; 904 PAUDIOTESTENV pTstEnv = pCtx->pTstEnv; 905 PAUDIOTESTIOOPTS pIoOpts = &pTstEnv->IoOpts; 866 906 867 907 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Got request for playing test tone #%RU32 (%RU16Hz, %RU32ms) ...\n", … … 874 914 const PAUDIOTESTSTREAM pTstStream = &pTstEnv->aStreams[0]; /** @todo Make this dynamic. */ 875 915 876 int rc = audioTestStreamInit(pTstEnv->pDrvStack, pTstStream, PDMAUDIODIR_OUT, &pTstEnv->Props, false /* fWithMixer */, 877 pTstEnv->cMsBufferSize, pTstEnv->cMsPreBuffer, pTstEnv->cMsSchedulingHint); 916 int rc = audioTestStreamInit(pTstEnv->pDrvStack, pTstStream, PDMAUDIODIR_OUT, pIoOpts); 878 917 if (RT_SUCCESS(rc)) 879 918 { … … 888 927 if (RT_SUCCESS(rc)) 889 928 { 890 rc = audioTestPlayTone( pTstEnv, pTstStream, pToneParms);929 rc = audioTestPlayTone(&pTstEnv->IoOpts, pTstEnv, pTstStream, pToneParms); 891 930 if (RT_SUCCESS(rc)) 892 931 { … … 910 949 static DECLCALLBACK(int) audioTestGstAtsToneRecordCallback(void const *pvUser, PAUDIOTESTTONEPARMS pToneParms) 911 950 { 912 PATSCALLBACKCTX pCtx = (PATSCALLBACKCTX)pvUser; 913 PAUDIOTESTENV pTstEnv = pCtx->pTstEnv; 951 PATSCALLBACKCTX pCtx = (PATSCALLBACKCTX)pvUser; 952 PAUDIOTESTENV pTstEnv = pCtx->pTstEnv; 953 PAUDIOTESTIOOPTS pIoOpts = &pTstEnv->IoOpts; 914 954 915 955 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Got request for recording test tone #%RU32 (%RU32ms) ...\n", … … 922 962 const PAUDIOTESTSTREAM pTstStream = &pTstEnv->aStreams[0]; /** @todo Make this dynamic. */ 923 963 924 int rc = audioTestStreamInit(pTstEnv->pDrvStack, pTstStream, PDMAUDIODIR_IN, &pTstEnv->Props, false /* fWithMixer */, 925 pTstEnv->cMsBufferSize, pTstEnv->cMsPreBuffer, pTstEnv->cMsSchedulingHint); 964 int rc = audioTestStreamInit(pTstEnv->pDrvStack, pTstStream, PDMAUDIODIR_IN, pIoOpts); 926 965 if (RT_SUCCESS(rc)) 927 966 { … … 930 969 TstParms.enmType = AUDIOTESTTYPE_TESTTONE_RECORD; 931 970 TstParms.enmDir = PDMAUDIODIR_IN; 932 TstParms.Props = pToneParms->Props;933 971 TstParms.TestTone = *pToneParms; 934 972 … … 937 975 if (RT_SUCCESS(rc)) 938 976 { 939 rc = audioTestRecordTone(p TstEnv, pTstStream, pToneParms);977 rc = audioTestRecordTone(pIoOpts, pTstEnv, pTstStream, pToneParms); 940 978 if (RT_SUCCESS(rc)) 941 979 { … … 1175 1213 * Initializes an audio test environment. 1176 1214 * 1215 * @param pTstEnv Audio test environment to initialize. 1216 */ 1217 void audioTestEnvInit(PAUDIOTESTENV pTstEnv) 1218 { 1219 RT_BZERO(pTstEnv, sizeof(AUDIOTESTENV)); 1220 1221 audioTestIoOptsInitDefaults(&pTstEnv->IoOpts); 1222 audioTestToneParmsInit(&pTstEnv->ToneParms); 1223 } 1224 1225 /** 1226 * Creates an audio test environment. 1227 * 1177 1228 * @returns VBox status code. 1178 * @param pTstEnv Audio test environment to initialize.1229 * @param pTstEnv Audio test environment to create. 1179 1230 * @param pDrvStack Driver stack to use. 1180 1231 */ 1181 int audioTestEnvInit(PAUDIOTESTENV pTstEnv, PAUDIOTESTDRVSTACK pDrvStack) 1182 { 1232 int audioTestEnvCreate(PAUDIOTESTENV pTstEnv, PAUDIOTESTDRVSTACK pDrvStack) 1233 { 1234 AssertReturn(PDMAudioPropsAreValid(&pTstEnv->IoOpts.Props), VERR_WRONG_ORDER); 1235 1183 1236 int rc = VINF_SUCCESS; 1184 1237 … … 1210 1263 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Output directory is '%s'\n", pTstEnv->szPathOut); 1211 1264 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Temp directory is '%s'\n", pTstEnv->szPathTemp); 1212 1213 if (!pTstEnv->cMsBufferSize)1214 pTstEnv->cMsBufferSize = UINT32_MAX;1215 if (!pTstEnv->cMsPreBuffer)1216 pTstEnv->cMsPreBuffer = UINT32_MAX;1217 if (!pTstEnv->cMsSchedulingHint)1218 pTstEnv->cMsSchedulingHint = UINT32_MAX;1219 1265 1220 1266 char szPathTemp[RTPATH_MAX]; -
trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h
r91489 r91632 197 197 198 198 /** 199 * Structure holding additional I/O options. 200 */ 201 typedef struct AUDIOTESTIOOPTS 202 { 203 /** Whether to use the audio connector or not. */ 204 bool fWithDrvAudio; 205 /** Whether to use a mixing buffer or not. */ 206 bool fWithMixer; 207 /** Buffer size (in ms). */ 208 uint32_t cMsBufferSize; 209 /** Pre-buffering size (in ms). */ 210 uint32_t cMsPreBuffer; 211 /** Scheduling (in ms). */ 212 uint32_t cMsSchedulingHint; 213 /** Audio vlume to use (in percent). */ 214 uint8_t uVolumePercent; 215 /** PCM audio properties to use. */ 216 PDMAUDIOPCMPROPS Props; 217 } AUDIOTESTIOOPTS; 218 /** Pointer to additional playback options. */ 219 typedef AUDIOTESTIOOPTS *PAUDIOTESTIOOPTS; 220 221 /** 199 222 * Structure for keeping a user context for the test service callbacks. 200 223 */ … … 225 248 /** Whether skip the actual verification or not. */ 226 249 bool fSkipVerify; 227 /** The PCM properties to use. */228 PDMAUDIOPCMPROPS Props;229 250 /** Name of the audio device to use. 230 251 * If empty the default audio device will be used. */ 231 252 char szDev[128]; 232 /** Audio volume to use (in percent).233 * Might not be available on all systems. */234 uint8_t uVolumePercent;235 253 /** Number of iterations for *all* tests specified. 236 254 * When set to 0 (default), a random value (see specific test) will be chosen. */ 237 255 uint32_t cIterations; 238 /** Duration (in ms) to play / record test tone. 239 * When set to 0 (default), a random value (see specific test) will be chosen. */ 240 uint32_t cMsToneDuration; 256 /** I/O options to use. */ 257 AUDIOTESTIOOPTS IoOpts; 258 /** Test tone parameters to use. */ 259 AUDIOTESTTONEPARMS ToneParms; 241 260 /** Output path for storing the test environment's final test files. */ 242 261 char szTag[AUDIOTEST_TAG_MAX]; … … 245 264 /** Temporary path for this test environment. */ 246 265 char szPathTemp[RTPATH_MAX]; 247 /** Buffer size (in ms). */248 RTMSINTERVAL cMsBufferSize;249 /** Pre-buffering time (in ms). */250 RTMSINTERVAL cMsPreBuffer;251 /** Scheduling hint (in ms). */252 RTMSINTERVAL cMsSchedulingHint;253 266 /** Pointer to audio test driver stack to use. */ 254 267 PAUDIOTESTDRVSTACK pDrvStack; … … 454 467 /** @name Test environment handling 455 468 * @{ */ 456 int audioTestEnvInit(PAUDIOTESTENV pTstEnv, PAUDIOTESTDRVSTACK pDrvStack); 469 void audioTestEnvInit(PAUDIOTESTENV pTstEnv); 470 int audioTestEnvCreate(PAUDIOTESTENV pTstEnv, PAUDIOTESTDRVSTACK pDrvStack); 457 471 void audioTestEnvDestroy(PAUDIOTESTENV pTstEnv); 458 472 int audioTestEnvPrologue(PAUDIOTESTENV pTstEnv, bool fPack, char *pszPackFile, size_t cbPackFile); … … 465 479 466 480 /** @todo Test tone handling */ 467 int audioTestPlayTone(PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms); 468 /** @} */ 469 481 int audioTestPlayTone(PAUDIOTESTIOOPTS pIoOpts, PAUDIOTESTENV pTstEnv, PAUDIOTESTSTREAM pStream, PAUDIOTESTTONEPARMS pParms); 482 void audioTestToneParmsInit(PAUDIOTESTTONEPARMS pToneParms); 483 /** @} */ 484 485 void audioTestIoOptsInitDefaults(PAUDIOTESTIOOPTS pIoOpts); 470 486 471 487 /*********************************************************************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.