Browse Source

Correct jack_thru and jack_simple_client.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2763 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
sletz 17 years ago
parent
commit
fd1321f576
3 changed files with 6 additions and 39 deletions
  1. +4
    -29
      example-clients/simple_client.c
  2. +1
    -9
      example-clients/thru_client.c
  3. +1
    -1
      example-clients/wscript

+ 4
- 29
example-clients/simple_client.c View File

@@ -15,7 +15,6 @@
#endif #endif
#include <jack/jack.h> #include <jack/jack.h>


jack_port_t *input_port;
jack_port_t *output_port1, *output_port2; jack_port_t *output_port1, *output_port2;
jack_client_t *client; jack_client_t *client;


@@ -39,13 +38,6 @@ static void signal_handler(int sig)
exit(0); 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 * The process callback for this JACK application is called in a
* special realtime thread once for each audio cycle. * special realtime thread once for each audio cycle.
@@ -57,11 +49,10 @@ volatile enum {
int int
process (jack_nframes_t nframes, void *arg) 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; paTestData *data = (paTestData*)arg;
int i; int i;


in = jack_port_get_buffer (input_port, nframes);
out1 = jack_port_get_buffer (output_port1, nframes); out1 = jack_port_get_buffer (output_port1, nframes);
out2 = jack_port_get_buffer (output_port2, nframes); out2 = jack_port_get_buffer (output_port2, nframes);


@@ -155,9 +146,6 @@ main (int argc, char *argv[])


/* create two ports */ /* create two ports */


input_port = jack_port_register (client, "input",
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsInput, 0);
output_port1 = jack_port_register (client, "output1", output_port1 = jack_port_register (client, "output1",
JACK_DEFAULT_AUDIO_TYPE, JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0); JackPortIsOutput, 0);
@@ -166,7 +154,7 @@ main (int argc, char *argv[])
JACK_DEFAULT_AUDIO_TYPE, JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0); 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"); fprintf(stderr, "no more JACK ports available\n");
exit (1); exit (1);
} }
@@ -186,20 +174,7 @@ main (int argc, char *argv[])
* "input" to the backend, and capture ports are "output" from * "input" to the backend, and capture ports are "output" from
* it. * 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, ports = jack_get_ports (client, NULL, NULL,
JackPortIsPhysical|JackPortIsInput); JackPortIsPhysical|JackPortIsInput);
if (ports == NULL) { if (ports == NULL) {
@@ -231,7 +206,7 @@ main (int argc, char *argv[])


/* keep running until the transport stops */ /* keep running until the transport stops */


while (client_state != Exit) {
while (1) {
#ifdef WIN32 #ifdef WIN32
Sleep(1000); Sleep(1000);
#else #else


example-clients/through_client.c → example-clients/thru_client.c View File

@@ -26,14 +26,6 @@ static void signal_handler ( int sig )
exit ( 0 ); 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 * The process callback for this JACK application is called in a
* special realtime thread once for each audio cycle. * special realtime thread once for each audio cycle.
@@ -208,7 +200,7 @@ main ( int argc, char *argv[] )


/* keep running until the transport stops */ /* keep running until the transport stops */


while ( client_state != Exit )
while (1)
{ {
#ifdef WIN32 #ifdef WIN32
Sleep ( 1000 ); Sleep ( 1000 );

+ 1
- 1
example-clients/wscript View File

@@ -18,7 +18,7 @@ example_programs = {
'jack_bufsize' : 'bufsize.c', 'jack_bufsize' : 'bufsize.c',
'jack_evmon' : 'evmon.c', 'jack_evmon' : 'evmon.c',
'jack_monitor_client' : 'monitor_client.c', 'jack_monitor_client' : 'monitor_client.c',
'jack_through' : 'through_client.c',
'jack_thru' : 'thru_client.c',
} }


example_libs = { example_libs = {


Loading…
Cancel
Save