Browse Source

More work to get rid of python global variables, DO NOT USE yet

tags/1.9.5
falkTX 11 years ago
parent
commit
8202485a6a
11 changed files with 385 additions and 390 deletions
  1. +10
    -8
      source/carla
  2. +6
    -11
      source/carla-patchbay
  3. +6
    -11
      source/carla-rack
  4. +16
    -0
      source/carla_backend.py
  5. +46
    -42
      source/carla_database.py
  6. +133
    -139
      source/carla_host.py
  7. +58
    -47
      source/carla_patchbay.py
  8. +30
    -16
      source/carla_rack.py
  9. +2
    -34
      source/carla_shared.py
  10. +77
    -81
      source/carla_skin.py
  11. +1
    -1
      source/carla_widgets.py

+ 10
- 8
source/carla View File

@@ -42,11 +42,11 @@ from carla_rack import CarlaRackW
# Tab widget (rack + patchbay)

class CarlaMultiW(QTabWidget):
def __init__(self, parent):
def __init__(self, parent, host):
QTabWidget.__init__(self, parent)

self.fRack = CarlaRackW(parent, False)
self.fPatchbay = CarlaPatchbayW(parent, False, False)
self.fRack = CarlaRackW(parent, host, False)
self.fPatchbay = CarlaPatchbayW(parent, host, False, False)
self.fParent = parent

self.fUseCustomPaint = False
@@ -215,13 +215,13 @@ class CarlaMultiW(QTabWidget):
# Main Window

class CarlaHostW(HostWindow):
def __init__(self, parent=None):
HostWindow.__init__(self, parent)
def __init__(self, host):
HostWindow.__init__(self, host)

# -------------------------------------------------------------
# Set-up container

self.fContainer = CarlaMultiW(self)
self.fContainer = CarlaMultiW(self, host)
self.setupContainer(True, self.fContainer.fPatchbay.themeData)

self.fContainer.setUseCustomPaint(self.fSavedSettings[CARLA_KEY_CUSTOM_PAINTING])
@@ -370,12 +370,14 @@ if __name__ == '__main__':
gCarla.isLocal = True
gCarla.isPlugin = False

initHost(initName, libPrefix)
host = initHost(initName, libPrefix)
host.isControl = False
host.isPlugin = False

# -------------------------------------------------------------
# Create GUI

gCarla.gui = CarlaHostW()
gCarla.gui = CarlaHostW(host)

# -------------------------------------------------------------
# Load project file if set


+ 6
- 11
source/carla-patchbay View File

@@ -26,10 +26,10 @@ from carla_patchbay import CarlaPatchbayW
# Main Window

class CarlaHostW(HostWindow):
def __init__(self, parent=None):
HostWindow.__init__(self, parent)
def __init__(self, host):
HostWindow.__init__(self, host)

self.fContainer = CarlaPatchbayW(self)
self.fContainer = CarlaPatchbayW(self, host)
self.setupContainer(True, self.fContainer.themeData)

# ------------------------------------------------------------------------------------------------------------
@@ -62,18 +62,13 @@ if __name__ == '__main__':
# -------------------------------------------------------------
# Init host backend

gCarla.isControl = False
gCarla.isLocal = True
gCarla.isPlugin = False
gCarla.processMode = ENGINE_PROCESS_MODE_PATCHBAY
gCarla.processModeForced = True

initHost(initName, libPrefix)
host = initHost(initName, libPrefix, False, False, True)
host.processMode = ENGINE_PROCESS_MODE_PATCHBAY

# -------------------------------------------------------------
# Create GUI

gCarla.gui = CarlaHostW()
gCarla.gui = CarlaHostW(host)

# -------------------------------------------------------------
# Load project file if set


+ 6
- 11
source/carla-rack View File

@@ -26,10 +26,10 @@ from carla_rack import CarlaRackW
# Main Window

class CarlaHostW(HostWindow):
def __init__(self, parent=None):
HostWindow.__init__(self, parent)
def __init__(self, host):
HostWindow.__init__(self, host)

self.fContainer = CarlaRackW(self)
self.fContainer = CarlaRackW(self, host)
self.setupContainer(False)

# ------------------------------------------------------------------------------------------------------------
@@ -62,18 +62,13 @@ if __name__ == '__main__':
# -------------------------------------------------------------
# Init host backend

gCarla.isControl = False
gCarla.isLocal = True
gCarla.isPlugin = False
gCarla.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK
gCarla.processModeForced = True

initHost(initName, libPrefix)
host = initHost(initName, libPrefix, False, False, True)
host.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK

# -------------------------------------------------------------
# Create GUI

gCarla.gui = CarlaHostW()
gCarla.gui = CarlaHostW(host)

# -------------------------------------------------------------
# Load project file if set


+ 16
- 0
source/carla_backend.py View File

@@ -1244,6 +1244,22 @@ class CarlaHostMeta(object):
self.isControl = False
self.isPlugin = False

# settings
self.processMode = 0
self.transportMode = 0

# settings
self.forceStereo = False
self.preferPluginBridges = False
self.preferUIBridges = False
self.uisAlwaysOnTop = False
self.maxParameters = 0
self.uiBridgesTimeout = 0

# settings
self.pathBinaries = ""
self.pathResources = ""

# use _putenv on windows
if not WINDOWS:
self.msvcrt = None


+ 46
- 42
source/carla_database.py View File

@@ -334,10 +334,11 @@ def checkFileSFZ(filename, tool):
class SearchPluginsThread(QThread):
pluginLook = pyqtSignal(int, str)

def __init__(self, parent):
def __init__(self, parent, pathBinaries):
QThread.__init__(self, parent)

self.fContinueChecking = False
self.fPathBinaries = pathBinaries

self.fCheckNative = False
self.fCheckPosix32 = False
@@ -360,7 +361,7 @@ class SearchPluginsThread(QThread):
else:
toolNative = "carla-discovery-native"

self.fToolNative = os.path.join(gCarla.pathBinaries, toolNative)
self.fToolNative = os.path.join(pathBinaries, toolNative)

if not os.path.exists(self.fToolNative):
self.fToolNative = ""
@@ -485,25 +486,25 @@ class SearchPluginsThread(QThread):
if not self.fContinueChecking: return

if self.fCheckPosix32:
self._checkLADSPA(OS, os.path.join(gCarla.pathBinaries, "carla-discovery-posix32"))
self._checkLADSPA(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
settingsDB.setValue("Plugins/LADSPA_posix32", self.fLadspaPlugins)

if not self.fContinueChecking: return

if self.fCheckPosix64:
self._checkLADSPA(OS, os.path.join(gCarla.pathBinaries, "carla-discovery-posix64"))
self._checkLADSPA(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
settingsDB.setValue("Plugins/LADSPA_posix64", self.fLadspaPlugins)

if not self.fContinueChecking: return

if self.fCheckWin32:
self._checkLADSPA("WINDOWS", os.path.join(gCarla.pathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
self._checkLADSPA("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
settingsDB.setValue("Plugins/LADSPA_win32", self.fLadspaPlugins)

if not self.fContinueChecking: return

if self.fCheckWin64:
self._checkLADSPA("WINDOWS", os.path.join(gCarla.pathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
self._checkLADSPA("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
settingsDB.setValue("Plugins/LADSPA_win64", self.fLadspaPlugins)

settingsDB.sync()
@@ -535,25 +536,25 @@ class SearchPluginsThread(QThread):
if not self.fContinueChecking: return

if self.fCheckPosix32:
self._checkDSSI(OS, os.path.join(gCarla.pathBinaries, "carla-discovery-posix32"))
self._checkDSSI(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
settingsDB.setValue("Plugins/DSSI_posix32", self.fDssiPlugins)

if not self.fContinueChecking: return

if self.fCheckPosix64:
self._checkDSSI(OS, os.path.join(gCarla.pathBinaries, "carla-discovery-posix64"))
self._checkDSSI(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
settingsDB.setValue("Plugins/DSSI_posix64", self.fDssiPlugins)

if not self.fContinueChecking: return

if self.fCheckWin32:
self._checkDSSI("WINDOWS", os.path.join(gCarla.pathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
self._checkDSSI("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
settingsDB.setValue("Plugins/DSSI_win32", self.fDssiPlugins)

if not self.fContinueChecking: return

if self.fCheckWin64:
self._checkDSSI("WINDOWS", os.path.join(gCarla.pathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
self._checkDSSI("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
settingsDB.setValue("Plugins/DSSI_win64", self.fDssiPlugins)

settingsDB.sync()
@@ -568,25 +569,25 @@ class SearchPluginsThread(QThread):
if not self.fContinueChecking: return

if self.fCheckPosix32:
self._checkLV2(os.path.join(gCarla.pathBinaries, "carla-discovery-posix32"))
self._checkLV2(os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
settingsDB.setValue("Plugins/LV2_posix32", self.fLv2Plugins)

if not self.fContinueChecking: return

if self.fCheckPosix64:
self._checkLV2(os.path.join(gCarla.pathBinaries, "carla-discovery-posix64"))
self._checkLV2(os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
settingsDB.setValue("Plugins/LV2_posix64", self.fLv2Plugins)

if not self.fContinueChecking: return

if self.fCheckWin32:
self._checkLV2(os.path.join(gCarla.pathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
self._checkLV2(os.path.join(self.fPathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
settingsDB.setValue("Plugins/LV2_win32", self.fLv2Plugins)

if not self.fContinueChecking: return

if self.fCheckWin64:
self._checkLV2(os.path.join(gCarla.pathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
self._checkLV2(os.path.join(self.fPathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
settingsDB.setValue("Plugins/LV2_win64", self.fLv2Plugins)

settingsDB.sync()
@@ -601,25 +602,25 @@ class SearchPluginsThread(QThread):
if not self.fContinueChecking: return

if self.fCheckPosix32:
self._checkVST(OS, os.path.join(gCarla.pathBinaries, "carla-discovery-posix32"))
self._checkVST(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
settingsDB.setValue("Plugins/VST_posix32", self.fVstPlugins)

if not self.fContinueChecking: return

if self.fCheckPosix64:
self._checkVST(OS, os.path.join(gCarla.pathBinaries, "carla-discovery-posix64"))
self._checkVST(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
settingsDB.setValue("Plugins/VST_posix64", self.fVstPlugins)

if not self.fContinueChecking: return

if self.fCheckWin32:
self._checkVST("WINDOWS", os.path.join(gCarla.pathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
self._checkVST("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
settingsDB.setValue("Plugins/VST_win32", self.fVstPlugins)

if not self.fContinueChecking: return

if self.fCheckWin64:
self._checkVST("WINDOWS", os.path.join(gCarla.pathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
self._checkVST("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
settingsDB.setValue("Plugins/VST_win64", self.fVstPlugins)

settingsDB.sync()
@@ -634,25 +635,25 @@ class SearchPluginsThread(QThread):
if not self.fContinueChecking: return

if self.fCheckPosix32 and MACOS:
self._checkVST3(OS, os.path.join(gCarla.pathBinaries, "carla-discovery-posix32"))
self._checkVST3(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
settingsDB.setValue("Plugins/VST3_posix32", self.fVst3Plugins)

if not self.fContinueChecking: return

if self.fCheckPosix64 and MACOS:
self._checkVST3(OS, os.path.join(gCarla.pathBinaries, "carla-discovery-posix64"))
self._checkVST3(OS, os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
settingsDB.setValue("Plugins/VST3_posix64", self.fVst3Plugins)

if not self.fContinueChecking: return

if self.fCheckWin32:
self._checkVST3("WINDOWS", os.path.join(gCarla.pathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
self._checkVST3("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win32.exe"), not WINDOWS)
settingsDB.setValue("Plugins/VST3_win32", self.fVst3Plugins)

if not self.fContinueChecking: return

if self.fCheckWin64:
self._checkVST3("WINDOWS", os.path.join(gCarla.pathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
self._checkVST3("WINDOWS", os.path.join(self.fPathBinaries, "carla-discovery-win64.exe"), not WINDOWS)
settingsDB.setValue("Plugins/VST3_win64", self.fVst3Plugins)

settingsDB.sync()
@@ -667,13 +668,13 @@ class SearchPluginsThread(QThread):
if not self.fContinueChecking: return

if self.fCheckPosix32:
self._checkAU(os.path.join(gCarla.pathBinaries, "carla-discovery-posix32"))
self._checkAU(os.path.join(self.fPathBinaries, "carla-discovery-posix32"))
settingsDB.setValue("Plugins/AU_posix32", self.fAuPlugins)

if not self.fContinueChecking: return

if self.fCheckPosix64:
self._checkAU(os.path.join(gCarla.pathBinaries, "carla-discovery-posix64"))
self._checkAU(os.path.join(self.fPathBinaries, "carla-discovery-posix64"))
settingsDB.setValue("Plugins/AU_posix64", self.fAuPlugins)

settingsDB.sync()
@@ -964,15 +965,16 @@ class SearchPluginsThread(QThread):
# Plugin Refresh Dialog

class PluginRefreshW(QDialog):
def __init__(self, parent):
def __init__(self, parent, host):
QDialog.__init__(self, parent)
self.host = host
self.ui = ui_carla_refresh.Ui_PluginRefreshW()
self.ui.setupUi(self)

# -------------------------------------------------------------
# Internal stuff

self.fThread = SearchPluginsThread(self)
self.fThread = SearchPluginsThread(self, host.pathBinaries)

# -------------------------------------------------------------
# Load settings
@@ -997,11 +999,11 @@ class PluginRefreshW(QDialog):
self.ui.ch_posix32.setText("MacOS 32bit")
self.ui.ch_posix64.setText("MacOS 64bit")

hasNative = os.path.exists(os.path.join(gCarla.pathBinaries, "carla-discovery-native"))
hasPosix32 = os.path.exists(os.path.join(gCarla.pathBinaries, "carla-discovery-posix32"))
hasPosix64 = os.path.exists(os.path.join(gCarla.pathBinaries, "carla-discovery-posix64"))
hasWin32 = os.path.exists(os.path.join(gCarla.pathBinaries, "carla-discovery-win32.exe"))
hasWin64 = os.path.exists(os.path.join(gCarla.pathBinaries, "carla-discovery-win64.exe"))
hasNative = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-native"))
hasPosix32 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-posix32"))
hasPosix64 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-posix64"))
hasWin32 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-win32.exe"))
hasWin64 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-win64.exe"))

if hasPosix32 and not WINDOWS:
self.ui.ico_posix32.setPixmap(self.fIconYes)
@@ -1132,9 +1134,9 @@ class PluginRefreshW(QDialog):
self.ui.group_options.setEnabled(False)

if self.ui.ch_do_checks.isChecked():
gCarla.host.unsetenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS")
self.host.unsetenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS")
else:
gCarla.host.setenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS", "true")
self.host.setenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS", "true")

native, posix32, posix64, win32, win64 = (self.ui.ch_native.isChecked(),
self.ui.ch_posix32.isChecked(), self.ui.ch_posix64.isChecked(),
@@ -1237,8 +1239,9 @@ class PluginRefreshW(QDialog):
# Plugin Database Dialog

class PluginDatabaseW(QDialog):
def __init__(self, parent):
def __init__(self, parent, host):
QDialog.__init__(self, parent)
self.host = host
self.ui = ui_carla_database.Ui_PluginDatabaseW()
self.ui.setupUi(self)

@@ -1321,7 +1324,7 @@ class PluginDatabaseW(QDialog):

@pyqtSlot()
def slot_refreshPlugins(self):
if PluginRefreshW(self).exec_():
if PluginRefreshW(self, self.host).exec_():
self._reAddPlugins()

if self.fRealParent:
@@ -1509,14 +1512,14 @@ class PluginDatabaseW(QDialog):
for plugins in internalPlugins:
internalCount += len(plugins)

canRefreshInternals = not (gCarla.isControl or gCarla.isPlugin or gCarla.host is None)
canRefreshInternals = not (self.host.isControl or self.host.isPlugin)

if canRefreshInternals and internalCount != gCarla.host.get_internal_plugin_count():
internalCount = gCarla.host.get_internal_plugin_count()
if canRefreshInternals and internalCount != self.host.get_internal_plugin_count():
internalCount = self.host.get_internal_plugin_count()
internalPlugins = []

for i in range(gCarla.host.get_internal_plugin_count()):
descInfo = gCarla.host.get_internal_plugin_info(i)
for i in range(self.host.get_internal_plugin_count()):
descInfo = self.host.get_internal_plugin_info(i)
plugins = checkPluginInternal(descInfo)

if plugins:
@@ -1742,12 +1745,13 @@ class PluginDatabaseW(QDialog):

if __name__ == '__main__':
from carla_app import CarlaApplication
from carla_host import initHost

app = CarlaApplication()

initHost("Settings", None, False)
host = initHost("Settings", None, False, False, False)

gui = PluginDatabaseW(None)
gui = PluginDatabaseW(None, host)
gui.show()

sys.exit(app.exec_())

+ 133
- 139
source/carla_host.py View File

@@ -164,22 +164,24 @@ class HostWindow(QMainWindow):
SIGTERM = pyqtSignal()
SIGUSR1 = pyqtSignal()

def __init__(self, parent):
QMainWindow.__init__(self, parent)
def __init__(self, host):
QMainWindow.__init__(self)
self.host = host
self.ui = ui_carla_host.Ui_CarlaHostW()
self.ui.setupUi(self)

if False:
# kdevelop likes this :)
gCarla.gui = self
gCarla.host = Host("")
host = CarlaHostMeta()
self.host = CarlaHostMeta()
gCarla.gui = self
self.fContainer = CarlaDummyW(self)

if MACOS and config_UseQt5:
self.ui.act_file_quit.setMenuRole(QAction.QuitRole)
self.ui.act_settings_configure.setMenuRole(QAction.PreferencesRole)
self.ui.act_help_about.setMenuRole(QAction.AboutRole)
self.ui.act_help_about_juce.setMenuRole(QAction.AboutQtRole)
self.ui.act_help_about_juce.setMenuRole(QAction.AboutRole)
self.ui.act_help_about_qt.setMenuRole(QAction.AboutQtRole)
self.ui.menu_Settings.setTitle("Panels")
#self.ui.menu_Help.hide()
@@ -208,7 +210,7 @@ class HostWindow(QMainWindow):

self.fSavedSettings = {}

if gCarla.isPlugin:
if self.host.isPlugin:
self.fClientName = "Carla-Plugin"
self.fSessionManagerName = "Plugin"
elif LADISH_APP_NAME:
@@ -229,7 +231,7 @@ class HostWindow(QMainWindow):
# -------------------------------------------------------------
# Set up GUI (engine stopped)

if gCarla.isPlugin:
if self.host.isPlugin:
self.ui.act_engine_start.setEnabled(False)
self.ui.menu_Engine.setEnabled(False)
else:
@@ -244,12 +246,12 @@ class HostWindow(QMainWindow):
self.ui.act_engine_stop.setEnabled(False)
self.ui.act_plugin_remove_all.setEnabled(False)

if gCarla.externalPatchbay:
self.ui.act_canvas_show_internal.setChecked(False)
self.ui.act_canvas_show_external.setChecked(True)
else:
self.ui.act_canvas_show_internal.setChecked(True)
self.ui.act_canvas_show_external.setChecked(False)
#if gCarla.externalPatchbay:
#self.ui.act_canvas_show_internal.setChecked(False)
#self.ui.act_canvas_show_external.setChecked(True)
#else:
self.ui.act_canvas_show_internal.setChecked(True)
self.ui.act_canvas_show_external.setChecked(False)

self.ui.menu_PluginMacros.setEnabled(False)
self.ui.menu_Canvas.setEnabled(False)
@@ -264,9 +266,7 @@ class HostWindow(QMainWindow):

self.fDirModel = QFileSystemModel(self)
self.fDirModel.setRootPath(HOME)

if gCarla.host is not None:
self.fDirModel.setNameFilters(gCarla.host.get_supported_file_extensions().split(";"))
self.fDirModel.setNameFilters(host.get_supported_file_extensions().split(";"))

self.ui.fileTreeView.setModel(self.fDirModel)
self.ui.fileTreeView.setRootIndex(self.fDirModel.index(HOME))
@@ -357,7 +357,7 @@ class HostWindow(QMainWindow):

def openSettingsWindow(self, hasCanvas, hasCanvasGL):
hasEngine = bool(self.fSessionManagerName != "Non Session Manager")
dialog = CarlaSettingsW(self, gCarla.host, hasCanvas, hasCanvasGL, hasEngine)
dialog = CarlaSettingsW(self, self.host, hasCanvas, hasCanvasGL, hasEngine)
return dialog.exec_()

def setupContainer(self, showCanvas, canvasThemeData = []):
@@ -400,8 +400,7 @@ class HostWindow(QMainWindow):
self.fContainer.projectLoadingStarted()
self.fIsProjectLoading = True

if gCarla.host is not None:
gCarla.host.load_project(self.fProjectFilename)
self.host.load_project(self.fProjectFilename)

self.fIsProjectLoading = False
self.fContainer.projectLoadingFinished()
@@ -419,15 +418,12 @@ class HostWindow(QMainWindow):
if not self.fProjectFilename:
return qCritical("ERROR: saving project without filename set")

gCarla.host.save_project(self.fProjectFilename)
self.host.save_project(self.fProjectFilename)

# -----------------------------------------------------------------
# Internal stuff (engine)

def setEngineSettings(self, settings = None):
if self.fSessionManagerName == "Non Session Manager":
return "JACK"

if settings is None: settings = QSettings()

# -------------------------------------------------------------
@@ -490,7 +486,7 @@ class HostWindow(QMainWindow):
# -------------------------------------------------------------
# read settings (engine advanced)

if gCarla.isPlugin:
if self.host.isPlugin:
audioDriver = "Plugin"

else:
@@ -544,46 +540,42 @@ class HostWindow(QMainWindow):
if audioDriver != "JACK" and transportMode == ENGINE_TRANSPORT_MODE_JACK:
transportMode = ENGINE_TRANSPORT_MODE_INTERNAL

if gCarla.processModeForced or gCarla.isPlugin:
processMode = gCarla.processMode
if self.host.isPlugin:
processMode = self.host.processMode

# -------------------------------------------------------------
# save this for later

gCarla.maxParameters = maxParameters
gCarla.useCustomSkins = useCustomSkins

if gCarla.host is None:
return audioDriver
self.host.maxParameters = maxParameters

# -------------------------------------------------------------
# apply settings

gCarla.host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, forceStereo, "")
gCarla.host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, preferPluginBridges, "")
gCarla.host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, preferUiBridges, "")
gCarla.host.set_engine_option(ENGINE_OPTION_UIS_ALWAYS_ON_TOP, uisAlwaysOnTop, "")
gCarla.host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, maxParameters, "")
gCarla.host.set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, uiBridgesTimeout, "")
gCarla.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(LADSPA_PATH))
gCarla.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(DSSI_PATH))
gCarla.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(LV2_PATH))
gCarla.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST, splitter.join(VST_PATH))
gCarla.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST3, splitter.join(VST3_PATH))
gCarla.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_AU, splitter.join(AU_PATH))
gCarla.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_GIG, splitter.join(GIG_PATH))
gCarla.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(SF2_PATH))
gCarla.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(SFZ_PATH))
if not gCarla.isPlugin:
gCarla.host.set_engine_option(ENGINE_OPTION_PROCESS_MODE, processMode, "")
gCarla.host.set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, transportMode, "")
gCarla.host.set_engine_option(ENGINE_OPTION_AUDIO_NUM_PERIODS, audioNumPeriods, "")
gCarla.host.set_engine_option(ENGINE_OPTION_AUDIO_BUFFER_SIZE, audioBufferSize, "")
gCarla.host.set_engine_option(ENGINE_OPTION_AUDIO_SAMPLE_RATE, audioSampleRate, "")
gCarla.host.set_engine_option(ENGINE_OPTION_AUDIO_DEVICE, 0, audioDevice)
self.host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, forceStereo, "")
self.host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, preferPluginBridges, "")
self.host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, preferUiBridges, "")
self.host.set_engine_option(ENGINE_OPTION_UIS_ALWAYS_ON_TOP, uisAlwaysOnTop, "")
self.host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, maxParameters, "")
self.host.set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, uiBridgesTimeout, "")
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(LADSPA_PATH))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(DSSI_PATH))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(LV2_PATH))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST, splitter.join(VST_PATH))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST3, splitter.join(VST3_PATH))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_AU, splitter.join(AU_PATH))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_GIG, splitter.join(GIG_PATH))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(SF2_PATH))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(SFZ_PATH))
if not self.host.isPlugin:
self.host.set_engine_option(ENGINE_OPTION_PROCESS_MODE, processMode, "")
self.host.set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, transportMode, "")
self.host.set_engine_option(ENGINE_OPTION_AUDIO_NUM_PERIODS, audioNumPeriods, "")
self.host.set_engine_option(ENGINE_OPTION_AUDIO_BUFFER_SIZE, audioBufferSize, "")
self.host.set_engine_option(ENGINE_OPTION_AUDIO_SAMPLE_RATE, audioSampleRate, "")
self.host.set_engine_option(ENGINE_OPTION_AUDIO_DEVICE, 0, audioDevice)

# -------------------------------------------------------------
# return selected driver name
@@ -593,12 +585,12 @@ class HostWindow(QMainWindow):
def startEngine(self):
audioDriver = self.setEngineSettings()

if gCarla.host is not None and not gCarla.host.engine_init(audioDriver, self.fClientName):
if not self.host.engine_init(audioDriver, self.fClientName):
if self.fFirstEngineInit:
self.fFirstEngineInit = False
return

audioError = gCarla.host.get_last_error()
audioError = self.host.get_last_error()

if audioError:
QMessageBox.critical(self, self.tr("Error"), self.tr("Could not connect to Audio backend '%s', possible reasons:\n%s" % (audioDriver, audioError)))
@@ -619,8 +611,8 @@ class HostWindow(QMainWindow):
self.ui.act_plugin_remove_all.setEnabled(False)
self.fContainer.removeAllPlugins()

if gCarla.host.is_engine_running() and not gCarla.host.engine_close():
print(gCarla.host.get_last_error())
if self.host.is_engine_running() and not self.host.engine_close():
print(self.host.get_last_error())

# -----------------------------------------------------------------
# Internal stuff (plugins)
@@ -673,10 +665,10 @@ class HostWindow(QMainWindow):
# Internal stuff (transport)

def refreshTransport(self, forced = False):
if gCarla.sampleRate == 0.0 or not gCarla.host.is_engine_running():
if gCarla.sampleRate == 0.0 or not self.host.is_engine_running():
return

timeInfo = gCarla.host.get_transport_info()
timeInfo = self.host.get_transport_info()
playing = bool(timeInfo['playing'])
frame = int(timeInfo['frame'])

@@ -742,7 +734,7 @@ class HostWindow(QMainWindow):

# ---------------------------------------------

if gCarla.host is not None and not gCarla.isPlugin:
if not self.host.isPlugin:
# engine
self.setEngineSettings(settings)

@@ -881,11 +873,11 @@ class HostWindow(QMainWindow):
def slot_engineStart(self, doStart = True):
if doStart: self.startEngine()

check = gCarla.host is not None and gCarla.host.is_engine_running()
check = self.host.is_engine_running()
self.ui.menu_PluginMacros.setEnabled(check)
self.ui.menu_Canvas.setEnabled(check)

if not gCarla.isPlugin:
if not self.host.isPlugin:
self.ui.act_engine_start.setEnabled(not check)
self.ui.act_engine_stop.setEnabled(check)

@@ -897,7 +889,7 @@ class HostWindow(QMainWindow):
self.setTransportMenuEnabled(check)

if check:
if not gCarla.isPlugin:
if not self.host.isPlugin:
self.refreshTransport(True)

self.fContainer.engineStarted()
@@ -911,11 +903,11 @@ class HostWindow(QMainWindow):
self.ui.act_plugin_remove_all.setEnabled(False)
self.fContainer.removeAllPlugins()

check = gCarla.host.is_engine_running()
check = self.host.is_engine_running()
self.ui.menu_PluginMacros.setEnabled(check)
self.ui.menu_Canvas.setEnabled(check)

if not gCarla.isPlugin:
if not self.host.isPlugin:
self.ui.act_engine_start.setEnabled(not check)
self.ui.act_engine_stop.setEnabled(check)

@@ -934,14 +926,12 @@ class HostWindow(QMainWindow):

@pyqtSlot()
def slot_pluginAdd(self, pluginToReplace = -1):
dialog = PluginDatabaseW(self)
dialog = PluginDatabaseW(self, self.host)

if not dialog.exec_():
return

if gCarla.host is None:
return
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
QMessageBox.warning(self, self.tr("Warning"), self.tr("Cannot add new plugins while engine is stopped"))
return

@@ -953,17 +943,17 @@ class HostWindow(QMainWindow):
extraPtr = self.getExtraPtr(dialog.fRetPlugin)

if pluginToReplace >= 0:
if not gCarla.host.replace_plugin(pluginToReplace):
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to replace plugin"), gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
if not self.host.replace_plugin(pluginToReplace):
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to replace plugin"), self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
return

ok = gCarla.host.add_plugin(btype, ptype, filename, None, label, uniqueId, extraPtr)
ok = self.host.add_plugin(btype, ptype, filename, None, label, uniqueId, extraPtr)

if pluginToReplace >= 0:
gCarla.host.replace_plugin(self.fContainer.getPluginCount())
self.host.replace_plugin(self.fContainer.getPluginCount())

if not ok:
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)

@pyqtSlot()
def slot_pluginRemoveAll(self):
@@ -979,66 +969,66 @@ class HostWindow(QMainWindow):
app = QApplication.instance()
for i in range(count):
app.processEvents()
gCarla.host.remove_plugin(count-i-1)
self.host.remove_plugin(count-i-1)

self.fContainer.projectLoadingFinished()

#self.fContainer.removeAllPlugins()
#gCarla.host.remove_all_plugins()
#self.host.remove_all_plugins()

# -----------------------------------------------------------------

@pyqtSlot(bool)
def slot_transportPlayPause(self, toggled):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

if toggled:
gCarla.host.transport_play()
self.host.transport_play()
else:
gCarla.host.transport_pause()
self.host.transport_pause()

self.refreshTransport()

@pyqtSlot()
def slot_transportStop(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

gCarla.host.transport_pause()
gCarla.host.transport_relocate(0)
self.host.transport_pause()
self.host.transport_relocate(0)

self.refreshTransport()

@pyqtSlot()
def slot_transportBackwards(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

newFrame = gCarla.host.get_current_transport_frame() - 100000
newFrame = self.host.get_current_transport_frame() - 100000

if newFrame < 0:
newFrame = 0

gCarla.host.transport_relocate(newFrame)
self.host.transport_relocate(newFrame)

@pyqtSlot()
def slot_transportForwards(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

newFrame = gCarla.host.get_current_transport_frame() + 100000
gCarla.host.transport_relocate(newFrame)
newFrame = self.host.get_current_transport_frame() + 100000
self.host.transport_relocate(newFrame)

# -----------------------------------------------------------------

@pyqtSlot()
def slot_aboutCarla(self):
CarlaAboutW(self, gCarla.host).exec_()
CarlaAboutW(self, self.host).exec_()

@pyqtSlot()
def slot_aboutJuce(self):
JuceAboutW(self, gCarla.host).exec_()
JuceAboutW(self, self.host).exec_()

@pyqtSlot()
def slot_aboutQt(self):
@@ -1087,10 +1077,10 @@ class HostWindow(QMainWindow):
def slot_fileTreeDoubleClicked(self, modelIndex):
filename = self.fDirModel.filePath(modelIndex)

if not gCarla.host.load_file(filename):
if not self.host.load_file(filename):
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"),
self.tr("Failed to load file"),
gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)

# -----------------------------------------------------------------

@@ -1127,10 +1117,10 @@ class HostWindow(QMainWindow):

@pyqtSlot(str)
def slot_handleEngineStartedCallback(self, processMode, transportMode, driverName):
gCarla.processMode = processMode
gCarla.transportMode = transportMode
gCarla.bufferSize = gCarla.host.get_buffer_size()
gCarla.sampleRate = gCarla.host.get_sample_rate()
self.host.processMode = processMode
self.host.transportMode = transportMode
gCarla.bufferSize = self.host.get_buffer_size()
gCarla.sampleRate = self.host.get_sample_rate()

self.slot_engineStart(False)

@@ -1199,14 +1189,13 @@ class HostWindow(QMainWindow):
QMainWindow.showEvent(self, event)

# set our gui as parent for all plugins UIs
if gCarla.host is not None:
winIdStr = "%x" % self.winId()
gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, winIdStr)
winIdStr = "%x" % self.winId()
self.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, winIdStr)

def timerEvent(self, event):
if event.timerId() == self.fIdleTimerFast:
#if not gCarla.isPlugin:
gCarla.host.engine_idle()
self.host.engine_idle()
self.refreshTransport()

self.fContainer.idleFast()
@@ -1224,11 +1213,11 @@ class HostWindow(QMainWindow):
self.killTimers()
self.saveSettings()

if gCarla.host is None or gCarla.isPlugin:
if self.host.isPlugin:
pass

elif gCarla.host.is_engine_running():
gCarla.host.set_engine_about_to_close()
elif self.host.is_engine_running():
self.host.set_engine_about_to_close()

count = self.fContainer.getPluginCount()

@@ -1240,12 +1229,12 @@ class HostWindow(QMainWindow):
app = QApplication.instance()
for i in range(count):
app.processEvents()
gCarla.host.remove_plugin(count-i-1)
self.host.remove_plugin(count-i-1)

app.processEvents()

#self.fContainer.removeAllPlugins()
#gCarla.host.remove_all_plugins()
#self.host.remove_all_plugins()

self.stopEngine()

@@ -1386,13 +1375,13 @@ def fileCallback(ptr, action, isDir, title, filter):
# ------------------------------------------------------------------------------------------------------------
# Init host

def initHost(initName, libPrefix = None, failError = True):
def initHost(initName, libPrefix, isControl, isPlugin, failError):
# --------------------------------------------------------------------------------------------------------
# Set Carla library name

libname = "libcarla_"

if gCarla.isControl:
if isControl:
libname += "control2"
else:
libname += "standalone2"
@@ -1411,40 +1400,40 @@ def initHost(initName, libPrefix = None, failError = True):

# standalone, installed system-wide linux
if libPrefix is not None:
gCarla.pathBinaries = os.path.join(libPrefix, "lib", "carla")
gCarla.pathResources = os.path.join(libPrefix, "share", "carla", "resources")
pathBinaries = os.path.join(libPrefix, "lib", "carla")
pathResources = os.path.join(libPrefix, "share", "carla", "resources")

# standalone, local source
elif CWDl.endswith("source"):
gCarla.pathBinaries = os.path.abspath(os.path.join(CWD, "..", "bin"))
gCarla.pathResources = os.path.join(gCarla.pathBinaries, "resources")
pathBinaries = os.path.abspath(os.path.join(CWD, "..", "bin"))
pathResources = os.path.join(pathBinaries, "resources")

# plugin
elif CWDl.endswith("resources"):
# installed system-wide linux
if CWDl.endswith("/share/carla/resources"):
gCarla.pathBinaries = os.path.abspath(os.path.join(CWD, "..", "..", "..", "lib", "carla"))
gCarla.pathResources = CWD
pathBinaries = os.path.abspath(os.path.join(CWD, "..", "..", "..", "lib", "carla"))
pathResources = CWD

# local source
elif CWDl.endswith("native-plugins%sresources" % os.sep):
gCarla.pathBinaries = os.path.abspath(os.path.join(CWD, "..", "..", "..", "..", "bin"))
gCarla.pathResources = CWD
pathBinaries = os.path.abspath(os.path.join(CWD, "..", "..", "..", "..", "bin"))
pathResources = CWD

# other
else:
gCarla.pathBinaries = os.path.abspath(os.path.join(CWD, ".."))
gCarla.pathResources = CWD
pathBinaries = os.path.abspath(os.path.join(CWD, ".."))
pathResources = CWD

# everything else
else:
gCarla.pathBinaries = CWD
gCarla.pathResources = os.path.join(gCarla.pathBinaries, "resources")
pathBinaries = CWD
pathResources = os.path.join(pathBinaries, "resources")

# --------------------------------------------------------------------------------------------------------
# Fail if binary dir is not found

if not os.path.exists(gCarla.pathBinaries):
if not os.path.exists(pathBinaries):
if failError:
QMessageBox.critical(None, "Error", "Failed to find the carla binaries, cannot continue")
sys.exit(1)
@@ -1457,30 +1446,35 @@ def initHost(initName, libPrefix = None, failError = True):
print(" Python version: %s" % sys.version.split(" ",1)[0])
print(" Qt version: %s" % qVersion())
print(" PyQt version: %s" % PYQT_VERSION_STR)
print(" Binary dir: %s" % gCarla.pathBinaries)
print(" Resources dir: %s" % gCarla.pathResources)
print(" Binary dir: %s" % pathBinaries)
print(" Resources dir: %s" % pathResources)

# --------------------------------------------------------------------------------------------------------
# Init host

if gCarla.host is None:
#try:
gCarla.host = CarlaHostDLL(os.path.join(gCarla.pathBinaries, libname))
#except:
#print("hmmmm...")
#return
# TODO handle failError == False

if isPlugin:
host = CarlaHostPlugin()
else:
host = CarlaHostDLL(os.path.join(pathBinaries, libname))

host.isControl = isControl
host.isPlugin = isPlugin

gCarla.host.set_engine_callback(engineCallback)
gCarla.host.set_file_callback(fileCallback)
host.set_engine_callback(engineCallback)
host.set_file_callback(fileCallback)

# If it's a plugin the paths are already set
if not gCarla.isPlugin:
gCarla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, gCarla.pathBinaries)
gCarla.host.set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, gCarla.pathResources)
if not isPlugin:
host.pathBinaries = pathBinaries
host.pathResources = pathResources
host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, pathBinaries)
host.set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, pathResources)

if not gCarla.isControl:
gCarla.host.set_engine_option(ENGINE_OPTION_NSM_INIT, os.getpid(), initName)
if not isControl:
host.set_engine_option(ENGINE_OPTION_NSM_INIT, os.getpid(), initName)

return gCarla.host
return host

# ------------------------------------------------------------------------------------------------------------

+ 58
- 47
source/carla_patchbay.py View File

@@ -61,9 +61,9 @@ CARLA_DEFAULT_CANVAS_SIZE_WIDTH = 3100
CARLA_DEFAULT_CANVAS_SIZE_HEIGHT = 2400

# ------------------------------------------------------------------------------------------------
# Patchbay info class, used in main carla as replacement for PluginEdit
# Dummt class used in main carla as replacement for PluginEdit

class PluginInfo(object):
class DummyPluginEdit(object):
def __init__(self, parent, pluginId):
object.__init__(self)

@@ -94,9 +94,17 @@ class PluginInfo(object):
# ------------------------------------------------------------------------------------------------
# Patchbay widget

class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
def __init__(self, parent, doSetup = True, onlyPatchbay = True, is3D = False):
class CarlaPatchbayW(QFrame, PluginEditParentMeta):
#class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
def __init__(self, parent, host, doSetup = True, onlyPatchbay = True, is3D = False):
QFrame.__init__(self, parent)
self.host = host

if False:
# kdevelop likes this :)
self.host = host = CarlaHostMeta()

# -------------------------------------------------------------

self.fLayout = QGridLayout(self)
self.fLayout.setContentsMargins(0, 0, 0, 0)
@@ -132,8 +140,9 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
self.fPluginCount = 0
self.fPluginList = []

self.fIsOnlyPatchbay = onlyPatchbay
self.fSelectedPlugins = []
self.fExternalPatchbay = False
self.fIsOnlyPatchbay = onlyPatchbay
self.fSelectedPlugins = []

self.fCanvasWidth = 0
self.fCanvasHeight = 0
@@ -254,15 +263,15 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):

def addPlugin(self, pluginId, isProjectLoading):
if self.fIsOnlyPatchbay:
pitem = PluginEdit(self, gCarla.host, pluginId)
pitem = PluginEdit(self, self.host, pluginId)
else:
pitem = PluginInfo(self, pluginId)
pitem = DummyPluginEdit(self, pluginId)

self.fPluginList.append(pitem)
self.fPluginCount += 1

if self.fIsOnlyPatchbay and not isProjectLoading:
gCarla.host.set_active(pluginId, True)
self.host.set_active(pluginId, True)

def removePlugin(self, pluginId):
patchcanvas.handlePluginRemoved(pluginId)
@@ -340,11 +349,11 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
for pluginId in self.fSelectedPlugins:
self.fPeaksCleared = False
if self.fPeaksIn.isVisible():
self.fPeaksIn.displayMeter(1, gCarla.host.get_input_peak_value(pluginId, True))
self.fPeaksIn.displayMeter(2, gCarla.host.get_input_peak_value(pluginId, False))
self.fPeaksIn.displayMeter(1, self.host.get_input_peak_value(pluginId, True))
self.fPeaksIn.displayMeter(2, self.host.get_input_peak_value(pluginId, False))
if self.fPeaksOut.isVisible():
self.fPeaksOut.displayMeter(1, gCarla.host.get_output_peak_value(pluginId, True))
self.fPeaksOut.displayMeter(2, gCarla.host.get_output_peak_value(pluginId, False))
self.fPeaksOut.displayMeter(1, self.host.get_output_peak_value(pluginId, True))
self.fPeaksOut.displayMeter(2, self.host.get_output_peak_value(pluginId, False))
return

if self.fPeaksCleared:
@@ -549,34 +558,34 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
@pyqtSlot(int)
def slot_noteOn(self, note):
for pluginId in self.fSelectedPlugins:
gCarla.host.send_midi_note(pluginId, 0, note, 100)
self.host.send_midi_note(pluginId, 0, note, 100)

@pyqtSlot(int)
def slot_noteOff(self, note):
for pluginId in self.fSelectedPlugins:
gCarla.host.send_midi_note(pluginId, 0, note, 0)
self.host.send_midi_note(pluginId, 0, note, 0)

# -----------------------------------------------------------------

@pyqtSlot()
def slot_pluginsEnable(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
gCarla.host.set_active(i, True)
self.host.set_active(i, True)

@pyqtSlot()
def slot_pluginsDisable(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
gCarla.host.set_active(i, False)
self.host.set_active(i, False)

@pyqtSlot()
def slot_pluginsVolume100(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -586,11 +595,11 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):

if pitem.getHints() & PLUGIN_CAN_VOLUME:
pitem.setParameterValue(PARAMETER_VOLUME, 1.0)
gCarla.host.set_volume(i, 1.0)
self.host.set_volume(i, 1.0)

@pyqtSlot()
def slot_pluginsMute(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -600,11 +609,11 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):

if pitem.getHints() & PLUGIN_CAN_VOLUME:
pitem.setParameterValue(PARAMETER_VOLUME, 0.0)
gCarla.host.set_volume(i, 0.0)
self.host.set_volume(i, 0.0)

@pyqtSlot()
def slot_pluginsWet100(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -614,11 +623,11 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):

if pitem.getHints() & PLUGIN_CAN_DRYWET:
pitem.setParameterValue(PARAMETER_DRYWET, 1.0)
gCarla.host.set_drywet(i, 1.0)
self.host.set_drywet(i, 1.0)

@pyqtSlot()
def slot_pluginsBypass(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -628,11 +637,11 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):

if pitem.getHints() & PLUGIN_CAN_DRYWET:
pitem.setParameterValue(PARAMETER_DRYWET, 0.0)
gCarla.host.set_drywet(i, 0.0)
self.host.set_drywet(i, 0.0)

@pyqtSlot()
def slot_pluginsCenter(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -643,12 +652,12 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
if pitem.getHints() & PLUGIN_CAN_BALANCE:
pitem.setParameterValue(PARAMETER_BALANCE_LEFT, -1.0)
pitem.setParameterValue(PARAMETER_BALANCE_RIGHT, 1.0)
gCarla.host.set_balance_left(i, -1.0)
gCarla.host.set_balance_right(i, 1.0)
self.host.set_balance_left(i, -1.0)
self.host.set_balance_right(i, 1.0)

if pitem.getHints() & PLUGIN_CAN_PANNING:
pitem.setParameterValue(PARAMETER_PANNING, 0.0)
gCarla.host.set_panning(i, 0.0)
self.host.set_panning(i, 0.0)

# -----------------------------------------------------------------

@@ -665,8 +674,8 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
self.fParent.updateContainer(self.themeData)
self.slot_miniCanvasCheckAll()

if gCarla.host is not None and gCarla.host.is_engine_running():
gCarla.host.patchbay_refresh(gCarla.externalPatchbay)
if self.host.is_engine_running():
self.host.patchbay_refresh(self.fExternalPatchbay)

# -----------------------------------------------------------------

@@ -870,7 +879,7 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
print("sorry, can't map this plugin to canvas client", pluginId, self.fPluginCount)
return

patchcanvas.setGroupAsPlugin(clientId, pluginId, bool(gCarla.host.get_plugin_info(pluginId)['hints'] & PLUGIN_HAS_CUSTOM_UI))
patchcanvas.setGroupAsPlugin(clientId, pluginId, bool(self.host.get_plugin_info(pluginId)['hints'] & PLUGIN_HAS_CUSTOM_UI))

@pyqtSlot(int)
def slot_handlePatchbayClientRemovedCallback(self, clientId):
@@ -907,7 +916,7 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
print("sorry, can't map this plugin to canvas client", pluginId, self.getPluginCount())
return

patchcanvas.setGroupAsPlugin(clientId, pluginId, bool(gCarla.host.get_plugin_info(pluginId)['hints'] & PLUGIN_HAS_CUSTOM_UI))
patchcanvas.setGroupAsPlugin(clientId, pluginId, bool(self.host.get_plugin_info(pluginId)['hints'] & PLUGIN_HAS_CUSTOM_UI))

@pyqtSlot(int, int, int, str)
def slot_handlePatchbayPortAddedCallback(self, clientId, portId, portFlags, portName):
@@ -961,7 +970,7 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):

@pyqtSlot()
def slot_canvasShowInternal(self):
gCarla.externalPatchbay = False
self.fExternalPatchbay = False
self.fParent.ui.act_canvas_show_internal.blockSignals(True)
self.fParent.ui.act_canvas_show_external.blockSignals(True)
self.fParent.ui.act_canvas_show_internal.setChecked(True)
@@ -972,7 +981,7 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):

@pyqtSlot()
def slot_canvasShowExternal(self):
gCarla.externalPatchbay = True
self.fExternalPatchbay = True
self.fParent.ui.act_canvas_show_internal.blockSignals(True)
self.fParent.ui.act_canvas_show_external.blockSignals(True)
self.fParent.ui.act_canvas_show_internal.setChecked(False)
@@ -985,8 +994,8 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
def slot_canvasRefresh(self):
patchcanvas.clear()

if gCarla.host is not None and gCarla.host.is_engine_running():
gCarla.host.patchbay_refresh(gCarla.externalPatchbay)
if self.host.is_engine_running():
self.host.patchbay_refresh(self.fExternalPatchbay)

for pitem in self.fPluginList:
if pitem is None:
@@ -1064,6 +1073,8 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
# Canvas callback

def canvasCallback(action, value1, value2, valueStr):
host = gCarla.gui.host

if action == patchcanvas.ACTION_GROUP_INFO:
pass

@@ -1089,19 +1100,19 @@ def canvasCallback(action, value1, value2, valueStr):
elif action == patchcanvas.ACTION_PORTS_CONNECT:
gOut, pOut, gIn, pIn = [int(i) for i in valueStr.split(":")]

if not gCarla.host.patchbay_connect(gOut, pOut, gIn, pIn):
print("Connection failed:", gCarla.host.get_last_error())
if not host.patchbay_connect(gOut, pOut, gIn, pIn):
print("Connection failed:", host.get_last_error())

elif action == patchcanvas.ACTION_PORTS_DISCONNECT:
connectionId = value1

if not gCarla.host.patchbay_disconnect(connectionId):
print("Disconnect failed:", gCarla.host.get_last_error())
if not host.patchbay_disconnect(connectionId):
print("Disconnect failed:", host.get_last_error())

elif action == patchcanvas.ACTION_PLUGIN_CLONE:
pluginId = value1

gCarla.host.clone_plugin(pluginId)
host.clone_plugin(pluginId)

elif action == patchcanvas.ACTION_PLUGIN_EDIT:
pluginId = value1
@@ -1112,14 +1123,14 @@ def canvasCallback(action, value1, value2, valueStr):
pluginId = value1
newName = valueStr

gCarla.host.rename_plugin(pluginId, newName)
host.rename_plugin(pluginId, newName)

elif action == patchcanvas.ACTION_PLUGIN_REMOVE:
pluginId = value1

gCarla.host.remove_plugin(pluginId)
host.remove_plugin(pluginId)

elif action == patchcanvas.ACTION_PLUGIN_SHOW_UI:
pluginId = value1

gCarla.host.show_custom_ui(pluginId, True)
host.show_custom_ui(pluginId, True)

+ 30
- 16
source/carla_rack.py View File

@@ -56,7 +56,7 @@ class CarlaRackItem(QListWidgetItem):
# -----------------------------------------------------------------

def createWidget(self, pluginId):
self.widget = createPluginSlot(self.fParent, pluginId)
self.widget = createPluginSlot(self.fParent, self.fParent.host, pluginId, True) # FIXME useSkins opt
self.widget.setFixedHeight(self.widget.getFixedHeight())

self.setSizeHint(QSize(640, self.widget.getFixedHeight()))
@@ -77,10 +77,17 @@ class CarlaRackItem(QListWidgetItem):
# Rack widget list

class CarlaRackList(QListWidget):
def __init__(self, parent):
def __init__(self, parent, host):
QListWidget.__init__(self, parent)
self.host = host

exts = gCarla.host.get_supported_file_extensions().split(";") if gCarla.host is not None else ["wav",]
if False:
# kdevelop likes this :)
host = CarlaHostMeta()

# -------------------------------------------------------------

exts = host.get_supported_file_extensions().split(";")

# plugin files
exts.append("dll")
@@ -164,18 +171,18 @@ class CarlaRackList(QListWidget):

if tryItem is not None:
pluginId = tryItem.widget.getPluginId()
gCarla.host.replace_plugin(pluginId)
self.host.replace_plugin(pluginId)

for url in urls:
filename = url.toLocalFile()

if not gCarla.host.load_file(filename):
if not self.host.load_file(filename):
CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"),
self.tr("Failed to load file"),
gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)

if tryItem is not None:
gCarla.host.replace_plugin(self.parent().fPluginCount)
self.host.replace_plugin(self.parent().fPluginCount)
#tryItem.widget.setActive(True, True, True)

def mousePressEvent(self, event):
@@ -196,8 +203,15 @@ class CarlaRackList(QListWidget):
# Rack widget

class CarlaRackW(QFrame):
def __init__(self, parent, doSetup = True):
def __init__(self, parent, host, doSetup = True):
QFrame.__init__(self, parent)
self.host = host

if False:
# kdevelop likes this :)
host = CarlaHostMeta()

# -------------------------------------------------------------

self.fLayout = QHBoxLayout(self)
self.fLayout.setContentsMargins(0, 0, 0, 0)
@@ -214,7 +228,7 @@ class CarlaRackW(QFrame):
self.fPadRight.setObjectName("PadRight")
self.fPadRight.setText("")

self.fRack = CarlaRackList(self)
self.fRack = CarlaRackList(self, host)
self.fRack.setObjectName("CarlaRackList")
self.fRack.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.fRack.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
@@ -436,7 +450,7 @@ class CarlaRackW(QFrame):

@pyqtSlot()
def slot_pluginsEnable(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -448,7 +462,7 @@ class CarlaRackW(QFrame):

@pyqtSlot()
def slot_pluginsDisable(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -460,7 +474,7 @@ class CarlaRackW(QFrame):

@pyqtSlot()
def slot_pluginsVolume100(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -472,7 +486,7 @@ class CarlaRackW(QFrame):

@pyqtSlot()
def slot_pluginsMute(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -484,7 +498,7 @@ class CarlaRackW(QFrame):

@pyqtSlot()
def slot_pluginsWet100(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -496,7 +510,7 @@ class CarlaRackW(QFrame):

@pyqtSlot()
def slot_pluginsBypass(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):
@@ -508,7 +522,7 @@ class CarlaRackW(QFrame):

@pyqtSlot()
def slot_pluginsCenter(self):
if not gCarla.host.is_engine_running():
if not self.host.is_engine_running():
return

for i in range(self.fPluginCount):


+ 2
- 34
source/carla_shared.py View File

@@ -484,54 +484,22 @@ del DEFAULT_SFZ_PATH

class CarlaObject(object):
__slots__ = [
# Host library object
'host',
# Host Window
'gui',
# bool, is controller
'isControl',
# bool, is running local
'isLocal',
# bool, is plugin
'isPlugin',
# current buffer size
'bufferSize',
# current sample rate
'sampleRate',
# current process mode
'processMode',
# check if process mode is forced (rack/patchbay)
'processModeForced',
# current transport mode
'transportMode',
# current max parameters
'maxParameters',
# wherever to use external patchbay mode
'externalPatchbay',
# wherever to use custom skins
'useCustomSkins',
# binary dir
'pathBinaries',
# resources dir
'pathResources'
'useCustomSkins'
]

gCarla = CarlaObject()
gCarla.host = None
gCarla.gui = None
gCarla.isControl = False
gCarla.isLocal = True
gCarla.isPlugin = False
gCarla.gui = None
gCarla.bufferSize = 0
gCarla.sampleRate = 0.0
gCarla.processMode = CARLA_DEFAULT_PROCESS_MODE
gCarla.processModeForced = False
gCarla.transportMode = CARLA_DEFAULT_TRANSPORT_MODE
gCarla.maxParameters = MAX_DEFAULT_PARAMETERS
gCarla.externalPatchbay = False
gCarla.useCustomSkins = True
gCarla.pathBinaries = ""
gCarla.pathResources = ""

# ------------------------------------------------------------------------------------------------------------
# Set CWD


+ 77
- 81
source/carla_skin.py View File

@@ -87,22 +87,23 @@ def getParameterShortName(paramName):

class AbstractPluginSlot(QFrame, PluginEditParentMeta):
#class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
def __init__(self, parent, pluginId):
def __init__(self, parent, host, pluginId):
QFrame.__init__(self, parent)
self.host = host

# -------------------------------------------------------------
# Get plugin info

self.fPluginId = pluginId
self.fPluginInfo = gCarla.host.get_plugin_info(self.fPluginId) if gCarla.host is not None else gFakePluginInfo
self.fPluginInfo = host.get_plugin_info(self.fPluginId)

if not gCarla.isLocal:
self.fPluginInfo['hints'] &= ~PLUGIN_HAS_CUSTOM_UI
#if not gCarla.isLocal:
#self.fPluginInfo['hints'] &= ~PLUGIN_HAS_CUSTOM_UI

# -------------------------------------------------------------
# Internal stuff

self.fIsActive = bool(gCarla.host.get_internal_parameter_value(self.fPluginId, PARAMETER_ACTIVE) >= 0.5) if gCarla.host is not None else True
self.fIsActive = bool(host.get_internal_parameter_value(self.fPluginId, PARAMETER_ACTIVE) >= 0.5)
self.fIsSelected = False

self.fLastGreenLedState = False
@@ -111,11 +112,11 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.fParameterIconTimer = ICON_STATE_OFF
self.fParameterList = [] # index, widget

if gCarla.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK or gCarla.host is None:
if host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
self.fPeaksInputCount = 2
self.fPeaksOutputCount = 2
else:
audioCountInfo = gCarla.host.get_audio_port_count_info(self.fPluginId)
audioCountInfo = host.get_audio_port_count_info(self.fPluginId)

self.fPeaksInputCount = int(audioCountInfo['ins'])
self.fPeaksOutputCount = int(audioCountInfo['outs'])
@@ -129,7 +130,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
# -------------------------------------------------------------
# Set-up GUI

self.fEditDialog = PluginEdit(self, gCarla.host, self.fPluginId)
self.fEditDialog = PluginEdit(self, host, self.fPluginId)

# -------------------------------------------------------------
# Set-up common widgets (as none)
@@ -206,14 +207,11 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.peak_out.setChannels(self.fPeaksOutputCount)
self.peak_out.setOrientation(self.peak_out.HORIZONTAL)

if gCarla.host is None:
return

for paramIndex, paramWidget in self.fParameterList:
paramWidget.setContextMenuPolicy(Qt.CustomContextMenu)
paramWidget.customContextMenuRequested.connect(self.slot_knobCustomMenu)
paramWidget.realValueChanged.connect(self.slot_parameterValueChanged)
paramWidget.setValue(gCarla.host.get_internal_parameter_value(self.fPluginId, paramIndex))
paramWidget.setValue(self.host.get_internal_parameter_value(self.fPluginId, paramIndex))

#------------------------------------------------------------------

@@ -255,7 +253,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.activeChanged(active)

if sendHost:
gCarla.host.set_active(self.fPluginId, active)
self.host.set_active(self.fPluginId, active)

if active:
self.fEditDialog.clearNotes()
@@ -271,26 +269,26 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):

elif parameterId == PARAMETER_DRYWET:
if (self.fPluginInfo['hints'] & PLUGIN_CAN_DRYWET) == 0: return
gCarla.host.set_drywet(self.fPluginId, value)
self.host.set_drywet(self.fPluginId, value)

elif parameterId == PARAMETER_VOLUME:
if (self.fPluginInfo['hints'] & PLUGIN_CAN_VOLUME) == 0: return
gCarla.host.set_volume(self.fPluginId, value)
self.host.set_volume(self.fPluginId, value)

elif parameterId == PARAMETER_BALANCE_LEFT:
if (self.fPluginInfo['hints'] & PLUGIN_CAN_BALANCE) == 0: return
gCarla.host.set_balance_left(self.fPluginId, value)
self.host.set_balance_left(self.fPluginId, value)

elif parameterId == PARAMETER_BALANCE_RIGHT:
if (self.fPluginInfo['hints'] & PLUGIN_CAN_BALANCE) == 0: return
gCarla.host.set_balance_right(self.fPluginId, value)
self.host.set_balance_right(self.fPluginId, value)

elif parameterId == PARAMETER_PANNING:
if (self.fPluginInfo['hints'] & PLUGIN_CAN_PANNING) == 0: return
gCarla.host.set_panning(self.fPluginId, value)
self.host.set_panning(self.fPluginId, value)

elif parameterId == PARAMETER_CTRL_CHANNEL:
gCarla.host.set_ctrl_channel(self.fPluginId, value)
self.host.set_ctrl_channel(self.fPluginId, value)

self.fEditDialog.setParameterValue(parameterId, value)

@@ -447,8 +445,8 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
# Input peaks
if self.fPeaksInputCount > 0:
if self.fPeaksInputCount > 1:
peak1 = gCarla.host.get_input_peak_value(self.fPluginId, True)
peak2 = gCarla.host.get_input_peak_value(self.fPluginId, False)
peak1 = self.host.get_input_peak_value(self.fPluginId, True)
peak2 = self.host.get_input_peak_value(self.fPluginId, False)
ledState = bool(peak1 != 0.0 or peak2 != 0.0)

if self.peak_in is not None:
@@ -456,7 +454,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.peak_in.displayMeter(2, peak2)

else:
peak = gCarla.host.get_input_peak_value(self.fPluginId, True)
peak = self.host.get_input_peak_value(self.fPluginId, True)
ledState = bool(peak != 0.0)

if self.peak_in is not None:
@@ -469,8 +467,8 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
# Output peaks
if self.fPeaksOutputCount > 0:
if self.fPeaksOutputCount > 1:
peak1 = gCarla.host.get_output_peak_value(self.fPluginId, True)
peak2 = gCarla.host.get_output_peak_value(self.fPluginId, False)
peak1 = self.host.get_output_peak_value(self.fPluginId, True)
peak2 = self.host.get_output_peak_value(self.fPluginId, False)
ledState = bool(peak1 != 0.0 or peak2 != 0.0)

if self.peak_out is not None:
@@ -478,7 +476,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.peak_out.displayMeter(2, peak2)

else:
peak = gCarla.host.get_output_peak_value(self.fPluginId, True)
peak = self.host.get_output_peak_value(self.fPluginId, True)
ledState = bool(peak != 0.0)

if self.peak_out is not None:
@@ -554,12 +552,10 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.setActive(not isEnabled, True, True)

elif actSel == actReset:
if gCarla.host is None: return
gCarla.host.reset_parameters(self.fPluginId)
self.host.reset_parameters(self.fPluginId)

elif actSel == actRandom:
if gCarla.host is None: return
gCarla.host.randomize_parameters(self.fPluginId)
self.host.randomize_parameters(self.fPluginId)

elif actSel == actGui:
bGui.click()
@@ -568,9 +564,9 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
bEdit.click()

elif actSel == actClone:
if gCarla.host is not None and not gCarla.host.clone_plugin(self.fPluginId):
if not self.host.clone_plugin(self.fPluginId):
CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)

elif actSel == actRename:
oldName = self.fPluginInfo['name']
@@ -581,19 +577,19 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):

newName = newNameTry[0]

if gCarla.host is None or gCarla.host.rename_plugin(self.fPluginId, newName):
if self.host.rename_plugin(self.fPluginId, newName):
self.setName(newName)
else:
CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)

elif actSel == actReplace:
gCarla.gui.slot_pluginAdd(self.fPluginId)

elif actSel == actRemove:
if gCarla.host is not None and not gCarla.host.remove_plugin(self.fPluginId):
if not self.host.remove_plugin(self.fPluginId):
CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)
self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)

#------------------------------------------------------------------

@@ -620,7 +616,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
minimText = self.tr("Set to Minimum (%i%%)" % int(minimum*100.0))
maximText = self.tr("Set to Maximum (%i%%)" % int(maximum*100.0))
else:
default = gCarla.host.get_default_parameter_value(self.fPluginId, index)
default = self.host.get_default_parameter_value(self.fPluginId, index)
resetText = self.tr("Reset (%f)" % default)
minimText = self.tr("Set to Minimum (%f)" % minimum)
maximText = self.tr("Set to Maximum (%f)" % maximum)
@@ -657,7 +653,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):

@pyqtSlot(bool)
def slot_showCustomUi(self, show):
gCarla.host.show_custom_ui(self.fPluginId, show)
self.host.show_custom_ui(self.fPluginId, show)

@pyqtSlot(bool)
def slot_showEditDialog(self, show):
@@ -665,7 +661,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):

@pyqtSlot()
def slot_removePlugin(self):
gCarla.host.remove_plugin(self.fPluginId)
self.host.remove_plugin(self.fPluginId)

#------------------------------------------------------------------

@@ -676,17 +672,17 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
if index < 0:
self.setInternalParameter(index, value)
else:
gCarla.host.set_parameter_value(self.fPluginId, index, value)
self.host.set_parameter_value(self.fPluginId, index, value)
self.setParameterValue(index, value, False)

@pyqtSlot(int)
def slot_programChanged(self, index):
gCarla.host.set_program(self.fPluginId, index)
self.host.set_program(self.fPluginId, index)
self.setProgram(index, False)

@pyqtSlot(int)
def slot_midiProgramChanged(self, index):
gCarla.host.set_midi_program(self.fPluginId, index)
self.host.set_midi_program(self.fPluginId, index)
self.setMidiProgram(index, False)

#------------------------------------------------------------------
@@ -698,8 +694,8 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
# ------------------------------------------------------------------------------------------------------------

class PluginSlot_Default(AbstractPluginSlot):
def __init__(self, parent, pluginId):
AbstractPluginSlot.__init__(self, parent, pluginId)
def __init__(self, parent, host, pluginId):
AbstractPluginSlot.__init__(self, parent, host, pluginId)
self.ui = ui_carla_plugin_default.Ui_PluginWidget()
self.ui.setupUi(self)

@@ -807,8 +803,8 @@ class PluginSlot_Default(AbstractPluginSlot):
# ------------------------------------------------------------------------------------------------------------

class PluginSlot_BasicFX(AbstractPluginSlot):
def __init__(self, parent, pluginId):
AbstractPluginSlot.__init__(self, parent, pluginId)
def __init__(self, parent, host, pluginId):
AbstractPluginSlot.__init__(self, parent, host, pluginId)
self.ui = ui_carla_plugin_basic_fx.Ui_PluginWidget()
self.ui.setupUi(self)

@@ -872,16 +868,16 @@ class PluginSlot_BasicFX(AbstractPluginSlot):
# -------------------------------------------------------------
# Set-up parameters

parameterCount = gCarla.host.get_parameter_count(self.fPluginId) if gCarla.host is not None else 0
parameterCount = self.host.get_parameter_count(self.fPluginId)

index = 0
for i in range(parameterCount):
if index >= 8:
break

paramInfo = gCarla.host.get_parameter_info(self.fPluginId, i)
paramData = gCarla.host.get_parameter_data(self.fPluginId, i)
paramRanges = gCarla.host.get_parameter_ranges(self.fPluginId, i)
paramInfo = self.host.get_parameter_info(self.fPluginId, i)
paramData = self.host.get_parameter_data(self.fPluginId, i)
paramRanges = self.host.get_parameter_ranges(self.fPluginId, i)

if paramData['type'] != PARAMETER_INPUT:
continue
@@ -993,13 +989,13 @@ class PluginSlot_BasicFX(AbstractPluginSlot):
# ------------------------------------------------------------------------------------------------------------

class PluginSlot_Calf(AbstractPluginSlot):
def __init__(self, parent, pluginId):
AbstractPluginSlot.__init__(self, parent, pluginId)
def __init__(self, parent, host, pluginId):
AbstractPluginSlot.__init__(self, parent, host, pluginId)
self.ui = ui_carla_plugin_calf.Ui_PluginWidget()
self.ui.setupUi(self)

audioCount = gCarla.host.get_audio_port_count_info(self.fPluginId) if gCarla.host is not None else {'ins': 2, 'outs': 2 }
midiCount = gCarla.host.get_midi_port_count_info(self.fPluginId) if gCarla.host is not None else {'ins': 1, 'outs': 0 }
audioCount = self.host.get_audio_port_count_info(self.fPluginId)
midiCount = self.host.get_midi_port_count_info(self.fPluginId)

# -------------------------------------------------------------
# Internal stuff
@@ -1063,7 +1059,7 @@ class PluginSlot_Calf(AbstractPluginSlot):
# -------------------------------------------------------------
# Set-up parameters

parameterCount = gCarla.host.get_parameter_count(self.fPluginId) if gCarla.host is not None else 0
parameterCount = self.host.get_parameter_count(self.fPluginId)

index = 0
limit = 7 if midiCount['ins'] == 0 else 6
@@ -1071,9 +1067,9 @@ class PluginSlot_Calf(AbstractPluginSlot):
if index >= limit:
break

paramInfo = gCarla.host.get_parameter_info(self.fPluginId, i)
paramData = gCarla.host.get_parameter_data(self.fPluginId, i)
paramRanges = gCarla.host.get_parameter_ranges(self.fPluginId, i)
paramInfo = self.host.get_parameter_info(self.fPluginId, i)
paramData = self.host.get_parameter_data(self.fPluginId, i)
paramRanges = self.host.get_parameter_ranges(self.fPluginId, i)

if paramData['type'] != PARAMETER_INPUT:
continue
@@ -1149,8 +1145,8 @@ class PluginSlot_Calf(AbstractPluginSlot):
# ------------------------------------------------------------------------------------------------------------

class PluginSlot_Nekobi(AbstractPluginSlot):
def __init__(self, parent, pluginId):
AbstractPluginSlot.__init__(self, parent, pluginId)
def __init__(self, parent, host, pluginId):
AbstractPluginSlot.__init__(self, parent, host, pluginId)
#self.ui = ui_carla_plugin_basic_fx.Ui_PluginWidget()
#self.ui.setupUi(self)

@@ -1201,15 +1197,15 @@ class PluginSlot_Nekobi(AbstractPluginSlot):
# ------------------------------------------------------------------------------------------------------------

class PluginSlot_ZitaRev(AbstractPluginSlot):
def __init__(self, parent, pluginId):
AbstractPluginSlot.__init__(self, parent, pluginId)
def __init__(self, parent, host, pluginId):
AbstractPluginSlot.__init__(self, parent, host, pluginId)
self.ui = ui_carla_plugin_zita.Ui_PluginWidget()
self.ui.setupUi(self)

# -------------------------------------------------------------
# Internal stuff

audioCount = gCarla.host.get_audio_port_count_info(self.fPluginId) if gCarla.host is not None else {'ins': 2, 'outs': 2 }
audioCount = self.host.get_audio_port_count_info(self.fPluginId)

# -------------------------------------------------------------
# Set-up GUI
@@ -1345,8 +1341,8 @@ class PluginSlot_ZitaRev(AbstractPluginSlot):
# ------------------------------------------------------------------------------------------------------------

class PluginSlot_ZynFX(AbstractPluginSlot):
def __init__(self, parent, pluginId):
AbstractPluginSlot.__init__(self, parent, pluginId)
def __init__(self, parent, host, pluginId):
AbstractPluginSlot.__init__(self, parent, host, pluginId)
self.ui = ui_carla_plugin_zynfx.Ui_PluginWidget()
self.ui.setupUi(self)

@@ -1380,13 +1376,13 @@ class PluginSlot_ZynFX(AbstractPluginSlot):
# -------------------------------------------------------------
# Set-up parameters

parameterCount = gCarla.host.get_parameter_count(self.fPluginId) if gCarla.host is not None else 0
parameterCount = self.host.get_parameter_count(self.fPluginId)

index = 0
for i in range(parameterCount):
paramInfo = gCarla.host.get_parameter_info(self.fPluginId, i)
paramData = gCarla.host.get_parameter_data(self.fPluginId, i)
paramRanges = gCarla.host.get_parameter_ranges(self.fPluginId, i)
paramInfo = self.host.get_parameter_info(self.fPluginId, i)
paramData = self.host.get_parameter_data(self.fPluginId, i)
paramRanges = self.host.get_parameter_ranges(self.fPluginId, i)

if paramData['type'] != PARAMETER_INPUT:
continue
@@ -1499,19 +1495,19 @@ class PluginSlot_ZynFX(AbstractPluginSlot):
# -------------------------------------------------------------
# Set-up MIDI programs

midiProgramCount = gCarla.host.get_midi_program_count(self.fPluginId) if gCarla.host is not None else 0
midiProgramCount = self.host.get_midi_program_count(self.fPluginId)

if midiProgramCount > 0:
self.ui.cb_presets.setEnabled(True)
self.ui.label_presets.setEnabled(True)

for i in range(midiProgramCount):
mpData = gCarla.host.get_midi_program_data(self.fPluginId, i)
mpData = self.host.get_midi_program_data(self.fPluginId, i)
mpName = mpData['name']

self.ui.cb_presets.addItem(mpName)

self.fCurrentMidiProgram = gCarla.host.get_current_midi_program_index(self.fPluginId)
self.fCurrentMidiProgram = self.host.get_current_midi_program_index(self.fPluginId)
self.ui.cb_presets.setCurrentIndex(self.fCurrentMidiProgram)

else:
@@ -1564,12 +1560,12 @@ class PluginSlot_ZynFX(AbstractPluginSlot):

# ------------------------------------------------------------------------------------------------------------

def createPluginSlot(parent, pluginId):
if not gCarla.useCustomSkins:
return PluginSlot_Default(parent, pluginId)
def createPluginSlot(parent, host, pluginId, useCustomSkins):
if not useCustomSkins:
return PluginSlot_Default(parent, host, pluginId)

pluginInfo = gCarla.host.get_plugin_info(pluginId)
pluginName = gCarla.host.get_real_plugin_name(pluginId)
pluginInfo = host.get_plugin_info(pluginId)
pluginName = host.get_real_plugin_name(pluginId)
pluginLabel = pluginInfo['label']
pluginMaker = pluginInfo['maker']
uniqueId = pluginInfo['uniqueId']
@@ -1578,21 +1574,21 @@ def createPluginSlot(parent, pluginId):

if pluginInfo['type'] == PLUGIN_INTERNAL:
if pluginLabel.startswith("zyn") and pluginInfo['category'] != PLUGIN_CATEGORY_SYNTH:
return PluginSlot_ZynFX(parent, pluginId)
return PluginSlot_ZynFX(parent, host, pluginId)

elif pluginInfo['type'] == PLUGIN_LADSPA:
if (pluginLabel == "zita-reverb" and uniqueId == 3701) or (pluginLabel == "zita-reverb-amb" and uniqueId == 3702):
return PluginSlot_ZitaRev(parent, pluginId)
return PluginSlot_ZitaRev(parent, host, pluginId)
if pluginLabel.startswith("Zyn") and pluginMaker.startswith("Josep Andreu"):
return PluginSlot_ZynFX(parent, pluginId)
return PluginSlot_ZynFX(parent, host, pluginId)

if pluginName.split(" ", 1)[0].lower() == "calf":
return PluginSlot_Calf(parent, pluginId)
return PluginSlot_Calf(parent, host, pluginId)

#if pluginName.lower() == "nekobi":
#return PluginSlot_Nekobi(parent, pluginId)

return PluginSlot_BasicFX(parent, pluginId)
return PluginSlot_BasicFX(parent, host, pluginId)

# ------------------------------------------------------------------------------------------------------------
# Main Testing


+ 1
- 1
source/carla_widgets.py View File

@@ -720,7 +720,7 @@ class PluginEdit(QDialog):

# -----------------------------------------------------------------

if parameterCount > gCarla.maxParameters:
if parameterCount > self.host.maxParameters:
fakeName = self.tr("This plugin has too many parameters to display here!")

paramFakeListFull = []


Loading…
Cancel
Save