aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alsa.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-05-25 12:01:14 -0700
committerChris Robinson <[email protected]>2009-05-25 12:01:14 -0700
commitc1de15f84062464db089d895cf17f75ae8faff69 (patch)
treef8118090ed3bedba8f4b097e6e417d14e584a230 /Alc/alsa.c
parent3be399c55555fdce2a7cfe35d5893691136cdfa5 (diff)
Update in descrete amounts using the update size
Diffstat (limited to 'Alc/alsa.c')
-rw-r--r--Alc/alsa.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Alc/alsa.c b/Alc/alsa.c
index c0e688c2..4d7111c5 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -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);