VirtualBox

Changeset 74006 in vbox for trunk/src


Ignore:
Timestamp:
Aug 31, 2018 5:23:27 PM (6 years ago)
Author:
vboxsync
Message:

Audio/DrvAudioHlp: Implemented DrvAudioHlpDeviceEnumGetDeviceCount().

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.h

    r73611 r74006  
    247247int DrvAudioHlpDeviceEnumCopyEx(PPDMAUDIODEVICEENUM pDstDevEnm, const PPDMAUDIODEVICEENUM pSrcDevEnm, PDMAUDIODIR enmUsage, bool fCopyUserData);
    248248PPDMAUDIODEVICE DrvAudioHlpDeviceEnumGetDefaultDevice(const PPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmDir);
     249uint16_t DrvAudioHlpDeviceEnumGetDeviceCount(const PPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmUsage);
    249250void DrvAudioHlpDeviceEnumPrint(const char *pszDesc, const PPDMAUDIODEVICEENUM pDevEnm);
    250251/** @}  */
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r73701 r74006  
    490490
    491491    return NULL;
     492}
     493
     494/**
     495 * Returns the number of enumerated devices of a given device enumeration.
     496 *
     497 * @returns Number of devices if found, or 0 if none found.
     498 * @param   pDevEnm             Device enumeration to get default device for.
     499 * @param   enmUsage            Usage to get default device for.
     500 */
     501uint16_t DrvAudioHlpDeviceEnumGetDeviceCount(const PPDMAUDIODEVICEENUM pDevEnm, PDMAUDIODIR enmUsage)
     502{
     503    AssertPtrReturn(pDevEnm, 0);
     504
     505    if (enmUsage == PDMAUDIODIR_ANY)
     506        return pDevEnm->cDevices;
     507
     508    uint32_t cDevs = 0;
     509
     510    PPDMAUDIODEVICE pDev;
     511    RTListForEach(&pDevEnm->lstDevices, pDev, PDMAUDIODEVICE, Node)
     512    {
     513        if (enmUsage == pDev->enmUsage)
     514            cDevs++;
     515    }
     516
     517    return cDevs;
    492518}
    493519
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