Changeset 88022 in vbox for trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
- Timestamp:
- Mar 8, 2021 5:50:57 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
r88016 r88022 62 62 ); 63 63 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); 67 67 68 68 RTTESTI_CHECK(DrvAudioHlpPcmPropsAreValid(&s_Cfg441StereoS16)); … … 78 78 ("got %x, expected 4\n", PDMAUDIOPCMPROPS_F2B(&s_Cfg441StereoU32, 1))); 79 79 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))); 86 86 87 87 uint32_t u32; 88 88 for (uint32_t i = 0; i < 256; i += 8) 89 89 { 90 RTTESTI_CHECK( DrvAudioHlpIsBytesAligned(&s_Cfg441StereoU32, i) == true);90 RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoU32, i) == true); 91 91 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); 93 93 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); 95 95 } 96 96 for (uint32_t i = 0; i < 4096; i += 4) 97 97 { 98 RTTESTI_CHECK( DrvAudioHlpIsBytesAligned(&s_Cfg441StereoS16, i) == true);98 RTTESTI_CHECK(PDMAudioPropsIsSizeAligned(&s_Cfg441StereoS16, i) == true); 99 99 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); 101 101 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, 106 106 ("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, 108 108 ("cb=%RU32\n", u32)); 109 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoS16, 1)) == 4,109 RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoS16, 1)) == 4, 110 110 ("cb=%RU32\n", u32)); 111 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoU16, 1)) == 4,111 RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoU16, 1)) == 4, 112 112 ("cb=%RU32\n", u32)); 113 RTTESTI_CHECK_MSG((u32 = DrvAudioHlpFramesToBytes(&s_Cfg441StereoU32, 1)) == 8,113 RTTESTI_CHECK_MSG((u32 = PDMAudioPropsFramesToBytes(&s_Cfg441StereoU32, 1)) == 8, 114 114 ("cb=%RU32\n", u32)); 115 115 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)); 119 119 120 120 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, 122 122 ("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, 124 124 ("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, 126 126 ("ms=%RU64\n", u64)); 127 127 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)); 132 132 //RTTESTI_CHECK_MSG((u64 = DrvAudioHlpFramesToMicro(&s_Cfg441StereoS16, 44100)) == RT_US_1SEC, 133 133 // ("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)); 146 146 147 147 /* DrvAudioHlpClearBuf: */ … … 151 151 152 152 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); 154 154 RTTESTI_CHECK(ASMMemIsZero(pbPage, PAGE_SIZE)); 155 155 156 156 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); 158 158 for (uint32_t off = 0; off < PAGE_SIZE; off += 2) 159 159 RTTESTI_CHECK_MSG(pbPage[off] == 0x80 && pbPage[off + 1] == 0, ("off=%#x: %#x %x\n", off, pbPage[off], pbPage[off + 1])); 160 160 161 161 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); 163 163 for (uint32_t off = 0; off < PAGE_SIZE; off += 4) 164 164 RTTESTI_CHECK(pbPage[off] == 0x80 && pbPage[off + 1] == 0 && pbPage[off + 2] == 0 && pbPage[off + 3] == 0); … … 167 167 RTTestDisableAssertions(hTest); 168 168 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. */ 170 170 RTTESTI_CHECK(ASMMemIsZero(pbPage, PAGE_SIZE)); 171 171 172 172 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. */ 174 174 for (uint32_t off = 0; off < PAGE_SIZE; off += 2) 175 175 RTTESTI_CHECK_MSG(pbPage[off] == 0x80 && pbPage[off + 1] == 0, ("off=%#x: %#x %x\n", off, pbPage[off], pbPage[off + 1])); 176 176 177 177 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. */ 179 179 for (uint32_t off = 0; off < PAGE_SIZE; off += 4) 180 180 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.