@@ -21,7 +21,7 @@ endif | |||
# ---------------------------------------------------------------------------------------------------------------------- | |||
BUILD_CXX_FLAGS += -I$(CWD) -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/modules -I$(CWD)/utils | |||
BUILD_CXX_FLAGS += -I$(CWD) -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/modules -I$(CWD)/utils -DBUILD_BRIDGE | |||
LINK_FLAGS += $(MODULEDIR)/juce_core.a | |||
LINK_FLAGS += $(JUCE_CORE_LIBS) | |||
@@ -31,13 +31,27 @@ OBJS = | |||
TARGETS = | |||
ifeq ($(LINUX),true) | |||
OBJS = $(OBJDIR)/libjack.cpp.o | |||
TARGETS = $(BINDIR)/jack/libjack.so.0 | |||
OBJS = \ | |||
$(OBJDIR)/libjack.cpp.o \ | |||
$(OBJDIR)/libjack_base.cpp.o \ | |||
$(OBJDIR)/libjack_callbacks.cpp.o \ | |||
$(OBJDIR)/libjack_client.cpp.o \ | |||
$(OBJDIR)/libjack_error.cpp.o \ | |||
$(OBJDIR)/libjack_latency.cpp.o \ | |||
$(OBJDIR)/libjack_non-callback.cpp.o \ | |||
$(OBJDIR)/libjack_metadata.cpp.o \ | |||
$(OBJDIR)/libjack_midi.cpp.o \ | |||
$(OBJDIR)/libjack_ports.cpp.o \ | |||
$(OBJDIR)/libjack_port-searching.cpp.o \ | |||
$(OBJDIR)/libjack_server-control.cpp.o \ | |||
$(OBJDIR)/libjack_time.cpp.o \ | |||
$(OBJDIR)/libjack_transport.cpp.o | |||
TARGET = $(BINDIR)/jack/libjack.so.0 | |||
endif | |||
# ---------------------------------------------------------------------------------------------------------------------- | |||
all: $(TARGETS) | |||
all: $(TARGET) | |||
# ---------------------------------------------------------------------------------------------------------------------- | |||
@@ -49,14 +63,14 @@ debug: | |||
# ---------------------------------------------------------------------------------------------------------------------- | |||
$(BINDIR)/jack/libjack.so.0: $(OBJDIR)/libjack.cpp.o | |||
$(TARGET): $(OBJS) | |||
-@mkdir -p $(BINDIR)/jack | |||
@echo "Linking libjack.so.0" | |||
@$(CXX) $< $(SHARED) $(LINK_FLAGS) $(LIBJACK_LIBS) -o $@ | |||
@$(CXX) $^ $(SHARED) $(LINK_FLAGS) $(LIBJACK_LIBS) -o $@ | |||
# ---------------------------------------------------------------------------------------------------------------------- | |||
$(OBJDIR)/libjack.cpp.o: libjack.cpp | |||
$(OBJDIR)/%.cpp.o: %.cpp | |||
-@mkdir -p $(OBJDIR) | |||
@echo "Compiling $<" | |||
@$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
@@ -0,0 +1,195 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
// need to include this first | |||
#include "CarlaDefines.h" | |||
// now include a bunch of stuff | |||
#include "CarlaBackendUtils.hpp" | |||
#include "CarlaBridgeUtils.hpp" | |||
#include "CarlaMIDI.h" | |||
#include "CarlaMutex.hpp" | |||
#include "LinkedList.hpp" | |||
#include "AppConfig.h" | |||
#include "juce_core/juce_core.h" | |||
#if 0 | |||
#include <jack/jack.h> | |||
#include <jack/midiport.h> | |||
#include <jack/transport.h> | |||
#include <jack/session.h> | |||
#include <jack/metadata.h> | |||
#endif | |||
#ifdef __SSE2_MATH__ | |||
# include <xmmintrin.h> | |||
#endif | |||
// must be last include | |||
#include "jackbridge/JackBridge.hpp" | |||
// small check to not hurt myself | |||
#ifdef JACKBRIDGE_DIRECT | |||
# error "Cannot create custom jack server while linking to libjack directly" | |||
#endif | |||
#ifndef BUILD_BRIDGE | |||
# error "BUILD_BRIDGE not enabled, why?" | |||
#endif | |||
CARLA_BACKEND_START_NAMESPACE | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
struct JackPortState { | |||
char* name; | |||
char* fullname; | |||
void* buffer; | |||
uint index; | |||
uint flags; | |||
bool isSystem; | |||
JackPortState() | |||
: name(nullptr), | |||
fullname(nullptr), | |||
buffer(nullptr), | |||
index(0), | |||
flags(0), | |||
isSystem(false) {} | |||
JackPortState(const char* const cn, const char* const pn, const uint i, const uint f, const bool sys) | |||
: name(strdup(pn)), | |||
fullname(nullptr), | |||
buffer(nullptr), | |||
index(i), | |||
flags(f), | |||
isSystem(sys) | |||
{ | |||
char strBuf[STR_MAX+1]; | |||
snprintf(strBuf, STR_MAX, "%s:%s", cn, pn); | |||
strBuf[STR_MAX] = '\0'; | |||
fullname = strdup(strBuf); | |||
} | |||
~JackPortState() | |||
{ | |||
free(name); | |||
free(fullname); | |||
} | |||
}; | |||
struct JackClientState { | |||
bool activated; | |||
bool prematurelyActivated; | |||
char* name; | |||
uint32_t bufferSize; | |||
double sampleRate; | |||
bool playing; | |||
jack_position_t position; | |||
LinkedList<JackPortState*> audioIns; | |||
LinkedList<JackPortState*> audioOuts; | |||
uint32_t fakeIns, fakeOuts; | |||
LinkedList<JackPortState> midiIns; | |||
LinkedList<JackPortState> midiOuts; | |||
JackProcessCallback process; | |||
void* processPtr; | |||
JackShutdownCallback shutdown; | |||
void* shutdownPtr; | |||
JackClientState() | |||
: activated(false), | |||
prematurelyActivated(false), | |||
name(nullptr), | |||
bufferSize(0), | |||
sampleRate(0.0), | |||
playing(false), | |||
audioIns(), | |||
audioOuts(), | |||
fakeIns(0), | |||
fakeOuts(0), | |||
midiIns(), | |||
midiOuts(), | |||
process(nullptr), | |||
processPtr(nullptr), | |||
shutdown(nullptr), | |||
shutdownPtr(nullptr) | |||
{ | |||
carla_zeroStruct(position); | |||
} | |||
~JackClientState() | |||
{ | |||
free(name); | |||
} | |||
}; | |||
class CarlaJackClient : public juce::Thread | |||
{ | |||
public: | |||
JackClientState fState; | |||
CarlaJackClient(); | |||
~CarlaJackClient() noexcept override; | |||
bool initIfNeeded(const char* const clientName); | |||
void clear() noexcept; | |||
bool isValid() const noexcept; | |||
void activate(); | |||
void deactivate(); | |||
void handleNonRtData(); | |||
// ------------------------------------------------------------------- | |||
protected: | |||
void run() override; | |||
private: | |||
BridgeAudioPool fShmAudioPool; | |||
BridgeRtClientControl fShmRtClientControl; | |||
BridgeNonRtClientControl fShmNonRtClientControl; | |||
BridgeNonRtServerControl fShmNonRtServerControl; | |||
char fBaseNameAudioPool[6+1]; | |||
char fBaseNameRtClientControl[6+1]; | |||
char fBaseNameNonRtClientControl[6+1]; | |||
char fBaseNameNonRtServerControl[6+1]; | |||
bool fIsValid; | |||
bool fIsOffline; | |||
bool fFirstIdle; | |||
int64_t fLastPingTime; | |||
uint32_t fAudioIns; | |||
uint32_t fAudioOuts; | |||
CarlaMutex fRealtimeThreadMutex; | |||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaJackClient) | |||
}; | |||
CARLA_BACKEND_END_NAMESPACE | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,60 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#include "libjack.hpp" | |||
CARLA_BACKEND_USE_NAMESPACE | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
void jack_get_version(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto_ptr) | |||
{ | |||
*major_ptr = 1; | |||
*minor_ptr = 9; | |||
*micro_ptr = 12; | |||
*proto_ptr = 1; | |||
} | |||
CARLA_EXPORT | |||
const char* jack_get_version_string(void) | |||
{ | |||
static const char* const kVersionStr = "1.9.12"; | |||
return kVersionStr; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_is_realtime(jack_client_t*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 0; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
void jack_free(void* ptr) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
free(ptr); | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,105 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* 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 | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_set_thread_init_callback(jack_client_t*, JackThreadInitCallback, void*) | |||
{ | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
void jack_on_shutdown(jack_client_t* client, JackShutdownCallback callback, void* arg) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr,); | |||
JackClientState& jstate(jclient->fState); | |||
CARLA_SAFE_ASSERT_RETURN(! jstate.activated,); | |||
jstate.shutdown = callback; | |||
jstate.shutdownPtr = arg; | |||
} | |||
// void jack_on_info_shutdown (jack_client_t *client, | |||
// JackInfoShutdownCallback shutdown_callback, void *arg) JACK_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
int jack_set_process_callback(jack_client_t* client, JackProcessCallback callback, void* arg) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
JackClientState& jstate(jclient->fState); | |||
CARLA_SAFE_ASSERT_RETURN(! jstate.activated, 1); | |||
jstate.process = callback; | |||
jstate.processPtr = arg; | |||
return 0; | |||
} | |||
// int jack_set_freewheel_callback (jack_client_t *client, | |||
// JackFreewheelCallback freewheel_callback, | |||
// void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_buffer_size_callback (jack_client_t *client, | |||
// JackBufferSizeCallback bufsize_callback, | |||
// void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_sample_rate_callback (jack_client_t *client, | |||
// JackSampleRateCallback srate_callback, | |||
// void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_client_registration_callback (jack_client_t *client, | |||
// JackClientRegistrationCallback | |||
// registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_port_registration_callback (jack_client_t *client, | |||
// JackPortRegistrationCallback | |||
// registration_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_port_connect_callback (jack_client_t *client, | |||
// JackPortConnectCallback | |||
// connect_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_port_rename_callback (jack_client_t *client, | |||
// JackPortRenameCallback | |||
// rename_callback, void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_graph_order_callback (jack_client_t *client, | |||
// JackGraphOrderCallback graph_callback, | |||
// void *) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
int jack_set_xrun_callback(jack_client_t*, JackXRunCallback, void*) | |||
{ | |||
return 0; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,175 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#include "libjack.hpp" | |||
CARLA_BACKEND_USE_NAMESPACE | |||
static CarlaJackClient gClient; | |||
static int gClientRefCount = 0; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
jack_client_t* jack_client_open(const char* client_name, jack_options_t /*options*/, jack_status_t* status, ...) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
if (! gClient.initIfNeeded(client_name)) | |||
{ | |||
if (status != nullptr) | |||
*status = JackServerError; | |||
return nullptr; | |||
} | |||
++gClientRefCount; | |||
return (jack_client_t*)&gClient; | |||
} | |||
CARLA_EXPORT | |||
jack_client_t* jack_client_new(const char* client_name) | |||
{ | |||
return jack_client_open(client_name, JackNullOption, nullptr); | |||
} | |||
CARLA_EXPORT | |||
int jack_client_close(jack_client_t* client) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
JackClientState& jstate(jclient->fState); | |||
if (jstate.activated) | |||
jclient->deactivate(); | |||
--gClientRefCount; | |||
return 0; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_client_name_size(void) | |||
{ | |||
return STR_MAX; | |||
} | |||
CARLA_EXPORT | |||
char* jack_get_client_name(jack_client_t* client) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, nullptr); | |||
const JackClientState& jstate(jclient->fState); | |||
return jstate.name; | |||
} | |||
CARLA_EXPORT | |||
char* jack_get_uuid_for_client_name(jack_client_t*, const char*) | |||
{ | |||
return nullptr; | |||
} | |||
CARLA_EXPORT | |||
char* jack_get_client_name_by_uuid (jack_client_t*, const char*) | |||
{ | |||
return nullptr; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_internal_client_new(const char*, const char*, const char*) | |||
{ | |||
return 1; | |||
} | |||
CARLA_EXPORT | |||
void jack_internal_client_close(const char*) | |||
{ | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_activate(jack_client_t* client) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
const JackClientState& jstate(jclient->fState); | |||
CARLA_SAFE_ASSERT_RETURN(! jstate.activated, 1); | |||
#if 0 | |||
// needed for pulseaudio | |||
static bool skipFirstActivate = true; | |||
if (skipFirstActivate) { | |||
skipFirstActivate = false; | |||
return 0; | |||
} | |||
#endif | |||
jclient->activate(); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_deactivate(jack_client_t* /*client*/) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
//CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
//CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
//JackClientState& jstate(jclient->fState); | |||
//CARLA_SAFE_ASSERT_RETURN(jstate.activated, 1); | |||
//jclient->deactivate(); | |||
return 0; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_get_client_pid(const char*) | |||
{ | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
pthread_t jack_client_thread_id(jack_client_t* client) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); | |||
const JackClientState& jstate(jclient->fState); | |||
CARLA_SAFE_ASSERT_RETURN(jstate.activated, 0); | |||
return (pthread_t)jclient->getThreadId(); | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,39 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* 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 | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//extern void (*jack_error_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT; | |||
//void jack_set_error_function (void (*func)(const char *)) JACK_OPTIONAL_WEAK_EXPORT; | |||
//extern void (*jack_info_callback)(const char *msg) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
void jack_set_info_function(void (*func)(const char *)) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
(void)func; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,60 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* 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 | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
// int jack_set_latency_callback (jack_client_t *client, | |||
// JackLatencyCallback latency_callback, | |||
// void *) JACK_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//void jack_port_set_latency (jack_port_t *port, jack_nframes_t) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
void jack_port_get_latency_range(jack_port_t*, jack_latency_callback_mode_t, jack_latency_range_t* range) | |||
{ | |||
range->min = range->max = 0; | |||
} | |||
//void jack_port_set_latency_range (jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range) JACK_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//int jack_recompute_total_latencies (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
jack_nframes_t jack_port_get_latency(jack_port_t*) | |||
{ | |||
return 0; | |||
} | |||
//jack_nframes_t jack_port_get_total_latency (jack_client_t *client, | |||
// jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//int jack_recompute_total_latency (jack_client_t*, jack_port_t* port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,70 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* 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 | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
const char* JACK_METADATA_PRETTY_NAME; | |||
const char* JACK_METADATA_PRETTY_NAME = "http://jackaudio.org/metadata/pretty-name"; | |||
// extern const char* JACK_METADATA_HARDWARE; | |||
// extern const char* JACK_METADATA_CONNECTED; | |||
// extern const char* JACK_METADATA_PORT_GROUP; | |||
// extern const char* JACK_METADATA_ICON_SMALL; | |||
// extern const char* JACK_METADATA_ICON_LARGE; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
// int | |||
// jack_set_property(jack_client_t*, | |||
// jack_uuid_t subject, | |||
// const char* key, | |||
// const char* value, | |||
// const char* type); | |||
// int | |||
// jack_get_property(jack_uuid_t subject, | |||
// const char* key, | |||
// char** value, | |||
// char** type); | |||
// void | |||
// jack_free_description (jack_description_t* desc, int free_description_itself); | |||
// int | |||
// jack_get_properties (jack_uuid_t subject, | |||
// jack_description_t* desc); | |||
// int | |||
// jack_get_all_properties (jack_description_t** descs); | |||
// int jack_remove_property (jack_client_t* client, jack_uuid_t subject, const char* key); | |||
// int jack_remove_properties (jack_client_t* client, jack_uuid_t subject); | |||
// int jack_remove_all_properties (jack_client_t* client); | |||
// int jack_set_property_change_callback (jack_client_t* client, | |||
// JackPropertyChangeCallback callback, | |||
// void* arg); | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,63 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* 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 | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
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; | |||
// void | |||
// jack_midi_reset_buffer(void *port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
// size_t | |||
// jack_midi_max_event_size(void* port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
// jack_midi_data_t* | |||
// jack_midi_event_reserve(void *port_buffer, | |||
// jack_nframes_t time, | |||
// size_t data_size) JACK_OPTIONAL_WEAK_EXPORT; | |||
// 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; | |||
// uint32_t jack_midi_get_lost_event_count(void *port_buffer) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,49 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#include "libjack.hpp" | |||
CARLA_BACKEND_USE_NAMESPACE | |||
typedef void *(*JackThreadCallback)(void* arg); | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
jack_nframes_t jack_thread_wait(jack_client_t*, int) | |||
{ | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
jack_nframes_t jack_cycle_wait(jack_client_t*) | |||
{ | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
void jack_cycle_signal(jack_client_t*, int) | |||
{ | |||
} | |||
CARLA_EXPORT | |||
int jack_set_process_thread(jack_client_t*, JackThreadCallback, void*) | |||
{ | |||
return ENOSYS; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,134 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* 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 | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
const char** jack_get_ports(jack_client_t*, const char* a, const char* b, unsigned long flags) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s | %s %s %li", __FUNCTION__, a, b, flags); | |||
static const char* capture_1 = "system:capture_1"; | |||
static const char* capture_2 = "system:capture_2"; | |||
static const char* playback_1 = "system:playback_1"; | |||
static const char* playback_2 = "system:playback_2"; | |||
if (flags == 0 || (flags & (JackPortIsInput|JackPortIsOutput)) == (JackPortIsInput|JackPortIsOutput)) | |||
{ | |||
if (const char** const ret = (const char**)calloc(5, sizeof(const char*))) | |||
{ | |||
ret[0] = capture_1; | |||
ret[1] = capture_2; | |||
ret[2] = playback_1; | |||
ret[3] = playback_2; | |||
ret[4] = nullptr; | |||
return ret; | |||
} | |||
} | |||
if (flags & JackPortIsInput) | |||
{ | |||
if (const char** const ret = (const char**)calloc(3, sizeof(const char*))) | |||
{ | |||
ret[0] = playback_1; | |||
ret[1] = playback_2; | |||
ret[2] = nullptr; | |||
return ret; | |||
} | |||
} | |||
if (flags & JackPortIsOutput) | |||
{ | |||
if (const char** const ret = (const char**)calloc(3, sizeof(const char*))) | |||
{ | |||
ret[0] = capture_1; | |||
ret[1] = capture_2; | |||
ret[2] = nullptr; | |||
return ret; | |||
} | |||
} | |||
return nullptr; | |||
} | |||
CARLA_EXPORT | |||
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); | |||
// const JackClientState& jstate(jclient->fState); | |||
//CARLA_SAFE_ASSERT_RETURN(jstate.activated, 0); | |||
static const JackPortState capturePorts[] = { | |||
JackPortState("system", "capture_1", 0, JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal, true), | |||
JackPortState("system", "capture_2", 1, JackPortIsOutput|JackPortIsPhysical|JackPortIsTerminal, true), | |||
}; | |||
static const JackPortState playbackPorts[] = { | |||
JackPortState("system", "playback_1", 3, JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal, true), | |||
JackPortState("system", "playback_2", 4, JackPortIsInput|JackPortIsPhysical|JackPortIsTerminal, true), | |||
}; | |||
if (std::strncmp(name, "system:", 7) == 0) | |||
{ | |||
name += 7; | |||
/**/ if (std::strncmp(name, "capture_", 8) == 0) | |||
{ | |||
name += 8; | |||
const int index = std::atoi(name); | |||
CARLA_SAFE_ASSERT_RETURN(index >= 0 && index < 2, nullptr); | |||
return (jack_port_t*)&capturePorts[index]; | |||
} | |||
else if (std::strncmp(name, "playback_", 9) == 0) | |||
{ | |||
name += 9; | |||
const int index = std::atoi(name); | |||
CARLA_SAFE_ASSERT_RETURN(index >= 0, nullptr); | |||
return (jack_port_t*)&playbackPorts[index]; | |||
} | |||
else | |||
{ | |||
carla_stderr2("Invalid port short name: '%s'", name); | |||
return nullptr; | |||
} | |||
} | |||
carla_stderr2("Invalid port name: '%s'", name); | |||
return nullptr; | |||
} | |||
CARLA_EXPORT | |||
jack_port_t* jack_port_by_id(jack_client_t*, jack_port_id_t) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return nullptr; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,282 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#include "libjack.hpp" | |||
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*/) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s | %s %s %lu", __FUNCTION__, port_name, port_type, flags); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, nullptr); | |||
JackClientState& jstate(jclient->fState); | |||
CARLA_SAFE_ASSERT_RETURN(port_name != nullptr && port_name[0] != '\0', nullptr); | |||
CARLA_SAFE_ASSERT_RETURN(port_type != nullptr && port_type[0] != '\0', nullptr); | |||
if (std::strcmp(port_type, JACK_DEFAULT_AUDIO_TYPE) == 0) | |||
{ | |||
uint32_t index; | |||
/**/ if (flags & JackPortIsInput) | |||
{ | |||
if (jstate.prematurelyActivated) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jstate.fakeIns > 0, nullptr); | |||
jstate.fakeIns -= 1; | |||
index = jstate.audioIns.count() - jstate.fakeIns - 1; | |||
} | |||
else | |||
{ | |||
index = jstate.audioIns.count(); | |||
jstate.audioIns.append(new JackPortState(jstate.name, port_name, index, flags, false)); | |||
} | |||
return (jack_port_t*)jstate.audioIns.getAt(index, nullptr); | |||
} | |||
else if (flags & JackPortIsOutput) | |||
{ | |||
if (jstate.prematurelyActivated) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jstate.fakeOuts > 0, nullptr); | |||
jstate.fakeOuts -= 1; | |||
index = jstate.audioOuts.count() - jstate.fakeOuts - 1; | |||
} | |||
else | |||
{ | |||
index = jstate.audioOuts.count(); | |||
jstate.audioOuts.append(new JackPortState(jstate.name, port_name, index, flags, false)); | |||
} | |||
return (jack_port_t*)jstate.audioOuts.getAt(index, nullptr); | |||
} | |||
carla_stderr2("Invalid port flags '%x'", flags); | |||
return nullptr; | |||
} | |||
carla_stderr2("Invalid port type '%s'", port_type); | |||
return nullptr; | |||
} | |||
CARLA_EXPORT | |||
int jack_port_unregister(jack_client_t* client, jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 1); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, 1); | |||
CARLA_SAFE_ASSERT_RETURN(! jport->isSystem, 1); | |||
JackClientState& jstate(jclient->fState); | |||
//CARLA_SAFE_ASSERT_RETURN(! jstate.activated, 1); | |||
if (jport->flags & JackPortIsOutput) | |||
{ | |||
if (jstate.prematurelyActivated) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jstate.fakeIns < 2, 1); | |||
jstate.fakeIns += 1; | |||
} | |||
else | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jstate.audioIns.removeOne(jport), 1); | |||
} | |||
} | |||
else | |||
{ | |||
if (jstate.prematurelyActivated) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jstate.fakeOuts < 2, 1); | |||
jstate.fakeOuts += 1; | |||
} | |||
else | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(jstate.audioOuts.removeOne(jport), 1); | |||
} | |||
} | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
void* jack_port_get_buffer(jack_port_t* port, jack_nframes_t) | |||
{ | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, nullptr); | |||
return jport->buffer; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
jack_uuid_t jack_port_uuid(const jack_port_t*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
const char* jack_port_name(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, nullptr); | |||
return jport->fullname; | |||
} | |||
CARLA_EXPORT | |||
const char* jack_port_short_name(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, nullptr); | |||
return jport->name; | |||
} | |||
CARLA_EXPORT | |||
int jack_port_flags(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, 0); | |||
return jport->flags; | |||
} | |||
CARLA_EXPORT | |||
const char* jack_port_type(const jack_port_t* port) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
JackPortState* const jport = (JackPortState*)port; | |||
CARLA_SAFE_ASSERT_RETURN(jport != nullptr, nullptr); | |||
// TODO | |||
return JACK_DEFAULT_AUDIO_TYPE; | |||
} | |||
//jack_port_type_id_t jack_port_type_id (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//int jack_port_is_mine (const jack_client_t *client, const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
int jack_port_connected(const jack_port_t*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 1; | |||
} | |||
//int jack_port_connected_to (const jack_port_t *port, | |||
// const char *port_name) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
// const char ** jack_port_get_connections (const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
// const char ** jack_port_get_all_connections (const jack_client_t *client, | |||
// const jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//int jack_port_tie (jack_port_t *src, jack_port_t *dst) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
//int jack_port_untie (jack_port_t *port) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//int jack_port_set_name (jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT; | |||
//int jack_port_rename (jack_client_t* client, jack_port_t *port, const char *port_name) JACK_OPTIONAL_WEAK_EXPORT; | |||
//int jack_port_set_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT; | |||
//int jack_port_unset_alias (jack_port_t *port, const char *alias) JACK_OPTIONAL_WEAK_EXPORT; | |||
//int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//int jack_port_request_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT; | |||
//int jack_port_request_monitor_by_name (jack_client_t *client, | |||
// const char *port_name, int onoff) JACK_OPTIONAL_WEAK_EXPORT; | |||
//int jack_port_ensure_monitor (jack_port_t *port, int onoff) JACK_OPTIONAL_WEAK_EXPORT; | |||
//int jack_port_monitoring_input (jack_port_t *port) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_connect(jack_client_t*, const char*, const char*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_disconnect(jack_client_t*, const char*, const char*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 0; | |||
} | |||
CARLA_EXPORT | |||
int jack_port_disconnect(jack_client_t*, jack_port_t*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 0; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_port_name_size(void) | |||
{ | |||
return STR_MAX; | |||
} | |||
// int jack_port_type_size(void) JACK_OPTIONAL_WEAK_EXPORT; | |||
//size_t jack_port_type_get_buffer_size (jack_client_t *client, const char *port_type) JACK_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,79 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* 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 | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
int jack_set_freewheel(jack_client_t*, int) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 1; | |||
} | |||
CARLA_EXPORT | |||
int jack_set_buffer_size(jack_client_t*, jack_nframes_t) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 1; | |||
} | |||
CARLA_EXPORT | |||
jack_nframes_t jack_get_sample_rate(jack_client_t* client) | |||
{ | |||
carla_debug("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); | |||
const JackClientState& jstate(jclient->fState); | |||
return jstate.sampleRate; | |||
} | |||
CARLA_EXPORT | |||
jack_nframes_t jack_get_buffer_size(jack_client_t* client) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); | |||
const JackClientState& jstate(jclient->fState); | |||
return jstate.bufferSize; | |||
} | |||
CARLA_EXPORT | |||
int jack_engine_takeover_timebase(jack_client_t*) | |||
{ | |||
return ENOSYS; | |||
} | |||
CARLA_EXPORT | |||
float jack_cpu_load(jack_client_t*) | |||
{ | |||
return 0.0f; | |||
} | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,55 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* 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 | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
//jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
jack_nframes_t jack_frame_time(const jack_client_t* client) | |||
{ | |||
carla_debug("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, 0); | |||
const JackClientState& jstate(jclient->fState); | |||
CARLA_SAFE_ASSERT_RETURN(jstate.activated, 0); | |||
return jstate.position.usecs; | |||
} | |||
// jack_nframes_t jack_last_frame_time (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_get_cycle_times(const jack_client_t *client, | |||
// jack_nframes_t *current_frames, | |||
// jack_time_t *current_usecs, | |||
// jack_time_t *next_usecs, | |||
// float *period_usecs) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
// jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t) JACK_OPTIONAL_WEAK_EXPORT; | |||
// jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t) JACK_OPTIONAL_WEAK_EXPORT; | |||
// jack_time_t jack_get_time(void) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- |
@@ -0,0 +1,94 @@ | |||
/* | |||
* Carla JACK API for external applications | |||
* Copyright (C) 2016-2017 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* 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 | |||
// -------------------------------------------------------------------------------------------------------------------- | |||
// int jack_release_timebase (jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_sync_callback (jack_client_t *client, | |||
// JackSyncCallback sync_callback, | |||
// void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_sync_timeout (jack_client_t *client, | |||
// jack_time_t timeout) JACK_OPTIONAL_WEAK_EXPORT; | |||
// int jack_set_timebase_callback (jack_client_t *client, | |||
// int conditional, | |||
// JackTimebaseCallback timebase_callback, | |||
// void *arg) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
int jack_transport_locate(jack_client_t*, jack_nframes_t) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return 1; | |||
} | |||
CARLA_EXPORT | |||
jack_transport_state_t jack_transport_query(const jack_client_t* client, jack_position_t* pos) | |||
{ | |||
carla_debug("CarlaJackClient :: %s", __FUNCTION__); | |||
CarlaJackClient* const jclient = (CarlaJackClient*)client; | |||
CARLA_SAFE_ASSERT_RETURN(jclient != nullptr, JackTransportStopped); | |||
const JackClientState& jstate(jclient->fState); | |||
CARLA_SAFE_ASSERT_RETURN(jstate.activated, JackTransportStopped); | |||
if (pos != nullptr) | |||
std::memcpy(pos, &jstate.position, sizeof(jack_position_t)); | |||
return jstate.playing ? JackTransportRolling : JackTransportStopped; | |||
} | |||
// jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client) JACK_OPTIONAL_WEAK_EXPORT; | |||
CARLA_EXPORT | |||
int jack_transport_reposition(jack_client_t*, const jack_position_t*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
return EINVAL; | |||
} | |||
CARLA_EXPORT | |||
void jack_transport_start(jack_client_t*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
} | |||
CARLA_EXPORT | |||
void jack_transport_stop (jack_client_t*) | |||
{ | |||
carla_stdout("CarlaJackClient :: %s", __FUNCTION__); | |||
} | |||
// void jack_get_transport_info (jack_client_t *client, | |||
// jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT; | |||
// void jack_set_transport_info (jack_client_t *client, | |||
// jack_transport_info_t *tinfo) JACK_OPTIONAL_WEAK_EXPORT; | |||
// -------------------------------------------------------------------------------------------------------------------- |