Jack2 1.9.6

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