VirtualBox

Changeset 73529 in vbox for trunk/include


Ignore:
Timestamp:
Aug 6, 2018 4:26:43 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124158
Message:

Audio: Changed cBits -> cBytes of PDMAUDIOPCMPROPS to avoid some unnecessary calculations (light optimization).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmaudioifs.h

    r73467 r73529  
    511511typedef struct PDMAUDIOPCMPROPS
    512512{
    513     /** Sample width. Bits per sample. */
    514     uint8_t     cBits;
     513    /** Sample width (in bytes). */
     514    uint8_t     cBytes;
    515515    /** Number of audio channels. */
    516516    uint8_t     cChannels;
     
    535535
    536536/** Initializor for PDMAUDIOPCMPROPS. */
    537 #define PDMAUDIOPCMPROPS_INITIALIZOR(a_cBits, a_fSigned, a_cCannels, a_uHz, a_cShift, a_fSwapEndian) \
    538     { a_cBits, a_cCannels, a_cShift, a_fSigned, a_fSwapEndian, a_uHz }
     537#define PDMAUDIOPCMPROPS_INITIALIZOR(a_cBytes, a_fSigned, a_cCannels, a_uHz, a_cShift, a_fSwapEndian) \
     538    { a_cBytes, a_cCannels, a_cShift, a_fSigned, a_fSwapEndian, a_uHz }
    539539/** Calculates the cShift value of given sample bits and audio channels.
    540540 *  Note: Does only support mono/stereo channels for now. */
    541 #define PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(cBits, cChannels)     ((cChannels == 2) + (cBits / 16))
     541#define PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(cBytes, cChannels)    ((cChannels == 2) + (cBytes / 2))
    542542/** Calculates the cShift value of a PDMAUDIOPCMPROPS structure. */
    543 #define PDMAUDIOPCMPROPS_MAKE_SHIFT(pProps)                     PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS((pProps)->cBits, (pProps)->cChannels)
     543#define PDMAUDIOPCMPROPS_MAKE_SHIFT(pProps)                     PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS((pProps)->cBytes, (pProps)->cChannels)
    544544/** Converts (audio) frames to bytes.
    545545 *  Needs the cShift value set correctly, using PDMAUDIOPCMPROPS_MAKE_SHIFT. */
Note: See TracChangeset for help on using the changeset viewer.

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