OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
audio/openal buffer vs block size issue and disable it's audio(4) backend

From: Jacob Meuser (jakemsrsdf.lonestar.org)
Date: Thu Aug 26 2010 - 19:38:08 CDT


bufsize should be the size of a block, not the size of the full
buffer. try to get 0.1 second total latency, but more importantly,
make sure the buffer has at least two blocks, if the client asked
for large blocks.

switch to REVISION while here.

tested with openarena, I'll send a patch to let it work there shortly.

ok?

--
jakemsrsdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/openal/Makefile,v
retrieving revision 1.14
diff -N -u -p Makefile
--- Makefile 2 Apr 2010 16:02:27 -0000 1.14
+++ Makefile 27 Aug 2010 00:20:26 -0000
-3,7 +3,7
 COMMENT= cross-platform 3D audio API
 
 DISTNAME= openal-0.0.8
-PKGNAME= ${DISTNAME}p6
+REVISION= 7
 CATEGORIES= audio
 SHARED_LIBS += openal 1.0 # .0.0
 
-28,7 +28,8 CONFIGURE_ARGS= --disable-vorbis \
                 --disable-arts \
                 --disable-mp3 \
                 --disable-esd \
- --disable-sdl
+ --disable-sdl \
+ --disable-solaris
 
 MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/admin/autotools
 
Index: files/alc_backend_sndio.c
===================================================================
RCS file: /cvs/ports/audio/openal/files/alc_backend_sndio.c,v
retrieving revision 1.2
diff -N -u -p files/alc_backend_sndio.c
--- files/alc_backend_sndio.c 16 Dec 2009 21:12:20 -0000 1.2
+++ files/alc_backend_sndio.c 27 Aug 2010 00:20:26 -0000
-48,7 +48,8 alcBackendSetAttributesNative_ (ALC_OpenMode mode, voi
                 par.pchan = chan;
         par.rate = *speed;
 
- par.appbufsz = *bufsiz / SIO_BPS(par.bits) / chan;
+ par.round = *bufsiz / SIO_BPS(par.bits) / chan;
+ par.appbufsz = *bufsiz > par.rate / 20 ? *bufsiz * 2 : par.rate / 10;
 
         if (!sio_setpar(handle, &par) || !sio_getpar(handle, &par) ||
             !sio_start(handle)) {
-77,7 +78,7 alcBackendSetAttributesNative_ (ALC_OpenMode mode, voi
                 return AL_FALSE;
         }
 
- *bufsiz = par.appbufsz * par.bps * chan;
+ *bufsiz = par.round * par.bps * chan;
         *speed = par.rate;
 
         return AL_TRUE;