diff --git a/c++/carla-backend/carla_backend.h b/c++/carla-backend/carla_backend.h index 99b9d31..fa202ac 100644 --- a/c++/carla-backend/carla_backend.h +++ b/c++/carla-backend/carla_backend.h @@ -83,7 +83,8 @@ enum BinaryType { BINARY_UNIX32 = 1, //!< Unix 32bit. BINARY_UNIX64 = 2, //!< Unix 64bit. BINARY_WIN32 = 3, //!< Windows 32bit. - BINARY_WIN64 = 4 //!< Windows 64bit. + BINARY_WIN64 = 4, //!< Windows 64bit. + BINARY_OTHER = 5 //!< Other. }; /*! @@ -114,18 +115,20 @@ enum PluginCategory { }; enum ParameterType { - PARAMETER_UNKNOWN = 0, - PARAMETER_INPUT = 1, - PARAMETER_OUTPUT = 2, - PARAMETER_LATENCY = 3 + PARAMETER_UNKNOWN = 0, + PARAMETER_INPUT = 1, + PARAMETER_OUTPUT = 2, + PARAMETER_LATENCY = 3, + PARAMETER_SAMPLE_RATE = 4 }; enum InternalParametersIndex { - PARAMETER_ACTIVE = -1, - PARAMETER_DRYWET = -2, - PARAMETER_VOLUME = -3, - PARAMETER_BALANCE_LEFT = -4, - PARAMETER_BALANCE_RIGHT = -5 + PARAMETER_NULL = -1, + PARAMETER_ACTIVE = -2, + PARAMETER_DRYWET = -3, + PARAMETER_VOLUME = -4, + PARAMETER_BALANCE_LEFT = -5, + PARAMETER_BALANCE_RIGHT = -6 }; enum CustomDataType { diff --git a/c++/carla-includes/carla_includes.h b/c++/carla-includes/carla_includes.h index a29ad39..6816112 100644 --- a/c++/carla-includes/carla_includes.h +++ b/c++/carla-includes/carla_includes.h @@ -80,7 +80,7 @@ # endif #else # warning Unknown binary type -# define BINARY_NATIVE BINARY_NONE +# define BINARY_NATIVE BINARY_OTHER #endif // export symbols if needed diff --git a/src/carla.py b/src/carla.py index 904ec7b..e6e71ba 100755 --- a/src/carla.py +++ b/src/carla.py @@ -17,7 +17,7 @@ # For a full copy of the GNU General Public License see the COPYING file # Imports (Global) -import json, os, sys +import json from PyQt4.QtCore import Qt, QThread from PyQt4.QtGui import QApplication, QMainWindow, QTableWidgetItem @@ -1677,8 +1677,9 @@ def callback_function(action, plugin_id, value1, value2, value3): if action == CALLBACK_DEBUG: Carla.gui.emit(SIGNAL("DebugCallback(int, int, int, double)"), plugin_id, value1, value2, value3) - elif action == CALLBACK_PARAMETER_CHANGED: + elif action == CALLBACK_PARAMETER_VALUE_CHANGED: Carla.gui.emit(SIGNAL("ParameterCallback(int, int, double)"), plugin_id, value1, value3) + # TODO param midi callbacks elif action == CALLBACK_PROGRAM_CHANGED: Carla.gui.emit(SIGNAL("ProgramCallback(int, int)"), plugin_id, value1) elif action == CALLBACK_MIDI_PROGRAM_CHANGED: diff --git a/src/carla_backend.py b/src/carla_backend.py index 45eb371..1dede82 100644 --- a/src/carla_backend.py +++ b/src/carla_backend.py @@ -17,7 +17,7 @@ # For a full copy of the GNU General Public License see the COPYING file # Imports (Global) -import os, sys +import os from ctypes import * from copy import deepcopy from subprocess import Popen, PIPE @@ -32,11 +32,6 @@ except: print("LRDF Support not available (LADSPA-RDF will be disabled)") haveLRDF = False -if sys.int_info[1] == 4 or sys.platform == "win64": - is64bit = True -else: - is64bit = False - # Convert a ctypes struct into a dict def struct_to_dict(struct): return dict((attr, getattr(struct, attr)) for attr, value in struct._fields_) @@ -181,6 +176,7 @@ else: global carla_library_path carla_library_path = "" +carla_discovery_native = "" carla_discovery_unix32 = "" carla_discovery_unix64 = "" carla_discovery_win32 = "" @@ -203,15 +199,17 @@ elif MACOS: else: carla_libname = "carla_backend.so" -CWD = sys.path[0] +CWD = sys.path[0] +CWDpp = os.path.join(CWDpp, "..", "c++") # make it work with cxfreeze -if CWD.endswith("/carla"): - CWD = CWD.rsplit("/carla", 1)[0] +if CWD.endswith(os.sep+"carla"): + CWD = CWD.rsplit(os.sep+"carla",1)[0] + CWDpp = CWD # find carla_library_path -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-backend", carla_libname)): - carla_library_path = os.path.join(CWD, "..", "c++", "carla-backend", carla_libname) +if os.path.exists(os.path.join(CWDpp, "carla-backend", carla_libname)): + carla_library_path = os.path.join(CWDpp, "carla-backend", carla_libname) else: if WINDOWS: CARLA_PATH = (os.path.join(PROGRAMFILES, "Cadence", "carla"),) @@ -226,9 +224,18 @@ else: carla_library_path = os.path.join(p, "carla", carla_libname) break +# find carla_discovery_native +if os.path.exists(os.path.join(CWDpp, "carla-discovery", "carla-discovery-native")): + carla_discovery_unix32 = os.path.join(CWDpp, "carla-discovery", "carla-discovery-native") +else: + for p in PATH: + if os.path.exists(os.path.join(p, "carla-discovery-native")): + carla_discovery_unix32 = os.path.join(p, "carla-discovery-native") + break + # find carla_discovery_unix32 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-discovery", "carla-discovery-unix32")): - carla_discovery_unix32 = os.path.join(CWD, "..", "c++", "carla-discovery", "carla-discovery-unix32") +if os.path.exists(os.path.join(CWDpp, "carla-discovery", "carla-discovery-unix32")): + carla_discovery_unix32 = os.path.join(CWDpp, "carla-discovery", "carla-discovery-unix32") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-discovery-unix32")): @@ -236,8 +243,8 @@ else: break # find carla_discovery_unix64 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-discovery", "carla-discovery-unix64")): - carla_discovery_unix64 = os.path.join(CWD, "..", "c++", "carla-discovery", "carla-discovery-unix64") +if os.path.exists(os.path.join(CWDpp, "carla-discovery", "carla-discovery-unix64")): + carla_discovery_unix64 = os.path.join(CWDpp, "carla-discovery", "carla-discovery-unix64") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-discovery-unix64")): @@ -245,8 +252,8 @@ else: break # find carla_discovery_win32 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-discovery", "carla-discovery-win32.exe")): - carla_discovery_win32 = os.path.join(CWD, "..", "c++", "carla-discovery", "carla-discovery-win32.exe") +if os.path.exists(os.path.join(CWDpp, "carla-discovery", "carla-discovery-win32.exe")): + carla_discovery_win32 = os.path.join(CWDpp, "carla-discovery", "carla-discovery-win32.exe") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-discovery-wine32.exe")): @@ -254,8 +261,8 @@ else: break # find carla_discovery_win64 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-discovery", "carla-discovery-win64.exe")): - carla_discovery_win64 = os.path.join(CWD, "..", "c++", "carla-discovery", "carla-discovery-win64.exe") +if os.path.exists(os.path.join(CWDpp, "carla-discovery", "carla-discovery-win64.exe")): + carla_discovery_win64 = os.path.join(CWDpp, "carla-discovery", "carla-discovery-win64.exe") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-discovery-win64.exe")): @@ -263,8 +270,8 @@ else: break # find carla_bridge_unix32 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-unix32")): - carla_bridge_unix32 = os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-unix32") +if os.path.exists(os.path.join(CWDpp, "carla-bridge", "carla-bridge-unix32")): + carla_bridge_unix32 = os.path.join(CWDpp, "carla-bridge", "carla-bridge-unix32") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-bridge-unix32")): @@ -272,8 +279,8 @@ else: break # find carla_bridge_unix64 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-unix64")): - carla_bridge_unix64 = os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-unix64") +if os.path.exists(os.path.join(CWDpp, "carla-bridge", "carla-bridge-unix64")): + carla_bridge_unix64 = os.path.join(CWDpp, "carla-bridge", "carla-bridge-unix64") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-bridge-unix64")): @@ -281,8 +288,8 @@ else: break # find carla_bridge_win32 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-win32.exe")): - carla_bridge_win32 = os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-win32.exe") +if os.path.exists(os.path.join(CWDpp, "carla-bridge", "carla-bridge-win32.exe")): + carla_bridge_win32 = os.path.join(CWDpp, "carla-bridge", "carla-bridge-win32.exe") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-bridge-wine32.exe")): @@ -290,8 +297,8 @@ else: break # find carla_bridge_win64 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-win64.exe")): - carla_bridge_win64 = os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-win64.exe") +if os.path.exists(os.path.join(CWDpp, "carla-bridge", "carla-bridge-win64.exe")): + carla_bridge_win64 = os.path.join(CWDpp, "carla-bridge", "carla-bridge-win64.exe") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-bridge-win64.exe")): @@ -299,8 +306,8 @@ else: break # find carla_bridge_lv2_gtk2 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-lv2-gtk2")): - carla_bridge_lv2_gtk2 = os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-lv2-gtk2") +if os.path.exists(os.path.join(CWDpp, "carla-bridge", "carla-bridge-lv2-gtk2")): + carla_bridge_lv2_gtk2 = os.path.join(CWDpp, "carla-bridge", "carla-bridge-lv2-gtk2") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-bridge-lv2-gtk2")): @@ -308,8 +315,8 @@ else: break # find carla_bridge_lv2_qt4 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-lv2-qt4")): - carla_bridge_lv2_qt4 = os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-lv2-qt4") +if os.path.exists(os.path.join(CWDpp, "carla-bridge", "carla-bridge-lv2-qt4")): + carla_bridge_lv2_qt4 = os.path.join(CWDpp, "carla-bridge", "carla-bridge-lv2-qt4") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-bridge-lv2-qt4")): @@ -317,8 +324,8 @@ else: break # find carla_bridge_lv2_x11 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-lv2-x11")): - carla_bridge_lv2_x11 = os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-lv2-x11") +if os.path.exists(os.path.join(CWDpp, "carla-bridge", "carla-bridge-lv2-x11")): + carla_bridge_lv2_x11 = os.path.join(CWDpp, "carla-bridge", "carla-bridge-lv2-x11") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-bridge-lv2-x11")): @@ -326,8 +333,8 @@ else: break # find carla_bridge_vst_x11 -if os.path.exists(os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-vst-x11")): - carla_bridge_vst_x11 = os.path.join(CWD, "..", "c++", "carla-bridge", "carla-bridge-vst-x11") +if os.path.exists(os.path.join(CWDpp, "carla-bridge", "carla-bridge-vst-x11")): + carla_bridge_vst_x11 = os.path.join(CWDpp, "carla-bridge", "carla-bridge-vst-x11") else: for p in PATH: if os.path.exists(os.path.join(p, "carla-bridge-vst-x11")): diff --git a/src/shared.py b/src/shared.py index aff5ac6..99a50e8 100644 --- a/src/shared.py +++ b/src/shared.py @@ -40,7 +40,7 @@ elif "linux" in sys.platform: LINUX = True MACOS = False WINDOWS = False -elif sys.platform in ("win32", "win64"): +elif sys.platform in ("win32", "win64", "cygwin"): HAIKU = False LINUX = False MACOS = False diff --git a/src/shared_carla.py b/src/shared_carla.py index 2044ddb..d5affa9 100644 --- a/src/shared_carla.py +++ b/src/shared_carla.py @@ -17,6 +17,7 @@ # For a full copy of the GNU General Public License see the COPYING file # Imports (Global) +import sys from copy import deepcopy from sip import unwrapinstance from PyQt4.QtCore import pyqtSlot, QSettings, QTimer @@ -42,6 +43,8 @@ Carla.Host = None Carla.gui = None Carla.isControl = False +is64bit = bool(platform.architecture()[0] == "64bit" and sys.maxsize > 2**32) + # ------------------------------------------------------------------------------------------------ # Backend defines @@ -74,7 +77,7 @@ BINARY_UNIX32 = 1 BINARY_UNIX64 = 2 BINARY_WIN32 = 3 BINARY_WIN64 = 4 -# TODO - use POSIX instead +BINARY_OTHER = 5 # enum PluginType PLUGIN_NONE = 0 @@ -98,18 +101,19 @@ PLUGIN_CATEGORY_UTILITY = 7 # Analyzer, Converter, Mixer PLUGIN_CATEGORY_OTHER = 8 # used to check if a plugin has a category # enum ParameterType -PARAMETER_UNKNOWN = 0 -PARAMETER_INPUT = 1 -PARAMETER_OUTPUT = 2 -PARAMETER_LATENCY = 3 -# TODO - add PARAMETER_SAMPLE_RATE +PARAMETER_UNKNOWN = 0 +PARAMETER_INPUT = 1 +PARAMETER_OUTPUT = 2 +PARAMETER_LATENCY = 3 +PARAMETER_SAMPLE_RATE = 4 # enum InternalParametersIndex -PARAMETER_ACTIVE = -1 -PARAMETER_DRYWET = -2 -PARAMETER_VOLUME = -3 -PARAMETER_BALANCE_LEFT = -4 -PARAMETER_BALANCE_RIGHT = -5 +PARAMETER_NULL = -1 +PARAMETER_ACTIVE = -2 +PARAMETER_DRYWET = -3 +PARAMETER_VOLUME = -4 +PARAMETER_BALANCE_LEFT = -5 +PARAMETER_BALANCE_RIGHT = -6 # enum CustomDataType CUSTOM_DATA_INVALID = 0 @@ -154,7 +158,7 @@ OPTION_PATH_BRIDGE_VST_X11 = 22 # enum CallbackType CALLBACK_DEBUG = 0 -CALLBACK_PARAMETER_CHANGED = 1 +CALLBACK_PARAMETER_VALUE_CHANGED = 1 CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 2 CALLBACK_PARAMETER_MIDI_CC_CHANGED = 3 CALLBACK_PROGRAM_CHANGED = 4 @@ -181,6 +185,19 @@ PROCESS_MODE_CONTINUOUS_RACK = 2 Carla.processMode = PROCESS_MODE_MULTIPLE_CLIENTS Carla.maxParameters = MAX_PARAMETERS +# set native binary type +if LINUX or MACOS: + BINARY_NATIVE = BINARY_UNIX64 if is64bit BINARY_UNIX32 +elif WINDOWS: + BINARY_NATIVE = BINARY_WIN64 if is64bit BINARY_WIN32 +else: + BINARY_NATIVE = BINARY_OTHER + +BINARY_NATIVE = BINARY_UNIX64 +BINARY_NATIVE = BINARY_WIN32 +BINARY_NATIVE = BINARY_WIN64 +BINARY_NATIVE = BINARY_OTHER + ICON_STATE_NULL = 0 ICON_STATE_WAIT = 1 ICON_STATE_OFF = 2