Browse Source

Implement more libjack stubs, catia now loads inside carla

tags/v1.9.9
falkTX 7 years ago
parent
commit
f3fbb37b1e
6 changed files with 72 additions and 22 deletions
  1. +6
    -1
      source/libjack/libjack_base.cpp
  2. +3
    -1
      source/libjack/libjack_client.cpp
  3. +31
    -8
      source/libjack/libjack_latency.cpp
  4. +7
    -5
      source/libjack/libjack_ports.cpp
  5. +15
    -4
      source/libjack/libjack_server-control.cpp
  6. +10
    -3
      source/libjack/libjack_time.cpp

+ 6
- 1
source/libjack/libjack_base.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla JACK API for external applications * Carla JACK API for external applications
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2016-2018 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -24,6 +24,8 @@ CARLA_BACKEND_USE_NAMESPACE
CARLA_EXPORT CARLA_EXPORT
void jack_get_version(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto_ptr) void jack_get_version(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto_ptr)
{ {
carla_debug("%s(%p, %p, %p, %p)", __FUNCTION__, major_ptr, minor_ptr, micro_ptr, proto_ptr);

*major_ptr = 1; *major_ptr = 1;
*minor_ptr = 9; *minor_ptr = 9;
*micro_ptr = 12; *micro_ptr = 12;
@@ -33,6 +35,8 @@ void jack_get_version(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto
CARLA_EXPORT CARLA_EXPORT
const char* jack_get_version_string(void) const char* jack_get_version_string(void)
{ {
carla_debug("%s()", __FUNCTION__);

static const char* const kVersionStr = "1.9.12"; static const char* const kVersionStr = "1.9.12";
return kVersionStr; return kVersionStr;
} }
@@ -55,6 +59,7 @@ CARLA_EXPORT
void jack_free(void* ptr) void jack_free(void* ptr)
{ {
carla_debug("%s(%p)", __FUNCTION__, ptr); carla_debug("%s(%p)", __FUNCTION__, ptr);

free(ptr); free(ptr);
} }




+ 3
- 1
source/libjack/libjack_client.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla JACK API for external applications * Carla JACK API for external applications
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2016-2018 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -24,6 +24,8 @@ CARLA_BACKEND_USE_NAMESPACE
CARLA_EXPORT CARLA_EXPORT
int jack_client_name_size(void) int jack_client_name_size(void)
{ {
carla_debug("%s()", __FUNCTION__);

return STR_MAX; return STR_MAX;
} }




+ 31
- 8
source/libjack/libjack_latency.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla JACK API for external applications * Carla JACK API for external applications
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2016-2018 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -29,17 +29,24 @@ int jack_set_latency_callback(jack_client_t* client, JackLatencyCallback callbac


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------


//void jack_port_set_latency (jack_port_t *port, jack_nframes_t) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;

// --------------------------------------------------------------------------------------------------------------------

CARLA_EXPORT CARLA_EXPORT
void jack_port_get_latency_range(jack_port_t*, jack_latency_callback_mode_t, jack_latency_range_t* range)
void jack_port_get_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range)
{ {
carla_debug("%s(%p, %u, %p)", __FUNCTION__, port, mode, range);

range->min = range->max = 0; range->min = range->max = 0;
return;

// unused
(void)port;
(void)mode;
} }


//void jack_port_set_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) JACK_WEAK_EXPORT;
CARLA_EXPORT
void jack_port_set_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range)
{
carla_stderr2("%s(%p, %u, %p)", __FUNCTION__, port, mode, range);
}


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------


@@ -53,6 +60,8 @@ int jack_recompute_total_latencies(jack_client_t* client)
CARLA_EXPORT CARLA_EXPORT
jack_nframes_t jack_port_get_latency(jack_port_t* port) jack_nframes_t jack_port_get_latency(jack_port_t* port)
{ {
carla_debug("%s(%p)", __FUNCTION__, port);

JackPortState* const jport = (JackPortState*)port; JackPortState* const jport = (JackPortState*)port;
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(jport != nullptr, 0);


@@ -74,6 +83,8 @@ jack_nframes_t jack_port_get_latency(jack_port_t* port)
CARLA_EXPORT CARLA_EXPORT
jack_nframes_t jack_port_get_total_latency(jack_client_t* client, jack_port_t* port) jack_nframes_t jack_port_get_total_latency(jack_client_t* client, jack_port_t* port)
{ {
carla_debug("%s(%p, %p)", __FUNCTION__, client, port);

JackClientState* const jclient = (JackClientState*)client; JackClientState* const jclient = (JackClientState*)client;
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1);


@@ -106,7 +117,19 @@ jack_nframes_t jack_port_get_total_latency(jack_client_t* client, jack_port_t* p
} }


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
// deprecated calls

CARLA_EXPORT
void jack_port_set_latency(jack_port_t* port, jack_nframes_t nframes)
{
carla_stderr2("%s(%p, %u)", __FUNCTION__, port, nframes);
}


//int jack_recompute_total_latency (jack_client_t*, jack_port_t* port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
CARLA_EXPORT
int jack_recompute_total_latency(jack_client_t* client, jack_port_t* port)
{
carla_stderr2("%s(%p, %p)", __FUNCTION__, client, port);
return 0;
}


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------

+ 7
- 5
source/libjack/libjack_ports.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla JACK API for external applications * Carla JACK API for external applications
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2016-2018 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -277,7 +277,7 @@ int jack_port_connected_to(const jack_port_t* port, const char* port_name)
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------


CARLA_EXPORT CARLA_EXPORT
const char** jack_port_get_connections (const jack_port_t* port)
const char** jack_port_get_connections(const jack_port_t* port)
{ {
carla_stderr2("%s(%p)", __FUNCTION__, port); carla_stderr2("%s(%p)", __FUNCTION__, port);
return nullptr; return nullptr;
@@ -299,7 +299,8 @@ int jack_port_tie(jack_port_t* src, jack_port_t* dst)
return ENOSYS; return ENOSYS;


// unused // unused
(void)src; (void)dst;
(void)src;
(void)dst;
} }


CARLA_EXPORT CARLA_EXPORT
@@ -343,9 +344,10 @@ int jack_port_unset_alias(jack_port_t* port, const char* alias)
} }


CARLA_EXPORT CARLA_EXPORT
int jack_port_get_aliases(const jack_port_t*, char* aliases[2])
int jack_port_get_aliases(const jack_port_t*, const char* aliases[2])
{ {
aliases[0] = aliases[1] = nullptr;
static const char nullChar = '\0';
aliases[0] = aliases[1] = &nullChar;
return 0; return 0;
} }




+ 15
- 4
source/libjack/libjack_server-control.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla JACK API for external applications * Carla JACK API for external applications
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2016-2018 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -22,23 +22,32 @@ CARLA_BACKEND_USE_NAMESPACE
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------


CARLA_EXPORT CARLA_EXPORT
int jack_set_freewheel(jack_client_t*, int)
int jack_set_freewheel(jack_client_t* client, int freewheel)
{ {
carla_debug("%s(%p, %i)", __FUNCTION__, client, freewheel);
return ENOSYS; return ENOSYS;

// unused
(void)client;
(void)freewheel;
} }


CARLA_EXPORT CARLA_EXPORT
int jack_set_buffer_size(jack_client_t* client, jack_nframes_t bufferSize)
int jack_set_buffer_size(jack_client_t* client, jack_nframes_t nframes)
{ {
carla_debug("%s(%p, %u)", __FUNCTION__, client, nframes);

JackClientState* const jclient = (JackClientState*)client; JackClientState* const jclient = (JackClientState*)client;
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);


return (jclient->server.bufferSize == bufferSize) ? 0 : 1;
return (jclient->server.bufferSize == nframes) ? 0 : 1;
} }


CARLA_EXPORT CARLA_EXPORT
jack_nframes_t jack_get_sample_rate(jack_client_t* client) jack_nframes_t jack_get_sample_rate(jack_client_t* client)
{ {
carla_debug("%s(%p)", __FUNCTION__, client);

JackClientState* const jclient = (JackClientState*)client; JackClientState* const jclient = (JackClientState*)client;
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);


@@ -48,6 +57,8 @@ jack_nframes_t jack_get_sample_rate(jack_client_t* client)
CARLA_EXPORT CARLA_EXPORT
jack_nframes_t jack_get_buffer_size(jack_client_t* client) jack_nframes_t jack_get_buffer_size(jack_client_t* client)
{ {
carla_debug("%s(%p)", __FUNCTION__, client);

JackClientState* const jclient = (JackClientState*)client; JackClientState* const jclient = (JackClientState*)client;
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);




+ 10
- 3
source/libjack/libjack_time.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla JACK API for external applications * Carla JACK API for external applications
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2016-2018 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -65,10 +65,17 @@ jack_time_t jack_frames_to_time(const jack_client_t* client, jack_nframes_t fram
const JackClientState* const jclient = (const JackClientState*)client; const JackClientState* const jclient = (const JackClientState*)client;
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);


return frames / jclient->server.sampleRate;
return static_cast<double>(frames) / jclient->server.sampleRate * 1000000.0;
} }


// jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t) JACK_OPTIONAL_WEAK_EXPORT;
CARLA_EXPORT
jack_nframes_t jack_time_to_frames(const jack_client_t* client, jack_time_t time)
{
const JackClientState* const jclient = (const JackClientState*)client;
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0);

return static_cast<double>(time) / 1000000.0 * jclient->server.sampleRate;
}


CARLA_EXPORT CARLA_EXPORT
jack_time_t jack_get_time(void) jack_time_t jack_get_time(void)


Loading…
Cancel
Save