Jack2 1.9.6

netjack.h

00001 
00002 /*
00003     Copyright (C) 2003 Robert Ham <rah@bash.sh>
00004     Copyright (C) 2005 Torben Hohn <torbenh@gmx.de>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 #ifndef __NETJACK_H__
00022 #define __NETJACK_H__
00023 
00024 #include <unistd.h>
00025 
00026 #include <jack/types.h>
00027 //#include <jack/driver.h>
00028 #include <jack/jack.h>
00029 #include <jack/transport.h>
00030 
00031 #include "jack/jslist.h"
00032 
00033 //#include <netinet/in.h>
00034 
00035 #ifdef __cplusplus
00036 extern "C"
00037 {
00038 #endif
00039 
00040 typedef struct _netjack_driver_state netjack_driver_state_t;
00041 
00042 struct _netjack_driver_state {
00043     jack_nframes_t  net_period_up;
00044     jack_nframes_t  net_period_down;
00045 
00046     jack_nframes_t  sample_rate;
00047     jack_nframes_t  bitdepth;
00048     jack_nframes_t  period_size;
00049     jack_time_t     period_usecs;
00050     int             dont_htonl_floats;
00051     int             always_deadline;
00052 
00053     jack_nframes_t  codec_latency;
00054 
00055     unsigned int    listen_port;
00056 
00057     unsigned int    capture_channels;
00058     unsigned int    playback_channels;
00059     unsigned int    capture_channels_audio;
00060     unsigned int    playback_channels_audio;
00061     unsigned int    capture_channels_midi;
00062     unsigned int    playback_channels_midi;
00063 
00064     JSList          *capture_ports;
00065     JSList          *playback_ports;
00066     JSList          *playback_srcs;
00067     JSList          *capture_srcs;
00068 
00069     jack_client_t   *client;
00070 
00071 #ifdef WIN32
00072     SOCKET          sockfd;
00073     SOCKET          outsockfd;
00074 #else
00075     int             sockfd;
00076     int             outsockfd;
00077 #endif
00078 
00079     struct sockaddr_in syncsource_address;
00080 
00081     int             reply_port;
00082     int             srcaddress_valid;
00083 
00084     int sync_state;
00085     unsigned int handle_transport_sync;
00086 
00087     unsigned int *rx_buf;
00088     unsigned int rx_bufsize;
00089     //unsigned int tx_bufsize;
00090     unsigned int mtu;
00091     unsigned int latency;
00092     unsigned int redundancy;
00093 
00094     jack_nframes_t expected_framecnt;
00095     int            expected_framecnt_valid;
00096     unsigned int   num_lost_packets;
00097     jack_time_t    next_deadline;
00098     jack_time_t    deadline_offset;
00099     int            next_deadline_valid;
00100     int            packet_data_valid;
00101     int            resync_threshold;
00102     int            running_free;
00103     int            deadline_goodness;
00104     jack_time_t    time_to_deadline;
00105     unsigned int   use_autoconfig;
00106     unsigned int   resample_factor;
00107     unsigned int   resample_factor_up;
00108     int            jitter_val;
00109 };
00110 
00111 int netjack_wait( netjack_driver_state_t *netj );
00112 void netjack_send_silence( netjack_driver_state_t *netj, int syncstate );
00113 void netjack_read( netjack_driver_state_t *netj, jack_nframes_t nframes ) ;
00114 void netjack_write( netjack_driver_state_t *netj, jack_nframes_t nframes, int syncstate );
00115 void netjack_attach( netjack_driver_state_t *netj );
00116 void netjack_detach( netjack_driver_state_t *netj );
00117 
00118 netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj,
00119                 jack_client_t * client,
00120                 const char *name,
00121                 unsigned int capture_ports,
00122                 unsigned int playback_ports,
00123                 unsigned int capture_ports_midi,
00124                 unsigned int playback_ports_midi,
00125                 jack_nframes_t sample_rate,
00126                 jack_nframes_t period_size,
00127                 unsigned int listen_port,
00128                 unsigned int transport_sync,
00129                 unsigned int resample_factor,
00130                 unsigned int resample_factor_up,
00131                 unsigned int bitdepth,
00132                 unsigned int use_autoconfig,
00133                 unsigned int latency,
00134                 unsigned int redundancy,
00135                 int dont_htonl_floats,
00136                 int always_deadline,
00137                 int jitter_val );
00138 
00139 void netjack_release( netjack_driver_state_t *netj );
00140 int netjack_startup( netjack_driver_state_t *netj );
00141 
00142 #ifdef __cplusplus
00143 }
00144 #endif
00145 
00146 #endif