Changeset 65035 in vbox
- Timestamp:
- Dec 30, 2016 11:24:17 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp
r65015 r65035 149 149 return; 150 150 151 Assert(pPCMProps->cBits); 152 size_t cbToClear = cSamples * (pPCMProps->cBits / 8 /* Bytes */); 153 Assert(cbBuf >= cbToClear); 154 155 if (cbBuf < cbToClear) 156 cbToClear = cbBuf; 157 151 158 Log2Func(("pPCMInfo=%p, pvBuf=%p, cSamples=%RU32, fSigned=%RTbool, cBits=%RU8, cShift=%RU8\n", 152 159 pPCMProps, pvBuf, cSamples, pPCMProps->fSigned, pPCMProps->cBits, pPCMProps->cShift)); … … 154 161 if (pPCMProps->fSigned) 155 162 { 156 memset(pvBuf, 0, cSamples << pPCMProps->cShift);163 RT_BZERO(pvBuf, cbToClear); 157 164 } 158 165 else … … 162 169 case 8: 163 170 { 164 memset(pvBuf, 0x80, c Samples << pPCMProps->cShift);171 memset(pvBuf, 0x80, cbToClear); 165 172 break; 166 173 } … … 169 176 { 170 177 uint16_t *p = (uint16_t *)pvBuf; 171 int shift = pPCMProps->cChannels - 1; 172 short s = INT16_MAX; 178 int16_t s = INT16_MAX; 173 179 174 180 if (pPCMProps->fSwapEndian) 175 181 s = RT_BSWAP_U16(s); 176 182 177 for (u nsigned i = 0; i < cSamples << shift; i++)183 for (uint32_t i = 0; i < cSamples; i++) 178 184 p[i] = s; 179 185 … … 184 190 { 185 191 uint32_t *p = (uint32_t *)pvBuf; 186 int shift = pPCMProps->cChannels - 1; 187 int32_t s = INT32_MAX; 192 int32_t s = INT32_MAX; 188 193 189 194 if (pPCMProps->fSwapEndian) 190 195 s = RT_BSWAP_U32(s); 191 196 192 for (u nsigned i = 0; i < cSamples << shift; i++)197 for (uint32_t i = 0; i < cSamples; i++) 193 198 p[i] = s; 194 199
Note:
See TracChangeset
for help on using the changeset viewer.