jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

742 lines
25KB

  1. /*
  2. Copyright (C) 2008 Romain Moret at Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #include "JackMidiPort.h"
  16. #include "JackTools.h"
  17. #include "JackPlatformPlug.h"
  18. #include "types.h"
  19. #include "transport.h"
  20. #ifndef WIN32
  21. #include <netinet/in.h>
  22. #endif
  23. #include <cmath>
  24. using namespace std;
  25. #ifndef htonll
  26. #ifdef __BIG_ENDIAN__
  27. #define htonll(x) (x)
  28. #define ntohll(x) (x)
  29. #else
  30. #define htonll(x) ((((uint64_t)htonl(x)) << 32) + htonl(x >> 32))
  31. #define ntohll(x) ((((uint64_t)ntohl(x)) << 32) + ntohl(x >> 32))
  32. #endif
  33. #endif
  34. namespace Jack
  35. {
  36. typedef struct _session_params session_params_t;
  37. typedef struct _packet_header packet_header_t;
  38. typedef struct _net_transport_data net_transport_data_t;
  39. typedef struct sockaddr socket_address_t;
  40. typedef struct in_addr address_t;
  41. typedef jack_default_audio_sample_t sample_t;
  42. enum JackNetEncoder {
  43. JackFloatEncoder = 0,
  44. JackIntEncoder = 1,
  45. JackCeltEncoder = 2,
  46. };
  47. //session params ******************************************************************************
  48. /**
  49. \brief This structure containes master/slave connection parameters, it's used to setup the whole system
  50. We have :
  51. - some info like version, type and packet id
  52. - names
  53. - network parameters (hostnames and mtu)
  54. - nunber of audio and midi channels
  55. - sample rate and buffersize
  56. - number of audio frames in one network packet (depends on the channel number)
  57. - is the NetDriver in Sync or ASync mode ?
  58. - is the NetDriver linked with the master's transport
  59. Data encoding : headers (session_params and packet_header) are encoded using HTN kind of functions but float data
  60. are kept in LITTLE_ENDIAN format (to avoid 2 conversions in the more common LITTLE_ENDIAN <==> LITTLE_ENDIAN connection case).
  61. */
  62. #define MASTER_PROTOCOL 2
  63. #define SLAVE_PROTOCOL 2
  64. struct _session_params
  65. {
  66. char fPacketType[7]; //packet type ('param')
  67. char fProtocolVersion; //version
  68. uint32_t fPacketID; //indicates the packet type
  69. char fName[JACK_CLIENT_NAME_SIZE]; //slave's name
  70. char fMasterNetName[256]; //master hostname (network)
  71. char fSlaveNetName[256]; //slave hostname (network)
  72. uint32_t fMtu; //connection mtu
  73. uint32_t fID; //slave's ID
  74. uint32_t fTransportSync; //is the transport synced ?
  75. int32_t fSendAudioChannels; //number of master->slave channels
  76. int32_t fReturnAudioChannels; //number of slave->master channels
  77. int32_t fSendMidiChannels; //number of master->slave midi channels
  78. int32_t fReturnMidiChannels; //number of slave->master midi channels
  79. uint32_t fSampleRate; //session sample rate
  80. uint32_t fPeriodSize; //period size
  81. uint32_t fSampleEncoder; //samples encoder
  82. uint32_t fKBps; // KB per second for CELT encoder
  83. uint32_t fSlaveSyncMode; //is the slave in sync mode ?
  84. char fNetworkMode; //fast, normal or slow mode
  85. };
  86. //net status **********************************************************************************
  87. /**
  88. \Brief This enum groups network error by type
  89. */
  90. enum _net_status
  91. {
  92. NET_SOCKET_ERROR = 0,
  93. NET_CONNECT_ERROR,
  94. NET_ERROR,
  95. NET_SEND_ERROR,
  96. NET_RECV_ERROR,
  97. NET_CONNECTED,
  98. NET_ROLLING
  99. };
  100. typedef enum _net_status net_status_t;
  101. //sync packet type ****************************************************************************
  102. /**
  103. \Brief This enum indicates the type of a sync packet (used in the initialization phase)
  104. */
  105. enum _sync_packet_type
  106. {
  107. INVALID = 0, //...
  108. SLAVE_AVAILABLE, //a slave is available
  109. SLAVE_SETUP, //slave configuration
  110. START_MASTER, //slave is ready, start master
  111. START_SLAVE, //master is ready, activate slave
  112. KILL_MASTER //master must stop
  113. };
  114. typedef enum _sync_packet_type sync_packet_type_t;
  115. //packet header *******************************************************************************
  116. /**
  117. \Brief This structure is a complete header
  118. A header indicates :
  119. - it is a header
  120. - the type of data the packet contains (sync, midi or audio)
  121. - the path of the packet (send -master->slave- or return -slave->master-)
  122. - the unique ID of the slave
  123. - the sample's bitdepth (unused for now)
  124. - the size of the midi data contains in the packet (indicates how much midi data will be sent)
  125. - the number of midi packet(s) : more than one is very unusual, it depends on the midi load
  126. - the ID of the current cycle (used to check missing packets)
  127. - the ID of the packet subcycle (for audio data)
  128. - a flag indicating this packet is the last of the cycle (for sync robustness, it's better to process this way)
  129. - a flag indicating if, in async mode, the previous graph was not finished or not
  130. - padding to fill 64 bytes
  131. */
  132. struct _packet_header
  133. {
  134. char fPacketType[7]; //packet type ( 'headr' )
  135. char fDataType; //a for audio, m for midi and s for sync
  136. char fDataStream; //s for send, r for return
  137. uint32_t fID; //unique ID of the slave
  138. uint32_t fNumPacket; //number of data packets of the cycle
  139. uint32_t fPacketSize; //packet size in bytes
  140. uint32_t fCycle; //process cycle counter
  141. uint32_t fSubCycle; //midi/audio subcycle counter
  142. uint32_t fIsLastPckt; //is it the last packet of a given cycle ('y' or 'n')
  143. };
  144. //net timebase master
  145. /**
  146. \Brief This enum describes timebase master's type
  147. */
  148. enum _net_timebase_master
  149. {
  150. NO_CHANGE = 0,
  151. RELEASE_TIMEBASEMASTER = 1,
  152. TIMEBASEMASTER = 2,
  153. CONDITIONAL_TIMEBASEMASTER = 3
  154. };
  155. typedef enum _net_timebase_master net_timebase_master_t;
  156. //transport data ******************************************************************************
  157. /**
  158. \Brief This structure contains transport data to be sent over the network
  159. */
  160. struct _net_transport_data
  161. {
  162. uint32_t fNewState; //is it a state change
  163. uint32_t fTimebaseMaster; //is there a new timebase master
  164. int32_t fState; //current cycle state
  165. jack_position_t fPosition; //current cycle position
  166. };
  167. //midi data ***********************************************************************************
  168. /**
  169. \Brief Midi buffer and operations class
  170. This class is a toolset to manipulate Midi buffers.
  171. A JackMidiBuffer has a fixed size, which is the same than an audio buffer size.
  172. An intermediate fixed size buffer allows to uninterleave midi data (from jack ports).
  173. But for a big majority of the process cycles, this buffer is filled less than 1%,
  174. Sending over a network 99% of useless data seems completely unappropriate.
  175. The idea is to count effective midi data, and then send the smallest packet we can.
  176. To do it, we use an intermediate buffer.
  177. We have two methods to convert data from jack ports to intermediate buffer,
  178. And two others to convert this intermediate buffer to a network buffer (header + payload data)
  179. */
  180. class SERVER_EXPORT NetMidiBuffer
  181. {
  182. private:
  183. int fNPorts;
  184. size_t fMaxBufsize;
  185. int fMaxPcktSize;
  186. char* fBuffer;
  187. char* fNetBuffer;
  188. JackMidiBuffer** fPortBuffer;
  189. size_t fCycleSize; // needed size in bytes ofr an entire cycle
  190. public:
  191. NetMidiBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );
  192. ~NetMidiBuffer();
  193. void Reset();
  194. // needed size in bytes for an entire cycle
  195. size_t GetCycleSize();
  196. int GetNumPackets();
  197. //utility
  198. void DisplayEvents();
  199. //jack<->buffer
  200. int RenderFromJackPorts();
  201. int RenderToJackPorts();
  202. //network<->buffer
  203. int RenderFromNetwork ( int subcycle, size_t copy_size );
  204. int RenderToNetwork ( int subcycle, size_t total_size );
  205. void SetBuffer ( int index, JackMidiBuffer* buffer );
  206. JackMidiBuffer* GetBuffer ( int index );
  207. };
  208. // audio data *********************************************************************************
  209. class SERVER_EXPORT NetAudioBuffer
  210. {
  211. public:
  212. NetAudioBuffer ()
  213. {}
  214. virtual ~NetAudioBuffer()
  215. {}
  216. // needed syze in bytes ofr an entire cycle
  217. virtual size_t GetCycleSize() = 0;
  218. // cycle duration in sec
  219. virtual float GetCycleDuration() = 0;
  220. virtual int GetNumPackets() = 0;
  221. //jack<->buffer
  222. virtual int RenderFromJackPorts () = 0;
  223. virtual int RenderToJackPorts () = 0;
  224. //network<->buffer
  225. virtual int RenderFromNetwork ( int cycle, int subcycle, size_t copy_size ) = 0;
  226. virtual int RenderToNetwork (int subcycle, size_t total_size ) = 0;
  227. virtual void SetBuffer ( int index, sample_t* buffer ) = 0;
  228. virtual sample_t* GetBuffer ( int index ) = 0;
  229. };
  230. /**
  231. \Brief Audio buffer and operations class
  232. This class is a toolset to manipulate audio buffers.
  233. The manipulation of audio buffers is similar to midi buffer, except those buffers have fixed size.
  234. The interleaving/uninterleaving operations are simplier here because audio buffers have fixed size,
  235. So there is no need of an intermediate buffer as in NetMidiBuffer.
  236. */
  237. struct JackPortList {
  238. jack_nframes_t fPeriodSize;
  239. jack_nframes_t fSubPeriodSize;
  240. size_t fSubPeriodBytesSize;
  241. sample_t** fPortBuffer;
  242. int fNPorts;
  243. size_t fCycleSize; // needed size in bytes for an entire cycle
  244. float fCycleDuration; // in sec
  245. int fLastSubCycle;
  246. JackPortList(session_params_t* params, uint32_t nports)
  247. {
  248. fNPorts = nports;
  249. fPeriodSize = params->fPeriodSize;
  250. if (params->fSendAudioChannels == 0 && params->fReturnAudioChannels == 0) {
  251. fSubPeriodSize = params->fPeriodSize;
  252. } else {
  253. jack_nframes_t period = (int) powf(2.f, (int) (log (float ((params->fMtu - sizeof(packet_header_t)))
  254. / (max(params->fReturnAudioChannels, params->fSendAudioChannels) * sizeof(sample_t))) / log(2.)));
  255. fSubPeriodSize = (period > params->fPeriodSize) ? params->fPeriodSize : period;
  256. }
  257. fSubPeriodBytesSize = fSubPeriodSize * sizeof(sample_t);
  258. fPortBuffer = new sample_t* [fNPorts];
  259. for (int port_index = 0; port_index < fNPorts; port_index++)
  260. fPortBuffer[port_index] = NULL;
  261. fCycleDuration = float(fSubPeriodSize) / float(params->fSampleRate);
  262. fCycleSize = params->fMtu * (fPeriodSize / fSubPeriodSize);
  263. fLastSubCycle = -1;
  264. }
  265. int GetNumPackets()
  266. {
  267. return fPeriodSize / fSubPeriodSize;
  268. }
  269. JackPortList()
  270. {
  271. fNPorts = 0;
  272. fPeriodSize = 0;
  273. fSubPeriodSize = 0;
  274. fSubPeriodBytesSize = 0;
  275. fPortBuffer = 0;
  276. }
  277. ~JackPortList()
  278. {
  279. delete [] fPortBuffer;
  280. }
  281. void SetBuffer( int index, sample_t* buffer )
  282. {
  283. fPortBuffer[index] = buffer;
  284. }
  285. sample_t* GetBuffer ( int index )
  286. {
  287. return fPortBuffer[index];
  288. }
  289. void Copy(sample_t** buffers)
  290. {
  291. for (int port_index = 0; port_index < fNPorts; port_index++)
  292. memcpy(buffers[port_index], fPortBuffer[port_index], fPeriodSize * sizeof(float));
  293. }
  294. // needed syze in bytes ofr an entire cycle
  295. size_t GetCycleSize()
  296. {
  297. return fCycleSize;
  298. }
  299. // cycle duration in sec
  300. float GetCycleDuration()
  301. {
  302. return fCycleDuration;
  303. }
  304. #ifdef __BIG_ENDIAN__
  305. static inline float SwapFloat(float f)
  306. {
  307. union
  308. {
  309. float f;
  310. unsigned char b[4];
  311. } dat1, dat2;
  312. dat1.f = f;
  313. dat2.b[0] = dat1.b[3];
  314. dat2.b[1] = dat1.b[2];
  315. dat2.b[2] = dat1.b[1];
  316. dat2.b[3] = dat1.b[0];
  317. return dat2.f;
  318. }
  319. int RenderFromJackPorts ()
  320. {
  321. return fNPorts * fSubPeriodBytesSize; // in bytes
  322. }
  323. int RenderToJackPorts ()
  324. {
  325. return fPeriodSize * sizeof(sample_t); // in bytes TODO
  326. }
  327. //network<->buffer
  328. int RenderFromNetwork(char* net_buffer, int cycle, int subcycle, size_t copy_size)
  329. {
  330. for ( int port_index = 0; port_index < fNPorts; port_index++ ) {
  331. float* src = (float*)(net_buffer + port_index * fSubPeriodBytesSize);
  332. float* dst = (float*)(fPortBuffer[port_index] + subcycle * fSubPeriodSize);
  333. for (unsigned int sample = 0; sample < fSubPeriodBytesSize / sizeof(float); sample++) {
  334. dst[sample] = SwapFloat(src[sample]);
  335. }
  336. }
  337. return copy_size;
  338. }
  339. int RenderToNetwork(char* net_buffer, int subcycle, size_t total_size)
  340. {
  341. for ( int port_index = 0; port_index < fNPorts; port_index++ ) {
  342. float* src = (float*)(fPortBuffer[port_index] + subcycle * fSubPeriodSize);
  343. float* dst = (float*)(net_buffer + port_index * fSubPeriodBytesSize);
  344. for (unsigned int sample = 0; sample < fSubPeriodBytesSize / sizeof(float); sample++) {
  345. dst[sample] = SwapFloat(src[sample]);
  346. }
  347. }
  348. return fNPorts * fSubPeriodBytesSize;
  349. }
  350. #else
  351. int RenderFromJackPorts ()
  352. {
  353. return fNPorts * fSubPeriodBytesSize; // in bytes
  354. }
  355. int RenderToJackPorts ()
  356. {
  357. fLastSubCycle = -1;
  358. return fPeriodSize * sizeof(sample_t); // in bytes; TODO
  359. }
  360. //network<->buffer
  361. int RenderFromNetwork(char* net_buffer, int cycle, int subcycle, size_t copy_size)
  362. {
  363. for (int port_index = 0; port_index < fNPorts; port_index++)
  364. memcpy(fPortBuffer[port_index] + subcycle * fSubPeriodSize, net_buffer + port_index * fSubPeriodBytesSize, fSubPeriodBytesSize);
  365. if (subcycle != fLastSubCycle + 1) {
  366. jack_error("Packet(s) missing from... %d %d", fLastSubCycle, subcycle);
  367. }
  368. fLastSubCycle = subcycle;
  369. return copy_size;
  370. }
  371. int RenderToNetwork(char* net_buffer,int subcycle, size_t total_size)
  372. {
  373. for (int port_index = 0; port_index < fNPorts; port_index++)
  374. memcpy(net_buffer + port_index * fSubPeriodBytesSize, fPortBuffer[port_index] + subcycle * fSubPeriodSize, fSubPeriodBytesSize);
  375. return fNPorts * fSubPeriodBytesSize;
  376. }
  377. #endif
  378. };
  379. struct JackPortListAllocate : public JackPortList {
  380. JackPortListAllocate()
  381. {
  382. fNPorts = 0;
  383. fPeriodSize = 0;
  384. fSubPeriodSize = 0;
  385. fSubPeriodBytesSize = 0;
  386. fPortBuffer = 0;
  387. }
  388. ~JackPortListAllocate()
  389. {
  390. for (int port_index = 0; port_index < fNPorts; port_index++)
  391. delete [] fPortBuffer[port_index];
  392. delete [] fPortBuffer;
  393. }
  394. void Init(session_params_t* params, uint32_t nports)
  395. {
  396. fNPorts = nports;
  397. fPeriodSize = params->fPeriodSize;
  398. if (params->fSendAudioChannels == 0 && params->fReturnAudioChannels == 0) {
  399. fSubPeriodSize = params->fPeriodSize;
  400. } else {
  401. jack_nframes_t period = ( int ) powf ( 2.f, ( int ) ( log (float ((params->fMtu - sizeof(packet_header_t)))
  402. / ( max ( params->fReturnAudioChannels, params->fSendAudioChannels ) * sizeof ( sample_t ) ) ) / log ( 2. ) ) );
  403. fSubPeriodSize = ( period > params->fPeriodSize ) ? params->fPeriodSize : period;
  404. }
  405. fSubPeriodBytesSize = fSubPeriodSize * sizeof ( sample_t );
  406. fPortBuffer = new sample_t* [fNPorts];
  407. for ( int port_index = 0; port_index < fNPorts; port_index++ )
  408. fPortBuffer[port_index] = new sample_t[fPeriodSize];
  409. }
  410. };
  411. class SERVER_EXPORT NetFloatAudioBuffer : public NetAudioBuffer
  412. {
  413. private:
  414. JackPortList fPortBuffer;
  415. char* fNetBuffer;
  416. public:
  417. NetFloatAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );
  418. ~NetFloatAudioBuffer();
  419. // needed size in bytes for an entire cycle
  420. size_t GetCycleSize();
  421. // cycle duration in sec
  422. float GetCycleDuration()
  423. {
  424. return fPortBuffer.GetCycleDuration();
  425. }
  426. int GetNumPackets()
  427. {
  428. return fPortBuffer.GetNumPackets();
  429. }
  430. //jack<->buffer
  431. int RenderFromJackPorts ();
  432. int RenderToJackPorts ();
  433. void SetBuffer ( int index, sample_t* buffer );
  434. sample_t* GetBuffer ( int index );
  435. //network<->buffer
  436. int RenderFromNetwork ( int cycle, int subcycle, size_t copy_size );
  437. int RenderToNetwork (int subcycle, size_t total_size );
  438. };
  439. #define CELT 1
  440. #ifdef CELT
  441. #include <celt/celt.h>
  442. class SERVER_EXPORT NetCeltAudioBuffer : public NetAudioBuffer
  443. {
  444. private:
  445. CELTMode ** fCeltMode;
  446. CELTEncoder ** fCeltEncoder;
  447. CELTDecoder ** fCeltDecoder;
  448. int fCompressedSizeByte;
  449. jack_nframes_t fPeriodSize;
  450. int fNumPackets;
  451. float fCycleDuration; // in sec
  452. size_t fCycleSize; // needed size in bytes for an entire cycle
  453. size_t fSubPeriodBytesSize;
  454. size_t fLastSubPeriodBytesSize;
  455. sample_t** fPortBuffer;
  456. char* fNetBuffer;
  457. unsigned char ** fCompressedBuffer;
  458. int fNPorts;
  459. int fLastSubCycle;
  460. void FreeCelt();
  461. public:
  462. NetCeltAudioBuffer(session_params_t* params, uint32_t nports, char* net_buffer, int kbps);
  463. ~NetCeltAudioBuffer();
  464. // needed size in bytes for an entire cycle
  465. size_t GetCycleSize();
  466. // cycle duration in sec
  467. float GetCycleDuration();
  468. int GetNumPackets();
  469. void SetBuffer(int index, sample_t* buffer);
  470. sample_t* GetBuffer(int index);
  471. //jack<->buffer
  472. int RenderFromJackPorts();
  473. int RenderToJackPorts();
  474. //network<->buffer
  475. int RenderFromNetwork(int cycle, int subcycle, size_t copy_size);
  476. int RenderToNetwork(int subcycle, size_t total_size);
  477. };
  478. #endif
  479. class SERVER_EXPORT NetIntAudioBuffer : public NetAudioBuffer
  480. {
  481. private:
  482. int fCompressedSizeByte;
  483. jack_nframes_t fPeriodSize;
  484. int fNumPackets;
  485. float fCycleDuration; // in sec
  486. size_t fCycleSize; // needed size in bytes for an entire cycle
  487. size_t fSubPeriodSize;
  488. size_t fSubPeriodBytesSize;
  489. size_t fLastSubPeriodSize;;
  490. size_t fLastSubPeriodBytesSize;
  491. sample_t** fPortBuffer;
  492. char* fNetBuffer;
  493. short ** fIntBuffer;
  494. int fNPorts;
  495. int fLastSubCycle;
  496. public:
  497. NetIntAudioBuffer(session_params_t* params, uint32_t nports, char* net_buffer);
  498. ~NetIntAudioBuffer();
  499. // needed size in bytes for an entire cycle
  500. size_t GetCycleSize();
  501. // cycle duration in sec
  502. float GetCycleDuration();
  503. int GetNumPackets();
  504. void SetBuffer(int index, sample_t* buffer);
  505. sample_t* GetBuffer(int index);
  506. //jack<->buffer
  507. int RenderFromJackPorts();
  508. int RenderToJackPorts();
  509. //network<->buffer
  510. int RenderFromNetwork(int cycle, int subcycle, size_t copy_size);
  511. int RenderToNetwork(int subcycle, size_t total_size);
  512. };
  513. #define AUDIO_BUFFER_SIZE 8
  514. /*
  515. class SERVER_EXPORT NetBufferedAudioBuffer : public NetAudioBuffer
  516. {
  517. private:
  518. char* fNetBuffer;
  519. JackPortListAllocate fPortBuffer[AUDIO_BUFFER_SIZE];
  520. sample_t** fJackPortBuffer;
  521. int fMaxCycle;
  522. public:
  523. NetBufferedAudioBuffer ( session_params_t* params, uint32_t nports, char* net_buffer );
  524. ~NetBufferedAudioBuffer();
  525. // needed syze in bytes ofr an entire cycle
  526. size_t GetCycleSize();
  527. // cycle duration in sec
  528. float GetCycleDuration()
  529. {
  530. return fPortBuffer[0].GetCycleDuration();
  531. }
  532. //jack<->buffer
  533. int RenderFromJackPorts (int subcycle );
  534. int RenderToJackPorts ( int cycle, int subcycle);
  535. //void FinishRenderToJackPorts (int cycle);
  536. //network<->buffer
  537. int RenderFromNetwork ( int subcycle, size_t copy_size )
  538. {
  539. // TODO
  540. return 0;
  541. }
  542. int RenderToNetwork ( int subcycle, size_t total_size )
  543. {
  544. // TODO
  545. return 0;
  546. }
  547. void SetBuffer ( int index, sample_t* buffer );
  548. sample_t* GetBuffer ( int index );
  549. };
  550. */
  551. //utility *************************************************************************************
  552. //socket API management
  553. SERVER_EXPORT int SocketAPIInit();
  554. SERVER_EXPORT int SocketAPIEnd();
  555. //n<-->h functions
  556. SERVER_EXPORT void SessionParamsHToN ( session_params_t* src_params, session_params_t* dst_params );
  557. SERVER_EXPORT void SessionParamsNToH ( session_params_t* src_params, session_params_t* dst_params );
  558. SERVER_EXPORT void PacketHeaderHToN ( packet_header_t* src_header, packet_header_t* dst_header );
  559. SERVER_EXPORT void PacketHeaderNToH ( packet_header_t* src_header, packet_header_t* dst_header );
  560. SERVER_EXPORT void MidiBufferHToN ( JackMidiBuffer* src_buffer, JackMidiBuffer* dst_buffer );
  561. SERVER_EXPORT void MidiBufferNToH ( JackMidiBuffer* src_buffer, JackMidiBuffer* dst_buffer );
  562. SERVER_EXPORT void TransportDataHToN ( net_transport_data_t* src_params, net_transport_data_t* dst_params );
  563. SERVER_EXPORT void TransportDataNToH ( net_transport_data_t* src_params, net_transport_data_t* dst_params );
  564. //display session parameters
  565. SERVER_EXPORT void SessionParamsDisplay ( session_params_t* params );
  566. //display packet header
  567. SERVER_EXPORT void PacketHeaderDisplay ( packet_header_t* header );
  568. //get the packet type from a sesion parameters
  569. SERVER_EXPORT sync_packet_type_t GetPacketType ( session_params_t* params );
  570. //set the packet type in a session parameters
  571. SERVER_EXPORT int SetPacketType ( session_params_t* params, sync_packet_type_t packet_type );
  572. //transport utility
  573. SERVER_EXPORT const char* GetTransportState ( int transport_state );
  574. SERVER_EXPORT void NetTransportDataDisplay ( net_transport_data_t* data );
  575. }