Unverified Commit 293c585e authored by Aaron Wyatt's avatar Aaron Wyatt Committed by GitHub
Browse files

Merge branch 'master' into custom-client-fix

parents adf3d7b7 3fec5796
......@@ -25,13 +25,11 @@ addons:
- librtaudio-dev
before_script:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
# manually install brew packages as addon: homebrew is broken in the default osx image
brew install $PKGS_OSX;
# mac: workaround for homebrew qmake not being symlinked into $PATH
# see https://stackoverflow.com/questions/48847505/why-cant-i-use-qmake-on-mac-after-installing-it
export PATH="/usr/local/opt/qt/bin:$PATH";
fi
# manually install brew packages as addon: homebrew is broken in the default osx image
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install $PKGS_OSX; fi
# mac: workaround for homebrew qmake not being symlinked into $PATH
# see https://stackoverflow.com/questions/48847505/why-cant-i-use-qmake-on-mac-after-installing-it
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then export PATH="/usr/local/opt/qt/bin:$PATH"; fi
script:
- cd src
......
---
master
master (this branch name will be deprecated when github follows through on interest in eliminating such terminology)
- (fixed) refactor "Master" to be "Hub"
- (fixed) 1.2 correctly tagged
---
1.2 (release candidate, not yet tagged)
......
......@@ -167,7 +167,7 @@ void JMess::setConnectedPorts()
}
//*******************************************************************************
void JMess::connectSpawnedPorts(int nChans, int hubPatch)
// called from UdpMasterListener::connectMesh
// called from UdpHubListener::connectMesh
{
QString IPS[gMAX_WAIRS];
int ctr = 0;
......@@ -307,7 +307,7 @@ void JMess::connectSpawnedPorts(int nChans, int hubPatch)
// this is brute force, does not look at individual clients, just patches the whole ensemble
// each time
void JMess::connectTUB(int /*nChans*/)
// called from UdpMasterListener::connectPatch
// called from UdpHubListener::connectPatch
{
for (int i = 0; i<=gMAX_TUB-gMIN_TUB; i++) // last IP decimal octet
for (int l = 1; l<=1; l++) // mono for now // chans are 1-based, 1...2
......
......@@ -16,7 +16,7 @@ And as of spring 2020 it moved back to GitHub for the current development.
## Links ##
* Preliminary [Documentation](http://ccrma.stanford.edu/groups/soundwire/software/jacktrip/) and [API](http://ccrma.stanford.edu/groups/soundwire/software/jacktrip/annotated.html).
* Subscribe to the [Mailing List](http://groups.google.com/group/jacktrip-users).
* [CCRMA](http://ccrma.stanford.edu/) .
* [CCRMA](http://ccrma.stanford.edu/).
* [SoundWIRE group](http://ccrma.stanford.edu/groups/soundwire/).
* [Juan-Pablo Caceres](https://ccrma.stanford.edu/~jcaceres/).
......
......@@ -435,7 +435,7 @@ unsigned int RtApiCore :: getDeviceCount( void )
{
// Find out how many audio devices there are, if any.
UInt32 dataSize;
AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyDataSize( kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize );
if ( result != noErr ) {
errorText_ = "RtApiCore::getDeviceCount: OS-X error getting device info!";
......@@ -453,7 +453,7 @@ unsigned int RtApiCore :: getDefaultInputDevice( void )
AudioDeviceID id;
UInt32 dataSize = sizeof( AudioDeviceID );
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyData( kAudioObjectSystemObject, &property, 0, NULL, &dataSize, &id );
if ( result != noErr ) {
errorText_ = "RtApiCore::getDefaultInputDevice: OS-X system error getting device.";
......@@ -486,7 +486,7 @@ unsigned int RtApiCore :: getDefaultOutputDevice( void )
AudioDeviceID id;
UInt32 dataSize = sizeof( AudioDeviceID );
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyData( kAudioObjectSystemObject, &property, 0, NULL, &dataSize, &id );
if ( result != noErr ) {
errorText_ = "RtApiCore::getDefaultOutputDevice: OS-X system error getting device.";
......@@ -533,7 +533,7 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device )
UInt32 dataSize = sizeof( AudioDeviceID ) * nDevices;
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyData( kAudioObjectSystemObject, &property,
0, NULL, &dataSize, (void *) &deviceList );
if ( result != noErr ) {
......@@ -765,7 +765,7 @@ bool RtApiCore :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
UInt32 dataSize = sizeof( AudioDeviceID ) * nDevices;
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyData( kAudioObjectSystemObject, &property,
0, NULL, &dataSize, (void *) &deviceList );
if ( result != noErr ) {
......
......@@ -472,7 +472,7 @@ RtApiCore:: RtApiCore()
CFRunLoopRef theRunLoop = NULL;
AudioObjectPropertyAddress property = { kAudioHardwarePropertyRunLoop,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectSetPropertyData( kAudioObjectSystemObject, &property, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop);
if ( result != noErr ) {
errorText_ = "RtApiCore::RtApiCore: error setting run loop property!";
......@@ -493,7 +493,7 @@ unsigned int RtApiCore :: getDeviceCount( void )
{
// Find out how many audio devices there are, if any.
UInt32 dataSize;
AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyDataSize( kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize );
if ( result != noErr ) {
errorText_ = "RtApiCore::getDeviceCount: OS-X error getting device info!";
......@@ -511,7 +511,7 @@ unsigned int RtApiCore :: getDefaultInputDevice( void )
AudioDeviceID id;
UInt32 dataSize = sizeof( AudioDeviceID );
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyData( kAudioObjectSystemObject, &property, 0, NULL, &dataSize, &id );
if ( result != noErr ) {
errorText_ = "RtApiCore::getDefaultInputDevice: OS-X system error getting device.";
......@@ -544,7 +544,7 @@ unsigned int RtApiCore :: getDefaultOutputDevice( void )
AudioDeviceID id;
UInt32 dataSize = sizeof( AudioDeviceID );
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyData( kAudioObjectSystemObject, &property, 0, NULL, &dataSize, &id );
if ( result != noErr ) {
errorText_ = "RtApiCore::getDefaultOutputDevice: OS-X system error getting device.";
......@@ -593,7 +593,7 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device )
UInt32 dataSize = sizeof( AudioDeviceID ) * nDevices;
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyData( kAudioObjectSystemObject, &property,
0, NULL, &dataSize, (void *) &deviceList );
if ( result != noErr ) {
......@@ -846,7 +846,7 @@ static OSStatus rateListener( AudioObjectID inDevice,
UInt32 dataSize = sizeof( Float64 );
AudioObjectPropertyAddress property = { kAudioDevicePropertyNominalSampleRate,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
kAudioObjectPropertyElementHub };
AudioObjectGetPropertyData( inDevice, &property, 0, NULL, &dataSize, rate );
return kAudioHardwareNoError;
}
......@@ -874,7 +874,7 @@ bool RtApiCore :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
UInt32 dataSize = sizeof( AudioDeviceID ) * nDevices;
AudioObjectPropertyAddress property = { kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
kAudioObjectPropertyElementHub };
OSStatus result = AudioObjectGetPropertyData( kAudioObjectSystemObject, &property,
0, NULL, &dataSize, (void *) &deviceList );
if ( result != noErr ) {
......@@ -1065,7 +1065,7 @@ bool RtApiCore :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
// Set a property listener for the sample rate change
Float64 reportedRate = 0.0;
AudioObjectPropertyAddress tmp = { kAudioDevicePropertyNominalSampleRate, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
AudioObjectPropertyAddress tmp = { kAudioDevicePropertyNominalSampleRate, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementHub };
result = AudioObjectAddPropertyListener( id, &tmp, rateListener, (void *) &reportedRate );
if ( result != noErr ) {
errorStream_ << "RtApiCore::probeDeviceOpen: system error (" << getErrorCode( result ) << ") setting sample rate property listener for device (" << device << ").";
......
......@@ -909,7 +909,7 @@ typedef struct copr_msg {
*/
#define SOUND_MIXER_NRDEVICES 25
#define SOUND_MIXER_VOLUME 0 /* Master output level */
#define SOUND_MIXER_VOLUME 0 /* Hub output level */
#define SOUND_MIXER_BASS 1 /* Treble level of all output channels */
#define SOUND_MIXER_TREBLE 2 /* Bass level of all output channels */
#define SOUND_MIXER_SYNTH 3 /* Volume of synthesier input */
......
......@@ -22,7 +22,7 @@ moc_h = ['src/DataProtocol.h',
'src/PacketHeader.h',
'src/Settings.h',
'src/UdpDataProtocol.h',
'src/UdpMasterListener.h']
'src/UdpHubListener.h']
moc_files = qt5.preprocess(moc_headers : moc_h)
src = ['src/DataProtocol.cpp',
......@@ -38,7 +38,7 @@ src = ['src/DataProtocol.cpp',
'src/RingBuffer.cpp',
'src/Settings.cpp',
'src/UdpDataProtocol.cpp',
'src/UdpMasterListener.cpp',
'src/UdpHubListener.cpp',
'src/AudioInterface.cpp',
'src/JackAudioInterface.cpp']
......
......@@ -35,6 +35,8 @@
#include "jacktrip_globals.h"
#include <QDebug>
// sJackMutex definition
QMutex JMess::sJMessMutex;
//-------------------------------------------------------------------------------
/*! \brief Constructs a JMess object that has a jack client.
......@@ -167,8 +169,11 @@ void JMess::setConnectedPorts()
}
//*******************************************************************************
void JMess::connectSpawnedPorts(int nChans, int hubPatch)
// called from UdpMasterListener::connectMesh
// called from UdpHubListener::connectMesh
{
QMutexLocker locker(&sJMessMutex);
QString IPS[gMAX_WAIRS];
int ctr = 0;
......@@ -197,7 +202,7 @@ void JMess::connectSpawnedPorts(int nChans, int hubPatch)
// qDebug() << ports[out_i] << systemPort << s;
}
}
for (int i = 0; i<ctr; i++) qDebug() << IPS[i];
// for (int i = 0; i<ctr; i++) qDebug() << IPS[i];
disconnectAll();
int k = 0;
......@@ -212,8 +217,8 @@ void JMess::connectSpawnedPorts(int nChans, int hubPatch)
if ((hubPatch == JackTrip::CLIENTECHO)||(hubPatch == JackTrip::FULLMIX)) k = i;
else if (hubPatch == JackTrip::CLIENTFOFI) k = (j+(i+1))%ctr;
for (int l = 1; l<=nChans; l++) { // chans are 1-based
qDebug() << "connect " << IPS[i]+":receive_"+QString::number(l)
<<"with " << IPS[k]+":send_"+QString::number(l);
// qDebug() << "connect " << IPS[i]+":receive_"+QString::number(l)
// <<"with " << IPS[k]+":send_"+QString::number(l);
QString left = IPS[i] +
":receive_" + QString::number(l);
......@@ -239,8 +244,8 @@ void JMess::connectSpawnedPorts(int nChans, int hubPatch)
for (int j = 0; j<jLimit; j++) {
k = (j+(i+1))%ctr;
for (int l = 1; l<=nChans; l++) { // chans are 1-based
qDebug() << "connect " << IPS[i]+":receive_"+QString::number(l)
<<"with " << IPS[k]+":send_"+QString::number(l);
// qDebug() << "connect " << IPS[i]+":receive_"+QString::number(l)
// <<"with " << IPS[k]+":send_"+QString::number(l);
QString left = IPS[i] +
":receive_" + QString::number(l);
......@@ -307,7 +312,7 @@ void JMess::connectSpawnedPorts(int nChans, int hubPatch)
// this is brute force, does not look at individual clients, just patches the whole ensemble
// each time
void JMess::connectTUB(int /*nChans*/)
// called from UdpMasterListener::connectPatch
// called from UdpHubListener::connectPatch
{
for (int i = 0; i<=gMAX_TUB-gMIN_TUB; i++) // last IP decimal octet
for (int l = 1; l<=1; l++) // mono for now // chans are 1-based, 1...2
......
......@@ -44,6 +44,7 @@
//#include <QXmlSimpleReader>
//#include <QXmlInputSource>
//#include <QXmlContentHandler>
#include <QMutexLocker>
#include <jack/jack.h>
......@@ -87,5 +88,6 @@ private:
//OuputPortN InputPortN
QVector<QVector<QString> > mConnectedPorts;
QVector<QVector<QString> > mPortsToConnect;
static QMutex sJMessMutex; ///< Mutex to make thread safe jack functions that are not
};
#endif
......@@ -133,7 +133,7 @@ JackTrip::~JackTrip()
//*******************************************************************************
void JackTrip::setupAudio(
#ifdef WAIRTOMASTER // WAIR
#ifdef WAIRTOHUB // WAIR
int ID
#endif // endwhere
)
......@@ -156,17 +156,14 @@ void JackTrip::setupAudio(
#endif // endwhere
mAudioBitResolution);
#ifdef WAIRTOMASTER // WAIR
qDebug() << "mPeerAddress" << mPeerAddress << mPeerAddress.contains(gDOMAIN_TRIPLE);
QString VARIABLE_AUDIO_NAME = WAIR_AUDIO_NAME; // legacy for WAIR
#ifdef WAIRTOHUB // WAIR
//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)) {
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;
// std::cout << "WAIR ID " << ID << " jacktrip client name set to=" <<
// mJackClientName << std::endl;
#endif // endwhere
mAudioInterface->setClientName(mJackClientName);
......@@ -321,7 +318,7 @@ void JackTrip::appendProcessPlugin(ProcessPlugin* plugin)
//*******************************************************************************
void JackTrip::startProcess(
#ifdef WAIRTOMASTER // WAIR
#ifdef WAIRTOHUB // WAIR
int ID
#endif // endwhere
)
......@@ -338,10 +335,8 @@ void JackTrip::startProcess(
if (gVerboseFlag) std::cout << " JackTrip:startProcess before checkIfPortIsBinded(mReceiverBindPort)" << std::endl;
#if defined __WIN_32__
//cc fixed windows crash with this print statement!
qDebug() << "before mJackTrip->startProcess"
<< mReceiverBindPort<< mSenderBindPort;
// msleep(2000);
//cc fixed windows crash with this print statement! hope to delete
// qDebug() << "before mJackTrip->startProcess" << mReceiverBindPort<< mSenderBindPort;
#endif
checkIfPortIsBinded(mReceiverBindPort);
if (gVerboseFlag) std::cout << " JackTrip:startProcess before checkIfPortIsBinded(mSenderBindPort)" << std::endl;
......@@ -350,7 +345,7 @@ void JackTrip::startProcess(
// ------------------------------
if (gVerboseFlag) std::cout << " JackTrip:startProcess before setupAudio" << std::endl;
setupAudio(
#ifdef WAIRTOMASTER // wair
#ifdef WAIRTOHUB // wair
ID
#endif // endwhere
);
......
......@@ -161,7 +161,7 @@ public:
/// \brief Start the processing threads
virtual void startProcess(
#ifdef WAIRTOMASTER // wair
#ifdef WAIRTOHUB // wair
int ID
#endif // endwhere
);
......@@ -437,7 +437,7 @@ public:
/// \brief Set the AudioInteface object
virtual void setupAudio(
#ifdef WAIRTOMASTER // WAIR
#ifdef WAIRTOHUB // WAIR
int ID
#endif // endwhere
);
......
......@@ -44,7 +44,7 @@
#include "JackTripWorker.h"
#include "JackTrip.h"
#include "UdpMasterListener.h"
#include "UdpHubListener.h"
#include "NetKS.h"
#include "LoopBack.h"
#include "Settings.h"
......@@ -58,8 +58,8 @@
using std::cout; using std::endl;
//*******************************************************************************
JackTripWorker::JackTripWorker(UdpMasterListener* udpmasterlistener, int BufferQueueLength, JackTrip::underrunModeT UnderRunMode) :
mUdpMasterListener(udpmasterlistener),
JackTripWorker::JackTripWorker(UdpHubListener* udpmasterlistener, int BufferQueueLength, JackTrip::underrunModeT UnderRunMode) :
mUdpHubListener(udpmasterlistener),
m_connectDefaultAudioPorts(false),
mBufferQueueLength(BufferQueueLength),
mUnderRunMode(UnderRunMode),
......@@ -80,7 +80,7 @@ JackTripWorker::JackTripWorker(UdpMasterListener* udpmasterlistener, int BufferQ
//*******************************************************************************
JackTripWorker::~JackTripWorker()
{
//delete mUdpMasterListener;
//delete mUdpHubListener;
}
......@@ -128,14 +128,14 @@ void JackTripWorker::run()
// Create and setup JackTrip Object
//JackTrip jacktrip(JackTrip::SERVER, JackTrip::UDP, mNumChans, 2);
if (gVerboseFlag) cout << "---> JackTripWorker: Creating jacktrip objects..." << endl;
Settings* settings = mUdpMasterListener->getSettings();
Settings* settings = mUdpHubListener->getSettings();
#ifdef WAIR // WAIR
// forces BufferQueueLength to 2
// need to parse numNetChans from incoming header
// but force to 16 for now
#define FORCEBUFFERQ 2
if (mUdpMasterListener->isWAIR()) { // invoked with -Sw
if (mUdpHubListener->isWAIR()) { // invoked with -Sw
mWAIR = true;
mNumNetRevChans = NUMNETREVCHANSbecauseNOTINRECEIVEDheader;
} else {};
......@@ -210,7 +210,7 @@ void JackTripWorker::run()
if (gVerboseFlag) cout << "---> JackTripWorker: setJackTripFromClientHeader..." << endl;
int PeerConnectionMode = setJackTripFromClientHeader(jacktrip);
if ( PeerConnectionMode == -1 ) {
mUdpMasterListener->releaseThread(mID);
mUdpHubListener->releaseThread(mID);
{ QMutexLocker locker(&mMutex); mSpawning = false; }
return;
}
......@@ -218,7 +218,7 @@ void JackTripWorker::run()
// Start Threads and event loop
if (gVerboseFlag) cout << "---> JackTripWorker: startProcess..." << endl;
jacktrip.startProcess(
#ifdef WAIRTOMASTER // wair
#ifdef WAIRTOHUB // wair
mID
#endif // endwhere
);
......@@ -245,14 +245,14 @@ void JackTripWorker::run()
std::cerr << "Couldn't send thread to the Pool" << endl;
std::cerr << e.what() << endl;
std::cerr << gPrintSeparator << endl;
mUdpMasterListener->releaseThread(mID);
mUdpHubListener->releaseThread(mID);
{ QMutexLocker locker(&mMutex); mSpawning = false; }
return;
}
{
QMutexLocker locker(&mMutex);
mUdpMasterListener->releaseThread(mID);
mUdpHubListener->releaseThread(mID);
}
cout << "JackTrip ID = " << mID << " released from the THREAD POOL" << endl;
......
......@@ -50,7 +50,7 @@
#include "jacktrip_globals.h"
//class JackTrip; // forward declaration
class UdpMasterListener; // forward declaration
class UdpHubListener; // forward declaration
/** \brief Prototype of the worker class that will be cloned through sending threads to the
......@@ -70,7 +70,7 @@ class JackTripWorker : public QObject, public QRunnable
public:
/// \brief The class constructor
JackTripWorker(UdpMasterListener* udpmasterlistener, int BufferQueueLength = gDefaultQueueLength, JackTrip::underrunModeT UnderRunMode = JackTrip::WAVETABLE);
JackTripWorker(UdpHubListener* udpmasterlistener, int BufferQueueLength = gDefaultQueueLength, JackTrip::underrunModeT UnderRunMode = JackTrip::WAVETABLE);
/// \brief The class destructor
virtual ~JackTripWorker();
......@@ -111,7 +111,7 @@ private:
int setJackTripFromClientHeader(JackTrip& jacktrip);
JackTrip::connectionModeT getConnectionModeFromHeader();
UdpMasterListener* mUdpMasterListener; ///< Master Listener Socket
UdpHubListener* mUdpHubListener; ///< Hub Listener Socket
//QHostAddress mClientAddress; ///< Client Address
QString mClientAddress;
uint16_t mServerPort; ///< Server Ephemeral Incomming Port to use with Client
......
......@@ -44,7 +44,7 @@
#include "Stk16.dsp.h"
#endif // endwhere
#include "UdpMasterListener.h"
#include "UdpHubListener.h"
#include "JackTripWorker.h"
#include "jacktrip_globals.h"
......@@ -291,7 +291,7 @@ void Settings::parseInput(int argc, char** argv)
case 'v':
//-------------------------------------------------------
cout << "JackTrip VERSION: " << gVersion << endl;
cout << "Copyright (c) 2008-2018 Juan-Pablo Caceres, Chris Chafe." << endl;
cout << "Copyright (c) 2008-2020 Juan-Pablo Caceres, Chris Chafe." << endl;
cout << "SoundWIRE group at CCRMA, Stanford University" << endl;
cout << "" << endl;
std::exit(0);
......@@ -371,7 +371,7 @@ void Settings::printUsage()
cout << "" << endl;
cout << "JackTrip: A System for High-Quality Audio Network Performance" << endl;
cout << "over the Internet" << endl;
cout << "Copyright (c) 2008-2018 Juan-Pablo Caceres, Chris Chafe." << endl;
cout << "Copyright (c) 2008-2020 Juan-Pablo Caceres, Chris Chafe." << endl;
cout << "SoundWIRE group at CCRMA, Stanford University" << endl;
cout << "VERSION: " << gVersion << endl;
cout << "" << endl;
......@@ -434,7 +434,7 @@ void Settings::startJackTrip()
/// \todo Change this, just here to test
if ( mJackTripServer ) {
UdpMasterListener* udpmaster = new UdpMasterListener;
UdpHubListener* udpmaster = new UdpHubListener;
udpmaster->setSettings(this);
#ifdef WAIR // WAIR
udpmaster->setWAIR(mWAIR);
......@@ -596,7 +596,7 @@ void Settings::startJackTrip()
// Start JackTrip
if (gVerboseFlag) std::cout << "Settings:startJackTrip before mJackTrip->startProcess" << std::endl;
mJackTrip->startProcess(
#ifdef WAIRTOMASTER // WAIR
#ifdef WAIRTOHUB // WAIR
0 // for WAIR compatibility, ID in jack client name
#endif // endwhere
);
......
......@@ -188,7 +188,7 @@ int UdpDataProtocol::bindSocket()
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 1, 1 );
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
......@@ -200,8 +200,8 @@ int UdpDataProtocol::bindSocket()
// Confirm that the Windows Sockets DLL supports 1.1. or higher
if ( LOBYTE( wsaData.wVersion ) != 1 ||
HIBYTE( wsaData.wVersion ) != 1 ) {
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
// Tell the user that we couldn't find a useable
// winsock.dll.
WSACleanup( );
......
......@@ -30,7 +30,7 @@
//*****************************************************************
/**
* \file UdpMasterListener.cpp
* \file UdpHubListener.cpp
* \author Juan-Pablo Caceres and Chris Chafe
* \date September 2008
*/
......@@ -45,7 +45,7 @@
#include <QStringList>
#include <QMutexLocker>
#include "UdpMasterListener.h"
#include "UdpHubListener.h"
#include "JackTripWorker.h"
#include "jacktrip_globals.h"
......@@ -53,7 +53,7 @@ using std::cout; using std::endl;
//*******************************************************************************
UdpMasterListener::UdpMasterListener(int server_port) :
UdpHubListener::UdpHubListener(int server_port) :
//mJTWorker(NULL),
mServerPort(server_port),
mStopped(false),
......@@ -70,6 +70,9 @@ UdpMasterListener::UdpMasterListener(int server_port) :
mJTWorkers->insert(i, NULL);
}
qDebug() << "mThreadPool default maxThreadCount =" << mThreadPool.maxThreadCount();
mThreadPool.setMaxThreadCount(mThreadPool.maxThreadCount() * 16);
qDebug() << "mThreadPool maxThreadCount set to" << mThreadPool.maxThreadCount();
//mJTWorkers = new JackTripWorker(this);
mThreadPool.setExpiryTimeout(3000); // msec (-1) = forever
......@@ -91,7 +94,7 @@ UdpMasterListener::UdpMasterListener(int server_port) :
//*******************************************************************************
UdpMasterListener::~UdpMasterListener()
UdpHubListener::~UdpHubListener()
{
QMutexLocker lock(&mMutex);
mThreadPool.waitForDone();
......@@ -108,7 +111,7 @@ UdpMasterListener::~UdpMasterListener()
// the client is already on the thread pool, it means that a new connection is
// requested (the old was desconnected). So we have to remove that thread from
// the pool and then connect again.
void UdpMasterListener::run()
void UdpHubListener::run()
{
mStopped = false;
......@@ -208,7 +211,7 @@ void UdpMasterListener::run()
m_connectDefaultAudioPorts
); /// \todo temp default to 1 channel
qDebug() << "mPeerAddress" << id << mActiveAddress[id].address << mActiveAddress[id].port;
// qDebug() << "mPeerAddress" << id << mActiveAddress[id].address << mActiveAddress[id].port;
}
//send one thread to the pool
cout << "JackTrip HUB SERVER: Starting JackTripWorker..." << endl;
......@@ -223,7 +226,7 @@ void UdpMasterListener::run()
if (isWAIR()) connectMesh(true); // invoked with -Sw
#endif // endwhere
qDebug() << "mPeerAddress" << mActiveAddress[id].address << mActiveAddress[id].port;
// qDebug() << "mPeerAddress" << mActiveAddress[id].address << mActiveAddress[id].port;
connectPatch(true);
}
......@@ -231,12 +234,12 @@ void UdpMasterListener::run()
/*
// Create objects on the stack
QUdpSocket MasterUdpSocket;
QUdpSocket HubUdpSocket;
QHostAddress PeerAddress;
uint16_t peer_port; // Ougoing Peer port, in case they're not using the default
// Bind the socket to the well known port
bindUdpSocket(MasterUdpSocket, mServerPort);
bindUdpSocket(HubUdpSocket, mServerPort);
char buf[1];
cout << "Server Listening in UDP Port: " << mServerPort << endl;
......@@ -245,11 +248,11 @@ void UdpMasterListener::run()
while ( !mStopped )
{
//cout << "WAITING........................." << endl;
while ( MasterUdpSocket.hasPendingDatagrams() )
while ( HubUdpSocket.hasPendingDatagrams() )
{
cout << "Received request from Client!" << endl;
// Get Client IP Address and outgoing port from packet
int rv = MasterUdpSocket.readDatagram(buf, 1, &PeerAddress, &peer_port);
int rv = HubUdpSocket.readDatagram(buf, 1, &PeerAddress, &peer_port);