JackTrip
|
Main class to creates a SERVER (to listen) or a CLIENT (to connect to a listening server) to send audio streams in the network. More...
#include <JackTrip.h>
Public Types | |
enum | dataProtocolT { UDP, TCP, SCTP } |
Enum for the data Protocol. At this time only UDP is implemented. More... | |
enum | jacktripModeT { SERVER, CLIENT, CLIENTTOPINGSERVER } |
Enum for the JackTrip mode. More... | |
enum | underrunModeT { WAVETABLE, ZEROS } |
Enum for the JackTrip Underrun Mode, when packets. More... |
Public Slots | |
void | slotStopProcesses () |
Slot to stop all the processes and threads. | |
void | slotUdpWatingTooLong (int wait_msec) |
This slot emits in turn the signal signalNoUdpPacketsForSeconds when UDP is waited for more than 30 seconds. |
Signals | |
void | signalProcessesStopped () |
Signal emitted when all the processes and threads are stopped | |
void | signalNoUdpPacketsForSeconds () |
Signal emitted when no UDP Packets have been received for a while |
Public Member Functions | |
JackTrip (jacktripModeT JacktripMode=CLIENT, dataProtocolT DataProtocolType=UDP, int NumChans=2, int BufferQueueLength=8, unsigned int redundancy=1, JackAudioInterface::audioBitResolutionT AudioBitResolution=JackAudioInterface::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. | |
virtual | ~JackTrip () |
The class destructor. | |
void | setPeerAddress (const char *PeerHostOrIP) |
Set the Peer Address for jacktripModeT::CLIENT mode only. | |
void | appendProcessPlugin (ProcessPlugin *plugin) |
Append a process plugin. Processes will be appended in order. | |
void | start () |
Start the processing threads. | |
void | stop () |
Stop the processing threads. | |
void | wait () |
Wait for all the threads to finish. This functions is used when JackTrip is run as a thread. | |
void | checkIfPortIsBinded (int port) |
Check if UDP port is already binded. | |
Methods to change parameters after construction | |
void | setJackTripMode (jacktripModeT JacktripMode) |
Sets (override) JackTrip Mode after construction. | |
void | setDataProtocoType (dataProtocolT DataProtocolType) |
Sets (override) DataProtocol Type after construction. | |
void | setPacketHeaderType (DataProtocol::packetHeaderTypeT PacketHeaderType) |
Sets the Packet header type. | |
void | setBufferQueueLength (int BufferQueueLength) |
Sets (override) Number of Channels after construction. | |
void | setAudioBitResolution (JackAudioInterface::audioBitResolutionT AudioBitResolution) |
Sets (override) Audio Bit Resolution after construction. | |
void | setUnderRunMode (underrunModeT UnderRunMode) |
Sets (override) Underrun Mode. | |
void | setAllPorts (int port) |
Sets port numbers for the local and peer machine. Receive port is port | |
void | setBindPorts (int port) |
Sets port numbers to bind in RECEIVER and SENDER sockets. | |
void | setPeerPorts (int port) |
Sets port numbers for the peer (remote) machine. | |
void | setClientName (char *ClientName) |
Set Client Name to something different that the default (JackTrip) | |
Mediator Functions | |
void | createHeader (const DataProtocol::packetHeaderTypeT headertype) |
void | putHeaderInPacket (int8_t *full_packet, int8_t *audio_packet) |
int | getPacketSizeInBytes () const |
void | parseAudioPacket (int8_t *full_packet, int8_t *audio_packet) |
void | sendNetworkPacket (const int8_t *ptrToSlot) |
void | receiveNetworkPacket (int8_t *ptrToReadSlot) |
void | readAudioBuffer (int8_t *ptrToReadSlot) |
void | writeAudioBuffer (const int8_t *ptrToSlot) |
uint32_t | getBufferSizeInSamples () const |
JackAudioInterface::samplingRateT | getSampleRateType () const |
uint8_t | getAudioBitResolution () const |
int | getNumInputChannels () const |
int | getNumOutputChannels () const |
void | checkPeerSettings (int8_t *full_packet) |
void | increaseSequenceNumber () |
int | getSequenceNumber () const |
int | getPeerSequenceNumber (int8_t *full_packet) const |
Private Member Functions | |
void | setupJackAudio () |
Set the JackAudioInteface object. | |
void | setupDataProtocol () |
Set the DataProtocol objects. | |
void | setupRingBuffers () |
Set the RingBuffer objects. | |
void | clientStart () |
Starts for the CLIENT mode. | |
void | serverStart () |
Starts for the SERVER mode. | |
void | clientPingToServerStart () |
Stats for the Client to Ping Server. |
Private Attributes | |
jacktripModeT | mJackTripMode |
JackTrip::jacktripModeT. | |
dataProtocolT | mDataProtocol |
Data Protocol Tipe. | |
DataProtocol::packetHeaderTypeT | mPacketHeaderType |
Packet Header Type. | |
int | mNumChans |
Number of Channels (inputs = outputs) | |
int | mBufferQueueLength |
Audio Buffer from network queue length. | |
uint32_t | mSampleRate |
Sample Rate. | |
uint32_t | mAudioBufferSize |
Audio buffer size to process on each callback. | |
JackAudioInterface::audioBitResolutionT | mAudioBitResolution |
Audio Bit Resolutions. | |
QString | mPeerAddress |
Peer Address to use in jacktripModeT::CLIENT Mode. | |
DataProtocol * | mDataProtocolSender |
Pointer to Abstract Type DataProtocol that sends packets. | |
DataProtocol * | mDataProtocolReceiver |
JackAudioInterface * | mJackAudio |
Interface to Jack Client. | |
PacketHeader * | mPacketHeader |
Pointer to Packet Header. | |
underrunModeT | mUnderRunMode |
underrunModeT Mode | |
RingBuffer * | mSendRingBuffer |
Pointer for the Send RingBuffer. | |
RingBuffer * | mReceiveRingBuffer |
Pointer for the Receive RingBuffer. | |
int | mReceiverBindPort |
Incoming (receiving) port for local machine. | |
int | mSenderPeerPort |
Incoming (receiving) port for peer machine. | |
int | mSenderBindPort |
Outgoing (sending) port for local machine. | |
int | mReceiverPeerPort |
Outgoing (sending) port for peer machine. | |
unsigned int | mRedundancy |
Redundancy factor in network data. | |
const char * | mJackClientName |
JackAudio Client Name. | |
QVector< ProcessPlugin * > | mProcessPlugins |
Vector of ProcesPlugins |
Main class to creates a SERVER (to listen) or a CLIENT (to connect to a listening server) to send audio streams in the network.
All audio and network settings can be set in this class. This class also acts as a Mediator between all the other class. Classes that uses JackTrip methods need to register with it.
Enum for the JackTrip mode.
Enum for the JackTrip Underrun Mode, when packets.
JackTrip::JackTrip | ( | jacktripModeT | JacktripMode = CLIENT , |
dataProtocolT | DataProtocolType = UDP , |
||
int | NumChans = 2 , |
||
int | BufferQueueLength = 8 , |
||
unsigned int | redundancy = 1 , |
||
JackAudioInterface::audioBitResolutionT | AudioBitResolution = JackAudioInterface::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.
JacktripMode | JackTrip::CLIENT or JackTrip::SERVER |
DataProtocolType | JackTrip::dataProtocolT |
NumChans | Number of Audio Channels (same for inputs and outputs) |
BufferQueueLength | Audio Buffer for receiving packets |
AudioBitResolution | Audio Sample Resolutions in bits |
redundancy | redundancy factor for network data |
|
virtual |
The class destructor.
void JackTrip::appendProcessPlugin | ( | ProcessPlugin * | plugin | ) |
Append a process plugin. Processes will be appended in order.
plugin | Pointer to ProcessPlugin Class |
void JackTrip::checkIfPortIsBinded | ( | int | port | ) |
Check if UDP port is already binded.
port | Port number |
void JackTrip::checkPeerSettings | ( | int8_t * | full_packet | ) |
|
private |
Stats for the Client to Ping Server.
|
private |
Starts for the CLIENT mode.
void JackTrip::createHeader | ( | const DataProtocol::packetHeaderTypeT | headertype | ) |
|
inline |
|
inline |
|
inline |
|
inline |
int JackTrip::getPacketSizeInBytes | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Starts for the SERVER mode.
|
inline |
Sets port numbers for the local and peer machine. Receive port is port
|
inline |
Sets (override) Audio Bit Resolution after construction.
|
inline |
Sets port numbers to bind in RECEIVER and SENDER sockets.
|
inline |
Sets (override) Number of Channels after construction.
Sets (override) Buffer Queue Length Mode after construction
|
inline |
Set Client Name to something different that the default (JackTrip)
|
inline |
Sets (override) DataProtocol Type after construction.
|
inline |
Sets (override) JackTrip Mode after construction.
|
inline |
Sets the Packet header type.
void JackTrip::setPeerAddress | ( | const char * | PeerHostOrIP | ) |
Set the Peer Address for jacktripModeT::CLIENT mode only.
|
inline |
Sets port numbers for the peer (remote) machine.
|
inline |
Sets (override) Underrun Mode.
|
private |
Set the DataProtocol objects.
|
private |
Set the JackAudioInteface object.
|
private |
Set the RingBuffer objects.
|
signal |
Signal emitted when no UDP Packets have been received for a while
|
signal |
Signal emitted when all the processes and threads are stopped
|
inlineslot |
Slot to stop all the processes and threads.
|
inlineslot |
This slot emits in turn the signal signalNoUdpPacketsForSeconds when UDP is waited for more than 30 seconds.
It is used to remove the thread from the server.
void JackTrip::start | ( | ) |
Start the processing threads.
void JackTrip::stop | ( | ) |
Stop the processing threads.
void JackTrip::wait | ( | ) |
Wait for all the threads to finish. This functions is used when JackTrip is run as a thread.
|
inline |
|
private |
Audio Bit Resolutions.
|
private |
Audio buffer size to process on each callback.
|
private |
Audio Buffer from network queue length.
|
private |
Data Protocol Tipe.
|
private |
|
private |
Pointer to Abstract Type DataProtocol that sends packets.
Pointer to Abstract Type DataProtocol that receives packets
|
private |
Interface to Jack Client.
|
private |
JackAudio Client Name.
|
private |
|
private |
Number of Channels (inputs = outputs)
|
private |
Pointer to Packet Header.
|
private |
Packet Header Type.
|
private |
Peer Address to use in jacktripModeT::CLIENT Mode.
|
private |
Vector of ProcesPlugins
|
private |
Incoming (receiving) port for local machine.
|
private |
Pointer for the Receive RingBuffer.
|
private |
Outgoing (sending) port for peer machine.
|
private |
Redundancy factor in network data.
|
private |
Sample Rate.
|
private |
Outgoing (sending) port for local machine.
|
private |
Incoming (receiving) port for peer machine.
|
private |
Pointer for the Send RingBuffer.
|
private |
underrunModeT Mode