Align SB16 DMA buffer size to 4 to avoid crash in 16-bit stereo mode.

This commit is contained in:
Volker Ruppert 2023-12-29 19:49:58 +01:00
parent be1baa295c
commit 63ab5ea24a
1 changed files with 1 additions and 1 deletions

View File

@ -1336,7 +1336,7 @@ void bx_sb16_c::dsp_dma(Bit8u command, Bit8u mode, Bit16u length, Bit8u comp)
}
}
}
DSP.dma.chunkcount = sampledatarate / 10; // 0.1 sec
DSP.dma.chunkcount = (sampledatarate / 10 + 4) & ~3; // 0.1 sec + alignment to 4 (for 16-bit stereo)
if (DSP.dma.chunkcount > BX_SOUNDLOW_WAVEPACKETSIZE) {
DSP.dma.chunkcount = BX_SOUNDLOW_WAVEPACKETSIZE;
}