Continue work on jucewrapper
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
6251756f4b
commit
649c88629e
3 changed files with 226 additions and 26 deletions
|
@ -3,6 +3,82 @@ project(Cardinal VERSION 0.0.0)
|
|||
|
||||
add_subdirectory(JUCE)
|
||||
|
||||
# Config
|
||||
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Define static libs
|
||||
|
||||
add_library(dgl STATIC IMPORTED)
|
||||
set_property(TARGET dgl PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../dpf/build/libdgl-opengl.a")
|
||||
|
||||
add_library(carla_host_plugin STATIC IMPORTED)
|
||||
set_property(TARGET carla_host_plugin PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/plugin/Release/carla-host-plugin.cpp.o")
|
||||
|
||||
add_library(carla_engine_plugin STATIC IMPORTED)
|
||||
set_property(TARGET carla_engine_plugin PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/carla_engine_plugin.a")
|
||||
|
||||
add_library(carla_plugin STATIC IMPORTED)
|
||||
set_property(TARGET carla_plugin PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/carla_plugin.a")
|
||||
|
||||
add_library(native_plugins STATIC IMPORTED)
|
||||
set_property(TARGET native_plugins PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/native-plugins.a")
|
||||
|
||||
add_library(audio_decoder STATIC IMPORTED)
|
||||
set_property(TARGET audio_decoder PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/audio_decoder.a")
|
||||
|
||||
add_library(jackbridge STATIC IMPORTED)
|
||||
set_property(TARGET jackbridge PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/jackbridge.min.a")
|
||||
|
||||
add_library(lilv STATIC IMPORTED)
|
||||
set_property(TARGET lilv PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/lilv.a")
|
||||
|
||||
add_library(rtmempool STATIC IMPORTED)
|
||||
set_property(TARGET rtmempool PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/rtmempool.a")
|
||||
|
||||
add_library(sfzero STATIC IMPORTED)
|
||||
set_property(TARGET sfzero PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/sfzero.a")
|
||||
|
||||
add_library(water STATIC IMPORTED)
|
||||
set_property(TARGET water PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/water.a")
|
||||
|
||||
add_library(zita_resampler STATIC IMPORTED)
|
||||
set_property(TARGET zita_resampler PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../carla/build/modules/Release/zita-resampler.a")
|
||||
|
||||
add_library(sCardinalFX STATIC IMPORTED)
|
||||
set_property(TARGET sCardinalFX PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../bin/CardinalFX.a")
|
||||
|
||||
add_library(sPlugins STATIC IMPORTED)
|
||||
set_property(TARGET sPlugins PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../plugins/plugins.a")
|
||||
|
||||
add_library(sRack STATIC IMPORTED)
|
||||
set_property(TARGET sRack PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/rack.a")
|
||||
|
||||
#ifeq ($(WINDOWS),true)
|
||||
#RACK_EXTRA_LIBS += $(DEP_LIB_PATH)/libarchive_static.a
|
||||
add_library(libarchive STATIC IMPORTED)
|
||||
set_property(TARGET libarchive PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libarchive.a")
|
||||
|
||||
add_library(libjansson STATIC IMPORTED)
|
||||
set_property(TARGET libjansson PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libjansson.a")
|
||||
|
||||
add_library(libquickjs STATIC IMPORTED)
|
||||
set_property(TARGET libquickjs PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libquickjs.a")
|
||||
|
||||
add_library(libsamplerate STATIC IMPORTED)
|
||||
set_property(TARGET libsamplerate PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libsamplerate.a")
|
||||
|
||||
add_library(libspeexdsp STATIC IMPORTED)
|
||||
set_property(TARGET libspeexdsp PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libspeexdsp.a")
|
||||
|
||||
add_library(libzstd STATIC IMPORTED)
|
||||
set_property(TARGET libzstd PROPERTY IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../src/Rack/dep/lib/libzstd.a")
|
||||
|
||||
#find_package(Dbus)
|
||||
find_package(OpenGL)
|
||||
find_package(X11)
|
||||
|
||||
# FX variant
|
||||
|
||||
juce_add_plugin(CardinalFX
|
||||
|
@ -13,7 +89,7 @@ juce_add_plugin(CardinalFX
|
|||
EDITOR_WANTS_KEYBOARD_FOCUS TRUE
|
||||
PLUGIN_MANUFACTURER_CODE Dstr
|
||||
PLUGIN_CODE dCnF
|
||||
FORMATS VST3 AU
|
||||
FORMATS Standalone AU
|
||||
PRODUCT_NAME "CardinalFX")
|
||||
|
||||
target_sources(CardinalFX
|
||||
|
@ -27,19 +103,52 @@ target_include_directories(CardinalFX
|
|||
|
||||
target_compile_definitions(CardinalFX
|
||||
PUBLIC
|
||||
JUCE_DISPLAY_SPLASH_SCREEN=0
|
||||
JUCE_USE_CURL=0
|
||||
JUCE_WEB_BROWSER=0)
|
||||
|
||||
target_link_options(CardinalFX
|
||||
PRIVATE
|
||||
"-l/Shared/Personal/FOSS/GIT/DISTRHO/DISTRHO_Cardinal/bin/CardinalFX.so"
|
||||
"-Wl,-rpath,."
|
||||
)
|
||||
target_link_directories(CardinalFX
|
||||
PUBLIC
|
||||
/opt/kxstudio/lib)
|
||||
|
||||
target_link_libraries(CardinalFX
|
||||
PRIVATE
|
||||
juce::juce_audio_utils
|
||||
-Wl,--whole-archive
|
||||
sCardinalFX
|
||||
sPlugins
|
||||
sRack
|
||||
carla_host_plugin
|
||||
carla_engine_plugin
|
||||
carla_plugin
|
||||
native_plugins
|
||||
audio_decoder
|
||||
jackbridge
|
||||
lilv
|
||||
rtmempool
|
||||
sfzero
|
||||
water
|
||||
zita_resampler
|
||||
dgl
|
||||
libarchive
|
||||
libjansson
|
||||
libquickjs
|
||||
libsamplerate
|
||||
libspeexdsp
|
||||
libzstd
|
||||
-Wl,--no-whole-archive
|
||||
GLX
|
||||
OpenGL
|
||||
X11
|
||||
Xcursor
|
||||
Xext
|
||||
Xrandr
|
||||
PUBLIC
|
||||
-ldbus-1
|
||||
-llo
|
||||
-lmagic
|
||||
-lsndfile -lFLAC -lvorbisenc -lvorbis -logg
|
||||
-lrt
|
||||
juce::juce_recommended_config_flags
|
||||
juce::juce_recommended_lto_flags
|
||||
juce::juce_recommended_warning_flags)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* DISTRHO Cardinal Plugin
|
||||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
|
||||
* Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
|
@ -17,15 +17,14 @@
|
|||
|
||||
#include <juce_audio_processors/juce_audio_processors.h>
|
||||
|
||||
#include "DistrhoPlugin.hpp"
|
||||
#include "DistrhoUI.hpp"
|
||||
|
||||
DISTRHO_PLUGIN_EXPORT DISTRHO_NAMESPACE::Plugin* createSharedPlugin();
|
||||
#define createPlugin ::createSharedPlugin
|
||||
#define createPlugin createStaticPlugin
|
||||
#include "src/DistrhoPluginInternal.hpp"
|
||||
#include "src/DistrhoUIInternal.hpp"
|
||||
|
||||
START_NAMESPACE_DISTRHO
|
||||
|
||||
#if 0
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
class ParameterForDPF : public juce::AudioProcessorParameter
|
||||
|
@ -69,29 +68,43 @@ protected:
|
|||
return 0.0f;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
class CardinalWrapperProcessor : public juce::AudioProcessor
|
||||
{
|
||||
friend class CardinalWrapperEditor;
|
||||
|
||||
PluginExporter plugin;
|
||||
|
||||
static bool writeMidiCb(void* ptr, const MidiEvent& midiEvent)
|
||||
static bool writeMidi(void* ptr, const MidiEvent& midiEvent)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool requestParameterValueChangeCb(void* ptr, uint32_t index, float value)
|
||||
static bool requestParameterValueChange(void* ptr, uint32_t index, float value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool updateStateValue(void* ptr, const char* key, const char* value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public:
|
||||
CardinalWrapperProcessor()
|
||||
: plugin(this, writeMidiCb, requestParameterValueChangeCb)
|
||||
: plugin(this, writeMidi, requestParameterValueChange, updateStateValue)
|
||||
{
|
||||
for (uint i=0; i<plugin.getParameterCount(); ++i)
|
||||
addParameter(new ParameterForDPF(plugin, i));
|
||||
if (const double sampleRate = getSampleRate())
|
||||
plugin.setSampleRate(sampleRate);
|
||||
|
||||
if (const int blockSize = getBlockSize())
|
||||
plugin.setBufferSize(blockSize);
|
||||
|
||||
// for (uint i=0; i<plugin.getParameterCount(); ++i)
|
||||
// addParameter(new ParameterForDPF(plugin, i));
|
||||
}
|
||||
|
||||
~CardinalWrapperProcessor() override
|
||||
|
@ -125,11 +138,25 @@ public:
|
|||
{
|
||||
midiMessages.clear();
|
||||
// AudioPlayHead* getPlayHead()
|
||||
|
||||
const int numSamples = buffer.getNumSamples();
|
||||
DISTRHO_SAFE_ASSERT_INT_RETURN(numSamples > 0, numSamples,);
|
||||
|
||||
DISTRHO_SAFE_ASSERT_RETURN(buffer.getNumChannels() == 2,);
|
||||
|
||||
const float* audioBufferIn[2];
|
||||
float* audioBufferOut[2];
|
||||
audioBufferIn[0] = buffer.getReadPointer(0);
|
||||
audioBufferIn[1] = buffer.getReadPointer(1);
|
||||
audioBufferOut[0] = buffer.getWritePointer(0);
|
||||
audioBufferOut[1] = buffer.getWritePointer(1);
|
||||
|
||||
plugin.run(audioBufferIn, audioBufferOut, numSamples, nullptr, 0);
|
||||
}
|
||||
|
||||
double getTailLengthSeconds() const override
|
||||
{
|
||||
return true;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
bool acceptsMidi() const override
|
||||
|
@ -181,17 +208,80 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
class CardinalWrapperEditor : public juce::AudioProcessorEditor
|
||||
{
|
||||
UIExporter* ui;
|
||||
void* const dspPtr;
|
||||
|
||||
static void editParamFunc(void* ptr, uint32_t rindex, bool started) {}
|
||||
static void setParamFunc(void* ptr, uint32_t rindex, float value) {}
|
||||
static void setStateFunc(void* ptr, const char* key, const char* value) {}
|
||||
static void sendNoteFunc(void* ptr, uint8_t channel, uint8_t note, uint8_t velo) {}
|
||||
|
||||
static void setSizeFunc(void* ptr, uint width, uint height)
|
||||
{
|
||||
static_cast<CardinalWrapperEditor*>(ptr)->setSize(width, height);
|
||||
}
|
||||
|
||||
static bool fileRequestFunc(void* ptr, const char* key) { return false; }
|
||||
|
||||
public:
|
||||
CardinalWrapperEditor(CardinalWrapperProcessor& processor)
|
||||
: juce::AudioProcessorEditor(processor)
|
||||
{}
|
||||
CardinalWrapperEditor(CardinalWrapperProcessor& cardinalProcessor)
|
||||
: juce::AudioProcessorEditor(cardinalProcessor),
|
||||
ui(nullptr),
|
||||
dspPtr(cardinalProcessor.plugin.getInstancePointer())
|
||||
{
|
||||
setOpaque(true);
|
||||
setResizable(true, false);
|
||||
// setResizeLimits(648, 538, -1, -1);
|
||||
setSize(1228, 666);
|
||||
}
|
||||
|
||||
~CardinalWrapperEditor() override
|
||||
{}
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void paint(juce::Graphics&)
|
||||
{
|
||||
if (ui == nullptr)
|
||||
{
|
||||
auto peer = getPeer();
|
||||
d_stdout("peer is %p", peer);
|
||||
|
||||
auto handle = peer->getNativeHandle();
|
||||
d_stdout("handle is %p", handle);
|
||||
|
||||
auto proc = getAudioProcessor();
|
||||
d_stdout("proc is %p", proc);
|
||||
|
||||
ui = new UIExporter(this,
|
||||
(uintptr_t)handle,
|
||||
proc->getSampleRate(),
|
||||
editParamFunc,
|
||||
setParamFunc,
|
||||
setStateFunc,
|
||||
sendNoteFunc,
|
||||
setSizeFunc,
|
||||
fileRequestFunc,
|
||||
nullptr, // bundlePath
|
||||
dspPtr,
|
||||
0.0 // scaleFactor
|
||||
);
|
||||
}
|
||||
|
||||
ui->plugin_idle();
|
||||
repaint();
|
||||
}
|
||||
};
|
||||
|
||||
juce::AudioProcessorEditor* CardinalWrapperProcessor::createEditor()
|
||||
{
|
||||
return new CardinalWrapperEditor(*this);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
END_NAMESPACE_DISTRHO
|
||||
|
@ -200,11 +290,10 @@ END_NAMESPACE_DISTRHO
|
|||
|
||||
juce::AudioProcessor* createPluginFilter()
|
||||
{
|
||||
// set valid but dummy values
|
||||
d_nextBufferSize = 512;
|
||||
d_nextSampleRate = 48000.0;
|
||||
return new DISTRHO_NAMESPACE::CardinalWrapperProcessor;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
|
||||
#define DISTRHO_IS_STANDALONE 0
|
||||
#include "src/DistrhoPlugin.cpp"
|
||||
#include "src/DistrhoUtils.cpp"
|
||||
|
|
|
@ -257,6 +257,8 @@ BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_PREFIX='"$(PREFIX)"'
|
|||
|
||||
ifeq ($(CARDINAL_VARIANT),main)
|
||||
all: jack lv2 vst3
|
||||
else ifeq ($(CARDINAL_VARIANT),fx)
|
||||
all: lv2 vst2 vst3 static
|
||||
else
|
||||
all: lv2 vst2 vst3
|
||||
endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue