diff options
author | Chris Robinson <[email protected]> | 2014-02-01 16:37:11 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-02-01 16:37:11 -0800 |
commit | 69f3a7da6d80f98298ade5b940422efb3860c9a9 (patch) | |
tree | 8c81048944c5c59f33b3c60dd49dbe1adb0e951d /Alc/ALu.c | |
parent | 9e2a8843a87b8f906a8da89965f473d32ddf40d4 (diff) |
Keep track of a device clock time, based on the number of samples processed
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1126,6 +1126,14 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) for(i = 0;i < SamplesToDo;i++) (*slot)->WetBuffer[0][i] = 0.0f; } + + /* Increment the clock time. Every second's worth of samples is + * converted and added to clock base so that large sample counts don't + * overflow during conversion. This also guarantees an exact, stable + * conversion. */ + device->SamplesDone += SamplesToDo; + device->ClockBase += (device->SamplesDone/device->Frequency) * DEVICE_CLOCK_RES; + device->SamplesDone %= device->Frequency; ALCdevice_Unlock(device); /* Click-removal. Could do better; this only really handles immediate |