@@ -1,5 +1,5 @@ | |||||
#!/usr/bin/make -f | #!/usr/bin/make -f | ||||
# Makefile for Carla-Backend # | |||||
# Makefile for carla-backend # | |||||
# ------------------------------------- # | # ------------------------------------- # | ||||
# Created by falkTX | # Created by falkTX | ||||
# | # | ||||
@@ -7,24 +7,50 @@ | |||||
CC ?= gcc | CC ?= gcc | ||||
CXX ?= g++ | CXX ?= g++ | ||||
CARLA_C_FLAGS = -Wall -fPIC -I. -I../carla-includes $(CFLAGS) | |||||
CARLA_CXX_FLAGS = -Wall -std=c++0x -fPIC -I. -I../carla-includes `pkg-config --cflags jack fluidsynth liblo QtCore QtGui` | |||||
CARLA_CXX_FLAGS += -DCARLA_BACKEND_NO_NAMESPACE -DCARLA_ENGINE_JACK $(CXXFLAGS) | |||||
CARLA_CXX_FLAGS += -DVESTIGE_HEADER -I../carla-includes/vestige # Comment this line to not use vestige header | |||||
CARLA_CXX_FLAGS += -DNDEBUG -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT -O2 -ffast-math -fomit-frame-pointer -fvisibility=hidden -mtune=generic -msse | |||||
# CARLA_CXX_FLAGS += -DDEBUG -O0 -g | |||||
CARLA_LINK_FLAGS = -shared -fPIC -ldl `pkg-config --libs jack fluidsynth linuxsampler liblo QtCore QtGui` $(LDFLAGS) | |||||
BASE_FLAGS = -O2 -ffast-math -fomit-frame-pointer -fPIC -mtune=generic -msse -Wall -I. -I../carla-includes | |||||
OBJS = carla_backend.o carla_bridge.o carla_engine_jack.o carla_osc.o carla_shared.o carla_threads.o ladspa.o dssi.o lv2.o vst.o fluidsynth.o linuxsampler.o lv2-rtmempool/rtmempool.o | |||||
HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true) | |||||
HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true) | |||||
CARLA_C_FLAGS = $(BASE_FLAGS) $(CFLAGS) | |||||
CARLA_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | |||||
CARLA_CXX_FLAGS += $(shell pkg-config --cflags jack liblo QtCore QtGui) -DCARLA_BACKEND_NO_NAMESPACE -DCARLA_ENGINE_JACK | |||||
CARLA_CXX_FLAGS += -DNDEBUG -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT | |||||
CARLA_CXX_FLAGS += -DVESTIGE_HEADER -I../carla-includes/vestige # Comment this line to not use vestige header | |||||
CARLA_LD_FLAGS = -shared -ldl $(LDFLAGS) | |||||
CARLA_LD_FLAGS += $(shell pkg-config --libs jack liblo QtCore QtGui) | |||||
ifeq ($(HAVE_FLUIDSYNTH),true) | |||||
CARLA_CXX_FLAGS += $(shell pkg-config --cflags fluidsynth) -DWANT_FLUIDSYNTH | |||||
CARLA_LD_FLAGS += $(shell pkg-config --libs fluidsynth) | |||||
endif | |||||
ifeq ($(HAVE_LINUXSAMPLER),true) | |||||
CARLA_CXX_FLAGS += $(shell pkg-config --cflags linuxsampler) -DWANT_LINUXSAMPLER | |||||
CARLA_LD_FLAGS += $(shell pkg-config --libs linuxsampler) | |||||
endif | |||||
OBJS = \ | |||||
carla_backend.o \ | |||||
carla_bridge.o \ | |||||
carla_engine_jack.o \ | |||||
carla_osc.o \ | |||||
carla_shared.o \ | |||||
carla_threads.o \ | |||||
ladspa.o dssi.o lv2.o vst.o fluidsynth.o linuxsampler.o \ | |||||
lv2-rtmempool/rtmempool.o \ | |||||
../carla-lilv/carla_lilv.a | |||||
# -------------------------------------------------------------- | |||||
all: carla_backend.so | all: carla_backend.so | ||||
carla_backend.so: $(OBJS) | carla_backend.so: $(OBJS) | ||||
$(CXX) $(OBJS) ../carla-lilv/carla_lilv.a $(CARLA_LINK_FLAGS) -o carla_backend.so | |||||
$(CXX) $^ $(CARLA_LD_FLAGS) -o $@ && strip $@ | |||||
carla_backend.a: $(OBJS) | |||||
$(CXX) $(OBJS) ../carla-lilv/carla_lilv.a -static $(CARLA_LINK_FLAGS) -o carla_backend.a | |||||
# -------------------------------------------------------------- | |||||
.c.o: | .c.o: | ||||
$(CC) -c $< $(CARLA_C_FLAGS) -o $@ | $(CC) -c $< $(CARLA_C_FLAGS) -o $@ | ||||
@@ -904,6 +904,7 @@ public: | |||||
for (uint32_t i=0; i < aout.count; i++) | for (uint32_t i=0; i < aout.count; i++) | ||||
aouts_buffer[i] = (float*)aout.ports[i]->getBuffer(); | aouts_buffer[i] = (float*)aout.ports[i]->getBuffer(); | ||||
#ifndef BUILD_BRIDGE | |||||
if (carla_options.proccess_hq) | if (carla_options.proccess_hq) | ||||
{ | { | ||||
float* ains_buffer2[ain.count]; | float* ains_buffer2[ain.count]; | ||||
@@ -921,6 +922,7 @@ public: | |||||
} | } | ||||
} | } | ||||
else | else | ||||
#endif | |||||
process(ains_buffer, aouts_buffer, nframes); | process(ains_buffer, aouts_buffer, nframes); | ||||
} | } | ||||
#endif | #endif | ||||
@@ -22,7 +22,7 @@ LINK_FLAGS = $(shell pkg-config --libs liblo QtCore) | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
BUILD_PLUGIN_FLAGS = $(BUILD_FLAGS) $(shell pkg-config --cflags QtGui) | |||||
BUILD_PLUGIN_FLAGS = $(BUILD_FLAGS) -DBUILD_BRIDGE_PLUGIN $(shell pkg-config --cflags QtGui) | |||||
LINK_PLUGIN_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs QtGui) | LINK_PLUGIN_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs QtGui) | ||||
UNIX_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) | UNIX_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) | ||||
@@ -18,29 +18,25 @@ | |||||
#include "carla_bridge_osc.h" | #include "carla_bridge_osc.h" | ||||
#include "carla_midi.h" | #include "carla_midi.h" | ||||
#ifdef BUILD_BRIDGE_UI | |||||
#include "carla_bridge_ui.h" | |||||
#else | |||||
// TODO | |||||
#include <cstring> | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
#include "carla_plugin.h" | #include "carla_plugin.h" | ||||
extern void plugin_bridge_show_gui(bool yesno); | extern void plugin_bridge_show_gui(bool yesno); | ||||
extern void plugin_bridge_quit(); | extern void plugin_bridge_quit(); | ||||
//CarlaPlugin* plugin = CarlaPlugins[0]; | |||||
static const size_t plugin_name_len = 14; | |||||
static const char* const plugin_name = "plugin-bridge"; | |||||
#else | |||||
#include "carla_bridge_ui.h" | |||||
extern int osc_handle_lv2_event_transfer(lo_arg** argv); | |||||
static const size_t plugin_name_len = 14; | |||||
static const char* const plugin_name = "lv2-ui-bridge"; | |||||
#endif | #endif | ||||
#include <cstring> | |||||
size_t plugin_name_len = 13; | |||||
const char* plugin_name = "lv2-ui-bridge"; | |||||
const char* global_osc_server_path = nullptr; | const char* global_osc_server_path = nullptr; | ||||
lo_server_thread global_osc_server_thread = nullptr; | lo_server_thread global_osc_server_thread = nullptr; | ||||
OscData global_osc_data = { nullptr, nullptr, nullptr }; | OscData global_osc_data = { nullptr, nullptr, nullptr }; | ||||
#if BRIDGE_LV2_GTK2 || BRIDGE_LV2_QT4 || BRIDGE_LV2_X11 | |||||
int osc_handle_lv2_event_transfer(lo_arg** argv); | |||||
#endif | |||||
// ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
void osc_init(const char* osc_url) | void osc_init(const char* osc_url) | ||||
@@ -128,10 +124,6 @@ int osc_message_handler(const char* path, const char* types, lo_arg** argv, int | |||||
if (strcmp(method, "configure") == 0) | if (strcmp(method, "configure") == 0) | ||||
return osc_handle_configure(argv); | return osc_handle_configure(argv); | ||||
#if BRIDGE_LV2_GTK2 || BRIDGE_LV2_QT4 || BRIDGE_LV2_X11 | |||||
else if (strcmp(method, "lv2_event_transfer") == 0) | |||||
return osc_handle_lv2_event_transfer(argv); | |||||
#endif | |||||
else if (strcmp(method, "control") == 0) | else if (strcmp(method, "control") == 0) | ||||
return osc_handle_control(argv); | return osc_handle_control(argv); | ||||
else if (strcmp(method, "program") == 0) | else if (strcmp(method, "program") == 0) | ||||
@@ -146,6 +138,10 @@ int osc_message_handler(const char* path, const char* types, lo_arg** argv, int | |||||
return osc_handle_hide(); | return osc_handle_hide(); | ||||
else if (strcmp(method, "quit") == 0) | else if (strcmp(method, "quit") == 0) | ||||
return osc_handle_quit(); | return osc_handle_quit(); | ||||
#if BRIDGE_LV2_GTK2 || BRIDGE_LV2_QT4 || BRIDGE_LV2_X11 | |||||
else if (strcmp(method, "lv2_event_transfer") == 0) | |||||
return osc_handle_lv2_event_transfer(argv); | |||||
#endif | |||||
#if 0 | #if 0 | ||||
else if (strcmp(method, "set_parameter_midi_channel") == 0) | else if (strcmp(method, "set_parameter_midi_channel") == 0) | ||||
return osc_set_parameter_midi_channel_handler(argv); | return osc_set_parameter_midi_channel_handler(argv); | ||||
@@ -162,15 +158,14 @@ int osc_message_handler(const char* path, const char* types, lo_arg** argv, int | |||||
int osc_handle_configure(lo_arg** argv) | int osc_handle_configure(lo_arg** argv) | ||||
{ | { | ||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
const char* key = (const char*)&argv[0]->s; | const char* key = (const char*)&argv[0]->s; | ||||
const char* value = (const char*)&argv[1]->s; | const char* value = (const char*)&argv[1]->s; | ||||
#ifdef BUILD_BRIDGE_UI | |||||
(void)key; | |||||
(void)value; | |||||
#else | |||||
if (CarlaPlugins[0]) | if (CarlaPlugins[0]) | ||||
CarlaPlugins[0]->set_custom_data(CUSTOM_DATA_STRING, key, value, false); | CarlaPlugins[0]->set_custom_data(CUSTOM_DATA_STRING, key, value, false); | ||||
#else | |||||
Q_UNUSED(argv); | |||||
#endif | #endif | ||||
return 0; | return 0; | ||||
@@ -178,15 +173,15 @@ int osc_handle_configure(lo_arg** argv) | |||||
int osc_handle_control(lo_arg** argv) | int osc_handle_control(lo_arg** argv) | ||||
{ | { | ||||
int index = argv[0]->i; | |||||
double value = argv[1]->f; | |||||
int index = argv[0]->i; | |||||
float value = argv[1]->f; | |||||
#ifdef BUILD_BRIDGE_UI | |||||
if (ui) | |||||
ui->queque_message(BRIDGE_MESSAGE_PARAMETER, index, 0, value); | |||||
#else | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
if (CarlaPlugins[0]) | if (CarlaPlugins[0]) | ||||
CarlaPlugins[0]->set_parameter_value_rindex(index, value, false, true, true); | CarlaPlugins[0]->set_parameter_value_rindex(index, value, false, true, true); | ||||
#else | |||||
if (ui) | |||||
ui->queque_message(BRIDGE_MESSAGE_PARAMETER, index, 0, value); | |||||
#endif | #endif | ||||
return 0; | return 0; | ||||
@@ -196,13 +191,16 @@ int osc_handle_program(lo_arg** argv) | |||||
{ | { | ||||
int index = argv[0]->i; | int index = argv[0]->i; | ||||
#ifdef BUILD_BRIDGE_UI | |||||
if (ui && index >= 0) | |||||
ui->queque_message(BRIDGE_MESSAGE_PROGRAM, index, 0, 0.0); | |||||
if (index >= 0) | |||||
{ | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
if (CarlaPlugins[0]) // TODO - asserts in plugin code | |||||
CarlaPlugins[0]->set_program(index, false, true, true, true); | |||||
#else | #else | ||||
if (CarlaPlugins[0] && index >= 0) | |||||
CarlaPlugins[0]->set_program(index, false, true, true, true); | |||||
if (ui) | |||||
ui->queque_message(BRIDGE_MESSAGE_PROGRAM, index, 0, 0.0); | |||||
#endif | #endif | ||||
} | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -212,13 +210,16 @@ int osc_handle_midi_program(lo_arg** argv) | |||||
int bank = argv[0]->i; | int bank = argv[0]->i; | ||||
int program = argv[1]->i; | int program = argv[1]->i; | ||||
#ifdef BUILD_BRIDGE_UI | |||||
if (ui && bank >= 0 && program >= 0) | |||||
ui->queque_message(BRIDGE_MESSAGE_MIDI_PROGRAM, bank, program, 0.0); | |||||
if (bank >= 0 && program >= 0) | |||||
{ | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
if (CarlaPlugins[0]) | |||||
CarlaPlugins[0]->set_midi_program_full(bank, program, false, true, true, true); | |||||
#else | #else | ||||
if (CarlaPlugins[0] && bank >= 0 && program >= 0) | |||||
CarlaPlugins[0]->set_midi_program_full(bank, program, false, true, true, true); | |||||
if (ui) | |||||
ui->queque_message(BRIDGE_MESSAGE_MIDI_PROGRAM, bank, program, 0.0); | |||||
#endif | #endif | ||||
} | |||||
return 0; | return 0; | ||||
} | } | ||||
@@ -235,22 +236,22 @@ int osc_handle_midi(lo_arg** argv) | |||||
if (MIDI_IS_STATUS_NOTE_OFF(status)) | if (MIDI_IS_STATUS_NOTE_OFF(status)) | ||||
{ | { | ||||
uint8_t note = data[2]; | uint8_t note = data[2]; | ||||
#ifdef BUILD_BRIDGE_UI | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
plugin->send_midi_note(false, note, 0, false, true, true); | |||||
#else | |||||
if (ui) | if (ui) | ||||
ui->queque_message(BRIDGE_MESSAGE_NOTE_OFF, note, 0, 0.0); | ui->queque_message(BRIDGE_MESSAGE_NOTE_OFF, note, 0, 0.0); | ||||
#else | |||||
plugin->send_midi_note(false, note, 0, false, true, true); | |||||
#endif | #endif | ||||
} | } | ||||
else if (MIDI_IS_STATUS_NOTE_ON(status)) | else if (MIDI_IS_STATUS_NOTE_ON(status)) | ||||
{ | { | ||||
uint8_t note = data[2]; | uint8_t note = data[2]; | ||||
uint8_t velo = data[3]; | uint8_t velo = data[3]; | ||||
#ifdef BUILD_BRIDGE_UI | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
plugin->send_midi_note(true, note, velo, false, true, true); | |||||
#else | |||||
if (ui) | if (ui) | ||||
ui->queque_message(BRIDGE_MESSAGE_NOTE_ON, note, velo, 0.0); | ui->queque_message(BRIDGE_MESSAGE_NOTE_ON, note, velo, 0.0); | ||||
#else | |||||
plugin->send_midi_note(true, note, velo, false, true, true); | |||||
#endif | #endif | ||||
} | } | ||||
@@ -259,11 +260,11 @@ int osc_handle_midi(lo_arg** argv) | |||||
int osc_handle_show() | int osc_handle_show() | ||||
{ | { | ||||
#ifdef BUILD_BRIDGE_UI | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
plugin_bridge_show_gui(true); | |||||
#else | |||||
if (ui) | if (ui) | ||||
ui->queque_message(BRIDGE_MESSAGE_SHOW_GUI, 1, 0, 0.0); | ui->queque_message(BRIDGE_MESSAGE_SHOW_GUI, 1, 0, 0.0); | ||||
#else | |||||
plugin_bridge_show_gui(true); | |||||
#endif | #endif | ||||
return 0; | return 0; | ||||
@@ -271,11 +272,11 @@ int osc_handle_show() | |||||
int osc_handle_hide() | int osc_handle_hide() | ||||
{ | { | ||||
#ifdef BUILD_BRIDGE_UI | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
plugin_bridge_show_gui(false); | |||||
#else | |||||
if (ui) | if (ui) | ||||
ui->queque_message(BRIDGE_MESSAGE_SHOW_GUI, 0, 0, 0.0); | ui->queque_message(BRIDGE_MESSAGE_SHOW_GUI, 0, 0, 0.0); | ||||
#else | |||||
plugin_bridge_show_gui(false); | |||||
#endif | #endif | ||||
return 0; | return 0; | ||||
@@ -283,11 +284,11 @@ int osc_handle_hide() | |||||
int osc_handle_quit() | int osc_handle_quit() | ||||
{ | { | ||||
#ifdef BUILD_BRIDGE_UI | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
plugin_bridge_quit(); | |||||
#else | |||||
if (ui) | if (ui) | ||||
ui->queque_message(BRIDGE_MESSAGE_QUIT, 0, 0, 0.0); | ui->queque_message(BRIDGE_MESSAGE_QUIT, 0, 0, 0.0); | ||||
#else | |||||
plugin_bridge_quit(); | |||||
#endif | #endif | ||||
return 0; | return 0; | ||||
@@ -295,17 +296,6 @@ int osc_handle_quit() | |||||
// ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
void osc_send_update() | |||||
{ | |||||
if (global_osc_data.target) | |||||
{ | |||||
char target_path[strlen(global_osc_data.path)+8]; | |||||
strcpy(target_path, global_osc_data.path); | |||||
strcat(target_path, "/update"); | |||||
lo_send(global_osc_data.target, target_path, "s", global_osc_server_path); | |||||
} | |||||
} | |||||
void osc_send_configure(const char* key, const char* value) | void osc_send_configure(const char* key, const char* value) | ||||
{ | { | ||||
if (global_osc_data.target) | if (global_osc_data.target) | ||||
@@ -361,31 +351,9 @@ void osc_send_midi(uint8_t buf[4]) | |||||
} | } | ||||
} | } | ||||
void osc_send_exiting() | |||||
{ | |||||
if (global_osc_data.target) | |||||
{ | |||||
char target_path[strlen(global_osc_data.path)+9]; | |||||
strcpy(target_path, global_osc_data.path); | |||||
strcat(target_path, "/exiting"); | |||||
lo_send(global_osc_data.target, target_path, ""); | |||||
} | |||||
} | |||||
// ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
#ifdef BUILD_BRIDGE_UI | |||||
void osc_send_lv2_event_transfer(const char* type, const char* key, const char* value) | |||||
{ | |||||
if (global_osc_data.target) | |||||
{ | |||||
char target_path[strlen(global_osc_data.path)+20]; | |||||
strcpy(target_path, global_osc_data.path); | |||||
strcat(target_path, "/lv2_event_transfer"); | |||||
lo_send(global_osc_data.target, target_path, "sss", type, key, value); | |||||
} | |||||
} | |||||
#else | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
void osc_send_bridge_ains_peak(int index, double value) | void osc_send_bridge_ains_peak(int index, double value) | ||||
{ | { | ||||
if (global_osc_data.target) | if (global_osc_data.target) | ||||
@@ -539,4 +507,37 @@ void osc_send_bridge_update() | |||||
lo_send(global_osc_data.target, target_path, ""); | lo_send(global_osc_data.target, target_path, ""); | ||||
} | } | ||||
} | } | ||||
#else | |||||
void osc_send_update() | |||||
{ | |||||
if (global_osc_data.target) | |||||
{ | |||||
char target_path[strlen(global_osc_data.path)+8]; | |||||
strcpy(target_path, global_osc_data.path); | |||||
strcat(target_path, "/update"); | |||||
lo_send(global_osc_data.target, target_path, "s", global_osc_server_path); | |||||
} | |||||
} | |||||
void osc_send_exiting() | |||||
{ | |||||
if (global_osc_data.target) | |||||
{ | |||||
char target_path[strlen(global_osc_data.path)+9]; | |||||
strcpy(target_path, global_osc_data.path); | |||||
strcat(target_path, "/exiting"); | |||||
lo_send(global_osc_data.target, target_path, ""); | |||||
} | |||||
} | |||||
void osc_send_lv2_event_transfer(const char* type, const char* key, const char* value) | |||||
{ | |||||
if (global_osc_data.target) | |||||
{ | |||||
char target_path[strlen(global_osc_data.path)+20]; | |||||
strcpy(target_path, global_osc_data.path); | |||||
strcat(target_path, "/lv2_event_transfer"); | |||||
lo_send(global_osc_data.target, target_path, "sss", type, key, value); | |||||
} | |||||
} | |||||
#endif | #endif |
@@ -20,20 +20,7 @@ | |||||
#include "carla_osc_includes.h" | #include "carla_osc_includes.h" | ||||
// common handlers | |||||
int osc_handle_configure(lo_arg** argv); | |||||
int osc_handle_control(lo_arg** argv); | |||||
int osc_handle_program(lo_arg** argv); | |||||
int osc_handle_midi_program(lo_arg** argv); | |||||
int osc_handle_midi(lo_arg** argv); | |||||
int osc_handle_show(); | |||||
int osc_handle_hide(); | |||||
int osc_handle_quit(); | |||||
#ifdef BUILD_BRIDGE_UI | |||||
// ui-bridge only | |||||
void osc_send_lv2_event_transfer(const char* type, const char* key, const char* value); | |||||
#else | |||||
#ifdef BUILD_BRIDGE_PLUGIN | |||||
// plugin-bridge only | // plugin-bridge only | ||||
void osc_send_bridge_ains_peak(int index, double value); | void osc_send_bridge_ains_peak(int index, double value); | ||||
void osc_send_bridge_aouts_peak(int index, double value); | void osc_send_bridge_aouts_peak(int index, double value); | ||||
@@ -49,6 +36,12 @@ void osc_send_bridge_param_ranges(int index, double def, double min, double max, | |||||
void osc_send_bridge_program_info(int index, const char* name); | void osc_send_bridge_program_info(int index, const char* name); | ||||
void osc_send_bridge_midi_program_info(int index, int bank, int program, const char* label); | void osc_send_bridge_midi_program_info(int index, int bank, int program, const char* label); | ||||
void osc_send_bridge_update(); | void osc_send_bridge_update(); | ||||
#else | |||||
// ui-bridge only | |||||
void osc_send_update(); | |||||
void osc_send_exiting(); | |||||
//void osc_send_lv2_atom_transfer(); | |||||
void osc_send_lv2_event_transfer(const char* type, const char* key, const char* value); | |||||
#endif | #endif | ||||
#endif // CARLA_BRIDGE_OSC_H | #endif // CARLA_BRIDGE_OSC_H |
@@ -15,6 +15,8 @@ | |||||
* For a full copy of the GNU General Public License see the COPYING file | * For a full copy of the GNU General Public License see the COPYING file | ||||
*/ | */ | ||||
#define CARLA_BACKEND_NO_EXPORTS | |||||
#include "carla_backend.h" | |||||
#include "carla_plugin.h" | #include "carla_plugin.h" | ||||
#include <QtGui/QApplication> | #include <QtGui/QApplication> | ||||
@@ -15,9 +15,9 @@ | |||||
* For a full copy of the GNU General Public License see the COPYING file | * For a full copy of the GNU General Public License see the COPYING file | ||||
*/ | */ | ||||
#include "carla_osc_includes.h" | |||||
#include "carla_vst_includes.h" | #include "carla_vst_includes.h" | ||||
#include "carla_bridge_osc.h" | |||||
#include "carla_bridge_ui.h" | #include "carla_bridge_ui.h" | ||||
#include "carla_midi.h" | #include "carla_midi.h" | ||||
@@ -19,6 +19,7 @@ | |||||
#define CARLA_BRIDGE_UI_H | #define CARLA_BRIDGE_UI_H | ||||
#include "carla_includes.h" | #include "carla_includes.h" | ||||
#include "carla_lib_includes.h" | |||||
#include <cstdio> | #include <cstdio> | ||||
#include <cstdlib> | #include <cstdlib> | ||||
@@ -63,6 +64,7 @@ public: | |||||
UiData(const char* ui_title) | UiData(const char* ui_title) | ||||
{ | { | ||||
m_lib = nullptr; | m_lib = nullptr; | ||||
m_filename = nullptr; | |||||
m_title = strdup(ui_title); | m_title = strdup(ui_title); | ||||
for (unsigned int i=0; i < MAX_BRIDGE_MESSAGES; i++) | for (unsigned int i=0; i < MAX_BRIDGE_MESSAGES; i++) | ||||
@@ -76,6 +78,8 @@ public: | |||||
virtual ~UiData() | virtual ~UiData() | ||||
{ | { | ||||
if (m_filename) | |||||
free(m_filename); | |||||
free(m_title); | free(m_title); | ||||
} | } | ||||
@@ -175,62 +179,35 @@ public: | |||||
bool lib_open(const char* filename) | bool lib_open(const char* filename) | ||||
{ | { | ||||
#ifdef Q_OS_WIN | |||||
m_lib = LoadLibraryA(filename); | |||||
#else | |||||
m_lib = dlopen(filename, RTLD_NOW); | |||||
#endif | |||||
m_lib = ::lib_open(filename); | |||||
m_filename = strdup(filename); | |||||
return bool(m_lib); | return bool(m_lib); | ||||
} | } | ||||
bool lib_close() | bool lib_close() | ||||
{ | { | ||||
if (m_lib) | if (m_lib) | ||||
#ifdef Q_OS_WIN | |||||
return FreeLibrary((HMODULE)m_lib) != 0; | |||||
#else | |||||
return dlclose(m_lib) != 0; | |||||
#endif | |||||
else | |||||
return false; | |||||
return ::lib_close(m_lib); | |||||
return false; | |||||
} | } | ||||
void* lib_symbol(const char* symbol) | void* lib_symbol(const char* symbol) | ||||
{ | { | ||||
if (m_lib) | if (m_lib) | ||||
#ifdef Q_OS_WIN | |||||
return (void*)GetProcAddress((HMODULE)m_lib, symbol); | |||||
#else | |||||
return dlsym(m_lib, symbol); | |||||
#endif | |||||
else | |||||
return nullptr; | |||||
return ::lib_symbol(m_lib, symbol); | |||||
return nullptr; | |||||
} | } | ||||
const char* lib_error(const char* filename) | |||||
const char* lib_error() | |||||
{ | { | ||||
#ifdef Q_OS_WIN | |||||
static char libError[2048]; | |||||
memset(libError, 0, sizeof(char)*2048); | |||||
LPVOID winErrorString; | |||||
DWORD winErrorCode = GetLastError(); | |||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, winErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&winErrorString, 0, nullptr); | |||||
snprintf(libError, 2048, "%s: error code %i: %s", filename, winErrorCode, (const char*)winErrorString); | |||||
LocalFree(winErrorString); | |||||
return libError; | |||||
#else | |||||
return dlerror(); | |||||
(void)filename; | |||||
#endif | |||||
return ::lib_error(m_filename ? m_filename : ""); | |||||
} | } | ||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
private: | private: | ||||
void* m_lib; | void* m_lib; | ||||
char* m_filename; | |||||
char* m_title; | char* m_title; | ||||
QMutex m_lock; | QMutex m_lock; | ||||
QuequeBridgeMessage QuequeBridgeMessages[MAX_BRIDGE_MESSAGES]; | QuequeBridgeMessage QuequeBridgeMessages[MAX_BRIDGE_MESSAGES]; | ||||
@@ -2,7 +2,7 @@ | |||||
QT = core | QT = core | ||||
CONFIG = warn_on qt link_pkgconfig debug | |||||
CONFIG = debug link_pkgconfig qt warn_on | |||||
PKGCONFIG = liblo gtk+-2.0 | PKGCONFIG = liblo gtk+-2.0 | ||||
TEMPLATE = app | TEMPLATE = app | ||||
@@ -16,13 +16,14 @@ SOURCES = \ | |||||
HEADERS = \ | HEADERS = \ | ||||
../carla_bridge_osc.h \ | ../carla_bridge_osc.h \ | ||||
../carla_bridge_ui.h \ | ../carla_bridge_ui.h \ | ||||
../../carla/carla_midi.h \ | |||||
../../carla/lv2_rdf.h \ | |||||
../../carla-backend/carla_midi.h \ | |||||
../../carla-includes/carla_includes.h \ | ../../carla-includes/carla_includes.h \ | ||||
../../carla-includes/carla_osc_includes.h | |||||
../../carla-includes/carla_lib_includes.h \ | |||||
../../carla-includes/carla_osc_includes.h \ | |||||
../../carla-includes/lv2_rdf.h | |||||
INCLUDEPATH = .. \ | INCLUDEPATH = .. \ | ||||
../../carla \ | |||||
../../carla-backend \ | |||||
../../carla-includes | ../../carla-includes | ||||
TARGET = carla-bridge-lv2-gtk2 | TARGET = carla-bridge-lv2-gtk2 | ||||
@@ -2,7 +2,7 @@ | |||||
QT = core gui | QT = core gui | ||||
CONFIG = warn_on qt link_pkgconfig debug | |||||
CONFIG = debug link_pkgconfig qt warn_on | |||||
PKGCONFIG = liblo | PKGCONFIG = liblo | ||||
TEMPLATE = app | TEMPLATE = app | ||||
@@ -16,13 +16,14 @@ SOURCES = \ | |||||
HEADERS = \ | HEADERS = \ | ||||
../carla_bridge_osc.h \ | ../carla_bridge_osc.h \ | ||||
../carla_bridge_ui.h \ | ../carla_bridge_ui.h \ | ||||
../../carla/carla_midi.h \ | |||||
../../carla/lv2_rdf.h \ | |||||
../../carla-backend/carla_midi.h \ | |||||
../../carla-includes/carla_includes.h \ | ../../carla-includes/carla_includes.h \ | ||||
../../carla-includes/carla_osc_includes.h | |||||
../../carla-includes/carla_lib_includes.h \ | |||||
../../carla-includes/carla_osc_includes.h \ | |||||
../../carla-includes/lv2_rdf.h | |||||
INCLUDEPATH = .. \ | INCLUDEPATH = .. \ | ||||
../../carla \ | |||||
../../carla-backend \ | |||||
../../carla-includes | ../../carla-includes | ||||
TARGET = carla-bridge-lv2-qt4 | TARGET = carla-bridge-lv2-qt4 | ||||
@@ -2,7 +2,7 @@ | |||||
QT = core gui | QT = core gui | ||||
CONFIG = warn_on qt link_pkgconfig debug | |||||
CONFIG = debug link_pkgconfig qt warn_on | |||||
PKGCONFIG = liblo | PKGCONFIG = liblo | ||||
TEMPLATE = app | TEMPLATE = app | ||||
@@ -16,13 +16,14 @@ SOURCES = \ | |||||
HEADERS = \ | HEADERS = \ | ||||
../carla_bridge_osc.h \ | ../carla_bridge_osc.h \ | ||||
../carla_bridge_ui.h \ | ../carla_bridge_ui.h \ | ||||
../../carla/carla_midi.h \ | |||||
../../carla/lv2_rdf.h \ | |||||
../../carla-backend/carla_midi.h \ | |||||
../../carla-includes/carla_includes.h \ | ../../carla-includes/carla_includes.h \ | ||||
../../carla-includes/carla_osc_includes.h | |||||
../../carla-includes/carla_lib_includes.h \ | |||||
../../carla-includes/carla_osc_includes.h \ | |||||
../../carla-includes/lv2_rdf.h | |||||
INCLUDEPATH = .. \ | INCLUDEPATH = .. \ | ||||
../../carla \ | |||||
../../carla-backend \ | |||||
../../carla-includes | ../../carla-includes | ||||
TARGET = carla-bridge-lv2-x11 | TARGET = carla-bridge-lv2-x11 | ||||
@@ -1,42 +0,0 @@ | |||||
# QtCreator project file | |||||
QT = core gui | |||||
CONFIG += warn_on qt debug link_pkgconfig | |||||
PKGCONFIG = jack liblo fluidsynth | |||||
TEMPLATE = app | |||||
VERSION = 0.5.0 | |||||
SOURCES = \ | |||||
../carla_bridge.cpp \ | |||||
../carla_osc.cpp \ | |||||
../../carla/carla_jack.cpp \ | |||||
../../carla/carla_shared.cpp \ | |||||
../../carla/ladspa.cpp \ | |||||
../../carla/dssi.cpp \ | |||||
../../carla/lv2.cpp \ | |||||
../../carla/vst.cpp \ | |||||
../../carla/lv2-rtmempool/rtmempool.c | |||||
HEADERS = \ | |||||
../carla_osc.h \ | |||||
../../carla/carla_backend.h \ | |||||
../../carla/carla_jack.h \ | |||||
../../carla/carla_plugin.h \ | |||||
../../carla/carla_shared.h \ | |||||
../../carla-includes/carla_includes.h | |||||
INCLUDEPATH = .. \ | |||||
../../carla-includes \ | |||||
# ../../carla-includes/vestige \ | |||||
../../carla-includes/vst \ | |||||
../../carla | |||||
TARGET = carla-bridge-qtcreator | |||||
DEFINES = BUILD_BRIDGE | |||||
LIBS = ../../carla-lilv/carla_lilv.a | |||||
QMAKE_CXXFLAGS *= -std=c++0x |
@@ -2,7 +2,7 @@ | |||||
QT = core gui | QT = core gui | ||||
CONFIG = warn_on qt link_pkgconfig debug | |||||
CONFIG = debug link_pkgconfig qt warn_on | |||||
PKGCONFIG = liblo | PKGCONFIG = liblo | ||||
TEMPLATE = app | TEMPLATE = app | ||||
@@ -16,15 +16,16 @@ SOURCES = \ | |||||
HEADERS = \ | HEADERS = \ | ||||
../carla_bridge_osc.h \ | ../carla_bridge_osc.h \ | ||||
../carla_bridge_ui.h \ | ../carla_bridge_ui.h \ | ||||
../../carla/carla_midi.h \ | |||||
../../carla/lv2_rdf.h \ | |||||
../../carla-backend/carla_midi.h \ | |||||
../../carla-includes/carla_includes.h \ | ../../carla-includes/carla_includes.h \ | ||||
../../carla-includes/carla_lib_includes.h \ | |||||
../../carla-includes/carla_osc_includes.h \ | ../../carla-includes/carla_osc_includes.h \ | ||||
../../carla-includes/carla_vst_includes.h | ../../carla-includes/carla_vst_includes.h | ||||
INCLUDEPATH = .. \ | INCLUDEPATH = .. \ | ||||
../../carla \ | |||||
../../carla-includes | |||||
../../carla-backend \ | |||||
../../carla-includes \ | |||||
../../carla-includes/vst | |||||
TARGET = carla-bridge-vst-x11 | TARGET = carla-bridge-vst-x11 | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla shared library code | * Carla shared library code | ||||
* Copyright (C) 2012 Filipe Coelho <falktx@gmail.com> | |||||
* Copyright (C) 2011-2012 Filipe Coelho <falktx@gmail.com> | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | ||||
@@ -24,8 +24,11 @@ | |||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
#define OSC_SEND_ARGS | #define OSC_SEND_ARGS | ||||
#define OSC_HANDLE_ARGS | |||||
#else | #else | ||||
class CarlaPlugin; | |||||
#define OSC_SEND_ARGS OscData*, | #define OSC_SEND_ARGS OscData*, | ||||
#define OSC_HANDLE_ARGS CarlaPlugin*, | |||||
#endif | #endif | ||||
struct OscData { | struct OscData { | ||||
@@ -41,16 +44,23 @@ void osc_clear_data(OscData*); | |||||
void osc_error_handler(int num, const char* msg, const char* path); | void osc_error_handler(int num, const char* msg, const char* path); | ||||
int osc_message_handler(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data); | int osc_message_handler(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data); | ||||
int osc_handle_configure(OSC_HANDLE_ARGS lo_arg** argv); | |||||
int osc_handle_control(OSC_HANDLE_ARGS lo_arg** argv); | |||||
int osc_handle_program(OSC_HANDLE_ARGS lo_arg** argv); | |||||
int osc_handle_midi_program(OSC_HANDLE_ARGS lo_arg** argv); | |||||
int osc_handle_midi(OSC_HANDLE_ARGS lo_arg** argv); | |||||
#ifdef BUILD_BRIDGE | |||||
int osc_handle_show(); | |||||
int osc_handle_hide(); | |||||
int osc_handle_quit(); | |||||
#endif | |||||
void osc_send_configure(OSC_SEND_ARGS const char* key, const char* value); | void osc_send_configure(OSC_SEND_ARGS const char* key, const char* value); | ||||
void osc_send_control(OSC_SEND_ARGS int control, double value); | void osc_send_control(OSC_SEND_ARGS int control, double value); | ||||
void osc_send_program(OSC_SEND_ARGS int program); | void osc_send_program(OSC_SEND_ARGS int program); | ||||
void osc_send_midi_program(OSC_SEND_ARGS int bank, int program, bool); | void osc_send_midi_program(OSC_SEND_ARGS int bank, int program, bool); | ||||
void osc_send_midi(OSC_SEND_ARGS uint8_t buf[4]); | void osc_send_midi(OSC_SEND_ARGS uint8_t buf[4]); | ||||
#ifdef BUILD_BRIDGE_UI | |||||
void osc_send_update(); | |||||
void osc_send_exiting(); | |||||
#else | |||||
#ifndef BUILD_BRIDGE | |||||
void osc_send_show(OscData*); | void osc_send_show(OscData*); | ||||
void osc_send_hide(OscData*); | void osc_send_hide(OscData*); | ||||
void osc_send_quit(OscData*); | void osc_send_quit(OscData*); | ||||
@@ -18,6 +18,8 @@ | |||||
#ifndef CARLA_VST_INCLUDES_H | #ifndef CARLA_VST_INCLUDES_H | ||||
#define CARLA_VST_INCLUDES_H | #define CARLA_VST_INCLUDES_H | ||||
#include <cstdint> | |||||
#define VST_FORCE_DEPRECATED 0 | #define VST_FORCE_DEPRECATED 0 | ||||
#include "aeffectx.h" | #include "aeffectx.h" | ||||
@@ -21,9 +21,9 @@ | |||||
#ifndef __LS_ENGINEFACTORY_H__ | #ifndef __LS_ENGINEFACTORY_H__ | ||||
#define __LS_ENGINEFACTORY_H__ | #define __LS_ENGINEFACTORY_H__ | ||||
#include "linuxsampler/common/global.h" | |||||
#include "linuxsampler/common/Exception.h" | |||||
#include "linuxsampler/engines/Engine.h" | |||||
#include <linuxsampler/common/global.h> | |||||
#include <linuxsampler/common/Exception.h> | |||||
#include <linuxsampler/engines/Engine.h> | |||||
#include <set> | #include <set> | ||||
#include <vector> | #include <vector> | ||||
@@ -2083,7 +2083,7 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): | |||||
else: | else: | ||||
self.setWidgetColor(PALETTE_COLOR_NONE) | self.setWidgetColor(PALETTE_COLOR_NONE) | ||||
if (self.pinfo['hints'] & PLUGIN_IS_SYNTH): | |||||
if self.pinfo['hints'] & PLUGIN_IS_SYNTH: | |||||
self.led_audio_in.setVisible(False) | self.led_audio_in.setVisible(False) | ||||
else: | else: | ||||
self.led_midi.setVisible(False) | self.led_midi.setVisible(False) | ||||
@@ -3052,9 +3052,8 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||||
if (build != BINARY_NATIVE): | if (build != BINARY_NATIVE): | ||||
# Store object so we can return a pointer | # Store object so we can return a pointer | ||||
if (self.m_bridge_info == None): | |||||
if self.m_bridge_info is None: | |||||
self.m_bridge_info = PluginBridgeInfo() | self.m_bridge_info = PluginBridgeInfo() | ||||
self.m_bridge_info.category = plugin['category'] | |||||
self.m_bridge_info.hints = plugin['hints'] | self.m_bridge_info.hints = plugin['hints'] | ||||
self.m_bridge_info.name = plugin['name'].encode("utf-8") | self.m_bridge_info.name = plugin['name'].encode("utf-8") | ||||
self.m_bridge_info.maker = plugin['maker'].encode("utf-8") | self.m_bridge_info.maker = plugin['maker'].encode("utf-8") | ||||
@@ -458,7 +458,10 @@ def runCarlaDiscovery(itype, stype, filename, tool, isWine=False): | |||||
command.append(tool) | command.append(tool) | ||||
command.append(stype) | command.append(stype) | ||||
command.append('"%s"' % filename) | |||||
if AVLINUX_PY2BUILD: | |||||
command.append('"%s"' % filename) | |||||
else: | |||||
command.append(filename) | |||||
if AVLINUX_PY2BUILD: | if AVLINUX_PY2BUILD: | ||||
try: | try: | ||||