- sndio supported as default audio output method

- build with -pthread in LDFLAGS instead of -lpthread in LIBS;
  allegro-config passes LDFLAGS on, so dependent ports build correctly
  (WANTLIB changes in dependent ports coming soon)
- don't build modules in liballegro: we don't ship an allegrorc to
  be able to choose which modules to use

"sndio bits look ok" ratchov@
This commit is contained in:
jakemsr 2010-04-26 02:56:30 +00:00
parent a7bf435011
commit 9b15a0535d
15 changed files with 750 additions and 48 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.2 2010/04/24 09:56:34 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.3 2010/04/26 02:56:30 jakemsr Exp $
COMMENT = game programming library for C/C++ developers
@ -6,6 +6,7 @@ SHARED_ONLY = Yes
V = 4.2.3
DISTNAME = allegro-$V
PKGNAME = ${DISTNAME}p0
CATEGORIES = games devel multimedia
SHARED_LIBS = alleg 0.0 # 4.2
@ -28,18 +29,23 @@ AUTOCONF_VERSION = 2.61
SUBST_VARS = V
WANTLIB = X11 Xcursor Xext Xpm Xxf86dga Xxf86vm c ossaudio m \
pthread
WANTLIB = X11 Xcursor Xext Xpm Xxf86dga Xxf86vm c m \
sndio pthread
CONFIGURE_ARGS = --enable-artsdigi=no \
--enable-esddigi=no \
--enable-jackdigi=no \
--enable-ossdigi=no \
--enable-ossmidi=no \
--enable-modules=no \
--with-x
MAKE_ENV += shared_major_minor=${LIBalleg_VERSION}
NO_REGRESS = Yes
post-extract:
cp ${FILESDIR}/sndio.c ${WRKSRC}/src/unix
post-install:
cd ${WRKSRC} && ${MAKE_PROGRAM} install-man
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/allegro

506
games/allegro/files/sndio.c Normal file
View File

@ -0,0 +1,506 @@
/*
* Copyright (c) 2010 Jacob Meuser <jakemsr@sdf.lonestar.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "allegro.h"
#if (defined ALLEGRO_WITH_SNDIODIGI) && ((!defined ALLEGRO_WITH_MODULES) || (defined ALLEGRO_MODULE))
#include "allegro/internal/aintern.h"
#include "allegro/platform/aintunix.h"
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
#include <poll.h>
#include <sndio.h>
static int sndio_detect(int input);
static int sndio_init(int input, int voices);
static void sndio_exit(int input);
static int sndio_set_mixer_volume(int volume);
static int sndio_get_mixer_volume(void);
static int sndio_buffer_size(void);
static int sndio_rec_cap_rate(int bits, int stereo);
static int sndio_rec_cap_parm(int rate, int bits, int stereo);
static int sndio_rec_source(int source);
static int sndio_rec_start(int rate, int bits, int stereo);
static void sndio_rec_stop(void);
static int sndio_rec_read(void *buf);
static int open_sndio_device(int input);
static void sndio_update(int threaded);
static void movecb(void *addr, int delta);
static void volcb(void *addr, unsigned vol);
static struct sio_hdl *hdl;
static struct sio_par par;
static int sndio_signed;
static int sndio_play_bufsize, sndio_play_round, sndio_play_appbufsz;
static unsigned char *sndio_play_bufdata;
static char sndio_desc[256] = EMPTY_STRING;
long long sndio_realpos, sndio_playpos;
int sndio_volume;
static int sndio_save_bits, sndio_save_stereo, sndio_save_freq;
static int sndio_rec_bufsize, sndio_rec_round, sndio_rec_appbufsz;
static unsigned char *sndio_rec_bufdata;
DIGI_DRIVER digi_sndio =
{
DIGI_SNDIO,
empty_string,
empty_string,
"sndio",
0,
0,
MIXER_MAX_SFX,
MIXER_DEF_SFX,
/* setup routines */
sndio_detect,
sndio_init,
sndio_exit,
sndio_set_mixer_volume,
sndio_get_mixer_volume,
/* for use by the audiostream functions */
NULL,
NULL,
sndio_buffer_size,
/* voice control functions */
_mixer_init_voice,
_mixer_release_voice,
_mixer_start_voice,
_mixer_stop_voice,
_mixer_loop_voice,
/* position control functions */
_mixer_get_position,
_mixer_set_position,
/* volume control functions */
_mixer_get_volume,
_mixer_set_volume,
_mixer_ramp_volume,
_mixer_stop_volume_ramp,
/* pitch control functions */
_mixer_get_frequency,
_mixer_set_frequency,
_mixer_sweep_frequency,
_mixer_stop_frequency_sweep,
/* pan control functions */
_mixer_get_pan,
_mixer_set_pan,
_mixer_sweep_pan,
_mixer_stop_pan_sweep,
/* effect control functions */
_mixer_set_echo,
_mixer_set_tremolo,
_mixer_set_vibrato,
/* input functions */
0,
0,
sndio_rec_cap_rate,
sndio_rec_cap_parm,
sndio_rec_source,
sndio_rec_start,
sndio_rec_stop,
sndio_rec_read
};
/* used to probe and to configure the device. don't use sio_start() here. */
static int
open_sndio_device(int input)
{
hdl = sio_open(NULL, (input ? SIO_REC : SIO_PLAY), 0);
if (hdl == NULL) {
uszprintf(allegro_error, ALLEGRO_ERROR_SIZE,
get_config_text("sio_opn failed"));
return -1;
}
sio_initpar(&par);
par.bits = (_sound_bits == 8) ? 8 : 16;
par.sig = 0;
if (input)
par.rchan = (_sound_stereo) ? 2 : 1;
else
par.pchan = (_sound_stereo) ? 2 : 1;
par.rate = (_sound_freq > 0) ? _sound_freq : 48000;
par.le = SIO_LE_NATIVE;
/* allegro wants small blocks */
par.round = 512;
par.appbufsz = par.rate / 10;
if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par) ||
(par.bits != 8 && par.bits != 16) ||
(input && (par.rchan != 1 && par.rchan != 2)) ||
(!input && (par.pchan != 1 && par.pchan != 2))) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
get_config_text("could not set sndio parameters"));
sio_close(hdl);
return -1;
}
_sound_bits = par.bits;
_sound_stereo = input ? par.rchan == 2 : par.pchan == 2;
_sound_freq = par.rate;
if (input) {
sndio_rec_round = par.round;
sndio_rec_appbufsz = par.appbufsz;
sndio_rec_bufsize = par.round * par.bps * par.rchan;
} else {
sndio_play_round = par.round;
sndio_play_appbufsz = par.appbufsz;
sndio_play_bufsize = sndio_play_round * par.bps * par.pchan;
}
sndio_signed = par.sig ? 1 : 0;
return 0;
}
static int
sndio_detect(int input)
{
if (input) {
if (digi_driver != digi_input_driver) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
get_config_text("sndio output driver must be installed before input can be read"));
return FALSE;
}
return TRUE;
}
if (open_sndio_device(0) != 0)
return FALSE;
sio_close(hdl);
return TRUE;
}
/* number of samples per channel in a block */
static int
sndio_buffer_size(void)
{
return sndio_play_round;
}
/* callback for data movement notification */
static void
movecb(void *addr, int delta)
{
sndio_realpos += delta;
}
/* callback for volume change notification */
static void
volcb(void *addr, unsigned vol)
{
sndio_volume = vol;
}
/* write as many blocks as is currently possible */
static void
sndio_update(int threaded)
{
struct pollfd pfd;
nfds_t nfds;
int i, nblocks, nbytes;
/* make sure counters have been updated */
nfds = sio_pollfd(hdl, &pfd, POLLOUT);
poll(&pfd, nfds, 0);
if (!(sio_revents(hdl, &pfd) & POLLOUT))
return;
nblocks = (sndio_play_appbufsz - (sndio_playpos - sndio_realpos)) /
sndio_play_round;
/* we got POLLOUT, so we can write something. if we don't
* write anything, we could underrun.
*/
if (nblocks < 1)
nblocks = 1;
for (i = 0; i < nblocks; i++) {
sio_write(hdl, sndio_play_bufdata, sndio_play_bufsize);
sndio_playpos += sndio_play_round;
if (sio_eof(hdl)) {
/* print error message? */
return;
}
_mix_some_samples((uintptr_t) sndio_play_bufdata, 0, sndio_signed);
}
}
static int
sndio_init(int input, int voices)
{
char tmp1[128], tmp2[128];
if (input) {
digi_driver->rec_cap_bits = 16;
digi_driver->rec_cap_stereo = TRUE;
return 0;
}
if (open_sndio_device(0) != 0)
return -1;
sndio_play_bufdata = _AL_MALLOC_ATOMIC(sndio_play_bufsize);
if (sndio_play_bufdata == 0) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
get_config_text("Can not allocate audio buffer"));
sio_close(hdl);
return -1;
}
sndio_realpos = sndio_playpos = 0;
sio_onmove(hdl, movecb, NULL);
sndio_volume = 127;
sio_onvol(hdl, volcb, NULL);
if (!sio_start(hdl)) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
get_config_text("Can not start sndio"));
sio_close(hdl);
return -1;
}
digi_sndio.voices = voices;
/* first arg is total number of samples */
if (_mixer_init(sndio_play_round * (_sound_stereo ? 2 : 1),
_sound_freq, _sound_stereo, ((_sound_bits == 16) ? 1 : 0),
&digi_sndio.voices) != 0) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
get_config_text("Can not init software mixer"));
sio_close(hdl);
return -1;
}
_mix_some_samples((uintptr_t) sndio_play_bufdata, 0, sndio_signed);
/* Add audio interrupt. */
_unix_bg_man->register_func(sndio_update);
uszprintf(sndio_desc, sizeof(sndio_desc),
get_config_text("%s: %d bits, %s, %d Hz, %s"),
"sndio device",
_sound_bits,
uconvert_ascii((sndio_signed ? "signed" : "unsigned"), tmp1),
_sound_freq,
uconvert_ascii((par.pchan == 2 ? "stereo" : "mono"), tmp2));
digi_driver->desc = sndio_desc;
return 0;
}
static void
sndio_exit(int input)
{
if (input)
return;
_unix_bg_man->unregister_func(sndio_update);
_AL_FREE(sndio_play_bufdata);
sndio_play_bufdata = 0;
_mixer_exit();
if (hdl != NULL)
sio_close(hdl);
hdl = NULL;
}
/* 'volume' is 0-255 */
static int
sndio_set_mixer_volume(int volume)
{
if (!sio_setvol(hdl, volume / 2))
return -1;
return 0;
}
/* should return 0-255 */
static int
sndio_get_mixer_volume(void)
{
return sndio_volume * 2;
}
/* Returns maximum recording sampling rate. */
static int
sndio_rec_cap_rate(int bits, int stereo)
{
/* should use sio_getcap() */
return 48000;
}
/* Returns whether the specified parameters can be set. */
static int
sndio_rec_cap_parm(int rate, int bits, int stereo)
{
/* should use sio_getcap() */
return 1;
}
/* Sets the sampling source for audio recording. */
static int
sndio_rec_source(int source)
{
/* not implemented in sndio */
switch (source) {
case SOUND_INPUT_MIC:
break;
case SOUND_INPUT_LINE:
break;
case SOUND_INPUT_CD:
break;
default:
return -1;
}
return 0;
}
/*
* Re-opens device with read-mode and starts recording (half-duplex).
* Returns the DMA buffer size if successful.
*/
static int
sndio_rec_start(int rate, int bits, int stereo)
{
sndio_save_bits = _sound_bits;
sndio_save_stereo = _sound_stereo;
sndio_save_freq = _sound_freq;
_unix_bg_man->unregister_func(sndio_update);
if (hdl != NULL)
sio_close(hdl);
hdl = NULL;
_sound_bits = bits;
_sound_stereo = stereo;
_sound_freq = rate;
if (open_sndio_device(1) != 0)
return 0;
sndio_volume = 127;
sio_onvol(hdl, volcb, NULL);
if (!sio_start(hdl)) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
get_config_text("Can not start sndio for recording"));
sio_close(hdl);
return 0;
}
return sndio_rec_bufsize;
}
/* Stops recording and switches the device back to the original mode. */
static void
sndio_rec_stop(void)
{
if (hdl != NULL)
sio_close(hdl);
hdl = NULL;
_sound_bits = sndio_save_bits;
_sound_stereo = sndio_save_stereo;
_sound_freq = sndio_save_freq;
if (open_sndio_device(0) != 0)
return;
sndio_realpos = sndio_playpos = 0;
sio_onmove(hdl, movecb, NULL);
sndio_volume = 127;
sio_onvol(hdl, volcb, NULL);
if (!sio_start(hdl)) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
get_config_text("Can not start sndio"));
sio_close(hdl);
return;
}
_unix_bg_man->register_func(sndio_update);
}
/* Retrieves the just recorded buffer, if there is one. */
static int
sndio_rec_read(void *buf)
{
struct pollfd pfd;
nfds_t nfds;
int ret, nbytes, offset = 0;
/* make sure counters have been updated */
nfds = sio_pollfd(hdl, &pfd, POLLIN);
poll(&pfd, nfds, 0);
sio_revents(hdl, &pfd);
if (!(sio_revents(hdl, &pfd) & POLLIN))
return 0;
nbytes = sndio_rec_bufsize;
while (nbytes) {
ret = sio_read(hdl, buf + offset, nbytes);
if (sio_eof(hdl))
return 0;
offset += ret;
nbytes -= ret;
}
return 1;
}
#endif /* ALLEGRO_WITH_SNDIODIGI */

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-aclocal_m4,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
--- aclocal.m4.orig Mon Sep 28 06:57:48 2009
+++ aclocal.m4 Thu Oct 15 13:13:11 2009
$OpenBSD: patch-aclocal_m4,v 1.2 2010/04/26 02:56:30 jakemsr Exp $
--- aclocal.m4.orig Sun Sep 27 21:57:48 2009
+++ aclocal.m4 Wed Jan 13 01:27:22 2010
@@ -438,19 +438,19 @@ allegro_enable_ossdigi=yes)
if test -n "$allegro_enable_ossdigi"; then
@ -46,11 +46,58 @@ $OpenBSD: patch-aclocal_m4,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
dnl Link with libossaudio if necessary, used by some BSD systems.
AC_CHECK_LIB(ossaudio, _oss_ioctl)
@@ -623,6 +623,7 @@ if test -n "$allegro_enable_esddigi"; then
fi
fi
@@ -683,6 +683,27 @@ if test -n "$allegro_enable_sgialdigi"; then
fi])
+
dnl
dnl Test for ARTS DIGI driver.
+dnl Test for sndio driver.
+dnl
+dnl Variables:
+dnl allegro_enable_sndiodigi=(yes|)
+dnl allegro_cv_support_sndiodigi=(yes|)
+dnl
+AC_DEFUN(ALLEGRO_ACTEST_SNDIODIGI,
+[AC_ARG_ENABLE(sndiodigi,
+[ --enable-sndiodigi[=x] enable building sndio driver [default=yes]],
+test "X$enableval" != "Xno" && allegro_enable_sndiodigi=yes,
+allegro_enable_sndiodigi=yes)
+
+if test "X$allegro_enable_sndiodigi" = "Xyes"; then
+ AC_CHECK_LIB(sndio, sio_open,
+ allegro_cv_support_sndiodigi=yes)
+ if test "X$allegro_cv_support_sndiodigi" = "Xyes" ; then
+ LIBS="-lsndio $LIBS"
+ fi
+fi])
+
+dnl
dnl Test for JACK driver.
dnl
dnl Variables:
@@ -744,10 +765,22 @@ dnl
dnl LIBS can be modified.
dnl
AC_DEFUN(ALLEGRO_ACTEST_PTHREADS,
-[AC_CHECK_HEADER(pthread.h,
-AC_CHECK_LIB(pthread, pthread_create,
-LIBS="-lpthread $LIBS"
-allegro_cv_support_pthreads=yes))])
+[AC_CHECK_HEADER(pthread.h, have_pthread_h=yes)
+if test "X$have_pthread_h" = "Xyes" ; then
+ save_LDFLAGS="$LDFLAGS";
+ LDFLAGS="$LDFLAGS -pthread"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <pthread.h>
+ pthread_t thr;]],
+ [pthread_create(&thr, NULL, NULL, NULL);])],
+ [allegro_cv_support_pthreads=yes],
+ [LDFLAGS="$save_LDFLAGS"])
+ if test "X$allegro_cv_support_pthreads" != "Xyes" ; then
+ AC_CHECK_LIB(pthread, pthread_create,
+ LIBS="-lpthread $LIBS" allegro_cv_support_pthreads=yes)
+ fi
+fi])
dnl
dnl Test for sched_yield (SunOS).

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-allegro_cfg,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
--- allegro.cfg.orig Sun May 21 03:01:46 2006
+++ allegro.cfg Wed Jan 13 02:32:09 2010
@@ -326,6 +326,7 @@ mouse_accel_factor =
# ARTS - aRts (Analog Real-Time Synthesizer)
# ALSA - ALSA Sound System
# JACK - JACK Audio Server
+# SIOD - sndio Audio API
#
# BeOS digital sound drivers:
#

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-configure_in,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
--- configure.in.orig Sun Jul 15 06:46:22 2007
+++ configure.in Thu Oct 15 13:13:55 2009
$OpenBSD: patch-configure_in,v 1.2 2010/04/26 02:56:30 jakemsr Exp $
--- configure.in.orig Sat Jul 14 21:46:22 2007
+++ configure.in Wed Jan 13 01:30:01 2010
@@ -28,26 +28,26 @@ allegro_enable_asm=yes)
dnl Enable 8-bpp color depth (default).
AC_ARG_ENABLE(color8,
@ -66,7 +66,23 @@ $OpenBSD: patch-configure_in,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
_libraries="$_libraries profile"
fi
fi
@@ -591,13 +591,13 @@ case "$allegro_system" in
@@ -479,6 +479,15 @@ else
_disabled_modules="sgialdigi $_disabled_modules"
fi
+dnl Test for sndio
+ALLEGRO_ACTEST_SNDIODIGI
+if test "$allegro_cv_support_sndiodigi" = yes; then
+ AC_DEFINE(ALLEGRO_WITH_SNDIODIGI,1,[Define if sndio is supported.])
+ _enabled_modules="sndiodigi $_enabled_modules"
+else
+ _disabled_modules="sndiodigi $_disabled_modules"
+fi
+
dnl Test for JACK driver
ALLEGRO_ACTEST_JACK
if test "X$allegro_cv_support_jackdigi" = "Xyes"; then
@@ -591,13 +600,13 @@ case "$allegro_system" in
allegro_support_linux=yes
AC_CHECK_HEADER(sys/io.h,
@ -83,7 +99,19 @@ $OpenBSD: patch-configure_in,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
if test "X$allegro_cv_processor_type" = "Xi386" -a "X$allegro_enable_vga" = "Xyes"; then
allegro_support_vga=yes
@@ -752,13 +752,13 @@ AC_SUBST(AR)
@@ -720,6 +729,11 @@ if test -n "$allegro_support_modules"; then
ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-sgialdigi.so"
fi
+ dnl SNDIO DIGI.
+ if test "X$allegro_cv_support_sndiodigi" = "Xyes"; then
+ ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-sndiodigi.so"
+ fi
+
dnl JACK DIGI.
if test "X$allegro_cv_support_jackdigi" = "Xyes"; then
ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-jackdigi.so"
@@ -752,13 +766,13 @@ AC_SUBST(AR)
#-----------------------------------------------------------------------------#
# Headers, features, functions and macros.
@ -104,7 +132,7 @@ $OpenBSD: patch-configure_in,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
# If the C compiler does not fully support the `const' keyword,
# define `const' to be empty.
@@ -778,14 +778,14 @@ AC_TYPE_SIZE_T
@@ -778,14 +792,14 @@ AC_TYPE_SIZE_T
# otherwise, define it to be `int'.
AC_TYPE_SIGNAL
@ -127,7 +155,7 @@ $OpenBSD: patch-configure_in,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
#-----------------------------------------------------------------------------#
@@ -822,6 +822,7 @@ if test -n "$GCC"; then
@@ -822,6 +836,7 @@ if test -n "$GCC"; then
else
TARGET_ARCH=
fi
@ -135,7 +163,7 @@ $OpenBSD: patch-configure_in,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
dnl Allow to specify additional flags.
CFLAGS="$CFLAGS $XCFLAGS"
WFLAGS="$WFLAGS $WCFLAGS"
@@ -833,11 +834,11 @@ if test -n "$GCC"; then
@@ -833,11 +848,11 @@ if test -n "$GCC"; then
if test "X$allegro_debug_with_dmalloc" = "Xyes"; then
ALLEGRO_DEBUG_CFLAGS="$ALLEGRO_DEBUG_CFLAGS -DDMALLOC"
fi

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-docs_txt_allegro_txt,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
--- docs/txt/allegro.txt.orig Tue Jan 12 01:50:48 2010
+++ docs/txt/allegro.txt Tue Jan 12 01:51:56 2010
@@ -12181,6 +12181,7 @@ Drivers DIGI_*/Unix
DIGI_ARTS - aRts (Analog Real-Time Synthesizer)
DIGI_ALSA - ALSA sound driver
DIGI_JACK - JACK sound driver
+ DIGI_SNDIO - sndio sound driver
Drivers MIDI_*/Unix
The Unix sound functions support the following MIDI sound cards:

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-include_allegro_platform_alunix_h,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
--- include/allegro/platform/alunix.h.orig Fri Jun 15 18:52:28 2007
+++ include/allegro/platform/alunix.h Wed Jan 13 02:49:06 2010
@@ -69,6 +69,8 @@ AL_VAR(TIMER_DRIVER, timerdrv_unix_sigalrm);
#define DIGI_ALSA AL_ID('A','L','S','A')
#define MIDI_ALSA AL_ID('A','M','I','D')
#define DIGI_JACK AL_ID('J','A','C','K')
+#define DIGI_SNDIO AL_ID('S','I','O','D')
+#define MIDI_SNDIO AL_ID('M','I','O','M')
#ifdef ALLEGRO_WITH_OSSDIGI
@@ -84,6 +86,12 @@ AL_VAR(MIDI_DRIVER, midi_oss);
#endif /* ALLEGRO_WITH_OSSMIDI */
#ifndef ALLEGRO_WITH_MODULES
+
+#ifdef ALLEGRO_WITH_SNDIODIGI
+AL_VAR(DIGI_DRIVER, digi_sndio);
+#define DIGI_DRIVER_SNDIO \
+ { DIGI_SNDIO, &digi_sndio, TRUE },
+#endif /* ALLEGRO_WITH_SNDIODIGI */
#ifdef ALLEGRO_WITH_ESDDIGI
AL_VAR(DIGI_DRIVER, digi_esd);

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-include_allegro_platform_alunixac_hin,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
--- include/allegro/platform/alunixac.hin.orig Tue Jan 12 02:01:05 2010
+++ include/allegro/platform/alunixac.hin Tue Jan 12 02:01:34 2010
@@ -153,6 +153,9 @@
/* Define if JACK DIGI driver is supported. */
#undef ALLEGRO_WITH_JACKDIGI
+/* Define if SNDIO DIGI driver is supported. */
+#undef ALLEGRO_WITH_SNDIODIGI
+
/* Define if you need to use a magic main. */
#undef ALLEGRO_WITH_MAGIC_MAIN

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-makefile_in,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
--- makefile.in.orig Wed Sep 19 15:19:25 2007
+++ makefile.in Thu Oct 15 13:12:42 2009
$OpenBSD: patch-makefile_in,v 1.2 2010/04/26 02:56:30 jakemsr Exp $
--- makefile.in.orig Wed Sep 19 06:19:25 2007
+++ makefile.in Tue Jan 12 02:03:00 2010
@@ -472,9 +472,9 @@ install-lib: lib modules
fi; \
done
@ -36,3 +36,11 @@ $OpenBSD: patch-makefile_in,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
$(mkinstalldirs) $(DESTDIR)$(prefix)/share/aclocal
@echo Installing allegro.m4 to $(DESTDIR)$(prefix)/share/aclocal
@$(INSTALL_DATA) misc/allegro.m4 $(DESTDIR)$(prefix)/share/aclocal
@@ -687,6 +672,7 @@ depend:
$(SHELL) -c 'cd $(srcdir) && misc/depmod.sh esddigi "\`esd-config --libs\`" $(ALLEGRO_MODULE_ESD_FILES)' >>makefile.dep
$(SHELL) -c 'cd $(srcdir) && misc/depmod.sh artsdigi "\`artsc-config --libs\`" $(ALLEGRO_MODULE_ARTS_FILES)' >>makefile.dep
$(SHELL) -c 'cd $(srcdir) && misc/depmod.sh sgialdigi -laudio $(ALLEGRO_MODULE_SGIAL_FILES)' >>makefile.dep
+ $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh sndiodigi -lsndio $(ALLEGRO_MODULE_SNDIO_FILES)' >>makefile.dep
$(SHELL) -c 'cd $(srcdir) && misc/depmod.sh jackdigi "\`pkg-config --libs jack\`" $(ALLEGRO_MODULE_JACK_FILES)' >>makefile.dep
@echo "Generating dependencies for simple programs"
$(SHELL) -c 'cd $(srcdir) && misc/deplexe.sh -- $(ALLEGRO_LIB_EXE_SOURCES) $(ALLEGRO_EXAMPLE_FILES)' >>makefile.dep

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-makefile_lst,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
--- makefile.lst.orig Tue Jan 12 02:03:42 2010
+++ makefile.lst Tue Jan 12 02:04:26 2010
@@ -312,6 +312,7 @@ ALLEGRO_SRC_UNIX_FILES = \
src/unix/alsamidi.c \
src/unix/arts.c \
src/unix/sgial.c \
+ src/unix/sndio.c \
src/unix/jack.c \
src/unix/udjgpp.c \
src/unix/udrvlist.c \
@@ -425,6 +426,9 @@ ALLEGRO_MODULE_ARTS_FILES = \
ALLEGRO_MODULE_SGIAL_FILES = \
src/unix/sgial.c
+
+ALLEGRO_MODULE_SNDIO_FILES = \
+ src/unix/sndio.c
ALLEGRO_MODULE_JACK_FILES = \
src/unix/jack.c

View File

@ -0,0 +1,8 @@
$OpenBSD: patch-modules_lst,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
--- modules.lst.orig Tue Jan 12 02:04:39 2010
+++ modules.lst Tue Jan 12 02:04:54 2010
@@ -10,3 +10,4 @@ alleg-sgialdigi.so
alleg-alsadigi.so
alleg-alsamidi.so
alleg-jackdigi.so
+alleg-sndiodigi.so

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-src_unix_uoss_c,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
--- src/unix/uoss.c.orig Sat Jun 16 03:52:28 2007
+++ src/unix/uoss.c Thu Oct 15 13:12:43 2009
@@ -193,7 +193,7 @@ static int open_oss_device(int input)
ustrzcpy(_oss_driver, sizeof(_oss_driver), get_config_string(uconvert_ascii("sound", tmp1),
uconvert_ascii("oss_driver", tmp2),
- uconvert_ascii("/dev/dsp", tmp3)));
+ uconvert_ascii("/dev/audio", tmp3)));
ustrzcpy(_oss_mixer_driver, sizeof(_oss_mixer_driver), get_config_string(uconvert_ascii("sound", tmp1),
uconvert_ascii("oss_mixer_driver", tmp2),
@@ -249,7 +249,7 @@ static int open_oss_device(int input)
bits = (_sound_bits == 8) ? 8 : 16;
stereo = (_sound_stereo) ? 1 : 0;
- freq = (_sound_freq > 0) ? _sound_freq : 45454;
+ freq = (_sound_freq > 0) ? _sound_freq : 48000;
/* fragment size is specified in samples, not in bytes */
fragsize = _oss_fragsize * (bits / 8) * (stereo ? 2 : 1);

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-src_unix_usnddrv_c,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
--- src/unix/usnddrv.c.orig Tue Jan 12 02:05:31 2010
+++ src/unix/usnddrv.c Tue Jan 12 02:06:08 2010
@@ -24,6 +24,9 @@ BEGIN_DIGI_DRIVER_LIST
#if (defined ALLEGRO_WITH_JACKDIGI) && (!defined ALLEGRO_WITH_MODULES)
DIGI_DRIVER_JACK
#endif
+#if (defined ALLEGRO_WITH_SNDIODIGI) && (!defined ALLEGRO_WITH_MODULES)
+ DIGI_DRIVER_SNDIO
+#endif
#if (defined ALLEGRO_WITH_SGIALDIGI) && (!defined ALLEGRO_WITH_MODULES)
DIGI_DRIVER_SGIAL
#endif

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-src_x_xdga2_c,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
--- src/x/xdga2.c.orig Wed Jan 13 04:02:59 2010
+++ src/x/xdga2.c Wed Jan 13 04:13:31 2010
@@ -49,7 +49,7 @@ static void _xdga2_set_palette_range(AL_CONST PALETTE
static void _xdga2_acquire(BITMAP *bmp);
static GFX_MODE_LIST *_xdga2_fetch_mode_list(void);
-#ifdef ALLEGRO_NO_ASM
+#if 1 //def ALLEGRO_NO_ASM
uintptr_t _xdga2_write_line(BITMAP *bmp, int line);
#else
uintptr_t _xdga2_write_line_asm(BITMAP *bmp, int line);
@@ -559,7 +559,7 @@ static BITMAP *_xdga2_private_gfxdrv_init_drv(GFX_DRIV
/* Hardware acceleration has been requested */
/* Updates line switcher to accommodate framebuffer synchronization */
-#ifdef ALLEGRO_NO_ASM
+#if 1 //def ALLEGRO_NO_ASM
bmp->write_bank = _xdga2_write_line;
bmp->read_bank = _xdga2_write_line;
#else
@@ -816,7 +816,7 @@ static void _xdga2_acquire(BITMAP *bmp)
}
-#ifdef ALLEGRO_NO_ASM
+#if 1 //def ALLEGRO_NO_ASM
/* _xdga2_write_line:
* Returns new line and synchronizes framebuffer if needed.

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2009/10/15 14:38:06 phessler Exp $
@comment $OpenBSD: PLIST,v 1.2 2010/04/26 02:56:30 jakemsr Exp $
bin/allegro-config
@bin bin/colormap
@bin bin/dat
@ -101,10 +101,6 @@ include/allegro/timer.h
include/allegro/unicode.h
include/linalleg.h
include/xalleg.h
lib/allegro/
lib/allegro/${V}/
lib/allegro/${V}/alleg-dga2.so
lib/allegro/${V}/modules.lst
@lib lib/liballeg.so.${LIBalleg_VERSION}
lib/liballeg_unsharable.a
@man man/man3/ALLEGRO_DATE.3