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, SERVERPINGSERVER } |
Enum for the JackTrip mode. More... | |
enum | underrunModeT { WAVETABLE, ZEROS } |
Enum for the JackTrip Underrun Mode, when packets. More... | |
enum | audiointerfaceModeT { JACK, RTAUDIO } |
Enum for Audio Interface Mode. More... | |
enum | connectionModeT { NORMAL, KSTRONG, JAMTEST } |
Enum for Connection Mode (in packet header) More... | |
enum | hubConnectionModeT { SERVERTOCLIENT, CLIENTECHO, CLIENTFOFI, RESERVEDMATRIX, FULLMIX } |
Enum for Hub Server Audio Connection Mode (connections to hub server are automatically patched in Jack) More... | |
Public Member Functions | |
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. More... | |
virtual | ~JackTrip () |
The class destructor. More... | |
virtual void | run () |
Starting point for the thread. More... | |
virtual void | setPeerAddress (const char *PeerHostOrIP) |
Set the Peer Address for jacktripModeT::CLIENT mode only. More... | |
virtual void | appendProcessPlugin (ProcessPlugin *plugin) |
Append a process plugin. Processes will be appended in order. More... | |
virtual void | startProcess () throw (std::invalid_argument) |
Start the processing threads. More... | |
virtual void | stop () |
Stop the processing threads. More... | |
virtual void | waitThreads () |
Wait for all the threads to finish. This functions is used when JackTrip is run as a thread. More... | |
virtual void | checkIfPortIsBinded (int port) |
Check if UDP port is already binded. More... | |
Getters and Setters Methods to change parameters after construction | |
virtual void | setJackTripMode (jacktripModeT JacktripMode) |
Sets (override) JackTrip Mode after construction. More... | |
virtual void | setDataProtocoType (dataProtocolT DataProtocolType) |
Sets (override) DataProtocol Type after construction. More... | |
virtual void | setPacketHeaderType (DataProtocol::packetHeaderTypeT PacketHeaderType) |
Sets the Packet header type. More... | |
virtual void | setBufferQueueLength (int BufferQueueLength) |
Sets (override) Buffer Queue Length Mode after construction. More... | |
virtual void | setAudioBitResolution (AudioInterface::audioBitResolutionT AudioBitResolution) |
Sets (override) Audio Bit Resolution after construction. More... | |
virtual void | setUnderRunMode (underrunModeT UnderRunMode) |
Sets (override) Underrun Mode. More... | |
virtual void | setAllPorts (int port) |
Sets port numbers for the local and peer machine. Receive port is port More... | |
virtual void | setBindPorts (int port) |
Sets port numbers to bind in RECEIVER and SENDER sockets. More... | |
virtual void | setPeerPorts (int port) |
Sets port numbers for the peer (remote) machine. More... | |
virtual void | setClientName (const char *ClientName) |
Set Client Name to something different that the default (JackTrip) More... | |
virtual void | setNumChannels (int num_chans) |
Set the number of audio channels. More... | |
virtual void | setConnectDefaultAudioPorts (bool connect) |
Set to connect or not default audio ports (only implemented in Jack) More... | |
virtual int | getReceiverBindPort () const |
virtual int | getSenderPeerPort () const |
virtual int | getSenderBindPort () const |
virtual int | getReceiverPeerPort () const |
virtual DataProtocol * | getDataProtocolSender () const |
virtual DataProtocol * | getDataProtocolReceiver () const |
virtual void | setDataProtocolSender (DataProtocol *const DataProtocolSender) |
virtual void | setDataProtocolReceiver (DataProtocol *const DataProtocolReceiver) |
virtual RingBuffer * | getSendRingBuffer () const |
virtual RingBuffer * | getReceiveRingBuffer () const |
virtual void | setSendRingBuffer (RingBuffer *const SendRingBuffer) |
virtual void | setReceiveRingBuffer (RingBuffer *const ReceiveRingBuffer) |
virtual void | setPacketHeader (PacketHeader *const PacketHeader) |
virtual int | getRingBuffersSlotSize () |
virtual void | setAudiointerfaceMode (JackTrip::audiointerfaceModeT audiointerface_mode) |
virtual void | setAudioInterface (AudioInterface *const AudioInterface) |
void | setSampleRate (uint32_t sample_rate) |
void | setDeviceID (uint32_t device_id) |
void | setAudioBufferSizeInSamples (uint32_t buf_size) |
JackTrip::connectionModeT | getConnectionMode () const |
void | setConnectionMode (JackTrip::connectionModeT connection_mode) |
JackTrip::hubConnectionModeT | getHubConnectionModeT () const |
void | setHubConnectionModeT (JackTrip::hubConnectionModeT connection_mode) |
JackTrip::jacktripModeT | getJackTripMode () const |
QString | getPeerAddress () const |
bool | receivedConnectionFromPeer () |
bool | tcpConnectionError () |
Mediator Functions | |
virtual void | createHeader (const DataProtocol::packetHeaderTypeT headertype) |
void | putHeaderInPacket (int8_t *full_packet, int8_t *audio_packet) |
virtual int | getPacketSizeInBytes () |
void | parseAudioPacket (int8_t *full_packet, int8_t *audio_packet) |
virtual void | sendNetworkPacket (const int8_t *ptrToSlot) |
virtual void | receiveNetworkPacket (int8_t *ptrToReadSlot) |
virtual void | readAudioBuffer (int8_t *ptrToReadSlot) |
virtual void | writeAudioBuffer (const int8_t *ptrToSlot) |
uint32_t | getBufferSizeInSamples () const |
uint32_t | getDeviceID () const |
AudioInterface::samplingRateT | getSampleRateType () const |
int | getSampleRate () const |
uint8_t | getAudioBitResolution () const |
unsigned int | getNumInputChannels () const |
unsigned int | getNumOutputChannels () const |
unsigned int | getNumChannels () const |
virtual void | checkPeerSettings (int8_t *full_packet) |
void | increaseSequenceNumber () |
int | getSequenceNumber () const |
uint64_t | getPeerTimeStamp (int8_t *full_packet) const |
uint16_t | getPeerSequenceNumber (int8_t *full_packet) const |
uint16_t | getPeerBufferSize (int8_t *full_packet) const |
uint8_t | getPeerSamplingRate (int8_t *full_packet) const |
uint8_t | getPeerBitResolution (int8_t *full_packet) const |
uint8_t | getPeerNumChannels (int8_t *full_packet) const |
uint8_t | getPeerConnectionMode (int8_t *full_packet) const |
size_t | getSizeInBytesPerChannel () const |
int | getHeaderSizeInBytes () const |
virtual int | getTotalAudioPacketSizeInBytes () const |
void | printTextTest () |
void | printTextTest2 () |
virtual void | setupAudio () |
Set the AudioInteface object. More... | |
void | closeAudio () |
Close the JackAudioInteface and disconnects it from JACK. More... | |
virtual void | setupDataProtocol () |
Set the DataProtocol objects. More... | |
void | setupRingBuffers () |
Set the RingBuffer objects. More... | |
void | clientStart () throw (std::invalid_argument) |
Starts for the CLIENT mode. More... | |
int | serverStart (bool timeout=false, int udpTimeout=gTimeOutMultiThreadedServer) throw (std::invalid_argument, std::runtime_error) |
Starts for the SERVER mode. More... | |
virtual int | clientPingToServerStart () throw (std::invalid_argument) |
Stats for the Client to Ping Server. More... | |
virtual void | slotStopProcesses () |
Slot to stop all the processes and threads. More... | |
void | slotUdpWaitingTooLongClientGoneProbably (int wait_msec) |
This slot emits in turn the signal signalNoUdpPacketsForSeconds when UDP has waited for more than 30 seconds. More... | |
void | slotPrintTest () |
void | slotReceivedConnectionFromPeer () |
void | signalUdpTimeOut () |
void | signalProcessesStopped () |
Signal emitted when all the processes and threads are stopped. More... | |
void | signalNoUdpPacketsForSeconds () |
Signal emitted when no UDP Packets have been received for a while. More... | |
void | signalTcpClientConnected () |
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 Hub Server Audio Connection Mode (connections to hub server are automatically patched in Jack)
Enum for the JackTrip Underrun Mode, when packets.
Enumerator | |
---|---|
WAVETABLE | Loops on the last received packet. |
ZEROS | Set new buffers to zero if there are no new ones. |
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.
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.
|
virtual |
Append a process plugin. Processes will be appended in order.
plugin | Pointer to ProcessPlugin Class |
|
virtual |
Check if UDP port is already binded.
port | Port number |
|
virtual |
|
virtual |
Stats for the Client to Ping Server.
void JackTrip::clientStart | ( | ) | ||
throw | ( | std::invalid_argument | ||
) |
Starts for the CLIENT mode.
void JackTrip::closeAudio | ( | ) |
Close the JackAudioInteface and disconnects it from JACK.
|
virtual |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
virtual |
|
inline |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Starting point for the thread.
|
inlinevirtual |
int JackTrip::serverStart | ( | bool | timeout = false , |
int | udpTimeout = gTimeOutMultiThreadedServer |
||
) | |||
throw | ( | std::invalid_argument, | |
std::runtime_error | |||
) |
Starts for the SERVER mode.
timout | Set the server to timeout after 2 seconds if no client connections are received. Usefull for the multithreaded server |
|
inlinevirtual |
Sets port numbers for the local and peer machine. Receive port is port
|
inlinevirtual |
Sets (override) Audio Bit Resolution after construction.
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Sets port numbers to bind in RECEIVER and SENDER sockets.
|
inlinevirtual |
Sets (override) Buffer Queue Length Mode after construction.
|
inlinevirtual |
Set Client Name to something different that the default (JackTrip)
|
inlinevirtual |
Set to connect or not default audio ports (only implemented in Jack)
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Sets (override) DataProtocol Type after construction.
|
inline |
|
inline |
|
inlinevirtual |
Sets (override) JackTrip Mode after construction.
|
inlinevirtual |
Set the number of audio channels.
|
inlinevirtual |
|
inlinevirtual |
Sets the Packet header type.
|
virtual |
Set the Peer Address for jacktripModeT::CLIENT mode only.
|
inlinevirtual |
Sets port numbers for the peer (remote) machine.
|
inlinevirtual |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
Sets (override) Underrun Mode.
|
virtual |
Set the AudioInteface object.
|
virtual |
Set the DataProtocol objects.
void JackTrip::setupRingBuffers | ( | ) |
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.
|
signal |
|
signal |
|
inlineslot |
|
inlineslot |
|
inlinevirtualslot |
Slot to stop all the processes and threads.
|
inlineslot |
This slot emits in turn the signal signalNoUdpPacketsForSeconds when UDP has waited for more than 30 seconds.
It is used to remove the thread from the server.
|
virtual |
Start the processing threads.
|
virtual |
Stop the processing threads.
|
inline |
|
virtual |
Wait for all the threads to finish. This functions is used when JackTrip is run as a thread.
|
inlinevirtual |