Browse Source

More work for carla-native-plugin

tags/v1.9.11
falkTX 6 years ago
parent
commit
d891f6de50
6 changed files with 56 additions and 21 deletions
  1. +9
    -0
      data/carla-native-plugin.pc
  2. +1
    -1
      data/carla-standalone.pc
  3. +1
    -1
      data/carla-utils.pc
  4. +19
    -8
      source/includes/CarlaNativePlugin.h
  5. +10
    -6
      source/plugin/Makefile
  6. +16
    -5
      source/plugin/carla-native-plugin.cpp

+ 9
- 0
data/carla-native-plugin.pc View File

@@ -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

+ 1
- 1
data/carla-standalone.pc View File

@@ -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

+ 1
- 1
data/carla-utils.pc View File

@@ -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

+ 19
- 8
source/includes/CarlaNativePlugin.h View File

@@ -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<uintptr_t>(enginePtr);
using CarlaBackend::CarlaEngine;
return (CarlaEngine*)static_cast<uintptr_t>(desc->dispatcher(handle,
NATIVE_PLUGIN_OPCODE_GET_INTERNAL_HANDLE,
0, 0, nullptr, 0.0f));
}
#endif



+ 10
- 6
source/plugin/Makefile View File

@@ -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 $@


+ 16
- 5
source/plugin/carla-native-plugin.cpp View File

@@ -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;
}

// --------------------------------------------------------------------------------------------------------------------

Loading…
Cancel
Save