| @@ -109,10 +109,13 @@ source/modules/%.a: .FORCE | |||
| # -------------------------------------------------------------- | |||
| backend: bin/libcarla_standalone2$(LIB_EXT) | |||
| backend: bin/libcarla_standalone2$(LIB_EXT) bin/libcarla_utils2$(LIB_EXT) | |||
| bin/libcarla_standalone2$(LIB_EXT): libs .FORCE | |||
| $(MAKE) -C source/backend | |||
| $(MAKE) -C source/backend ../../bin/libcarla_standalone2$(LIB_EXT) | |||
| bin/libcarla_utils2$(LIB_EXT): libs .FORCE | |||
| $(MAKE) -C source/backend ../../bin/libcarla_utils2$(LIB_EXT) | |||
| # -------------------------------------------------------------- | |||
| @@ -168,4 +168,7 @@ VST3_PLUGIN_CPP = $(CWD)/backend/plugin/Vst3Plugin.cpp $ | |||
| CARLA_STANDALONE_CPP_DEPS = $(CARLA_HOST_H) $(CARLA_MIDI_H) $(CARLA_NATIVE_H) $(CARLA_ENGINE_HPP) $(CARLA_PLUGIN_HPP) $(CARLA_BACKEND_UTILS_HPP) $(CARLA_BASE64_UTILS_HPP) $(CARLA_OSC_UTILS_HPP) | |||
| CARLA_STANDALONE_CPP = $(CWD)/backend/CarlaStandalone.cpp $(CARLA_STANDALONE_CPP_DEPS) $(CARLA_PLUGIN_UI_CPP) $(CARLA_DSSI_UTILS_CPP) $(CARLA_STATE_UTILS_CPP) | |||
| CARLA_UTILS_CPP_DEPS = $(CARLA_UTILS_H) $(CARLA_THREAD_HPP) | |||
| CARLA_UTILS_CPP = $(CWD)/backend/CarlaUtils.cpp $(CARLA_UTILS_CPP_DEPS) | |||
| # ---------------------------------------------------------------------------------------------------------------------------- | |||
| @@ -0,0 +1,66 @@ | |||
| /* | |||
| * Carla Plugin Host | |||
| * Copyright (C) 2011-2014 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 "CarlaUtils.h" | |||
| #include "CarlaThread.hpp" | |||
| #include "juce_core.h" | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| void carla_set_process_name(const char* name) | |||
| { | |||
| carla_debug("carla_set_process_name(\"%s\")", name); | |||
| CarlaThread::setCurrentThreadName(name); | |||
| juce::Thread::setCurrentThreadName(name); | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| const char* carla_get_library_filename() | |||
| { | |||
| carla_debug("carla_get_library_filename()"); | |||
| static CarlaString ret; | |||
| if (ret.isEmpty()) | |||
| { | |||
| using juce::File; | |||
| ret = File(File::getSpecialLocation(File::currentExecutableFile)).getFullPathName().toRawUTF8(); | |||
| } | |||
| return ret; | |||
| } | |||
| const char* carla_get_library_folder() | |||
| { | |||
| carla_debug("carla_get_library_folder()"); | |||
| static CarlaString ret; | |||
| if (ret.isEmpty()) | |||
| { | |||
| using juce::File; | |||
| ret = File(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory()).getFullPathName().toRawUTF8(); | |||
| } | |||
| return ret; | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| @@ -0,0 +1,49 @@ | |||
| /* | |||
| * Carla Plugin Host | |||
| * Copyright (C) 2011-2014 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. | |||
| */ | |||
| #ifndef CARLA_UTILS_H_INCLUDED | |||
| #define CARLA_UTILS_H_INCLUDED | |||
| #include "CarlaDefines.h" | |||
| /*! | |||
| * @defgroup CarlaUtilsAPI Carla Utils API | |||
| * | |||
| * The Carla Utils API. | |||
| * | |||
| * This API allows to call advanced features from Python. | |||
| * @{ | |||
| */ | |||
| /*! | |||
| * Get the juce version used in the current Carla build. | |||
| */ | |||
| CARLA_EXPORT void carla_set_process_name(const char* name); | |||
| /*! | |||
| * Get the current carla library filename. | |||
| */ | |||
| CARLA_EXPORT const char* carla_get_library_filename(); | |||
| /*! | |||
| * Get the folder where the current use carla library resides. | |||
| */ | |||
| CARLA_EXPORT const char* carla_get_library_folder(); | |||
| /** @} */ | |||
| #endif /* CARLA_UTILS_H_INCLUDED */ | |||
| @@ -35,6 +35,8 @@ STANDALONE_LIBS += ../modules/rtaudio.a | |||
| STANDALONE_LIBS += ../modules/rtmidi.a | |||
| endif | |||
| UTILS_LIBS = ../modules/juce_core.a | |||
| # -------------------------------------------------------------- | |||
| STANDALONE_FLAGS = $(JACKBRIDGE_LIBS) | |||
| @@ -77,13 +79,17 @@ ifeq ($(UNIX),true) | |||
| STANDALONE_FLAGS += -lmagic | |||
| endif | |||
| UTILS_FLAGS = $(JUCE_CORE_LIBS) | |||
| # -------------------------------------------------------------- | |||
| OBJS = \ | |||
| CarlaStandalone.cpp.o | |||
| CarlaStandalone.cpp.o \ | |||
| CarlaUtils.cpp.o | |||
| TARGETS = \ | |||
| ../../bin/libcarla_standalone2$(LIB_EXT) | |||
| ../../bin/libcarla_standalone2$(LIB_EXT) \ | |||
| ../../bin/libcarla_utils2$(LIB_EXT) | |||
| # -------------------------------------------------------------- | |||
| @@ -108,9 +114,15 @@ doxygen: CarlaBackend.doxygen | |||
| CarlaStandalone.cpp.o: $(CARLA_STANDALONE_CPP) | |||
| $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
| CarlaUtils.cpp.o: $(CARLA_UTILS_CPP) | |||
| $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
| # -------------------------------------------------------------- | |||
| ../../bin/libcarla_standalone2$(LIB_EXT): $(OBJS) $(STANDALONE_LIBS) | |||
| ../../bin/libcarla_standalone2$(LIB_EXT): CarlaStandalone.cpp.o $(STANDALONE_LIBS) | |||
| $(CXX) $< $(LIBS_START) $(STANDALONE_LIBS) $(LIBS_END) $(LINK_FLAGS) $(STANDALONE_FLAGS) $(SHARED) -o $@ | |||
| ../../bin/libcarla_utils2$(LIB_EXT): CarlaUtils.cpp.o $(UTILS_LIBS) | |||
| $(CXX) $< $(LIBS_START) $(UTILS_LIBS) $(LIBS_END) $(LINK_FLAGS) $(UTILS_FLAGS) $(SHARED) -o $@ | |||
| # -------------------------------------------------------------- | |||
| @@ -83,3 +83,32 @@ def getPluginTypeFromString(stype): | |||
| return PLUGIN_NONE | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Carla Utils object using a DLL | |||
| class CarlaUtils(object): | |||
| def __init__(self, filename): | |||
| object.__init__(self) | |||
| self.lib = cdll.LoadLibrary(filename) | |||
| self.lib.carla_set_process_name.argtypes = [c_char_p] | |||
| self.lib.carla_set_process_name.restype = None | |||
| self.lib.carla_get_library_filename.argtypes = None | |||
| self.lib.carla_get_library_filename.restype = c_char_p | |||
| self.lib.carla_get_library_folder.argtypes = None | |||
| self.lib.carla_get_library_folder.restype = c_char_p | |||
| # -------------------------------------------------------------------------------------------------------- | |||
| def set_process_name(self, index, name): | |||
| self.lib.carla_set_process_name(name.encode("utf-8")) | |||
| def get_library_filename(self): | |||
| return charPtrToString(self.lib.carla_get_library_filename()) | |||
| def get_library_folder(self): | |||
| return charPtrToString(self.lib.carla_get_library_folder()) | |||
| # ------------------------------------------------------------------------------------------------------------ | |||