mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-20 11:01:54 -05:00
- remove jack support for now
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@222 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
d782e29e37
commit
4f196eb750
47
configure
vendored
47
configure
vendored
@ -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.59 for wsjt 5.9.2.
|
# Generated by GNU Autoconf 2.59 for wsjt 5.9.2.
|
||||||
#
|
#
|
||||||
# $Id: configure.ac 187 2006-07-05 15:32:17Z va3db $
|
# $Id: configure.ac 190 2006-07-06 13:44:34Z va3db $
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003 Free Software Foundation, Inc.
|
# Copyright (C) 2003 Free Software Foundation, Inc.
|
||||||
# This configure script is free software; the Free Software Foundation
|
# This configure script is free software; the Free Software Foundation
|
||||||
@ -857,7 +857,6 @@ Optional Features:
|
|||||||
--enable-alsa Force ALSA SOUNDCARD usage.
|
--enable-alsa Force ALSA SOUNDCARD usage.
|
||||||
--enable-oss Force OSS SOUND usage.
|
--enable-oss Force OSS SOUND usage.
|
||||||
--enable-portaudio Force PORTAUDIO SOUND usage.
|
--enable-portaudio Force PORTAUDIO SOUND usage.
|
||||||
--enable-jack Force JACK usage.
|
|
||||||
--enable-g95 Use G95 compiler if available.
|
--enable-g95 Use G95 compiler if available.
|
||||||
--enable-gfortran Use gfortran compiler if available.
|
--enable-gfortran Use gfortran compiler if available.
|
||||||
|
|
||||||
@ -977,7 +976,7 @@ Copyright (C) 2003 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 187 2006-07-05 15:32:17Z va3db $
|
$Id: configure.ac 190 2006-07-06 13:44:34Z va3db $
|
||||||
_ACEOF
|
_ACEOF
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -2354,7 +2353,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Provide some information about the compiler.
|
# Provide some information about the compiler.
|
||||||
echo "$as_me:2357:" \
|
echo "$as_me:2356:" \
|
||||||
"checking for Fortran 77 compiler version" >&5
|
"checking for Fortran 77 compiler version" >&5
|
||||||
ac_compiler=`set X $ac_compile; echo $2`
|
ac_compiler=`set X $ac_compile; echo $2`
|
||||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
||||||
@ -3657,8 +3656,8 @@ else
|
|||||||
echo "${ECHO_T}no" >&6
|
echo "${ECHO_T}no" >&6
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract the first word of "gfortran41", so it can be a program name with args.
|
# Extract the first word of "gfortran42", so it can be a program name with args.
|
||||||
set dummy gfortran41; ac_word=$2
|
set dummy gfortran42; ac_word=$2
|
||||||
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||||
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
|
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
|
||||||
if test "${ac_cv_path_GFORTRAN+set}" = set; then
|
if test "${ac_cv_path_GFORTRAN+set}" = set; then
|
||||||
@ -6638,15 +6637,6 @@ else
|
|||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-jack or --disable-jack was given.
|
|
||||||
if test "${enable_jack+set}" = set; then
|
|
||||||
enableval="$enable_jack"
|
|
||||||
jack=$enableval
|
|
||||||
else
|
|
||||||
jack=no
|
|
||||||
fi;
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-g95 or --disable-g95 was given.
|
# Check whether --enable-g95 or --disable-g95 was given.
|
||||||
if test "${enable_g95+set}" = set; then
|
if test "${enable_g95+set}" = set; then
|
||||||
enableval="$enable_g95"
|
enableval="$enable_g95"
|
||||||
@ -6710,7 +6700,7 @@ FC="${FC}"
|
|||||||
|
|
||||||
|
|
||||||
if test "$alsa" != yes -a "$oss" != yes -a \
|
if test "$alsa" != yes -a "$oss" != yes -a \
|
||||||
"$portaudio" != yes -a "$jack" != yes; then
|
"$portaudio" != yes; then
|
||||||
if test $HAS_PORTAUDIO_H -eq 1; then
|
if test $HAS_PORTAUDIO_H -eq 1; then
|
||||||
portaudio=yes;
|
portaudio=yes;
|
||||||
elif test $HAS_ASOUNDLIB_H -eq 1; then
|
elif test $HAS_ASOUNDLIB_H -eq 1; then
|
||||||
@ -6751,23 +6741,12 @@ _ACEOF
|
|||||||
|
|
||||||
NEEDPORTAUDIO="portaudio-v19/lib/libportaudio.a"
|
NEEDPORTAUDIO="portaudio-v19/lib/libportaudio.a"
|
||||||
|
|
||||||
LDFLAGS="portaudio-v19/lib/libportaudio.a ${LDFLAGS} -lsamplerate"
|
LDFLAGS="-Lportaudio-v19/lib/libportaudio.a ${LDFLAGS} -lsamplerate"
|
||||||
else
|
else
|
||||||
NEEDPORTAUDIO=""
|
NEEDPORTAUDIO=""
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$jack" = yes; then
|
|
||||||
|
|
||||||
cat >>confdefs.h <<\_ACEOF
|
|
||||||
#define USE_JACK 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
AUDIO="start_jack.c"
|
|
||||||
|
|
||||||
LDFLAGS="${LDFLAGS} -ljack"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if test $HAS_ASOUNDLIB_H -eq 1; then
|
if test $HAS_ASOUNDLIB_H -eq 1; then
|
||||||
cat >>confdefs.h <<\_ACEOF
|
cat >>confdefs.h <<\_ACEOF
|
||||||
@ -6821,14 +6800,6 @@ echo "$as_me: error: You need soundcard.h to use --enable-oss" >&2;}
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$jack" = yes; then
|
|
||||||
if test $HAS_JACK_H -eq 0; then
|
|
||||||
{ { echo "$as_me:$LINENO: error: You need jack.h to use --enable-jack" >&5
|
|
||||||
echo "$as_me: error: You need jack.h to use --enable-jack" >&2;}
|
|
||||||
{ (exit 1); exit 1; }; }
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$portaudio" = yes; then
|
if test "$portaudio" = yes; then
|
||||||
if test $HAS_PORTAUDIO_H -eq 0; then
|
if test $HAS_PORTAUDIO_H -eq 0; then
|
||||||
{ { echo "$as_me:$LINENO: error: You need portaudio.h to use --enable-portaudio" >&5
|
{ { echo "$as_me:$LINENO: error: You need portaudio.h to use --enable-portaudio" >&5
|
||||||
@ -7818,10 +7789,6 @@ if test $oss == "yes"; then
|
|||||||
echo "Using oss.";
|
echo "Using oss.";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $jack == "yes"; then
|
|
||||||
echo "Using jack.";
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
|
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
|
||||||
echo
|
echo
|
||||||
|
30
configure.ac
30
configure.ac
@ -1,7 +1,6 @@
|
|||||||
dnl $Id$
|
dnl $Id$
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
|
|
||||||
dnl AC_PREREQ(2.59)
|
dnl AC_PREREQ(2.59)
|
||||||
|
|
||||||
dnl Sneaky way to get an Id tag into the configure script
|
dnl Sneaky way to get an Id tag into the configure script
|
||||||
@ -87,10 +86,10 @@ G95_LIB_PATH=`${G95} -print-file-name=`
|
|||||||
AC_MSG_RESULT(${G95_LIB_PATH})
|
AC_MSG_RESULT(${G95_LIB_PATH})
|
||||||
AC_PATH_PROG(GFORTRAN, gfortran)
|
AC_PATH_PROG(GFORTRAN, gfortran)
|
||||||
dnl
|
dnl
|
||||||
dnl FreeBSD currently installs gfortran as gfortran41, considered experimental
|
dnl FreeBSD currently installs gfortran as gfortran42
|
||||||
dnl See http://gcc.gnu.org/fortran/
|
dnl See http://gcc.gnu.org/fortran/
|
||||||
dnl
|
dnl
|
||||||
AC_PATH_PROG(GFORTRAN, gfortran41)
|
AC_PATH_PROG(GFORTRAN, gfortran42)
|
||||||
AC_MSG_CHECKING([gfortran lib path])
|
AC_MSG_CHECKING([gfortran lib path])
|
||||||
GFORTRAN_LIB_PATH=`${GFORTRAN} -print-file-name=`
|
GFORTRAN_LIB_PATH=`${GFORTRAN} -print-file-name=`
|
||||||
AC_MSG_RESULT(${GFORTRAN_LIB_PATH})
|
AC_MSG_RESULT(${GFORTRAN_LIB_PATH})
|
||||||
@ -233,13 +232,6 @@ AC_ARG_ENABLE(portaudio,
|
|||||||
AC_HELP_STRING([--enable-portaudio],[Force PORTAUDIO SOUND usage.]),
|
AC_HELP_STRING([--enable-portaudio],[Force PORTAUDIO SOUND usage.]),
|
||||||
[portaudio=$enableval], [portaudio=no])
|
[portaudio=$enableval], [portaudio=no])
|
||||||
|
|
||||||
dnl jack soundsupport
|
|
||||||
dnl =================
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(jack,
|
|
||||||
AC_HELP_STRING([--enable-jack],[Force JACK usage.]),
|
|
||||||
[jack=$enableval] , [jack=no])
|
|
||||||
|
|
||||||
dnl pick gfortran or g95
|
dnl pick gfortran or g95
|
||||||
dnl ====================
|
dnl ====================
|
||||||
|
|
||||||
@ -290,7 +282,7 @@ dnl set defaults
|
|||||||
dnl ============
|
dnl ============
|
||||||
|
|
||||||
if test "$alsa" != yes -a "$oss" != yes -a \
|
if test "$alsa" != yes -a "$oss" != yes -a \
|
||||||
"$portaudio" != yes -a "$jack" != yes; then
|
"$portaudio" != yes; then
|
||||||
if test $HAS_PORTAUDIO_H -eq 1; then
|
if test $HAS_PORTAUDIO_H -eq 1; then
|
||||||
[portaudio=yes];
|
[portaudio=yes];
|
||||||
elif test $HAS_ASOUNDLIB_H -eq 1; then
|
elif test $HAS_ASOUNDLIB_H -eq 1; then
|
||||||
@ -320,12 +312,6 @@ else
|
|||||||
AC_SUBST(NEEDPORTAUDIO, "")
|
AC_SUBST(NEEDPORTAUDIO, "")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$jack" = yes; then
|
|
||||||
AC_DEFINE(USE_JACK, 1, [Define if you want JACK used.])
|
|
||||||
AC_SUBST(AUDIO, "start_jack.c")
|
|
||||||
LDFLAGS="${LDFLAGS} -ljack"
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl set conf flags
|
dnl set conf flags
|
||||||
dnl ==============
|
dnl ==============
|
||||||
|
|
||||||
@ -364,12 +350,6 @@ if test "$oss" = yes; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$jack" = yes; then
|
|
||||||
if test $HAS_JACK_H -eq 0; then
|
|
||||||
AC_MSG_ERROR([You need jack.h to use --enable-jack])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$portaudio" = yes; then
|
if test "$portaudio" = yes; then
|
||||||
if test $HAS_PORTAUDIO_H -eq 0; then
|
if test $HAS_PORTAUDIO_H -eq 0; then
|
||||||
AC_MSG_ERROR([You need portaudio.h to use --enable-portaudio])
|
AC_MSG_ERROR([You need portaudio.h to use --enable-portaudio])
|
||||||
@ -416,10 +396,6 @@ if test $oss == "yes"; then
|
|||||||
echo "Using oss.";
|
echo "Using oss.";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $jack == "yes"; then
|
|
||||||
echo "Using jack.";
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
|
echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
|
||||||
echo
|
echo
|
||||||
|
393
start_jack.c
393
start_jack.c
@ -1,393 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <jack/types.h>
|
|
||||||
#include <jack/jack.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define AUDIOBUFSIZE 4096
|
|
||||||
#define FRAMESPERBUFFER 1024
|
|
||||||
|
|
||||||
char rcv_buf[AUDIOBUFSIZE]; /* XXX grab one from upper app later --db */
|
|
||||||
char tx_buf[AUDIOBUFSIZE]; /* XXX grab one from upper app later --db */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Lots of pieces stolen directly from jack simple_client.c
|
|
||||||
*/
|
|
||||||
jack_port_t *input_port;
|
|
||||||
jack_port_t *output_port;
|
|
||||||
jack_client_t *client;
|
|
||||||
void jack_read(void);
|
|
||||||
void jack_write(void);
|
|
||||||
|
|
||||||
/* a simple state machine for this client */
|
|
||||||
volatile enum {
|
|
||||||
Init,
|
|
||||||
Run,
|
|
||||||
Exit
|
|
||||||
} client_state = Init;
|
|
||||||
|
|
||||||
extern void decode1_(int *iarg);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* local state data referencing some gcom common fortran variables as well
|
|
||||||
*/
|
|
||||||
struct audio_data {
|
|
||||||
int fd_in; /* Audio fd in; used only locally in this function */
|
|
||||||
int fd_out; /* Audio fd out; used only locally in this function */
|
|
||||||
double *Tsec; /* Present time SoundIn,SoundOut */
|
|
||||||
double *tbuf; /* Tsec at time of input callback SoundIn */
|
|
||||||
int *iwrite; /* Write pointer to Rx ring buffer SoundIn */
|
|
||||||
int *ibuf; /* Most recent input buffer# SoundIn */
|
|
||||||
int *TxOK; /* OK to transmit? SoundIn */
|
|
||||||
int *ndebug; /* Write debugging info? GUI */
|
|
||||||
int *ndsec; /* Dsec in units of 0.1 s GUI */
|
|
||||||
int *Transmitting; /* Actually transmitting? SoundOut */
|
|
||||||
int *nwave; /* Number of samples in iwave SoundIn */
|
|
||||||
int *nmode; /* Which WSJT mode? GUI */
|
|
||||||
int *trperiod; /* Tx or Rx period in seconds GUI */
|
|
||||||
int nbuflen;
|
|
||||||
int nfs;
|
|
||||||
int16_t *y1; /* Ring buffer for audio channel 0 SoundIn */
|
|
||||||
int16_t *y2; /* Ring buffer for audio channel 1 SoundIn */
|
|
||||||
short *iwave;
|
|
||||||
}data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The process callback for this JACK application is called in a
|
|
||||||
* special realtime thread once for each audio cycle.
|
|
||||||
*
|
|
||||||
* This client follows a simple rule: when the JACK transport is
|
|
||||||
* running, copy the input port to the output. When it stops, exit.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
process (jack_nframes_t nframes, void *arg)
|
|
||||||
{
|
|
||||||
jack_default_audio_sample_t *in, *out;
|
|
||||||
jack_transport_state_t ts = jack_transport_query(client, NULL);
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (ts == JackTransportRolling) {
|
|
||||||
if (client_state == Init)
|
|
||||||
client_state = Run;
|
|
||||||
in = jack_port_get_buffer (input_port, nframes);
|
|
||||||
/* First hack */
|
|
||||||
if (nframes != 0) {
|
|
||||||
memcpy (rcv_buf, in, nframes);
|
|
||||||
jack_read();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
out = jack_port_get_buffer (output_port, nframes);
|
|
||||||
memcpy (out, in,
|
|
||||||
sizeof (jack_default_audio_sample_t) * nframes);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} else if (ts == JackTransportStopped) {
|
|
||||||
|
|
||||||
if (client_state == Run)
|
|
||||||
client_state = Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* JACK calls this shutdown_callback if the server ever shuts down or
|
|
||||||
* decides to disconnect the client.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
jack_shutdown (void *arg)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* start_threads()
|
|
||||||
* inputs - ndevin device number for input
|
|
||||||
* - ndevout device number for output
|
|
||||||
* - y1 short int array for channel 0
|
|
||||||
* - y2 short int array for channel 1
|
|
||||||
* - nmax
|
|
||||||
* - iwrite
|
|
||||||
* - iwave
|
|
||||||
* - nwave
|
|
||||||
* - rate
|
|
||||||
* - NSPB
|
|
||||||
* - TRPeriod
|
|
||||||
* - TxOK
|
|
||||||
* - ndebug debug output or not?
|
|
||||||
* - Transmitting
|
|
||||||
* - Tsec
|
|
||||||
* - ngo
|
|
||||||
* - nmode
|
|
||||||
* - tbuf
|
|
||||||
* - ibuf
|
|
||||||
* - ndsec
|
|
||||||
* output - ?
|
|
||||||
* side effects - Called from audio_init.f90 to start audio decode and
|
|
||||||
* OSS thread.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
|
|
||||||
int *nbuflen, int *iwrite, short iwave[],
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
pthread_t thread1,thread2;
|
|
||||||
int iret1,iret2;
|
|
||||||
int iarg1 = 1,iarg2 = 2;
|
|
||||||
int32_t rate=*nfsample;
|
|
||||||
double dnfs;
|
|
||||||
const char **ports;
|
|
||||||
const char *client_name;
|
|
||||||
jack_options_t options = JackNullOption;
|
|
||||||
jack_status_t status;
|
|
||||||
|
|
||||||
data.Tsec = Tsec;
|
|
||||||
data.tbuf = tbuf;
|
|
||||||
data.iwrite = iwrite;
|
|
||||||
data.ibuf = ibuf;
|
|
||||||
data.TxOK = TxOK;
|
|
||||||
data.ndebug = ndebug;
|
|
||||||
data.ndsec = ndsec;
|
|
||||||
data.Transmitting = Transmitting;
|
|
||||||
data.y1 = y1;
|
|
||||||
data.y2 = y2;
|
|
||||||
data.nbuflen = *nbuflen;
|
|
||||||
data.nmode = nmode;
|
|
||||||
data.nwave = nwave;
|
|
||||||
data.iwave = iwave;
|
|
||||||
data.nfs = *nfsample;
|
|
||||||
data.trperiod = TRPeriod;
|
|
||||||
|
|
||||||
dnfs=(double)*nfsample;
|
|
||||||
|
|
||||||
/* open a client connection to the JACK server */
|
|
||||||
|
|
||||||
client = jack_client_open ("wsjt", options, &status, NULL);
|
|
||||||
if (client == NULL) {
|
|
||||||
fprintf (stderr, "jack_client_open() failed, "
|
|
||||||
"status = 0x%2.0x\n", status);
|
|
||||||
if (status & JackServerFailed) {
|
|
||||||
fprintf (stderr, "Unable to connect to JACK server\n");
|
|
||||||
}
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
if (status & JackServerStarted) {
|
|
||||||
fprintf (stderr, "JACK server started\n");
|
|
||||||
}
|
|
||||||
if (status & JackNameNotUnique) {
|
|
||||||
client_name = jack_get_client_name(client);
|
|
||||||
fprintf (stderr, "unique name `%s' assigned\n", client_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* tell the JACK server to call `process()' whenever
|
|
||||||
* there is work to be done.
|
|
||||||
*/
|
|
||||||
|
|
||||||
jack_set_process_callback (client, process, 0);
|
|
||||||
|
|
||||||
/* tell the JACK server to call `jack_shutdown()' if
|
|
||||||
* it ever shuts down, either entirely, or if it
|
|
||||||
* just decides to stop calling us.
|
|
||||||
*/
|
|
||||||
|
|
||||||
jack_on_shutdown (client, jack_shutdown, 0);
|
|
||||||
|
|
||||||
/* display the current sample rate.
|
|
||||||
*/
|
|
||||||
|
|
||||||
printf ("engine sample rate: %" PRIu32 "\n",
|
|
||||||
jack_get_sample_rate (client));
|
|
||||||
|
|
||||||
/* create two ports */
|
|
||||||
|
|
||||||
input_port = jack_port_register (client, "input",
|
|
||||||
JACK_DEFAULT_AUDIO_TYPE,
|
|
||||||
JackPortIsInput, 0);
|
|
||||||
output_port = jack_port_register (client, "output",
|
|
||||||
JACK_DEFAULT_AUDIO_TYPE,
|
|
||||||
JackPortIsOutput, 0);
|
|
||||||
|
|
||||||
if ((input_port == NULL) || (output_port == NULL)) {
|
|
||||||
fprintf(stderr, "no more JACK ports available\n");
|
|
||||||
/* ZZZ close jack above */
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tell the JACK server that we are ready to roll. Our
|
|
||||||
* process() callback will start running now.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (jack_activate (client)) {
|
|
||||||
fprintf (stderr, "cannot activate client");
|
|
||||||
/* ZZZ close jack above */
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Connect the ports. You can't do this before the client is
|
|
||||||
* activated, because we can't make connections to clients
|
|
||||||
* that aren't running. Note the confusing (but necessary)
|
|
||||||
* orientation of the driver backend ports: playback ports are
|
|
||||||
* "input" to the backend, and capture ports are "output" from
|
|
||||||
* it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ports = jack_get_ports (client, NULL, NULL,
|
|
||||||
JackPortIsPhysical|JackPortIsOutput);
|
|
||||||
if (ports == NULL) {
|
|
||||||
fprintf(stderr, "no physical capture ports\n");
|
|
||||||
/* ZZZ close jack above */
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jack_connect (client, ports[0], jack_port_name (input_port))) {
|
|
||||||
fprintf (stderr, "cannot connect input ports\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
free (ports);
|
|
||||||
|
|
||||||
ports = jack_get_ports (client, NULL, NULL,
|
|
||||||
JackPortIsPhysical|JackPortIsInput);
|
|
||||||
if (ports == NULL) {
|
|
||||||
fprintf(stderr, "no physical playback ports\n");
|
|
||||||
/* ZZZ close jack above */
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (jack_connect (client, jack_port_name (output_port), ports[0])) {
|
|
||||||
fprintf (stderr, "cannot connect output ports\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
free (ports);
|
|
||||||
|
|
||||||
|
|
||||||
printf("Audio jack streams running normally.\n");
|
|
||||||
printf("******************************************************************\n");
|
|
||||||
|
|
||||||
printf("start_threads: creating thread for decode1\n");
|
|
||||||
// iret1 = pthread_create(&thread1, NULL,
|
|
||||||
// (void *(*)(void *))oss_loop, &iarg1);
|
|
||||||
// printf("start_threads: creating thread for decode1_\n");
|
|
||||||
iret2 = pthread_create(&thread2, NULL,
|
|
||||||
(void *(*)(void *))decode1_,&iarg2);
|
|
||||||
/* keep running until the transport stops */
|
|
||||||
#if 0
|
|
||||||
jack_client_close (client);
|
|
||||||
#endif
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* jack_read
|
|
||||||
*
|
|
||||||
* inputs - none
|
|
||||||
* output - none
|
|
||||||
* side effects -
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
jack_read(void)
|
|
||||||
{
|
|
||||||
struct timeval tv;
|
|
||||||
unsigned int i;
|
|
||||||
static int n=0;
|
|
||||||
static int n2=0;
|
|
||||||
static int ia=0;
|
|
||||||
static int ib=0;
|
|
||||||
static int ic=0;
|
|
||||||
static int16_t *in;
|
|
||||||
static int16_t *wptr;
|
|
||||||
static int TxOKz=0;
|
|
||||||
static int ncall=0;
|
|
||||||
static int nsec=0;
|
|
||||||
static double stime;
|
|
||||||
|
|
||||||
/* Get System time */
|
|
||||||
gettimeofday(&tv, NULL);
|
|
||||||
stime = (double) tv.tv_sec + ((double)tv.tv_usec / 1000000.0) +
|
|
||||||
*(data.ndsec) * 0.1;
|
|
||||||
*(data.Tsec) = stime;
|
|
||||||
|
|
||||||
ncall++;
|
|
||||||
|
|
||||||
/* increment buffer pointers only if data available */
|
|
||||||
ia=*(data.iwrite);
|
|
||||||
ib=*(data.ibuf);
|
|
||||||
data.tbuf[ib-1] = stime; /* convert to c index to store */
|
|
||||||
ib++;
|
|
||||||
if(ib>FRAMESPERBUFFER)
|
|
||||||
ib=1;
|
|
||||||
*(data.ibuf) = ib;
|
|
||||||
in = (int16_t *)rcv_buf; /* XXX */
|
|
||||||
for(i=0; i<FRAMESPERBUFFER; i++) {
|
|
||||||
data.y1[ia] = (*in++);
|
|
||||||
data.y2[ia] = (*in++);
|
|
||||||
ia++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ia >= data.nbuflen)
|
|
||||||
ia=0; //Wrap buffer pointer if necessary
|
|
||||||
*(data.iwrite) = ia; /* Save buffer pointer */
|
|
||||||
fivehz_(); /* Call fortran routine */
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
jack_write(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
static int n=0;
|
|
||||||
static int ic=0;
|
|
||||||
struct timeval tv;
|
|
||||||
static int n2=0;
|
|
||||||
static int16_t *wptr;
|
|
||||||
static int TxOKz=0;
|
|
||||||
static int nsec=0;
|
|
||||||
static double stime;
|
|
||||||
|
|
||||||
/* Get System time */
|
|
||||||
gettimeofday(&tv, NULL);
|
|
||||||
stime = (double) tv.tv_sec + ((double)tv.tv_usec / 1000000.0) +
|
|
||||||
*(data.ndsec) * 0.1;
|
|
||||||
*(data.Tsec) = stime;
|
|
||||||
|
|
||||||
if(*(data.TxOK) && (!TxOKz)) {
|
|
||||||
n=nsec/(*(data.trperiod));
|
|
||||||
ic = (int)(stime - *(data.trperiod)*n) * data.nfs;
|
|
||||||
ic = ic % *(data.nwave);
|
|
||||||
}
|
|
||||||
|
|
||||||
TxOKz = *(data.TxOK);
|
|
||||||
*(data.Transmitting) = *(data.TxOK);
|
|
||||||
wptr = (int16_t *)tx_buf; /* XXX */
|
|
||||||
if(*(data.TxOK)) {
|
|
||||||
for(i=0 ; i<FRAMESPERBUFFER; i++ ) {
|
|
||||||
n2 = data.iwave[ic];
|
|
||||||
addnoise_(&n2);
|
|
||||||
*wptr++ = n2; /* left */
|
|
||||||
*wptr++ = n2; /* right */
|
|
||||||
ic++;
|
|
||||||
if(ic >= *(data.nwave)) {
|
|
||||||
ic = ic % *(data.nwave); /* Wrap buffer pointer if necessary */
|
|
||||||
if(*(data.nmode) == 2)
|
|
||||||
*(data.TxOK) = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
memset(tx_buf, 0, AUDIOBUFSIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (write(data.fd_out, tx_buf, AUDIOBUFSIZE) < 0) {
|
|
||||||
fprintf(stderr, "Can't write to soundcard.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fivehztx_(); /* Call fortran routine */
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user