diff --git a/source/Makefile.mk b/source/Makefile.mk index f18961c84..dc3fd9301 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -55,7 +55,7 @@ BUILD_CXX_FLAGS += -DVESTIGE_HEADER HAVE_JACK = $(shell pkg-config --exists jack && echo true) HAVE_AF_DEPS = $(shell pkg-config --exists libavcodec libavformat sndfile && echo true) -HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml && echo true) +HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true) ifeq ($(HAVE_JACK),true) HAVE_JACK_LATENCY = $(shell pkg-config --atleast-version=0.121.0 jack && echo true) diff --git a/source/backend/native/Makefile b/source/backend/native/Makefile index 63bbe7401..7afe99df3 100644 --- a/source/backend/native/Makefile +++ b/source/backend/native/Makefile @@ -19,8 +19,8 @@ endif ifeq ($(HAVE_ZYN_DEPS),true) ZYN_CXX_FLAGS = $(BUILD_CXX_FLAGS) -ZYN_CXX_FLAGS += $(shell pkg-config --cflags fftw3 mxml) -LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml) +ZYN_CXX_FLAGS += $(shell pkg-config --cflags fftw3 mxml zlib) +LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib) endif # -------------------------------------------------------------- @@ -35,11 +35,11 @@ OBJS = \ nekofilter.c.o # DISTRHO plugins -# OBJS += \ -# distrho-3bandeq.cpp.o \ -# distrho-3bandsplitter.cpp.o \ -# distrho-pingpongpan.cpp.o \ -# distrho-notes.cpp.o +OBJS += \ + distrho-3bandeq.cpp.o \ + distrho-3bandsplitter.cpp.o \ + distrho-pingpongpan.cpp.o \ + distrho-notes.cpp.o # AudioFile ifeq ($(HAVE_AF_DEPS),true) diff --git a/source/backend/native/zynaddsubfx.cpp b/source/backend/native/zynaddsubfx.cpp index aca4729b0..36afe9b7f 100644 --- a/source/backend/native/zynaddsubfx.cpp +++ b/source/backend/native/zynaddsubfx.cpp @@ -22,12 +22,15 @@ #include "CarlaNative.hpp" #include "CarlaMIDI.h" #include "CarlaString.hpp" +#include "RtList.hpp" #include "zynaddsubfx/Misc/Master.h" #include "zynaddsubfx/Misc/Util.h" #include +// TODO - free sPrograms + // Dummy variables and functions for linking purposes class WavFile; namespace Nio { @@ -53,29 +56,7 @@ public: kMaster(new Master()), kSampleRate(getSampleRate()) { -#if 0 - // refresh banks - kMaster->bank.rescanforbanks(); - - for (uint32_t i=0, size = kMaster->bank.banks.size(); i < size; i++) - { - if (kMaster->bank.banks[i].dir.empty()) - continue; - - kMaster->bank.loadbank(kMaster->bank.banks[i].dir); - - for (unsigned int instrument = 0; instrument < BANK_SIZE; instrument++) - { - const std::string insName(kMaster->bank.getname(instrument)); - - if (insName.empty() || insName[0] == '\0' || insName[0] == ' ') - continue; - - ProgramInfo pInfo(i, instrument, insName.c_str()); - fPrograms.push_back(pInfo); - } - } -#endif + _maybeInitPrograms(kMaster); } ~ZynAddSubFxPlugin() @@ -84,8 +65,6 @@ public: pthread_mutex_lock(&kMaster->mutex); pthread_mutex_unlock(&kMaster->mutex); - fPrograms.clear(); - delete kMaster; } @@ -150,22 +129,22 @@ protected: uint32_t getMidiProgramCount() { - return fPrograms.size(); + return sPrograms.count(); } const MidiProgram* getMidiProgramInfo(const uint32_t index) { CARLA_ASSERT(index < getMidiProgramCount()); - if (index >= fPrograms.size()) + if (index >= sPrograms.count()) return nullptr; - const ProgramInfo& pInfo(fPrograms[index]); + const ProgramInfo* const pInfo(sPrograms.getAt(index)); static MidiProgram midiProgram; - midiProgram.bank = pInfo.bank; - midiProgram.program = pInfo.prog; - midiProgram.name = pInfo.name; + midiProgram.bank = pInfo->bank; + midiProgram.program = pInfo->prog; + midiProgram.name = pInfo->name; return &midiProgram; } @@ -224,13 +203,6 @@ protected: return; } - if (frames != 1024) - carla_stdout("ZYN process(%p, %i, %i, %p)", outBuffer, frames, midiEventCount, midiEvents); - -#if 0 - carla_zeroFloat(outBuffer[0], frames); - carla_zeroFloat(outBuffer[1], frames); -#else for (uint32_t i=0; i < midiEventCount; i++) { const MidiEvent* const midiEvent = &midiEvents[i]; @@ -261,7 +233,6 @@ protected: } kMaster->GetAudioOutSamples(frames, kSampleRate, outBuffer[0], outBuffer[1]); -#endif pthread_mutex_unlock(&kMaster->mutex); } @@ -272,23 +243,33 @@ private: struct ProgramInfo { uint32_t bank; uint32_t prog; - CarlaString name; + const char* name; ProgramInfo(uint32_t bank_, uint32_t prog_, const char* name_) : bank(bank_), prog(prog_), - name(name_) {} + name(carla_strdup(name_)) {} + + ~ProgramInfo() + { + if (name != nullptr) + { + delete[] name; + name = nullptr; + } + } ProgramInfo() = delete; + ProgramInfo(ProgramInfo&) = delete; + ProgramInfo(const ProgramInfo&) = delete; }; - std::vector fPrograms; - Master* const kMaster; const unsigned kSampleRate; public: static int sInstanceCount; + static NonRtList sPrograms; static PluginHandle _instantiate(const PluginDescriptor*, HostDescriptor* host) { @@ -327,10 +308,44 @@ public: } } + static void _maybeInitPrograms(Master* const master) + { + static bool doSearch = true; + + if (! doSearch) + return; + + doSearch = false; + +#if 0 + // refresh banks + master->bank.rescanforbanks(); + + for (uint32_t i=0, size = master->bank.banks.size(); i < size; i++) + { + if (master->bank.banks[i].dir.empty()) + continue; + + master->bank.loadbank(master->bank.banks[i].dir); + + for (unsigned int instrument = 0; instrument < BANK_SIZE; instrument++) + { + const std::string insName(master->bank.getname(instrument)); + + if (insName.empty() || insName[0] == '\0' || insName[0] == ' ') + continue; + + sPrograms.append(new ProgramInfo(i, instrument, insName.c_str())); + } + } +#endif + } + CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ZynAddSubFxPlugin) }; int ZynAddSubFxPlugin::sInstanceCount = 0; +NonRtList ZynAddSubFxPlugin::sPrograms; // ----------------------------------------------------------------------- diff --git a/source/backend/plugin/NativePlugin.cpp b/source/backend/plugin/NativePlugin.cpp index 86e4e4d13..5ad5c600b 100644 --- a/source/backend/plugin/NativePlugin.cpp +++ b/source/backend/plugin/NativePlugin.cpp @@ -33,13 +33,11 @@ void carla_register_all_plugins() carla_register_native_plugin_midiTranspose(); carla_register_native_plugin_nekofilter(); -#ifndef BUILD_BRIDGE // DISTRHO plugins carla_register_native_plugin_3BandEQ(); carla_register_native_plugin_3BandSplitter(); carla_register_native_plugin_PingPongPan(); carla_register_native_plugin_Notes(); -#endif #ifdef WANT_AUDIOFILE // AudioFile diff --git a/source/backend/standalone/Makefile b/source/backend/standalone/Makefile index b5cd5c414..dde7f4f15 100644 --- a/source/backend/standalone/Makefile +++ b/source/backend/standalone/Makefile @@ -9,7 +9,8 @@ include ../Makefile.mk # -------------------------------------------------------------- # Common -LINK_FLAGS += $(shell pkg-config --libs gl liblo QtCore QtGui QtXml) +LINK_FLAGS += $(shell pkg-config --libs gl liblo QtCore QtXml) +LINK_FLAGS += -X11 # -------------------------------------------------------------- # Engine @@ -37,11 +38,13 @@ endif # -------------------------------------------------------------- # Native +LINK_FLAGS += $(shell pkg-config --libs QtGui) + ifeq ($(HAVE_AF_DEPS),true) LINK_FLAGS += $(shell pkg-config --libs libavcodec libavformat sndfile) endif ifeq ($(HAVE_ZYN_DEPS),true) -LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml) +LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml zlib) endif # -------------------------------------------------------------- diff --git a/source/bridges/CarlaBridgePlugin.cpp b/source/bridges/CarlaBridgePlugin.cpp index ad0d76351..58f76cd6e 100644 --- a/source/bridges/CarlaBridgePlugin.cpp +++ b/source/bridges/CarlaBridgePlugin.cpp @@ -436,7 +436,6 @@ int main(int argc, char* argv[]) { CARLA_BRIDGE_USE_NAMESPACE -#if 0 if (argc != 6) { carla_stdout("usage: %s