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/jack.h>
28 #include <jack/transport.h>
29 #include "jack/jslist.h"
32 #include <celt/celt.h>
42 typedef struct _netjack_driver_state netjack_driver_state_t
;
44 struct _netjack_driver_state
{
45 jack_nframes_t net_period_up
;
46 jack_nframes_t net_period_down
;
48 jack_nframes_t sample_rate
;
49 jack_nframes_t bitdepth
;
50 jack_nframes_t period_size
;
51 jack_time_t period_usecs
;
52 int dont_htonl_floats
;
55 jack_nframes_t codec_latency
;
57 unsigned int listen_port
;
59 unsigned int capture_channels
;
60 unsigned int playback_channels
;
61 unsigned int capture_channels_audio
;
62 unsigned int playback_channels_audio
;
63 unsigned int capture_channels_midi
;
64 unsigned int playback_channels_midi
;
66 JSList
*capture_ports
;
67 JSList
*playback_ports
;
68 JSList
*playback_srcs
;
71 jack_client_t
*client
;
81 struct sockaddr_in syncsource_address
;
87 unsigned int handle_transport_sync
;
90 unsigned int rx_bufsize
;
91 //unsigned int tx_bufsize;
94 unsigned int redundancy
;
96 jack_nframes_t expected_framecnt
;
97 int expected_framecnt_valid
;
98 unsigned int num_lost_packets
;
99 jack_time_t next_deadline
;
100 jack_time_t deadline_offset
;
101 int next_deadline_valid
;
102 int packet_data_valid
;
103 int resync_threshold
;
105 int deadline_goodness
;
106 jack_time_t time_to_deadline
;
107 unsigned int use_autoconfig
;
108 unsigned int resample_factor
;
109 unsigned int resample_factor_up
;
111 struct _packet_cache
* packcache
;
117 int netjack_wait( netjack_driver_state_t
*netj
);
118 void netjack_send_silence( netjack_driver_state_t
*netj
, int syncstate
);
119 void netjack_read( netjack_driver_state_t
*netj
, jack_nframes_t nframes
) ;
120 void netjack_write( netjack_driver_state_t
*netj
, jack_nframes_t nframes
, int syncstate
);
121 void netjack_attach( netjack_driver_state_t
*netj
);
122 void netjack_detach( netjack_driver_state_t
*netj
);
124 netjack_driver_state_t
*netjack_init (netjack_driver_state_t
*netj
,
125 jack_client_t
* client
,
127 unsigned int capture_ports
,
128 unsigned int playback_ports
,
129 unsigned int capture_ports_midi
,
130 unsigned int playback_ports_midi
,
131 jack_nframes_t sample_rate
,
132 jack_nframes_t period_size
,
133 unsigned int listen_port
,
134 unsigned int transport_sync
,
135 unsigned int resample_factor
,
136 unsigned int resample_factor_up
,
137 unsigned int bitdepth
,
138 unsigned int use_autoconfig
,
139 unsigned int latency
,
140 unsigned int redundancy
,
141 int dont_htonl_floats
,
145 void netjack_release( netjack_driver_state_t
*netj
);
146 int netjack_startup( netjack_driver_state_t
*netj
);