Browse Source

Give notice when carla needs to be restarted after lv2 rescan

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.4.2
falkTX 2 years ago
parent
commit
15f7f584f6
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
10 changed files with 76 additions and 16 deletions
  1. +37
    -2
      resources/ui/carla_refresh.ui
  2. +1
    -0
      source/backend/CarlaBackend.h
  3. +2
    -0
      source/backend/CarlaUtils.h
  4. +10
    -4
      source/backend/engine/CarlaEngine.cpp
  5. +3
    -1
      source/backend/engine/CarlaEngineNative.cpp
  6. +3
    -1
      source/backend/engine/CarlaEngineOscHandlers.cpp
  7. +1
    -0
      source/frontend/carla_backend.py
  8. +1
    -1
      source/frontend/carla_backend_qt.py
  9. +10
    -4
      source/frontend/carla_database.py
  10. +8
    -3
      source/frontend/carla_host.py

+ 37
- 2
resources/ui/carla_refresh.ui View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>686</width>
<height>330</height>
<width>613</width>
<height>369</height>
</rect>
</property>
<property name="windowTitle">
@@ -482,6 +482,41 @@ You can disable these checks to get a faster scanning time (at your own risk).</
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="lv2_restart_notice" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../resources.qrc">:/16x16/dialog-information.svgz</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Restart Carla to list the new LV2 plugins</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>


+ 1
- 0
source/backend/CarlaBackend.h View File

@@ -854,6 +854,7 @@ typedef enum {
/*!
* A plugin has been added.
* @a pluginId Plugin Id
* @a value1 Plugin type
* @a valueStr Plugin name
*/
ENGINE_CALLBACK_PLUGIN_ADDED = 1,


+ 2
- 0
source/backend/CarlaUtils.h View File

@@ -147,6 +147,7 @@ typedef struct _CarlaCachedPluginInfo {
* Do not call this for any other plugin formats.
*
* @note if this carla build uses JUCE, then you must call carla_juce_init beforehand
* @note for AU plugins, you cannot call this outside the main thread
*/
CARLA_EXPORT uint carla_get_cached_plugin_count(PluginType ptype, const char* pluginPath);

@@ -154,6 +155,7 @@ CARLA_EXPORT uint carla_get_cached_plugin_count(PluginType ptype, const char* pl
* Get information about a cached plugin.
*
* @note if this carla build uses JUCE, then you must call carla_juce_init beforehand
* @note for AU plugins, you cannot call this outside the main thread
*/
CARLA_EXPORT const CarlaCachedPluginInfo* carla_get_cached_plugin_info(PluginType ptype, uint index);



+ 10
- 4
source/backend/engine/CarlaEngine.cpp View File

@@ -832,7 +832,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype,
plugin->setEnabled(true);

++pData->curPluginCount;
callback(true, true, ENGINE_CALLBACK_PLUGIN_ADDED, id, 0, 0, 0, 0.0f, plugin->getName());
callback(true, true, ENGINE_CALLBACK_PLUGIN_ADDED, id, plugin->getType(), 0, 0, 0.0f, plugin->getName());

if (getType() != kEngineTypeBridge)
plugin->setActive(true, true, true);
@@ -2888,7 +2888,9 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
plugin->setEnabled(true);

++pData->curPluginCount;
callback(true, true, ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, 0, 0, 0, 0.0f, plugin->getName());
callback(true, true, ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, plugin->getType(),
0, 0, 0.0f,
plugin->getName());

if (isPatchbay)
pData->graph.addPlugin(plugin);
@@ -2941,7 +2943,9 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
plugin->setEnabled(true);

++pData->curPluginCount;
callback(true, true, ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, 0, 0, 0, 0.0f, plugin->getName());
callback(true, true, ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, plugin->getType(),
0, 0, 0.0f,
plugin->getName());

if (isPatchbay)
pData->graph.addPlugin(plugin);
@@ -3089,7 +3093,9 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alw
plugin->setEnabled(true);

++pData->curPluginCount;
callback(true, true, ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, 0, 0, 0, 0.0f, plugin->getName());
callback(true, true, ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, plugin->getType(),
0, 0, 0.0f,
plugin->getName());

#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
if (isPatchbay)


+ 3
- 1
source/backend/engine/CarlaEngineNative.cpp View File

@@ -1311,7 +1311,9 @@ protected:
{
if (const CarlaPluginPtr plugin = pData->plugins[i].plugin)
if (plugin->isEnabled())
uiServerCallback(ENGINE_CALLBACK_PLUGIN_ADDED, i, 0, 0, 0, 0.0f, plugin->getName());
uiServerCallback(ENGINE_CALLBACK_PLUGIN_ADDED, i, plugin->getType(),
0, 0, 0.0f,
plugin->getName());
}

if (kIsPatchbay)


+ 3
- 1
source/backend/engine/CarlaEngineOscHandlers.cpp View File

@@ -271,7 +271,9 @@ int CarlaEngineOsc::handleMsgRegister(const bool isTCP,
const CarlaPluginPtr plugin = fEngine->getPluginUnchecked(i);
CARLA_SAFE_ASSERT_CONTINUE(plugin != nullptr);

fEngine->callback(false, true, ENGINE_CALLBACK_PLUGIN_ADDED, i, 0, 0, 0, 0.0f, plugin->getName());
fEngine->callback(false, true, ENGINE_CALLBACK_PLUGIN_ADDED, i, plugin->getType(),
0, 0, 0.0f,
plugin->getName());
}

fEngine->patchbayRefresh(false, true, fEngine->pData->graph.isUsingExternalOSC());


+ 1
- 0
source/frontend/carla_backend.py View File

@@ -607,6 +607,7 @@ ENGINE_CALLBACK_DEBUG = 0

# A plugin has been added.
# @a pluginId Plugin Id
# @a value1 Plugin type
# @a valueStr Plugin name
ENGINE_CALLBACK_PLUGIN_ADDED = 1



+ 1
- 1
source/frontend/carla_backend_qt.py View File

@@ -32,7 +32,7 @@ from carla_backend import CarlaHostNull, CarlaHostDLL, CarlaHostPlugin
class CarlaHostSignals(QObject):
# signals
DebugCallback = pyqtSignal(int, int, int, int, float, str)
PluginAddedCallback = pyqtSignal(int, str)
PluginAddedCallback = pyqtSignal(int, int, str)
PluginRemovedCallback = pyqtSignal(int)
PluginRenamedCallback = pyqtSignal(int, str)
PluginUnavailableCallback = pyqtSignal(int, str)


+ 10
- 4
source/frontend/carla_database.py View File

@@ -1001,7 +1001,7 @@ class SearchPluginsThread(QThread):
# Plugin Refresh Dialog

class PluginRefreshW(QDialog):
def __init__(self, parent, host, useSystemIcons):
def __init__(self, parent, host, useSystemIcons, hasLoadedLv2Plugins):
QDialog.__init__(self, parent)
self.host = host
self.ui = ui_carla_refresh.Ui_PluginRefreshW()
@@ -1017,7 +1017,7 @@ class PluginRefreshW(QDialog):
hasWin32 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-win32.exe"))
hasWin64 = os.path.exists(os.path.join(self.host.pathBinaries, "carla-discovery-win64.exe"))

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

# -------------------------------------------------------------------------------------------------------------
# Set-up Icons
@@ -1140,6 +1140,9 @@ class PluginRefreshW(QDialog):
self.ui.ch_vst.setEnabled(False)
self.ui.ch_vst3.setEnabled(False)

if not hasLoadedLv2Plugins:
self.ui.lv2_restart_notice.hide()

self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)

# -------------------------------------------------------------------------------------------------------------
@@ -1406,6 +1409,9 @@ class PluginDatabaseW(QDialog):
self.ui = ui_carla_database.Ui_PluginDatabaseW()
self.ui.setupUi(self)

# To be changed by parent
self.hasLoadedLv2Plugins = False

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

@@ -1683,7 +1689,7 @@ class PluginDatabaseW(QDialog):

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

if self.fRealParent:
@@ -2411,7 +2417,7 @@ if __name__ == '__main__':
_loadHostSettings(host)

gui = PluginDatabaseW(None, host, True)
#gui = PluginRefreshW(None, host, True)
#gui = PluginRefreshW(None, host, True, False)
gui.show()

app.exit_exec()


+ 8
- 3
source/frontend/carla_host.py View File

@@ -165,6 +165,7 @@ class HostWindow(QMainWindow):
self.fProjectFilename = ""
self.fIsProjectLoading = False
self.fCurrentlyRemovingAllPlugins = False
self.fHasLoadedLv2Plugins = False

self.fLastTransportBPM = 0.0
self.fLastTransportFrame = 0
@@ -1182,6 +1183,7 @@ class HostWindow(QMainWindow):
self.fPluginDatabaseDialog = PluginDatabaseW(self.fParentOrSelf, self.host,
self.fSavedSettings[CARLA_KEY_MAIN_SYSTEM_ICONS])
dialog = self.fPluginDatabaseDialog
dialog.hasLoadedLv2Plugins = self.fHasLoadedLv2Plugins

ret = dialog.exec_()

@@ -1431,8 +1433,8 @@ class HostWindow(QMainWindow):
# --------------------------------------------------------------------------------------------------------
# Plugins (host callbacks)

@pyqtSlot(int, str)
def slot_handlePluginAddedCallback(self, pluginId, pluginName):
@pyqtSlot(int, int, str)
def slot_handlePluginAddedCallback(self, pluginId, pluginType, pluginName):
if pluginId != self.fPluginCount:
print("ERROR: pluginAdded mismatch Id:", pluginId, self.fPluginCount)
pitem = self.getPluginItem(pluginId)
@@ -1445,6 +1447,9 @@ class HostWindow(QMainWindow):

self.ui.act_plugin_remove_all.setEnabled(self.fPluginCount > 0)

if pluginType == PLUGIN_LV2:
self.fHasLoadedLv2Plugins = True

@pyqtSlot(int)
def slot_handlePluginRemovedCallback(self, pluginId):
if self.fWithCanvas:
@@ -3041,7 +3046,7 @@ def engineCallback(host, action, pluginId, value1, value2, value3, valuef, value
if action == ENGINE_CALLBACK_DEBUG:
host.DebugCallback.emit(pluginId, value1, value2, value3, valuef, valueStr)
elif action == ENGINE_CALLBACK_PLUGIN_ADDED:
host.PluginAddedCallback.emit(pluginId, valueStr)
host.PluginAddedCallback.emit(pluginId, value1, valueStr)
elif action == ENGINE_CALLBACK_PLUGIN_REMOVED:
host.PluginRemovedCallback.emit(pluginId)
elif action == ENGINE_CALLBACK_PLUGIN_RENAMED:


Loading…
Cancel
Save