dsound: Adjust for partial block before prepare-header and add-buffer steps.
Otherwise, the wave-in driver(s) may copy incorrect data to internal structures.
This commit is contained in:
parent
0bb1eb72b8
commit
2de653552c
|
@ -1146,6 +1146,9 @@ IDirectSoundCaptureBufferImpl_Start(
|
|||
|
||||
for (c = 0; c < device->nrofpwaves; ++c) {
|
||||
device->pwave[c].lpData = (char *)device->buffer + c * blocksize;
|
||||
if (c + 1 == device->nrofpwaves)
|
||||
device->pwave[c].dwBufferLength = device->buflen - c * blocksize;
|
||||
else
|
||||
device->pwave[c].dwBufferLength = blocksize;
|
||||
device->pwave[c].dwBytesRecorded = 0;
|
||||
device->pwave[c].dwUser = (DWORD)device;
|
||||
|
@ -1167,8 +1170,6 @@ IDirectSoundCaptureBufferImpl_Start(
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (device->buflen % blocksize)
|
||||
device->pwave[device->nrofpwaves - 1].dwBufferLength = device->buflen % blocksize;
|
||||
|
||||
FillMemory(device->buffer, device->buflen, (device->pwfx->wBitsPerSample == 8) ? 128 : 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue