openbsd-ports/x11/emiclock/patches/patch-sound3
espie 5fc3a0a31a OpenBSD sound support
(why do I spend my time repairing half-finished `ports' ?)
2000-04-02 12:31:52 +00:00

43 lines
1.0 KiB
Plaintext

--- sys/FreeBSD/audio.c.orig Sun Apr 2 13:02:20 2000
+++ sys/FreeBSD/audio.c Sun Apr 2 13:07:43 2000
@@ -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 *cache
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);