From a00bfddfdf76185293cf947c742ecc9dbaf4d7f6 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 7 Aug 2011 13:50:01 +0100 Subject: [PATCH] Fix crash when host does not support midi-in; Add missing file --- {demo.lv2 => demo/Build}/Juce_Demo_Plugin.make | 28 +++++++++++----------- demo/Build/Makefile | 4 ++-- demo/Build/premake.lua | 4 ++-- .../audio/plugin_client/LV2/juce_LV2_Wrapper.cpp | 20 +++++++++------- 4 files changed, 29 insertions(+), 27 deletions(-) rename {demo.lv2 => demo/Build}/Juce_Demo_Plugin.make (98%) diff --git a/demo.lv2/Juce_Demo_Plugin.make b/demo/Build/Juce_Demo_Plugin.make similarity index 98% rename from demo.lv2/Juce_Demo_Plugin.make rename to demo/Build/Juce_Demo_Plugin.make index 288f5ed..162b858 100644 --- a/demo.lv2/Juce_Demo_Plugin.make +++ b/demo/Build/Juce_Demo_Plugin.make @@ -2,39 +2,39 @@ # Don't edit this file! Instead edit `premake.lua` then rerun `make` ifndef CONFIG - CONFIG=Release + CONFIG=Debug endif # if multiple archs are defined turn off automated dependency generation DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD) -ifeq ($(CONFIG),Release) +ifeq ($(CONFIG),Debug) BINDIR := . LIBDIR := . - OBJDIR := ./intermediate/Juce_Demo_Plugin_Release + OBJDIR := ./intermediate/Juce_Demo_Plugin_Debug OUTDIR := . - CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCE_ALSA=0" -D "JucePlugin_Build_LV2=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../juce/source" -I "../JuceLibraryCode" -I "../Source" - CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -fPIC -O2 -march=native -Os -fPIC -fvisibility=hidden + CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCE_ALSA=0" -D "JucePlugin_Build_LV2=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../juce/source" -I "../JuceLibraryCode" -I "../Source" + CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -fPIC -g -march=native -ggdb -O0 -fPIC -fvisibility=hidden CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -s -L"/usr/X11R6/lib/" -L"../.." -lfreetype -lpthread -lrt -lX11 -lGL -ljuce + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -L"/usr/X11R6/lib/" -L"../.." -lfreetype -lpthread -lrt -lX11 -lGL -ljuce_debug LDDEPS := - RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCE_ALSA=0" -D "JucePlugin_Build_LV2=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../juce/source" -I "../JuceLibraryCode" -I "../Source" + RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCE_ALSA=0" -D "JucePlugin_Build_LV2=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../juce/source" -I "../JuceLibraryCode" -I "../Source" TARGET := libJuce_Demo_Plugin.so BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) endif -ifeq ($(CONFIG),Debug) +ifeq ($(CONFIG),Release) BINDIR := . LIBDIR := . - OBJDIR := ./intermediate/Juce_Demo_Plugin_Debug + OBJDIR := ./intermediate/Juce_Demo_Plugin_Release OUTDIR := . - CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCE_ALSA=0" -D "JucePlugin_Build_LV2=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../juce/source" -I "../JuceLibraryCode" -I "../Source" - CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -fPIC -g -march=native -ggdb -O0 -fPIC -fvisibility=hidden + CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCE_ALSA=0" -D "JucePlugin_Build_LV2=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../juce/source" -I "../JuceLibraryCode" -I "../Source" + CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -fPIC -O2 -march=native -Os -fPIC -fvisibility=hidden CXXFLAGS += $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -L"/usr/X11R6/lib/" -L"../.." -lfreetype -lpthread -lrt -lX11 -lGL -ljuce_debug + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -s -L"/usr/X11R6/lib/" -L"../.." -lfreetype -lpthread -lrt -lX11 -lGL -ljuce LDDEPS := - RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCE_ALSA=0" -D "JucePlugin_Build_LV2=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../juce/source" -I "../JuceLibraryCode" -I "../Source" - TARGET := libJuce_Demo_Plugin_debug.so + RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCE_ALSA=0" -D "JucePlugin_Build_LV2=1" -I "/usr/include" -I "/usr/include/freetype2" -I "../../juce/source" -I "../JuceLibraryCode" -I "../Source" + TARGET := libJuce_Demo_Plugin.so BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) endif diff --git a/demo/Build/Makefile b/demo/Build/Makefile index 92d6c56..425fe59 100644 --- a/demo/Build/Makefile +++ b/demo/Build/Makefile @@ -1,10 +1,10 @@ # Makefile autogenerated by premake # Don't edit this file! Instead edit `premake.lua` then rerun `make` # Options: -# CONFIG=[Release|Debug] +# CONFIG=[Debug|Release] ifndef CONFIG - CONFIG=Release + CONFIG=Debug endif export CONFIG diff --git a/demo/Build/premake.lua b/demo/Build/premake.lua index 97d97e5..0921747 100644 --- a/demo/Build/premake.lua +++ b/demo/Build/premake.lua @@ -3,7 +3,7 @@ project.name = "Juce_Demo_Plugin" project.bindir = "." project.libdir = project.bindir -project.configs = { "Release", "Debug" } +project.configs = { "Debug", "Release" } package = newpackage() package.name = project.name @@ -22,7 +22,7 @@ package.config["Release"].buildoptions = { "-march=native -Os -fPIC -fvisibil package.config["Release"].defines = { "LINUX=1", "NDEBUG=1", "JUCE_ALSA=0", "JucePlugin_Build_LV2=1" } package.config["Release"].links = { "freetype", "pthread", "rt", "X11", "GL", "juce" } -package.config["Debug"].target = project.name .. "_debug" +package.config["Debug"].target = project.name package.config["Debug"].objdir = package.objdir .. "/" .. project.name .. "_Debug" package.config["Debug"].buildoptions = { "-march=native -ggdb -O0 -fPIC -fvisibility=hidden" } package.config["Debug"].defines = { "LINUX=1", "DEBUG=1", "_DEBUG=1", "JUCE_ALSA=0", "JucePlugin_Build_LV2=1" } diff --git a/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp b/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp index aa47bec..d90420a 100644 --- a/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp +++ b/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp @@ -369,7 +369,6 @@ public: port_count (0) { printf("JuceLV2Wrapper()\n"); - initialiseJuce_GUI(); filter = createPluginFilter(); jassert(filter != nullptr); @@ -619,16 +618,19 @@ public: } // LV2 MIDI Input - LV2_Event_Iterator iter; - lv2_event_begin(&iter, port_min); + if (port_min != nullptr) + { + LV2_Event_Iterator iter; + lv2_event_begin(&iter, port_min); - lv2_event_buffer_reset(port_min, LV2_EVENT_AUDIO_STAMP, (uint8_t*)(port_min + 1)); + lv2_event_buffer_reset(port_min, LV2_EVENT_AUDIO_STAMP, (uint8_t*)(port_min + 1)); - for (uint32_t i=0; i < iter.buf->event_count; ++i) { - uint8_t* data; - LV2_Event* ev = lv2_event_get(&iter, &data); - midiEvents.addEvent(data, ev->size, ev->frames); - lv2_event_increment(&iter); + for (uint32_t i=0; i < iter.buf->event_count; ++i) { + uint8_t* data; + LV2_Event* ev = lv2_event_get(&iter, &data); + midiEvents.addEvent(data, ev->size, ev->frames); + lv2_event_increment(&iter); + } } for (; i < numIn; ++i) -- 2.11.4.GIT