ports/101960: Update port: audio/openal (customizable audio buffer size)
Jean-Yves Lefort
jylefort at FreeBSD.org
Sun Aug 13 06:20:21 UTC 2006
>Number: 101960
>Category: ports
>Synopsis: Update port: audio/openal (customizable audio buffer size)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sun Aug 13 06:20:18 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Jean-Yves Lefort
>Release: FreeBSD 6.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD jsite.lefort.net 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Tue May 9 22:34:08 CEST 2006 jylefort at jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386
>Description:
- Allow to customize the audio buffer size (see pkg-message for the point).
- Take maintainership.
>How-To-Repeat:
>Fix:
diff -ruN /usr/ports/audio/openal/Makefile openal/Makefile
--- /usr/ports/audio/openal/Makefile Wed Jul 5 19:54:22 2006
+++ openal/Makefile Sun Aug 13 08:07:04 2006
@@ -7,12 +7,12 @@
PORTNAME= openal
PORTVERSION= 20060211
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= audio
MASTER_SITES= http://openal.org/openal_webstf/downloads/
DISTVERSION= 0.0.8
-MAINTAINER= erik at smluc.org
+MAINTAINER= jylefort at FreeBSD.org
COMMENT= A 3D positional spatialized sound library
GNU_CONFIGURE= yes
@@ -87,5 +87,8 @@
s|Libs: |&${PTHREAD_LIBS} |;\
s|Cflags: |&${PTHREAD_CFLAGS} |' \
${WRKSRC}/admin/pkgconfig/openal.pc.in
+
+post-install:
+ @${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>
diff -ruN /usr/ports/audio/openal/files/patch-src-backends-alc_backend_bsd.c openal/files/patch-src-backends-alc_backend_bsd.c
--- /usr/ports/audio/openal/files/patch-src-backends-alc_backend_bsd.c Sun Apr 23 21:46:44 2006
+++ openal/files/patch-src-backends-alc_backend_bsd.c Sun Aug 13 07:59:51 2006
@@ -1,5 +1,5 @@
---- src/backends/alc_backend_bsd.c.orig Sat Apr 22 12:25:15 2006
-+++ src/backends/alc_backend_bsd.c Sat Apr 22 12:26:15 2006
+--- src/backends/alc_backend_bsd.c.orig Thu Jan 5 16:11:20 2006
++++ src/backends/alc_backend_bsd.c Sun Aug 13 07:39:16 2006
@@ -9,7 +9,10 @@
*/
#include "al_siteconfig.h"
@@ -11,49 +11,55 @@
#include <assert.h>
#include <fcntl.h>
#include <sys/soundcard.h>
-@@ -113,7 +114,6 @@
+@@ -113,7 +116,6 @@
*/
static void *grab_write_native(void) {
- const char *dsppath = "/dev/dsp";
+ const char *dsppath = "/dev/dsp";
- int divisor = _alSpot(_AL_DEF_BUFSIZ) | (2<<16);
-
- dsp_fd = open(dsppath, O_WRONLY | O_NONBLOCK);
-
-@@ -126,10 +126,6 @@
- perror("fcntl");
- }
-
+
+ dsp_fd = open(dsppath, O_WRONLY | O_NONBLOCK);
+
+@@ -126,10 +128,6 @@
+ perror("fcntl");
+ }
+
- if(ioctl(dsp_fd, SNDCTL_DSP_SETFRAGMENT, &divisor) < 0) {
- perror("ioctl SETFRAGMENT");
- }
-
- FD_ZERO(&dsp_fd_set);
- FD_SET(dsp_fd, &dsp_fd_set);
-
-@@ -318,10 +314,11 @@
+ FD_ZERO(&dsp_fd_set);
+ FD_SET(dsp_fd, &dsp_fd_set);
+
+@@ -318,10 +316,12 @@
}
-
+
static ALboolean set_write_native(UNUSED(void *handle),
- UNUSED(unsigned int *bufsiz),
+ unsigned int *bufsiz,
- ALenum *fmt,
- unsigned int *speed) {
- ALuint channels = _alGetChannelsFromFormat(*fmt);
+ ALenum *fmt,
+ unsigned int *speed) {
+ ALuint channels = _alGetChannelsFromFormat(*fmt);
+ int divisor;
-
- if(dsp_fd < 0) {
- return AL_FALSE;
-@@ -363,6 +360,23 @@
-
-
- *fmt = BSD2ALFMT(*fmt, channels);
++ char *custom_bufsiz;
+
+ if(dsp_fd < 0) {
+ return AL_FALSE;
+@@ -363,6 +363,28 @@
+
+
+ *fmt = BSD2ALFMT(*fmt, channels);
+
-+ if(ioctl(dsp_fd, SNDCTL_DSP_GETBLKSIZE, bufsiz) < 0) {
++ custom_bufsiz = getenv("OPENAL_BUFFER_SIZE");
++ if (custom_bufsiz != NULL)
++ *bufsiz = atoi(custom_bufsiz);
++ else {
++ if(ioctl(dsp_fd, SNDCTL_DSP_GETBLKSIZE, bufsiz) < 0) {
+#ifdef DEBUG_MAXIMUS
-+ fprintf(stderr, "blksize %d\n", *bufsiz);
-+ perror("get_devsp blksize ioctl");
++ fprintf(stderr, "blksize %d\n", *bufsiz);
++ perror("get_devsp blksize ioctl");
+#endif
-+ return AL_FALSE;
++ return AL_FALSE;
++ }
+ }
+
+ divisor = _alSpot(*bufsiz) | (2<<16);
@@ -64,6 +70,6 @@
+#endif
+ return AL_FALSE;
+ }
-
- return AL_TRUE;
+
+ return AL_TRUE;
}
diff -ruN /usr/ports/audio/openal/pkg-message openal/pkg-message
--- /usr/ports/audio/openal/pkg-message Thu Jan 1 01:00:00 1970
+++ openal/pkg-message Sun Aug 13 08:06:42 2006
@@ -0,0 +1,14 @@
+===============================================================================
+If you hear cracks and pops with some applications, adjust the
+OPENAL_BUFFER_SIZE environment variable, for instance:
+
+ export OPENAL_BUFFER_SIZE=8192
+ fgfs
+
+If the OPENAL_BUFFER_SIZE environment variable is not set, the default sound
+card buffer size is used.
+
+Increasing the audio buffer size increases the audio latency but decreases the
+CPU usage; decreasing the audio buffer size decreases the audio latency but
+increases the CPU usage (which can cause cracks and pops).
+===============================================================================
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list