diff --git a/source/Makefile.mk b/source/Makefile.mk index 97e80e2d4..d72c79085 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -80,26 +80,14 @@ endif # -------------------------------------------------------------- # Check for required libs +# liblo always required ifneq ($(shell pkg-config --exists liblo && echo true),true) $(error liblo missing, cannot continue) 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 +# Qt5 always required +ifneq ($(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true),true) +$(error liblo missing, cannot continue) endif # -------------------------------------------------------------- @@ -111,14 +99,18 @@ ifeq ($(LINUX),true) HAVE_ALSA = $(shell pkg-config --exists alsa && echo true) HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true) HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true) +HAVE_OPENGL = $(shell pkg-config --exists gl && echo true) HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true) HAVE_QT4 = $(shell pkg-config --exists QtCore QtGui && echo true) -HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Gui Qt5Widgets && echo true) -HAVE_OPENGL = $(shell pkg-config --exists gl && echo true) else HAVE_OPENGL = true endif +ifeq ($(CARLA_CSOUND_SUPPORT),true) +# FIXME ? +HAVE_CSOUND = $(shell pkg-config --exists sndfile && echo true) +endif + ifeq ($(CARLA_SAMPLERS_SUPPORT),true) HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true) HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true) @@ -130,7 +122,26 @@ endif HAVE_AF_DEPS = $(shell pkg-config --exists sndfile && echo true) HAVE_MF_DEPS = $(shell pkg-config --exists smf && echo true) HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true) -HAVE_ZYN_UI_DEPS = $(shell pkg-config --exists ntk ntk_images && echo true) +HAVE_ZYN_UI_DEPS = $(shell pkg-config --exists ntk_images ntk && echo true) + +# -------------------------------------------------------------- +# Check for juce support + +ifeq ($(HAIKU),true) +HAVE_JUCE = false +endif + +ifeq ($(LINUX),true) +HAVE_JUCE = $(shell pkg-config --exists x11 xinerama xext xcursor freetype2 && echo true) +endif + +ifeq ($(MACOS),true) +HAVE_JUCE = true +endif + +ifeq ($(WIN32),true) +HAVE_JUCE = true +endif # -------------------------------------------------------------- # Set libs stuff @@ -144,12 +155,16 @@ endif RTMEMPOOL_LIBS = -lpthread +ifeq ($(HAIKU),true) +endif + ifeq ($(LINUX),true) ifeq ($(HAVE_OPENGL),true) DGL_FLAGS = $(shell pkg-config --cflags gl x11) DGL_LIBS = $(shell pkg-config --libs gl x11) endif JACKBRIDGE_LIBS = -ldl -lpthread -lrt +ifeq ($(HAVE_JUCE),true) JUCE_CORE_LIBS = -ldl -lpthread -lrt JUCE_EVENTS_FLAGS = $(shell pkg-config --cflags x11) JUCE_EVENTS_LIBS = $(shell pkg-config --libs x11) @@ -157,7 +172,10 @@ JUCE_GRAPHICS_FLAGS = $(shell pkg-config --cflags x11 xinerama xext freetyp 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 +endif LILV_LIBS = -ldl -lm -lrt +QTCORE_FLAGS = $(shell pkg-config --cflags Qt5Core) +QTCORE_LIBS = $(shell pkg-config --libs Qt5Core) ifeq ($(HAVE_ALSA),true) RTAUDIO_FLAGS += $(shell pkg-config --cflags alsa) -D__LINUX_ALSA__ RTAUDIO_LIBS += $(shell pkg-config --libs alsa) -lpthread @@ -180,6 +198,7 @@ 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 +QTCORE_LIBS = -framework Qt5Core RTAUDIO_FLAGS += -D__MACOSX_CORE__ RTAUDIO_LIBS += -lpthread RTMIDI_FLAGS += -D__MACOSX_CORE__ @@ -194,6 +213,8 @@ JUCE_EVENTS_LIBS = -lole32 JUCE_GRAPHICS_LIBS = -lgdi32 JUCE_GUI_BASICS_LIBS = -lgdi32 -limm32 -lcomdlg32 -lole32 LILV_LIBS = -lm +QTCORE_FLAGS = $(shell pkg-config --cflags Qt5Core) +QTCORE_LIBS = $(shell pkg-config --libs Qt5Core) RTAUDIO_FLAGS += -D__WINDOWS_ASIO__ -D__WINDOWS_DS__ RTAUDIO_LIBS += -lpthread RTMIDI_FLAGS += -D__WINDOWS_MM__ diff --git a/source/backend/Makefile.mk b/source/backend/Makefile.mk index f54bcaf84..8dd8a4e39 100644 --- a/source/backend/Makefile.mk +++ b/source/backend/Makefile.mk @@ -9,6 +9,18 @@ include ../../Makefile.mk # -------------------------------------------------------------- BUILD_CXX_FLAGS += -I. -I.. -I../../includes -I../../modules -I../../utils +BUILD_CXX_FLAGS += $(QTCORE_FLAGS) + +ifeq ($(HAVE_FFMPEG),true) +BUILD_CXX_FLAGS += -DHAVE_FFMPEG +endif + +ifeq ($(HAVE_JUCE),true) +# BUILD_CXX_FLAGS += -DHAVE_JUCE +endif + +# -------------------------------------------------------------- + BUILD_CXX_FLAGS += -DWANT_NATIVE ifeq ($(CARLA_PLUGIN_SUPPORT),true) @@ -18,12 +30,12 @@ BUILD_CXX_FLAGS += -DVESTIGE_HEADER endif endif -ifeq ($(CARLA_CSOUND_SUPPORT),true) +# -------------------------------------------------------------- + +ifeq ($(HAVE_CSOUND),true) BUILD_CXX_FLAGS += -DWANT_CSOUND endif -# -------------------------------------------------------------- - ifeq ($(HAVE_FLUIDSYNTH),true) BUILD_CXX_FLAGS += -DWANT_FLUIDSYNTH endif @@ -36,9 +48,6 @@ endif ifeq ($(HAVE_AF_DEPS),true) BUILD_CXX_FLAGS += -DWANT_AUDIOFILE -ifeq ($(HAVE_FFMPEG),true) -BUILD_CXX_FLAGS += -DHAVE_FFMPEG -endif endif ifeq ($(HAVE_MF_DEPS),true) diff --git a/source/backend/standalone/CarlaStandalone.cpp b/source/backend/standalone/CarlaStandalone.cpp index d638fb4f5..9a31d289b 100644 --- a/source/backend/standalone/CarlaStandalone.cpp +++ b/source/backend/standalone/CarlaStandalone.cpp @@ -19,14 +19,17 @@ // Check carla_stderr2("Engine is not running"); <= prepend func name and args #include "CarlaHost.h" +#include "CarlaNative.h" + #include "CarlaEngine.hpp" #include "CarlaPlugin.hpp" #include "CarlaBackendUtils.hpp" -//#include "CarlaOscUtils.hpp" -#include "CarlaNative.h" +#include "CarlaThread.hpp" + +#include -#ifdef USE_JUCE +#ifdef HAVE_JUCE # include "juce_gui_basics.h" using juce::initialiseJuce_GUI; using juce::shutdownJuce_GUI; @@ -36,7 +39,7 @@ using juce::MessageManager; namespace CB = CarlaBackend; using CB::EngineOptions; -#ifdef USE_JUCE +#ifdef HAVE_JUCE // ----------------------------------------------------------------------- // Juce Message Thread @@ -107,7 +110,7 @@ struct CarlaBackendStandalone { CarlaString lastError; -#ifdef USE_JUCE +#ifdef HAVE_JUCE JuceMessageThread juceMsgThread; #endif @@ -130,12 +133,12 @@ struct CarlaBackendStandalone { ~CarlaBackendStandalone() { CARLA_ASSERT(engine == nullptr); -#ifdef USE_JUCE +#ifdef HAVE_JUCE CARLA_ASSERT(MessageManager::getInstanceWithoutCreating() == nullptr); #endif } -#ifdef USE_JUCE +#ifdef HAVE_JUCE void init() { JUCE_AUTORELEASEPOOL @@ -457,7 +460,7 @@ bool carla_engine_init(const char* driverName, const char* clientName) if (gStandalone.engine->init(clientName)) { gStandalone.lastError = "No error"; -#ifdef USE_JUCE +#ifdef HAVE_JUCE gStandalone.init(); #endif return true; @@ -514,7 +517,7 @@ bool carla_engine_init_bridge(const char audioBaseName[6+1], const char controlB if (gStandalone.engine->init(clientName)) { gStandalone.lastError = "No error"; -#ifdef USE_JUCE +#ifdef HAVE_JUCE gStandalone.init(); #endif return true; @@ -548,7 +551,7 @@ bool carla_engine_close() if (! closed) gStandalone.lastError = gStandalone.engine->getLastError(); -#ifdef USE_JUCE +#ifdef HAVE_JUCE gStandalone.close(); #endif @@ -693,7 +696,7 @@ const char* carla_file_callback(FileCallbackOpcode action, bool isDir, const cha { CARLA_SAFE_ASSERT_RETURN(title != nullptr && title[0] != '\0', nullptr); CARLA_SAFE_ASSERT_RETURN(filter != nullptr && filter[0] != '\0', nullptr); - carla_debug("carla_file_callback(%i:%s, %s, \"%s\", \"%s\")", action, FileCallbackOpcode2Str(action), bool2str(isDir), title, filter); + carla_debug("carla_file_callback(%i:%s, %s, \"%s\", \"%s\")", action, CB::FileCallbackOpcode2Str(action), bool2str(isDir), title, filter); if (gStandalone.fileCallback == nullptr) return nullptr; @@ -746,7 +749,7 @@ bool carla_save_project(const char* filename) bool carla_patchbay_connect(int portIdA, int portIdB) { - CARLA_SAFE_ASSERT_RETURN(portA != portB, false); + CARLA_SAFE_ASSERT_RETURN(portIdA != portIdB, false); carla_debug("carla_patchbay_connect(%i, %i)", portIdA, portIdB); if (gStandalone.engine != nullptr) @@ -1330,16 +1333,20 @@ const char* carla_get_chunk_data(uint pluginId) if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) { -#ifdef USE_JUCE - if (plugin->getOptions() & CB::PLUGIN_OPTION_USE_CHUNKS) + if (plugin->getOptionsEnabled() & CB::PLUGIN_OPTION_USE_CHUNKS) { void* data = nullptr; const int32_t dataSize(plugin->getChunkData(&data)); if (data != nullptr && dataSize > 0) { +#if 0 //def HAVE_JUCE juce::MemoryBlock memBlock(data, dataSize); chunkData = memBlock.toBase64Encoding().toRawUTF8(); +#else + QByteArray chunk(QByteArray((char*)data, dataSize).toBase64()); + chunkData = chunk.constData(); +#endif return (const char*)chunkData; } else @@ -1347,9 +1354,7 @@ const char* carla_get_chunk_data(uint pluginId) } else carla_stderr2("carla_get_chunk_data(%i) - plugin does not use chunks", pluginId); -#else - carla_stderr2("carla_get_chunk_data(%i) - unsupported", pluginId); -#endif + return nullptr; } @@ -1565,25 +1570,23 @@ float carla_get_current_parameter_value(uint pluginId, uint32_t parameterId) // ------------------------------------------------------------------------------------------------------------------- -float carla_get_input_peak_value(uint pluginId, unsigned short portId) +float carla_get_input_peak_value(uint pluginId, bool isLeft) { CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0.0f); - CARLA_SAFE_ASSERT_RETURN(portId == 1 || portId == 2, 0.0f); - return gStandalone.engine->getInputPeak(pluginId, portId); + return gStandalone.engine->getInputPeak(pluginId, isLeft); } -float carla_get_output_peak_value(uint pluginId, unsigned short portId) +float carla_get_output_peak_value(uint pluginId, bool isLeft) { CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, 0.0f); - CARLA_SAFE_ASSERT_RETURN(portId == 1 || portId == 2, 0.0f); - return gStandalone.engine->getOutputPeak(pluginId, portId); + return gStandalone.engine->getOutputPeak(pluginId, isLeft); } // ------------------------------------------------------------------------------------------------------------------- -void carla_set_option(uint pluginId, unsigned int option, bool yesNo) +void carla_set_option(uint pluginId, uint option, bool yesNo) { CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,); carla_debug("carla_set_option(%i, %i, %s)", pluginId, option, bool2str(yesNo)); @@ -1826,15 +1829,15 @@ void carla_send_midi_note(uint pluginId, uint8_t channel, uint8_t note, uint8_t } #endif -void carla_show_custom_ui(uint pluginId, bool yesno) +void carla_show_custom_ui(uint pluginId, bool yesNo) { CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,); - carla_debug("carla_show_custom_ui(%i, %s)", pluginId, bool2str(yesno)); + carla_debug("carla_show_custom_ui(%i, %s)", pluginId, bool2str(yesNo)); if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) - return plugin->showCustomUI(yesno); + return plugin->showCustomUI(yesNo); - carla_stderr2("carla_show_custom_ui(%i, %s) - could not find plugin", pluginId, bool2str(yesno)); + carla_stderr2("carla_show_custom_ui(%i, %s) - could not find plugin", pluginId, bool2str(yesNo)); } // ------------------------------------------------------------------------------------------------------------------- @@ -1895,7 +1898,18 @@ const char* carla_get_host_osc_url_udp() return gStandalone.engine->getOscServerPathUDP(); } +// ------------------------------------------------------------------------------------------------------------------- + +#if 0 +int main(int argc, char* argv[]) +{ + return 0; +} +#endif + #if 0 +//#include "CarlaOscUtils.hpp" + // ------------------------------------------------------------------------------------------------------------------- #define NSM_API_VERSION_MAJOR 1 diff --git a/source/discovery/Makefile b/source/discovery/Makefile index 0f5fe246c..7fef62a7d 100644 --- a/source/discovery/Makefile +++ b/source/discovery/Makefile @@ -9,17 +9,27 @@ include ../Makefile.mk # -------------------------------------------------------------- BUILD_CXX_FLAGS += -I../backend -I../includes -I../modules -I../utils +BUILD_CXX_FLAGS += $(QTCORE_FLAGS) +LINK_FLAGS += $(QTCORE_LIBS) + +# -------------------------------------------------------------- + BUILD_CXX_FLAGS += -DWANT_NATIVE ifeq ($(CARLA_PLUGIN_SUPPORT),true) -BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST +BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_VST ifeq ($(CARLA_VESTIGE_HEADER),true) BUILD_CXX_FLAGS += -DVESTIGE_HEADER endif endif -ifeq ($(CARLA_CSOUND_SUPPORT),true) -NATIVE_FLAGS += -DWANT_CSOUND +# -DWANT_DSSI -DWANT_LV2 + +# -------------------------------------------------------------- + +ifeq ($(HAVE_CSOUND),true) +NATIVE_FLAGS += $(shell pkg-config --cflags --libs sndfile) -lcsound64 -DWANT_CSOUND +NATIVE_FLAGS += $(JUCE_CORE_FLAGS) $(JUCE_CORE_LIBS) endif ifeq ($(HAVE_FLUIDSYNTH),true) @@ -27,14 +37,24 @@ NATIVE_FLAGS += $(shell pkg-config --cflags --libs fluidsynth) -DWANT_FLUIDSYNTH endif ifeq ($(HAVE_LINUXSAMPLER),true) -NATIVE_FLAGS += $(shell pkg-config --cflags --libs linuxsampler) -DWANT_LINUXSAMPLER +# NATIVE_FLAGS += $(shell pkg-config --cflags --libs linuxsampler) -DWANT_LINUXSAMPLER endif -LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) -LINK_FLAGS += $(JUCE_CORE_LIBS) - # -------------------------------------------------------------- +ifeq ($(CARLA_PLUGIN_SUPPORT),true) +LIBS = ../modules/lilv.a +LIBS_posix32 = ../modules/lilv.posix32.a +LIBS_posix64 = ../modules/lilv.posix64.a +LIBS_win32 = ../modules/lilv.win32.a +LIBS_win64 = ../modules/lilv.win64.a +LINK_FLAGS += $(LILV_LIBS) +endif + +ifeq ($(HAVE_CSOUND),true) +LIBS = ../modules/juce_core.a +endif + POSIX_BUILD_FLAGS = $(BUILD_CXX_FLAGS) POSIX_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32 -L/usr/lib/i386-linux-gnu POSIX_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu @@ -43,28 +63,7 @@ POSIX_LINK_FLAGS = $(LINK_FLAGS) -ldl WIN_BUILD_FLAGS = $(BUILD_CXX_FLAGS) WIN_32BIT_FLAGS = $(32BIT_FLAGS) WIN_64BIT_FLAGS = $(64BIT_FLAGS) -WIN_LINK_FLAGS = $(LINK_FLAGS) -lkernel32 - -LIBS = ../modules/juce_audio_basics.a -LIBS_posix32 = ../modules/juce_audio_basics.posix32.a -LIBS_posix64 = ../modules/juce_audio_basics.posix64.a -LIBS_win32 = ../modules/juce_audio_basics.win32.a -LIBS_win64 = ../modules/juce_audio_basics.win64.a - -LIBS += ../modules/juce_core.a -LIBS_posix32 += ../modules/juce_core.posix32.a -LIBS_posix64 += ../modules/juce_core.posix64.a -LIBS_win32 += ../modules/juce_core.win32.a -LIBS_win64 += ../modules/juce_core.win64.a - -ifeq ($(CARLA_PLUGIN_SUPPORT),true) -LIBS += ../modules/lilv.a -LIBS_posix32 += ../modules/lilv.posix32.a -LIBS_posix64 += ../modules/lilv.posix64.a -LIBS_win32 += ../modules/lilv.win32.a -LIBS_win64 += ../modules/lilv.win64.a -LINK_FLAGS += $(LILV_LIBS) -endif +WIN_LINK_FLAGS = $(LINK_FLAGS) OBJS = carla-discovery.cpp @@ -114,12 +113,6 @@ debug: .FORCE: .PHONY: .FORCE -../modules/juce_audio_basics.%.a: .FORCE - $(MAKE) -C ../modules juce_audio_basics_$* - -../modules/juce_core.%.a: .FORCE - $(MAKE) -C ../modules juce_core_$* - ../modules/lilv.%.a: .FORCE $(MAKE) -C ../modules lilv_$* diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index 44c351e32..95e32933f 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -27,27 +27,28 @@ # include "CarlaDssiUtils.hpp" #endif #ifdef WANT_LV2 +# include # include "CarlaLv2Utils.hpp" #endif #ifdef WANT_VST # include "CarlaVstUtils.hpp" #endif +#ifdef WANT_CSOUND +# include "juce_core.h" +# include +#endif #ifdef WANT_FLUIDSYNTH # include #endif #ifdef WANT_LINUXSAMPLER +# include # include "linuxsampler/EngineFactory.h" #endif -#include "juce_audio_basics.h" - #include #define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; -using juce::File; -using juce::FloatVectorOperations; - CARLA_BACKEND_USE_NAMESPACE // -------------------------------------------------------------------------- @@ -187,11 +188,7 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode timeInfo.timeSigDenominator = 4; timeInfo.flags |= kVstTimeSigValid; -#ifdef VESTIGE_HEADER - ret = getAddressFromPointer(&timeInfo); -#else - ret = ToVstPtr(&timeInfo); -#endif + ret = (intptr_t)&timeInfo; break; case DECLARE_VST_DEPRECATED(audioMasterTempoAt): @@ -355,13 +352,10 @@ public: DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); DISCOVERY_OUT("audio.outs", 2); - DISCOVERY_OUT("audio.total", 2); DISCOVERY_OUT("midi.ins", 1); - DISCOVERY_OUT("midi.total", 1); - DISCOVERY_OUT("programs.total", programs); //DISCOVERY_OUT("parameters.ins", 13); // defined in Carla, TODO //DISCOVERY_OUT("parameters.outs", 1); - //DISCOVERY_OUT("parameters.total", 14); + DISCOVERY_OUT("programs", programs); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("end", "------------"); } @@ -525,7 +519,7 @@ void do_ladspa_check(void*& libHandle, const char* const filename, const bool in if (LADSPA_IS_PORT_AUDIO(portDescriptor)) { - FloatVectorOperations::clear(bufferAudio[iA], kBufferSize); + carla_zeroFloat(bufferAudio[iA], kBufferSize); descriptor->connect_port(handle, j, bufferAudio[iA++]); } else if (LADSPA_IS_PORT_CONTROL(portDescriptor)) @@ -604,10 +598,8 @@ void do_ladspa_check(void*& libHandle, const char* const filename, const bool in DISCOVERY_OUT("hints", hints); DISCOVERY_OUT("audio.ins", audioIns); DISCOVERY_OUT("audio.outs", audioOuts); - DISCOVERY_OUT("audio.total", audioTotal); DISCOVERY_OUT("parameters.ins", parametersIns); DISCOVERY_OUT("parameters.outs", parametersOuts); - DISCOVERY_OUT("parameters.total", parametersTotal); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("end", "------------"); } @@ -718,11 +710,10 @@ void do_dssi_check(void*& libHandle, const char* const filename, const bool init int audioOuts = 0; int audioTotal = 0; int midiIns = 0; - int midiTotal = 0; int parametersIns = 0; int parametersOuts = 0; int parametersTotal = 0; - int programsTotal = 0; + int programs = 0; if (LADSPA_IS_HARD_RT_CAPABLE(ldescriptor->Properties)) hints |= PLUGIN_IS_RTSAFE; @@ -753,14 +744,14 @@ void do_dssi_check(void*& libHandle, const char* const filename, const bool init } if (descriptor->run_synth != nullptr || descriptor->run_multiple_synths != nullptr) - midiIns = midiTotal = 1; + midiIns = 1; if (midiIns > 0 && audioIns == 0 && audioOuts > 0) hints |= PLUGIN_IS_SYNTH; if (const char* const ui = find_dssi_ui(filename, ldescriptor->Label)) { - hints |= PLUGIN_HAS_GUI; + hints |= PLUGIN_HAS_CUSTOM_UI; delete[] ui; } @@ -790,7 +781,7 @@ void do_dssi_check(void*& libHandle, const char* const filename, const bool init if (descriptor->get_program != nullptr && descriptor->select_program != nullptr) { - while (descriptor->get_program(handle, programsTotal++)) + while (descriptor->get_program(handle, programs++)) continue; } @@ -806,7 +797,7 @@ void do_dssi_check(void*& libHandle, const char* const filename, const bool init if (LADSPA_IS_PORT_AUDIO(portDescriptor)) { - FloatVectorOperations::clear(bufferAudio[iA], kBufferSize); + carla_zeroFloat(bufferAudio[iA], kBufferSize); ldescriptor->connect_port(handle, j, bufferAudio[iA++]); } else if (LADSPA_IS_PORT_CONTROL(portDescriptor)) @@ -863,7 +854,7 @@ void do_dssi_check(void*& libHandle, const char* const filename, const bool init } // select first midi-program if available - if (programsTotal > 0) + if (programs > 0) { if (const DSSI_Program_Descriptor* const pDesc = descriptor->get_program(handle, 0)) descriptor->select_program(handle, pDesc->Bank, pDesc->Program); @@ -919,13 +910,10 @@ void do_dssi_check(void*& libHandle, const char* const filename, const bool init DISCOVERY_OUT("hints", hints); DISCOVERY_OUT("audio.ins", audioIns); DISCOVERY_OUT("audio.outs", audioOuts); - DISCOVERY_OUT("audio.total", audioTotal); DISCOVERY_OUT("midi.ins", midiIns); - DISCOVERY_OUT("midi.total", midiTotal); DISCOVERY_OUT("parameters.ins", parametersIns); DISCOVERY_OUT("parameters.outs", parametersOuts); - DISCOVERY_OUT("parameters.total", parametersTotal); - DISCOVERY_OUT("programs.total", programsTotal); + DISCOVERY_OUT("programs", programs); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("end", "------------"); } @@ -946,16 +934,12 @@ void do_lv2_check(const char* const bundle, const bool init) Lv2WorldClass& lv2World(Lv2WorldClass::getInstance()); // Convert bundle filename to URI - const size_t bundleSize(std::strlen(bundle)+8); - char bundleURI[bundleSize]; - std::strcpy(bundleURI, "file://"); - std::strcat(bundleURI, bundle); - - bundleURI[bundleSize-1] = OS_SEP; - bundleURI[bundleSize] = '\0'; + QString qBundle(QUrl::fromLocalFile(bundle).toString()); + if (! qBundle.endsWith(OS_SEP_STR)) + qBundle += OS_SEP_STR; // Load bundle - Lilv::Node lilvBundle(lv2World.new_uri(bundleURI)); + Lilv::Node lilvBundle(lv2World.new_uri(qBundle.toUtf8().constData())); lv2World.load_bundle(lilvBundle); // Load plugins in this bundle @@ -1058,17 +1042,14 @@ void do_lv2_check(const char* const bundle, const bool init) } } - int hints = 0; + int hints = 0x0; int audioIns = 0; int audioOuts = 0; - int audioTotal = 0; int midiIns = 0; int midiOuts = 0; - int midiTotal = 0; int parametersIns = 0; int parametersOuts = 0; - int parametersTotal = 0; - int programsTotal = rdfDescriptor->PresetCount; + int programs = rdfDescriptor->PresetCount; for (uint32_t j=0; j < rdfDescriptor->FeatureCount; ++j) { @@ -1088,8 +1069,6 @@ void do_lv2_check(const char* const bundle, const bool init) audioIns += 1; else if (LV2_IS_PORT_OUTPUT(rdfPort->Types)) audioOuts += 1; - - audioTotal += 1; } else if (LV2_IS_PORT_CONTROL(rdfPort->Types)) { @@ -1115,8 +1094,6 @@ void do_lv2_check(const char* const bundle, const bool init) parametersIns += 1; else if (LV2_IS_PORT_OUTPUT(rdfPort->Types)) parametersOuts += 1; - - parametersTotal += 1; } } else if (LV2_PORT_SUPPORTS_MIDI_EVENT(rdfPort->Types)) @@ -1125,8 +1102,6 @@ void do_lv2_check(const char* const bundle, const bool init) midiIns += 1; else if (LV2_IS_PORT_OUTPUT(rdfPort->Types)) midiOuts += 1; - - midiTotal += 1; } } @@ -1134,7 +1109,7 @@ void do_lv2_check(const char* const bundle, const bool init) hints |= PLUGIN_IS_SYNTH; if (rdfDescriptor->UICount > 0) - hints |= PLUGIN_HAS_GUI; + hints |= PLUGIN_HAS_CUSTOM_UI; DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("uri", rdfDescriptor->URI); @@ -1148,14 +1123,11 @@ void do_lv2_check(const char* const bundle, const bool init) DISCOVERY_OUT("hints", hints); DISCOVERY_OUT("audio.ins", audioIns); DISCOVERY_OUT("audio.outs", audioOuts); - DISCOVERY_OUT("audio.total", audioTotal); DISCOVERY_OUT("midi.ins", midiIns); DISCOVERY_OUT("midi.outs", midiOuts); - DISCOVERY_OUT("midi.total", midiTotal); DISCOVERY_OUT("parameters.ins", parametersIns); DISCOVERY_OUT("parameters.outs", parametersOuts); - DISCOVERY_OUT("parameters.total", parametersTotal); - DISCOVERY_OUT("programs.total", programsTotal); + DISCOVERY_OUT("programs", programs); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("end", "------------"); @@ -1255,16 +1227,13 @@ void do_vst_check(void*& libHandle, const bool init) int hints = 0x0; int audioIns = effect->numInputs; int audioOuts = effect->numOutputs; - int audioTotal = audioIns + audioOuts; int midiIns = 0; int midiOuts = 0; - int midiTotal = 0; - int parametersIns = effect->numParams; - int parametersTotal = parametersIns; - int programsTotal = effect->numPrograms; + int parameters = effect->numParams; + int programs = effect->numPrograms; if (effect->flags & effFlagsHasEditor) - hints |= PLUGIN_HAS_GUI; + hints |= PLUGIN_HAS_CUSTOM_UI; if (effect->flags & effFlagsIsSynth) hints |= PLUGIN_IS_SYNTH; @@ -1275,8 +1244,6 @@ void do_vst_check(void*& libHandle, const bool init) if (vstPluginCanDo(effect, "sendVstEvents") || vstPluginCanDo(effect, "sendVstMidiEvent")) midiOuts = 1; - midiTotal = midiIns + midiOuts; - // ----------------------------------------------------------------------- // start crash-free plugin test @@ -1295,21 +1262,20 @@ void do_vst_check(void*& libHandle, const bool init) if (midiIns == 0 && gVstWantsMidi) { midiIns = 1; - midiTotal = midiIns + midiOuts; } float* bufferAudioIn[audioIns]; for (int j=0; j < audioIns; ++j) { bufferAudioIn[j] = new float[kBufferSize]; - FloatVectorOperations::clear(bufferAudioIn[j], kBufferSize); + carla_zeroFloat(bufferAudioIn[j], kBufferSize); } float* bufferAudioOut[audioOuts]; for (int j=0; j < audioOuts; ++j) { bufferAudioOut[j] = new float[kBufferSize]; - FloatVectorOperations::clear(bufferAudioOut[j], kBufferSize); + carla_zeroFloat(bufferAudioOut[j], kBufferSize); } struct VstEventsFixed { @@ -1383,13 +1349,10 @@ void do_vst_check(void*& libHandle, const bool init) DISCOVERY_OUT("hints", hints); DISCOVERY_OUT("audio.ins", audioIns); DISCOVERY_OUT("audio.outs", audioOuts); - DISCOVERY_OUT("audio.total", audioTotal); DISCOVERY_OUT("midi.ins", midiIns); DISCOVERY_OUT("midi.outs", midiOuts); - DISCOVERY_OUT("midi.total", midiTotal); - DISCOVERY_OUT("parameters.ins", parametersIns); - DISCOVERY_OUT("parameters.total", parametersTotal); - DISCOVERY_OUT("programs.total", programsTotal); + DISCOVERY_OUT("parameters.ins", parameters); + DISCOVERY_OUT("programs", programs); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("end", "------------"); @@ -1424,6 +1387,389 @@ void do_vst_check(void*& libHandle, const bool init) #endif } +#ifdef WANT_CSOUND +static int csound_midiInOpen(CSOUND*, void**, const char*) { return 0; } +static int csound_midiRead(CSOUND*, void*, unsigned char*, int) { return 0; } +static int csound_midiInClose(CSOUND*, void*) { return 0; } + +static int csound_midiOutOpen(CSOUND*, void**, const char*) { return 0; } +static int csound_midiWrite(CSOUND*, void*, const unsigned char*, int) { return 0; } +static int csound_midiOutClose(CSOUND*, void*) { return 0; } + +#if 1//ndef DEBUG +static void csound_silence(CSOUND*, int, const char*, va_list) {} +#endif +#endif + +void do_csound_check(const char* const filename, const bool init) +{ +#ifdef WANT_CSOUND + Csound csound; +#if 1//ndef DEBUG + csound.SetMessageCallback(csound_silence); +#endif + csound.SetHostImplementedAudioIO(true, kBufferSize); + csound.SetHostImplementedMIDIIO(true); + csound.Reset(); + + csound.SetExternalMidiInOpenCallback(csound_midiInOpen); + csound.SetExternalMidiReadCallback(csound_midiRead); + csound.SetExternalMidiInCloseCallback(csound_midiInClose); + + csound.SetExternalMidiOutOpenCallback(csound_midiOutOpen); + csound.SetExternalMidiWriteCallback(csound_midiWrite); + csound.SetExternalMidiOutCloseCallback(csound_midiOutClose); + + if (csound.Compile(const_cast(filename)) != 0) + { + DISCOVERY_OUT("error", "csound failed to compile"); + return; + } + + csound.PerformKsmps(); + csound.SetScoreOffsetSeconds(0); + csound.RewindScore(); + + int hints = 0x0; + int audioIns = 0; + int audioOuts = 0; + int midiIns = 0; + int midiOuts = 0; + int parametersIns = 0; + int parametersOuts = 0; + int programs = 0; + + int numChannels; + controlChannelInfo_t* channelList; + + numChannels = csound.ListChannels(channelList); + + carla_stderr2("Num chan %i", numChannels); + + if (numChannels != 0 && channelList != nullptr) + { + for (int i=0; i < numChannels; ++i) + { + const controlChannelInfo_t& channel(channelList[i]); + + carla_stderr2("chan @%i, type %i", i, channel.type); + + if (channel.type & CSOUND_AUDIO_CHANNEL) + { + if (channel.type & CSOUND_INPUT_CHANNEL) + audioIns += 1; + else if (channel.type & CSOUND_OUTPUT_CHANNEL) + audioOuts += 1; + } + else if (channel.type & CSOUND_CONTROL_CHANNEL) + { + if (channel.type & CSOUND_INPUT_CHANNEL) + parametersIns += 1; + else if (channel.type & CSOUND_OUTPUT_CHANNEL) + parametersOuts += 1; + } + } + + csound.DeleteChannelList(channelList); + } + +#if 1 + using namespace juce; + + String plantFlag, presetFlag; + + File file(filename); + String source(file.loadFileAsString()); + + StringArray csdText; + int lines=1; + String csdLine(""); + csdText.addLines(source); + bool multiComment = false; + bool multiLine = false; + + // check for minimal Cabbage GUI + for (int i=0, _size=csdText.size(); i < _size; ++i) + { + if (csdText[i].indexOfWholeWordIgnoreCase(String("")) != -1) + break; + + // we don't enter for multitab, plants need to be created first + if (csdText[i].contains("multitab ")) + continue; + + if (csdText[i].trim().isNotEmpty()) + { + if (csdText[i].contains("), \\") || csdText[i].contains("),\\") || csdText[i].contains(") \\")) + { + multiLine = true; + csdLine=""; + lines=0; + + while (multiLine) + { + if (csdText[i+lines].contains("), \\") || csdText[i+lines].contains("),\\") || csdText[i+lines].contains(") \\")) + lines++; + else + multiLine=false; + } + + for (int y=0;y<=lines;y++) + csdLine = csdLine + " "+ csdText[i+y].trim()+" "; + + i=i+lines; + } + else + csdLine = csdText[i]; + + //tidy up string + csdLine = csdLine.trimStart(); + //csdLine = csdLine.removeCharacters(" \\"); + //csdLine = csdLine.removeCharacters(",\\"); + //Logger::writeToLog(csdLine); + StringArray tokes; + tokes.addTokens(csdLine.trimEnd(), ", ", "\""); + + if (tokes.getReference(0).containsIgnoreCase(String("/*"))) + { + multiComment = true; + } + if (tokes.getReference(0).containsIgnoreCase(String("*\\"))) + { + multiComment = false; + } + + if (tokes.getReference(0).containsIgnoreCase(String(";"))) + { + // allows for single line comments + } + else if (tokes.getReference(0).containsIgnoreCase(String("}"))) + { + plantFlag = ""; // reset plantFlag when a closing bracket is found + presetFlag = ""; + } + + if (! multiComment) + { + // populate the guiLayoutCtrls vector with non-interactive widgets + // the host widgets aren't GUI based but they can be added to this + // vector too, as can the editor button. + if (tokes.getReference(0).equalsIgnoreCase(String("form")) + || tokes.getReference(0).equalsIgnoreCase(String("image")) + || tokes.getReference(0).equalsIgnoreCase(String("keyboard")) + || tokes.getReference(0).equalsIgnoreCase(String("csoundoutput")) + || tokes.getReference(0).equalsIgnoreCase(String("line")) + || tokes.getReference(0).equalsIgnoreCase(String("label")) + || tokes.getReference(0).equalsIgnoreCase(String("hostbpm")) + || tokes.getReference(0).equalsIgnoreCase(String("hosttime")) + || tokes.getReference(0).equalsIgnoreCase(String("hostplaying")) + || tokes.getReference(0).equalsIgnoreCase(String("hostppqpos")) + || tokes.getReference(0).equalsIgnoreCase(String("vumeter")) + || tokes.getReference(0).equalsIgnoreCase(String("patmatrix")) + || tokes.getReference(0).equalsIgnoreCase(String("source")) + || tokes.getReference(0).equalsIgnoreCase(String("multitab")) + || tokes.getReference(0).equalsIgnoreCase(String("infobutton")) + || tokes.getReference(0).equalsIgnoreCase(String("filebutton")) + || tokes.getReference(0).equalsIgnoreCase(String("soundfiler")) + || tokes.getReference(0).equalsIgnoreCase(String("snapshot")) + || tokes.getReference(0).equalsIgnoreCase(String("table")) + || tokes.getReference(0).equalsIgnoreCase(String("pvsview")) + || tokes.getReference(0).equalsIgnoreCase(String("hostrecording")) + || tokes.getReference(0).equalsIgnoreCase(String("directorylist")) + || tokes.getReference(0).equalsIgnoreCase(String("transport")) + || tokes.getReference(0).equalsIgnoreCase(String("groupbox"))) + { +#if 0 + CabbageGUIClass cAttr(csdLine.trimEnd(), guiID); + + if (cAttr.getStringProp("native").length()>0) + { + //create generic plugin editor and break.. + setupNativePluginEditor(); + nativePluginEditor = true; + return; + } + + // showMessage(cAttr.getStringProp("type")); + csdLine = ""; + + // add soundfiler buffering sources + if (tokes.getReference(0).equalsIgnoreCase(String("soundfiler"))) + { + addSoundfilerSource(cAttr.getStringProp(("file")), cAttr.getChannels()); + Logger::writeToLog(String(audioSourcesArray.size()-1)); + cAttr.setNumProp("soundfilerIndex", audioSourcesArray.size()-1); + } + + // set up plant flag if needed for other widgets + if (cAttr.getStringProp(String("plant")).isNotEmpty()) + { + plantFlag = cAttr.getStringProp(String("plant")); + presetFlag = cAttr.getStringProp(String("preset")); + } + else if (cAttr.getStringProp(String("relToPlant")).equalsIgnoreCase(String(""))) + cAttr.setStringProp(String("relToPlant"), plantFlag); + + guiLayoutCtrls.add(cAttr); + + guiID++; + if (cAttr.getStringProp("type").containsIgnoreCase("form")) + if (cAttr.getStringProp("text").length()>2) + setPluginName(cAttr.getStringProp("text")); + else if(cAttr.getStringProp("caption").length()>2) + setPluginName(cAttr.getStringProp("caption")); + else + setPluginName("Untitled Cabbage Patch!"); + + //StringArray log = logGUIAttributes(cAttr, String("Non-Interactive")); + //debugMessageArray.addArray(logGUIAttributes(cAttr, String("Non-Interactive"))); + sendChangeMessage(); + + // if instrument uses any of the host widgets, or an xypad, turn + // on the timer + if (tokes.getReference(0).equalsIgnoreCase(String("hostbpm")) + ||tokes.getReference(0).equalsIgnoreCase(String("hosttime")) + ||tokes.getReference(0).equalsIgnoreCase(String("hostplaying")) + ||tokes.getReference(0).equalsIgnoreCase(String("hostppqpos")) + ||tokes.getReference(0).equalsIgnoreCase(String("hostrecording"))) + startTimer(20); +#endif + } + // populate the guiCtrls vector with interactive widgets + else if (tokes.getReference(0).equalsIgnoreCase(String("hslider")) + || tokes.getReference(0).equalsIgnoreCase(String("vslider")) + || tokes.getReference(0).equalsIgnoreCase(String("rslider")) + || tokes.getReference(0).equalsIgnoreCase(String("combobox")) + || tokes.getReference(0).equalsIgnoreCase(String("checkbox")) + || tokes.getReference(0).equalsIgnoreCase(String("xypad")) + || tokes.getReference(0).equalsIgnoreCase(String("button"))) + { +#if 0 + CabbageGUIClass cAttr(csdLine.trimEnd(), guiID); + csdLine = ""; + //Logger::writeToLog(tokes.getReference(0)); + // attach widget to plant if need be + if (cAttr.getStringProp(String("relToPlant")).equalsIgnoreCase(String(""))) + { + //showMessage(cAttr.getStringProp(String("relToPlant"))); + cAttr.setStringProp(String("relToPlant"), plantFlag); + //showMessage(String("presetFlag:")+presetFlag); + //showMessage(cAttr.getStringProp("name")); + if (cAttr.getStringProp("preset").length()<1) + cAttr.setStringProp(String("preset"), presetFlag.trim()); + //showMessage(cAttr.getStringProp("preset")); + } + + // xypad contain two control paramters, one for x axis and another for y. As such we add two + // to our contorl vector so that plugin hosts display two sliders. We name one of the xypad pads + // 'dummy' so that our editor doesn't display it. Our editor only needs to show one xypad. + if (tokes.getReference(0).equalsIgnoreCase(String("xypad"))) + { + cAttr.setStringProp(String("xyChannel"), String("X")); + cAttr.setNumProp("sliderRange", cAttr.getNumProp("xypadRangeX")); + cAttr.setNumProp("min", cAttr.getNumProp("minX")); + cAttr.setNumProp("max", cAttr.getNumProp("maxX")); + cAttr.setNumProp("value", cAttr.getNumProp("valueX")); + cAttr.setStringProp(String("channel"), cAttr.getStringProp("xChannel")); + guiCtrls.add(cAttr); + + cAttr.setStringProp(String("xyChannel"), String("Y")); + cAttr.setNumProp("sliderRange", cAttr.getNumProp("xypadRangeY")); + cAttr.setNumProp("min", cAttr.getNumProp("minY")); + cAttr.setNumProp("max", cAttr.getNumProp("maxY")); + cAttr.setNumProp("value", cAttr.getNumProp("valueY")); + cAttr.setStringProp(String("channel"), cAttr.getStringProp("yChannel")); + //append 'dummy' to name so the editor know not to display the + //second xypad + cAttr.setStringProp("name", cAttr.getStringProp("name")+String("dummy")); + guiCtrls.add(cAttr); + guiID++; + startTimer(20); + } + else + { + guiCtrls.add(cAttr); + guiID++; + } + + //debugMessageArray.addArray(logGUIAttributes(cAttr, String("Interactive"))); + sendChangeMessage(); +#endif + } + } + } + + } // end of scan through entire csd text, control vectors are now populated + + // create multitabs now that plants have been inserted to control vector.. + for (int i=0, _size=csdText.size(); i < _size; ++i) + { + if (csdText[i].contains("multitab ") && ! csdText[i].contains(";")) + { + csdLine = csdText[i]; + csdLine = csdLine.trimStart(); + StringArray tokes; + tokes.addTokens(csdLine.trimEnd(), ", ", "\""); + +#if 0 + if (tokes.getReference(0).equalsIgnoreCase(String("multitab"))) + { + CabbageGUIClass cAttr(csdLine.trimEnd(), guiID); + //showMessage(cAttr.getStringProp("type")); + csdLine = ""; + //set up plant flag if needed for other widgets + if(cAttr.getStringProp(String("plant")).isNotEmpty()){ + plantFlag = cAttr.getStringProp(String("plant")); + presetFlag = cAttr.getStringProp(String("preset")); + } + else if(cAttr.getStringProp(String("relToPlant")).equalsIgnoreCase(String(""))) + cAttr.setStringProp(String("relToPlant"), plantFlag); + guiLayoutCtrls.add(cAttr); + guiID++; + } +#endif + } + } // end of multitab check + +#if 0 + // init all channels with their init val + for(int i=0;iSetChannel( guiCtrls.getReference(i).getStringProp("channel").toUTF8(), guiCtrls.getReference(i).getNumProp("value")); + //Logger::writeToLog(guiCtrls.getReference(i).getStringProp("channel")+": "+String(guiCtrls.getReference(i).getNumProp("value"))); + } +#endif +#endif + + csound.Cleanup(); + csound.Reset(); + + DISCOVERY_OUT("init", "-----------"); +// DISCOVERY_OUT("name", (const char*)name); +// DISCOVERY_OUT("label", (const char*)label); +// DISCOVERY_OUT("maker", ""); +// DISCOVERY_OUT("copyright", ""); + DISCOVERY_OUT("hints", hints); + DISCOVERY_OUT("audio.ins", audioIns); + DISCOVERY_OUT("audio.outs", audioOuts); + DISCOVERY_OUT("midi.ins", midiIns); + DISCOVERY_OUT("midi.outs", midiOuts); + DISCOVERY_OUT("parameters.ins", parametersIns); + DISCOVERY_OUT("parameters.outs", parametersOuts); + DISCOVERY_OUT("programs", programs); + DISCOVERY_OUT("build", BINARY_NATIVE); + DISCOVERY_OUT("end", "------------"); + +#else + DISCOVERY_OUT("error", "csound support not available"); + return; + + // unused + (void)filename; + (void)init; +#endif +} + void do_fluidsynth_check(const char* const filename, const bool init) { #ifdef WANT_FLUIDSYNTH @@ -1460,13 +1806,8 @@ void do_fluidsynth_check(const char* const filename, const bool init) delete_fluid_settings(f_settings); } -#ifdef CARLA_OS_WIN - int sep = '\\'; -#else - int sep = '/'; -#endif - - CarlaString name(std::strrchr(filename, sep)+1); + // FIXME + CarlaString name(std::strrchr(filename, OS_SEP)+1); name.truncate(name.rfind('.')); CarlaString label(name); @@ -1479,13 +1820,10 @@ void do_fluidsynth_check(const char* const filename, const bool init) DISCOVERY_OUT("copyright", ""); DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); DISCOVERY_OUT("audio.outs", 2); - DISCOVERY_OUT("audio.total", 2); DISCOVERY_OUT("midi.ins", 1); - DISCOVERY_OUT("midi.total", 1); - DISCOVERY_OUT("programs.total", programs); + DISCOVERY_OUT("programs", programs); DISCOVERY_OUT("parameters.ins", 13); // defined in Carla DISCOVERY_OUT("parameters.outs", 1); - DISCOVERY_OUT("parameters.total", 14); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("end", "------------"); @@ -1500,13 +1838,10 @@ void do_fluidsynth_check(const char* const filename, const bool init) DISCOVERY_OUT("copyright", ""); DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); DISCOVERY_OUT("audio.outs", 32); - DISCOVERY_OUT("audio.total", 32); DISCOVERY_OUT("midi.ins", 1); - DISCOVERY_OUT("midi.total", 1); - DISCOVERY_OUT("programs.total", programs); + DISCOVERY_OUT("programs", programs); DISCOVERY_OUT("parameters.ins", 13); // defined in Carla DISCOVERY_OUT("parameters.outs", 1); - DISCOVERY_OUT("parameters.total", 14); DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("end", "------------"); #else @@ -1522,18 +1857,30 @@ void do_fluidsynth_check(const char* const filename, const bool init) void do_linuxsampler_check(const char* const filename, const char* const stype, const bool init) { #ifdef WANT_LINUXSAMPLER - const juce::File file(filename); + const QFileInfo file(filename); + + if (! file.exists()) + { + DISCOVERY_OUT("error", "Requested file does not exist"); + return; + } - if (! file.existsAsFile()) + if (! file.isFile()) { - DISCOVERY_OUT("error", "Requested file is not valid or does not exist"); + DISCOVERY_OUT("error", "Requested file is not valid"); + return; + } + + if (! file.isReadable()) + { + DISCOVERY_OUT("error", "Requested file is not readable"); return; } if (init) const LinuxSamplerScopedEngine engine(filename, stype); else - LinuxSamplerScopedEngine::outputInfo(nullptr, 0, file.getFileNameWithoutExtension().toRawUTF8()); + LinuxSamplerScopedEngine::outputInfo(nullptr, 0, file.baseName().toUtf8().constData()); #else DISCOVERY_OUT("error", stype << " support not available"); return; @@ -1546,6 +1893,7 @@ void do_linuxsampler_check(const char* const filename, const char* const stype, // -------------------------------------------------------------------------- +#if 0 class ScopedWorkingDirSet { public: @@ -1563,62 +1911,12 @@ public: private: const File fPreviousWorkingDirectory; }; +#endif // ------------------------------ main entry point ------------------------------ int main(int argc, char* argv[]) { - if (argc == 2 && std::strcmp(argv[1], "-formats") == 0) - { - printf("Available plugin formats:\n"); - printf("LADSPA: "); -#ifdef WANT_LADSPA - printf("yes\n"); -#else - printf("no\n"); -#endif - printf("DSSI: "); -#ifdef WANT_DSSI - printf("yes\n"); -#else - printf("no\n"); -#endif - printf("LV2: "); -#ifdef WANT_LV2 - printf("yes\n"); -#else - printf("no\n"); -#endif - printf("VST: "); -#ifdef WANT_VST - printf("yes\n"); -#else - printf("no\n"); -#endif - printf("\n"); - - printf("Available sampler formats:\n"); - printf("GIG (LinuxSampler): "); -#ifdef WANT_LINUXSAMPLER - printf("yes\n"); -#else - printf("no\n"); -#endif - printf("SF2 (FluidSynth): "); -#ifdef WANT_FLUIDSYNTH - printf("yes\n"); -#else - printf("no\n"); -#endif - printf("SFZ (LinuxSampler): "); -#ifdef WANT_LINUXSAMPLER - printf("yes\n"); -#else - printf("no\n"); -#endif - return 0; - } - if (argc != 3) { carla_stdout("usage: %s ", argv[0]); @@ -1629,7 +1927,7 @@ int main(int argc, char* argv[]) const char* const filename = argv[2]; const PluginType type = getPluginTypeFromString(stype); - const ScopedWorkingDirSet swds(filename); + //const ScopedWorkingDirSet swds(filename); CarlaString filenameStr(filename); filenameStr.toLower(); @@ -1712,7 +2010,7 @@ int main(int argc, char* argv[]) //do_au_check(handle, doInit); break; case PLUGIN_CSOUND: - //do_csound_check(handle, doInit); + do_csound_check(filename, doInit); break; case PLUGIN_GIG: do_linuxsampler_check(filename, "gig", doInit);