@@ -121,11 +121,13 @@ protected: | |||
CarlaString ldpreload; | |||
/* | |||
if (options.frontendWinId != 0) | |||
{ | |||
ldpreload = (CarlaString(options.binaryDir) | |||
+ "/libcarla_interposer-x11.so"); | |||
} | |||
*/ | |||
const ScopedEngineEnvironmentLocker _seel(kEngine); | |||
@@ -18,12 +18,8 @@ | |||
#include "libjack.hpp" | |||
#include <sys/prctl.h> | |||
using juce::File; | |||
using juce::FloatVectorOperations; | |||
using juce::MemoryBlock; | |||
using juce::String; | |||
using juce::Time; | |||
using juce::Thread; | |||
CARLA_BACKEND_START_NAMESPACE | |||
@@ -37,7 +33,7 @@ public: | |||
CarlaJackAppClient() | |||
: Thread("CarlaJackAppClient"), | |||
fServer(), | |||
fServer(this), | |||
fAudioPoolCopy(nullptr), | |||
fIsValid(false), | |||
fIsOffline(false), | |||
@@ -293,6 +289,18 @@ void CarlaJackAppClient::handleNonRtData() | |||
signalThreadShouldExit(); | |||
break; | |||
} | |||
if (opcode != kPluginBridgeNonRtClientPing) | |||
{ | |||
static int shownNull = 0; | |||
if (opcode == kPluginBridgeNonRtClientNull) | |||
{ | |||
if (shownNull > 5) | |||
continue; | |||
++shownNull; | |||
} | |||
carla_stdout("CarlaJackAppClient::handleNonRtData() - opcode %s handled", PluginBridgeNonRtClientOpcode2str(opcode)); | |||
} | |||
} | |||
} | |||
@@ -595,6 +603,13 @@ void CarlaJackAppClient::run() | |||
signalThreadShouldExit(); | |||
break; | |||
} | |||
//#ifdef DEBUG | |||
if (opcode != kPluginBridgeRtClientProcess && opcode != kPluginBridgeRtClientMidiEvent) | |||
{ | |||
carla_stdout("CarlaJackAppClientRtThread::run() - opcode %s done", PluginBridgeRtClientOpcode2str(opcode)); | |||
} | |||
//#endif | |||
} | |||
} | |||
@@ -668,6 +683,8 @@ static CarlaJackAppClient gClient; | |||
CARLA_EXPORT | |||
jack_client_t* jack_client_open(const char* client_name, jack_options_t options, jack_status_t* status, ...) | |||
{ | |||
carla_stdout("%s(%s, 0x%x, %p)", __FUNCTION__, client_name, options, status); | |||
if (JackClientState* const client = gClient.addClient(client_name)) | |||
return (jack_client_t*)client; | |||
@@ -686,6 +703,8 @@ jack_client_t* jack_client_new(const char* client_name) | |||
CARLA_EXPORT | |||
int jack_client_close(jack_client_t* client) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
@@ -696,11 +715,13 @@ int jack_client_close(jack_client_t* client) | |||
CARLA_EXPORT | |||
pthread_t jack_client_thread_id(jack_client_t* client) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); | |||
CarlaJackAppClient* const jackAppPtr = jclient->server.jackAppPtr; | |||
CARLA_SAFE_ASSERT_RETURN(jackAppPtr != nullptr, 0); | |||
CARLA_SAFE_ASSERT_RETURN(jackAppPtr != nullptr && jackAppPtr == &gClient, 0); | |||
return (pthread_t)jackAppPtr->getThreadId(); | |||
} | |||
@@ -718,11 +739,21 @@ CARLA_BACKEND_END_NAMESPACE | |||
CARLA_BACKEND_USE_NAMESPACE | |||
CARLA_EXPORT | |||
int jack_client_real_time_priority(jack_client_t*) | |||
int jack_client_real_time_priority(jack_client_t* client) | |||
{ | |||
carla_stdout("CarlaJackAppClient :: %s", __FUNCTION__); | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
return -1; | |||
} | |||
typedef void (*JackSessionCallback)(jack_session_event_t*, void*); | |||
CARLA_EXPORT | |||
int jack_set_session_callback(jack_client_t* client, JackSessionCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
return 0; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -65,6 +65,7 @@ struct JackPortState { | |||
void* buffer; | |||
uint index; | |||
uint flags; | |||
bool isMidi; | |||
bool isSystem; | |||
JackPortState() | |||
@@ -73,14 +74,16 @@ struct JackPortState { | |||
buffer(nullptr), | |||
index(0), | |||
flags(0), | |||
isMidi(false), | |||
isSystem(false) {} | |||
JackPortState(const char* const cn, const char* const pn, const uint i, const uint f, const bool sys) | |||
JackPortState(const char* const cn, const char* const pn, const uint i, const uint f, const bool midi, const bool sys) | |||
: name(strdup(pn)), | |||
fullname(nullptr), | |||
buffer(nullptr), | |||
index(i), | |||
flags(f), | |||
isMidi(midi), | |||
isSystem(sys) | |||
{ | |||
char strBuf[STR_MAX+1]; | |||
@@ -108,8 +111,8 @@ struct JackClientState { | |||
LinkedList<JackPortState*> audioIns; | |||
LinkedList<JackPortState*> audioOuts; | |||
LinkedList<JackPortState> midiIns; | |||
LinkedList<JackPortState> midiOuts; | |||
LinkedList<JackPortState*> midiIns; | |||
LinkedList<JackPortState*> midiOuts; | |||
JackShutdownCallback shutdownCb; | |||
void* shutdownCbPtr; | |||
@@ -172,6 +175,18 @@ struct JackClientState { | |||
delete jport; | |||
} | |||
for (LinkedList<JackPortState*>::Itenerator it = midiIns.begin2(); it.valid(); it.next()) | |||
{ | |||
if (JackPortState* const jport = it.getValue(nullptr)) | |||
delete jport; | |||
} | |||
for (LinkedList<JackPortState*>::Itenerator it = midiOuts.begin2(); it.valid(); it.next()) | |||
{ | |||
if (JackPortState* const jport = it.getValue(nullptr)) | |||
delete jport; | |||
} | |||
free(name); | |||
name = nullptr; | |||
@@ -189,8 +204,8 @@ struct JackServerState { | |||
bool playing; | |||
jack_position_t position; | |||
JackServerState() | |||
: jackAppPtr(nullptr), | |||
JackServerState(CarlaJackAppClient* const app) | |||
: jackAppPtr(app), | |||
bufferSize(0), | |||
sampleRate(0.0), | |||
playing(false) | |||
@@ -40,8 +40,10 @@ const char* jack_get_version_string(void) | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_is_realtime(jack_client_t*) | |||
int jack_is_realtime(jack_client_t* client) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
return 1; | |||
} | |||
@@ -50,6 +52,8 @@ int jack_is_realtime(jack_client_t*) | |||
CARLA_EXPORT | |||
void jack_free(void* ptr) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, ptr); | |||
free(ptr); | |||
} | |||
@@ -22,14 +22,18 @@ CARLA_BACKEND_USE_NAMESPACE | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_set_thread_init_callback(jack_client_t*, JackThreadInitCallback, void*) | |||
int jack_set_thread_init_callback(jack_client_t* client, JackThreadInitCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
void jack_on_shutdown(jack_client_t* client, JackShutdownCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr,); | |||
@@ -42,6 +46,8 @@ void jack_on_shutdown(jack_client_t* client, JackShutdownCallback callback, void | |||
CARLA_EXPORT | |||
void jack_on_info_shutdown(jack_client_t* client, JackInfoShutdownCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr,); | |||
@@ -54,6 +60,8 @@ void jack_on_info_shutdown(jack_client_t* client, JackInfoShutdownCallback callb | |||
CARLA_EXPORT | |||
int jack_set_process_callback(jack_client_t* client, JackProcessCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
@@ -67,6 +75,8 @@ int jack_set_process_callback(jack_client_t* client, JackProcessCallback callbac | |||
CARLA_EXPORT | |||
int jack_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
@@ -80,6 +90,8 @@ int jack_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback cal | |||
CARLA_EXPORT | |||
int jack_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
@@ -93,6 +105,8 @@ int jack_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback | |||
CARLA_EXPORT | |||
int jack_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
@@ -104,38 +118,50 @@ int jack_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback | |||
} | |||
CARLA_EXPORT | |||
int jack_set_client_registration_callback(jack_client_t*, JackClientRegistrationCallback, void*) | |||
int jack_set_client_registration_callback(jack_client_t* client, JackClientRegistrationCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_set_port_registration_callback(jack_client_t*, JackPortRegistrationCallback, void*) | |||
int jack_set_port_registration_callback(jack_client_t* client, JackPortRegistrationCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_set_port_connect_callback(jack_client_t*, JackPortConnectCallback, void*) | |||
int jack_set_port_connect_callback(jack_client_t* client, JackPortConnectCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_set_port_rename_callback(jack_client_t*, JackPortRenameCallback, void*) | |||
int jack_set_port_rename_callback(jack_client_t* client, JackPortRenameCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_set_graph_order_callback(jack_client_t*, JackGraphOrderCallback, void*) | |||
int jack_set_graph_order_callback(jack_client_t* client, JackGraphOrderCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_set_xrun_callback(jack_client_t*, JackXRunCallback, void*) | |||
int jack_set_xrun_callback(jack_client_t* client, JackXRunCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
return 0; | |||
} | |||
@@ -30,6 +30,8 @@ int jack_client_name_size(void) | |||
CARLA_EXPORT | |||
char* jack_get_client_name(jack_client_t* client) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, nullptr); | |||
@@ -66,6 +68,8 @@ void jack_internal_client_close(const char*) | |||
CARLA_EXPORT | |||
int jack_activate(jack_client_t* client) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
@@ -79,6 +83,8 @@ int jack_activate(jack_client_t* client) | |||
CARLA_EXPORT | |||
int jack_deactivate(jack_client_t* client) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
@@ -27,9 +27,7 @@ CARLA_BACKEND_USE_NAMESPACE | |||
CARLA_EXPORT | |||
void jack_set_error_function(void (*func)(const char *)) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
(void)func; | |||
carla_stdout("%s(%p)", __FUNCTION__, func); | |||
} | |||
//extern void (*jack_info_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT; | |||
@@ -37,9 +35,7 @@ void jack_set_error_function(void (*func)(const char *)) | |||
CARLA_EXPORT | |||
void jack_set_info_function(void (*func)(const char *)) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
(void)func; | |||
carla_stdout("%s(%p)", __FUNCTION__, func); | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -25,39 +25,47 @@ CARLA_BACKEND_USE_NAMESPACE | |||
CARLA_EXPORT | |||
jack_nframes_t jack_midi_get_event_count(void*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_midi_event_get(jack_midi_event_t*, void*, uint32_t) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return ENODATA; | |||
} | |||
// void | |||
// jack_midi_clear_buffer(void *port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
void jack_midi_clear_buffer(void*) | |||
{ | |||
} | |||
// void | |||
// jack_midi_reset_buffer(void *port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
void jack_midi_reset_buffer(void*) | |||
{ | |||
} | |||
// size_t | |||
// jack_midi_max_event_size(void* port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
size_t jack_midi_max_event_size(void*) | |||
{ | |||
return 0; | |||
} | |||
// jack_midi_data_t* | |||
// jack_midi_event_reserve(void *port_buffer, | |||
// jack_nframes_t time, | |||
// size_t data_size) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
jack_midi_data_t* jack_midi_event_reserve(void*, jack_nframes_t, size_t) | |||
{ | |||
return nullptr; | |||
} | |||
// int | |||
// jack_midi_event_write(void *port_buffer, | |||
// jack_nframes_t time, | |||
// const jack_midi_data_t *data, | |||
// size_t data_size) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
int jack_midi_event_write(void*, jack_nframes_t, const jack_midi_data_t*, size_t) | |||
{ | |||
return ENOBUFS; | |||
} | |||
// uint32_t jack_midi_get_lost_event_count(void *port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
uint32_t jack_midi_get_lost_event_count(void*) | |||
{ | |||
return 0; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -23,9 +23,12 @@ CARLA_BACKEND_USE_NAMESPACE | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
const char** jack_get_ports(jack_client_t*, const char* a, const char* b, unsigned long flags) | |||
const char** jack_get_ports(jack_client_t* client, const char* a, const char* b, unsigned long flags) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s | %s %s %li", __FUNCTION__, a, b, flags); | |||
carla_stdout("%s(%p, %s, %s, 0x%lx)", __FUNCTION__, client, a, b, flags); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, nullptr); | |||
static const char* capture_1 = "system:capture_1"; | |||
static const char* capture_2 = "system:capture_2"; | |||
@@ -71,23 +74,20 @@ const char** jack_get_ports(jack_client_t*, const char* a, const char* b, unsign | |||
} | |||
CARLA_EXPORT | |||
jack_port_t* jack_port_by_name(jack_client_t* /*client*/, const char* name) | |||
jack_port_t* jack_port_by_name(jack_client_t* client, const char* name) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s | %s", __FUNCTION__, name); | |||
// CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
// CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); | |||
carla_stdout("%s(%p, %s)", __FUNCTION__, client, name); | |||
// const JackClientState& jstate(jclient->fState); | |||
//CARLA_SAFE_ASSERT_RETURN(jstate.activated, 0); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); | |||
static const JackPortState capturePorts[] = { | |||
JackPortState("system", "capture_1", 0, JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal, true), | |||
JackPortState("system", "capture_2", 1, JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal, true), | |||
JackPortState("system", "capture_1", 0, JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal, false, true), | |||
JackPortState("system", "capture_2", 1, JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal, false, true), | |||
}; | |||
static const JackPortState playbackPorts[] = { | |||
JackPortState("system", "playback_1", 3, JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal, true), | |||
JackPortState("system", "playback_2", 4, JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal, true), | |||
JackPortState("system", "playback_1", 3, JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal, false, true), | |||
JackPortState("system", "playback_2", 4, JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal, false, true), | |||
}; | |||
if (std::strncmp(name, "system:", 7) == 0) | |||
@@ -124,9 +124,9 @@ jack_port_t* jack_port_by_name(jack_client_t* /*client*/, const char* name) | |||
} | |||
CARLA_EXPORT | |||
jack_port_t* jack_port_by_id(jack_client_t*, jack_port_id_t) | |||
jack_port_t* jack_port_by_id(jack_client_t* client, jack_port_id_t port_id) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stderr2("%s(%p, %u)", __FUNCTION__, client, port_id); | |||
return nullptr; | |||
} | |||
@@ -23,9 +23,9 @@ CARLA_BACKEND_USE_NAMESPACE | |||
CARLA_EXPORT | |||
jack_port_t* jack_port_register(jack_client_t* client, const char* port_name, const char* port_type, | |||
unsigned long flags, unsigned long /*buffer_size*/) | |||
unsigned long flags, unsigned long buffer_size) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s | %s %s %lu", __FUNCTION__, port_name, port_type, flags); | |||
carla_stdout("%s(%p, %s, %s, 0x%lx, %lu)", __FUNCTION__, client, port_name, port_type, flags, buffer_size); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, nullptr); | |||
@@ -37,7 +37,7 @@ jack_port_t* jack_port_register(jack_client_t* client, const char* port_name, co | |||
{ | |||
if (flags & JackPortIsInput) | |||
{ | |||
JackPortState* const port = new JackPortState(jclient->name, port_name, jclient->audioIns.count(), flags, false); | |||
JackPortState* const port = new JackPortState(jclient->name, port_name, jclient->audioIns.count(), flags, false, false); | |||
const CarlaMutexLocker cms(jclient->mutex); | |||
@@ -47,7 +47,7 @@ jack_port_t* jack_port_register(jack_client_t* client, const char* port_name, co | |||
if (flags & JackPortIsOutput) | |||
{ | |||
JackPortState* const port = new JackPortState(jclient->name, port_name, jclient->audioOuts.count(), flags, false); | |||
JackPortState* const port = new JackPortState(jclient->name, port_name, jclient->audioOuts.count(), flags, false, false); | |||
const CarlaMutexLocker cms(jclient->mutex); | |||
@@ -59,6 +59,32 @@ jack_port_t* jack_port_register(jack_client_t* client, const char* port_name, co | |||
return nullptr; | |||
} | |||
if (std::strcmp(port_type, JACK_DEFAULT_MIDI_TYPE) == 0) | |||
{ | |||
if (flags & JackPortIsInput) | |||
{ | |||
JackPortState* const port = new JackPortState(jclient->name, port_name, jclient->midiIns.count(), flags, true, false); | |||
const CarlaMutexLocker cms(jclient->mutex); | |||
jclient->midiIns.append(port); | |||
return (jack_port_t*)port; | |||
} | |||
if (flags & JackPortIsOutput) | |||
{ | |||
JackPortState* const port = new JackPortState(jclient->name, port_name, jclient->midiOuts.count(), flags, true, false); | |||
const CarlaMutexLocker cms(jclient->mutex); | |||
jclient->midiOuts.append(port); | |||
return (jack_port_t*)port; | |||
} | |||
carla_stderr2("Invalid port flags '%x'", flags); | |||
return nullptr; | |||
} | |||
carla_stderr2("Invalid port type '%s'", port_type); | |||
return nullptr; | |||
} | |||
@@ -66,6 +92,8 @@ jack_port_t* jack_port_register(jack_client_t* client, const char* port_name, co | |||
CARLA_EXPORT | |||
int jack_port_unregister(jack_client_t* client, jack_port_t* port) | |||
{ | |||
carla_stdout("%s(%p, %p)", __FUNCTION__, client, port); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
@@ -75,19 +103,36 @@ int jack_port_unregister(jack_client_t* client, jack_port_t* port) | |||
const CarlaMutexLocker cms(jclient->mutex); | |||
if (jport->flags & JackPortIsInput) | |||
if (jport->isMidi) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jclient->audioIns.removeOne(jport), 1); | |||
return 0; | |||
} | |||
if (jport->flags & JackPortIsInput) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jclient->midiIns.removeOne(jport), 1); | |||
return 0; | |||
} | |||
if (jport->flags & JackPortIsOutput) | |||
if (jport->flags & JackPortIsOutput) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jclient->midiOuts.removeOne(jport), 1); | |||
return 0; | |||
} | |||
} | |||
else | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jclient->audioOuts.removeOne(jport), 1); | |||
return 0; | |||
if (jport->flags & JackPortIsInput) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jclient->audioIns.removeOne(jport), 1); | |||
return 0; | |||
} | |||
if (jport->flags & JackPortIsOutput) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jclient->audioOuts.removeOne(jport), 1); | |||
return 0; | |||
} | |||
} | |||
carla_stderr2("Invalid port type on unregister"); | |||
carla_stderr2("Invalid port on unregister"); | |||
return 1; | |||
} | |||
@@ -103,9 +148,9 @@ void* jack_port_get_buffer(jack_port_t* port, jack_nframes_t) | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
jack_uuid_t jack_port_uuid(const jack_port_t*) | |||
jack_uuid_t jack_port_uuid(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stdout("%s(%p)", __FUNCTION__, port); | |||
return 0; | |||
} | |||
@@ -113,7 +158,7 @@ jack_uuid_t jack_port_uuid(const jack_port_t*) | |||
CARLA_EXPORT | |||
const char* jack_port_name(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stdout("%s(%p)", __FUNCTION__, port); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, nullptr); | |||
@@ -124,7 +169,7 @@ const char* jack_port_name(const jack_port_t* port) | |||
CARLA_EXPORT | |||
const char* jack_port_short_name(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stdout("%s(%p)", __FUNCTION__, port); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, nullptr); | |||
@@ -135,7 +180,7 @@ const char* jack_port_short_name(const jack_port_t* port) | |||
CARLA_EXPORT | |||
int jack_port_flags(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stdout("%s(%p)", __FUNCTION__, port); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, 0); | |||
@@ -146,44 +191,69 @@ int jack_port_flags(const jack_port_t* port) | |||
CARLA_EXPORT | |||
const char* jack_port_type(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stdout("%s(%p)", __FUNCTION__, port); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, nullptr); | |||
// TODO | |||
static const char* const kAudioType = JACK_DEFAULT_AUDIO_TYPE; | |||
static const char* const kMidiType = JACK_DEFAULT_MIDI_TYPE; | |||
return JACK_DEFAULT_AUDIO_TYPE; | |||
return jport->isMidi ? kMidiType : kAudioType; | |||
} | |||
//jack_port_type_id_t jack_port_type_id (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
uint32_t jack_port_type_id(const jack_port_t* port) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, port); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, 0); | |||
return jport->isMidi ? 1 : 0; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//int jack_port_is_mine (const jack_client_t *client, const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
int jack_port_is_mine(const jack_client_t* client, const jack_port_t* port) | |||
{ | |||
carla_stderr2("%s(%p, %p)", __FUNCTION__, client, port); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_port_connected(const jack_port_t*) | |||
int jack_port_connected(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stderr2("%s(%p)", __FUNCTION__, port); | |||
return 1; | |||
} | |||
//int jack_port_connected_to (const jack_port_t *port, | |||
// const char *port_name) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
int jack_port_connected_to(const jack_port_t* port, const char* port_name) | |||
{ | |||
carla_stderr2("%s(%p, %s)", __FUNCTION__, port, port_name); | |||
return 1; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
const char** jack_port_get_connections (const jack_port_t*) | |||
const char** jack_port_get_connections (const jack_port_t* port) | |||
{ | |||
carla_stderr2("%s(%p)", __FUNCTION__, port); | |||
return nullptr; | |||
} | |||
CARLA_EXPORT | |||
const char** jack_port_get_all_connections(const jack_client_t*, const jack_port_t*) | |||
const char** jack_port_get_all_connections(const jack_client_t* client, const jack_port_t* port) | |||
{ | |||
carla_stderr2("%s(%p, %p)", __FUNCTION__, client, port); | |||
return nullptr; | |||
} | |||
@@ -219,25 +289,25 @@ const char** jack_port_get_all_connections(const jack_client_t*, const jack_port | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_connect(jack_client_t*, const char*, const char*) | |||
int jack_connect(jack_client_t* client, const char* a, const char* b) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stderr2("%s(%p, %s. %s)", __FUNCTION__, client, a, b); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_disconnect(jack_client_t*, const char*, const char*) | |||
int jack_disconnect(jack_client_t* client, const char* a, const char* b) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stderr2("%s(%p, %s. %s)", __FUNCTION__, client, a, b); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_port_disconnect(jack_client_t*, jack_port_t*) | |||
int jack_port_disconnect(jack_client_t* client, jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stderr2("%s(%p, %p)", __FUNCTION__, client, port); | |||
return 0; | |||
} | |||
@@ -15,7 +15,6 @@ | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
// need to include this first | |||
#include "libjack.hpp" | |||
CARLA_BACKEND_USE_NAMESPACE | |||
@@ -23,16 +22,28 @@ CARLA_BACKEND_USE_NAMESPACE | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_engine_takeover_timebase(jack_client_t*) | |||
int jack_engine_takeover_timebase(jack_client_t* client) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
return ENOSYS; | |||
} | |||
// int jack_release_timebase (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_release_timebase(jack_client_t* client) | |||
{ | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_set_sync_callback(jack_client_t* client, JackSyncCallback callback, void* arg) | |||
{ | |||
carla_stdout("%s(%p, %p, %p)", __FUNCTION__, client, callback, arg); | |||
JackClientState* const jclient = (JackClientState*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
@@ -43,21 +54,28 @@ int jack_set_sync_callback(jack_client_t* client, JackSyncCallback callback, voi | |||
return 0; | |||
} | |||
// int jack_set_sync_timeout (jack_client_t *client, | |||
// jack_time_t timeout) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
int jack_set_sync_timeout(jack_client_t* client, jack_time_t timeout) | |||
{ | |||
carla_stdout("%s(%p, " P_UINT64 ")", __FUNCTION__, client, timeout); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_set_timebase_callback(jack_client_t*, int, JackTimebaseCallback, void*) | |||
int jack_set_timebase_callback(jack_client_t* client, int conditional, JackTimebaseCallback callback, void* arg) | |||
{ | |||
// FIXME? | |||
carla_stdout("%s(%p, %i, %p, %p)", __FUNCTION__, client, conditional, callback, arg); | |||
return EBUSY; | |||
} | |||
CARLA_EXPORT | |||
int jack_transport_locate(jack_client_t*, jack_nframes_t) | |||
int jack_transport_locate(jack_client_t* client, jack_nframes_t frame) | |||
{ | |||
// FIXME? | |||
return 1; | |||
carla_stdout("%s(%p, %u)", __FUNCTION__, client, frame); | |||
return ENOSYS; | |||
} | |||
CARLA_EXPORT | |||
@@ -79,6 +97,7 @@ jack_transport_state_t jack_transport_query(const jack_client_t* client, jack_po | |||
return JackTransportStopped; | |||
} | |||
CARLA_EXPORT | |||
jack_nframes_t jack_get_current_transport_frame(const jack_client_t* client) | |||
{ | |||
if (const JackClientState* const jclient = (JackClientState*)client) | |||
@@ -88,31 +107,37 @@ jack_nframes_t jack_get_current_transport_frame(const jack_client_t* client) | |||
} | |||
CARLA_EXPORT | |||
int jack_transport_reposition(jack_client_t*, const jack_position_t*) | |||
int jack_transport_reposition(jack_client_t* client, const jack_position_t* pos) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stdout("%s(%p, %p)", __FUNCTION__, client, pos); | |||
return EINVAL; | |||
return ENOSYS; | |||
} | |||
CARLA_EXPORT | |||
void jack_transport_start(jack_client_t*) | |||
void jack_transport_start(jack_client_t* client) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
} | |||
CARLA_EXPORT | |||
void jack_transport_stop (jack_client_t*) | |||
void jack_transport_stop(jack_client_t* client) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
carla_stdout("%s(%p)", __FUNCTION__, client); | |||
} | |||
// void jack_get_transport_info (jack_client_t *client, | |||
// jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
void jack_get_transport_info(jack_client_t* client, void* tinfo) | |||
{ | |||
carla_stdout("%s(%p, %p)", __FUNCTION__, client, tinfo); | |||
} | |||
// void jack_set_transport_info (jack_client_t *client, | |||
// jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
void jack_set_transport_info(jack_client_t* client, void* tinfo) | |||
{ | |||
carla_stdout("%s(%p, %p)", __FUNCTION__, client, tinfo); | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |