Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TPF
jacktrip
Commits
3fec5796
Unverified
Commit
3fec5796
authored
Jul 25, 2020
by
ntonnaett
Committed by
GitHub
Jul 25, 2020
Browse files
Merge pull request #94 from jacktrip/chris
Chris
parents
e73e98e5
549880aa
Changes
20
Hide whitespace changes
Inline
Side-by-side
CHANGESLOG.txt
View file @
3fec5796
---
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)
...
...
JMess.cpp
View file @
3fec5796
...
...
@@ -167,7 +167,7 @@ void JMess::setConnectedPorts()
}
//*******************************************************************************
void
JMess
::
connectSpawnedPorts
(
int
nChans
,
int
hubPatch
)
// called from Udp
Master
Listener::connectMesh
// called from Udp
Hub
Listener::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 Udp
Master
Listener::connectPatch
// called from Udp
Hub
Listener::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
...
...
externals/includes/QTWindows/libjack.dll
View file @
3fec5796
No preview for this file type
externals/includes/QTWindows/libjack.lib
View file @
3fec5796
No preview for this file type
externals/includes/rtaudio-4.0.7/RtAudio.cpp
View file @
3fec5796
...
...
@@ -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
,
kAudioObjectPropertyElement
Master
};
AudioObjectPropertyAddress
propertyAddress
=
{
kAudioHardwarePropertyDevices
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
AudioObjectPropertyAddress
property
=
{
kAudioHardwarePropertyDefaultInputDevice
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
AudioObjectPropertyAddress
property
=
{
kAudioHardwarePropertyDefaultOutputDevice
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
kAudioObjectPropertyElement
Hub
};
OSStatus
result
=
AudioObjectGetPropertyData
(
kAudioObjectSystemObject
,
&
property
,
0
,
NULL
,
&
dataSize
,
(
void
*
)
&
deviceList
);
if
(
result
!=
noErr
)
{
...
...
externals/rtaudio-4.1.1/RtAudio.cpp
View file @
3fec5796
...
...
@@ -472,7 +472,7 @@ RtApiCore:: RtApiCore()
CFRunLoopRef
theRunLoop
=
NULL
;
AudioObjectPropertyAddress
property
=
{
kAudioHardwarePropertyRunLoop
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElement
Master
};
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
AudioObjectPropertyAddress
propertyAddress
=
{
kAudioHardwarePropertyDevices
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
AudioObjectPropertyAddress
property
=
{
kAudioHardwarePropertyDefaultInputDevice
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
AudioObjectPropertyAddress
property
=
{
kAudioHardwarePropertyDefaultOutputDevice
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
kAudioObjectPropertyElement
Hub
};
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
,
kAudioObjectPropertyElement
Master
};
AudioObjectPropertyAddress
tmp
=
{
kAudioDevicePropertyNominalSampleRate
,
kAudioObjectPropertyScopeGlobal
,
kAudioObjectPropertyElement
Hub
};
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
<<
")."
;
...
...
externals/rtaudio-4.1.1/include/soundcard.h
View file @
3fec5796
...
...
@@ -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 */
...
...
meson.build
View file @
3fec5796
...
...
@@ -22,7 +22,7 @@ moc_h = ['src/DataProtocol.h',
'src/PacketHeader.h',
'src/Settings.h',
'src/UdpDataProtocol.h',
'src/Udp
Master
Listener.h']
'src/Udp
Hub
Listener.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/Udp
Master
Listener.cpp',
'src/Udp
Hub
Listener.cpp',
'src/AudioInterface.cpp',
'src/JackAudioInterface.cpp']
...
...
src/JMess.cpp
View file @
3fec5796
...
...
@@ -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 Udp
Master
Listener::connectMesh
// called from Udp
Hub
Listener::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 Udp
Master
Listener::connectPatch
// called from Udp
Hub
Listener::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
...
...
src/JMess.h
View file @
3fec5796
...
...
@@ -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
src/JackTrip.cpp
View file @
3fec5796
...
...
@@ -133,7 +133,7 @@ JackTrip::~JackTrip()
//*******************************************************************************
void
JackTrip
::
setupAudio
(
#ifdef WAIRTO
MASTER
// WAIR
#ifdef WAIRTO
HUB
// WAIR
int
ID
#endif // endwhere
)
...
...
@@ -156,14 +156,12 @@ 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
QByteArray
tmp
=
QString
(
mPeerAddress
).
replace
(
":"
,
"."
).
toLatin1
();
if
(
mPeerAddress
.
toStdString
()
!=
""
)
mJackClientName
=
tmp
.
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
...
...
@@ -319,7 +317,7 @@ void JackTrip::appendProcessPlugin(ProcessPlugin* plugin)
//*******************************************************************************
void
JackTrip
::
startProcess
(
#ifdef WAIRTO
MASTER
// WAIR
#ifdef WAIRTO
HUB
// WAIR
int
ID
#endif // endwhere
)
...
...
@@ -336,10 +334,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
;
...
...
@@ -348,7 +344,7 @@ void JackTrip::startProcess(
// ------------------------------
if
(
gVerboseFlag
)
std
::
cout
<<
" JackTrip:startProcess before setupAudio"
<<
std
::
endl
;
setupAudio
(
#ifdef WAIRTO
MASTER
// wair
#ifdef WAIRTO
HUB
// wair
ID
#endif // endwhere
);
...
...
src/JackTrip.h
View file @
3fec5796
...
...
@@ -161,7 +161,7 @@ public:
/// \brief Start the processing threads
virtual
void
startProcess
(
#ifdef WAIRTO
MASTER
// wair
#ifdef WAIRTO
HUB
// wair
int
ID
#endif // endwhere
);
...
...
@@ -437,7 +437,7 @@ public:
/// \brief Set the AudioInteface object
virtual
void
setupAudio
(
#ifdef WAIRTO
MASTER
// WAIR
#ifdef WAIRTO
HUB
// WAIR
int
ID
#endif // endwhere
);
...
...
src/JackTripWorker.cpp
View file @
3fec5796
...
...
@@ -44,7 +44,7 @@
#include
"JackTripWorker.h"
#include
"JackTrip.h"
#include
"Udp
Master
Listener.h"
#include
"Udp
Hub
Listener.h"
#include
"NetKS.h"
#include
"LoopBack.h"
#include
"Settings.h"
...
...
@@ -58,8 +58,8 @@
using
std
::
cout
;
using
std
::
endl
;
//*******************************************************************************
JackTripWorker
::
JackTripWorker
(
Udp
Master
Listener
*
udpmasterlistener
,
int
BufferQueueLength
,
JackTrip
::
underrunModeT
UnderRunMode
)
:
mUdp
Master
Listener
(
udpmasterlistener
),
JackTripWorker
::
JackTripWorker
(
Udp
Hub
Listener
*
udpmasterlistener
,
int
BufferQueueLength
,
JackTrip
::
underrunModeT
UnderRunMode
)
:
mUdp
Hub
Listener
(
udpmasterlistener
),
m_connectDefaultAudioPorts
(
false
),
mBufferQueueLength
(
BufferQueueLength
),
mUnderRunMode
(
UnderRunMode
),
...
...
@@ -80,7 +80,7 @@ JackTripWorker::JackTripWorker(UdpMasterListener* udpmasterlistener, int BufferQ
//*******************************************************************************
JackTripWorker
::~
JackTripWorker
()
{
//delete mUdp
Master
Listener;
//delete mUdp
Hub
Listener;
}
...
...
@@ -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
=
mUdp
Master
Listener
->
getSettings
();
Settings
*
settings
=
mUdp
Hub
Listener
->
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
(
mUdp
Master
Listener
->
isWAIR
())
{
// invoked with -Sw
if
(
mUdp
Hub
Listener
->
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
)
{
mUdp
Master
Listener
->
releaseThread
(
mID
);
mUdp
Hub
Listener
->
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 WAIRTO
MASTER
// wair
#ifdef WAIRTO
HUB
// 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
;
mUdp
Master
Listener
->
releaseThread
(
mID
);
mUdp
Hub
Listener
->
releaseThread
(
mID
);
{
QMutexLocker
locker
(
&
mMutex
);
mSpawning
=
false
;
}
return
;
}
{
QMutexLocker
locker
(
&
mMutex
);
mUdp
Master
Listener
->
releaseThread
(
mID
);
mUdp
Hub
Listener
->
releaseThread
(
mID
);
}
cout
<<
"JackTrip ID = "
<<
mID
<<
" released from the THREAD POOL"
<<
endl
;
...
...
src/JackTripWorker.h
View file @
3fec5796
...
...
@@ -50,7 +50,7 @@
#include
"jacktrip_globals.h"
//class JackTrip; // forward declaration
class
Udp
Master
Listener
;
// forward declaration
class
Udp
Hub
Listener
;
// 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
(
Udp
Master
Listener
*
udpmasterlistener
,
int
BufferQueueLength
=
gDefaultQueueLength
,
JackTrip
::
underrunModeT
UnderRunMode
=
JackTrip
::
WAVETABLE
);
JackTripWorker
(
Udp
Hub
Listener
*
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
();
Udp
Master
Listener
*
mUdp
Master
Listener
;
///<
Master
Listener Socket
Udp
Hub
Listener
*
mUdp
Hub
Listener
;
///<
Hub
Listener Socket
//QHostAddress mClientAddress; ///< Client Address
QString
mClientAddress
;
uint16_t
mServerPort
;
///< Server Ephemeral Incomming Port to use with Client
...
...
src/Settings.cpp
View file @
3fec5796
...
...
@@ -44,7 +44,7 @@
#include
"Stk16.dsp.h"
#endif // endwhere
#include
"Udp
Master
Listener.h"
#include
"Udp
Hub
Listener.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-20
18
Juan-Pablo Caceres, Chris Chafe."
<<
endl
;
cout
<<
"Copyright (c) 2008-20
20
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-20
18
Juan-Pablo Caceres, Chris Chafe."
<<
endl
;
cout
<<
"Copyright (c) 2008-20
20
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
)
{
Udp
Master
Listener
*
udpmaster
=
new
Udp
Master
Listener
;
Udp
Hub
Listener
*
udpmaster
=
new
Udp
Hub
Listener
;
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 WAIRTO
MASTER
// WAIR
#ifdef WAIRTO
HUB
// WAIR
0
// for WAIR compatibility, ID in jack client name
#endif // endwhere
);
...
...
src/UdpDataProtocol.cpp
View file @
3fec5796
...
...
@@ -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
(
);
...
...
src/Udp
Master
Listener.cpp
→
src/Udp
Hub
Listener.cpp
View file @
3fec5796
...
...
@@ -30,7 +30,7 @@
//*****************************************************************
/**
* \file Udp
Master
Listener.cpp
* \file Udp
Hub
Listener.cpp
* \author Juan-Pablo Caceres and Chris Chafe
* \date September 2008
*/
...
...
@@ -45,7 +45,7 @@
#include
<QStringList>
#include
<QMutexLocker>
#include
"Udp
Master
Listener.h"
#include
"Udp
Hub
Listener.h"
#include
"JackTripWorker.h"
#include
"jacktrip_globals.h"
...
...
@@ -53,7 +53,7 @@ using std::cout; using std::endl;
//*******************************************************************************
Udp
Master
Listener
::
Udp
Master
Listener
(
int
server_port
)
:
Udp
Hub
Listener
::
Udp
Hub
Listener
(
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) :
//*******************************************************************************
Udp
Master
Listener
::~
Udp
Master
Listener
()
Udp
Hub
Listener
::~
Udp
Hub
Listener
()
{
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
Udp
Master
Listener
::
run
()
void
Udp
Hub
Listener
::
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
Master
UdpSocket;
QUdpSocket
Hub
UdpSocket;
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(
Master
UdpSocket, mServerPort);
bindUdpSocket(
Hub
UdpSocket, 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 (
Master
UdpSocket.hasPendingDatagrams() )
while (
Hub
UdpSocket.hasPendingDatagrams() )
{
cout << "Received request from Client!" << endl;
// Get Client IP Address and outgoing port from packet
int rv =
Master
UdpSocket.readDatagram(buf, 1, &PeerAddress, &peer_port);
int rv =
Hub
UdpSocket.readDatagram(buf, 1, &PeerAddress, &peer_port);
cout << "Peer Port in Server ==== " << peer_port << endl;
if (rv < 0) { std::cerr << "ERROR: Bad UDP packet read..." << endl; }
...
...
@@ -283,7 +286,7 @@ void UdpMasterListener::run()
//*******************************************************************************
// Returns 0 on error
int
Udp
Master
Listener
::
readClientUdpPort
(
QTcpSocket
*
clientConnection
)
int
Udp
Hub
Listener
::
readClientUdpPort
(
QTcpSocket
*
clientConnection
)
{
// Read the size of the package
// ----------------------------
...
...
@@ -309,7 +312,7 @@ int UdpMasterListener::readClientUdpPort(QTcpSocket* clientConnection)
//*******************************************************************************
int
Udp
Master
Listener
::
sendUdpPort
(
QTcpSocket
*
clientConnection
,
int
udp_port
)
int
Udp
Hub
Listener
::
sendUdpPort
(
QTcpSocket
*
clientConnection
,
int
udp_port
)
{
// Send Port Number to Client
// --------------------------
...
...
@@ -331,7 +334,7 @@ int UdpMasterListener::sendUdpPort(QTcpSocket* clientConnection, int udp_port)
//*******************************************************************************
/*
void Udp
Master
Listener::sendToPoolPrototype(int id)
void Udp
Hub
Listener::sendToPoolPrototype(int id)
{
mJTWorker->setJackTrip(id, mActiveAddress[id][0],
mBasePort+(2*id), mActiveAddress[id][1],
...
...
@@ -342,7 +345,7 @@ void UdpMasterListener::sendToPoolPrototype(int id)
//*******************************************************************************
void
Udp
Master
Listener
::
bindUdpSocket
(
QUdpSocket
&
udpsocket
,
int
port
)
void
Udp
Hub
Listener
::
bindUdpSocket
(
QUdpSocket
&
udpsocket
,
int
port
)
{
// QHostAddress::Any : let the kernel decide the active address
if
(
!
udpsocket
.
bind
(
QHostAddress
::
Any
,