diff options
author | Chris Robinson <[email protected]> | 2008-01-26 21:10:55 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-01-26 21:10:55 -0800 |
commit | ad6237f6f756a56bed11554e07db9f176c6b72ef (patch) | |
tree | 62b740ff37e757222a385752bb5ca232418b9787 /Alc/dsound.c | |
parent | d06c64e1c418802c1461cc8b433251140ad5ad6f (diff) |
Fix availibility amount calculation
Diffstat (limited to 'Alc/dsound.c')
-rw-r--r-- | Alc/dsound.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Alc/dsound.c b/Alc/dsound.c index e7bfb139..41248961 100644 --- a/Alc/dsound.c +++ b/Alc/dsound.c @@ -58,14 +58,17 @@ static ALuint DSoundProc(ALvoid *ptr) DWORD PlayCursor; VOID *WritePtr1, *WritePtr2; DWORD WriteCnt1, WriteCnt2; + DWORD BufferSize; DWORD avail; HRESULT err; + BufferSize = pDevice->UpdateFreq*pDevice->FrameSize; + while(!pData->killNow) { // Get current play and write cursors IDirectSoundBuffer_GetCurrentPosition(pData->DSsbuffer, &PlayCursor, NULL); - avail = (PlayCursor-LastCursor) % (pDevice->UpdateFreq*pDevice->FrameSize); + avail = (PlayCursor-LastCursor+BufferSize) % BufferSize; if(avail == 0) { @@ -105,7 +108,7 @@ static ALuint DSoundProc(ALvoid *ptr) // Update old write cursor location LastCursor += WriteCnt1+WriteCnt2; - LastCursor %= pDevice->UpdateFreq*pDevice->FrameSize; + LastCursor %= BufferSize; } return 0; |