From c58469e2341b39662ab825ee35d70a9d17b78f74 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 21 Nov 2010 11:34:16 -0800 Subject: Handle the timer wrapping in the wave and null output devices --- Alc/null.c | 7 ++++--- Alc/wave.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'Alc') diff --git a/Alc/null.c b/Alc/null.c index ffff4224..beabdc21 100644 --- a/Alc/null.c +++ b/Alc/null.c @@ -55,9 +55,10 @@ static ALuint NullProc(ALvoid *ptr) avail = (ALuint64)(now-start) * Device->Frequency / 1000; if(avail < done) { - AL_PRINT("Timer wrapped\n"); - aluHandleDisconnect(Device); - break; + /* Timer wrapped. Add the remainder of the cycle to the available + * count and reset the number of samples done */ + avail += 0xFFFFFFFFu*Device->Frequency/1000 - done; + done = 0; } if(avail-done < Device->UpdateSize) { diff --git a/Alc/wave.c b/Alc/wave.c index 1f25d7f2..f8921c64 100644 --- a/Alc/wave.c +++ b/Alc/wave.c @@ -106,9 +106,10 @@ static ALuint WaveProc(ALvoid *ptr) avail = (ALuint64)(now-start) * pDevice->Frequency / 1000; if(avail < done) { - AL_PRINT("Timer wrapped\n"); - aluHandleDisconnect(pDevice); - break; + /* Timer wrapped. Add the remainder of the cycle to the available + * count and reset the number of samples done */ + avail += 0xFFFFFFFFu*pDevice->Frequency/1000 - done; + done = 0; } if(avail-done < pDevice->UpdateSize) { -- cgit v1.2.3