VirtualBox

Changeset 57397 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Aug 17, 2015 3:13:40 PM (9 years ago)
Author:
vboxsync
Message:

AudioMixBuffer: Implemented AudioMixBufClear(), added DEBUG_DUMP_PCM_DATA_PATH.

Location:
trunk/src/VBox/Devices/Audio
Files:
2 edited

Legend:

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

    r56648 r57397  
    2121/*
    2222 * DEBUG_DUMP_PCM_DATA enables dumping the raw PCM data
    23  * to a file on the host. Be sure to adjust the dumping path
     23 * to a file on the host. Be sure to adjust DEBUG_DUMP_PCM_DATA_PATH
    2424 * to your needs before using this!
    2525 */
    2626#ifdef DEBUG
    2727//# define DEBUG_DUMP_PCM_DATA
     28# define DEBUG_DUMP_PCM_DATA_PATH "c:\\temp\\"
    2829#endif
    2930
     
    213214
    214215    return rc;
     216}
     217
     218/**
     219 * Clears the entire sample buffer.
     220 *
     221 * @param   pMixBuf                 Mixing buffer to clear.
     222 *
     223 */
     224void AudioMixBufClear(PPDMAUDIOMIXBUF pMixBuf)
     225{
     226    AssertPtrReturnVoid(pMixBuf);
     227
     228    if (pMixBuf->cSamples)
     229        RT_BZERO(pMixBuf->pSamples, pMixBuf->cSamples * sizeof(PDMAUDIOSAMPLE));
    215230}
    216231
     
    13301345#ifdef DEBUG_DUMP_PCM_DATA
    13311346        RTFILE fh;
    1332         rc = RTFileOpen(&fh, "c:\\temp\\mixbuf_readcirc.pcm",
     1347        rc = RTFileOpen(&fh, DEBUG_DUMP_PCM_DATA_PATH "mixbuf_readcirc.pcm",
    13331348                        RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
    13341349        if (RT_SUCCESS(rc))
     
    13701385    pMixBuf->cProcessed   = 0;
    13711386
    1372     if (pMixBuf->cSamples)
    1373         RT_BZERO(pMixBuf->pSamples, pMixBuf->cSamples * sizeof(PDMAUDIOSAMPLE));
     1387    AudioMixBufClear(pMixBuf);
    13741388}
    13751389
     
    15331547#ifdef DEBUG_DUMP_PCM_DATA
    15341548    RTFILE fh;
    1535     rc = RTFileOpen(&fh, "c:\\temp\\mixbuf_writeat.pcm",
     1549    rc = RTFileOpen(&fh, DEBUG_DUMP_PCM_DATA_PATH "mixbuf_writeat.pcm",
    15361550                    RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
    15371551    if (RT_SUCCESS(rc))
     
    16861700#ifdef DEBUG_DUMP_PCM_DATA
    16871701        RTFILE fh;
    1688         RTFileOpen(&fh, "c:\\temp\\mixbuf_writeex.pcm",
     1702        RTFileOpen(&fh, DEBUG_DUMP_PCM_DATA_PATH "mixbuf_writeex.pcm",
    16891703                   RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
    16901704        RTFileWrite(fh, pSamplesDst1, AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), NULL);
  • trunk/src/VBox/Devices/Audio/AudioMixBuffer.h

    r55920 r57397  
    5252int AudioMixBufAcquire(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamplesToRead, PPDMAUDIOSAMPLE *ppvSamples, uint32_t *pcSamplesRead);
    5353inline uint32_t AudioMixBufBytesToSamples(PPDMAUDIOMIXBUF pMixBuf);
     54void AudioMixBufClear(PPDMAUDIOMIXBUF pMixBuf);
    5455void AudioMixBufDestroy(PPDMAUDIOMIXBUF pMixBuf);
    5556void AudioMixBufFinish(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamplesToClear);
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