Jack2 1.9.7
|
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 #if HAVE_CELT 00034 #include <celt/celt.h> 00035 #endif 00036 00037 //#include <netinet/in.h> 00038 00039 #ifdef __cplusplus 00040 extern "C" 00041 { 00042 #endif 00043 00044 struct _packet_cache; 00045 00046 typedef struct _netjack_driver_state netjack_driver_state_t; 00047 00048 struct _netjack_driver_state { 00049 jack_nframes_t net_period_up; 00050 jack_nframes_t net_period_down; 00051 00052 jack_nframes_t sample_rate; 00053 jack_nframes_t bitdepth; 00054 jack_nframes_t period_size; 00055 jack_time_t period_usecs; 00056 int dont_htonl_floats; 00057 int always_deadline; 00058 00059 jack_nframes_t codec_latency; 00060 00061 unsigned int listen_port; 00062 00063 unsigned int capture_channels; 00064 unsigned int playback_channels; 00065 unsigned int capture_channels_audio; 00066 unsigned int playback_channels_audio; 00067 unsigned int capture_channels_midi; 00068 unsigned int playback_channels_midi; 00069 00070 JSList *capture_ports; 00071 JSList *playback_ports; 00072 JSList *playback_srcs; 00073 JSList *capture_srcs; 00074 00075 jack_client_t *client; 00076 00077 #ifdef WIN32 00078 SOCKET sockfd; 00079 SOCKET outsockfd; 00080 #else 00081 int sockfd; 00082 int outsockfd; 00083 #endif 00084 00085 struct sockaddr_in syncsource_address; 00086 00087 int reply_port; 00088 int srcaddress_valid; 00089 00090 int sync_state; 00091 unsigned int handle_transport_sync; 00092 00093 unsigned int *rx_buf; 00094 unsigned int rx_bufsize; 00095 //unsigned int tx_bufsize; 00096 unsigned int mtu; 00097 unsigned int latency; 00098 unsigned int redundancy; 00099 00100 jack_nframes_t expected_framecnt; 00101 int expected_framecnt_valid; 00102 unsigned int num_lost_packets; 00103 jack_time_t next_deadline; 00104 jack_time_t deadline_offset; 00105 int next_deadline_valid; 00106 int packet_data_valid; 00107 int resync_threshold; 00108 int running_free; 00109 int deadline_goodness; 00110 jack_time_t time_to_deadline; 00111 unsigned int use_autoconfig; 00112 unsigned int resample_factor; 00113 unsigned int resample_factor_up; 00114 int jitter_val; 00115 struct _packet_cache * packcache; 00116 #if HAVE_CELT 00117 CELTMode *celt_mode; 00118 #endif 00119 }; 00120 00121 int netjack_wait( netjack_driver_state_t *netj ); 00122 void netjack_send_silence( netjack_driver_state_t *netj, int syncstate ); 00123 void netjack_read( netjack_driver_state_t *netj, jack_nframes_t nframes ) ; 00124 void netjack_write( netjack_driver_state_t *netj, jack_nframes_t nframes, int syncstate ); 00125 void netjack_attach( netjack_driver_state_t *netj ); 00126 void netjack_detach( netjack_driver_state_t *netj ); 00127 00128 netjack_driver_state_t *netjack_init (netjack_driver_state_t *netj, 00129 jack_client_t * client, 00130 const char *name, 00131 unsigned int capture_ports, 00132 unsigned int playback_ports, 00133 unsigned int capture_ports_midi, 00134 unsigned int playback_ports_midi, 00135 jack_nframes_t sample_rate, 00136 jack_nframes_t period_size, 00137 unsigned int listen_port, 00138 unsigned int transport_sync, 00139 unsigned int resample_factor, 00140 unsigned int resample_factor_up, 00141 unsigned int bitdepth, 00142 unsigned int use_autoconfig, 00143 unsigned int latency, 00144 unsigned int redundancy, 00145 int dont_htonl_floats, 00146 int always_deadline, 00147 int jitter_val ); 00148 00149 void netjack_release( netjack_driver_state_t *netj ); 00150 int netjack_startup( netjack_driver_state_t *netj ); 00151 00152 #ifdef __cplusplus 00153 } 00154 #endif 00155 00156 #endif