VirtualBox

Changeset 88457 in vbox


Ignore:
Timestamp:
Apr 12, 2021 9:21:06 AM (3 years ago)
Author:
vboxsync
Message:

DrvHostAudioDebug: Tried to correct pfnStreamCapture so it does not ignore the frame size and channel count. Also, use the standard tuning for notes. General cleanups. bugref:9890

File:
1 edited

Legend:

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

    r88390 r88457  
    1616 */
    1717
    18 #include <iprt/mem.h>
    19 #include <iprt/rand.h>
    20 #include <iprt/uuid.h> /* For PDMIBASE_2_PDMDRV. */
    21 
    22 #include <math.h>
    23 
     18
     19/*********************************************************************************************************************************
     20*   Header Files                                                                                                                 *
     21*********************************************************************************************************************************/
    2422#define LOG_GROUP LOG_GROUP_DRV_HOST_AUDIO
    2523#include <VBox/log.h>
     
    2725#include <VBox/vmm/pdmaudioinline.h>
    2826
     27#include <iprt/rand.h>
     28#include <iprt/uuid.h> /* For PDMIBASE_2_PDMDRV. */
     29
     30#define _USE_MATH_DEFINES
     31#include <math.h> /* sin, M_PI */
     32
    2933#include "AudioHlp.h"
    3034#include "VBoxDD.h"
    3135
    3236
    33 /**
    34  * Structure for keeping a debug input/output stream.
     37/*********************************************************************************************************************************
     38*   Structures and Typedefs                                                                                                      *
     39*********************************************************************************************************************************/
     40/**
     41 * Debug host audio stream.
    3542 */
    3643typedef struct DEBUGAUDIOSTREAM
    3744{
    3845    /** The stream's acquired configuration. */
    39     PPDMAUDIOSTREAMCFG pCfg;
     46    PDMAUDIOSTREAMCFG   Cfg;
    4047    /** Audio file to dump output to or read input from. */
    41     PAUDIOHLPFILE      pFile;
     48    PAUDIOHLPFILE       pFile;
    4249    union
    4350    {
    4451        struct
    4552        {
     53            /** Current sample index for generate the sine wave. */
     54            uint64_t    uSample;
     55            /** The fixed portion of the sin() input. */
     56            double      rdFixed;
     57            /** Timestamp of last captured samples. */
     58            uint64_t    tsLastCaptured;
    4659            /** Frequency (in Hz) of the sine wave to generate. */
    47             uint16_t   uFreqHz;
    48             /** Current sample index for generate the sine wave. */
    49             uint64_t   uSample;
    50             /** Timestamp of last captured samples. */
    51             uint64_t   tsLastCaptured;
     60            double      rdFreqHz;
    5261        } In;
    5362    };
    54 } DEBUGAUDIOSTREAM, *PDEBUGAUDIOSTREAM;
     63} DEBUGAUDIOSTREAM;
     64/** Pointer to a debug host audio stream. */
     65typedef DEBUGAUDIOSTREAM *PDEBUGAUDIOSTREAM;
    5566
    5667/**
     
    6172{
    6273    /** Pointer to the driver instance structure. */
    63     PPDMDRVINS    pDrvIns;
     74    PPDMDRVINS      pDrvIns;
    6475    /** Pointer to host audio interface. */
    65     PDMIHOSTAUDIO IHostAudio;
    66 } DRVHOSTDEBUGAUDIO, *PDRVHOSTDEBUGAUDIO;
    67 
    68 /*******************************************PDM_AUDIO_DRIVER******************************/
     76    PDMIHOSTAUDIO   IHostAudio;
     77} DRVHOSTDEBUGAUDIO;
     78/** Pointer to a debug host audio driver. */
     79typedef DRVHOSTDEBUGAUDIO *PDRVHOSTDEBUGAUDIO;
     80
     81
     82/*********************************************************************************************************************************
     83*   Global Variables                                                                                                             *
     84*********************************************************************************************************************************/
     85/** Frequency selection for input streams. */
     86static const double s_ardInputFreqsHz[] =
     87{
     88     349.2282 /*F4*/,
     89     440.0000 /*A4*/,
     90     523.2511 /*C5*/,
     91     698.4565 /*F5*/,
     92     880.0000 /*A5*/,
     93    1046.502  /*C6*/,
     94    1174.659  /*D6*/,
     95    1396.913  /*F6*/,
     96    1760.0000 /*A6*/
     97};
    6998
    7099
     
    77106    AssertPtrReturn(pBackendCfg, VERR_INVALID_POINTER);
    78107
    79     RTStrPrintf2(pBackendCfg->szName, sizeof(pBackendCfg->szName), "DebugAudio");
     108    RTStrCopy(pBackendCfg->szName, sizeof(pBackendCfg->szName), "DebugAudio");
    80109
    81110    pBackendCfg->cbStreamOut    = sizeof(DEBUGAUDIOSTREAM);
     
    94123static DECLCALLBACK(PDMAUDIOBACKENDSTS) drvHostDebugAudioHA_GetStatus(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
    95124{
    96     RT_NOREF(enmDir);
    97     AssertPtrReturn(pInterface, PDMAUDIOBACKENDSTS_UNKNOWN);
    98 
     125    RT_NOREF(pInterface, enmDir);
    99126    return PDMAUDIOBACKENDSTS_RUNNING;
    100 }
    101 
    102 
    103 /**
    104  * Creates a debug output .WAV file on the host with the specified stream configuration.
    105  *
    106  * @returns VBox status code.
    107  * @param   pDrv                Driver instance.
    108  * @param   pStreamDbg          Debug audio stream to create file for.
    109  * @param   fIn                 Whether this is an input or output stream to create file for.
    110  * @param   pCfg                Stream configuration to create .wAV file with.
    111  */
    112 static int debugCreateFile(PDRVHOSTDEBUGAUDIO pDrv, PDEBUGAUDIOSTREAM pStreamDbg, bool fIn, PPDMAUDIOSTREAMCFG pCfg)
    113 {
    114     char szFile[RTPATH_MAX];
    115     int rc = AudioHlpFileNameGet(szFile, RT_ELEMENTS(szFile), NULL /* Use temporary directory */, fIn ? "DebugAudioIn" : "DebugAudioOut",
    116                                  pDrv->pDrvIns->iInstance, AUDIOHLPFILETYPE_WAV, AUDIOHLPFILENAME_FLAGS_NONE);
    117     if (RT_SUCCESS(rc))
    118     {
    119         rc = AudioHlpFileCreate(AUDIOHLPFILETYPE_WAV, szFile, AUDIOHLPFILE_FLAGS_NONE, &pStreamDbg->pFile);
    120         if (RT_SUCCESS(rc))
    121             rc = AudioHlpFileOpen(pStreamDbg->pFile, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE, &pCfg->Props);
    122         if (RT_FAILURE(rc))
    123             LogRel(("DebugAudio: Creating %sput file '%s' failed with %Rrc\n", fIn ? "in" : "out", szFile, rc));
    124     }
    125     else
    126         LogRel(("DebugAudio: Unable to build file name: %Rrc\n", rc));
    127 
    128     return rc;
    129 }
    130 
    131 
    132 static int debugCreateStreamIn(PDRVHOSTDEBUGAUDIO pDrv, PDEBUGAUDIOSTREAM pStreamDbg,
    133                                PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)
    134 {
    135     RT_NOREF(pDrv, pCfgReq);
    136 
    137     pStreamDbg->In.uSample   = 0; /* Initialize sample index. */
    138 
    139     const uint16_t auFreqsHz[] = { 400, 600, 750, 800, 1000, 1200, 1400, 1600 };
    140 
    141     /* Chose a random frequency so that every time a recording is started (hopefully) another tone will be generated. */
    142     pStreamDbg->In.uFreqHz   = auFreqsHz[RTRandU32Ex(0, RT_ELEMENTS(auFreqsHz) - 1)];
    143 
    144     return debugCreateFile(pDrv, pStreamDbg, true /* fIn */, pCfgAcq);
    145 }
    146 
    147 
    148 static int debugCreateStreamOut(PDRVHOSTDEBUGAUDIO pDrv, PDEBUGAUDIOSTREAM pStreamDbg,
    149                                 PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)
    150 {
    151     RT_NOREF(pDrv, pCfgAcq);
    152 
    153     return debugCreateFile(pDrv, pStreamDbg, false /* fIn */, pCfgReq);
    154127}
    155128
     
    161134                                                          PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)
    162135{
    163     AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
    164     AssertPtrReturn(pStream,    VERR_INVALID_POINTER);
    165     AssertPtrReturn(pCfgReq,    VERR_INVALID_POINTER);
    166     AssertPtrReturn(pCfgAcq,    VERR_INVALID_POINTER);
    167 
    168136    PDRVHOSTDEBUGAUDIO pDrv       = RT_FROM_MEMBER(pInterface, DRVHOSTDEBUGAUDIO, IHostAudio);
    169137    PDEBUGAUDIOSTREAM  pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;
    170 
    171     int rc;
     138    AssertPtrReturn(pStreamDbg, VERR_INVALID_POINTER);
     139    AssertPtrReturn(pCfgReq, VERR_INVALID_POINTER);
     140    AssertPtrReturn(pCfgAcq, VERR_INVALID_POINTER);
     141
     142    PDMAudioStrmCfgCopy(&pStreamDbg->Cfg, pCfgAcq);
     143
    172144    if (pCfgReq->enmDir == PDMAUDIODIR_IN)
    173         rc = debugCreateStreamIn( pDrv, pStreamDbg, pCfgReq, pCfgAcq);
    174     else
    175         rc = debugCreateStreamOut(pDrv, pStreamDbg, pCfgReq, pCfgAcq);
    176 
    177     if (RT_SUCCESS(rc))
    178145    {
    179         pStreamDbg->pCfg = PDMAudioStrmCfgDup(pCfgAcq);
    180         if (!pStreamDbg->pCfg)
    181             rc = VERR_NO_MEMORY;
     146        /* Pick a frequency from our selection, so that every time a recording starts
     147           we'll hopfully generate a different note. */
     148        pStreamDbg->In.rdFreqHz = s_ardInputFreqsHz[RTRandU32Ex(0, RT_ELEMENTS(s_ardInputFreqsHz) - 1)];
     149        pStreamDbg->In.rdFixed  = 2.0 * M_PI * pStreamDbg->In.rdFreqHz / PDMAudioPropsHz(&pStreamDbg->Cfg.Props);
     150        pStreamDbg->In.uSample  = 0;
    182151    }
    183152
     153    int rc = AudioHlpFileCreateAndOpenEx(&pStreamDbg->pFile, AUDIOHLPFILETYPE_WAV, NULL /*use temp dir*/,
     154                                         pCfgReq->enmDir == PDMAUDIODIR_IN ? "DebugAudioIn" : "DebugAudioOut",
     155                                         pDrv->pDrvIns->iInstance, AUDIOHLPFILENAME_FLAGS_NONE, AUDIOHLPFILE_FLAGS_NONE,
     156                                         &pCfgReq->Props, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE);
     157    if (RT_FAILURE(rc))
     158        LogRel(("DebugAudio: Failed to creating debug file for %s stream '%s' in the temp directory: %Rrc\n",
     159                pCfgReq->enmDir == PDMAUDIODIR_IN ? "input" : "output", pCfgReq->szName, rc));
     160
    184161    return rc;
     162}
     163
     164
     165/**
     166 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamDestroy}
     167 */
     168static DECLCALLBACK(int) drvHostDebugAudioHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
     169{
     170    RT_NOREF(pInterface);
     171    PDEBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;
     172    AssertPtrReturn(pStreamDbg, VERR_INVALID_POINTER);
     173
     174    if (pStreamDbg->pFile)
     175    {
     176        AudioHlpFileDestroy(pStreamDbg->pFile);
     177        pStreamDbg->pFile = NULL;
     178    }
     179
     180    return VINF_SUCCESS;
     181}
     182
     183
     184/**
     185 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamControl}
     186 */
     187static DECLCALLBACK(int) drvHostDebugAudioHA_StreamControl(PPDMIHOSTAUDIO pInterface,
     188                                                           PPDMAUDIOBACKENDSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd)
     189{
     190    RT_NOREF(pInterface, pStream, enmStreamCmd);
     191    return VINF_SUCCESS;
     192}
     193
     194
     195/**
     196 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetReadable}
     197 */
     198static DECLCALLBACK(uint32_t) drvHostDebugAudioHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
     199{
     200    RT_NOREF(pInterface);
     201    PDEBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;
     202
     203    return PDMAudioPropsMilliToBytes(&pStreamDbg->Cfg.Props, 10 /*ms*/);
     204}
     205
     206
     207/**
     208 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetWritable}
     209 */
     210static DECLCALLBACK(uint32_t) drvHostDebugAudioHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
     211{
     212    RT_NOREF(pInterface, pStream);
     213    return UINT32_MAX;
     214}
     215
     216
     217/**
     218 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetPending}
     219 */
     220static DECLCALLBACK(uint32_t) drvHostDebugAudioHA_StreamGetPending(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
     221{
     222    RT_NOREF(pInterface, pStream);
     223    return 0;
     224}
     225
     226
     227/**
     228 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetWritable}
     229 */
     230static DECLCALLBACK(PDMAUDIOSTREAMSTS) drvHostDebugAudioHA_StreamGetStatus(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
     231{
     232    RT_NOREF(pInterface, pStream);
     233    return PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED | PDMAUDIOSTREAMSTS_FLAGS_ENABLED;
    185234}
    186235
     
    192241                                                        const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten)
    193242{
     243    RT_NOREF(pInterface);
    194244    PDEBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;
    195     RT_NOREF(pInterface);
    196245
    197246    int rc = AudioHlpFileWrite(pStreamDbg->pFile, pvBuf, cbBuf, 0 /* fFlags */);
     
    199248        *pcbWritten = cbBuf;
    200249    else
    201         LogRel(("DebugAudio: Writing output failed with %Rrc\n", rc));
     250        LogRelMax(32, ("DebugAudio: Writing output failed with %Rrc\n", rc));
    202251    return rc;
    203252}
     
    208257 */
    209258static DECLCALLBACK(int) drvHostDebugAudioHA_StreamCapture(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream,
    210                                                            void *pvBuf, uint32_t uBufSize, uint32_t *puRead)
     259                                                           void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead)
    211260{
    212261    RT_NOREF(pInterface);
    213 
    214     PDEBUGAUDIOSTREAM  pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;
    215 
    216     PPDMAUDIOSTREAMCFG pCfg = pStreamDbg->pCfg;
    217     AssertPtr(pCfg);
    218 
    219     Assert(uBufSize % PDMAudioPropsSampleSize(&pCfg->Props) == 0);
    220     size_t const cSamples = uBufSize / PDMAudioPropsSampleSize(&pCfg->Props);
    221 
    222     uint16_t *paBuf = (uint16_t *)pvBuf;
    223 
    224     /* Generate a simple mono sine wave. */
    225     for (size_t i = 0; i < cSamples; i++)
     262    PDEBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;
     263/** @todo rate limit this?  */
     264
     265    /*
     266     * Clear the buffer first so we don't need to thing about additional channels.
     267     */
     268    uint32_t cFrames = PDMAudioPropsBytesToFrames(&pStreamDbg->Cfg.Props, cbBuf);
     269    PDMAudioPropsClearBuffer(&pStreamDbg->Cfg.Props, pvBuf, cbBuf, cFrames);
     270
     271    /*
     272     * Generate the select sin wave in the first channel:
     273     */
     274    uint32_t const cbFrame   = PDMAudioPropsFrameSize(&pStreamDbg->Cfg.Props);
     275    double const   rdFixed   = pStreamDbg->In.rdFixed;
     276    uint64_t       iSrcFrame = pStreamDbg->In.uSample;
     277    switch (PDMAudioPropsSampleSize(&pStreamDbg->Cfg.Props))
    226278    {
    227         paBuf[i] = 32760 * sin((2.f * float(3.1415) * pStreamDbg->In.uFreqHz) / pCfg->Props.uHz * pStreamDbg->In.uSample);
    228         if (pStreamDbg->In.uSample == UINT64_MAX)
    229         {
    230             pStreamDbg->In.uSample = 0;
    231             continue;
    232         }
    233 
    234         pStreamDbg->In.uSample++;
     279        case 1:
     280            /* untested */
     281            if (PDMAudioPropsIsSigned(&pStreamDbg->Cfg.Props))
     282            {
     283                int8_t *piSample = (int8_t *)pvBuf;
     284                while (cFrames-- > 0)
     285                {
     286                    *piSample = 126 /*Amplitude*/ * sin(rdFixed * iSrcFrame);
     287                    iSrcFrame++;
     288                    piSample += cbFrame;
     289                }
     290            }
     291            else
     292            {
     293                /* untested */
     294                uint16_t *pbSample = (uint16_t *)pvBuf;
     295                while (cFrames-- > 0)
     296                {
     297                    *pbSample = 126 /*Amplitude*/ * sin(rdFixed * iSrcFrame) + 0x80;
     298                    iSrcFrame++;
     299                    pbSample += cbFrame;
     300                }
     301            }
     302            break;
     303
     304        case 2:
     305            if (PDMAudioPropsIsSigned(&pStreamDbg->Cfg.Props))
     306            {
     307                int16_t *piSample = (int16_t *)pvBuf;
     308                while (cFrames-- > 0)
     309                {
     310                    *piSample = 32760 /*Amplitude*/ * sin(rdFixed * iSrcFrame);
     311                    iSrcFrame++;
     312                    piSample = (int16_t *)((uint8_t *)piSample + cbFrame);
     313                }
     314            }
     315            else
     316            {
     317                /* untested */
     318                uint16_t *puSample = (uint16_t *)pvBuf;
     319                while (cFrames-- > 0)
     320                {
     321                    *puSample = 32760 /*Amplitude*/ * sin(rdFixed * iSrcFrame) + 0x8000;
     322                    iSrcFrame++;
     323                    puSample = (uint16_t *)((uint8_t *)puSample + cbFrame);
     324                }
     325            }
     326            break;
     327
     328        case 4:
     329            /* untested */
     330            if (PDMAudioPropsIsSigned(&pStreamDbg->Cfg.Props))
     331            {
     332                int32_t *piSample = (int32_t *)pvBuf;
     333                while (cFrames-- > 0)
     334                {
     335                    *piSample = (32760 << 16) /*Amplitude*/ * sin(rdFixed * iSrcFrame);
     336                    iSrcFrame++;
     337                    piSample = (int32_t *)((uint8_t *)piSample + cbFrame);
     338                }
     339            }
     340            else
     341            {
     342                uint32_t *puSample = (uint32_t *)pvBuf;
     343                while (cFrames-- > 0)
     344                {
     345                    *puSample = (32760 << 16) /*Amplitude*/ * sin(rdFixed * iSrcFrame) + UINT32_C(0x80000000);
     346                    iSrcFrame++;
     347                    puSample = (uint32_t *)((uint8_t *)puSample + cbFrame);
     348                }
     349            }
     350            break;
     351
     352        default:
     353            AssertFailed();
    235354    }
    236 
    237     int rc = AudioHlpFileWrite(pStreamDbg->pFile, pvBuf, uBufSize, 0 /* fFlags */);
    238     if (RT_FAILURE(rc))
    239     {
    240         LogRel(("DebugAudio: Writing input failed with %Rrc\n", rc));
    241         return rc;
    242     }
    243 
    244     if (puRead)
    245         *puRead = uBufSize;
    246 
    247     return VINF_SUCCESS;
    248 }
    249 
    250 
    251 static int debugDestroyStreamIn(PDRVHOSTDEBUGAUDIO pDrv, PDEBUGAUDIOSTREAM pStreamDbg)
    252 {
    253     RT_NOREF(pDrv, pStreamDbg);
    254     return VINF_SUCCESS;
    255 }
    256 
    257 
    258 static int debugDestroyStreamOut(PDRVHOSTDEBUGAUDIO pDrv, PDEBUGAUDIOSTREAM pStreamDbg)
    259 {
    260     RT_NOREF(pDrv, pStreamDbg);
    261     return VINF_SUCCESS;
    262 }
    263 
    264 
    265 /**
    266  * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamDestroy}
    267  */
    268 static DECLCALLBACK(int) drvHostDebugAudioHA_StreamDestroy(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
    269 {
    270     AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
    271 
    272     PDRVHOSTDEBUGAUDIO pDrv       = RT_FROM_MEMBER(pInterface, DRVHOSTDEBUGAUDIO, IHostAudio);
    273     PDEBUGAUDIOSTREAM  pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;
    274 
    275     if (!pStreamDbg->pCfg) /* Not (yet) configured? Skip. */
    276         return VINF_SUCCESS;
    277 
    278     int rc;
    279     if (pStreamDbg->pCfg->enmDir == PDMAUDIODIR_IN)
    280         rc = debugDestroyStreamIn (pDrv, pStreamDbg);
     355    pStreamDbg->In.uSample = iSrcFrame;
     356
     357    /*
     358     * Write it.
     359     */
     360    int rc = AudioHlpFileWrite(pStreamDbg->pFile, pvBuf, cbBuf, 0 /* fFlags */);
     361    if (RT_SUCCESS(rc))
     362        *pcbRead = cbBuf;
    281363    else
    282         rc = debugDestroyStreamOut(pDrv, pStreamDbg);
    283 
    284     if (RT_SUCCESS(rc))
    285     {
    286         AudioHlpFileDestroy(pStreamDbg->pFile);
    287 
    288         PDMAudioStrmCfgFree(pStreamDbg->pCfg);
    289         pStreamDbg->pCfg = NULL;
    290     }
    291 
     364        LogRelMax(32, ("DebugAudio: Writing input failed with %Rrc\n", rc));
    292365    return rc;
    293 }
    294 
    295 
    296 /**
    297  * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamControl}
    298  */
    299 static DECLCALLBACK(int) drvHostDebugAudioHA_StreamControl(PPDMIHOSTAUDIO pInterface,
    300                                                            PPDMAUDIOBACKENDSTREAM pStream, PDMAUDIOSTREAMCMD enmStreamCmd)
    301 {
    302     RT_NOREF(enmStreamCmd);
    303     AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
    304     AssertPtrReturn(pStream,    VERR_INVALID_POINTER);
    305 
    306     return VINF_SUCCESS;
    307 }
    308 
    309 
    310 /**
    311  * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetReadable}
    312  */
    313 static DECLCALLBACK(uint32_t) drvHostDebugAudioHA_StreamGetReadable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
    314 {
    315     RT_NOREF(pInterface);
    316 
    317     PDEBUGAUDIOSTREAM pStreamDbg = (PDEBUGAUDIOSTREAM)pStream;
    318 
    319     AssertPtr(pStreamDbg->pCfg);
    320 
    321     return PDMAudioPropsMilliToBytes(&pStreamDbg->pCfg->Props, 10 /*ms*/);
    322 }
    323 
    324 
    325 /**
    326  * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetWritable}
    327  */
    328 static DECLCALLBACK(uint32_t) drvHostDebugAudioHA_StreamGetWritable(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
    329 {
    330     RT_NOREF(pInterface, pStream);
    331 
    332     return UINT32_MAX;
    333 }
    334 
    335 
    336 /**
    337  * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamGetWritable}
    338  */
    339 static DECLCALLBACK(PDMAUDIOSTREAMSTS) drvHostDebugAudioHA_StreamGetStatus(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream)
    340 {
    341     RT_NOREF(pInterface, pStream);
    342 
    343     return PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED | PDMAUDIOSTREAMSTS_FLAGS_ENABLED;
    344366}
    345367
     
    379401    /* IHostAudio */
    380402    pThis->IHostAudio.pfnGetConfig          = drvHostDebugAudioHA_GetConfig;
     403    pThis->IHostAudio.pfnGetDevices         = NULL;
    381404    pThis->IHostAudio.pfnGetStatus          = drvHostDebugAudioHA_GetStatus;
    382405    pThis->IHostAudio.pfnStreamCreate       = drvHostDebugAudioHA_StreamCreate;
     
    385408    pThis->IHostAudio.pfnStreamGetReadable  = drvHostDebugAudioHA_StreamGetReadable;
    386409    pThis->IHostAudio.pfnStreamGetWritable  = drvHostDebugAudioHA_StreamGetWritable;
     410    pThis->IHostAudio.pfnStreamGetPending   = drvHostDebugAudioHA_StreamGetPending;
    387411    pThis->IHostAudio.pfnStreamGetStatus    = drvHostDebugAudioHA_StreamGetStatus;
    388412    pThis->IHostAudio.pfnStreamPlay         = drvHostDebugAudioHA_StreamPlay;
    389413    pThis->IHostAudio.pfnStreamCapture      = drvHostDebugAudioHA_StreamCapture;
    390     pThis->IHostAudio.pfnGetDevices         = NULL;
    391     pThis->IHostAudio.pfnStreamGetPending   = NULL;
    392414
    393415#ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
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