summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorbjs <bjs>2008-04-08 01:44:47 +0000
committerbjs <bjs>2008-04-08 01:44:47 +0000
commitccd7aa8f02ae0f766378603c16982ff97c27e920 (patch)
tree57e745ccf82b414ab08312fdfdc26b03f6bfd0ea /audio
parentf19046e3e870bdb85eed429bff43eef1a1658282 (diff)
downloadpkgsrc-ccd7aa8f02ae0f766378603c16982ff97c27e920.tar.gz
Update this package to 0.110.0, refactoring most of the patches.
There are still some bugs lurking, but on NetBSD/amd64 4.99.48 with azalia(4), both the sun and OSS drivers work fairly well! Try it out with audio/moc-devel. Please let me know if you encounter any problems. Currently, I manually create the distfile with the dist-bzip2 target in my local sources. I plan on hosting a repository of these sources somewhere with a NetBSD/pkgsrc branch soon.
Diffstat (limited to 'audio')
-rw-r--r--audio/jack-devel/Makefile47
-rw-r--r--audio/jack-devel/PLIST3
-rw-r--r--audio/jack-devel/buildlink3.mk22
-rw-r--r--audio/jack-devel/distinfo33
-rw-r--r--audio/jack-devel/patches/patch-aa13
-rw-r--r--audio/jack-devel/patches/patch-ab99
-rw-r--r--audio/jack-devel/patches/patch-ac11
-rw-r--r--audio/jack-devel/patches/patch-ae30
-rw-r--r--audio/jack-devel/patches/patch-af6
-rw-r--r--audio/jack-devel/patches/patch-ah4
-rw-r--r--audio/jack-devel/patches/patch-ai75
-rw-r--r--audio/jack-devel/patches/patch-aj82
-rw-r--r--audio/jack-devel/patches/patch-ak6
-rw-r--r--audio/jack-devel/patches/patch-al59
-rw-r--r--audio/jack-devel/patches/patch-an887
-rw-r--r--audio/jack-devel/patches/patch-ao15
-rw-r--r--audio/jack-devel/patches/patch-ap11
17 files changed, 281 insertions, 1122 deletions
diff --git a/audio/jack-devel/Makefile b/audio/jack-devel/Makefile
index 4ab70ef3d69..6f2e4765b9c 100644
--- a/audio/jack-devel/Makefile
+++ b/audio/jack-devel/Makefile
@@ -1,13 +1,14 @@
-# $NetBSD: Makefile,v 1.2 2008/03/17 02:31:10 bjs Exp $
+# $NetBSD: Makefile,v 1.3 2008/04/08 01:44:47 bjs Exp $
#
-DISTNAME= jack-0.109.10
-PKGNAME= ${DISTNAME:C/jack/&-devel/}
-PKGREVISION= 1
+DISTNAME= jack-audio-connection-kit-${JACK_VERSION}
+PKGNAME= jack-${JACK_VERSION}
CATEGORIES= audio
MASTER_SITES= ${MASTER_SITE_LOCAL}
EXTRACT_SUFX= .tar.bz2
+JACK_VERSION= 0.110.0
+
MAINTAINER= bjs@NetBSD.org
HOMEPAGE= http://www.jackaudio.org/
COMMENT= JACK audio connection kit
@@ -18,21 +19,42 @@ GNU_CONFIGURE= yes
USE_TOOLS+= pkg-config
USE_LIBTOOL= yes
+PKGCONFIG_OVERRIDE+= jack.pc.in
+
+PTHREAD_OPTS+= require native
+
CONFIGURE_ARGS+= --disable-alsa
CONFIGURE_ARGS+= --disable-freebob
CONFIGURE_ARGS+= --disable-coreaudio
CONFIGURE_ARGS+= --disable-firewire
CONFIGURE_ARGS+= --disable-optimize
-CONFIGURE_ARGS+= --disable-sse
-
CONFIGURE_ARGS+= --enable-resize
CONFIGURE_ARGS+= --enable-timestamps
-CONFIGURE_ARGS+= --with-default-tmpdir=/tmp/
+CFLAGS.NetBSD+= -D_NETBSD_SOURCE
+
+CONFIGURE_ENV+= ac_cv_header_readline_chardefs_h=yes
+
+JACKD_DEFAULT_TMPDIR?= /tmp
+JACKD_PROCFS_PATH?= /proc
.include "../../mk/bsd.prefs.mk"
-.if exists(/usr/include/sys/audioio.h)
+.if "${OPSYS:M*BSD}" != "" || ${OPSYS} == "Darwin"
+CFLAGS+= -DJACK_HOST_HAS_BSD_POLL
+.endif
+
+.if exists(/dev/shm) && ${OPSYS} == "Linux"
+CONFIGURE_ARGS+= --with-default-tmpdir=/dev/shm
+.else
+CONFIGURE_ARGS+= --with-default-tmpdir=${JACKD_DEFAULT_TMPDIR:Q}
+.endif
+
+###
+### XXX The sun driver is buggy on NetBSD right now. I hope to remedy
+### this shortly.
+###
+.if ${OPSYS} == "NetBSD" || ${OPSYS} == "OpenBSD" || ${OPSYS} == "Solaris"
CONFIGURE_ARGS+= --enable-sun
PLIST_SUBST+= SUN=""
.else
@@ -46,20 +68,13 @@ PLIST_SUBST+= SUN="@comment "
CONFIGURE_ARGS+= --enable-oss
PLIST_SUBST+= OSS=""
MAKE_ENV+= LIBOSSAUDIO=${LIBOSSAUDIO:Q}
+CFLAGS+= -DDEVOSSAUDIO=\"${DEVOSSAUDIO:U/dev/dsp}\"
.else
CONFIGURE_ARGS+= --disable-oss
PLIST_SUBST+= OSS="@comment "
.endif
-PKGCONFIG_OVERRIDE+= jack.pc.in
-PTHREAD_OPTS+= require native
-
-CFLAGS.NetBSD+= -DJACKD_WATCHDOG_TIMEOUT=900
-CFLAGS.NetBSD+= -D_NETBSD_SOURCE
-
-JACKD_PROCFS_PATH?= /proc
-
SUBST_CLASSES+= jacksrc
SUBST_FILES.jacksrc= libjack/unlock.c
SUBST_MESSAGE.jacksrc= Peforming substitutions in JACK sources.
diff --git a/audio/jack-devel/PLIST b/audio/jack-devel/PLIST
index 7df1f3f5a51..3ecf40e90f5 100644
--- a/audio/jack-devel/PLIST
+++ b/audio/jack-devel/PLIST
@@ -1,6 +1,5 @@
-@comment $NetBSD: PLIST,v 1.2 2008/03/17 02:31:10 bjs Exp $
+@comment $NetBSD: PLIST,v 1.3 2008/04/08 01:44:47 bjs Exp $
bin/jack_alias
-bin/jack_bufsize
bin/jack_connect
bin/jack_disconnect
bin/jack_evmon
diff --git a/audio/jack-devel/buildlink3.mk b/audio/jack-devel/buildlink3.mk
index f0918ce2d0f..3a368a46f0a 100644
--- a/audio/jack-devel/buildlink3.mk
+++ b/audio/jack-devel/buildlink3.mk
@@ -1,19 +1,19 @@
-# $NetBSD: buildlink3.mk,v 1.1.1.1 2008/03/16 09:26:46 bjs Exp $
+# $NetBSD: buildlink3.mk,v 1.2 2008/04/08 01:44:47 bjs Exp $
-BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
-JACK_DEVEL_BUILDLINK3_MK:= ${JACK_DEVEL_BUILDLINK3_MK}+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+JACK_BUILDLINK3_MK:= ${JACK_BUILDLINK3_MK}+
.if ${BUILDLINK_DEPTH} == "+"
-BUILDLINK_DEPENDS+= jack-devel
+BUILDLINK_DEPENDS+= jack
.endif
-BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Njack-devel}
-BUILDLINK_PACKAGES+= jack-devel
-BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}jack-devel
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Njack}
+BUILDLINK_PACKAGES+= jack
+BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}jack
-.if ${JACK_DEVEL_BUILDLINK3_MK} == "+"
-BUILDLINK_API_DEPENDS.jack-devel+= jack-devel>=0.109.10
-BUILDLINK_PKGSRCDIR.jack-devel?= ../../audio/jack-devel
-.endif # JACK_DEVEL_BUILDLINK3_MK
+.if ${JACK_BUILDLINK3_MK} == "+"
+BUILDLINK_API_DEPENDS.jack+= jack>=0.110.0
+BUILDLINK_PKGSRCDIR.jack?= ../../audio/jack-devel
+.endif # JACK_BUILDLINK3_MK
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/audio/jack-devel/distinfo b/audio/jack-devel/distinfo
index c773a17553c..bfb61578de2 100644
--- a/audio/jack-devel/distinfo
+++ b/audio/jack-devel/distinfo
@@ -1,20 +1,21 @@
-$NetBSD: distinfo,v 1.2 2008/03/17 02:31:10 bjs Exp $
+$NetBSD: distinfo,v 1.3 2008/04/08 01:44:47 bjs Exp $
-SHA1 (jack-0.109.10.tar.bz2) = a82376dcb3610967eac82789dc543b64b9702e39
-RMD160 (jack-0.109.10.tar.bz2) = 20efa1e19cbe74718c07b262de9e8af5f2f72e58
-Size (jack-0.109.10.tar.bz2) = 577713 bytes
-SHA1 (patch-aa) = 14e400acbfd3fdba20e137e032bccb0963c0517e
-SHA1 (patch-ab) = d2293459aaeddf96b3a429b2fb5280dc90abb3f7
-SHA1 (patch-ac) = 7052322d44700b0bf81642a5e68ae53a3da62df1
+SHA1 (jack-audio-connection-kit-0.110.0.tar.bz2) = 2eaefe6af7fa35aec4d84c0ca8690b6c2c4c9c8d
+RMD160 (jack-audio-connection-kit-0.110.0.tar.bz2) = 5905e7199f45fec4559d98bef21940c57096e3c2
+Size (jack-audio-connection-kit-0.110.0.tar.bz2) = 504535 bytes
+SHA1 (patch-aa) = 169403b0eacff27b6f77f714b07eab571c0e6455
+SHA1 (patch-ab) = 8ccffe0f6ebe73710cb3ba535c6e1bb19a191a6a
+SHA1 (patch-ac) = 05e9e8fcdf9f562616f1b32036d7e4f654ddac3f
SHA1 (patch-ad) = 9632ad3a03015688f02bc4b715d74e21ae293c8f
-SHA1 (patch-ae) = a18c44b803e340d2b1317a539ffb2123490badc3
-SHA1 (patch-af) = 6e7c16137434c601f09da982528f3f8c81bdd354
+SHA1 (patch-ae) = 7fb1deae5473cc9df556176c878610805baf66dc
+SHA1 (patch-af) = 446bbcb0a835279c7821bcebfd6eec04a0fd7870
SHA1 (patch-ag) = e7a5e878cdd47355f8d6213163b8560939708f32
-SHA1 (patch-ah) = b3445eea50978ff83b16fbe2cfe2f8d111fd67aa
-SHA1 (patch-ai) = e01725f9cd38d05737ccc7ea6e43daa0acf03110
-SHA1 (patch-aj) = 243e7e0c1865c03c74f212bab0c7cab1201bf3c0
-SHA1 (patch-ak) = 7d1eaa5cecc5f1c3b725ff768089dfd4a133ea45
-SHA1 (patch-al) = fc7311171027b71cbd7572431f45d69ed81dcd92
+SHA1 (patch-ah) = d5dd0c8718b6f07277444d0cce02340eb849e092
+SHA1 (patch-ai) = 89817ae9c013d0da37307f9bc673bf370784e869
+SHA1 (patch-aj) = 478c44fc5a82b2ffa108e985baae49765c793828
+SHA1 (patch-ak) = 334e03bc426034c0c231af40b48ee43717c1bed8
+SHA1 (patch-al) = 53985ecc7471045d7c7ef5cb91382ac627c17ba1
SHA1 (patch-am) = c4d1d5562dace10971ef7fba37ddfcf07ad2fdb5
-SHA1 (patch-an) = 90939c5e0a8a53bf701d93ba88a2900439866142
-SHA1 (patch-ap) = 8a963fdcbc8a986b2872b756684a70edc32ce5ce
+SHA1 (patch-an) = c43d7877fb223965f5e45ba32be8565366fe2fd7
+SHA1 (patch-ao) = 88f0e4bf223db31375c7b3b2f0ef152d5cadf374
+SHA1 (patch-ap) = 1e15592658714da73ebceb695000cd636ea9b871
diff --git a/audio/jack-devel/patches/patch-aa b/audio/jack-devel/patches/patch-aa
index 8dccfd34a0f..b39c8dc33ef 100644
--- a/audio/jack-devel/patches/patch-aa
+++ b/audio/jack-devel/patches/patch-aa
@@ -1,4 +1,4 @@
-$NetBSD: patch-aa,v 1.1 2008/03/17 02:31:10 bjs Exp $
+$NetBSD: patch-aa,v 1.2 2008/04/08 01:44:47 bjs Exp $
--- config/sysdeps/atomicity.h.orig 2006-05-15 13:12:44.000000000 -0400
+++ config/sysdeps/atomicity.h
@@ -15,3 +15,14 @@ $NetBSD: patch-aa,v 1.1 2008/03/17 02:31:10 bjs Exp $
#include <config/cpu/i386/atomicity.h>
+@@ -15,6 +19,10 @@
+
+ #include <config/cpu/powerpc/atomicity.h>
+
++#elif defined(__mips__) || defined(__mips64__)
++
++#include <config/cpu/mips/atomicity.h>
++
+ #else
+
+ #include <config/cpu/generic/atomicity.h>
diff --git a/audio/jack-devel/patches/patch-ab b/audio/jack-devel/patches/patch-ab
index 0da51cdcf50..04ea90ee93a 100644
--- a/audio/jack-devel/patches/patch-ab
+++ b/audio/jack-devel/patches/patch-ab
@@ -1,51 +1,50 @@
-$NetBSD: patch-ab,v 1.2 2008/03/17 02:31:10 bjs Exp $
+$NetBSD: patch-ab,v 1.3 2008/04/08 01:44:47 bjs Exp $
---- configure.orig 2008-03-15 02:20:31.000000000 -0400
-+++ configure
-@@ -19799,6 +19799,10 @@ case "${host_os}" in
- # need small realtime stack
- JACK_THREAD_STACK_TOUCH=10000
- ;;
-+ netbsd*)
-+ # need small realtime stack
-+ JACK_THREAD_STACK_TOUCH=10000
-+ ;;
- darwin*)
- JACK_THREAD_STACK_TOUCH=10000 # need small realtime stack
- JACK_CPP_VARARGS_BROKEN=1
-@@ -23039,8 +23043,7 @@ fi
-
- JACK_CORE_CFLAGS="-I\$(top_srcdir)/config -I\$(top_srcdir) \
- -I\$(top_srcdir) -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -Wall -g"
--JACK_OPT_CFLAGS="$JACK_CORE_CFLAGS -march=pentium2 -mcpu=pentium4 -O3 \
---ffast-math -funroll-loops -fprefetch-loop-arrays"
-+JACK_OPT_CFLAGS="$JACK_CORE_CFLAGS"
- JACK_CFLAGS="$JACK_CORE_CFLAGS $CFLAGS"
-
-
-@@ -23122,7 +23125,7 @@ rm -f core conftest.err conftest.$ac_obj
- fi
-
-
-- JACK_OPT_CFLAGS="-D_REENTRANT -O2 -mcpu=7400 $ALTIVEC_OPT_FLAGS_FLAGS -mhard-float -mpowerpc-gfxopt"
-+ JACK_OPT_CFLAGS="-D_REENTRANT -O2 $ALTIVEC_OPT_FLAGS_FLAGS -mhard-float -mpowerpc-gfxopt"
-
- elif echo $target_cpu | egrep '(i.86|x86_64)' >/dev/null; then
-
-@@ -23294,14 +23297,14 @@ cat >>confdefs.h <<\_ACEOF
- #define x86 1
- _ACEOF
-
-- COMMON_X86_OPT_FLAGS="-DREENTRANT -O3 -fomit-frame-pointer -ffast-math -funroll-loops"
-+ COMMON_X86_OPT_FLAGS="-DREENTRANT"
-
- if test "$target_cpu" = "i586"; then
- JACK_OPT_CFLAGS="-march=i586 "
- elif test "$target_cpu" = "i686"; then
- JACK_OPT_CFLAGS="-march=i686"
- elif test "$target_cpu" = "x86_64"; then
-- JACK_OPT_CFLAGS="-march=k8"
-+ JACK_OPT_CFLAGS=""
- else
- :
- fi
+The default watchdog timeout is 10 seconds, which is too much for
+usleep(). Let's nanosleep if it's available.
+
+--- jackd/engine.c.orig 2008-03-17 18:26:49.000000000 -0400
++++ jackd/engine.c
+@@ -907,12 +907,24 @@ jack_engine_post_process (jack_engine_t
+ static void *
+ jack_watchdog_thread (void *arg)
+ {
++#ifdef nanosleep
++ struct timespec ts;
++#endif
+ jack_engine_t *engine = (jack_engine_t *) arg;
+
+ engine->watchdog_check = 0;
++#ifdef nanosleep
++ ts.tv_sec = JACKD_WATCHDOG_TIMEOUT / 1000;
++ ts.tv_nsec = (JACKD_WATCHDOG_TIMEOUT - (ts.tv_sec * 1000)) * 1000;
++#endif
++
+
+ while (1) {
++#ifdef nanosleep
++ nanosleep(&ts, NULL);
++#else
+ usleep (1000 * JACKD_WATCHDOG_TIMEOUT);
++#endif
+ if (!engine->freewheeling && engine->watchdog_check == 0) {
+
+ jack_error ("jackd watchdog: timeout - killing jackd");
+@@ -1468,7 +1480,7 @@ jack_server_thread (void *arg)
+ (engine, pfd[i].fd)) {
+ jack_error ("could not handle external"
+ " client request");
+-#ifdef JACK_USE_MACH_THREADS
++#ifdef JACK_HOST_HAS_BSD_POLL
+ /* poll is implemented using
+ select (see the macosx/fakepoll
+ code). When the socket is closed
+@@ -1481,7 +1493,7 @@ jack_server_thread (void *arg)
+ and remove the client.
+ */
+ jack_client_disconnect(engine, pfd[i].fd);
+-#endif /* JACK_USE_MACH_THREADS */
++#endif /* JACK_HOST_HAS_BSD_POLL */
+ }
+ }
+ }
diff --git a/audio/jack-devel/patches/patch-ac b/audio/jack-devel/patches/patch-ac
index c4933419208..94fb2d9fe8f 100644
--- a/audio/jack-devel/patches/patch-ac
+++ b/audio/jack-devel/patches/patch-ac
@@ -1,8 +1,13 @@
-$NetBSD: patch-ac,v 1.1.1.1 2008/03/16 09:26:46 bjs Exp $
+$NetBSD: patch-ac,v 1.2 2008/04/08 01:44:47 bjs Exp $
---- drivers/netjack/net_source.c.orig 2008-03-11 09:37:32.000000000 -0400
+--- drivers/netjack/net_source.c.orig 2008-03-17 10:06:55.000000000 -0400
+++ drivers/netjack/net_source.c
-@@ -11,7 +11,9 @@
+@@ -8,10 +8,14 @@
+ #include <stdlib.h>
+ #include <string.h>
+
++#include <sys/socket.h>
++
#include <netinet/in.h>
#include <netdb.h>
diff --git a/audio/jack-devel/patches/patch-ae b/audio/jack-devel/patches/patch-ae
index c202363709e..6bf303f88b2 100644
--- a/audio/jack-devel/patches/patch-ae
+++ b/audio/jack-devel/patches/patch-ae
@@ -1,15 +1,17 @@
-$NetBSD: patch-ae,v 1.1.1.1 2008/03/16 09:26:46 bjs Exp $
+$NetBSD: patch-ae,v 1.2 2008/04/08 01:44:47 bjs Exp $
---- drivers/Makefile.in.orig 2008-03-15 02:20:34.000000000 -0400
-+++ drivers/Makefile.in
-@@ -219,7 +219,9 @@ MAINTAINERCLEANFILES = Makefile.in
- @HAVE_FREEBOB_TRUE@FREEBOB_DIR = freebob
- @HAVE_FIREWIRE_FALSE@FIREWIRE_DIR =
- @HAVE_FIREWIRE_TRUE@FIREWIRE_DIR = firewire
--SUBDIRS = $(ALSA_MIDI_DIR) $(ALSA_DIR) dummy $(OSS_DIR) $(SUN_DIR) $(PA_DIR) $(CA_DIR) $(FREEBOB_DIR) $(FIREWIRE_DIR)
-+@HAVE_SAMPLERATE_TRUE@NETJACK_DIR = netjack
-+@HAVE_SAMPLERATE_FALSE@NETJACK_DIR =
-+SUBDIRS = $(ALSA_MIDI_DIR) $(ALSA_DIR) dummy $(NETJACK_DIR) $(OSS_DIR) $(SUN_DIR) $(PA_DIR) $(CA_DIR) $(FREEBOB_DIR) $(FIREWIRE_DIR)
- DIST_SUBDIRS = alsa alsa-midi dummy oss sun portaudio coreaudio freebob firewire
- all: all-recursive
-
+I'm not quite sure what's going on here, but I don't think res
+should be a pointer (quells a warning, has no ill effects that
+I can detect).
+
+--- libjack/intclient.c.orig 2008-03-13 05:05:16.000000000 -0400
++++ libjack/intclient.c
+@@ -167,7 +167,7 @@ jack_internal_client_load (jack_client_t
+ {
+ va_list ap;
+ va_start(ap, status);
+- jack_intclient_t* res = jack_internal_client_load_aux(client, client_name, options, status, ap);
++ jack_intclient_t res = jack_internal_client_load_aux(client, client_name, options, status, ap);
+ va_end(ap);
+ return res;
+ }
diff --git a/audio/jack-devel/patches/patch-af b/audio/jack-devel/patches/patch-af
index 5216c222cba..1f4f8124dd0 100644
--- a/audio/jack-devel/patches/patch-af
+++ b/audio/jack-devel/patches/patch-af
@@ -1,7 +1,7 @@
-$NetBSD: patch-af,v 1.1.1.1 2008/03/16 09:26:46 bjs Exp $
+$NetBSD: patch-af,v 1.2 2008/04/08 01:44:47 bjs Exp $
---- example-clients/transport.c.orig 2006-05-15 18:21:26.000000000 -0400
-+++ example-clients/transport.c
+--- tools/transport.c.orig 2008-04-02 17:53:12.000000000 -0400
++++ tools/transport.c
@@ -29,6 +29,10 @@
#include <jack/jack.h>
#include <jack/transport.h>
diff --git a/audio/jack-devel/patches/patch-ah b/audio/jack-devel/patches/patch-ah
index bcf0c1c4fc6..41a44bf71aa 100644
--- a/audio/jack-devel/patches/patch-ah
+++ b/audio/jack-devel/patches/patch-ah
@@ -1,4 +1,6 @@
-$NetBSD: patch-ah,v 1.1.1.1 2008/03/16 09:26:46 bjs Exp $
+$NetBSD: patch-ah,v 1.2 2008/04/08 01:44:47 bjs Exp $
+
+Allow overriding the watchdog timeout.
--- jack/engine.h.orig 2008-01-10 16:34:30.000000000 -0500
+++ jack/engine.h
diff --git a/audio/jack-devel/patches/patch-ai b/audio/jack-devel/patches/patch-ai
index 41010b3d778..11c0557a3f0 100644
--- a/audio/jack-devel/patches/patch-ai
+++ b/audio/jack-devel/patches/patch-ai
@@ -1,67 +1,14 @@
-$NetBSD: patch-ai,v 1.2 2008/03/17 02:31:10 bjs Exp $
+$NetBSD: patch-ai,v 1.3 2008/04/08 01:44:47 bjs Exp $
---- jackd/engine.c.orig 2008-03-14 03:08:35.000000000 -0400
-+++ jackd/engine.c
-@@ -633,7 +633,8 @@ jack_process_external(jack_engine_t *eng
- int status = 0;
- char c = 0;
- struct pollfd pfd[1];
-- int poll_timeout;
-+ struct timespec poll_timeout = { 0, 0 };
-+
- jack_client_internal_t *client;
- jack_client_control_t *ctl;
- jack_time_t now, then;
-@@ -666,11 +667,11 @@ jack_process_external(jack_engine_t *eng
- then = jack_get_microseconds ();
-
- if (engine->freewheeling) {
-- poll_timeout = 10000; /* 10 seconds */
-+ poll_timeout.tv_sec = 10;
- } else {
-- poll_timeout = (engine->client_timeout_msecs > 0 ?
-- engine->client_timeout_msecs :
-- 1 + engine->driver->period_usecs/1000);
-+ poll_timeout.tv_nsec = (engine->client_timeout_msecs > 0 ?
-+ engine->client_timeout_msecs * 1e6 :
-+ 1000 + engine->driver->period_usecs);
+--- libjack/client.c.orig 2008-03-17 07:30:44.000000000 -0400
++++ libjack/client.c
+@@ -1533,7 +1533,9 @@ jack_wake_next_client (jack_client_t* cl
+ jack_error ("cannot complete execution of the "
+ "processing graph (%s)",
+ strerror(errno));
++#ifndef JACK_HOST_HAS_BSD_POLL
+ return -1;
++#endif
}
-
- pfd[0].fd = client->subgraph_wait_fd;
-@@ -679,8 +680,8 @@ jack_process_external(jack_engine_t *eng
- DEBUG ("waiting on fd==%d for process() subgraph to finish",
- client->subgraph_wait_fd);
-
-- if (poll (pfd, 1, poll_timeout) < 0) {
-- jack_error ("poll on subgraph processing failed (%s)",
-+ if (pollts (pfd, 1, &poll_timeout, NULL) < 0) {
-+ jack_error ("pollts on subgraph processing failed (%s)",
- strerror (errno));
- status = -1;
- }
-@@ -1424,6 +1425,7 @@ jack_server_thread (void *arg)
- struct sockaddr_un client_addr;
- socklen_t client_addrlen;
- struct pollfd *pfd;
-+ struct timespec poll_timeout = { 10, 0 };
- int client_socket;
- int done = 0;
- int i;
-@@ -1441,7 +1443,7 @@ jack_server_thread (void *arg)
- DEBUG ("start while");
-
-- if (poll (pfd, max, 10000) < 0) {
-+ if (pollts (pfd, max, &poll_timeout, NULL) < 0) {
- if (errno == EINTR) {
- continue;
- }
-@@ -1468,7 +1470,7 @@ jack_server_thread (void *arg)
- (engine, pfd[i].fd)) {
- jack_error ("could not handle external"
- " client request");
--#ifdef JACK_USE_MACH_THREADS
-+#if defined(JACK_USE_MACH_THREADS) || defined(__NetBSD__)
- /* poll is implemented using
- select (see the macosx/fakepoll
- code). When the socket is closed
+ return 0;
diff --git a/audio/jack-devel/patches/patch-aj b/audio/jack-devel/patches/patch-aj
index b0c965c469e..ee1c65ac9ef 100644
--- a/audio/jack-devel/patches/patch-aj
+++ b/audio/jack-devel/patches/patch-aj
@@ -1,37 +1,47 @@
-$NetBSD: patch-aj,v 1.2 2008/03/17 02:31:10 bjs Exp $
+$NetBSD: patch-aj,v 1.3 2008/04/08 01:44:47 bjs Exp $
---- libjack/client.c.orig 2008-03-12 10:36:07.000000000 -0400
-+++ libjack/client.c
-@@ -1420,13 +1420,14 @@ static int
- jack_client_core_wait (jack_client_t* client)
- {
- jack_client_control_t *control = client->control;
-+ struct timespec poll_timeout = { 1, 0 };
-
- DEBUG ("client polling on %s", client->pollmax == 2 ?
- "event_fd and graph_wait_fd..." :
- "event_fd only");
-
- while (1) {
-- if (poll (client->pollfd, client->pollmax, 1000) < 0) {
-+ if (pollts (client->pollfd, client->pollmax, &poll_timeout, NULL) < 0) {
- if (errno == EINTR) {
- continue;
- }
-@@ -1896,14 +1897,14 @@ jack_activate (jack_client_t *client)
- * pages are actually mapped (more important for mlockall(2)
- * usage in jack_start_thread())
- */
--
-+#if !defined(__NetBSD__)
- char buf[JACK_THREAD_STACK_TOUCH];
- int i;
-
- for (i = 0; i < JACK_THREAD_STACK_TOUCH; i++) {
- buf[i] = (char) (i & 0xff);
- }
--
-+#endif
- if (client->control->type == ClientInternal ||
- client->control->type == ClientDriver) {
- goto startit;
+Kill all of the overzealous optimization; if the user wants this,
+there is devel/cpuflags and mk.conf.
+
+--- configure.orig 2008-04-07 17:42:32.000000000 -0400
++++ configure
+@@ -22915,9 +22915,9 @@ fi
+
+
+ JACK_CORE_CFLAGS="-I\$(top_srcdir)/config -I\$(top_srcdir) \
+--I\$(top_srcdir) -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -Wall -g"
+-JACK_OPT_CFLAGS="$JACK_CORE_CFLAGS -march=pentium2 -mcpu=pentium4 -O3 \
+--ffast-math -funroll-loops -fprefetch-loop-arrays"
++-I\$(top_srcdir) -Wall -g"
++JACK_OPT_CFLAGS="$JACK_CORE_CFLAGS -ffast-math -funroll-loops \
++-fprefetch-loop-arrays"
+ JACK_CFLAGS="$JACK_CORE_CFLAGS $CFLAGS"
+
+
+@@ -22999,7 +22999,7 @@ rm -f core conftest.err conftest.$ac_obj
+ fi
+
+
+- JACK_OPT_CFLAGS="-D_REENTRANT -O2 -mcpu=7400 $ALTIVEC_OPT_FLAGS_FLAGS -mhard-float -mpowerpc-gfxopt"
++ JACK_OPT_CFLAGS="$ALTIVEC_OPT_FLAGS_FLAGS -mhard-float -mpowerpc-gfxopt"
+
+ elif echo $target_cpu | egrep '(i.86|x86_64)' >/dev/null; then
+
+@@ -23171,7 +23171,7 @@ cat >>confdefs.h <<\_ACEOF
+ #define x86 1
+ _ACEOF
+
+- COMMON_X86_OPT_FLAGS="-DREENTRANT -O3 -fomit-frame-pointer -ffast-math -funroll-loops"
++ COMMON_X86_OPT_FLAGS="-fomit-frame-pointer -ffast-math -funroll-loops"
+
+ if test "$target_cpu" = "i586"; then
+ JACK_OPT_CFLAGS="-march=i586 "
+@@ -25491,7 +25491,7 @@ else
+ fi
+
+
+-ac_config_files="$ac_config_files Makefile config/Makefile config/cpu/Makefile config/cpu/alpha/Makefile config/cpu/cris/Makefile config/cpu/generic/Makefile config/cpu/i386/Makefile config/cpu/i486/Makefile config/cpu/ia64/Makefile config/cpu/m68k/Makefile config/cpu/mips/Makefile config/cpu/powerpc/Makefile config/cpu/s390/Makefile config/os/Makefile config/os/generic/Makefile config/os/gnu-linux/Makefile config/os/macosx/Makefile config/sysdeps/Makefile doc/Makefile doc/reference.doxygen drivers/Makefile drivers/alsa/Makefile drivers/alsa-midi/Makefile drivers/dummy/Makefile drivers/oss/Makefile drivers/sun/Makefile drivers/portaudio/Makefile drivers/coreaudio/Makefile drivers/freebob/Makefile drivers/firewire/Makefile drivers/netjack/Makefile example-clients/Makefile tools/Makefile jack.pc jack.spec jack/Makefile jack/version.h jackd/Makefile jackd/jackd.1 libjack/Makefile"
++ac_config_files="$ac_config_files Makefile config/Makefile config/cpu/Makefile config/cpu/alpha/Makefile config/cpu/cris/Makefile config/cpu/generic/Makefile config/cpu/i386/Makefile config/cpu/i486/Makefile config/cpu/ia64/Makefile config/cpu/m68k/Makefile config/cpu/mips/Makefile config/cpu/powerpc/Makefile config/cpu/s390/Makefile config/os/Makefile config/os/generic/Makefile config/os/gnu-linux/Makefile config/os/macosx/Makefile config/sysdeps/Makefile drivers/Makefile drivers/alsa/Makefile drivers/alsa-midi/Makefile drivers/dummy/Makefile drivers/oss/Makefile drivers/sun/Makefile drivers/portaudio/Makefile drivers/coreaudio/Makefile drivers/freebob/Makefile drivers/firewire/Makefile drivers/netjack/Makefile example-clients/Makefile tools/Makefile jack.pc jack.spec jack/Makefile jack/version.h jackd/Makefile jackd/jackd.1 libjack/Makefile"
+
+ cat >confcache <<\_ACEOF
+ # This file is a shell script that caches the results of configure
diff --git a/audio/jack-devel/patches/patch-ak b/audio/jack-devel/patches/patch-ak
index 4df083703c3..0441cf54b70 100644
--- a/audio/jack-devel/patches/patch-ak
+++ b/audio/jack-devel/patches/patch-ak
@@ -1,4 +1,8 @@
-$NetBSD: patch-ak,v 1.1.1.1 2008/03/16 09:26:46 bjs Exp $
+$NetBSD: patch-ak,v 1.2 2008/04/08 01:44:47 bjs Exp $
+
+Yuck. At least let's attempt to make this somewhat sane.
+When I have the time and figure out the Right Thing(tm)
+to do, perhaps I'll rewrite some of the shm code.
--- libjack/unlock.c.orig 2008-03-04 07:20:10.000000000 -0500
+++ libjack/unlock.c
diff --git a/audio/jack-devel/patches/patch-al b/audio/jack-devel/patches/patch-al
index 519ba475358..941910c1946 100644
--- a/audio/jack-devel/patches/patch-al
+++ b/audio/jack-devel/patches/patch-al
@@ -1,48 +1,21 @@
-$NetBSD: patch-al,v 1.1.1.1 2008/03/16 09:26:46 bjs Exp $
+$NetBSD: patch-al,v 1.2 2008/04/08 01:44:47 bjs Exp $
---- drivers/sun/sun_driver.h.orig 2008-03-13 05:05:16.000000000 -0400
-+++ drivers/sun/sun_driver.h
-@@ -66,7 +66,7 @@ typedef struct _sun_driver
- int outfd;
- int format;
- int ignorehwbuf;
-- int trigger;
-+ int verbose;
-
- size_t indevbufsize;
- size_t outdevbufsize;
-@@ -75,8 +75,8 @@ typedef struct _sun_driver
- void *outdevbuf;
-
- float iodelay;
-- jack_time_t last_periodtime;
-- jack_time_t next_periodtime;
-+ jack_time_t poll_last;
-+ jack_time_t poll_next;
- jack_nframes_t sys_in_latency;
- jack_nframes_t sys_out_latency;
-
-@@ -86,15 +86,15 @@ typedef struct _sun_driver
- jack_engine_t *engine;
- jack_client_t *client;
+Quell a warning about uninitialized use of these variables.
+
+--- drivers/netjack/net_driver.c.orig 2008-03-06 05:03:06.000000000 -0500
++++ drivers/netjack/net_driver.c
+@@ -132,8 +132,12 @@ net_driver_run_cycle (net_driver_t *driv
+ int wait_status;
+ float delayed_usecs;
-+ int playback_ready;
-+ int capture_ready;
+- jack_nframes_t nframes = net_driver_wait (driver, -1, &wait_status,
+- &delayed_usecs);
++ jack_nframes_t nframes;
+
-+ int playback_drops;
-+ int capture_drops;
++ wait_status = 0;
++ delayed_usecs = 0;
+
- volatile int run;
-- volatile int threads;
-- pthread_t thread_in;
-- pthread_t thread_out;
-- pthread_mutex_t mutex_in;
-- pthread_mutex_t mutex_out;
--# ifdef USE_BARRIER
-- pthread_barrier_t barrier;
--# endif
-+ pthread_t io_thread;
-+ pthread_mutex_t io_mutex;
- sem_t sem_start;
- } sun_driver_t;
++ nframes = net_driver_wait (driver, -1, &wait_status, &delayed_usecs);
+ // currently there is no xrun detection.
+ // so nframes will always be period_size.
diff --git a/audio/jack-devel/patches/patch-an b/audio/jack-devel/patches/patch-an
index f1b6dc2dc56..2a0b89741d5 100644
--- a/audio/jack-devel/patches/patch-an
+++ b/audio/jack-devel/patches/patch-an
@@ -1,871 +1,56 @@
-$NetBSD: patch-an,v 1.1.1.1 2008/03/16 09:26:46 bjs Exp $
+$NetBSD: patch-an,v 1.2 2008/04/08 01:44:47 bjs Exp $
---- drivers/sun/sun_driver.c.orig 2008-03-13 05:05:16.000000000 -0400
+This driver is buggy on NetBSD right now. This is likely [in part] due to
+problems with our audio driver, but there could very well be problems
+here, too. I welcome guidance/suggestions/comments on how to improve
+this driver, which was written by <jakemsr@openbsd.org>. For NetBSD
+questions, though, it's probably best if you contact the maintainer of
+this package and/or another NetBSD developer.
+
+--- drivers/sun/sun_driver.c.orig 2008-03-27 17:29:08.000000000 -0400
+++ drivers/sun/sun_driver.c
-@@ -28,16 +28,6 @@
+@@ -26,13 +26,6 @@
#include <config.h>
--#ifdef USE_BARRIER
--/*
-- * POSIX conformance level should be globally defined somewhere, possibly
-- * in config.h? Otherwise it's pre 1993/09 level, which leaves out significant
-- * parts of threading and realtime stuff. Note: most of the parts are still
-- * defined as optional by the standard, so OS conformance to this level
-- * doesn't necessarily mean everything exists.
-- */
--#define _XOPEN_SOURCE 600
+-#ifndef _REENTRANT
+-#define _REENTRANT
+-#endif
+-#ifndef _THREAD_SAFE
+-#define _THREAD_SAFE
-#endif
- #ifndef _REENTRANT
- #define _REENTRANT
- #endif
-@@ -50,6 +40,7 @@
+-
+ #include <sys/stat.h>
+ #include <sys/types.h>
#include <sys/ioctl.h>
- #include <sys/audioio.h>
+@@ -59,6 +52,12 @@
-+#include <poll.h>
- #include <unistd.h>
- #include <pthread.h>
- #include <stdlib.h>
-@@ -72,7 +63,7 @@
#include "sun_driver.h"
-
--#define SUN_DRIVER_N_PARAMS 11
-+#define SUN_DRIVER_N_PARAMS 12
- const static jack_driver_param_desc_t sun_params[SUN_DRIVER_N_PARAMS] = {
- { "rate",
- 'r',
-@@ -150,6 +141,13 @@ const static jack_driver_param_desc_t su
- { .ui = 0 },
- "system output latency",
- "system output latency"
-+ },
-+ { "verbose",
-+ 'v',
-+ JackDriverParamBool,
-+ { },
-+ "enable verbose debugging output",
-+ "enable verbose debugging output"
- }
- };
-
-@@ -167,37 +165,176 @@ static void set_period_size (sun_driver_
- ((double) driver->period_size /
- (double) driver->sample_rate) * 1e6;
- driver->last_wait_ust = 0;
-- driver->last_periodtime = jack_get_microseconds();
-- driver->next_periodtime = 0;
-+ driver->poll_last = jack_get_microseconds();
-+ driver->poll_next = 0;
- driver->iodelay = 0.0F;
- }
-
-
--static inline void update_times (sun_driver_t *driver)
-+static jack_nframes_t
-+sun_driver_wait (sun_driver_t *driver, int *status, float *iodelay)
- {
-- driver->last_periodtime = jack_get_microseconds();
-- if (driver->next_periodtime > 0)
-+ struct pollfd pfd[2];
-+ jack_time_t poll_enter;
-+ jack_time_t poll_ret = 0;
-+ jack_nframes_t capture_avail = 0;
-+ jack_nframes_t playback_avail = 0;
-+ jack_nframes_t avail;
-+ int need_capture = 0;
-+ int need_playback = 0;
-+ int capture_errors = 0;
-+ int playback_errors = 0;
-+ nfds_t nfds;
-+ struct timespec ts = { 0, 0 };
-+
-+ *status = 0;
-+ *iodelay = 0;
-+
-+ if (driver->infd >= 0)
-+ {
-+ driver->capture_ready = 0;
-+ need_capture = 1;
-+ }
-+
-+ if (driver->outfd >= 0)
- {
-- driver->iodelay = (float)
-- ((long double) driver->last_periodtime -
-- (long double) driver->next_periodtime);
-- }
-- else driver->iodelay = 0.0F;
-- driver->next_periodtime =
-- driver->last_periodtime +
-- driver->period_usecs;
-+ driver->playback_ready = 0;
-+ need_playback = 1;
-+ }
-+
-+ while (need_capture || need_playback)
-+ {
-+ bzero(&pfd[0], sizeof(struct pollfd));
-+ bzero(&pfd[1], sizeof(struct pollfd));
-+
-+ if (driver->infd >= 0 )
-+ {
-+ pfd[0].fd = driver->infd;
-+ pfd[0].events = POLLIN;
-+ }
-+
-+ if (driver->outfd >= 0)
-+ {
-+ pfd[1].fd = driver->outfd;
-+ pfd[1].events = POLLOUT;
-+ }
-+
-+ poll_enter = jack_get_microseconds();
++#ifdef __NetBSD__
++#define AUMODE_PLAY_FLAGS (AUMODE_PLAY | AUMODE_PLAY_ALL)
++#else
++#define AUMODE_PLAY_FLAGS AUMODE_PLAY
++#endif
+
-+ ts.tv_nsec = driver->period_usecs * 1000;
-+
-+ nfds = pollts(pfd, 2, &ts, NULL);
-+ if ( nfds == -1 ||
-+ ((pfd[0].revents | pfd[1].revents) &
-+ (POLLERR | POLLHUP | POLLNVAL)) )
-+ {
-+ jack_error("sun_driver: poll() error: %s, %s@%i",
-+ strerror(errno), __FILE__, __LINE__);
-+ return 0;
-+ }
-+
-+ poll_ret = jack_get_microseconds();
-+
-+ if (driver->poll_next && poll_ret > driver->poll_next)
-+ *iodelay = poll_ret - driver->poll_next;
-+ driver->poll_last = poll_ret;
-+ driver->poll_next = poll_ret + driver->period_usecs;
-+ driver->engine->transport_cycle_start(driver->engine,
-+ poll_ret);
-+
-+ if (nfds == 0)
-+ {
-+ jack_error("sun_driver: poll() timeout, waited "
-+ "%" PRIu64 " usecs, %s@%i",
-+ poll_ret - poll_enter, __FILE__, __LINE__);
-+ return 0;
-+ }
-+
-+ if (need_capture)
-+ {
-+ if (ioctl(driver->infd, AUDIO_RERROR,
-+ &capture_errors) < 0)
-+ {
-+ jack_error("sun_driver: AUDIO_RERROR failed: "
-+ "%s, %s@%i", strerror(errno),
-+ __FILE__, __LINE__);
-+ return 0;
-+ }
-+ capture_errors /= driver->period_size;
-+ capture_errors -= driver->capture_drops;
-+ if ((capture_errors > 0) && driver->verbose)
-+ {
-+ printf("sun_driver: missed %d capture"
-+ " cycles\n", capture_errors);
-+ }
-+ driver->capture_drops += capture_errors;
-+ if (pfd[0].revents & POLLIN)
-+ {
-+ capture_avail = driver->period_size;
-+ need_capture--;
-+ }
-+ }
-+
-+ if (need_playback)
-+ {
-+ if (ioctl(driver->outfd, AUDIO_PERROR,
-+ &playback_errors) < 0)
-+ {
-+ jack_error("sun_driver: AUDIO_PERROR failed: "
-+ "%s: %s@%i", strerror(errno),
-+ __FILE__, __LINE__);
-+ return 0;
-+ }
-+ playback_errors /= driver->period_size;
-+ playback_errors -= driver->playback_drops;
-+ if ((playback_errors > 0) && driver->verbose)
-+ {
-+ printf("sun_driver: missed %d playback"
-+ " cycles\n", playback_errors);
-+ }
-+ driver->playback_drops += playback_errors;
-+ if (pfd[1].revents & POLLOUT)
-+ {
-+ playback_avail = driver->period_size;
-+ need_playback--;
-+ }
-+ }
-+ }
-+
-+ driver->last_wait_ust = poll_ret;
-+
-+ avail = capture_avail < playback_avail ?
-+ (capture_avail > 0 ? capture_avail : playback_avail) :
-+ (playback_avail > 0 ? playback_avail : capture_avail);
-+
-+ if (capture_avail > 0)
-+ *status |= 1;
-+ if (playback_avail > 0)
-+ *status |= 2;
-+
-+ return avail - (avail % driver->period_size);
- }
+ #define SUN_DRIVER_N_PARAMS 11
+ const static jack_driver_param_desc_t sun_params[SUN_DRIVER_N_PARAMS] = {
+@@ -736,7 +735,7 @@ sun_driver_set_parameters (sun_driver_t
- static inline void driver_cycle (sun_driver_t *driver)
- {
-- update_times(driver);
-- driver->engine->transport_cycle_start(driver->engine,
-- driver->last_periodtime);
--
-- driver->last_wait_ust = driver->last_periodtime;
-- driver->engine->run_cycle(driver->engine,
-- driver->period_size, driver->iodelay);
-+ jack_nframes_t ready_frames;
-+ int ready_status;
-+ float iodelay;
-+
-+ ready_frames = sun_driver_wait (driver, &ready_status, &iodelay);
-+
-+ if (ready_frames == 0)
-+ {
-+ driver->engine->delay (driver->engine, iodelay);
-+ }
-+
-+ if (ready_status & 1)
-+ driver->capture_ready = 1;
-+ if (ready_status & 2)
-+ driver->playback_ready = 1;
-+
-+ driver->engine->run_cycle(driver->engine, ready_frames, iodelay);
- }
-
-
-@@ -337,8 +474,8 @@ static int sun_driver_attach (sun_driver
- JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
- if (port == NULL)
- {
-- jack_error("sun_driver: cannot register port for %s: %s@%i",
-- channel_name, __FILE__, __LINE__);
-+ jack_error("sun_driver: cannot register port for %s: "
-+ "%s@%i", channel_name, __FILE__, __LINE__);
- break;
- }
- jack_port_set_latency(port,
-@@ -356,8 +493,8 @@ static int sun_driver_attach (sun_driver
- JACK_DEFAULT_AUDIO_TYPE, port_flags, 0);
- if (port == NULL)
- {
-- jack_error("sun_driver: cannot register port for %s: %s@%i",
-- channel_name, __FILE__, __LINE__);
-+ jack_error("sun_driver: cannot register port for "
-+ "%s: %s@%i", channel_name, __FILE__, __LINE__);
- break;
- }
- jack_port_set_latency(port,
-@@ -417,8 +554,6 @@ static int sun_driver_start (sun_driver_
- const char *indev = driver->indev;
- const char *outdev = driver->outdev;
-
-- driver->trigger = 0;
--
- if ((strcmp(indev, outdev) == 0) &&
- ((driver->capture_channels > 0) && (driver->playback_channels > 0)))
- {
-@@ -426,15 +561,17 @@ static int sun_driver_start (sun_driver_
- if (infd < 0)
- {
- jack_error(
-- "sun_driver: failed to open duplex device %s: %s@%i, errno=%d",
-- indev, __FILE__, __LINE__, errno);
-+ "sun_driver: failed to open duplex device "
-+ "%s: %s@%i, errno=%d", indev, __FILE__,
-+ __LINE__, errno);
- return -1;
- }
- if (ioctl(infd, AUDIO_SETFD, &s) < 0)
- {
- jack_error(
-- "sun_driver: failed to enable full duplex for %s: %s@%i, errno=%d",
-- indev, __FILE__, __LINE__, errno);
-+ "sun_driver: failed to enable full duplex for "
-+ "%s: %s@%i, errno=%d", indev, __FILE__,
-+ __LINE__, errno);
- return -1;
- }
- }
-@@ -446,7 +583,8 @@ static int sun_driver_start (sun_driver_
- if (infd < 0)
- {
- jack_error(
-- "sun_driver: failed to open input device %s: %s@%i, errno=%d",
-+ "sun_driver: failed to open input "
-+ "device %s: %s@%i, errno=%d",
- indev, __FILE__, __LINE__, errno);
- }
- }
-@@ -456,7 +594,8 @@ static int sun_driver_start (sun_driver_
- if (outfd < 0)
- {
- jack_error(
-- "sun_driver: failed to open output device %s: %s@%i, errno=%d",
-+ "sun_driver: failed to open output "
-+ "device %s: %s@%i, errno=%d",
- outdev, __FILE__, __LINE__, errno);
- }
- }
-@@ -464,7 +603,8 @@ static int sun_driver_start (sun_driver_
- if (infd == -1 && outfd == -1)
- {
- jack_error(
-- "sun_driver: no device was opened %s@%i", __FILE__, __LINE__);
-+ "sun_driver: no device was opened %s@%i", __FILE__,
-+ __LINE__);
- }
-
- driver->infd = infd;
-@@ -479,6 +619,7 @@ static int sun_driver_start (sun_driver_
- audio_if_in.record.precision = driver->bits;
- audio_if_in.record.channels = driver->capture_channels;
- audio_if_in.record.sample_rate = driver->sample_rate;
-+ audio_if_in.record.pause = 1;
-
- }
- if (outfd >= 0)
-@@ -487,6 +628,8 @@ static int sun_driver_start (sun_driver_
- audio_if_out.play.precision = driver->bits;
- audio_if_out.play.channels = driver->playback_channels;
- audio_if_out.play.sample_rate = driver->sample_rate;
-+ audio_if_out.play.pause = 1;
-+
- }
if (infd == outfd)
- audio_if_in.play = audio_if_out.play;
-@@ -514,7 +657,8 @@ static int sun_driver_start (sun_driver_
- {
- if (ioctl(infd, AUDIO_SETINFO, &audio_if_in) < 0)
- jack_error(
-- "sun_driver: failed to set parameters for %s: %s@%i, errno=%d",
-+ "sun_driver: failed to set parameters for "
-+ "%s: %s@%i, errno=%d",
- indev, __FILE__, __LINE__, errno);
- }
-
-@@ -522,7 +666,8 @@ static int sun_driver_start (sun_driver_
{
- if (ioctl(outfd, AUDIO_SETINFO, &audio_if_out) < 0)
- jack_error(
-- "sun_driver: failed to set parameters for %s: %s@%i, errno=%d",
-+ "sun_driver: failed to set parameters for "
-+ "%s: %s@%i, errno=%d",
- outdev, __FILE__, __LINE__, errno);
+- audio_if_in.mode = AUMODE_PLAY | AUMODE_RECORD;
++ audio_if_in.mode = AUMODE_PLAY_FLAGS | AUMODE_RECORD;
}
-
-@@ -534,8 +679,8 @@ static int sun_driver_start (sun_driver_
- {
- if (ioctl(infd, AUDIO_GETINFO, &audio_if_in) < 0)
- {
-- jack_error("sun_driver: AUDIO_GETINFO failed: %s@%i, errno=%d",
-- __FILE__, __LINE__, errno);
-+ jack_error("sun_driver: AUDIO_GETINFO failed: "
-+ "%s@%i, errno=%d", __FILE__, __LINE__, errno);
- }
-
- if (audio_if_in.record.encoding != driver->format ||
-@@ -543,12 +688,20 @@ static int sun_driver_start (sun_driver_
- audio_if_in.record.channels != driver->capture_channels ||
- audio_if_in.record.sample_rate != driver->sample_rate)
- {
-- jack_error("sun_driver: setting capture parameters failed: %s@%i",
-- __FILE__, __LINE__);
-+ jack_error("sun_driver: setting capture parameters "
-+ "failed: %s@%i", __FILE__, __LINE__);
-+ jack_error("encoding = %d: format = %d",
-+ audio_if_in.record.encoding, driver->format);
-+ jack_error("precision = %d: bits = %d",
-+ audio_if_in.record.precision, driver->bits);
-+ jack_error("channels = %d: channels = %d",
-+ audio_if_in.record.channels, driver->capture_channels);
-+ jack_error("rate = %d: rate = %d",
-+ audio_if_in.record.sample_rate, driver->sample_rate);
- }
-
-- period_size = 8 * audio_if_in.blocksize / driver->capture_channels /
-- driver->bits;
-+ period_size = 8 * audio_if_in.blocksize /
-+ driver->capture_channels / driver->bits;
- }
-
- if (outfd > 0)
-@@ -561,30 +714,38 @@ static int sun_driver_start (sun_driver_
- {
- if (ioctl(outfd, AUDIO_GETINFO, &audio_if_out) < 0)
- {
-- jack_error("sun_driver: AUDIO_GETINFO failed: %s@%i, errno=%d",
-- __FILE__, __LINE__, errno);
-+ jack_error("sun_driver: AUDIO_GETINFO failed: "
-+ "%s@%i, errno=%d", __FILE__, __LINE__,
-+ errno);
- }
- }
-
-- if (audio_if_in.play.encoding != driver->format ||
-- audio_if_in.play.precision != driver->bits ||
-- audio_if_in.play.channels != driver->playback_channels ||
-- audio_if_in.play.sample_rate != driver->sample_rate)
-+ if (audio_if_out.play.encoding != driver->format ||
-+ audio_if_out.play.precision != driver->bits ||
-+ audio_if_out.play.channels != driver->playback_channels ||
-+ audio_if_out.play.sample_rate != driver->sample_rate)
- {
-- jack_error("sun_driver: setting playback parameters failed: %s@%i",
-+ jack_error("sun_driver: playback settings failed: %s@%i",
- __FILE__, __LINE__);
-+ jack_error("encoding = %d: format = %d",
-+ audio_if_in.play.encoding, driver->format);
-+ jack_error("precision = %d: bits = %d",
-+ audio_if_in.play.precision, driver->bits);
-+ jack_error("channels = %d: channels = %d",
-+ audio_if_in.play.channels, driver->playback_channels);
-+ jack_error("rate = %d: rate = %d",
-+ audio_if_in.play.sample_rate, driver->sample_rate);
- }
-
-- period_size = 8 * audio_if_out.blocksize / driver->playback_channels /
-- driver->bits;
-+ period_size = 8 * audio_if_out.blocksize /
-+ driver->playback_channels / driver->bits;
- }
-
- if (period_size != driver->period_size && !driver->ignorehwbuf)
+ else
{
- printf("sun_driver: period size update: %u\n", period_size);
-- driver->period_size = period_size;
-- driver->period_usecs = ((double) driver->period_size /
-- (double) driver->sample_rate) * 1e6;
-+
-+ set_period_size (driver, period_size);
-
- driver->engine->set_buffer_size(driver->engine,
- driver->period_size);
-@@ -631,50 +792,24 @@ static int sun_driver_start (sun_driver_
- printf("sun_driver: indevbuf %zd B, outdevbuf %zd B\n",
- driver->indevbufsize, driver->outdevbufsize);
+@@ -744,7 +743,7 @@ sun_driver_set_parameters (sun_driver_t
+ audio_if_in.mode = AUMODE_RECORD;
-- pthread_mutex_init(&driver->mutex_in, NULL);
-- pthread_mutex_init(&driver->mutex_out, NULL);
--# ifdef USE_BARRIER
-- puts("sun_driver: using barrier mode, (dual thread)");
-- pthread_barrier_init(&driver->barrier, NULL, 2);
--# else
-- puts("sun_driver: not using barrier mode, (single thread)");
--# endif
-+ pthread_mutex_init(&driver->io_mutex, NULL);
-+
- sem_init(&driver->sem_start, 0, 0);
- driver->run = 1;
-- driver->threads = 0;
-- if (infd >= 0)
-- {
-- if (jack_client_create_thread(NULL, &driver->thread_in,
-- driver->engine->rtpriority,
-- driver->engine->control->real_time,
-- io_thread, driver) < 0)
-- {
-- jack_error("sun_driver: jack_client_create_thread() failed: %s@%i",
-- __FILE__, __LINE__);
-- return -1;
-- }
-- driver->threads |= 1;
-- }
-
-- if ((outfd >= 0) && (infd < 0))
-+ if (jack_client_create_thread(NULL, &driver->io_thread,
-+ driver->engine->rtpriority, driver->engine->control->real_time,
-+ io_thread, driver) < 0)
- {
-- if (jack_client_create_thread(NULL, &driver->thread_out,
-- driver->engine->rtpriority,
-- driver->engine->control->real_time,
-- io_thread, driver) < 0)
-- {
-- jack_error("sun_driver: jack_client_create_thread() failed: %s@%i",
-- __FILE__, __LINE__);
-- return -1;
-- }
-- driver->threads |= 2;
-+ jack_error("sun_driver: jack_client_create_thread() "
-+ "failed: %s@%i", __FILE__, __LINE__);
-+ return -1;
+ if (outfd > 0)
+- audio_if_out.mode = AUMODE_PLAY;
++ audio_if_out.mode = AUMODE_PLAY_FLAGS;
}
-- if (driver->threads & 1) sem_post(&driver->sem_start);
-- if (driver->threads & 2) sem_post(&driver->sem_start);
-+ sem_post(&driver->sem_start);
-
-- driver->last_periodtime = jack_get_microseconds();
-- driver->next_periodtime = 0;
-+ driver->poll_last = jack_get_microseconds();
-+ driver->poll_next = 0;
- driver->iodelay = 0.0F;
-
- return 0;
-@@ -686,38 +821,25 @@ static int sun_driver_stop (sun_driver_t
- void *retval;
-
- driver->run = 0;
-- if (driver->threads & 1)
-- {
-- if (pthread_join(driver->thread_in, &retval) < 0)
-- {
-- jack_error("sun_driver: pthread_join() failed: %s@%i",
-- __FILE__, __LINE__);
-- return -1;
-- }
-- }
-- if (driver->threads & 2)
-+ if (pthread_join(driver->io_thread, &retval) < 0)
- {
-- if (pthread_join(driver->thread_out, &retval) < 0)
-- {
-- jack_error("sun_driver: pthread_join() failed: %s@%i",
-- __FILE__, __LINE__);
-- return -1;
-- }
-+ jack_error("sun_driver: pthread_join() failed: %s@%i",
-+ __FILE__, __LINE__);
-+ return -1;
- }
-+
- sem_destroy(&driver->sem_start);
--# ifdef USE_BARRIER
-- pthread_barrier_destroy(&driver->barrier);
--# endif
-- pthread_mutex_destroy(&driver->mutex_in);
-- pthread_mutex_destroy(&driver->mutex_out);
-+ pthread_mutex_destroy(&driver->io_mutex);
-
- if (driver->outfd >= 0 && driver->outfd != driver->infd)
- {
-+ ioctl(driver->outfd, AUDIO_DRAIN);
- close(driver->outfd);
- driver->outfd = -1;
- }
- if (driver->infd >= 0)
- {
-+ ioctl(driver->infd, AUDIO_DRAIN);
- close(driver->infd);
- driver->infd = -1;
- }
-@@ -744,16 +866,19 @@ static int sun_driver_read (sun_driver_t
- JSList *node;
- jack_port_t *port;
-
-- if (!driver->run) return 0;
-+ if (!driver->run)
-+ return 0;
-+
- if (nframes != driver->period_size)
- {
- jack_error(
-- "sun_driver: read failed nframes != period_size (%u/%u): %s@%i",
-- nframes, driver->period_size, __FILE__, __LINE__);
-+ "sun_driver: read failed nframes != period_size: "
-+ "(%u/%u): %s@%i", nframes, driver->period_size,
-+ __FILE__, __LINE__);
- return -1;
- }
-
-- pthread_mutex_lock(&driver->mutex_in);
-+ pthread_mutex_lock(&driver->io_mutex);
-
- node = driver->capture_ports;
- channel = 0;
-@@ -774,7 +899,7 @@ static int sun_driver_read (sun_driver_t
- channel++;
- }
-
-- pthread_mutex_unlock(&driver->mutex_in);
-+ pthread_mutex_unlock(&driver->io_mutex);
-
- return 0;
- }
-@@ -787,16 +912,19 @@ static int sun_driver_write (sun_driver_
- JSList *node;
- jack_port_t *port;
-
-- if (!driver->run) return 0;
-+ if (!driver->run)
-+ return 0;
-+
- if (nframes != driver->period_size)
- {
- jack_error(
-- "sun_driver: write failed nframes != period_size (%u/%u): %s@%i",
-- nframes, driver->period_size, __FILE__, __LINE__);
-+ "sun_driver: write failed nframes != period_size "
-+ "(%u/%u): %s@%i", nframes, driver->period_size,
-+ __FILE__, __LINE__);
- return -1;
- }
-
-- pthread_mutex_lock(&driver->mutex_out);
-+ pthread_mutex_lock(&driver->io_mutex);
-
- node = driver->playback_ports;
- channel = 0;
-@@ -817,7 +945,7 @@ static int sun_driver_write (sun_driver_
- channel++;
- }
-
-- pthread_mutex_unlock(&driver->mutex_out);
-+ pthread_mutex_unlock(&driver->io_mutex);
-
- return 0;
- }
-@@ -825,13 +953,10 @@ static int sun_driver_write (sun_driver_
-
- static int sun_driver_null_cycle (sun_driver_t *driver, jack_nframes_t nframes)
- {
-- pthread_mutex_lock(&driver->mutex_in);
-+ pthread_mutex_lock(&driver->io_mutex);
- memset(driver->indevbuf, 0x00, driver->indevbufsize);
-- pthread_mutex_unlock(&driver->mutex_in);
--
-- pthread_mutex_lock(&driver->mutex_out);
- memset(driver->outdevbuf, 0x00, driver->outdevbufsize);
-- pthread_mutex_unlock(&driver->mutex_out);
-+ pthread_mutex_unlock(&driver->io_mutex);
-
- return 0;
- }
-@@ -853,39 +978,19 @@ static int sun_driver_bufsize (sun_drive
-
- /* internal driver thread */
-
--
--#ifdef USE_BARRIER
--static inline void synchronize (sun_driver_t *driver)
--{
-- if (driver->threads == 3)
-- {
-- if (pthread_barrier_wait(&driver->barrier) ==
-- PTHREAD_BARRIER_SERIAL_THREAD)
-- {
-- driver_cycle(driver);
-- }
-- }
-- else
-- {
-- driver_cycle(driver);
-- }
--}
--#endif
--
--
- static void *io_thread (void *param)
- {
- size_t localsize;
- ssize_t io_res;
- void *localbuf;
- sun_driver_t *driver = (sun_driver_t *) param;
-+ audio_info_t audio_if;
-+ int i;
-
-- sem_wait(&driver->sem_start);
--
--# ifdef USE_BARRIER
-- if (pthread_self() == driver->thread_in)
-+ if (driver->outfd >= 0 && driver->playback_channels > 0)
- {
-- localsize = driver->indevbufsize;
-+ /* "prime" the playback buffer */
-+ localsize = driver->outdevbufsize;
- localbuf = malloc(localsize);
- if (localbuf == NULL)
- {
-@@ -894,113 +999,104 @@ static void *io_thread (void *param)
- return NULL;
- }
-
-- while (driver->run)
-+ memset(localbuf, 0, localsize);
-+ for (i = 0; i < driver->nperiods; i++)
- {
-- io_res = read(driver->infd, localbuf, localsize);
-+ io_res = write(driver->outfd, localbuf, localsize);
- if (io_res < (ssize_t) localsize)
- {
- jack_error(
-- "sun_driver: read() failed: %s@%i, count=%d/%d, errno=%d",
-- __FILE__, __LINE__, io_res, localsize,
-- errno);
-+ "sun_driver: write() failed: %s@%i, "
-+ "count=%d/%d, errno=%d", __FILE__,
-+ __LINE__, io_res, localsize, errno);
- break;
- }
--
-- pthread_mutex_lock(&driver->mutex_in);
-- memcpy(driver->indevbuf, localbuf, localsize);
-- pthread_mutex_unlock(&driver->mutex_in);
--
-- synchronize(driver);
- }
--
- free(localbuf);
- }
-- else if (pthread_self() == driver->thread_out)
-- {
-- localsize = driver->outdevbufsize;
-- localbuf = malloc(localsize);
-- if (localbuf == NULL)
-- {
-- jack_error("sun_driver: malloc() failed: %s@%i",
-- __FILE__, __LINE__);
-- return NULL;
-- }
-- while (driver->run)
-- {
-- pthread_mutex_lock(&driver->mutex_out);
-- memcpy(localbuf, driver->outdevbuf, localsize);
-- pthread_mutex_unlock(&driver->mutex_out);
-
-- io_res = write(driver->outfd, localbuf, localsize);
-- if (io_res < (ssize_t) localsize)
-- {
-- jack_error(
-- "sun_driver: write() failed: %s@%i, count=%d/%d, errno=%d",
-- __FILE__, __LINE__, io_res, localsize,
-- errno);
-- break;
-- }
-+ sem_wait(&driver->sem_start);
-
-- synchronize(driver);
-- }
-+ /* start DMA engine(s) */
-
-- free(localbuf);
-+ if (driver->infd >= 0)
-+ {
-+ AUDIO_INITINFO(&audio_if);
-+ audio_if.record.pause = 0;
-+ if (ioctl(driver->infd, AUDIO_SETINFO, &audio_if) < 0)
-+ jack_error(
-+ "sun_driver: failed to trigger capture: "
-+ "%s@%i, errno=%d", __FILE__, __LINE__, errno);
-+ ioctl(driver->infd, AUDIO_FLUSH);
-+ }
-+
-+ if (driver->outfd >= 0)
-+ {
-+ AUDIO_INITINFO(&audio_if);
-+ audio_if.play.pause = 0;
-+ if (ioctl(driver->outfd, AUDIO_SETINFO, &audio_if) < 0)
-+ jack_error(
-+ "sun_driver: failed to trigger playback: "
-+ "%s@%i, errno=%d", __FILE__, __LINE__, errno);
-+ ioctl(driver->outfd, AUDIO_FLUSH);
- }
--# else
-+
- localsize = (driver->indevbufsize >= driver->outdevbufsize) ?
- driver->indevbufsize : driver->outdevbufsize;
- localbuf = malloc(localsize);
- if (localbuf == NULL)
- {
-- jack_error("sun_driver: malloc() failed: %s@%i", __FILE__, __LINE__);
-+ jack_error("sun_driver: malloc() failed: %s@%i",
-+ __FILE__, __LINE__);
- return NULL;
- }
-
- while (driver->run)
- {
-- if (driver->outfd >= 0 && driver->playback_channels > 0)
-+ if (driver->playback_ready > 0)
- {
-- pthread_mutex_lock(&driver->mutex_out);
-+ pthread_mutex_lock(&driver->io_mutex);
- memcpy(localbuf, driver->outdevbuf,
- driver->outdevbufsize);
-- pthread_mutex_unlock(&driver->mutex_out);
-+ pthread_mutex_unlock(&driver->io_mutex);
-
- io_res = write(driver->outfd, localbuf,
- driver->outdevbufsize);
- if (io_res < (ssize_t) driver->outdevbufsize)
- {
- jack_error(
-- "sun_driver: write() failed: %s@%i, count=%d/%d, errno=%d",
-+ "sun_driver: write() failed: %s@%i, "
-+ "count=%d/%d, errno=%d",
- __FILE__, __LINE__, io_res,
- driver->outdevbufsize, errno);
- break;
- }
- }
-
-- if (driver->capture_channels > 0)
-+ if (driver->capture_ready > 0)
- {
- io_res = read(driver->infd, localbuf,
- driver->indevbufsize);
- if (io_res < (ssize_t) driver->indevbufsize)
- {
- jack_error(
-- "sun_driver: read() failed: %s@%i, count=%d/%d, errno=%d",
-+ "sun_driver: read() failed: %s@%i, "
-+ "count=%d/%d, errno=%d",
- __FILE__, __LINE__, io_res,
- driver->indevbufsize, errno);
- break;
- }
-
-- pthread_mutex_lock(&driver->mutex_in);
-+ pthread_mutex_lock(&driver->io_mutex);
- memcpy(driver->indevbuf, localbuf,
- driver->indevbufsize);
-- pthread_mutex_unlock(&driver->mutex_in);
-+ pthread_mutex_unlock(&driver->io_mutex);
- }
-
- driver_cycle(driver);
- }
-
- free(localbuf);
--# endif
-
- return NULL;
- }
-@@ -1082,7 +1178,7 @@ jack_driver_t * driver_initialize (jack_
- driver->indev = NULL;
- driver->outdev = NULL;
- driver->ignorehwbuf = 0;
-- driver->trigger = 0;
-+ driver->verbose = 0;
-
- pnode = params;
- while (pnode != NULL)
-@@ -1109,6 +1205,9 @@ jack_driver_t * driver_initialize (jack_
- case 'o':
- playback_channels = param->value.ui;
- break;
-+ case 'v':
-+ driver->verbose = 1;
-+ break;
- case 'C':
- driver->indev = strdup(param->value.str);
- break;
-@@ -1172,4 +1271,3 @@ void driver_finish (jack_driver_t *drive
- free(sun_driver->outdev);
- free(driver);
- }
--
+ if (infd > 0)
diff --git a/audio/jack-devel/patches/patch-ao b/audio/jack-devel/patches/patch-ao
new file mode 100644
index 00000000000..e297316e63b
--- /dev/null
+++ b/audio/jack-devel/patches/patch-ao
@@ -0,0 +1,15 @@
+$NetBSD: patch-ao,v 1.1 2008/04/08 01:44:47 bjs Exp $
+
+We want to make sure there's no garbage in the output buffer, otherwise
+untoward stuff can happen.
+
+--- drivers/oss/oss_driver.c.orig 2008-03-04 07:20:10.000000000 -0500
++++ drivers/oss/oss_driver.c
+@@ -1042,6 +1042,7 @@ static void *io_thread (void *param)
+ pthread_mutex_lock(&driver->mutex_out);
+ memcpy(localbuf, driver->outdevbuf,
+ driver->outdevbufsize);
++ memset(driver->outdevbuf, 0x00, driver->outdevbufsize);
+ pthread_mutex_unlock(&driver->mutex_out);
+
+ io_res = write(driver->outfd, localbuf,
diff --git a/audio/jack-devel/patches/patch-ap b/audio/jack-devel/patches/patch-ap
index 3a03e689135..2d4c8a7993d 100644
--- a/audio/jack-devel/patches/patch-ap
+++ b/audio/jack-devel/patches/patch-ap
@@ -1,4 +1,4 @@
-$NetBSD: patch-ap,v 1.1 2008/03/17 02:31:10 bjs Exp $
+$NetBSD: patch-ap,v 1.2 2008/04/08 01:44:47 bjs Exp $
--- jack/types.h.orig 2008-03-12 10:36:07.000000000 -0400
+++ jack/types.h
@@ -11,12 +11,3 @@ $NetBSD: patch-ap,v 1.1 2008/03/17 02:31:10 bjs Exp $
/**
* Type used to represent sample frame counts.
-@@ -33,7 +33,7 @@ typedef uint32_t jack_nframes_t;
- /**
- * Maximum value that can be stored in jack_nframes_t
- */
--#define JACK_MAX_FRAMES (4294967295U) /* This should be UINT32_MAX, but
-+#define JACK_MAX_FRAMES UINT32_MAX /* This should be UINT32_MAX, but
- C++ has a problem with that. */
-
- /**