openbsd-ports/x11/emiclock/patches/patch-sys_FreeBSD_audio_c
2007-10-26 20:44:07 +00:00

44 lines
1.1 KiB
Plaintext

$OpenBSD: patch-sys_FreeBSD_audio_c,v 1.1 2007/10/26 20:44:07 jasper Exp $
--- sys/FreeBSD/audio.c.orig Thu Sep 2 16:34:34 1999
+++ sys/FreeBSD/audio.c Fri Oct 26 22:33:32 2007
@@ -90,7 +90,9 @@ S_PlaySound(char *soundfile)
return (SOUND_DEVICE_ERROR);
}
+#ifdef __FreeBSD__
ioctl(sdev, SNDCTL_DSP_RESET, 0);
+#endif
fstat(sfile, &sstat);
len = sstat.st_size;
@@ -100,7 +102,11 @@ S_PlaySound(char *soundfile)
if ( (l = read(sfile, buffer, len)) > 0)
write(sdev, buffer, l);
+#ifdef __FreeBSD__
ioctl(sdev, SNDCTL_DSP_SYNC, 0);
+#elif defined(__OpenBSD__)
+ ioctl(sdev, AUDIO_DRAIN, 0);
+#endif
XtFree(buffer);
close(sdev);
@@ -159,11 +165,17 @@ S_PlayCacheSound(SoundCacheBuffer *cacheBufferPtr)
return(SOUND_DEVICE_ERROR);
}
+#ifdef __FreeBSD__
ioctl(sdev, SNDCTL_DSP_RESET, 0);
+#endif
write(sdev,cacheBufferPtr->soundCacheBuffer,cacheBufferPtr->soundLength);
+#ifdef __FreeBSD__
ioctl(sdev, SNDCTL_DSP_SYNC, 0);
+#elif defined(__OpenBSD__)
+ ioctl(sdev, AUDIO_DRAIN, 0);
+#endif
close(sdev);
return(SOUND_NO_ERROR);