4 Copyright (C) 2008 Marc-Olivier Barre <marco@marcochapeau.org>
5 Copyright (C) 2008 Pieter Palmers <pieterpalmers@users.sourceforge.net>
6 Copyright (C) 2006 Torben Hohn <torbenh@gmx.de>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 * @brief This client connects a remote slave JACK to a local JACK server assumed to be the master
37 #if defined(HAVE_CONFIG_H)
46 #include <netinet/in.h>
48 #include <sys/socket.h>
51 /* These two required by FreeBSD. */
52 #include <sys/types.h>
54 #include <jack/jack.h>
56 #include <netjack_packet.h>
58 #include <samplerate.h>
62 #include <celt/celt.h>
67 JSList
*capture_ports
= NULL
;
68 JSList
*capture_srcs
= NULL
;
69 int capture_channels
= 0;
70 int capture_channels_audio
= 2;
71 int capture_channels_midi
= 1;
72 JSList
*playback_ports
= NULL
;
73 JSList
*playback_srcs
= NULL
;
74 int playback_channels
= 0;
75 int playback_channels_audio
= 2;
76 int playback_channels_midi
= 1;
77 int dont_htonl_floats
= 0;
80 jack_nframes_t factor
= 1;
86 jack_client_t
*client
;
87 packet_cache
* packcache
= 0;
89 int state_connected
= 0;
90 int state_latency
= 0;
91 int state_netxruns
= 0;
92 int state_currentframe
= 0;
93 int state_recv_packet_queue_time
= 0;
101 struct sockaddr_in destaddr
;
102 struct sockaddr_in bindaddr
;
104 struct sockaddr destaddr
;
105 struct sockaddr bindaddr
;
109 jack_transport_state_t last_transport_state
;
115 int freewheeling
= 0;
118 * This Function allocates all the I/O Ports which are added the lists.
121 alloc_ports (int n_capture_audio
, int n_playback_audio
, int n_capture_midi
, int n_playback_midi
)
124 int port_flags
= JackPortIsOutput
;
129 capture_ports
= NULL
;
130 /* Allocate audio capture channels */
131 for (chn
= 0; chn
< n_capture_audio
; chn
++) {
132 snprintf (buf
, sizeof (buf
) - 1, "capture_%u", chn
+ 1);
133 port
= jack_port_register (client
, buf
, JACK_DEFAULT_AUDIO_TYPE
, port_flags
, 0);
135 printf( "jack_netsource: cannot register %s port\n", buf
);
138 if (bitdepth
== 1000) {
140 #if HAVE_CELT_API_0_11
141 CELTMode
*celt_mode
= celt_mode_create( jack_get_sample_rate( client
), jack_get_buffer_size(client
), NULL
);
142 capture_srcs
= jack_slist_append(capture_srcs
, celt_decoder_create_custom( celt_mode
, 1, NULL
) );
143 #elif HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8
144 CELTMode
*celt_mode
= celt_mode_create( jack_get_sample_rate( client
), jack_get_buffer_size(client
), NULL
);
145 capture_srcs
= jack_slist_append(capture_srcs
, celt_decoder_create( celt_mode
, 1, NULL
) );
147 CELTMode
*celt_mode
= celt_mode_create( jack_get_sample_rate( client
), 1, jack_get_buffer_size(client
), NULL
);
148 capture_srcs
= jack_slist_append(capture_srcs
, celt_decoder_create( celt_mode
) );
153 capture_srcs
= jack_slist_append (capture_srcs
, src_new (SRC_LINEAR
, 1, NULL
));
156 capture_ports
= jack_slist_append (capture_ports
, port
);
159 /* Allocate midi capture channels */
160 for (chn
= n_capture_audio
; chn
< n_capture_midi
+ n_capture_audio
; chn
++) {
161 snprintf (buf
, sizeof (buf
) - 1, "capture_%u", chn
+ 1);
162 port
= jack_port_register (client
, buf
, JACK_DEFAULT_MIDI_TYPE
, port_flags
, 0);
164 printf ("jack_netsource: cannot register %s port\n", buf
);
167 capture_ports
= jack_slist_append(capture_ports
, port
);
170 /* Allocate audio playback channels */
171 port_flags
= JackPortIsInput
;
172 playback_ports
= NULL
;
173 for (chn
= 0; chn
< n_playback_audio
; chn
++) {
174 snprintf (buf
, sizeof (buf
) - 1, "playback_%u", chn
+ 1);
175 port
= jack_port_register (client
, buf
, JACK_DEFAULT_AUDIO_TYPE
, port_flags
, 0);
177 printf ("jack_netsource: cannot register %s port\n", buf
);
180 if( bitdepth
== 1000 ) {
182 #if HAVE_CELT_API_0_11
183 CELTMode
*celt_mode
= celt_mode_create( jack_get_sample_rate (client
), jack_get_buffer_size(client
), NULL
);
184 playback_srcs
= jack_slist_append(playback_srcs
, celt_encoder_create_custom( celt_mode
, 1, NULL
) );
185 #elif HAVE_CELT_API_0_7 || HAVE_CELT_API_0_8
186 CELTMode
*celt_mode
= celt_mode_create( jack_get_sample_rate (client
), jack_get_buffer_size(client
), NULL
);
187 playback_srcs
= jack_slist_append(playback_srcs
, celt_encoder_create( celt_mode
, 1, NULL
) );
189 CELTMode
*celt_mode
= celt_mode_create( jack_get_sample_rate (client
), 1, jack_get_buffer_size(client
), NULL
);
190 playback_srcs
= jack_slist_append(playback_srcs
, celt_encoder_create( celt_mode
) );
195 playback_srcs
= jack_slist_append (playback_srcs
, src_new (SRC_LINEAR
, 1, NULL
));
198 playback_ports
= jack_slist_append (playback_ports
, port
);
201 /* Allocate midi playback channels */
202 for (chn
= n_playback_audio
; chn
< n_playback_midi
+ n_playback_audio
; chn
++) {
203 snprintf (buf
, sizeof (buf
) - 1, "playback_%u", chn
+ 1);
204 port
= jack_port_register (client
, buf
, JACK_DEFAULT_MIDI_TYPE
, port_flags
, 0);
206 printf ("jack_netsource: cannot register %s port\n", buf
);
209 playback_ports
= jack_slist_append (playback_ports
, port
);
214 * The Sync callback... sync state is set elsewhere...
215 * we will see if this is working correctly.
216 * i dont really believe in it yet.
219 sync_cb (jack_transport_state_t state
, jack_position_t
*pos
, void *arg
)
221 static int latency_count
= 0;
222 int retval
= sync_state
;
224 if (! state_connected
) {
232 else if (state
== JackTransportStarting
&& last_transport_state
!= JackTransportStarting
) {
234 latency_count
= latency
- 1;
237 last_transport_state
= state
;
242 freewheel_cb (int starting
, void *arg
)
244 freewheeling
= starting
;
247 int deadline_goodness
= 0;
249 * The process callback for this JACK application.
250 * It is called by JACK at the appropriate times.
253 process (jack_nframes_t nframes
, void *arg
)
255 jack_nframes_t net_period
;
256 int rx_bufsize
, tx_bufsize
;
258 jack_default_audio_sample_t
*buf
;
263 const char *porttype
;
266 jack_position_t local_trans_pos
;
268 uint32_t *packet_buf_tx
, *packet_bufX
;
269 uint32_t *rx_packet_ptr
;
270 jack_time_t packet_recv_timestamp
;
272 if( bitdepth
== 1000 )
273 net_period
= (factor
* jack_get_buffer_size(client
) * 1024 / jack_get_sample_rate(client
) / 8) & (~1) ;
275 net_period
= (float) nframes
/ (float) factor
;
277 rx_bufsize
= get_sample_size (bitdepth
) * capture_channels
* net_period
+ sizeof (jacknet_packet_header
);
278 tx_bufsize
= get_sample_size (bitdepth
) * playback_channels
* net_period
+ sizeof (jacknet_packet_header
);
280 /* Allocate a buffer where both In and Out Buffer will fit */
281 packet_buf_tx
= alloca (tx_bufsize
);
283 jacknet_packet_header
*pkthdr_tx
= (jacknet_packet_header
*) packet_buf_tx
;
286 * for latency==0 we need to send out the packet before we wait on the reply.
287 * but this introduces a cycle of latency, when netsource is connected to itself.
288 * so we send out before read only in zero latency mode.
293 /* reset packet_bufX... */
294 packet_bufX
= packet_buf_tx
+ sizeof (jacknet_packet_header
) / sizeof (jack_default_audio_sample_t
);
296 /* ---------- Send ---------- */
297 render_jack_ports_to_payload (bitdepth
, playback_ports
, playback_srcs
, nframes
,
298 packet_bufX
, net_period
, dont_htonl_floats
);
300 /* fill in packet hdr */
301 pkthdr_tx
->transport_state
= jack_transport_query (client
, &local_trans_pos
);
302 pkthdr_tx
->transport_frame
= local_trans_pos
.frame
;
303 pkthdr_tx
->framecnt
= framecnt
;
304 pkthdr_tx
->latency
= latency
;
305 pkthdr_tx
->reply_port
= reply_port
;
306 pkthdr_tx
->sample_rate
= jack_get_sample_rate (client
);
307 pkthdr_tx
->period_size
= nframes
;
309 /* playback for us is capture on the other side */
310 pkthdr_tx
->capture_channels_audio
= playback_channels_audio
;
311 pkthdr_tx
->playback_channels_audio
= capture_channels_audio
;
312 pkthdr_tx
->capture_channels_midi
= playback_channels_midi
;
313 pkthdr_tx
->playback_channels_midi
= capture_channels_midi
;
314 pkthdr_tx
->mtu
= mtu
;
315 if( freewheeling
!= 0 )
316 pkthdr_tx
->sync_state
= (jack_nframes_t
)MASTER_FREEWHEELS
;
318 pkthdr_tx
->sync_state
= (jack_nframes_t
)deadline_goodness
;
319 //printf("goodness=%d\n", deadline_goodness );
321 packet_header_hton (pkthdr_tx
);
322 if (cont_miss
< 3 * latency
+ 5) {
324 for( r
= 0; r
< redundancy
; r
++ )
325 netjack_sendto (outsockfd
, (char *) packet_buf_tx
, tx_bufsize
, 0, &destaddr
, sizeof (destaddr
), mtu
);
326 } else if (cont_miss
> 50 + 5 * latency
) {
328 packet_cache_reset_master_address( packcache
);
329 //printf ("Frame %d \tRealy too many packets missed (%d). Let's reset the counter\n", framecnt, cont_miss);
335 * ok... now the RECEIVE code.
343 input_fd
= outsockfd
;
345 // for latency == 0 we can poll.
346 if( (latency
== 0) || (freewheeling
!= 0) ) {
347 jack_time_t deadline
= jack_get_time() + 1000000 * jack_get_buffer_size(client
) / jack_get_sample_rate(client
);
348 // Now loop until we get the right packet.
350 jack_nframes_t got_frame
;
351 if ( ! netjack_poll_deadline( input_fd
, deadline
) )
354 packet_cache_drain_socket(packcache
, input_fd
);
356 if (packet_cache_get_next_available_framecnt( packcache
, framecnt
- latency
, &got_frame
))
357 if( got_frame
== (framecnt
- latency
) )
362 // only drain socket.
363 packet_cache_drain_socket(packcache
, input_fd
);
366 size
= packet_cache_retreive_packet_pointer( packcache
, framecnt
- latency
, (char**)&rx_packet_ptr
, rx_bufsize
, &packet_recv_timestamp
);
367 /* First alternative : we received what we expected. Render the data
368 * to the JACK ports so it can be played. */
369 if (size
== rx_bufsize
) {
370 uint32_t *packet_buf_rx
= rx_packet_ptr
;
371 jacknet_packet_header
*pkthdr_rx
= (jacknet_packet_header
*) packet_buf_rx
;
372 packet_bufX
= packet_buf_rx
+ sizeof (jacknet_packet_header
) / sizeof (jack_default_audio_sample_t
);
373 // calculate how much time there would have been, if this packet was sent at the deadline.
375 int recv_time_offset
= (int) (jack_get_time() - packet_recv_timestamp
);
376 packet_header_ntoh (pkthdr_rx
);
377 deadline_goodness
= recv_time_offset
- (int)pkthdr_rx
->latency
;
378 //printf( "deadline goodness = %d ---> off: %d\n", deadline_goodness, recv_time_offset );
381 //printf("Frame %d \tRecovered from dropouts\n", framecnt);
384 render_payload_to_jack_ports (bitdepth
, packet_bufX
, net_period
,
385 capture_ports
, capture_srcs
, nframes
, dont_htonl_floats
);
387 state_currentframe
= framecnt
;
388 state_recv_packet_queue_time
= recv_time_offset
;
390 sync_state
= pkthdr_rx
->sync_state
;
391 packet_cache_release_packet( packcache
, framecnt
- latency
);
393 /* Second alternative : we've received something that's not
394 * as big as expected or we missed a packet. We render silence
395 * to the ouput ports */
397 jack_nframes_t latency_estimate
;
398 if( packet_cache_find_latency( packcache
, framecnt
, &latency_estimate
) )
399 //if( (state_latency == 0) || (latency_estimate < state_latency) )
400 state_latency
= latency_estimate
;
402 // Set the counters up.
403 state_currentframe
= framecnt
;
404 //state_latency = framecnt - pkthdr->framecnt;
407 //printf ("Frame %d \tPacket missed or incomplete (expected: %d bytes, got: %d bytes)\n", framecnt, rx_bufsize, size);
408 //printf ("Frame %d \tPacket missed or incomplete\n", framecnt);
411 node
= capture_ports
;
412 while (node
!= NULL
) {
413 port
= (jack_port_t
*) node
->data
;
414 buf
= jack_port_get_buffer (port
, nframes
);
415 porttype
= jack_port_type (port
);
416 if (strncmp (porttype
, JACK_DEFAULT_AUDIO_TYPE
, jack_port_type_size ()) == 0)
417 for (i
= 0; i
< nframes
; i
++)
419 else if (strncmp (porttype
, JACK_DEFAULT_MIDI_TYPE
, jack_port_type_size ()) == 0)
420 jack_midi_clear_buffer (buf
);
421 node
= jack_slist_next (node
);
426 /* reset packet_bufX... */
427 packet_bufX
= packet_buf_tx
+ sizeof (jacknet_packet_header
) / sizeof (jack_default_audio_sample_t
);
429 /* ---------- Send ---------- */
430 render_jack_ports_to_payload (bitdepth
, playback_ports
, playback_srcs
, nframes
,
431 packet_bufX
, net_period
, dont_htonl_floats
);
433 /* fill in packet hdr */
434 pkthdr_tx
->transport_state
= jack_transport_query (client
, &local_trans_pos
);
435 pkthdr_tx
->transport_frame
= local_trans_pos
.frame
;
436 pkthdr_tx
->framecnt
= framecnt
;
437 pkthdr_tx
->latency
= latency
;
438 pkthdr_tx
->reply_port
= reply_port
;
439 pkthdr_tx
->sample_rate
= jack_get_sample_rate (client
);
440 pkthdr_tx
->period_size
= nframes
;
442 /* playback for us is capture on the other side */
443 pkthdr_tx
->capture_channels_audio
= playback_channels_audio
;
444 pkthdr_tx
->playback_channels_audio
= capture_channels_audio
;
445 pkthdr_tx
->capture_channels_midi
= playback_channels_midi
;
446 pkthdr_tx
->playback_channels_midi
= capture_channels_midi
;
447 pkthdr_tx
->mtu
= mtu
;
448 if( freewheeling
!= 0 )
449 pkthdr_tx
->sync_state
= (jack_nframes_t
)MASTER_FREEWHEELS
;
451 pkthdr_tx
->sync_state
= (jack_nframes_t
)deadline_goodness
;
452 //printf("goodness=%d\n", deadline_goodness );
454 packet_header_hton (pkthdr_tx
);
455 if (cont_miss
< 3 * latency
+ 5) {
457 for( r
= 0; r
< redundancy
; r
++ )
458 netjack_sendto (outsockfd
, (char *) packet_buf_tx
, tx_bufsize
, 0, &destaddr
, sizeof (destaddr
), mtu
);
459 } else if (cont_miss
> 50 + 5 * latency
) {
461 packet_cache_reset_master_address( packcache
);
462 //printf ("Frame %d \tRealy too many packets missed (%d). Let's reset the counter\n", framecnt, cont_miss);
472 * This is the shutdown callback for this JACK application.
473 * It is called by JACK if the server ever shuts down or
474 * decides to disconnect the client.
478 jack_shutdown (void *arg
)
480 fprintf(stderr
, "JACK shut down, exiting ...\n");
485 init_sockaddr_in (struct sockaddr_in
*name
, const char *hostname
, uint16_t port
)
487 name
->sin_family
= AF_INET
;
488 name
->sin_port
= htons (port
);
490 struct hostent
*hostinfo
= gethostbyname (hostname
);
491 if (hostinfo
== NULL
) {
492 fprintf (stderr
, "init_sockaddr_in: unknown host: %s.\n", hostname
);
496 name
->sin_addr
.s_addr
= inet_addr( hostname
);
498 name
->sin_addr
= *(struct in_addr
*) hostinfo
->h_addr
;
501 name
->sin_addr
.s_addr
= htonl (INADDR_ANY
) ;
508 fprintf (stderr
, "usage: jack_netsource [options]\n"
510 " -h this help text\n"
511 " -H <slave host> - Host name of the slave JACK\n"
512 " -o <num channels> - Number of audio playback channels\n"
513 " -i <num channels> - Number of audio capture channels\n"
514 " -O <num channels> - Number of midi playback channels\n"
515 " -I <num channels> - Number of midi capture channels\n"
516 " -n <periods> - Network latency in JACK periods\n"
517 " -p <port> - UDP port that the slave is listening on\n"
518 " -r <reply port> - UDP port that we are listening on\n"
519 " -B <bind port> - reply port, for use in NAT environments\n"
520 " -b <bitdepth> - Set transport to use 16bit or 8bit\n"
521 " -c <kbits> - Use CELT encoding with <kbits> kbits per channel\n"
522 " -m <mtu> - Assume this mtu for the link\n"
523 " -R <N> - Redundancy: send out packets N times.\n"
524 " -e - skip host-to-network endianness conversion\n"
525 " -N <jack name> - Reports a different name to jack\n"
526 " -s <server name> - The name of the local jack server\n"
531 sigterm_handler( int signal
)
537 main (int argc
, char *argv
[])
539 /* Some startup related basics */
540 char *client_name
, *server_name
= NULL
, *peer_ip
;
541 int peer_port
= 3000;
542 jack_options_t options
= JackNullOption
;
543 jack_status_t status
;
546 int rc
= WSAStartup(MAKEWORD(2, 0), &wsa
);
548 /* Torben's famous state variables, aka "the reporting API" ! */
549 /* heh ? these are only the copies of them ;) */
550 int statecopy_connected
, statecopy_latency
, statecopy_netxruns
;
551 jack_nframes_t net_period
;
552 /* Argument parsing stuff */
554 extern int optind
, optopt
;
562 client_name
= (char *) malloc (sizeof (char) * 10);
563 peer_ip
= (char *) malloc (sizeof (char) * 10);
564 sprintf(client_name
, "netjack");
565 sprintf(peer_ip
, "localhost");
567 while ((c
= getopt (argc
, argv
, ":h:H:o:i:O:I:n:p:r:B:b:c:m:R:e:N:s:")) != -1) {
575 peer_ip
= (char *) malloc (sizeof (char) * strlen (optarg
) + 1);
576 strcpy (peer_ip
, optarg
);
579 playback_channels_audio
= atoi (optarg
);
582 capture_channels_audio
= atoi (optarg
);
585 playback_channels_midi
= atoi (optarg
);
588 capture_channels_midi
= atoi (optarg
);
591 latency
= atoi (optarg
);
594 peer_port
= atoi (optarg
);
597 reply_port
= atoi (optarg
);
600 bind_port
= atoi (optarg
);
603 factor
= atoi (optarg
);
604 printf("This feature is deprecated and will be removed in future netjack versions. CELT offers a superiour way to conserve bandwidth");
607 bitdepth
= atoi (optarg
);
612 factor
= atoi (optarg
);
614 printf( "not built with celt support\n" );
622 redundancy
= atoi (optarg
);
625 dont_htonl_floats
= 1;
629 client_name
= (char *) malloc (sizeof (char) * strlen (optarg
) + 1);
630 strcpy (client_name
, optarg
);
633 server_name
= (char *) malloc (sizeof (char) * strlen (optarg
) + 1);
634 strcpy (server_name
, optarg
);
635 options
|= JackServerName
;
638 fprintf (stderr
, "Option -%c requires an operand\n", optopt
);
642 fprintf (stderr
, "Unrecognized option: -%c\n", optopt
);
651 capture_channels
= capture_channels_audio
+ capture_channels_midi
;
652 playback_channels
= playback_channels_audio
+ playback_channels_midi
;
654 outsockfd
= socket (AF_INET
, SOCK_DGRAM
, 0);
655 insockfd
= socket (AF_INET
, SOCK_DGRAM
, 0);
657 if ((outsockfd
== -1) || (insockfd
== -1)) {
658 fprintf (stderr
, "cant open sockets\n" );
662 init_sockaddr_in ((struct sockaddr_in
*) &destaddr
, peer_ip
, peer_port
);
664 init_sockaddr_in ((struct sockaddr_in
*) &bindaddr
, NULL
, bind_port
);
665 if( bind (outsockfd
, &bindaddr
, sizeof (bindaddr
)) ) {
666 fprintf (stderr
, "bind failure\n" );
670 init_sockaddr_in ((struct sockaddr_in
*) &bindaddr
, NULL
, reply_port
);
671 if( bind (insockfd
, &bindaddr
, sizeof (bindaddr
)) ) {
672 fprintf (stderr
, "bind failure\n" );
676 /* try to become a client of the JACK server */
677 client
= jack_client_open (client_name
, options
, &status
, server_name
);
678 if (client
== NULL
) {
679 fprintf (stderr
, "jack_client_open() failed, status = 0x%2.0x\n"
680 "Is the JACK server running ?\n", status
);
684 /* Set up jack callbacks */
685 jack_set_process_callback (client
, process
, 0);
686 jack_set_sync_callback (client
, sync_cb
, 0);
687 jack_set_freewheel_callback (client
, freewheel_cb
, 0);
688 jack_on_shutdown (client
, jack_shutdown
, 0);
690 alloc_ports (capture_channels_audio
, playback_channels_audio
, capture_channels_midi
, playback_channels_midi
);
692 if( bitdepth
== 1000 )
693 net_period
= (factor
* jack_get_buffer_size(client
) * 1024 / jack_get_sample_rate(client
) / 8) & (~1) ;
695 net_period
= ceilf((float) jack_get_buffer_size (client
) / (float) factor
);
697 int rx_bufsize
= get_sample_size (bitdepth
) * capture_channels
* net_period
+ sizeof (jacknet_packet_header
);
698 packcache
= packet_cache_new (latency
+ 50, rx_bufsize
, mtu
);
700 /* tell the JACK server that we are ready to roll */
701 if (jack_activate (client
)) {
702 fprintf (stderr
, "Cannot activate client");
706 /* Now sleep forever... and evaluate the state_ vars */
708 signal( SIGTERM
, sigterm_handler
);
709 signal( SIGINT
, sigterm_handler
);
711 statecopy_connected
= 2; // make it report unconnected on start.
712 statecopy_latency
= state_latency
;
713 statecopy_netxruns
= state_netxruns
;
721 if (statecopy_connected
!= state_connected
) {
722 statecopy_connected
= state_connected
;
723 if (statecopy_connected
) {
724 state_netxruns
= 1; // We want to reset the netxrun count on each new connection
725 printf ("Connected :-)\n");
727 printf ("Not Connected\n");
732 if (statecopy_connected
) {
733 if (statecopy_netxruns
!= state_netxruns
) {
734 statecopy_netxruns
= state_netxruns
;
735 printf ("%s: at frame %06d -> total netxruns %d (%d%%) queue time= %d\n",
739 100 * statecopy_netxruns
/ state_currentframe
,
740 state_recv_packet_queue_time
);
745 if (statecopy_latency
!= state_latency
) {
746 statecopy_latency
= state_latency
;
747 if (statecopy_latency
> 1)
748 printf ("current latency %d\n", statecopy_latency
);
754 jack_client_close (client
);
755 packet_cache_free (packcache
);