From 5bd1ed9d9a1fc05aee40c07b5ca9adbfa525535c Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Fri, 30 Mar 2012 06:58:39 -0300 Subject: [PATCH] [xmp] Remove OpenBSD-specific bsd driver It was the same as the standard BSD driver. Signed-off-by: Claudio Matsuoka --- configure.ac | 4 +- src/sound.c | 4 -- src/sound_bsd.c | 2 +- src/sound_openbsd.c | 125 -------------------------------------------- 4 files changed, 3 insertions(+), 132 deletions(-) delete mode 100644 src/sound_openbsd.c diff --git a/configure.ac b/configure.ac index a11d121..770ca15 100644 --- a/configure.ac +++ b/configure.ac @@ -72,8 +72,8 @@ openbsd*) LIBS="${LIBS} -lsndio" fi if test "${ac_cv_header_sys_audioio_h}" = "yes"; then - AC_DEFINE(SOUND_OPENBSD) - DRIVERS="${DRIVERS} sound_openbsd.o" + AC_DEFINE(SOUND_BSD) + DRIVERS="${DRIVERS} sound_bsd.o" fi ;; solaris*) diff --git a/src/sound.c b/src/sound.c index d11d7c7..079f149 100644 --- a/src/sound.c +++ b/src/sound.c @@ -8,7 +8,6 @@ extern struct sound_driver sound_alsa; extern struct sound_driver sound_win32; extern struct sound_driver sound_coreaudio; extern struct sound_driver sound_sndio; -extern struct sound_driver sound_openbsd; extern struct sound_driver sound_solaris; extern struct sound_driver sound_bsd; extern struct sound_driver sound_beos; @@ -28,9 +27,6 @@ void init_sound_drivers() #ifdef SOUND_SNDIO register_sound_driver(&sound_sndio); #endif -#ifdef SOUND_OPENBSD - register_sound_driver(&sound_openbsd); -#endif #ifdef SOUND_BSD register_sound_driver(&sound_bsd); #endif diff --git a/src/sound_bsd.c b/src/sound_bsd.c index c599a31..6011ef7 100644 --- a/src/sound_bsd.c +++ b/src/sound_bsd.c @@ -74,7 +74,7 @@ static void play(void *b, int i) b = (char *)b + j; } else break; - }; + } } static void deinit() diff --git a/src/sound_openbsd.c b/src/sound_openbsd.c deleted file mode 100644 index 05f16bb..0000000 --- a/src/sound_openbsd.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Extended Module Player - * Copyright (C) 1996-2012 Claudio Matsuoka and Hipolito Carraro Jr - * - * This file is part of the Extended Module Player and is distributed - * under the terms of the GNU General Public License. See doc/COPYING - * for more information. - */ - -/* This should work for OpenBSD */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sound.h" - -static int audio_fd; - -struct sound_driver sound_openbsd; - -static int init(struct options *options) -{ - char **parm = options->driver_parm; - audio_info_t ainfo; - int gain = 128; - int bsize = 32 * 1024; - - if ((audio_fd = open("/dev/sound", O_WRONLY)) == -1) - return -1; - - parm_init(parm); - chkparm1("gain", gain = strtoul(token, NULL, 0)); - chkparm1("buffer", bsize = strtoul(token, NULL, 0)); - parm_end(); - - if (gain < AUDIO_MIN_GAIN) - gain = AUDIO_MIN_GAIN; - if (gain > AUDIO_MAX_GAIN) - gain = AUDIO_MAX_GAIN; - - AUDIO_INITINFO(&ainfo); - - ainfo.play.sample_rate = options->rate; - ainfo.play.channels = options->format & XMP_FORMAT_MONO ? 1 : 2; - - if (options->format & XMP_FORMAT_8BIT) { - ainfo.play.precision = 8; - ainfo.play.encoding = AUDIO_ENCODING_ULINEAR; - options->format |= XMP_FORMAT_UNSIGNED; - } else { - ainfo.play.precision = 16; - ainfo.play.encoding = AUDIO_ENCODING_SLINEAR; - options->format &= ~XMP_FORMAT_UNSIGNED; - } - - ainfo.play.gain = gain; - ainfo.play.buffer_size = bsize; - - if (ioctl(audio_fd, AUDIO_SETINFO, &ainfo) == -1) { - close(audio_fd); - return -1; - } - - sound_openbsd.description = "OpenBSD PCM audio"; - - return 0; -} - -static void play(void *b, int i) -{ - int j; - - while (i) { - if ((j = write(audio_fd, b, i)) > 0) { - i -= j; - b = (char *)b + j; - } else - break; - } -} - -static void deinit() -{ - close(audio_fd); -} - -static void flush() -{ -} - -static void onpause() -{ -} - -static void onresume() -{ -} - - -static char *help[] = { - "gain=val", "Audio output gain (0 to 255)", - "buffer=val", "Audio buffer size (default is 32768)", - NULL -}; - -struct sound_driver sound_openbsd = { - "openbsd", - "OpenBSD PCM audio", - help, - init, - deinit, - play, - flush, - onpause, - onresume -};