Changeset 64508 in vbox for trunk/src/VBox/Devices/Audio/DrvHostValidationKit.cpp
- Timestamp:
- Nov 1, 2016 2:48:42 PM (8 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostValidationKit.cpp
r64378 r64508 1 1 /* $Id$ */ 2 2 /** @file 3 * Debug audio driver -- host backend for dumping and injecting audio data 4 * from/to the device emulation. 3 * Validation Kit audio driver. 5 4 */ 6 5 … … 33 32 * Structure for keeping a debug input/output stream. 34 33 */ 35 typedef struct DEBUGAUDIOSTREAM34 typedef struct VAKITAUDIOSTREAM 36 35 { 37 36 /** Note: Always must come first! */ … … 55 54 }; 56 55 57 } DEBUGAUDIOSTREAM, *PDEBUGAUDIOSTREAM;58 59 /** 60 * Debugaudio driver instance data.56 } VAKITAUDIOSTREAM, *PVAKITAUDIOSTREAM; 57 58 /** 59 * Validation Kit audio driver instance data. 61 60 * @implements PDMIAUDIOCONNECTOR 62 61 */ 63 typedef struct DRVHOST DEBUGAUDIO62 typedef struct DRVHOSTVAKITAUDIO 64 63 { 65 64 /** Pointer to the driver instance structure. */ … … 67 66 /** Pointer to host audio interface. */ 68 67 PDMIHOSTAUDIO IHostAudio; 69 } DRVHOST DEBUGAUDIO, *PDRVHOSTDEBUGAUDIO;68 } DRVHOSTVAKITAUDIO, *PDRVHOSTVAKITAUDIO; 70 69 71 70 /*******************************************PDM_AUDIO_DRIVER******************************/ … … 75 74 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetConfig} 76 75 */ 77 static DECLCALLBACK(int) drvHost DebugAudioGetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg)76 static DECLCALLBACK(int) drvHostVaKitAudioGetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg) 78 77 { 79 78 NOREF(pInterface); 80 79 AssertPtrReturn(pBackendCfg, VERR_INVALID_POINTER); 81 80 82 pBackendCfg->cbStreamOut = sizeof( DEBUGAUDIOSTREAM);83 pBackendCfg->cbStreamIn = sizeof( DEBUGAUDIOSTREAM);81 pBackendCfg->cbStreamOut = sizeof(VAKITAUDIOSTREAM); 82 pBackendCfg->cbStreamIn = sizeof(VAKITAUDIOSTREAM); 84 83 85 84 pBackendCfg->cMaxStreamsOut = 1; /* Output */ … … 93 92 * @interface_method_impl{PDMIHOSTAUDIO,pfnInit} 94 93 */ 95 static DECLCALLBACK(int) drvHost DebugAudioInit(PPDMIHOSTAUDIO pInterface)94 static DECLCALLBACK(int) drvHostVaKitAudioInit(PPDMIHOSTAUDIO pInterface) 96 95 { 97 96 NOREF(pInterface); … … 105 104 * @interface_method_impl{PDMIHOSTAUDIO,pfnShutdown} 106 105 */ 107 static DECLCALLBACK(void) drvHost DebugAudioShutdown(PPDMIHOSTAUDIO pInterface)106 static DECLCALLBACK(void) drvHostVaKitAudioShutdown(PPDMIHOSTAUDIO pInterface) 108 107 { 109 108 NOREF(pInterface); … … 114 113 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetStatus} 115 114 */ 116 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHost DebugAudioGetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)115 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHostVaKitAudioGetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir) 117 116 { 118 117 RT_NOREF(enmDir); … … 147 146 NOREF(pInterface); 148 147 149 P DEBUGAUDIOSTREAM pDbgStream = (PDEBUGAUDIOSTREAM)pStream;148 PVAKITAUDIOSTREAM pDbgStream = (PVAKITAUDIOSTREAM)pStream; 150 149 151 150 /* Just adopt the wanted stream configuration. */ … … 199 198 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCreate} 200 199 */ 201 static DECLCALLBACK(int) drvHost DebugAudioStreamCreate(PPDMIHOSTAUDIO pInterface,200 static DECLCALLBACK(int) drvHostVaKitAudioStreamCreate(PPDMIHOSTAUDIO pInterface, 202 201 PPDMAUDIOSTREAM pStream, 203 202 PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq) … … 221 220 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamPlay} 222 221 */ 223 static DECLCALLBACK(int) drvHost DebugAudioStreamPlay(PPDMIHOSTAUDIO pInterface,222 static DECLCALLBACK(int) drvHostVaKitAudioStreamPlay(PPDMIHOSTAUDIO pInterface, 224 223 PPDMAUDIOSTREAM pStream, const void *pvBuf, uint32_t cbBuf, 225 224 uint32_t *pcbWritten) … … 227 226 RT_NOREF(pvBuf, cbBuf); 228 227 229 PDRVHOST DEBUGAUDIO pDrv = RT_FROM_MEMBER(pInterface, DRVHOSTDEBUGAUDIO, IHostAudio);230 P DEBUGAUDIOSTREAM pDbgStream = (PDEBUGAUDIOSTREAM)pStream;228 PDRVHOSTVAKITAUDIO pDrv = RT_FROM_MEMBER(pInterface, DRVHOSTVAKITAUDIO, IHostAudio); 229 PVAKITAUDIOSTREAM pDbgStream = (PVAKITAUDIOSTREAM)pStream; 231 230 232 231 /* Consume as many samples as would be played at the current frequency since last call. */ … … 294 293 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCapture} 295 294 */ 296 static DECLCALLBACK(int) drvHost DebugAudioStreamCapture(PPDMIHOSTAUDIO pInterface,295 static DECLCALLBACK(int) drvHostVaKitAudioStreamCapture(PPDMIHOSTAUDIO pInterface, 297 296 PPDMAUDIOSTREAM pStream, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead) 298 297 { … … 318 317 { 319 318 RT_NOREF(pInterface); 320 P DEBUGAUDIOSTREAM pDbgStream = (PDEBUGAUDIOSTREAM)pStream;319 PVAKITAUDIOSTREAM pDbgStream = (PVAKITAUDIOSTREAM)pStream; 321 320 if ( pDbgStream 322 321 && pDbgStream->Out.pu8PlayBuffer) … … 348 347 349 348 350 static DECLCALLBACK(int) drvHost DebugAudioStreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)349 static DECLCALLBACK(int) drvHostVaKitAudioStreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream) 351 350 { 352 351 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); … … 362 361 } 363 362 364 static DECLCALLBACK(int) drvHost DebugAudioStreamControl(PPDMIHOSTAUDIO pInterface,363 static DECLCALLBACK(int) drvHostVaKitAudioStreamControl(PPDMIHOSTAUDIO pInterface, 365 364 PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd) 366 365 { 367 366 RT_NOREF(enmStreamCmd); 367 368 368 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 369 369 AssertPtrReturn(pStream, VERR_INVALID_POINTER); … … 374 374 } 375 375 376 static DECLCALLBACK(PDMAUDIOSTRMSTS) drvHost DebugAudioStreamGetStatus(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)376 static DECLCALLBACK(PDMAUDIOSTRMSTS) drvHostVaKitAudioStreamGetStatus(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream) 377 377 { 378 378 NOREF(pInterface); … … 383 383 } 384 384 385 static DECLCALLBACK(int) drvHost DebugAudioStreamIterate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)385 static DECLCALLBACK(int) drvHostVaKitAudioStreamIterate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream) 386 386 { 387 387 NOREF(pInterface); … … 395 395 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 396 396 */ 397 static DECLCALLBACK(void *) drvHost DebugAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)397 static DECLCALLBACK(void *) drvHostVaKitAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID) 398 398 { 399 399 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 400 PDRVHOST DEBUGAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTDEBUGAUDIO);400 PDRVHOSTVAKITAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTVAKITAUDIO); 401 401 402 402 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); … … 411 411 * @copydoc FNPDMDRVCONSTRUCT 412 412 */ 413 static DECLCALLBACK(int) drvHost DebugAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)413 static DECLCALLBACK(int) drvHostVaKitAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 414 414 { 415 415 RT_NOREF(pCfg, fFlags); 416 416 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 417 PDRVHOST DEBUGAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTDEBUGAUDIO);418 LogRel(("Audio: Initializing DEBUGdriver\n"));417 PDRVHOSTVAKITAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTVAKITAUDIO); 418 LogRel(("Audio: Initializing ValidationKit driver\n")); 419 419 420 420 /* … … 423 423 pThis->pDrvIns = pDrvIns; 424 424 /* IBase */ 425 pDrvIns->IBase.pfnQueryInterface = drvHost DebugAudioQueryInterface;425 pDrvIns->IBase.pfnQueryInterface = drvHostVaKitAudioQueryInterface; 426 426 /* IHostAudio */ 427 PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHost DebugAudio);427 PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHostVaKitAudio); 428 428 429 429 return VINF_SUCCESS; … … 433 433 * Char driver registration record. 434 434 */ 435 const PDMDRVREG g_DrvHost DebugAudio =435 const PDMDRVREG g_DrvHostValidationKitAudio = 436 436 { 437 437 /* u32Version */ 438 438 PDM_DRVREG_VERSION, 439 439 /* szName */ 440 " DebugAudio",440 "ValidationKit", 441 441 /* szRCMod */ 442 442 "", … … 444 444 "", 445 445 /* pszDescription */ 446 " Debugaudio host driver",446 "ValidationKit audio host driver", 447 447 /* fFlags */ 448 448 PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT, … … 450 450 PDM_DRVREG_CLASS_AUDIO, 451 451 /* cMaxInstances */ 452 ~0U,452 1, 453 453 /* cbInstance */ 454 sizeof(DRVHOST DEBUGAUDIO),454 sizeof(DRVHOSTVAKITAUDIO), 455 455 /* pfnConstruct */ 456 drvHost DebugAudioConstruct,456 drvHostVaKitAudioConstruct, 457 457 /* pfnDestruct */ 458 458 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.