Skip to content

Commit

Permalink
LV2: Streamline discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
terminator356 committed Sep 25, 2023
1 parent 152d863 commit cb0bce7
Show file tree
Hide file tree
Showing 8 changed files with 414 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,11 @@ endif (ENABLE_VST_VESTIGE)
## LV2 support
##

# Whether to use a cache for LV2 plugins.
# This shouldn't be required and should be pointless.
# It is kept as a sort of placeholder for the code in case we ever need it.
#SET (LV2_USE_PLUGIN_CACHE true)

if (ENABLE_LV2)

set (muse_serd_ver "0.30.0")
Expand Down
3 changes: 3 additions & 0 deletions src/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
25.09.2023
- LV2: Streamline discovery. Eliminate duplicate load_world and load_all_plugins. (Tim)
This might make only slightly faster startup time. But code is more proper now.
24.09.2023
*** MusE 4.2.1 ***
23.09.2023
Expand Down
1 change: 1 addition & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#cmakedefine DSSI_SUPPORT
#cmakedefine LV2_SUPPORT
#cmakedefine LV2_MAKE_PATH_SUPPORT
#cmakedefine LV2_USE_PLUGIN_CACHE
#cmakedefine PYTHON_SUPPORT
#cmakedefine MIDNAM_SUPPORT
#cmakedefine HAVE_INSTPATCH
Expand Down
16 changes: 10 additions & 6 deletions src/libs/plugin/plugin_cache_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#endif // HAVE_LRDF


#ifdef LV2_USE_PLUGIN_CACHE
#ifdef LV2_SUPPORT

#include <set>
Expand Down Expand Up @@ -107,6 +108,7 @@
//#include <sord/sord.h>

#endif // LV2_SUPPORT
#endif // LV2_USE_PLUGIN_CACHE

// Forwards from header:
#include "xml.h"
Expand Down Expand Up @@ -1846,6 +1848,7 @@ void scanLinuxVSTPlugins(PluginScanList* /*list*/, bool /*scanPorts*/, bool /*de
}
#endif // VST_NATIVE_SUPPORT

#ifdef LV2_USE_PLUGIN_CACHE
#ifdef LV2_SUPPORT

#define NS_EXT "http://lv2plug.in/ns/ext/"
Expand Down Expand Up @@ -2525,13 +2528,11 @@ static void scanLv2Plugin(const LilvPlugin *plugin,
lilv_node_free(nameNode);
}

#endif // LV2_SUPPORT

//---------------------------------------------------------
// scanLv2Plugins
//---------------------------------------------------------

#ifdef LV2_SUPPORT
void scanLv2Plugins(PluginScanList* list, bool scanPorts, bool debugStdErr)
{
std::set<std::string> supportedFeatures;
Expand Down Expand Up @@ -2640,6 +2641,7 @@ void scanLv2Plugins(PluginScanList* /*list*/, bool /*scanPorts*/, bool /*debugSt
{
}
#endif // LV2_SUPPORT
#endif // LV2_USE_PLUGIN_CACHE

//---------------------------------------------------------
// scanAllPlugins
Expand Down Expand Up @@ -3208,10 +3210,12 @@ bool checkPluginCacheFiles(
std::fprintf(stderr, "Error: Deleting obsolete LV2 plugin cache file failed!\n");
}

// SPECIAL for LV2: No need for a cache file.
// Bring LV2 plugins directly into the list, after all the cache scanning and creation.
if(types & PluginScanInfoStruct::PluginTypeLV2)
scanLv2Plugins(list, writePorts, debugStdErr);
// SPECIAL for LV2: No need for a cache file.
// Bring LV2 plugins directly into the list, after all the cache scanning and creation.
// #ifndef LV2_USE_PLUGIN_CACHE
// if(types & PluginScanInfoStruct::PluginTypeLV2)
// scanLv2Plugins(list, writePorts, debugStdErr);
// #endif

return res;
}
Expand Down
7 changes: 6 additions & 1 deletion src/libs/plugin/plugin_cache_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@
#include <dssi.h>
#endif // DSSI_SUPPORT

#ifdef LV2_USE_PLUGIN_CACHE
#ifdef LV2_SUPPORT
#include "lilv/lilv.h"
#endif // LV2_SUPPORT

#endif // LV2_USE_PLUGIN_CACHE

#ifdef VST_NATIVE_SUPPORT
#ifdef VST_SDK_QUIRK_DEF
Expand Down Expand Up @@ -134,9 +135,11 @@ bool scanLinuxVstDescriptor(const char* filename, AEffect *plugin, long int id,
bool writeLinuxVstInfo(const char* filename, LinuxVST_Instance_Function lvst, bool do_ports, int level, MusECore::Xml& xml);
#endif

#ifdef LV2_USE_PLUGIN_CACHE
#ifdef LV2_SUPPORT
void scanLv2Ports(const LilvPlugin *plugin, PluginScanInfoStruct* info, bool debugStdErr);
#endif
#endif //LV2_USE_PLUGIN_CACHE

bool writeUnknownPluginInfo(const char* filename, int level, MusECore::Xml& xml);

Expand All @@ -147,7 +150,9 @@ void scanLadspaPlugins(const QString& museGlobalLib, PluginScanList* list, bool
void scanMessPlugins(const QString& museGlobalLib, PluginScanList* list, bool scanPorts, bool debugStdErr);
void scanDssiPlugins(PluginScanList* list, bool scanPorts, bool debugStdErr);
void scanLinuxVSTPlugins(PluginScanList* list, bool scanPorts, bool debugStdErr);
#ifdef LV2_USE_PLUGIN_CACHE
void scanLv2Plugins(PluginScanList* list, bool scanPorts, bool debugStdErr);
#endif

void scanAllPlugins(const QString& museGlobalLib,
PluginScanList* list,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/plugin/plugin_scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class PluginScanInfoStruct
{ };

//~PluginScanInfoStruct();

#ifdef PLUGIN_INFO_USE_QT

#if defined(_WIN64) || defined(_WIN32)
Expand Down
4 changes: 4 additions & 0 deletions src/muse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ target_link_libraries(core
dl
)

if(NOT LV2_USE_PLUGIN_CACHE)
target_link_libraries(core plugin_cache_reader_module)
endif(NOT LV2_USE_PLUGIN_CACHE)

if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
message("Warning: HAVE_CXX_ATOMICS_WITHOUT_LIB or HAVE_CXX_ATOMICS64_WITHOUT_LIB are false. Linking core with required libatomic.")
target_link_libraries(core atomic)
Expand Down
Loading

0 comments on commit cb0bce7

Please sign in to comment.