kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Upstream version 2.10F
rodzic
2e12ab4185
commit
6aac6bc05a
|
|
@ -8,6 +8,9 @@ Change Log:
|
|||
5) Rename some classes so that fldigi builds on Mac OSX.
|
||||
Many thanks to Justin Burket and Diane Bruce.
|
||||
6) Added a <MODEM> macro that changes the current modem
|
||||
7) Added "Log File" status to saved application state
|
||||
8) Added Pulse Audio support
|
||||
9) Added "use default audio device" if h/w changes
|
||||
|
||||
2.09 1) Modified src/Makefile.am for FreeBSD name space clash
|
||||
2) Added psk multi-channel viewer with regex search capability
|
||||
|
|
|
|||
385
configure.ac
385
configure.ac
|
|
@ -1,23 +1,24 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_COPYRIGHT([Copyright (C) 2007 Stelios Bounanos, M0GLD (m0gld AT enotty DOT net)])
|
||||
AC_COPYRIGHT([Copyright (C) 2007, 2008 Stelios Bounanos, M0GLD (m0gld AT enotty DOT net)])
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT([fldigi], [2.10E], [w1hkj AT w1hkj DOT com])
|
||||
AC_INIT([fldigi], [2.10F], [w1hkj AT w1hkj DOT com])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
|
||||
# define build, build_cpu, build_vendor, build_os
|
||||
AC_CANONICAL_BUILD
|
||||
# define host, host_cpu, host_vendor, host_os
|
||||
AC_CANONICAL_HOST
|
||||
#define target, target_cpu, target_vendor, target_os
|
||||
# define target, target_cpu, target_vendor, target_os
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
AM_INIT_AUTOMAKE([-Wall foreign std-options 1.9.6])
|
||||
AM_MAINTAINER_MODE
|
||||
AC_CONFIG_SRCDIR([src/main.cxx])
|
||||
AC_CONFIG_HEADER([src/config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
|
||||
AC_DEFINE(PACKAGE_HOME, ["http://www.w1hkj.com/Fldigi-2.x.html"], [Home page])
|
||||
|
|
@ -66,320 +67,87 @@ AC_CHECK_FUNCS([gethostbyname localtime_r memmove memset mkdir select snprintf s
|
|||
|
||||
AC_PRESERVE_HELP_ORDER
|
||||
|
||||
dnl blank line
|
||||
dnl blank line before our options in configure's help text
|
||||
AC_ARG_WITH([], [], [], [])
|
||||
|
||||
###########################
|
||||
# static flag
|
||||
###########################
|
||||
AC_ARG_ENABLE([static],
|
||||
AC_HELP_STRING([--enable-static], [enable static linking]),
|
||||
[case "${enableval}" in
|
||||
yes|no) ac_cv_static="${enableval}" ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-static]) ;;
|
||||
esac],
|
||||
[ac_cv_static=no])
|
||||
if test "x$ac_cv_static" = "xyes"; then
|
||||
AC_CHECK_LIB([rt], [clock_gettime], [RTLIB=-lrt])
|
||||
fi
|
||||
AC_SUBST([RTLIB])
|
||||
### static flag
|
||||
# Set ac_cv_static to yes/no
|
||||
# Substitute RTLIB in Makefile
|
||||
AC_FLDIGI_STATIC
|
||||
|
||||
###########################
|
||||
# debug flag
|
||||
###########################
|
||||
AC_ARG_ENABLE([debug],
|
||||
AC_HELP_STRING([--enable-debug], [turn on debugging]),
|
||||
[case "${enableval}" in
|
||||
yes|no) ac_cv_debug="${enableval}" ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
|
||||
esac],
|
||||
[ac_cv_debug=no])
|
||||
if test "x$ac_cv_debug" = "xyes"; then
|
||||
if test "x$GXX" = "xyes"; then
|
||||
CXXFLAGS="-O0 -ggdb3 -Wall"
|
||||
else
|
||||
CXXFLAGS="-O0 -g -Wall"
|
||||
fi
|
||||
### debug flag
|
||||
# Set ac_cv_debug to yes/no
|
||||
# Override CXXFLAGS
|
||||
# Set ENABLE_DEBUG Makefile conditional
|
||||
# Substitute RDYNAMIC in Makefile
|
||||
AC_FLDIGI_DEBUG
|
||||
|
||||
# check for -rdynamic support
|
||||
AC_MSG_CHECKING([whether $CXX supports -rdynamic])
|
||||
LDFLAGS_saved="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS -rdynamic"
|
||||
AC_TRY_LINK([], [], [ac_cv_rdynamic=yes], [ac_cv_rdynamic=no])
|
||||
AC_MSG_RESULT([$ac_cv_rdynamic])
|
||||
LDFLAGS="$LDFLAGS_saved"
|
||||
### TLS flag
|
||||
# Set ac_cv_tls to yes/no
|
||||
# Define USE_TLS in config.h
|
||||
AC_FLDIGI_TLS
|
||||
|
||||
if test "x$ac_cv_rdynamic" = "xyes"; then
|
||||
RDYNAMIC=-rdynamic
|
||||
fi
|
||||
### std::bind or alternatives
|
||||
# Set ac_cv_std_bind or ac_cv_std_tr1_bind to yes/no
|
||||
# Define HAVE_STD_BIND or HAVE_STD_TR1_BIND in config.h
|
||||
# Substitute BOOST_CPPFLAGS and BOOST_LDFLAGS in Makefile
|
||||
# if falling back to Boost
|
||||
AC_FLDIGI_BIND
|
||||
|
||||
CFLAGS="$CXXFLAGS"
|
||||
AC_MSG_NOTICE([debugging enabled; overriding CXXFLAGS])
|
||||
fi
|
||||
AM_CONDITIONAL([ENABLE_DEBUG], [test "x$ac_cv_debug" = "xyes"])
|
||||
AC_SUBST([RDYNAMIC])
|
||||
### FLTK
|
||||
# Substitute FLTK_CFLAGS and FLTK_LIBS in Makefile
|
||||
# Set FLUID variable
|
||||
# Set HAVE_FLUID Makefile conditional
|
||||
AC_FLDIGI_FLTK
|
||||
|
||||
###########################
|
||||
# TLS flag
|
||||
###########################
|
||||
AC_ARG_ENABLE([tls],
|
||||
AC_HELP_STRING([--enable-tls], [enable use of TLS @<:@autodetect@:>@]),
|
||||
[case "${enableval}" in
|
||||
yes|no) ac_cv_want_tls="${enableval}" ;;
|
||||
*) AC_MSG_ERROR([bad value "${enableval}" for --enable-tls]) ;;
|
||||
esac],
|
||||
[ac_cv_want_tls=check])
|
||||
### OSS
|
||||
# Set ac_cv_oss to yes/no
|
||||
# Define USE_OSS in config.h
|
||||
AC_FLDIGI_OSS
|
||||
|
||||
if test "x$ac_cv_want_tls" = "xno"; then
|
||||
AC_DEFINE(USE_TLS, 0, [Defined if we are using TLS])
|
||||
ac_cv_have_tls=no
|
||||
else
|
||||
CHECK_TLS()
|
||||
if test "x$ac_cv_want_tls" = "xcheck"; then
|
||||
if test "x$ac_cv_have_tls" = "xyes"; then
|
||||
AC_DEFINE(USE_TLS, 1, [Defined if we are using TLS])
|
||||
else
|
||||
AC_DEFINE(USE_TLS, 0, [Defined if we are using TLS])
|
||||
fi
|
||||
else # $ac_cv_want_tls is yes
|
||||
if test "x$ac_cv_have_tls" = "xno"; then
|
||||
AC_MSG_FAILURE([--enable-tls was given, but TLS is not supported])
|
||||
else
|
||||
AC_DEFINE(USE_TLS, 1, [Defined if we are using TLS])
|
||||
fi
|
||||
fi
|
||||
### libsamplerate
|
||||
# Substitute SAMPLERATE_CFLAGS and SAMPLERATE_LIBS in Makefile
|
||||
# Set NO_SAMPLERATE Makefile conditional
|
||||
AC_FLDIGI_SAMPLERATE
|
||||
|
||||
### libsndfile
|
||||
# Set ac_cv_sndfile to yes/no
|
||||
# Define USE_SNDFILE in config.h
|
||||
# Substitute SNDFILE_CFLAGS and SNDFILE_LIBS in Makefile
|
||||
AC_FLDIGI_PKG_CHECK([sndfile], [sndfile >= 1.0.10], [with], [SNDFILE],
|
||||
[enable reading/writing of audio files via libsndfile @<:@autodetect@:>@] )
|
||||
|
||||
### portaudio
|
||||
# Set ac_cv_portaudio to yes/no
|
||||
# Define USE_PORTAUDIO in config.h
|
||||
# Substitute PORTAUDIO_CFLAGS and PORTAUDIO_LIBS in Makefile
|
||||
AC_FLDIGI_PKG_CHECK([portaudio], [portaudio-2.0 >= 19], [without], [PORTAUDIO],
|
||||
[enable support for PortAudio @<:@autodetect@:>@] )
|
||||
|
||||
### pulseaudio
|
||||
# Set ac_cv_pulseaudio to yes/no
|
||||
# Define USE_PULSEAUDIO in config.h
|
||||
# Substitute PULSEAUDIO_CFLAGS and PULSEAUDIO_LIBS in Makefile
|
||||
AC_FLDIGI_PKG_CHECK([pulseaudio], [libpulse-simple >= 0.9.7], [with], [PULSEAUDIO],
|
||||
[enable support for PulseAudio @<:@autodetect@:>@] )
|
||||
|
||||
if test "x$ac_cv_oss" = "xno" && \
|
||||
test "x$ac_cv_portaudio" = "xno" && \
|
||||
test "x$ac_cv_pulseaudio" = "xno"; then
|
||||
AC_MSG_FAILURE([$PACKAGE requires OSS, PortAudio, or PulseAudio])
|
||||
fi
|
||||
|
||||
###########################
|
||||
# bind
|
||||
###########################
|
||||
# Look for a working std::bind or std::tr1::bind. If neither is present
|
||||
# we will need Boost >= 1.32.0, which provides boost::bind.
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_MSG_CHECKING([for std::bind in <functional>])
|
||||
AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <functional>
|
||||
void f(void) { }]],
|
||||
[[std::bind(f)();]])],
|
||||
[ac_cv_std_bind=yes], [ac_cv_std_bind=no] )
|
||||
AC_MSG_RESULT([$ac_cv_std_bind])
|
||||
if test "x$ac_cv_std_bind" = "xyes"; then
|
||||
AC_DEFINE(HAVE_STD_BIND, 1, [Define to 1 if we have std::bind in <functional>])
|
||||
else
|
||||
AC_DEFINE(HAVE_STD_BIND, 0, [Define to 1 if we have std::bind in <functional>])
|
||||
fi
|
||||
### hamlib
|
||||
# Set ac_cv_hamlib to yes/no
|
||||
# Define USE_HAMLIB in config.h
|
||||
# Substitute HAMLIB_CFLAGS and HAMLIB_LIBS in Makefile
|
||||
# Set ENABLE_HAMLIB Makefile conditional
|
||||
AC_FLDIGI_PKG_CHECK([hamlib], [hamlib >= 1.2.4], [with], [HAMLIB],
|
||||
[use hamradio control libraries @<:@autodetect@:>@],
|
||||
[ENABLE_HAMLIB])
|
||||
|
||||
if test "x$ac_cv_std_bind" = "xno"; then
|
||||
AC_MSG_CHECKING([for std::tr1::bind in <tr1/functional>])
|
||||
AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <tr1/functional>
|
||||
void f(void) { }]],
|
||||
[[std::tr1::bind(f)();]])],
|
||||
[ac_cv_std_tr1_bind=yes], [ac_cv_std_tr1_bind=no] )
|
||||
AC_MSG_RESULT([$ac_cv_std_tr1_bind])
|
||||
if test "x$ac_cv_std_tr1_bind" = "xyes"; then
|
||||
AC_DEFINE(HAVE_STD_TR1_BIND, 1, [Define to 1 if we have std::tr1::bind in <tr1/functional>])
|
||||
else
|
||||
AC_DEFINE(HAVE_STD_TR1_BIND, 0, [Define to 1 if we have std::tr1::bind in <tr1/functional>])
|
||||
fi
|
||||
fi
|
||||
AC_LANG_POP(C++)
|
||||
|
||||
if test "x$ac_cv_std_bind" = "xno" && test "x$ac_cv_std_tr1_bind" = "xno"; then
|
||||
AX_BOOST_BASE(1.32.0)
|
||||
if test "x$want_boost" = "xno"; then
|
||||
AC_MSG_ERROR([Boost is required])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([BOOST_CPPFLAGS])
|
||||
AC_SUBST([BOOST_LDFLAGS])
|
||||
|
||||
###########################
|
||||
# FLTK
|
||||
###########################
|
||||
AC_ARG_VAR([FLTK_CFLAGS], [C compiler flags for FLTK, overriding fltk-config])
|
||||
AC_ARG_VAR([FLTK_LIBS], [linker flags for FLTK, overriding fltk-config])
|
||||
if test "x$FLTK_CFLAGS" = "x" && test "x$FLTK_LIBS" = "x"; then
|
||||
AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no])
|
||||
if test "$FLTK_CONFIG" = "no"; then
|
||||
AC_MSG_ERROR([
|
||||
*** The fltk-config script could not be found. Please install the development
|
||||
*** headers and libraries for FLTK 1.1.x, or set PATH to the directory that
|
||||
*** contains fltk-config.
|
||||
])
|
||||
fi
|
||||
HAVE_FLTK_API_VERSION=no
|
||||
FLTK_API_VERSION=`$FLTK_CONFIG --api-version`
|
||||
if test "x$FLTK_API_VERSION" = "x1.1" || "x$FLTK_API_VERSION" = "x1.2"; then
|
||||
HAVE_FLTK_API_VERSION=yes
|
||||
fi
|
||||
if test "${HAVE_FLTK_API_VERSION}" = "no"; then
|
||||
AC_MSG_ERROR([
|
||||
*** The version of FLTK found on your system provides API version $FLTK_API_VERSION.
|
||||
*** To build $PACKAGE you need a FLTK version that provides API 1.1.
|
||||
])
|
||||
fi
|
||||
FLTK_CFLAGS=`$FLTK_CONFIG --cxxflags`
|
||||
if test "x$ac_cv_static" != "xyes"; then
|
||||
FLTK_LIBS=`$FLTK_CONFIG --ldflags --use-images`
|
||||
else
|
||||
FLTK_LIBS=`$FLTK_CONFIG --ldstaticflags --use-images`
|
||||
fi
|
||||
else
|
||||
AC_MSG_NOTICE([not checking for FLTK])
|
||||
fi
|
||||
AC_SUBST([FLTK_CFLAGS])
|
||||
AC_SUBST([FLTK_LIBS])
|
||||
|
||||
AC_ARG_VAR([FLUID], [Fast Light User-Interface Designer])
|
||||
AC_CHECK_PROG([FLUID], [fluid], [fluid])
|
||||
AM_CONDITIONAL([HAVE_FLUID], [test -n "$FLUID"])
|
||||
|
||||
###########################
|
||||
# libsamplerate
|
||||
###########################
|
||||
PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.1, ac_cv_samplerate=yes, ac_cv_samplerate=no)
|
||||
if test "x$ac_cv_samplerate" = "xno"; then
|
||||
AC_MSG_NOTICE([using bundled libsamplerate])
|
||||
fi
|
||||
AC_SUBST([SAMPLERATE_CFLAGS])
|
||||
AC_SUBST([SAMPLERATE_LIBS])
|
||||
AM_CONDITIONAL([NO_SAMPLERATE], [test "x$ac_cv_samplerate" = "xno"])
|
||||
|
||||
###########################
|
||||
# libsndfile
|
||||
###########################
|
||||
AC_ARG_WITH([sndfile],
|
||||
AC_HELP_STRING([--with-sndfile],
|
||||
[enable reading/writing of audio files via libsndfile @<:@autodetect@:>@]),
|
||||
[case "${withval}" in
|
||||
yes|no) ac_cv_want_sndfile="${withval}" ;;
|
||||
*) AC_MSG_ERROR([bad value "${withval}" for --with-sndfile]) ;;
|
||||
esac],
|
||||
[ac_cv_want_sndfile=check])
|
||||
if test "x$ac_cv_want_sndfile" = "xno"; then
|
||||
AC_DEFINE(USE_SNDFILE, 0, [Define to 1 if we are using sndfile])
|
||||
ac_cv_sndfile=no
|
||||
else
|
||||
PKG_CHECK_EXISTS(sndfile >= 1.0.10, ac_cv_sndfile=yes, ac_cv_sndfile=no)
|
||||
if test "x$ac_cv_want_sndfile" = "xcheck"; then
|
||||
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.10, [:], [:])
|
||||
if test "x$ac_cv_sndfile" = "xyes"; then
|
||||
AC_DEFINE(USE_SNDFILE, 1, [Define to 1 if we are using sndfile])
|
||||
else
|
||||
AC_DEFINE(USE_SNDFILE, 0, [Define to 1 if we are using sndfile])
|
||||
fi
|
||||
else # $ac_cv_want_sndfile is yes
|
||||
if test "x$ac_cv_sndfile" = "xno"; then
|
||||
AC_MSG_NOTICE([--with-sndfile was given, but test for sndfile failed])
|
||||
else
|
||||
AC_DEFINE(USE_SNDFILE, 1, [Define to 1 if we are using sndfile])
|
||||
fi
|
||||
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.10) # for the error message
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([SNDFILE_CFLAGS])
|
||||
AC_SUBST([SNDFILE_LIBS])
|
||||
|
||||
###########################
|
||||
# OSS
|
||||
###########################
|
||||
AC_ARG_ENABLE([oss],
|
||||
AC_HELP_STRING([--disable-oss], [disable support for OSS @<:@autodetect@:>@]),
|
||||
[case "${enableval}" in
|
||||
yes|no) ac_cv_want_oss="${enableval}" ;;
|
||||
*) AC_MSG_ERROR([bad value "${enableval}" for --disable-oss]) ;;
|
||||
esac],
|
||||
[ac_cv_want_oss=check])
|
||||
ac_cv_oss=no
|
||||
if test "x$ac_cv_want_oss" = "xno"; then
|
||||
AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS])
|
||||
else
|
||||
AC_CHECK_HEADER( [sys/soundcard.h], [ac_cv_oss=yes],
|
||||
[AC_CHECK_HEADER([machine/soundcard.h], [ac_cv_oss=yes], [])] )
|
||||
if test "x$ac_cv_want_oss" = "xcheck"; then
|
||||
if test "x$ac_cv_oss" = "xyes"; then
|
||||
AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS])
|
||||
else
|
||||
AC_MSG_NOTICE([disabling OSS driver])
|
||||
AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS])
|
||||
fi
|
||||
else # $ac_cv_want_oss is yes
|
||||
if test "x$ac_cv_oss" = "xno"; then
|
||||
AC_MSG_FAILURE([--enable-oss was given, but test for OSS failed])
|
||||
else
|
||||
AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
###########################
|
||||
# portaudio
|
||||
###########################
|
||||
AC_ARG_WITH([portaudio],
|
||||
AC_HELP_STRING([--without-portaudio],
|
||||
[disable support for PortAudio]),
|
||||
[case "${withval}" in
|
||||
yes|no) ac_cv_want_portaudio="${withval}" ;;
|
||||
*) AC_MSG_ERROR([bad value "${withval}" for --without-portaudio]) ;;
|
||||
esac],
|
||||
[ac_cv_want_portaudio=yes])
|
||||
if test "x$ac_cv_want_portaudio" = "xyes"; then
|
||||
PKG_CHECK_EXISTS(portaudio-2.0 >= 19, ac_cv_portaudio=yes, ac_cv_portaudio=no)
|
||||
if test "x$ac_cv_portaudio" = "xyes"; then
|
||||
AC_DEFINE(USE_PORTAUDIO, 1, [Define to 1 if we are using PortAudio])
|
||||
else
|
||||
AC_MSG_NOTICE([portaudio test failed (use --without-portaudio to disable)])
|
||||
fi
|
||||
PKG_CHECK_MODULES(PORTAUDIO, portaudio-2.0 >= 19)
|
||||
else
|
||||
AC_DEFINE(USE_PORTAUDIO, 0, [Define to 1 if we are using PortAudio])
|
||||
ac_cv_portaudio=no
|
||||
fi
|
||||
AC_SUBST([PORTAUDIO_CFLAGS])
|
||||
AC_SUBST([PORTAUDIO_LIBS])
|
||||
|
||||
if test "$ac_cv_oss" = "no" && test "$ac_cv_portaudio" = "no"; then
|
||||
AC_MSG_FAILURE([$PACKAGE requires OSS or PortAudio])
|
||||
fi
|
||||
|
||||
###########################
|
||||
# hamlib
|
||||
###########################
|
||||
AC_ARG_WITH([hamlib],
|
||||
AC_HELP_STRING([--with-hamlib],
|
||||
[use hamradio control libraries @<:@autodetect@:>@]),
|
||||
[case "${withval}" in
|
||||
yes|no) ac_cv_want_hamlib="${withval}" ;;
|
||||
*) AC_MSG_ERROR([bad value "${withval}" for --with-hamlib]) ;;
|
||||
esac],
|
||||
[ac_cv_want_hamlib=check])
|
||||
if test "x$ac_cv_want_hamlib" = "xno"; then
|
||||
AC_DEFINE(USE_HAMLIB, 0)
|
||||
ac_cv_hamlib=no
|
||||
else
|
||||
PKG_CHECK_EXISTS(hamlib >= 1.2.4, ac_cv_hamlib=yes, ac_cv_hamlib=no)
|
||||
if test "x$ac_cv_want_hamlib" = "xcheck"; then
|
||||
PKG_CHECK_MODULES(HAMLIB, hamlib >= 1.2.4, [:], [:])
|
||||
if test "x$ac_cv_hamlib" = "xyes"; then
|
||||
AC_DEFINE(USE_HAMLIB, 1, [Define to 1 if we are using hamlib])
|
||||
else
|
||||
AC_DEFINE(USE_HAMLIB, 0, [Define to 1 if we are using hamlib])
|
||||
fi
|
||||
else # $ac_cv_want_hamlib is yes
|
||||
if test "x$ac_cv_hamlib" = "xno"; then
|
||||
AC_MSG_NOTICE([--with-hamlib was given, but test for hamlib failed])
|
||||
else
|
||||
AC_DEFINE(USE_HAMLIB, 1, [Define to 1 if we are using hamlib])
|
||||
fi
|
||||
PKG_CHECK_MODULES(HAMLIB, hamlib >= 1.2.4) # for the error message
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([HAMLIB_CFLAGS])
|
||||
AC_SUBST([HAMLIB_LIBS])
|
||||
AM_CONDITIONAL([ENABLE_HAMLIB], [test "x$ac_cv_hamlib" = "xyes"])
|
||||
|
||||
###########################
|
||||
# output
|
||||
###########################
|
||||
### output
|
||||
AH_TOP([
|
||||
#ifndef CONFIG_H_
|
||||
#define CONFIG_H_
|
||||
|
|
@ -391,9 +159,8 @@ AH_BOTTOM([
|
|||
AC_CONFIG_FILES([Makefile src/Makefile])
|
||||
AC_OUTPUT
|
||||
|
||||
###########################
|
||||
# summary
|
||||
###########################
|
||||
|
||||
### summary
|
||||
AC_MSG_RESULT([
|
||||
Configuration summary:
|
||||
|
||||
|
|
@ -401,10 +168,10 @@ Configuration summary:
|
|||
|
||||
Static linking ...................... $ac_cv_static
|
||||
Debugging ........................... $ac_cv_debug
|
||||
TLS ................................. $ac_cv_have_tls
|
||||
|
||||
sndfile ............................. $ac_cv_sndfile
|
||||
OSS ................................. $ac_cv_oss
|
||||
PortAudio ........................... $ac_cv_portaudio
|
||||
PulseAudio .......................... $ac_cv_pulseaudio
|
||||
hamlib .............................. $ac_cv_hamlib
|
||||
])
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
dnl Look for a working std::bind or std::tr1::bind. If neither is present
|
||||
dnl we will need Boost >= 1.32.0, which provides boost::bind.
|
||||
|
||||
AC_DEFUN([AC_FLDIGI_BIND], [
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_MSG_CHECKING([for std::bind in <functional>])
|
||||
AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <functional>
|
||||
void f(void) { }]],
|
||||
[[std::bind(f)();]])],
|
||||
[ac_cv_std_bind=yes], [ac_cv_std_bind=no] )
|
||||
AC_MSG_RESULT([$ac_cv_std_bind])
|
||||
if test "x$ac_cv_std_bind" = "xyes"; then
|
||||
AC_DEFINE(HAVE_STD_BIND, 1, [Define to 1 if we have std::bind in <functional>])
|
||||
else
|
||||
AC_DEFINE(HAVE_STD_BIND, 0, [Define to 1 if we have std::bind in <functional>])
|
||||
fi
|
||||
|
||||
if test "x$ac_cv_std_bind" = "xno"; then
|
||||
AC_MSG_CHECKING([for std::tr1::bind in <tr1/functional>])
|
||||
AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <tr1/functional>
|
||||
void f(void) { }]],
|
||||
[[std::tr1::bind(f)();]])],
|
||||
[ac_cv_std_tr1_bind=yes], [ac_cv_std_tr1_bind=no] )
|
||||
AC_MSG_RESULT([$ac_cv_std_tr1_bind])
|
||||
if test "x$ac_cv_std_tr1_bind" = "xyes"; then
|
||||
AC_DEFINE(HAVE_STD_TR1_BIND, 1, [Define to 1 if we have std::tr1::bind in <tr1/functional>])
|
||||
else
|
||||
AC_DEFINE(HAVE_STD_TR1_BIND, 0, [Define to 1 if we have std::tr1::bind in <tr1/functional>])
|
||||
fi
|
||||
fi
|
||||
AC_LANG_POP(C++)
|
||||
|
||||
if test "x$ac_cv_std_bind" = "xno" && test "x$ac_cv_std_tr1_bind" = "xno"; then
|
||||
AX_BOOST_BASE(1.32.0)
|
||||
if test "x$want_boost" = "xno"; then
|
||||
AC_MSG_ERROR([Boost is required])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([BOOST_CPPFLAGS])
|
||||
AC_SUBST([BOOST_LDFLAGS])
|
||||
])
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
AC_DEFUN([AC_FLDIGI_RDYNAMIC], [
|
||||
LDFLAGS_saved="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS -rdynamic"
|
||||
|
||||
AC_MSG_CHECKING([whether $CC supports -rdynamic])
|
||||
AC_TRY_LINK([], [], [ac_cv_rdynamic=yes], [ac_cv_rdynamic=no])
|
||||
AC_MSG_RESULT([$ac_cv_rdynamic])
|
||||
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_MSG_CHECKING([whether $CXX supports -rdynamic])
|
||||
AC_TRY_LINK([], [], [ac_cv_rdynamic=yes], [ac_cv_rdynamic=no])
|
||||
AC_MSG_RESULT([$ac_cv_rdynamic])
|
||||
AC_LANG_POP(C++)
|
||||
|
||||
LDFLAGS="$LDFLAGS_saved"
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AC_FLDIGI_DEBUG], [
|
||||
AC_ARG_ENABLE([debug],
|
||||
AC_HELP_STRING([--enable-debug], [turn on debugging]),
|
||||
[case "${enableval}" in
|
||||
yes|no) ac_cv_debug="${enableval}" ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
|
||||
esac],
|
||||
[ac_cv_debug=no])
|
||||
if test "x$ac_cv_debug" = "xyes"; then
|
||||
if test "x$GXX" = "xyes"; then
|
||||
CXXFLAGS="-O0 -ggdb3 -Wall"
|
||||
else
|
||||
CXXFLAGS="-O0 -g -Wall"
|
||||
fi
|
||||
|
||||
AC_FLDIGI_RDYNAMIC()
|
||||
if test "x$ac_cv_rdynamic" = "xyes"; then
|
||||
RDYNAMIC=-rdynamic
|
||||
fi
|
||||
|
||||
CFLAGS="$CXXFLAGS"
|
||||
AC_MSG_NOTICE([debugging enabled; overriding CXXFLAGS])
|
||||
fi
|
||||
AM_CONDITIONAL([ENABLE_DEBUG], [test "x$ac_cv_debug" = "xyes"])
|
||||
AC_SUBST([RDYNAMIC])
|
||||
])
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
AC_DEFUN([AC_FLDIGI_FLTK], [
|
||||
AC_ARG_VAR([FLTK_CFLAGS], [C compiler flags for FLTK, overriding fltk-config])
|
||||
AC_ARG_VAR([FLTK_LIBS], [linker flags for FLTK, overriding fltk-config])
|
||||
if test "x$FLTK_CFLAGS" = "x" && test "x$FLTK_LIBS" = "x"; then
|
||||
AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no])
|
||||
if test "$FLTK_CONFIG" = "no"; then
|
||||
AC_MSG_ERROR([
|
||||
*** The fltk-config script could not be found. Please install the development
|
||||
*** headers and libraries for FLTK 1.1.x, or set PATH to the directory that
|
||||
*** contains fltk-config.
|
||||
])
|
||||
fi
|
||||
HAVE_FLTK_API_VERSION=no
|
||||
FLTK_API_VERSION=`$FLTK_CONFIG --api-version`
|
||||
if test "x$FLTK_API_VERSION" = "x1.1" || "x$FLTK_API_VERSION" = "x1.2"; then
|
||||
HAVE_FLTK_API_VERSION=yes
|
||||
fi
|
||||
if test "${HAVE_FLTK_API_VERSION}" = "no"; then
|
||||
AC_MSG_ERROR([
|
||||
*** The version of FLTK found on your system provides API version $FLTK_API_VERSION.
|
||||
*** To build $PACKAGE you need a FLTK version that provides API 1.1.
|
||||
])
|
||||
fi
|
||||
FLTK_CFLAGS=`$FLTK_CONFIG --cxxflags`
|
||||
if test "x$ac_cv_static" != "xyes"; then
|
||||
FLTK_LIBS=`$FLTK_CONFIG --ldflags --use-images`
|
||||
else
|
||||
FLTK_LIBS=`$FLTK_CONFIG --ldstaticflags --use-images`
|
||||
fi
|
||||
else
|
||||
AC_MSG_NOTICE([not checking for FLTK])
|
||||
fi
|
||||
AC_SUBST([FLTK_CFLAGS])
|
||||
AC_SUBST([FLTK_LIBS])
|
||||
|
||||
AC_ARG_VAR([FLUID], [Fast Light User-Interface Designer])
|
||||
AC_CHECK_PROG([FLUID], [fluid], [fluid])
|
||||
AM_CONDITIONAL([HAVE_FLUID], [test -n "$FLUID"])
|
||||
])
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
AC_DEFUN([AC_FLDIGI_OSS], [
|
||||
AC_ARG_ENABLE([oss],
|
||||
AC_HELP_STRING([--disable-oss], [disable support for OSS @<:@autodetect@:>@]),
|
||||
[case "${enableval}" in
|
||||
yes|no) ac_cv_want_oss="${enableval}" ;;
|
||||
*) AC_MSG_ERROR([bad value "${enableval}" for --disable-oss]) ;;
|
||||
esac],
|
||||
[ac_cv_want_oss=check])
|
||||
ac_cv_oss=no
|
||||
if test "x$ac_cv_want_oss" = "xno"; then
|
||||
AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS])
|
||||
else
|
||||
AC_CHECK_HEADER( [sys/soundcard.h], [ac_cv_oss=yes],
|
||||
[AC_CHECK_HEADER([machine/soundcard.h], [ac_cv_oss=yes], [])] )
|
||||
if test "x$ac_cv_want_oss" = "xcheck"; then
|
||||
if test "x$ac_cv_oss" = "xyes"; then
|
||||
AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS])
|
||||
else
|
||||
AC_MSG_NOTICE([disabling OSS driver])
|
||||
AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS])
|
||||
fi
|
||||
else # $ac_cv_want_oss is yes
|
||||
if test "x$ac_cv_oss" = "xno"; then
|
||||
AC_MSG_FAILURE([--enable-oss was given, but test for OSS failed])
|
||||
else
|
||||
AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
# name, version, opt-prefix, subst-var-prefix, help-text, [am-cond]
|
||||
AC_DEFUN([AC_FLDIGI_PKG_CHECK], [
|
||||
|
||||
AC_ARG_WITH($1, AC_HELP_STRING([--[]$3-[]$1], [$5]),
|
||||
[case "${withval}" in
|
||||
yes|no) ac_cv_want_[]$1="${withval}" ;;
|
||||
*) AC_MSG_ERROR([bad value "${withval}" for --[]$3-[]$1]) ;;
|
||||
esac],
|
||||
[ac_cv_want_[]$1=check])
|
||||
if test "x$ac_cv_want_[]$1" = "xno"; then
|
||||
AC_DEFINE([USE_][$4], 0)
|
||||
ac_cv_[]$1=no
|
||||
else
|
||||
PKG_CHECK_EXISTS([$2], ac_cv_[]$1=yes, ac_cv_[]$1=no)
|
||||
if test "x$ac_cv_want_[]$1" = "xcheck"; then
|
||||
PKG_CHECK_MODULES([$4], [$2], [:], [:])
|
||||
if test "x$ac_cv_[]$1" = "xyes"; then
|
||||
AC_DEFINE([USE_][$4], 1, [Define to 1 if we are using [$1]])
|
||||
else
|
||||
AC_DEFINE([USE_][$4], 0, [Define to 1 if we are using [$1]])
|
||||
fi
|
||||
else # $ac_cv_want_[]$1 is yes
|
||||
if test "x$ac_cv_[]$1" = "xno"; then
|
||||
AC_MSG_NOTICE([--[]$3-[]$1 was given, but test for [$1] failed])
|
||||
else
|
||||
AC_DEFINE([USE_][$4], 1, [Define to 1 if we are using [$1]])
|
||||
fi
|
||||
PKG_CHECK_MODULES([$4], [$2]) # for the error message
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([$3][_CFLAGS])
|
||||
AC_SUBST([$3][_LIBS])
|
||||
|
||||
m4_ifval([$6], [ AM_CONDITIONAL([$6], [test "x$ac_cv_[]$1" = "xyes"]) ], [:])
|
||||
])
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
AC_DEFUN([AC_FLDIGI_SAMPLERATE], [
|
||||
PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.1.1, ac_cv_samplerate=yes, ac_cv_samplerate=no)
|
||||
if test "x$ac_cv_samplerate" = "xno"; then
|
||||
AC_MSG_WARN([using bundled libsamplerate])
|
||||
fi
|
||||
AC_SUBST([SAMPLERATE_CFLAGS])
|
||||
AC_SUBST([SAMPLERATE_LIBS])
|
||||
AM_CONDITIONAL([NO_SAMPLERATE], [test "x$ac_cv_samplerate" = "xno"])
|
||||
])
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
AC_DEFUN([AC_FLDIGI_STATIC], [
|
||||
AC_ARG_ENABLE([static],
|
||||
AC_HELP_STRING([--enable-static], [enable static linking]),
|
||||
[case "${enableval}" in
|
||||
yes|no) ac_cv_static="${enableval}" ;;
|
||||
*) AC_MSG_ERROR([bad value ${enableval} for --enable-static]) ;;
|
||||
esac],
|
||||
[ac_cv_static=no])
|
||||
if test "x$ac_cv_static" = "xyes"; then
|
||||
AC_CHECK_LIB([rt], [clock_gettime], [RTLIB=-lrt])
|
||||
fi
|
||||
AC_SUBST([RTLIB])
|
||||
])
|
||||
39
m4/tls.m4
39
m4/tls.m4
|
|
@ -40,14 +40,45 @@ AC_DEFUN([CHECK_TLS], [
|
|||
return 0;
|
||||
return (a_in_other_thread == a_in_main_thread);]] )
|
||||
],
|
||||
[ac_cv_have_tls=yes], [ac_cv_have_tls=no] )
|
||||
[ac_cv_tls=yes], [ac_cv_tls=no] )
|
||||
CXXFLAGS="$chktls_save_CXXFLAGS"
|
||||
fi],
|
||||
[ac_cv_have_tls=no],
|
||||
[ac_cv_tls=no],
|
||||
[AC_LINK_IFELSE([__thread int a; int b; int main() { return a = b; }],
|
||||
[ac_cv_have_tls=yes], [ac_cv_have_tls=no])]
|
||||
[ac_cv_tls=yes], [ac_cv_tls=no])]
|
||||
)
|
||||
|
||||
AC_LANG_POP(C++)
|
||||
AC_MSG_RESULT([$ac_cv_have_tls])
|
||||
AC_MSG_RESULT([$ac_cv_tls])
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([AC_FLDIGI_TLS], [
|
||||
AC_ARG_ENABLE([tls],
|
||||
AC_HELP_STRING([--enable-tls], [enable use of TLS @<:@autodetect@:>@]),
|
||||
[case "${enableval}" in
|
||||
yes|no) ac_cv_want_tls="${enableval}" ;;
|
||||
*) AC_MSG_ERROR([bad value "${enableval}" for --enable-tls]) ;;
|
||||
esac],
|
||||
[ac_cv_want_tls=check])
|
||||
|
||||
if test "x$ac_cv_want_tls" = "xno"; then
|
||||
AC_DEFINE(USE_TLS, 0, [Defined if we are using TLS])
|
||||
ac_cv_tls=no
|
||||
else
|
||||
CHECK_TLS()
|
||||
if test "x$ac_cv_want_tls" = "xcheck"; then
|
||||
if test "x$ac_cv_tls" = "xyes"; then
|
||||
AC_DEFINE(USE_TLS, 1, [Defined if we are using TLS])
|
||||
else
|
||||
AC_DEFINE(USE_TLS, 0, [Defined if we are using TLS])
|
||||
fi
|
||||
else # $ac_cv_want_tls is yes
|
||||
if test "x$ac_cv_tls" = "xno"; then
|
||||
AC_MSG_FAILURE([--enable-tls was given, but TLS is not supported])
|
||||
else
|
||||
AC_DEFINE(USE_TLS, 1, [Defined if we are using TLS])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ bin_PROGRAMS = fldigi
|
|||
AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/irrxml @BOOST_CPPFLAGS@
|
||||
|
||||
AM_CXXFLAGS = @PORTAUDIO_CFLAGS@ @FLTK_CFLAGS@ @SNDFILE_CFLAGS@ \
|
||||
@SAMPLERATE_CFLAGS@ @HAMLIB_CFLAGS@ \
|
||||
@SAMPLERATE_CFLAGS@ @PULSEAUDIO_CFLAGS@ @HAMLIB_CFLAGS@ \
|
||||
-pipe -Wall -O2 -ffast-math -fexceptions -finline-functions
|
||||
AM_CFLAGS = $(AM_CXXFLAGS)
|
||||
|
||||
LDADD = @PORTAUDIO_LIBS@ @BOOST_LDFLAGS@ @FLTK_LIBS@ @SNDFILE_LIBS@ \
|
||||
@SAMPLERATE_LIBS@ @HAMLIB_LIBS@ @RTLIB@
|
||||
@SAMPLERATE_LIBS@ @PULSEAUDIO_LIBS@ @HAMLIB_LIBS@ @RTLIB@
|
||||
|
||||
|
||||
SAMPLERATE_SRC = samplerate/common.h samplerate/fastest_coeffs.h \
|
||||
|
|
|
|||
|
|
@ -566,6 +566,7 @@ Fl_Group *AudioIO=(Fl_Group *)0;
|
|||
|
||||
static void cb_btnAudioIO(Fl_Round_Button* o, void*) {
|
||||
btnAudioIO[1]->value(0);
|
||||
btnAudioIO[2]->value(0);
|
||||
o->value(1);
|
||||
menuOSSDev->activate();
|
||||
menuPADev->deactivate();
|
||||
|
|
@ -576,10 +577,9 @@ progdefaults.changed = true;
|
|||
resetSoundCard();
|
||||
}
|
||||
|
||||
Fl_Round_Button *btnAudioIO[2]={(Fl_Round_Button *)0};
|
||||
|
||||
static void cb_btnAudioIO1(Fl_Round_Button* o, void*) {
|
||||
btnAudioIO[0]->value(0);
|
||||
btnAudioIO[2]->value(0);
|
||||
o->value(1);
|
||||
menuPADev->activate();
|
||||
menuOSSDev->deactivate();
|
||||
|
|
@ -590,6 +590,21 @@ progdefaults.changed = true;
|
|||
resetSoundCard();
|
||||
}
|
||||
|
||||
Fl_Round_Button *btnAudioIO[3]={(Fl_Round_Button *)0};
|
||||
|
||||
static void cb_btnAudioIO2(Fl_Round_Button* o, void*) {
|
||||
btnAudioIO[0]->value(0);
|
||||
btnAudioIO[1]->value(0);
|
||||
o->value(1);
|
||||
menuPADev->deactivate();
|
||||
menuOSSDev->deactivate();
|
||||
menuSampleRate->deactivate();
|
||||
scDevice = "localhost";
|
||||
progdefaults.btnAudioIOis = 2;
|
||||
progdefaults.changed = true;
|
||||
resetSoundCard();
|
||||
}
|
||||
|
||||
Fl_Input_Choice *menuOSSDev=(Fl_Input_Choice *)0;
|
||||
|
||||
static void cb_menuOSSDev(Fl_Input_Choice* o, void*) {
|
||||
|
|
@ -1176,6 +1191,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
|
|||
{ Fl_Group* o = tabWaterfall = new Fl_Group(0, 25, 405, 195, "W-fall");
|
||||
o->color((Fl_Color)51);
|
||||
o->selection_color((Fl_Color)51);
|
||||
o->hide();
|
||||
{ Fl_Tabs* o = new Fl_Tabs(0, 25, 405, 195);
|
||||
{ Fl_Group* o = new Fl_Group(0, 50, 400, 170, "Filters/Colors");
|
||||
{ Fl_Group* o = new Fl_Group(5, 55, 390, 42, "FFT Prefilter");
|
||||
|
|
@ -1542,7 +1558,6 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
|
|||
{ Fl_Group* o = tabSoundCard = new Fl_Group(0, 25, 400, 195, "SndCrd");
|
||||
o->color((Fl_Color)51);
|
||||
o->selection_color((Fl_Color)51);
|
||||
o->hide();
|
||||
{ Fl_Tabs* o = tabsSoundCard = new Fl_Tabs(0, 25, 400, 195);
|
||||
o->selection_color((Fl_Color)10);
|
||||
{ Fl_Group* o = tabAudio = new Fl_Group(0, 50, 400, 170, "Audio");
|
||||
|
|
@ -1570,16 +1585,21 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
|
|||
{ Fl_Group* o = AudioIO = new Fl_Group(0, 55, 140, 70, "I/O");
|
||||
o->box(FL_ENGRAVED_FRAME);
|
||||
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
|
||||
{ Fl_Round_Button* o = btnAudioIO[0] = new Fl_Round_Button(25, 70, 95, 25, "OSS");
|
||||
{ Fl_Round_Button* o = btnAudioIO[0] = new Fl_Round_Button(35, 60, 100, 25, "OSS");
|
||||
o->down_box(FL_DIAMOND_DOWN_BOX);
|
||||
o->selection_color((Fl_Color)1);
|
||||
o->callback((Fl_Callback*)cb_btnAudioIO);
|
||||
}
|
||||
{ Fl_Round_Button* o = btnAudioIO[1] = new Fl_Round_Button(25, 95, 100, 25, "PortAudio");
|
||||
{ Fl_Round_Button* o = btnAudioIO[1] = new Fl_Round_Button(35, 80, 100, 25, "PortAudio");
|
||||
o->down_box(FL_DIAMOND_DOWN_BOX);
|
||||
o->selection_color((Fl_Color)1);
|
||||
o->callback((Fl_Callback*)cb_btnAudioIO1);
|
||||
}
|
||||
{ Fl_Round_Button* o = btnAudioIO[2] = new Fl_Round_Button(35, 100, 100, 25, "PulseAudio");
|
||||
o->down_box(FL_DIAMOND_DOWN_BOX);
|
||||
o->selection_color((Fl_Color)1);
|
||||
o->callback((Fl_Callback*)cb_btnAudioIO2);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Input_Choice* o = menuOSSDev = new Fl_Input_Choice(155, 60, 110, 25, "OSS device");
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
|
|||
code {} {}
|
||||
Fl_Window {} {
|
||||
label {fldigi - config} open
|
||||
xywh {528 602 400 255} type Double color 45 selection_color 51 align 80 visible
|
||||
xywh {663 306 400 255} type Double color 45 selection_color 51 align 80 visible
|
||||
} {
|
||||
Fl_Tabs tabsConfigure {open
|
||||
xywh {0 0 405 220} color 47 selection_color 9
|
||||
|
|
@ -90,7 +90,7 @@ progdefaults.changed = true;}
|
|||
}
|
||||
Fl_Group tabWaterfall {
|
||||
label {W-fall} open
|
||||
xywh {0 25 405 195} color 51 selection_color 51
|
||||
xywh {0 25 405 195} color 51 selection_color 51 hide
|
||||
} {
|
||||
Fl_Tabs {} {open
|
||||
xywh {0 25 405 195}
|
||||
|
|
@ -231,7 +231,7 @@ progdefaults.changed = true;}
|
|||
Fl_Check_Button btnWFaveraging {
|
||||
label {wf averaging}
|
||||
callback {progdefaults.WFaveraging = o->value();
|
||||
progdefaults.changed = true;} selected
|
||||
progdefaults.changed = true;}
|
||||
xywh {206 105 114 15} down_box DOWN_BOX
|
||||
code0 {o->value(progdefaults.WFaveraging);}
|
||||
}
|
||||
|
|
@ -637,7 +637,7 @@ o->label((inpQRZuserpassword->type() & FL_SECRET_INPUT) ? "Show" : "Hide");}
|
|||
}
|
||||
Fl_Group tabSoundCard {
|
||||
label SndCrd open
|
||||
xywh {0 25 400 195} color 51 selection_color 51 hide
|
||||
xywh {0 25 400 195} color 51 selection_color 51
|
||||
} {
|
||||
Fl_Tabs tabsSoundCard {open
|
||||
xywh {0 25 400 195} selection_color 10
|
||||
|
|
@ -681,6 +681,7 @@ progdefaults.changed = true;}
|
|||
Fl_Round_Button {btnAudioIO[0]} {
|
||||
label OSS
|
||||
callback {btnAudioIO[1]->value(0);
|
||||
btnAudioIO[2]->value(0);
|
||||
o->value(1);
|
||||
menuOSSDev->activate();
|
||||
menuPADev->deactivate();
|
||||
|
|
@ -689,11 +690,12 @@ scDevice = menuOSSDev->value();
|
|||
progdefaults.btnAudioIOis = 0;
|
||||
progdefaults.changed = true;
|
||||
resetSoundCard();}
|
||||
xywh {25 70 95 25} down_box DIAMOND_DOWN_BOX selection_color 1
|
||||
xywh {35 60 100 25} down_box DIAMOND_DOWN_BOX selection_color 1
|
||||
}
|
||||
Fl_Round_Button {btnAudioIO[1]} {
|
||||
label PortAudio
|
||||
callback {btnAudioIO[0]->value(0);
|
||||
btnAudioIO[2]->value(0);
|
||||
o->value(1);
|
||||
menuPADev->activate();
|
||||
menuOSSDev->deactivate();
|
||||
|
|
@ -702,7 +704,21 @@ scDevice = menuPADev->value();
|
|||
progdefaults.btnAudioIOis = 1;
|
||||
progdefaults.changed = true;
|
||||
resetSoundCard();}
|
||||
xywh {25 95 100 25} down_box DIAMOND_DOWN_BOX selection_color 1
|
||||
xywh {35 80 100 25} down_box DIAMOND_DOWN_BOX selection_color 1
|
||||
}
|
||||
Fl_Round_Button {btnAudioIO[2]} {
|
||||
label PulseAudio
|
||||
callback {btnAudioIO[0]->value(0);
|
||||
btnAudioIO[1]->value(0);
|
||||
o->value(1);
|
||||
menuPADev->deactivate();
|
||||
menuOSSDev->deactivate();
|
||||
menuSampleRate->deactivate();
|
||||
scDevice = "localhost";
|
||||
progdefaults.btnAudioIOis = 2;
|
||||
progdefaults.changed = true;
|
||||
resetSoundCard();} selected
|
||||
xywh {35 100 100 25} down_box DIAMOND_DOWN_BOX selection_color 1
|
||||
}
|
||||
}
|
||||
Fl_Input_Choice menuOSSDev {
|
||||
|
|
@ -768,7 +784,7 @@ progdefaults.changed = true;}
|
|||
label PCM
|
||||
callback {setPCMvolume(o->value());
|
||||
progdefaults.changed = true;}
|
||||
xywh {19 125 340 21} type {Horz Knob} color 26 selection_color 1 align 8 step 0.01 value 0.8 textsize 14
|
||||
xywh {19 125 340 21} type {Horz Knob} color 26 selection_color 1 align 8 value 0.8 textsize 14
|
||||
code0 {extern void setPCMvolume(double);}
|
||||
}
|
||||
Fl_Input_Choice menuMix {
|
||||
|
|
@ -921,14 +937,14 @@ progdefaults.changed = true;}
|
|||
label {Dash/Dot}
|
||||
callback {progdefaults.CWdash2dot=o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {205 185 64 21} type Simple align 4 minimum 2.5 maximum 4 step 0.1 value 3
|
||||
xywh {205 185 64 21} type Simple align 4 minimum 2.5 maximum 4 value 3
|
||||
code0 {o->value(progdefaults.CWdash2dot);}
|
||||
}
|
||||
Fl_Counter cntCWrisetime {
|
||||
label Edge
|
||||
callback {progdefaults.CWrisetime=o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {325 185 65 21} type Simple align 4 minimum 0 maximum 15 step 0.1 value 4
|
||||
xywh {325 185 65 21} type Simple align 4 minimum 0 maximum 15 value 4
|
||||
code0 {o->value(progdefaults.CWrisetime);}
|
||||
}
|
||||
Fl_Counter cntCWdefWPM {
|
||||
|
|
@ -987,7 +1003,7 @@ resetDOMEX();}
|
|||
label {BW factor:}
|
||||
callback {progdefaults.DOMINOEX_BW=o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {25 134 63 21} type Simple minimum 1 maximum 3 step 0.1 value 2
|
||||
xywh {25 134 63 21} type Simple minimum 1 maximum 3 value 2
|
||||
code0 {o->value(progdefaults.DOMINOEX_BW);}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,11 +237,11 @@ void cb_mnuSaveMacro(Fl_Menu_*, void*) {
|
|||
restoreFocus();
|
||||
}
|
||||
|
||||
bool logging = false;
|
||||
void cb_mnuLogFile(Fl_Menu_ *, void *) {
|
||||
logging = !logging;
|
||||
restoreFocus();
|
||||
}
|
||||
//bool logging = false;
|
||||
//void cb_mnuLogFile(Fl_Menu_ *, void *) {
|
||||
// logging = !logging;
|
||||
// restoreFocus();
|
||||
//}
|
||||
|
||||
void clean_exit() {
|
||||
if (progdefaults.changed == true) {
|
||||
|
|
@ -885,7 +885,8 @@ Fl_Menu_Item menu_[] = {
|
|||
{"&Files", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
|
||||
{"Open Macros", 0, (Fl_Callback*)cb_mnuOpenMacro, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
|
||||
{"Save Macros", 0, (Fl_Callback*)cb_mnuSaveMacro, 0, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
|
||||
{"Log File", 0, (Fl_Callback*)cb_mnuLogFile, 0, FL_MENU_DIVIDER | FL_MENU_TOGGLE, FL_NORMAL_LABEL, 0, 14, 0},
|
||||
//{"Log File", 0, (Fl_Callback*)cb_mnuLogFile, 0, FL_MENU_DIVIDER | FL_MENU_TOGGLE, FL_NORMAL_LABEL, 0, 14, 0},
|
||||
{"Log File", 0, 0, 0, FL_MENU_DIVIDER | FL_MENU_TOGGLE, FL_NORMAL_LABEL, 0, 14, 0},
|
||||
#if USE_SNDFILE
|
||||
{"Audio", 0, 0, 0, FL_MENU_DIVIDER | FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
|
||||
{"Rx capture", 0, (Fl_Callback*)cb_mnuCapture, 0, FL_MENU_TOGGLE, FL_NORMAL_LABEL, 0, 14, 0},//70
|
||||
|
|
@ -997,19 +998,25 @@ Fl_Menu_Item sample_rate_menu[] = {
|
|||
{ "88200" }, { "96000" }, { "192000" }, { 0 }
|
||||
};
|
||||
|
||||
void activate_rig_menu_item(bool b)
|
||||
Fl_Menu_Item *getMenuItem(char *caption)
|
||||
{
|
||||
Fl_Menu_Item *rig = 0;
|
||||
Fl_Menu_Item *item = 0;
|
||||
for (size_t i = 0; i < sizeof(menu_)/sizeof(menu_[0]); i++) {
|
||||
if (menu_[i].text && !strcmp(menu_[i].text, "Rig")) {
|
||||
rig = menu_ + i;
|
||||
if (menu_[i].text && !strcmp(menu_[i].text, caption)) {
|
||||
item = menu_ + i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!rig) {
|
||||
cerr << "FIXME: could not find Rig menu\n";
|
||||
if (!item)
|
||||
cerr << "FIXME: could not find '" << caption << "' menu\n";
|
||||
return item;
|
||||
}
|
||||
|
||||
void activate_rig_menu_item(bool b)
|
||||
{
|
||||
Fl_Menu_Item *rig = getMenuItem("Rig");
|
||||
if (!rig)
|
||||
return;
|
||||
}
|
||||
|
||||
if (b) {
|
||||
bSaveFreqList = true;
|
||||
|
|
@ -1391,7 +1398,7 @@ void put_Bandwidth(int bandwidth)
|
|||
void display_metric(double metric)
|
||||
{
|
||||
FL_LOCK_D();
|
||||
REQ(static_cast<void (Fl_Progress::*)(float)>(&Fl_Progress::value), pgrsSquelch, metric);
|
||||
REQ_DROP(static_cast<void (Fl_Progress::*)(float)>(&Fl_Progress::value), pgrsSquelch, metric);
|
||||
FL_UNLOCK_D();
|
||||
FL_AWAKE_D();
|
||||
}
|
||||
|
|
@ -1402,8 +1409,8 @@ void put_cwRcvWPM(double wpm)
|
|||
int L = progdefaults.CWlowerlimit;
|
||||
double dWPM = 100.0*(wpm - L)/(U - L);
|
||||
FL_LOCK_D();
|
||||
REQ(static_cast<void (Fl_Progress::*)(float)>(&Fl_Progress::value), prgsCWrcvWPM, dWPM);
|
||||
REQ(static_cast<int (Fl_Value_Output::*)(double)>(&Fl_Value_Output::value), valCWrcvWPM, (int)wpm);
|
||||
REQ_DROP(static_cast<void (Fl_Progress::*)(float)>(&Fl_Progress::value), prgsCWrcvWPM, dWPM);
|
||||
REQ_DROP(static_cast<int (Fl_Value_Output::*)(double)>(&Fl_Value_Output::value), valCWrcvWPM, (int)wpm);
|
||||
FL_UNLOCK_D();
|
||||
FL_AWAKE_D();
|
||||
}
|
||||
|
|
@ -1432,6 +1439,8 @@ void set_video(double *data, int len)
|
|||
digiscope->video(data, len);
|
||||
}
|
||||
|
||||
Fl_Menu_Item *mnuLogging = (Fl_Menu_Item *)0;
|
||||
|
||||
void put_rx_char(unsigned int data)
|
||||
{
|
||||
static unsigned int last = 0;
|
||||
|
|
@ -1471,8 +1480,10 @@ void put_rx_char(unsigned int data)
|
|||
if (Maillogfile)
|
||||
Maillogfile->log_to_file(cLogfile::LOG_RX, ascii2[data]);
|
||||
|
||||
if (logging)
|
||||
logfile->log_to_file(cLogfile::LOG_RX, ascii2[data]);
|
||||
if (!mnuLogging) mnuLogging = getMenuItem("Log File");
|
||||
if (mnuLogging)
|
||||
if (mnuLogging->value())
|
||||
logfile->log_to_file(cLogfile::LOG_RX, ascii2[data]);
|
||||
}
|
||||
|
||||
string strSecText = "";
|
||||
|
|
@ -1521,7 +1532,7 @@ void put_Status2(const char *msg)
|
|||
m[sizeof(m) - 1] = '\0';
|
||||
|
||||
FL_LOCK_D();
|
||||
REQ(static_cast<void (Fl_Box::*)(const char *)>(&Fl_Box::label), Status2, m);
|
||||
REQ_DROP(static_cast<void (Fl_Box::*)(const char *)>(&Fl_Box::label), Status2, m);
|
||||
FL_UNLOCK_D();
|
||||
FL_AWAKE_D();
|
||||
}
|
||||
|
|
@ -1533,7 +1544,7 @@ void put_Status1(const char *msg)
|
|||
m[sizeof(m) - 1] = '\0';
|
||||
|
||||
FL_LOCK_D();
|
||||
REQ(static_cast<void (Fl_Box::*)(const char *)>(&Fl_Box::label), Status1, m);
|
||||
REQ_DROP(static_cast<void (Fl_Box::*)(const char *)>(&Fl_Box::label), Status1, m);
|
||||
FL_UNLOCK_D();
|
||||
FL_AWAKE_D();
|
||||
}
|
||||
|
|
@ -1656,8 +1667,11 @@ void put_echo_char(unsigned int data)
|
|||
|
||||
if (Maillogfile)
|
||||
Maillogfile->log_to_file(cLogfile::LOG_TX, ascii2[data & 0x7F]);
|
||||
if (logging)
|
||||
logfile->log_to_file(cLogfile::LOG_TX, ascii2[data & 0x7F]);
|
||||
|
||||
if (!mnuLogging) mnuLogging = getMenuItem("Log File"); // should only be called once
|
||||
if (mnuLogging)
|
||||
if (mnuLogging->value())
|
||||
logfile->log_to_file(cLogfile::LOG_TX, ascii2[data & 0x7F]);
|
||||
}
|
||||
|
||||
void resetRTTY() {
|
||||
|
|
|
|||
|
|
@ -76,13 +76,11 @@ feld::~feld()
|
|||
if (hilbert) delete hilbert;
|
||||
if (bpfilt) delete bpfilt;
|
||||
if (bbfilt) delete bbfilt;
|
||||
// if (wfid) delete wfid;
|
||||
}
|
||||
|
||||
feld::feld(trx_mode m)
|
||||
{
|
||||
double lp;
|
||||
double flo, fhi;
|
||||
mode = m;
|
||||
samplerate = FeldSampleRate;
|
||||
FL_LOCK_D();
|
||||
|
|
@ -102,13 +100,7 @@ feld::feld(trx_mode m)
|
|||
|
||||
lp = 1.5 * bandwidth / 2.0 / samplerate;
|
||||
|
||||
fhi = (bandwidth / 2 + TxPixRate * 1.5) / samplerate;
|
||||
flo = (bandwidth / 2 - TxPixRate * 1.5) / samplerate;
|
||||
|
||||
if (mode == MODE_FSKHELL || mode == MODE_FSKH105)
|
||||
bpfilt = new fftfilt (flo, fhi, 1024);
|
||||
else
|
||||
bpfilt = new fftfilt(0, lp, 1024);
|
||||
bpfilt = new fftfilt(0, lp, 1024);
|
||||
|
||||
bbfilt = new Cmovavg(8);
|
||||
|
||||
|
|
@ -116,7 +108,6 @@ feld::feld(trx_mode m)
|
|||
|
||||
blackboard = false;
|
||||
hardkeying = false;
|
||||
// wfid = new id(this);
|
||||
|
||||
rxphacc = 0.0;
|
||||
txphacc = 0.0;
|
||||
|
|
@ -172,12 +163,6 @@ void feld::FSKHELL_rx(complex z)
|
|||
if (blackboard)
|
||||
vid = 255 - vid;
|
||||
|
||||
// x = z.mag();
|
||||
// if (x > peakhold)
|
||||
// peakhold = x;
|
||||
// else
|
||||
// peakhold *= (1 - 0.02 / RxColumnLen);
|
||||
|
||||
col_data[col_pointer + RxColumnLen] = vid;
|
||||
col_pointer++;
|
||||
if (col_pointer == RxColumnLen) {
|
||||
|
|
@ -214,8 +199,6 @@ void feld::rx(complex z)
|
|||
|
||||
x = CLAMP (x / peakhold, 0.0, 1.0);
|
||||
|
||||
// agc = decayavg(agc, peakhold - minhold, 40);
|
||||
|
||||
agc = minmaxfilt->run(peakhold - minhold);
|
||||
|
||||
metric = CLAMP(100*agc, 0.0, 100.0);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ extern Fl_Spinner *cntRxRateCorr;
|
|||
extern Fl_Spinner *cntTxRateCorr;
|
||||
extern Fl_Spinner *cntTxOffset;
|
||||
extern Fl_Group *AudioIO;
|
||||
extern Fl_Round_Button *btnAudioIO[2];
|
||||
extern Fl_Round_Button *btnAudioIO[3];
|
||||
#include <FL/Fl_Input_Choice.H>
|
||||
extern Fl_Input_Choice *menuOSSDev;
|
||||
extern Fl_Input_Choice *menuPADev;
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ struct configuration {
|
|||
string OSSdevice;
|
||||
string PAdevice;
|
||||
int sample_rate;
|
||||
string sample_converter;
|
||||
int RX_corr;
|
||||
int TX_corr;
|
||||
int TxOffset;
|
||||
|
|
|
|||
|
|
@ -95,9 +95,11 @@ extern Digiscope *digiscope;
|
|||
|
||||
extern void create_fl_digi_main();
|
||||
extern Fl_Menu_Item menu_[];
|
||||
extern Fl_Menu_Item *getMenuItem(char *caption);
|
||||
extern void activate_rig_menu_item(bool b);
|
||||
extern void activate_test_menu_item(bool b);
|
||||
|
||||
|
||||
extern void put_freq(double frequency);
|
||||
extern void put_Bandwidth(int bandwidth);
|
||||
extern void display_metric(double metric);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ protected:
|
|||
unsigned char *txptr;
|
||||
|
||||
double outbuf[OUTBUFSIZE];
|
||||
// these processes must be declared in the derived class
|
||||
|
||||
bool historyON;
|
||||
Digiscope::scope_mode scopemode;
|
||||
|
||||
double scdata[512];
|
||||
|
|
@ -69,6 +70,7 @@ public:
|
|||
modem();
|
||||
virtual ~modem(){};
|
||||
|
||||
// these processes must be declared in the derived class
|
||||
virtual void init();
|
||||
virtual void tx_init (SoundBase *sc) = 0;
|
||||
virtual void rx_init () = 0;
|
||||
|
|
@ -91,6 +93,8 @@ public:
|
|||
bool get_sqlchOnOff() { return squelchon;}
|
||||
void set_afcOnOff(int val) {afcon = val;}
|
||||
bool get_afcOnOff() { return afcon;}
|
||||
void HistoryON(bool val) {historyON = val;}
|
||||
bool HistoryON() { return historyON;}
|
||||
|
||||
// void set_mode(trx_mode);
|
||||
trx_mode get_mode();
|
||||
|
|
|
|||
|
|
@ -144,6 +144,8 @@ protected:
|
|||
int pfd[2];
|
||||
size_t npri;
|
||||
bool attached;
|
||||
public:
|
||||
bool drop_flag;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -151,19 +153,40 @@ extern qrunner *cbq[NUM_QRUNNER_THREADS];
|
|||
|
||||
|
||||
#define REQ REQ_ASYNC
|
||||
#define REQ_DROP REQ_ASYNC_DROP
|
||||
|
||||
#define REQ_ASYNC(...) \
|
||||
#define REQ_ASYNC(...) \
|
||||
do { \
|
||||
if (GET_THREAD_ID() != FLMAIN_TID) \
|
||||
cbq[GET_THREAD_ID()]->request(bind(__VA_ARGS__)); \
|
||||
else \
|
||||
bind(__VA_ARGS__)(); \
|
||||
} while (0)
|
||||
#define REQ_SYNC(...) \
|
||||
do { \
|
||||
if (GET_THREAD_ID() != FLMAIN_TID) \
|
||||
cbq[GET_THREAD_ID()]->request_sync(bind(__VA_ARGS__)); \
|
||||
else \
|
||||
bind(__VA_ARGS__)(); \
|
||||
} while (0)
|
||||
|
||||
#define REQ_ASYNC_DROP(...) \
|
||||
do { \
|
||||
if (GET_THREAD_ID() != FLMAIN_TID) \
|
||||
if (GET_THREAD_ID() != FLMAIN_TID) { \
|
||||
if (unlikely(cbq[GET_THREAD_ID()]->drop_flag)) \
|
||||
break; \
|
||||
cbq[GET_THREAD_ID()]->request(bind(__VA_ARGS__)); \
|
||||
} \
|
||||
else \
|
||||
bind(__VA_ARGS__)(); \
|
||||
} while (0)
|
||||
|
||||
#define REQ_SYNC(...) \
|
||||
#define REQ_SYNC_DROP(...) \
|
||||
do { \
|
||||
if (GET_THREAD_ID() != FLMAIN_TID) \
|
||||
if (GET_THREAD_ID() != FLMAIN_TID) { \
|
||||
if (unlikely(cbq[GET_THREAD_ID()]->drop_flag)) \
|
||||
break; \
|
||||
cbq[GET_THREAD_ID()]->request_sync(bind(__VA_ARGS__)); \
|
||||
} \
|
||||
else \
|
||||
bind(__VA_ARGS__)(); \
|
||||
} while (0)
|
||||
|
|
@ -177,6 +200,11 @@ extern qrunner *cbq[NUM_QRUNNER_THREADS];
|
|||
cbq[i]->flush(); \
|
||||
} while (0)
|
||||
|
||||
#define QRUNNER_DROP(v_) \
|
||||
do { \
|
||||
if ((GET_THREAD_ID() != FLMAIN_TID)) \
|
||||
cbq[GET_THREAD_ID()]->drop_flag = v_; \
|
||||
} while (0)
|
||||
|
||||
#endif // QRUNNER_H_
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@
|
|||
#if USE_PORTAUDIO
|
||||
#include <portaudio.h>
|
||||
#endif
|
||||
#if USE_PULSEAUDIO
|
||||
#include <pulse/simple.h>
|
||||
#include <pulse/error.h>
|
||||
#endif
|
||||
#include <samplerate.h>
|
||||
|
||||
#define MAXSC 32767.0;
|
||||
|
|
@ -48,29 +52,50 @@
|
|||
//#define SRC_BUF_LEN (8*SND_BUF_LEN)
|
||||
|
||||
|
||||
#define msgprefix std::string("Sound error: ")
|
||||
class SndException : public std::exception
|
||||
{
|
||||
public:
|
||||
SndException() : err(0) { }
|
||||
#if USE_PORTAUDIO
|
||||
SndException(int e) : err(e), msg(msgprefix + (e >= 0 ? strerror(e) : Pa_GetErrorText(e))) { }
|
||||
#else
|
||||
SndException(int e) : err(e), msg(msgprefix + strerror(e)) { }
|
||||
#endif
|
||||
SndException(const char *s) : err(1), msg(msgprefix + s) { }
|
||||
~SndException() throw() { }
|
||||
const char *what(void) const throw() { return msg.c_str(); }
|
||||
int error(void) const { return err; }
|
||||
private:
|
||||
SndException(int err_ = 0) : err(err_), msg(std::string("Sound error: ") + err_to_str()) { }
|
||||
SndException(const char* msg_) : err(1), msg(msg_) { }
|
||||
virtual ~SndException() throw() { }
|
||||
|
||||
const char* what(void) const throw() { return msg.c_str(); }
|
||||
int error(void) const { return err; }
|
||||
|
||||
protected:
|
||||
virtual const char* err_to_str(void) { return strerror(err); }
|
||||
|
||||
int err;
|
||||
std::string msg;
|
||||
};
|
||||
#undef msgprefix
|
||||
|
||||
#if USE_PORTAUDIO
|
||||
class SndPortException : public SndException
|
||||
{
|
||||
public:
|
||||
SndPortException(int err_ = 0) : SndException(err_) { }
|
||||
SndPortException(const char* msg_) : SndException(msg_) { }
|
||||
protected:
|
||||
const char* err_to_str(void) { return Pa_GetErrorText(err); }
|
||||
};
|
||||
#endif
|
||||
|
||||
#if USE_PULSEAUDIO
|
||||
class SndPulseException : public SndException
|
||||
{
|
||||
public:
|
||||
SndPulseException(int err_ = 0) : SndException(err_) { }
|
||||
SndPulseException(const char* msg_) : SndException(msg_) { }
|
||||
protected:
|
||||
const char* err_to_str(void) { return pa_strerror(err); }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class SoundBase {
|
||||
protected:
|
||||
int sample_frequency;
|
||||
int sample_converter;
|
||||
int txppm;
|
||||
int rxppm;
|
||||
|
||||
|
|
@ -114,6 +139,7 @@ public:
|
|||
int Playback(bool val);
|
||||
int Generate(bool val);
|
||||
#endif
|
||||
static int get_converter(const char* name);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -221,4 +247,34 @@ private:
|
|||
|
||||
#endif // USE_PORTAUDIO
|
||||
|
||||
#endif
|
||||
#if USE_PULSEAUDIO
|
||||
|
||||
class SoundPulse : public SoundBase
|
||||
{
|
||||
public:
|
||||
SoundPulse(const char* dev);
|
||||
virtual ~SoundPulse();
|
||||
|
||||
int Open(int mode, int freq = 8000);
|
||||
void Close(void);
|
||||
int write_samples(double* buf, int count);
|
||||
int write_stereo(double* bufleft, double* bufright, int count);
|
||||
int Read(double *buf, int count);
|
||||
bool full_duplex(void) { return true; }
|
||||
|
||||
private:
|
||||
void src_data_reset(int mode);
|
||||
void resample(int mode, float *buf, int count, int max = 0);
|
||||
|
||||
private:
|
||||
double dev_sample_rate;
|
||||
pa_simple* in_stream;
|
||||
pa_simple* out_stream;
|
||||
pa_sample_spec stream_params;
|
||||
|
||||
float* fbuf;
|
||||
};
|
||||
|
||||
#endif // USE_PULSEAUDIO
|
||||
|
||||
#endif // SOUND_H
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ struct status {
|
|||
unsigned int VIEWERxpos;
|
||||
unsigned int VIEWERypos;
|
||||
bool VIEWERvisible;
|
||||
bool LOGenabled;
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
|||
76
src/main.cxx
76
src/main.cxx
|
|
@ -216,6 +216,7 @@ int main(int argc, char ** argv)
|
|||
|
||||
void sound_init(void)
|
||||
{
|
||||
#if USE_OSS
|
||||
glob_t gbuf;
|
||||
glob("/dev/dsp*", 0, NULL, &gbuf);
|
||||
for (size_t i = 0; i < gbuf.gl_pathc; i++)
|
||||
|
|
@ -224,9 +225,12 @@ void sound_init(void)
|
|||
progdefaults.OSSdevice = gbuf.gl_pathv[0];
|
||||
menuOSSDev->value(progdefaults.OSSdevice.c_str());
|
||||
globfree(&gbuf);
|
||||
|
||||
#endif
|
||||
|
||||
#if USE_PORTAUDIO
|
||||
SoundPort::initialize();
|
||||
if (SoundPort::devices().size() == 0)
|
||||
cerr << "PortAudio did not find any devices!\n";
|
||||
|
||||
for (SoundPort::device_iterator idev = SoundPort::devices().begin();
|
||||
idev != SoundPort::devices().end(); ++idev) {
|
||||
|
|
@ -234,16 +238,16 @@ void sound_init(void)
|
|||
s.append(Pa_GetHostApiInfo((*idev)->hostApi)->name).append("/").append((*idev)->name);
|
||||
|
||||
string::size_type i = s.find('/') + 1;
|
||||
// backslash-escape any slashes in the device name
|
||||
// backslash-escape any slashes in the device name
|
||||
while ((i = s.find('/', i)) != string::npos) {
|
||||
s.insert(i, 1, '\\');
|
||||
i += 2;
|
||||
}
|
||||
menuPADev->add(s.c_str());
|
||||
// set the initial value in the configuration structure
|
||||
if (progdefaults.PAdevice == "" && idev == SoundPort::devices().begin())
|
||||
progdefaults.PAdevice = (*idev)->name;
|
||||
}
|
||||
// set the initial value in the configuration structure
|
||||
if (progdefaults.PAdevice == "")
|
||||
progdefaults.PAdevice = (*(SoundPort::devices().begin() + Pa_GetDefaultOutputDevice()))->name;
|
||||
menuPADev->value(progdefaults.PAdevice.c_str());
|
||||
|
||||
btnAudioIO[1]->activate();
|
||||
|
|
@ -263,27 +267,49 @@ void sound_init(void)
|
|||
#endif
|
||||
|
||||
// set the Sound Card configuration tab to the correct initial values
|
||||
#if !USE_PORTAUDIO
|
||||
progdefaults.btnAudioIOis = 0;
|
||||
btnAudioIO[1]->deactivate();
|
||||
#endif
|
||||
#if !USE_OSS
|
||||
progdefaults.btnAudioIOis = 1;
|
||||
btnAudioIO[0]->deactivate();
|
||||
#endif
|
||||
if (progdefaults.btnAudioIOis == 0) {
|
||||
#if !USE_PORTAUDIO
|
||||
btnAudioIO[1]->deactivate();
|
||||
#endif
|
||||
#if !USE_PULSEAUDIO
|
||||
btnAudioIO[2]->deactivate();
|
||||
#endif
|
||||
if (progdefaults.btnAudioIOis == -1 || !btnAudioIO[progdefaults.btnAudioIOis]->active()) {
|
||||
for (size_t i = 0; i < sizeof(btnAudioIO)/sizeof(*btnAudioIO); i++) {
|
||||
if (btnAudioIO[i]->active()) {
|
||||
progdefaults.btnAudioIOis = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (progdefaults.btnAudioIOis) {
|
||||
case 0:
|
||||
scDevice = progdefaults.OSSdevice;
|
||||
btnAudioIO[0]->value(1);
|
||||
btnAudioIO[1]->value(0);
|
||||
btnAudioIO[2]->value(0);
|
||||
menuOSSDev->activate();
|
||||
menuPADev->deactivate();
|
||||
menuSampleRate->deactivate();
|
||||
} else {
|
||||
break;
|
||||
case 1:
|
||||
scDevice = progdefaults.PAdevice;
|
||||
btnAudioIO[0]->value(0);
|
||||
btnAudioIO[1]->value(1);
|
||||
btnAudioIO[2]->value(0);
|
||||
menuOSSDev->deactivate();
|
||||
menuPADev->activate();
|
||||
break;
|
||||
case 2:
|
||||
scDevice = "localhost";
|
||||
btnAudioIO[0]->value(0);
|
||||
btnAudioIO[1]->value(0);
|
||||
btnAudioIO[2]->value(1);
|
||||
menuOSSDev->deactivate();
|
||||
menuPADev->deactivate();
|
||||
break;
|
||||
}
|
||||
resetMixerControls();
|
||||
}
|
||||
|
|
@ -324,6 +350,12 @@ void generate_option_help(void) {
|
|||
<< " The default is: " << progdefaults.tx_msgid
|
||||
<< " or 0x" << hex << progdefaults.tx_msgid << dec << "\n\n"
|
||||
|
||||
<< " --resample CONVERTER\n"
|
||||
<< " Set the resampling method\n"
|
||||
<< " CONVERTER can be of `src-sinc-best-quality', `src-sinc-medium-quality',\n"
|
||||
" `src-sinc-fastest', `src-zero-order-hold', or `src-linear'\n"
|
||||
" The default is `src-sinc-fastest'\n\n"
|
||||
|
||||
<< " --version\n"
|
||||
<< " Print version information\n\n"
|
||||
|
||||
|
|
@ -403,8 +435,9 @@ int parse_args(int argc, char **argv, int& idx)
|
|||
enum { OPT_ZERO, OPT_RX_IPC_KEY, OPT_TX_IPC_KEY, OPT_CONFIG_DIR,
|
||||
OPT_FAST_TEXT, OPT_FONT, OPT_WFALL_WIDTH, OPT_WFALL_HEIGHT,
|
||||
OPT_WINDOW_WIDTH, OPT_WINDOW_HEIGHT, OPT_PROFILE, OPT_USE_CHECK,
|
||||
OPT_RESAMPLE,
|
||||
#if USE_PORTAUDIO
|
||||
OPT_ALLOW_FULL_DUPLEX, OPT_FRAMES_PER_BUFFER, OPT_SAMPLE_RATE,
|
||||
OPT_ALLOW_FULL_DUPLEX, OPT_FRAMES_PER_BUFFER,
|
||||
#endif
|
||||
OPT_EXIT_AFTER,
|
||||
OPT_HELP, OPT_VERSION };
|
||||
|
|
@ -423,10 +456,12 @@ int parse_args(int argc, char **argv, int& idx)
|
|||
{ "window-height", 1, 0, OPT_WINDOW_HEIGHT },
|
||||
{ "profile", 1, 0, OPT_PROFILE },
|
||||
{ "usechkbtns", 0, 0, OPT_USE_CHECK },
|
||||
|
||||
{ "resample", 1, 0, OPT_RESAMPLE },
|
||||
|
||||
#if USE_PORTAUDIO
|
||||
{ "full-duplex", 0, 0, OPT_ALLOW_FULL_DUPLEX },
|
||||
{ "frames-per-buf",1, 0, OPT_FRAMES_PER_BUFFER },
|
||||
{ "sample-rate", 1, 0, OPT_SAMPLE_RATE },
|
||||
#endif
|
||||
{ "exit-after", 1, 0, OPT_EXIT_AFTER },
|
||||
|
||||
|
|
@ -511,6 +546,14 @@ int parse_args(int argc, char **argv, int& idx)
|
|||
useCheckButtons = true;
|
||||
break;
|
||||
|
||||
case OPT_RESAMPLE:
|
||||
if (SoundBase::get_converter(optarg) == INT_MIN) {
|
||||
cerr << "Unknown converter `" << optarg << "'\n";
|
||||
goto help;
|
||||
}
|
||||
progdefaults.sample_converter = optarg;
|
||||
break;
|
||||
|
||||
#if USE_PORTAUDIO
|
||||
case OPT_ALLOW_FULL_DUPLEX:
|
||||
pa_allow_full_duplex = true;
|
||||
|
|
@ -518,10 +561,6 @@ int parse_args(int argc, char **argv, int& idx)
|
|||
case OPT_FRAMES_PER_BUFFER:
|
||||
pa_frames_per_buffer = strtol(optarg, 0, 10);
|
||||
break;
|
||||
case OPT_SAMPLE_RATE:
|
||||
cerr << "The --sample-rate switch is deprecated and will be removed in a future release\n";
|
||||
progdefaults.sample_rate = strtol(optarg, 0, 10);
|
||||
break;
|
||||
#endif // USE_PORTAUDIO
|
||||
|
||||
case OPT_EXIT_AFTER:
|
||||
|
|
@ -536,6 +575,7 @@ int parse_args(int argc, char **argv, int& idx)
|
|||
cout << version_text;
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
help:
|
||||
case '?':
|
||||
cerr << "Try `" << PACKAGE_NAME << " --help' for more information.\n";
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
|
|||
|
|
@ -133,11 +133,12 @@ configuration progdefaults = {
|
|||
"/dev/ttyS0", // PTTdev
|
||||
"fldigi ", // secondary text
|
||||
// Sound card
|
||||
0, // int btnAudioIOis
|
||||
-1, // int btnAudioIOis
|
||||
"", // string SCdevice;
|
||||
"", // string OSSdevice;
|
||||
"", // string PAdevice;
|
||||
0, // int sample_rate;
|
||||
"src-sinc-fastest", // string sample_converter;
|
||||
0, // int RX_corr;
|
||||
0, // int TX_corr;
|
||||
0, // int TxOffset;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ status progStatus = {
|
|||
40, // uint VIEWERnchars
|
||||
50, // uint VIEWERxpos
|
||||
50, // uint VIEWERypos
|
||||
false // bool VIEWERvisible
|
||||
false, // bool VIEWERvisible
|
||||
false // bool LOGenabled
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -67,6 +68,12 @@ void status::saveLastState()
|
|||
speed = wf->Speed();
|
||||
reflevel = progdefaults.wfRefLevel;
|
||||
ampspan = progdefaults.wfAmpSpan;
|
||||
|
||||
Fl_Menu_Item *mnulogging = getMenuItem("Log File");
|
||||
if (mnulogging)
|
||||
LOGenabled = mnulogging->value();
|
||||
else
|
||||
LOGenabled = false;
|
||||
|
||||
if (dlgViewer) {
|
||||
if (dlgViewer->visible()) {
|
||||
|
|
@ -104,6 +111,7 @@ void status::saveLastState()
|
|||
deffile << VIEWERxpos << endl;
|
||||
deffile << VIEWERypos << endl;
|
||||
deffile << VIEWERvisible << endl;
|
||||
deffile << LOGenabled << endl;
|
||||
deffile.close();
|
||||
}
|
||||
|
||||
|
|
@ -131,6 +139,7 @@ void status::initLastState()
|
|||
deffile >> VIEWERxpos;
|
||||
deffile >> VIEWERypos;
|
||||
deffile >> VIEWERvisible;
|
||||
deffile >> LOGenabled;
|
||||
deffile.close();
|
||||
progdefaults.wfRefLevel = reflevel;
|
||||
progdefaults.wfAmpSpan = ampspan;
|
||||
|
|
@ -175,4 +184,10 @@ void status::initLastState()
|
|||
if (VIEWERvisible == true)
|
||||
openViewer();
|
||||
|
||||
if (LOGenabled) {
|
||||
Fl_Menu_Item *mnulogging = getMenuItem("Log File");
|
||||
if (!mnulogging)
|
||||
return;
|
||||
mnulogging->set();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,7 +365,8 @@ void psk::afc()
|
|||
{
|
||||
if (!afcon)
|
||||
return;
|
||||
phaseafc();
|
||||
if (dcd == true)
|
||||
phaseafc();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "qrunner.h"
|
||||
|
||||
qrunner::qrunner(size_t npri_)
|
||||
: npri(npri_), attached(false)
|
||||
: npri(npri_), attached(false), drop_flag(false)
|
||||
{
|
||||
fifo = new fqueue(2048, npri);
|
||||
if (pipe(pfd) == -1)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@
|
|||
|
||||
|
||||
SoundBase::SoundBase()
|
||||
: sample_frequency(0), txppm(progdefaults.TX_corr), rxppm(progdefaults.RX_corr),
|
||||
: sample_frequency(0), sample_converter(get_converter(progdefaults.sample_converter.c_str())),
|
||||
txppm(progdefaults.TX_corr), rxppm(progdefaults.RX_corr),
|
||||
tx_src_state(0), tx_src_data(0), rx_src_state(0), rx_src_data(0),
|
||||
snd_buffer(0), src_buffer(0),
|
||||
#if USE_SNDFILE
|
||||
|
|
@ -256,6 +257,23 @@ void SoundBase::tag_file(SNDFILE *sndfile, const char *title)
|
|||
}
|
||||
#endif // USE_SNDFILE
|
||||
|
||||
int SoundBase::get_converter(const char* name)
|
||||
{
|
||||
if (!strcasecmp(name, "src-sinc-best-quality"))
|
||||
return SRC_SINC_BEST_QUALITY;
|
||||
else if (!strcasecmp(name, "src-sinc-medium-quality"))
|
||||
return SRC_SINC_MEDIUM_QUALITY;
|
||||
else if (!strcasecmp(name, "src-sinc-fastest"))
|
||||
return SRC_SINC_FASTEST;
|
||||
else if (!strcasecmp(name, "src-zero-order-hold"))
|
||||
return SRC_ZERO_ORDER_HOLD;
|
||||
else if (!strcasecmp(name, "src-linear"))
|
||||
return SRC_LINEAR;
|
||||
else
|
||||
return INT_MIN;
|
||||
}
|
||||
|
||||
|
||||
#if USE_OSS
|
||||
SoundOSS::SoundOSS(const char *dev ) {
|
||||
device = dev;
|
||||
|
|
@ -297,11 +315,11 @@ SoundOSS::SoundOSS(const char *dev ) {
|
|||
throw;
|
||||
}
|
||||
|
||||
rx_src_state = src_new(SRC_SINC_FASTEST, 2, &err);
|
||||
rx_src_state = src_new(sample_converter, 2, &err);
|
||||
if (rx_src_state == 0)
|
||||
throw SndException(src_strerror(err));
|
||||
|
||||
tx_src_state = src_new(SRC_SINC_FASTEST, 2, &err);
|
||||
tx_src_state = src_new(sample_converter, 2, &err);
|
||||
if (tx_src_state == 0)
|
||||
throw SndException(src_strerror(err));
|
||||
|
||||
|
|
@ -673,14 +691,14 @@ void SoundPort::initialize(void)
|
|||
int err;
|
||||
|
||||
if ((err = Pa_Initialize()) != paNoError)
|
||||
throw SndException(err);
|
||||
throw SndPortException(err);
|
||||
pa_init = true;
|
||||
|
||||
PaDeviceIndex ndev = Pa_GetDeviceCount();
|
||||
if ((ndev = Pa_GetDeviceCount()) < 0)
|
||||
throw SndException(ndev);
|
||||
throw SndPortException(ndev);
|
||||
if (ndev == 0)
|
||||
throw SndException("No available audio devices");
|
||||
throw SndPortException("No available audio devices");
|
||||
|
||||
devs.reserve(ndev);
|
||||
for (PaDeviceIndex i = 0; i < ndev; i++)
|
||||
|
|
@ -805,7 +823,7 @@ int SoundPort::Read(double *buf, int count)
|
|||
cerr << "Giving up\n";
|
||||
// fall through
|
||||
default:
|
||||
throw SndException(err);
|
||||
throw SndPortException(err);
|
||||
}
|
||||
}
|
||||
retries = 0;
|
||||
|
|
@ -866,7 +884,7 @@ int SoundPort::write_samples(double *buf, int count)
|
|||
cerr << "Giving up\n";
|
||||
// fall through
|
||||
default:
|
||||
throw SndException(err);
|
||||
throw SndPortException(err);
|
||||
}
|
||||
}
|
||||
retries = 0;
|
||||
|
|
@ -907,10 +925,10 @@ int SoundPort::write_stereo(double *bufleft, double *bufright, int count)
|
|||
cerr << "Giving up\n";
|
||||
// fall through
|
||||
default:
|
||||
throw SndException(err);
|
||||
throw SndPortException(err);
|
||||
}
|
||||
|
||||
throw SndException(err);
|
||||
throw SndPortException(err);
|
||||
}
|
||||
retries = 0;
|
||||
|
||||
|
|
@ -930,7 +948,7 @@ void SoundPort::src_data_reset(int mode)
|
|||
if (mode & 1 << O_RDONLY) {
|
||||
if (rx_src_state)
|
||||
src_delete(rx_src_state);
|
||||
rx_src_state = src_new(SRC_SINC_FASTEST, 2, &err);
|
||||
rx_src_state = src_new(sample_converter, 2, &err);
|
||||
if (!rx_src_state)
|
||||
throw SndException(src_strerror(err));
|
||||
rx_src_data->src_ratio = req_sample_rate / (dev_sample_rate * (1.0 + rxppm / 1e6));
|
||||
|
|
@ -938,7 +956,7 @@ void SoundPort::src_data_reset(int mode)
|
|||
if (mode & 1 << O_WRONLY) {
|
||||
if (tx_src_state)
|
||||
src_delete(tx_src_state);
|
||||
tx_src_state = src_new(SRC_SINC_FASTEST, 2, &err);
|
||||
tx_src_state = src_new(sample_converter, 2, &err);
|
||||
if (!tx_src_state)
|
||||
throw SndException(src_strerror(err));
|
||||
tx_src_data->src_ratio = dev_sample_rate * (1.0 + txppm / 1e6) / req_sample_rate;
|
||||
|
|
@ -993,7 +1011,7 @@ void SoundPort::init_stream(void)
|
|||
break;
|
||||
if (idev == devs.end()) {
|
||||
cerr << "PA_debug: could not find device \"" << device << "\"\n";
|
||||
idev = devs.begin();
|
||||
idev = devs.begin() + Pa_GetDefaultOutputDevice();
|
||||
}
|
||||
PaDeviceIndex idx = idev - devs.begin();
|
||||
|
||||
|
|
@ -1022,7 +1040,7 @@ void SoundPort::init_stream(void)
|
|||
|
||||
// we are unlikely to have an output-only device
|
||||
if ((*idev)->maxInputChannels == 0)
|
||||
throw SndException(EBUSY);
|
||||
throw SndPortException(EBUSY);
|
||||
|
||||
in_params.device = idx;
|
||||
in_params.channelCount = 2;
|
||||
|
|
@ -1057,10 +1075,10 @@ void SoundPort::start_stream(void)
|
|||
err = Pa_OpenStream(&stream, stream_params[STREAM_IN], stream_params[STREAM_OUT],
|
||||
dev_sample_rate, frames_per_buffer, paNoFlag, NULL, NULL);
|
||||
if (err != paNoError)
|
||||
throw SndException(err);
|
||||
throw SndPortException(err);
|
||||
if ((err = Pa_StartStream(stream)) != paNoError) {
|
||||
Close();
|
||||
throw SndException(err);
|
||||
throw SndPortException(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1072,7 +1090,7 @@ bool SoundPort::stream_active(void)
|
|||
int err;
|
||||
|
||||
if ((err = Pa_IsStreamActive(stream)) < 0)
|
||||
throw SndException(err);
|
||||
throw SndPortException(err);
|
||||
|
||||
return err == 1;
|
||||
}
|
||||
|
|
@ -1133,7 +1151,7 @@ double SoundPort::find_srate(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
throw SndException(err);
|
||||
throw SndPortException(err);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -1159,3 +1177,235 @@ void SoundPort::pa_perror(int err, const char* str)
|
|||
}
|
||||
|
||||
#endif // USE_PORTAUDIO
|
||||
|
||||
|
||||
#if USE_PULSEAUDIO
|
||||
|
||||
SoundPulse::SoundPulse(const char *dev)
|
||||
: dev_sample_rate(48000), in_stream(0), out_stream(0), fbuf(0)
|
||||
{
|
||||
try {
|
||||
rx_src_data = new SRC_DATA;
|
||||
tx_src_data = new SRC_DATA;
|
||||
}
|
||||
catch (const std::bad_alloc& e) {
|
||||
cerr << "Cannot create libsamplerate data structures\n";
|
||||
throw;
|
||||
}
|
||||
|
||||
try {
|
||||
snd_buffer = new float[2 * SND_BUF_LEN];
|
||||
src_buffer = new float[2 * SND_BUF_LEN];
|
||||
fbuf = new float[2 * SND_BUF_LEN];
|
||||
}
|
||||
catch (const std::bad_alloc& e) {
|
||||
cerr << "Cannot allocate libsamplerate buffers\n";
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
SoundPulse::~SoundPulse()
|
||||
{
|
||||
Close();
|
||||
delete [] fbuf;
|
||||
}
|
||||
|
||||
int SoundPulse::Open(int mode, int freq)
|
||||
{
|
||||
int old_sample_rate = sample_frequency;
|
||||
sample_frequency = freq;
|
||||
|
||||
if (in_stream && out_stream) {
|
||||
if (sample_frequency != old_sample_rate) {
|
||||
src_data_reset(1 << O_RDONLY | 1 << O_WRONLY);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
Close();
|
||||
stream_params.format = PA_SAMPLE_FLOAT32LE;
|
||||
stream_params.channels = 2;
|
||||
stream_params.rate = dev_sample_rate;
|
||||
|
||||
char sname[32];
|
||||
int err;
|
||||
snprintf(sname, sizeof(sname), "capture (%u)", getpid());
|
||||
if (!in_stream) {
|
||||
in_stream = pa_simple_new(NULL, PACKAGE_NAME, PA_STREAM_RECORD, NULL,
|
||||
sname, &stream_params, NULL, NULL, &err);
|
||||
if (!in_stream)
|
||||
throw SndPulseException(err);
|
||||
}
|
||||
|
||||
snprintf(sname, sizeof(sname), "playback (%u)", getpid());
|
||||
if (!out_stream) {
|
||||
out_stream = pa_simple_new(NULL, PACKAGE_NAME, PA_STREAM_PLAYBACK, NULL,
|
||||
sname, &stream_params, NULL, NULL, &err);
|
||||
if (!out_stream)
|
||||
throw SndPulseException(err);
|
||||
}
|
||||
|
||||
src_data_reset(1 << O_RDONLY | 1 << O_WRONLY);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SoundPulse::Close(void)
|
||||
{
|
||||
int err = PA_OK;
|
||||
if (in_stream) {
|
||||
pa_simple_drain(in_stream, &err);
|
||||
if (err != PA_OK)
|
||||
cerr << pa_strerror(err) << '\n';
|
||||
pa_simple_free(in_stream);
|
||||
in_stream = 0;
|
||||
}
|
||||
if (out_stream) {
|
||||
pa_simple_drain(out_stream, &err);
|
||||
if (err != PA_OK)
|
||||
cerr << pa_strerror(err) << '\n';
|
||||
pa_simple_free(out_stream);
|
||||
out_stream = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int SoundPulse::write_samples(double* buf, int count)
|
||||
{
|
||||
if (generate)
|
||||
writeGenerate(buf, count);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
fbuf[2*i] = fbuf[2*i + 1] = buf[i];
|
||||
|
||||
float *wbuf = fbuf;
|
||||
if (sample_frequency != dev_sample_rate || progdefaults.TX_corr != 0) {
|
||||
resample(1 << O_WRONLY, wbuf, count);
|
||||
wbuf = tx_src_data->data_out;
|
||||
count = tx_src_data->output_frames_gen;
|
||||
}
|
||||
|
||||
int err;
|
||||
if (pa_simple_write(out_stream, wbuf, count * sizeof(double), &err) == -1)
|
||||
throw SndPulseException(err);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
int SoundPulse::write_stereo(double* bufleft, double* bufright, int count)
|
||||
{
|
||||
if (generate)
|
||||
writeGenerate(bufleft, count);
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
fbuf[2*i] = bufleft[i];
|
||||
fbuf[2*i + 1] = bufright[i];
|
||||
}
|
||||
|
||||
float *wbuf = fbuf;
|
||||
if (sample_frequency != dev_sample_rate || progdefaults.TX_corr != 0) {
|
||||
resample(1 << O_WRONLY, wbuf, count);
|
||||
wbuf = tx_src_data->data_out;
|
||||
count = tx_src_data->output_frames_gen;
|
||||
}
|
||||
|
||||
int err;
|
||||
if (pa_simple_write(out_stream, wbuf, count * sizeof(double), &err) == -1)
|
||||
throw SndPulseException(err);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
int SoundPulse::Read(double *buf, int count)
|
||||
{
|
||||
int ncount = (int)MIN(SND_BUF_LEN, ceil(count / rx_src_data->src_ratio));
|
||||
|
||||
int err;
|
||||
if (pa_simple_read(in_stream, fbuf, sizeof(double) * ncount, &err) == -1)
|
||||
throw SndPulseException(err);
|
||||
|
||||
if (capture)
|
||||
writeCapture(buf, count);
|
||||
if (playback) {
|
||||
readPlayback(buf, count);
|
||||
if (progdefaults.EnableMixer) {
|
||||
double vol = valRcvMixer->value();
|
||||
for (int i = 0; i < count; i++)
|
||||
buf[i] *= vol;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
float *rbuf = fbuf;
|
||||
if (sample_frequency != dev_sample_rate || progdefaults.RX_corr != 0) {
|
||||
resample(1 << O_RDONLY, rbuf, ncount, count);
|
||||
rbuf = rx_src_data->data_out;
|
||||
count = rx_src_data->output_frames_gen;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
buf[i] = rbuf[2*i];
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void SoundPulse::src_data_reset(int mode)
|
||||
{
|
||||
int err;
|
||||
if (mode & 1 << O_RDONLY) {
|
||||
if (rx_src_state)
|
||||
src_delete(rx_src_state);
|
||||
rx_src_state = src_new(sample_converter, stream_params.channels, &err);
|
||||
if (!rx_src_state)
|
||||
throw SndException(src_strerror(err));
|
||||
rx_src_data->src_ratio = sample_frequency / (dev_sample_rate * (1.0 + rxppm / 1e6));
|
||||
}
|
||||
if (mode & 1 << O_WRONLY) {
|
||||
if (tx_src_state)
|
||||
src_delete(tx_src_state);
|
||||
tx_src_state = src_new(sample_converter, stream_params.channels, &err);
|
||||
if (!tx_src_state)
|
||||
throw SndException(src_strerror(err));
|
||||
tx_src_data->src_ratio = dev_sample_rate * (1.0 + txppm / 1e6) / sample_frequency;
|
||||
}
|
||||
}
|
||||
|
||||
void SoundPulse::resample(int mode, float *buf, int count, int max)
|
||||
{
|
||||
if (mode & 1 << O_RDONLY) {
|
||||
if (rxppm != progdefaults.RX_corr) {
|
||||
rxppm = progdefaults.RX_corr;
|
||||
rx_src_data->src_ratio = sample_frequency
|
||||
/ dev_sample_rate
|
||||
* (1.0 + rxppm / 1e6);
|
||||
src_set_ratio(rx_src_state, rx_src_data->src_ratio);
|
||||
}
|
||||
|
||||
rx_src_data->data_in = buf;
|
||||
rx_src_data->input_frames = count;
|
||||
rx_src_data->data_out = snd_buffer;
|
||||
rx_src_data->output_frames = max ? max : SND_BUF_LEN;
|
||||
rx_src_data->end_of_input = 0;
|
||||
|
||||
src_process(rx_src_state, rx_src_data);
|
||||
}
|
||||
else if (mode & 1 << O_WRONLY) {
|
||||
if (txppm != progdefaults.TX_corr) {
|
||||
txppm = progdefaults.TX_corr;
|
||||
tx_src_data->src_ratio = dev_sample_rate
|
||||
* (1.0 + txppm / 1e6)
|
||||
/ sample_frequency;
|
||||
src_set_ratio(tx_src_state, tx_src_data->src_ratio);
|
||||
}
|
||||
|
||||
tx_src_data->data_in = buf;
|
||||
tx_src_data->input_frames = count;
|
||||
tx_src_data->data_out = src_buffer;
|
||||
tx_src_data->output_frames = max ? max : SND_BUF_LEN;
|
||||
tx_src_data->end_of_input = 0;
|
||||
|
||||
src_process(tx_src_state, tx_src_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // USE_PULSEAUDIO
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ modem::modem()
|
|||
reverse = wfrev ^ !wfsb;
|
||||
afcon = true;
|
||||
squelchon = true;
|
||||
historyON = false;
|
||||
}
|
||||
|
||||
void modem::init()
|
||||
|
|
|
|||
|
|
@ -133,13 +133,17 @@ void trx_trx_receive_loop()
|
|||
else {
|
||||
bool afc = active_modem->get_afcOnOff();
|
||||
active_modem->set_afcOnOff(0);
|
||||
QRUNNER_DROP(true);
|
||||
active_modem->HistoryON(true);
|
||||
trxrb.get_rv(rbvec);
|
||||
if (rbvec[0].len)
|
||||
active_modem->rx_process(rbvec[0].buf, rbvec[0].len);
|
||||
if (rbvec[1].len)
|
||||
active_modem->rx_process(rbvec[1].buf, rbvec[1].len);
|
||||
QRUNNER_DROP(false);
|
||||
active_modem->set_afcOnOff(afc);
|
||||
bHistory = false;
|
||||
active_modem->HistoryON(false);
|
||||
}
|
||||
}
|
||||
if (!scard->full_duplex())
|
||||
|
|
@ -297,19 +301,27 @@ void trx_reset_loop()
|
|||
delete scard;
|
||||
scard = 0;
|
||||
}
|
||||
#if USE_PORTAUDIO && USE_OSS
|
||||
if (progdefaults.btnAudioIOis == 1)
|
||||
scard = new SoundPort(trx_scdev.c_str());
|
||||
else
|
||||
|
||||
switch (progdefaults.btnAudioIOis) {
|
||||
#if USE_OSS
|
||||
case 0:
|
||||
scard = new SoundOSS(trx_scdev.c_str());
|
||||
#else
|
||||
# if USE_PORTAUDIO
|
||||
scard = new SoundPort(trx_scdev.c_str());
|
||||
# endif
|
||||
# if USE_OSS
|
||||
scard = new SoundOSS(trx_scdev.c_str());
|
||||
# endif
|
||||
break;
|
||||
#endif
|
||||
#if USE_PORTAUDIO
|
||||
case 1:
|
||||
scard = new SoundPort(trx_scdev.c_str());
|
||||
break;
|
||||
#endif
|
||||
#if USE_PULSEAUDIO
|
||||
case 2:
|
||||
scard = new SoundPulse(trx_scdev.c_str());
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
trx_state = STATE_RX;
|
||||
}
|
||||
|
||||
|
|
@ -360,19 +372,26 @@ void trx_start(const char *scdev)
|
|||
}
|
||||
|
||||
if (scard) delete scard;
|
||||
#if USE_PORTAUDIO && USE_OSS
|
||||
if (progdefaults.btnAudioIOis == 1)
|
||||
scard = new SoundPort(scdev);
|
||||
else
|
||||
|
||||
switch (progdefaults.btnAudioIOis) {
|
||||
#if USE_OSS
|
||||
case 0:
|
||||
scard = new SoundOSS(scdev);
|
||||
#else
|
||||
# if USE_PORTAUDIO
|
||||
scard = new SoundPort(scdev);
|
||||
# endif
|
||||
# if USE_OSS
|
||||
scard = new SoundOSS(scdev);
|
||||
# endif
|
||||
break;
|
||||
#endif
|
||||
#if USE_PORTAUDIO
|
||||
case 1:
|
||||
scard = new SoundPort(scdev);
|
||||
break;
|
||||
#endif
|
||||
#if USE_PULSEAUDIO
|
||||
case 2:
|
||||
scard = new SoundPulse(scdev);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
trx_state = STATE_RX;
|
||||
_trx_tune = 0;
|
||||
|
|
|
|||
|
|
@ -27,13 +27,11 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "digiscope.h"
|
||||
|
||||
#include "modem.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "digiscope.h"
|
||||
#include "modem.h"
|
||||
#include "trx.h"
|
||||
#include "qrunner.h"
|
||||
|
||||
|
||||
|
|
@ -55,21 +53,17 @@ Digiscope::~Digiscope()
|
|||
|
||||
void Digiscope::video(double *data, int len )
|
||||
{
|
||||
if (active_modem->HistoryON()) return;
|
||||
|
||||
if (data == NULL || len == 0)
|
||||
return;
|
||||
|
||||
FL_LOCK_D();
|
||||
int W = w() - 4;
|
||||
int H = h() - 4;
|
||||
// video signal display
|
||||
// if (len < W)
|
||||
// for (int i = 0; i < W; i++)
|
||||
// vidline[3*i] = vidline[3*i+1] =
|
||||
// vidline[3*i+2] = (unsigned char)(data[i * W / len]);
|
||||
// else
|
||||
for (int i = 0; i < W; i++)
|
||||
vidline[3*i] = vidline[3*i+1] =
|
||||
vidline[3*i+2] = (unsigned char)(data[i * len / W]);
|
||||
for (int i = 0; i < W; i++)
|
||||
vidline[3*i] = vidline[3*i+1] =
|
||||
vidline[3*i+2] = (unsigned char)(data[i * len / W]);
|
||||
vidline[3*W/2] = 255;
|
||||
vidline[3*W/2+1] = 0;
|
||||
vidline[3*W/2+2] = 0;
|
||||
|
|
@ -83,13 +77,15 @@ void Digiscope::video(double *data, int len )
|
|||
memcpy (&vidbuf[3*W*linecnt], vidline, 3*W * sizeof(unsigned char));
|
||||
linecnt++;
|
||||
|
||||
REQ(&Digiscope::redraw, this);
|
||||
REQ_DROP(&Digiscope::redraw, this);
|
||||
FL_UNLOCK_D();
|
||||
FL_AWAKE_D();
|
||||
}
|
||||
|
||||
void Digiscope::data(double *data, int len, bool scale)
|
||||
{
|
||||
if (active_modem->HistoryON()) return;
|
||||
|
||||
if (data == 0) {
|
||||
memset(_buf, 0, MAX_LEN * sizeof(*_buf));
|
||||
return;
|
||||
|
|
@ -114,28 +110,32 @@ void Digiscope::data(double *data, int len, bool scale)
|
|||
else
|
||||
_buf[i] = 0.0;
|
||||
}
|
||||
REQ(&Digiscope::redraw, this);
|
||||
REQ_DROP(&Digiscope::redraw, this);
|
||||
FL_UNLOCK_D();
|
||||
FL_AWAKE_D();
|
||||
}
|
||||
|
||||
void Digiscope::phase(double ph, bool hl)
|
||||
{
|
||||
if (active_modem->HistoryON()) return;
|
||||
|
||||
FL_LOCK_D();
|
||||
_phase = ph;
|
||||
_highlight = hl;
|
||||
REQ(&Digiscope::redraw, this);
|
||||
REQ_DROP(&Digiscope::redraw, this);
|
||||
FL_UNLOCK_D();
|
||||
FL_AWAKE_D();
|
||||
}
|
||||
|
||||
void Digiscope::rtty(double flo, double fhi, double amp)
|
||||
{
|
||||
if (active_modem->HistoryON()) return;
|
||||
|
||||
FL_LOCK_D();
|
||||
_flo = flo;
|
||||
_fhi = fhi;
|
||||
_amp = amp;
|
||||
REQ(&Digiscope::redraw, this);
|
||||
REQ_DROP(&Digiscope::redraw, this);
|
||||
FL_UNLOCK_D();
|
||||
FL_AWAKE_D();
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ void Digiscope::mode(scope_mode md)
|
|||
vidline[3*W/2+2] = 0;
|
||||
for (int i = 0; i < H; i++)
|
||||
memcpy(&vidbuf[3*W*i], vidline, 3*W*sizeof(unsigned char) );
|
||||
REQ(&Digiscope::redraw, this);
|
||||
REQ_DROP(&Digiscope::redraw, this);
|
||||
FL_UNLOCK_D();
|
||||
FL_AWAKE_D();
|
||||
}
|
||||
|
|
@ -278,8 +278,7 @@ void Digiscope::draw_video()
|
|||
fl_draw_image(
|
||||
vidbuf,
|
||||
x() + 2, y() + 2,
|
||||
w() - 4, h() - 4);//,
|
||||
// 3, 3* (w() - 4));
|
||||
w() - 4, h() - 4);
|
||||
}
|
||||
|
||||
void Digiscope::draw()
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue