예제 #1
0
static void
cbjack_destroy(cubeb * context)
{
  context->active = false;

  if (context->jack_client != NULL)
    api_jack_client_close (context->jack_client);

  if (context->libjack)
    dlclose(context->libjack);

  free(context);
}
예제 #2
0
static int
cbjack_get_preferred_sample_rate(cubeb * ctx, uint32_t * rate)
{
  if (!ctx->jack_client) {
    jack_client_t * testclient = api_jack_client_open("test-samplerate",
                                                 JackNoStartServer,
                                                 NULL);
    if (!testclient) {
      return CUBEB_ERROR;
    }

    *rate = api_jack_get_sample_rate(testclient);
    api_jack_client_close(testclient);

  } else {
    *rate = api_jack_get_sample_rate(ctx->jack_client);
  }
  return CUBEB_OK;
}
예제 #3
0
static void
cbjack_destroy(cubeb * context)
{
  // stop thread if any
  if (context->stream_refill_thread) {
    context->active = false;
    pthread_join (context->stream_refill_thread, NULL);
  }

  if (context->jack_client)
    api_jack_client_close (context->jack_client);

  for (int s = 0; s < MAX_STREAMS; s++) {
    for (int c = 0; c < MAX_CHANNELS; c++) {
      if (context->streams[s].ringbuffer[c])
        api_jack_ringbuffer_free(context->streams[s].ringbuffer[c]);
    }
  }

  pthread_mutex_destroy(&context->mutex);
  free(context);
}