diff --git a/source/carla b/source/carla index 6e427c0e6..49660c557 100755 --- a/source/carla +++ b/source/carla @@ -221,7 +221,7 @@ class CarlaHostW(HostWindow): self.fInfoLabel.setText("Engine stopped") def engineChanged(self): - self.fInfoText = "Engine running | SampleRate: %g | BufferSize: %i" % (Carla.sampleRate, Carla.bufferSize) + self.fInfoText = "Engine running | SampleRate: %g | BufferSize: %i" % (gCarla.sampleRate, gCarla.bufferSize) self.fInfoLabel.setText("%s | %s" % (self.fInfoText, self.fTextTransport)) # ----------------------------------------------------------------- @@ -320,30 +320,30 @@ if __name__ == '__main__': # ------------------------------------------------------------- # Init host backend - Carla.isControl = False - Carla.isLocal = True - Carla.isPlugin = False + gCarla.isControl = False + gCarla.isLocal = True + gCarla.isPlugin = False initHost(appName, libPrefix) # ------------------------------------------------------------- # Create GUI - Carla.gui = CarlaHostW() + gCarla.gui = CarlaHostW() # set our gui as parent for all plugins UIs - Carla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(Carla.gui.winId())) + gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(gCarla.gui.winId())) # ------------------------------------------------------------- # Load project file if set if projectFilename is not None: - Carla.gui.loadProjectLater(projectFilename) + gCarla.gui.loadProjectLater(projectFilename) # ------------------------------------------------------------- # Show GUI - Carla.gui.show() + gCarla.gui.show() # ------------------------------------------------------------- # App-Loop diff --git a/source/carla-patchbay b/source/carla-patchbay index 28cb444ab..434c97f6c 100755 --- a/source/carla-patchbay +++ b/source/carla-patchbay @@ -75,31 +75,31 @@ if __name__ == '__main__': # ------------------------------------------------------------- # Init host backend - Carla.isControl = False - Carla.isLocal = True - Carla.isPlugin = False - Carla.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS + gCarla.isControl = False + gCarla.isLocal = True + gCarla.isPlugin = False + gCarla.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS initHost(appName, libPrefix) # ------------------------------------------------------------- # Create GUI - Carla.gui = CarlaHostW() + gCarla.gui = CarlaHostW() # set our gui as parent for all plugins UIs - Carla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(Carla.gui.winId())) + gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(gCarla.gui.winId())) # ------------------------------------------------------------- # Load project file if set if projectFilename is not None: - Carla.gui.loadProjectLater(projectFilename) + gCarla.gui.loadProjectLater(projectFilename) # ------------------------------------------------------------- # Show GUI - Carla.gui.show() + gCarla.gui.show() # ------------------------------------------------------------- # App-Loop diff --git a/source/carla-plugin b/source/carla-plugin index 40b66a79a..b3ba5deb8 100755 --- a/source/carla-plugin +++ b/source/carla-plugin @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Carla plugin host (plugin UI) -# Copyright (C) 2013 Filipe Coelho +# Copyright (C) 2013-2014 Filipe Coelho # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -221,11 +221,11 @@ class PluginHost(object): return True def engine_idle(self): - if Carla.gui.idleExternalUI(): + if gCarla.gui.idleExternalUI(): return self.fIsRunning = False - Carla.gui.d_uiQuit() + gCarla.gui.d_uiQuit() def is_engine_running(self): return self.fIsRunning @@ -237,7 +237,7 @@ class PluginHost(object): pass def set_engine_option(self, option, value, valueStr): - Carla.gui.send(["set_engine_option", option, value, valueStr]) + gCarla.gui.send(["set_engine_option", option, value, valueStr]) # ------------------------------------------------------------------- @@ -245,41 +245,41 @@ class PluginHost(object): pass def load_file(self, filename): - Carla.gui.send(["load_file", filename]) + gCarla.gui.send(["load_file", filename]) return True def load_project(self, filename): - Carla.gui.send(["load_project", filename]) + gCarla.gui.send(["load_project", filename]) return True def save_project(self, filename): - Carla.gui.send(["save_project", filename]) + gCarla.gui.send(["save_project", filename]) return True # ------------------------------------------------------------------- def patchbay_connect(self, portIdA, portIdB): - Carla.gui.send(["patchbay_connect", portIdA, portIdB]) + gCarla.gui.send(["patchbay_connect", portIdA, portIdB]) return True def patchbay_disconnect(self, connectionId): - Carla.gui.send(["patchbay_disconnect", connectionId]) + gCarla.gui.send(["patchbay_disconnect", connectionId]) return True def patchbay_refresh(self): - Carla.gui.send(["patchbay_refresh"]) + gCarla.gui.send(["patchbay_refresh"]) return True # ------------------------------------------------------------------- def transport_play(self): - Carla.gui.send(["transport_play"]) + gCarla.gui.send(["transport_play"]) def transport_pause(self): - Carla.gui.send(["transport_pause"]) + gCarla.gui.send(["transport_pause"]) def transport_relocate(self, frame): - Carla.gui.send(["transport_relocate"]) + gCarla.gui.send(["transport_relocate"]) def get_current_transport_frame(self): return 0 @@ -290,41 +290,41 @@ class PluginHost(object): # ------------------------------------------------------------------- def add_plugin(self, btype, ptype, filename, name, label, extraPtr): - Carla.gui.send(["add_plugin", btype, ptype, filename, name, label]) + gCarla.gui.send(["add_plugin", btype, ptype, filename, name, label]) return True def remove_plugin(self, pluginId): - Carla.gui.send(["remove_plugin", pluginId]) + gCarla.gui.send(["remove_plugin", pluginId]) return True def remove_all_plugins(self): - Carla.gui.send(["remove_all_plugins"]) + gCarla.gui.send(["remove_all_plugins"]) return True def rename_plugin(self, pluginId, newName): - Carla.gui.send(["rename_plugin", pluginId, newName]) + gCarla.gui.send(["rename_plugin", pluginId, newName]) return newName def clone_plugin(self, pluginId): - Carla.gui.send(["clone_plugin", pluginId]) + gCarla.gui.send(["clone_plugin", pluginId]) return True def replace_plugin(self, pluginId): - Carla.gui.send(["replace_plugin", pluginId]) + gCarla.gui.send(["replace_plugin", pluginId]) return True def switch_plugins(self, pluginIdA, pluginIdB): - Carla.gui.send(["switch_plugins", pluginIdA, pluginIdB]) + gCarla.gui.send(["switch_plugins", pluginIdA, pluginIdB]) return True # ------------------------------------------------------------------- def load_plugin_state(self, pluginId, filename): - Carla.gui.send(["load_plugin_state", pluginId, filename]) + gCarla.gui.send(["load_plugin_state", pluginId, filename]) return True def save_plugin_state(self, pluginId, filename): - Carla.gui.send(["save_plugin_state", pluginId, filename]) + gCarla.gui.send(["save_plugin_state", pluginId, filename]) return True # ------------------------------------------------------------------- @@ -415,62 +415,62 @@ class PluginHost(object): # ------------------------------------------------------------------- def set_option(self, pluginId, option, yesNo): - Carla.gui.send(["set_option", pluginId, option, yesNo]) + gCarla.gui.send(["set_option", pluginId, option, yesNo]) def set_active(self, pluginId, onOff): - Carla.gui.send(["set_active", pluginId, onOff]) + gCarla.gui.send(["set_active", pluginId, onOff]) def set_drywet(self, pluginId, value): - Carla.gui.send(["set_drywet", pluginId, value]) + gCarla.gui.send(["set_drywet", pluginId, value]) def set_volume(self, pluginId, value): - Carla.gui.send(["set_volume", pluginId, value]) + gCarla.gui.send(["set_volume", pluginId, value]) def set_balance_left(self, pluginId, value): - Carla.gui.send(["set_balance_left", pluginId, value]) + gCarla.gui.send(["set_balance_left", pluginId, value]) def set_balance_right(self, pluginId, value): - Carla.gui.send(["set_balance_right", pluginId, value]) + gCarla.gui.send(["set_balance_right", pluginId, value]) def set_panning(self, pluginId, value): - Carla.gui.send(["set_panning", pluginId, value]) + gCarla.gui.send(["set_panning", pluginId, value]) def set_ctrl_channel(self, pluginId, channel): - Carla.gui.send(["set_ctrl_channel", pluginId, channel]) + gCarla.gui.send(["set_ctrl_channel", pluginId, channel]) # ------------------------------------------------------------------- def set_parameter_value(self, pluginId, parameterId, value): - Carla.gui.send(["set_parameter_value", pluginId, parameterId, value]) + gCarla.gui.send(["set_parameter_value", pluginId, parameterId, value]) def set_parameter_midi_channel(self, pluginId, parameterId, channel): - Carla.gui.send(["set_parameter_midi_channel", pluginId, parameterId, channel]) + gCarla.gui.send(["set_parameter_midi_channel", pluginId, parameterId, channel]) def set_parameter_midi_cc(self, pluginId, parameterId, cc): - Carla.gui.send(["set_parameter_midi_cc", pluginId, parameterId, cc]) + gCarla.gui.send(["set_parameter_midi_cc", pluginId, parameterId, cc]) def set_program(self, pluginId, programId): - Carla.gui.send(["set_program", pluginId, programId]) + gCarla.gui.send(["set_program", pluginId, programId]) def set_midi_program(self, pluginId, midiProgramId): - Carla.gui.send(["set_midi_program", pluginId, midiProgramId]) + gCarla.gui.send(["set_midi_program", pluginId, midiProgramId]) def set_custom_data(self, pluginId, type_, key, value): - Carla.gui.send(["set_custom_data", pluginId, type_, key, value]) + gCarla.gui.send(["set_custom_data", pluginId, type_, key, value]) def set_chunk_data(self, pluginId, chunkData): - Carla.gui.send(["set_chunk_data", pluginId, chunkData]) + gCarla.gui.send(["set_chunk_data", pluginId, chunkData]) # ------------------------------------------------------------------- def prepare_for_save(self, pluginId): - Carla.gui.send(["prepare_for_save", pluginId]) + gCarla.gui.send(["prepare_for_save", pluginId]) def send_midi_note(self, pluginId, channel, note, velocity): - Carla.gui.send(["send_midi_note", pluginId, channel, note, velocity]) + gCarla.gui.send(["send_midi_note", pluginId, channel, note, velocity]) def show_custom_ui(self, pluginId, yesNo): - Carla.gui.send(["show_custom_ui", pluginId, yesNo]) + gCarla.gui.send(["show_custom_ui", pluginId, yesNo]) # ------------------------------------------------------------------- @@ -551,12 +551,12 @@ class CarlaMiniW(HostWindow, ExternalUI): elif msg.startswith("PEAKS_"): pluginId = int(msg.replace("PEAKS_", "")) in1, in2, out1, out2 = [float(i) for i in self.fPipeRecv.readline().strip().split(":")] - Carla.host._set_peaks(pluginId, in1, in2, out1, out2) + gCarla.host._set_peaks(pluginId, in1, in2, out1, out2) elif msg.startswith("PARAMVAL_"): pluginId, paramId = [int(i) for i in msg.replace("PARAMVAL_", "").split(":")] paramValue = float(self.fPipeRecv.readline().strip()) - Carla.host._set_parameterValueS(pluginId, paramId, paramValue) + gCarla.host._set_parameterValueS(pluginId, paramId, paramValue) elif msg.startswith("ENGINE_CALLBACK_"): action = int(msg.replace("ENGINE_CALLBACK_", "")) @@ -567,25 +567,25 @@ class CarlaMiniW(HostWindow, ExternalUI): valueStr = self.fPipeRecv.readline().strip().replace("\r", "\n") if action == ENGINE_CALLBACK_PLUGIN_RENAMED: - Carla.host._set_pluginName(pluginId, valueStr) + gCarla.host._set_pluginName(pluginId, valueStr) elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: - Carla.host._set_parameterValueS(pluginId, value1, value3) + gCarla.host._set_parameterValueS(pluginId, value1, value3) elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED: - Carla.host._set_parameterDefault(pluginId, value1, value3) + gCarla.host._set_parameterDefault(pluginId, value1, value3) elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED: - Carla.host._set_parameterMidiCC(pluginId, value1, value2) + gCarla.host._set_parameterMidiCC(pluginId, value1, value2) elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: - Carla.host._set_parameterMidiChannel(pluginId, value1, value2) + gCarla.host._set_parameterMidiChannel(pluginId, value1, value2) elif action == ENGINE_CALLBACK_PROGRAM_CHANGED: - Carla.host._set_currentProgram(pluginId, value1) + gCarla.host._set_currentProgram(pluginId, value1) elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED: - Carla.host._set_currentMidiProgram(pluginId, value1) + gCarla.host._set_currentMidiProgram(pluginId, value1) engineCallback(None, action, pluginId, value1, value2, value3, valueStr) elif msg.startswith("PLUGIN_INFO_"): pluginId = int(msg.replace("PLUGIN_INFO_", "")) - Carla.host._add(pluginId) + gCarla.host._add(pluginId) type_, category, hints, uniqueId, optsAvail, optsEnabled = [int(i) for i in self.fPipeRecv.readline().strip().split(":")] filename = self.fPipeRecv.readline().strip().replace("\r", "\n") @@ -611,20 +611,20 @@ class CarlaMiniW(HostWindow, ExternalUI): 'patchbayClientId': 0, 'uniqueId': uniqueId } - Carla.host._set_pluginInfo(pluginId, pinfo) - Carla.host._set_pluginRealName(pluginId, realName) + gCarla.host._set_pluginInfo(pluginId, pinfo) + gCarla.host._set_pluginRealName(pluginId, realName) elif msg.startswith("AUDIO_COUNT_"): pluginId, ins, outs = [int(i) for i in msg.replace("AUDIO_COUNT_", "").split(":")] - Carla.host._set_audioCountInfo(pluginId, {'ins': ins, 'outs': outs}) + gCarla.host._set_audioCountInfo(pluginId, {'ins': ins, 'outs': outs}) elif msg.startswith("MIDI_COUNT_"): pluginId, ins, outs = [int(i) for i in msg.replace("MIDI_COUNT_", "").split(":")] - Carla.host._set_midiCountInfo(pluginId, {'ins': ins, 'outs': outs}) + gCarla.host._set_midiCountInfo(pluginId, {'ins': ins, 'outs': outs}) elif msg.startswith("PARAMETER_COUNT_"): pluginId, ins, outs, count = [int(i) for i in msg.replace("PARAMETER_COUNT_", "").split(":")] - Carla.host._set_parameterCountInfo(pluginId, count, {'ins': ins, 'outs': outs}) + gCarla.host._set_parameterCountInfo(pluginId, count, {'ins': ins, 'outs': outs}) elif msg.startswith("PARAMETER_DATA_"): pluginId, paramId = [int(i) for i in msg.replace("PARAMETER_DATA_", "").split(":")] @@ -638,7 +638,7 @@ class CarlaMiniW(HostWindow, ExternalUI): 'unit': paramUnit, 'scalePointCount': 0, } - Carla.host._set_parameterInfoS(pluginId, paramId, paramInfo) + gCarla.host._set_parameterInfoS(pluginId, paramId, paramInfo) paramData = { 'type': paramType, @@ -648,7 +648,7 @@ class CarlaMiniW(HostWindow, ExternalUI): 'midiCC': midiCC, 'midiChannel': midiChannel } - Carla.host._set_parameterDataS(pluginId, paramId, paramData) + gCarla.host._set_parameterDataS(pluginId, paramId, paramData) elif msg.startswith("PARAMETER_RANGES_"): pluginId, paramId = [int(i) for i in msg.replace("PARAMETER_RANGES_", "").split(":")] @@ -662,28 +662,28 @@ class CarlaMiniW(HostWindow, ExternalUI): 'stepSmall': stepSmall, 'stepLarge': stepLarge } - Carla.host._set_parameterRangeS(pluginId, paramId, paramRanges) + gCarla.host._set_parameterRangeS(pluginId, paramId, paramRanges) elif msg.startswith("PROGRAM_COUNT_"): pluginId, count, current = [int(i) for i in msg.replace("PROGRAM_COUNT_", "").split(":")] - Carla.host._set_programCount(pluginId, count) - Carla.host._set_currentProgram(pluginId, current) + gCarla.host._set_programCount(pluginId, count) + gCarla.host._set_currentProgram(pluginId, current) elif msg.startswith("PROGRAM_NAME_"): pluginId, progId = [int(i) for i in msg.replace("PROGRAM_NAME_", "").split(":")] progName = self.fPipeRecv.readline().strip().replace("\r", "\n") - Carla.host._set_programNameS(pluginId, progId, progName) + gCarla.host._set_programNameS(pluginId, progId, progName) elif msg.startswith("MIDI_PROGRAM_COUNT_"): pluginId, count, current = [int(i) for i in msg.replace("MIDI_PROGRAM_COUNT_", "").split(":")] - Carla.host._set_midiProgramCount(pluginId, count) - Carla.host._set_currentMidiProgram(pluginId, current) + gCarla.host._set_midiProgramCount(pluginId, count) + gCarla.host._set_currentMidiProgram(pluginId, current) elif msg.startswith("MIDI_PROGRAM_DATA_"): pluginId, midiProgId = [int(i) for i in msg.replace("MIDI_PROGRAM_DATA_", "").split(":")] bank, program = [int(i) for i in self.fPipeRecv.readline().strip().split(":")] name = self.fPipeRecv.readline().strip().replace("\r", "\n") - Carla.host._set_midiProgramDataS(pluginId, midiProgId, {'bank': bank, 'program': program, 'name': name}) + gCarla.host._set_midiProgramDataS(pluginId, midiProgId, {'bank': bank, 'program': program, 'name': name}) elif msg == "error": error = self.fPipeRecv.readline().strip().replace("\r", "\n") @@ -725,24 +725,24 @@ if __name__ == '__main__': # ------------------------------------------------------------- # Init plugin host data - Carla.isControl = False - Carla.isLocal = True - Carla.isPlugin = True + gCarla.isControl = False + gCarla.isLocal = True + gCarla.isPlugin = True # ------------------------------------------------------------- # Create GUI first - Carla.gui = CarlaMiniW() + gCarla.gui = CarlaMiniW() # ------------------------------------------------------------- # Init plugin host now - Carla.host = PluginHost(Carla.gui.d_getSampleRate()) + gCarla.host = PluginHost(gCarla.gui.d_getSampleRate()) initHost("Carla-Plugin") # set our gui as parent for all plugins UIs - Carla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(Carla.gui.winId())) + gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(gCarla.gui.winId())) # simulate an engire started callback engineCallback(None, ENGINE_CALLBACK_ENGINE_STARTED, 0, ENGINE_PROCESS_MODE_CONTINUOUS_RACK, ENGINE_TRANSPORT_MODE_PLUGIN, 0.0, "Plugin") @@ -753,6 +753,6 @@ if __name__ == '__main__': ret = app.exec_() # disable parenting - Carla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, "0") + gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, "0") sys.exit(ret) diff --git a/source/carla-rack b/source/carla-rack index 668078571..2fdface0e 100755 --- a/source/carla-rack +++ b/source/carla-rack @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Carla plugin host -# Copyright (C) 2011-2013 Filipe Coelho +# Copyright (C) 2011-2014 Filipe Coelho # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -75,31 +75,31 @@ if __name__ == '__main__': # ------------------------------------------------------------- # Init host backend - Carla.isControl = False - Carla.isLocal = True - Carla.isPlugin = False - Carla.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK + gCarla.isControl = False + gCarla.isLocal = True + gCarla.isPlugin = False + gCarla.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK initHost(appName, libPrefix) # ------------------------------------------------------------- # Create GUI - Carla.gui = CarlaHostW() + gCarla.gui = CarlaHostW() # set our gui as parent for all plugins UIs - Carla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(Carla.gui.winId())) + gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(gCarla.gui.winId())) # ------------------------------------------------------------- # Load project file if set if projectFilename is not None: - Carla.gui.loadProjectLater(projectFilename) + gCarla.gui.loadProjectLater(projectFilename) # ------------------------------------------------------------- # Show GUI - Carla.gui.show() + gCarla.gui.show() # ------------------------------------------------------------- # App-Loop diff --git a/source/carla_control.py b/source/carla_control.py index 8080a09a3..b7b6aeb35 100755 --- a/source/carla_control.py +++ b/source/carla_control.py @@ -633,7 +633,7 @@ class CarlaControlW(QMainWindow): self.fPluginCount = 0 self.fPluginList = [] - Carla.host.fPluginsInfo = [] + gCarla.host.fPluginsInfo = [] self.fIdleTimerFast = self.startTimer(60) self.fIdleTimerSlow = self.startTimer(60*2) @@ -676,7 +676,7 @@ class CarlaControlW(QMainWindow): @pyqtSlot(int, str) def slot_handleAddPluginStart(self, pluginId, pluginName): self.fLastPluginName = pluginName - Carla.host._add(pluginId) + gCarla.host._add(pluginId) @pyqtSlot(int) def slot_handleAddPluginEnd(self, pluginId): @@ -712,7 +712,7 @@ class CarlaControlW(QMainWindow): for i in range(pluginId, self.fPluginCount): self.fPluginList[i].setId(i) - Carla.host.fPluginsInfo.pop(pluginId) + gCarla.host.fPluginsInfo.pop(pluginId) @pyqtSlot(int, int, int, int, str, str, str, str, int) def slot_handleSetPluginData(self, pluginId, type_, category, hints, realName, label, maker, copyright, uniqueId): @@ -725,8 +725,8 @@ class CarlaControlW(QMainWindow): info['maker'] = maker info['copyright'] = copyright info['uniqueId'] = uniqueId - Carla.host._set_pluginInfo(pluginId, info) - Carla.host._set_pluginRealName(pluginId, realName) + gCarla.host._set_pluginInfo(pluginId, info) + gCarla.host._set_pluginRealName(pluginId, realName) @pyqtSlot(int, int, int, int, int, int, int, int) def slot_handleSetPluginPorts(self, pluginId, audioIns, audioOuts, midiIns, midiOuts, cIns, cOuts, cTotals): @@ -746,9 +746,9 @@ class CarlaControlW(QMainWindow): paramInfo['outs'] = cOuts paramInfo['total'] = cTotals - Carla.host._set_audioCountInfo(pluginId, audioInfo) - Carla.host._set_midiCountInfo(pluginId, midiInfo) - Carla.host._set_parameterCountInfo(pluginId, paramInfo) + gCarla.host._set_audioCountInfo(pluginId, audioInfo) + gCarla.host._set_midiCountInfo(pluginId, midiInfo) + gCarla.host._set_parameterCountInfo(pluginId, paramInfo) @pyqtSlot(int, int, int, int, str, str, float) def slot_handleSetParameterData(self, pluginId, index, type_, hints, name, label, current): @@ -765,9 +765,9 @@ class CarlaControlW(QMainWindow): info['name'] = name info['label'] = label - Carla.host._set_parameterDataS(pluginId, index, data) - Carla.host._set_parameterInfoS(pluginId, index, info) - Carla.host._set_parameterValueS(pluginId, index, current) + gCarla.host._set_parameterDataS(pluginId, index, data) + gCarla.host._set_parameterInfoS(pluginId, index, info) + gCarla.host._set_parameterValueS(pluginId, index, current) @pyqtSlot(int, int, float, float, float, float, float, float) def slot_handleSetParameterRanges(self, pluginId, index, min_, max_, def_, step, stepSmall, stepLarge): @@ -779,12 +779,12 @@ class CarlaControlW(QMainWindow): ranges['stepSmall'] = stepSmall ranges['stepLarge'] = stepLarge - Carla.host._set_parameterRangeS(pluginId, index, ranges) + gCarla.host._set_parameterRangeS(pluginId, index, ranges) @pyqtSlot(int, int, float) def slot_handleSetParameterValue(self, pluginId, parameterId, value): if parameterId >= 0: - Carla.host._set_parameterValueS(pluginId, parameterId, value) + gCarla.host._set_parameterValueS(pluginId, parameterId, value) if pluginId >= self.fPluginCount: return @@ -797,7 +797,7 @@ class CarlaControlW(QMainWindow): @pyqtSlot(int, int, float) def slot_handleSetDefaultValue(self, pluginId, parameterId, value): - Carla.host._set_parameterDefaultValue(pluginId, parameterId, value) + gCarla.host._set_parameterDefaultValue(pluginId, parameterId, value) if pluginId >= self.fPluginCount: return @@ -810,7 +810,7 @@ class CarlaControlW(QMainWindow): @pyqtSlot(int, int, int) def slot_handleSetParameterMidiCC(self, pluginId, index, cc): - Carla.host._set_parameterMidiCC(pluginId, index, cc) + gCarla.host._set_parameterMidiCC(pluginId, index, cc) if pluginId >= self.fPluginCount: return @@ -823,7 +823,7 @@ class CarlaControlW(QMainWindow): @pyqtSlot(int, int, int) def slot_handleSetParameterMidiChannel(self, pluginId, index, channel): - Carla.host._set_parameterMidiChannel(pluginId, index, channel) + gCarla.host._set_parameterMidiChannel(pluginId, index, channel) if pluginId >= self.fPluginCount: return @@ -836,7 +836,7 @@ class CarlaControlW(QMainWindow): @pyqtSlot(int, int) def slot_handleSetProgram(self, pluginId, index): - Carla.host._set_currentProgram(pluginId, index) + gCarla.host._set_currentProgram(pluginId, index) if pluginId >= self.fPluginCount: return @@ -849,15 +849,15 @@ class CarlaControlW(QMainWindow): @pyqtSlot(int, int) def slot_handleSetProgramCount(self, pluginId, count): - Carla.host._set_programCount(pluginId, count) + gCarla.host._set_programCount(pluginId, count) @pyqtSlot(int, int, str) def slot_handleSetProgramName(self, pluginId, index, name): - Carla.host._set_programNameS(pluginId, index, name) + gCarla.host._set_programNameS(pluginId, index, name) @pyqtSlot(int, int) def slot_handleSetMidiProgram(self, pluginId, index): - Carla.host._set_currentMidiProgram(pluginId, index) + gCarla.host._set_currentMidiProgram(pluginId, index) if pluginId >= self.fPluginCount: return @@ -870,7 +870,7 @@ class CarlaControlW(QMainWindow): @pyqtSlot(int, int) def slot_handleSetMidiProgramCount(self, pluginId, count): - Carla.host._set_midiProgramCount(pluginId, count) + gCarla.host._set_midiProgramCount(pluginId, count) @pyqtSlot(int, int, int, int, str) def slot_handleSetMidiProgramData(self, pluginId, index, bank, program, name): @@ -878,15 +878,15 @@ class CarlaControlW(QMainWindow): data['bank'] = bank data['program'] = program data['label'] = name - Carla.host._set_midiProgramDataS(pluginId, index, data) + gCarla.host._set_midiProgramDataS(pluginId, index, data) @pyqtSlot(int, int, float) def slot_handleSetInputPeakValue(self, pluginId, portId, value): - Carla.host._set_inPeak(pluginId, portId-1, value) + gCarla.host._set_inPeak(pluginId, portId-1, value) @pyqtSlot(int, int, float) def slot_handleSetOutputPeakValue(self, pluginId, portId, value): - Carla.host._set_outPeak(pluginId, portId-1, value) + gCarla.host._set_outPeak(pluginId, portId-1, value) @pyqtSlot(int, int, int, int) def slot_handleNoteOn(self, pluginId, channel, note, velo): @@ -912,7 +912,7 @@ class CarlaControlW(QMainWindow): @pyqtSlot(int, float, float, float, float) def slot_handleSetPeaks(self, pluginId, in1, in2, out1, out2): - Carla.host._set_peaks(pluginId, in1, in2, out1, out2) + gCarla.host._set_peaks(pluginId, in1, in2, out1, out2) @pyqtSlot() def slot_handleExit(self): @@ -997,16 +997,16 @@ if __name__ == '__main__': libName = carla_library_filename # Init backend (OSC bridge version) - Carla.host = Host() + gCarla.host = Host() # Create GUI - Carla.gui = CarlaControlW(oscAddr) + gCarla.gui = CarlaControlW(oscAddr) # Set-up custom signal handling setUpSignals() # Show GUI - Carla.gui.show() + gCarla.gui.show() # App-Loop sys.exit(app.exec_()) diff --git a/source/carla_database.py b/source/carla_database.py index da5becd2f..776b3464c 100755 --- a/source/carla_database.py +++ b/source/carla_database.py @@ -354,7 +354,7 @@ class SearchPluginsThread(QThread): self.fCheckSF2 = False self.fCheckSFZ = False - self.fToolNative = Carla.discovery_native + self.fToolNative = gCarla.discovery_native self.fCurCount = 0 self.fCurPercentValue = 0 @@ -369,7 +369,7 @@ class SearchPluginsThread(QThread): self.fCsdFiles = [] self.fKitPlugins = [] - print(Carla.discovery_native) + print(gCarla.discovery_native) # ------------------------------------------------------------- @@ -472,25 +472,25 @@ class SearchPluginsThread(QThread): if not self.fContinueChecking: return if self.fCheckPosix32: - self._checkLADSPA(OS, Carla.discovery_posix32) + self._checkLADSPA(OS, gCarla.discovery_posix32) settingsDB.setValue("Plugins/LADSPA_posix32", self.fLadspaPlugins) if not self.fContinueChecking: return if self.fCheckPosix64: - self._checkLADSPA(OS, Carla.discovery_posix64) + self._checkLADSPA(OS, gCarla.discovery_posix64) settingsDB.setValue("Plugins/LADSPA_posix64", self.fLadspaPlugins) if not self.fContinueChecking: return if self.fCheckWin32: - self._checkLADSPA("WINDOWS", Carla.discovery_win32, not WINDOWS) + self._checkLADSPA("WINDOWS", gCarla.discovery_win32, not WINDOWS) settingsDB.setValue("Plugins/LADSPA_win32", self.fLadspaPlugins) if not self.fContinueChecking: return if self.fCheckWin64: - self._checkLADSPA("WINDOWS", Carla.discovery_win64, not WINDOWS) + self._checkLADSPA("WINDOWS", gCarla.discovery_win64, not WINDOWS) settingsDB.setValue("Plugins/LADSPA_win64", self.fLadspaPlugins) settingsDB.sync() @@ -518,25 +518,25 @@ class SearchPluginsThread(QThread): if not self.fContinueChecking: return if self.fCheckPosix32: - self._checkDSSI(OS, Carla.discovery_posix32) + self._checkDSSI(OS, gCarla.discovery_posix32) settingsDB.setValue("Plugins/DSSI_posix32", self.fDssiPlugins) if not self.fContinueChecking: return if self.fCheckPosix64: - self._checkDSSI(OS, Carla.discovery_posix64) + self._checkDSSI(OS, gCarla.discovery_posix64) settingsDB.setValue("Plugins/DSSI_posix64", self.fDssiPlugins) if not self.fContinueChecking: return if self.fCheckWin32: - self._checkDSSI("WINDOWS", Carla.discovery_win32, not WINDOWS) + self._checkDSSI("WINDOWS", gCarla.discovery_win32, not WINDOWS) settingsDB.setValue("Plugins/DSSI_win32", self.fDssiPlugins) if not self.fContinueChecking: return if self.fCheckWin64: - self._checkDSSI("WINDOWS", Carla.discovery_win64, not WINDOWS) + self._checkDSSI("WINDOWS", gCarla.discovery_win64, not WINDOWS) settingsDB.setValue("Plugins/DSSI_win64", self.fDssiPlugins) settingsDB.sync() @@ -551,25 +551,25 @@ class SearchPluginsThread(QThread): if not self.fContinueChecking: return if self.fCheckPosix32: - self._checkLV2(Carla.discovery_posix32) + self._checkLV2(gCarla.discovery_posix32) settingsDB.setValue("Plugins/LV2_posix32", self.fLv2Plugins) if not self.fContinueChecking: return if self.fCheckPosix64: - self._checkLV2(Carla.discovery_posix64) + self._checkLV2(gCarla.discovery_posix64) settingsDB.setValue("Plugins/LV2_posix64", self.fLv2Plugins) if not self.fContinueChecking: return if self.fCheckWin32: - self._checkLV2(Carla.discovery_win32, not WINDOWS) + self._checkLV2(gCarla.discovery_win32, not WINDOWS) settingsDB.setValue("Plugins/LV2_win32", self.fLv2Plugins) if not self.fContinueChecking: return if self.fCheckWin64: - self._checkLV2(Carla.discovery_win64, not WINDOWS) + self._checkLV2(gCarla.discovery_win64, not WINDOWS) settingsDB.setValue("Plugins/LV2_win64", self.fLv2Plugins) settingsDB.sync() @@ -584,25 +584,25 @@ class SearchPluginsThread(QThread): if not self.fContinueChecking: return if self.fCheckPosix32: - self._checkVST(OS, Carla.discovery_posix32) + self._checkVST(OS, gCarla.discovery_posix32) settingsDB.setValue("Plugins/VST_posix32", self.fVstPlugins) if not self.fContinueChecking: return if self.fCheckPosix64: - self._checkVST(OS, Carla.discovery_posix64) + self._checkVST(OS, gCarla.discovery_posix64) settingsDB.setValue("Plugins/VST_posix64", self.fVstPlugins) if not self.fContinueChecking: return if self.fCheckWin32: - self._checkVST("WINDOWS", Carla.discovery_win32, not WINDOWS) + self._checkVST("WINDOWS", gCarla.discovery_win32, not WINDOWS) settingsDB.setValue("Plugins/VST_win32", self.fVstPlugins) if not self.fContinueChecking: return if self.fCheckWin64: - self._checkVST("WINDOWS", Carla.discovery_win64, not WINDOWS) + self._checkVST("WINDOWS", gCarla.discovery_win64, not WINDOWS) settingsDB.setValue("Plugins/VST_win64", self.fVstPlugins) settingsDB.sync() @@ -617,13 +617,13 @@ class SearchPluginsThread(QThread): if not self.fContinueChecking: return if self.fCheckPosix32: - self._checkAU(Carla.discovery_posix32) + self._checkAU(gCarla.discovery_posix32) settingsDB.setValue("Plugins/AU_posix32", self.fAuPlugins) if not self.fContinueChecking: return if self.fCheckPosix64: - self._checkAU(Carla.discovery_posix64) + self._checkAU(gCarla.discovery_posix64) settingsDB.setValue("Plugins/AU_posix64", self.fAuPlugins) settingsDB.sync() @@ -638,7 +638,7 @@ class SearchPluginsThread(QThread): if self.fCheckGIG: settings = QSettings() - GIG_PATH = toList(settings.value("Paths/GIG", Carla.DEFAULT_GIG_PATH)) + GIG_PATH = toList(settings.value("Paths/GIG", gCarla.DEFAULT_GIG_PATH)) del settings self._checkKIT(GIG_PATH, "gig") @@ -648,7 +648,7 @@ class SearchPluginsThread(QThread): if self.fCheckSF2: settings = QSettings() - SF2_PATH = toList(settings.value("Paths/SF2", Carla.DEFAULT_SF2_PATH)) + SF2_PATH = toList(settings.value("Paths/SF2", gCarla.DEFAULT_SF2_PATH)) del settings self._checkKIT(SF2_PATH, "sf2") @@ -658,7 +658,7 @@ class SearchPluginsThread(QThread): if self.fCheckSFZ: settings = QSettings() - SFZ_PATH = toList(settings.value("Paths/SFZ", Carla.DEFAULT_SFZ_PATH)) + SFZ_PATH = toList(settings.value("Paths/SFZ", gCarla.DEFAULT_SFZ_PATH)) del settings self._checkKIT(SFZ_PATH, "sfz") @@ -673,7 +673,7 @@ class SearchPluginsThread(QThread): self._pluginLook(self.fLastCheckValue, "LADSPA plugins...") settings = QSettings() - LADSPA_PATH = toList(settings.value("Paths/LADSPA", Carla.DEFAULT_LADSPA_PATH)) + LADSPA_PATH = toList(settings.value("Paths/LADSPA", gCarla.DEFAULT_LADSPA_PATH)) for iPATH in LADSPA_PATH: binaries = findBinaries(iPATH, OS) @@ -706,7 +706,7 @@ class SearchPluginsThread(QThread): self._pluginLook(self.fLastCheckValue, "DSSI plugins...") settings = QSettings() - DSSI_PATH = toList(settings.value("Paths/DSSI", Carla.DEFAULT_DSSI_PATH)) + DSSI_PATH = toList(settings.value("Paths/DSSI", gCarla.DEFAULT_DSSI_PATH)) for iPATH in DSSI_PATH: binaries = findBinaries(iPATH, OS) @@ -739,7 +739,7 @@ class SearchPluginsThread(QThread): self._pluginLook(self.fLastCheckValue, "LV2 bundles...") settings = QSettings() - LV2_PATH = toList(settings.value("Paths/LV2", Carla.DEFAULT_LV2_PATH)) + LV2_PATH = toList(settings.value("Paths/LV2", gCarla.DEFAULT_LV2_PATH)) for iPATH in LV2_PATH: bundles = findLV2Bundles(iPATH) @@ -775,7 +775,7 @@ class SearchPluginsThread(QThread): self._pluginLook(self.fLastCheckValue, "VST plugins...") settings = QSettings() - VST_PATH = toList(settings.value("Paths/VST", Carla.DEFAULT_VST_PATH)) + VST_PATH = toList(settings.value("Paths/VST", gCarla.DEFAULT_VST_PATH)) for iPATH in VST_PATH: if MACOS and not isWine: @@ -812,7 +812,7 @@ class SearchPluginsThread(QThread): self._pluginLook(self.fLastCheckValue, "AU plugins...") settings = QSettings() - AU_PATH = toList(settings.value("Paths/AU", Carla.DEFAULT_AU_PATH)) + AU_PATH = toList(settings.value("Paths/AU", gCarla.DEFAULT_AU_PATH)) for iPATH in AU_PATH: binaries = findBinaries(iPATH, "MACOS") @@ -843,7 +843,7 @@ class SearchPluginsThread(QThread): self.fCsdFiles = [] settings = QSettings() - CSOUND_PATH = toList(settings.value("Paths/CSOUND", Carla.DEFAULT_CSOUND_PATH)) + CSOUND_PATH = toList(settings.value("Paths/CSOUND", gCarla.DEFAULT_CSOUND_PATH)) for iPATH in CSOUND_PATH: files = findFilenames(iPATH, "csd") @@ -945,28 +945,28 @@ class PluginRefreshW(QDialog): self.ui.ch_posix32.setText("MacOS 32bit") self.ui.ch_posix64.setText("MacOS 64bit") - if Carla.discovery_posix32 and not WINDOWS: + if gCarla.discovery_posix32 and not WINDOWS: self.ui.ico_posix32.setPixmap(self.fIconYes) else: self.ui.ico_posix32.setPixmap(self.fIconNo) self.ui.ch_posix32.setChecked(False) self.ui.ch_posix32.setEnabled(False) - if Carla.discovery_posix64 and not WINDOWS: + if gCarla.discovery_posix64 and not WINDOWS: self.ui.ico_posix64.setPixmap(self.fIconYes) else: self.ui.ico_posix64.setPixmap(self.fIconNo) self.ui.ch_posix64.setChecked(False) self.ui.ch_posix64.setEnabled(False) - if Carla.discovery_win32: + if gCarla.discovery_win32: self.ui.ico_win32.setPixmap(self.fIconYes) else: self.ui.ico_win32.setPixmap(self.fIconNo) self.ui.ch_win32.setChecked(False) self.ui.ch_win32.setEnabled(False) - if Carla.discovery_win64: + if gCarla.discovery_win64: self.ui.ico_win64.setPixmap(self.fIconYes) else: self.ui.ico_win64.setPixmap(self.fIconNo) @@ -978,35 +978,35 @@ class PluginRefreshW(QDialog): else: self.ui.ico_rdflib.setPixmap(self.fIconNo) - hasNative = bool(Carla.discovery_native) + hasNative = bool(gCarla.discovery_native) hasNonNative = False if WINDOWS: if kIs64bit: - hasNative = bool(Carla.discovery_win64) - hasNonNative = bool(Carla.discovery_win32) - self.fThread.setSearchToolNative(Carla.discovery_win64) + hasNative = bool(gCarla.discovery_win64) + hasNonNative = bool(gCarla.discovery_win32) + self.fThread.setSearchToolNative(gCarla.discovery_win64) self.ui.ch_win64.setChecked(False) self.ui.ch_win64.setVisible(False) self.ui.ico_win64.setVisible(False) self.ui.label_win64.setVisible(False) else: - hasNative = bool(Carla.discovery_win32) - hasNonNative = bool(Carla.discovery_win64) - self.fThread.setSearchToolNative(Carla.discovery_win32) + hasNative = bool(gCarla.discovery_win32) + hasNonNative = bool(gCarla.discovery_win64) + self.fThread.setSearchToolNative(gCarla.discovery_win32) self.ui.ch_win32.setChecked(False) self.ui.ch_win32.setVisible(False) self.ui.ico_win32.setVisible(False) self.ui.label_win32.setVisible(False) elif LINUX or MACOS: if kIs64bit: - hasNonNative = bool(Carla.discovery_posix32 or Carla.discovery_win32 or Carla.discovery_win64) + hasNonNative = bool(gCarla.discovery_posix32 or gCarla.discovery_win32 or gCarla.discovery_win64) self.ui.ch_posix64.setChecked(False) self.ui.ch_posix64.setVisible(False) self.ui.ico_posix64.setVisible(False) self.ui.label_posix64.setVisible(False) else: - hasNonNative = bool(Carla.discovery_posix64 or Carla.discovery_win32 or Carla.discovery_win64) + hasNonNative = bool(gCarla.discovery_posix64 or gCarla.discovery_win32 or gCarla.discovery_win64) self.ui.ch_posix32.setChecked(False) self.ui.ch_posix32.setVisible(False) self.ui.ico_posix32.setVisible(False) @@ -1445,14 +1445,14 @@ class PluginDatabaseW(QDialog): for plugins in internalPlugins: internalCount += len(plugins) - canRefreshInternals = not (Carla.isControl or Carla.isPlugin or Carla.host is None) + canRefreshInternals = not (gCarla.isControl or gCarla.isPlugin or gCarla.host is None) - if canRefreshInternals and internalCount != Carla.host.get_internal_plugin_count(): - internalCount = Carla.host.get_internal_plugin_count() + if canRefreshInternals and internalCount != gCarla.host.get_internal_plugin_count(): + internalCount = gCarla.host.get_internal_plugin_count() internalPlugins = [] - for i in range(Carla.host.get_internal_plugin_count()): - descInfo = Carla.host.get_internal_plugin_info(i) + for i in range(gCarla.host.get_internal_plugin_count()): + descInfo = gCarla.host.get_internal_plugin_info(i) plugins = checkPluginInternal(descInfo) if plugins: diff --git a/source/carla_host.py b/source/carla_host.py index 8ae5c50b1..fd229062f 100644 --- a/source/carla_host.py +++ b/source/carla_host.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Carla host code -# Copyright (C) 2011-2013 Filipe Coelho +# Copyright (C) 2011-2014 Filipe Coelho # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -154,16 +154,16 @@ class HostWindow(QMainWindow): self.ui.setupUi(self) if False: - Carla.gui = self + gCarla.gui = self self.fContainer = CarlaDummyW(self) # ------------------------------------------------------------- # Set callback, TODO put somewhere else - if Carla.host is not None: - Carla.host.set_engine_callback(engineCallback) + if gCarla.host is not None: + gCarla.host.set_engine_callback(engineCallback) - Carla.host.set_file_callback(fileCallback) + gCarla.host.set_file_callback(fileCallback) # ------------------------------------------------------------- # Internal stuff @@ -207,7 +207,7 @@ class HostWindow(QMainWindow): # ------------------------------------------------------------- # Set up GUI (engine stopped) - if Carla.isPlugin: + if gCarla.isPlugin: self.ui.act_file_new.setEnabled(False) self.ui.act_file_open.setEnabled(False) self.ui.act_engine_start.setEnabled(False) @@ -231,8 +231,8 @@ class HostWindow(QMainWindow): self.fDirModel = QFileSystemModel(self) self.fDirModel.setRootPath(HOME) - if Carla.host is not None: - self.fDirModel.setNameFilters(Carla.host.get_supported_file_extensions().split(";")) + if gCarla.host is not None: + self.fDirModel.setNameFilters(gCarla.host.get_supported_file_extensions().split(";")) self.ui.fileTreeView.setModel(self.fDirModel) self.ui.fileTreeView.setRootIndex(self.fDirModel.index(HOME)) @@ -309,8 +309,8 @@ class HostWindow(QMainWindow): #@pyqtSlot() #def slot_test(self): #print("test started") - #if not Carla.host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, "/usr/bin/zita-rev1", "name of client", "label of client", None): - #print(Carla.host.get_last_error()) + #if not gCarla.host.add_plugin(BINARY_NATIVE, PLUGIN_JACK, "/usr/bin/zita-rev1", "name of client", "label of client", None): + #print(gCarla.host.get_last_error()) #print("test ended") # ----------------------------------------------------------------- @@ -343,7 +343,7 @@ class HostWindow(QMainWindow): return qCritical("ERROR: loading project without filename set") self.fIsProjectLoading = True - Carla.host.load_project(self.fProjectFilename) + gCarla.host.load_project(self.fProjectFilename) self.fIsProjectLoading = False self.fContainer.projectLoaded() @@ -361,13 +361,13 @@ class HostWindow(QMainWindow): if not self.fProjectFilename: return qCritical("ERROR: saving project without filename set") - Carla.host.save_project(self.fProjectFilename) + gCarla.host.save_project(self.fProjectFilename) # ----------------------------------------------------------------- # Internal stuff (engine) def setEngineSettings(self, settings = None): - if Carla.isPlugin: + if gCarla.isPlugin: return "Plugin" if settings is None: settings = QSettings() @@ -460,26 +460,26 @@ class HostWindow(QMainWindow): # ------------------------------------------------------------- # apply to engine - Carla.host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, forceStereo, "") - Carla.host.set_engine_option(ENGINE_OPTION_UIS_ALWAYS_ON_TOP, uisAlwaysOnTop, "") + gCarla.host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, forceStereo, "") + gCarla.host.set_engine_option(ENGINE_OPTION_UIS_ALWAYS_ON_TOP, uisAlwaysOnTop, "") - if not Carla.isPlugin: - Carla.host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, preferPluginBridges, "") - Carla.host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, preferUiBridges, "") + if not gCarla.isPlugin: + gCarla.host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, preferPluginBridges, "") + gCarla.host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, preferUiBridges, "") - Carla.host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, maxParameters, "") - Carla.host.set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, uiBridgesTimeout, "") + gCarla.host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, maxParameters, "") + gCarla.host.set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, uiBridgesTimeout, "") - Carla.host.set_engine_option(ENGINE_OPTION_PROCESS_MODE, processMode, "") - Carla.host.set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, transportMode, "") + gCarla.host.set_engine_option(ENGINE_OPTION_PROCESS_MODE, processMode, "") + gCarla.host.set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, transportMode, "") - Carla.host.set_engine_option(ENGINE_OPTION_AUDIO_NUM_PERIODS, audioNumPeriods, "") - Carla.host.set_engine_option(ENGINE_OPTION_AUDIO_BUFFER_SIZE, audioBufferSize, "") - Carla.host.set_engine_option(ENGINE_OPTION_AUDIO_SAMPLE_RATE, audioSampleRate, "") - Carla.host.set_engine_option(ENGINE_OPTION_AUDIO_DEVICE, 0, audioDevice) + 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) # save this for later - Carla.maxParameters = maxParameters + gCarla.maxParameters = maxParameters # return selected driver name return audioDriver @@ -487,12 +487,12 @@ class HostWindow(QMainWindow): def startEngine(self): audioDriver = self.setEngineSettings() - if not Carla.host.engine_init(audioDriver, self.fClientName): + if not gCarla.host.engine_init(audioDriver, self.fClientName): if self.fFirstEngineInit: self.fFirstEngineInit = False return - audioError = Carla.host.get_last_error() + audioError = gCarla.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))) @@ -513,8 +513,8 @@ class HostWindow(QMainWindow): self.ui.act_plugin_remove_all.setEnabled(False) self.fContainer.removeAllPlugins() - if Carla.host.is_engine_running() and not Carla.host.engine_close(): - print(Carla.host.get_last_error()) + if gCarla.host.is_engine_running() and not gCarla.host.engine_close(): + print(gCarla.host.get_last_error()) # ----------------------------------------------------------------- # Internal stuff (plugins) @@ -567,10 +567,10 @@ class HostWindow(QMainWindow): # Internal stuff (transport) def refreshTransport(self, forced = False): - if Carla.sampleRate == 0.0 or not Carla.host.is_engine_running(): + if gCarla.sampleRate == 0.0 or not gCarla.host.is_engine_running(): return - timeInfo = Carla.host.get_transport_info() + timeInfo = gCarla.host.get_transport_info() playing = bool(timeInfo['playing']) frame = int(timeInfo['frame']) @@ -589,7 +589,7 @@ class HostWindow(QMainWindow): self.fLastTransportState = playing if frame != self.fLastTransportFrame or forced: - time = frame / Carla.sampleRate + time = frame / gCarla.sampleRate secs = time % 60 mins = (time / 60) % 60 hrs = (time / 3600) % 60 @@ -645,20 +645,20 @@ class HostWindow(QMainWindow): # --------------------------------------------- - if not Carla.isPlugin: + if not gCarla.isPlugin: # engine self.setEngineSettings(settings) # plugin paths - LADSPA_PATH = toList(settings.value("Paths/LADSPA", Carla.DEFAULT_LADSPA_PATH)) - DSSI_PATH = toList(settings.value("Paths/DSSI", Carla.DEFAULT_DSSI_PATH)) - LV2_PATH = toList(settings.value("Paths/LV2", Carla.DEFAULT_LV2_PATH)) - VST_PATH = toList(settings.value("Paths/VST", Carla.DEFAULT_VST_PATH)) - AU_PATH = toList(settings.value("Paths/AU", Carla.DEFAULT_AU_PATH)) - CSOUND_PATH = toList(settings.value("Paths/CSOUND", Carla.DEFAULT_CSOUND_PATH)) - GIG_PATH = toList(settings.value("Paths/GIG", Carla.DEFAULT_GIG_PATH)) - SF2_PATH = toList(settings.value("Paths/SF2", Carla.DEFAULT_SF2_PATH)) - SFZ_PATH = toList(settings.value("Paths/SFZ", Carla.DEFAULT_SFZ_PATH)) + LADSPA_PATH = toList(settings.value("Paths/LADSPA", gCarla.DEFAULT_LADSPA_PATH)) + DSSI_PATH = toList(settings.value("Paths/DSSI", gCarla.DEFAULT_DSSI_PATH)) + LV2_PATH = toList(settings.value("Paths/LV2", gCarla.DEFAULT_LV2_PATH)) + VST_PATH = toList(settings.value("Paths/VST", gCarla.DEFAULT_VST_PATH)) + AU_PATH = toList(settings.value("Paths/AU", gCarla.DEFAULT_AU_PATH)) + CSOUND_PATH = toList(settings.value("Paths/CSOUND", gCarla.DEFAULT_CSOUND_PATH)) + GIG_PATH = toList(settings.value("Paths/GIG", gCarla.DEFAULT_GIG_PATH)) + SF2_PATH = toList(settings.value("Paths/SF2", gCarla.DEFAULT_SF2_PATH)) + SFZ_PATH = toList(settings.value("Paths/SFZ", gCarla.DEFAULT_SFZ_PATH)) os.environ["LADSPA_PATH"] = splitter.join(LADSPA_PATH) os.environ["DSSI_PATH"] = splitter.join(DSSI_PATH) @@ -803,11 +803,11 @@ class HostWindow(QMainWindow): def slot_engineStart(self, doStart = True): if doStart: self.startEngine() - check = Carla.host.is_engine_running() + check = gCarla.host.is_engine_running() self.ui.menu_PluginMacros.setEnabled(check) self.ui.menu_Canvas.setEnabled(check) - if not Carla.isPlugin: + if not gCarla.isPlugin: self.ui.act_file_save.setEnabled(check) self.ui.act_engine_start.setEnabled(not check) self.ui.act_engine_stop.setEnabled(check) @@ -819,7 +819,7 @@ class HostWindow(QMainWindow): self.setTransportMenuEnabled(check) if check: - if not Carla.isPlugin: + if not gCarla.isPlugin: self.refreshTransport(True) self.fContainer.engineStarted() @@ -833,11 +833,11 @@ class HostWindow(QMainWindow): self.ui.act_plugin_remove_all.setEnabled(False) self.fContainer.removeAllPlugins() - check = Carla.host.is_engine_running() + check = gCarla.host.is_engine_running() self.ui.menu_PluginMacros.setEnabled(check) self.ui.menu_Canvas.setEnabled(check) - if not Carla.isPlugin: + if not gCarla.isPlugin: self.ui.act_file_save.setEnabled(check) self.ui.act_engine_start.setEnabled(not check) self.ui.act_engine_stop.setEnabled(check) @@ -861,7 +861,7 @@ class HostWindow(QMainWindow): if not dialog.exec_(): return - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): QMessageBox.warning(self, self.tr("Warning"), self.tr("Cannot add new plugins while engine is stopped")) return @@ -872,59 +872,59 @@ class HostWindow(QMainWindow): uniqueId = dialog.fRetPlugin['uniqueId'] extraPtr = self.getExtraPtr(dialog.fRetPlugin) - if not Carla.host.add_plugin(btype, ptype, filename, None, label, uniqueId, extraPtr): - CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), charPtrToString(Carla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok) + if not gCarla.host.add_plugin(btype, ptype, filename, None, label, uniqueId, extraPtr): + CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load plugin"), charPtrToString(gCarla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok) return @pyqtSlot() def slot_pluginRemoveAll(self): self.ui.act_plugin_remove_all.setEnabled(False) self.fContainer.removeAllPlugins() - Carla.host.remove_all_plugins() + gCarla.host.remove_all_plugins() # ----------------------------------------------------------------- @pyqtSlot(bool) def slot_transportPlayPause(self, toggled): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return if toggled: - Carla.host.transport_play() + gCarla.host.transport_play() else: - Carla.host.transport_pause() + gCarla.host.transport_pause() self.refreshTransport() @pyqtSlot() def slot_transportStop(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return - Carla.host.transport_pause() - Carla.host.transport_relocate(0) + gCarla.host.transport_pause() + gCarla.host.transport_relocate(0) self.refreshTransport() @pyqtSlot() def slot_transportBackwards(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return - newFrame = Carla.host.get_current_transport_frame() - 100000 + newFrame = gCarla.host.get_current_transport_frame() - 100000 if newFrame < 0: newFrame = 0 - Carla.host.transport_relocate(newFrame) + gCarla.host.transport_relocate(newFrame) @pyqtSlot() def slot_transportForwards(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return - newFrame = Carla.host.get_current_transport_frame() + 100000 - Carla.host.transport_relocate(newFrame) + newFrame = gCarla.host.get_current_transport_frame() + 100000 + gCarla.host.transport_relocate(newFrame) # ----------------------------------------------------------------- @@ -979,10 +979,10 @@ class HostWindow(QMainWindow): def slot_fileTreeDoubleClicked(self, modelIndex): filename = self.fDirModel.filePath(modelIndex) - if not Carla.host.load_file(filename): + if not gCarla.host.load_file(filename): CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), self.tr("Failed to load file"), - Carla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) + gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) # ----------------------------------------------------------------- @@ -1019,10 +1019,10 @@ class HostWindow(QMainWindow): @pyqtSlot(str) def slot_handleEngineStartedCallback(self, processMode, transportMode, driverName): - Carla.processMode = processMode - Carla.transportMode = transportMode - Carla.bufferSize = Carla.host.get_buffer_size() - Carla.sampleRate = Carla.host.get_sample_rate() + gCarla.processMode = processMode + gCarla.transportMode = transportMode + gCarla.bufferSize = gCarla.host.get_buffer_size() + gCarla.sampleRate = gCarla.host.get_sample_rate() self.slot_engineStart(False) @@ -1036,8 +1036,8 @@ class HostWindow(QMainWindow): self.killTimers() self.slot_engineStop(False) - Carla.bufferSize = 0 - Carla.sampleRate = 0.0 + gCarla.bufferSize = 0 + gCarla.sampleRate = 0.0 # ----------------------------------------------------------------- @@ -1089,8 +1089,8 @@ class HostWindow(QMainWindow): def timerEvent(self, event): if event.timerId() == self.fIdleTimerFast: - #if not Carla.isPlugin: - Carla.host.engine_idle() + #if not gCarla.isPlugin: + gCarla.host.engine_idle() self.refreshTransport() self.fContainer.idleFast() @@ -1108,8 +1108,8 @@ class HostWindow(QMainWindow): self.killTimers() self.saveSettings() - if Carla.host.is_engine_running(): - Carla.host.set_engine_about_to_close() + if gCarla.host.is_engine_running(): + gCarla.host.set_engine_about_to_close() self.ui.act_plugin_remove_all.setEnabled(False) self.fContainer.removeAllPlugins() self.stopEngine() @@ -1121,108 +1121,108 @@ class HostWindow(QMainWindow): def engineCallback(ptr, action, pluginId, value1, value2, value3, valueStr): if action == ENGINE_CALLBACK_PROCESS_MODE_CHANGED: - Carla.processMode = value1 - if Carla.gui is not None: - Carla.gui.ProcessModeChangedCallback.emit(value1) + gCarla.processMode = value1 + if gCarla.gui is not None: + gCarla.gui.ProcessModeChangedCallback.emit(value1) return if action == ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED: - Carla.transportMode = value1 - if Carla.gui is not None: - Carla.gui.TransportModeChangedCallback.emit(value1) + gCarla.transportMode = value1 + if gCarla.gui is not None: + gCarla.gui.TransportModeChangedCallback.emit(value1) return if action == ENGINE_CALLBACK_BUFFER_SIZE_CHANGED: - Carla.bufferSize = value1 - if Carla.gui is not None: - Carla.gui.BufferSizeChangedCallback.emit(value1) + gCarla.bufferSize = value1 + if gCarla.gui is not None: + gCarla.gui.BufferSizeChangedCallback.emit(value1) return if action == ENGINE_CALLBACK_SAMPLE_RATE_CHANGED: - Carla.sampleRate = value1 - if Carla.gui is not None: - Carla.gui.SampleRateChangedCallback.emit(value3) + gCarla.sampleRate = value1 + if gCarla.gui is not None: + gCarla.gui.SampleRateChangedCallback.emit(value3) return - if Carla.gui is None: + if gCarla.gui is None: print("WARNING: Got engine callback but UI is not ready : ", pluginId, value1, value2, value3, valueStr) return valueStr = charPtrToString(valueStr) if action == ENGINE_CALLBACK_DEBUG: - Carla.gui.DebugCallback.emit(pluginId, value1, value2, value3, valueStr) + gCarla.gui.DebugCallback.emit(pluginId, value1, value2, value3, valueStr) elif action == ENGINE_CALLBACK_PLUGIN_ADDED: - Carla.gui.PluginAddedCallback.emit(pluginId, valueStr) + gCarla.gui.PluginAddedCallback.emit(pluginId, valueStr) elif action == ENGINE_CALLBACK_PLUGIN_REMOVED: - Carla.gui.PluginRemovedCallback.emit(pluginId) + gCarla.gui.PluginRemovedCallback.emit(pluginId) elif action == ENGINE_CALLBACK_PLUGIN_RENAMED: - Carla.gui.PluginRenamedCallback.emit(pluginId, valueStr) + gCarla.gui.PluginRenamedCallback.emit(pluginId, valueStr) elif action == ENGINE_CALLBACK_PLUGIN_UNAVAILABLE: - Carla.gui.PluginUnavailableCallback.emit(pluginId, valueStr) + gCarla.gui.PluginUnavailableCallback.emit(pluginId, valueStr) elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: - Carla.gui.ParameterValueChangedCallback.emit(pluginId, value1, value3) + gCarla.gui.ParameterValueChangedCallback.emit(pluginId, value1, value3) elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED: - Carla.gui.ParameterDefaultChangedCallback.emit(pluginId, value1, value3) + gCarla.gui.ParameterDefaultChangedCallback.emit(pluginId, value1, value3) elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED: - Carla.gui.ParameterMidiCcChangedCallback.emit(pluginId, value1, value2) + gCarla.gui.ParameterMidiCcChangedCallback.emit(pluginId, value1, value2) elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: - Carla.gui.ParameterMidiChannelChangedCallback.emit(pluginId, value1, value2) + gCarla.gui.ParameterMidiChannelChangedCallback.emit(pluginId, value1, value2) elif action == ENGINE_CALLBACK_PROGRAM_CHANGED: - Carla.gui.ProgramChangedCallback.emit(pluginId, value1) + gCarla.gui.ProgramChangedCallback.emit(pluginId, value1) elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED: - Carla.gui.MidiProgramChangedCallback.emit(pluginId, value1) + gCarla.gui.MidiProgramChangedCallback.emit(pluginId, value1) elif action == ENGINE_CALLBACK_UI_STATE_CHANGED: - Carla.gui.UiStateChangedCallback.emit(pluginId, value1) + gCarla.gui.UiStateChangedCallback.emit(pluginId, value1) elif action == ENGINE_CALLBACK_NOTE_ON: - Carla.gui.NoteOnCallback.emit(pluginId, value1, value2, int(value3)) + gCarla.gui.NoteOnCallback.emit(pluginId, value1, value2, int(value3)) elif action == ENGINE_CALLBACK_NOTE_OFF: - Carla.gui.NoteOffCallback.emit(pluginId, value1, value2) + gCarla.gui.NoteOffCallback.emit(pluginId, value1, value2) elif action == ENGINE_CALLBACK_UPDATE: - Carla.gui.UpdateCallback.emit(pluginId) + gCarla.gui.UpdateCallback.emit(pluginId) elif action == ENGINE_CALLBACK_RELOAD_INFO: - Carla.gui.ReloadInfoCallback.emit(pluginId) + gCarla.gui.ReloadInfoCallback.emit(pluginId) elif action == ENGINE_CALLBACK_RELOAD_PARAMETERS: - Carla.gui.ReloadParametersCallback.emit(pluginId) + gCarla.gui.ReloadParametersCallback.emit(pluginId) elif action == ENGINE_CALLBACK_RELOAD_PROGRAMS: - Carla.gui.ReloadProgramsCallback.emit(pluginId) + gCarla.gui.ReloadProgramsCallback.emit(pluginId) elif action == ENGINE_CALLBACK_RELOAD_ALL: - Carla.gui.ReloadAllCallback.emit(pluginId) + gCarla.gui.ReloadAllCallback.emit(pluginId) elif action == ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED: - Carla.gui.PatchbayClientAddedCallback.emit(pluginId, value1, value2, valueStr) + gCarla.gui.PatchbayClientAddedCallback.emit(pluginId, value1, value2, valueStr) elif action == ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED: - Carla.gui.PatchbayClientRemovedCallback.emit(pluginId) + gCarla.gui.PatchbayClientRemovedCallback.emit(pluginId) elif action == ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED: - Carla.gui.PatchbayClientRenamedCallback.emit(pluginId, valueStr) + gCarla.gui.PatchbayClientRenamedCallback.emit(pluginId, valueStr) elif action == ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED: - Carla.gui.PatchbayClientDataChangedCallback.emit(pluginId, value1, value2) + gCarla.gui.PatchbayClientDataChangedCallback.emit(pluginId, value1, value2) elif action == ENGINE_CALLBACK_PATCHBAY_PORT_ADDED: - Carla.gui.PatchbayPortAddedCallback.emit(pluginId, value1, value2, valueStr) + gCarla.gui.PatchbayPortAddedCallback.emit(pluginId, value1, value2, valueStr) elif action == ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED: - Carla.gui.PatchbayPortRemovedCallback.emit(pluginId, value1) + gCarla.gui.PatchbayPortRemovedCallback.emit(pluginId, value1) elif action == ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED: - Carla.gui.PatchbayPortRenamedCallback.emit(pluginId, value1, valueStr) + gCarla.gui.PatchbayPortRenamedCallback.emit(pluginId, value1, valueStr) elif action == ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED: - Carla.gui.PatchbayConnectionAddedCallback.emit(pluginId, value1, value2) + gCarla.gui.PatchbayConnectionAddedCallback.emit(pluginId, value1, value2) elif action == ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED: - Carla.gui.PatchbayConnectionRemovedCallback.emit(pluginId, value1, value2) + gCarla.gui.PatchbayConnectionRemovedCallback.emit(pluginId, value1, value2) elif action == ENGINE_CALLBACK_ENGINE_STARTED: - Carla.gui.EngineStartedCallback.emit(value1, value2, valueStr) + gCarla.gui.EngineStartedCallback.emit(value1, value2, valueStr) elif action == ENGINE_CALLBACK_ENGINE_STOPPED: - Carla.gui.killTimers() - Carla.gui.EngineStoppedCallback.emit() + gCarla.gui.killTimers() + gCarla.gui.EngineStoppedCallback.emit() elif action == ENGINE_CALLBACK_INFO: - Carla.gui.InfoCallback.emit(valueStr) + gCarla.gui.InfoCallback.emit(valueStr) elif action == ENGINE_CALLBACK_ERROR: - Carla.gui.ErrorCallback.emit(valueStr) + gCarla.gui.ErrorCallback.emit(valueStr) elif action == ENGINE_CALLBACK_QUIT: - Carla.gui.QuitCallback.emit() + gCarla.gui.QuitCallback.emit() # ------------------------------------------------------------------------------------------------------------ # File callback def fileCallback(ptr, action, isDir, title, filter): - if Carla.gui is None: + if gCarla.gui is None: return None ret = "" @@ -1230,13 +1230,13 @@ def fileCallback(ptr, action, isDir, title, filter): if action == FILE_CALLBACK_DEBUG: pass elif action == FILE_CALLBACK_OPEN: - ret = QFileDialog.getOpenFileName(Carla.gui, charPtrToString(title), "", charPtrToString(filter) ) #, QFileDialog.ShowDirsOnly if isDir else 0x0) + ret = QFileDialog.getOpenFileName(gCarla.gui, charPtrToString(title), "", charPtrToString(filter) ) #, QFileDialog.ShowDirsOnly if isDir else 0x0) elif action == FILE_CALLBACK_SAVE: - ret = QFileDialog.getSaveFileName(Carla.gui, charPtrToString(title), "", charPtrToString(filter), QFileDialog.ShowDirsOnly if isDir else 0x0) + ret = QFileDialog.getSaveFileName(gCarla.gui, charPtrToString(title), "", charPtrToString(filter), QFileDialog.ShowDirsOnly if isDir else 0x0) if not ret: return None - Carla.gui._fileRet = c_char_p(ret.encode("utf-8")) - retval = cast(byref(Carla.gui._fileRet), POINTER(c_uintptr)) + gCarla.gui._fileRet = c_char_p(ret.encode("utf-8")) + retval = cast(byref(gCarla.gui._fileRet), POINTER(c_uintptr)) return retval.contents.value diff --git a/source/carla_patchbay.py b/source/carla_patchbay.py index d89739875..ddd4774f9 100644 --- a/source/carla_patchbay.py +++ b/source/carla_patchbay.py @@ -214,7 +214,7 @@ class CarlaPatchbayW(QFrame): self.fPluginCount += 1 if not isProjectLoading: - Carla.host.set_active(pluginId, True) + gCarla.host.set_active(pluginId, True) def removePlugin(self, pluginId): if not self.fIsOnlyPatchbay: @@ -287,11 +287,11 @@ class CarlaPatchbayW(QFrame): for pluginId in self.fSelectedPlugins: self.fPeaksCleared = False if self.fPeaksIn.isVisible(): - self.fPeaksIn.displayMeter(1, Carla.host.get_input_peak_value(pluginId, True)) - self.fPeaksIn.displayMeter(2, Carla.host.get_input_peak_value(pluginId, False)) + self.fPeaksIn.displayMeter(1, gCarla.host.get_input_peak_value(pluginId, True)) + self.fPeaksIn.displayMeter(2, gCarla.host.get_input_peak_value(pluginId, False)) if self.fPeaksOut.isVisible(): - self.fPeaksOut.displayMeter(1, Carla.host.get_output_peak_value(pluginId, True)) - self.fPeaksOut.displayMeter(2, Carla.host.get_output_peak_value(pluginId, False)) + self.fPeaksOut.displayMeter(1, gCarla.host.get_output_peak_value(pluginId, True)) + self.fPeaksOut.displayMeter(2, gCarla.host.get_output_peak_value(pluginId, False)) return if self.fPeaksCleared: return @@ -464,34 +464,34 @@ class CarlaPatchbayW(QFrame): @pyqtSlot(int) def slot_noteOn(self, note): for pluginId in self.fSelectedPlugins: - Carla.host.send_midi_note(pluginId, 0, note, 100) + gCarla.host.send_midi_note(pluginId, 0, note, 100) @pyqtSlot(int) def slot_noteOff(self, note): for pluginId in self.fSelectedPlugins: - Carla.host.send_midi_note(pluginId, 0, note, 0) + gCarla.host.send_midi_note(pluginId, 0, note, 0) # ----------------------------------------------------------------- @pyqtSlot() def slot_pluginsEnable(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): - Carla.host.set_active(i, True) + gCarla.host.set_active(i, True) @pyqtSlot() def slot_pluginsDisable(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): - Carla.host.set_active(i, False) + gCarla.host.set_active(i, False) @pyqtSlot() def slot_pluginsVolume100(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -501,11 +501,11 @@ class CarlaPatchbayW(QFrame): if pitem.getHints() & PLUGIN_CAN_VOLUME: pitem.setParameterValue(PARAMETER_VOLUME, 1.0) - Carla.host.set_volume(i, 1.0) + gCarla.host.set_volume(i, 1.0) @pyqtSlot() def slot_pluginsMute(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -515,11 +515,11 @@ class CarlaPatchbayW(QFrame): if pitem.getHints() & PLUGIN_CAN_VOLUME: pitem.setParameterValue(PARAMETER_VOLUME, 0.0) - Carla.host.set_volume(i, 0.0) + gCarla.host.set_volume(i, 0.0) @pyqtSlot() def slot_pluginsWet100(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -529,11 +529,11 @@ class CarlaPatchbayW(QFrame): if pitem.getHints() & PLUGIN_CAN_DRYWET: pitem.setParameterValue(PARAMETER_DRYWET, 1.0) - Carla.host.set_drywet(i, 1.0) + gCarla.host.set_drywet(i, 1.0) @pyqtSlot() def slot_pluginsBypass(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -543,11 +543,11 @@ class CarlaPatchbayW(QFrame): if pitem.getHints() & PLUGIN_CAN_DRYWET: pitem.setParameterValue(PARAMETER_DRYWET, 0.0) - Carla.host.set_drywet(i, 0.0) + gCarla.host.set_drywet(i, 0.0) @pyqtSlot() def slot_pluginsCenter(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -558,12 +558,12 @@ class CarlaPatchbayW(QFrame): if pitem.getHints() & PLUGIN_CAN_BALANCE: pitem.setParameterValue(PARAMETER_BALANCE_LEFT, -1.0) pitem.setParameterValue(PARAMETER_BALANCE_RIGHT, 1.0) - Carla.host.set_balance_left(i, -1.0) - Carla.host.set_balance_right(i, 1.0) + gCarla.host.set_balance_left(i, -1.0) + gCarla.host.set_balance_right(i, 1.0) if pitem.getHints() & PLUGIN_CAN_PANNING: pitem.setParameterValue(PARAMETER_PANNING, 0.0) - Carla.host.set_panning(i, 0.0) + gCarla.host.set_panning(i, 0.0) # ----------------------------------------------------------------- @@ -580,8 +580,8 @@ class CarlaPatchbayW(QFrame): self.fParent.updateContainer(self.themeData) self.slot_miniCanvasCheckAll() - if Carla.host.is_engine_running(): - Carla.host.patchbay_refresh() + if gCarla.host.is_engine_running(): + gCarla.host.patchbay_refresh() # ----------------------------------------------------------------- @@ -772,7 +772,7 @@ class CarlaPatchbayW(QFrame): print("sorry, can't map this plugin to canvas client", pluginId, self.fPluginCount) return - patchcanvas.setGroupAsPlugin(clientId, pluginId, bool(Carla.host.get_plugin_info(pluginId)['hints'] & PLUGIN_HAS_CUSTOM_UI)) + patchcanvas.setGroupAsPlugin(clientId, pluginId, bool(gCarla.host.get_plugin_info(pluginId)['hints'] & PLUGIN_HAS_CUSTOM_UI)) @pyqtSlot(int) def slot_handlePatchbayClientRemovedCallback(self, clientId): @@ -809,7 +809,7 @@ class CarlaPatchbayW(QFrame): print("sorry, can't map this plugin to canvas client", pluginId, self.getPluginCount()) return - patchcanvas.setGroupAsPlugin(clientId, pluginId, bool(Carla.host.get_plugin_info(pluginId)['hints'] & PLUGIN_HAS_CUSTOM_UI)) + patchcanvas.setGroupAsPlugin(clientId, pluginId, bool(gCarla.host.get_plugin_info(pluginId)['hints'] & PLUGIN_HAS_CUSTOM_UI)) @pyqtSlot(int, int, int, str) def slot_handlePatchbayPortAddedCallback(self, clientId, portId, portFlags, portName): @@ -861,8 +861,8 @@ class CarlaPatchbayW(QFrame): @pyqtSlot() def slot_canvasRefresh(self): patchcanvas.clear() - if Carla.host.is_engine_running(): - Carla.host.patchbay_refresh() + if gCarla.host.is_engine_running(): + gCarla.host.patchbay_refresh() QTimer.singleShot(1000 if self.fParent.fSavedSettings[CARLA_KEY_CANVAS_EYE_CANDY] else 0, self.fMiniCanvasPreview.update) @pyqtSlot() @@ -939,12 +939,12 @@ def canvasCallback(action, value1, value2, valueStr): elif action == patchcanvas.ACTION_GROUP_SPLIT: groupId = value1 patchcanvas.splitGroup(groupId) - Carla.gui.ui.miniCanvasPreview.update() + gCarla.gui.ui.miniCanvasPreview.update() elif action == patchcanvas.ACTION_GROUP_JOIN: groupId = value1 patchcanvas.joinGroup(groupId) - Carla.gui.ui.miniCanvasPreview.update() + gCarla.gui.ui.miniCanvasPreview.update() elif action == patchcanvas.ACTION_PORT_INFO: pass @@ -956,37 +956,37 @@ def canvasCallback(action, value1, value2, valueStr): portIdA = value1 portIdB = value2 - if not Carla.host.patchbay_connect(portIdA, portIdB): - print("Connection failed:", Carla.host.get_last_error()) + if not gCarla.host.patchbay_connect(portIdA, portIdB): + print("Connection failed:", gCarla.host.get_last_error()) elif action == patchcanvas.ACTION_PORTS_DISCONNECT: connectionId = value1 - if not Carla.host.patchbay_disconnect(connectionId): - print("Disconnect failed:", Carla.host.get_last_error()) + if not gCarla.host.patchbay_disconnect(connectionId): + print("Disconnect failed:", gCarla.host.get_last_error()) elif action == patchcanvas.ACTION_PLUGIN_CLONE: pluginId = value1 - Carla.host.clone_plugin(pluginId) + gCarla.host.clone_plugin(pluginId) elif action == patchcanvas.ACTION_PLUGIN_EDIT: pluginId = value1 - Carla.gui.fContainer.showEditDialog(pluginId) + gCarla.gui.fContainer.showEditDialog(pluginId) elif action == patchcanvas.ACTION_PLUGIN_RENAME: pluginId = value1 newName = valueStr - Carla.host.rename_plugin(pluginId, newName) + gCarla.host.rename_plugin(pluginId, newName) elif action == patchcanvas.ACTION_PLUGIN_REMOVE: pluginId = value1 - Carla.host.remove_plugin(pluginId) + gCarla.host.remove_plugin(pluginId) elif action == patchcanvas.ACTION_PLUGIN_SHOW_UI: pluginId = value1 - Carla.host.show_custom_ui(pluginId, True) + gCarla.host.show_custom_ui(pluginId, True) diff --git a/source/carla_rack.py b/source/carla_rack.py index f6301a734..4febd5082 100644 --- a/source/carla_rack.py +++ b/source/carla_rack.py @@ -327,7 +327,7 @@ class CarlaRackW(QFrame): @pyqtSlot() def slot_pluginsEnable(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -339,7 +339,7 @@ class CarlaRackW(QFrame): @pyqtSlot() def slot_pluginsDisable(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -351,7 +351,7 @@ class CarlaRackW(QFrame): @pyqtSlot() def slot_pluginsVolume100(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -363,7 +363,7 @@ class CarlaRackW(QFrame): @pyqtSlot() def slot_pluginsMute(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -375,7 +375,7 @@ class CarlaRackW(QFrame): @pyqtSlot() def slot_pluginsWet100(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -387,7 +387,7 @@ class CarlaRackW(QFrame): @pyqtSlot() def slot_pluginsBypass(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): @@ -399,7 +399,7 @@ class CarlaRackW(QFrame): @pyqtSlot() def slot_pluginsCenter(self): - if not Carla.host.is_engine_running(): + if not gCarla.host.is_engine_running(): return for i in range(self.fPluginCount): diff --git a/source/carla_settings.py b/source/carla_settings.py index f15a335cd..cebb30d57 100755 --- a/source/carla_settings.py +++ b/source/carla_settings.py @@ -19,7 +19,7 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import pyqtSlot, QByteArray, QSettings +from PyQt4.QtCore import pyqtSlot, QByteArray, QDir, QSettings from PyQt4.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath from PyQt4.QtGui import QDialog, QDialogButtonBox, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget @@ -42,7 +42,7 @@ CANVAS_EYECANDY_SMALL = 1 # Carla defaults # Main -CARLA_DEFAULT_MAIN_PROJECT_FOLDER = HOME +CARLA_DEFAULT_MAIN_PROJECT_FOLDER = QDir.homePath() CARLA_DEFAULT_MAIN_USE_PRO_THEME = True CARLA_DEFAULT_MAIN_PRO_THEME_COLOR = "Black" CARLA_DEFAULT_MAIN_REFRESH_INTERVAL = 20 @@ -105,7 +105,7 @@ class DriverSettingsW(QDialog): self.fDriverIndex = driverIndex self.fDriverName = driverName - self.fDeviceNames = Carla.host.get_engine_driver_device_names(driverIndex) if Carla.host is not None else [] + self.fDeviceNames = gCarla.host.get_engine_driver_device_names(driverIndex) if gCarla.host is not None else [] self.fBufferSizes = BUFFER_SIZE_LIST self.fSampleRates = SAMPLE_RATE_LIST @@ -180,8 +180,8 @@ class DriverSettingsW(QDialog): self.ui.cb_buffersize.clear() self.ui.cb_samplerate.clear() - if deviceName and Carla.host is not None: - driverDeviceInfo = Carla.host.get_engine_driver_device_info(self.fDriverIndex, deviceName) + if deviceName and gCarla.host is not None: + driverDeviceInfo = gCarla.host.get_engine_driver_device_info(self.fDriverIndex, deviceName) self.fBufferSizes = numPtrToList(driverDeviceInfo['bufferSizes']) self.fSampleRates = numPtrToList(driverDeviceInfo['sampleRates']) @@ -234,9 +234,9 @@ class CarlaSettingsW(QDialog): # ------------------------------------------------------------- # Set-up GUI - if Carla.host is not None: - for i in range(Carla.host.get_engine_driver_count()): - self.ui.cb_engine_audio_driver.addItem(Carla.host.get_engine_driver_name(i)) + if gCarla.host is not None: + for i in range(gCarla.host.get_engine_driver_count()): + self.ui.cb_engine_audio_driver.addItem(gCarla.host.get_engine_driver_name(i)) else: self.ui.tb_engine_driver_config.setEnabled(False) @@ -262,7 +262,7 @@ class CarlaSettingsW(QDialog): if not MACOS: self.ui.cb_paths.removeItem(self.ui.cb_paths.findText("AU")) - if Carla.isPlugin: + if gCarla.isPlugin: self.ui.lw_page.hideRow(self.TAB_INDEX_ENGINE) self.ui.lw_page.hideRow(self.TAB_INDEX_PATHS) @@ -361,15 +361,15 @@ class CarlaSettingsW(QDialog): # -------------------------------------------- # Paths - ladspas = toList(settings.value(CARLA_KEY_PATHS_LADSPA, Carla.DEFAULT_LADSPA_PATH)) - dssis = toList(settings.value(CARLA_KEY_PATHS_DSSI, Carla.DEFAULT_DSSI_PATH)) - lv2s = toList(settings.value(CARLA_KEY_PATHS_LV2, Carla.DEFAULT_LV2_PATH)) - vsts = toList(settings.value(CARLA_KEY_PATHS_VST, Carla.DEFAULT_VST_PATH)) - aus = toList(settings.value(CARLA_KEY_PATHS_AU, Carla.DEFAULT_AU_PATH)) - csds = toList(settings.value(CARLA_KEY_PATHS_CSD, Carla.DEFAULT_CSOUND_PATH)) - gigs = toList(settings.value(CARLA_KEY_PATHS_GIG, Carla.DEFAULT_GIG_PATH)) - sf2s = toList(settings.value(CARLA_KEY_PATHS_SF2, Carla.DEFAULT_SF2_PATH)) - sfzs = toList(settings.value(CARLA_KEY_PATHS_SFZ, Carla.DEFAULT_SFZ_PATH)) + ladspas = toList(settings.value(CARLA_KEY_PATHS_LADSPA, gCarla.DEFAULT_LADSPA_PATH)) + dssis = toList(settings.value(CARLA_KEY_PATHS_DSSI, gCarla.DEFAULT_DSSI_PATH)) + lv2s = toList(settings.value(CARLA_KEY_PATHS_LV2, gCarla.DEFAULT_LV2_PATH)) + vsts = toList(settings.value(CARLA_KEY_PATHS_VST, gCarla.DEFAULT_VST_PATH)) + aus = toList(settings.value(CARLA_KEY_PATHS_AU, gCarla.DEFAULT_AU_PATH)) + csds = toList(settings.value(CARLA_KEY_PATHS_CSD, gCarla.DEFAULT_CSOUND_PATH)) + gigs = toList(settings.value(CARLA_KEY_PATHS_GIG, gCarla.DEFAULT_GIG_PATH)) + sf2s = toList(settings.value(CARLA_KEY_PATHS_SF2, gCarla.DEFAULT_SF2_PATH)) + sfzs = toList(settings.value(CARLA_KEY_PATHS_SFZ, gCarla.DEFAULT_SFZ_PATH)) ladspas.sort() dssis.sort() diff --git a/source/carla_shared.py b/source/carla_shared.py index b7dd320cc..f5fe1f064 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Common Carla code -# Copyright (C) 2011-2013 Filipe Coelho +# Copyright (C) 2011-2014 Filipe Coelho # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -22,7 +22,7 @@ import os import sys -from PyQt4.QtCore import qFatal, qWarning +from PyQt4.QtCore import qFatal, qWarning, QDir from PyQt4.QtGui import QIcon from PyQt4.QtGui import QFileDialog, QMessageBox @@ -59,51 +59,56 @@ VERSION = "1.9.0" # ------------------------------------------------------------------------------------------------------------ # Set TMP -TMP = os.getenv("TMP") +envTMP = os.getenv("TMP") -if TMP is None: +if envTMP is None: if WINDOWS: qWarning("TMP variable not set") - TMP = os.path.join(WINDIR, "temp") - else: - TMP = "/tmp" + TMP = QDir.tempPath() +else: + TMP = envTMP -elif not os.path.exists(TMP): +if not os.path.exists(TMP): qWarning("TMP does not exist") - TMP = "/tmp" + TMP = "/" + +del envTMP # ------------------------------------------------------------------------------------------------------------ # Set HOME -HOME = os.getenv("HOME") - -if HOME is None: - HOME = os.path.expanduser("~") +envHOME = os.getenv("HOME") +if envHOME is None: if LINUX or MACOS: qWarning("HOME variable not set") + HOME = QDir.homePath() +else: + HOME = envHOME if not os.path.exists(HOME): qWarning("HOME does not exist") HOME = TMP +del envHOME + # ------------------------------------------------------------------------------------------------------------ # Set PATH -PATH = os.getenv("PATH") +envPATH = os.getenv("PATH") -if PATH is None: +if envPATH is None: qWarning("PATH variable not set") - if MACOS: PATH = ("/opt/local/bin", "/usr/local/bin", "/usr/bin", "/bin") elif WINDOWS: PATH = (os.path.join(WINDIR, "system32"), WINDIR) else: PATH = ("/usr/local/bin", "/usr/bin", "/bin") - else: - PATH = PATH.split(os.pathsep) + PATH = envPATH.split(os.pathsep) + +del envPATH # ------------------------------------------------------------------------------------------------------------ # Static MIDI CC list @@ -159,141 +164,7 @@ MIDI_CC_LIST = ( "0x5D FX 3 Depth [Chorus]", "0x5E FX 4 Depth [Detune]", "0x5F FX 5 Depth [Phaser]" - ) - -# ------------------------------------------------------------------------------------------------------------ -# Default Plugin Folders (get) - -if WINDOWS: - splitter = ";" - APPDATA = os.getenv("APPDATA") - PROGRAMFILES = os.getenv("PROGRAMFILES") - PROGRAMFILESx86 = os.getenv("PROGRAMFILES(x86)") - COMMONPROGRAMFILES = os.getenv("COMMONPROGRAMFILES") - - # Small integrity tests - if not APPDATA: - qFatal("APPDATA variable not set, cannot continue") - sys.exit(1) - - if not PROGRAMFILES: - qFatal("PROGRAMFILES variable not set, cannot continue") - sys.exit(1) - - if not COMMONPROGRAMFILES: - qFatal("COMMONPROGRAMFILES variable not set, cannot continue") - sys.exit(1) - - DEFAULT_LADSPA_PATH = ";".join((os.path.join(APPDATA, "LADSPA"), - os.path.join(PROGRAMFILES, "LADSPA"))) - - DEFAULT_DSSI_PATH = ";".join((os.path.join(APPDATA, "DSSI"), - os.path.join(PROGRAMFILES, "DSSI"))) - - DEFAULT_LV2_PATH = ";".join((os.path.join(APPDATA, "LV2"), - os.path.join(COMMONPROGRAMFILES, "LV2"))) - - DEFAULT_VST_PATH = ";".join((os.path.join(PROGRAMFILES, "VstPlugins"), - os.path.join(PROGRAMFILES, "Steinberg", "VstPlugins"))) - - DEFAULT_AU_PATH = "" - - # TODO - DEFAULT_CSOUND_PATH = "" - - DEFAULT_GIG_PATH = ";".join((os.path.join(APPDATA, "GIG"),)) - DEFAULT_SF2_PATH = ";".join((os.path.join(APPDATA, "SF2"),)) - DEFAULT_SFZ_PATH = ";".join((os.path.join(APPDATA, "SFZ"),)) - - if PROGRAMFILESx86: - DEFAULT_LADSPA_PATH += ";"+os.path.join(PROGRAMFILESx86, "LADSPA") - DEFAULT_DSSI_PATH += ";"+os.path.join(PROGRAMFILESx86, "DSSI") - DEFAULT_VST_PATH += ";"+os.path.join(PROGRAMFILESx86, "VstPlugins") - DEFAULT_VST_PATH += ";"+os.path.join(PROGRAMFILESx86, "Steinberg", "VstPlugins") - -elif HAIKU: - splitter = ":" - - DEFAULT_LADSPA_PATH = ":".join((os.path.join(HOME, ".ladspa"), - os.path.join("/", "boot", "common", "add-ons", "ladspa"))) - - DEFAULT_DSSI_PATH = ":".join((os.path.join(HOME, ".dssi"), - os.path.join("/", "boot", "common", "add-ons", "dssi"))) - - DEFAULT_LV2_PATH = ":".join((os.path.join(HOME, ".lv2"), - os.path.join("/", "boot", "common", "add-ons", "lv2"))) - - DEFAULT_VST_PATH = ":".join((os.path.join(HOME, ".vst"), - os.path.join("/", "boot", "common", "add-ons", "vst"))) - - DEFAULT_AU_PATH = "" - - # TODO - DEFAULT_CSOUND_PATH = "" - - # TODO - DEFAULT_GIG_PATH = "" - DEFAULT_SF2_PATH = "" - DEFAULT_SFZ_PATH = "" - -elif MACOS: - splitter = ":" - - DEFAULT_LADSPA_PATH = ":".join((os.path.join(HOME, "Library", "Audio", "Plug-Ins", "LADSPA"), - os.path.join("/", "Library", "Audio", "Plug-Ins", "LADSPA"))) - - DEFAULT_DSSI_PATH = ":".join((os.path.join(HOME, "Library", "Audio", "Plug-Ins", "DSSI"), - os.path.join("/", "Library", "Audio", "Plug-Ins", "DSSI"))) - - DEFAULT_LV2_PATH = ":".join((os.path.join(HOME, "Library", "Audio", "Plug-Ins", "LV2"), - os.path.join("/", "Library", "Audio", "Plug-Ins", "LV2"))) - - DEFAULT_VST_PATH = ":".join((os.path.join(HOME, "Library", "Audio", "Plug-Ins", "VST"), - os.path.join("/", "Library", "Audio", "Plug-Ins", "VST"))) - - DEFAULT_AU_PATH = ":".join((os.path.join(HOME, "Library", "Audio", "Plug-Ins", "Components"), - os.path.join("/", "Library", "Audio", "Plug-Ins", "Components"))) - - # TODO - DEFAULT_CSOUND_PATH = "" - - # TODO - DEFAULT_GIG_PATH = "" - DEFAULT_SF2_PATH = "" - DEFAULT_SFZ_PATH = "" - -else: - splitter = ":" - - DEFAULT_LADSPA_PATH = ":".join((os.path.join(HOME, ".ladspa"), - os.path.join("/", "usr", "lib", "ladspa"), - os.path.join("/", "usr", "local", "lib", "ladspa"))) - - DEFAULT_DSSI_PATH = ":".join((os.path.join(HOME, ".dssi"), - os.path.join("/", "usr", "lib", "dssi"), - os.path.join("/", "usr", "local", "lib", "dssi"))) - - DEFAULT_LV2_PATH = ":".join((os.path.join(HOME, ".lv2"), - os.path.join("/", "usr", "lib", "lv2"), - os.path.join("/", "usr", "local", "lib", "lv2"))) - - DEFAULT_VST_PATH = ":".join((os.path.join(HOME, ".vst"), - os.path.join("/", "usr", "lib", "vst"), - os.path.join("/", "usr", "local", "lib", "vst"))) - - DEFAULT_AU_PATH = "" - - # TODO - DEFAULT_CSOUND_PATH = "" - - DEFAULT_GIG_PATH = ":".join((os.path.join(HOME, ".sounds", "gig"), - os.path.join("/", "usr", "share", "sounds", "gig"))) - - DEFAULT_SF2_PATH = ":".join((os.path.join(HOME, ".sounds", "sf2"), - os.path.join("/", "usr", "share", "sounds", "sf2"))) - - DEFAULT_SFZ_PATH = ":".join((os.path.join(HOME, ".sounds", "sfz"), - os.path.join("/", "usr", "share", "sounds", "sfz"))) +) # ------------------------------------------------------------------------------------------------------------ # Carla Settings keys @@ -328,6 +199,7 @@ CARLA_KEY_PATHS_LADSPA = "Paths/LADSPA" CARLA_KEY_PATHS_DSSI = "Paths/DSSI" CARLA_KEY_PATHS_LV2 = "Paths/LV2" CARLA_KEY_PATHS_VST = "Paths/VST" +CARLA_KEY_PATHS_VST3 = "Paths/VST3" CARLA_KEY_PATHS_AU = "Paths/AU" CARLA_KEY_PATHS_CSD = "Paths/CSD" CARLA_KEY_PATHS_GIG = "Paths/GIG" @@ -370,6 +242,7 @@ class CarlaObject(object): 'DEFAULT_DSSI_PATH', 'DEFAULT_LV2_PATH', 'DEFAULT_VST_PATH', + 'DEFAULT_VST3_PATH', 'DEFAULT_AU_PATH', 'DEFAULT_CSOUND_PATH', 'DEFAULT_GIG_PATH', @@ -377,22 +250,149 @@ class CarlaObject(object): 'DEFAULT_SFZ_PATH' ] -Carla = CarlaObject() -Carla.host = None -Carla.gui = None -Carla.isControl = False -Carla.isLocal = True -Carla.isPlugin = False -Carla.bufferSize = 0 -Carla.sampleRate = 0.0 -Carla.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS if LINUX else ENGINE_PROCESS_MODE_CONTINUOUS_RACK -Carla.transportMode = ENGINE_TRANSPORT_MODE_JACK if LINUX else ENGINE_TRANSPORT_MODE_INTERNAL -Carla.maxParameters = MAX_DEFAULT_PARAMETERS -Carla.discovery_native = "" -Carla.discovery_posix32 = "" -Carla.discovery_posix64 = "" -Carla.discovery_win32 = "" -Carla.discovery_win64 = "" +gCarla = CarlaObject() +gCarla.host = None +gCarla.gui = None +gCarla.isControl = False +gCarla.isLocal = True +gCarla.isPlugin = False +gCarla.bufferSize = 0 +gCarla.sampleRate = 0.0 +gCarla.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS if LINUX else ENGINE_PROCESS_MODE_CONTINUOUS_RACK +gCarla.transportMode = ENGINE_TRANSPORT_MODE_JACK if LINUX else ENGINE_TRANSPORT_MODE_INTERNAL +gCarla.maxParameters = MAX_DEFAULT_PARAMETERS +gCarla.discovery_native = "" +gCarla.discovery_posix32 = "" +gCarla.discovery_posix64 = "" +gCarla.discovery_win32 = "" +gCarla.discovery_win64 = "" + +# ------------------------------------------------------------------------------------------------------------ +# Default Plugin Folders (get) + +DEFAULT_LADSPA_PATH = "" +DEFAULT_DSSI_PATH = "" +DEFAULT_LV2_PATH = "" +DEFAULT_VST_PATH = "" +DEFAULT_VST3_PATH = "" +DEFAULT_AU_PATH = "" +DEFAULT_CSOUND_PATH = "" +DEFAULT_GIG_PATH = "" +DEFAULT_SF2_PATH = "" +DEFAULT_SFZ_PATH = "" + +if WINDOWS: + splitter = ";" + + APPDATA = os.getenv("APPDATA") + PROGRAMFILES = os.getenv("PROGRAMFILES") + PROGRAMFILESx86 = os.getenv("PROGRAMFILES(x86)") + COMMONPROGRAMFILES = os.getenv("COMMONPROGRAMFILES") + + # Small integrity tests + if not APPDATA: + qFatal("APPDATA variable not set, cannot continue") + sys.exit(1) + + if not PROGRAMFILES: + qFatal("PROGRAMFILES variable not set, cannot continue") + sys.exit(1) + + if not COMMONPROGRAMFILES: + qFatal("COMMONPROGRAMFILES variable not set, cannot continue") + sys.exit(1) + + DEFAULT_LADSPA_PATH = APPDATA + "\\LADSPA" + DEFAULT_LADSPA_PATH += ";" + PROGRAMFILES + "\\LADSPA" + + DEFAULT_DSSI_PATH = APPDATA + "\\DSSI" + DEFAULT_DSSI_PATH += ";" + PROGRAMFILES + "\\DSSI" + + DEFAULT_LV2_PATH = APPDATA + "\\LV2" + DEFAULT_LV2_PATH += ";" + COMMONPROGRAMFILES + "\\LV2" + + DEFAULT_VST_PATH = PROGRAMFILES + "\\VstPlugins" + DEFAULT_VST_PATH += ";" + PROGRAMFILES + "\\Steinberg\\VstPlugins" + + DEFAULT_VST3_PATH = PROGRAMFILES + "\\Vst3" + + DEFAULT_GIG_PATH = APPDATA + "\\GIG" + DEFAULT_SF2_PATH = APPDATA + "\\SF2" + DEFAULT_SFZ_PATH = APPDATA + "\\SFZ" + + if PROGRAMFILESx86: + DEFAULT_LADSPA_PATH += ";" + PROGRAMFILESx86 + "\\LADSPA" + DEFAULT_DSSI_PATH += ";" + PROGRAMFILESx86 + "\\DSSI" + DEFAULT_VST_PATH += ";" + PROGRAMFILESx86 + "\\VstPlugins" + DEFAULT_VST_PATH += ";" + PROGRAMFILESx86 + "\\Steinberg\\VstPlugins" +elif HAIKU: + splitter = ":" + + DEFAULT_LADSPA_PATH = HOME + "/.ladspa" + DEFAULT_LADSPA_PATH += ":/boot/common/add-ons/ladspa" + + DEFAULT_DSSI_PATH = HOME + "/.dssi" + DEFAULT_DSSI_PATH += ":/boot/common/add-ons/dssi" + + DEFAULT_LV2_PATH = HOME + "/.lv2" + DEFAULT_LV2_PATH += ":/boot/common/add-ons/lv2" + + DEFAULT_VST_PATH = HOME + "/.vst" + DEFAULT_VST_PATH += ":/boot/common/add-ons/vst" + + DEFAULT_VST3_PATH = HOME + "/.vst3" + DEFAULT_VST3_PATH += ":/boot/common/add-ons/vst3" +elif MACOS: + splitter = ":" + + DEFAULT_LADSPA_PATH = HOME + "/Library/Audio/Plug-Ins/LADSPA" + DEFAULT_LADSPA_PATH += ":/Library/Audio/Plug-Ins/LADSPA" + + DEFAULT_DSSI_PATH = HOME + "/Library/Audio/Plug-Ins/DSSI" + DEFAULT_DSSI_PATH += ":/Library/Audio/Plug-Ins/DSSI" + + DEFAULT_LV2_PATH = HOME + "/Library/Audio/Plug-Ins/LV2" + DEFAULT_LV2_PATH += ":/Library/Audio/Plug-Ins/LV2" + + DEFAULT_VST_PATH = HOME + "/Library/Audio/Plug-Ins/VST" + DEFAULT_VST_PATH += ":/Library/Audio/Plug-Ins/VST" + + DEFAULT_VST3_PATH = HOME + "/Library/Audio/Plug-Ins/VST3" + DEFAULT_VST3_PATH += ":/Library/Audio/Plug-Ins/VST3" + + DEFAULT_AU_PATH = HOME + "/Library/Audio/Plug-Ins/Components" + DEFAULT_AU_PATH += ":/Library/Audio/Plug-Ins/Components" +else: + splitter = ":" + + DEFAULT_LADSPA_PATH = HOME + "/.ladspa" + DEFAULT_LADSPA_PATH += ":/usr/lib/ladspa" + DEFAULT_LADSPA_PATH += ":/usr/local/lib/ladspa" + + DEFAULT_DSSI_PATH = HOME + "/.dssi" + DEFAULT_DSSI_PATH += ":/usr/lib/dssi" + DEFAULT_DSSI_PATH += ":/usr/local/lib/dssi" + + DEFAULT_LV2_PATH = HOME + "/.lv2" + DEFAULT_LV2_PATH += ":/usr/lib/lv2" + DEFAULT_LV2_PATH += ":/usr/local/lib/lv2" + + DEFAULT_VST_PATH = HOME + "/.vst" + DEFAULT_VST_PATH += ":/usr/lib/vst" + DEFAULT_VST_PATH += ":/usr/local/lib/vst" + + DEFAULT_VST3_PATH = HOME + "/.vst3" + DEFAULT_VST3_PATH += ":/usr/lib/vst3" + DEFAULT_VST3_PATH += ":/usr/local/lib/vst3" + + DEFAULT_GIG_PATH = HOME + "/.sounds/gig" + DEFAULT_GIG_PATH += ":/usr/share/sounds/gig" + + DEFAULT_SF2_PATH = HOME + "/.sounds/sf2" + DEFAULT_SF2_PATH += ":/usr/share/sounds/sf2" + + DEFAULT_SFZ_PATH = HOME + "/.sounds/sfz" + DEFAULT_SFZ_PATH += ":/usr/share/sounds/sfz" # ------------------------------------------------------------------------------------------------------------ # Default Plugin Folders (set) @@ -415,26 +415,28 @@ if WINDOWS: del reg if readEnvVars: - Carla.DEFAULT_LADSPA_PATH = os.getenv("LADSPA_PATH", DEFAULT_LADSPA_PATH).split(splitter) - Carla.DEFAULT_DSSI_PATH = os.getenv("DSSI_PATH", DEFAULT_DSSI_PATH).split(splitter) - Carla.DEFAULT_LV2_PATH = os.getenv("LV2_PATH", DEFAULT_LV2_PATH).split(splitter) - Carla.DEFAULT_VST_PATH = os.getenv("VST_PATH", DEFAULT_VST_PATH).split(splitter) - Carla.DEFAULT_AU_PATH = os.getenv("AU_PATH", DEFAULT_AU_PATH).split(splitter) - Carla.DEFAULT_CSOUND_PATH = os.getenv("CSOUND_PATH", DEFAULT_CSOUND_PATH).split(splitter) - Carla.DEFAULT_GIG_PATH = os.getenv("GIG_PATH", DEFAULT_GIG_PATH).split(splitter) - Carla.DEFAULT_SF2_PATH = os.getenv("SF2_PATH", DEFAULT_SF2_PATH).split(splitter) - Carla.DEFAULT_SFZ_PATH = os.getenv("SFZ_PATH", DEFAULT_SFZ_PATH).split(splitter) + gCarla.DEFAULT_LADSPA_PATH = os.getenv("LADSPA_PATH", DEFAULT_LADSPA_PATH).split(splitter) + gCarla.DEFAULT_DSSI_PATH = os.getenv("DSSI_PATH", DEFAULT_DSSI_PATH).split(splitter) + gCarla.DEFAULT_LV2_PATH = os.getenv("LV2_PATH", DEFAULT_LV2_PATH).split(splitter) + gCarla.DEFAULT_VST_PATH = os.getenv("VST_PATH", DEFAULT_VST_PATH).split(splitter) + gCarla.DEFAULT_VST3_PATH = os.getenv("VST3_PATH", DEFAULT_VST3_PATH).split(splitter) + gCarla.DEFAULT_AU_PATH = os.getenv("AU_PATH", DEFAULT_AU_PATH).split(splitter) + gCarla.DEFAULT_CSOUND_PATH = os.getenv("CSOUND_PATH", DEFAULT_CSOUND_PATH).split(splitter) + gCarla.DEFAULT_GIG_PATH = os.getenv("GIG_PATH", DEFAULT_GIG_PATH).split(splitter) + gCarla.DEFAULT_SF2_PATH = os.getenv("SF2_PATH", DEFAULT_SF2_PATH).split(splitter) + gCarla.DEFAULT_SFZ_PATH = os.getenv("SFZ_PATH", DEFAULT_SFZ_PATH).split(splitter) else: - Carla.DEFAULT_LADSPA_PATH = DEFAULT_LADSPA_PATH.split(splitter) - Carla.DEFAULT_DSSI_PATH = DEFAULT_DSSI_PATH.split(splitter) - Carla.DEFAULT_LV2_PATH = DEFAULT_LV2_PATH.split(splitter) - Carla.DEFAULT_VST_PATH = DEFAULT_VST_PATH.split(splitter) - Carla.DEFAULT_AU_PATH = DEFAULT_AU_PATH.split(splitter) - Carla.DEFAULT_CSOUND_PATH = DEFAULT_CSOUND_PATH.split(splitter) - Carla.DEFAULT_GIG_PATH = DEFAULT_GIG_PATH.split(splitter) - Carla.DEFAULT_SF2_PATH = DEFAULT_SF2_PATH.split(splitter) - Carla.DEFAULT_SFZ_PATH = DEFAULT_SFZ_PATH.split(splitter) + gCarla.DEFAULT_LADSPA_PATH = DEFAULT_LADSPA_PATH.split(splitter) + gCarla.DEFAULT_DSSI_PATH = DEFAULT_DSSI_PATH.split(splitter) + gCarla.DEFAULT_LV2_PATH = DEFAULT_LV2_PATH.split(splitter) + gCarla.DEFAULT_VST_PATH = DEFAULT_VST_PATH.split(splitter) + gCarla.DEFAULT_VST3_PATH = DEFAULT_VST3_PATH.split(splitter) + gCarla.DEFAULT_AU_PATH = DEFAULT_AU_PATH.split(splitter) + gCarla.DEFAULT_CSOUND_PATH = DEFAULT_CSOUND_PATH.split(splitter) + gCarla.DEFAULT_GIG_PATH = DEFAULT_GIG_PATH.split(splitter) + gCarla.DEFAULT_SF2_PATH = DEFAULT_SF2_PATH.split(splitter) + gCarla.DEFAULT_SFZ_PATH = DEFAULT_SFZ_PATH.split(splitter) # ------------------------------------------------------------------------------------------------------------ # Search for Carla tools @@ -469,7 +471,7 @@ def initHost(appName, libPrefix = None, failError = True): libname = "libcarla_" - if Carla.isControl: + if gCarla.isControl: libname += "control2" else: libname += "standalone2" @@ -514,20 +516,20 @@ def initHost(appName, libPrefix = None, failError = True): # ------------------------------------------------------------- # find windows tools - Carla.discovery_win32 = findTool("discovery", "carla-discovery-win32.exe") - Carla.discovery_win64 = findTool("discovery", "carla-discovery-win64.exe") + gCarla.discovery_win32 = findTool("discovery", "carla-discovery-win32.exe") + gCarla.discovery_win64 = findTool("discovery", "carla-discovery-win64.exe") # ------------------------------------------------------------- # find native and posix tools if not WINDOWS: - Carla.discovery_native = findTool("discovery", "carla-discovery-native") - Carla.discovery_posix32 = findTool("discovery", "carla-discovery-posix32") - Carla.discovery_posix64 = findTool("discovery", "carla-discovery-posix64") + gCarla.discovery_native = findTool("discovery", "carla-discovery-native") + gCarla.discovery_posix32 = findTool("discovery", "carla-discovery-posix32") + gCarla.discovery_posix64 = findTool("discovery", "carla-discovery-posix64") # ------------------------------------------------------------- - if not (libfilename or Carla.isPlugin): + if not (libfilename or gCarla.isPlugin): if failError: QMessageBox.critical(None, "Error", "Failed to find the carla library, cannot continue") sys.exit(1) @@ -536,8 +538,8 @@ def initHost(appName, libPrefix = None, failError = True): # ------------------------------------------------------------- # Init host - if Carla.host is None: - Carla.host = Host(libfilename) + if gCarla.host is None: + gCarla.host = Host(libfilename) # ------------------------------------------------------------- # Set binary path @@ -547,11 +549,11 @@ def initHost(appName, libPrefix = None, failError = True): systemBinaries = os.path.join(libfolder, "bridges") if os.path.exists(libfolder): - Carla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, libfolder) + gCarla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, libfolder) elif os.path.exists(localBinaries): - Carla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, localBinaries) + gCarla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, localBinaries) elif os.path.exists(systemBinaries): - Carla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, systemBinaries) + gCarla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, systemBinaries) # ------------------------------------------------------------- # Set resource path @@ -560,9 +562,9 @@ def initHost(appName, libPrefix = None, failError = True): systemResources = os.path.join(libfolder, "resources") if os.path.exists(localResources): - Carla.host.set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, localResources) + gCarla.host.set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, localResources) elif os.path.exists(systemResources): - Carla.host.set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, systemResources) + gCarla.host.set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, systemResources) # ------------------------------------------------------------------------------------------------------------ # Check if a value is a number (float support) @@ -595,13 +597,13 @@ def getIcon(icon, size=16): # Signal handler def signalHandler(sig, frame): - if Carla.gui is None: + if gCarla.gui is None: return if sig in (SIGINT, SIGTERM): - Carla.gui.SIGTERM.emit() + gCarla.gui.SIGTERM.emit() elif haveSIGUSR1 and sig == SIGUSR1: - Carla.gui.SIGUSR1.emit() + gCarla.gui.SIGUSR1.emit() def setUpSignals(): signal(SIGINT, signalHandler) @@ -615,8 +617,8 @@ def setUpSignals(): # ------------------------------------------------------------------------------------------------------------ # QLineEdit and QPushButton combo -def getAndSetPath(self_, currentPath, lineEdit): - newPath = QFileDialog.getExistingDirectory(self_, self_.tr("Set Path"), currentPath, QFileDialog.ShowDirsOnly) +def getAndSetPath(parent, currentPath, lineEdit): + newPath = QFileDialog.getExistingDirectory(parent, parent.tr("Set Path"), currentPath, QFileDialog.ShowDirsOnly) if newPath: lineEdit.setText(newPath) return newPath @@ -656,8 +658,8 @@ def getPluginTypeAsString(ptype): # ------------------------------------------------------------------------------------------------------------ # Custom MessageBox -def CustomMessageBox(self_, icon, title, text, extraText="", buttons=QMessageBox.Yes|QMessageBox.No, defButton=QMessageBox.No): - msgBox = QMessageBox(self_) +def CustomMessageBox(parent, icon, title, text, extraText="", buttons=QMessageBox.Yes|QMessageBox.No, defButton=QMessageBox.No): + msgBox = QMessageBox(parent) msgBox.setIcon(icon) msgBox.setWindowTitle(title) msgBox.setText(text) diff --git a/source/carla_skin.py b/source/carla_skin.py index bdd2178a9..92f5daaa7 100644 --- a/source/carla_skin.py +++ b/source/carla_skin.py @@ -45,7 +45,7 @@ class AbstractPluginSlot(QFrame): # Get plugin info self.fPluginId = pluginId - self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId) if Carla.host is not None else gFakePluginInfo + self.fPluginInfo = gCarla.host.get_plugin_info(self.fPluginId) if gCarla.host is not None else gFakePluginInfo self.fPluginInfo['filename'] = charPtrToString(self.fPluginInfo['filename']) self.fPluginInfo['name'] = charPtrToString(self.fPluginInfo['name']) @@ -54,7 +54,7 @@ class AbstractPluginSlot(QFrame): self.fPluginInfo['copyright'] = charPtrToString(self.fPluginInfo['copyright']) self.fPluginInfo['iconName'] = charPtrToString(self.fPluginInfo['iconName']) - if not Carla.isLocal: + if not gCarla.isLocal: self.fPluginInfo['hints'] &= ~PLUGIN_HAS_CUSTOM_UI # ------------------------------------------------------------- @@ -69,11 +69,11 @@ class AbstractPluginSlot(QFrame): self.fParameterIconTimer = ICON_STATE_NULL self.fParameterList = [] # index, widget - if Carla.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK or Carla.host is None: + if gCarla.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK or gCarla.host is None: self.fPeaksInputCount = 2 self.fPeaksOutputCount = 2 else: - audioCountInfo = Carla.host.get_audio_port_count_info(self.fPluginId) + audioCountInfo = gCarla.host.get_audio_port_count_info(self.fPluginId) self.fPeaksInputCount = int(audioCountInfo['ins']) self.fPeaksOutputCount = int(audioCountInfo['outs']) @@ -167,8 +167,8 @@ class AbstractPluginSlot(QFrame): for paramIndex, paramWidget in self.fParameterList: paramWidget.valueChanged.connect(self.slot_parameterValueChanged) - if paramIndex >= 0 and Carla.host is not None: - paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramIndex) * 1000) + if paramIndex >= 0 and gCarla.host is not None: + paramWidget.setValue(gCarla.host.get_current_parameter_value(self.fPluginId, paramIndex) * 1000) #------------------------------------------------------------------ @@ -209,7 +209,7 @@ class AbstractPluginSlot(QFrame): self.fIsActive = active if sendGui: self.activeChanged(active) - if sendCallback: Carla.host.set_active(self.fPluginId, active) + if sendCallback: gCarla.host.set_active(self.fPluginId, active) if active: self.fEditDialog.clearNotes() @@ -225,26 +225,26 @@ class AbstractPluginSlot(QFrame): elif parameterId == PARAMETER_DRYWET: if (self.fPluginInfo['hints'] & PLUGIN_CAN_DRYWET) == 0: return - Carla.host.set_drywet(self.fPluginId, value) + gCarla.host.set_drywet(self.fPluginId, value) elif parameterId == PARAMETER_VOLUME: if (self.fPluginInfo['hints'] & PLUGIN_CAN_VOLUME) == 0: return - Carla.host.set_volume(self.fPluginId, value) + gCarla.host.set_volume(self.fPluginId, value) elif parameterId == PARAMETER_BALANCE_LEFT: if (self.fPluginInfo['hints'] & PLUGIN_CAN_BALANCE) == 0: return - Carla.host.set_balance_left(self.fPluginId, value) + gCarla.host.set_balance_left(self.fPluginId, value) elif parameterId == PARAMETER_BALANCE_RIGHT: if (self.fPluginInfo['hints'] & PLUGIN_CAN_BALANCE) == 0: return - Carla.host.set_balance_right(self.fPluginId, value) + gCarla.host.set_balance_right(self.fPluginId, value) elif parameterId == PARAMETER_PANNING: if (self.fPluginInfo['hints'] & PLUGIN_CAN_PANNING) == 0: return - Carla.host.set_panning(self.fPluginId, value) + gCarla.host.set_panning(self.fPluginId, value) elif parameterId == PARAMETER_CTRL_CHANNEL: - Carla.host.set_ctrl_channel(self.fPluginId, value) + gCarla.host.set_ctrl_channel(self.fPluginId, value) self.fEditDialog.setParameterValue(parameterId, value) @@ -382,8 +382,8 @@ class AbstractPluginSlot(QFrame): # Input peaks if self.fPeaksInputCount > 0: if self.fPeaksInputCount > 1: - peak1 = Carla.host.get_input_peak_value(self.fPluginId, True) - peak2 = Carla.host.get_input_peak_value(self.fPluginId, False) + peak1 = gCarla.host.get_input_peak_value(self.fPluginId, True) + peak2 = gCarla.host.get_input_peak_value(self.fPluginId, False) ledState = bool(peak1 != 0.0 or peak2 != 0.0) if self.peak_in is not None: @@ -391,7 +391,7 @@ class AbstractPluginSlot(QFrame): self.peak_in.displayMeter(2, peak2) else: - peak = Carla.host.get_input_peak_value(self.fPluginId, True) + peak = gCarla.host.get_input_peak_value(self.fPluginId, True) ledState = bool(peak != 0.0) if self.peak_in is not None: @@ -404,8 +404,8 @@ class AbstractPluginSlot(QFrame): # Output peaks if self.fPeaksOutputCount > 0: if self.fPeaksOutputCount > 1: - peak1 = Carla.host.get_output_peak_value(self.fPluginId, True) - peak2 = Carla.host.get_output_peak_value(self.fPluginId, False) + peak1 = gCarla.host.get_output_peak_value(self.fPluginId, True) + peak2 = gCarla.host.get_output_peak_value(self.fPluginId, False) ledState = bool(peak1 != 0.0 or peak2 != 0.0) if self.peak_out is not None: @@ -413,7 +413,7 @@ class AbstractPluginSlot(QFrame): self.peak_out.displayMeter(2, peak2) else: - peak = Carla.host.get_output_peak_value(self.fPluginId, True) + peak = gCarla.host.get_output_peak_value(self.fPluginId, True) ledState = bool(peak != 0.0) if self.peak_out is not None: @@ -487,9 +487,9 @@ class AbstractPluginSlot(QFrame): elif actSel == actEdit: bEdit.click() elif actSel == actClone: - if Carla.host is not None and not Carla.host.clone_plugin(self.fPluginId): + if gCarla.host is not None and not gCarla.host.clone_plugin(self.fPluginId): CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"), - Carla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) + gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) elif actSel == actRename: oldName = self.fPluginInfo['name'] @@ -500,16 +500,16 @@ class AbstractPluginSlot(QFrame): newName = newNameTry[0] - if Carla.host is None or Carla.host.rename_plugin(self.fPluginId, newName): + if gCarla.host is None or gCarla.host.rename_plugin(self.fPluginId, newName): self.setName(newName) else: CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"), - Carla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) + gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) elif actSel == actRemove: - if Carla.host is not None and not Carla.host.remove_plugin(self.fPluginId): + if gCarla.host is not None and not gCarla.host.remove_plugin(self.fPluginId): CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"), - Carla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) + gCarla.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) #------------------------------------------------------------------ @@ -525,7 +525,7 @@ class AbstractPluginSlot(QFrame): @pyqtSlot(bool) def slot_showCustomUi(self, show): - Carla.host.show_custom_ui(self.fPluginId, show) + gCarla.host.show_custom_ui(self.fPluginId, show) @pyqtSlot(bool) def slot_showEditDialog(self, show): @@ -533,7 +533,7 @@ class AbstractPluginSlot(QFrame): @pyqtSlot() def slot_removePlugin(self): - Carla.host.remove_plugin(self.fPluginId) + gCarla.host.remove_plugin(self.fPluginId) #------------------------------------------------------------------ @@ -545,17 +545,17 @@ class AbstractPluginSlot(QFrame): if index < 0: self.setInternalParameter(index, value) else: - Carla.host.set_parameter_value(self.fPluginId, index, value) + gCarla.host.set_parameter_value(self.fPluginId, index, value) self.setParameterValue(index, value, False) @pyqtSlot(int) def slot_programChanged(self, index): - Carla.host.set_program(self.fPluginId, index) + gCarla.host.set_program(self.fPluginId, index) self.setProgram(index, False) @pyqtSlot(int) def slot_midiProgramChanged(self, index): - Carla.host.set_midi_program(self.fPluginId, index) + gCarla.host.set_midi_program(self.fPluginId, index) self.setMidiProgram(index, False) #------------------------------------------------------------------ @@ -757,13 +757,13 @@ class PluginSlot_BasicFX(AbstractPluginSlot): # ------------------------------------------------------------- # Set-up parameters - parameterCount = Carla.host.get_parameter_count(self.fPluginId) if Carla.host is not None else 0 + parameterCount = gCarla.host.get_parameter_count(self.fPluginId) if gCarla.host is not None else 0 index = 0 for i in range(min(parameterCount, 8)): - paramInfo = Carla.host.get_parameter_info(self.fPluginId, i) - paramData = Carla.host.get_parameter_data(self.fPluginId, i) - paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i) + 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) if paramData['type'] != PARAMETER_INPUT: continue @@ -926,8 +926,8 @@ class PluginSlot_Calf(AbstractPluginSlot): labelFont.setPointSize(labelFont.pointSize()+3) self.ui.label_name.setFont(labelFont) - audioCount = Carla.host.get_audio_port_count_info(self.fPluginId) if Carla.host is not None else {'ins': 2, 'outs': 2 } - midiCount = Carla.host.get_midi_port_count_info(self.fPluginId) if Carla.host is not None else {'ins': 1, 'outs': 0 } + 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 } if audioCount['ins'] == 0: self.ui.label_audio_in.hide() @@ -988,7 +988,7 @@ class PluginSlot_ZitaRev(AbstractPluginSlot): # ------------------------------------------------------------- # Internal stuff - audioCount = Carla.host.get_audio_port_count_info(self.fPluginId) if Carla.host is not None else {'ins': 2, 'outs': 2 } + audioCount = gCarla.host.get_audio_port_count_info(self.fPluginId) if gCarla.host is not None else {'ins': 2, 'outs': 2 } # ------------------------------------------------------------- # Set-up GUI @@ -1146,13 +1146,13 @@ class PluginSlot_ZynFX(AbstractPluginSlot): # ------------------------------------------------------------- # Set-up parameters - parameterCount = Carla.host.get_parameter_count(self.fPluginId) if Carla.host is not None else 0 + parameterCount = gCarla.host.get_parameter_count(self.fPluginId) if gCarla.host is not None else 0 index = 0 for i in range(parameterCount): - paramInfo = Carla.host.get_parameter_info(self.fPluginId, i) - paramData = Carla.host.get_parameter_data(self.fPluginId, i) - paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i) + 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) if paramData['type'] != PARAMETER_INPUT: continue @@ -1252,19 +1252,19 @@ class PluginSlot_ZynFX(AbstractPluginSlot): # ------------------------------------------------------------- # Set-up MIDI programs - midiProgramCount = Carla.host.get_midi_program_count(self.fPluginId) if Carla.host is not None else 0 + midiProgramCount = gCarla.host.get_midi_program_count(self.fPluginId) if gCarla.host is not None else 0 if midiProgramCount > 0: self.ui.cb_presets.setEnabled(True) self.ui.label_presets.setEnabled(True) for i in range(midiProgramCount): - mpData = Carla.host.get_midi_program_data(self.fPluginId, i) + mpData = gCarla.host.get_midi_program_data(self.fPluginId, i) mpName = charPtrToString(mpData['name']) self.ui.cb_presets.addItem(mpName) - self.fCurrentMidiProgram = Carla.host.get_current_midi_program_index(self.fPluginId) + self.fCurrentMidiProgram = gCarla.host.get_current_midi_program_index(self.fPluginId) self.ui.cb_presets.setCurrentIndex(self.fCurrentMidiProgram) else: @@ -1302,8 +1302,8 @@ class PluginSlot_ZynFX(AbstractPluginSlot): # ------------------------------------------------------------------------------------------------------------ def createPluginSlot(parent, pluginId): - pluginInfo = Carla.host.get_plugin_info(pluginId) - pluginName = Carla.host.get_real_plugin_name(pluginId) + pluginInfo = gCarla.host.get_plugin_info(pluginId) + pluginName = gCarla.host.get_real_plugin_name(pluginId) pluginLabel = charPtrToString(pluginInfo['label']) uniqueId = int(pluginInfo['uniqueId']) diff --git a/source/carla_style.py b/source/carla_style.py index 141a94614..532b7bff6 100644 --- a/source/carla_style.py +++ b/source/carla_style.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Carla style -# Copyright (C) 2013 Filipe Coelho +# Copyright (C) 2013-2014 Filipe Coelho # # This program is free software you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/source/carla_widgets.py b/source/carla_widgets.py index d98c68fc9..f81af5e80 100755 --- a/source/carla_widgets.py +++ b/source/carla_widgets.py @@ -93,9 +93,9 @@ class CarlaAboutW(QDialog): self.ui = ui_carla_about.Ui_CarlaAboutW() self.ui.setupUi(self) - if Carla.isControl: + if gCarla.isControl: extraInfo = " - %s" % self.tr("OSC Bridge Version") - elif Carla.isPlugin: + elif gCarla.isPlugin: extraInfo = " - %s" % self.tr("Plugin Version") else: extraInfo = "" @@ -106,18 +106,18 @@ class CarlaAboutW(QDialog): "
Copyright (C) 2011-2013 falkTX
" "" % (VERSION, extraInfo))) - if Carla.isControl or Carla.isPlugin or Carla.host is None: + if gCarla.isControl or gCarla.isPlugin or gCarla.host is None: self.ui.l_extended.hide() self.ui.tabWidget.removeTab(1) self.ui.tabWidget.removeTab(1) self.adjustSize() else: - self.ui.l_extended.setText(Carla.host.get_complete_license_text()) + self.ui.l_extended.setText(gCarla.host.get_complete_license_text()) - if Carla.host.is_engine_running(): - self.ui.le_osc_url_tcp.setText(Carla.host.get_host_osc_url_tcp()) - self.ui.le_osc_url_udp.setText(Carla.host.get_host_osc_url_udp()) + if gCarla.host.is_engine_running(): + self.ui.le_osc_url_tcp.setText(gCarla.host.get_host_osc_url_tcp()) + self.ui.le_osc_url_udp.setText(gCarla.host.get_host_osc_url_udp()) else: self.ui.le_osc_url_tcp.setText(self.tr("(Engine not running)")) self.ui.le_osc_url_udp.setText(self.tr("(Engine not running)")) @@ -363,7 +363,7 @@ class PluginParameter(QWidget): self.valueChanged.emit(self.fParameterId, value) def _textCallBack(self): - return Carla.host.get_parameter_text(self.fPluginId, self.fParameterId) + return gCarla.host.get_parameter_text(self.fPluginId, self.fParameterId) # ------------------------------------------------------------------------------------------------------------ # Plugin Editor (Built-in) @@ -372,7 +372,7 @@ class PluginEdit(QDialog): kParamsPerPage = 8 def __init__(self, parent, pluginId): - QDialog.__init__(self, Carla.gui) + QDialog.__init__(self, gCarla.gui) self.ui = ui_carla_edit.Ui_PluginEdit() self.ui.setupUi(self) @@ -471,7 +471,7 @@ class PluginEdit(QDialog): self.ui.cb_programs.currentIndexChanged.connect(self.slot_programIndexChanged) self.ui.cb_midi_programs.currentIndexChanged.connect(self.slot_midiProgramIndexChanged) - if Carla.isLocal: + if gCarla.isLocal: self.ui.b_save_state.clicked.connect(self.slot_stateSave) self.ui.b_load_state.clicked.connect(self.slot_stateLoad) else: @@ -484,14 +484,14 @@ class PluginEdit(QDialog): # Update current program text if self.ui.cb_programs.count() > 0: pIndex = self.ui.cb_programs.currentIndex() - pName = charPtrToString(Carla.host.get_program_name(self.fPluginId, pIndex)) + pName = charPtrToString(gCarla.host.get_program_name(self.fPluginId, pIndex)) #pName = pName[:40] + (pName[40:] and "...") self.ui.cb_programs.setItemText(pIndex, pName) # Update current midi program text if self.ui.cb_midi_programs.count() > 0: mpIndex = self.ui.cb_midi_programs.currentIndex() - mpData = Carla.host.get_midi_program_data(self.fPluginId, mpIndex) + mpData = gCarla.host.get_midi_program_data(self.fPluginId, mpIndex) mpBank = int(mpData['bank']) mpProg = int(mpData['program']) mpName = charPtrToString(mpData['name']) @@ -500,7 +500,7 @@ class PluginEdit(QDialog): # Update all parameter values for paramType, paramId, paramWidget in self.fParameterList: - paramWidget.setValue(Carla.host.get_current_parameter_value(self.fPluginId, paramId), False) + paramWidget.setValue(gCarla.host.get_current_parameter_value(self.fPluginId, paramId), False) paramWidget.update() self.fParametersToUpdate = [] @@ -508,8 +508,8 @@ class PluginEdit(QDialog): #------------------------------------------------------------------ def reloadAll(self): - if Carla.host is not None: - self.fPluginInfo = Carla.host.get_plugin_info(self.fPluginId) + if gCarla.host is not None: + self.fPluginInfo = gCarla.host.get_plugin_info(self.fPluginId) self.fPluginInfo['filename'] = charPtrToString(self.fPluginInfo['filename']) self.fPluginInfo['name'] = charPtrToString(self.fPluginInfo['name']) self.fPluginInfo['label'] = charPtrToString(self.fPluginInfo['label']) @@ -517,7 +517,7 @@ class PluginEdit(QDialog): self.fPluginInfo['copyright'] = charPtrToString(self.fPluginInfo['copyright']) self.fPluginInfo['iconName'] = charPtrToString(self.fPluginInfo['iconName']) - if not Carla.isLocal: + if not gCarla.isLocal: self.fPluginInfo['hints'] &= ~PLUGIN_HAS_CUSTOM_UI else: @@ -538,11 +538,11 @@ class PluginEdit(QDialog): #------------------------------------------------------------------ def reloadInfo(self): - if Carla.host is not None: - pluginName = Carla.host.get_real_plugin_name(self.fPluginId) - audioCountInfo = Carla.host.get_audio_port_count_info(self.fPluginId) - midiCountInfo = Carla.host.get_midi_port_count_info(self.fPluginId) - paramCountInfo = Carla.host.get_parameter_count_info(self.fPluginId) + if gCarla.host is not None: + pluginName = gCarla.host.get_real_plugin_name(self.fPluginId) + audioCountInfo = gCarla.host.get_audio_port_count_info(self.fPluginId) + midiCountInfo = gCarla.host.get_midi_port_count_info(self.fPluginId) + paramCountInfo = gCarla.host.get_parameter_count_info(self.fPluginId) else: pluginName = "" audioCountInfo = gFakePortCountInfo @@ -661,7 +661,7 @@ class PluginEdit(QDialog): self.ui.tabWidget.widget(1).deleteLater() self.ui.tabWidget.removeTab(1) - if Carla.host is None: + if gCarla.host is None: paramFakeListFull = [] paramFakeList = [] paramFakeWidth = QFontMetrics(self.font()).width(gFakeParamInfo['name']) @@ -672,12 +672,12 @@ class PluginEdit(QDialog): self._createParameterWidgets(PARAMETER_INPUT, paramFakeListFull, self.tr("Parameters")) return - parameterCount = Carla.host.get_parameter_count(self.fPluginId) + parameterCount = gCarla.host.get_parameter_count(self.fPluginId) if parameterCount <= 0: pass - elif parameterCount <= Carla.maxParameters: + elif parameterCount <= gCarla.maxParameters: paramInputListFull = [] paramOutputListFull = [] @@ -687,10 +687,10 @@ class PluginEdit(QDialog): paramOutputWidth = 0 for i in range(parameterCount): - paramInfo = Carla.host.get_parameter_info(self.fPluginId, i) - paramData = Carla.host.get_parameter_data(self.fPluginId, i) - paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i) - paramValue = Carla.host.get_current_parameter_value(self.fPluginId, i) + 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) + paramValue = gCarla.host.get_current_parameter_value(self.fPluginId, i) if paramData['type'] not in (PARAMETER_INPUT, PARAMETER_OUTPUT): continue @@ -718,7 +718,7 @@ class PluginEdit(QDialog): } for j in range(paramInfo['scalePointCount']): - scalePointInfo = Carla.host.get_parameter_scalepoint_info(self.fPluginId, i, j) + scalePointInfo = gCarla.host.get_parameter_scalepoint_info(self.fPluginId, i, j) parameter['scalePoints'].append({ 'value': scalePointInfo['value'], @@ -771,7 +771,7 @@ class PluginEdit(QDialog): self._createParameterWidgets(PARAMETER_INPUT, paramInputListFull, self.tr("Parameters")) self._createParameterWidgets(PARAMETER_OUTPUT, paramOutputListFull, self.tr("Outputs")) - else: # > Carla.maxParameters + else: # > gCarla.maxParameters fakeName = self.tr("This plugin has too many parameters to display here!") paramFakeListFull = [] @@ -808,18 +808,18 @@ class PluginEdit(QDialog): self.ui.cb_programs.blockSignals(True) self.ui.cb_programs.clear() - programCount = Carla.host.get_program_count(self.fPluginId) if Carla.host is not None else 0 + programCount = gCarla.host.get_program_count(self.fPluginId) if gCarla.host is not None else 0 if programCount > 0: self.ui.cb_programs.setEnabled(True) self.ui.label_programs.setEnabled(True) for i in range(programCount): - pName = charPtrToString(Carla.host.get_program_name(self.fPluginId, i)) + pName = charPtrToString(gCarla.host.get_program_name(self.fPluginId, i)) #pName = pName[:40] + (pName[40:] and "...") self.ui.cb_programs.addItem(pName) - self.fCurrentProgram = Carla.host.get_current_program_index(self.fPluginId) + self.fCurrentProgram = gCarla.host.get_current_program_index(self.fPluginId) self.ui.cb_programs.setCurrentIndex(self.fCurrentProgram) else: @@ -833,14 +833,14 @@ class PluginEdit(QDialog): self.ui.cb_midi_programs.blockSignals(True) self.ui.cb_midi_programs.clear() - midiProgramCount = Carla.host.get_midi_program_count(self.fPluginId) if Carla.host is not None else 0 + midiProgramCount = gCarla.host.get_midi_program_count(self.fPluginId) if gCarla.host is not None else 0 if midiProgramCount > 0: self.ui.cb_midi_programs.setEnabled(True) self.ui.label_midi_programs.setEnabled(True) for i in range(midiProgramCount): - mpData = Carla.host.get_midi_program_data(self.fPluginId, i) + mpData = gCarla.host.get_midi_program_data(self.fPluginId, i) mpBank = int(mpData['bank']) mpProg = int(mpData['program']) mpName = charPtrToString(mpData['name']) @@ -848,7 +848,7 @@ class PluginEdit(QDialog): self.ui.cb_midi_programs.addItem("%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName)) - self.fCurrentMidiProgram = Carla.host.get_current_midi_program_index(self.fPluginId) + self.fCurrentMidiProgram = gCarla.host.get_current_midi_program_index(self.fPluginId) self.ui.cb_midi_programs.setCurrentIndex(self.fCurrentMidiProgram) else: @@ -1026,7 +1026,7 @@ class PluginEdit(QDialog): # Update parameter outputs for paramType, paramId, paramWidget in self.fParameterList: if paramType == PARAMETER_OUTPUT: - value = Carla.host.get_current_parameter_value(self.fPluginId, paramId) + value = gCarla.host.get_current_parameter_value(self.fPluginId, paramId) paramWidget.setValue(value, False) #------------------------------------------------------------------ @@ -1041,7 +1041,7 @@ class PluginEdit(QDialog): askTry = QMessageBox.question(self, self.tr("Overwrite?"), self.tr("Overwrite previously created file?"), QMessageBox.Ok|QMessageBox.Cancel) if askTry == QMessageBox.Ok: - Carla.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename) + gCarla.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename) return self.fCurrentStateFilename = None @@ -1054,22 +1054,22 @@ class PluginEdit(QDialog): filenameTry += ".carxs" self.fCurrentStateFilename = filenameTry - Carla.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename) + gCarla.host.save_plugin_state(self.fPluginId, self.fCurrentStateFilename) @pyqtSlot() def slot_stateLoad(self): if self.fPluginInfo['type'] == PLUGIN_LV2: presetList = [] - for i in range(Carla.host.get_program_count(self.fPluginId)): - presetList.append("%03i - %s" % (i+1, charPtrToString(Carla.host.get_program_name(self.fPluginId, i)))) + for i in range(gCarla.host.get_program_count(self.fPluginId)): + presetList.append("%03i - %s" % (i+1, charPtrToString(gCarla.host.get_program_name(self.fPluginId, i)))) ret = QInputDialog.getItem(self, self.tr("Open LV2 Preset"), self.tr("Select an LV2 Preset:"), presetList, 0, False) if ret[1]: index = int(ret[0].split(" - ", 1)[0])-1 - Carla.host.set_midi_program(self.fPluginId, -1) - Carla.host.set_program(self.fPluginId, index) + gCarla.host.set_midi_program(self.fPluginId, -1) + gCarla.host.set_program(self.fPluginId, index) self.setMidiProgram(-1) return @@ -1079,13 +1079,13 @@ class PluginEdit(QDialog): if filenameTry: self.fCurrentStateFilename = filenameTry - Carla.host.load_plugin_state(self.fPluginId, self.fCurrentStateFilename) + gCarla.host.load_plugin_state(self.fPluginId, self.fCurrentStateFilename) #------------------------------------------------------------------ @pyqtSlot(bool) def slot_optionChanged(self, clicked): - if Carla.host is None: + if gCarla.host is None: return sender = self.sender() @@ -1111,41 +1111,41 @@ class PluginEdit(QDialog): else: return - Carla.host.set_option(self.fPluginId, option, clicked) + gCarla.host.set_option(self.fPluginId, option, clicked) #------------------------------------------------------------------ @pyqtSlot(int) def slot_dryWetChanged(self, value): - if Carla.host is not None: - Carla.host.set_drywet(self.fPluginId, float(value)/1000) + if gCarla.host is not None: + gCarla.host.set_drywet(self.fPluginId, float(value)/1000) @pyqtSlot(int) def slot_volumeChanged(self, value): - if Carla.host is not None: - Carla.host.set_volume(self.fPluginId, float(value)/1000) + if gCarla.host is not None: + gCarla.host.set_volume(self.fPluginId, float(value)/1000) @pyqtSlot(int) def slot_balanceLeftChanged(self, value): - if Carla.host is not None: - Carla.host.set_balance_left(self.fPluginId, float(value)/1000) + if gCarla.host is not None: + gCarla.host.set_balance_left(self.fPluginId, float(value)/1000) @pyqtSlot(int) def slot_balanceRightChanged(self, value): - if Carla.host is not None: - Carla.host.set_balance_right(self.fPluginId, float(value)/1000) + if gCarla.host is not None: + gCarla.host.set_balance_right(self.fPluginId, float(value)/1000) @pyqtSlot(int) def slot_panningChanged(self, value): - if Carla.host is not None: - Carla.host.set_panning(self.fPluginId, float(value)/1000) + if gCarla.host is not None: + gCarla.host.set_panning(self.fPluginId, float(value)/1000) @pyqtSlot(int) def slot_ctrlChannelChanged(self, value): self.fControlChannel = value-1 - if Carla.host is not None: - Carla.host.set_ctrl_channel(self.fPluginId, self.fControlChannel) + if gCarla.host is not None: + gCarla.host.set_ctrl_channel(self.fPluginId, self.fControlChannel) self.ui.keyboard.allNotesOff() self._updateCtrlMidiProgram() @@ -1154,20 +1154,20 @@ class PluginEdit(QDialog): @pyqtSlot(int, float) def slot_parameterValueChanged(self, parameterId, value): - if Carla.host is not None: - Carla.host.set_parameter_value(self.fPluginId, parameterId, value) + if gCarla.host is not None: + gCarla.host.set_parameter_value(self.fPluginId, parameterId, value) if self.fRealParent is not None: self.fRealParent.parameterValueChanged(parameterId, value) @pyqtSlot(int, int) def slot_parameterMidiControlChanged(self, parameterId, control): - if Carla.host is not None: - Carla.host.set_parameter_midi_cc(self.fPluginId, parameterId, control) + if gCarla.host is not None: + gCarla.host.set_parameter_midi_cc(self.fPluginId, parameterId, control) @pyqtSlot(int, int) def slot_parameterMidiChannelChanged(self, parameterId, channel): - if Carla.host is not None: - Carla.host.set_parameter_midi_channel(self.fPluginId, parameterId, channel-1) + if gCarla.host is not None: + gCarla.host.set_parameter_midi_channel(self.fPluginId, parameterId, channel-1) #------------------------------------------------------------------ @@ -1175,8 +1175,8 @@ class PluginEdit(QDialog): def slot_programIndexChanged(self, index): self.fCurrentProgram = index - if Carla.host is not None: - Carla.host.set_program(self.fPluginId, index) + if gCarla.host is not None: + gCarla.host.set_program(self.fPluginId, index) if self.fRealParent is not None: self.fRealParent.programChanged(index) @@ -1184,8 +1184,8 @@ class PluginEdit(QDialog): def slot_midiProgramIndexChanged(self, index): self.fCurrentMidiProgram = index - if Carla.host is not None: - Carla.host.set_midi_program(self.fPluginId, index) + if gCarla.host is not None: + gCarla.host.set_midi_program(self.fPluginId, index) if self.fRealParent is not None: self.fRealParent.midiProgramChanged(index) @@ -1193,15 +1193,15 @@ class PluginEdit(QDialog): @pyqtSlot(int) def slot_noteOn(self, note): - if self.fControlChannel >= 0 and Carla.host is not None: - Carla.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 100) + if self.fControlChannel >= 0 and gCarla.host is not None: + gCarla.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 100) if self.fRealParent is not None: self.fRealParent.notePressed(note) @pyqtSlot(int) def slot_noteOff(self, note): - if self.fControlChannel >= 0 and Carla.host is not None: - Carla.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 0) + if self.fControlChannel >= 0 and gCarla.host is not None: + gCarla.host.send_midi_note(self.fPluginId, self.fControlChannel, note, 0) if self.fRealParent is not None: self.fRealParent.noteReleased(note) @@ -1370,7 +1370,7 @@ class PluginEdit(QDialog): self.ui.cb_midi_programs.setEnabled(True) - mpIndex = Carla.host.get_current_midi_program_index(self.fPluginId) + mpIndex = gCarla.host.get_current_midi_program_index(self.fPluginId) if self.ui.cb_midi_programs.currentIndex() != mpIndex: self.setMidiProgram(mpIndex)