Ejemplo n.º 1
0
static void
cbjack_connect_ports (cubeb_stream * stream)
{
  const char ** phys_in_ports = api_jack_get_ports (stream->context->jack_client,
                                                   NULL, NULL,
                                                   JackPortIsInput
                                                   | JackPortIsPhysical);
  const char ** phys_out_ports = api_jack_get_ports (stream->context->jack_client,
                                                    NULL, NULL,
                                                    JackPortIsOutput
                                                    | JackPortIsPhysical);

 if (*phys_in_ports == NULL) {
    goto skipplayback;
  }

  // Connect outputs to playback
  for (unsigned int c = 0; c < stream->out_params.channels && phys_in_ports[c] != NULL; c++) {
    const char *src_port = api_jack_port_name (stream->output_ports[c]);

    api_jack_connect (stream->context->jack_client, src_port, phys_in_ports[c]);
  }

skipplayback:
  if (*phys_out_ports == NULL) {
    goto end;
  }
  // Connect inputs to capture
  for (unsigned int c = 0; c < stream->in_params.channels && phys_out_ports[c] != NULL; c++) {
    const char *src_port = api_jack_port_name (stream->input_ports[c]);

    api_jack_connect (stream->context->jack_client, phys_out_ports[c], src_port);
  }
end:
  api_jack_free(phys_out_ports);
  api_jack_free(phys_in_ports);
}
Ejemplo n.º 2
0
static void
cbjack_connect_ports (cubeb_stream * stream)
{
  const char **physical_ports = api_jack_get_ports (stream->context->jack_client,
                                                    NULL, NULL, JackPortIsInput | JackPortIsPhysical);
  if (physical_ports == NULL) {
    return;
  }

  // Connect to all physical ports
  for (unsigned int c = 0; c < stream->params.channels && physical_ports[c]; c++) {
    const char *src_port = api_jack_port_name (stream->output_ports[c]);

    api_jack_connect (stream->context->jack_client, src_port, physical_ports[c]);
  }
  api_jack_free(physical_ports);
}