3 Copyright (C) 2003 Robert Ham <rah@bash.sh>
4 Copyright (C) 2005 Torben Hohn <torbenh@gmx.de>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <jack/types.h>
27 //#include <jack/driver.h>
28 #include <jack/jack.h>
29 #include <jack/transport.h>
31 #include "jack/jslist.h"
33 //#include <netinet/in.h>
40 typedef struct _netjack_driver_state netjack_driver_state_t
;
42 struct _netjack_driver_state
{
43 jack_nframes_t net_period_up
;
44 jack_nframes_t net_period_down
;
46 jack_nframes_t sample_rate
;
47 jack_nframes_t bitdepth
;
48 jack_nframes_t period_size
;
49 jack_time_t period_usecs
;
50 int dont_htonl_floats
;
53 jack_nframes_t codec_latency
;
55 unsigned int listen_port
;
57 unsigned int capture_channels
;
58 unsigned int playback_channels
;
59 unsigned int capture_channels_audio
;
60 unsigned int playback_channels_audio
;
61 unsigned int capture_channels_midi
;
62 unsigned int playback_channels_midi
;
64 JSList
*capture_ports
;
65 JSList
*playback_ports
;
66 JSList
*playback_srcs
;
69 jack_client_t
*client
;
79 struct sockaddr_in syncsource_address
;
85 unsigned int handle_transport_sync
;
88 unsigned int *pkt_buf
;
89 unsigned int rx_bufsize
;
90 //unsigned int tx_bufsize;
93 unsigned int redundancy
;
95 jack_nframes_t expected_framecnt
;
96 int expected_framecnt_valid
;
97 unsigned int num_lost_packets
;
98 jack_time_t next_deadline
;
99 jack_time_t deadline_offset
;
100 int next_deadline_valid
;
101 int packet_data_valid
;
102 int resync_threshold
;
104 int deadline_goodness
;
105 jack_time_t time_to_deadline
;
106 unsigned int use_autoconfig
;
107 unsigned int resample_factor
;
108 unsigned int resample_factor_up
;
112 int netjack_wait( netjack_driver_state_t
*netj
);
113 void netjack_send_silence( netjack_driver_state_t
*netj
, int syncstate
);
114 void netjack_read( netjack_driver_state_t
*netj
, jack_nframes_t nframes
) ;
115 void netjack_write( netjack_driver_state_t
*netj
, jack_nframes_t nframes
, int syncstate
);
116 void netjack_attach( netjack_driver_state_t
*netj
);
117 void netjack_detach( netjack_driver_state_t
*netj
);
119 netjack_driver_state_t
*netjack_init (netjack_driver_state_t
*netj
,
120 jack_client_t
* client
,
122 unsigned int capture_ports
,
123 unsigned int playback_ports
,
124 unsigned int capture_ports_midi
,
125 unsigned int playback_ports_midi
,
126 jack_nframes_t sample_rate
,
127 jack_nframes_t period_size
,
128 unsigned int listen_port
,
129 unsigned int transport_sync
,
130 unsigned int resample_factor
,
131 unsigned int resample_factor_up
,
132 unsigned int bitdepth
,
133 unsigned int use_autoconfig
,
134 unsigned int latency
,
135 unsigned int redundancy
,
136 int dont_htonl_floats
,
140 void netjack_release( netjack_driver_state_t
*netj
);
141 int netjack_startup( netjack_driver_state_t
*netj
);