VirtualBox

Changeset 89397 in vbox for trunk


Ignore:
Timestamp:
May 31, 2021 12:35:46 PM (4 years ago)
Author:
vboxsync
Message:

AudioMixBuffer: Converting AUDMIXBUF_CONVERT into a template file to simplify debugging (can't step macro template code in windbg). bugref:9890

File:
1 edited

Legend:

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

    r89396 r89397  
    11/* $Id$ */
    22/** @file
    3  * Audio mixing buffer for converting template.
     3 * Audio mixing buffer - Format conversion template.
    44 */
    55
     
    1717
    1818
    19 /**
    20  * Macro for generating the conversion routines from/to different formats.
    21  * Be careful what to pass in/out, as most of the macros are optimized for speed and
    22  * thus don't do any bounds checking!
    23  *
    24  * @note Currently does not handle any endianness conversion yet!
    25  */
    26 #define AUDMIXBUF_CONVERT(a_Name, a_Type, _aMin, _aMax, _aSigned, _aShift) \
     19#define AUDMIXBUF_CONVERT(a_Name, a_Type, a_Min, a_Max, a_fSigned, a_cShift) \
    2720/* Clips a specific output value to a single sample value. */ \
    2821DECLINLINE(int32_t) audioMixBufSampleFrom##a_Name(a_Type aVal) \
    2922{ \
    3023    /* left shifting of signed values is not defined, therefore the intermediate uint64_t cast */ \
    31     if (_aSigned) \
    32         return (int32_t) (((uint32_t) ((int32_t) aVal                     )) << (32 - _aShift)); \
    33     return     (int32_t) (((uint32_t) ((int32_t) aVal - ((_aMax >> 1) + 1))) << (32 - _aShift)); \
     24    if (a_fSigned) \
     25        return (int32_t) (((uint32_t) ((int32_t) aVal                     )) << (32 - a_cShift)); \
     26    return     (int32_t) (((uint32_t) ((int32_t) aVal - ((a_Max >> 1) + 1))) << (32 - a_cShift)); \
    3427} \
    3528\
     
    3730DECLINLINE(a_Type) audioMixBufSampleTo##a_Name(int32_t iVal) \
    3831{ \
    39     if (_aSigned) \
    40         return (a_Type)  (iVal >> (32 - _aShift)); \
    41     return     (a_Type) ((iVal >> (32 - _aShift)) + ((_aMax >> 1) + 1)); \
     32    if (a_fSigned) \
     33        return (a_Type)  (iVal >> (32 - a_cShift)); \
     34    return     (a_Type) ((iVal >> (32 - a_cShift)) + ((a_Max >> 1) + 1)); \
    4235} \
    4336\
     
    6154                pDst[idxDst] = audioMixBufSampleTo##a_Name(pi32Src[idxSrc]); \
    6255            else if (idxSrc != -2) \
    63                 pDst[idxDst] = (_aSigned) ? 0 : (_aMax >> 1); \
     56                pDst[idxDst] = (a_fSigned) ? 0 : (a_Max >> 1); \
    6457            else \
    6558                pDst[idxDst] = 0; \
     
    147140                pi32Dst[idxDst] = audioMixBufSampleTo##a_Name(pSrc[idxSrc]); \
    148141            else if (idxSrc != -2) \
    149                 pi32Dst[idxDst] = (_aSigned) ? 0 : (_aMax >> 1); \
     142                pi32Dst[idxDst] = (a_fSigned) ? 0 : (a_Max >> 1); \
    150143            else \
    151144                pi32Dst[idxDst] = 0; \
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