Browse Source

Fix carla-native LV2 export build

tags/1.9.4
falkTX 11 years ago
parent
commit
71adc5fdb3
25 changed files with 196 additions and 317 deletions
  1. +35
    -35
      source/Makefile.mk
  2. +1
    -1
      source/modules/carla_native/3bandsplitter/DistrhoPlugin3BandSplitter.cpp
  3. +1
    -1
      source/modules/carla_native/3bandsplitter/DistrhoPlugin3BandSplitter.hpp
  4. +0
    -2
      source/modules/carla_native/3bandsplitter/DistrhoPluginInfo.h
  5. +3
    -1
      source/modules/carla_native/3bandsplitter/DistrhoUI3BandSplitter.cpp
  6. +8
    -2
      source/modules/carla_native/3bandsplitter/DistrhoUI3BandSplitter.hpp
  7. +4
    -4
      source/modules/carla_native/Makefile
  8. +6
    -6
      source/modules/carla_native/_all.c
  9. +35
    -179
      source/modules/carla_native/distrho/DistrhoPluginCarla.cpp
  10. +0
    -2
      source/modules/carla_native/pingpongpan/DistrhoPluginInfo.h
  11. +1
    -1
      source/modules/carla_native/pingpongpan/DistrhoPluginPingPongPan.cpp
  12. +1
    -1
      source/modules/carla_native/pingpongpan/DistrhoPluginPingPongPan.hpp
  13. +2
    -2
      source/modules/carla_native/pingpongpan/DistrhoUIPingPongPan.cpp
  14. +7
    -2
      source/modules/carla_native/pingpongpan/DistrhoUIPingPongPan.hpp
  15. +0
    -2
      source/modules/carla_native/stereoenhancer/DistrhoPluginInfo.h
  16. +1
    -1
      source/modules/carla_native/stereoenhancer/DistrhoPluginStereoEnhancer.cpp
  17. +2
    -2
      source/modules/carla_native/stereoenhancer/DistrhoUIStereoEnhancer.cpp
  18. +7
    -2
      source/modules/carla_native/stereoenhancer/DistrhoUIStereoEnhancer.hpp
  19. +1
    -3
      source/modules/distrho/DistrhoPluginMain.cpp
  20. +1
    -11
      source/modules/distrho/DistrhoUIMain.cpp
  21. +24
    -0
      source/modules/distrho/src/DistrhoPluginLADSPA+DSSI.cpp
  22. +0
    -1
      source/modules/distrho/src/DistrhoUIInternal.hpp
  23. +5
    -5
      source/plugin/carla-native-base.cpp
  24. +16
    -16
      source/plugin/carla-native-lv2-export.cpp
  25. +35
    -35
      source/plugin/carla-native-lv2.cpp

+ 35
- 35
source/Makefile.mk View File

@@ -84,23 +84,23 @@ ifneq ($(shell pkg-config --exists liblo && echo true),true)
$(error liblo missing, cannot continue) $(error liblo missing, cannot continue)
endif endif


# ifeq ($(LINUX),true)
# ifneq ($(shell pkg-config --exists x11 && echo true),true)
# $(error X11 missing, cannot continue)
# endif
# ifneq ($(shell pkg-config --exists xinerama && echo true),true)
# $(error Xinerama missing, cannot continue)
# endif
# ifneq ($(shell pkg-config --exists xext && echo true),true)
# $(error Xext missing, cannot continue)
# endif
# ifneq ($(shell pkg-config --exists xcursor && echo true),true)
# $(error Xcursor missing, cannot continue)
# endif
# ifneq ($(shell pkg-config --exists freetype2 && echo true),true)
# $(error FreeType2 missing, cannot continue)
# endif
# endif
ifeq ($(LINUX),true)
ifneq ($(shell pkg-config --exists x11 && echo true),true)
$(error X11 missing, cannot continue)
endif
ifneq ($(shell pkg-config --exists xinerama && echo true),true)
$(error Xinerama missing, cannot continue)
endif
ifneq ($(shell pkg-config --exists xext && echo true),true)
$(error Xext missing, cannot continue)
endif
ifneq ($(shell pkg-config --exists xcursor && echo true),true)
$(error Xcursor missing, cannot continue)
endif
ifneq ($(shell pkg-config --exists freetype2 && echo true),true)
$(error FreeType2 missing, cannot continue)
endif
endif


# -------------------------------------------------------------- # --------------------------------------------------------------
# Check for optional libs (required by backend or bridges) # Check for optional libs (required by backend or bridges)
@@ -150,13 +150,13 @@ DGL_FLAGS = $(shell pkg-config --cflags gl x11)
DGL_LIBS = $(shell pkg-config --libs gl x11) DGL_LIBS = $(shell pkg-config --libs gl x11)
endif endif
JACKBRIDGE_LIBS = -ldl -lpthread -lrt JACKBRIDGE_LIBS = -ldl -lpthread -lrt
# JUCE_CORE_LIBS = -ldl -lpthread -lrt
# JUCE_EVENTS_FLAGS = $(shell pkg-config --cflags x11)
# JUCE_EVENTS_LIBS = $(shell pkg-config --libs x11)
# JUCE_GRAPHICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext freetype2)
# JUCE_GRAPHICS_LIBS = $(shell pkg-config --libs x11 xinerama xext freetype2)
# JUCE_GUI_BASICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext xcursor)
# JUCE_GUI_BASICS_LIBS = $(shell pkg-config --libs x11 xinerama xext xcursor) -ldl
JUCE_CORE_LIBS = -ldl -lpthread -lrt
JUCE_EVENTS_FLAGS = $(shell pkg-config --cflags x11)
JUCE_EVENTS_LIBS = $(shell pkg-config --libs x11)
JUCE_GRAPHICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext freetype2)
JUCE_GRAPHICS_LIBS = $(shell pkg-config --libs x11 xinerama xext freetype2)
JUCE_GUI_BASICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext xcursor)
JUCE_GUI_BASICS_LIBS = $(shell pkg-config --libs x11 xinerama xext xcursor) -ldl
LILV_LIBS = -ldl -lm -lrt LILV_LIBS = -ldl -lm -lrt
ifeq ($(HAVE_ALSA),true) ifeq ($(HAVE_ALSA),true)
RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__ RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__
@@ -173,12 +173,12 @@ endif
ifeq ($(MACOS),true) ifeq ($(MACOS),true)
DGL_LIBS = -framework OpenGL -framework Cocoa DGL_LIBS = -framework OpenGL -framework Cocoa
JACKBRIDGE_LIBS = -ldl -lpthread JACKBRIDGE_LIBS = -ldl -lpthread
# JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
# JUCE_AUDIO_DEVICES_LIBS = -framework CoreAudio -framework CoreMIDI -framework DiscRecording
# JUCE_AUDIO_FORMATS_LIBS = -framework CoreAudio -framework CoreMIDI -framework QuartzCore -framework AudioToolbox
# JUCE_CORE_LIBS = -framework Cocoa -framework IOKit
# JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
# JUCE_GUI_BASICS_LIBS = -framework Cocoa -framework Carbon -framework QuartzCore
JUCE_AUDIO_BASICS_LIBS = -framework Accelerate
JUCE_AUDIO_DEVICES_LIBS = -framework CoreAudio -framework CoreMIDI -framework DiscRecording
JUCE_AUDIO_FORMATS_LIBS = -framework CoreAudio -framework CoreMIDI -framework QuartzCore -framework AudioToolbox
JUCE_CORE_LIBS = -framework Cocoa -framework IOKit
JUCE_GRAPHICS_LIBS = -framework Cocoa -framework QuartzCore
JUCE_GUI_BASICS_LIBS = -framework Cocoa -framework Carbon -framework QuartzCore
LILV_LIBS = -ldl -lm LILV_LIBS = -ldl -lm
RTAUDIO_FLAGS += -D__MACOSX_CORE__ RTAUDIO_FLAGS += -D__MACOSX_CORE__
RTAUDIO_LIBS += -lpthread RTAUDIO_LIBS += -lpthread
@@ -188,11 +188,11 @@ endif
ifeq ($(WIN32),true) ifeq ($(WIN32),true)
DGL_LIBS = -lopengl32 -lgdi32 DGL_LIBS = -lopengl32 -lgdi32
JACKBRIDGE_LIBS = -lpthread JACKBRIDGE_LIBS = -lpthread
# JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
# JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
# JUCE_EVENTS_LIBS = -lole32
# JUCE_GRAPHICS_LIBS = -lgdi32
# JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32
JUCE_CORE_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm
JUCE_EVENTS_LIBS = -lole32
JUCE_GRAPHICS_LIBS = -lgdi32
JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32
LILV_LIBS = -lm LILV_LIBS = -lm
RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__ RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__
RTAUDIO_LIBS += -lpthread RTAUDIO_LIBS += -lpthread


+ 1
- 1
source/modules/carla_native/3bandsplitter/DistrhoPlugin3BandSplitter.cpp View File

@@ -224,7 +224,7 @@ void DistrhoPlugin3BandSplitter::d_deactivate()
tmp1LP = tmp2LP = tmp1HP = tmp2HP = 0.0f; tmp1LP = tmp2LP = tmp1HP = tmp2HP = 0.0f;
} }
void DistrhoPlugin3BandSplitter::d_run(float** inputs, float** outputs, uint32_t frames, const MidiEvent*, uint32_t)
void DistrhoPlugin3BandSplitter::d_run(float** inputs, float** outputs, uint32_t frames)
{ {
float* in1 = inputs[0]; float* in1 = inputs[0];
float* in2 = inputs[1]; float* in2 = inputs[1];


+ 1
- 1
source/modules/carla_native/3bandsplitter/DistrhoPlugin3BandSplitter.hpp View File

@@ -88,7 +88,7 @@ protected:
void d_activate() override; void d_activate() override;
void d_deactivate() override; void d_deactivate() override;
void d_run(float** inputs, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) override;
void d_run(float** inputs, float** outputs, uint32_t frames) override;
// ------------------------------------------------------------------- // -------------------------------------------------------------------


+ 0
- 2
source/modules/carla_native/3bandsplitter/DistrhoPluginInfo.h View File

@@ -32,6 +32,4 @@


#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandSplitter" #define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandSplitter"


#define DISTRHO_UI_OPENGL

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 3
- 1
source/modules/carla_native/3bandsplitter/DistrhoUI3BandSplitter.cpp View File

@@ -16,12 +16,14 @@


#include "DistrhoUI3BandSplitter.hpp" #include "DistrhoUI3BandSplitter.hpp"


using DGL::Point;

START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


DistrhoUI3BandSplitter::DistrhoUI3BandSplitter() DistrhoUI3BandSplitter::DistrhoUI3BandSplitter()
: OpenGLUI(),
: UI(),
fAboutWindow(this) fAboutWindow(this)
{ {
// background // background


+ 8
- 2
source/modules/carla_native/3bandsplitter/DistrhoUI3BandSplitter.hpp View File

@@ -17,7 +17,7 @@
#ifndef DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED #ifndef DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED
#define DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED #define DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED


#include "DistrhoUIOpenGL.hpp"
#include "DistrhoUI.hpp"


#include "dgl/ImageAboutWindow.hpp" #include "dgl/ImageAboutWindow.hpp"
#include "dgl/ImageButton.hpp" #include "dgl/ImageButton.hpp"
@@ -27,11 +27,17 @@
#include "DistrhoArtwork3BandSplitter.hpp" #include "DistrhoArtwork3BandSplitter.hpp"
#include "DistrhoPlugin3BandSplitter.hpp" #include "DistrhoPlugin3BandSplitter.hpp"


using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;
using DGL::ImageSlider;

START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


class DistrhoUI3BandSplitter : public OpenGLUI,
class DistrhoUI3BandSplitter : public UI,
public ImageButton::Callback, public ImageButton::Callback,
public ImageKnob::Callback, public ImageKnob::Callback,
public ImageSlider::Callback public ImageSlider::Callback


+ 4
- 4
source/modules/carla_native/Makefile View File

@@ -110,10 +110,10 @@ OBJS += \
endif endif


# DISTRHO plugins (PyQt) # DISTRHO plugins (PyQt)
OBJS += \
distrho-bigmeter.cpp.o \
distrho-bigmeterM.cpp.o \
distrho-notes.cpp.o
# OBJS += \
# distrho-bigmeter.cpp.o \
# distrho-bigmeterM.cpp.o \
# distrho-notes.cpp.o


ifeq ($(HAVE_ZYN_DEPS),true) ifeq ($(HAVE_ZYN_DEPS),true)
# ZynAddSubFX # ZynAddSubFX


+ 6
- 6
source/modules/carla_native/_all.c View File

@@ -54,9 +54,9 @@ extern void carla_register_native_plugin_StereoEnhancer();
#endif #endif


// DISTRHO plugins (PyQt) // DISTRHO plugins (PyQt)
extern void carla_register_native_plugin_BigMeter();
extern void carla_register_native_plugin_BigMeterM();
extern void carla_register_native_plugin_Notes();
// extern void carla_register_native_plugin_BigMeter();
// extern void carla_register_native_plugin_BigMeterM();
// extern void carla_register_native_plugin_Notes();


#ifdef WANT_ZYNADDSUBFX #ifdef WANT_ZYNADDSUBFX
// ZynAddSubFX // ZynAddSubFX
@@ -103,9 +103,9 @@ void carla_register_all_plugins()
#endif #endif


// DISTRHO plugins (PyQt) // DISTRHO plugins (PyQt)
carla_register_native_plugin_BigMeter();
carla_register_native_plugin_BigMeterM();
carla_register_native_plugin_Notes();
// carla_register_native_plugin_BigMeter();
// carla_register_native_plugin_BigMeterM();
// carla_register_native_plugin_Notes();


#ifdef WANT_ZYNADDSUBFX #ifdef WANT_ZYNADDSUBFX
// ZynAddSubFX // ZynAddSubFX


+ 35
- 179
source/modules/carla_native/distrho/DistrhoPluginCarla.cpp View File

@@ -14,10 +14,6 @@
* For a full copy of the license see the LGPL.txt file * For a full copy of the license see the LGPL.txt file
*/ */


#ifdef DISTRHO_UI_QT
# error We do not want Qt in the engine code!
#endif

#include "CarlaNative.hpp" #include "CarlaNative.hpp"
#include "CarlaString.hpp" #include "CarlaString.hpp"


@@ -25,12 +21,6 @@


#if DISTRHO_PLUGIN_HAS_UI #if DISTRHO_PLUGIN_HAS_UI
# include "DistrhoUIMain.cpp" # include "DistrhoUIMain.cpp"
# ifdef DISTRHO_UI_OPENGL
# include "dgl/App.hpp"
# include "dgl/Window.hpp"
# else
# include "CarlaPipeUtils.hpp"
# endif
#endif #endif


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -41,213 +31,86 @@ START_NAMESPACE_DISTRHO
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// Carla UI // Carla UI


#ifdef DISTRHO_UI_OPENGL
# if ! DISTRHO_PLUGIN_WANT_STATE
static const setStateFunc setStateCallback = nullptr;
# endif
# if ! DISTRHO_PLUGIN_IS_SYNTH
static const sendNoteFunc sendNoteCallback = nullptr;
# endif
#else
static const editParamFunc editParameterCallback = nullptr;
static const setParamFunc setParameterCallback = nullptr;
static const setStateFunc setStateCallback = nullptr;
static const sendNoteFunc sendNoteCallback = nullptr;
static const uiResizeFunc uiResizeCallback = nullptr;
#if ! DISTRHO_PLUGIN_WANT_STATE
static const setStateFunc setStateCallback = nullptr;
#endif
#if ! DISTRHO_PLUGIN_IS_SYNTH
static const sendNoteFunc sendNoteCallback = nullptr;
#endif #endif


#ifdef DISTRHO_UI_EXTERNAL
class UICarla : public CarlaPipeServer
#else
class UICarla class UICarla
#endif
{ {
public: public:
UICarla(const NativeHostDescriptor* const host, PluginInternal* const plugin)
UICarla(const NativeHostDescriptor* const host, PluginExporter* const plugin)
: fHost(host), : fHost(host),
fPlugin(plugin), fPlugin(plugin),
fUi(this, 0, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, uiResizeCallback)
#ifdef DISTRHO_UI_OPENGL
, glWindow(fUi.getWindow())
#endif
fUI(this, 0, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, uiResizeCallback)
{ {
#ifdef DISTRHO_UI_OPENGL
//glWindow.setSize(fUi.getWidth(), fUi.getHeight());
glWindow.setTitle(host->uiName);
#else
CarlaString filename;
filename += fHost->resourceDir;
#ifdef CARLA_OS_WIN
filename += "\\";
#else
filename += "/";
#endif
filename += fUi.getExternalFilename();

char sampleRateStr[12+1];
sampleRateStr[12] = '\0';
std::snprintf(sampleRateStr, 12, "%g", host->get_sample_rate(host->handle));

CarlaPipeServer::start(filename, sampleRateStr, host->uiName);
#endif
}

#ifdef DISTRHO_UI_EXTERNAL
~UICarla() override
{
CarlaPipeServer::stop();
}

void fail(const char* const error) override
{
carla_stderr2(error);
fHost->dispatcher(fHost->handle, HOST_OPCODE_UI_UNAVAILABLE, 0, 0, nullptr, 0.0f);
fUI.setTitle(host->uiName);
} }


void msgReceived(const char* const msg) override
{
if (std::strcmp(msg, "control") == 0)
{
int index;
float value;

if (readNextLineAsInt(index) && readNextLineAsFloat(value))
handleSetParameterValue(index, value);
}
else if (std::strcmp(msg, "configure") == 0)
{
char* key;
char* value;

if (readNextLineAsString(key) && readNextLineAsString(value))
{
handleSetState(key, value);
std::free(key);
std::free(value);
}
}
else if (std::strcmp(msg, "exiting") == 0)
{
waitChildClose();
fHost->ui_closed(fHost->handle);
}
else
{
carla_stderr("unknown message HOST: \"%s\"", msg);
}
}
#endif

// --------------------------------------------- // ---------------------------------------------


void carla_show(const bool yesNo) void carla_show(const bool yesNo)
{ {
#ifdef DISTRHO_UI_OPENGL
glWindow.setVisible(yesNo);
#else
if (yesNo)
writeMsg("show\n", 5);
else
writeMsg("hide\n", 5);
#endif
fUI.setVisible(yesNo);
} }


void carla_idle() void carla_idle()
{ {
fUi.idle();

#ifdef DISTRHO_UI_EXTERNAL
CarlaPipeServer::idle();
#endif
fUI.idle();
} }


void carla_setParameterValue(const uint32_t index, const float value) void carla_setParameterValue(const uint32_t index, const float value)
{ {
#ifdef DISTRHO_UI_OPENGL
fUi.parameterChanged(index, value);
#else
char msgParamIndex[0xff+1];
char msgParamValue[0xff+1];

std::snprintf(msgParamIndex, 0xff, "%d\n", index);
std::snprintf(msgParamValue, 0xff, "%f\n", value);

msgParamIndex[0xff] = '\0';
msgParamValue[0xff] = '\0';

writeMsg("control\n", 8);
writeMsg(msgParamIndex);
writeMsg(msgParamValue);
#endif
fUI.parameterChanged(index, value);
} }


#if DISTRHO_PLUGIN_WANT_PROGRAMS #if DISTRHO_PLUGIN_WANT_PROGRAMS
void carla_setMidiProgram(const uint32_t realProgram) void carla_setMidiProgram(const uint32_t realProgram)
{ {
#ifdef DISTRHO_UI_OPENGL
fUi.programChanged(realProgram);
#else
char msgProgram[0xff+1];

std::snprintf(msgProgram, 0xff, "%d\n", realProgram);

msgProgram[0xff] = '\0';

writeMsg("program\n", 8);
writeMsg(msgProgram);
#endif
fUI.programChanged(realProgram);
} }
#endif #endif


#if DISTRHO_PLUGIN_WANT_STATE #if DISTRHO_PLUGIN_WANT_STATE
void carla_setCustomData(const char* const key, const char* const value) void carla_setCustomData(const char* const key, const char* const value)
{ {
#ifdef DISTRHO_UI_OPENGL
fUi.stateChanged(key, value);
#else
writeMsg("configure\n", 10);
writeAndFixMsg(key);
writeAndFixMsg(value);
#endif
fUI.stateChanged(key, value);
} }
#endif #endif


void carla_setUiTitle(const char* const uiTitle) void carla_setUiTitle(const char* const uiTitle)
{ {
#ifdef DISTRHO_UI_OPENGL
glWindow.setTitle(uiTitle);
#else
writeMsg("uiTitle\n", 8);
writeAndFixMsg(uiTitle);
#endif
fUI.setTitle(uiTitle);
} }


// --------------------------------------------- // ---------------------------------------------


protected: protected:
void handleEditParameter(uint32_t, bool)
void handleEditParameter(const uint32_t, const bool)
{ {
// TODO // TODO
} }


void handleSetParameterValue(uint32_t rindex, float value)
void handleSetParameterValue(const uint32_t rindex, const float value)
{ {
fHost->ui_parameter_changed(fHost->handle, rindex, value); fHost->ui_parameter_changed(fHost->handle, rindex, value);
} }


void handleSetState(const char* key, const char* value)
void handleSetState(const char* const key, const char* const value)
{ {
fHost->ui_custom_data_changed(fHost->handle, key, value); fHost->ui_custom_data_changed(fHost->handle, key, value);
} }


void handleSendNote(bool, uint8_t, uint8_t, uint8_t)
void handleSendNote(const uint8_t, const uint8_t, const uint8_t)
{ {
// TODO // TODO
} }


void handleUiResize(unsigned int /*width*/, unsigned int /*height*/)
void handleUiResize(const unsigned int width, const unsigned int height)
{ {
// TODO
fUI.setSize(width, height);
} }


// --------------------------------------------- // ---------------------------------------------
@@ -255,20 +118,14 @@ protected:
private: private:
// Plugin stuff // Plugin stuff
const NativeHostDescriptor* const fHost; const NativeHostDescriptor* const fHost;
PluginInternal* const fPlugin;
PluginExporter* const fPlugin;


// UI // UI
UIInternal fUi;

#ifdef DISTRHO_UI_OPENGL
// OpenGL stuff
Window& glWindow;
#endif
UIExporter fUI;


// --------------------------------------------- // ---------------------------------------------
// Callbacks // Callbacks


#ifdef DISTRHO_UI_OPENGL
#define handlePtr ((UICarla*)ptr) #define handlePtr ((UICarla*)ptr)


static void editParameterCallback(void* ptr, uint32_t index, bool started) static void editParameterCallback(void* ptr, uint32_t index, bool started)
@@ -281,19 +138,19 @@ private:
handlePtr->handleSetParameterValue(rindex, value); handlePtr->handleSetParameterValue(rindex, value);
} }


#if DISTRHO_PLUGIN_WANT_STATE
#if DISTRHO_PLUGIN_WANT_STATE
static void setStateCallback(void* ptr, const char* key, const char* value) static void setStateCallback(void* ptr, const char* key, const char* value)
{ {
handlePtr->handleSetState(key, value); handlePtr->handleSetState(key, value);
} }
#endif
#endif


#if DISTRHO_PLUGIN_IS_SYNTH
static void sendNoteCallback(void* ptr, bool onOff, uint8_t channel, uint8_t note, uint8_t velocity)
#if DISTRHO_PLUGIN_IS_SYNTH
static void sendNoteCallback(void* ptr, uint8_t channel, uint8_t note, uint8_t velocity)
{ {
handlePtr->handleSendNote(onOff, channel, note, velocity);
handlePtr->handleSendNote(channel, note, velocity);
} }
#endif
#endif


static void uiResizeCallback(void* ptr, unsigned int width, unsigned int height) static void uiResizeCallback(void* ptr, unsigned int width, unsigned int height)
{ {
@@ -301,7 +158,6 @@ private:
} }


#undef handlePtr #undef handlePtr
#endif


CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(UICarla) CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(UICarla)
}; };
@@ -379,9 +235,9 @@ protected:
param.ranges.def = ranges.def; param.ranges.def = ranges.def;
param.ranges.min = ranges.min; param.ranges.min = ranges.min;
param.ranges.max = ranges.max; param.ranges.max = ranges.max;
param.ranges.step = ranges.step;
param.ranges.stepSmall = ranges.stepSmall;
param.ranges.stepLarge = ranges.stepLarge;
//param.ranges.step = ranges.step;
//param.ranges.stepSmall = ranges.stepSmall;
//param.ranges.stepLarge = ranges.stepLarge;
} }


return &param; return &param;
@@ -470,7 +326,7 @@ protected:
{ {
uint32_t i; uint32_t i;


for (i=0; i < midiEventCount && i < MAX_MIDI_EVENTS; ++i)
for (i=0; i < midiEventCount && i < kMaxMidiEvents; ++i)
{ {
const NativeMidiEvent* const midiEvent(&midiEvents[i]); const NativeMidiEvent* const midiEvent(&midiEvents[i]);
MidiEvent* const realMidiEvent(&fRealMidiEvents[i]); MidiEvent* const realMidiEvent(&fRealMidiEvents[i]);
@@ -487,7 +343,7 @@ protected:
#else #else
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override
{ {
fPlugin.run(inBuffer, outBuffer, frames, nullptr, 0);
fPlugin.run(inBuffer, outBuffer, frames);
} }
#endif #endif


@@ -573,10 +429,10 @@ protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------


private: private:
PluginInternal fPlugin;
PluginExporter fPlugin;


#if DISTRHO_PLUGIN_IS_SYNTH #if DISTRHO_PLUGIN_IS_SYNTH
MidiEvent fRealMidiEvents[MAX_MIDI_EVENTS];
MidiEvent fRealMidiEvents[kMaxMidiEvents];
#endif #endif


#if DISTRHO_PLUGIN_HAS_UI #if DISTRHO_PLUGIN_HAS_UI


+ 0
- 2
source/modules/carla_native/pingpongpan/DistrhoPluginInfo.h View File

@@ -32,6 +32,4 @@


#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/PingPongPan" #define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/PingPongPan"


#define DISTRHO_UI_OPENGL

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 1
- 1
source/modules/carla_native/pingpongpan/DistrhoPluginPingPongPan.cpp View File

@@ -134,7 +134,7 @@ void DistrhoPluginPingPongPan::d_deactivate()
wavePos = 0.0f; wavePos = 0.0f;
} }
void DistrhoPluginPingPongPan::d_run(float** inputs, float** outputs, uint32_t frames, const MidiEvent*, uint32_t)
void DistrhoPluginPingPongPan::d_run(float** inputs, float** outputs, uint32_t frames)
{ {
float* in1 = inputs[0]; float* in1 = inputs[0];
float* in2 = inputs[1]; float* in2 = inputs[1];


+ 1
- 1
source/modules/carla_native/pingpongpan/DistrhoPluginPingPongPan.hpp View File

@@ -84,7 +84,7 @@ protected:
void d_activate() override; void d_activate() override;
void d_deactivate() override; void d_deactivate() override;
void d_run(float** inputs, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) override;
void d_run(float** inputs, float** outputs, uint32_t frames) override;
// ------------------------------------------------------------------- // -------------------------------------------------------------------


+ 2
- 2
source/modules/carla_native/pingpongpan/DistrhoUIPingPongPan.cpp View File

@@ -16,14 +16,14 @@


#include "DistrhoUIPingPongPan.hpp" #include "DistrhoUIPingPongPan.hpp"


#include "dgl/ImageAboutWindow.hpp"
using DGL::Point;


START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


DistrhoUIPingPongPan::DistrhoUIPingPongPan() DistrhoUIPingPongPan::DistrhoUIPingPongPan()
: OpenGLUI(),
: UI(),
fAboutWindow(this) fAboutWindow(this)
{ {
// background // background


+ 7
- 2
source/modules/carla_native/pingpongpan/DistrhoUIPingPongPan.hpp View File

@@ -17,7 +17,7 @@
#ifndef DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED #ifndef DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED
#define DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED #define DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED


#include "DistrhoUIOpenGL.hpp"
#include "DistrhoUI.hpp"


#include "dgl/ImageAboutWindow.hpp" #include "dgl/ImageAboutWindow.hpp"
#include "dgl/ImageButton.hpp" #include "dgl/ImageButton.hpp"
@@ -26,11 +26,16 @@
#include "DistrhoArtworkPingPongPan.hpp" #include "DistrhoArtworkPingPongPan.hpp"
#include "DistrhoPluginPingPongPan.hpp" #include "DistrhoPluginPingPongPan.hpp"


using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;

START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


class DistrhoUIPingPongPan : public OpenGLUI,
class DistrhoUIPingPongPan : public UI,
public ImageButton::Callback, public ImageButton::Callback,
public ImageKnob::Callback public ImageKnob::Callback
{ {


+ 0
- 2
source/modules/carla_native/stereoenhancer/DistrhoPluginInfo.h View File

@@ -32,6 +32,4 @@


#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/StereoEnhancer" #define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/StereoEnhancer"


#define DISTRHO_UI_OPENGL

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 1
- 1
source/modules/carla_native/stereoenhancer/DistrhoPluginStereoEnhancer.cpp View File

@@ -165,7 +165,7 @@ void DistrhoPluginStereoEnhancer::d_deactivate()
tmp1HP = tmp2HP = 0.0f; tmp1HP = tmp2HP = 0.0f;
} }
void DistrhoPluginStereoEnhancer::d_run(float** inputs, float** outputs, uint32_t frames, const MidiEvent*, uint32_t)
void DistrhoPluginStereoEnhancer::d_run(float** inputs, float** outputs, uint32_t frames)
{ {
float* in1 = inputs[0]; float* in1 = inputs[0];
float* in2 = inputs[1]; float* in2 = inputs[1];


+ 2
- 2
source/modules/carla_native/stereoenhancer/DistrhoUIStereoEnhancer.cpp View File

@@ -16,14 +16,14 @@


#include "DistrhoUIStereoEnhancer.hpp" #include "DistrhoUIStereoEnhancer.hpp"


#include "dgl/ImageAboutWindow.hpp"
using DGL::Point;


START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


DistrhoUIStereoEnhancer::DistrhoUIStereoEnhancer() DistrhoUIStereoEnhancer::DistrhoUIStereoEnhancer()
: OpenGLUI(),
: UI(),
fAboutWindow(this) fAboutWindow(this)
{ {
// background // background


+ 7
- 2
source/modules/carla_native/stereoenhancer/DistrhoUIStereoEnhancer.hpp View File

@@ -17,7 +17,7 @@
#ifndef DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED #ifndef DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED
#define DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED #define DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED


#include "DistrhoUIOpenGL.hpp"
#include "DistrhoUI.hpp"


#include "dgl/ImageAboutWindow.hpp" #include "dgl/ImageAboutWindow.hpp"
#include "dgl/ImageButton.hpp" #include "dgl/ImageButton.hpp"
@@ -26,11 +26,16 @@
#include "DistrhoArtworkStereoEnhancer.hpp" #include "DistrhoArtworkStereoEnhancer.hpp"
#include "DistrhoPluginStereoEnhancer.hpp" #include "DistrhoPluginStereoEnhancer.hpp"


using DGL::Image;
using DGL::ImageAboutWindow;
using DGL::ImageButton;
using DGL::ImageKnob;

START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


class DistrhoUIStereoEnhancer : public OpenGLUI,
class DistrhoUIStereoEnhancer : public UI,
public ImageButton::Callback, public ImageButton::Callback,
public ImageKnob::Callback public ImageKnob::Callback
{ {


+ 1
- 3
source/modules/distrho/DistrhoPluginMain.cpp View File

@@ -16,9 +16,7 @@


#include "src/DistrhoPlugin.cpp" #include "src/DistrhoPlugin.cpp"


#if defined(DISTRHO_PLUGIN_TARGET_JACK)
# include "src/DistrhoPluginJACK.cpp"
#elif (defined(DISTRHO_PLUGIN_TARGET_LADSPA) || defined(DISTRHO_PLUGIN_TARGET_DSSI))
#if (defined(DISTRHO_PLUGIN_TARGET_LADSPA) || defined(DISTRHO_PLUGIN_TARGET_DSSI))
# include "src/DistrhoPluginLADSPA+DSSI.cpp" # include "src/DistrhoPluginLADSPA+DSSI.cpp"
#elif defined(DISTRHO_PLUGIN_TARGET_LV2) #elif defined(DISTRHO_PLUGIN_TARGET_LV2)
# include "src/DistrhoPluginLV2.cpp" # include "src/DistrhoPluginLV2.cpp"


+ 1
- 11
source/modules/distrho/DistrhoUIMain.cpp View File

@@ -16,20 +16,10 @@


#include "src/DistrhoUI.cpp" #include "src/DistrhoUI.cpp"


#if defined(DISTRHO_PLUGIN_TARGET_JACK)
// nothing
#elif defined(DISTRHO_PLUGIN_TARGET_DSSI)
#if defined(DISTRHO_PLUGIN_TARGET_DSSI)
# include "src/DistrhoUIDSSI.cpp" # include "src/DistrhoUIDSSI.cpp"
#elif defined(DISTRHO_PLUGIN_TARGET_LV2) #elif defined(DISTRHO_PLUGIN_TARGET_LV2)
# include "src/DistrhoUILV2.cpp" # include "src/DistrhoUILV2.cpp"
#elif defined(DISTRHO_PLUGIN_TARGET_VST) #elif defined(DISTRHO_PLUGIN_TARGET_VST)
// nothing // nothing
#endif #endif

#if defined(DISTRHO_UI_EXTERNAL)
# include "src/DistrhoUIExternal.cpp"
#elif defined(DISTRHO_UI_OPENGL)
# include "src/DistrhoUIOpenGL.cpp"
#elif defined(DISTRHO_UI_QT)
# include "src/DistrhoUIQt.cpp"
#endif

+ 24
- 0
source/modules/distrho/src/DistrhoPluginLADSPA+DSSI.cpp View File

@@ -43,11 +43,19 @@ public:
: fPortControls(nullptr), : fPortControls(nullptr),
fLastControlValues(nullptr) fLastControlValues(nullptr)
{ {
#if DISTRHO_PLUGIN_NUM_INPUTS > 0
for (uint32_t i=0; i < DISTRHO_PLUGIN_NUM_INPUTS; ++i) for (uint32_t i=0; i < DISTRHO_PLUGIN_NUM_INPUTS; ++i)
fPortAudioIns[i] = nullptr; fPortAudioIns[i] = nullptr;
#else
fPortAudioIns = nullptr;
#endif


#if DISTRHO_PLUGIN_NUM_OUTPUTS > 0
for (uint32_t i=0; i < DISTRHO_PLUGIN_NUM_OUTPUTS; ++i) for (uint32_t i=0; i < DISTRHO_PLUGIN_NUM_OUTPUTS; ++i)
fPortAudioOuts[i] = nullptr; fPortAudioOuts[i] = nullptr;
#else
fPortAudioOuts = nullptr;
#endif


{ {
const uint32_t count(fPlugin.getParameterCount()); const uint32_t count(fPlugin.getParameterCount());
@@ -100,6 +108,7 @@ public:
{ {
unsigned long index = 0; unsigned long index = 0;


#if DISTRHO_PLUGIN_NUM_INPUTS > 0
for (unsigned long i=0; i < DISTRHO_PLUGIN_NUM_INPUTS; ++i) for (unsigned long i=0; i < DISTRHO_PLUGIN_NUM_INPUTS; ++i)
{ {
if (port == index++) if (port == index++)
@@ -108,7 +117,9 @@ public:
return; return;
} }
} }
#endif


#if DISTRHO_PLUGIN_NUM_OUTPUTS > 0
for (unsigned long i=0; i < DISTRHO_PLUGIN_NUM_OUTPUTS; ++i) for (unsigned long i=0; i < DISTRHO_PLUGIN_NUM_OUTPUTS; ++i)
{ {
if (port == index++) if (port == index++)
@@ -117,6 +128,7 @@ public:
return; return;
} }
} }
#endif


#if DISTRHO_PLUGIN_WANT_LATENCY #if DISTRHO_PLUGIN_WANT_LATENCY
if (port == index++) if (port == index++)
@@ -318,8 +330,16 @@ private:
PluginExporter fPlugin; PluginExporter fPlugin;


// LADSPA ports // LADSPA ports
#if DISTRHO_PLUGIN_NUM_INPUTS > 0
LADSPA_Data* fPortAudioIns[DISTRHO_PLUGIN_NUM_INPUTS]; LADSPA_Data* fPortAudioIns[DISTRHO_PLUGIN_NUM_INPUTS];
#else
LADSPA_Data** fPortAudioIns;
#endif
#if DISTRHO_PLUGIN_NUM_OUTPUTS > 0
LADSPA_Data* fPortAudioOuts[DISTRHO_PLUGIN_NUM_OUTPUTS]; LADSPA_Data* fPortAudioOuts[DISTRHO_PLUGIN_NUM_OUTPUTS];
#else
LADSPA_Data** fPortAudioOuts;
#endif
LADSPA_Data** fPortControls; LADSPA_Data** fPortControls;
#if DISTRHO_PLUGIN_WANT_LATENCY #if DISTRHO_PLUGIN_WANT_LATENCY
LADSPA_Data* fPortLatency; LADSPA_Data* fPortLatency;
@@ -496,6 +516,7 @@ public:
LADSPA_PortRangeHint* portRangeHints = new LADSPA_PortRangeHint [portCount]; LADSPA_PortRangeHint* portRangeHints = new LADSPA_PortRangeHint [portCount];


// Set ports // Set ports
#if DISTRHO_PLUGIN_NUM_INPUTS > 0
for (unsigned long i=0; i < DISTRHO_PLUGIN_NUM_INPUTS; ++i, ++port) for (unsigned long i=0; i < DISTRHO_PLUGIN_NUM_INPUTS; ++i, ++port)
{ {
char portName[24] = { '\0' }; char portName[24] = { '\0' };
@@ -508,7 +529,9 @@ public:
portRangeHints[port].LowerBound = 0.0f; portRangeHints[port].LowerBound = 0.0f;
portRangeHints[port].UpperBound = 1.0f; portRangeHints[port].UpperBound = 1.0f;
} }
#endif


#if DISTRHO_PLUGIN_NUM_OUTPUTS > 0
for (unsigned long i=0; i < DISTRHO_PLUGIN_NUM_OUTPUTS; ++i, ++port) for (unsigned long i=0; i < DISTRHO_PLUGIN_NUM_OUTPUTS; ++i, ++port)
{ {
char portName[24] = { '\0' }; char portName[24] = { '\0' };
@@ -521,6 +544,7 @@ public:
portRangeHints[port].LowerBound = 0.0f; portRangeHints[port].LowerBound = 0.0f;
portRangeHints[port].UpperBound = 1.0f; portRangeHints[port].UpperBound = 1.0f;
} }
#endif


#if DISTRHO_PLUGIN_WANT_LATENCY #if DISTRHO_PLUGIN_WANT_LATENCY
// Set latency port // Set latency port


+ 0
- 1
source/modules/distrho/src/DistrhoUIInternal.hpp View File

@@ -21,7 +21,6 @@


#include "../dgl/App.hpp" #include "../dgl/App.hpp"
#include "../dgl/Window.hpp" #include "../dgl/Window.hpp"
#include <lo/lo_osc_types.h>


START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO




+ 5
- 5
source/plugin/carla-native-base.cpp View File

@@ -16,7 +16,7 @@
*/ */


#include "CarlaNative.h" #include "CarlaNative.h"
#include "RtList.hpp"
#include "List.hpp"


#include "lv2/lv2.h" #include "lv2/lv2.h"


@@ -31,7 +31,7 @@ struct PluginListManager {


~PluginListManager() ~PluginListManager()
{ {
for (NonRtList<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin(); it.valid(); it.next())
for (List<const LV2_Descriptor*>::Itenerator it = lv2Descs.begin(); it.valid(); it.next())
{ {
const LV2_Descriptor*& lv2Desc(*it); const LV2_Descriptor*& lv2Desc(*it);
delete[] lv2Desc->URI; delete[] lv2Desc->URI;
@@ -42,15 +42,15 @@ struct PluginListManager {
lv2Descs.clear(); lv2Descs.clear();
} }


NonRtList<const PluginDescriptor*> descs;
NonRtList<const LV2_Descriptor*> lv2Descs;
List<const NativePluginDescriptor*> descs;
List<const LV2_Descriptor*> lv2Descs;
}; };


static PluginListManager sPluginDescsMgr; static PluginListManager sPluginDescsMgr;


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


void carla_register_native_plugin(const PluginDescriptor* desc)
void carla_register_native_plugin(const NativePluginDescriptor* desc)
{ {
#ifdef CARLA_NATIVE_PLUGIN_LV2 #ifdef CARLA_NATIVE_PLUGIN_LV2
// LV2 MIDI Out and Open/Save are not implemented yet // LV2 MIDI Out and Open/Save are not implemented yet


+ 16
- 16
source/plugin/carla-native-lv2-export.cpp View File

@@ -114,9 +114,9 @@ void writeManifestFile()
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugins // Plugins


for (NonRtList<const PluginDescriptor*>::Itenerator it = sPluginDescsMgr.descs.begin(); it.valid(); it.next())
for (List<const NativePluginDescriptor*>::Itenerator it = sPluginDescsMgr.descs.begin(); it.valid(); it.next())
{ {
const PluginDescriptor*& pluginDesc(*it);
const NativePluginDescriptor*& pluginDesc(*it);
const String label(pluginDesc->label); const String label(pluginDesc->label);


if (label == "carla") if (label == "carla")
@@ -149,12 +149,12 @@ void writeManifestFile()


// ----------------------------------------------------------------------- // -----------------------------------------------------------------------


static uint32_t host_getBufferSize(HostHandle) { return 512; }
static double host_getSampleRate(HostHandle) { return 44100.0; }
static bool host_isOffline(HostHandle) { return true; }
static intptr_t host_dispatcher(HostHandle, HostDispatcherOpcode, int32_t, intptr_t, void*, float) { return 0; }
static uint32_t host_getBufferSize(NativeHostHandle) { return 512; }
static double host_getSampleRate(NativeHostHandle) { return 44100.0; }
static bool host_isOffline(NativeHostHandle) { return true; }
static intptr_t host_dispatcher(NativeHostHandle, NativeHostDispatcherOpcode, int32_t, intptr_t, void*, float) { return 0; }


void writePluginFile(const PluginDescriptor* const pluginDesc)
void writePluginFile(const NativePluginDescriptor* const pluginDesc)
{ {
const String pluginLabel(pluginDesc->label); const String pluginLabel(pluginDesc->label);
const String pluginFile("carla-native.lv2/" + pluginLabel + ".ttl"); const String pluginFile("carla-native.lv2/" + pluginLabel + ".ttl");
@@ -169,7 +169,7 @@ void writePluginFile(const PluginDescriptor* const pluginDesc)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Init plugin // Init plugin


HostDescriptor hostDesc;
NativeHostDescriptor hostDesc;
hostDesc.handle = nullptr; hostDesc.handle = nullptr;
hostDesc.resourceDir = ""; hostDesc.resourceDir = "";
hostDesc.uiName = ""; hostDesc.uiName = "";
@@ -186,7 +186,7 @@ void writePluginFile(const PluginDescriptor* const pluginDesc)
hostDesc.ui_save_file = nullptr; hostDesc.ui_save_file = nullptr;
hostDesc.dispatcher = host_dispatcher; hostDesc.dispatcher = host_dispatcher;


PluginHandle pluginHandle = pluginDesc->instantiate(&hostDesc);
NativePluginHandle pluginHandle = pluginDesc->instantiate(&hostDesc);


CARLA_SAFE_ASSERT_RETURN(pluginHandle != nullptr,) CARLA_SAFE_ASSERT_RETURN(pluginHandle != nullptr,)


@@ -290,7 +290,7 @@ void writePluginFile(const PluginDescriptor* const pluginDesc)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// UIs // UIs


if (pluginDesc->hints & PLUGIN_HAS_GUI)
if (pluginDesc->hints & PLUGIN_HAS_UI)
{ {
text += " ui:ui <http://kxstudio.sf.net/carla/ui> ;\n"; text += " ui:ui <http://kxstudio.sf.net/carla/ui> ;\n";
text += "\n"; text += "\n";
@@ -459,9 +459,9 @@ void writePluginFile(const PluginDescriptor* const pluginDesc)


for (uint32_t i=0; i < paramCount; ++i) for (uint32_t i=0; i < paramCount; ++i)
{ {
const Parameter* paramInfo(pluginDesc->get_parameter_info(pluginHandle, i));
const String paramName(paramInfo->name != nullptr ? paramInfo->name : "");
const String paramUnit(paramInfo->unit != nullptr ? paramInfo->unit : "");
const NativeParameter* paramInfo(pluginDesc->get_parameter_info(pluginHandle, i));
const String paramName(paramInfo->name != nullptr ? paramInfo->name : "");
const String paramUnit(paramInfo->unit != nullptr ? paramInfo->unit : "");


CARLA_SAFE_ASSERT_RETURN(paramInfo != nullptr,) CARLA_SAFE_ASSERT_RETURN(paramInfo != nullptr,)


@@ -509,7 +509,7 @@ void writePluginFile(const PluginDescriptor* const pluginDesc)


for (uint32_t j=0; j < paramInfo->scalePointCount; ++j) for (uint32_t j=0; j < paramInfo->scalePointCount; ++j)
{ {
const ParameterScalePoint* const scalePoint(&paramInfo->scalePoints[j]);
const NativeParameterScalePoint* const scalePoint(&paramInfo->scalePoints[j]);


if (j == 0) if (j == 0)
text += " lv2:scalePoint [ "; text += " lv2:scalePoint [ ";
@@ -564,9 +564,9 @@ int main()
{ {
writeManifestFile(); writeManifestFile();


for (NonRtList<const PluginDescriptor*>::Itenerator it = sPluginDescsMgr.descs.begin(); it.valid(); it.next())
for (List<const NativePluginDescriptor*>::Itenerator it = sPluginDescsMgr.descs.begin(); it.valid(); it.next())
{ {
const PluginDescriptor*& pluginDesc(*it);
const NativePluginDescriptor*& pluginDesc(*it);
writePluginFile(pluginDesc); writePluginFile(pluginDesc);
} }




+ 35
- 35
source/plugin/carla-native-lv2.cpp View File

@@ -91,7 +91,7 @@ class NativePlugin : public LV2_External_UI_Widget
public: public:
static const uint32_t kMaxMidiEvents = 512; static const uint32_t kMaxMidiEvents = 512;


NativePlugin(const PluginDescriptor* const desc, const double sampleRate, const char* const bundlePath, const LV2_Feature* const* features)
NativePlugin(const NativePluginDescriptor* const desc, const double sampleRate, const char* const bundlePath, const LV2_Feature* const* features)
: fHandle(nullptr), : fHandle(nullptr),
fDescriptor(desc), fDescriptor(desc),
fMidiEventCount(0), fMidiEventCount(0),
@@ -218,8 +218,8 @@ public:
if (fHandle == nullptr) if (fHandle == nullptr)
return false; return false;


carla_zeroStruct<MidiEvent>(fMidiEvents, kMaxMidiEvents*2);
carla_zeroStruct<TimeInfo>(fTimeInfo);
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2);
carla_zeroStruct<NativeTimeInfo>(fTimeInfo);


fPorts.init(fDescriptor, fHandle); fPorts.init(fDescriptor, fHandle);
fUris.map(fUridMap); fUris.map(fUridMap);
@@ -240,7 +240,7 @@ public:
if (fDescriptor->activate != nullptr) if (fDescriptor->activate != nullptr)
fDescriptor->activate(fHandle); fDescriptor->activate(fHandle);


carla_zeroStruct<TimeInfo>(fTimeInfo);
carla_zeroStruct<NativeTimeInfo>(fTimeInfo);
} }


void lv2_deactivate() void lv2_deactivate()
@@ -303,7 +303,7 @@ public:
if (fDescriptor->midiIns > 0 || (fDescriptor->hints & PLUGIN_USES_TIME) != 0) if (fDescriptor->midiIns > 0 || (fDescriptor->hints & PLUGIN_USES_TIME) != 0)
{ {
fMidiEventCount = 0; fMidiEventCount = 0;
carla_zeroStruct<MidiEvent>(fMidiEvents, kMaxMidiEvents*2);
carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2);


LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[0], iter) LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[0], iter)
{ {
@@ -503,7 +503,7 @@ public:
if (index >= fDescriptor->get_midi_program_count(fHandle)) if (index >= fDescriptor->get_midi_program_count(fHandle))
return nullptr; return nullptr;


const MidiProgram* const midiProg(fDescriptor->get_midi_program_info(fHandle, index));
const NativeMidiProgram* const midiProg(fDescriptor->get_midi_program_info(fHandle, index));


if (midiProg == nullptr) if (midiProg == nullptr)
return nullptr; return nullptr;
@@ -691,14 +691,14 @@ protected:
return (fPorts.freewheel != nullptr && *fPorts.freewheel >= 0.5f); return (fPorts.freewheel != nullptr && *fPorts.freewheel >= 0.5f);
} }


const TimeInfo* handleGetTimeInfo() const
const NativeTimeInfo* handleGetTimeInfo() const
{ {
CARLA_SAFE_ASSERT_RETURN(fIsProcessing, nullptr); CARLA_SAFE_ASSERT_RETURN(fIsProcessing, nullptr);


return &fTimeInfo; return &fTimeInfo;
} }


bool handleWriteMidiEvent(const MidiEvent* const event)
bool handleWriteMidiEvent(const NativeMidiEvent* const event)
{ {
CARLA_SAFE_ASSERT_RETURN(fIsProcessing, false); CARLA_SAFE_ASSERT_RETURN(fIsProcessing, false);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->midiOuts > 0, false); CARLA_SAFE_ASSERT_RETURN(fDescriptor->midiOuts > 0, false);
@@ -710,7 +710,7 @@ protected:
{ {
if (fMidiEvents[i].data[0] == 0) if (fMidiEvents[i].data[0] == 0)
{ {
std::memcpy(&fMidiEvents[i], event, sizeof(MidiEvent));
std::memcpy(&fMidiEvents[i], event, sizeof(NativeMidiEvent));
return true; return true;
} }
} }
@@ -752,7 +752,7 @@ protected:
return nullptr; return nullptr;
} }


intptr_t handleDispatcher(const HostDispatcherOpcode opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt)
intptr_t handleDispatcher(const NativeHostDispatcherOpcode opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt)
{ {
carla_debug("NativePlugin::handleDispatcher(%i, %i, " P_INTPTR ", %p, %f)", opcode, index, value, ptr, opt); carla_debug("NativePlugin::handleDispatcher(%i, %i, " P_INTPTR ", %p, %f)", opcode, index, value, ptr, opt);


@@ -814,14 +814,14 @@ protected:


private: private:
// Native data // Native data
PluginHandle fHandle;
HostDescriptor fHost;
const PluginDescriptor* const fDescriptor;
LV2_Program_Descriptor fProgramDesc;
NativePluginHandle fHandle;
NativeHostDescriptor fHost;
const NativePluginDescriptor* const fDescriptor;
LV2_Program_Descriptor fProgramDesc;


uint32_t fMidiEventCount;
MidiEvent fMidiEvents[kMaxMidiEvents*2];
TimeInfo fTimeInfo;
uint32_t fMidiEventCount;
NativeMidiEvent fMidiEvents[kMaxMidiEvents*2];
NativeTimeInfo fTimeInfo;


bool fUiWasShown; bool fUiWasShown;
bool fIsProcessing; bool fIsProcessing;
@@ -959,7 +959,7 @@ private:
} }
} }


void init(const PluginDescriptor* const desc, PluginHandle handle)
void init(const NativePluginDescriptor* const desc, NativePluginHandle handle)
{ {
CARLA_SAFE_ASSERT_RETURN(desc != nullptr && handle != nullptr,) CARLA_SAFE_ASSERT_RETURN(desc != nullptr && handle != nullptr,)


@@ -1018,7 +1018,7 @@ private:
} }
} }


void connectPort(const PluginDescriptor* const desc, const uint32_t port, void* const dataLocation)
void connectPort(const NativePluginDescriptor* const desc, const uint32_t port, void* const dataLocation)
{ {
uint32_t index = 0; uint32_t index = 0;


@@ -1109,57 +1109,57 @@ private:


#define handlePtr ((NativePlugin*)handle) #define handlePtr ((NativePlugin*)handle)


static uint32_t host_get_buffer_size(HostHandle handle)
static uint32_t host_get_buffer_size(NativeHostHandle handle)
{ {
return handlePtr->handleGetBufferSize(); return handlePtr->handleGetBufferSize();
} }


static double host_get_sample_rate(HostHandle handle)
static double host_get_sample_rate(NativeHostHandle handle)
{ {
return handlePtr->handleGetSampleRate(); return handlePtr->handleGetSampleRate();
} }


static bool host_is_offline(HostHandle handle)
static bool host_is_offline(NativeHostHandle handle)
{ {
return handlePtr->handleIsOffline(); return handlePtr->handleIsOffline();
} }


static const TimeInfo* host_get_time_info(HostHandle handle)
static const NativeTimeInfo* host_get_time_info(NativeHostHandle handle)
{ {
return handlePtr->handleGetTimeInfo(); return handlePtr->handleGetTimeInfo();
} }


static bool host_write_midi_event(HostHandle handle, const ::MidiEvent* event)
static bool host_write_midi_event(NativeHostHandle handle, const NativeMidiEvent* event)
{ {
return handlePtr->handleWriteMidiEvent(event); return handlePtr->handleWriteMidiEvent(event);
} }


static void host_ui_parameter_changed(HostHandle handle, uint32_t index, float value)
static void host_ui_parameter_changed(NativeHostHandle handle, uint32_t index, float value)
{ {
handlePtr->handleUiParameterChanged(index, value); handlePtr->handleUiParameterChanged(index, value);
} }


static void host_ui_custom_data_changed(HostHandle handle, const char* key, const char* value)
static void host_ui_custom_data_changed(NativeHostHandle handle, const char* key, const char* value)
{ {
handlePtr->handleUiCustomDataChanged(key, value); handlePtr->handleUiCustomDataChanged(key, value);
} }


static void host_ui_closed(HostHandle handle)
static void host_ui_closed(NativeHostHandle handle)
{ {
handlePtr->handleUiClosed(); handlePtr->handleUiClosed();
} }


static const char* host_ui_open_file(HostHandle handle, bool isDir, const char* title, const char* filter)
static const char* host_ui_open_file(NativeHostHandle handle, bool isDir, const char* title, const char* filter)
{ {
return handlePtr->handleUiOpenFile(isDir, title, filter); return handlePtr->handleUiOpenFile(isDir, title, filter);
} }


static const char* host_ui_save_file(HostHandle handle, bool isDir, const char* title, const char* filter)
static const char* host_ui_save_file(NativeHostHandle handle, bool isDir, const char* title, const char* filter)
{ {
return handlePtr->handleUiSaveFile(isDir, title, filter); return handlePtr->handleUiSaveFile(isDir, title, filter);
} }


static intptr_t host_dispatcher(HostHandle handle, HostDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt)
static intptr_t host_dispatcher(NativeHostHandle handle, NativeHostDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt)
{ {
return handlePtr->handleDispatcher(opcode, index, value, ptr, opt); return handlePtr->handleDispatcher(opcode, index, value, ptr, opt);
} }
@@ -1176,8 +1176,8 @@ static LV2_Handle lv2_instantiate(const LV2_Descriptor* lv2Descriptor, double sa
{ {
carla_debug("lv2_instantiate(%p, %g, %s, %p)", lv2Descriptor, sampleRate, bundlePath, features); carla_debug("lv2_instantiate(%p, %g, %s, %p)", lv2Descriptor, sampleRate, bundlePath, features);


const PluginDescriptor* pluginDesc = nullptr;
const char* pluginLabel = nullptr;
const NativePluginDescriptor* pluginDesc = nullptr;
const char* pluginLabel = nullptr;


if (std::strncmp(lv2Descriptor->URI, "http://kxstudio.sf.net/carla/plugins/", 37) == 0) if (std::strncmp(lv2Descriptor->URI, "http://kxstudio.sf.net/carla/plugins/", 37) == 0)
pluginLabel = lv2Descriptor->URI+37; pluginLabel = lv2Descriptor->URI+37;
@@ -1192,9 +1192,9 @@ static LV2_Handle lv2_instantiate(const LV2_Descriptor* lv2Descriptor, double sa


carla_debug("lv2_instantiate() - looking up label \"%s\"", pluginLabel); carla_debug("lv2_instantiate() - looking up label \"%s\"", pluginLabel);


for (NonRtList<const PluginDescriptor*>::Itenerator it = sPluginDescsMgr.descs.begin(); it.valid(); it.next())
for (List<const NativePluginDescriptor*>::Itenerator it = sPluginDescsMgr.descs.begin(); it.valid(); it.next())
{ {
const PluginDescriptor*& tmpDesc(*it);
const NativePluginDescriptor*& tmpDesc(*it);


if (std::strcmp(tmpDesc->label, pluginLabel) == 0) if (std::strcmp(tmpDesc->label, pluginLabel) == 0)
{ {
@@ -1395,7 +1395,7 @@ const LV2_Descriptor* lv2_descriptor(uint32_t index)
return sPluginDescsMgr.lv2Descs.getAt(index); return sPluginDescsMgr.lv2Descs.getAt(index);
} }


const PluginDescriptor*& pluginDesc(sPluginDescsMgr.descs.getAt(index));
const NativePluginDescriptor*& pluginDesc(sPluginDescsMgr.descs.getAt(index));


CarlaString tmpURI; CarlaString tmpURI;




Loading…
Cancel
Save