diff --git a/data/carla-native-plugin.pc b/data/carla-native-plugin.pc new file mode 100644 index 000000000..f6c2c12eb --- /dev/null +++ b/data/carla-native-plugin.pc @@ -0,0 +1,9 @@ +prefix=X-PREFIX-X +libdir=X-LIBDIR-X/carla +includedir=X-INCLUDEDIR-X/carla + +Name: carla-native-plugin +Version: 1.9.11 +Description: Carla Native Plugin +Libs: -Wl,rpath=${libdir} -L${libdir} -lcarla_native-plugin +Cflags: -DREAL_BUILD -I${includedir} -I${includedir}/includes diff --git a/data/carla-standalone.pc b/data/carla-standalone.pc index fb2239003..af696da92 100644 --- a/data/carla-standalone.pc +++ b/data/carla-standalone.pc @@ -3,7 +3,7 @@ libdir=X-LIBDIR-X/carla includedir=X-INCLUDEDIR-X/carla Name: carla-standalone -Version: 1.9.5 +Version: 1.9.11 Description: Carla Host Standalone Libs: -Wl,rpath=${libdir} -L${libdir} -lcarla_standalone2 Cflags: -DREAL_BUILD -I${includedir} -I${includedir}/includes diff --git a/data/carla-utils.pc b/data/carla-utils.pc index 0d5acdd78..a27596991 100644 --- a/data/carla-utils.pc +++ b/data/carla-utils.pc @@ -3,7 +3,7 @@ libdir=X-LIBDIR-X/carla includedir=X-INCLUDEDIR-X/carla Name: carla-utils -Version: 1.9.5 +Version: 1.9.11 Description: Carla Host Utilities Libs: -Wl,rpath=${libdir} -L${libdir} -lcarla_utils Cflags: -DREAL_BUILD -I${includedir} -I${includedir}/includes -I${includedir}/utils diff --git a/source/includes/CarlaNativePlugin.h b/source/includes/CarlaNativePlugin.h index cf5eaf5b1..088aa5637 100644 --- a/source/includes/CarlaNativePlugin.h +++ b/source/includes/CarlaNativePlugin.h @@ -22,29 +22,40 @@ #include "CarlaNative.h" #include "CarlaEngine.hpp" +/*! + * Get the absolute filename of this carla library. + */ +CARLA_EXPORT const char* carla_get_library_filename(); + /*! * Get the folder where this carla library resides. */ +CARLA_EXPORT const char* carla_get_library_folder(); + +/*! + * Get the native plugin descriptor for the carla-rack plugin. + */ CARLA_EXPORT const NativePluginDescriptor* carla_get_native_rack_plugin(); /*! - * Get the folder where this carla library resides. + * Get the native plugin descriptor for the carla-patchbay plugin. */ CARLA_EXPORT const NativePluginDescriptor* carla_get_native_patchbay_plugin(); #ifdef __cplusplus -CARLA_BACKEND_USE_NAMESPACE - +/*! + * Get the internal CarlaEngine instance. + */ static inline -CarlaEngine* carla_plugin_get_engine(const NativePluginDescriptor* desc, NativePluginHandle handle) +CarlaBackend::CarlaEngine* carla_plugin_get_engine(const NativePluginDescriptor* desc, NativePluginHandle handle) { CARLA_SAFE_ASSERT_RETURN(desc != nullptr, nullptr); CARLA_SAFE_ASSERT_RETURN(handle != nullptr, nullptr); - const intptr_t enginePtr = desc->dispatcher(handle, NATIVE_PLUGIN_OPCODE_GET_INTERNAL_HANDLE, 0, 0, nullptr, 0.0f); - CARLA_SAFE_ASSERT_RETURN(enginePtr != 0, nullptr); - - return (CarlaEngine*)static_cast(enginePtr); + using CarlaBackend::CarlaEngine; + return (CarlaEngine*)static_cast(desc->dispatcher(handle, + NATIVE_PLUGIN_OPCODE_GET_INTERNAL_HANDLE, + 0, 0, nullptr, 0.0f)); } #endif diff --git a/source/plugin/Makefile b/source/plugin/Makefile index 624861650..3e8380a8a 100644 --- a/source/plugin/Makefile +++ b/source/plugin/Makefile @@ -74,10 +74,14 @@ LINK_FLAGS += $(MAGIC_LIBS) LINK_FLAGS += $(X11_LIBS) ifeq ($(MACOS),true) -SYMBOLS_NATIVE = -Wl,-exported_symbol,_carla_get_native_rack_plugin -Wl,-exported_symbol,_carla_get_native_patchbay_plugin -SYMBOLS_LV2 = -Wl,-exported_symbol,_lv2_descriptor -Wl,-exported_symbol,_lv2ui_descriptor -SYMBOLS_LV2_UI = -Wl,-exported_symbol,_lv2ui_descriptor -SYMBOLS_VST = # TODO +SYMBOLS_NATIVE = -Wl,-exported_symbol,_carla_get_native_rack_plugin +SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_native_patchbay_plugin +SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_library_filename +SYMBOLS_NATIVE += -Wl,-exported_symbol,_carla_get_library_folder +SYMBOLS_LV2 = -Wl,-exported_symbol,_lv2_descriptor +SYMBOLS_LV2 += -Wl,-exported_symbol,_lv2ui_descriptor +SYMBOLS_LV2_UI = -Wl,-exported_symbol,_lv2ui_descriptor +SYMBOLS_VST = # TODO endif # --------------------------------------------------------------------------------------------------------------------- @@ -89,7 +93,7 @@ LIBS_ui = $(MODULEDIR)/water.a TARGETS = \ $(BINDIR)/carla-native-plugin$(APP_EXT) \ - $(BINDIR)/libcarla-native-plugin$(LIB_EXT) + $(BINDIR)/libcarla_native-plugin$(LIB_EXT) TARGETS += \ $(BINDIR)/carla.lv2/carla$(LIB_EXT) @@ -140,7 +144,7 @@ $(BINDIR)/carla-native-plugin$(APP_EXT): $(OBJDIR)/carla-native-plugin.cpp.o $(L @echo "Linking carla-native-plugin$(APP_EXT)" @$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(LINK_FLAGS) -o $@ -$(BINDIR)/libcarla-native-plugin$(LIB_EXT): $(OBJDIR)/carla-native-plugin.cpp.o $(LIBS) +$(BINDIR)/libcarla_native-plugin$(LIB_EXT): $(OBJDIR)/carla-native-plugin.cpp.o $(LIBS) -@mkdir -p $(BINDIR) @echo "Linking libcarla-native-plugin$(LIB_EXT)" @$(CXX) $< $(LIBS_START) $(LIBS) $(LIBS_END) $(SHARED) $(SYMBOLS_NATIVE) $(LINK_FLAGS) -o $@ diff --git a/source/plugin/carla-native-plugin.cpp b/source/plugin/carla-native-plugin.cpp index fdd3487fb..992f12bbb 100644 --- a/source/plugin/carla-native-plugin.cpp +++ b/source/plugin/carla-native-plugin.cpp @@ -18,6 +18,11 @@ #include "CarlaUtils.hpp" #include "CarlaNativePlugin.h" +#include "CarlaString.hpp" +#include "water/files/File.h" + +// -------------------------------------------------------------------------------------------------------------------- + static uint32_t get_buffer_size(NativeHostHandle) { return 128; @@ -35,17 +40,21 @@ static bool is_offline(NativeHostHandle) int main() { + const char* const filename = carla_get_library_filename(); + CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', 1); + + const char* const folder = carla_get_library_folder(); + CARLA_SAFE_ASSERT_RETURN(folder != nullptr && folder[0] != '\0', 1); + const NativePluginDescriptor* const rack = carla_get_native_rack_plugin(); CARLA_SAFE_ASSERT_RETURN(rack != nullptr, 1); const NativePluginDescriptor* const patchbay = carla_get_native_patchbay_plugin(); CARLA_SAFE_ASSERT_RETURN(patchbay != nullptr, 1); - const char* const resourceDir = get_current_dir_name(); - const NativeHostDescriptor host = { nullptr, - resourceDir, + "", // resourceDir "Carla Plugin UI", 0, @@ -65,12 +74,12 @@ int main() nullptr, // ui_save_file nullptr, // dispatcher - }; + const NativePluginHandle handle = rack->instantiate(&host); CARLA_SAFE_ASSERT_RETURN(handle != nullptr, 1); - CarlaEngine* const engine = carla_plugin_get_engine(rack, handle); + CarlaBackend::CarlaEngine* const engine = carla_plugin_get_engine(rack, handle); CARLA_SAFE_ASSERT_RETURN(engine != nullptr, 1); carla_stdout("Got Engine %p, %s, %i, %f", @@ -79,3 +88,5 @@ int main() rack->cleanup(handle); return 0; } + +// --------------------------------------------------------------------------------------------------------------------