mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
LV2: Add turtle-writer program
This commit is contained in:
parent
6fffbdae92
commit
1d04669410
4 changed files with 97 additions and 0 deletions
|
|
@ -148,3 +148,5 @@ install(FILES "${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake"
|
|||
"${JUCE_CMAKE_UTILS_DIR}/copyDir.cmake"
|
||||
"${JUCE_CMAKE_UTILS_DIR}/juce_runtime_arch_detection.cpp"
|
||||
DESTINATION "${JUCE_INSTALL_DESTINATION}")
|
||||
|
||||
install(EXPORT LV2_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}")
|
||||
|
|
|
|||
|
|
@ -37,3 +37,5 @@ juce_add_modules(
|
|||
juce_osc
|
||||
juce_product_unlocking
|
||||
juce_video)
|
||||
|
||||
add_subdirectory(juce_audio_plugin_client)
|
||||
|
|
|
|||
22
modules/juce_audio_plugin_client/CMakeLists.txt
Normal file
22
modules/juce_audio_plugin_client/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# ==============================================================================
|
||||
#
|
||||
# This file is part of the JUCE 7 technical preview.
|
||||
# Copyright (c) 2022 - Raw Material Software Limited
|
||||
#
|
||||
# You may use this code under the terms of the GPL v3
|
||||
# (see www.gnu.org/licenses).
|
||||
#
|
||||
# For the technical preview this file cannot be licensed commercially.
|
||||
#
|
||||
# JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
|
||||
# EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
|
||||
# DISCLAIMED.
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
add_executable(juce_lv2_helper LV2/juce_LV2TurtleDumpProgram.cpp)
|
||||
add_executable(juce::juce_lv2_helper ALIAS juce_lv2_helper)
|
||||
target_compile_features(juce_lv2_helper PRIVATE cxx_std_14)
|
||||
set_target_properties(juce_lv2_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON)
|
||||
target_link_libraries(juce_lv2_helper PRIVATE ${CMAKE_DL_LIBS})
|
||||
install(TARGETS juce_lv2_helper EXPORT LV2_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}")
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE 7 technical preview.
|
||||
Copyright (c) 2022 - Raw Material Software Limited
|
||||
|
||||
You may use this code under the terms of the GPL v3
|
||||
(see www.gnu.org/licenses).
|
||||
|
||||
For the technical preview this file cannot be licensed commercially.
|
||||
|
||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
|
||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
|
||||
DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
HMODULE dlopen (const char* filename, int) { return LoadLibrary (filename); }
|
||||
FARPROC dlsym (HMODULE handle, const char* name) { return GetProcAddress (handle, name); }
|
||||
enum { RTLD_LAZY = 0 };
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
// Replicating some of the LV2 header here so that we don't have to set up any
|
||||
// custom include paths for this file.
|
||||
// Normally this would be a bad idea, but the LV2 API has to keep these definitions
|
||||
// in order to remain backwards-compatible.
|
||||
|
||||
extern "C"
|
||||
{
|
||||
typedef struct LV2_Descriptor
|
||||
{
|
||||
const void* a;
|
||||
const void* b;
|
||||
const void* c;
|
||||
const void* d;
|
||||
const void* e;
|
||||
const void* f;
|
||||
const void* g;
|
||||
const void* (*extension_data)(const char* uri);
|
||||
} LV2_Descriptor;
|
||||
}
|
||||
|
||||
int main (int argc, const char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
return 1;
|
||||
|
||||
const auto* libraryPath = argv[1];
|
||||
|
||||
struct RecallFeature
|
||||
{
|
||||
int (*doRecall) (const char*);
|
||||
};
|
||||
|
||||
if (auto* handle = dlopen (libraryPath, RTLD_LAZY))
|
||||
if (auto* getDescriptor = reinterpret_cast<const LV2_Descriptor* (*) (uint32_t)> (dlsym (handle, "lv2_descriptor")))
|
||||
if (auto* descriptor = getDescriptor (0))
|
||||
if (auto* extensionData = descriptor->extension_data)
|
||||
if (auto* recallFeature = reinterpret_cast<const RecallFeature*> (extensionData ("https://lv2-extensions.juce.com/turtle_recall")))
|
||||
if (auto* doRecall = recallFeature->doRecall)
|
||||
return doRecall (libraryPath);
|
||||
|
||||
return 1;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue