Changeset 88967 in vbox for trunk/src/VBox/ValidationKit/utils/audio
- Timestamp:
- May 10, 2021 5:33:06 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r88964 r88967 74 74 /** Audio device to use. */ 75 75 PDMAUDIOHOSTDEV Dev; 76 /** Absolute path where to store the test audio data.77 * If NULL, no test audio data will be written. */78 char *pszPathOutAbs;79 76 /** How much to delay (wait, in ms) the test being executed. */ 80 77 RTMSINTERVAL msDelay; … … 120 117 /** The current (last) audio device enumeration to use. */ 121 118 PDMAUDIOHOSTENUM DevEnm; 119 /** The audio test set to use. */ 120 AUDIOTESTSET Set; 122 121 } AUDIOTESTENV; 123 122 /** Pointer a audio test environment. */ … … 159 158 VKAT_TEST_OPT_OUTDIR, 160 159 VKAT_TEST_OPT_PAUSE, 161 VKAT_TEST_OPT_HZ, 162 VKAT_TEST_OPT_BIT, 163 VKAT_TEST_OPT_CHAN, 164 VKAT_TEST_OPT_SIGNED, 160 VKAT_TEST_OPT_PCM_HZ, 161 VKAT_TEST_OPT_PCM_BIT, 162 VKAT_TEST_OPT_PCM_CHAN, 163 VKAT_TEST_OPT_PCM_SIGNED, 164 VKAT_TEST_OPT_TAG, 165 165 VKAT_TEST_OPT_VOL 166 166 }; … … 184 184 { "--device", VKAT_TEST_OPT_DEV, RTGETOPT_REQ_STRING }, 185 185 { "--pause", VKAT_TEST_OPT_PAUSE, RTGETOPT_REQ_UINT32 }, 186 { "--pcm-bit", VKAT_TEST_OPT_BIT, RTGETOPT_REQ_UINT8 }, 187 { "--pcm-chan", VKAT_TEST_OPT_CHAN, RTGETOPT_REQ_UINT8 }, 188 { "--pcm-hz", VKAT_TEST_OPT_HZ, RTGETOPT_REQ_UINT16 }, 189 { "--pcm-signed", VKAT_TEST_OPT_SIGNED, RTGETOPT_REQ_BOOL }, 186 { "--pcm-bit", VKAT_TEST_OPT_PCM_BIT, RTGETOPT_REQ_UINT8 }, 187 { "--pcm-chan", VKAT_TEST_OPT_PCM_CHAN, RTGETOPT_REQ_UINT8 }, 188 { "--pcm-hz", VKAT_TEST_OPT_PCM_HZ, RTGETOPT_REQ_UINT16 }, 189 { "--pcm-signed", VKAT_TEST_OPT_PCM_SIGNED, RTGETOPT_REQ_BOOL }, 190 { "--tag", VKAT_TEST_OPT_TAG, RTGETOPT_REQ_STRING }, 190 191 { "--volume", VKAT_TEST_OPT_VOL, RTGETOPT_REQ_UINT8 } 191 192 … … 242 243 * @param pTstEnv Audio test environment to initialize. 243 244 * @param pDrvAudio Audio driver to use. 244 */ 245 static void audioTestEnvInit(PAUDIOTESTENV pTstEnv, PPDMIHOSTAUDIO pDrvAudio) 245 * @param pszPathOut Output path to use. If NULL, the system's temp directory will be used. 246 * @þaram pszTag Tag name to use. If NULL, a generated UUID will be used. 247 */ 248 static int audioTestEnvInit(PAUDIOTESTENV pTstEnv, PPDMIHOSTAUDIO pDrvAudio, const char *pszPathOut, const char *pszTag) 246 249 { 247 250 RT_BZERO(pTstEnv, sizeof(AUDIOTESTENV)); … … 250 253 PDMAudioHostEnumInit(&pTstEnv->DevEnm); 251 254 252 return ;255 return AudioTestSetCreate(&pTstEnv->Set, pszPathOut, pszTag); 253 256 } 254 257 … … 264 267 265 268 PDMAudioHostEnumDelete(&pTstEnv->DevEnm); 269 270 AudioTestSetDestroy(&pTstEnv->Set); 266 271 } 267 272 … … 274 279 { 275 280 RT_BZERO(pTstParms, sizeof(AUDIOTESTPARMS)); 281 276 282 return; 277 283 } … … 286 292 if (!pTstParms) 287 293 return; 288 289 RTStrFree(pTstParms->pszPathOutAbs);290 pTstParms->pszPathOutAbs = NULL;291 294 292 295 return; … … 609 612 audioTestParmsInit(&TstCust); 610 613 611 char *pszDevice = NULL; /* Custom device to use. Can be NULL if not being used. */ 614 char *pszDevice = NULL; /* Custom device to use. Can be NULL if not being used. */ 615 char *pszPathOut = NULL; /* Custom output path to use. Can be NULL if not being used. */ 616 char *pszTag = NULL; /* Custom tag to use. Can be NULL if not being used. */ 612 617 613 618 RT_ZERO(g_DrvIns); … … 709 714 case VKAT_TEST_OPT_OUTDIR: 710 715 { 711 TstCust.pszPathOutAbs= RTStrDup(ValueUnion.psz);712 break; 713 } 714 715 case VKAT_TEST_OPT_ BIT:716 pszPathOut = RTStrDup(ValueUnion.psz); 717 break; 718 } 719 720 case VKAT_TEST_OPT_PCM_BIT: 716 721 { 717 722 TstCust.ToneParms.Props.cbSampleX = ValueUnion.u8 / 8 /* bit */; … … 719 724 } 720 725 721 case VKAT_TEST_OPT_ CHAN:726 case VKAT_TEST_OPT_PCM_CHAN: 722 727 { 723 728 TstCust.ToneParms.Props.cChannelsX = ValueUnion.u8; … … 725 730 } 726 731 727 case VKAT_TEST_OPT_ HZ:732 case VKAT_TEST_OPT_PCM_HZ: 728 733 { 729 734 TstCust.ToneParms.Props.uHz = ValueUnion.u32; … … 731 736 } 732 737 733 case VKAT_TEST_OPT_ SIGNED:738 case VKAT_TEST_OPT_PCM_SIGNED: 734 739 { 735 740 TstCust.ToneParms.Props.fSigned = ValueUnion.f; 741 break; 742 } 743 744 case VKAT_TEST_OPT_TAG: 745 { 746 pszTag = RTStrDup(ValueUnion.psz); 736 747 break; 737 748 } … … 771 782 /* For now all tests have the same test environment. */ 772 783 AUDIOTESTENV TstEnv; 773 audioTestEnvInit(&TstEnv, pDrvAudio); 774 775 PPDMAUDIOHOSTDEV pDev; 776 rc = audioTestDevicesEnumerateAndCheck(&TstEnv, pszDevice, &pDev); 784 rc = audioTestEnvInit(&TstEnv, pDrvAudio, pszPathOut, pszTag); 777 785 if (RT_SUCCESS(rc)) 778 audioTestWorker(&TstEnv, &TstCust); 779 780 audioTestEnvDestroy(&TstEnv); 786 { 787 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Output directory is '%s'\n", TstEnv.Set.szPathOutAbs); 788 789 PPDMAUDIOHOSTDEV pDev; 790 rc = audioTestDevicesEnumerateAndCheck(&TstEnv, pszDevice, &pDev); 791 if (RT_SUCCESS(rc)) 792 audioTestWorker(&TstEnv, &TstCust); 793 794 audioTestEnvDestroy(&TstEnv); 795 } 781 796 audioTestDrvDestruct(pDrvReg, &g_DrvIns); 782 797 } … … 785 800 786 801 RTStrFree(pszDevice); 802 RTStrFree(pszPathOut); 803 RTStrFree(pszTag); 787 804 788 805 /*
Note:
See TracChangeset
for help on using the changeset viewer.