aboutsummaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorjylefort <jylefort@FreeBSD.org>2006-08-16 21:27:39 +0800
committerjylefort <jylefort@FreeBSD.org>2006-08-16 21:27:39 +0800
commit628fbfe98737b16b3b8b251d1eb87b65a08a7d95 (patch)
tree83d06b614c426e26f34603c22f451ea5789d1630 /audio
parent8e50317fe645cf2d3846eaf1d139e85c1f9141e0 (diff)
downloadfreebsd-ports-gnome-628fbfe98737b16b3b8b251d1eb87b65a08a7d95.tar.gz
freebsd-ports-gnome-628fbfe98737b16b3b8b251d1eb87b65a08a7d95.tar.zst
freebsd-ports-gnome-628fbfe98737b16b3b8b251d1eb87b65a08a7d95.zip
Allow the user to customize the audio buffer size.
PR: ports/101960 Submitted by: jylefort Approved by: maintainer
Diffstat (limited to 'audio')
-rw-r--r--audio/openal/Makefile5
-rw-r--r--audio/openal/files/patch-src-backends-alc_backend_bsd.c70
-rw-r--r--audio/openal/pkg-message14
3 files changed, 56 insertions, 33 deletions
diff --git a/audio/openal/Makefile b/audio/openal/Makefile
index 949723ace3fc..ddc10cd3fa63 100644
--- a/audio/openal/Makefile
+++ b/audio/openal/Makefile
@@ -7,7 +7,7 @@
PORTNAME= openal
PORTVERSION= 20060211
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= audio
MASTER_SITES= http://openal.org/openal_webstf/downloads/
DISTVERSION= 0.0.8
@@ -88,4 +88,7 @@ post-patch:
s|Cflags: |&${PTHREAD_CFLAGS} |' \
${WRKSRC}/admin/pkgconfig/openal.pc.in
+post-install:
+ @${CAT} ${PKGMESSAGE}
+
.include <bsd.port.post.mk>
diff --git a/audio/openal/files/patch-src-backends-alc_backend_bsd.c b/audio/openal/files/patch-src-backends-alc_backend_bsd.c
index 8de0a05ce023..6a653388f3f3 100644
--- a/audio/openal/files/patch-src-backends-alc_backend_bsd.c
+++ b/audio/openal/files/patch-src-backends-alc_backend_bsd.c
@@ -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 --git a/audio/openal/pkg-message b/audio/openal/pkg-message
new file mode 100644
index 000000000000..1331e9e0c798
--- /dev/null
+++ b/audio/openal/pkg-message
@@ -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).
+===============================================================================