Browse Source

Add a little documentation in netjack2 source code

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2749 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
moret 17 years ago
parent
commit
a51add6c76
5 changed files with 100 additions and 3 deletions
  1. +4
    -0
      common/JackNetDriver.h
  2. +8
    -0
      common/JackNetManager.h
  3. +72
    -2
      common/JackNetTool.h
  4. +13
    -0
      common/JackTools.h
  5. +3
    -1
      windows/jackdmp.workspace

+ 4
- 0
common/JackNetDriver.h View File

@@ -30,6 +30,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

namespace Jack
{
/**
\Brief This class describes the Net Backend
*/

class JackNetDriver : public JackAudioDriver
{
private:


+ 8
- 0
common/JackNetManager.h View File

@@ -30,6 +30,10 @@ namespace Jack
{
class JackNetMasterManager;

/**
\Brief This class describes a Net Master
*/

class JackNetMaster
{
friend class JackNetMasterManager;
@@ -108,6 +112,10 @@ namespace Jack
typedef std::list<JackNetMaster*> master_list_t;
typedef master_list_t::iterator master_list_it_t;

/**
\Brief This class describer the Network Manager
*/

class JackNetMasterManager
{
friend class JackNetMaster;


+ 72
- 2
common/JackNetTool.h View File

@@ -39,6 +39,20 @@ namespace Jack

//session params ******************************************************************************

/**
\brief This structure containes master/slave connection parameters, it's used to setup the whole system

We have :
- some info like version, type and packet id
- names
- network parameters (hostnames and mtu)
- nunber of audio and midi channels
- sample rate and buffersize
- number of audio frames in one network packet (depends on the channel number)
- is the NetDriver in Sync or ASync mode ?
- is the NetDriver linked with the master's transport
*/

struct _session_params
{
char fPacketType[7]; //packet type ('param')
@@ -63,6 +77,10 @@ namespace Jack

//net status **********************************************************************************

/**
\Brief This enum groups network error by type
*/

enum _net_status
{
NET_SOCKET_ERROR = 0,
@@ -78,6 +96,10 @@ namespace Jack

//sync packet type ****************************************************************************

/**
\Brief This enum indicates the type of a sync packet (used in the initialization phase)
*/

enum _sync_packet_type
{
INVALID = 0, //...
@@ -93,12 +115,31 @@ namespace Jack

//packet header *******************************************************************************

/**
\Brief This structure is a complete header

A header indicates :
- it is a header
- the type of data the packet contains (sync, midi or audio)
- the path of the packet (send -master->slave- or return -slave->master-)
- the unique ID of the slave
- the sample's bitdepth (unused for now)
- the size of the midi data contains in the packet (indicates how much midi data will be sent)
- the number of midi packet(s) : more than one is very unusual, it depends on the midi load
- the ID of the current cycle (used to check missing packets)
- the ID of the packet subcycle (for audio data)
- a flag indicating this packet is the last of the cycle (for sync robustness, it's better to process this way)
- a flag indicating if, in async mode, the previous graph was not finished or not
- padding to fill 64 bytes

*/

struct _packet_header
{
char fPacketType[7]; //packet type ( 'headr' )
char fDataType; //a for audio, m for midi
char fDataType; //a for audio, m for midi and s for sync
char fDataStream; //s for send, r for return
uint32_t fID; //to identify the slave
uint32_t fID; //unique ID of the slave
uint32_t fBitdepth; //bitdepth of the data samples
uint32_t fMidiDataSize; //size of midi data (if packet is 'midi typed') in bytes
uint32_t fNMidiPckt; //number of midi packets of the cycle
@@ -111,6 +152,10 @@ namespace Jack

//transport data ******************************************************************************

/**
\Brief This structure contains transport info
*/

struct _net_transport_data
{
jack_position_t fCurPos;
@@ -119,6 +164,21 @@ namespace Jack

//midi data ***********************************************************************************

/**
\Brief Midi buffer and operations class

This class is a toolset to manipulate Midi buffers.
A JackMidiBuffer has a fixed size, which is the same than an audio buffer size.
An intermediate fixed size buffer allows to uninterleave midi data (from jack ports).
But for a big majority of the process cycles, this buffer is filled less than 1%,
Sending over a network 99% of useless data seems completely unappropriate.
The idea is to count effective midi data, and then send the smallest packet we can.
To do it, we use an intermediate buffer.
We have two methods to convert data from jack ports to intermediate buffer,
And two others to convert this intermediate buffer to a network buffer (header + payload data)

*/

class EXPORT NetMidiBuffer
{
private:
@@ -150,6 +210,16 @@ namespace Jack

// audio data *********************************************************************************

/**
\Brief Audio buffer and operations class

This class is a toolset to manipulate audio buffers.
The manipulation of audio buffers is similar to midi buffer, except those buffers have fixed size.
The interleaving/uninterleaving operations are simplier here because audio buffers have fixed size,
So there is no need of an intermediate buffer as in NetMidiBuffer.

*/

class EXPORT NetAudioBuffer
{
private:


+ 13
- 0
common/JackTools.h View File

@@ -90,6 +90,19 @@ namespace Jack

/*!
\brief Generic monitoring class. Saves data to GnuPlot files ('.plt' and '.log' datafile)

This template class allows to manipulate monitoring records, and automatically generate the GnuPlot config and data files.
Operations are RT safe because it uses fixed size data buffers.
You can set the number of measure points, and the number of records.

To use it :
- create a JackGnuPlotMonitor, you can use the data type you want.
- create a temporary array for your measure
- once you have filled this array with 'measure points' value, call write() to add it to the record
- once you've done with your measurment, just call save() to save your data file

You can also call SetPlotFile() to automatically generate '.plt' file from an options list.

*/

template <class T> class JackGnuPlotMonitor


+ 3
- 1
windows/jackdmp.workspace View File

@@ -16,7 +16,9 @@
<Project filename="jack_netdriver.cbp">
<Depends filename="libjackservermp.cbp" />
</Project>
<Project filename="jack_netadapter.cbp" active="1" />
<Project filename="jack_netadapter.cbp" active="1">
<Depends filename="libjackservermp.cbp" />
</Project>
<Project filename="jack_netmanager.cbp">
<Depends filename="libjackservermp.cbp" />
</Project>


Loading…
Cancel
Save