From fd1321f576f71c939af64e62d006d6f7e241bddc Mon Sep 17 00:00:00 2001 From: sletz Date: Fri, 1 Aug 2008 16:56:05 +0000 Subject: [PATCH] Correct jack_thru and jack_simple_client. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2763 0c269be4-1314-0410-8aa9-9f06e86f4224 --- example-clients/simple_client.c | 33 +++---------------- .../{through_client.c => thru_client.c} | 10 +----- example-clients/wscript | 2 +- 3 files changed, 6 insertions(+), 39 deletions(-) rename example-clients/{through_client.c => thru_client.c} (97%) diff --git a/example-clients/simple_client.c b/example-clients/simple_client.c index 35a17584..d417a559 100644 --- a/example-clients/simple_client.c +++ b/example-clients/simple_client.c @@ -15,7 +15,6 @@ #endif #include -jack_port_t *input_port; jack_port_t *output_port1, *output_port2; jack_client_t *client; @@ -39,13 +38,6 @@ static void signal_handler(int sig) exit(0); } -/* a simple state machine for this client */ -volatile enum { - Init, - Run, - Exit -} client_state = Init; - /** * The process callback for this JACK application is called in a * special realtime thread once for each audio cycle. @@ -57,11 +49,10 @@ volatile enum { int process (jack_nframes_t nframes, void *arg) { - jack_default_audio_sample_t *in, *out1, *out2; + jack_default_audio_sample_t *out1, *out2; paTestData *data = (paTestData*)arg; int i; - in = jack_port_get_buffer (input_port, nframes); out1 = jack_port_get_buffer (output_port1, nframes); out2 = jack_port_get_buffer (output_port2, nframes); @@ -155,9 +146,6 @@ main (int argc, char *argv[]) /* create two ports */ - input_port = jack_port_register (client, "input", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsInput, 0); output_port1 = jack_port_register (client, "output1", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); @@ -166,7 +154,7 @@ main (int argc, char *argv[]) JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); - if ((input_port == NULL) || (output_port1 == NULL) || (output_port2 == NULL)) { + if ((output_port1 == NULL) || (output_port2 == NULL)) { fprintf(stderr, "no more JACK ports available\n"); exit (1); } @@ -186,20 +174,7 @@ main (int argc, char *argv[]) * "input" to the backend, and capture ports are "output" from * it. */ - - ports = jack_get_ports (client, NULL, NULL, - JackPortIsPhysical|JackPortIsOutput); - if (ports == NULL) { - fprintf(stderr, "no physical capture ports\n"); - exit (1); - } - - if (jack_connect (client, ports[0], jack_port_name (input_port))) { - fprintf (stderr, "cannot connect input ports\n"); - } - - free (ports); - + ports = jack_get_ports (client, NULL, NULL, JackPortIsPhysical|JackPortIsInput); if (ports == NULL) { @@ -231,7 +206,7 @@ main (int argc, char *argv[]) /* keep running until the transport stops */ - while (client_state != Exit) { + while (1) { #ifdef WIN32 Sleep(1000); #else diff --git a/example-clients/through_client.c b/example-clients/thru_client.c similarity index 97% rename from example-clients/through_client.c rename to example-clients/thru_client.c index b58a97b8..2f46d088 100644 --- a/example-clients/through_client.c +++ b/example-clients/thru_client.c @@ -26,14 +26,6 @@ static void signal_handler ( int sig ) exit ( 0 ); } -/* a simple state machine for this client */ -volatile enum -{ - Init, - Run, - Exit -} client_state = Init; - /** * The process callback for this JACK application is called in a * special realtime thread once for each audio cycle. @@ -208,7 +200,7 @@ main ( int argc, char *argv[] ) /* keep running until the transport stops */ - while ( client_state != Exit ) + while (1) { #ifdef WIN32 Sleep ( 1000 ); diff --git a/example-clients/wscript b/example-clients/wscript index 9e6d5f6a..9b648c95 100644 --- a/example-clients/wscript +++ b/example-clients/wscript @@ -18,7 +18,7 @@ example_programs = { 'jack_bufsize' : 'bufsize.c', 'jack_evmon' : 'evmon.c', 'jack_monitor_client' : 'monitor_client.c', - 'jack_through' : 'through_client.c', + 'jack_thru' : 'thru_client.c', } example_libs = {