result = mal_device_get_current_frame__dsound(pDevice, mal_device_type_capture, ¤tFramePosCapture);
DWORD physicalCaptureCursorInBytes;
if (result != MAL_SUCCESS) {
DWORD physicalReadCursorInBytes;
return result;
if (FAILED(mal_IDirectSoundCaptureBuffer_GetCurrentPosition((mal_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer, &physicalCaptureCursorInBytes, &physicalReadCursorInBytes))) {
return MAL_ERROR;
}
}
/* If nothing is available we just sleep for a bit and return from this iteration. */
/* If nothing is available we just sleep for a bit and return from this iteration. */
if (currentFramePosCapture == prevFramePosCapture) {
if (physicalReadCursorInBytes == prevReadCursorInBytesCapture) {
mal_sleep(waitTimeInMilliseconds);
mal_sleep(waitTimeInMilliseconds);
continue; /* Nothing is available in the capture buffer. */
continue; /* Nothing is available in the capture buffer. */
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[DirectSound] Failed to unlock internal buffer from capture device after reading from the device.", MAL_FAILED_TO_UNMAP_DEVICE_BUFFER);
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[DirectSound] Failed to unlock internal buffer from capture device after reading from the device.", MAL_FAILED_TO_UNMAP_DEVICE_BUFFER);