Browse Source

Continue previous work, more or less working; Still needs more

tags/1.9.5
falkTX 10 years ago
parent
commit
345352c1f5
6 changed files with 594 additions and 660 deletions
  1. +41
    -37
      source/carla
  2. +53
    -2
      source/carla_backend.py
  3. +408
    -525
      source/carla_host.py
  4. +25
    -27
      source/carla_patchbay.py
  5. +15
    -18
      source/carla_rack.py
  6. +52
    -51
      source/modules/native-plugins/resources/carla-plugin

+ 41
- 37
source/carla View File

@@ -45,6 +45,13 @@ class CarlaMultiW(QTabWidget):
def __init__(self, parent, host): def __init__(self, parent, host):
QTabWidget.__init__(self, parent) QTabWidget.__init__(self, parent)


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

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

self.fRack = CarlaRackW(parent, host, False) self.fRack = CarlaRackW(parent, host, False)
self.fPatchbay = CarlaPatchbayW(parent, host, False, False) self.fPatchbay = CarlaPatchbayW(parent, host, False, False)
self.fParent = parent self.fParent = parent
@@ -84,36 +91,36 @@ class CarlaMultiW(QTabWidget):


parent.ui.act_settings_configure.triggered.connect(self.fPatchbay.slot_configureCarla) parent.ui.act_settings_configure.triggered.connect(self.fPatchbay.slot_configureCarla)


parent.ParameterValueChangedCallback.connect(self.fRack.slot_handleParameterValueChangedCallback)
parent.ParameterValueChangedCallback.connect(self.fPatchbay.slot_handleParameterValueChangedCallback)
parent.ParameterDefaultChangedCallback.connect(self.fRack.slot_handleParameterDefaultChangedCallback)
parent.ParameterMidiChannelChangedCallback.connect(self.fRack.slot_handleParameterMidiChannelChangedCallback)
parent.ParameterMidiCcChangedCallback.connect(self.fRack.slot_handleParameterMidiCcChangedCallback)
parent.ProgramChangedCallback.connect(self.fRack.slot_handleProgramChangedCallback)
parent.MidiProgramChangedCallback.connect(self.fRack.slot_handleMidiProgramChangedCallback)
parent.OptionChangedCallback.connect(self.fRack.slot_handleOptionChangedCallback)
parent.UiStateChangedCallback.connect(self.fRack.slot_handleUiStateChangedCallback)
parent.NoteOnCallback.connect(self.fRack.slot_handleNoteOnCallback)
parent.NoteOnCallback.connect(self.fPatchbay.slot_handleNoteOnCallback)
parent.NoteOffCallback.connect(self.fRack.slot_handleNoteOffCallback)
parent.NoteOffCallback.connect(self.fPatchbay.slot_handleNoteOffCallback)
parent.UpdateCallback.connect(self.fRack.slot_handleUpdateCallback)
parent.ReloadInfoCallback.connect(self.fRack.slot_handleReloadInfoCallback)
parent.ReloadParametersCallback.connect(self.fRack.slot_handleReloadParametersCallback)
parent.ReloadParametersCallback.connect(self.fPatchbay.slot_handleReloadParametersCallback)
parent.ReloadProgramsCallback.connect(self.fRack.slot_handleReloadProgramsCallback)
parent.ReloadAllCallback.connect(self.fRack.slot_handleReloadAllCallback)
parent.ReloadAllCallback.connect(self.fPatchbay.slot_handleReloadAllCallback)
parent.PatchbayClientAddedCallback.connect(self.fPatchbay.slot_handlePatchbayClientAddedCallback)
parent.PatchbayClientRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRemovedCallback)
parent.PatchbayClientRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRenamedCallback)
parent.PatchbayClientDataChangedCallback.connect(self.fPatchbay.slot_handlePatchbayClientDataChangedCallback)
parent.PatchbayPortAddedCallback.connect(self.fPatchbay.slot_handlePatchbayPortAddedCallback)
parent.PatchbayPortRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRemovedCallback)
parent.PatchbayPortRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRenamedCallback)
parent.PatchbayConnectionAddedCallback.connect(self.fPatchbay.slot_handlePatchbayConnectionAddedCallback)
parent.PatchbayConnectionRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayConnectionRemovedCallback)
host.ParameterValueChangedCallback.connect(self.fRack.slot_handleParameterValueChangedCallback)
host.ParameterValueChangedCallback.connect(self.fPatchbay.slot_handleParameterValueChangedCallback)
host.ParameterDefaultChangedCallback.connect(self.fRack.slot_handleParameterDefaultChangedCallback)
host.ParameterMidiChannelChangedCallback.connect(self.fRack.slot_handleParameterMidiChannelChangedCallback)
host.ParameterMidiCcChangedCallback.connect(self.fRack.slot_handleParameterMidiCcChangedCallback)
host.ProgramChangedCallback.connect(self.fRack.slot_handleProgramChangedCallback)
host.MidiProgramChangedCallback.connect(self.fRack.slot_handleMidiProgramChangedCallback)
host.OptionChangedCallback.connect(self.fRack.slot_handleOptionChangedCallback)
host.UiStateChangedCallback.connect(self.fRack.slot_handleUiStateChangedCallback)
host.NoteOnCallback.connect(self.fRack.slot_handleNoteOnCallback)
host.NoteOnCallback.connect(self.fPatchbay.slot_handleNoteOnCallback)
host.NoteOffCallback.connect(self.fRack.slot_handleNoteOffCallback)
host.NoteOffCallback.connect(self.fPatchbay.slot_handleNoteOffCallback)
host.UpdateCallback.connect(self.fRack.slot_handleUpdateCallback)
host.ReloadInfoCallback.connect(self.fRack.slot_handleReloadInfoCallback)
host.ReloadParametersCallback.connect(self.fRack.slot_handleReloadParametersCallback)
host.ReloadParametersCallback.connect(self.fPatchbay.slot_handleReloadParametersCallback)
host.ReloadProgramsCallback.connect(self.fRack.slot_handleReloadProgramsCallback)
host.ReloadAllCallback.connect(self.fRack.slot_handleReloadAllCallback)
host.ReloadAllCallback.connect(self.fPatchbay.slot_handleReloadAllCallback)
host.PatchbayClientAddedCallback.connect(self.fPatchbay.slot_handlePatchbayClientAddedCallback)
host.PatchbayClientRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRemovedCallback)
host.PatchbayClientRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayClientRenamedCallback)
host.PatchbayClientDataChangedCallback.connect(self.fPatchbay.slot_handlePatchbayClientDataChangedCallback)
host.PatchbayPortAddedCallback.connect(self.fPatchbay.slot_handlePatchbayPortAddedCallback)
host.PatchbayPortRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRemovedCallback)
host.PatchbayPortRenamedCallback.connect(self.fPatchbay.slot_handlePatchbayPortRenamedCallback)
host.PatchbayConnectionAddedCallback.connect(self.fPatchbay.slot_handlePatchbayConnectionAddedCallback)
host.PatchbayConnectionRemovedCallback.connect(self.fPatchbay.slot_handlePatchbayConnectionRemovedCallback)


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


@@ -143,18 +150,15 @@ class CarlaMultiW(QTabWidget):
# ----------------------------------------------------------------- # -----------------------------------------------------------------


def engineStarted(self): def engineStarted(self):
pass
#self.fRack.engineStarted() #self.fRack.engineStarted()
#self.fPatchbay.engineStarted() #self.fPatchbay.engineStarted()
self.fParent.engineChanged()


def engineStopped(self): def engineStopped(self):
#self.fRack.engineStopped() #self.fRack.engineStopped()
self.fPatchbay.engineStopped() self.fPatchbay.engineStopped()
self.fParent.engineStopped() self.fParent.engineStopped()


def engineChanged(self):
self.fParent.engineChanged()

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


def idleFast(self): def idleFast(self):
@@ -257,9 +261,9 @@ class CarlaHostW(HostWindow):
self.fInfoText = "" self.fInfoText = ""
self.fInfoLabel.setText("Engine stopped") self.fInfoLabel.setText("Engine stopped")


def engineChanged(self):
self.fInfoText = "Engine running | SampleRate: %g | BufferSize: %i" % (gCarla.sampleRate, gCarla.bufferSize)
self.fInfoLabel.setText("%s | %s" % (self.fInfoText, self.fTextTransport))
#def engineChanged(self):
#self.fInfoText = "Engine running | SampleRate: %g | BufferSize: %i" % (gCarla.sampleRate, gCarla.bufferSize)
#self.fInfoLabel.setText("%s | %s" % (self.fInfoText, self.fTextTransport))


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




+ 53
- 2
source/carla_backend.py View File

@@ -16,6 +16,11 @@
# #
# For a full copy of the GNU General Public License see the doc/GPL.txt file. # For a full copy of the GNU General Public License see the doc/GPL.txt file.


# ------------------------------------------------------------------------------------------------------------
# Imports (Config)

from carla_config import *

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


@@ -25,6 +30,11 @@ from os import environ
from platform import architecture from platform import architecture
from sys import platform, maxsize from sys import platform, maxsize


if config_UseQt5:
from PyQt5.QtCore import pyqtSignal, QObject
else:
from PyQt4.QtCore import pyqtSignal, QObject

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# 64bit check # 64bit check


@@ -1237,9 +1247,50 @@ else:
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Carla Host object (Meta) # Carla Host object (Meta)


class CarlaHostMeta(object):
#class CarlaHostMeta(metaclass=ABCMeta):
class CarlaHostMeta(QObject):
#class CarlaHostMeta(QObject, metaclass=ABCMeta):
# signals
DebugCallback = pyqtSignal(int, int, int, float, str)
PluginAddedCallback = pyqtSignal(int, str)
PluginRemovedCallback = pyqtSignal(int)
PluginRenamedCallback = pyqtSignal(int, str)
PluginUnavailableCallback = pyqtSignal(int, str)
ParameterValueChangedCallback = pyqtSignal(int, int, float)
ParameterDefaultChangedCallback = pyqtSignal(int, int, float)
ParameterMidiCcChangedCallback = pyqtSignal(int, int, int)
ParameterMidiChannelChangedCallback = pyqtSignal(int, int, int)
ProgramChangedCallback = pyqtSignal(int, int)
MidiProgramChangedCallback = pyqtSignal(int, int)
OptionChangedCallback = pyqtSignal(int, int, bool)
UiStateChangedCallback = pyqtSignal(int, int)
NoteOnCallback = pyqtSignal(int, int, int, int)
NoteOffCallback = pyqtSignal(int, int, int)
UpdateCallback = pyqtSignal(int)
ReloadInfoCallback = pyqtSignal(int)
ReloadParametersCallback = pyqtSignal(int)
ReloadProgramsCallback = pyqtSignal(int)
ReloadAllCallback = pyqtSignal(int)
PatchbayClientAddedCallback = pyqtSignal(int, int, int, str)
PatchbayClientRemovedCallback = pyqtSignal(int)
PatchbayClientRenamedCallback = pyqtSignal(int, str)
PatchbayClientDataChangedCallback = pyqtSignal(int, int, int)
PatchbayPortAddedCallback = pyqtSignal(int, int, int, str)
PatchbayPortRemovedCallback = pyqtSignal(int, int)
PatchbayPortRenamedCallback = pyqtSignal(int, int, str)
PatchbayConnectionAddedCallback = pyqtSignal(int, int, int, int, int)
PatchbayConnectionRemovedCallback = pyqtSignal(int, int, int)
EngineStartedCallback = pyqtSignal(int, int, str)
EngineStoppedCallback = pyqtSignal()
ProcessModeChangedCallback = pyqtSignal(int)
TransportModeChangedCallback = pyqtSignal(int)
BufferSizeChangedCallback = pyqtSignal(int)
SampleRateChangedCallback = pyqtSignal(float)
InfoCallback = pyqtSignal(str)
ErrorCallback = pyqtSignal(str)
QuitCallback = pyqtSignal()

def __init__(self): def __init__(self):
QObject.__init__(self)


# info about this host object # info about this host object
self.isControl = False self.isControl = False


+ 408
- 525
source/carla_host.py
File diff suppressed because it is too large
View File


+ 25
- 27
source/carla_patchbay.py View File

@@ -102,7 +102,8 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta):


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


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


@@ -230,29 +231,29 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta):


parent.ui.act_settings_configure.triggered.connect(self.slot_configureCarla) parent.ui.act_settings_configure.triggered.connect(self.slot_configureCarla)


parent.ParameterValueChangedCallback.connect(self.slot_handleParameterValueChangedCallback)
parent.ParameterDefaultChangedCallback.connect(self.slot_handleParameterDefaultChangedCallback)
parent.ParameterMidiChannelChangedCallback.connect(self.slot_handleParameterMidiChannelChangedCallback)
parent.ParameterMidiCcChangedCallback.connect(self.slot_handleParameterMidiCcChangedCallback)
parent.ProgramChangedCallback.connect(self.slot_handleProgramChangedCallback)
parent.MidiProgramChangedCallback.connect(self.slot_handleMidiProgramChangedCallback)
parent.OptionChangedCallback.connect(self.slot_handleOptionChangedCallback)
parent.NoteOnCallback.connect(self.slot_handleNoteOnCallback)
parent.NoteOffCallback.connect(self.slot_handleNoteOffCallback)
parent.UpdateCallback.connect(self.slot_handleUpdateCallback)
parent.ReloadInfoCallback.connect(self.slot_handleReloadInfoCallback)
parent.ReloadParametersCallback.connect(self.slot_handleReloadParametersCallback)
parent.ReloadProgramsCallback.connect(self.slot_handleReloadProgramsCallback)
parent.ReloadAllCallback.connect(self.slot_handleReloadAllCallback)
parent.PatchbayClientAddedCallback.connect(self.slot_handlePatchbayClientAddedCallback)
parent.PatchbayClientRemovedCallback.connect(self.slot_handlePatchbayClientRemovedCallback)
parent.PatchbayClientRenamedCallback.connect(self.slot_handlePatchbayClientRenamedCallback)
parent.PatchbayClientDataChangedCallback.connect(self.slot_handlePatchbayClientDataChangedCallback)
parent.PatchbayPortAddedCallback.connect(self.slot_handlePatchbayPortAddedCallback)
parent.PatchbayPortRemovedCallback.connect(self.slot_handlePatchbayPortRemovedCallback)
parent.PatchbayPortRenamedCallback.connect(self.slot_handlePatchbayPortRenamedCallback)
parent.PatchbayConnectionAddedCallback.connect(self.slot_handlePatchbayConnectionAddedCallback)
parent.PatchbayConnectionRemovedCallback.connect(self.slot_handlePatchbayConnectionRemovedCallback)
host.ParameterValueChangedCallback.connect(self.slot_handleParameterValueChangedCallback)
host.ParameterDefaultChangedCallback.connect(self.slot_handleParameterDefaultChangedCallback)
host.ParameterMidiChannelChangedCallback.connect(self.slot_handleParameterMidiChannelChangedCallback)
host.ParameterMidiCcChangedCallback.connect(self.slot_handleParameterMidiCcChangedCallback)
host.ProgramChangedCallback.connect(self.slot_handleProgramChangedCallback)
host.MidiProgramChangedCallback.connect(self.slot_handleMidiProgramChangedCallback)
host.OptionChangedCallback.connect(self.slot_handleOptionChangedCallback)
host.NoteOnCallback.connect(self.slot_handleNoteOnCallback)
host.NoteOffCallback.connect(self.slot_handleNoteOffCallback)
host.UpdateCallback.connect(self.slot_handleUpdateCallback)
host.ReloadInfoCallback.connect(self.slot_handleReloadInfoCallback)
host.ReloadParametersCallback.connect(self.slot_handleReloadParametersCallback)
host.ReloadProgramsCallback.connect(self.slot_handleReloadProgramsCallback)
host.ReloadAllCallback.connect(self.slot_handleReloadAllCallback)
host.PatchbayClientAddedCallback.connect(self.slot_handlePatchbayClientAddedCallback)
host.PatchbayClientRemovedCallback.connect(self.slot_handlePatchbayClientRemovedCallback)
host.PatchbayClientRenamedCallback.connect(self.slot_handlePatchbayClientRenamedCallback)
host.PatchbayClientDataChangedCallback.connect(self.slot_handlePatchbayClientDataChangedCallback)
host.PatchbayPortAddedCallback.connect(self.slot_handlePatchbayPortAddedCallback)
host.PatchbayPortRemovedCallback.connect(self.slot_handlePatchbayPortRemovedCallback)
host.PatchbayPortRenamedCallback.connect(self.slot_handlePatchbayPortRenamedCallback)
host.PatchbayConnectionAddedCallback.connect(self.slot_handlePatchbayConnectionAddedCallback)
host.PatchbayConnectionRemovedCallback.connect(self.slot_handlePatchbayConnectionRemovedCallback)


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


@@ -337,9 +338,6 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta):
def engineStopped(self): def engineStopped(self):
patchcanvas.clear() patchcanvas.clear()


def engineChanged(self):
pass

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


def idleFast(self): def idleFast(self):


+ 15
- 18
source/carla_rack.py View File

@@ -305,21 +305,21 @@ class CarlaRackW(QFrame):


parent.ui.act_settings_configure.triggered.connect(self.slot_configureCarla) parent.ui.act_settings_configure.triggered.connect(self.slot_configureCarla)


parent.ParameterValueChangedCallback.connect(self.slot_handleParameterValueChangedCallback)
parent.ParameterDefaultChangedCallback.connect(self.slot_handleParameterDefaultChangedCallback)
parent.ParameterMidiChannelChangedCallback.connect(self.slot_handleParameterMidiChannelChangedCallback)
parent.ParameterMidiCcChangedCallback.connect(self.slot_handleParameterMidiCcChangedCallback)
parent.ProgramChangedCallback.connect(self.slot_handleProgramChangedCallback)
parent.MidiProgramChangedCallback.connect(self.slot_handleMidiProgramChangedCallback)
parent.OptionChangedCallback.connect(self.slot_handleOptionChangedCallback)
parent.UiStateChangedCallback.connect(self.slot_handleUiStateChangedCallback)
parent.NoteOnCallback.connect(self.slot_handleNoteOnCallback)
parent.NoteOffCallback.connect(self.slot_handleNoteOffCallback)
parent.UpdateCallback.connect(self.slot_handleUpdateCallback)
parent.ReloadInfoCallback.connect(self.slot_handleReloadInfoCallback)
parent.ReloadParametersCallback.connect(self.slot_handleReloadParametersCallback)
parent.ReloadProgramsCallback.connect(self.slot_handleReloadProgramsCallback)
parent.ReloadAllCallback.connect(self.slot_handleReloadAllCallback)
host.ParameterValueChangedCallback.connect(self.slot_handleParameterValueChangedCallback)
host.ParameterDefaultChangedCallback.connect(self.slot_handleParameterDefaultChangedCallback)
host.ParameterMidiChannelChangedCallback.connect(self.slot_handleParameterMidiChannelChangedCallback)
host.ParameterMidiCcChangedCallback.connect(self.slot_handleParameterMidiCcChangedCallback)
host.ProgramChangedCallback.connect(self.slot_handleProgramChangedCallback)
host.MidiProgramChangedCallback.connect(self.slot_handleMidiProgramChangedCallback)
host.OptionChangedCallback.connect(self.slot_handleOptionChangedCallback)
host.UiStateChangedCallback.connect(self.slot_handleUiStateChangedCallback)
host.NoteOnCallback.connect(self.slot_handleNoteOnCallback)
host.NoteOffCallback.connect(self.slot_handleNoteOffCallback)
host.UpdateCallback.connect(self.slot_handleUpdateCallback)
host.ReloadInfoCallback.connect(self.slot_handleReloadInfoCallback)
host.ReloadParametersCallback.connect(self.slot_handleReloadParametersCallback)
host.ReloadProgramsCallback.connect(self.slot_handleReloadProgramsCallback)
host.ReloadAllCallback.connect(self.slot_handleReloadAllCallback)


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


@@ -400,9 +400,6 @@ class CarlaRackW(QFrame):
def engineStopped(self): def engineStopped(self):
pass pass


def engineChanged(self):
pass

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


def idleFast(self): def idleFast(self):


+ 52
- 51
source/modules/native-plugins/resources/carla-plugin View File

@@ -26,11 +26,11 @@ from externalui import ExternalUI
# Host Plugin object # Host Plugin object


class PluginHost(CarlaHostPlugin): class PluginHost(CarlaHostPlugin):
def __init__(self, sampleRate):
def __init__(self):
CarlaHostPlugin.__init__(self) CarlaHostPlugin.__init__(self)


self.fIsRunning = True self.fIsRunning = True
self.fSampleRate = sampleRate
self.fSampleRate = float(sys.argv[1]) if len(sys.argv) > 1 else 44100.0


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


@@ -64,17 +64,27 @@ class PluginHost(CarlaHostPlugin):
# Main Window # Main Window


class CarlaMiniW(ExternalUI, HostWindow): class CarlaMiniW(ExternalUI, HostWindow):
def __init__(self):
def __init__(self, host):
# need to init this first
gCarla.gui = self

# now the regular stuff
ExternalUI.__init__(self) ExternalUI.__init__(self)
HostWindow.__init__(self, None)
HostWindow.__init__(self, host)
self.host = host

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


if sys.argv[0].lower().endswith("/carla-plugin-patchbay"): if sys.argv[0].lower().endswith("/carla-plugin-patchbay"):
from carla_patchbay import CarlaPatchbayW from carla_patchbay import CarlaPatchbayW
self.fContainer = CarlaPatchbayW(self)
self.fContainer = CarlaPatchbayW(self, host)
self.setupContainer(True, self.fContainer.themeData) self.setupContainer(True, self.fContainer.themeData)
else: else:
from carla_rack import CarlaRackW from carla_rack import CarlaRackW
self.fContainer = CarlaRackW(self)
self.fContainer = CarlaRackW(self, host)
self.setupContainer(False) self.setupContainer(False)


self.setWindowTitle(self.fUiName) self.setWindowTitle(self.fUiName)
@@ -122,12 +132,12 @@ class CarlaMiniW(ExternalUI, HostWindow):
elif msg.startswith("PEAKS_"): elif msg.startswith("PEAKS_"):
pluginId = int(msg.replace("PEAKS_", "")) pluginId = int(msg.replace("PEAKS_", ""))
in1, in2, out1, out2 = [float(i) for i in self.readlineblock().split(":")] in1, in2, out1, out2 = [float(i) for i in self.readlineblock().split(":")]
gCarla.host._set_peaks(pluginId, in1, in2, out1, out2)
self.host._set_peaks(pluginId, in1, in2, out1, out2)


elif msg.startswith("PARAMVAL_"): elif msg.startswith("PARAMVAL_"):
pluginId, paramId = [int(i) for i in msg.replace("PARAMVAL_", "").split(":")] pluginId, paramId = [int(i) for i in msg.replace("PARAMVAL_", "").split(":")]
paramValue = float(self.readlineblock()) paramValue = float(self.readlineblock())
gCarla.host._set_parameterValue(pluginId, paramId, paramValue)
self.host._set_parameterValue(pluginId, paramId, paramValue)


elif msg.startswith("ENGINE_CALLBACK_"): elif msg.startswith("ENGINE_CALLBACK_"):
action = int(msg.replace("ENGINE_CALLBACK_", "")) action = int(msg.replace("ENGINE_CALLBACK_", ""))
@@ -138,28 +148,28 @@ class CarlaMiniW(ExternalUI, HostWindow):
valueStr = self.readlineblock().replace("\r", "\n") valueStr = self.readlineblock().replace("\r", "\n")


if action == ENGINE_CALLBACK_PLUGIN_RENAMED: if action == ENGINE_CALLBACK_PLUGIN_RENAMED:
gCarla.host._set_pluginName(pluginId, valueStr)
self.host._set_pluginName(pluginId, valueStr)
elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED:
if value1 < 0: if value1 < 0:
gCarla.host._set_internalValue(pluginId, value1, value3)
self.host._set_internalValue(pluginId, value1, value3)
else: else:
gCarla.host._set_parameterValue(pluginId, value1, value3)
self.host._set_parameterValue(pluginId, value1, value3)
elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED: elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED:
gCarla.host._set_parameterDefault(pluginId, value1, value3)
self.host._set_parameterDefault(pluginId, value1, value3)
elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED: elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED:
gCarla.host._set_parameterMidiCC(pluginId, value1, value2)
self.host._set_parameterMidiCC(pluginId, value1, value2)
elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
gCarla.host._set_parameterMidiChannel(pluginId, value1, value2)
self.host._set_parameterMidiChannel(pluginId, value1, value2)
elif action == ENGINE_CALLBACK_PROGRAM_CHANGED: elif action == ENGINE_CALLBACK_PROGRAM_CHANGED:
gCarla.host._set_currentProgram(pluginId, value1)
self.host._set_currentProgram(pluginId, value1)
elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED: elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED:
gCarla.host._set_currentMidiProgram(pluginId, value1)
self.host._set_currentMidiProgram(pluginId, value1)


engineCallback(None, action, pluginId, value1, value2, value3, valueStr) engineCallback(None, action, pluginId, value1, value2, value3, valueStr)


elif msg.startswith("PLUGIN_INFO_"): elif msg.startswith("PLUGIN_INFO_"):
pluginId = int(msg.replace("PLUGIN_INFO_", "")) pluginId = int(msg.replace("PLUGIN_INFO_", ""))
gCarla.host._add(pluginId)
self.host._add(pluginId)


type_, category, hints, uniqueId, optsAvail, optsEnabled = [int(i) for i in self.readlineblock().split(":")] type_, category, hints, uniqueId, optsAvail, optsEnabled = [int(i) for i in self.readlineblock().split(":")]
filename = self.readlineblock().replace("\r", "\n") filename = self.readlineblock().replace("\r", "\n")
@@ -185,20 +195,20 @@ class CarlaMiniW(ExternalUI, HostWindow):
'patchbayClientId': 0, 'patchbayClientId': 0,
'uniqueId': uniqueId 'uniqueId': uniqueId
} }
gCarla.host._set_pluginInfo(pluginId, pinfo)
gCarla.host._set_pluginRealName(pluginId, realName)
self.host._set_pluginInfo(pluginId, pinfo)
self.host._set_pluginRealName(pluginId, realName)


elif msg.startswith("AUDIO_COUNT_"): elif msg.startswith("AUDIO_COUNT_"):
pluginId, ins, outs = [int(i) for i in msg.replace("AUDIO_COUNT_", "").split(":")] pluginId, ins, outs = [int(i) for i in msg.replace("AUDIO_COUNT_", "").split(":")]
gCarla.host._set_audioCountInfo(pluginId, {'ins': ins, 'outs': outs})
self.host._set_audioCountInfo(pluginId, {'ins': ins, 'outs': outs})


elif msg.startswith("MIDI_COUNT_"): elif msg.startswith("MIDI_COUNT_"):
pluginId, ins, outs = [int(i) for i in msg.replace("MIDI_COUNT_", "").split(":")] pluginId, ins, outs = [int(i) for i in msg.replace("MIDI_COUNT_", "").split(":")]
gCarla.host._set_midiCountInfo(pluginId, {'ins': ins, 'outs': outs})
self.host._set_midiCountInfo(pluginId, {'ins': ins, 'outs': outs})


elif msg.startswith("PARAMETER_COUNT_"): elif msg.startswith("PARAMETER_COUNT_"):
pluginId, ins, outs, count = [int(i) for i in msg.replace("PARAMETER_COUNT_", "").split(":")] pluginId, ins, outs, count = [int(i) for i in msg.replace("PARAMETER_COUNT_", "").split(":")]
gCarla.host._set_parameterCountInfo(pluginId, count, {'ins': ins, 'outs': outs})
self.host._set_parameterCountInfo(pluginId, count, {'ins': ins, 'outs': outs})


elif msg.startswith("PARAMETER_DATA_"): elif msg.startswith("PARAMETER_DATA_"):
pluginId, paramId = [int(i) for i in msg.replace("PARAMETER_DATA_", "").split(":")] pluginId, paramId = [int(i) for i in msg.replace("PARAMETER_DATA_", "").split(":")]
@@ -212,7 +222,7 @@ class CarlaMiniW(ExternalUI, HostWindow):
'unit': paramUnit, 'unit': paramUnit,
'scalePointCount': 0, 'scalePointCount': 0,
} }
gCarla.host._set_parameterInfo(pluginId, paramId, paramInfo)
self.host._set_parameterInfo(pluginId, paramId, paramInfo)


paramData = { paramData = {
'type': paramType, 'type': paramType,
@@ -222,7 +232,7 @@ class CarlaMiniW(ExternalUI, HostWindow):
'midiCC': midiCC, 'midiCC': midiCC,
'midiChannel': midiChannel 'midiChannel': midiChannel
} }
gCarla.host._set_parameterData(pluginId, paramId, paramData)
self.host._set_parameterData(pluginId, paramId, paramData)


elif msg.startswith("PARAMETER_RANGES_"): elif msg.startswith("PARAMETER_RANGES_"):
pluginId, paramId = [int(i) for i in msg.replace("PARAMETER_RANGES_", "").split(":")] pluginId, paramId = [int(i) for i in msg.replace("PARAMETER_RANGES_", "").split(":")]
@@ -236,28 +246,28 @@ class CarlaMiniW(ExternalUI, HostWindow):
'stepSmall': stepSmall, 'stepSmall': stepSmall,
'stepLarge': stepLarge 'stepLarge': stepLarge
} }
gCarla.host._set_parameterRanges(pluginId, paramId, paramRanges)
self.host._set_parameterRanges(pluginId, paramId, paramRanges)


elif msg.startswith("PROGRAM_COUNT_"): elif msg.startswith("PROGRAM_COUNT_"):
pluginId, count, current = [int(i) for i in msg.replace("PROGRAM_COUNT_", "").split(":")] pluginId, count, current = [int(i) for i in msg.replace("PROGRAM_COUNT_", "").split(":")]
gCarla.host._set_programCount(pluginId, count)
gCarla.host._set_currentProgram(pluginId, current)
self.host._set_programCount(pluginId, count)
self.host._set_currentProgram(pluginId, current)


elif msg.startswith("PROGRAM_NAME_"): elif msg.startswith("PROGRAM_NAME_"):
pluginId, progId = [int(i) for i in msg.replace("PROGRAM_NAME_", "").split(":")] pluginId, progId = [int(i) for i in msg.replace("PROGRAM_NAME_", "").split(":")]
progName = self.readlineblock().replace("\r", "\n") progName = self.readlineblock().replace("\r", "\n")
gCarla.host._set_programName(pluginId, progId, progName)
self.host._set_programName(pluginId, progId, progName)


elif msg.startswith("MIDI_PROGRAM_COUNT_"): elif msg.startswith("MIDI_PROGRAM_COUNT_"):
pluginId, count, current = [int(i) for i in msg.replace("MIDI_PROGRAM_COUNT_", "").split(":")] pluginId, count, current = [int(i) for i in msg.replace("MIDI_PROGRAM_COUNT_", "").split(":")]
gCarla.host._set_midiProgramCount(pluginId, count)
gCarla.host._set_currentMidiProgram(pluginId, current)
self.host._set_midiProgramCount(pluginId, count)
self.host._set_currentMidiProgram(pluginId, current)


elif msg.startswith("MIDI_PROGRAM_DATA_"): elif msg.startswith("MIDI_PROGRAM_DATA_"):
pluginId, midiProgId = [int(i) for i in msg.replace("MIDI_PROGRAM_DATA_", "").split(":")] pluginId, midiProgId = [int(i) for i in msg.replace("MIDI_PROGRAM_DATA_", "").split(":")]
bank, program = [int(i) for i in self.readlineblock().split(":")] bank, program = [int(i) for i in self.readlineblock().split(":")]
name = self.readlineblock().replace("\r", "\n") name = self.readlineblock().replace("\r", "\n")
gCarla.host._set_midiProgramData(pluginId, midiProgId, {'bank': bank, 'program': program, 'name': name})
self.host._set_midiProgramData(pluginId, midiProgId, {'bank': bank, 'program': program, 'name': name})


elif msg == "error": elif msg == "error":
error = self.readlineblock().replace("\r", "\n") error = self.readlineblock().replace("\r", "\n")
@@ -297,34 +307,25 @@ if __name__ == '__main__':
setUpSignals() setUpSignals()


# ------------------------------------------------------------- # -------------------------------------------------------------
# Init plugin host data
# Init host backend


gCarla.isControl = False
gCarla.isLocal = True
gCarla.isPlugin = True
gCarla.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK
host = initHost("Carla-Plugin", PluginHost, False, True, True)
host.processMode = ENGINE_PROCESS_MODE_PATCHBAY if sys.argv[0].lower().endswith("/carla-plugin-patchbay") else ENGINE_PROCESS_MODE_CONTINUOUS_RACK


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

gCarla.gui = CarlaMiniW()
# FIXME
loadHostSettings(host)


# ------------------------------------------------------------- # -------------------------------------------------------------
# Init plugin host now
# Create GUI


gCarla.host = PluginHost(gCarla.gui.d_getSampleRate())
gCarla.gui = CarlaMiniW(host)


initHost("Carla-Plugin")
# -------------------------------------------------------------
# simulate an engire started callback FIXME


# simulate an engire started callback
engineCallback(None, ENGINE_CALLBACK_ENGINE_STARTED, 0, ENGINE_PROCESS_MODE_CONTINUOUS_RACK, ENGINE_TRANSPORT_MODE_PLUGIN, 0.0, "Plugin")
engineCallback(host, ENGINE_CALLBACK_ENGINE_STARTED, 0, host.processMode, ENGINE_TRANSPORT_MODE_PLUGIN, 0.0, "Plugin")


# ------------------------------------------------------------- # -------------------------------------------------------------
# App-Loop # App-Loop


ret = app.exec_()

# disable parenting
gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, "0")

sys.exit(ret)
app.exit_exec()

Loading…
Cancel
Save