aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfsound/oss.c
diff options
context:
space:
mode:
authorTwinaphex2014-12-20 20:43:18 +0100
committerTwinaphex2014-12-20 20:43:18 +0100
commit247fc699be6b3bd95fd9126541e0804cc8dffdd4 (patch)
treed38e169e68e48a3ccbf8a3805f9cb87197ed894a /plugins/dfsound/oss.c
parent3e5b01fcef8ef20dacca45ea7a7b0c461e6bd666 (diff)
parent7931825ed8ef51dab3e37475d8126103ebc9fb6f (diff)
downloadpcsx_rearmed-247fc699be6b3bd95fd9126541e0804cc8dffdd4.tar.gz
pcsx_rearmed-247fc699be6b3bd95fd9126541e0804cc8dffdd4.tar.bz2
pcsx_rearmed-247fc699be6b3bd95fd9126541e0804cc8dffdd4.zip
Merge pull request #11 from notaz/upstream_merge
Upstream merge
Diffstat (limited to 'plugins/dfsound/oss.c')
-rw-r--r--plugins/dfsound/oss.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/dfsound/oss.c b/plugins/dfsound/oss.c
index 709cb37..8093ae4 100644
--- a/plugins/dfsound/oss.c
+++ b/plugins/dfsound/oss.c
@@ -16,6 +16,7 @@
***************************************************************************/
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -153,7 +154,20 @@ static int oss_busy(void)
static void oss_feed(void *buf, int bytes)
{
+ audio_buf_info info;
+ char sbuf[4096];
+
if(oss_audio_fd == -1) return;
+ if(ioctl(oss_audio_fd,SNDCTL_DSP_GETOSPACE,&info)==0)
+ {
+ if(info.fragments==info.fragstotal)
+ {
+ memset(sbuf, 0, sizeof(sbuf));
+ write(oss_audio_fd, sbuf, sizeof(sbuf));
+ write(oss_audio_fd, sbuf, sizeof(sbuf));
+ }
+ }
+
write(oss_audio_fd, buf, bytes);
}