I have no way to test this, so testing would be much appreciated. also removed current MAINTAINER address since it bounces.
-- jake...@sdf.lonestar.org SDF Public Access UNIX System - http://sdf.lonestar.org Index: Makefile =================================================================== RCS file: /cvs/ports/comms/gmfsk/Makefile,v retrieving revision 1.17 diff -N -u -p Makefile --- Makefile 10 Aug 2009 06:30:30 -0000 1.17 +++ Makefile 26 Dec 2009 09:48:49 -0000 @@ -4,7 +4,7 @@ COMMENT= GNOME multimode HF terminal GNOME_PROJECT= gmfsk GNOME_VERSION= 0.6 -PKGNAME= ${DISTNAME}p13 +PKGNAME= ${DISTNAME}p14 CATEGORIES= comms hamradio HOMEPAGE= http://gmfsk.connect.fi/ @@ -12,8 +12,6 @@ MASTER_SITES= ${HOMEPAGE} \ http://he.fi/pub/ham/unix/linux/hfmodems/ EXTRACT_SUFX= .tar.gz -MAINTAINER= Jason Wright <ja...@openbsd.org> - # GPLv2 - FDL PERMIT_PACKAGE_CDROM= Yes PERMIT_PACKAGE_FTP= Yes @@ -26,8 +24,8 @@ WANTLIB += bonobo-2 bonobo-activation bonoboui-2 c cai WANTLIB += expat fontconfig freetype gio-2.0 glib-2.0 WANTLIB += glitz gmodule-2.0 gnome-2 gnome-keyring gnomecanvas-2 WANTLIB += gnomevfs-2 gobject-2.0 gthread-2.0 m pango-1.0 pangocairo-1.0 -WANTLIB += pangoft2-1.0 pixman-1 png popt pthread pthread-stubs stdc++ xcb -WANTLIB += xml2 z +WANTLIB += pangoft2-1.0 pixman-1 png popt pthread pthread-stubs sndio +WANTLIB += stdc++ xcb xml2 z MODULES= devel/gettext \ x11/gnome \ @@ -46,7 +44,8 @@ LIB_DEPENDS= fftw.>=2::math/fftw \ CONFIGURE_STYLE= gnu CONFIGURE_ARGS= --enable-hamlib CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ - LDFLAGS="-L${LOCALBASE}/lib" + LDFLAGS="-L${LOCALBASE}/lib" \ + LIBS="-lsndio" USE_X11= Yes Index: patches/patch-src_snd_c =================================================================== RCS file: /cvs/ports/comms/gmfsk/patches/patch-src_snd_c,v retrieving revision 1.1.1.1 diff -N -u -p patches/patch-src_snd_c --- patches/patch-src_snd_c 28 May 2007 18:47:06 -0000 1.1.1.1 +++ patches/patch-src_snd_c 26 Dec 2009 09:48:49 -0000 @@ -1,41 +1,63 @@ $OpenBSD: patch-src_snd_c,v 1.1.1.1 2007/05/28 18:47:06 jason Exp $ ---- src/snd.c.orig Sat Apr 17 13:24:11 2004 -+++ src/snd.c Wed Nov 23 11:04:58 2005 -@@ -36,7 +36,12 @@ +--- src/snd.c.orig Sat Apr 17 10:24:11 2004 ++++ src/snd.c Sat Dec 26 01:23:04 2009 +@@ -36,8 +36,7 @@ #include <fcntl.h> #include <time.h> -#include <sys/soundcard.h> -+#ifdef __OpenBSD__ -+# include <sys/audioio.h> -+#else -+# include <sys/soundcard.h> -+#endif -+ - #include <sys/ioctl.h> +-#include <sys/ioctl.h> ++#include <sndio.h> #include "snd.h" -@@ -139,9 +144,11 @@ static gint opensnd(gint direction) + #include "misc.h" +@@ -55,6 +54,7 @@ + static snd_config_t config; + static snd_config_t newconfig; + ++static struct sio_hdl *hdl; + static gint snd_fd = -1; + static gint snd_dir = 0; + +@@ -133,18 +133,18 @@ static void dprintf(const char *fmt, ...) + + /* ---------------------------------------------------------------------- */ + +-static gint opensnd(gint direction) ++static struct sio_hdl * opensnd(gint direction) + { + #ifdef SND_DEBUG audio_buf_info info; gchar *str; #endif - guint sndparam, wanted; -+ audio_info_t ainfo; - gint fd; +- gint fd; ++ struct sio_hdl *h; ++ struct sio_par par, gpar; -+ AUDIO_INITINFO(&ainfo); -+ if (!config.device) { snderr("opensnd: device not set"); - return -1; -@@ -166,17 +173,11 @@ static gint opensnd(gint direction) +- return -1; ++ return NULL; + } + + #ifdef SND_DEBUG +@@ -165,18 +165,16 @@ static gint opensnd(gint direction) + dprintf("Opening %s for %s...\n", config.device, str); #endif - /* non-blocking open */ +- /* non-blocking open */ - if ((fd = open(config.device, direction | O_NONBLOCK)) < 0) { -+ if ((fd = open(config.device, direction)) < 0) { - snderr("opensnd: open: %s: %m", config.device); - return -1; +- snderr("opensnd: open: %s: %m", config.device); +- return -1; ++ if (!strncmp(config.device, "", 1) || ++ !strncmp(config.device, "default", 8)) ++ h = sio_open(NULL, direction, 0); ++ else ++ h = sio_open(config.device, direction, 0); ++ if (!h) { ++ snderr("opensnd: open: %s", config.device); ++ return NULL; } - /* make it block again - (SNDCTL_DSP_NONBLOCK ???) */ @@ -47,7 +69,7 @@ $OpenBSD: patch-src_snd_c,v 1.1.1.1 2007/05/28 18:47:0 #ifdef SND_DEBUG if (config.flags & SND_FLAG_8BIT) str = "8 bit unsigned"; -@@ -186,20 +187,15 @@ static gint opensnd(gint direction) +@@ -186,20 +184,15 @@ static gint opensnd(gint direction) dprintf("Setting sample format (%s)...\n", str); #endif @@ -55,19 +77,18 @@ $OpenBSD: patch-src_snd_c,v 1.1.1.1 2007/05/28 18:47:0 - wanted = AFMT_U8; /* 8 bit unsigned */ - else - wanted = AFMT_S16_NE; /* 16 bit signed, native byteorder */ -- ++ sio_initpar(&par); + - sndparam = wanted; - if (ioctl(fd, SNDCTL_DSP_SETFMT, &sndparam) < 0) { - snderr("opensnd: ioctl: SNDCTL_DSP_SETFMT: %m"); - goto error; + if (config.flags & SND_FLAG_8BIT) { -+ ainfo.record.encoding = ainfo.play.encoding = -+ AUDIO_ENCODING_ULINEAR; -+ ainfo.record.precision = ainfo.play.precision = 8; ++ par.bits = 8; ++ par.sig = 0; + } else { -+ ainfo.record.encoding = ainfo.play.encoding = -+ AUDIO_ENCODING_SLINEAR; -+ ainfo.record.precision = ainfo.play.precision = 16; ++ par.bits = 16; ++ par.sig = 1; } - if (sndparam != wanted) { - snderr("opensnd: Requested sample format not supported"); @@ -76,15 +97,15 @@ $OpenBSD: patch-src_snd_c,v 1.1.1.1 2007/05/28 18:47:0 #ifdef SND_DEBUG dprintf("Setting %s audio...\n", -@@ -207,61 +203,34 @@ static gint opensnd(gint direction) +@@ -207,90 +200,50 @@ static gint opensnd(gint direction) #endif if (config.flags & SND_FLAG_STEREO) - wanted = 1; /* stereo */ -+ ainfo.record.channels = ainfo.play.channels = 2; ++ par.pchan = par.rchan = 2; else - wanted = 0; /* mono */ -+ ainfo.record.channels = ainfo.play.channels = 1; ++ par.pchan = par.rchan = 1; - sndparam = wanted; - if (ioctl(fd, SNDCTL_DSP_STEREO, &sndparam) < 0) { @@ -112,77 +133,225 @@ $OpenBSD: patch-src_snd_c,v 1.1.1.1 2007/05/28 18:47:0 - config.samplerate); - } - config.samplerate = sndparam; -+ ainfo.record.sample_rate = ainfo.play.sample_rate = config.samplerate; ++ par.rate = config.samplerate; /* Request a buffer size of 512 samples */ - if (config.flags & SND_FLAG_8BIT) - sndparam = 0x00000009; - else - sndparam = 0x0000000A; -+ ainfo.blocksize = 512; -+ if ((config.flags & SND_FLAG_8BIT) == 0) -+ ainfo.blocksize *= 2; ++ par.round = 512; ++ par.appbufsz = par.round * 4; - if (config.flags & SND_FLAG_STEREO) +- if (config.flags & SND_FLAG_STEREO) - sndparam += 1; -+ ainfo.blocksize *= 2; - - /* Unlimited amount of buffers for RX, four for TX */ - if (direction == O_RDONLY) +- +- /* Unlimited amount of buffers for RX, four for TX */ +- if (direction == O_RDONLY) - sndparam |= 0x7FFF0000; -+ ainfo.hiwat = 65536; - else +- else - sndparam |= 0x00040000; -+ ainfo.hiwat = 4; - +- #ifdef SND_DEBUG - dprintf("Setting fragment size (param = 0x%08X)...\n", sndparam); +- dprintf("Setting fragment size (param = 0x%08X)...\n", sndparam); ++ dprintf("-- \n"); #endif - if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &sndparam) < 0) { - snderr("opensnd: ioctl: SNDCTL_DSP_SETFRAGMENT: %m"); -- goto error; ++ if (!sio_setpar(h, &par) || !sio_getpar(h, &gpar) || ++ gpar.bits != par.bits || gpar.sig != par.sig) { ++ snderr("sndopen: could not set parameters as desired"); + goto error; + } + + #ifdef SND_DEBUG +- if (direction == O_RDONLY) { +- if (ioctl(fd, SNDCTL_DSP_GETISPACE, &info) < 0) { +- dprintf("ioctl: SNDCTL_DSP_GETISPACE: %m"); +- } +- } else { +- if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) < 0) { +- dprintf("ioctl: SNDCTL_DSP_GETOSPACE: %m"); +- } - } - - #ifdef SND_DEBUG - if (direction == O_RDONLY) { - if (ioctl(fd, SNDCTL_DSP_GETISPACE, &info) < 0) { -@@ -281,6 +250,27 @@ static gint opensnd(gint direction) - dprintf("-- \n"); - #endif - -+ if (ioctl(fd, AUDIO_SETINFO, &ainfo) == -1) { -+ snderr("sndopen: setinfo failed: %m"); -+ goto error; -+ } -+ -+ if (ioctl(fd, AUDIO_GETINFO, &ainfo) == -1) { -+ snderr("sndopen: getinfo failed: %m"); -+ goto error; -+ } -+ -+#ifdef SND_DEBUG -+ printf("samplerate: play %u / record %u / want %u\n", -+ ainfo.play.sample_rate, ainfo.record.sample_rate, -+ config.samplerate); +- dprintf("Audio buffer size: %d bytes, number of buffers: %d\n", +- info.fragsize, info.fragstotal); ++ printf("samplerate: %u / want %u\n", ++ gpar.rate, config.samplerate); + printf("channels: play %u / record %u / want %u\n", -+ ainfo.play.channels, ainfo.record.channels, ++ gpar.pchan, gpar.rchan, + (config.flags & SND_FLAG_STEREO) ? 2 : 1); -+#endif -+ -+ config.samplerate = ainfo.play.sample_rate; -+ - return fd; + #endif +-#ifdef SND_DEBUG +- dprintf("-- \n"); +-#endif ++ config.samplerate = gpar.rate; + +- return fd; ++ return h; + error: -@@ -453,8 +443,8 @@ void sound_close(void) +- close(fd); +- return -1; ++ sio_close(h); ++ return NULL; + } - /* never close stdin/out/err */ - if (snd_fd > 2) { + /* ---------------------------------------------------------------------- */ + +-gint sound_open_for_write(gint rate) ++int sound_open_for_write(gint rate) + { + gdouble real_rate; + gdouble ratio; +@@ -307,11 +260,11 @@ gint sound_open_for_write(gint rate) + if (config.flags & SND_FLAG_TESTMODE_MASK) + snd_fd = 1; + else if (!(config.flags & SND_FLAG_FULLDUP)) +- snd_fd = opensnd(O_WRONLY); +- else if (snd_fd < 0) +- snd_fd = opensnd(O_RDWR); ++ hdl = opensnd(SIO_PLAY); ++ else if (hdl == NULL) ++ hdl = opensnd(SIO_PLAY | SIO_REC); + +- if (snd_fd < 0) ++ if (hdl == NULL) + return -1; + + snd_dir = O_WRONLY; +@@ -323,14 +276,14 @@ gint sound_open_for_write(gint rate) + src_delete(tx_src_state); + tx_src_state = NULL; + } +- return snd_fd; ++ return 0; + } + + ratio = real_rate / rate; + + if (tx_src_state && tx_src_data && tx_src_data->src_ratio == ratio) { + src_reset(tx_src_state); +- return snd_fd; ++ return 0; + } + + #if SND_DEBUG +@@ -354,7 +307,7 @@ gint sound_open_for_write(gint rate) + + tx_src_data->src_ratio = ratio; + +- return snd_fd; ++ return 0; + } + + gint sound_open_for_read(gint rate) +@@ -374,11 +327,11 @@ gint sound_open_for_read(gint rate) + if (config.flags & SND_FLAG_TESTMODE_MASK) + snd_fd = 0; + else if (!(config.flags & SND_FLAG_FULLDUP)) +- snd_fd = opensnd(O_RDONLY); +- else if (snd_fd < 0) +- snd_fd = opensnd(O_RDWR); ++ hdl = opensnd(SIO_REC); ++ else if (hdl == NULL) ++ hdl = opensnd(SIO_REC | SIO_PLAY); + +- if (snd_fd < 0) ++ if (hdl == NULL) + return -1; + + snd_dir = O_RDONLY; +@@ -390,14 +343,14 @@ gint sound_open_for_read(gint rate) + src_delete(rx_src_state); + rx_src_state = NULL; + } +- return snd_fd; ++ return 0; + } + + ratio = rate / real_rate; + + if (rx_src_state && rx_src_data && rx_src_data->src_ratio == ratio) { + src_reset(rx_src_state); +- return snd_fd; ++ return 0; + } + + #if SND_DEBUG +@@ -421,7 +374,7 @@ gint sound_open_for_read(gint rate) + + rx_src_data->src_ratio = ratio; + +- return snd_fd; ++ return 0; + } + + void sound_close(void) +@@ -451,13 +404,7 @@ void sound_close(void) + } + #endif + +- /* never close stdin/out/err */ +- if (snd_fd > 2) { - if (ioctl(snd_fd, SNDCTL_DSP_SYNC, 0) < 0) - snderr("sound_close: ioctl: SNDCTL_DSP_SYNC: %m"); -+ if (ioctl(snd_fd, AUDIO_FLUSH, 0) < 0) -+ snderr("sound_close: ioctl: AUDIO_FLUSH: %m"); - close(snd_fd); - snd_fd = -1; +- close(snd_fd); +- snd_fd = -1; +- } ++ sio_close(hdl); + } + + char *sound_error(void) +@@ -477,8 +424,8 @@ gint sound_write(gfloat *buf, gint cnt) + if ((config.flags & SND_FLAG_TESTMODE_MASK) == SND_FLAG_TESTMODE_RX) + return cnt; + +- if (snd_fd < 0) { +- snderr("sound_write: fd < 0"); ++ if (hdl == NULL) { ++ snderr("sound_write: hdl == NULL"); + return -1; } + +@@ -539,7 +486,7 @@ static gint write_samples(gfloat *buf, gint count) + if (config.flags & SND_FLAG_STEREO) + count *= 2; + +- if ((i = write(snd_fd, p, count)) < 0) ++ if ((i = sio_write(hdl, p, count)) < 0) + snderr("write_samples: write: %m"); + + return i; +@@ -573,8 +520,8 @@ gint sound_read(gfloat **buffer, gint *count) + return 0; + } + +- if (snd_fd < 0) { +- snderr("sound_read: fd < 0"); ++ if (hdl == NULL) { ++ snderr("sound_read: hdl == NULL"); + return -1; + } + +@@ -625,7 +572,7 @@ static gint read_samples(gfloat *buf, gint count) + if (config.flags & SND_FLAG_8BIT) { + count *= sizeof(guint8); + +- if ((len = read(snd_fd, snd_b_buffer, count)) < 0) ++ if ((len = sio_read(hdl, snd_b_buffer, count)) < 0) + goto error; + + len /= sizeof(guint8); +@@ -641,7 +588,7 @@ static gint read_samples(gfloat *buf, gint count) + } else { + count *= sizeof(gint16); + +- if ((len = read(snd_fd, snd_w_buffer, count)) < 0) ++ if ((len = sio_read(hdl, snd_w_buffer, count)) < 0) + goto error; + + len /= sizeof(gint16);