Jack2 1.9.6
|
00001 /* 00002 Copyright (C) 2001 Paul Davis 00003 Copyright (C) 2008 Romain Moret at Grame 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 00019 */ 00020 00021 #ifndef __JackNetDriver__ 00022 #define __JackNetDriver__ 00023 00024 #include "JackAudioDriver.h" 00025 #include "JackNetInterface.h" 00026 00027 #ifdef JACK_MONITOR 00028 #include "JackFrameTimer.h" 00029 #endif 00030 00031 namespace Jack 00032 { 00037 class JackNetDriver : public JackAudioDriver, public JackNetSlaveInterface 00038 { 00039 private: 00040 //jack data 00041 jack_port_id_t* fMidiCapturePortList; 00042 jack_port_id_t* fMidiPlaybackPortList; 00043 00044 //transport 00045 int fLastTransportState; 00046 int fLastTimebaseMaster; 00047 00048 //monitoring 00049 #ifdef JACK_MONITOR 00050 JackGnuPlotMonitor<float>* fNetTimeMon; 00051 jack_time_t fRcvSyncUst; 00052 #endif 00053 00054 bool Initialize(); 00055 void FreeAll(); 00056 00057 int AllocPorts(); 00058 int FreePorts(); 00059 00060 //transport 00061 void EncodeTransportData(); 00062 void DecodeTransportData(); 00063 00064 JackMidiBuffer* GetMidiInputBuffer ( int port_index ); 00065 JackMidiBuffer* GetMidiOutputBuffer ( int port_index ); 00066 00067 public: 00068 JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table, 00069 const char* ip, int port, int mtu, int midi_input_ports, int midi_output_ports, 00070 char* net_name, uint transport_sync, char network_master_mode ); 00071 ~JackNetDriver(); 00072 00073 int Open ( jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing, 00074 int inchannels, int outchannels, bool monitor, const char* capture_driver_name, 00075 const char* playback_driver_name, jack_nframes_t capture_latency, jack_nframes_t playback_latency ); 00076 int Close(); 00077 00078 int Attach(); 00079 int Detach(); 00080 00081 int Read(); 00082 int Write(); 00083 00084 // BufferSize can't be changed 00085 bool IsFixedBufferSize() 00086 { 00087 return true; 00088 } 00089 00090 int SetBufferSize ( jack_nframes_t buffer_size ) 00091 { 00092 return -1; 00093 } 00094 00095 int SetSampleRate ( jack_nframes_t sample_rate ) 00096 { 00097 return -1; 00098 } 00099 00100 }; 00101 } 00102 00103 #endif