From 9093c7d3ef4fa8329c6d8c502bcdaf686894f547 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 30 Mar 2013 05:54:01 +0000 Subject: [PATCH] Don't load new plugin if last one loaded matches file type --- source/carla.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/source/carla.py b/source/carla.py index f87f197df..83e5f5aa6 100755 --- a/source/carla.py +++ b/source/carla.py @@ -825,8 +825,17 @@ class CarlaMainW(QMainWindow): self.showLastError(False) elif extension in ("aac", "flac", "oga", "ogg", "mp3", "wav"): + # check if last plugin is audiofile + if self.fPluginCount > 0: + pluginId = self.fPluginCount-1 + pwidget = self.fPluginList[pluginId] + + if pwidget is not None and pwidget.fPluginInfo["label"] == "audiofile": + Carla.host.set_custom_data(pluginId, CUSTOM_DATA_STRING, "file00", filename) + return + self.fLastLoadedPluginId = -2 - if Carla.host.add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, None, basename, "audiofile", None): + if Carla.host.add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, None, None, "audiofile", None): while (self.fLastLoadedPluginId == -2): sleep(0.2) idx = self.fLastLoadedPluginId self.fLastLoadedPluginId = -1 @@ -836,8 +845,17 @@ class CarlaMainW(QMainWindow): self.showLastError(False) elif extension in ("mid", "midi"): + # check if last plugin is midifile + if self.fPluginCount > 0: + pluginId = self.fPluginCount-1 + pwidget = self.fPluginList[pluginId] + + if pwidget is not None and pwidget.fPluginInfo["label"] == "midifile": + Carla.host.set_custom_data(pluginId, CUSTOM_DATA_STRING, "file", filename) + return + self.fLastLoadedPluginId = -2 - if Carla.host.add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, None, basename, "midifile", None): + if Carla.host.add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, None, None, "midifile", None): while (self.fLastLoadedPluginId == -2): sleep(0.2) idx = self.fLastLoadedPluginId self.fLastLoadedPluginId = -1