use SDL for audio output by default; drop OSS backend

ok claudio@ (MAINTAINER)
This commit is contained in:
jakemsr 2010-04-26 16:37:24 +00:00
parent 7dbc4ad2de
commit 614e8f7a06
6 changed files with 88 additions and 37 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.15 2009/09/10 22:17:52 jasper Exp $
# $OpenBSD: Makefile,v 1.16 2010/04/26 16:37:24 jakemsr Exp $
ONLY_FOR_ARCHS= amd64 i386
SHARED_ONLY= Yes
@ -6,7 +6,7 @@ SHARED_ONLY= Yes
COMMENT= first person shooter
DISTNAME= quake2-0.3
PKGNAME= ${DISTNAME}p9
PKGNAME= ${DISTNAME}p10
CATEGORIES= games
HOMEPAGE= http://www.quakeforge.net/
@ -19,8 +19,7 @@ PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB= ICE GL SM X11 Xau Xdmcp Xext Xrandr Xrender Xxf86dga \
Xxf86vm c m ossaudio pthread pthread-stubs sndio \
usbhid xcb
Xxf86vm c m pthread pthread-stubs sndio usbhid xcb
MASTER_SITES= http://www.phil.uu.nl/~lievisse/distfiles/

View File

@ -1,6 +1,24 @@
$OpenBSD: patch-configure,v 1.1 2008/06/28 02:54:30 jakemsr Exp $
$OpenBSD: patch-configure,v 1.2 2010/04/26 16:37:24 jakemsr Exp $
--- configure.orig Tue Mar 16 02:38:24 2004
+++ configure Fri May 30 05:15:37 2008
+++ configure Tue Jan 20 03:37:35 2009
@@ -22152,7 +22152,7 @@ rm -f conftest*
fi
-
+HAVE_OSS="no"
if test "x$HAVE_OSS" = xyes; then
BUILD_SNDOSS_TRUE=
BUILD_SNDOSS_FALSE='#'
@@ -22161,7 +22161,7 @@ else
BUILD_SNDOSS_FALSE=
fi
-SNDDRIVERS="$SNDDRIVERS snd_oss.la"
+# SNDDRIVERS="$SNDDRIVERS snd_oss.la"
HAVE_AO=no
@@ -22854,12 +22854,11 @@ fi
HAVE_SOLARIS="$ac_cv_header_sys_audioio_h"

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_snd_dma_c,v 1.1 2010/04/26 16:37:24 jakemsr Exp $
--- src/snd_dma.c.orig Tue Jan 20 03:20:20 2009
+++ src/snd_dma.c Tue Jan 20 03:21:26 2009
@@ -164,7 +164,7 @@ void S_Init (void)
struct stat st;
/* load sound driver */
- snddriver = Cvar_Get("snddriver", "oss", CVAR_ARCHIVE);
+ snddriver = Cvar_Get("snddriver", "sdl", CVAR_ARCHIVE);
Com_Printf("loading %s sound output driver", snddriver->string);
snprintf(fn, MAX_OSPATH, PKGLIBDIR"/snd_%s.so", snddriver->string);

View File

@ -1,28 +0,0 @@
$OpenBSD: patch-src_snd_oss_c,v 1.3 2008/06/28 02:50:59 jakemsr Exp $
--- src/snd_oss.c.orig Sun Mar 14 18:25:43 2004
+++ src/snd_oss.c Thu May 29 23:49:13 2008
@@ -239,6 +239,15 @@ qboolean SNDDMA_Init(struct sndinfo * s) {
return 0;
}
+ int sel;
+ /* make sure we're using a power of two blocksize */
+ sel = 0x7fff000b; /* as many 2048 byte blocks as possible */
+ if (ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &sel)==-1)
+ {
+ perror("SETFRAGMENT");
+ si->Com_Printf("SNDDMA_Init: SETFRAGMENT ioctl failed.\n");
+ }
+
if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1)
{
perror("GETOSPACE");
@@ -358,7 +367,7 @@ qboolean SNDDMA_Init(struct sndinfo * s) {
if (!si->dma->buffer) {
si->dma->buffer = (unsigned char *) mmap(NULL, info.fragstotal * info.fragsize,
-#if defined(__FreeBSD__) && (__FreeBSD_version < 500000)
+#if defined(__FreeBSD__) && (__FreeBSD_version < 500000) || defined (__OpenBSD__)
PROT_READ|PROT_WRITE,
#else
PROT_WRITE,

View File

@ -0,0 +1,52 @@
$OpenBSD: patch-src_snd_sdl_c,v 1.1 2010/04/26 16:37:24 jakemsr Exp $
--- src/snd_sdl.c.orig Mon Mar 15 04:50:39 2004
+++ src/snd_sdl.c Wed Feb 10 12:38:45 2010
@@ -63,12 +63,12 @@ SNDDMA_Init (struct sndinfo * s)
if (SDL_WasInit(SDL_INIT_EVERYTHING) == 0) {
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
- Com_Printf ("Couldn't init SDL audio: %s\n", SDL_GetError ());
+ s->Com_Printf ("Couldn't init SDL audio: %s\n", SDL_GetError ());
return 0;
}
} else if (SDL_WasInit(SDL_INIT_AUDIO) == 0) {
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
- Com_Printf ("Couldn't init SDL audio: %s\n", SDL_GetError ());
+ s->Com_Printf ("Couldn't init SDL audio: %s\n", SDL_GetError ());
return 0;
}
}
@@ -97,7 +97,7 @@ SNDDMA_Init (struct sndinfo * s)
desired.format = AUDIO_S16LSB;
break;
default:
- Com_Printf ("Unknown number of audio bits: %d\n", desired_bits);
+ si->Com_Printf ("Unknown number of audio bits: %d\n", desired_bits);
return 0;
}
desired.channels = si->channels->value;
@@ -108,12 +108,14 @@ SNDDMA_Init (struct sndinfo * s)
desired.samples = 1024;
else
desired.samples = 512;
+
+ desired.samples *= 2;
desired.callback = paint_audio;
/* Open the audio device */
if (SDL_OpenAudio (&desired, &obtained) < 0) {
- Com_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ());
+ si->Com_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ());
return 0;
}
@@ -136,7 +138,7 @@ SNDDMA_Init (struct sndinfo * s)
/* Not supported -- force SDL to do our bidding */
SDL_CloseAudio ();
if (SDL_OpenAudio (&desired, NULL) < 0) {
- Com_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ());
+ si->Com_Printf ("Couldn't open SDL audio: %s\n", SDL_GetError ());
return 0;
}
memcpy (&obtained, &desired, sizeof (desired));

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.4 2008/06/28 02:50:59 jakemsr Exp $
@comment $OpenBSD: PLIST,v 1.5 2010/04/26 16:37:24 jakemsr Exp $
@bin bin/quake2
lib/quake2/
lib/quake2/baseq2/
@ -15,8 +15,6 @@ lib/quake2/ref_softsdl.la
lib/quake2/ref_softsdl.so
lib/quake2/ref_softx.la
lib/quake2/ref_softx.so
lib/quake2/snd_oss.la
lib/quake2/snd_oss.so
lib/quake2/snd_sdl.la
lib/quake2/snd_sdl.so
share/quake2/