Changeset 89643 in vbox
- Timestamp:
- Jun 13, 2021 1:59:53 PM (3 years ago)
- Location:
- trunk/src/VBox/ValidationKit/utils/audio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r89642 r89643 94 94 * Global Variables * 95 95 *********************************************************************************************************************************/ 96 /** 97 * Backends. 98 * 99 * @note The first backend in the array is the default one for the platform. 100 */ 101 struct 102 { 103 /** The driver registration structure. */ 104 PCPDMDRVREG pDrvReg; 105 /** The backend name. 106 * Aliases are implemented by having multiple entries for the same backend. */ 107 const char *pszName; 108 } const g_aBackends[] = 109 { 110 #if defined(VBOX_WITH_AUDIO_ALSA) && defined(RT_OS_LINUX) 111 { &g_DrvHostALSAAudio, "alsa" }, 112 #endif 113 #ifdef VBOX_WITH_AUDIO_PULSE 114 { &g_DrvHostPulseAudio, "pulseaudio" }, 115 { &g_DrvHostPulseAudio, "pulse" }, 116 { &g_DrvHostPulseAudio, "pa" }, 117 #endif 118 #ifdef VBOX_WITH_AUDIO_OSS 119 { &g_DrvHostOSSAudio, "oss" }, 120 #endif 121 #if defined(RT_OS_DARWIN) 122 { &g_DrvHostCoreAudio, "coreaudio" }, 123 { &g_DrvHostCoreAudio, "core" }, 124 { &g_DrvHostCoreAudio, "ca" }, 125 #endif 126 #if defined(RT_OS_WINDOWS) 127 { &g_DrvHostAudioWas, "wasapi" }, 128 { &g_DrvHostAudioWas, "was" }, 129 { &g_DrvHostDSound, "directsound" }, 130 { &g_DrvHostDSound, "dsound" }, 131 { &g_DrvHostDSound, "ds" }, 132 #endif 133 { &g_DrvHostValidationKitAudio, "valkit" } 134 }; 135 AssertCompile(sizeof(g_aBackends) > 0 /* port me */); 96 136 97 137 /** … … 188 228 189 229 /** 230 * Get default backend. 231 */ 232 PCPDMDRVREG AudioTestGetDefaultBackend(void) 233 { 234 return g_aBackends[0].pDrvReg; 235 } 236 237 238 /** 190 239 * Helper for handling --backend options. 191 240 * … … 194 243 * @param pszBackend The backend option value. 195 244 */ 196 PCPDMDRVREG audioTestFindBackendOpt(const char *pszBackend)245 PCPDMDRVREG AudioTestFindBackendOpt(const char *pszBackend) 197 246 { 198 247 for (uintptr_t i = 0; i < RT_ELEMENTS(g_aBackends); i++) … … 573 622 const char *pszDevice = NULL; /* Custom device to use. Can be NULL if not being used. */ 574 623 const char *pszTag = NULL; /* Custom tag to use. Can be NULL if not being used. */ 575 PCPDMDRVREG pDrvReg = g_aBackends[0].pDrvReg;624 PCPDMDRVREG pDrvReg = AudioTestGetDefaultBackend(); 576 625 bool fWithDrvAudio = false; 577 626 uint8_t cPcmSampleBit = 0; … … 597 646 598 647 case 'b': 599 pDrvReg = audioTestFindBackendOpt(ValueUnion.psz);648 pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz); 600 649 if (pDrvReg == NULL) 601 650 return RTEXITCODE_SYNTAX; -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdGeneric.cpp
r89642 r89643 72 72 */ 73 73 /* Option values: */ 74 PCPDMDRVREG pDrvReg = g_aBackends[0].pDrvReg;74 PCPDMDRVREG pDrvReg = AudioTestGetDefaultBackend(); 75 75 76 76 /* Argument processing loop: */ … … 82 82 { 83 83 case 'b': 84 pDrvReg = audioTestFindBackendOpt(ValueUnion.psz);84 pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz); 85 85 if (pDrvReg == NULL) 86 86 return RTEXITCODE_SYNTAX; … … 408 408 { 409 409 /* Option values: */ 410 PCPDMDRVREG pDrvReg = g_aBackends[0].pDrvReg;410 PCPDMDRVREG pDrvReg = AudioTestGetDefaultBackend(); 411 411 uint32_t cMsBufferSize = UINT32_MAX; 412 412 uint32_t cMsPreBuffer = UINT32_MAX; … … 427 427 { 428 428 case 'b': 429 pDrvReg = audioTestFindBackendOpt(ValueUnion.psz);429 pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz); 430 430 if (pDrvReg == NULL) 431 431 return RTEXITCODE_SYNTAX; … … 753 753 { 754 754 /* Option values: */ 755 PCPDMDRVREG pDrvReg = g_aBackends[0].pDrvReg;755 PCPDMDRVREG pDrvReg = AudioTestGetDefaultBackend(); 756 756 uint32_t cMsBufferSize = UINT32_MAX; 757 757 uint32_t cMsPreBuffer = UINT32_MAX; … … 777 777 { 778 778 case 'b': 779 pDrvReg = audioTestFindBackendOpt(ValueUnion.psz);779 pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz); 780 780 if (pDrvReg == NULL) 781 781 return RTEXITCODE_SYNTAX; -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp
r89642 r89643 255 255 256 256 /* Go with the platform's default bakcend if nothing else is specified. */ 257 Ctx.Guest.pDrvReg = g_aBackends[0].pDrvReg;257 Ctx.Guest.pDrvReg = AudioTestGetDefaultBackend(); 258 258 259 259 /* Argument processing loop: */ … … 286 286 287 287 case 'b': 288 Ctx.Guest.pDrvReg = audioTestFindBackendOpt(ValueUnion.psz);288 Ctx.Guest.pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz); 289 289 if (Ctx.Guest.pDrvReg == NULL) 290 290 return RTEXITCODE_SYNTAX; -
trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp
r89641 r89643 655 655 pDrvReg = &g_DrvHostValidationKitAudio; 656 656 else /* Go with the platform's default backend if nothing else is set. */ 657 pDrvReg = g_aBackends[0].pDrvReg;657 pDrvReg = AudioTestGetDefaultBackend(); 658 658 } 659 659 -
trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h
r89642 r89643 31 31 #endif 32 32 33 34 /********************************************************************************************************************************* 35 * Header Files * 36 *********************************************************************************************************************************/ 33 37 #include <iprt/getopt.h> 34 38 … … 43 47 44 48 #include "VBoxDD.h" 45 46 47 /*********************************************************************************************************************************48 * Externals *49 *********************************************************************************************************************************/50 /** Terminate ASAP if set. Set on Ctrl-C. */51 extern bool volatile g_fTerminate;52 /** The release logger. */53 extern PRTLOGGER g_pRelLogger;54 55 /** The test handle. */56 extern RTTEST g_hTest;57 extern unsigned g_uVerbosity;58 extern bool g_fDrvAudioDebug;59 extern const char *g_pszDrvAudioDebug;60 61 /** The test handle. */62 extern RTTEST g_hTest;63 /** The current verbosity level. */64 extern unsigned g_uVerbosity;65 /** DrvAudio: Enable debug (or not). */66 extern bool g_fDrvAudioDebug;67 /** DrvAudio: The debug output path. */68 extern const char *g_pszDrvAudioDebug;69 70 71 /*********************************************************************************************************************************72 * Defined Constants And Macros *73 *********************************************************************************************************************************/74 49 75 50 … … 136 111 /** Pointer to mixer setup for a stream. */ 137 112 typedef AUDIOTESTDRVMIXSTREAM *PAUDIOTESTDRVMIXSTREAM; 138 139 /**140 * Backends.141 *142 * @note The first backend in the array is the default one for the platform.143 */144 struct145 {146 /** The driver registration structure. */147 PCPDMDRVREG pDrvReg;148 /** The backend name.149 * Aliases are implemented by having multiple entries for the same backend. */150 const char *pszName;151 } const g_aBackends[] =152 {153 #if defined(VBOX_WITH_AUDIO_ALSA) && defined(RT_OS_LINUX)154 { &g_DrvHostALSAAudio, "alsa" },155 #endif156 #ifdef VBOX_WITH_AUDIO_PULSE157 { &g_DrvHostPulseAudio, "pulseaudio" },158 { &g_DrvHostPulseAudio, "pulse" },159 { &g_DrvHostPulseAudio, "pa" },160 #endif161 #ifdef VBOX_WITH_AUDIO_OSS162 { &g_DrvHostOSSAudio, "oss" },163 #endif164 #if defined(RT_OS_DARWIN)165 { &g_DrvHostCoreAudio, "coreaudio" },166 { &g_DrvHostCoreAudio, "core" },167 { &g_DrvHostCoreAudio, "ca" },168 #endif169 #if defined(RT_OS_WINDOWS)170 { &g_DrvHostAudioWas, "wasapi" },171 { &g_DrvHostAudioWas, "was" },172 { &g_DrvHostDSound, "directsound" },173 { &g_DrvHostDSound, "dsound" },174 { &g_DrvHostDSound, "ds" },175 #endif176 { &g_DrvHostValidationKitAudio, "valkit" }177 };178 AssertCompile(sizeof(g_aBackends) > 0 /* port me */);179 113 180 114 /** … … 366 300 typedef VKATCMD const *PCVKATCMD; 367 301 368 extern const VKATCMD g_CmdEnum; 369 extern const VKATCMD g_CmdPlay; 370 extern const VKATCMD g_CmdRec; 371 extern const VKATCMD g_CmdSelfTest; 372 373 extern AUDIOTESTDESC g_aTests[]; 374 extern unsigned g_cTests; 302 303 /********************************************************************************************************************************* 304 * Global Variables * 305 *********************************************************************************************************************************/ 306 /** Terminate ASAP if set. Set on Ctrl-C. */ 307 extern bool volatile g_fTerminate; 308 /** The release logger. */ 309 extern PRTLOGGER g_pRelLogger; 310 311 /** The test handle. */ 312 extern RTTEST g_hTest; 313 extern unsigned g_uVerbosity; 314 extern bool g_fDrvAudioDebug; 315 extern const char *g_pszDrvAudioDebug; 316 317 /** The test handle. */ 318 extern RTTEST g_hTest; 319 /** The current verbosity level. */ 320 extern unsigned g_uVerbosity; 321 /** DrvAudio: Enable debug (or not). */ 322 extern bool g_fDrvAudioDebug; 323 /** DrvAudio: The debug output path. */ 324 extern const char *g_pszDrvAudioDebug; 325 326 extern const VKATCMD g_CmdEnum; 327 extern const VKATCMD g_CmdPlay; 328 extern const VKATCMD g_CmdRec; 329 extern const VKATCMD g_CmdSelfTest; 330 331 extern AUDIOTESTDESC g_aTests[]; 332 extern unsigned g_cTests; 375 333 376 334 … … 421 379 /** @name Backend handling 422 380 * @{ */ 423 PCPDMDRVREG audioTestFindBackendOpt(const char *pszBackend); 381 PCPDMDRVREG AudioTestGetDefaultBackend(void); 382 PCPDMDRVREG AudioTestFindBackendOpt(const char *pszBackend); 424 383 /** @} */ 425 384
Note:
See TracChangeset
for help on using the changeset viewer.