Commit ba3d81b1 authored by jcacerec's avatar jcacerec
Browse files

Port scheame working and tested with JamLinks in OS x

parent 4ccb238e
---
1.0.5
- (added) Compatibility with JamLink boxes (at 48KHz and 64 buffer size)
- (added) Option for packet without header
- (added) Option to change default client name
- (removed) Universal OS X support. Now only works with intel machines
- (added) option for packet without header
---
1.0.4
......
......@@ -103,10 +103,10 @@ public:
DataProtocol::packetHeaderTypeT PacketHeaderType =
DataProtocol::DEFAULT,
underrunModeT UnderRunMode = WAVETABLE,
int receiver_bind_port = gInputPort_0,
int sender_peer_port = gInputPort_0,
int sender_bind_port = gDefaultSendPort,
int receiver_peer_port = gDefaultSendPort);
int receiver_bind_port = gDefaultPort,
int sender_peer_port = gDefaultPort,
int sender_bind_port = gDefaultPort,
int receiver_peer_port = gDefaultPort);
/// \brief The class destructor
virtual ~JackTrip();
......@@ -168,18 +168,20 @@ public:
{
mReceiverBindPort = port;
mSenderPeerPort = port;
mSenderBindPort = port;
mReceiverPeerPort = port;
}
/// \brief Sets port numbers for the local machine.
/// Receive port is <tt>port</tt>
void setLocalPorts(int port)
/// \brief Sets port numbers to bind in RECEIVER and SENDER sockets.
void setBindPorts(int port)
{
mReceiverBindPort = port;
mSenderBindPort = port;
}
/// \brief Sets port numbers for the peer (remote) machine.
/// Receive port is <tt>port</tt>
void setPeerPorts(int port)
{
mSenderPeerPort = port;
mReceiverPeerPort = port;
}
/// \brief Set Client Name to something different that the default (JackTrip)
void setClientName(char* ClientName)
......
......@@ -115,7 +115,7 @@ void JackTripWorker::run()
// Create and setup JackTrip Object
JackTrip jacktrip(JackTrip::CLIENT, JackTrip::UDP, mNumChans, 2);
jacktrip.setPeerAddress( mClientAddress.toString().toLatin1().data() );
jacktrip.setLocalPorts(mServerPort);
jacktrip.setBindPorts(mServerPort);
jacktrip.setPeerPorts(mClientPort-1);
// Connect signals and slots
......
......@@ -61,7 +61,7 @@ Settings::Settings() :
mNumChans(2),
mBufferQueueLength(gDefaultQueueLength),
mAudioBitResolution(JackAudioInterface::BIT16),
mPortNum(gInputPort_0),
mPortNum(gDefaultPort),
mClientName(NULL),
mUnderrrunZero(false),
mLoopBack(false),
......@@ -258,7 +258,7 @@ void Settings::printUsage()
<< gDefaultQueueLength << ")" << endl;
cout << " -r, --redundancy # (1 or more) Packet Redundancy to avoid glitches with packet losses (defaul 1)"
<< endl;
cout << " -o, --portoffset # Receiving port offset from base port " << gInputPort_0 << endl;
cout << " -o, --portoffset # Receiving port offset from base port " << gDefaultPort << endl;
cout << " -b, --bitres # (8, 16, 24, 32) Audio Bit Rate Resolutions (default 16)" << endl;
cout << " -z, --zerounderrun Set buffer to zeros when underrun occurs (defaults to wavetable)" << endl;
cout << " -l, --loopback Run in Loop-Back Mode" << endl;
......@@ -322,7 +322,15 @@ void Settings::startJackTrip()
// Set in JamLink Mode
if ( mJamLink ) {
cout << "Running in JamLink Mode..." << endl;
mJackTrip->setPacketHeaderType(DataProtocol::JAMLINK); }
mJackTrip->setPacketHeaderType(DataProtocol::JAMLINK);
// JamLinks only receive in port gDefaultPort (4464), so we set that number here
mJackTrip->setPeerPorts(gDefaultPort);
// Also, because of the NAT traversal scheme, the portn need to be
// "symetric", e.g.:
// from JackTrip to JamLink : src = 4474, dest = 4464
// from JamLinl to JackTrip : src = 4464, dest = 4474
mJackTrip->setBindPorts(mPortNum);
}
// Set in EmptyHeader Mode
if ( mEmptyHeader ) {
......
......@@ -47,6 +47,12 @@
#include "jacktrip_globals.h"
/** \brief UDP implementation of DataProtocol class
*
* The class has a <tt>bind port</tt> and a <tt>peer port</tt>. The meaning of these
* depends on the runModeT. If it's a SENDER, <tt>bind port</tt> is the source port and
* <tt>peer port</tt> is the destination port for each UDP packet. If it's a RECEIVER,
* the <tt>bind port</tt> destination port (for incoming packets) and the <tt>peer port</tt>
* is the source port.
*/
class UdpDataProtocol : public DataProtocol
{
......@@ -105,11 +111,20 @@ public:
QHostAddress& peerHostAddress,
uint16_t& port);
/** \brief Sets the bind port number
*/
void setBindPort(int port)
{ mBindPort = port; }
/** \brief Sets the peer port number
*/
void setPeerPort(int port)
{ mPeerPort = port; }
/** \brief Implements the Thread Loop. To start the thread, call start()
* ( DO NOT CALL run() )
*
* This function creats and binds all the socket and start the connection loop thread.
*/
virtual void run();
......
......@@ -43,7 +43,7 @@
//namespace JackTrip/// \todo Add this namespace
const char* const gVersion = "1.0.4"; ///< JackTrip version
const char* const gVersion = "1.0.5"; ///< JackTrip version
//*******************************************************************************
/// \name Default Values
......@@ -60,9 +60,10 @@ const int gDefaultOutputQueueLength = 4;
//*******************************************************************************
/// \name Network related ports
//@{
const int gInputPort_0 = 4464; ///< Input base port
const int gDefaultPort = 4464; ///< Default JackTrip Port
//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
//const int gDefaultSendPort = 4464; ///< Default for to use to send packet
//@}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment