From 99cd80593ef5d3fe4c3505ca40727143da13480a Mon Sep 17 00:00:00 2001 From: Diane Bruce Date: Thu, 6 Jul 2006 13:44:34 +0000 Subject: [PATCH] - Cleaned up portaudio-v19 compile/clean a bit - Fixed more missing merges, start_threads needs to pass PttPort, devin_name devout_name - start_oss.c needs to use devin_name, devout_name git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@190 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Makefile.in | 11 +++++++++-- audio_init.F90 | 2 +- configure | 14 ++++++++++---- configure.ac | 3 +++ portaudio-v19/config.status | 2 +- start_oss.c | 36 ++++++++++++++++++++---------------- 6 files changed, 44 insertions(+), 24 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6e972d920..4ee345e89 100644 --- a/Makefile.in +++ b/Makefile.in @@ -86,15 +86,22 @@ OBJS2C = ${SRCS2C:.c=.o} # and mostly sorted # --db # +# @NEEDPORTAUDIO@ will be filled in with libportaudio.a if portaudio is used +# SRCS3C = ptt_unix.c igray.c wrapkarn.c cutil.c OBJS3C = ${SRCS3C:.c=.o} AUDIOSRCS = @AUDIO@ all: wsjt6 + JT65code: $(OBJS1) $(FC) -o JT65code $(OBJS1) -wsjt6: Audio.so #wsjt.spec +portaudio-v19/lib/libportaudio.a: + (cd portaudio-v19;./configure --with-jack=no) + (cd portaudio-v19;${MAKE}) + +wsjt6: @NEEDPORTAUDIO@ Audio.so #wsjt.spec # ${PYTHON} c:\python23\installer\Build.py wsjt.spec # ${RM} wsjt6 @@ -116,4 +123,4 @@ wsjt.spec: wsjt.py astro.py g.py options.py palettes.py smeter.py specjt.py .PHONY : clean clean: ${RM} -f *.o *.so *~ JT65code wsjt6 - + (cd portaudio-v19;${MAKE} clean) diff --git a/audio_init.F90 b/audio_init.F90 index ff6cd46b0..92bbb7c1e 100644 --- a/audio_init.F90 +++ b/audio_init.F90 @@ -70,7 +70,7 @@ subroutine audio_init(ndin,ndout) ! print*,'Audio INIT called.' ierr=start_threads(ndevin,ndevout,y1,y2,nmax,iwrite,iwave,nwave, & 11025,NSPB,TRPeriod,TxOK,ndebug,Transmitting, & - Tsec,ngo,nmode,tbuf,ibuf,ndsec) + Tsec,ngo,nmode,tbuf,ibuf,ndsec,PttPort,devin_name,devout_name) #endif diff --git a/configure b/configure index f9c47fc8c..f0e4329a0 100755 --- a/configure +++ b/configure @@ -2,7 +2,7 @@ # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for wsjt 5.9.2. # -# $Id: configure.ac 185 2006-07-05 03:49:02Z va3db $ +# $Id: configure.ac 187 2006-07-05 15:32:17Z va3db $ # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation @@ -311,7 +311,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT F77 FFLAGS ac_ct_F77 CPP EGREP SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RM CP MV LN SED AR LD TEST PYTHON F2PY G95 GFORTRAN OS CLOBBER FC_LIB_PATH FC AUDIO LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT F77 FFLAGS ac_ct_F77 CPP EGREP SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RM CP MV LN SED AR LD TEST PYTHON F2PY G95 GFORTRAN OS CLOBBER FC_LIB_PATH FC AUDIO NEEDPORTAUDIO LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -977,7 +977,7 @@ Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -$Id: configure.ac 185 2006-07-05 03:49:02Z va3db $ +$Id: configure.ac 187 2006-07-05 15:32:17Z va3db $ _ACEOF exit 0 fi @@ -6749,7 +6749,12 @@ _ACEOF AUDIO="a2d.f90 jtaudio.c start_portaudio.c" - LDFLAGS="-Lportaudio-v19/lib/libportaudio.a ${LDFLAGS} -lsamplerate" + NEEDPORTAUDIO="portaudio-v19/lib/libportaudio.a" + + LDFLAGS="portaudio-v19/lib/libportaudio.a ${LDFLAGS} -lsamplerate" +else + NEEDPORTAUDIO="" + fi if test "$jack" = yes; then @@ -7517,6 +7522,7 @@ s,@CLOBBER@,$CLOBBER,;t t s,@FC_LIB_PATH@,$FC_LIB_PATH,;t t s,@FC@,$FC,;t t s,@AUDIO@,$AUDIO,;t t +s,@NEEDPORTAUDIO@,$NEEDPORTAUDIO,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF diff --git a/configure.ac b/configure.ac index a83829d62..c7fb69c62 100644 --- a/configure.ac +++ b/configure.ac @@ -314,7 +314,10 @@ fi if test "$portaudio" = yes; then AC_DEFINE(USE_PORTAUDIO, 1, [Define if you want PORTAUDIO used.]) AC_SUBST(AUDIO, "a2d.f90 jtaudio.c start_portaudio.c") + AC_SUBST(NEEDPORTAUDIO, "portaudio-v19/lib/libportaudio.a") LDFLAGS="-Lportaudio-v19/lib/libportaudio.a ${LDFLAGS} -lsamplerate" +else + AC_SUBST(NEEDPORTAUDIO, "") fi if test "$jack" = yes; then diff --git a/portaudio-v19/config.status b/portaudio-v19/config.status index 9ca00d332..d2b8f073e 100755 --- a/portaudio-v19/config.status +++ b/portaudio-v19/config.status @@ -35,7 +35,7 @@ sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF /^[ ]*VPATH[ ]*=[^:]*$/d -s%@SHELL@%/usr/local/bin/bash%g +s%@SHELL@%/bin/sh%g s%@CFLAGS@%-g -O2 -Wall -pedantic -pipe -fPIC -DPA_LITTLE_ENDIAN%g s%@CPPFLAGS@%%g s%@CXXFLAGS@%%g diff --git a/start_oss.c b/start_oss.c index c241829e3..6009be2fc 100644 --- a/start_oss.c +++ b/start_oss.c @@ -80,7 +80,8 @@ start_threads_(int *ndevin, int *ndevout, short y1[], short y2[], int *nwave, int *nfsample, int *nsamperbuf, int *TRPeriod, int *TxOK, int *ndebug, int *Transmitting, double *Tsec, int *ngo, int *nmode, - double tbuf[], int *ibuf, int *ndsec) + double tbuf[], int *ibuf, int *ndsec, + char *PttPort, char *devin_name, char *devout_name) { pthread_t thread1,thread2; int iret1,iret2; @@ -90,14 +91,19 @@ start_threads_(int *ndevin, int *ndevout, short y1[], short y2[], int format; int channels; double dnfs; + int i; + char *p; + + p = strchr(devin_name, ' '); + if(p != NULL) + *p = '\0'; + + p = strchr(devin_name, '/'); + if(p != NULL) + snprintf(dsp_in, MAXDSPNAME, "%s", devin_name); /* assume /dev/... */ + else + snprintf(dsp_in, MAXDSPNAME, "/dev/%s", devin_name); - /* XXX OSS device is decoded from ndevin and ndevout - * This is not strictly speaking the way to do it and is - * probably specific to FreeBSD for now. - * i.e. the .0 addition is a vchan; I'll add configure magic later. --db - */ - snprintf(dsp_in, MAXDSPNAME, - "/dev/dsp%d.0", *ndevin); dsp_in[MAXDSPNAME] = '\0'; data.fd_in = open (dsp_in, O_RDWR, 0); @@ -107,15 +113,13 @@ start_threads_(int *ndevin, int *ndevout, short y1[], short y2[], exit(-1); } - if (*ndevin == *ndevout) { - data.fd_out = data.fd_in; - strncpy(dsp_out, dsp_in, sizeof(dsp_out)); - dsp_out[sizeof(dsp_out)] = '\0'; + data.fd_out = data.fd_in; + strncpy(dsp_out, dsp_in, sizeof(dsp_out)); + dsp_out[sizeof(dsp_out)] = '\0'; - if (ioctl(data.fd_in, SNDCTL_DSP_SETDUPLEX, 0) < 0) { - fprintf(stderr, "Cannot use %s for full duplex.\n", dsp_in); - exit(-1); - } + if (ioctl(data.fd_in, SNDCTL_DSP_SETDUPLEX, 0) < 0) { + fprintf(stderr, "Cannot use %s for full duplex.\n", dsp_in); + return(-1); } data.Tsec = Tsec;