** Warning: Cannot open xref database.
1 #include <stdio.h>
2 #include <memory.h>
3 #include <jack/jack.h>
4
5 jack_port_t *input_port;
6 jack_port_t *output_port;
7
8 static int
9 process (jack_nframes_t nframes, void *arg)
10 {
11 jack_default_audio_sample_t *out = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port, nframes);
12 jack_default_audio_sample_t *in = (jack_default_audio_sample_t *) jack_port_get_buffer (input_port, nframes);
13
14 memcpy (out, in, sizeof (jack_default_audio_sample_t) * nframes);
15
16 return 0;
17 }
18
19 int
20 jack_initialize (jack_client_t *client, const char *data)
21 {
22 jack_set_process_callback (client, process, 0);
23
24 /* create two ports */
25
26 input_port = jack_port_register (client, "input", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
27 output_port = jack_port_register (client, "output", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
28
29 /* start the client */
30
31 jack_activate (client);
32
33 /* connect the ports */
34
35 if (jack_connect (client, "alsa_pcm:capture_1", jack_port_name (input_port))) {
36 fprintf (stderr, "cannot connect input port\n");
37 }
38
39 if (jack_connect (client, jack_port_name (output_port), "alsa_pcm:playback_1")) {
40 fprintf (stderr, "cannot connect output port\n");
41 }
42
43 /* our client is running. we're happy */
44
45 return 0;
46 }
47
48 void
49 jack_finish (void)
50 {
51 /* relax */
52 }
53
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.