diff options
author | Chris Robinson <[email protected]> | 2012-02-29 00:32:20 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-02-29 00:32:20 -0800 |
commit | 00b0e64bd20ac45bbc848746b3e04deabdbad14d (patch) | |
tree | dd8911c71ff7d0bef1bb077e63e4b40fd8fe1af2 /Alc | |
parent | 2747c87893481414d26100f8f2728be88246872c (diff) |
Use local variables to determine how much to write to mmdevapi
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/mmdevapi.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c index 46e779c5..2b3cfa8b 100644 --- a/Alc/backends/mmdevapi.c +++ b/Alc/backends/mmdevapi.c @@ -272,6 +272,7 @@ static ALuint MMDevApiProc(ALvoid *ptr) IAudioRenderClient *iface; void *ptr; } render; + UINT32 update_size, num_updates; UINT32 written, len; BYTE *buffer; HRESULT hr; @@ -294,6 +295,8 @@ static ALuint MMDevApiProc(ALvoid *ptr) SetRTPriority(); + update_size = device->UpdateSize; + num_updates = device->NumUpdates; while(!data->killNow) { hr = IAudioClient_GetCurrentPadding(data->client, &written); @@ -304,8 +307,8 @@ static ALuint MMDevApiProc(ALvoid *ptr) break; } - len = device->UpdateSize*device->NumUpdates - written; - if(len < device->UpdateSize) + len = update_size*num_updates - written; + if(len < update_size) { DWORD res; res = WaitForSingleObjectEx(data->hNotifyEvent, 2000, FALSE); @@ -313,7 +316,7 @@ static ALuint MMDevApiProc(ALvoid *ptr) ERR("WaitForSingleObjectEx error: 0x%lx\n", res); continue; } - len -= len%device->UpdateSize; + len -= len%update_size; hr = IAudioRenderClient_GetBuffer(render.iface, len, &buffer); if(SUCCEEDED(hr)) |