| @@ -19,7 +19,8 @@ | |||||
| #ifdef WANT_DSSI | #ifdef WANT_DSSI | ||||
| #include "carla_dssi.h" | |||||
| #include "carla_ladspa_utils.h" | |||||
| #include "dssi/dssi.h" | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| @@ -16,14 +16,16 @@ | |||||
| */ | */ | ||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| # error Should not use fluidsynth for bridges! | |||||
| # error Should not use fluidsynth for bridges! | |||||
| #endif | #endif | ||||
| #include "carla_plugin.h" | #include "carla_plugin.h" | ||||
| #ifdef WANT_FLUIDSYNTH | #ifdef WANT_FLUIDSYNTH | ||||
| #include "carla_fluidsynth.h" | |||||
| #include <fluidsynth.h> | |||||
| #define FLUIDSYNTH_VERSION_NEW_API (FLUIDSYNTH_VERSION_MAJOR >= 1 && FLUIDSYNTH_VERSION_MINOR >= 1 && FLUIDSYNTH_VERSION_MICRO >= 4) | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Carla Backend | |||||
| * Carla Backend, LADSPA plugin code | |||||
| * Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | * Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | ||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
| @@ -19,7 +19,7 @@ | |||||
| #ifdef WANT_LADSPA | #ifdef WANT_LADSPA | ||||
| #include "carla_ladspa.h" | |||||
| #include "carla_ladspa_utils.h" | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| @@ -18,14 +18,14 @@ | |||||
| // TODO - setMidiProgram() | // TODO - setMidiProgram() | ||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| # error Should not use linuxsampler for bridges! | |||||
| # error Should not use linuxsampler for bridges! | |||||
| #endif | #endif | ||||
| #include "carla_plugin.h" | #include "carla_plugin.h" | ||||
| #ifdef WANT_LINUXSAMPLER | #ifdef WANT_LINUXSAMPLER | ||||
| #include "carla_linuxsampler.h" | |||||
| #include "carla_linuxsampler_utils.h" | |||||
| #include <QtCore/QFileInfo> | #include <QtCore/QFileInfo> | ||||
| @@ -19,7 +19,7 @@ | |||||
| #define CARLA_NATIVE_MM_H | #define CARLA_NATIVE_MM_H | ||||
| #include "carla_native.h" | #include "carla_native.h" | ||||
| #include "carla_includes.h" | |||||
| #include "carla_utils.h" | |||||
| class PluginDescriptorClass { | class PluginDescriptorClass { | ||||
| public: | public: | ||||
| @@ -54,12 +54,10 @@ HEADERS = \ | |||||
| ../../carla-includes/carla_utils.h \ | ../../carla-includes/carla_utils.h \ | ||||
| ../../carla-includes/carla_lib_utils.h \ | ../../carla-includes/carla_lib_utils.h \ | ||||
| ../../carla-includes/carla_osc_utils.h \ | ../../carla-includes/carla_osc_utils.h \ | ||||
| ../../carla-includes/carla_ladspa.h \ | |||||
| ../../carla-includes/carla_dssi.h \ | |||||
| ../../carla-includes/carla_ladspa_utils.h \ | |||||
| ../../carla-includes/carla_lv2.h \ | ../../carla-includes/carla_lv2.h \ | ||||
| ../../carla-includes/carla_vst.h \ | |||||
| ../../carla-includes/carla_fluidsynth.h \ | |||||
| ../../carla-includes/carla_linuxsampler.h \ | |||||
| ../../carla-includes/carla_vst_utils.h \ | |||||
| ../../carla-includes/carla_linuxsampler_utils.h \ | |||||
| ../../carla-includes/ladspa_rdf.h \ | ../../carla-includes/ladspa_rdf.h \ | ||||
| ../../carla-includes/lv2_rdf.h | ../../carla-includes/lv2_rdf.h | ||||
| @@ -19,10 +19,10 @@ | |||||
| #ifdef WANT_VST | #ifdef WANT_VST | ||||
| #include "carla_vst.h" | |||||
| #include "carla_vst_utils.h" | |||||
| #ifdef Q_WS_X11 | #ifdef Q_WS_X11 | ||||
| # include <QtGui/QX11Info> | |||||
| # include <QtGui/QX11Info> | |||||
| #endif | #endif | ||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| @@ -1,24 +0,0 @@ | |||||
| /* | |||||
| * Carla common DSSI code | |||||
| * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or modify | |||||
| * it under the terms of the GNU General Public License as published by | |||||
| * the Free Software Foundation; either version 2 of the License, or | |||||
| * any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the COPYING file | |||||
| */ | |||||
| #ifndef CARLA_DSSI_INCLUDES_H | |||||
| #define CARLA_DSSI_INCLUDES_H | |||||
| #include "carla_ladspa.h" | |||||
| #include "dssi/dssi.h" | |||||
| #endif // CARLA_DSSI_INCLUDES_H | |||||
| @@ -1,27 +0,0 @@ | |||||
| /* | |||||
| * Carla common FluidSynth code | |||||
| * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> | |||||
| * | |||||
| * This program is free software; you can redistribute it and/or modify | |||||
| * it under the terms of the GNU General Public License as published by | |||||
| * the Free Software Foundation; either version 2 of the License, or | |||||
| * any later version. | |||||
| * | |||||
| * This program is distributed in the hope that it will be useful, | |||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| * GNU General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the COPYING file | |||||
| */ | |||||
| #ifndef CARLA_FLUIDSYNTH_INCLUDES_H | |||||
| #define CARLA_FLUIDSYNTH_INCLUDES_H | |||||
| #include <fluidsynth.h> | |||||
| #if (FLUIDSYNTH_VERSION_MAJOR >= 1 && FLUIDSYNTH_VERSION_MINOR >= 1 && FLUIDSYNTH_VERSION_MICRO >= 4) | |||||
| # define FLUIDSYNTH_VERSION_NEW_API | |||||
| #endif | |||||
| #endif // CARLA_FLUIDSYNTH_INCLUDES_H | |||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Carla common LADSPA code | |||||
| * Carla LADSPA utils | |||||
| * Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | * Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | ||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
| @@ -15,8 +15,10 @@ | |||||
| * For a full copy of the GNU General Public License see the COPYING file | * For a full copy of the GNU General Public License see the COPYING file | ||||
| */ | */ | ||||
| #ifndef CARLA_LADSPA_INCLUDES_H | |||||
| #define CARLA_LADSPA_INCLUDES_H | |||||
| #ifndef CARLA_LADSPA_UTILS_H | |||||
| #define CARLA_LADSPA_UTILS_H | |||||
| #include "carla_utils.h" | |||||
| #include "ladspa/ladspa.h" | #include "ladspa/ladspa.h" | ||||
| #include "ladspa_rdf.h" | #include "ladspa_rdf.h" | ||||
| @@ -28,55 +30,58 @@ | |||||
| // Copy RDF object | // Copy RDF object | ||||
| static inline | static inline | ||||
| const LADSPA_RDF_Descriptor* ladspa_rdf_dup(const LADSPA_RDF_Descriptor* const rdf_descriptor) | |||||
| const LADSPA_RDF_Descriptor* ladspa_rdf_dup(const LADSPA_RDF_Descriptor* const oldDescriptor) | |||||
| { | { | ||||
| CARLA_ASSERT(rdf_descriptor); | |||||
| CARLA_ASSERT(oldDescriptor); | |||||
| if (! oldDescriptor) | |||||
| return nullptr; | |||||
| LADSPA_RDF_Descriptor* const new_descriptor = new LADSPA_RDF_Descriptor; | |||||
| LADSPA_RDF_Descriptor* const newDescriptor = new LADSPA_RDF_Descriptor(); | |||||
| new_descriptor->Type = rdf_descriptor->Type; | |||||
| new_descriptor->UniqueID = rdf_descriptor->UniqueID; | |||||
| new_descriptor->PortCount = rdf_descriptor->PortCount; | |||||
| newDescriptor->Type = oldDescriptor->Type; | |||||
| newDescriptor->UniqueID = oldDescriptor->UniqueID; | |||||
| newDescriptor->PortCount = oldDescriptor->PortCount; | |||||
| if (rdf_descriptor->Title) | |||||
| new_descriptor->Title = strdup(rdf_descriptor->Title); | |||||
| if (oldDescriptor->Title) | |||||
| newDescriptor->Title = strdup(oldDescriptor->Title); | |||||
| if (rdf_descriptor->Creator) | |||||
| new_descriptor->Creator = strdup(rdf_descriptor->Creator); | |||||
| if (oldDescriptor->Creator) | |||||
| newDescriptor->Creator = strdup(oldDescriptor->Creator); | |||||
| if (new_descriptor->PortCount > 0) | |||||
| if (newDescriptor->PortCount > 0) | |||||
| { | { | ||||
| new_descriptor->Ports = new LADSPA_RDF_Port[new_descriptor->PortCount]; | |||||
| newDescriptor->Ports = new LADSPA_RDF_Port[newDescriptor->PortCount]; | |||||
| for (unsigned long i=0; i < new_descriptor->PortCount; i++) | |||||
| for (unsigned long i=0; i < newDescriptor->PortCount; i++) | |||||
| { | { | ||||
| LADSPA_RDF_Port* const Port = &new_descriptor->Ports[i]; | |||||
| Port->Type = rdf_descriptor->Ports[i].Type; | |||||
| Port->Hints = rdf_descriptor->Ports[i].Hints; | |||||
| Port->Default = rdf_descriptor->Ports[i].Default; | |||||
| Port->Unit = rdf_descriptor->Ports[i].Unit; | |||||
| Port->ScalePointCount = rdf_descriptor->Ports[i].ScalePointCount; | |||||
| LADSPA_RDF_Port* const newPort = &newDescriptor->Ports[i]; | |||||
| newPort->Type = oldDescriptor->Ports[i].Type; | |||||
| newPort->Hints = oldDescriptor->Ports[i].Hints; | |||||
| newPort->Default = oldDescriptor->Ports[i].Default; | |||||
| newPort->Unit = oldDescriptor->Ports[i].Unit; | |||||
| newPort->ScalePointCount = oldDescriptor->Ports[i].ScalePointCount; | |||||
| if (rdf_descriptor->Ports[i].Label) | |||||
| Port->Label = strdup(rdf_descriptor->Ports[i].Label); | |||||
| if (oldDescriptor->Ports[i].Label) | |||||
| newPort->Label = strdup(oldDescriptor->Ports[i].Label); | |||||
| if (Port->ScalePointCount > 0) | |||||
| if (newPort->ScalePointCount > 0) | |||||
| { | { | ||||
| Port->ScalePoints = new LADSPA_RDF_ScalePoint[Port->ScalePointCount]; | |||||
| newPort->ScalePoints = new LADSPA_RDF_ScalePoint[newPort->ScalePointCount]; | |||||
| for (unsigned long j=0; j < Port->ScalePointCount; j++) | |||||
| for (unsigned long j=0; j < newPort->ScalePointCount; j++) | |||||
| { | { | ||||
| LADSPA_RDF_ScalePoint* const ScalePoint = &Port->ScalePoints[j]; | |||||
| ScalePoint->Value = rdf_descriptor->Ports[i].ScalePoints[j].Value; | |||||
| LADSPA_RDF_ScalePoint* const newScalePoint = &newPort->ScalePoints[j]; | |||||
| newScalePoint->Value = oldDescriptor->Ports[i].ScalePoints[j].Value; | |||||
| if (rdf_descriptor->Ports[i].ScalePoints[j].Label) | |||||
| ScalePoint->Label = strdup(rdf_descriptor->Ports[i].ScalePoints[j].Label); | |||||
| if (oldDescriptor->Ports[i].ScalePoints[j].Label) | |||||
| newScalePoint->Label = strdup(oldDescriptor->Ports[i].ScalePoints[j].Label); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return new_descriptor; | |||||
| return newDescriptor; | |||||
| } | } | ||||
| // ------------------------------------------------------------------------------------------------ | // ------------------------------------------------------------------------------------------------ | ||||
| @@ -96,30 +101,33 @@ bool is_ladspa_port_good(const LADSPA_PortDescriptor port1, const LADSPA_PortDes | |||||
| } | } | ||||
| static inline | static inline | ||||
| bool is_ladspa_rdf_descriptor_valid(const LADSPA_RDF_Descriptor* const rdf_descriptor, const LADSPA_Descriptor* const descriptor) | |||||
| bool is_ladspa_rdf_descriptor_valid(const LADSPA_RDF_Descriptor* const rdfDescriptor, const LADSPA_Descriptor* const descriptor) | |||||
| { | { | ||||
| CARLA_ASSERT(rdfDescriptor); | |||||
| CARLA_ASSERT(descriptor); | CARLA_ASSERT(descriptor); | ||||
| if (! rdf_descriptor) | |||||
| if (! rdfDescriptor) | |||||
| return false; | |||||
| if (! descriptor) | |||||
| return false; | return false; | ||||
| if (rdf_descriptor->UniqueID != descriptor->UniqueID) | |||||
| if (rdfDescriptor->UniqueID != descriptor->UniqueID) | |||||
| { | { | ||||
| qWarning("WARNING - Plugin has wrong UniqueID: %li != %li", rdf_descriptor->UniqueID, descriptor->UniqueID); | |||||
| qWarning("WARNING - Plugin has wrong UniqueID: %li != %li", rdfDescriptor->UniqueID, descriptor->UniqueID); | |||||
| return false; | return false; | ||||
| } | } | ||||
| if (rdf_descriptor->PortCount > descriptor->PortCount) | |||||
| if (rdfDescriptor->PortCount > descriptor->PortCount) | |||||
| { | { | ||||
| qWarning("WARNING - Plugin has RDF data, but invalid PortCount: %li > %li", rdf_descriptor->PortCount, descriptor->PortCount); | |||||
| qWarning("WARNING - Plugin has RDF data, but invalid PortCount: %li > %li", rdfDescriptor->PortCount, descriptor->PortCount); | |||||
| return false; | return false; | ||||
| } | } | ||||
| for (unsigned long i=0; i < rdf_descriptor->PortCount; i++) | |||||
| for (unsigned long i=0; i < rdfDescriptor->PortCount; i++) | |||||
| { | { | ||||
| if (! is_ladspa_port_good(rdf_descriptor->Ports[i].Type, descriptor->PortDescriptors[i])) | |||||
| if (! is_ladspa_port_good(rdfDescriptor->Ports[i].Type, descriptor->PortDescriptors[i])) | |||||
| { | { | ||||
| qWarning("WARNING - Plugin has RDF data, but invalid PortTypes: %i != %i", rdf_descriptor->Ports[i].Type, descriptor->PortDescriptors[i]); | |||||
| qWarning("WARNING - Plugin has RDF data, but invalid PortTypes: %i != %i", rdfDescriptor->Ports[i].Type, descriptor->PortDescriptors[i]); | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| @@ -156,25 +164,25 @@ LADSPA_Data get_default_ladspa_port_value(const LADSPA_PortRangeHintDescriptor h | |||||
| break; | break; | ||||
| case LADSPA_HINT_DEFAULT_LOW: | case LADSPA_HINT_DEFAULT_LOW: | ||||
| if (LADSPA_IS_HINT_LOGARITHMIC(hintDescriptor)) | if (LADSPA_IS_HINT_LOGARITHMIC(hintDescriptor)) | ||||
| def = exp((log(min)*0.75f) + (log(max)*0.25f)); | |||||
| def = std::exp((std::log(min)*0.75f) + (std::log(max)*0.25f)); | |||||
| else | else | ||||
| def = (min*0.75f) + (max*0.25f); | def = (min*0.75f) + (max*0.25f); | ||||
| break; | break; | ||||
| case LADSPA_HINT_DEFAULT_MIDDLE: | case LADSPA_HINT_DEFAULT_MIDDLE: | ||||
| if (LADSPA_IS_HINT_LOGARITHMIC(hintDescriptor)) | if (LADSPA_IS_HINT_LOGARITHMIC(hintDescriptor)) | ||||
| def = sqrt(min*max); | |||||
| def = std::sqrt(min*max); | |||||
| else | else | ||||
| def = (min+max)/2; | def = (min+max)/2; | ||||
| break; | break; | ||||
| case LADSPA_HINT_DEFAULT_HIGH: | case LADSPA_HINT_DEFAULT_HIGH: | ||||
| if (LADSPA_IS_HINT_LOGARITHMIC(hintDescriptor)) | if (LADSPA_IS_HINT_LOGARITHMIC(hintDescriptor)) | ||||
| def = exp((log(min)*0.25) + (log(max)*0.75)); | |||||
| def = std::exp((std::log(min)*0.25f) + (std::log(max)*0.75f)); | |||||
| else | else | ||||
| def = (min*0.25) + (max*0.75); | |||||
| def = (min*0.25f) + (max*0.75f); | |||||
| break; | break; | ||||
| default: | default: | ||||
| if (min < 0.0 && max > 0.0) | |||||
| def = 0.0; | |||||
| if (min < 0.0f && max > 0.0f) | |||||
| def = 0.0f; | |||||
| else | else | ||||
| def = min; | def = min; | ||||
| break; | break; | ||||
| @@ -183,8 +191,8 @@ LADSPA_Data get_default_ladspa_port_value(const LADSPA_PortRangeHintDescriptor h | |||||
| else | else | ||||
| { | { | ||||
| // no default value | // no default value | ||||
| if (min < 0.0 && max > 0.0) | |||||
| def = 0.0; | |||||
| if (min < 0.0f && max > 0.0f) | |||||
| def = 0.0f; | |||||
| else | else | ||||
| def = min; | def = min; | ||||
| } | } | ||||
| @@ -192,4 +200,6 @@ LADSPA_Data get_default_ladspa_port_value(const LADSPA_PortRangeHintDescriptor h | |||||
| return def; | return def; | ||||
| } | } | ||||
| #endif // CARLA_LADSPA_INCLUDES_H | |||||
| // ------------------------------------------------------------------------------------------------ | |||||
| #endif // CARLA_LADSPA_UTILS_H | |||||
| @@ -18,11 +18,9 @@ | |||||
| #ifndef CARLA_LIBRARY_UTILS_H | #ifndef CARLA_LIBRARY_UTILS_H | ||||
| #define CARLA_LIBRARY_UTILS_H | #define CARLA_LIBRARY_UTILS_H | ||||
| #include "carla_defines.h" | |||||
| #include "carla_utils.h" | |||||
| #ifdef Q_OS_WIN | |||||
| # include <cstdio> | |||||
| #else | |||||
| #ifndef Q_OS_WIN | |||||
| # include <dlfcn.h> | # include <dlfcn.h> | ||||
| #endif | #endif | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Carla common LinuxSampler code | |||||
| * Carla LinuxSampler utils | |||||
| * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> | * Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> | ||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
| @@ -15,8 +15,8 @@ | |||||
| * For a full copy of the GNU General Public License see the COPYING file | * For a full copy of the GNU General Public License see the COPYING file | ||||
| */ | */ | ||||
| #ifndef CARLA_LINUXSAMPLER_INCLUDES_H | |||||
| #define CARLA_LINUXSAMPLER_INCLUDES_H | |||||
| #ifndef CARLA_LINUXSAMPLER_UTILS_H | |||||
| #define CARLA_LINUXSAMPLER_UTILS_H | |||||
| #include <linuxsampler/engines/Engine.h> | #include <linuxsampler/engines/Engine.h> | ||||
| #include <linuxsampler/Sampler.h> | #include <linuxsampler/Sampler.h> | ||||
| @@ -26,6 +26,8 @@ | |||||
| namespace LinuxSampler { | namespace LinuxSampler { | ||||
| // ----------------------------------------------------------------------- | |||||
| class EngineFactory | class EngineFactory | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -44,9 +46,15 @@ protected: | |||||
| #include "carla_plugin.h" | #include "carla_plugin.h" | ||||
| // ----------------------------------------------------------------------- | |||||
| // LinuxSampler static values | |||||
| static const float VOLUME_MAX = 3.16227766f; // +10 dB | static const float VOLUME_MAX = 3.16227766f; // +10 dB | ||||
| static const float VOLUME_MIN = 0.0f; // -inf dB | static const float VOLUME_MIN = 0.0f; // -inf dB | ||||
| // ----------------------------------------------------------------------- | |||||
| // LinuxSampler AudioOutputDevice Plugin | |||||
| class AudioOutputDevicePlugin : public AudioOutputDevice | class AudioOutputDevicePlugin : public AudioOutputDevice | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -55,6 +63,8 @@ public: | |||||
| m_engine(engine), | m_engine(engine), | ||||
| m_plugin(plugin) | m_plugin(plugin) | ||||
| { | { | ||||
| CARLA_ASSERT(engine); | |||||
| CARLA_ASSERT(plugin); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -94,6 +104,7 @@ public: | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Give public access to the RenderAudio call | |||||
| int Render(uint samples) | int Render(uint samples) | ||||
| { | { | ||||
| @@ -105,6 +116,9 @@ private: | |||||
| CarlaBackend::CarlaPlugin* const m_plugin; | CarlaBackend::CarlaPlugin* const m_plugin; | ||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | |||||
| // LinuxSampler MidiInputDevice Plugin | |||||
| class MidiInputDevicePlugin : public MidiInputDevice | class MidiInputDevicePlugin : public MidiInputDevice | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -135,6 +149,7 @@ public: | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Properly delete port (deconstructor is protected) | |||||
| void DeleteMidiPort(MidiInputPort* const port) | void DeleteMidiPort(MidiInputPort* const port) | ||||
| { | { | ||||
| @@ -143,6 +158,7 @@ public: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // MIDI Port implementation for this plugin MIDI input driver | // MIDI Port implementation for this plugin MIDI input driver | ||||
| // (Constructor and deconstructor are protected) | |||||
| class MidiInputPortPlugin : public MidiInputPort | class MidiInputPortPlugin : public MidiInputPort | ||||
| { | { | ||||
| @@ -155,8 +171,10 @@ public: | |||||
| }; | }; | ||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | |||||
| #endif // ! BUILD_NATIVE | #endif // ! BUILD_NATIVE | ||||
| } // namespace LinuxSampler | } // namespace LinuxSampler | ||||
| #endif // CARLA_LINUXSAMPLER_INCLUDES_H | |||||
| #endif // CARLA_LINUXSAMPLER_UTILS_H | |||||
| @@ -31,6 +31,19 @@ | |||||
| # include <linux/prctl.h> | # include <linux/prctl.h> | ||||
| #endif | #endif | ||||
| // carla_assert* | |||||
| static inline | |||||
| void carla_assert(const char* const assertion, const char* const file, const int line) | |||||
| { | |||||
| qCritical("Carla assertion failure: \"%s\" in file %s, line %i", assertion, file, line); | |||||
| } | |||||
| static inline | |||||
| void carla_assert_int(const char* const assertion, const char* const file, const int line, const int value) | |||||
| { | |||||
| qCritical("Carla assertion failure: \"%s\" in file %s, line %i, value %i", assertion, file, line, value); | |||||
| } | |||||
| // carla_*sleep | // carla_*sleep | ||||
| #ifdef Q_OS_WIN | #ifdef Q_OS_WIN | ||||
| # define carla_sleep(t) Sleep(t * 1000) | # define carla_sleep(t) Sleep(t * 1000) | ||||
| @@ -49,19 +62,6 @@ | |||||
| # define carla_setenv(key, value) setenv(key, value, 1) | # define carla_setenv(key, value) setenv(key, value, 1) | ||||
| #endif | #endif | ||||
| // carla_assert* | |||||
| static inline | |||||
| void carla_assert(const char* const assertion, const char* const file, const int line) | |||||
| { | |||||
| qCritical("Carla assertion failure: \"%s\" in file %s, line %i", assertion, file, line); | |||||
| } | |||||
| static inline | |||||
| void carla_assert_int(const char* const assertion, const char* const file, const int line, const int value) | |||||
| { | |||||
| qCritical("Carla assertion failure: \"%s\" in file %s, line %i, value %i", assertion, file, line, value); | |||||
| } | |||||
| // carla_setprocname (not available on all platforms) | // carla_setprocname (not available on all platforms) | ||||
| static inline | static inline | ||||
| void carla_setprocname(const char* const name) | void carla_setprocname(const char* const name) | ||||
| @@ -79,19 +79,19 @@ void carla_setprocname(const char* const name) | |||||
| } | } | ||||
| // math functions | // math functions | ||||
| inline | |||||
| static inline | |||||
| float carla_absF(const float& value) | float carla_absF(const float& value) | ||||
| { | { | ||||
| return (value < 0.0f) ? -value : value; | return (value < 0.0f) ? -value : value; | ||||
| } | } | ||||
| inline | |||||
| static inline | |||||
| float carla_minF(const float& x, const float& y) | float carla_minF(const float& x, const float& y) | ||||
| { | { | ||||
| return (x < y ? x : y); | return (x < y ? x : y); | ||||
| } | } | ||||
| inline | |||||
| static inline | |||||
| float carla_maxF(const float& x, const float& y) | float carla_maxF(const float& x, const float& y) | ||||
| { | { | ||||
| return (x > y ? x : y); | return (x > y ? x : y); | ||||
| @@ -114,7 +114,9 @@ const char* bool2str(const bool yesNo) | |||||
| static inline | static inline | ||||
| void pass() {} | void pass() {} | ||||
| // ------------------------------------------------- | |||||
| // carla_string class | // carla_string class | ||||
| class carla_string | class carla_string | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -131,16 +133,11 @@ public: | |||||
| buffer = ::strdup(strBuf ? strBuf : ""); | buffer = ::strdup(strBuf ? strBuf : ""); | ||||
| } | } | ||||
| carla_string(const char* const strBuf) | |||||
| explicit carla_string(const char* const strBuf) | |||||
| { | { | ||||
| buffer = ::strdup(strBuf ? strBuf : ""); | buffer = ::strdup(strBuf ? strBuf : ""); | ||||
| } | } | ||||
| explicit carla_string(const carla_string& str) | |||||
| { | |||||
| buffer = ::strdup(str.buffer); | |||||
| } | |||||
| explicit carla_string(const int value) | explicit carla_string(const int value) | ||||
| { | { | ||||
| const size_t strBufSize = ::abs(value/10) + 3; | const size_t strBufSize = ::abs(value/10) + 3; | ||||
| @@ -193,6 +190,14 @@ public: | |||||
| buffer = ::strdup(strBuf); | buffer = ::strdup(strBuf); | ||||
| } | } | ||||
| // --------------------------------------------- | |||||
| // non-explicit constructor | |||||
| carla_string(const carla_string& str) | |||||
| { | |||||
| buffer = ::strdup(str.buffer); | |||||
| } | |||||
| // --------------------------------------------- | // --------------------------------------------- | ||||
| // deconstructor | // deconstructor | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Carla common VST code | |||||
| * Carla VST utils | |||||
| * Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | * Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | ||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or modify | * This program is free software; you can redistribute it and/or modify | ||||
| @@ -15,8 +15,8 @@ | |||||
| * For a full copy of the GNU General Public License see the COPYING file | * For a full copy of the GNU General Public License see the COPYING file | ||||
| */ | */ | ||||
| #ifndef CARLA_VST_INCLUDES_H | |||||
| #define CARLA_VST_INCLUDES_H | |||||
| #ifndef CARLA_VST_UTILS_H | |||||
| #define CARLA_VST_UTILS_H | |||||
| // disable deprecated VST features (not) | // disable deprecated VST features (not) | ||||
| #define VST_FORCE_DEPRECATED 0 | #define VST_FORCE_DEPRECATED 0 | ||||
| @@ -102,7 +102,7 @@ | |||||
| #define kVstVersion 2400 | #define kVstVersion 2400 | ||||
| #define VSTCALLBACK | #define VSTCALLBACK | ||||
| struct ERect { | struct ERect { | ||||
| short top, left, bottom, right; | |||||
| int16_t top, left, bottom, right; | |||||
| }; | }; | ||||
| struct VstTimeInfo_R { | struct VstTimeInfo_R { | ||||
| double samplePos, sampleRate, nanoSeconds, ppqPos, tempo, barStartPos, cycleStartPos, cycleEndPos; | double samplePos, sampleRate, nanoSeconds, ppqPos, tempo, barStartPos, cycleStartPos, cycleEndPos; | ||||
| @@ -431,4 +431,4 @@ const char* vstMasterOpcode2str(const int32_t opcode) | |||||
| } | } | ||||
| } | } | ||||
| #endif // CARLA_VST_INCLUDES_H | |||||
| #endif // CARLA_VST_UTILS_H | |||||
| @@ -18,6 +18,8 @@ | |||||
| #ifndef LADSPA_RDF_INCLUDED | #ifndef LADSPA_RDF_INCLUDED | ||||
| #define LADSPA_RDF_INCLUDED | #define LADSPA_RDF_INCLUDED | ||||
| #include <cstdlib> | |||||
| // Base Types | // Base Types | ||||
| typedef float LADSPA_Data; | typedef float LADSPA_Data; | ||||
| typedef int LADSPA_Property; | typedef int LADSPA_Property; | ||||
| @@ -62,38 +64,38 @@ typedef unsigned long long LADSPA_PluginType; | |||||
| #define LADSPA_PORT_HAS_LABEL(x) ((x) & LADSPA_PORT_LABEL) | #define LADSPA_PORT_HAS_LABEL(x) ((x) & LADSPA_PORT_LABEL) | ||||
| // Plugin Types | // Plugin Types | ||||
| #define LADSPA_CLASS_UTILITY 0x000000001 | |||||
| #define LADSPA_CLASS_GENERATOR 0x000000002 | |||||
| #define LADSPA_CLASS_SIMULATOR 0x000000004 | |||||
| #define LADSPA_CLASS_OSCILLATOR 0x000000008 | |||||
| #define LADSPA_CLASS_TIME 0x000000010 | |||||
| #define LADSPA_CLASS_DELAY 0x000000020 | |||||
| #define LADSPA_CLASS_PHASER 0x000000040 | |||||
| #define LADSPA_CLASS_FLANGER 0x000000080 | |||||
| #define LADSPA_CLASS_CHORUS 0x000000100 | |||||
| #define LADSPA_CLASS_REVERB 0x000000200 | |||||
| #define LADSPA_CLASS_FREQUENCY 0x000000400 | |||||
| #define LADSPA_CLASS_FREQUENCY_METER 0x000000800 | |||||
| #define LADSPA_CLASS_FILTER 0x000001000 | |||||
| #define LADSPA_CLASS_LOWPASS 0x000002000 | |||||
| #define LADSPA_CLASS_HIGHPASS 0x000004000 | |||||
| #define LADSPA_CLASS_BANDPASS 0x000008000 | |||||
| #define LADSPA_CLASS_COMB 0x000010000 | |||||
| #define LADSPA_CLASS_ALLPASS 0x000020000 | |||||
| #define LADSPA_CLASS_EQ 0x000040000 | |||||
| #define LADSPA_CLASS_PARAEQ 0x000080000 | |||||
| #define LADSPA_CLASS_MULTIEQ 0x000100000 | |||||
| #define LADSPA_CLASS_AMPLITUDE 0x000200000 | |||||
| #define LADSPA_CLASS_PITCH 0x000400000 | |||||
| #define LADSPA_CLASS_AMPLIFIER 0x000800000 | |||||
| #define LADSPA_CLASS_WAVESHAPER 0x001000000 | |||||
| #define LADSPA_CLASS_MODULATOR 0x002000000 | |||||
| #define LADSPA_CLASS_DISTORTION 0x004000000 | |||||
| #define LADSPA_CLASS_DYNAMICS 0x008000000 | |||||
| #define LADSPA_CLASS_COMPRESSOR 0x010000000 | |||||
| #define LADSPA_CLASS_EXPANDER 0x020000000 | |||||
| #define LADSPA_CLASS_LIMITER 0x040000000 | |||||
| #define LADSPA_CLASS_GATE 0x080000000 | |||||
| #define LADSPA_CLASS_UTILITY 0x000000001LL | |||||
| #define LADSPA_CLASS_GENERATOR 0x000000002LL | |||||
| #define LADSPA_CLASS_SIMULATOR 0x000000004LL | |||||
| #define LADSPA_CLASS_OSCILLATOR 0x000000008LL | |||||
| #define LADSPA_CLASS_TIME 0x000000010LL | |||||
| #define LADSPA_CLASS_DELAY 0x000000020LL | |||||
| #define LADSPA_CLASS_PHASER 0x000000040LL | |||||
| #define LADSPA_CLASS_FLANGER 0x000000080LL | |||||
| #define LADSPA_CLASS_CHORUS 0x000000100LL | |||||
| #define LADSPA_CLASS_REVERB 0x000000200LL | |||||
| #define LADSPA_CLASS_FREQUENCY 0x000000400LL | |||||
| #define LADSPA_CLASS_FREQUENCY_METER 0x000000800LL | |||||
| #define LADSPA_CLASS_FILTER 0x000001000LL | |||||
| #define LADSPA_CLASS_LOWPASS 0x000002000LL | |||||
| #define LADSPA_CLASS_HIGHPASS 0x000004000LL | |||||
| #define LADSPA_CLASS_BANDPASS 0x000008000LL | |||||
| #define LADSPA_CLASS_COMB 0x000010000LL | |||||
| #define LADSPA_CLASS_ALLPASS 0x000020000LL | |||||
| #define LADSPA_CLASS_EQ 0x000040000LL | |||||
| #define LADSPA_CLASS_PARAEQ 0x000080000LL | |||||
| #define LADSPA_CLASS_MULTIEQ 0x000100000LL | |||||
| #define LADSPA_CLASS_AMPLITUDE 0x000200000LL | |||||
| #define LADSPA_CLASS_PITCH 0x000400000LL | |||||
| #define LADSPA_CLASS_AMPLIFIER 0x000800000LL | |||||
| #define LADSPA_CLASS_WAVESHAPER 0x001000000LL | |||||
| #define LADSPA_CLASS_MODULATOR 0x002000000LL | |||||
| #define LADSPA_CLASS_DISTORTION 0x004000000LL | |||||
| #define LADSPA_CLASS_DYNAMICS 0x008000000LL | |||||
| #define LADSPA_CLASS_COMPRESSOR 0x010000000LL | |||||
| #define LADSPA_CLASS_EXPANDER 0x020000000LL | |||||
| #define LADSPA_CLASS_LIMITER 0x040000000LL | |||||
| #define LADSPA_CLASS_GATE 0x080000000LL | |||||
| #define LADSPA_CLASS_SPECTRAL 0x100000000LL | #define LADSPA_CLASS_SPECTRAL 0x100000000LL | ||||
| #define LADSPA_CLASS_NOTCH 0x200000000LL | #define LADSPA_CLASS_NOTCH 0x200000000LL | ||||
| @@ -127,7 +129,7 @@ struct LADSPA_RDF_ScalePoint { | |||||
| ~LADSPA_RDF_ScalePoint() | ~LADSPA_RDF_ScalePoint() | ||||
| { | { | ||||
| if (Label) | if (Label) | ||||
| free((void*)Label); | |||||
| ::free((void*)Label); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -154,7 +156,7 @@ struct LADSPA_RDF_Port { | |||||
| ~LADSPA_RDF_Port() | ~LADSPA_RDF_Port() | ||||
| { | { | ||||
| if (Label) | if (Label) | ||||
| free((void*)Label); | |||||
| ::free((void*)Label); | |||||
| if (ScalePoints) | if (ScalePoints) | ||||
| delete[] ScalePoints; | delete[] ScalePoints; | ||||
| @@ -182,10 +184,10 @@ struct LADSPA_RDF_Descriptor { | |||||
| ~LADSPA_RDF_Descriptor() | ~LADSPA_RDF_Descriptor() | ||||
| { | { | ||||
| if (Title) | if (Title) | ||||
| free((void*)Title); | |||||
| ::free((void*)Title); | |||||
| if (Creator) | if (Creator) | ||||
| free((void*)Creator); | |||||
| ::free((void*)Creator); | |||||
| if (Ports) | if (Ports) | ||||
| delete[] Ports; | delete[] Ports; | ||||
| @@ -21,6 +21,7 @@ | |||||
| // TODO - presets | // TODO - presets | ||||
| #include <cstdint> | #include <cstdint> | ||||
| #include <cstdlib> | |||||
| // Base Types | // Base Types | ||||
| typedef float LV2_Data; | typedef float LV2_Data; | ||||
| @@ -189,11 +190,11 @@ typedef unsigned long long LV2_PluginType; | |||||
| #define LV2_IS_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND) | #define LV2_IS_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND) | ||||
| #define LV2_IS_PORT_DESIGNATION_TIME_POSITION(x) ((x) == LV2_PORT_DESIGNATION_TIME_POSITION) | #define LV2_IS_PORT_DESIGNATION_TIME_POSITION(x) ((x) == LV2_PORT_DESIGNATION_TIME_POSITION) | ||||
| #define LV2_IS_PORT_DESIGNATION_TIME_SPEED(x) ((x) == LV2_PORT_DESIGNATION_TIME_SPEED) | #define LV2_IS_PORT_DESIGNATION_TIME_SPEED(x) ((x) == LV2_PORT_DESIGNATION_TIME_SPEED) | ||||
| #define LV2_IS_PORT_DESIGNATION_TIME(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR || (x) == LV2_PORT_DESIGNATION_TIME_BAR_BEAT || \ | |||||
| (x) == LV2_PORT_DESIGNATION_TIME_BEAT || (x) == LV2_PORT_DESIGNATION_TIME_BEAT_UNIT || \ | |||||
| (x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR || (x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE || \ | |||||
| (x) == LV2_PORT_DESIGNATION_TIME_FRAME || (x) == LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND || \ | |||||
| (x) == LV2_PORT_DESIGNATION_TIME_POSITION || (x) == LV2_PORT_DESIGNATION_TIME_SPEED) | |||||
| #define LV2_IS_PORT_DESIGNATION_TIME(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR || (x) == LV2_PORT_DESIGNATION_TIME_BAR_BEAT || \ | |||||
| (x) == LV2_PORT_DESIGNATION_TIME_BEAT || (x) == LV2_PORT_DESIGNATION_TIME_BEAT_UNIT || \ | |||||
| (x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR || (x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE || \ | |||||
| (x) == LV2_PORT_DESIGNATION_TIME_FRAME || (x) == LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND || \ | |||||
| (x) == LV2_PORT_DESIGNATION_TIME_POSITION || (x) == LV2_PORT_DESIGNATION_TIME_SPEED) | |||||
| // Preset State Types (TODO: Null is not a type, this is just a placeholder) | // Preset State Types (TODO: Null is not a type, this is just a placeholder) | ||||
| #define LV2_PRESET_STATE_NULL 0x0 | #define LV2_PRESET_STATE_NULL 0x0 | ||||
| @@ -332,13 +333,13 @@ struct LV2_RDF_PortUnit { | |||||
| ~LV2_RDF_PortUnit() | ~LV2_RDF_PortUnit() | ||||
| { | { | ||||
| if (Name) | if (Name) | ||||
| free((void*)Name); | |||||
| ::free((void*)Name); | |||||
| if (Render) | if (Render) | ||||
| free((void*)Render); | |||||
| ::free((void*)Render); | |||||
| if (Symbol) | if (Symbol) | ||||
| free((void*)Symbol); | |||||
| ::free((void*)Symbol); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -354,7 +355,7 @@ struct LV2_RDF_PortScalePoint { | |||||
| ~LV2_RDF_PortScalePoint() | ~LV2_RDF_PortScalePoint() | ||||
| { | { | ||||
| if (Label) | if (Label) | ||||
| free((void*)Label); | |||||
| ::free((void*)Label); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -385,10 +386,10 @@ struct LV2_RDF_Port { | |||||
| ~LV2_RDF_Port() | ~LV2_RDF_Port() | ||||
| { | { | ||||
| if (Name) | if (Name) | ||||
| free((void*)Name); | |||||
| ::free((void*)Name); | |||||
| if (Symbol) | if (Symbol) | ||||
| free((void*)Symbol); | |||||
| ::free((void*)Symbol); | |||||
| if (ScalePoints) | if (ScalePoints) | ||||
| delete[] ScalePoints; | delete[] ScalePoints; | ||||
| @@ -407,7 +408,7 @@ struct LV2_RDF_PresetPort { | |||||
| ~LV2_RDF_PresetPort() | ~LV2_RDF_PresetPort() | ||||
| { | { | ||||
| if (Symbol) | if (Symbol) | ||||
| free((void*)Symbol); | |||||
| ::free((void*)Symbol); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -426,7 +427,7 @@ struct LV2_RDF_PresetState { | |||||
| ~LV2_RDF_PresetState() | ~LV2_RDF_PresetState() | ||||
| { | { | ||||
| if (Key) | if (Key) | ||||
| free((void*)Key); | |||||
| ::free((void*)Key); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -452,10 +453,10 @@ struct LV2_RDF_Preset { | |||||
| ~LV2_RDF_Preset() | ~LV2_RDF_Preset() | ||||
| { | { | ||||
| if (URI) | if (URI) | ||||
| free((void*)URI); | |||||
| ::free((void*)URI); | |||||
| if (Label) | if (Label) | ||||
| free((void*)Label); | |||||
| ::free((void*)Label); | |||||
| if (Ports) | if (Ports) | ||||
| delete[] Ports; | delete[] Ports; | ||||
| @@ -477,7 +478,7 @@ struct LV2_RDF_Feature { | |||||
| ~LV2_RDF_Feature() | ~LV2_RDF_Feature() | ||||
| { | { | ||||
| if (URI) | if (URI) | ||||
| free((void*)URI); | |||||
| ::free((void*)URI); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -507,13 +508,13 @@ struct LV2_RDF_UI { | |||||
| ~LV2_RDF_UI() | ~LV2_RDF_UI() | ||||
| { | { | ||||
| if (URI) | if (URI) | ||||
| free((void*)URI); | |||||
| ::free((void*)URI); | |||||
| if (Binary) | if (Binary) | ||||
| free((void*)Binary); | |||||
| ::free((void*)Binary); | |||||
| if (Bundle) | if (Bundle) | ||||
| free((void*)Bundle); | |||||
| ::free((void*)Bundle); | |||||
| if (Features) | if (Features) | ||||
| delete[] Features; | delete[] Features; | ||||
| @@ -572,22 +573,22 @@ struct LV2_RDF_Descriptor { | |||||
| ~LV2_RDF_Descriptor() | ~LV2_RDF_Descriptor() | ||||
| { | { | ||||
| if (URI) | if (URI) | ||||
| free((void*)URI); | |||||
| ::free((void*)URI); | |||||
| if (Name) | if (Name) | ||||
| free((void*)Name); | |||||
| ::free((void*)Name); | |||||
| if (Author) | if (Author) | ||||
| free((void*)Author); | |||||
| ::free((void*)Author); | |||||
| if (License) | if (License) | ||||
| free((void*)License); | |||||
| ::free((void*)License); | |||||
| if (Binary) | if (Binary) | ||||
| free((void*)Binary); | |||||
| ::free((void*)Binary); | |||||
| if (Bundle) | if (Bundle) | ||||
| free((void*)Bundle); | |||||
| ::free((void*)Bundle); | |||||
| if (Ports) | if (Ports) | ||||
| delete[] Ports; | delete[] Ports; | ||||
| @@ -606,4 +607,4 @@ struct LV2_RDF_Descriptor { | |||||
| } | } | ||||
| }; | }; | ||||
| #endif /* LV2_RDF_INCLUDED */ | |||||
| #endif // LV2_RDF_INCLUDED | |||||