Browse Source

Carla: Fix cx-freeze builds, allow carla-discovery-native

tags/v0.9.0
falkTX 13 years ago
parent
commit
f34fc5b897
6 changed files with 89 additions and 61 deletions
  1. +13
    -10
      c++/carla-backend/carla_backend.h
  2. +1
    -1
      c++/carla-includes/carla_includes.h
  3. +3
    -2
      src/carla.py
  4. +42
    -35
      src/carla_backend.py
  5. +1
    -1
      src/shared.py
  6. +29
    -12
      src/shared_carla.py

+ 13
- 10
c++/carla-backend/carla_backend.h View File

@@ -83,7 +83,8 @@ enum BinaryType {
BINARY_UNIX32 = 1, //!< Unix 32bit. BINARY_UNIX32 = 1, //!< Unix 32bit.
BINARY_UNIX64 = 2, //!< Unix 64bit. BINARY_UNIX64 = 2, //!< Unix 64bit.
BINARY_WIN32 = 3, //!< Windows 32bit. 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 { 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 { 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 { enum CustomDataType {


+ 1
- 1
c++/carla-includes/carla_includes.h View File

@@ -80,7 +80,7 @@
# endif # endif
#else #else
# warning Unknown binary type # warning Unknown binary type
# define BINARY_NATIVE BINARY_NONE
# define BINARY_NATIVE BINARY_OTHER
#endif #endif


// export symbols if needed // export symbols if needed


+ 3
- 2
src/carla.py View File

@@ -17,7 +17,7 @@
# For a full copy of the GNU General Public License see the COPYING file # For a full copy of the GNU General Public License see the COPYING file


# Imports (Global) # Imports (Global)
import json, os, sys
import json
from PyQt4.QtCore import Qt, QThread from PyQt4.QtCore import Qt, QThread
from PyQt4.QtGui import QApplication, QMainWindow, QTableWidgetItem from PyQt4.QtGui import QApplication, QMainWindow, QTableWidgetItem


@@ -1677,8 +1677,9 @@ def callback_function(action, plugin_id, value1, value2, value3):


if action == CALLBACK_DEBUG: if action == CALLBACK_DEBUG:
Carla.gui.emit(SIGNAL("DebugCallback(int, int, int, double)"), plugin_id, value1, value2, value3) 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) Carla.gui.emit(SIGNAL("ParameterCallback(int, int, double)"), plugin_id, value1, value3)
# TODO param midi callbacks
elif action == CALLBACK_PROGRAM_CHANGED: elif action == CALLBACK_PROGRAM_CHANGED:
Carla.gui.emit(SIGNAL("ProgramCallback(int, int)"), plugin_id, value1) Carla.gui.emit(SIGNAL("ProgramCallback(int, int)"), plugin_id, value1)
elif action == CALLBACK_MIDI_PROGRAM_CHANGED: elif action == CALLBACK_MIDI_PROGRAM_CHANGED:


+ 42
- 35
src/carla_backend.py View File

@@ -17,7 +17,7 @@
# For a full copy of the GNU General Public License see the COPYING file # For a full copy of the GNU General Public License see the COPYING file


# Imports (Global) # Imports (Global)
import os, sys
import os
from ctypes import * from ctypes import *
from copy import deepcopy from copy import deepcopy
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
@@ -32,11 +32,6 @@ except:
print("LRDF Support not available (LADSPA-RDF will be disabled)") print("LRDF Support not available (LADSPA-RDF will be disabled)")
haveLRDF = False haveLRDF = False


if sys.int_info[1] == 4 or sys.platform == "win64":
is64bit = True
else:
is64bit = False

# Convert a ctypes struct into a dict # Convert a ctypes struct into a dict
def struct_to_dict(struct): def struct_to_dict(struct):
return dict((attr, getattr(struct, attr)) for attr, value in struct._fields_) return dict((attr, getattr(struct, attr)) for attr, value in struct._fields_)
@@ -181,6 +176,7 @@ else:
global carla_library_path global carla_library_path
carla_library_path = "" carla_library_path = ""


carla_discovery_native = ""
carla_discovery_unix32 = "" carla_discovery_unix32 = ""
carla_discovery_unix64 = "" carla_discovery_unix64 = ""
carla_discovery_win32 = "" carla_discovery_win32 = ""
@@ -203,15 +199,17 @@ elif MACOS:
else: else:
carla_libname = "carla_backend.so" carla_libname = "carla_backend.so"


CWD = sys.path[0]
CWD = sys.path[0]
CWDpp = os.path.join(CWDpp, "..", "c++")


# make it work with cxfreeze # 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 # 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: else:
if WINDOWS: if WINDOWS:
CARLA_PATH = (os.path.join(PROGRAMFILES, "Cadence", "carla"),) CARLA_PATH = (os.path.join(PROGRAMFILES, "Cadence", "carla"),)
@@ -226,9 +224,18 @@ else:
carla_library_path = os.path.join(p, "carla", carla_libname) carla_library_path = os.path.join(p, "carla", carla_libname)
break 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 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-discovery-unix32")): if os.path.exists(os.path.join(p, "carla-discovery-unix32")):
@@ -236,8 +243,8 @@ else:
break break


# find carla_discovery_unix64 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-discovery-unix64")): if os.path.exists(os.path.join(p, "carla-discovery-unix64")):
@@ -245,8 +252,8 @@ else:
break break


# find carla_discovery_win32 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-discovery-wine32.exe")): if os.path.exists(os.path.join(p, "carla-discovery-wine32.exe")):
@@ -254,8 +261,8 @@ else:
break break


# find carla_discovery_win64 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-discovery-win64.exe")): if os.path.exists(os.path.join(p, "carla-discovery-win64.exe")):
@@ -263,8 +270,8 @@ else:
break break


# find carla_bridge_unix32 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-bridge-unix32")): if os.path.exists(os.path.join(p, "carla-bridge-unix32")):
@@ -272,8 +279,8 @@ else:
break break


# find carla_bridge_unix64 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-bridge-unix64")): if os.path.exists(os.path.join(p, "carla-bridge-unix64")):
@@ -281,8 +288,8 @@ else:
break break


# find carla_bridge_win32 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-bridge-wine32.exe")): if os.path.exists(os.path.join(p, "carla-bridge-wine32.exe")):
@@ -290,8 +297,8 @@ else:
break break


# find carla_bridge_win64 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-bridge-win64.exe")): if os.path.exists(os.path.join(p, "carla-bridge-win64.exe")):
@@ -299,8 +306,8 @@ else:
break break


# find carla_bridge_lv2_gtk2 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-bridge-lv2-gtk2")): if os.path.exists(os.path.join(p, "carla-bridge-lv2-gtk2")):
@@ -308,8 +315,8 @@ else:
break break


# find carla_bridge_lv2_qt4 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-bridge-lv2-qt4")): if os.path.exists(os.path.join(p, "carla-bridge-lv2-qt4")):
@@ -317,8 +324,8 @@ else:
break break


# find carla_bridge_lv2_x11 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-bridge-lv2-x11")): if os.path.exists(os.path.join(p, "carla-bridge-lv2-x11")):
@@ -326,8 +333,8 @@ else:
break break


# find carla_bridge_vst_x11 # 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: else:
for p in PATH: for p in PATH:
if os.path.exists(os.path.join(p, "carla-bridge-vst-x11")): if os.path.exists(os.path.join(p, "carla-bridge-vst-x11")):


+ 1
- 1
src/shared.py View File

@@ -40,7 +40,7 @@ elif "linux" in sys.platform:
LINUX = True LINUX = True
MACOS = False MACOS = False
WINDOWS = False WINDOWS = False
elif sys.platform in ("win32", "win64"):
elif sys.platform in ("win32", "win64", "cygwin"):
HAIKU = False HAIKU = False
LINUX = False LINUX = False
MACOS = False MACOS = False


+ 29
- 12
src/shared_carla.py View File

@@ -17,6 +17,7 @@
# For a full copy of the GNU General Public License see the COPYING file # For a full copy of the GNU General Public License see the COPYING file


# Imports (Global) # Imports (Global)
import sys
from copy import deepcopy from copy import deepcopy
from sip import unwrapinstance from sip import unwrapinstance
from PyQt4.QtCore import pyqtSlot, QSettings, QTimer from PyQt4.QtCore import pyqtSlot, QSettings, QTimer
@@ -42,6 +43,8 @@ Carla.Host = None
Carla.gui = None Carla.gui = None
Carla.isControl = False Carla.isControl = False


is64bit = bool(platform.architecture()[0] == "64bit" and sys.maxsize > 2**32)

# ------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------
# Backend defines # Backend defines


@@ -74,7 +77,7 @@ BINARY_UNIX32 = 1
BINARY_UNIX64 = 2 BINARY_UNIX64 = 2
BINARY_WIN32 = 3 BINARY_WIN32 = 3
BINARY_WIN64 = 4 BINARY_WIN64 = 4
# TODO - use POSIX instead
BINARY_OTHER = 5


# enum PluginType # enum PluginType
PLUGIN_NONE = 0 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 PLUGIN_CATEGORY_OTHER = 8 # used to check if a plugin has a category


# enum ParameterType # 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 # 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 # enum CustomDataType
CUSTOM_DATA_INVALID = 0 CUSTOM_DATA_INVALID = 0
@@ -154,7 +158,7 @@ OPTION_PATH_BRIDGE_VST_X11 = 22


# enum CallbackType # enum CallbackType
CALLBACK_DEBUG = 0 CALLBACK_DEBUG = 0
CALLBACK_PARAMETER_CHANGED = 1
CALLBACK_PARAMETER_VALUE_CHANGED = 1
CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 2 CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 2
CALLBACK_PARAMETER_MIDI_CC_CHANGED = 3 CALLBACK_PARAMETER_MIDI_CC_CHANGED = 3
CALLBACK_PROGRAM_CHANGED = 4 CALLBACK_PROGRAM_CHANGED = 4
@@ -181,6 +185,19 @@ PROCESS_MODE_CONTINUOUS_RACK = 2
Carla.processMode = PROCESS_MODE_MULTIPLE_CLIENTS Carla.processMode = PROCESS_MODE_MULTIPLE_CLIENTS
Carla.maxParameters = MAX_PARAMETERS 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_NULL = 0
ICON_STATE_WAIT = 1 ICON_STATE_WAIT = 1
ICON_STATE_OFF = 2 ICON_STATE_OFF = 2


Loading…
Cancel
Save