VirtualBox

Ignore:
Timestamp:
Mar 8, 2021 5:50:57 PM (4 years ago)
Author:
vboxsync
Message:

Audio: Preparing to move some of the DrvAudio.h stuff into PDM. bugref:9890

File:
1 edited

Legend:

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

    r88016 r88022  
    6262    );
    6363
    64     RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoS16) == 44100*4*8);
    65     RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoU16) == 44100*4*8);
    66     RTTESTI_CHECK(DrvAudioHlpGetBitrate(&s_Cfg441StereoU32) == 44100*8*8);
     64    RTTESTI_CHECK(PDMAudioPropsGetBitrate(&s_Cfg441StereoS16) == 44100*4*8);
     65    RTTESTI_CHECK(PDMAudioPropsGetBitrate(&s_Cfg441StereoU16) == 44100*4*8);
     66    RTTESTI_CHECK(PDMAudioPropsGetBitrate(&s_Cfg441StereoU32) == 44100*8*8);
    6767
    6868    RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&s_Cfg441StereoS16));
     
    7878                      ("got %x, expected 4\n", PDMAUDIOPCMPROPS_F2B(&s_Cfg441StereoU32, 1)));
    7979
    80     RTTESTI_CHECK_MSG(DrvAudioHlpBytesPerFrame(&s_Cfg441StereoS16) == 4,
    81                       ("got %x, expected 4\n", DrvAudioHlpBytesPerFrame(&s_Cfg441StereoS16)));
    82     RTTESTI_CHECK_MSG(DrvAudioHlpBytesPerFrame(&s_Cfg441StereoU16) == 4,
    83                       ("got %x, expected 4\n", DrvAudioHlpBytesPerFrame(&s_Cfg441StereoU16)));
    84     RTTESTI_CHECK_MSG(DrvAudioHlpBytesPerFrame(&s_Cfg441StereoU32) == 8,
    85                       ("got %x, expected 4\n", DrvAudioHlpBytesPerFrame(&s_Cfg441StereoU32)));
     80    RTTESTI_CHECK_MSG(PDMAudioPropsBytesPerFrame(&s_Cfg441StereoS16) == 4,
     81                      ("got %x, expected 4\n", PDMAudioPropsBytesPerFrame(&s_Cfg441StereoS16)));
     82    RTTESTI_CHECK_MSG(PDMAudioPropsBytesPerFrame(&s_Cfg441StereoU16) == 4,
     83                      ("got %x, expected 4\n", PDMAudioPropsBytesPerFrame(&s_Cfg441StereoU16)));
     84    RTTESTI_CHECK_MSG(PDMAudioPropsBytesPerFrame(&s_Cfg441StereoU32) == 8,
     85                      ("got %x, expected 4\n", PDMAudioPropsBytesPerFrame(&s_Cfg441StereoU32)));
    8686
    8787    uint32_t u32;
    8888    for (uint32_t i = 0; i < 256; i += 8)
    8989    {
    90         RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i) == true);
     90        RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoU32, i) == true);
    9191        for (uint32_t j = 1; j < 8; j++)
    92             RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i + j) == false);
     92            RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoU32, i + j) == false);
    9393        for (uint32_t j = 0; j < 8; j++)
    94             RTTESTI_CHECK(DrvAudioHlpFloorBytesToFrame(&s_Cfg441StereoU32, i + j) == i);
     94            RTTESTI_CHECK(PDMAudioPropsFloorBytesToFrame(&s_Cfg441StereoU32, i + j) == i);
    9595    }
    9696    for (uint32_t i = 0; i < 4096; i += 4)
    9797    {
    98         RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoS16, i) == true);
     98        RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoS16, i) == true);
    9999        for (uint32_t j = 1; j < 4; j++)
    100             RTTESTI_CHECK(DrvAudioHlpIsBytesAligned(&s_Cfg441StereoS16, i + j) == false);
     100            RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoS16, i + j) == false);
    101101        for (uint32_t j = 0; j < 4; j++)
    102             RTTESTI_CHECK(DrvAudioHlpFloorBytesToFrame(&s_Cfg441StereoS16, i + j) == i);
    103     }
    104 
    105     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 44100)) == 44100 * 2 * 2,
     102            RTTESTI_CHECK(PDMAudioPropsFloorBytesToFrame(&s_Cfg441StereoS16, i + j) == i);
     103    }
     104
     105    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoS16, 44100)) == 44100 * 2 * 2,
    106106                      ("cb=%RU32\n", u32));
    107     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 2)) == 2 * 2 * 2,
     107    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoS16, 2)) == 2 * 2 * 2,
    108108                      ("cb=%RU32\n", u32));
    109     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 1)) == 4,
     109    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoS16, 1)) == 4,
    110110                      ("cb=%RU32\n", u32));
    111     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoU16, 1)) == 4,
     111    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoU16, 1)) == 4,
    112112                      ("cb=%RU32\n", u32));
    113     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoU32, 1)) == 8,
     113    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoU32, 1)) == 8,
    114114                      ("cb=%RU32\n", u32));
    115115
    116     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoS16, 4)) == 1, ("cb=%RU32\n", u32));
    117     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoU16, 4)) == 1, ("cb=%RU32\n", u32));
    118     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpBytesToFrames(&s_Cfg441StereoU32, 8)) == 1, ("cb=%RU32\n", u32));
     116    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsBytesToFrames(&s_Cfg441StereoS16, 4)) == 1, ("cb=%RU32\n", u32));
     117    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsBytesToFrames(&s_Cfg441StereoU16, 4)) == 1, ("cb=%RU32\n", u32));
     118    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsBytesToFrames(&s_Cfg441StereoU32, 8)) == 1, ("cb=%RU32\n", u32));
    119119
    120120    uint64_t u64;
    121     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpBytesToNano(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_NS_1SEC,
     121    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsBytesToNano(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_NS_1SEC,
    122122                      ("ns=%RU64\n", u64));
    123     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpBytesToMicro(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_US_1SEC,
     123    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsBytesToMicro(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_US_1SEC,
    124124                      ("us=%RU64\n", u64));
    125     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpBytesToMilli(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_MS_1SEC,
     125    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsBytesToMilli(&s_Cfg441StereoS16, 44100 * 2 * 2)) == RT_MS_1SEC,
    126126                      ("ms=%RU64\n", u64));
    127127
    128     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16, 44100)) == RT_NS_1SEC, ("ns=%RU64\n", u64));
    129     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16,     1)) == 22675,      ("ns=%RU64\n", u64));
    130     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16,    31)) == 702947,     ("ns=%RU64\n", u64));
    131     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToNano(&s_Cfg441StereoS16,   255)) == 5782312,    ("ns=%RU64\n", u64));
     128    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToNano(&s_Cfg441StereoS16, 44100)) == RT_NS_1SEC, ("ns=%RU64\n", u64));
     129    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToNano(&s_Cfg441StereoS16,     1)) == 22675,      ("ns=%RU64\n", u64));
     130    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToNano(&s_Cfg441StereoS16,    31)) == 702947,     ("ns=%RU64\n", u64));
     131    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToNano(&s_Cfg441StereoS16,   255)) == 5782312,    ("ns=%RU64\n", u64));
    132132    //RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMicro(&s_Cfg441StereoS16, 44100)) == RT_US_1SEC,
    133133    //                  ("us=%RU64\n", u64));
    134     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli(&s_Cfg441StereoS16, 44100)) == RT_MS_1SEC, ("ms=%RU64\n", u64));
    135     RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMilli(&s_Cfg441StereoS16,   255)) == 5,          ("ms=%RU64\n", u64));
    136 
    137     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToFrames(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100, ("cb=%RU32\n", u32));
    138     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToFrames(&s_Cfg441StereoS16,      215876)) == 10,    ("cb=%RU32\n", u32));
    139     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToFrames(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100, ("cb=%RU32\n", u32));
    140     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToFrames(&s_Cfg441StereoU32,          6)) == 265,   ("cb=%RU32\n", u32));
    141 
    142     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToBytes(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
    143     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpNanoToBytes(&s_Cfg441StereoS16,      702947)) == 31*2*2,    ("cb=%RU32\n", u32));
    144     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToBytes(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
    145     RTTESTI_CHECK_MSG((u32 = DrvAudioHlpMilliToBytes(&s_Cfg441StereoS16,          5)) == 884,       ("cb=%RU32\n", u32));
     134    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToMilli(&s_Cfg441StereoS16, 44100)) == RT_MS_1SEC, ("ms=%RU64\n", u64));
     135    RTTESTI_CHECK_MSG((u64 = PDMAudioPropsFramesToMilli(&s_Cfg441StereoS16,   255)) == 5,          ("ms=%RU64\n", u64));
     136
     137    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsNanoToFrames(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100, ("cb=%RU32\n", u32));
     138    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsNanoToFrames(&s_Cfg441StereoS16,      215876)) == 10,    ("cb=%RU32\n", u32));
     139    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsMilliToFrames(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100, ("cb=%RU32\n", u32));
     140    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsMilliToFrames(&s_Cfg441StereoU32,          6)) == 265,   ("cb=%RU32\n", u32));
     141
     142    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsNanoToBytes(&s_Cfg441StereoS16,  RT_NS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
     143    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsNanoToBytes(&s_Cfg441StereoS16,      702947)) == 31*2*2,    ("cb=%RU32\n", u32));
     144    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsMilliToBytes(&s_Cfg441StereoS16, RT_MS_1SEC)) == 44100*2*2, ("cb=%RU32\n", u32));
     145    RTTESTI_CHECK_MSG((u32 = PDMAudioPropsMilliToBytes(&s_Cfg441StereoS16,          5)) == 884,       ("cb=%RU32\n", u32));
    146146
    147147    /* DrvAudioHlpClearBuf: */
     
    151151
    152152    memset(pbPage, 0x42, PAGE_SIZE);
    153     DrvAudioHlpClearBuf(&s_Cfg441StereoS16, pbPage, PAGE_SIZE, PAGE_SIZE / 4);
     153    PDMAudioPropsClearBuffer(&s_Cfg441StereoS16, pbPage, PAGE_SIZE, PAGE_SIZE / 4);
    154154    RTTESTI_CHECK(ASMMemIsZero(pbPage, PAGE_SIZE));
    155155
    156156    memset(pbPage, 0x42, PAGE_SIZE);
    157     DrvAudioHlpClearBuf(&s_Cfg441StereoU16, pbPage, PAGE_SIZE, PAGE_SIZE / 4);
     157    PDMAudioPropsClearBuffer(&s_Cfg441StereoU16, pbPage, PAGE_SIZE, PAGE_SIZE / 4);
    158158    for (uint32_t off = 0; off < PAGE_SIZE; off += 2)
    159159        RTTESTI_CHECK_MSG(pbPage[off] == 0x80 && pbPage[off + 1] == 0, ("off=%#x: %#x %x\n", off, pbPage[off], pbPage[off + 1]));
    160160
    161161    memset(pbPage, 0x42, PAGE_SIZE);
    162     DrvAudioHlpClearBuf(&s_Cfg441StereoU32, pbPage, PAGE_SIZE, PAGE_SIZE / 8);
     162    PDMAudioPropsClearBuffer(&s_Cfg441StereoU32, pbPage, PAGE_SIZE, PAGE_SIZE / 8);
    163163    for (uint32_t off = 0; off < PAGE_SIZE; off += 4)
    164164        RTTESTI_CHECK(pbPage[off] == 0x80 && pbPage[off + 1] == 0 && pbPage[off + 2] == 0 && pbPage[off + 3] == 0);
     
    167167    RTTestDisableAssertions(hTest);
    168168    memset(pbPage, 0x42, PAGE_SIZE);
    169     DrvAudioHlpClearBuf(&s_Cfg441StereoS16, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
     169    PDMAudioPropsClearBuffer(&s_Cfg441StereoS16, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
    170170    RTTESTI_CHECK(ASMMemIsZero(pbPage, PAGE_SIZE));
    171171
    172172    memset(pbPage, 0x42, PAGE_SIZE);
    173     DrvAudioHlpClearBuf(&s_Cfg441StereoU16, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
     173    PDMAudioPropsClearBuffer(&s_Cfg441StereoU16, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
    174174    for (uint32_t off = 0; off < PAGE_SIZE; off += 2)
    175175        RTTESTI_CHECK_MSG(pbPage[off] == 0x80 && pbPage[off + 1] == 0, ("off=%#x: %#x %x\n", off, pbPage[off], pbPage[off + 1]));
    176176
    177177    memset(pbPage, 0x42, PAGE_SIZE);
    178     DrvAudioHlpClearBuf(&s_Cfg441StereoU32, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
     178    PDMAudioPropsClearBuffer(&s_Cfg441StereoU32, pbPage, PAGE_SIZE, PAGE_SIZE); /* should adjust down the frame count. */
    179179    for (uint32_t off = 0; off < PAGE_SIZE; off += 4)
    180180        RTTESTI_CHECK(pbPage[off] == 0x80 && pbPage[off + 1] == 0 && pbPage[off + 2] == 0 && pbPage[off + 3] == 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