Jack2  1.9.9
JackNetDriver.h
1 /*
2 Copyright (C) 2008-2011 Romain Moret at Grame
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #ifndef __JackNetDriver__
21 #define __JackNetDriver__
22 
23 #include "JackTimedDriver.h"
24 #include "JackNetInterface.h"
25 
26 //#define JACK_MONITOR
27 
28 namespace Jack
29 {
35  {
36 
37  private:
38 
39  //jack data
40  jack_port_id_t* fMidiCapturePortList;
41  jack_port_id_t* fMidiPlaybackPortList;
42 
43  //transport
44  int fLastTransportState;
45  int fLastTimebaseMaster;
46 
47  //monitoring
48  #ifdef JACK_MONITOR
49  JackGnuPlotMonitor<float>* fNetTimeMon;
50  jack_time_t fRcvSyncUst;
51  #endif
52 
53  bool Initialize();
54  void FreeAll();
55 
56  int AllocPorts();
57  int FreePorts();
58 
59  //transport
60  void EncodeTransportData();
61  void DecodeTransportData();
62 
63  JackMidiBuffer* GetMidiInputBuffer(int port_index);
64  JackMidiBuffer* GetMidiOutputBuffer(int port_index);
65 
66  void SaveConnections();
67 
68  public:
69 
70  JackNetDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
71  const char* ip, int port, int mtu, int midi_input_ports, int midi_output_ports,
72  char* net_name, uint transport_sync, int network_latency, int celt_encoding, int opus_encoding);
73  virtual ~JackNetDriver();
74 
75  int Close();
76 
77  int Attach();
78  int Detach();
79 
80  int Read();
81  int Write();
82 
83  // BufferSize can't be changed
84  bool IsFixedBufferSize()
85  {
86  return true;
87  }
88 
89  int SetBufferSize(jack_nframes_t buffer_size)
90  {
91  return -1;
92  }
93 
94  int SetSampleRate(jack_nframes_t sample_rate)
95  {
96  return -1;
97  }
98 
99  };
100 }
101 
102 #endif
Inter process synchronization using using Mach semaphore.
Locked Engine, access to methods is serialized using a mutex.
Generic monitoring class. Saves data to GnuPlot files (&#39;.plt&#39; and &#39;.log&#39; datafile) ...
Definition: JackTools.h:101