- ok, this should enable Bobs portaudio fixes and ALSA depending on

--enable options. 

This will have to be cleaned up a lot more to minimise #ifdef's
a2d_() is needed for portaudio which is needed by both windows and *nix
but only a small piece of start_threads.c is needed for portaudio
the ALSA part is #ifdef'd out when USE_PORTAUDIO is enabled.
audio_init.f90 and a2d.f90 now have #ifdef's on USE_PORTAUDIO
instead of Win32.

Lots to do still.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@73 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Diane Bruce 2006-01-10 02:43:23 +00:00
parent bb05bf7662
commit 2858f3b9c9
6 changed files with 52 additions and 42 deletions

View File

@ -3,6 +3,7 @@ FC ?= @F77@
FFLAGS = @FFLAGS@ FFLAGS = @FFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
# #
# WSJT specific Fortran flags # WSJT specific Fortran flags
FFLAGS += -Wall -fbounds-check FFLAGS += -Wall -fbounds-check
@ -12,7 +13,7 @@ G95=@G95@
COMPILER=@G95_LIB_PATH@ COMPILER=@G95_LIB_PATH@
LDFLAGS += -L${COMPILER} LDFLAGS += -L${COMPILER}
LDFLAGS += -lpthread -lg2c LDFLAGS += -lg2c
PYTHON ?= @PYTHON@ PYTHON ?= @PYTHON@
RM ?= @RM@ RM ?= @RM@
@ -35,14 +36,19 @@ SRCS2F90 = a2d.f90 abc441.f90 astro0.f90 audio_init.f90 azdist0.f90 \
wsjtgen.f90 runqqq.f90 fivehz.f90 wsjtgen.f90 runqqq.f90 fivehz.f90
SRCS2F77 = wsjt1.f fsubs1.f fsubs.f astro.f astropak.f SRCS2F77 = wsjt1.f fsubs1.f fsubs.f astro.f astropak.f
# #
# ok, so far for Windows @AUDIO@ will be jtaudio.c since it uses portaudio # ok, so far for now
# for *nix @AUDIO@ will also be jtaudio.c for portaudio # Windows @AUDIO@ will be jtaudio.c since it uses portaudio
# for *nix @AUDIO@ will also be jtaudio.c and start_threads.c
# for portaudio
# for *nix @AUDIO@ will be start_threads.c for alsa # for *nix @AUDIO@ will be start_threads.c for alsa
# for *nix @AUDIO@ will be ?? for oss # for *nix @AUDIO@ will be ?? for oss
# #
# ptt_unix.c vs. ptt.c I'll sort out later. # ptt_unix.c vs. ptt.c I'll sort out later.
# ditto for cutil.c (only used on *nix) # ditto for cutil.c (only used on *nix)
# --db # --db
# jtaudio.c/start_threads.c mess will have to be sorted out later
# to minimise #ifdef's
# --db
# #
SRCS2C = ptt_unix.c igray.c wrapkarn.c cutil.c SRCS2C = ptt_unix.c igray.c wrapkarn.c cutil.c
SRCS2C += @AUDIO@ SRCS2C += @AUDIO@
@ -56,7 +62,7 @@ wsjt6: Audio.so #wsjt.spec
# ${RM} wsjt6 # ${RM} wsjt6
Audio.so: $(OBJS2C) Audio.so: $(OBJS2C)
${PYTHON} ${F2PY_PY} -c --verbose --opt="-O -cpp -D${OS} \ ${PYTHON} ${F2PY_PY} -c --verbose --opt="-O -cpp -D${CFLAGS} \
-fno-second-underscore" $(OBJS2C) -m Audio \ -fno-second-underscore" $(OBJS2C) -m Audio \
--f77exec=${G95} --f90exec=${G95} ${CPPFLAGS} ${LDFLAGS} \ --f77exec=${G95} --f90exec=${G95} ${CPPFLAGS} ${LDFLAGS} \
only: $(F2PYONLY) \ only: $(F2PYONLY) \

View File

@ -1,7 +1,8 @@
!---------------------------------------------------- a2d !---------------------------------------------------- a2d
subroutine a2d(iarg) subroutine a2d(iarg)
#ifdef Win32 #if 1
!--- # ifdef USE_PORTAUDIO
! Start the PortAudio streams for audio input and output. ! Start the PortAudio streams for audio input and output.
integer nchin(0:20),nchout(0:20) integer nchin(0:20),nchout(0:20)
include 'gcom1.f90' include 'gcom1.f90'

View File

@ -5,6 +5,8 @@ subroutine audio_init(ndin,ndout)
#ifdef Win32 #ifdef Win32
use dfmt use dfmt
integer Thread1,Thread2 integer Thread1,Thread2
#endif
#ifdef USE_PORTAUDIO
external a2d,decode1 external a2d,decode1
#endif #endif

27
configure vendored
View File

@ -2,7 +2,7 @@
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53 for wsjt 0.9. # Generated by GNU Autoconf 2.53 for wsjt 0.9.
# #
# $Id: configure.ac 70 2006-01-09 21:30:35Z va3db $ # $Id: configure.ac 71 2006-01-09 21:35:25Z va3db $
# #
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
@ -924,7 +924,7 @@ Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it. gives unlimited permission to copy, distribute and modify it.
$Id: configure.ac 70 2006-01-09 21:30:35Z va3db $ $Id: configure.ac 71 2006-01-09 21:35:25Z va3db $
_ACEOF _ACEOF
exit 0 exit 0
fi fi
@ -2198,7 +2198,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
CFLAGS="$OLD_CFLAGS" CFLAGS="$OLD_CFLAGS"
CPPFLAGS="-I/usr/local/include -I/usr/include/alsa ${CPPFLAGS}" CPPFLAGS="-I/usr/local/include -I/usr/include/alsa ${CPPFLAGS}"
LDFLAGS="-L/usr/local/lib ${LDFLAGS}" LDFLAGS="-L/usr/local/lib -lpthread ${LDFLAGS}"
echo "$as_me:$LINENO: checking uname -s for Cygwin, Solaris or HPUX" >&5 echo "$as_me:$LINENO: checking uname -s for Cygwin, Solaris or HPUX" >&5
echo $ECHO_N "checking uname -s for Cygwin, Solaris or HPUX... $ECHO_C" >&6 echo $ECHO_N "checking uname -s for Cygwin, Solaris or HPUX... $ECHO_C" >&6
@ -2236,15 +2236,15 @@ echo $ECHO_N "checking if $CC is Apple GCC... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $AppleGCC" >&5 echo "$as_me:$LINENO: result: $AppleGCC" >&5
echo "${ECHO_T}$AppleGCC" >&6 echo "${ECHO_T}$AppleGCC" >&6
WSJT_CFLAGS="$WSJT_CFLAGS -Wall -O0" CFLAGS="$CFLAGS -Wall -O0"
fi fi
if test "$ac_cv_prog_cc_g" = yes; then if test "$ac_cv_prog_cc_g" = yes; then
WSJT_CFLAGS="$WSJT_CFLAGS -g" CFLAGS="$CFLAGS -g"
fi fi
if test ! -z "$CFLAGS"; then if test ! -z "$CFLAGS"; then
WSJT_CFLAGS="$WSJT_CFLAGS $CFLAGS" CFLAGS="$CFLAGS $CFLAGS"
fi fi
@ -5556,11 +5556,10 @@ _ACEOF
fi fi
if test "$prefix" = "NONE"; then if test "$prefix" = "NONE"; then
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define WSJT_PREFIX "$ac_default_prefix" #define PREFIX "$ac_default_prefix"
_ACEOF _ACEOF
@ -5570,7 +5569,7 @@ else
prefix=`echo $prefix | sed 's/\/$//'` prefix=`echo $prefix | sed 's/\/$//'`
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define WSJT_PREFIX "$prefix" #define PREFIX "$prefix"
_ACEOF _ACEOF
@ -5614,7 +5613,7 @@ _ACEOF
AUDIO="start_threads.c" AUDIO="start_threads.c"
LDFLAGS="${LDFLAGS} -lpthreads -lasound" LDFLAGS="${LDFLAGS} -lpthread -lasound"
fi fi
if test "$oss" = yes; then if test "$oss" = yes; then
@ -5633,9 +5632,11 @@ cat >>confdefs.h <<\_ACEOF
#define USE_PORTAUDIO 1 #define USE_PORTAUDIO 1
_ACEOF _ACEOF
AUDIO="jtaudio.c" AUDIO="jtaudio.c start_threads.c"
LDFLAGS="${LDFLAGS} -lpthreads -lportaudio" LDFLAGS="${LDFLAGS} -lportaudio"
CFLAGS="${CFLAGS} -DUSE_PORTAUDIO"
CPPFLAGS="${CPPFLAGS} -DUSE_PORTAUDIO"
fi fi
@ -5689,6 +5690,7 @@ CPPFLAGS="${CPPFLAGS}"
LDFLAGS="${LDFLAGS}" LDFLAGS="${LDFLAGS}"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure # tests run on this system so they can be shared between configure
@ -6272,7 +6274,6 @@ s,@G95@,$G95,;t t
s,@G95_LIB_PATH@,$G95_LIB_PATH,;t t s,@G95_LIB_PATH@,$G95_LIB_PATH,;t t
s,@OS@,$OS,;t t s,@OS@,$OS,;t t
s,@CLOBBER@,$CLOBBER,;t t s,@CLOBBER@,$CLOBBER,;t t
s,@WSJT_CFLAGS@,$WSJT_CFLAGS,;t t
s,@AUDIO@,$AUDIO,;t t s,@AUDIO@,$AUDIO,;t t
CEOF CEOF

View File

@ -24,7 +24,7 @@ CFLAGS="$OLD_CFLAGS"
dnl Lets guess at some likely places for extra libs/includes XXX -db dnl Lets guess at some likely places for extra libs/includes XXX -db
CPPFLAGS="-I/usr/local/include -I/usr/include/alsa ${CPPFLAGS}" CPPFLAGS="-I/usr/local/include -I/usr/include/alsa ${CPPFLAGS}"
LDFLAGS="-L/usr/local/lib ${LDFLAGS}" LDFLAGS="-L/usr/local/lib -lpthread ${LDFLAGS}"
AC_MSG_CHECKING([uname -s for Cygwin, Solaris or HPUX]) AC_MSG_CHECKING([uname -s for Cygwin, Solaris or HPUX])
case `uname -s` in case `uname -s` in
@ -52,19 +52,19 @@ if test "$ac_cv_c_compiler_gnu" = yes; then
AC_MSG_RESULT($AppleGCC) AC_MSG_RESULT($AppleGCC)
WSJT_CFLAGS="$WSJT_CFLAGS -Wall -O0" CFLAGS="$CFLAGS -Wall -O0"
fi fi
dnl If we support -g, use it! dnl If we support -g, use it!
if test "$ac_cv_prog_cc_g" = yes; then if test "$ac_cv_prog_cc_g" = yes; then
WSJT_CFLAGS="$WSJT_CFLAGS -g" CFLAGS="$CFLAGS -g"
fi fi
dnl jdc -- If CFLAGS is defined, best use it everywhere... dnl jdc -- If CFLAGS is defined, best use it everywhere...
dnl NOTE: jv says it must be added to the *END*, because things like dnl NOTE: jv says it must be added to the *END*, because things like
dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid. dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
if test ! -z "$CFLAGS"; then if test ! -z "$CFLAGS"; then
WSJT_CFLAGS="$WSJT_CFLAGS $CFLAGS" CFLAGS="$CFLAGS $CFLAGS"
fi fi
@ -177,10 +177,9 @@ if test "$assert" = no; then
AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
fi fi
AC_SUBST(WSJT_CFLAGS)
if test "$prefix" = "NONE"; then if test "$prefix" = "NONE"; then
AC_DEFINE_UNQUOTED(WSJT_PREFIX, "$ac_default_prefix", [Prefix where wsjt is installed.]) AC_DEFINE_UNQUOTED(PREFIX, "$ac_default_prefix", [Prefix where wsjt is installed.])
else else
@ -188,7 +187,7 @@ dnl Don't get bitten by Cygwin's stupidity if the user specified
dnl a custom prefix with a trailing slash dnl a custom prefix with a trailing slash
prefix=`echo $prefix | sed 's/\/$//'` prefix=`echo $prefix | sed 's/\/$//'`
AC_DEFINE_UNQUOTED(WSJT_PREFIX, "$prefix", [Prefix where wsjt is installed.]) AC_DEFINE_UNQUOTED(PREFIX, "$prefix", [Prefix where wsjt is installed.])
fi fi
@ -220,7 +219,7 @@ AC_HELP_STRING([--enable-portaudio],[Force PORTAUDIO SOUND usage.]),
if test "$alsa" = yes; then if test "$alsa" = yes; then
AC_DEFINE(USE_ALSA, 1, [Define if you want ALSA used.]) AC_DEFINE(USE_ALSA, 1, [Define if you want ALSA used.])
AC_SUBST(AUDIO, "start_threads.c") AC_SUBST(AUDIO, "start_threads.c")
LDFLAGS="${LDFLAGS} -lpthreads -lasound" LDFLAGS="${LDFLAGS} -lpthread -lasound"
fi fi
if test "$oss" = yes; then if test "$oss" = yes; then
@ -228,10 +227,13 @@ if test "$oss" = yes; then
AC_SUBST(AUDIO, "jtaudio.c") AC_SUBST(AUDIO, "jtaudio.c")
fi fi
dnl XXX
if test "$portaudio" = yes; then if test "$portaudio" = yes; then
AC_DEFINE(USE_PORTAUDIO, 1, [Define if you want PORTAUDIO used.]) AC_DEFINE(USE_PORTAUDIO, 1, [Define if you want PORTAUDIO used.])
AC_SUBST(AUDIO, "jtaudio.c") AC_SUBST(AUDIO, "jtaudio.c start_threads.c")
LDFLAGS="${LDFLAGS} -lpthreads -lportaudio" LDFLAGS="${LDFLAGS} -lportaudio"
CFLAGS="${CFLAGS} -DUSE_PORTAUDIO"
CPPFLAGS="${CPPFLAGS} -DUSE_PORTAUDIO"
fi fi
dnl set conf flags dnl set conf flags
@ -270,6 +272,7 @@ fi
dnl dnl
AC_SUBST(CPPFLAGS, "${CPPFLAGS}") AC_SUBST(CPPFLAGS, "${CPPFLAGS}")
AC_SUBST(LDFLAGS, "${LDFLAGS}") AC_SUBST(LDFLAGS, "${LDFLAGS}")
AC_SUBST(CFLAGS)
AC_OUTPUT AC_OUTPUT

View File

@ -3,21 +3,18 @@
#include <pthread.h> #include <pthread.h>
#include "conf.h" #include "conf.h"
/* #ifdef USE_ALSA
* XXX This should have been caught in the sanity tests in configure --db
*/
#if defined(USE_ALSA) && !defined(HAS_ASOUNDLIB_H)
#error "You must have alsa support to use alsa"
#endif
#if defined(USE_ALSA) && defined(HAS_ASOUNDLIB_H)
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#endif #endif
#include <inttypes.h> #include <inttypes.h>
#include <time.h> #include <time.h>
#if defined(USE_ALSA) && defined(HAS_ASOUNDLIB_H) #ifdef USE_PORTAUDIO
extern a2d_();
#endif
#ifdef USE_ALSA
#if 1 #if 1
#define ALSA_LOG #define ALSA_LOG
@ -519,7 +516,7 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
int iarg1 = 1,iarg2 = 2; int iarg1 = 1,iarg2 = 2;
//int32_t rate=11025; //int32_t rate=11025;
int32_t rate=*nfsample; int32_t rate=*nfsample;
#if defined(USE_ALSA) && defined(HAS_ASOUNDLIB_H) #ifdef USE_ALSA
alsa_driver_capture.app_buffer_y1 = y1; alsa_driver_capture.app_buffer_y1 = y1;
alsa_driver_capture.app_buffer_y2 = y2; alsa_driver_capture.app_buffer_y2 = y2;
alsa_driver_capture.app_buffer_offset = iwrite; alsa_driver_capture.app_buffer_offset = iwrite;
@ -539,7 +536,7 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
#endif #endif
printf("start threads called\n"); printf("start threads called\n");
iret1 = pthread_create(&thread1,NULL,decode1_,&iarg1); iret1 = pthread_create(&thread1,NULL,decode1_,&iarg1);
#if defined(USE_ALSA) && defined(HAS_ASOUNDLIB_H) #ifdef USE_ALSA
/* Open audio card. */ /* Open audio card. */
ao_alsa_open(&alsa_driver_playback, &rate, SND_PCM_STREAM_PLAYBACK); ao_alsa_open(&alsa_driver_playback, &rate, SND_PCM_STREAM_PLAYBACK);
ao_alsa_open(&alsa_driver_capture, &rate, SND_PCM_STREAM_CAPTURE); ao_alsa_open(&alsa_driver_capture, &rate, SND_PCM_STREAM_CAPTURE);
@ -552,8 +549,8 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
snd_pcm_start(alsa_driver_capture.audio_fd); snd_pcm_start(alsa_driver_capture.audio_fd);
snd_pcm_prepare(alsa_driver_playback.audio_fd); snd_pcm_prepare(alsa_driver_playback.audio_fd);
//snd_pcm_start(alsa_driver_playback.audio_fd); //snd_pcm_start(alsa_driver_playback.audio_fd);
#else
/* snd_pcm_start */ /* snd_pcm_start */
//iret2 = pthread_create(&thread2,NULL,a2d_,&iarg2); iret2 = pthread_create(&thread2,NULL,a2d_,&iarg2);
#endif #endif
} }