aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-02-13 19:34:47 -0800
committerChris Robinson <[email protected]>2008-02-13 19:34:47 -0800
commitd523b440e3f6211e59f7f4e8f3c752ff6942b664 (patch)
treec67217a750f97053a947e02a916dd79389b0b26c
parentf2875d5d13c1d37c0602d49e49699b4b0a48ddd5 (diff)
Wait for a PCM handle to be ready for more data instead of polling every 1ms or so
-rw-r--r--Alc/alsa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Alc/alsa.c b/Alc/alsa.c
index 67945ae8..19682db7 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -73,6 +73,7 @@ MAKE_FUNC(snd_pcm_hw_params);
MAKE_FUNC(snd_pcm_prepare);
MAKE_FUNC(snd_pcm_start);
MAKE_FUNC(snd_pcm_resume);
+MAKE_FUNC(snd_pcm_wait);
MAKE_FUNC(snd_pcm_state);
MAKE_FUNC(snd_pcm_avail_update);
MAKE_FUNC(snd_pcm_areas_silence);
@@ -185,7 +186,8 @@ static ALuint ALSAProc(ALvoid *ptr)
break;
}
}
- Sleep(1);
+ else if(psnd_pcm_wait(data->pcmHandle, 1000) == 0)
+ AL_PRINT("Wait timeout... buffer size too low?\n");
continue;
}
@@ -747,6 +749,7 @@ LOAD_FUNC(snd_pcm_hw_params);
LOAD_FUNC(snd_pcm_prepare);
LOAD_FUNC(snd_pcm_start);
LOAD_FUNC(snd_pcm_resume);
+LOAD_FUNC(snd_pcm_wait);
LOAD_FUNC(snd_pcm_state);
LOAD_FUNC(snd_pcm_avail_update);
LOAD_FUNC(snd_pcm_areas_silence);