Jack2 1.9.12

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 {
34 class JackNetDriver : public JackWaiterDriver, public JackNetSlaveInterface
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 // The wanted value at creation time (may be different than the value actually returned by the master)
48 int fWantedAudioCaptureChannels;
49 int fWantedAudioPlaybackChannels;
50
51 int fWantedMIDICaptureChannels;
52 int fWantedMIDIPlaybackChannels;
53
54 bool fAutoSave;
55
56 //monitoring
57 #ifdef JACK_MONITOR
58 JackGnuPlotMonitor<float>* fNetTimeMon;
59 jack_time_t fRcvSyncUst;
60 #endif
61
62 bool Initialize();
63 void FreeAll();
64
65 int AllocPorts();
66 int FreePorts();
67
68 //transport
69 void EncodeTransportData();
70 void DecodeTransportData();
71
72 JackMidiBuffer* GetMidiInputBuffer(int port_index);
73 JackMidiBuffer* GetMidiOutputBuffer(int port_index);
74
75 void SaveConnections(int alias);
76
77 void UpdateLatencies();
78
79 public:
80
81 JackNetDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
82 const char* ip, int port, int mtu, int midi_input_ports, int midi_output_ports,
83 char* net_name, uint transport_sync, int network_latency, int celt_encoding,
84 int opus_encoding, bool auto_save);
85 virtual ~JackNetDriver();
86
87 int Open(jack_nframes_t buffer_size,
88 jack_nframes_t samplerate,
89 bool capturing,
90 bool playing,
91 int inchannels,
92 int outchannels,
93 bool monitor,
94 const char* capture_driver_name,
95 const char* playback_driver_name,
96 jack_nframes_t capture_latency,
97 jack_nframes_t playback_latency);
98 int Close();
99
100 int Attach();
101 int Detach();
102
103 int Read();
104 int Write();
105
106 // BufferSize can't be changed
107 bool IsFixedBufferSize()
108 {
109 return true;
110 }
111
112 int SetBufferSize(jack_nframes_t buffer_size)
113 {
114 return -1;
115 }
116
117 int SetSampleRate(jack_nframes_t sample_rate)
118 {
119 return -1;
120 }
121
122 };
123 }
124
125 #endif
Jack::JackLockedEngine
Locked Engine, access to methods is serialized using a mutex.
Definition: JackLockedEngine.h:78
Jack::JackNetSlaveInterface
Definition: JackNetInterface.h:199
Jack::JackPosixSemaphore
Inter process synchronization using POSIX semaphore.
Definition: JackPosixSemaphore.h:36
Jack::JackNetDriver
Definition: JackNetDriver.h:34
Jack::JackMidiBuffer
Definition: JackMidiPort.h:75
Jack::JackGnuPlotMonitor
Generic monitoring class. Saves data to GnuPlot files ('.plt' and '.log' datafile)
Definition: JackTools.h:101
Jack::JackWaiterDriver
Definition: JackTimedDriver.h:63