From 183b06cad05e907a4f449e29af5369ae0f496e8c Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 20 Dec 2016 17:52:16 +0000 Subject: [PATCH] carla-control: fix last used plugin data leftovers, all clear now --- source/carla_backend.py | 23 +++++++++++++---------- source/carla_control.py | 5 ++++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/source/carla_backend.py b/source/carla_backend.py index dfa72d30b..3107baf6a 100644 --- a/source/carla_backend.py +++ b/source/carla_backend.py @@ -20,7 +20,6 @@ # Imports (Global) from abc import ABCMeta, abstractmethod -from copy import deepcopy from ctypes import * from platform import architecture from sys import platform, maxsize @@ -2993,16 +2992,21 @@ class CarlaHostPlugin(CarlaHostMeta): def _add(self, pluginId): if len(self.fPluginsInfo) != pluginId: + self._reset_info(self.fPluginsInfo[pluginId]) return info = PluginStoreInfo() - info.pluginInfo = deepcopy(PyCarlaPluginInfo) + self._reset_info(info) + self.fPluginsInfo.append(info) + + def _reset_info(self, info): + info.pluginInfo = PyCarlaPluginInfo.copy() info.pluginRealName = "" info.internalValues = [0.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0] - info.audioCountInfo = deepcopy(PyCarlaPortCountInfo) - info.midiCountInfo = deepcopy(PyCarlaPortCountInfo) + info.audioCountInfo = PyCarlaPortCountInfo.copy() + info.midiCountInfo = PyCarlaPortCountInfo.copy() info.parameterCount = 0 - info.parameterCountInfo = deepcopy(PyCarlaPortCountInfo) + info.parameterCountInfo = PyCarlaPortCountInfo.copy() info.parameterInfo = [] info.parameterData = [] info.parameterRanges = [] @@ -3016,7 +3020,6 @@ class CarlaHostPlugin(CarlaHostMeta): info.customDataCount = 0 info.customData = [] info.peaks = [0.0, 0.0, 0.0, 0.0] - self.fPluginsInfo.append(info) def _set_pluginInfo(self, pluginId, info): self.fPluginsInfo[pluginId].pluginInfo = info @@ -3052,9 +3055,9 @@ class CarlaHostPlugin(CarlaHostMeta): # add placeholders for x in range(count): - self.fPluginsInfo[pluginId].parameterInfo.append(deepcopy(PyCarlaParameterInfo)) - self.fPluginsInfo[pluginId].parameterData.append(deepcopy(PyParameterData)) - self.fPluginsInfo[pluginId].parameterRanges.append(deepcopy(PyParameterRanges)) + self.fPluginsInfo[pluginId].parameterInfo.append(PyCarlaParameterInfo.copy()) + self.fPluginsInfo[pluginId].parameterData.append(PyParameterData.copy()) + self.fPluginsInfo[pluginId].parameterRanges.append(PyParameterRanges.copy()) self.fPluginsInfo[pluginId].parameterValues.append(0.0) def _set_programCount(self, pluginId, count): @@ -3075,7 +3078,7 @@ class CarlaHostPlugin(CarlaHostMeta): # add placeholders for x in range(count): - self.fPluginsInfo[pluginId].midiProgramData.append(deepcopy(PyMidiProgramData)) + self.fPluginsInfo[pluginId].midiProgramData.append(PyMidiProgramData.copy()) def _set_customDataCount(self, pluginId, count): self.fPluginsInfo[pluginId].customDataCount = count diff --git a/source/carla_control.py b/source/carla_control.py index 4ab867ba7..b6d5f4b1c 100755 --- a/source/carla_control.py +++ b/source/carla_control.py @@ -465,7 +465,10 @@ class HostWindowOSC(HostWindow): self.ui.act_file_refresh.setEnabled(False) if lo_target is not None: - lo_send(lo_target, "/unregister") + try: + lo_send(lo_target, "/unregister") + except: + pass self.killTimer(self.fIdleTimer) self.fIdleTimer = 0