diff options
author | Chris Robinson <[email protected]> | 2009-05-25 12:01:14 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-05-25 12:01:14 -0700 |
commit | c1de15f84062464db089d895cf17f75ae8faff69 (patch) | |
tree | f8118090ed3bedba8f4b097e6e417d14e584a230 | |
parent | 3be399c55555fdce2a7cfe35d5893691136cdfa5 (diff) |
Update in descrete amounts using the update size
-rw-r--r-- | Alc/alsa.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -177,7 +177,7 @@ static ALuint ALSAProc(ALvoid *ptr) } // make sure there's frames to process - if(avail == 0) + if(avail < (snd_pcm_sframes_t)pDevice->UpdateSize) { if(state != SND_PCM_STATE_RUNNING) { @@ -190,10 +190,13 @@ static ALuint ALSAProc(ALvoid *ptr) break; } } - else if(psnd_pcm_wait(data->pcmHandle, 1000) == 0) + else if(avail == 0 && psnd_pcm_wait(data->pcmHandle, 1000) == 0) AL_PRINT("Wait timeout... buffer size too low?\n"); + else if(avail != 0) + Sleep(1); continue; } + avail = pDevice->UpdateSize; // it is possible that contiguous areas are smaller, thus we use a loop while (avail > 0) @@ -209,9 +212,9 @@ static ALuint ALSAProc(ALvoid *ptr) break; } - SuspendContext(NULL); WritePtr = (char*)areas->addr + (offset * areas->step / 8); WriteCnt = psnd_pcm_frames_to_bytes(data->pcmHandle, frames); + SuspendContext(NULL); aluMixData(pDevice->Context, WritePtr, WriteCnt, pDevice->Format); ProcessContext(NULL); |