aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfsound/alsa.c
diff options
context:
space:
mode:
authornotaz2015-01-05 23:50:33 +0200
committernotaz2015-01-10 01:57:56 +0200
commite541b8e06ff03a7fe7bd75b1bc0ad53f60b2d0de (patch)
tree68a1291696301e90cf3b10c4fda1733dc4eab0b7 /plugins/dfsound/alsa.c
parent3bd31caf9e9f5ddab2bf4fbdb5a129f4972c45f3 (diff)
downloadpcsx_rearmed-e541b8e06ff03a7fe7bd75b1bc0ad53f60b2d0de.tar.gz
pcsx_rearmed-e541b8e06ff03a7fe7bd75b1bc0ad53f60b2d0de.tar.bz2
pcsx_rearmed-e541b8e06ff03a7fe7bd75b1bc0ad53f60b2d0de.zip
spu: don't block on audio
Diffstat (limited to 'plugins/dfsound/alsa.c')
-rw-r--r--plugins/dfsound/alsa.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/plugins/dfsound/alsa.c b/plugins/dfsound/alsa.c
index b5655a9..6b9f83e 100644
--- a/plugins/dfsound/alsa.c
+++ b/plugins/dfsound/alsa.c
@@ -195,8 +195,21 @@ static void alsa_feed(void *pSound, int lBytes)
snd_pcm_prepare(handle);
snd_pcm_writei(handle, sbuf, sizeof(sbuf) / 4);
snd_pcm_writei(handle, sbuf, sizeof(sbuf) / 4);
+ snd_pcm_writei(handle, sbuf, sizeof(sbuf) / 4);
+ }
+ else
+ {
+ int l = snd_pcm_avail(handle);
+ if (l < lBytes / 4)
+ {
+ if (l == 0)
+ return;
+
+ lBytes = l * 4;
+ }
}
- snd_pcm_writei(handle,pSound, lBytes / 4);
+
+ snd_pcm_writei(handle, pSound, lBytes / 4);
}
void out_register_alsa(struct out_driver *drv)