From 43c375716a7f3cd73f3b3ce8bb03136bef4f5d82 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 5 Oct 2013 00:33:56 -0700 Subject: Only rest as long as needed in the Null renderer --- Alc/backends/null.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Alc/backends/null.c') diff --git a/Alc/backends/null.c b/Alc/backends/null.c index 93b38063..d001cb41 100644 --- a/Alc/backends/null.c +++ b/Alc/backends/null.c @@ -43,8 +43,6 @@ static ALuint NullProc(ALvoid *ptr) null_data *data = (null_data*)Device->ExtraData; ALuint now, start; ALuint64 avail, done; - const ALuint restTime = (ALuint64)Device->UpdateSize * 1000 / - Device->Frequency / 2; done = 0; start = timeGetTime(); @@ -62,15 +60,16 @@ static ALuint NullProc(ALvoid *ptr) } if(avail-done < Device->UpdateSize) { + ALuint restTime = (Device->UpdateSize - (avail-done)) * 1000 / + Device->Frequency; Sleep(restTime); continue; } - while(avail-done >= Device->UpdateSize) - { + do { aluMixData(Device, NULL, Device->UpdateSize); done += Device->UpdateSize; - } + } while(avail-done >= Device->UpdateSize); } return 0; -- cgit v1.2.3