Jack2  1.9.7
JackNetOneDriver.h
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 "netjack.h"
00026 #include "netjack_packet.h"
00027 
00028 namespace Jack
00029 {
00034     class JackNetOneDriver : public JackAudioDriver
00035     {
00036         private:
00037 
00038             netjack_driver_state_t netj;
00039 
00040             void
00041             render_payload_to_jack_ports_float ( void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats);
00042             void
00043             render_jack_ports_to_payload_float (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats );
00044             #ifdef HAVE_CELT
00045             void
00046             render_payload_to_jack_ports_celt (void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes);
00047             void
00048             render_jack_ports_to_payload_celt (JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up);
00049             #endif
00050             void
00051             render_payload_to_jack_ports (int bitdepth, void *packet_payload, jack_nframes_t net_period_down, JSList *capture_ports, JSList *capture_srcs, jack_nframes_t nframes, int dont_htonl_floats);
00052             void
00053             render_jack_ports_to_payload (int bitdepth, JSList *playback_ports, JSList *playback_srcs, jack_nframes_t nframes, void *packet_payload, jack_nframes_t net_period_up, int dont_htonl_floats);
00054 
00055         public:
00056 
00057             JackNetOneDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
00058                 int port, int mtu, int capture_ports, int playback_ports, int midi_input_ports, int midi_output_ports,
00059                 int sample_rate, int period_size, int resample_factor,
00060                 const char* net_name, uint transport_sync, int bitdepth, int use_autoconfig,
00061                 int latency, int redundancy, int dont_htonl_floats, int always_deadline, int jitter_val );
00062                 ~JackNetOneDriver();
00063 
00064             int Open ( jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing,
00065                        int inchannels, int outchannels, bool monitor, const char* capture_driver_name,
00066                        const char* playback_driver_name, jack_nframes_t capture_latency, jack_nframes_t playback_latency );
00067 
00068             int Close();
00069             int Attach();
00070             int Detach();
00071 
00072             int Read();
00073             int Write();
00074 
00075             bool Initialize();
00076             int AllocPorts();
00077             void FreePorts();
00078 
00079             // BufferSize can't be changed
00080             bool IsFixedBufferSize()
00081             {
00082                 return true;
00083             }
00084 
00085             int SetBufferSize ( jack_nframes_t buffer_size )
00086             {
00087                 return -1;
00088             }
00089 
00090             int SetSampleRate ( jack_nframes_t sample_rate )
00091             {
00092                 return -1;
00093             }
00094 
00095     };
00096 }
00097 
00098 #endif