VirtualBox

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


Ignore:
Timestamp:
Feb 8, 2017 11:51:37 AM (8 years ago)
Author:
vboxsync
Message:

Reverted r113373 (committed too much).

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

Legend:

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

    r65673 r65674  
    26742674        pStrmCfg->Props.cBits     = cBits;
    26752675        pStrmCfg->Props.fSigned   = true;
    2676         pStrmCfg->Props.cShift    = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pStrmCfg->Props.cBits, pStrmCfg->Props.cChannels);
    26772676    }
    26782677
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r65673 r65674  
    16411641            streamCfg.Props.cBits     = 16;
    16421642            streamCfg.Props.fSigned   = true;
    1643             streamCfg.Props.cShift    = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(streamCfg.Props.cBits, streamCfg.Props.cChannels);
    16441643
    16451644            rc = ichac97MixerAddDrvStreams(pThis, pMixSink, &streamCfg);
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r65673 r65674  
    153153uint8_t DrvAudioHlpAudFmtToBits(PDMAUDIOFMT enmFmt);
    154154const char *DrvAudioHlpAudFmtToStr(PDMAUDIOFMT enmFmt);
    155 void DrvAudioHlpClearBuf(const PPDMAUDIOPCMPROPS pPCMInfo, void *pvBuf, size_t cbBuf, uint32_t cSamples);
     155void DrvAudioHlpClearBuf(PPDMAUDIOPCMPROPS pPCMInfo, void *pvBuf, size_t cbBuf, uint32_t cSamples);
    156156uint32_t DrvAudioHlpCalcBitrate(uint8_t cBits, uint32_t uHz, uint8_t cChannels);
    157 uint32_t DrvAudioHlpCalcBitrate(const PPDMAUDIOPCMPROPS pProps);
    158 bool DrvAudioHlpPCMPropsAreEqual(const PPDMAUDIOPCMPROPS pPCMProps1, const PPDMAUDIOPCMPROPS pPCMProps2);
    159 bool DrvAudioHlpPCMPropsAreEqual(const PPDMAUDIOPCMPROPS pPCMProps, const PPDMAUDIOSTREAMCFG pCfg);
     157uint32_t DrvAudioHlpCalcBitrate(PPDMAUDIOPCMPROPS pProps);
     158bool DrvAudioHlpPCMPropsAreEqual(PPDMAUDIOPCMPROPS pPCMProps1, PPDMAUDIOPCMPROPS pPCMProps2);
     159bool DrvAudioHlpPCMPropsAreEqual(PPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg);
    160160bool DrvAudioHlpPCMPropsAreValid(const PPDMAUDIOPCMPROPS pProps);
    161 int DrvAudioHlpPCMPropsToStreamCfg(const PPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg);
    162 const char *DrvAudioHlpRecSrcToStr(const PDMAUDIORECSOURCE enmRecSource);
    163 void DrvAudioHlpStreamCfgPrint(const PPDMAUDIOSTREAMCFG pCfg);
     161int DrvAudioHlpPCMPropsToStreamCfg(PPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg);
     162const char *DrvAudioHlpRecSrcToStr(PDMAUDIORECSOURCE enmRecSource);
     163void DrvAudioHlpStreamCfgPrint(PPDMAUDIOSTREAMCFG pCfg);
    164164bool DrvAudioHlpStreamCfgIsValid(const PPDMAUDIOSTREAMCFG pCfg);
    165165int DrvAudioHlpStreamCfgCopy(PPDMAUDIOSTREAMCFG pDstCfg, const PPDMAUDIOSTREAMCFG pSrcCfg);
     
    174174PPDMAUDIODEVICE DrvAudioHlpDeviceAlloc(size_t cbData);
    175175void DrvAudioHlpDeviceFree(PPDMAUDIODEVICE pDev);
    176 PPDMAUDIODEVICE DrvAudioHlpDeviceDup(const PPDMAUDIODEVICE pDev, bool fCopyUserData);
     176PPDMAUDIODEVICE DrvAudioHlpDeviceDup(PPDMAUDIODEVICE pDev, bool fCopyUserData);
    177177
    178178int DrvAudioHlpDeviceEnumInit(PPDMAUDIODEVICEENUM pDevEnm);
    179179void DrvAudioHlpDeviceEnumFree(PPDMAUDIODEVICEENUM pDevEnm);
    180180int DrvAudioHlpDeviceEnumAdd(PPDMAUDIODEVICEENUM pDevEnm, PPDMAUDIODEVICE pDev);
    181 int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, const PPDMAUDIODEVICEENUM pSrcDevEnm, PDMAUDIODIR enmUsage);
    182 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, const PPDMAUDIODEVICEENUM pSrcDevEnm);
    183 PPDMAUDIODEVICEENUM DrvAudioHlpDeviceEnumDup(const PPDMAUDIODEVICEENUM pDevEnm);
    184 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, const PPDMAUDIODEVICEENUM pSrcDevEnm);
    185 int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, const PPDMAUDIODEVICEENUM pSrcDevEnm, PDMAUDIODIR enmUsage, bool fCopyUserData);
    186 PPDMAUDIODEVICE DrvAudioHlpDeviceEnumGetDefaultDevice(const PPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmDir);
    187 void DrvAudioHlpDeviceEnumPrint(const char *pszDesc, const PPDMAUDIODEVICEENUM pDevEnm);
     181int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm, PDMAUDIODIR enmUsage);
     182int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm);
     183PPDMAUDIODEVICEENUM DrvAudioHlpDeviceEnumDup(PPDMAUDIODEVICEENUM pDevEnm);
     184int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm);
     185int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm, PDMAUDIODIR enmUsage, bool fCopyUserData);
     186PPDMAUDIODEVICE DrvAudioHlpDeviceEnumGetDefaultDevice(PPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmDir);
     187void DrvAudioHlpDeviceEnumPrint(const char *pszDesc, PPDMAUDIODEVICEENUM pDevEnm);
    188188
    189189const char *DrvAudioHlpAudDirToStr(PDMAUDIODIR enmDir);
     
    191191char *DrvAudioHlpAudDevFlagsToStrA(PDMAUDIODEVFLAG fFlags);
    192192
    193 int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, const PPDMAUDIOPCMPROPS pProps, PDMAUDIOFILEFLAGS fFlags);
     193int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, PPDMAUDIOPCMPROPS pProps, PDMAUDIOFILEFLAGS fFlags);
    194194int DrvAudioHlpWAVFileClose(PPDMAUDIOFILE pFile);
    195195size_t DrvAudioHlpWAVFileGetDataSize(PPDMAUDIOFILE pFile);
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r65673 r65674  
    141141 * @param   cSamples                Number of audio samples to clear in the buffer.
    142142 */
    143 void DrvAudioHlpClearBuf(const PPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cSamples)
     143void DrvAudioHlpClearBuf(PPDMAUDIOPCMPROPS pPCMProps, void *pvBuf, size_t cbBuf, uint32_t cSamples)
    144144{
    145145    AssertPtrReturnVoid(pPCMProps);
     
    273273 * @param   fCopyUserData       Whether to also copy the user data portion or not.
    274274 */
    275 PPDMAUDIODEVICE DrvAudioHlpDeviceDup(const PPDMAUDIODEVICE pDev, bool fCopyUserData)
     275PPDMAUDIODEVICE DrvAudioHlpDeviceDup(PPDMAUDIODEVICE pDev, bool fCopyUserData)
    276276{
    277277    AssertPtrReturn(pDev, NULL);
     
    363363 * @param   pDevEnm             Device enumeration to duplicate.
    364364 */
    365 PPDMAUDIODEVICEENUM DrvAudioHlpDeviceEnumDup(const PPDMAUDIODEVICEENUM pDevEnm)
     365PPDMAUDIODEVICEENUM DrvAudioHlpDeviceEnumDup(PPDMAUDIODEVICEENUM pDevEnm)
    366366{
    367367    AssertPtrReturn(pDevEnm, NULL);
     
    410410 * @param   fCopyUserData       Whether to also copy the user data portion or not.
    411411 */
    412 int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, const PPDMAUDIODEVICEENUM pSrcDevEnm,
     412int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm,
    413413                                PDMAUDIODIR enmUsage, bool fCopyUserData)
    414414{
     
    452452 * @param   pSrcDevEnm          Source enumeration to use.
    453453 */
    454 int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, const PPDMAUDIODEVICEENUM pSrcDevEnm)
     454int DrvAudioHlpDeviceEnumCopy(PPDMAUDIODEVICEENUM pDstDevEnm, PPDMAUDIODEVICEENUM pSrcDevEnm)
    455455{
    456456    return DrvAudioHlpDeviceEnumCopyEx(pDstDevEnm, pSrcDevEnm, PDMAUDIODIR_ANY, false /* fCopyUserData */);
     
    465465 * @param   enmUsage            Usage to get default device for.
    466466 */
    467 PPDMAUDIODEVICE DrvAudioHlpDeviceEnumGetDefaultDevice(const PPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmUsage)
     467PPDMAUDIODEVICE DrvAudioHlpDeviceEnumGetDefaultDevice(PPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmUsage)
    468468{
    469469    AssertPtrReturn(pDevEnm, NULL);
     
    491491 * @param  pDevEnm              Device enumeration to log.
    492492 */
    493 void DrvAudioHlpDeviceEnumPrint(const char *pszDesc, const PPDMAUDIODEVICEENUM pDevEnm)
     493void DrvAudioHlpDeviceEnumPrint(const char *pszDesc, PPDMAUDIODEVICEENUM pDevEnm)
    494494{
    495495    AssertPtrReturnVoid(pszDesc);
     
    618618 * @param   enmRecSrc           Recording source to convert.
    619619 */
    620 const char *DrvAudioHlpRecSrcToStr(const PDMAUDIORECSOURCE enmRecSrc)
     620const char *DrvAudioHlpRecSrcToStr(PDMAUDIORECSOURCE enmRecSrc)
    621621{
    622622    switch (enmRecSrc)
     
    767767 * @param   pProps2             Second properties to compare.
    768768 */
    769 bool DrvAudioHlpPCMPropsAreEqual(const PPDMAUDIOPCMPROPS pProps1, const PPDMAUDIOPCMPROPS pProps2)
     769bool DrvAudioHlpPCMPropsAreEqual(PPDMAUDIOPCMPROPS pProps1, PPDMAUDIOPCMPROPS pProps2)
    770770{
    771771    AssertPtrReturn(pProps1, false);
     
    816816        return false;
    817817
    818     fValid &= pProps->uHz > 0;
    819     fValid &= pProps->cShift == PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cBits, pProps->cChannels);
    820 
    821     fValid &= pProps->fSwapEndian == false; /** @todo Handling Big Endian audio data is not supported yet. */
     818    fValid |= pProps->uHz > 0;
     819    fValid |= pProps->cShift == PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pProps->cBits, pProps->cChannels);
     820
     821    fValid |= pProps->fSwapEndian == false; /** @todo Handling Big Endian audio data is not supported yet. */
    822822
    823823    return fValid;
     
    832832 * @param   pCfg                Stream configuration to compare.
    833833 */
    834 bool DrvAudioHlpPCMPropsAreEqual(const PPDMAUDIOPCMPROPS pProps, const PPDMAUDIOSTREAMCFG pCfg)
     834bool DrvAudioHlpPCMPropsAreEqual(PPDMAUDIOPCMPROPS pProps, PPDMAUDIOSTREAMCFG pCfg)
    835835{
    836836    AssertPtrReturn(pProps, false);
     
    847847 * @param   pCfg                Pointer to audio stream configuration to store result into.
    848848 */
    849 int DrvAudioHlpPCMPropsToStreamCfg(const PPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg)
     849int DrvAudioHlpPCMPropsToStreamCfg(PPDMAUDIOPCMPROPS pPCMProps, PPDMAUDIOSTREAMCFG pCfg)
    850850{
    851851    AssertPtrReturn(pPCMProps, VERR_INVALID_POINTER);
     
    939939    }
    940940
    941     AssertPtr(pDst);
    942941    return pDst;
    943942}
     
    948947 * @param   pCfg                Stream configuration to log.
    949948 */
    950 void DrvAudioHlpStreamCfgPrint(const PPDMAUDIOSTREAMCFG pCfg)
     949void DrvAudioHlpStreamCfgPrint(PPDMAUDIOSTREAMCFG pCfg)
    951950{
    952951    AssertPtrReturnVoid(pCfg);
     
    10041003 * @remark
    10051004 */
    1006 uint32_t DrvAudioHlpCalcBitrate(const PPDMAUDIOPCMPROPS pProps)
     1005uint32_t DrvAudioHlpCalcBitrate(PPDMAUDIOPCMPROPS pProps)
    10071006{
    10081007    return DrvAudioHlpCalcBitrate(pProps->cBits, pProps->uHz, pProps->cChannels);
     
    11381137 * @param   fFlags              Audio file flags.
    11391138 */
    1140 int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, const PPDMAUDIOPCMPROPS pProps,
     1139int DrvAudioHlpWAVFileOpen(PPDMAUDIOFILE pFile, const char *pszFile, uint32_t fOpen, PPDMAUDIOPCMPROPS pProps,
    11411140                           PDMAUDIOFILEFLAGS fFlags)
    11421141{
  • trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp

    r65673 r65674  
    469469static HRESULT directSoundPlayInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
    470470{
    471     AssertPtrReturn(pThis,     E_POINTER);
    472     AssertPtrReturn(pStreamDS, E_POINTER);
    473 
    474471    if (pStreamDS->Out.pDS != NULL)
    475472    {
     
    512509static HRESULT directSoundPlayClose(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
    513510{
    514     AssertPtrReturn(pThis,     E_POINTER);
     511    AssertPtrReturn(pThis, E_POINTER);
    515512    AssertPtrReturn(pStreamDS, E_POINTER);
    516513
     
    639636        RT_ZERO(bc);
    640637        bc.dwSize = sizeof(bc);
    641 
    642638        hr = IDirectSoundBuffer8_GetCaps(pStreamDS->Out.pDSB, &bc);
    643639        if (FAILED(hr))
     
    774770static HRESULT directSoundPlayGetStatus(PDRVHOSTDSOUND pThis, LPDIRECTSOUNDBUFFER8 pDSB, DWORD *pdwStatus)
    775771{
    776     AssertPtrReturn(pThis, E_POINTER);
     772    AssertPtr(pThis);
    777773    AssertPtrReturn(pDSB,  E_POINTER);
    778 
    779774    AssertPtrNull(pdwStatus);
    780775
     
    848843static HRESULT directSoundPlayStart(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
    849844{
    850     AssertPtrReturn(pThis,     E_POINTER);
     845    AssertPtrReturn(pThis,         E_POINTER);
    851846    AssertPtrReturn(pStreamDS, E_POINTER);
    852847
     
    891886 */
    892887
    893 static LPCGUID dsoundCaptureSelectDevice(PDRVHOSTDSOUND pThis, PPDMAUDIOSTREAMCFG pCfg)
    894 {
    895     AssertPtrReturn(pThis, NULL);
    896     AssertPtrReturn(pCfg,  NULL);
     888static LPCGUID dsoundCaptureSelectDevice(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
     889{
     890    AssertPtrReturn(pThis,     NULL);
     891    AssertPtrReturn(pStreamDS, NULL);
     892    AssertPtrReturn(pStreamDS->pCfg, NULL);
    897893
    898894    int rc = VINF_SUCCESS;
     
    903899        PDSOUNDDEV pDev = NULL;
    904900
    905         switch (pCfg->DestSource.Source)
     901        switch (pStreamDS->pCfg->DestSource.Source)
    906902        {
    907903            case PDMAUDIORECSOURCE_LINE:
     
    936932        {
    937933            DSLOG(("DSound: Guest source '%s' is using host recording device '%s'\n",
    938                    DrvAudioHlpRecSrcToStr(pCfg->DestSource.Source), pDev->pszName));
     934                   DrvAudioHlpRecSrcToStr(pStreamDS->pCfg->DestSource.Source), pDev->pszName));
    939935
    940936            pGUID = &pDev->Guid;
     
    952948    /* This always has to be in the release log. */
    953949    LogRel(("DSound: Guest source '%s' is using host recording device with GUID '%s'\n",
    954             DrvAudioHlpRecSrcToStr(pCfg->DestSource.Source), pszGUID ? pszGUID: "{?}"));
     950            DrvAudioHlpRecSrcToStr(pStreamDS->pCfg->DestSource.Source), pszGUID ? pszGUID: "{?}"));
    955951
    956952    if (pszGUID)
     
    975971
    976972
    977 static HRESULT directSoundCaptureInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS, PPDMAUDIOSTREAMCFG pCfg)
    978 {
    979     AssertPtrReturn(pThis,     E_POINTER);
    980     AssertPtrReturn(pStreamDS, E_POINTER);
    981     AssertPtrReturn(pCfg,      E_POINTER);
    982 
     973static HRESULT directSoundCaptureInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
     974{
    983975    if (pStreamDS->In.pDSC != NULL)
    984976    {
     
    995987    else
    996988    {
    997         LPCGUID pGUID = dsoundCaptureSelectDevice(pThis, pCfg);
     989        LPCGUID pGUID = dsoundCaptureSelectDevice(pThis, pStreamDS);
    998990        hr = IDirectSoundCapture_Initialize(pStreamDS->In.pDSC, pGUID);
    999991        if (FAILED(hr))
     
    10691061        return E_INVALIDARG;
    10701062
    1071     HRESULT hr = directSoundCaptureInterfaceCreate(pThis, pStreamDS, pCfgReq);
     1063    HRESULT hr = directSoundCaptureInterfaceCreate(pThis, pStreamDS);
    10721064    if (FAILED(hr))
    10731065        return hr;
     
    12881280
    12891281        RTMemFree(pDev);
    1290         pDev = NULL;
    12911282    }
    12921283}
     
    16281619        directSoundPlayUnlock(pThis, pDSB, pv1, pv2, cb1, cb2);
    16291620
    1630         pStreamDS->Out.offPlayWritePos = (pStreamDS->Out.offPlayWritePos + cbWrittenTotal) % cbBuffer;
     1621        pStreamDS->Out.offPlayWritePos = (pStreamDS->Out.offPlayWritePos + PDMAUDIOPCMPROPS_S2B(pProps, cbWrittenTotal))
     1622                                       % cbBuffer;
    16311623
    16321624        DSLOGF(("DSound: %RU32/%RU32, buffer write pos %ld, rc=%Rrc\n",
    1633                 cbWrittenTotal, cbLive, pStreamDS->Out.offPlayWritePos, rc));
     1625                PDMAUDIOPCMPROPS_S2B(pProps, cbWrittenTotal), cbLive, pStreamDS->Out.offPlayWritePos, rc));
    16341626
    16351627        if (pStreamDS->Out.fRestartPlayback)
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