Jack2 1.9.8

JackNetOneDriver.h

00001 /*
00002 Copyright (C) 2008-2011 Torben Horn
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 
00018 */
00019 
00020 #ifndef __JackNetDriver__
00021 #define __JackNetDriver__
00022 
00023 #include "JackTimedDriver.h"
00024 #include "netjack.h"
00025 #include "netjack_packet.h"
00026 
00027 namespace Jack
00028 {
00033 class JackNetOneDriver : public JackWaiterDriver
00034 {
00035     private:
00036 
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 #if 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 
00056         JackNetOneDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
00057                            int port, int mtu, int capture_ports, int playback_ports, int midi_input_ports, int midi_output_ports,
00058                            int sample_rate, int period_size, int resample_factor,
00059                            const char* net_name, uint transport_sync, int bitdepth, int use_autoconfig,
00060                            int latency, int redundancy, int dont_htonl_floats, int always_deadline, int jitter_val);
00061         virtual ~JackNetOneDriver();
00062 
00063         int Close();
00064         int Attach();
00065         int Detach();
00066 
00067         int Read();
00068         int Write();
00069 
00070         bool Initialize();
00071         int AllocPorts();
00072         void FreePorts();
00073 
00074         // BufferSize can't be changed
00075         bool IsFixedBufferSize()
00076         {
00077             return true;
00078         }
00079 
00080         int SetBufferSize(jack_nframes_t buffer_size)
00081         {
00082             return -1;
00083         }
00084 
00085         int SetSampleRate(jack_nframes_t sample_rate)
00086         {
00087             return -1;
00088         }
00089 
00090 };
00091 
00092 }
00093 
00094 #endif