|
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 |
| JackTrip::~JackTrip | ( | ) | [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 | ) |
| void JackTrip::clientPingToServerStart | ( | ) | [private] |
Stats for the Client to Ping Server.
| void JackTrip::clientStart | ( | ) | [private] |
Starts for the CLIENT mode.
| void JackTrip::createHeader | ( | const DataProtocol::packetHeaderTypeT | headertype | ) |
| uint8_t JackTrip::getAudioBitResolution | ( | ) | const [inline] |
| uint32_t JackTrip::getBufferSizeInSamples | ( | ) | const [inline] |
| int JackTrip::getNumInputChannels | ( | ) | const [inline] |
| int JackTrip::getNumOutputChannels | ( | ) | const [inline] |
| int JackTrip::getPacketSizeInBytes | ( | ) | const |
| int JackTrip::getPeerSequenceNumber | ( | int8_t * | full_packet | ) | const [inline] |
| JackAudioInterface::samplingRateT JackTrip::getSampleRateType | ( | ) | const [inline] |
| int JackTrip::getSequenceNumber | ( | ) | const [inline] |
| void JackTrip::increaseSequenceNumber | ( | ) | [inline] |
| void JackTrip::readAudioBuffer | ( | int8_t * | ptrToReadSlot | ) | [inline] |
| void JackTrip::receiveNetworkPacket | ( | int8_t * | ptrToReadSlot | ) | [inline] |
| void JackTrip::sendNetworkPacket | ( | const int8_t * | ptrToSlot | ) | [inline] |
| void JackTrip::serverStart | ( | ) | [private] |
Starts for the SERVER mode.
| void JackTrip::setAllPorts | ( | int | port | ) | [inline] |
Sets port numbers for the local and peer machine. Receive port is port
| void JackTrip::setAudioBitResolution | ( | JackAudioInterface::audioBitResolutionT | AudioBitResolution | ) | [inline] |
Sets (override) Audio Bit Resolution after construction.
| void JackTrip::setBindPorts | ( | int | port | ) | [inline] |
Sets port numbers to bind in RECEIVER and SENDER sockets.
| void JackTrip::setBufferQueueLength | ( | int | BufferQueueLength | ) | [inline] |
Sets (override) Number of Channels after construction.
Sets (override) Buffer Queue Length Mode after construction
| void JackTrip::setClientName | ( | char * | ClientName | ) | [inline] |
Set Client Name to something different that the default (JackTrip)
| void JackTrip::setDataProtocoType | ( | dataProtocolT | DataProtocolType | ) | [inline] |
Sets (override) DataProtocol Type after construction.
| void JackTrip::setJackTripMode | ( | jacktripModeT | JacktripMode | ) | [inline] |
Sets (override) JackTrip Mode after construction.
| void JackTrip::setPacketHeaderType | ( | DataProtocol::packetHeaderTypeT | PacketHeaderType | ) | [inline] |
Sets the Packet header type.
| void JackTrip::setPeerAddress | ( | const char * | PeerHostOrIP | ) |
Set the Peer Address for jacktripModeT::CLIENT mode only.
| void JackTrip::setPeerPorts | ( | int | port | ) | [inline] |
Sets port numbers for the peer (remote) machine.
| void JackTrip::setUnderRunMode | ( | underrunModeT | UnderRunMode | ) | [inline] |
Sets (override) Underrun Mode.
| void JackTrip::setupDataProtocol | ( | ) | [private] |
Set the DataProtocol objects.
| void JackTrip::setupJackAudio | ( | ) | [private] |
Set the JackAudioInteface object.
| void JackTrip::setupRingBuffers | ( | ) | [private] |
Set the RingBuffer objects.
| void JackTrip::signalNoUdpPacketsForSeconds | ( | ) | [signal] |
Signal emitted when no UDP Packets have been received for a while
| void JackTrip::signalProcessesStopped | ( | ) | [signal] |
Signal emitted when all the processes and threads are stopped
| void JackTrip::slotStopProcesses | ( | ) | [inline, slot] |
Slot to stop all the processes and threads.
| void JackTrip::slotUdpWatingTooLong | ( | int | wait_msec | ) | [inline, slot] |
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.
| void JackTrip::writeAudioBuffer | ( | const int8_t * | ptrToSlot | ) | [inline] |
Audio Bit Resolutions.
uint32_t JackTrip::mAudioBufferSize [private] |
Audio buffer size to process on each callback.
int JackTrip::mBufferQueueLength [private] |
Audio Buffer from network queue length.
dataProtocolT JackTrip::mDataProtocol [private] |
Data Protocol Tipe.
DataProtocol* JackTrip::mDataProtocolReceiver [private] |
DataProtocol* JackTrip::mDataProtocolSender [private] |
Pointer to Abstract Type DataProtocol that sends packets.
Pointer to Abstract Type DataProtocol that receives packets
JackAudioInterface* JackTrip::mJackAudio [private] |
Interface to Jack Client.
const char* JackTrip::mJackClientName [private] |
JackAudio Client Name.
int JackTrip::mNumChans [private] |
Number of Channels (inputs = outputs)
PacketHeader* JackTrip::mPacketHeader [private] |
Pointer to Packet Header.
Packet Header Type.
QString JackTrip::mPeerAddress [private] |
Peer Address to use in jacktripModeT::CLIENT Mode.
QVector<ProcessPlugin*> JackTrip::mProcessPlugins [private] |
Vector of ProcesPlugins
int JackTrip::mReceiverBindPort [private] |
Incoming (receiving) port for local machine.
RingBuffer* JackTrip::mReceiveRingBuffer [private] |
Pointer for the Receive RingBuffer.
int JackTrip::mReceiverPeerPort [private] |
Outgoing (sending) port for peer machine.
unsigned int JackTrip::mRedundancy [private] |
Redundancy factor in network data.
uint32_t JackTrip::mSampleRate [private] |
Sample Rate.
int JackTrip::mSenderBindPort [private] |
Outgoing (sending) port for local machine.
int JackTrip::mSenderPeerPort [private] |
Incoming (receiving) port for peer machine.
RingBuffer* JackTrip::mSendRingBuffer [private] |
Pointer for the Send RingBuffer.
underrunModeT JackTrip::mUnderRunMode [private] |
underrunModeT Mode