| @@ -1,82 +1,77 @@ | |||
| #!/usr/bin/make -f | |||
| # Makefile for Carla-Discovery # | |||
| # Makefile for carla-discovery # | |||
| # ----------------------------------------- # | |||
| # Created by falkTX | |||
| # | |||
| CXX ?= g++ | |||
| WINECXX ?= wineg++ | |||
| PKGCONFIG ?= pkg-config | |||
| BUILD_FLAGS = -Wall -std=c++0x -O2 -ffast-math -fomit-frame-pointer -fPIC -mtune=generic -msse -I../carla-includes $(CXXFLAGS) | |||
| BUILD_FLAGS = -O2 -ffast-math -fomit-frame-pointer -mtune=generic -msse -std=c++0x -Wall $(CXXFLAGS) | |||
| BUILD_FLAGS += -I../carla-includes $(shell pkg-config --cflags QtCore) | |||
| BUILD_FLAGS += -DNDEBUG -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT | |||
| BUILD_FLAGS += -DVESTIGE_HEADER -I../carla-includes/vestige # Comment this line to not use vestige header | |||
| LINK_FLAGS = $(LDFLAGS) | |||
| 32BIT_FLAGS = -m32 | |||
| 64BIT_FLAGS = -m64 | |||
| LINK_FLAGS = $(shell pkg-config --libs QtCore) $(LDFLAGS) | |||
| ifneq ($(FLUIDSYNTH),) | |||
| BUILD_FLAGS += $(shell pkg-config --cflags fluidsynth) -DWANT_FLUIDSYNTH | |||
| LINK_FLAGS += $(shell pkg-config --libs fluidsynth) | |||
| endif | |||
| UNIX_BUILD_FLAGS = $(BUILD_FLAGS) | |||
| UNIX_LINK_FLAGS = -ldl $(LINK_FLAGS) | |||
| UNIX_32BIT_FLAGS = -L/usr/lib32 -L/usr/lib/i386-linux-gnu $(32BIT_FLAGS) | |||
| UNIX_64BIT_FLAGS = -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu $(64BIT_FLAGS) | |||
| UNIX_LINK_FLAGS = -ldl $(LINK_FLAGS) | |||
| WIN_BUILD_FLAGS = $(BUILD_FLAGS) | |||
| WIN_LINK_FLAGS = -static $(LINK_FLAGS) | |||
| WIN_32BIT_FLAGS = $(32BIT_FLAGS) | |||
| WIN_64BIT_FLAGS = $(64BIT_FLAGS) | |||
| WIN_BUILD_FLAGS = $(BUILD_FLAGS) | |||
| WIN_32BIT_FLAGS = $(32BIT_FLAGS) | |||
| WIN_64BIT_FLAGS = $(64BIT_FLAGS) | |||
| WIN_LINK_FLAGS = -static $(LINK_FLAGS) | |||
| WINE_BUILD_FLAGS = -fpermissive $(BUILD_FLAGS) | |||
| WINE_LINK_FLAGS = $(LINK_FLAGS) | |||
| WINE_BUILD_FLAGS = $(BUILD_FLAGS) # -fpermissive | |||
| WINE_32BIT_FLAGS = -L/usr/lib32/wine -L/usr/lib/i386-linux-gnu/wine $(32BIT_FLAGS) | |||
| WINE_64BIT_FLAGS = -L/usr/lib64/wine -L/usr/lib/x86_64-linux-gnu/wine $(64BIT_FLAGS) | |||
| WINE_LINK_FLAGS = -ldl $(LINK_FLAGS) | |||
| ifeq ($(FLUIDSYNTH),) | |||
| else | |||
| BUILD_FLAGS += `$(PKGCONFIG) --cflags fluidsynth` -DWANT_FLUIDSYNTH | |||
| LINK_FLAGS += `$(PKGCONFIG) --libs fluidsynth` | |||
| endif | |||
| ifeq ($(LILV),) | |||
| else | |||
| BUILD_FLAGS += -DWANT_LILV | |||
| LINK_FLAGS += ../carla-lilv/carla_lilv.a | |||
| endif | |||
| # -------------------------------------------------------------- | |||
| all: | |||
| @echo "Build type must be unix32, unix64, win[e]32 or win[e]64" | |||
| unix32: carla-discovery-unix32 | |||
| unix64: carla-discovery-unix64 | |||
| win32: carla-discovery-win32.exe | |||
| win64: carla-discovery-win64.exe | |||
| win32: carla-discovery-win32.exe | |||
| win64: carla-discovery-win64.exe | |||
| wine32: carla-discovery-win32.exe.so | |||
| wine64: carla-discovery-win64.exe.so | |||
| # -------------------------------------------------------------- | |||
| 32BIT_OBJS = carla-discovery.cpp ../carla-lilv/carla_lilv_32bit.a | |||
| 64BIT_OBJS = carla-discovery.cpp ../carla-lilv/carla_lilv_64bit.a | |||
| carla-discovery-unix32: carla-discovery.cpp | |||
| $(CXX) carla-discovery.cpp $(UNIX_BUILD_FLAGS) $(UNIX_32BIT_FLAGS) $(UNIX_LINK_FLAGS) -DBUILD_UNIX32 -o $@ | |||
| carla-discovery-unix32: $(32BIT_OBJS) | |||
| $(CXX) $(32BIT_OBJS) $(UNIX_BUILD_FLAGS) $(UNIX_32BIT_FLAGS) $(UNIX_LINK_FLAGS) -o $@ | |||
| carla-discovery-unix64: carla-discovery.cpp | |||
| $(CXX) carla-discovery.cpp $(UNIX_BUILD_FLAGS) $(UNIX_64BIT_FLAGS) $(UNIX_LINK_FLAGS) -DBUILD_UNIX64 -o $@ | |||
| carla-discovery-unix64: $(64BIT_OBJS) | |||
| $(CXX) $(64BIT_OBJS) $(UNIX_BUILD_FLAGS) $(UNIX_64BIT_FLAGS) $(UNIX_LINK_FLAGS) -o $@ | |||
| carla-discovery-win32.exe: carla-discovery.cpp | |||
| $(CXX) carla-discovery.cpp $(WIN_BUILD_FLAGS) $(WIN_32BIT_FLAGS) $(WIN_LINK_FLAGS) -DBUILD_WIN32 -o $@ | |||
| carla-discovery-win32.exe: $(32BIT_OBJS) | |||
| $(CXX) $(32BIT_OBJS) $(WIN_BUILD_FLAGS) $(WIN_32BIT_FLAGS) $(WIN_LINK_FLAGS) -o $@ | |||
| carla-discovery-win64.exe: carla-discovery.cpp | |||
| $(CXX) carla-discovery.cpp $(WIN_BUILD_FLAGS) $(WIN_64BIT_FLAGS) $(WIN_LINK_FLAGS) -DBUILD_WIN64 -o $@ | |||
| carla-discovery-win64.exe: $(64BIT_OBJS) | |||
| $(CXX) $(64BIT_OBJS) $(WIN_BUILD_FLAGS) $(WIN_64BIT_FLAGS) $(WIN_LINK_FLAGS) -o $@ | |||
| carla-discovery-win32.exe.so: carla-discovery.cpp | |||
| $(WINECXX) carla-discovery.cpp $(WINE_BUILD_FLAGS) $(WINE_32BIT_FLAGS) $(WINE_LINK_FLAGS) -DBUILD_WIN32 -o carla-discovery-win32.exe | |||
| carla-discovery-win32.exe.so: $(32BIT_OBJS) | |||
| $(WINECXX) $(32BIT_OBJS) $(WINE_BUILD_FLAGS) $(WINE_32BIT_FLAGS) $(WINE_LINK_FLAGS) -o carla-discovery-win32.exe | |||
| carla-discovery-win64.exe.so: carla-discovery.cpp | |||
| $(WINECXX) carla-discovery.cpp $(WINE_BUILD_FLAGS) $(WINE_64BIT_FLAGS) $(WINE_LINK_FLAGS) -DBUILD_WIN64 -o carla-discovery-win64.exe | |||
| carla-discovery-win64.exe.so: $(64BIT_OBJS) | |||
| $(WINECXX) $(64BIT_OBJS) $(WINE_BUILD_FLAGS) $(WINE_64BIT_FLAGS) $(WINE_LINK_FLAGS) -o carla-discovery-win64.exe | |||
| # -------------------------------------------------------------- | |||
| clean: | |||
| rm -f carla-discovery-* | |||
| @@ -1,23 +1,28 @@ | |||
| # QtCreator project file | |||
| CONFIG = warn_on qt release | |||
| QT = core | |||
| CONFIG = link_pkgconfig qt warn_on debug | |||
| DEFINES = DEBUG VESTIGE_HEADER WANT_FLUIDSYNTH | |||
| PKGCONFIG = fluidsynth | |||
| TARGET = carla-discovery-qtcreator | |||
| TEMPLATE = app | |||
| VERSION = 0.5.0 | |||
| VERSION = 0.5.0 | |||
| SOURCES = \ | |||
| ../carla-discovery.cpp | |||
| HEADERS = \ | |||
| ../../carla-includes/carla_includes.h \ | |||
| ../../carla-includes/carla_vst_includes.h | |||
| ../../carla-includes/carla_lib_includes.h \ | |||
| ../../carla-includes/carla_vst_includes.h \ | |||
| ../../carla-includes/lv2_rdf.h | |||
| INCLUDEPATH = .. \ | |||
| ../../carla-includes \ | |||
| ../../carla-includes/vestige | |||
| TARGET = carla-discovery-qtcreator | |||
| DEFINES = VESTIGE_HEADER BUILD_UNIX64 | |||
| LIBS = ../../carla-lilv/carla_lilv.a -ldl | |||
| LIBS += ../../carla-lilv/carla_lilv.a -ldl | |||
| QMAKE_CXXFLAGS *= -std=c++0x | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * JACK Backend code for Carla | |||
| * Carla shared includes | |||
| * Copyright (C) 2011-2012 Filipe Coelho <falktx@gmail.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| @@ -27,6 +27,12 @@ | |||
| #define QT_NO_STL | |||
| #endif | |||
| #if defined (__GXX_EXPERIMENTAL_CXX0X__) && defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||
| // nullptr is available | |||
| #else | |||
| # define nullptr (0) | |||
| #endif | |||
| #include <QtCore/Qt> | |||
| #ifdef Q_OS_WIN | |||
| @@ -0,0 +1,76 @@ | |||
| /* | |||
| * Carla shared library code | |||
| * Copyright (C) 2012 Filipe Coelho <falktx@gmail.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 COPYING file | |||
| */ | |||
| #ifndef CARLA_LIB_INCLUDES_H | |||
| #define CARLA_LIB_INCLUDES_H | |||
| #ifdef Q_OS_WIN | |||
| #include <cstdio> | |||
| #endif | |||
| static | |||
| void* lib_open(const char* filename) | |||
| { | |||
| #ifdef Q_OS_WIN | |||
| return LoadLibraryA(filename); | |||
| #else | |||
| return dlopen(filename, RTLD_LAZY); | |||
| #endif | |||
| } | |||
| static | |||
| bool lib_close(void* lib) | |||
| { | |||
| #ifdef Q_OS_WIN | |||
| return FreeLibrary((HMODULE)lib); | |||
| #else | |||
| return (dlclose(lib) == 0); | |||
| #endif | |||
| } | |||
| static | |||
| void* lib_symbol(void* lib, const char* symbol) | |||
| { | |||
| #ifdef Q_OS_WIN | |||
| return (void*)GetProcAddress((HMODULE)lib, symbol); | |||
| #else | |||
| return dlsym(lib, symbol); | |||
| #endif | |||
| } | |||
| static | |||
| const char* lib_error(const char* filename) | |||
| { | |||
| #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 | |||
| } | |||
| #endif // CARLA_LIB_INCLUDES_H | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * JACK Backend code for Carla | |||
| * Carla shared OSC code | |||
| * Copyright (C) 2012 Filipe Coelho <falktx@gmail.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * JACK Backend code for Carla | |||
| * Carla shared VST code | |||
| * Copyright (C) 2012 Filipe Coelho <falktx@gmail.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or modify | |||
| @@ -734,7 +734,7 @@ inline const LV2_RDF_Descriptor* lv2_rdf_new(const char* URI) | |||
| LILV_FOREACH(plugins, i, Plugins) | |||
| { | |||
| Lilv::Plugin Plugin = Lilv::Plugin(lilv_plugins_get(Plugins, i)); | |||
| Lilv::Plugin Plugin(lilv_plugins_get(Plugins, i)); | |||
| if (strcmp(Plugin.get_uri().as_string(), URI) == 0) | |||
| { | |||
| @@ -1771,33 +1771,24 @@ inline bool is_lv2_feature_supported(const char* uri) | |||
| return true; | |||
| else if (strcmp(uri, LV2_URID__unmap) == 0) | |||
| return true; | |||
| #ifndef BUILD_BRIDGE_UI | |||
| else if (strcmp(uri, LV2_WORKER__schedule) == 0) | |||
| return true; | |||
| #endif | |||
| else if (strcmp(uri, LV2_PROGRAMS__Host) == 0) | |||
| return true; | |||
| #ifndef BUILD_BRIDGE_UI | |||
| else if (strcmp(uri, LV2_RTSAFE_MEMORY_POOL_URI) == 0) | |||
| return true; | |||
| #endif | |||
| else | |||
| return false; | |||
| } | |||
| inline bool is_lv2_ui_feature_supported(const char* uri) | |||
| { | |||
| #ifndef LV2_UI_PREFIX | |||
| #define LV2_UI_PREFIX "http://lv2plug.in/ns/extensions/ui#" | |||
| #endif | |||
| if (is_lv2_feature_supported(uri)) | |||
| return true; | |||
| #ifndef BUILD_BRIDGE_UI | |||
| else if (strcmp(uri, LV2_DATA_ACCESS_URI) == 0) | |||
| return true; | |||
| else if (strcmp(uri, LV2_INSTANCE_ACCESS_URI) == 0) | |||
| return true; | |||
| #endif | |||
| else if (strcmp(uri, LV2_UI__noUserResize) == 0) | |||
| return true; | |||
| else if (strcmp(uri, LV2_UI__fixedSize) == 0) | |||
| @@ -1814,12 +1805,10 @@ inline bool is_lv2_ui_feature_supported(const char* uri) | |||
| return false; // TODO | |||
| else if (strcmp(uri, LV2_UI_PREFIX "makeResident") == 0) | |||
| return true; | |||
| #ifndef BUILD_BRIDGE_UI | |||
| else if (strcmp(uri, LV2_EXTERNAL_UI_URI) == 0) | |||
| return true; | |||
| else if (strcmp(uri, LV2_EXTERNAL_UI_DEPRECATED_URI) == 0) | |||
| return true; | |||
| #endif | |||
| else | |||
| return false; | |||
| } | |||
| @@ -12,7 +12,7 @@ SORD_VERSION = 0.8.0 | |||
| SRATOM_VERSION = 0.2.0 | |||
| LILV_VERSION = 0.14.2 | |||
| BUILD_FLAGS = -O2 -fvisibility=hidden -fPIC -mtune=generic -std=c99 -Wall | |||
| BUILD_FLAGS = -O2 -fvisibility=hidden -fPIC -mtune=generic -std=c99 -Wall $(CFLAGS) | |||
| BUILD_FLAGS += -Iconfig -I../carla-includes | |||
| 32BIT_FLAGS = -m32 | |||
| @@ -231,6 +231,8 @@ typedef void (*CallbackFunc)(CallbackType action, unsigned short plugin_id, int | |||
| // ----------------------------------------------------- | |||
| // Exported symbols (API) | |||
| #ifndef CARLA_NO_EXPORTS | |||
| CARLA_EXPORT bool carla_init(const char* client_name); | |||
| CARLA_EXPORT bool carla_close(); | |||
| CARLA_EXPORT bool carla_is_engine_running(); | |||
| @@ -304,6 +306,8 @@ CARLA_EXPORT quint32 get_buffer_size(); | |||
| CARLA_EXPORT double get_sample_rate(); | |||
| CARLA_EXPORT double get_latency(); | |||
| #endif // CARLA_NO_EXPORTS | |||
| // End of exported symbols | |||
| // ----------------------------------------------------- | |||
| @@ -503,12 +503,12 @@ public: | |||
| { | |||
| if (strcmp(descriptor->PortNames[i], "latency") == 0 || strcmp(descriptor->PortNames[i], "_latency") == 0) | |||
| { | |||
| min = 0; | |||
| min = 0.0; | |||
| max = get_sample_rate(); | |||
| def = 0; | |||
| step = 1; | |||
| step_small = 1; | |||
| step_large = 1; | |||
| def = 0.0; | |||
| step = 1.0; | |||
| step_small = 1.0; | |||
| step_large = 1.0; | |||
| param.data[j].type = PARAMETER_LATENCY; | |||
| param.data[j].hints = 0; | |||
| @@ -1179,7 +1179,7 @@ public: | |||
| static intptr_t VstHostCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) | |||
| { | |||
| #if DEBUG | |||
| qDebug("VstHostCallback() - code: %s, index: %i, value: " P_INTPTR ", opt: %f", VstOpcode2str(opcode), index, value, opt); | |||
| qDebug("VstHostCallback(%p, opcode: %s, index: %i, value: " P_INTPTR ", opt: %f", effect, VstOpcode2str(opcode), index, value, opt); | |||
| #endif | |||
| // Check if 'user' points to this plugin | |||
| @@ -1336,7 +1336,7 @@ public: | |||
| if (jack_pos->unique_1 == jack_pos->unique_2 && (jack_pos->valid & JackPositionBBT) > 0) | |||
| return jack_pos->beats_per_minute * 10000; | |||
| return 120.0 * 10000; | |||
| return 120 * 10000; | |||
| case audioMasterGetNumAutomatableParameters: | |||
| // Deprecated in VST SDK 2.4 | |||
| @@ -1582,7 +1582,7 @@ public: | |||
| #endif | |||
| default: | |||
| qDebug("VstHostCallback() - code: %s, index: %i, value: " P_INTPTR ", opt: %f", VstOpcode2str(opcode), index, value, opt); | |||
| qDebug("VstHostCallback(%p, opcode: %s, index: %i, value: " P_INTPTR ", opt: %f", effect, VstOpcode2str(opcode), index, value, opt); | |||
| break; | |||
| } | |||