VirtualBox

Ignore:
Timestamp:
Nov 1, 2016 2:48:42 PM (8 years ago)
Author:
vboxsync
Message:

Audio: Added Validation Kit skeleton driver. Use with VBOX_WITH_AUDIO_VALIDATIONKIT set. Needs to be modifiable at runtime later.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostValidationKit.cpp

    r64378 r64508  
    11/* $Id$ */
    22/** @file
    3  * Debug audio driver -- host backend for dumping and injecting audio data
    4  * from/to the device emulation.
     3 * Validation Kit audio driver.
    54 */
    65
     
    3332 * Structure for keeping a debug input/output stream.
    3433 */
    35 typedef struct DEBUGAUDIOSTREAM
     34typedef struct VAKITAUDIOSTREAM
    3635{
    3736    /** Note: Always must come first! */
     
    5554    };
    5655
    57 } DEBUGAUDIOSTREAM, *PDEBUGAUDIOSTREAM;
    58 
    59 /**
    60  * Debug audio driver instance data.
     56} VAKITAUDIOSTREAM, *PVAKITAUDIOSTREAM;
     57
     58/**
     59 * Validation Kit audio driver instance data.
    6160 * @implements PDMIAUDIOCONNECTOR
    6261 */
    63 typedef struct DRVHOSTDEBUGAUDIO
     62typedef struct DRVHOSTVAKITAUDIO
    6463{
    6564    /** Pointer to the driver instance structure. */
     
    6766    /** Pointer to host audio interface. */
    6867    PDMIHOSTAUDIO IHostAudio;
    69 } DRVHOSTDEBUGAUDIO, *PDRVHOSTDEBUGAUDIO;
     68} DRVHOSTVAKITAUDIO, *PDRVHOSTVAKITAUDIO;
    7069
    7170/*******************************************PDM_AUDIO_DRIVER******************************/
     
    7574 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetConfig}
    7675 */
    77 static DECLCALLBACK(int) drvHostDebugAudioGetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg)
     76static DECLCALLBACK(int) drvHostVaKitAudioGetConfig(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg)
    7877{
    7978    NOREF(pInterface);
    8079    AssertPtrReturn(pBackendCfg, VERR_INVALID_POINTER);
    8180
    82     pBackendCfg->cbStreamOut    = sizeof(DEBUGAUDIOSTREAM);
    83     pBackendCfg->cbStreamIn     = sizeof(DEBUGAUDIOSTREAM);
     81    pBackendCfg->cbStreamOut    = sizeof(VAKITAUDIOSTREAM);
     82    pBackendCfg->cbStreamIn     = sizeof(VAKITAUDIOSTREAM);
    8483
    8584    pBackendCfg->cMaxStreamsOut = 1; /* Output */
     
    9392 * @interface_method_impl{PDMIHOSTAUDIO,pfnInit}
    9493 */
    95 static DECLCALLBACK(int) drvHostDebugAudioInit(PPDMIHOSTAUDIO pInterface)
     94static DECLCALLBACK(int) drvHostVaKitAudioInit(PPDMIHOSTAUDIO pInterface)
    9695{
    9796    NOREF(pInterface);
     
    105104 * @interface_method_impl{PDMIHOSTAUDIO,pfnShutdown}
    106105 */
    107 static DECLCALLBACK(void) drvHostDebugAudioShutdown(PPDMIHOSTAUDIO pInterface)
     106static DECLCALLBACK(void) drvHostVaKitAudioShutdown(PPDMIHOSTAUDIO pInterface)
    108107{
    109108    NOREF(pInterface);
     
    114113 * @interface_method_impl{PDMIHOSTAUDIO,pfnGetStatus}
    115114 */
    116 static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHostDebugAudioGetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
     115static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHostVaKitAudioGetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
    117116{
    118117    RT_NOREF(enmDir);
     
    147146    NOREF(pInterface);
    148147
    149     PDEBUGAUDIOSTREAM pDbgStream = (PDEBUGAUDIOSTREAM)pStream;
     148    PVAKITAUDIOSTREAM pDbgStream = (PVAKITAUDIOSTREAM)pStream;
    150149
    151150    /* Just adopt the wanted stream configuration. */
     
    199198 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCreate}
    200199 */
    201 static DECLCALLBACK(int) drvHostDebugAudioStreamCreate(PPDMIHOSTAUDIO pInterface,
     200static DECLCALLBACK(int) drvHostVaKitAudioStreamCreate(PPDMIHOSTAUDIO pInterface,
    202201                                                       PPDMAUDIOSTREAM pStream,
    203202                                                       PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)
     
    221220 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamPlay}
    222221 */
    223 static DECLCALLBACK(int) drvHostDebugAudioStreamPlay(PPDMIHOSTAUDIO pInterface,
     222static DECLCALLBACK(int) drvHostVaKitAudioStreamPlay(PPDMIHOSTAUDIO pInterface,
    224223                                                     PPDMAUDIOSTREAM pStream, const void *pvBuf, uint32_t cbBuf,
    225224                                                     uint32_t *pcbWritten)
     
    227226    RT_NOREF(pvBuf, cbBuf);
    228227
    229     PDRVHOSTDEBUGAUDIO pDrv       = RT_FROM_MEMBER(pInterface, DRVHOSTDEBUGAUDIO, IHostAudio);
    230     PDEBUGAUDIOSTREAM  pDbgStream = (PDEBUGAUDIOSTREAM)pStream;
     228    PDRVHOSTVAKITAUDIO pDrv       = RT_FROM_MEMBER(pInterface, DRVHOSTVAKITAUDIO, IHostAudio);
     229    PVAKITAUDIOSTREAM  pDbgStream = (PVAKITAUDIOSTREAM)pStream;
    231230
    232231    /* Consume as many samples as would be played at the current frequency since last call. */
     
    294293 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCapture}
    295294 */
    296 static DECLCALLBACK(int) drvHostDebugAudioStreamCapture(PPDMIHOSTAUDIO pInterface,
     295static DECLCALLBACK(int) drvHostVaKitAudioStreamCapture(PPDMIHOSTAUDIO pInterface,
    297296                                                        PPDMAUDIOSTREAM pStream, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead)
    298297{
     
    318317{
    319318    RT_NOREF(pInterface);
    320     PDEBUGAUDIOSTREAM pDbgStream = (PDEBUGAUDIOSTREAM)pStream;
     319    PVAKITAUDIOSTREAM pDbgStream = (PVAKITAUDIOSTREAM)pStream;
    321320    if (   pDbgStream
    322321        && pDbgStream->Out.pu8PlayBuffer)
     
    348347
    349348
    350 static DECLCALLBACK(int) drvHostDebugAudioStreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
     349static DECLCALLBACK(int) drvHostVaKitAudioStreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
    351350{
    352351    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
     
    362361}
    363362
    364 static DECLCALLBACK(int) drvHostDebugAudioStreamControl(PPDMIHOSTAUDIO pInterface,
     363static DECLCALLBACK(int) drvHostVaKitAudioStreamControl(PPDMIHOSTAUDIO pInterface,
    365364                                                        PPDMAUDIOSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd)
    366365{
    367366    RT_NOREF(enmStreamCmd);
     367
    368368    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
    369369    AssertPtrReturn(pStream,    VERR_INVALID_POINTER);
     
    374374}
    375375
    376 static DECLCALLBACK(PDMAUDIOSTRMSTS) drvHostDebugAudioStreamGetStatus(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
     376static DECLCALLBACK(PDMAUDIOSTRMSTS) drvHostVaKitAudioStreamGetStatus(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
    377377{
    378378    NOREF(pInterface);
     
    383383}
    384384
    385 static DECLCALLBACK(int) drvHostDebugAudioStreamIterate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
     385static DECLCALLBACK(int) drvHostVaKitAudioStreamIterate(PPDMIHOSTAUDIO pInterface, PPDMAUDIOSTREAM pStream)
    386386{
    387387    NOREF(pInterface);
     
    395395 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    396396 */
    397 static DECLCALLBACK(void *) drvHostDebugAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     397static DECLCALLBACK(void *) drvHostVaKitAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    398398{
    399399    PPDMDRVINS         pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    400     PDRVHOSTDEBUGAUDIO pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTDEBUGAUDIO);
     400    PDRVHOSTVAKITAUDIO pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTVAKITAUDIO);
    401401
    402402    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
     
    411411 * @copydoc FNPDMDRVCONSTRUCT
    412412 */
    413 static DECLCALLBACK(int) drvHostDebugAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
     413static DECLCALLBACK(int) drvHostVaKitAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
    414414{
    415415    RT_NOREF(pCfg, fFlags);
    416416    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    417     PDRVHOSTDEBUGAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTDEBUGAUDIO);
    418     LogRel(("Audio: Initializing DEBUG driver\n"));
     417    PDRVHOSTVAKITAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTVAKITAUDIO);
     418    LogRel(("Audio: Initializing ValidationKit driver\n"));
    419419
    420420    /*
     
    423423    pThis->pDrvIns                   = pDrvIns;
    424424    /* IBase */
    425     pDrvIns->IBase.pfnQueryInterface = drvHostDebugAudioQueryInterface;
     425    pDrvIns->IBase.pfnQueryInterface = drvHostVaKitAudioQueryInterface;
    426426    /* IHostAudio */
    427     PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHostDebugAudio);
     427    PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHostVaKitAudio);
    428428
    429429    return VINF_SUCCESS;
     
    433433 * Char driver registration record.
    434434 */
    435 const PDMDRVREG g_DrvHostDebugAudio =
     435const PDMDRVREG g_DrvHostValidationKitAudio =
    436436{
    437437    /* u32Version */
    438438    PDM_DRVREG_VERSION,
    439439    /* szName */
    440     "DebugAudio",
     440    "ValidationKit",
    441441    /* szRCMod */
    442442    "",
     
    444444    "",
    445445    /* pszDescription */
    446     "Debug audio host driver",
     446    "ValidationKit audio host driver",
    447447    /* fFlags */
    448448    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
     
    450450    PDM_DRVREG_CLASS_AUDIO,
    451451    /* cMaxInstances */
    452     ~0U,
     452    1,
    453453    /* cbInstance */
    454     sizeof(DRVHOSTDEBUGAUDIO),
     454    sizeof(DRVHOSTVAKITAUDIO),
    455455    /* pfnConstruct */
    456     drvHostDebugAudioConstruct,
     456    drvHostVaKitAudioConstruct,
    457457    /* pfnDestruct */
    458458    NULL,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette