import gmfsk: software for doing radio digital modes: PSK31, RTTY, THROB, etc

This commit is contained in:
jason 2007-05-28 18:47:06 +00:00
parent 5657f51a08
commit 2098987ed1
7 changed files with 296 additions and 0 deletions

36
comms/gmfsk/Makefile Normal file
View File

@ -0,0 +1,36 @@
# $OpenBSD: Makefile,v 1.1.1.1 2007/05/28 18:47:06 jason Exp $
COMMENT= "Gnome multimode HF terminal"
DISTNAME= gmfsk-0.6
CATEGORIES= comms hamradio
HOMEPAGE= http://gmfsk.connect.fi/
MASTER_SITES= http://gmfsk.connect.fi/ \
http://he.fi/pub/ham/unix/linux/hfmodems/
MAINTAINER= Jason Wright <jason@openbsd.org>
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB += ICE SM X11 Xau Xcursor Xdmcp Xext Xfixes Xi Xinerama \
Xrandr Xrender c expat fontconfig freetype m pthread stdc++ z \
atk-1.0 cairo glib-2.0 glitz gmodule-2.0 gobject-2.0 \
gthread-2.0 iconv intl pango-1.0 pangocairo-1.0 pangoft2-1.0 \
png ORBit-2 art_lgpl_2 bonobo-2 bonobo-activation bonoboui-2 \
gconf-2 gnome-2 gnome-keyring gnomecanvas-2 gnomevfs-2 popt xml2
LIB_DEPENDS= fftw.>=2::math/fftw \
gtk-x11-2.0,gdk_pixbuf-2.0,gdk-x11-2.0::x11/gtk+2 \
hamlib.>=2::comms/hamlib \
gnomeui-2::x11/gnome/libgnomeui
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS= --enable-hamlib --disable-schemas-install
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
.include <bsd.port.mk>

5
comms/gmfsk/distinfo Normal file
View File

@ -0,0 +1,5 @@
MD5 (gmfsk-0.6.tar.gz) = GEhAsxuF9sT4bNvifwZEyA==
RMD160 (gmfsk-0.6.tar.gz) = Uy0kVMzH+rNucHACxv2n+eLsFM0=
SHA1 (gmfsk-0.6.tar.gz) = Jzi8K4PrjyAB7SUDxGYSPOSyWKU=
SHA256 (gmfsk-0.6.tar.gz) = dKQvMrJ2hOqhRdsykRdteAao5EauvWecarOEzugdDJU=
SIZE (gmfsk-0.6.tar.gz) = 540765

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_ptt_c,v 1.1.1.1 2007/05/28 18:47:06 jason Exp $
--- src/ptt.c.orig Sat Nov 5 13:56:29 2005
+++ src/ptt.c Sat Nov 5 13:57:28 2005
@@ -142,7 +142,7 @@ static gint openptt(void)
guchar pararg;
#endif
- if ((fd = open(pttpath, O_RDWR, 0)) < 0) {
+ if ((fd = open(pttpath, O_RDWR | O_NONBLOCK, 0)) < 0) {
errmsg("Cannot open PTT device '%s': %m", pttpath);
return -1;
}

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-src_samplerate_common_h,v 1.1.1.1 2007/05/28 18:47:06 jason Exp $
--- src/samplerate/common.h.orig Fri Nov 4 16:35:02 2005
+++ src/samplerate/common.h Fri Nov 4 16:35:36 2005
@@ -22,8 +22,14 @@
#define SRC_MAX_RATIO 12
#define SRC_MIN_RATIO_DIFF (1e-20)
+#ifdef MAX
+#undef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+#ifdef MIN
+#undef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#endif
#define MAKE_MAGIC(a,b,c,d,e,f) ((a)+((b)<<4)+((c)<<8)+((d)<<12)+((e)<<16)+((f)<<20))

View File

@ -0,0 +1,188 @@
$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 @@
#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 "snd.h"
@@ -139,9 +144,11 @@ static gint opensnd(gint direction)
audio_buf_info info;
gchar *str;
#endif
- guint sndparam, wanted;
+ audio_info_t ainfo;
gint fd;
+ AUDIO_INITINFO(&ainfo);
+
if (!config.device) {
snderr("opensnd: device not set");
return -1;
@@ -166,17 +173,11 @@ static gint opensnd(gint direction)
#endif
/* 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;
}
- /* make it block again - (SNDCTL_DSP_NONBLOCK ???) */
- if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK) < 0) {
- snderr("opensnd: ioctl: SNDCTL_DSP_NONBLOCK: %m");
- goto error;
- }
-
#ifdef SND_DEBUG
if (config.flags & SND_FLAG_8BIT)
str = "8 bit unsigned";
@@ -186,20 +187,15 @@ static gint opensnd(gint direction)
dprintf("Setting sample format (%s)...\n", str);
#endif
- if (config.flags & SND_FLAG_8BIT)
- wanted = AFMT_U8; /* 8 bit unsigned */
- else
- wanted = AFMT_S16_NE; /* 16 bit signed, native byteorder */
-
- 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;
+ } else {
+ ainfo.record.encoding = ainfo.play.encoding =
+ AUDIO_ENCODING_SLINEAR;
+ ainfo.record.precision = ainfo.play.precision = 16;
}
- if (sndparam != wanted) {
- snderr("opensnd: Requested sample format not supported");
- goto error;
- }
#ifdef SND_DEBUG
dprintf("Setting %s audio...\n",
@@ -207,61 +203,34 @@ static gint opensnd(gint direction)
#endif
if (config.flags & SND_FLAG_STEREO)
- wanted = 1; /* stereo */
+ ainfo.record.channels = ainfo.play.channels = 2;
else
- wanted = 0; /* mono */
+ ainfo.record.channels = ainfo.play.channels = 1;
- sndparam = wanted;
- if (ioctl(fd, SNDCTL_DSP_STEREO, &sndparam) < 0) {
- snderr("opensnd: ioctl: SNDCTL_DSP_STEREO: %m");
- goto error;
- }
- if (sndparam != wanted) {
- snderr("opensnd: Cannot set %s audio",
- (config.flags & SND_FLAG_STEREO) ? "stereo" : "mono");
- goto error;
- }
-
#ifdef SND_DEBUG
dprintf("Setting samplerate to %u...\n", config.samplerate);
#endif
- sndparam = config.samplerate;
- if (ioctl(fd, SNDCTL_DSP_SPEED, &sndparam) < 0) {
- snderr("opensnd: ioctl: SNDCTL_DSP_SPEED: %m");
- goto error;
- }
- if (sndparam != config.samplerate) {
- g_warning("Sampling rate is %u, requested %u\n",
- sndparam,
- config.samplerate);
- }
- config.samplerate = sndparam;
+ ainfo.record.sample_rate = ainfo.play.sample_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;
if (config.flags & SND_FLAG_STEREO)
- sndparam += 1;
+ ainfo.blocksize *= 2;
/* Unlimited amount of buffers for RX, four for TX */
if (direction == O_RDONLY)
- sndparam |= 0x7FFF0000;
+ ainfo.hiwat = 65536;
else
- sndparam |= 0x00040000;
+ ainfo.hiwat = 4;
#ifdef SND_DEBUG
dprintf("Setting fragment size (param = 0x%08X)...\n", sndparam);
#endif
- if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &sndparam) < 0) {
- snderr("opensnd: ioctl: SNDCTL_DSP_SETFRAGMENT: %m");
- goto error;
- }
-
#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);
+ printf("channels: play %u / record %u / want %u\n",
+ ainfo.play.channels, ainfo.record.channels,
+ (config.flags & SND_FLAG_STEREO) ? 2 : 1);
+#endif
+
+ config.samplerate = ainfo.play.sample_rate;
+
return fd;
error:
@@ -453,8 +443,8 @@ void sound_close(void)
/* 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;
}

12
comms/gmfsk/pkg/DESCR Normal file
View File

@ -0,0 +1,12 @@
gMFSK is a multimode HF terminal program for Linux and other unix-like
operating systems. Despite the name, gMFSK can send and receive many
digital conversational modes typically used by radio amateurs on HF.
Supported modes are:
MFSK (MFSK16 and MFSK8)
RTTY
THROB (1, 2 and 4 throbs/sec)
PSK31 (BPSK and QPSK)
PSK63
MT63
Feldhell

25
comms/gmfsk/pkg/PLIST Normal file
View File

@ -0,0 +1,25 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2007/05/28 18:47:06 jason Exp $
bin/gmfsk
share/gnome/
share/gnome/help/
share/gnome/help/gmfsk/
share/gnome/help/gmfsk/C/
share/gnome/help/gmfsk/C/fdl-appendix.xml
share/gnome/help/gmfsk/C/figures/
share/gnome/help/gmfsk/C/figures/gmfsk_start_window.png
share/gnome/help/gmfsk/C/figures/note.png
share/gnome/help/gmfsk/C/figures/tip.png
share/gnome/help/gmfsk/C/figures/warning.png
share/gnome/help/gmfsk/C/gmfsk.xml
share/gnome/help/gmfsk/C/legal.xml
share/omf/
share/omf/gmfsk/
share/omf/gmfsk/gmfsk-C.omf
share/pixmaps/
share/pixmaps/gmfsk/
share/pixmaps/gmfsk/gnome-screenshot.png
share/pixmaps/gmfsk/mfsk.png
share/pixmaps/gmfsk/pause.xpm
share/pixmaps/gmfsk/rx.xpm
share/pixmaps/gmfsk/tune.xpm
share/pixmaps/gmfsk/tx.xpm