aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-03-13 01:32:15 -0700
committerChris Robinson <[email protected]>2012-03-13 01:32:15 -0700
commit0af14c7a11b31216bb4c4f7db3fe91af5abac454 (patch)
tree68fa581f5410e81175b8b67b778ef724d83198d7
parent8ef777ebbefd651e6039369cc52fa13effa18c2f (diff)
Try to find a multiple of mmdevapi's period size nearest to the wanted update size
-rw-r--r--Alc/backends/mmdevapi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index 13d63941..9e55c8ce 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -520,6 +520,9 @@ static HRESULT DoReset(ALCdevice *device)
if(SUCCEEDED(hr))
{
min_len = (UINT32)((min_per*device->Frequency + 10000000-1) / 10000000);
+ /* Find the nearest multiple of the period size to the update size */
+ if(min_len < device->UpdateSize)
+ min_len *= (device->UpdateSize + min_len/2)/min_len;
hr = IAudioClient_GetBufferSize(data->client, &buffer_len);
}
if(FAILED(hr))