JackTrip: src/JackTrip.h Source File

JackTrip

JackTrip.h
Go to the documentation of this file.
1 //*****************************************************************
2 /*
3 JackTrip: A System for High-Quality Audio Network Performance
4 over the Internet
5
6 Copyright (c) 2008 Juan-Pablo Caceres, Chris Chafe.
7 SoundWIRE group at CCRMA, Stanford University.
8
9 Permission is hereby granted, free of charge, to any person
10 obtaining a copy of this software and associated documentation
11 files (the "Software"), to deal in the Software without
12 restriction, including without limitation the rights to use,
13 copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the
15 Software is furnished to do so, subject to the following
16 conditions:
17
18 The above copyright notice and this permission notice shall be
19 included in all copies or substantial portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 OTHER DEALINGS IN THE SOFTWARE.
29 */
30 //*****************************************************************
31
38 #ifndef __JACKTRIP_H__
39 #define __JACKTRIP_H__
40
41 //#include <tr1/memory> //for shared_ptr
42 #include <stdexcept>
43
44 #include <QObject>
45 #include <QString>
46 #include <QUdpSocket>
47
48 #include "DataProtocol.h"
49 #include "AudioInterface.h"
50
51 #ifndef __NO_JACK__
52 #include "JackAudioInterface.h"
53 #endif //__NO_JACK__
54
55 #include "PacketHeader.h"
56 #include "RingBuffer.h"
57
58 #include <signal.h>
67 class JackTrip : public QThread
68 {
69 Q_OBJECT;
70
71 public:
72
73 //----------ENUMS------------------------------------------
75 enum dataProtocolT {
76 UDP,
77 TCP,
78 SCTP
79 };
80
82 enum jacktripModeT {
83 SERVER,
84 CLIENT,
85 CLIENTTOPINGSERVER,
86 SERVERPINGSERVER
87 };
88
90 enum underrunModeT {
91 WAVETABLE,
92 ZEROS
93 };
94
96 enum audiointerfaceModeT {
97 JACK,
98 RTAUDIO
99 };
100
102 enum connectionModeT {
103 NORMAL,
104 KSTRONG,
105 JAMTEST
106 };
107 //---------------------------------------------------------
108
109
118 JackTrip(jacktripModeT JacktripMode = CLIENT,
119 dataProtocolT DataProtocolType = UDP,
120 int NumChans = gDefaultNumInChannels,
121 int BufferQueueLength = gDefaultQueueLength,
122 unsigned int redundancy = gDefaultRedundancy,
123 AudioInterface::audioBitResolutionT AudioBitResolution =
124 AudioInterface::BIT16,
125 DataProtocol::packetHeaderTypeT PacketHeaderType =
126 DataProtocol::DEFAULT,
127 underrunModeT UnderRunMode = WAVETABLE,
128 int receiver_bind_port = gDefaultPort,
129 int sender_bind_port = gDefaultPort,
130 int receiver_peer_port = gDefaultPort,
131 int sender_peer_port = gDefaultPort);
132
134 virtual ~JackTrip();
135
137 virtual void run() {}
138
140 virtual void setPeerAddress(const char* PeerHostOrIP);
141
145 //void appendProcessPlugin(const std::tr1::shared_ptr<ProcessPlugin> plugin);
146 virtual void appendProcessPlugin(ProcessPlugin* plugin);
147
149 virtual void startProcess() throw(std::invalid_argument);
150
152 virtual void stop();
153
156 virtual void waitThreads();
157
160 virtual void checkIfPortIsBinded(int port);
161
162 //------------------------------------------------------------------------------------
164
165 //
167 virtual void setJackTripMode(jacktripModeT JacktripMode)
168 { mJackTripMode = JacktripMode; }
170 virtual void setDataProtocoType(dataProtocolT DataProtocolType)
171 { mDataProtocol = DataProtocolType; }
173 virtual void setPacketHeaderType(DataProtocol::packetHeaderTypeT PacketHeaderType)
174 {
175 mPacketHeaderType = PacketHeaderType;
176 delete mPacketHeader;
177 mPacketHeader = NULL;
178 createHeader(mPacketHeaderType);
179 }
181 virtual void setBufferQueueLength(int BufferQueueLength)
182 { mBufferQueueLength = BufferQueueLength; }
184 virtual void setAudioBitResolution(AudioInterface::audioBitResolutionT AudioBitResolution)
185 { mAudioBitResolution = AudioBitResolution; }
187 virtual void setUnderRunMode(underrunModeT UnderRunMode)
188 { mUnderRunMode = UnderRunMode; }
191 virtual void setAllPorts(int port)
192 {
193 mReceiverBindPort = port;
194 mSenderPeerPort = port;
195 mSenderBindPort = port;
196 mReceiverPeerPort = port;
197 }
199 virtual void setBindPorts(int port)
200 {
201 mReceiverBindPort = port;
202 mSenderBindPort = port;
203 }
205 virtual void setPeerPorts(int port)
206 {
207 mSenderPeerPort = port;
208 mReceiverPeerPort = port;
209 }
211 virtual void setClientName(const char* ClientName)
212 { mJackClientName = ClientName; }
214 virtual void setNumChannels(int num_chans)
215 { mNumChans = num_chans; }
216
217 virtual int getReceiverBindPort() const
218 { return mReceiverBindPort; }
219 virtual int getSenderPeerPort() const
220 { return mSenderPeerPort; }
221 virtual int getSenderBindPort() const
222 { return mSenderBindPort; }
223 virtual int getReceiverPeerPort() const
224 { return mReceiverPeerPort; }
225
226 virtual DataProtocol* getDataProtocolSender() const
227 { return mDataProtocolSender; }
228 virtual DataProtocol* getDataProtocolReceiver() const
229 { return mDataProtocolReceiver; }
230 virtual void setDataProtocolSender(DataProtocol* const DataProtocolSender)
231 { mDataProtocolSender = DataProtocolSender; }
232 virtual void setDataProtocolReceiver(DataProtocol* const DataProtocolReceiver)
233 { mDataProtocolReceiver = DataProtocolReceiver; }
234
235 virtual RingBuffer* getSendRingBuffer() const
236 { return mSendRingBuffer; }
237 virtual RingBuffer* getReceiveRingBuffer() const
238 { return mReceiveRingBuffer; }
239 virtual void setSendRingBuffer(RingBuffer* const SendRingBuffer)
240 { mSendRingBuffer = SendRingBuffer; }
241 virtual void setReceiveRingBuffer(RingBuffer* const ReceiveRingBuffer)
242 { mReceiveRingBuffer = ReceiveRingBuffer; }
243
244 virtual void setPacketHeader(PacketHeader* const PacketHeader)
245 { mPacketHeader = PacketHeader; }
246
247 virtual int getRingBuffersSlotSize()
248 { return getTotalAudioPacketSizeInBytes(); }
249
250 virtual void setAudiointerfaceMode(JackTrip::audiointerfaceModeT audiointerface_mode)
251 { mAudiointerfaceMode = audiointerface_mode; }
252 virtual void setAudioInterface(AudioInterface* const AudioInterface)
253 { mAudioInterface = AudioInterface; }
254
255
256 void setSampleRate(uint32_t sample_rate)
257 { mSampleRate = sample_rate; }
258 void setAudioBufferSizeInSamples(uint32_t buf_size)
259 { mAudioBufferSize = buf_size; }
260
261 JackTrip::connectionModeT getConnectionMode() const
262 { return mConnectionMode; }
263 void setConnectionMode(JackTrip::connectionModeT connection_mode)
264 { mConnectionMode = connection_mode; }
265
266 JackTrip::jacktripModeT getJackTripMode() const
267 { return mJackTripMode; }
268
269 QString getPeerAddress() const
270 { return mPeerAddress; }
271
272 bool receivedConnectionFromPeer()
273 { return mReceivedConnection; }
274
275 bool tcpConnectionError()
276 { return mTcpConnectionError; }
278 //------------------------------------------------------------------------------------
279
280
281 //------------------------------------------------------------------------------------
283
284 virtual void createHeader(const DataProtocol::packetHeaderTypeT headertype);
286 void putHeaderInPacket(int8_t* full_packet, int8_t* audio_packet);
287 virtual int getPacketSizeInBytes();
288 void parseAudioPacket(int8_t* full_packet, int8_t* audio_packet);
289 virtual void sendNetworkPacket(const int8_t* ptrToSlot)
290 { mSendRingBuffer->insertSlotNonBlocking(ptrToSlot); }
291 virtual void receiveNetworkPacket(int8_t* ptrToReadSlot)
292 { mReceiveRingBuffer->readSlotNonBlocking(ptrToReadSlot); }
293 virtual void readAudioBuffer(int8_t* ptrToReadSlot)
294 { mSendRingBuffer->readSlotBlocking(ptrToReadSlot); }
295 virtual void writeAudioBuffer(const int8_t* ptrToSlot)
296 { mReceiveRingBuffer->insertSlotNonBlocking(ptrToSlot); }
297 uint32_t getBufferSizeInSamples() const
298 { return mAudioBufferSize; /*return mAudioInterface->getBufferSizeInSamples();*/ }
299
300 AudioInterface::samplingRateT getSampleRateType() const
301 { return mAudioInterface->getSampleRateType(); }
302 int getSampleRate() const
303 { return mSampleRate; /*return mAudioInterface->getSampleRate();*/ }
304
305 uint8_t getAudioBitResolution() const
306 { return mAudioBitResolution*8; /*return mAudioInterface->getAudioBitResolution();*/ }
307 unsigned int getNumInputChannels() const
308 { return mNumChans; /*return mAudioInterface->getNumInputChannels();*/ }
309 unsigned int getNumOutputChannels() const
310 { return mNumChans; /*return mAudioInterface->getNumOutputChannels();*/ }
311 unsigned int getNumChannels() const
312 {
313 if (getNumInputChannels() == getNumOutputChannels())
314 { return getNumInputChannels(); }
315 else { return 0; }
316 }
317 virtual void checkPeerSettings(int8_t* full_packet);
318 void increaseSequenceNumber()
319 { mPacketHeader->increaseSequenceNumber(); }
320 int getSequenceNumber() const
321 { return mPacketHeader->getSequenceNumber(); }
322
323 uint64_t getPeerTimeStamp(int8_t* full_packet) const
324 { return mPacketHeader->getPeerTimeStamp(full_packet); }
325
326 uint16_t getPeerSequenceNumber(int8_t* full_packet) const
327 { return mPacketHeader->getPeerSequenceNumber(full_packet); }
328
329 uint16_t getPeerBufferSize(int8_t* full_packet) const
330 { return mPacketHeader->getPeerBufferSize(full_packet); }
331
332 uint8_t getPeerSamplingRate(int8_t* full_packet) const
333 { return mPacketHeader->getPeerSamplingRate(full_packet); }
334
335 uint8_t getPeerBitResolution(int8_t* full_packet) const
336 { return mPacketHeader->getPeerBitResolution(full_packet); }
337
338 uint8_t getPeerNumChannels(int8_t* full_packet) const
339 { return mPacketHeader->getPeerNumChannels(full_packet); }
340
341 uint8_t getPeerConnectionMode(int8_t* full_packet) const
342 { return mPacketHeader->getPeerConnectionMode(full_packet); }
343
344 size_t getSizeInBytesPerChannel() const
345 { return mAudioInterface->getSizeInBytesPerChannel(); }
346 int getHeaderSizeInBytes() const
347 { return mPacketHeader->getHeaderSizeInBytes(); }
348 virtual int getTotalAudioPacketSizeInBytes() const
349 { return mAudioInterface->getSizeInBytesPerChannel() * mNumChans; }
351 //------------------------------------------------------------------------------------
352
353 void printTextTest() {std::cout << "=== JackTrip PRINT ===" << std::endl;}
354 void printTextTest2() {std::cout << "=== JackTrip PRINT2 ===" << std::endl;}
355
356 public slots:
358 virtual void slotStopProcesses()
359 {
360 std::cout << "Stopping JackTrip..." << std::endl;
361 mStopped = true;
362 this->stop();
363 }
364
370 void slotUdpWatingTooLong(int wait_msec)
371 {
372 int wait_time = 30000; // msec
373 if ( !(wait_msec%wait_time) ) {
374 std::cerr << "UDP WAITED MORE THAN 30 seconds." << std::endl;
375 emit signalNoUdpPacketsForSeconds();
376 }
377 }
378 void slotPrintTest()
379 { std::cout << "=== TESTING ===" << std::endl; }
380 void slotReceivedConnectionFromPeer()
381 { mReceivedConnection = true; }
382
383
384 signals:
385
386 void signalUdpTimeOut();
388 void signalProcessesStopped();
390 void signalNoUdpPacketsForSeconds();
391 void signalTcpClientConnected();
392
393
394 public:
395
397 virtual void setupAudio();
399 void closeAudio();
401 virtual void setupDataProtocol();
403 void setupRingBuffers();
405 void clientStart() throw(std::invalid_argument);
410 int serverStart(bool timeout = false, int udpTimeout = gTimeOutMultiThreadedServer)
411 throw(std::invalid_argument, std::runtime_error);
414 virtual int clientPingToServerStart() throw(std::invalid_argument);
415
416 private:
417 //void bindReceiveSocket(QUdpSocket& UdpSocket, int bind_port,
418 // QHostAddress PeerHostAddress, int peer_port)
419 //throw(std::runtime_error);
420
421
422 jacktripModeT mJackTripMode;
423 dataProtocolT mDataProtocol;
424 DataProtocol::packetHeaderTypeT mPacketHeaderType;
425 JackTrip::audiointerfaceModeT mAudiointerfaceMode;
426
427 int mNumChans;
428 int mBufferQueueLength;
429 uint32_t mSampleRate;
430 uint32_t mAudioBufferSize;
431 AudioInterface::audioBitResolutionT mAudioBitResolution;
432 QString mPeerAddress;
433
435 DataProtocol* mDataProtocolSender;
437 DataProtocol* mDataProtocolReceiver;
438 AudioInterface* mAudioInterface;
439 PacketHeader* mPacketHeader;
440 underrunModeT mUnderRunMode;
441
443 RingBuffer* mSendRingBuffer;
445 RingBuffer* mReceiveRingBuffer;
446
447 int mReceiverBindPort;
448 int mSenderPeerPort;
449 int mSenderBindPort;
450 int mReceiverPeerPort;
451 int mTcpServerPort;
452
453 unsigned int mRedundancy;
454 const char* mJackClientName;
455
456 JackTrip::connectionModeT mConnectionMode;
457
458 QVector<ProcessPlugin*> mProcessPlugins;
459
460 volatile bool mReceivedConnection;
461 volatile bool mTcpConnectionError;
462 volatile bool mStopped;
463 };
464
465 #endif
466
467
JackTrip::getSenderPeerPort
virtual int getSenderPeerPort() const
Definition: JackTrip.h:219
JackTrip::setClientName
virtual void setClientName(const char *ClientName)
Set Client Name to something different that the default (JackTrip)
Definition: JackTrip.h:211
JackTrip::UDP
Use UDP (User Datagram Protocol)
Definition: JackTrip.h:76
JackTrip::setSampleRate
void setSampleRate(uint32_t sample_rate)
Definition: JackTrip.h:256
AudioInterface::audioBitResolutionT
audioBitResolutionT
Enum for Audio Resolution in bits.
Definition: AudioInterface.h:61
JackTrip::receivedConnectionFromPeer
bool receivedConnectionFromPeer()
Definition: JackTrip.h:272
JackTrip::getPeerConnectionMode
uint8_t getPeerConnectionMode(int8_t *full_packet) const
Definition: JackTrip.h:341
AudioInterface
Base Class that provides an interface with audio.
Definition: AudioInterface.h:56
JackTrip::setAudiointerfaceMode
virtual void setAudiointerfaceMode(JackTrip::audiointerfaceModeT audiointerface_mode)
Definition: JackTrip.h:250
JackTrip::setDataProtocolReceiver
virtual void setDataProtocolReceiver(DataProtocol *const DataProtocolReceiver)
Definition: JackTrip.h:232
JackTrip::readAudioBuffer
virtual void readAudioBuffer(int8_t *ptrToReadSlot)
Definition: JackTrip.h:293
JackTrip::getBufferSizeInSamples
uint32_t getBufferSizeInSamples() const
Definition: JackTrip.h:297
JackTrip::closeAudio
void closeAudio()
Close the JackAudioInteface and disconnects it from JACK.
Definition: JackTrip.cpp:176
JackTrip::checkIfPortIsBinded
virtual void checkIfPortIsBinded(int port)
Check if UDP port is already binded.
Definition: JackTrip.cpp:730
JackTrip::getPeerNumChannels
uint8_t getPeerNumChannels(int8_t *full_packet) const
Definition: JackTrip.h:338
JackTrip::createHeader
virtual void createHeader(const DataProtocol::packetHeaderTypeT headertype)
Definition: JackTrip.cpp:666
PacketHeader::getPeerSequenceNumber
virtual uint16_t getPeerSequenceNumber(int8_t *full_packet) const =0
PacketHeader::getPeerBitResolution
virtual uint8_t getPeerBitResolution(int8_t *full_packet) const =0
JackTrip::WAVETABLE
Loops on the last received packet.
Definition: JackTrip.h:91
JackTrip::appendProcessPlugin
virtual void appendProcessPlugin(ProcessPlugin *plugin)
Append a process plugin. Processes will be appended in order.
Definition: JackTrip.cpp:274
JackTrip::checkPeerSettings
virtual void checkPeerSettings(int8_t *full_packet)
Definition: JackTrip.cpp:723
JackTrip::getPeerBitResolution
uint8_t getPeerBitResolution(int8_t *full_packet) const
Definition: JackTrip.h:335
JackTrip::signalUdpTimeOut
void signalUdpTimeOut()
Definition: moc_JackTrip.cpp:182
JackTrip::NORMAL
Normal Mode.
Definition: JackTrip.h:103
JackTrip::printTextTest2
void printTextTest2()
Definition: JackTrip.h:354
JackTrip::writeAudioBuffer
virtual void writeAudioBuffer(const int8_t *ptrToSlot)
Definition: JackTrip.h:295
JackTrip::~JackTrip
virtual ~JackTrip()
The class destructor.
Definition: JackTrip.cpp:111
JackTrip::getReceiveRingBuffer
virtual RingBuffer * getReceiveRingBuffer() const
Definition: JackTrip.h:237
JackTrip::slotReceivedConnectionFromPeer
void slotReceivedConnectionFromPeer()
Definition: JackTrip.h:380
JackTrip::JAMTEST
Karplus Strong.
Definition: JackTrip.h:105
JackTrip::audiointerfaceModeT
audiointerfaceModeT
Enum for Audio Interface Mode.
Definition: JackTrip.h:96
JackTrip::getNumInputChannels
unsigned int getNumInputChannels() const
Definition: JackTrip.h:307
PacketHeader::getPeerNumChannels
virtual uint8_t getPeerNumChannels(int8_t *full_packet) const =0
JackTrip::signalNoUdpPacketsForSeconds
void signalNoUdpPacketsForSeconds()
Signal emitted when no UDP Packets have been received for a while.
Definition: moc_JackTrip.cpp:194
AudioInterface::samplingRateT
samplingRateT
Sampling Rates supported by JACK.
Definition: AudioInterface.h:69
JackTrip::setPeerAddress
virtual void setPeerAddress(const char *PeerHostOrIP)
Set the Peer Address for jacktripModeT::CLIENT mode only.
Definition: JackTrip.cpp:267
JackTrip::getTotalAudioPacketSizeInBytes
virtual int getTotalAudioPacketSizeInBytes() const
Definition: JackTrip.h:348
JackTrip::JACK
Jack Mode.
Definition: JackTrip.h:97
gDefaultNumInChannels
const int gDefaultNumInChannels
Definition: jacktrip_globals.h:52
JackTrip::JackTrip
JackTrip(jacktripModeT JacktripMode=CLIENT, dataProtocolT DataProtocolType=UDP, int NumChans=gDefaultNumInChannels, int BufferQueueLength=gDefaultQueueLength, unsigned int redundancy=gDefaultRedundancy, AudioInterface::audioBitResolutionT AudioBitResolution=AudioInterface::BIT16, DataProtocol::packetHeaderTypeT PacketHeaderType=DataProtocol::DEFAULT, underrunModeT UnderRunMode=WAVETABLE, int receiver_bind_port=gDefaultPort, int sender_bind_port=gDefaultPort, int receiver_peer_port=gDefaultPort, int sender_peer_port=gDefaultPort)
The class Constructor with Default Parameters.
Definition: JackTrip.cpp:68
JackTrip::tcpConnectionError
bool tcpConnectionError()
Definition: JackTrip.h:275
JackTrip::setAudioBufferSizeInSamples
void setAudioBufferSizeInSamples(uint32_t buf_size)
Definition: JackTrip.h:258
JackTrip::underrunModeT
underrunModeT
Enum for the JackTrip Underrun Mode, when packets.
Definition: JackTrip.h:90
JackTrip::increaseSequenceNumber
void increaseSequenceNumber()
Definition: JackTrip.h:318
uint32_t
quint32 uint32_t
Typedef for unsigned int. This type is guaranteed to be 32-bit.
Definition: jacktrip_types.h:73
PacketHeader::getPeerTimeStamp
virtual uint64_t getPeerTimeStamp(int8_t *full_packet) const =0
AudioInterface.h
JackTrip::getSequenceNumber
int getSequenceNumber() const
Definition: JackTrip.h:320
JackTrip::setPacketHeaderType
virtual void setPacketHeaderType(DataProtocol::packetHeaderTypeT PacketHeaderType)
Sets the Packet header type.
Definition: JackTrip.h:173
JackTrip::connectionModeT
connectionModeT
Enum for Connection Mode (useful for connections to MultiClient Server)
Definition: JackTrip.h:102
AudioInterface::BIT16
16 bits (default)
Definition: AudioInterface.h:63
DataProtocol::packetHeaderTypeT
packetHeaderTypeT
Enum to define packet header types.
Definition: DataProtocol.h:100
JackTrip::getPeerTimeStamp
uint64_t getPeerTimeStamp(int8_t *full_packet) const
Definition: JackTrip.h:323
JackTrip::startProcess
virtual void startProcess()
Start the processing threads.
Definition: JackTrip.cpp:282
JackTrip::getNumOutputChannels
unsigned int getNumOutputChannels() const
Definition: JackTrip.h:309
DataProtocol.h
JackTrip::parseAudioPacket
void parseAudioPacket(int8_t *full_packet, int8_t *audio_packet)
Definition: JackTrip.cpp:712
PacketHeader
Base class for header type. Subclass this struct to create a new header.
Definition: PacketHeader.h:117
JackTrip::clientPingToServerStart
virtual int clientPingToServerStart()
Stats for the Client to Ping Server.
Definition: JackTrip.cpp:475
JackTrip::setJackTripMode
virtual void setJackTripMode(jacktripModeT JacktripMode)
Sets (override) JackTrip Mode after construction.
Definition: JackTrip.h:167
JackTrip::setupAudio
virtual void setupAudio()
Set the AudioInteface object.
Definition: JackTrip.cpp:124
JackTrip::SERVER
Run in Server Mode.
Definition: JackTrip.h:83
PacketHeader::getHeaderSizeInBytes
virtual int getHeaderSizeInBytes() const =0
Get the header size in bytes.
JackTrip::getPeerSamplingRate
uint8_t getPeerSamplingRate(int8_t *full_packet) const
Definition: JackTrip.h:332
gDefaultPort
const int gDefaultPort
Default JackTrip Port.
Definition: jacktrip_globals.h:72
RingBuffer.h
JackTrip::putHeaderInPacket
void putHeaderInPacket(int8_t *full_packet, int8_t *audio_packet)
Definition: JackTrip.cpp:687
ProcessPlugin
Interface for the process plugins to add to the JACK callback process in JackAudioInterface.
Definition: ProcessPlugin.h:52
JackTrip::getAudioBitResolution
uint8_t getAudioBitResolution() const
Definition: JackTrip.h:305
JackTrip::serverStart
int serverStart(bool timeout=false, int udpTimeout=gTimeOutMultiThreadedServer)
Starts for the SERVER mode.
Definition: JackTrip.cpp:404
JackTrip::getHeaderSizeInBytes
int getHeaderSizeInBytes() const
Definition: JackTrip.h:346
PacketHeader.h
JackTrip::stop
virtual void stop()
Stop the processing threads.
Definition: JackTrip.cpp:357
AudioInterface::getSampleRateType
virtual samplingRateT getSampleRateType() const
Get the Jack Server Sampling Rate Enum Type samplingRateT.
Definition: AudioInterface.cpp:333
JackTrip::setAllPorts
virtual void setAllPorts(int port)
Sets port numbers for the local and peer machine. Receive port is port
Definition: JackTrip.h:191
JackTrip::waitThreads
virtual void waitThreads()
Wait for all the threads to finish. This functions is used when JackTrip is run as a thread...
Definition: JackTrip.cpp:380
JackTrip::setNumChannels
virtual void setNumChannels(int num_chans)
Set the number of audio channels.
Definition: JackTrip.h:214
JackTrip::run
virtual void run()
Starting point for the thread.
Definition: JackTrip.h:137
JackTrip::getRingBuffersSlotSize
virtual int getRingBuffersSlotSize()
Definition: JackTrip.h:247
JackTrip::getNumChannels
unsigned int getNumChannels() const
Definition: JackTrip.h:311
JackTrip::setUnderRunMode
virtual void setUnderRunMode(underrunModeT UnderRunMode)
Sets (override) Underrun Mode.
Definition: JackTrip.h:187
int8_t
qint8 int8_t
Typedef for unsigned long long int. This type is guaranteed to be 64-bit.
Definition: jacktrip_types.h:78
JackTrip::KSTRONG
Karplus Strong.
Definition: JackTrip.h:104
JackTrip::getSampleRateType
AudioInterface::samplingRateT getSampleRateType() const
Definition: JackTrip.h:300
JackTrip::SCTP
NOT IMPLEMENTED: Use SCTP (Stream Control Transmission Protocol)
Definition: JackTrip.h:78
PacketHeader::getPeerBufferSize
virtual uint16_t getPeerBufferSize(int8_t *full_packet) const =0
JackTrip::getPeerSequenceNumber
uint16_t getPeerSequenceNumber(int8_t *full_packet) const
Definition: JackTrip.h:326
JackTrip::getPacketSizeInBytes
virtual int getPacketSizeInBytes()
Definition: JackTrip.cpp:701
JackTrip::RTAUDIO
RtAudio Mode.
Definition: JackTrip.h:98
JackTrip::setDataProtocolSender
virtual void setDataProtocolSender(DataProtocol *const DataProtocolSender)
Definition: JackTrip.h:230
JackTrip::getJackTripMode
JackTrip::jacktripModeT getJackTripMode() const
Definition: JackTrip.h:266
JackTrip::getSendRingBuffer
virtual RingBuffer * getSendRingBuffer() const
Definition: JackTrip.h:235
DataProtocol
Base class that defines the transmission protocol.
Definition: DataProtocol.h:92
JackTrip::printTextTest
void printTextTest()
Definition: JackTrip.h:353
gDefaultQueueLength
const int gDefaultQueueLength
Definition: jacktrip_globals.h:58
JackTrip::setDataProtocoType
virtual void setDataProtocoType(dataProtocolT DataProtocolType)
Sets (override) DataProtocol Type after construction.
Definition: JackTrip.h:170
JackTrip::setConnectionMode
void setConnectionMode(JackTrip::connectionModeT connection_mode)
Definition: JackTrip.h:263
JackTrip::getSampleRate
int getSampleRate() const
Definition: JackTrip.h:302
JackTrip::getSizeInBytesPerChannel
size_t getSizeInBytesPerChannel() const
Definition: JackTrip.h:344
JackAudioInterface.h
JackTrip::getReceiverBindPort
virtual int getReceiverBindPort() const
Definition: JackTrip.h:217
DataProtocol::DEFAULT
Default application header.
Definition: DataProtocol.h:101
JackTrip::slotPrintTest
void slotPrintTest()
Definition: JackTrip.h:378
gTimeOutMultiThreadedServer
const int gTimeOutMultiThreadedServer
Definition: jacktrip_globals.h:64
JackTrip::setBufferQueueLength
virtual void setBufferQueueLength(int BufferQueueLength)
Sets (override) Buffer Queue Length Mode after construction.
Definition: JackTrip.h:181
RingBuffer
Provides a ring-buffer (or circular-buffer) that can be written to and read from asynchronously (bloc...
Definition: RingBuffer.h:57
JackTrip::sendNetworkPacket
virtual void sendNetworkPacket(const int8_t *ptrToSlot)
Definition: JackTrip.h:289
PacketHeader::getSequenceNumber
virtual uint16_t getSequenceNumber() const
Returns the current sequence number.
Definition: PacketHeader.h:151
JackTrip::setPeerPorts
virtual void setPeerPorts(int port)
Sets port numbers for the peer (remote) machine.
Definition: JackTrip.h:205
JackTrip::receiveNetworkPacket
virtual void receiveNetworkPacket(int8_t *ptrToReadSlot)
Definition: JackTrip.h:291
JackTrip::signalTcpClientConnected
void signalTcpClientConnected()
Definition: moc_JackTrip.cpp:200
JackTrip::jacktripModeT
jacktripModeT
Enum for the JackTrip mode.
Definition: JackTrip.h:82
JackTrip::clientStart
void clientStart()
Starts for the CLIENT mode.
Definition: JackTrip.cpp:388
JackTrip::getSenderBindPort
virtual int getSenderBindPort() const
Definition: JackTrip.h:221
gDefaultRedundancy
const int gDefaultRedundancy
Definition: jacktrip_globals.h:63
JackTrip::setAudioInterface
virtual void setAudioInterface(AudioInterface *const AudioInterface)
Definition: JackTrip.h:252
PacketHeader::getPeerConnectionMode
virtual uint8_t getPeerConnectionMode(int8_t *full_packet) const =0
JackTrip::ZEROS
Set new buffers to zero if there are no new ones.
Definition: JackTrip.h:92
JackTrip::getReceiverPeerPort
virtual int getReceiverPeerPort() const
Definition: JackTrip.h:223
JackTrip::dataProtocolT
dataProtocolT
Enum for the data Protocol. At this time only UDP is implemented.
Definition: JackTrip.h:75
JackTrip::getDataProtocolReceiver
virtual DataProtocol * getDataProtocolReceiver() const
Definition: JackTrip.h:228
RingBuffer::readSlotNonBlocking
void readSlotNonBlocking(int8_t *ptrToReadSlot)
Same as readSlotBlocking but non-blocking (asynchronous)
Definition: RingBuffer.cpp:175
JackTrip
Main class to creates a SERVER (to listen) or a CLIENT (to connect to a listening server) to send aud...
Definition: JackTrip.h:67
JackTrip::setSendRingBuffer
virtual void setSendRingBuffer(RingBuffer *const SendRingBuffer)
Definition: JackTrip.h:239
JackTrip::setAudioBitResolution
virtual void setAudioBitResolution(AudioInterface::audioBitResolutionT AudioBitResolution)
Sets (override) Audio Bit Resolution after construction.
Definition: JackTrip.h:184
JackTrip::getConnectionMode
JackTrip::connectionModeT getConnectionMode() const
Definition: JackTrip.h:261
JackTrip::signalProcessesStopped
void signalProcessesStopped()
Signal emitted when all the processes and threads are stopped.
Definition: moc_JackTrip.cpp:188
AudioInterface::getSizeInBytesPerChannel
virtual size_t getSizeInBytesPerChannel() const
Definition: AudioInterface.cpp:110
JackTrip::TCP
NOT IMPLEMENTED: Use TCP (Transmission Control Protocol)
Definition: JackTrip.h:77
JackTrip::slotStopProcesses
virtual void slotStopProcesses()
Slot to stop all the processes and threads.
Definition: JackTrip.h:358
JackTrip::SERVERPINGSERVER
Server of the MultiThreaded JackTrip.
Definition: JackTrip.h:86
JackTrip::CLIENTTOPINGSERVER
Client of the Ping Server Mode.
Definition: JackTrip.h:85
RingBuffer::insertSlotNonBlocking
void insertSlotNonBlocking(const int8_t *ptrToSlot)
Same as insertSlotBlocking but non-blocking (asynchronous)
Definition: RingBuffer.cpp:149
JackTrip::setReceiveRingBuffer
virtual void setReceiveRingBuffer(RingBuffer *const ReceiveRingBuffer)
Definition: JackTrip.h:241
PacketHeader::increaseSequenceNumber
virtual void increaseSequenceNumber()
Increase sequence number for counter, a 16bit number.
Definition: PacketHeader.h:147
JackTrip::slotUdpWatingTooLong
void slotUdpWatingTooLong(int wait_msec)
This slot emits in turn the signal signalNoUdpPacketsForSeconds when UDP has waited for more than 30 ...
Definition: JackTrip.h:370
JackTrip::setPacketHeader
virtual void setPacketHeader(PacketHeader *const PacketHeader)
Definition: JackTrip.h:244
JackTrip::getPeerBufferSize
uint16_t getPeerBufferSize(int8_t *full_packet) const
Definition: JackTrip.h:329
JackTrip::setupDataProtocol
virtual void setupDataProtocol()
Set the DataProtocol objects.
Definition: JackTrip.cpp:188
JackTrip::CLIENT
Run in Client Mode.
Definition: JackTrip.h:84
JackTrip::getDataProtocolSender
virtual DataProtocol * getDataProtocolSender() const
Definition: JackTrip.h:226
uint16_t
quint16 uint16_t
Typedef for unsigned short. This type is guaranteed to be 16-bit.
Definition: jacktrip_types.h:71
PacketHeader::getPeerSamplingRate
virtual uint8_t getPeerSamplingRate(int8_t *full_packet) const =0
JackTrip::setupRingBuffers
void setupRingBuffers()
Set the RingBuffer objects.
Definition: JackTrip.cpp:226
RingBuffer::readSlotBlocking
void readSlotBlocking(int8_t *ptrToReadSlot)
Read a slot from the RingBuffer into ptrToReadSlot. This method will block until there&#39;s space in the...
Definition: RingBuffer.cpp:125
uint8_t
quint8 uint8_t
Typedef for unsigned char. This type is guaranteed to be 8-bit.
Definition: jacktrip_types.h:69
JackTrip::setBindPorts
virtual void setBindPorts(int port)
Sets port numbers to bind in RECEIVER and SENDER sockets.
Definition: JackTrip.h:199
JackTrip::getPeerAddress
QString getPeerAddress() const
Definition: JackTrip.h:269