hotfix for convert uint16_t to uint32_t as should be for nBlockAlign equation

This commit is contained in:
RadWolfie 2019-03-28 00:26:50 -05:00
parent 274c6fd083
commit 1affa2a680
2 changed files with 4 additions and 4 deletions

View File

@ -1935,7 +1935,7 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_GetInfo)
pInfo->dwFlags = XMO_STREAMF_FIXED_SAMPLE_SIZE | XMO_STREAMF_INPUT_ASYNC;
pInfo->dwInputSize = pThis->EmuBufferDesc.lpwfxFormat->nBlockAlign;
pInfo->dwOutputSize = 0;
pInfo->dwMaxLookahead = std::max(static_cast<uint32_t>(pThis->EmuBufferDesc.lpwfxFormat->nChannels * pThis->EmuBufferDesc.lpwfxFormat->wBitsPerSample / 8) * 32, static_cast<uint32_t>(pThis->EmuBufferDesc.lpwfxFormat->nBlockAlign) * 2);
pInfo->dwMaxLookahead = std::max(static_cast<uint32_t>(pThis->EmuBufferDesc.lpwfxFormat->nChannels * static_cast<uint32_t>(pThis->EmuBufferDesc.lpwfxFormat->wBitsPerSample) / 8) * 32, static_cast<uint32_t>(pThis->EmuBufferDesc.lpwfxFormat->nBlockAlign) * 2);
}
leaveCriticalSection;

View File

@ -226,7 +226,7 @@ inline void GeneratePCMFormat(
lpwfxFormatHost->nChannels = 2;
lpwfxFormatHost->nSamplesPerSec = 44100;
lpwfxFormatHost->wBitsPerSample = 8;
lpwfxFormatHost->nBlockAlign = lpwfxFormatHost->nChannels * lpwfxFormatHost->wBitsPerSample / 8;
lpwfxFormatHost->nBlockAlign = lpwfxFormatHost->nChannels * static_cast<uint32_t>(lpwfxFormatHost->wBitsPerSample) / 8;
lpwfxFormatHost->nAvgBytesPerSec = lpwfxFormatHost->nSamplesPerSec * lpwfxFormatHost->nBlockAlign;
}
else {
@ -249,7 +249,7 @@ inline void GeneratePCMFormat(
}
if (lpwfxFormatHost->nBlockAlign == 0) {
lpwfxFormatHost->nBlockAlign = lpwfxFormatHost->nChannels * lpwfxFormatHost->wBitsPerSample / 8;
lpwfxFormatHost->nBlockAlign = lpwfxFormatHost->nChannels * static_cast<uint32_t>(lpwfxFormatHost->wBitsPerSample) / 8;
}
if (lpwfxFormatHost->nSamplesPerSec == 0) {
@ -335,7 +335,7 @@ inline void GeneratePCMFormat(
// TODO: Still a requirement? Need to retest it again. Can't remember which title cause problem or had been resolved.
// sanity check
if (!bIsSpecial) {
if (DSBufferDesc.lpwfxFormat->nBlockAlign != (DSBufferDesc.lpwfxFormat->nChannels*DSBufferDesc.lpwfxFormat->wBitsPerSample) / 8) {
if (DSBufferDesc.lpwfxFormat->nBlockAlign != DSBufferDesc.lpwfxFormat->nChannels* static_cast<uint32_t>(DSBufferDesc.lpwfxFormat->wBitsPerSample) / 8) {
DSBufferDesc.lpwfxFormat->nBlockAlign = (2 * DSBufferDesc.lpwfxFormat->wBitsPerSample) / 8;
DSBufferDesc.lpwfxFormat->nAvgBytesPerSec = DSBufferDesc.lpwfxFormat->nSamplesPerSec * DSBufferDesc.lpwfxFormat->nBlockAlign;
}