- sndio instead of audio(4)

- cleanup & modernize:
remove bouncing maintainer contact, remove nop patch, regen patches,
@bin markers
This commit is contained in:
jakemsr 2009-12-14 00:33:08 +00:00
parent aa4e53b6ed
commit e845b6c545
9 changed files with 202 additions and 53 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.10 2008/01/04 17:48:33 espie Exp $
# $OpenBSD: Makefile,v 1.11 2009/12/14 00:33:08 jakemsr Exp $
COMMENT= text to speech utility
@ -8,7 +8,7 @@ BROKEN= gcc hang compiling cmu_us_kal_diphone.c
VERSION= 1.2
DISTNAME= flite-${VERSION}-release
PKGNAME= flite-${VERSION}p1
PKGNAME= flite-${VERSION}p2
SHARED_LIBS= flite 1.2 \
flite_cmu_time_awb 1.2 \
flite_cmu_us_kal 1.2 \
@ -27,21 +27,22 @@ CATEGORIES= audio
HOMEPAGE= http://www.cmuflite.org/
MAINTAINER= Jason L. Wright <jason@openbsd.org>
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB= c m
WANTLIB= c m sndio
MASTER_SITES= http://www.speech.cs.cmu.edu/flite/packed/flite-${VERSION}/
CONFIGURE_STYLE= gnu dest
CONFIGURE_ARGS= ${CONFIGURE_SHARED}
CONFIGURE_ARGS= ${CONFIGURE_SHARED} --with-audio=sndio
USE_GMAKE= Yes
NO_REGRESS= Yes
VMEM_WARNING= Yes
post-extract:
cp ${FILESDIR}/au_sndio.c ${WRKSRC}/src/audio
.include <bsd.port.mk>

View File

@ -0,0 +1,121 @@
/*
* Copyright (c) 2009 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 <sndio.h>
#include "cst_string.h"
#include "cst_audio.h"
cst_audiodev *
audio_open_sndio(int sps, int channels, cst_audiofmt fmt)
{
struct sio_par par;
struct sio_hdl *hdl;
cst_audiodev *ad;
hdl = sio_open(NULL, SIO_PLAY, 0);
if (hdl == NULL) {
cst_errmsg("sndio_audio: failed to open audio device\n");
cst_error();
}
sio_initpar(&par);
switch (fmt) {
case CST_AUDIO_LINEAR16:
par.bits = 16;
par.sig = 1;
break;
case CST_AUDIO_LINEAR8:
par.bits = 8;
par.sig = 0;
break;
default:
cst_errmsg("sndio_audio: invalid format\n");
cst_error();
}
par.pchan = 1;
par.rate = sps;
if (!sio_setpar(hdl, &par)) {
cst_errmsg("sndio_audio: failed to set audio params\n");
cst_error();
}
if (!sio_getpar(hdl, &par)) {
cst_errmsg("sndio_audio: failed to get audio params\n");
cst_error();
}
ad = cst_alloc(cst_audiodev, 1);
ad->sps = sps;
ad->real_sps = par.rate;
ad->channels = channels;
ad->real_channels = par.pchan;
ad->fmt = fmt;
if (par.sig == 1 && par.bits == 16)
ad->real_fmt = CST_AUDIO_LINEAR16;
else if (par.sig == 0 && par.bits == 8)
ad->real_fmt = CST_AUDIO_LINEAR8;
else {
cst_errmsg("sndio_audio: returned audio format unsupported\n");
cst_free(ad);
cst_error();
}
if (!sio_start(hdl)) {
cst_errmsg("sndio_audio: start failed\n");
cst_free(ad);
cst_error();
}
ad->platform_data = hdl;
return ad;
}
int
audio_close_sndio(cst_audiodev *ad)
{
if (ad == NULL)
return 0;
sio_close(ad->platform_data);
cst_free(ad);
return 0;
}
int
audio_write_sndio(cst_audiodev *ad, void *samples, int num_bytes)
{
return sio_write(ad->platform_data, samples, num_bytes);
}
int
audio_flush_sndio(cst_audiodev *ad)
{
return 0;
}
int
audio_drain_sndio(cst_audiodev *ad)
{
return 0;
}

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-configure,v 1.1.1.1 2003/04/23 05:33:19 jason Exp $
--- configure.orig Sun Apr 20 23:05:35 2003
+++ configure Sun Apr 20 23:04:27 2003
$OpenBSD: patch-configure,v 1.2 2009/12/14 00:33:08 jakemsr Exp $
--- configure.orig Tue Feb 18 08:18:20 2003
+++ configure Wed Dec 9 20:13:56 2009
@@ -1120,6 +1120,9 @@ if test "$shared" = true; then
SHFLAGS="-fPIC"
OTHERLIBS="-lsocket -ldl"
@ -11,3 +11,33 @@ $OpenBSD: patch-configure,v 1.1.1.1 2003/04/23 05:33:19 jason Exp $
*)
;;
esac
@@ -1492,7 +1495,7 @@ if test "${with_audio+set}" = set; then
fi
-if test "x$AUDIODEFS" = x; then
+#if test "x$AUDIODEFS" = x; then
case "$AUDIODRIVER" in
linux|oss)
AUDIODRIVER=oss
@@ -1502,6 +1505,11 @@ if test "x$AUDIODEFS" = x; then
AUDIODRIVER=oss
AUDIODEFS=-DCST_AUDIO_FREEBSD
;;
+ sndio)
+ AUDIODRIVER=sndio
+ AUDIODEFS=-DCST_AUDIO_SNDIO
+ AUDIOLIBS=-lsndio
+ ;;
qnx)
AUDIODRIVER=alsa
AUDIODEFS=-DCST_AUDIO_QNX
@@ -1510,7 +1518,7 @@ if test "x$AUDIODEFS" = x; then
AUDIODEFS=-DCST_AUDIO_NONE
;;
esac
-fi
+#fi

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-configure_in,v 1.1.1.1 2003/04/23 05:33:19 jason Exp $
--- configure.in.orig Sun Apr 20 23:05:32 2003
+++ configure.in Sun Apr 20 23:04:58 2003
@@ -68,6 +68,9 @@ if test "$shared" = true; then
SHFLAGS="-fPIC"
OTHERLIBS="-lsocket -ldl"
;;
+ openbsd*)
+ SHFLAGS="-shared -fPIC"
+ ;;
*)
;;
esac

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_audio_Makefile,v 1.1 2009/12/14 00:33:08 jakemsr Exp $
--- src/audio/Makefile.orig Wed Dec 9 19:24:16 2009
+++ src/audio/Makefile Wed Dec 9 19:24:35 2009
@@ -45,7 +45,7 @@ BASESRCS = auclient.c auserver.c audio.c
SRCS = $(BASESRCS) $(AUDIODRIVER:%=au_%.c)
OBJS = $(SRCS:.c=.o)
FILES = Makefile $(H) $(BASESRCS) au_alsa.c au_command.c au_none.c \
- au_oss.c au_sun.c au_wince.c
+ au_oss.c au_sun.c au_wince.c au_sndio.c
LIBNAME = flite
LOCAL_INCLUDES = -I. $(AUDIODEFS)

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-src_audio_au_sun_c,v 1.1.1.1 2003/04/23 05:33:19 jason Exp $
--- src/audio/au_sun.c.orig Mon Jan 7 18:25:52 2002
+++ src/audio/au_sun.c Sun Apr 20 18:12:34 2003
@@ -45,6 +45,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
+#include <sys/ioctl.h>
#include <sys/filio.h>
#include <sys/audioio.h>
#include "cst_string.h"
@@ -76,7 +77,11 @@ cst_audiodev *audio_open_sun(int sps, in
cst_error();
}
}
+#ifdef __OpenBSD__
+ AUDIO_INITINFO(&ainfo);
+#else
ioctl(fd,AUDIO_GETINFO,&ainfo);
+#endif
switch (fmt)
{

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-src_audio_native_audio_h,v 1.1 2009/12/14 00:33:08 jakemsr Exp $
--- src/audio/native_audio.h.orig Wed Dec 9 19:46:49 2009
+++ src/audio/native_audio.h Wed Dec 9 19:48:27 2009
@@ -63,6 +63,17 @@
#endif
+#ifdef CST_AUDIO_SNDIO
+
+#define AUDIO_OPEN_NATIVE audio_open_sndio
+#define AUDIO_CLOSE_NATIVE audio_close_sndio
+#define AUDIO_SET_SAMPLE_RATE_NATIVE audio_set_sample_rate_sndio
+#define AUDIO_WRITE_NATIVE audio_write_sndio
+#define AUDIO_DRAIN_NATIVE audio_drain_sndio
+#define AUDIO_FLUSH_NATIVE audio_flush_sndio
+
+#endif
+
#ifdef CST_AUDIO_LINUX
#define AUDIO_OPEN_NATIVE audio_open_oss

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-tools_find_sts_main_c,v 1.1 2004/12/13 11:59:48 espie Exp $
--- tools/find_sts_main.c.orig Mon Dec 13 12:55:55 2004
+++ tools/find_sts_main.c Mon Dec 13 12:58:01 2004
@@ -75,6 +75,11 @@ cst_sts *find_sts(cst_wave *sig, cst_tra
$OpenBSD: patch-tools_find_sts_main_c,v 1.2 2009/12/14 00:33:08 jakemsr Exp $
--- tools/find_sts_main.c.orig Thu Dec 26 09:18:30 2002
+++ tools/find_sts_main.c Wed Dec 9 19:23:23 2009
@@ -75,6 +75,11 @@ cst_sts *find_sts(cst_wave *sig, cst_track *lpc)
double *resd;
int size,start,end;
short *sigplus;
@ -13,7 +13,7 @@ $OpenBSD: patch-tools_find_sts_main_c,v 1.1 2004/12/13 11:59:48 espie Exp $
sts = cst_alloc(cst_sts,lpc->num_frames);
start = 0;
@@ -93,14 +98,16 @@ cst_sts *find_sts(cst_wave *sig, cst_tra
@@ -93,14 +98,16 @@ cst_sts *find_sts(cst_wave *sig, cst_track *lpc)
lpc->frames[i],lpc->num_channels,
resd,
size);

View File

@ -1,6 +1,6 @@
@comment $OpenBSD: PLIST,v 1.2 2004/08/05 03:28:12 espie Exp $
bin/flite
bin/flite_time
@comment $OpenBSD: PLIST,v 1.3 2009/12/14 00:33:08 jakemsr Exp $
@bin bin/flite
@bin bin/flite_time
include/flite/
include/flite/cst_alloc.h
include/flite/cst_args.h