From a362f7be13b3a64662051fa3f5fa9d55a0f6d56b Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 20 Sep 2023 19:35:49 -0400 Subject: [PATCH] Fix issue 1243 Slow startup. Fix missing simpledrums. --- src/ChangeLog | 7 +++++++ src/libs/plugin/plugin_cache_reader.cpp | 6 +++++- src/libs/plugin/plugin_cache_reader.h | 4 ++-- src/libs/plugin/plugin_cache_writer.cpp | 10 +++++++++- src/muse/components/CMakeLists.txt | 2 ++ .../automation_mode_toolbar.cpp | 0 .../{widgets => components}/automation_mode_toolbar.h | 0 src/muse/widgets/CMakeLists.txt | 5 +++-- 8 files changed, 28 insertions(+), 6 deletions(-) rename src/muse/{widgets => components}/automation_mode_toolbar.cpp (100%) rename src/muse/{widgets => components}/automation_mode_toolbar.h (100%) diff --git a/src/ChangeLog b/src/ChangeLog index e006db6fd..3b64d777b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +20.09.2023 + - Fixed issue 1243 Slow startup: Always rescanning when file contains no plugins. (Tim) + File ladspa_dsp.so was causing rescanning all the time because it is normally empty + until a configuration file is hand-entered by the user. + - Fixed missing simpledrums MESS synth: Moved files automation_mode_toolbar.h/.cpp + from widgets folder to components folder because it contains icons, and simpledrums + uses our widgets library and it is not supposed to contain icons. 10.09.2023 *** MusE 4.2 *** 03.09.2023 diff --git a/src/libs/plugin/plugin_cache_reader.cpp b/src/libs/plugin/plugin_cache_reader.cpp index 85b9d427c..432ec84f1 100644 --- a/src/libs/plugin/plugin_cache_reader.cpp +++ b/src/libs/plugin/plugin_cache_reader.cpp @@ -392,8 +392,9 @@ bool readPluginScanInfo(MusECore::Xml& xml, PluginScanInfoStruct* info, bool rea // return true on error //--------------------------------------------------------- -bool readPluginScan(MusECore::Xml& xml, PluginScanList* list, bool readPorts, bool readEnums) +bool readPluginScan(MusECore::Xml& xml, PluginScanList* list, bool readPorts, bool readEnums, int *numPlugins) { + int plugins = 0; for (;;) { MusECore::Xml::Token token(xml.parse()); const QString& tag(xml.s1()); @@ -412,6 +413,7 @@ bool readPluginScan(MusECore::Xml& xml, PluginScanList* list, bool readPorts, bo { // We must include all plugins. list->add(new PluginScanInfo(info)); + ++plugins; } break; } @@ -428,6 +430,8 @@ bool readPluginScan(MusECore::Xml& xml, PluginScanList* list, bool readPorts, bo case MusECore::Xml::TagEnd: if (tag == "muse") { + if(numPlugins) + *numPlugins = plugins; return false; } return true; diff --git a/src/libs/plugin/plugin_cache_reader.h b/src/libs/plugin/plugin_cache_reader.h index b82956696..a902a3d75 100644 --- a/src/libs/plugin/plugin_cache_reader.h +++ b/src/libs/plugin/plugin_cache_reader.h @@ -83,8 +83,8 @@ bool readPluginScanInfoPortEnum(MusECore::Xml& xml, PluginPortInfo* port_info); bool readPluginScanInfoPort(MusECore::Xml& xml, PluginScanInfoStruct* info); // Return true on error bool readPluginScanInfo(MusECore::Xml& xml, PluginScanInfoStruct* info, bool readPorts = false, bool readEnums = false); -// Return true on error -bool readPluginScan(MusECore::Xml& xml, PluginScanList* list, bool readPorts = false, bool readEnums = false); +// Return true on error. If successful, numPlugins, if valid, is set to the number of plugins found. +bool readPluginScan(MusECore::Xml& xml, PluginScanList* list, bool readPorts = false, bool readEnums = false, int *numPlugins = nullptr); // Read the plugin cache text file to a plugin list. bool readPluginCacheFile( diff --git a/src/libs/plugin/plugin_cache_writer.cpp b/src/libs/plugin/plugin_cache_writer.cpp index 011f26c66..d1085a89b 100644 --- a/src/libs/plugin/plugin_cache_writer.cpp +++ b/src/libs/plugin/plugin_cache_writer.cpp @@ -1696,12 +1696,20 @@ static bool pluginScan( // Read the list of plugins found in the xml. // For now we don't supply a separate scanEnums flag in pluginScan(), so just use scanPorts instead. - if(readPluginScan(xml, list, scanPorts, scanPorts)) + int numPlugins = 0; + if(readPluginScan(xml, list, scanPorts, scanPorts, &numPlugins)) { std::fprintf(stderr, "\npluginScan FAILED: On readPluginScan(): file: %s\n\n", filename_ba.constData()); fail = true; } + // No plugins found in this file? + if(numPlugins == 0) + { + std::fprintf(stderr, "\npluginScan: No plugins found in file:%s! Putting this file in 'unknown' cache.\n\n", filename_ba.constData()); + fail = true; + } + // Close the temp file. infile.close(); diff --git a/src/muse/components/CMakeLists.txt b/src/muse/components/CMakeLists.txt index f2934785a..9c09baa2f 100644 --- a/src/muse/components/CMakeLists.txt +++ b/src/muse/components/CMakeLists.txt @@ -51,6 +51,7 @@ QT5_WRAP_CPP (components_mocs arrangercolumns.h # action.h audio_converter_settings.h + automation_mode_toolbar.h background_painter.h bigtime.h canvas.h @@ -215,6 +216,7 @@ file (GLOB components_source_files appearance.cpp arrangercolumns.cpp audio_converter_settings.cpp + automation_mode_toolbar.cpp background_painter.cpp bigtime.cpp canvas.cpp diff --git a/src/muse/widgets/automation_mode_toolbar.cpp b/src/muse/components/automation_mode_toolbar.cpp similarity index 100% rename from src/muse/widgets/automation_mode_toolbar.cpp rename to src/muse/components/automation_mode_toolbar.cpp diff --git a/src/muse/widgets/automation_mode_toolbar.h b/src/muse/components/automation_mode_toolbar.h similarity index 100% rename from src/muse/widgets/automation_mode_toolbar.h rename to src/muse/components/automation_mode_toolbar.h diff --git a/src/muse/widgets/CMakeLists.txt b/src/muse/widgets/CMakeLists.txt index 95702e55f..e2a2de7ca 100644 --- a/src/muse/widgets/CMakeLists.txt +++ b/src/muse/widgets/CMakeLists.txt @@ -34,6 +34,9 @@ ## controls which are too dependent on other MusE modules or ## controls and dialogs which are really only useful to the ## main app or could never really be publicly exposed. +## NOTE: Do not put any widgets here that use our icons since +## this might be shared with plugins for example. Instead, +## put such widgets in the components folder. ## ## As more of the 'components' might be stripped down and moved ## into the 'widgets' folder, the original structure of the @@ -49,7 +52,6 @@ QT5_WRAP_CPP (widget_mocs # aboutbox_impl.h # arrangercolumns.h # action.h - automation_mode_toolbar.h # bigtime.h # canvas.h checkbox.h @@ -196,7 +198,6 @@ QT5_WRAP_CPP (widget_mocs file (GLOB widgets_source_files # aboutbox_impl.cpp # arrangercolumns.cpp - automation_mode_toolbar.cpp # background_painter.cpp # bigtime.cpp # canvas.cpp