| @@ -28,7 +28,7 @@ if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Read CLI args | # Read CLI args | ||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__) | |||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else sys.argv[0]) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # App initialization | # App initialization | ||||
| @@ -28,7 +28,7 @@ if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Read CLI args | # Read CLI args | ||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__) | |||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else sys.argv[0]) | |||||
| for arg in sys.argv: | for arg in sys.argv: | ||||
| if arg.startswith("osc."): | if arg.startswith("osc."): | ||||
| @@ -28,7 +28,7 @@ if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Read CLI args | # Read CLI args | ||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__) | |||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else sys.argv[0]) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # App initialization | # App initialization | ||||
| @@ -28,7 +28,7 @@ if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Read CLI args | # Read CLI args | ||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__) | |||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else sys.argv[0]) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # App initialization | # App initialization | ||||
| @@ -1708,7 +1708,7 @@ if __name__ == '__main__': | |||||
| from carla_app import CarlaApplication | from carla_app import CarlaApplication | ||||
| from carla_host import initHost, loadHostSettings | from carla_host import initHost, loadHostSettings | ||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__) | |||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else sys.argv[0]) | |||||
| app = CarlaApplication("Carla2-Database", libPrefix) | app = CarlaApplication("Carla2-Database", libPrefix) | ||||
| host = initHost("Carla2-Database", libPrefix, False, False, False) | host = initHost("Carla2-Database", libPrefix, False, False, False) | ||||
| @@ -851,7 +851,7 @@ if __name__ == '__main__': | |||||
| from carla_app import CarlaApplication | from carla_app import CarlaApplication | ||||
| from carla_host import initHost, loadHostSettings | from carla_host import initHost, loadHostSettings | ||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__) | |||||
| initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else sys.argv[0]) | |||||
| app = CarlaApplication("Carla2-Settings", libPrefix) | app = CarlaApplication("Carla2-Settings", libPrefix) | ||||
| host = initHost("Carla2-Settings", libPrefix, False, False, False) | host = initHost("Carla2-Settings", libPrefix, False, False, False) | ||||
| @@ -112,6 +112,7 @@ OBJS += \ | |||||
| # ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- | ||||
| # ZynAddSubFX | # ZynAddSubFX | ||||
| ifeq ($(LINUX),true) | |||||
| ifeq ($(HAVE_ZYN_DEPS),true) | ifeq ($(HAVE_ZYN_DEPS),true) | ||||
| OBJS += \ | OBJS += \ | ||||
| $(OBJDIR)/zynaddsubfx-fx.cpp.o \ | $(OBJDIR)/zynaddsubfx-fx.cpp.o \ | ||||
| @@ -158,6 +159,7 @@ ZYN_UI_FILES_H = \ | |||||
| zynaddsubfx/UI/VirKeyboard.h | zynaddsubfx/UI/VirKeyboard.h | ||||
| endif | endif | ||||
| endif | endif | ||||
| endif | |||||
| # ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- | ||||
| # Experimental plugins | # Experimental plugins | ||||
| @@ -116,9 +116,9 @@ void carla_register_all_native_plugins(void) | |||||
| #endif | #endif | ||||
| #ifdef HAVE_ZYN_DEPS | #ifdef HAVE_ZYN_DEPS | ||||
| # ifdef CARLA_OS_LINUX | |||||
| // ZynAddSubFX | // ZynAddSubFX | ||||
| carla_register_native_plugin_zynaddsubfx_fx(); | carla_register_native_plugin_zynaddsubfx_fx(); | ||||
| # ifdef CARLA_OS_LINUX | |||||
| carla_register_native_plugin_zynaddsubfx_synth(); | carla_register_native_plugin_zynaddsubfx_synth(); | ||||
| # endif | # endif | ||||
| #endif | #endif | ||||
| @@ -24,7 +24,6 @@ | |||||
| #include <cstdio> | #include <cstdio> | ||||
| #include <cstring> | #include <cstring> | ||||
| #include <cassert> | #include <cassert> | ||||
| #include <err.h> | |||||
| #include "../Misc/Util.h" | #include "../Misc/Util.h" | ||||
| #include "SVFilter.h" | #include "SVFilter.h" | ||||
| @@ -21,7 +21,6 @@ | |||||
| #include <cmath> | #include <cmath> | ||||
| #include <cstring> | #include <cstring> | ||||
| #include <err.h> | |||||
| #include "../Misc/Allocator.h" | #include "../Misc/Allocator.h" | ||||
| #include "Unison.h" | #include "Unison.h" | ||||
| @@ -34,7 +34,9 @@ | |||||
| #include <atomic> | #include <atomic> | ||||
| #include <list> | #include <list> | ||||
| #include <err.h> | |||||
| #ifndef errx | |||||
| # include <err.h> | |||||
| #endif | |||||
| using std::string; | using std::string; | ||||
| #ifndef PLUGINVERSION | #ifndef PLUGINVERSION | ||||
| @@ -26,7 +26,6 @@ | |||||
| #include <cmath> | #include <cmath> | ||||
| #include <cstdio> | #include <cstdio> | ||||
| #include <fstream> | #include <fstream> | ||||
| #include <err.h> | |||||
| #include <sys/types.h> | #include <sys/types.h> | ||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||
| @@ -66,11 +66,8 @@ static const String nameToSymbol(const String& name, const uint32_t portIndex) | |||||
| { | { | ||||
| for (int i=0; i < trimmedName.length(); ++i) | for (int i=0; i < trimmedName.length(); ++i) | ||||
| { | { | ||||
| #ifdef CARLA_OS_WIN | |||||
| const int32_t c = static_cast<int32_t>(trimmedName[i]); | |||||
| #else | |||||
| const juce_wchar c = trimmedName[i]; | const juce_wchar c = trimmedName[i]; | ||||
| #endif | |||||
| if (i == 0 && std::isdigit(c)) | if (i == 0 && std::isdigit(c)) | ||||
| symbol += "_"; | symbol += "_"; | ||||
| else if (std::isalpha(c) || std::isdigit(c)) | else if (std::isalpha(c) || std::isdigit(c)) | ||||
| @@ -32,10 +32,19 @@ public: | |||||
| * Constructor. | * Constructor. | ||||
| */ | */ | ||||
| CarlaMutex() noexcept | CarlaMutex() noexcept | ||||
| #if 0 //def CARLA_OS_WIN | |||||
| : fAlreadyLocked(false), | |||||
| fSection(), | |||||
| #else | |||||
| : fMutex(), | : fMutex(), | ||||
| #endif | |||||
| fTryLockWasCalled(false) | fTryLockWasCalled(false) | ||||
| { | { | ||||
| #if 0 //def CARLA_OS_WIN | |||||
| InitializeCriticalSection(&fSection); | |||||
| #else | |||||
| pthread_mutex_init(&fMutex, nullptr); | pthread_mutex_init(&fMutex, nullptr); | ||||
| #endif | |||||
| } | } | ||||
| /* | /* | ||||
| @@ -43,7 +52,11 @@ public: | |||||
| */ | */ | ||||
| ~CarlaMutex() noexcept | ~CarlaMutex() noexcept | ||||
| { | { | ||||
| #if 0 //def CARLA_OS_WIN | |||||
| DeleteCriticalSection(&fSection); | |||||
| #else | |||||
| pthread_mutex_destroy(&fMutex); | pthread_mutex_destroy(&fMutex); | ||||
| #endif | |||||
| } | } | ||||
| /* | /* | ||||
| @@ -61,7 +74,16 @@ public: | |||||
| */ | */ | ||||
| void lock() const noexcept | void lock() const noexcept | ||||
| { | { | ||||
| #if 0 //def CARLA_OS_WIN | |||||
| EnterCriticalSection(&fSection); | |||||
| for (;fAlreadyLocked;) | |||||
| Sleep(500); | |||||
| fAlreadyLocked = true; | |||||
| #else | |||||
| pthread_mutex_lock(&fMutex); | pthread_mutex_lock(&fMutex); | ||||
| #endif | |||||
| } | } | ||||
| /* | /* | ||||
| @@ -72,7 +94,21 @@ public: | |||||
| { | { | ||||
| fTryLockWasCalled = true; | fTryLockWasCalled = true; | ||||
| #if 0 //def CARLA_OS_WIN | |||||
| if (TryEnterCriticalSection(&fSection) == FALSE) | |||||
| return false; | |||||
| if (fAlreadyLocked) | |||||
| { | |||||
| LeaveCriticalSection(&fSection); | |||||
| return false; | |||||
| } | |||||
| fAlreadyLocked = true; | |||||
| return true; | |||||
| #else | |||||
| return (pthread_mutex_trylock(&fMutex) == 0); | return (pthread_mutex_trylock(&fMutex) == 0); | ||||
| #endif | |||||
| } | } | ||||
| /* | /* | ||||
| @@ -83,12 +119,22 @@ public: | |||||
| if (resetTryLock) | if (resetTryLock) | ||||
| fTryLockWasCalled = false; | fTryLockWasCalled = false; | ||||
| #if 0 //def CARLA_OS_WIN | |||||
| fAlreadyLocked = false; | |||||
| LeaveCriticalSection(&fSection); | |||||
| #else | |||||
| pthread_mutex_unlock(&fMutex); | pthread_mutex_unlock(&fMutex); | ||||
| #endif | |||||
| } | } | ||||
| private: | private: | ||||
| mutable pthread_mutex_t fMutex; // The mutex | |||||
| mutable volatile bool fTryLockWasCalled; // true if "tryLock()" was called at least once | |||||
| #if 0 //def CARLA_OS_WIN | |||||
| mutable volatile bool fAlreadyLocked; | |||||
| mutable CRITICAL_SECTION fSection; | |||||
| #else | |||||
| mutable pthread_mutex_t fMutex; | |||||
| #endif | |||||
| mutable volatile bool fTryLockWasCalled; // true if "tryLock()" was called at least once | |||||
| CARLA_PREVENT_HEAP_ALLOCATION | CARLA_PREVENT_HEAP_ALLOCATION | ||||
| CARLA_DECLARE_NON_COPY_CLASS(CarlaMutex) | CARLA_DECLARE_NON_COPY_CLASS(CarlaMutex) | ||||
| @@ -35,6 +35,7 @@ | |||||
| #ifdef CARLA_OS_WIN | #ifdef CARLA_OS_WIN | ||||
| # include <ctime> | # include <ctime> | ||||
| # include "juce_core.h" | |||||
| #else | #else | ||||
| # include <cerrno> | # include <cerrno> | ||||
| # include <fcntl.h> | # include <fcntl.h> | ||||