New upstream version 1.2.2
authorIOhannes m zmölnig <zmoelnig@umlautS.umlaeute.mur.at>
Sun, 3 Jan 2021 22:44:23 +0000 (23:44 +0100)
committerIOhannes m zmölnig <zmoelnig@umlautS.umlaeute.mur.at>
Sun, 3 Jan 2021 22:44:23 +0000 (23:44 +0100)
31 files changed:
.travis.yml
CHANGESLOG.txt
INSTALL.txt
README.md
WIN10BUILDINSTRUCTIONS.pdf [new file with mode: 0644]
documentation/documentation.cpp
scripts/README.md [new file with mode: 0644]
scripts/slork/die.bin [new file with mode: 0644]
scripts/slork/feedjack-cleanslate.bin [new file with mode: 0644]
scripts/slork/feedjack-client.bin [new file with mode: 0644]
scripts/slork/feedjack-clientconnect.bin [new file with mode: 0644]
scripts/slork/feedjack-launch-n-jacktrip-servers.bin [new file with mode: 0644]
scripts/slork/feedjack-launch-one-jacktrip-client.bin [new file with mode: 0644]
scripts/slork/feedjack-launchjack-even-without-motu.bin [new file with mode: 0644]
scripts/slork/feedjack-launchjack.bin [new file with mode: 0644]
scripts/slork/feedjack-remotespeakerconnect.bin [new file with mode: 0644]
scripts/slork/feedjack-server.bin [new file with mode: 0644]
scripts/slork/feedjack-serverconnect.bin [new file with mode: 0644]
scripts/test/client_connection_test.sh [new file with mode: 0755]
scripts/test/version_test.sh [new file with mode: 0755]
scripts/utility/record_jack_receiving_ports.sh [new file with mode: 0755]
src/AudioInterface.h
src/JackAudioInterface.cpp
src/JackAudioInterface.h
src/JackTrip.cpp
src/JackTrip.h
src/Settings.cpp
src/Settings.h
src/UdpHubListener.cpp
src/UdpHubListener.h
src/jacktrip_globals.h

index f551d998981c9573d6f265a6c3c2037c68fbae34..2fe76ba9d515b258689e8a85fb332aea4f9c3df4 100644 (file)
@@ -9,7 +9,7 @@ language:
 dist: bionic
 
 branches:
-  - master
+  - dev
 
 env:
   global:
index 3377943fdc77507801027354d771025d410e8dd5..00398724b62443c5ebe685df30f77a9942ba8433 100644 (file)
@@ -1,3 +1,8 @@
+---
+1.2.2 (main)
+- (added) bindPort range to reject oddball connections
+- (fixed) jack client name strings
+
 ---
 1.2.1 (master) (branch name will be deprecated)
 (main and dev) (new branches, respectively for stable and development)
index f8b23dc59f15c1c269bfc54b446488a3e4d95974..9d3ed5028230505a232077bc977a390771e98261 100644 (file)
-Jacktrip : Build Instructions for Linux and MacOS X\r
+Jacktrip : Build Instructions\r
 \r
 JackTrip: A System for High-Quality Audio Network Performance over the Internet.\r
 \r
----\r
-MacOS X (10.9 or higher) installation:\r
-\r
-If you are installing on MacOS X, a binary is provided with each release (download the latest release from https://github.com/jacktrip/jacktrip/releases before proceeding).\r
-You need to have a working jack installation on your machine (see below).\r
-\r
-To install (using Terminal):\r
-\r
-$ git clone https://github.com/jacktrip/jacktrip.git\r
-$ cd jacktrip/src\r
-$ sudo cp jacktrip /usr/local/bin/\r
-  (enter your password when prompted)\r
-\r
-$ sudo chmod 755 /usr/local/bin/jacktrip\r
-  (now you can run jacktrip from any directory using Terminal)\r
-\r
-\r
-\r
-To build using QtCreator (tested using QtCreator 4.11 and macOS 10.13.6):\r
-\r
-  * Open jacktrip.pro using QtCreator\r
-  * Choose a correctly configured Kit\r
-  * Install Jack:\r
-    brew install jack\r
-    brew install qjackctl\r
-\r
+The following are instructions for compiling Jacktrip from source.  Compiling from source is the best way to keep up with the latest changes, both stable and experimental.  For quicker ways to install Jacktrip, go to README.md in the root directory of the project.\r
 \r
+Steps:\r
+Dependencies\r
+Build\r
+Installation (Linux and OS X only)\r
+Installation or Build Verification\r
 ---\r
-Fedora installation (also tested on Ubuntu Studio):\r
+Dependencies(for all operating systems):\r
+g++\r
+Qt 5.14.2\r
+Jack\r
+Note: rtaudio is no longer a dependency\r
 \r
-To install on Fedora (and possibly other Linux distributions), you need qt5, jack-audio-connection-kit-devel, and rtaudio.\r
+All Linux\r
 \r
-How to install qt5 and other needed tools on Fedora: \r
+Fedora:\r
 dnf install qt5-devel\r
 dnf groupinstall "C Development Tools and Libraries"\r
 dnf groupinstall "Development Tools"\r
 dnf install jack-audio-connection-kit-devel alsa-lib-devel iperf qjackctl audacity git\r
+Clone the git repo and run ./build in the src directory or use QtCreator to compile\r
 \r
-Ubuntu Studio already comes with jack and qjackctl but you may have to install libjack-dev. Other basic tools can be installed on Ubuntu with:\r
-\r
-sudo apt install build-essential\r
-\r
+Ubuntu and Debian/Raspbian:\r
+apt install -y --no-install-recommends build-essential librtaudio-dev qt5-default autoconf automake libtool make libjack-jackd2-dev qjackctl audacity git\r
+Clone the git repo and run ./build in the src directory or use QtCreator to compile\r
 \r
-For rtaudio, if you don’t have the latest package, install from source:\r
-\r
-$ git clone https://github.com/thestk/rtaudio\r
-$ cd rtaudio\r
-$ bash autogen.sh\r
-$ ./configure --with-jack\r
-$ make\r
-$ sudo make install\r
-$ sudo ln -s /usr/local/lib/librtaudio.so.6 /lib64/\r
-\r
-Then to install jacktrip:\r
-\r
-$ git clone https://github.com/jacktrip/jacktrip.git\r
-$ cd jacktrip/src\r
-$ ./build\r
-$ sudo make install\r
-\r
-\r
----\r
-Dependencies:\r
-\r
-You need to have installed the libraries in your system:\r
-Qt 5.3 or higher\r
+Other Linux distributions:\r
+the latest Qt\r
 jack-audio-connection-kit-devel\r
-rtaudio\r
+Clone the git repo and run ./build in the src directory or use QtCreator to compile\r
 \r
 If you are using yum you can just install them (as root) with:\r
    yum install jack-audio-connection-kit-devel\r
 and install qt from the qt site.\r
 \r
-If you want to build on MacOS X, you need JackOSX\r
-http://www.jackosx.com/\r
-and Qt 5.3 or higher.\r
-\r
-It is also possible to build without jack, see below.\r
-\r
+OSX (skip the steps you don't need):\r
+\r
+Install Jack2 https://jackaudio.org/downloads/\r
+If this command returns the XCode version, you have it installed:\r
+xcodebuild -version\r
+If you don't have XCode, go to the AppStore to download and install it.\r
+If this command returns the version number of the package manager Homebrew, you have it installed:\r
+brew -v\r
+If you don't have Homebrew, install it:\r
+/bin/bash -c "$(curl -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install.sh)"\r
+To install git if you don't have it:\r
+brew install git\r
+brew install qjackctl\r
+Install and link qt5:\r
+brew install qt5\r
+brew link qt5 --force\r
+Clone the git repo and run ./build in the src directory or use QtCreator to compile\r
 \r
 ---\r
-Build:\r
+Build (Linux or Mac OS X):\r
+You can compile using the build script or QtCreator.\r
 \r
-If you're on Mac OS X or Fedora Linux and have all the dependencies installed,\r
-you can build by simply going to the /src directory and typing the following:\r
-    ./build\r
+To clone the repo in the Terminal:\r
+$ git clone https://github.com/jacktrip/jacktrip.git\r
 \r
-If you want to build without Jack support (meaning that you won't need jack installed\r
-to use the app) type the following:\r
-   ./build nojack\r
+To compile using the build script:\r
+$ cd jacktrip/src\r
+$ ./build\r
+$ cd ../builddir\r
+$ ls\r
+You should see a 'jacktrip' executable in this folder.\r
 \r
-If the previous script doesn't work on a different Linux flavor, try building\r
+If the build script doesn't work on a different Linux flavor, try building\r
 the Makefiles yourself. You'd need qmake. Then you can build by:\r
 $ qmake jacktrip.pro\r
 $ make release\r
 \r
-Or without Jack support:\r
-$ qmake -config nojack jacktrip.pro\r
-$ make release\r
+To build using QtCreator:\r
+  * Open jacktrip.pro using QtCreator\r
+  * Choose a correctly configured Kit\r
 \r
+On MacOS X, QtCreator places the 'jacktrip' executabe by default in a folder with a name like 'build-jacktrip-Desktop_x86_darwin_generic_mach_o_64bit-Release.'\r
 \r
-If you want to install (using Terminal): on the /builddir directory type:\r
+---\r
+Installation on MacOS X (10.9 or higher) or Linux:\r
 \r
+You need to have a working Jack installation on your machine (see Dependencies above).\r
+\r
+To install using Terminal (skip the first three steps if you've already followed the Build instructions above):\r
+\r
+$ git clone https://github.com/jacktrip/jacktrip.git\r
+$ cd jacktrip/src\r
+$ ./build\r
+$ cd ../builddir\r
 $ sudo cp jacktrip /usr/local/bin/\r
   (enter your password when prompted)\r
 \r
 $ sudo chmod 755 /usr/local/bin/jacktrip\r
   (now you can run jacktrip from any directory using Terminal)\r
-\r
-\r
+  \r
 ---\r
-WINDOWS (XP and later)\r
-\r
-Dependencies:\r
-\r
-- ASIO4all audio driver is required even with Audio interfaces that support ASIO: www.asio4all.com\r
-\r
-Installation:\r
+Installation Verification on MacOS X or Linux:\r
+If you have installed jacktrip, from anywhere in the Terminal, type:\r
+$ jacktrip -v\r
 \r
-Simply Run the setup file Jacktrip-1.1.exe, which will unpack Jacktrip in the directory of your choice,\r
-the default is Program Files/Jacktrip.\r
+If you have compiled from source without installing, in the /builddir directory type:\r
+$ ./jacktrip -v\r
 \r
-The installer also adds the executable Jacktrip.exe in the System32 directory, so that it can be executed\r
-from a command prompt from any working directory.\r
+If you see something like this, you have successfully installed Jacktrip:\r
+JackTrip VERSION: 1.xx\r
+Copyright (c) 2008-2020 Juan-Pablo Caceres, Chris Chafe.\r
+SoundWIRE group at CCRMA, Stanford University\r
 \r
-This executable (jacktrip.exe) can be found in the bin directory, along with the Dynamic\r
-Link Libraries (DLLs) it links to.\r
+Follow the link at the bottom of the page to use Jacktrip.\r
 \r
-\r
-Building:\r
-\r
-The easiest way to build is to download the free Qt Creator IDE from https://www.qt.io/download since the jacktrip buildscript is written in qmake.\r
-\r
-Use `git clone https://github.com/jacktrip/jacktrip.git` to download a fresh copy of the repo.\r
+---\r
+WINDOWS (XP and later)\r
+- ASIO4all audio driver is required even with Audio interfaces that support ASIO: www.asio4all.com.\r
+- Note: Some users have reported success using the PortAudio driver, though it is not currently supported.\r
+\r
+Building\r
+Note: WIN10BUILDINSTRUCTIONS.pdf (in the same directory as this file) has screenshots of the Windows 10 build process and step-by-step instructions.\r
+If you do not have Git installed, download it from https://git-scm.com/download/win.\r
+Open the command line by typing cmd.exe in the Windows search bar.\r
+Use the `cd` command to navigate to the directory where you would like to install jacktrip, e.g. `cd C:\Users\Your User Name\`.\r
+Use `git clone https://github.com/jacktrip/jacktrip.git` to download a fresh copy of the repo or `git pull` to update your repo.\r
+\r
+On Windows 10, the easiest way to build is in the command line:\r
+To add the location of qmake to the path, in the Windows search bar, type "environment variable" and click on the Environment Variables button in the Advanced tab of System Properties.  Find the Path variable in System variables, click Edit, and enter the location of qmake, e.g. `C:\Qt\5.15.0\mingw81_64\bin`, where 5.15.0 is the version of Qt you installed.\r
+To verify you have g++ installed, type `where g++` in the command line.  If the command returns `not found` rather than a path, go to the Qt Maintenance Tool, which might be in a directory such as `C:\Qt\maintenancetool.exe`, and remove, then reinstall Qt.\r
+In the command line, use the `cd` command to navigate to the project directory, e.g. `cd jacktrip` and execute the following commands:\r
+mkdir builddir (this step creates the build directory, and is only necessary if you're building for the first time)\r
+cd builddir\r
+qmake -spec win32-g++ ../src/jacktrip.pro (you may skip this step if you're building for the first time)\r
+mingw32-make clean (you may skip this step if you're building for the first time)\r
+qmake -spec win32-g++ ../src/jacktrip.pro\r
+mingw32-make release\r
+\r
+On earlier Windows versions, the easiest way to build is to download the free Qt Creator IDE from https://www.qt.io/download since the jacktrip buildscript is written in qmake.\r
 Open the `src/jacktrip.pro` and configure the project.\r
-\r
 Make sure to select the MinGW compiler (for example the one shipped with QtCreator).\r
 Building with Clang or Microsoft Visual Studio Compilers is currently not supported!\r
 \r
-\r
 Download Jack2 from https://jackaudio.org/downloads/\r
 Make sure to install Jack into `C:\Program Files (x86)\Jack` (as this is the path where the jacktrip build script will look for it).\r
 \r
 Hit build in QtCreator.\r
+Copy the dll files `Qt5Core.dll` and `Qt5Network.dll` from your compiler's bin directory, e.g. `C:\Qt\5.15.0\mingw81_64\bin` to the folder in your project where your `jacktrip.exe` is located, e.g. `C:\Users\Your Name\jacktrip\build-jacktrip-Desktop-Qt_5_15_0_MinGW_64_bit-Release\release`\r
+In the above example, 5.15.0 is the version of Qt MinGW 64 bit is the compiler.  The folder names may vary according to the Qt and compiler versions you are using.\r
 \r
 Note: compiling with modifications in the .pro file (like adding a new source or header file) requires\r
 qmake which is only available in the Qt Creator package.\r
 \r
----\r
+Build Verification:\r
+In the search field (Windows key + R), enter cmd.exe to open the command line.  Use the `cd` command to navigate to the directory where the executable jacktrip.exe is located, e.g. `C:\Users\Your Name\jacktrip\build-jacktrip-Desktop-Qt_5_15_0_MinGW_64_bit-Release\release`.\r
 \r
-BUILD WARNING\r
+From there, the following command should return the version of Jacktrip you installed:\r
+jacktrip.exe -v\r
 \r
-Always keep the /src and /externals directories under the same directory.\r
-\r
----\r
-Post Configuration\r
-Detailed instructions at\r
-http://ccrma.stanford.edu/groups/soundwire/software/jacktrip/\r
+If you see something like this, you have successfully installed Jacktrip:\r
+JackTrip VERSION: 1.xx\r
+Copyright (c) 2008-2020 Juan-Pablo Caceres, Chris Chafe.\r
+SoundWIRE group at CCRMA, Stanford University\r
 \r
+Follow the link below for instructions on how to use Jacktrip.\r
 \r
 ---\r
-Using JackTrip\r
+Post Configuration & Using Jacktrip:\r
 Detailed instructions at\r
-http://ccrma.stanford.edu/groups/soundwire/software/jacktrip/\r
+https://ccrma.stanford.edu/docs/common/IETF.html\r
index 201635edb58ae902d2f284fb9739461fda6dbd7f..717a575f46a5a8de36d8280eeba4a44a9d919a8c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -3,6 +3,20 @@ It supports any number of channels (as many as the computer/network can handle)
 
 You can use it between any combination of machines e.g., one end using Linux can connect to another using Mac OSX.
 
+# Installation
+## Linux ##
+Linux installation instructions can be found in INSTALL.txt in the src directory of the project.
+
+## OSX or Windows ##
+Installers and executables are the easiest way to install Jacktrip.
+
+OSX installer or executable: https://ccrma.stanford.edu/software/jacktrip/osx/index.html 
+- Temporary [link](https://www.dropbox.com/s/jb7vh9oiew50cm6/jacktrip-macos-installer-x64-1.2.1.pkg?dl=0) to JackTrip 1.2.1 installer (see more details [here](https://github.com/jacktrip/jacktrip/issues/158#issuecomment-699215590))
+
+Windows installer or executable: https://ccrma.stanford.edu/software/jacktrip/windows/index.html
+
+To keep up with the latest changes, both experimental and stable, follow instructions to compile from source in INSTALL.txt in the src directory of the project.
+
 # Raspberry Pi
 
 [paper](https://lac.linuxaudio.org/2019/doc/chafe2.pdf) accompanying jacktrip demo at [Linux Audio Conference 2019](https://lac.linuxaudio.org/2019/)
diff --git a/WIN10BUILDINSTRUCTIONS.pdf b/WIN10BUILDINSTRUCTIONS.pdf
new file mode 100644 (file)
index 0000000..28901e0
Binary files /dev/null and b/WIN10BUILDINSTRUCTIONS.pdf differ
index 4783844b9a82e1be95c9426644d84b57af8aeca6..fd7d3abe80818dc090eb052f922fbfcffcff07da 100644 (file)
@@ -67,7 +67,7 @@ Please read the documentation inside the packet to install.
 
 \subsection install_subsec_osx Mac OS X Requirements
 
-You'll need: <a href="http://www.jackosx.com/">Jack OS X</a>.
+You'll need: <a href="https://jackaudio.org/downloads/">Jack OS X</a>.
 The documentation explains how to install it and set it up, and it's highly recommended.
 
 Jack OS X comes with JackPilot to do the audio routing.
diff --git a/scripts/README.md b/scripts/README.md
new file mode 100644 (file)
index 0000000..df42ace
--- /dev/null
@@ -0,0 +1,12 @@
+# Scripts
+Unless otherwise noted, these scripts are written for Linux.
+
+## slork ##
+There are examples in these scripts of how to connect jack ports across system audio, jacktrip, and other programs.  Matt Wright wrote for them for the Stanford Laptop Orchestra (SLOrk).
+
+## test ##
+These test scripts can be run on a development branch or in CI.
+
+## utility ##
+Scripts for specific tasks such as recording all channels jack receives from applications like jacktrip.
+
diff --git a/scripts/slork/die.bin b/scripts/slork/die.bin
new file mode 100644 (file)
index 0000000..cef5a40
--- /dev/null
@@ -0,0 +1,14 @@
+killall chuck; killall miniAudicle; killall audicle
+kill -9 `ps -ef | grep /Applications/Max.app | awk '{print $2}'`
+kill -9 `ps -ef | grep /Applications/FaceTime.app | awk '{print $2}'`
+kill -9 `ps -ef | grep /Applications/Wekinator.app | awk '{print $2}'`
+kill -9 `ps -ef | grep FaceOSC_Wekinator_14Inputs.app | awk '{print $2}'`
+kill -9 `ps -ef | grep /users/lja/vr2019 | awk '{print $2}'`
+
+killall jacktrip; killall jackd
+
+killall FaceOSC; killall python
+killall Preview
+
+audiodevice input "MOTU UltraLite mk3 Hybrid"
+audiodevice output "MOTU UltraLite mk3 Hybrid"
diff --git a/scripts/slork/feedjack-cleanslate.bin b/scripts/slork/feedjack-cleanslate.bin
new file mode 100644 (file)
index 0000000..aef317d
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+echo killing jacktrip...
+killall jacktrip
+
+echo killing jackd...
+killall jackd
+
+echo the slate is clean
diff --git a/scripts/slork/feedjack-client.bin b/scripts/slork/feedjack-client.bin
new file mode 100644 (file)
index 0000000..eabdfc4
--- /dev/null
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+if test $# -ne 2; then
+    echo usage: $0 [client-number] [program]
+    echo  client-number is 1-12
+    echo  program is like a max patch or something
+
+    exit -1
+fi
+
+echo I hope you died
+echo Someday this script to check to see if Max or MiniAudicle or jacktrip.. are sunning...
+#die
+
+
+echo Launching Jack \(in the background\) and requiring MOTU
+feedjack-launchjack &
+
+if [ $? -eq 0 ]
+then
+    echo Jack seems to have launched OK.
+else
+    echo Had to set system to MOTU - please try again
+    exit 1
+fi
+
+# a little time for Jack to get settled
+sleep 2
+
+
+echo Launching Jacktrip client
+feedjack-launch-one-jacktrip-client $1 &
+
+# We can't check to see if it was successful because we have to launch
+# it in the background
+
+# if [ $? -eq 0 ]
+# then
+#    echo Jacktrip client seems to have launched OK.
+# else
+#    echo Could not launch jacktrip client - try again.
+#    exit 1
+# fi
+
+
+# Disconnect All - workaround to problem of jacktrip auto-connecting
+# to system audio.  We'll do feedjack-clientconnect later anyway.
+~/slork/bin/jmess-1.0.3 -D
+
+
+echo your program is \"$2\"
+
+# Now see what to launch on the client side
+
+if [ "$2" = "remotespeaker" ]
+then
+    sleep 10
+    echo This machine will just be a remote speaker
+    feedjack-remotespeakerconnect
+else
+
+    # should check to see whether Max is really needed...
+    echo launching max
+    open ~/slork/users/matt/max-choose-JackRouter.maxpat
+    
+    sleep 2
+
+    echo launching the program you asked for:
+    echo $2
+    open-in-dir $2
+
+
+
+    echo Waiting for Max and Jacktrip to finish initializing
+    sleep 10
+
+    echo trying feedjack-clientconnect - You may need to run it again
+    echo     feedjack-clientconnect
+
+    feedjack-clientconnect
+fi
diff --git a/scripts/slork/feedjack-clientconnect.bin b/scripts/slork/feedjack-clientconnect.bin
new file mode 100644 (file)
index 0000000..ee530f8
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# Disconnect All
+~/slork/bin/jmess-1.0.3 -D
+
+for PROG in Max miniAudicle
+ do
+    # Injection from MOTU input 1 (on the front!) into ${PROG}
+    jack_connect system:capture_1 ${PROG}:in1
+
+    # Hear from jacktrip to ${PROG}
+    jack_connect JackTrip:receive_1 ${PROG}:in2
+
+    # ${PROG} 1-6 to hemi
+    jack_connect ${PROG}:out1 system:playback_1
+    jack_connect ${PROG}:out2 system:playback_2
+    jack_connect ${PROG}:out3 system:playback_3
+    jack_connect ${PROG}:out4 system:playback_4
+    jack_connect ${PROG}:out5 system:playback_5
+    jack_connect ${PROG}:out6 system:playback_6
+
+    # Pre-fader say from ${PROG} to MOTU
+    jack_connect ${PROG}:out7 system:playback_7
+
+    # ${PROG} 1-6 to say (for injection)
+    echo \(special workaround for Kunwoo and Avery\)
+    jack_connect ${PROG}:out1 JackTrip:send_1
+    jack_connect ${PROG}:out2 JackTrip:send_1
+    jack_connect ${PROG}:out3 JackTrip:send_1
+    jack_connect ${PROG}:out4 JackTrip:send_1
+    jack_connect ${PROG}:out5 JackTrip:send_1
+    jack_connect ${PROG}:out6 JackTrip:send_1
+
+done
+
+
+# post-fader say to jacktrip
+jack_connect system:capture_3 JackTrip:send_1
+
+# post-fader say to hemi
+jack_connect system:capture_3 system:playback_1
+jack_connect system:capture_3 system:playback_2
+jack_connect system:capture_3 system:playback_3
+jack_connect system:capture_3 system:playback_4
+jack_connect system:capture_3 system:playback_5
+jack_connect system:capture_3 system:playback_6
diff --git a/scripts/slork/feedjack-launch-n-jacktrip-servers.bin b/scripts/slork/feedjack-launch-n-jacktrip-servers.bin
new file mode 100644 (file)
index 0000000..80f0dcc
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+echo Killing any running instances of jacktrip...
+killall jacktrip
+
+OUTPUTFILEPREFIX="/tmp/jacktrip-server-output-"
+rm $OUTPUTFILEPREFIX*
+
+echo Turning off wifi - thanks Tucker
+networksetup -setairportpower en0 off # disable wifi
+
+
+echo Launching 12 jacktrip servers...
+for i in {1..12}
+ do
+ echo Launching jacktrip server $i
+ let i10=i*10
+ JACKTRIP_CMD="jacktrip -s -z -n 1 -o $i10 --clientname node-$i "
+ OUTPUTFILE="$OUTPUTFILEPREFIX$i"
+ echo "   " $JACKTRIP_CMD
+ $JACKTRIP_CMD </dev/null &> $OUTPUTFILE &
+ echo "   " Redirecting output \(stdout and stderr\) to $OUTPUTFILE
+
+ # Disconnect All - workaround to problem of jacktrip auto-connecting to system audio.  We'll do feedjack-serverconnect later anyway.
+ ~/slork/bin/jmess-1.0.3 -D
+
+ done
+
+LIST_CMD="ls -l $OUTPUTFILEPREFIX*"
+echo $LIST_CMD
+$LIST_CMD
+echo "ls -l $OUTPUTFILEPREFIX*"
+
+echo now do feedjack-serverconnect
+#feedjack-serverconnect
diff --git a/scripts/slork/feedjack-launch-one-jacktrip-client.bin b/scripts/slork/feedjack-launch-one-jacktrip-client.bin
new file mode 100644 (file)
index 0000000..440254b
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+if test $# -ne 1; then
+    echo usage: $0 [client-number]
+    echo where client-number is 1-12
+    exit -1
+fi
+
+echo Killing any running instances of jacktrip...
+killall jacktrip
+
+#serverHostname="sine.local"
+serverHostname="quinoa.local"
+
+echo looking for server \($serverHostname\)...
+serverIP="$(ping -q -c1 $serverHostname | head -1 | awk -F'[()]' '{print $2}')"
+
+# if [ $? -eq 0 && ! -z "$serverIP" ]
+if [ ! -z "$serverIP" ]
+then
+    echo Yay found $serverHostname at IP $serverIP
+else
+    echo Oh no - cannot see $serverHostname on the network
+    echo Please check the ethernet cables and try again.
+    exit 1
+fi
+
+Echo
+echo serverIP is $serverIP
+
+
+let clientnum=$1
+echo you asked to be client $clientnum
+
+let offset=$clientnum*10
+echo so your port offset should be $offset
+
+command="/Users/slork/slork/bin/jacktrip-1.1 -c $serverIP -n 1 -o $offset -z"
+echo $command
+$command
+
diff --git a/scripts/slork/feedjack-launchjack-even-without-motu.bin b/scripts/slork/feedjack-launchjack-even-without-motu.bin
new file mode 100644 (file)
index 0000000..7b065b1
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+echo Launching Jack...
+jackd -dcoreaudio -r44100 -p256
+echo ...Jack has stopped
diff --git a/scripts/slork/feedjack-launchjack.bin b/scripts/slork/feedjack-launchjack.bin
new file mode 100644 (file)
index 0000000..e908990
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+echo Checking whether system sound input is MOTU...
+audiodevice input 2> /dev/null | grep MOTU
+if [ $? -eq 0 ]
+then
+    echo Yay found MOTU input!
+else
+    echo System sound input is not MOTU:
+    audiodevice input 2> /dev/null 
+    echo Attempting to set to MOTU:
+    system-sound-to-motu
+    echo Now try again...
+    exit 1
+fi
+
+echo Checking whether system sound output is MOTU...
+audiodevice output 2> /dev/null | grep MOTU
+if [ $? -eq 0 ]
+then
+    echo Yay found MOTU output!
+else
+    echo System sound output is not MOTU:
+    audiodevice output 2> /dev/null 
+    echo Attempting to set to MOTU:
+    system-sound-to-motu
+    echo Now try again...
+    exit 2
+fi
+
+
+feedjack-launchjack-even-without-motu
diff --git a/scripts/slork/feedjack-remotespeakerconnect.bin b/scripts/slork/feedjack-remotespeakerconnect.bin
new file mode 100644 (file)
index 0000000..fbe16d0
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Disconnect All
+~/slork/bin/jmess-1.0.3 -D
+
+    # Hear from jacktrip to hemi
+    jack_connect JackTrip:receive_1 system:playback_1
+    jack_connect JackTrip:receive_1 system:playback_2
+    jack_connect JackTrip:receive_1 system:playback_3
+    jack_connect JackTrip:receive_1 system:playback_4
+    jack_connect JackTrip:receive_1 system:playback_5
+    jack_connect JackTrip:receive_1 system:playback_6
diff --git a/scripts/slork/feedjack-server.bin b/scripts/slork/feedjack-server.bin
new file mode 100644 (file)
index 0000000..93e507b
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+echo die
+die
+
+
+echo Launching Jack even without MOTU \(in the background\)
+feedjack-launchjack-even-without-motu &
+
+# a little time for Jack to get settled
+sleep 10
+
+#echo Launching Jack \(in the background\)
+# feedjack-launchjack &
+
+
+echo launching max
+open ~/slork/users/matt/max-choose-JackRouter.maxpat
+open ~/matt/feedback/maxmsp/externals-OSX/shell.mxo 
+# should actually wait until shell finishes loading before opening the patch that uses it...
+open ~/matt/feedback/maxmsp/tune-instruments-gain.maxpat
+
+
+echo Launching Jacktrip servers
+feedjack-launch-n-jacktrip-servers
+
+
+
+echo now do:
+echo     feedjack-serverconnect
+#feedjack-serverconnect
diff --git a/scripts/slork/feedjack-serverconnect.bin b/scripts/slork/feedjack-serverconnect.bin
new file mode 100644 (file)
index 0000000..f3f75b8
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# Disconnect All
+~/slork/bin/jmess-1.0.3 -D
+
+# All clients' say into Max
+jack_connect node-1:receive_1 Max:in1
+jack_connect node-2:receive_1 Max:in2
+jack_connect node-3:receive_1 Max:in3
+jack_connect node-4:receive_1 Max:in4
+jack_connect node-5:receive_1 Max:in5
+jack_connect node-6:receive_1 Max:in6
+jack_connect node-7:receive_1 Max:in7
+jack_connect node-8:receive_1 Max:in8
+jack_connect node-9:receive_1 Max:in9
+jack_connect node-10:receive_1 Max:in10
+jack_connect node-11:receive_1 Max:in11
+jack_connect node-12:receive_1 Max:in12
+
+
+# All clients' hear from Max
+jack_connect Max:out1 node-1:send_1
+jack_connect Max:out2 node-2:send_1
+jack_connect Max:out3 node-3:send_1
+jack_connect Max:out4 node-4:send_1
+jack_connect Max:out5 node-5:send_1
+jack_connect Max:out6 node-6:send_1
+jack_connect Max:out7 node-7:send_1
+jack_connect Max:out8 node-8:send_1
+jack_connect Max:out9 node-9:send_1
+jack_connect Max:out10 node-10:send_1
+jack_connect Max:out11 node-11:send_1
+jack_connect Max:out12 node-12:send_1
+
+# echo KLUDGE: also connecting Max output 6 to this machine\'s hemi
+# jack_connect Max:out6 system:playback_1
+# jack_connect Max:out6 system:playback_2
+# jack_connect Max:out6 system:playback_3
+# jack_connect Max:out6 system:playback_4
+# jack_connect Max:out6 system:playback_5
+# jack_connect Max:out6 system:playback_6
diff --git a/scripts/test/client_connection_test.sh b/scripts/test/client_connection_test.sh
new file mode 100755 (executable)
index 0000000..cbdb178
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/bash
+#tests the jacktrip client connection to a hub server
+
+#kills existing jackd process, assuming current user has perms
+if pgrep -x "jackd"; then
+  echo 'stopping jackd'
+  command killall jackd
+  sleep 5
+fi
+
+#kills existing jacktrip processes, assuming current user has perms
+if pgrep -x "jacktrip"; then
+  echo 'stopping jacktrip'
+  command killall jacktrip
+  sleep 15
+fi
+
+#start jackd
+gnome-terminal -- command jackd -dalsa -dhw:0 -r48000 -p1024 -n2 > /dev/null 2>&1
+#command jacktrip -C 171.64.197.165 >> output.txt 2>&1 &
+sleep 5
+command jacktrip -C 171.64.197.165 > output.txt 2>&1 &
+sleep 5
+outputmsg=`cat output.txt`
+echo "$outputmsg"
+
+regExp='.*received connection.*'
+
+if [[ "${outputmsg,,}" =~ $regExp ]]; then
+  echo "Connection test passed!"
+else
+  echo "Connection test failed!"
+fi
+
+sleep 5
+if pgrep -x "jackd"; then
+  echo "killing jackd to clean up"
+  command killall jackd
+fi
+
+if pgrep -x "jacktrip"; then
+  echo "killing jacktrip to clean up"
+  command killall jacktrip
+fi
diff --git a/scripts/test/version_test.sh b/scripts/test/version_test.sh
new file mode 100755 (executable)
index 0000000..30c927b
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+# tests the jacktrip version command
+
+OUTPUTSTRING=$(command jacktrip -v)
+
+#this regular expression match the word "version,"
+#an optional colon and space(s), followed by at least one number
+regExp='.*version\:?\s*([0-9]+).*'
+
+echo "${OUTPUTSTRING,,}"
+#converts the jacktrip -v command output to lower case
+#for case insensitive matching and applies the regular expression to it
+if [[ "${OUTPUTSTRING,,}" =~ $regExp ]]; then
+  echo "version test passed"
+else
+  echo "version test failed"
+fi
diff --git a/scripts/utility/record_jack_receiving_ports.sh b/scripts/utility/record_jack_receiving_ports.sh
new file mode 100755 (executable)
index 0000000..ce792c1
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+if ! pgrep -x "jackd" ; then
+  printf "Please start jack with a 48K sample rate before running this script."
+  exit
+fi
+
+IPs=($(jack_lsp | grep ":receive_*" | cut -d: -f1))
+uniqIPs=($(printf "%s\n" "${IPs[@]}" | sort -u | tr '\n' ' '))
+
+uniqLength=${#uniqIPs[@]}
+printf '%s\n' "number of unique IP's: ${uniqLength}"
+
+for IP in "${uniqIPs[@]}"
+do
+  printf '%s\n' "IP: ${IP}"
+  NOW=$( date '+%F_%H:%M:%S' )
+  ecasound -f:,1,48000 -i jack,${IP} -o rec_${IP}_${NOW}_output.wav &
+done 
+
+echo "Press ESC key to stop recording"
+# read a single character
+while read -r -n1 key
+do
+# if input == ESC key
+  if [[ $key == $'\e' ]];then
+  kill $(ps aux | grep '[e]casound' | awk '{print $2}') 
+  break;
+  fi
+done
+
index 573622d31873844830ff4dc141ca6c2fb4e284f1..c4b953c7e1141a5dcf4183df6807b7677283317e 100644 (file)
@@ -159,7 +159,7 @@ public:
     virtual void setBufferSizeInSamples(uint32_t buf_size)
     { mBufferSizeInSamples = buf_size; }
     /// \brief Set Client Name to something different that the default (JackTrip)
-    virtual void setClientName(const char* ClientName) = 0;
+    virtual void setClientName(QString ClientName) = 0;
     //------------------------------------------------------------------
 
     //--------------GETTERS---------------------------------------------
index 1e16e194c9fa0472b0f1461422f0fe11a572d7a9..70c763237d6877ca331430e1b6900b4f39f342f9 100644 (file)
@@ -102,8 +102,23 @@ void JackAudioInterface::setup()
 //*******************************************************************************
 void JackAudioInterface::setupClient()
 {
-    const char* client_name = mClientName;
-    const char* server_name = NULL;
+    QByteArray clientName = mClientName.toUtf8();
+//    const char* server_name = NULL;
+#ifdef __MAC_OSX__
+    //Jack seems to have an issue with client names over 27 bytes in OS X
+    int maxSize = 27;
+#else
+    int maxSize = jack_client_name_size();
+#endif
+    if (clientName.length() > maxSize) {
+        int length = maxSize;
+        //Make sure we don't cut mid multi-byte character.
+        while ((length > 0) && ((clientName.at(length) & 0xc0) == 0x80)) {
+            length--;
+        }
+        clientName.truncate(length);
+    }
+
     // was  jack_options_t options = JackNoStartServer;
     // and then jack_options_t options = JackLoadName;
     jack_options_t options = JackNullOption; // from jackSimpleClient example
@@ -114,10 +129,15 @@ void JackAudioInterface::setupClient()
     /// verbose message, check how to desable them.
     {
         QMutexLocker locker(&sJackMutex);
+//#ifndef WAIR // WAIR
+//        mClient = jack_client_open (client_name, options, &status, server_name);
+//#else
+//        mClient = jack_client_open (client_name, JackUseExactName, &status, server_name);
+//#endif // endwhere
 #ifndef WAIR // WAIR
-        mClient = jack_client_open (client_name, options, &status, server_name);
+        mClient = jack_client_open (clientName.constData(), options, &status);
 #else
-        mClient = jack_client_open (client_name, JackUseExactName, &status, server_name);
+        mClient = jack_client_open (clientName.constData(), JackUseExactName, &status);
 #endif // endwhere
     }
 
@@ -136,8 +156,7 @@ void JackAudioInterface::setupClient()
         fprintf (stderr, "JACK server started\n");
     }
     if (status & JackNameNotUnique) {
-        client_name = jack_get_client_name(mClient);
-        fprintf (stderr, "unique name `%s' assigned\n", client_name);
+        fprintf (stderr, "unique name `%s' assigned\n", jack_get_client_name(mClient));
     }
 
     // Set function to call if Jack shuts down
index d4b72e827a64de5176c06d5e1868149e3b041b93..7886d8269ee86b11e5e4a32213c7ba3aba06ddde 100644 (file)
@@ -98,7 +98,7 @@ public:
 
     //--------------SETTERS---------------------------------------------
     /// \brief Set Client Name to something different that the default (JackTrip)
-    virtual void setClientName(const char* ClientName)
+    virtual void setClientName(QString ClientName)
     { mClientName = ClientName; }
     virtual void setSampleRate(uint32_t /*sample_rate*/)
     { std::cout << "WARNING: Setting the Sample Rate in Jack mode has no effect." << std::endl; }
@@ -174,7 +174,7 @@ private:
     AudioInterface::audioBitResolutionT mBitResolutionMode; ///< Bit resolution (audioBitResolutionT) mode
 
     jack_client_t* mClient; ///< Jack Client
-    const char* mClientName; ///< Jack Client Name
+    QString mClientName; ///< Jack Client Name
     QVarLengthArray<jack_port_t*> mInPorts; ///< Vector of Input Ports (Channels)
     QVarLengthArray<jack_port_t*> mOutPorts; ///< Vector of Output Ports (Channels)
     QVarLengthArray<sample_t*> mInBuffer; ///< Vector of Input buffers/channel read from JACK
index c425851d9a8286341cdb229474abc87623c7d836..4ba94af530a835422c6fc29803de943d7ab7d5e0 100644 (file)
@@ -79,7 +79,7 @@ JackTrip::JackTrip(jacktripModeT JacktripMode,
                    DataProtocol::packetHeaderTypeT PacketHeaderType,
                    underrunModeT UnderRunMode,
                    int receiver_bind_port, int sender_bind_port,
-                   int receiver_peer_port, int sender_peer_port) :
+                   int receiver_peer_port, int sender_peer_port, int tcp_peer_port) :
     mJackTripMode(JacktripMode),
     mDataProtocol(DataProtocolType),
     mPacketHeaderType(PacketHeaderType),
@@ -104,7 +104,7 @@ JackTrip::JackTrip(jacktripModeT JacktripMode,
     mSenderPeerPort(sender_peer_port),
     mSenderBindPort(sender_bind_port),
     mReceiverPeerPort(receiver_peer_port),
-    mTcpServerPort(4464),
+    mTcpServerPort(tcp_peer_port),
     mRedundancy(redundancy),
     mJackClientName(gJackDefaultClientName),
     mConnectionMode(JackTrip::NORMAL),
@@ -157,11 +157,18 @@ void JackTrip::setupAudio(
                                                  mAudioBitResolution);
 
 #ifdef WAIRTOHUB // WAIR
+//        qDebug() << "mPeerAddress" << mPeerAddress << mPeerAddress.contains(gDOMAIN_TRIPLE);
+        QString VARIABLE_AUDIO_NAME = WAIR_AUDIO_NAME; // legacy for WAIR
+        QByteArray tmp = QString(mPeerAddress).replace(":", ".").toLatin1();
         //Set our Jack client name if we're a hub server or a custom name hasn't been set
-             if ( mPeerAddress.toStdString() != "" &&
-                 (mJackClientName == gJackDefaultClientName || mJackTripMode == SERVERPINGSERVER)) {
-            mJackClientName = QString(mPeerAddress).replace(":", ".").toLatin1().constData();
+        if (!mPeerAddress.isEmpty() && (mJackClientName.constData() == gJackDefaultClientName.constData())) {
+            mJackClientName = QString(mPeerAddress).replace(":", "_");
         }
+//           if ( mPeerAddress.toStdString() != "" &&
+//               (mJackClientName == gJackDefaultClientName || mJackTripMode == SERVERPINGSERVER)) {
+//            mJackClientName = QString(mPeerAddress).replace(":", ".").toLatin1().constData();
+//        }
+
 //        std::cout  << "WAIR ID " << ID << " jacktrip client name set to=" <<
 //                      mJackClientName << std::endl;
 #endif // endwhere
@@ -170,8 +177,11 @@ void JackTrip::setupAudio(
 
         if (gVerboseFlag) std::cout << "  JackTrip:setupAudio before mAudioInterface->setup" << std::endl;
         mAudioInterface->setup();
+        if (gVerboseFlag) std::cout << "  JackTrip:setupAudio before mAudioInterface->getSampleRate" << std::endl;
         mSampleRate = mAudioInterface->getSampleRate();
+        if (gVerboseFlag) std::cout << "  JackTrip:setupAudio before mAudioInterface->getDeviceID" << std::endl;
         mDeviceID = mAudioInterface->getDeviceID();
+        if (gVerboseFlag) std::cout << "  JackTrip:setupAudio before mAudioInterface->getBufferSizeInSamples" << std::endl;
         mAudioBufferSize = mAudioInterface->getBufferSizeInSamples();
 #endif //__NON_JACK__
 #ifdef __NO_JACK__ /// \todo FIX THIS REPETITION OF CODE
@@ -659,9 +669,9 @@ int JackTrip::clientPingToServerStart()
     // Connect Socket to Server and wait for response
     // ----------------------------------------------
     tcpClient.connectToHost(serverHostAddress, mTcpServerPort);
-    if (gVerboseFlag) cout << "Connecting to TCP Server..." << endl;
+    if (gVerboseFlag) cout << "Connecting to TCP Server at " <<  serverHostAddress.toString().toLatin1().constData() << " port " << mTcpServerPort << "..." << endl;
     if (!tcpClient.waitForConnected()) {
-        std::cerr << "TCP Socket ERROR: " << tcpClient.errorString().toStdString() <<  endl;
+        std::cerr << "TCP Socket ERROR at " << mTcpServerPort << ": " << tcpClient.errorString().toStdString() <<  endl;
         //std::exit(1);
         return -1;
     }
@@ -677,7 +687,7 @@ int JackTrip::clientPingToServerStart()
     while ( tcpClient.bytesToWrite() > 0 ) {
         tcpClient.waitForBytesWritten(-1);
     }
-    if (gVerboseFlag) cout << "Port sent to Server" << endl;
+    if (gVerboseFlag) cout << "Port " << mReceiverBindPort << " sent to Server" << endl;
 
     // Read the size of the package
     // ----------------------------
@@ -704,7 +714,7 @@ int JackTrip::clientPingToServerStart()
     // --------------------
     tcpClient.close(); // Close the socket
     //cout << "TCP Socket Closed!" << endl;
-    if (gVerboseFlag) cout << "Connection Succesfull!" << endl;
+    if (gVerboseFlag) cout << "Connection Successful!" << endl;
 
     // Set with the received UDP port
     // ------------------------------
index 594e22abfff97acbc05c370d26264b3d2b4ecdb3..9885a213e9c9e531b84b717a1af4b207eb8617b4 100644 (file)
@@ -140,7 +140,8 @@ public:
              int receiver_bind_port = gDefaultPort,
              int sender_bind_port = gDefaultPort,
              int receiver_peer_port = gDefaultPort,
-             int sender_peer_port = gDefaultPort);
+             int sender_peer_port = gDefaultPort,
+             int tcp_peer_port = gDefaultPort);
 
     /// \brief The class destructor
     virtual ~JackTrip();
@@ -214,20 +215,20 @@ public:
         mReceiverPeerPort = port;
     }
     /// \brief Sets port numbers to bind in RECEIVER and SENDER sockets.
-    virtual void setBindPorts(int port)
+    void setBindPorts(int port)
     {
         mReceiverBindPort = port;
         mSenderBindPort = port;
     }
     /// \brief Sets port numbers for the peer (remote) machine.
-    virtual void setPeerPorts(int port)
+    void setPeerPorts(int port)
     {
         mSenderPeerPort = port;
         mReceiverPeerPort = port;
     }
     /// \brief Set Client Name to something different that the default (JackTrip)
-    virtual void setClientName(const char* ClientName)
-    { mJackClientName = ClientName; }
+    virtual void setClientName(QString clientName)
+    { mJackClientName = clientName; }
     /// \brief Set the number of audio channels
     virtual void setNumChannels(int num_chans)
     { mNumChans = num_chans; }
@@ -500,7 +501,7 @@ private:
     int mTcpServerPort;
 
     unsigned int mRedundancy; ///< Redundancy factor in network data
-    const char* mJackClientName; ///< JackAudio Client Name
+    QString mJackClientName; ///< JackAudio Client Name
 
     JackTrip::connectionModeT mConnectionMode; ///< Connection Mode
     JackTrip::hubConnectionModeT mHubConnectionModeT; ///< Hub Server Jack Audio Patch Connection Mode
index 541ee8aa995e7b5846c1f6167e7ecaa6a0fae2ec..bbc386b0a8d7677e0a6768a36e9471e921f97dd1 100644 (file)
@@ -68,6 +68,7 @@ Settings::Settings() :
     mBufferQueueLength(gDefaultQueueLength),
     mAudioBitResolution(AudioInterface::BIT16),
     mBindPortNum(gDefaultPort), mPeerPortNum(gDefaultPort),
+    mServerUdpPortNum(NULL),
     mClientName(NULL),
     mUnderrrunZero(false),
     mLoopBack(false),
@@ -125,6 +126,7 @@ void Settings::parseInput(int argc, char** argv)
     { "portoffset", required_argument, NULL, 'o' }, // Port Offset from 4464
     { "bindport", required_argument, NULL, 'B' }, // Port Offset from 4464
     { "peerport", required_argument, NULL, 'P' }, // Port Offset from 4464
+    { "udpbaseport", required_argument, NULL, 'U' }, // Server udp base port (defaults to 61002)
     { "queue", required_argument, NULL, 'q' }, // Queue Length
     { "redundancy", required_argument, NULL, 'r' }, // Redundancy
     { "bitres", required_argument, NULL, 'b' }, // Audio Bit Resolution
@@ -152,13 +154,16 @@ void Settings::parseInput(int argc, char** argv)
     /// \todo Specify mandatory arguments
     int ch;
     while ( (ch = getopt_long(argc, argv,
-                              "n:N:H:sc:SC:o:B:P:q:r:b:zlwjeJ:RTd:F:p:DvVh", longopts, NULL)) != -1 )
+                              "n:N:H:sc:SC:o:B:P:U:q:r:b:zlwjeJ:RTd:F:p:DvVh", longopts, NULL)) != -1 )
         switch (ch) {
 
         case 'n': // Number of input and output channels
             //-------------------------------------------------------
             mNumChans = atoi(optarg);
             break;
+        case 'U': // UDP Bind Port
+            mServerUdpPortNum = atoi(optarg);
+            break;
 #ifdef WAIR
         case 'w':
             //-------------------------------------------------------
@@ -200,14 +205,18 @@ void Settings::parseInput(int argc, char** argv)
             //-------------------------------------------------------
             mBindPortNum += atoi(optarg);
             mPeerPortNum += atoi(optarg);
+            if (gVerboseFlag) std::cout << "SETTINGS: argument parsed for TCP Bind Port: " << mBindPortNum << std::endl;
+            if (gVerboseFlag) std::cout << "SETTINGS: argument parsed for TCP Peer Port: " << mPeerPortNum << std::endl;
             break;
         case 'B': // Bind Port
             //-------------------------------------------------------
             mBindPortNum = atoi(optarg);
+            if (gVerboseFlag) std::cout << "SETTINGS: argument parsed for TCP Bind Port: " << mBindPortNum << std::endl;
             break;
         case 'P': // Peer Port
             //-------------------------------------------------------
             mPeerPortNum = atoi(optarg);
+            if (gVerboseFlag) std::cout << "SETTINGS: argument parsed for TCP Peer Port: " << mPeerPortNum << std::endl;
             break;
         case 'b':
             //-------------------------------------------------------
@@ -398,11 +407,12 @@ void Settings::printUsage()
          << gDefaultQueueLength << ")" << endl;
     cout << " -r, --redundancy  # (1 or more)          Packet Redundancy to avoid glitches with packet losses (default: 1)"
          << endl;
-    cout << " -o, --portoffset  #                      Receiving port offset from base port " << gDefaultPort << endl;
-    cout << " --bindport        #                      Set only the bind port number (default: 4464)" << endl;
-    cout << " --peerport        #                      Set only the Peer port number (default: 4464)" << endl;
+    cout << " -o, --portoffset  #                      Receiving bind port and peer port offset from default " << gDefaultPort << endl;
+    cout << " -B, --bindport        #                  Set only the bind port number (default: " << gDefaultPort << ")" << endl;
+    cout << " -P, --peerport        #                  Set only the peer port number (default: " << gDefaultPort << ")" << endl;
+    cout << " -U, --udpbaseport                        Set only the server udp base port number (default: 61002)" << endl;
     cout << " -b, --bitres      # (8, 16, 24, 32)      Audio Bit Rate Resolutions (default: 16)" << endl;
-    cout << " -p, --hubpatch    # (0, 1, 2, 3, 4)      Hub auto audio patch, only has effect if running HUB SERVER mode, 0=server-to-clients, 1=client loopback, 2=client fan out/in but not loopback, 3=reserved for TUB, 4=full mix (default: 0)" << endl;
+    cout << " -p, --hubpatch    # (0, 1, 2, 3, 4)      Hub auto audio patch, only has effect if running HUB SERVER mode, 0=server-to-clients, 1=client loopback, 2=clients can hear all clients except themselves, 3=reserved for TUB, 4=full mix (default: 0), i.e. clients auto-connect and hear all clients including themselves" << endl;
     cout << " -z, --zerounderrun                       Set buffer to zeros when underrun occurs (default: wavetable)" << endl;
     cout << " -l, --loopback                           Run in Loop-Back Mode" << endl;
     cout << " -j, --jamlink                            Run in JamLink Mode (Connect to a JamLink Box)" << endl;
@@ -417,8 +427,8 @@ void Settings::printUsage()
     cout << "   --deviceid      #                      The rtaudio device id --rtaudio mode only (default: 0)" << endl;
     cout << endl;
     cout << "ARGUMENTS TO DISPLAY IO STATISTICS:" << endl;
-    cout << "   --iostat <time_in_secs>                Turn on IO stat reporting with specified interval (in seconds)" << endl;
-    cout << "   --iostatlog <log_file>                 Save stat log into a file (default: print in stdout)" << endl;
+    cout << " -I, --iostat <time_in_secs>              Turn on IO stat reporting with specified interval (in seconds)" << endl;
+    cout << " -G, --iostatlog <log_file>               Save stat log into a file (default: print in stdout)" << endl;
     cout << endl;
     cout << "HELP ARGUMENTS: " << endl;
     cout << " -v, --version                            Prints Version Number" << endl;
@@ -432,9 +442,13 @@ void Settings::printUsage()
 void Settings::startJackTrip()
 {
 
+    if ((mBindPortNum < gBindPortLow) || (mBindPortNum > gBindPortHigh))
+        std::cout << "BindPort: "<< mBindPortNum << " outside range"  << std::endl;
+
     /// \todo Change this, just here to test
     if ( mJackTripServer ) {
-        UdpHubListener* udpmaster = new UdpHubListener;
+        if (gVerboseFlag) std::cout << "JackTrip HUB SERVER TCP Bind Port: " << mBindPortNum << std::endl;
+        UdpHubListener* udpmaster = new UdpHubListener(mBindPortNum,mServerUdpPortNum);
         udpmaster->setSettings(this);
 #ifdef WAIR // WAIR
         udpmaster->setWAIR(mWAIR);
@@ -478,7 +492,15 @@ void Settings::startJackTrip()
                          #ifdef WAIR // wair
                                  mNumNetRevChans,
                          #endif // endwhere
-                                 mBufferQueueLength, mRedundancy, mAudioBitResolution);
+                                 mBufferQueueLength, mRedundancy, mAudioBitResolution,
+                                 /*DataProtocol::packetHeaderTypeT PacketHeaderType = */DataProtocol::DEFAULT,
+                                 /*underrunModeT UnderRunMode = */ mUnderRunMode,
+                                 /* int receiver_bind_port = */ gDefaultPort,
+                                 /*int sender_bind_port = */ gDefaultPort,
+                                 /*int receiver_peer_port = */ gDefaultPort,
+                                 /* int sender_peer_port = */ gDefaultPort,
+                                 mPeerPortNum
+                                 );
 
         // Set connect or not default audio ports. Only work for jack
         mJackTrip->setConnectDefaultAudioPorts(mConnectDefaultAudioPorts);
@@ -497,6 +519,10 @@ void Settings::startJackTrip()
             cout << "Setting buffers to zero when underrun..." << endl;
             cout << gPrintSeparator << std::endl;
             mJackTrip->setUnderRunMode(JackTrip::ZEROS);
+        } else {
+            cout << "Setting buffers to wavetable when underrun..." << endl;
+            cout << gPrintSeparator << std::endl;
+            mJackTrip->setUnderRunMode(JackTrip::WAVETABLE);
         }
 
         // Set peer address in server mode
index dba212ed6150dca907e16ce737a9440301c8bd5d..9856bf22d1936402a9f324091cd22bcf96be3d0d 100644 (file)
@@ -94,8 +94,10 @@ private:
     QString mPeerAddress; ///< Peer Address to use in jacktripModeT::CLIENT Mode
     int mBindPortNum; ///< Bind Port Number
     int mPeerPortNum; ///< Peer Port Number
+    int mServerUdpPortNum;
     char* mClientName; ///< JackClient Name
     bool mUnderrrunZero; ///< Use Underrun to Zero mode
+    JackTrip::underrunModeT mUnderRunMode;
 
 #ifdef WAIR // wair
     int mNumNetRevChans; ///< Number of Network Audio Channels (net comb filters)
index b69b7b11b630e7c0d0de31d9a4dd24be0bf8b986..4cbd6499ff9f632bc334f7fbbfff0f4e71333dc4 100644 (file)
@@ -53,9 +53,10 @@ using std::cout; using std::endl;
 
 
 //*******************************************************************************
-UdpHubListener::UdpHubListener(int server_port) :
+UdpHubListener::UdpHubListener(int server_port, int server_udp_port) :
     //mJTWorker(NULL),
     mServerPort(server_port),
+    mServerUdpPort(server_udp_port),//final udp base port number
     mStopped(false),
     #ifdef WAIR // wair
     mWAIR(false),
@@ -85,8 +86,15 @@ UdpHubListener::UdpHubListener(int server_port) :
     // The Dynamic and/or Private Ports are those from 49152 through 65535
     // mBasePort = ( rand() % ( (65535 - gMaxThreads) - 49152 ) ) + 49152;
 
-    // SoundWIRE ports open are UDP 61000-62000
-    mBasePort = 61000;
+    // SoundWIRE ports open are UDP 61002-62000
+    // (server_port - gDefaultPort) apply TCP offset to UDP too
+    if (mServerUdpPort != NULL){
+      mBasePort = mServerUdpPort;
+    } else {
+      mBasePort = 61002 + (server_port - gDefaultPort);
+    }
+
+    cout << "JackTrip HUB SERVER: UDP Base Port set to " << mBasePort << endl;
 
     mUnderRunMode = JackTrip::WAVETABLE;
     mBufferQueueLength = gDefaultQueueLength;
@@ -116,14 +124,14 @@ void UdpHubListener::run()
     mStopped = false;
 
     QHostAddress PeerAddress; // Object to store peer address
-    int peer_udp_port; // Peer listening port
+    uint16_t peer_udp_port; // Peer listening port
     int server_udp_port; // Server assigned udp port
 
     // Create and bind the TCP server
     // ------------------------------
     QTcpServer TcpServer;
     if ( !TcpServer.listen(QHostAddress::Any, mServerPort) ) {
-        std::cerr << "TCP Socket Server ERROR: " << TcpServer.errorString().toStdString() <<  endl;
+        std::cerr << "TCP Socket Server ERROR on Port " << mServerPort << ": " << TcpServer.errorString().toStdString() <<  endl;
         std::exit(1);
     }
 
@@ -159,7 +167,21 @@ void UdpHubListener::run()
             // Get UDP port from client
             // ------------------------
             peer_udp_port = readClientUdpPort(clientConnection);
-            if ( peer_udp_port == 0 ) { break; }
+            if ( peer_udp_port == 0 ) {
+                cout << "JackTrip HUB SERVER: Client UDP Port is = " << peer_udp_port << endl;
+                cout << "JackTrip HUB SERVER: Exiting " << endl;
+                break;
+            }
+            if ( peer_udp_port < gBindPortLow ) {
+                cout << "JackTrip HUB SERVER: Client UDP Port is = " << peer_udp_port << endl;
+                cout << "JackTrip HUB SERVER: Exiting " << endl;
+                break;
+            }
+            if ( peer_udp_port > gBindPortHigh ) {
+                cout << "JackTrip HUB SERVER: Client UDP Port is = " << peer_udp_port << endl;
+                cout << "JackTrip HUB SERVER: Exiting " << endl;
+                break;
+            }
             cout << "JackTrip HUB SERVER: Client UDP Port is = " << peer_udp_port << endl;
 
             // Check is client is new or not
@@ -186,6 +208,8 @@ void UdpHubListener::run()
             }
             // Assign server port and send it to Client
             server_udp_port = mBasePort+id;
+            cout << "JackTrip HUB SERVER: Sending Final UDP Port to Client: " << server_udp_port << endl;
+
             if ( sendUdpPort(clientConnection, server_udp_port) == 0 ) {
                 clientConnection->close();
                 delete clientConnection;
@@ -291,13 +315,13 @@ void UdpHubListener::run()
 
 //*******************************************************************************
 // Returns 0 on error
-int UdpHubListener::readClientUdpPort(QTcpSocket* clientConnection)
+uint16_t UdpHubListener::readClientUdpPort(QTcpSocket* clientConnection)
 {
     // Read the size of the package
     // ----------------------------
     //tcpClient.waitForReadyRead();
     cout << "JackTrip HUB SERVER: Reading UDP port from Client..." << endl;
-    while (clientConnection->bytesAvailable() < (int)sizeof(uint16_t)) {
+    while (clientConnection->bytesAvailable() < (qint64)sizeof(uint16_t)) {
         if (!clientConnection->waitForReadyRead()) {
             std::cerr << "TCP Socket ERROR: " << clientConnection->errorString().toStdString() <<  endl;
             return 0;
@@ -307,8 +331,8 @@ int UdpHubListener::readClientUdpPort(QTcpSocket* clientConnection)
     if (gVerboseFlag) cout << "Ready To Read From Client!" << endl;
     // Read UDP Port Number from Server
     // --------------------------------
-    int udp_port;
-    int size = sizeof(udp_port);
+    uint16_t udp_port = 0;
+    qint64 size = sizeof(udp_port);
     char port_buf[size];
     clientConnection->read(port_buf, size);
     std::memcpy(&udp_port, port_buf, size);
index 82dca3b5678969ae1c529a477cf75616be107afb..0bc0a8c75777a92d3c025dcf2e88ac8b28008f8e 100644 (file)
@@ -70,7 +70,7 @@ class UdpHubListener : public QThread
     Q_OBJECT;
 
 public:
-    UdpHubListener(int server_port = gServerUdpPort);
+    UdpHubListener(int server_port = gServerUdpPort, int server_udp_port = NULL);
     virtual ~UdpHubListener();
 
     /// \brief Implements the Thread Loop. To start the thread, call start()
@@ -104,7 +104,7 @@ private:
    */
     static void bindUdpSocket(QUdpSocket& udpsocket, int port);
 
-    int readClientUdpPort(QTcpSocket* clientConnection);
+    uint16_t readClientUdpPort(QTcpSocket* clientConnection);
     int sendUdpPort(QTcpSocket* clientConnection, int udp_port);
 
 
@@ -133,6 +133,7 @@ private:
     QThreadPool mThreadPool; ///< The Thread Pool
 
     int mServerPort; //< Server known port number
+    int mServerUdpPort; //< Server udp base port number
     int mBasePort;
     addressPortPair mActiveAddress[gMaxThreads]; ///< Active address pool addresses
     QHash<QString, uint16_t> mActiveAddressPortPair;
index e0dfa08946b27d65aae1897b6c3d91d7c568570a..4c98f170611bc4a376ac672d1cf7946f5f11e781 100644 (file)
@@ -44,7 +44,7 @@
 /// \todo Add this namespace
 //namespace JackTrip
 
-const char* const gVersion = "1.2.1"; ///< JackTrip version
+const char* const gVersion = "1.2.2"; ///< JackTrip version
 
 //*******************************************************************************
 /// \name Default Values
@@ -99,6 +99,8 @@ const int gWaitCounter = 60;
 /// \name Network related ports
 //@{
 const int gDefaultPort = 4464; ///< Default JackTrip Port
+const int gBindPortLow = 3464; ///< lowest Bindport
+const int gBindPortHigh = 5464; ///< highest Bindport
 //const int gInputPort_0 = 4464; ///< Input base port
 //const int gOutputPort_0 = 4465; ///< Output base port
 //const int gDefaultSendPort = 4464; ///< Default for to use to send packet
@@ -123,7 +125,7 @@ extern int gVerboseFlag; ///< Verbose mode flag declaration
 /// \name JackAudio
 //@{
 const int gJackBitResolution = 32; ///< Audio Bit Resolution of the Jack Server
-const char* const gJackDefaultClientName = "JackTrip";
+const QString gJackDefaultClientName = "JackTrip";
 //@}