Having GPLv3 as license makes carla itself GPLv3. Let's keep Carla at GPLv2+ please :) (a single simple plugin is not worth the "upgrade")tags/1.9.7
| @@ -559,7 +559,6 @@ const char* carla_get_complete_license_text() | |||
| "<li>AT1, BLS1 and REV1 plugin code by Fons Adriaensen</li>" | |||
| #endif | |||
| "<li>MIDI Sequencer UI code by Perry Nguyen</li>" | |||
| "<li>MVerb plugin code by Martin Eastwood</li>" | |||
| "<li>Nekobi plugin code based on nekobee by Sean Bolton and others</li>" | |||
| "<li>VectorJuice and WobbleJuice plugin code by Andre Sklenar</li>" | |||
| #ifdef HAVE_ZYN_DEPS | |||
| @@ -99,7 +99,6 @@ OBJS += \ | |||
| $(OBJDIR)/distrho-3bandeq.cpp.o \ | |||
| $(OBJDIR)/distrho-3bandsplitter.cpp.o \ | |||
| $(OBJDIR)/distrho-kars.cpp.o \ | |||
| $(OBJDIR)/distrho-mverb.cpp.o \ | |||
| $(OBJDIR)/distrho-nekobi.cpp.o \ | |||
| $(OBJDIR)/distrho-pingpongpan.cpp.o | |||
| @@ -287,12 +286,6 @@ $(OBJDIR)/distrho-kars.cpp.o: distrho-kars.cpp | |||
| @echo "Compiling $<" | |||
| @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_NAMESPACE=DISTRHO_Kars -Idistrho-kars -I$(CWD)/modules/dgl -Wno-effc++ -c -o $@ | |||
| $(OBJDIR)/distrho-mverb.cpp.o: distrho-mverb.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| # FIXME - fix mverb strict warnings | |||
| @echo "Compiling $<" | |||
| @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_NAMESPACE=DISTRHO_MVerb -Idistrho-mverb -I$(CWD)/modules/dgl -Wno-conversion -Wno-effc++ -Wno-shadow -c -o $@ | |||
| $(OBJDIR)/distrho-nekobi.cpp.o: distrho-nekobi.cpp | |||
| -@mkdir -p $(OBJDIR) | |||
| # FIXME - fix nekobi strict warnings | |||
| @@ -44,7 +44,6 @@ extern void carla_register_native_plugin_carla(void); | |||
| extern void carla_register_native_plugin_distrho_3bandeq(void); | |||
| extern void carla_register_native_plugin_distrho_3bandsplitter(void); | |||
| extern void carla_register_native_plugin_distrho_kars(void); | |||
| extern void carla_register_native_plugin_distrho_mverb(void); | |||
| extern void carla_register_native_plugin_distrho_nekobi(void); | |||
| extern void carla_register_native_plugin_distrho_pingpongpan(void); | |||
| extern void carla_register_native_plugin_distrho_prom(void); | |||
| @@ -98,7 +97,6 @@ void carla_register_all_native_plugins(void) | |||
| carla_register_native_plugin_distrho_3bandeq(); | |||
| carla_register_native_plugin_distrho_3bandsplitter(); | |||
| carla_register_native_plugin_distrho_kars(); | |||
| carla_register_native_plugin_distrho_mverb(); | |||
| carla_register_native_plugin_distrho_nekobi(); | |||
| carla_register_native_plugin_distrho_pingpongpan(); | |||
| #ifdef HAVE_DGL | |||
| @@ -412,29 +412,6 @@ static const NativePluginDescriptor sNativePluginDescriptors[] = { | |||
| /* copyright */ "ISC", | |||
| DESCFUNCS | |||
| }, | |||
| { | |||
| /* category */ NATIVE_PLUGIN_CATEGORY_DELAY, | |||
| #ifdef HAVE_DGL | |||
| /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | |||
| |NATIVE_PLUGIN_HAS_UI | |||
| |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD | |||
| |NATIVE_PLUGIN_USES_PARENT_ID), | |||
| #else | |||
| /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE), | |||
| #endif | |||
| /* supports */ NATIVE_PLUGIN_SUPPORTS_NOTHING, | |||
| /* audioIns */ 2, | |||
| /* audioOuts */ 2, | |||
| /* midiIns */ 0, | |||
| /* midiOuts */ 0, | |||
| /* paramIns */ 9, | |||
| /* paramOuts */ 0, | |||
| /* name */ "MVerb", | |||
| /* label */ "mverb", | |||
| /* maker */ "falkTX, Martin Eastwood", | |||
| /* copyright */ "GPL v3+", | |||
| DESCFUNCS | |||
| }, | |||
| { | |||
| /* category */ NATIVE_PLUGIN_CATEGORY_SYNTH, | |||
| #ifdef HAVE_DGL | |||
| @@ -1,83 +0,0 @@ | |||
| /* | |||
| * Carla Native Plugins | |||
| * Copyright (C) 2012-2015 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 doc/GPL.txt file. | |||
| */ | |||
| // config fix | |||
| #include "CarlaDefines.h" | |||
| #include "distrho-mverb/DistrhoPluginInfo.h" | |||
| #if DISTRHO_PLUGIN_HAS_UI && ! defined(HAVE_DGL) | |||
| # undef DISTRHO_PLUGIN_HAS_UI | |||
| # define DISTRHO_PLUGIN_HAS_UI 0 | |||
| #endif | |||
| // Plugin Code | |||
| #include "distrho-mverb/DistrhoArtworkMVerb.cpp" | |||
| #include "distrho-mverb/DistrhoPluginMVerb.cpp" | |||
| #if DISTRHO_PLUGIN_HAS_UI | |||
| #include "distrho-mverb/DistrhoUIMVerb.cpp" | |||
| #endif | |||
| // DISTRHO Code | |||
| #define DISTRHO_PLUGIN_TARGET_CARLA | |||
| #include "DistrhoPluginMain.cpp" | |||
| #if DISTRHO_PLUGIN_HAS_UI | |||
| #include "DistrhoUIMain.cpp" | |||
| #endif | |||
| START_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------- | |||
| static const NativePluginDescriptor _mverbDesc = { | |||
| /* category */ NATIVE_PLUGIN_CATEGORY_DELAY, | |||
| #if DISTRHO_PLUGIN_HAS_UI | |||
| /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | |||
| |NATIVE_PLUGIN_HAS_UI | |||
| |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD | |||
| |NATIVE_PLUGIN_USES_PARENT_ID), | |||
| #else | |||
| /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE), | |||
| #endif | |||
| /* supports */ NATIVE_PLUGIN_SUPPORTS_NOTHING, | |||
| /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, | |||
| /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, | |||
| /* midiIns */ 0, | |||
| /* midiOuts */ 0, | |||
| /* paramIns */ MVerb<float>::NUM_PARAMS, | |||
| /* paramOuts */ 0, | |||
| /* name */ DISTRHO_PLUGIN_NAME, | |||
| /* label */ "mverb", | |||
| /* maker */ "falkTX, Martin Eastwood", | |||
| /* copyright */ "GPL v3+", | |||
| PluginDescriptorFILL(PluginCarla) | |||
| }; | |||
| END_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------- | |||
| CARLA_EXPORT | |||
| void carla_register_native_plugin_distrho_mverb(); | |||
| CARLA_EXPORT | |||
| void carla_register_native_plugin_distrho_mverb() | |||
| { | |||
| USE_NAMESPACE_DISTRHO | |||
| carla_register_native_plugin(&_mverbDesc); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| @@ -1,20 +0,0 @@ | |||
| /* (Auto-generated binary data file). */ | |||
| #ifndef BINARY_DISTRHOARTWORKMVERB_HPP | |||
| #define BINARY_DISTRHOARTWORKMVERB_HPP | |||
| namespace DistrhoArtworkMVerb | |||
| { | |||
| extern const char* backgroundData; | |||
| const unsigned int backgroundDataSize = 147744; | |||
| const unsigned int backgroundWidth = 456; | |||
| const unsigned int backgroundHeight = 108; | |||
| extern const char* knobData; | |||
| const unsigned int knobDataSize = 528384; | |||
| const unsigned int knobWidth = 32; | |||
| const unsigned int knobHeight = 4128; | |||
| } | |||
| #endif // BINARY_DISTRHOARTWORKMVERB_HPP | |||
| @@ -1,35 +0,0 @@ | |||
| /* | |||
| * DISTRHO MVerb, a DPF'ied MVerb. | |||
| * Copyright (c) 2010 Martin Eastwood | |||
| * Copyright (C) 2015 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 3 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 LICENSE file. | |||
| */ | |||
| #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_BRAND "DISTRHO" | |||
| #define DISTRHO_PLUGIN_NAME "MVerb" | |||
| #define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/MVerb" | |||
| #define DISTRHO_PLUGIN_HAS_UI 1 | |||
| #define DISTRHO_PLUGIN_IS_RT_SAFE 1 | |||
| #define DISTRHO_PLUGIN_NUM_INPUTS 2 | |||
| #define DISTRHO_PLUGIN_NUM_OUTPUTS 2 | |||
| #define DISTRHO_PLUGIN_WANT_PROGRAMS 1 | |||
| #define DISTRHO_PLUGIN_USES_MODGUI 1 | |||
| #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:ReverbPlugin" | |||
| #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| @@ -1,235 +0,0 @@ | |||
| /* | |||
| * DISTRHO MVerb, a DPF'ied MVerb. | |||
| * Copyright (c) 2010 Martin Eastwood | |||
| * Copyright (C) 2015 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 3 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 LICENSE file. | |||
| */ | |||
| #include "DistrhoPluginMVerb.hpp" | |||
| START_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------- | |||
| DistrhoPluginMVerb::DistrhoPluginMVerb() | |||
| : Plugin(MVerb<float>::NUM_PARAMS, 5, 0) // 5 program, 0 states | |||
| { | |||
| fVerb.setSampleRate(getSampleRate()); | |||
| // set initial values | |||
| loadProgram(0); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| // Init | |||
| void DistrhoPluginMVerb::initParameter(uint32_t index, Parameter& parameter) | |||
| { | |||
| parameter.unit = "%"; | |||
| parameter.ranges.min = 0.0f; | |||
| parameter.ranges.max = 100.0f; | |||
| // default values taken from 1st preset | |||
| switch (index) | |||
| { | |||
| case MVerb<float>::DAMPINGFREQ: | |||
| parameter.hints = kParameterIsAutomable; | |||
| parameter.name = "Damping"; | |||
| parameter.symbol = "damping"; | |||
| parameter.ranges.def = 0.5f * 100.0f; | |||
| break; | |||
| case MVerb<float>::DENSITY: | |||
| parameter.hints = kParameterIsAutomable; | |||
| parameter.name = "Density"; | |||
| parameter.symbol = "density"; | |||
| parameter.ranges.def = 0.5f * 100.0f; | |||
| break; | |||
| case MVerb<float>::BANDWIDTHFREQ: | |||
| parameter.hints = kParameterIsAutomable; | |||
| parameter.name = "Bandwidth"; | |||
| parameter.symbol = "bandwidth"; | |||
| parameter.ranges.def = 0.5f * 100.0f; | |||
| break; | |||
| case MVerb<float>::DECAY: | |||
| parameter.hints = kParameterIsAutomable; | |||
| parameter.name = "Decay"; | |||
| parameter.symbol = "decay"; | |||
| parameter.ranges.def = 0.5f * 100.0f; | |||
| break; | |||
| case MVerb<float>::PREDELAY: | |||
| parameter.hints = kParameterIsAutomable; | |||
| parameter.name = "Predelay"; | |||
| parameter.symbol = "predelay"; | |||
| parameter.ranges.def = 0.5f * 100.0f; | |||
| break; | |||
| case MVerb<float>::SIZE: | |||
| parameter.hints = kParameterIsAutomable; | |||
| parameter.name = "Size"; | |||
| parameter.symbol = "size"; | |||
| parameter.ranges.def = 0.75f * 100.0f; | |||
| parameter.ranges.min = 0.05f * 100.0f; | |||
| break; | |||
| case MVerb<float>::GAIN: | |||
| parameter.hints = kParameterIsAutomable; | |||
| parameter.name = "Gain"; | |||
| parameter.symbol = "gain"; | |||
| parameter.ranges.def = 1.0f * 100.0f; | |||
| break; | |||
| case MVerb<float>::MIX: | |||
| parameter.hints = kParameterIsAutomable; | |||
| parameter.name = "Mix"; | |||
| parameter.symbol = "mix"; | |||
| parameter.ranges.def = 0.5f * 100.0f; | |||
| break; | |||
| case MVerb<float>::EARLYMIX: | |||
| parameter.hints = kParameterIsAutomable; | |||
| parameter.name = "Early/Late Mix"; | |||
| parameter.symbol = "earlymix"; | |||
| parameter.ranges.def = 0.5f * 100.0f; | |||
| break; | |||
| } | |||
| } | |||
| void DistrhoPluginMVerb::initProgramName(uint32_t index, String& programName) | |||
| { | |||
| switch(index) | |||
| { | |||
| case 0: | |||
| programName = "Halves"; | |||
| break; | |||
| case 1: | |||
| programName = "Dark"; | |||
| break; | |||
| case 2: | |||
| programName = "Cupboard"; | |||
| break; | |||
| case 3: | |||
| programName = "Stadium"; | |||
| break; | |||
| case 4: | |||
| programName = "Subtle"; | |||
| break; | |||
| } | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| // Internal data | |||
| float DistrhoPluginMVerb::getParameterValue(uint32_t index) const | |||
| { | |||
| return fVerb.getParameter(static_cast<int>(index)) * 100.0f; | |||
| } | |||
| void DistrhoPluginMVerb::setParameterValue(uint32_t index, float value) | |||
| { | |||
| fVerb.setParameter(static_cast<int>(index), value / 100.0f); | |||
| } | |||
| void DistrhoPluginMVerb::loadProgram(uint32_t index) | |||
| { | |||
| // NOTE: DAMPINGFREQ is reversed | |||
| switch(index) | |||
| { | |||
| case 0: | |||
| fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::PREDELAY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::SIZE, 0.75f); | |||
| fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::MIX, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::EARLYMIX, 0.5f); | |||
| break; | |||
| case 1: | |||
| fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 0.1f); | |||
| fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 0.1f); | |||
| fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::PREDELAY, 0.0f); | |||
| fVerb.setParameter(MVerb<float>::SIZE, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::MIX, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::EARLYMIX, 0.75f); | |||
| break; | |||
| case 2: | |||
| fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::PREDELAY, 0.0f); | |||
| fVerb.setParameter(MVerb<float>::SIZE, 0.25f); | |||
| fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::MIX, 0.35f); | |||
| fVerb.setParameter(MVerb<float>::EARLYMIX, 0.75f); | |||
| break; | |||
| case 3: | |||
| fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::PREDELAY, 0.0f); | |||
| fVerb.setParameter(MVerb<float>::SIZE, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::MIX, 0.35f); | |||
| fVerb.setParameter(MVerb<float>::EARLYMIX, 0.75f); | |||
| break; | |||
| case 4: | |||
| fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::PREDELAY, 0.0f); | |||
| fVerb.setParameter(MVerb<float>::SIZE, 0.5f); | |||
| fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||
| fVerb.setParameter(MVerb<float>::MIX, 0.15f); | |||
| fVerb.setParameter(MVerb<float>::EARLYMIX, 0.75f); | |||
| break; | |||
| } | |||
| fVerb.reset(); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| // Process | |||
| void DistrhoPluginMVerb::activate() | |||
| { | |||
| fVerb.reset(); | |||
| } | |||
| void DistrhoPluginMVerb::run(const float** inputs, float** outputs, uint32_t frames) | |||
| { | |||
| fVerb.process(inputs, outputs, static_cast<int>(frames)); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| // Callbacks | |||
| void DistrhoPluginMVerb::sampleRateChanged(double newSampleRate) | |||
| { | |||
| fVerb.setSampleRate(newSampleRate); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| Plugin* createPlugin() | |||
| { | |||
| return new DistrhoPluginMVerb(); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| @@ -1,109 +0,0 @@ | |||
| /* | |||
| * DISTRHO MVerb, a DPF'ied MVerb. | |||
| * Copyright (c) 2010 Martin Eastwood | |||
| * Copyright (C) 2015 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 3 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 LICENSE file. | |||
| */ | |||
| #ifndef DISTRHO_PLUGIN_MVERB_HPP_INCLUDED | |||
| #define DISTRHO_PLUGIN_MVERB_HPP_INCLUDED | |||
| #include "DistrhoPlugin.hpp" | |||
| #include "MVerb.h" | |||
| START_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------- | |||
| class DistrhoPluginMVerb : public Plugin | |||
| { | |||
| public: | |||
| DistrhoPluginMVerb(); | |||
| protected: | |||
| // ------------------------------------------------------------------- | |||
| // Information | |||
| const char* getLabel() const noexcept override | |||
| { | |||
| return "MVerb"; | |||
| } | |||
| const char* getDescription() const override | |||
| { | |||
| return "Studio quality reverb, provides a practical demonstration of Dattorro’s figure-of-eight reverb structure."; | |||
| } | |||
| const char* getMaker() const noexcept override | |||
| { | |||
| return "Martin Eastwood, falkTX"; | |||
| } | |||
| const char* getHomePage() const override | |||
| { | |||
| return "https://github.com/DISTRHO/MVerb"; | |||
| } | |||
| const char* getLicense() const noexcept override | |||
| { | |||
| return "GPL v3+"; | |||
| } | |||
| uint32_t getVersion() const noexcept override | |||
| { | |||
| return d_version(1, 0, 0); | |||
| } | |||
| int64_t getUniqueId() const noexcept override | |||
| { | |||
| return d_cconst('M', 'V', 'r', 'b'); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // Init | |||
| void initParameter(uint32_t index, Parameter& parameter) override; | |||
| void initProgramName(uint32_t index, String& programName) override; | |||
| // ------------------------------------------------------------------- | |||
| // Internal data | |||
| float getParameterValue(uint32_t index) const override; | |||
| void setParameterValue(uint32_t index, float value) override; | |||
| void loadProgram(uint32_t index) override; | |||
| // ------------------------------------------------------------------- | |||
| // Process | |||
| void activate() override; | |||
| void run(const float** inputs, float** outputs, uint32_t frames) override; | |||
| // ------------------------------------------------------------------- | |||
| // Callbacks | |||
| void sampleRateChanged(double newSampleRate) override; | |||
| // ------------------------------------------------------------------- | |||
| private: | |||
| MVerb<float> fVerb; | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginMVerb) | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // DISTRHO_PLUGIN_MVERB_HPP_INCLUDED | |||
| @@ -1,259 +0,0 @@ | |||
| /* | |||
| * DISTRHO MVerb, a DPF'ied MVerb. | |||
| * Copyright (c) 2010 Martin Eastwood | |||
| * Copyright (C) 2015 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 3 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 LICENSE file. | |||
| */ | |||
| #include "DistrhoUIMVerb.hpp" | |||
| #include "MVerb.h" | |||
| START_NAMESPACE_DISTRHO | |||
| namespace Art = DistrhoArtworkMVerb; | |||
| using DGL::Color; | |||
| // ----------------------------------------------------------------------- | |||
| DistrhoUIMVerb::DistrhoUIMVerb() | |||
| : UI(Art::backgroundWidth, Art::backgroundHeight), | |||
| fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR) | |||
| { | |||
| // text | |||
| fNanoText.loadSharedResources(); | |||
| fNanoFont = fNanoText.findFont(NANOVG_DEJAVU_SANS_TTF); | |||
| // knobs | |||
| Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight); | |||
| { | |||
| ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||
| knob->setId(MVerb<float>::DAMPINGFREQ); | |||
| knob->setAbsolutePos(56 + 7*40, 40); | |||
| knob->setRange(0.0f, 100.0f); | |||
| knob->setDefault(50.0f); | |||
| knob->setCallback(this); | |||
| fKnobs.push_back(knob); | |||
| } | |||
| { | |||
| ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||
| knob->setId(MVerb<float>::DENSITY); | |||
| knob->setAbsolutePos(56 + 4*40, 40); | |||
| knob->setRange(0.0f, 100.0f); | |||
| knob->setDefault(50.0f); | |||
| knob->setCallback(this); | |||
| fKnobs.push_back(knob); | |||
| } | |||
| { | |||
| ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||
| knob->setId(MVerb<float>::BANDWIDTHFREQ); | |||
| knob->setAbsolutePos(56 + 5*40, 40); | |||
| knob->setRange(0.0f, 100.0f); | |||
| knob->setDefault(50.0f); | |||
| knob->setCallback(this); | |||
| fKnobs.push_back(knob); | |||
| } | |||
| { | |||
| ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||
| knob->setId(MVerb<float>::DECAY); | |||
| knob->setAbsolutePos(56 + 6*40, 40); | |||
| knob->setRange(0.0f, 100.0f); | |||
| knob->setDefault(50.0f); | |||
| knob->setCallback(this); | |||
| fKnobs.push_back(knob); | |||
| } | |||
| { | |||
| ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||
| knob->setId(MVerb<float>::PREDELAY); | |||
| knob->setAbsolutePos(56 + 1*40, 40); | |||
| knob->setRange(0.0f, 100.0f); | |||
| knob->setDefault(50.0f); | |||
| knob->setCallback(this); | |||
| fKnobs.push_back(knob); | |||
| } | |||
| { | |||
| ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||
| knob->setId(MVerb<float>::SIZE); | |||
| knob->setAbsolutePos(56 + 3*40, 40); | |||
| knob->setRange(5.0f, 100.0f); | |||
| knob->setDefault(100.0f); | |||
| knob->setCallback(this); | |||
| fKnobs.push_back(knob); | |||
| } | |||
| { | |||
| ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||
| knob->setId(MVerb<float>::GAIN); | |||
| knob->setAbsolutePos(56 + 8*40, 40); | |||
| knob->setRange(0.0f, 100.0f); | |||
| knob->setDefault(75.0f); | |||
| knob->setCallback(this); | |||
| fKnobs.push_back(knob); | |||
| } | |||
| { | |||
| ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||
| knob->setId(MVerb<float>::MIX); | |||
| knob->setAbsolutePos(56 + 0*40, 40); | |||
| knob->setRange(0.0f, 100.0f); | |||
| knob->setDefault(50.0f); | |||
| knob->setCallback(this); | |||
| fKnobs.push_back(knob); | |||
| } | |||
| { | |||
| ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||
| knob->setId(MVerb<float>::EARLYMIX); | |||
| knob->setAbsolutePos(56 + 2*40, 40); | |||
| knob->setRange(0.0f, 100.0f); | |||
| knob->setDefault(50.0f); | |||
| knob->setCallback(this); | |||
| fKnobs.push_back(knob); | |||
| } | |||
| // set initial values | |||
| programLoaded(0); | |||
| } | |||
| DistrhoUIMVerb::~DistrhoUIMVerb() | |||
| { | |||
| for (std::vector<ImageKnob*>::iterator it=fKnobs.begin(), end=fKnobs.end(); it != end; ++it) | |||
| { | |||
| ImageKnob* const knob(*it); | |||
| delete knob; | |||
| } | |||
| fKnobs.clear(); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| // DSP Callbacks | |||
| void DistrhoUIMVerb::parameterChanged(uint32_t index, float value) | |||
| { | |||
| fKnobs[index]->setValue(value); | |||
| } | |||
| void DistrhoUIMVerb::programLoaded(uint32_t index) | |||
| { | |||
| switch(index) | |||
| { | |||
| case 0: | |||
| fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::PREDELAY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||
| fKnobs[MVerb<float>::MIX]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::EARLYMIX]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::SIZE]->setValue(0.75f*100.0f); | |||
| break; | |||
| case 1: | |||
| fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.9f*100.0f); | |||
| fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(0.1f*100.0f); | |||
| fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::PREDELAY]->setValue(0.0f*100.0f); | |||
| fKnobs[MVerb<float>::SIZE]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||
| fKnobs[MVerb<float>::MIX]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::EARLYMIX]->setValue(0.75f*100.0f); | |||
| break; | |||
| case 2: | |||
| fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.0f*100.0f); | |||
| fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(1.0f*100.0f); | |||
| fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::PREDELAY]->setValue(0.0f*100.0f); | |||
| fKnobs[MVerb<float>::SIZE]->setValue(0.25f*100.0f); | |||
| fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||
| fKnobs[MVerb<float>::MIX]->setValue(0.35f*100.0f); | |||
| fKnobs[MVerb<float>::EARLYMIX]->setValue(0.75f*100.0f); | |||
| break; | |||
| case 3: | |||
| fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.0f*100.0f); | |||
| fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(1.0f*100.0f); | |||
| fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::PREDELAY]->setValue(0.0f*100.0f); | |||
| fKnobs[MVerb<float>::SIZE]->setValue(1.0f*100.0f); | |||
| fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||
| fKnobs[MVerb<float>::MIX]->setValue(0.35f*100.0f); | |||
| fKnobs[MVerb<float>::EARLYMIX]->setValue(0.75f*100.0f); | |||
| break; | |||
| case 4: | |||
| fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.0f*100.0f); | |||
| fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(1.0f*100.0f); | |||
| fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::PREDELAY]->setValue(0.0f*100.0f); | |||
| fKnobs[MVerb<float>::SIZE]->setValue(0.5f*100.0f); | |||
| fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||
| fKnobs[MVerb<float>::MIX]->setValue(0.15f*100.0f); | |||
| fKnobs[MVerb<float>::EARLYMIX]->setValue(0.75f*100.0f); | |||
| break; | |||
| } | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| // Widget Callbacks | |||
| void DistrhoUIMVerb::imageKnobDragStarted(ImageKnob* knob) | |||
| { | |||
| editParameter(knob->getId(), true); | |||
| } | |||
| void DistrhoUIMVerb::imageKnobDragFinished(ImageKnob* knob) | |||
| { | |||
| editParameter(knob->getId(), false); | |||
| } | |||
| void DistrhoUIMVerb::imageKnobValueChanged(ImageKnob* knob, float value) | |||
| { | |||
| setParameterValue(knob->getId(), value); | |||
| } | |||
| void DistrhoUIMVerb::onDisplay() | |||
| { | |||
| fImgBackground.draw(); | |||
| // text display | |||
| fNanoText.beginFrame(this); | |||
| fNanoText.fontFaceId(fNanoFont); | |||
| fNanoText.fontSize(13); | |||
| fNanoText.textAlign(NanoVG::ALIGN_CENTER|NanoVG::ALIGN_TOP); | |||
| fNanoText.fillColor(Color(1.0f, 1.0f, 1.0f)); | |||
| char strBuf[32+1]; | |||
| strBuf[32] = '\0'; | |||
| for (std::size_t i=0; i<MVerb<float>::NUM_PARAMS; ++i) | |||
| { | |||
| std::snprintf(strBuf, 32, "%i%%", int(fKnobs[i]->getValue())); | |||
| fNanoText.textBox(56.0f + float(fKnobs[i]->getAbsoluteX()) - 56.0f, 76.0f, 34.0f, strBuf, nullptr); | |||
| } | |||
| fNanoText.endFrame(); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| UI* createUI() | |||
| { | |||
| return new DistrhoUIMVerb(); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| @@ -1,74 +0,0 @@ | |||
| /* | |||
| * DISTRHO MVerb, a DPF'ied MVerb. | |||
| * Copyright (c) 2010 Martin Eastwood | |||
| * Copyright (C) 2015 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 3 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 LICENSE file. | |||
| */ | |||
| #ifndef DISTRHO_UI_MVERB_HPP_INCLUDED | |||
| #define DISTRHO_UI_MVERB_HPP_INCLUDED | |||
| #include "DistrhoUI.hpp" | |||
| #include "NanoVG.hpp" | |||
| #include "ImageWidgets.hpp" | |||
| #include "DistrhoArtworkMVerb.hpp" | |||
| #include <vector> | |||
| using DGL::Image; | |||
| using DGL::ImageKnob; | |||
| using DGL::NanoVG; | |||
| START_NAMESPACE_DISTRHO | |||
| // ----------------------------------------------------------------------- | |||
| class DistrhoUIMVerb : public UI, | |||
| public ImageKnob::Callback | |||
| { | |||
| public: | |||
| DistrhoUIMVerb(); | |||
| ~DistrhoUIMVerb() override; | |||
| protected: | |||
| // ------------------------------------------------------------------- | |||
| // DSP Callbacks | |||
| void parameterChanged(uint32_t index, float value) override; | |||
| void programLoaded(uint32_t index) override; | |||
| // ------------------------------------------------------------------- | |||
| // Widget Callbacks | |||
| void imageKnobDragStarted(ImageKnob* knob) override; | |||
| void imageKnobDragFinished(ImageKnob* knob) override; | |||
| void imageKnobValueChanged(ImageKnob* knob, float value) override; | |||
| void onDisplay() override; | |||
| private: | |||
| Image fImgBackground; | |||
| NanoVG fNanoText; | |||
| NanoVG::FontId fNanoFont; | |||
| std::vector<ImageKnob*> fKnobs; | |||
| DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIMVerb) | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // DISTRHO_UI_MVERB_HPP_INCLUDED | |||
| @@ -1,842 +0,0 @@ | |||
| // Copyright (c) 2010 Martin Eastwood | |||
| // This code is distributed under the terms of the GNU General Public License | |||
| // MVerb 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 3 of the License, or | |||
| // at your option) any later version. | |||
| // | |||
| // MVerb 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. | |||
| // | |||
| // You should have received a copy of the GNU General Public License | |||
| // along with this MVerb. If not, see <http://www.gnu.org/licenses/>. | |||
| #ifndef EMVERB_H | |||
| #define EMVERB_H | |||
| #include <cmath> | |||
| #include <cstring> | |||
| //forward declaration | |||
| template<typename T, int maxLength> class Allpass; | |||
| template<typename T, int maxLength> class StaticAllpassFourTap; | |||
| template<typename T, int maxLength> class StaticDelayLine; | |||
| template<typename T, int maxLength> class StaticDelayLineFourTap; | |||
| template<typename T, int maxLength> class StaticDelayLineEightTap; | |||
| template<typename T, int OverSampleCount> class StateVariable; | |||
| template<typename T> | |||
| class MVerb | |||
| { | |||
| private: | |||
| Allpass<T, 96000> allpass[4]; | |||
| StaticAllpassFourTap<T, 96000> allpassFourTap[4]; | |||
| StateVariable<T,4> bandwidthFilter[2]; | |||
| StateVariable<T,4> damping[2]; | |||
| StaticDelayLine<T, 96000> predelay; | |||
| StaticDelayLineFourTap<T, 96000> staticDelayLine[4]; | |||
| StaticDelayLineEightTap<T, 96000> earlyReflectionsDelayLine[2]; | |||
| T SampleRate, DampingFreq, Density1, Density2, BandwidthFreq, PreDelayTime, Decay, Gain, Mix, EarlyMix, Size; | |||
| T MixSmooth, EarlyLateSmooth, BandwidthSmooth, DampingSmooth, PredelaySmooth, SizeSmooth, DensitySmooth, DecaySmooth; | |||
| T PreviousLeftTank, PreviousRightTank; | |||
| int ControlRate, ControlRateCounter; | |||
| public: | |||
| enum | |||
| { | |||
| DAMPINGFREQ=0, | |||
| DENSITY, | |||
| BANDWIDTHFREQ, | |||
| DECAY, | |||
| PREDELAY, | |||
| SIZE, | |||
| GAIN, | |||
| MIX, | |||
| EARLYMIX, | |||
| NUM_PARAMS | |||
| }; | |||
| MVerb(){ | |||
| DampingFreq = 18000.; | |||
| BandwidthFreq = 18000.; | |||
| SampleRate = 44100.; | |||
| Decay = 0.5; | |||
| Gain = 1.; | |||
| Mix = 1.; | |||
| Size = 1.; | |||
| EarlyMix = 1.; | |||
| PreviousLeftTank = 0.; | |||
| PreviousRightTank = 0.; | |||
| PreDelayTime = 100 * (SampleRate / 1000); | |||
| MixSmooth = EarlyLateSmooth = BandwidthSmooth = DampingSmooth = PredelaySmooth = SizeSmooth = DecaySmooth = DensitySmooth = 0.; | |||
| ControlRate = SampleRate / 1000; | |||
| ControlRateCounter = 0; | |||
| reset(); | |||
| } | |||
| ~MVerb(){ | |||
| //nowt to do here | |||
| } | |||
| void process(const T **inputs, T **outputs, int sampleFrames){ | |||
| T OneOverSampleFrames = 1. / sampleFrames; | |||
| T MixDelta = (Mix - MixSmooth) * OneOverSampleFrames; | |||
| T EarlyLateDelta = (EarlyMix - EarlyLateSmooth) * OneOverSampleFrames; | |||
| T BandwidthDelta = (((BandwidthFreq * 18400.) + 100.) - BandwidthSmooth) * OneOverSampleFrames; | |||
| T DampingDelta = (((DampingFreq * 18400.) + 100.) - DampingSmooth) * OneOverSampleFrames; | |||
| T PredelayDelta = ((PreDelayTime * 200 * (SampleRate / 1000)) - PredelaySmooth) * OneOverSampleFrames; | |||
| T SizeDelta = (Size - SizeSmooth) * OneOverSampleFrames; | |||
| T DecayDelta = (((0.7995f * Decay) + 0.005) - DecaySmooth) * OneOverSampleFrames; | |||
| T DensityDelta = (((0.7995f * Density1) + 0.005) - DensitySmooth) * OneOverSampleFrames; | |||
| for(int i=0;i<sampleFrames;++i){ | |||
| T left = inputs[0][i]; | |||
| T right = inputs[1][i]; | |||
| MixSmooth += MixDelta; | |||
| EarlyLateSmooth += EarlyLateDelta; | |||
| BandwidthSmooth += BandwidthDelta; | |||
| DampingSmooth += DampingDelta; | |||
| PredelaySmooth += PredelayDelta; | |||
| SizeSmooth += SizeDelta; | |||
| DecaySmooth += DecayDelta; | |||
| DensitySmooth += DensityDelta; | |||
| if (ControlRateCounter >= ControlRate){ | |||
| ControlRateCounter = 0; | |||
| bandwidthFilter[0].Frequency(BandwidthSmooth); | |||
| bandwidthFilter[1].Frequency(BandwidthSmooth); | |||
| damping[0].Frequency(DampingSmooth); | |||
| damping[1].Frequency(DampingSmooth); | |||
| } | |||
| ++ControlRateCounter; | |||
| predelay.SetLength(PredelaySmooth); | |||
| Density2 = DecaySmooth + 0.15; | |||
| if (Density2 > 0.5) | |||
| Density2 = 0.5; | |||
| if (Density2 < 0.25) | |||
| Density2 = 0.25; | |||
| allpassFourTap[1].SetFeedback(Density2); | |||
| allpassFourTap[3].SetFeedback(Density2); | |||
| allpassFourTap[0].SetFeedback(Density1); | |||
| allpassFourTap[2].SetFeedback(Density1); | |||
| T bandwidthLeft = bandwidthFilter[0](left) ; | |||
| T bandwidthRight = bandwidthFilter[1](right) ; | |||
| T earlyReflectionsL = earlyReflectionsDelayLine[0] ( bandwidthLeft * 0.5 + bandwidthRight * 0.3 ) | |||
| + earlyReflectionsDelayLine[0].GetIndex(2) * 0.6 | |||
| + earlyReflectionsDelayLine[0].GetIndex(3) * 0.4 | |||
| + earlyReflectionsDelayLine[0].GetIndex(4) * 0.3 | |||
| + earlyReflectionsDelayLine[0].GetIndex(5) * 0.3 | |||
| + earlyReflectionsDelayLine[0].GetIndex(6) * 0.1 | |||
| + earlyReflectionsDelayLine[0].GetIndex(7) * 0.1 | |||
| + ( bandwidthLeft * 0.4 + bandwidthRight * 0.2 ) * 0.5 ; | |||
| T earlyReflectionsR = earlyReflectionsDelayLine[1] ( bandwidthLeft * 0.3 + bandwidthRight * 0.5 ) | |||
| + earlyReflectionsDelayLine[1].GetIndex(2) * 0.6 | |||
| + earlyReflectionsDelayLine[1].GetIndex(3) * 0.4 | |||
| + earlyReflectionsDelayLine[1].GetIndex(4) * 0.3 | |||
| + earlyReflectionsDelayLine[1].GetIndex(5) * 0.3 | |||
| + earlyReflectionsDelayLine[1].GetIndex(6) * 0.1 | |||
| + earlyReflectionsDelayLine[1].GetIndex(7) * 0.1 | |||
| + ( bandwidthLeft * 0.2 + bandwidthRight * 0.4 ) * 0.5 ; | |||
| T predelayMonoInput = predelay(( bandwidthRight + bandwidthLeft ) * 0.5f); | |||
| T smearedInput = predelayMonoInput; | |||
| for(int j=0;j<4;j++) | |||
| smearedInput = allpass[j] ( smearedInput ); | |||
| T leftTank = allpassFourTap[0] ( smearedInput + PreviousRightTank ) ; | |||
| leftTank = staticDelayLine[0] (leftTank); | |||
| leftTank = damping[0](leftTank); | |||
| leftTank = allpassFourTap[1](leftTank); | |||
| leftTank = staticDelayLine[1](leftTank); | |||
| T rightTank = allpassFourTap[2] (smearedInput + PreviousLeftTank) ; | |||
| rightTank = staticDelayLine[2](rightTank); | |||
| rightTank = damping[1] (rightTank); | |||
| rightTank = allpassFourTap[3](rightTank); | |||
| rightTank = staticDelayLine[3](rightTank); | |||
| PreviousLeftTank = leftTank * DecaySmooth; | |||
| PreviousRightTank = rightTank * DecaySmooth; | |||
| T accumulatorL = (0.6*staticDelayLine[2].GetIndex(1)) | |||
| +(0.6*staticDelayLine[2].GetIndex(2)) | |||
| -(0.6*allpassFourTap[3].GetIndex(1)) | |||
| +(0.6*staticDelayLine[3].GetIndex(1)) | |||
| -(0.6*staticDelayLine[0].GetIndex(1)) | |||
| -(0.6*allpassFourTap[1].GetIndex(1)) | |||
| -(0.6*staticDelayLine[1].GetIndex(1)); | |||
| T accumulatorR = (0.6*staticDelayLine[0].GetIndex(2)) | |||
| +(0.6*staticDelayLine[0].GetIndex(3)) | |||
| -(0.6*allpassFourTap[1].GetIndex(2)) | |||
| +(0.6*staticDelayLine[1].GetIndex(2)) | |||
| -(0.6*staticDelayLine[2].GetIndex(3)) | |||
| -(0.6*allpassFourTap[3].GetIndex(2)) | |||
| -(0.6*staticDelayLine[3].GetIndex(2)); | |||
| accumulatorL = ((accumulatorL * EarlyMix) + ((1 - EarlyMix) * earlyReflectionsL)); | |||
| accumulatorR = ((accumulatorR * EarlyMix) + ((1 - EarlyMix) * earlyReflectionsR)); | |||
| left = ( left + MixSmooth * ( accumulatorL - left ) ) * Gain; | |||
| right = ( right + MixSmooth * ( accumulatorR - right ) ) * Gain; | |||
| outputs[0][i] = left; | |||
| outputs[1][i] = right; | |||
| } | |||
| } | |||
| void reset(){ | |||
| ControlRateCounter = 0; | |||
| bandwidthFilter[0].SetSampleRate (SampleRate ); | |||
| bandwidthFilter[1].SetSampleRate (SampleRate ); | |||
| bandwidthFilter[0].Reset(); | |||
| bandwidthFilter[1].Reset(); | |||
| damping[0].SetSampleRate (SampleRate ); | |||
| damping[1].SetSampleRate (SampleRate ); | |||
| damping[0].Reset(); | |||
| damping[1].Reset(); | |||
| predelay.Clear(); | |||
| predelay.SetLength(PreDelayTime); | |||
| allpass[0].Clear(); | |||
| allpass[1].Clear(); | |||
| allpass[2].Clear(); | |||
| allpass[3].Clear(); | |||
| allpass[0].SetLength (0.0048 * SampleRate); | |||
| allpass[1].SetLength (0.0036 * SampleRate); | |||
| allpass[2].SetLength (0.0127 * SampleRate); | |||
| allpass[3].SetLength (0.0093 * SampleRate); | |||
| allpass[0].SetFeedback (0.75); | |||
| allpass[1].SetFeedback (0.75); | |||
| allpass[2].SetFeedback (0.625); | |||
| allpass[3].SetFeedback (0.625); | |||
| allpassFourTap[0].Clear(); | |||
| allpassFourTap[1].Clear(); | |||
| allpassFourTap[2].Clear(); | |||
| allpassFourTap[3].Clear(); | |||
| allpassFourTap[0].SetLength(0.020 * SampleRate * Size); | |||
| allpassFourTap[1].SetLength(0.060 * SampleRate * Size); | |||
| allpassFourTap[2].SetLength(0.030 * SampleRate * Size); | |||
| allpassFourTap[3].SetLength(0.089 * SampleRate * Size); | |||
| allpassFourTap[0].SetFeedback(Density1); | |||
| allpassFourTap[1].SetFeedback(Density2); | |||
| allpassFourTap[2].SetFeedback(Density1); | |||
| allpassFourTap[3].SetFeedback(Density2); | |||
| allpassFourTap[0].SetIndex(0,0,0,0); | |||
| allpassFourTap[1].SetIndex(0,0.006 * SampleRate * Size, 0.041 * SampleRate * Size, 0); | |||
| allpassFourTap[2].SetIndex(0,0,0,0); | |||
| allpassFourTap[3].SetIndex(0,0.031 * SampleRate * Size, 0.011 * SampleRate * Size, 0); | |||
| staticDelayLine[0].Clear(); | |||
| staticDelayLine[1].Clear(); | |||
| staticDelayLine[2].Clear(); | |||
| staticDelayLine[3].Clear(); | |||
| staticDelayLine[0].SetLength(0.15 * SampleRate * Size); | |||
| staticDelayLine[1].SetLength(0.12 * SampleRate * Size); | |||
| staticDelayLine[2].SetLength(0.14 * SampleRate * Size); | |||
| staticDelayLine[3].SetLength(0.11 * SampleRate * Size); | |||
| staticDelayLine[0].SetIndex(0, 0.067 * SampleRate * Size, 0.011 * SampleRate * Size , 0.121 * SampleRate * Size); | |||
| staticDelayLine[1].SetIndex(0, 0.036 * SampleRate * Size, 0.089 * SampleRate * Size , 0); | |||
| staticDelayLine[2].SetIndex(0, 0.0089 * SampleRate * Size, 0.099 * SampleRate * Size , 0); | |||
| staticDelayLine[3].SetIndex(0, 0.067 * SampleRate * Size, 0.0041 * SampleRate * Size , 0); | |||
| earlyReflectionsDelayLine[0].Clear(); | |||
| earlyReflectionsDelayLine[1].Clear(); | |||
| earlyReflectionsDelayLine[0].SetLength(0.089 * SampleRate); | |||
| earlyReflectionsDelayLine[0].SetIndex (0, 0.0199*SampleRate, 0.0219*SampleRate, 0.0354*SampleRate,0.0389*SampleRate, 0.0414*SampleRate, 0.0692*SampleRate, 0); | |||
| earlyReflectionsDelayLine[1].SetLength(0.069 * SampleRate); | |||
| earlyReflectionsDelayLine[1].SetIndex (0, 0.0099*SampleRate, 0.011*SampleRate, 0.0182*SampleRate,0.0189*SampleRate, 0.0213*SampleRate, 0.0431*SampleRate, 0); | |||
| } | |||
| void setParameter(int index, T value){ | |||
| switch(index){ | |||
| case DAMPINGFREQ: | |||
| DampingFreq = /* 1. - */ value; // FIXME? | |||
| break; | |||
| case DENSITY: | |||
| Density1 = value; | |||
| break; | |||
| case BANDWIDTHFREQ: | |||
| BandwidthFreq = value; | |||
| break; | |||
| case PREDELAY: | |||
| PreDelayTime = value; | |||
| break; | |||
| case SIZE: | |||
| Size = value; | |||
| allpassFourTap[0].Clear(); | |||
| allpassFourTap[1].Clear(); | |||
| allpassFourTap[2].Clear(); | |||
| allpassFourTap[3].Clear(); | |||
| allpassFourTap[0].SetLength(0.020 * SampleRate * Size); | |||
| allpassFourTap[1].SetLength(0.060 * SampleRate * Size); | |||
| allpassFourTap[2].SetLength(0.030 * SampleRate * Size); | |||
| allpassFourTap[3].SetLength(0.089 * SampleRate * Size); | |||
| allpassFourTap[1].SetIndex(0,0.006 * SampleRate * Size, 0.041 * SampleRate * Size, 0); | |||
| allpassFourTap[3].SetIndex(0,0.031 * SampleRate * Size, 0.011 * SampleRate * Size, 0); | |||
| staticDelayLine[0].Clear(); | |||
| staticDelayLine[1].Clear(); | |||
| staticDelayLine[2].Clear(); | |||
| staticDelayLine[3].Clear(); | |||
| staticDelayLine[0].SetLength(0.15 * SampleRate * Size); | |||
| staticDelayLine[1].SetLength(0.12 * SampleRate * Size); | |||
| staticDelayLine[2].SetLength(0.14 * SampleRate * Size); | |||
| staticDelayLine[3].SetLength(0.11 * SampleRate * Size); | |||
| staticDelayLine[0].SetIndex(0, 0.067 * SampleRate * Size, 0.011 * SampleRate * Size , 0.121 * SampleRate * Size); | |||
| staticDelayLine[1].SetIndex(0, 0.036 * SampleRate * Size, 0.089 * SampleRate * Size , 0); | |||
| staticDelayLine[2].SetIndex(0, 0.0089 * SampleRate * Size, 0.099 * SampleRate * Size , 0); | |||
| staticDelayLine[3].SetIndex(0, 0.067 * SampleRate * Size, 0.0041 * SampleRate * Size , 0); | |||
| break; | |||
| case DECAY: | |||
| Decay = value; | |||
| break; | |||
| case GAIN: | |||
| Gain = value; | |||
| break; | |||
| case MIX: | |||
| Mix = value; | |||
| break; | |||
| case EARLYMIX: | |||
| EarlyMix = value; | |||
| break; | |||
| } | |||
| } | |||
| float getParameter(int index) const{ | |||
| switch(index){ | |||
| case DAMPINGFREQ: | |||
| return DampingFreq; | |||
| break; | |||
| case DENSITY: | |||
| return Density1; | |||
| break; | |||
| case BANDWIDTHFREQ: | |||
| return BandwidthFreq; | |||
| break; | |||
| case PREDELAY: | |||
| return PreDelayTime; | |||
| break; | |||
| case SIZE: | |||
| return Size; | |||
| break; | |||
| case DECAY: | |||
| return Decay; | |||
| break; | |||
| case GAIN: | |||
| return Gain; | |||
| break; | |||
| case MIX: | |||
| return Mix; | |||
| break; | |||
| case EARLYMIX: | |||
| return EarlyMix; | |||
| break; | |||
| default: return 0.f; | |||
| break; | |||
| } | |||
| } | |||
| void setSampleRate(T sr){ | |||
| SampleRate = sr; | |||
| ControlRate = SampleRate / 1000; | |||
| reset(); | |||
| } | |||
| }; | |||
| template<typename T, int maxLength> | |||
| class Allpass | |||
| { | |||
| private: | |||
| T buffer[maxLength]; | |||
| int index; | |||
| int Length; | |||
| T Feedback; | |||
| public: | |||
| Allpass() | |||
| { | |||
| SetLength ( maxLength - 1 ); | |||
| Clear(); | |||
| Feedback = 0.5; | |||
| } | |||
| T operator()(T input) | |||
| { | |||
| T output; | |||
| T bufout; | |||
| bufout = buffer[index]; | |||
| T temp = input * -Feedback; | |||
| output = bufout + temp; | |||
| buffer[index] = input + ((bufout+temp)*Feedback); | |||
| if(++index>=Length) index = 0; | |||
| return output; | |||
| } | |||
| void SetLength (int Length) | |||
| { | |||
| if( Length >= maxLength ) | |||
| Length = maxLength; | |||
| if( Length < 0 ) | |||
| Length = 0; | |||
| this->Length = Length; | |||
| } | |||
| void SetFeedback(T feedback) | |||
| { | |||
| Feedback = feedback; | |||
| } | |||
| void Clear() | |||
| { | |||
| std::memset(buffer, 0, sizeof(buffer)); | |||
| index = 0; | |||
| } | |||
| int GetLength() const | |||
| { | |||
| return Length; | |||
| } | |||
| }; | |||
| template<typename T, int maxLength> | |||
| class StaticAllpassFourTap | |||
| { | |||
| private: | |||
| T buffer[maxLength]; | |||
| int index1, index2, index3, index4; | |||
| int Length; | |||
| T Feedback; | |||
| public: | |||
| StaticAllpassFourTap() | |||
| { | |||
| SetLength ( maxLength - 1 ); | |||
| Clear(); | |||
| Feedback = 0.5; | |||
| } | |||
| T operator()(T input) | |||
| { | |||
| T output; | |||
| T bufout; | |||
| bufout = buffer[index1]; | |||
| T temp = input * -Feedback; | |||
| output = bufout + temp; | |||
| buffer[index1] = input + ((bufout+temp)*Feedback); | |||
| if(++index1>=Length) | |||
| index1 = 0; | |||
| if(++index2 >= Length) | |||
| index2 = 0; | |||
| if(++index3 >= Length) | |||
| index3 = 0; | |||
| if(++index4 >= Length) | |||
| index4 = 0; | |||
| return output; | |||
| } | |||
| void SetIndex (int Index1, int Index2, int Index3, int Index4) | |||
| { | |||
| index1 = Index1; | |||
| index2 = Index2; | |||
| index3 = Index3; | |||
| index4 = Index4; | |||
| } | |||
| T GetIndex (int Index) | |||
| { | |||
| switch (Index) | |||
| { | |||
| case 0: | |||
| return buffer[index1]; | |||
| break; | |||
| case 1: | |||
| return buffer[index2]; | |||
| break; | |||
| case 2: | |||
| return buffer[index3]; | |||
| break; | |||
| case 3: | |||
| return buffer[index4]; | |||
| break; | |||
| default: | |||
| return buffer[index1]; | |||
| break; | |||
| } | |||
| } | |||
| void SetLength (int Length) | |||
| { | |||
| if( Length >= maxLength ) | |||
| Length = maxLength; | |||
| if( Length < 0 ) | |||
| Length = 0; | |||
| this->Length = Length; | |||
| } | |||
| void Clear() | |||
| { | |||
| std::memset(buffer, 0, sizeof(buffer)); | |||
| index1 = index2 = index3 = index4 = 0; | |||
| } | |||
| void SetFeedback(T feedback) | |||
| { | |||
| Feedback = feedback; | |||
| } | |||
| int GetLength() const | |||
| { | |||
| return Length; | |||
| } | |||
| }; | |||
| template<typename T, int maxLength> | |||
| class StaticDelayLine | |||
| { | |||
| private: | |||
| T buffer[maxLength]; | |||
| int index; | |||
| int Length; | |||
| T Feedback; | |||
| public: | |||
| StaticDelayLine() | |||
| { | |||
| SetLength ( maxLength - 1 ); | |||
| Clear(); | |||
| } | |||
| T operator()(T input) | |||
| { | |||
| T output = buffer[index]; | |||
| buffer[index++] = input; | |||
| if(index >= Length) | |||
| index = 0; | |||
| return output; | |||
| } | |||
| void SetLength (int Length) | |||
| { | |||
| if( Length >= maxLength ) | |||
| Length = maxLength; | |||
| if( Length < 0 ) | |||
| Length = 0; | |||
| this->Length = Length; | |||
| } | |||
| void Clear() | |||
| { | |||
| std::memset(buffer, 0, sizeof(buffer)); | |||
| index = 0; | |||
| } | |||
| int GetLength() const | |||
| { | |||
| return Length; | |||
| } | |||
| }; | |||
| template<typename T, int maxLength> | |||
| class StaticDelayLineFourTap | |||
| { | |||
| private: | |||
| T buffer[maxLength]; | |||
| int index1, index2, index3, index4; | |||
| int Length; | |||
| T Feedback; | |||
| public: | |||
| StaticDelayLineFourTap() | |||
| { | |||
| SetLength ( maxLength - 1 ); | |||
| Clear(); | |||
| } | |||
| //get ouput and iterate | |||
| T operator()(T input) | |||
| { | |||
| T output = buffer[index1]; | |||
| buffer[index1++] = input; | |||
| if(index1 >= Length) | |||
| index1 = 0; | |||
| if(++index2 >= Length) | |||
| index2 = 0; | |||
| if(++index3 >= Length) | |||
| index3 = 0; | |||
| if(++index4 >= Length) | |||
| index4 = 0; | |||
| return output; | |||
| } | |||
| void SetIndex (int Index1, int Index2, int Index3, int Index4) | |||
| { | |||
| index1 = Index1; | |||
| index2 = Index2; | |||
| index3 = Index3; | |||
| index4 = Index4; | |||
| } | |||
| T GetIndex (int Index) | |||
| { | |||
| switch (Index) | |||
| { | |||
| case 0: | |||
| return buffer[index1]; | |||
| break; | |||
| case 1: | |||
| return buffer[index2]; | |||
| break; | |||
| case 2: | |||
| return buffer[index3]; | |||
| break; | |||
| case 3: | |||
| return buffer[index4]; | |||
| break; | |||
| default: | |||
| return buffer[index1]; | |||
| break; | |||
| } | |||
| } | |||
| void SetLength (int Length) | |||
| { | |||
| if( Length >= maxLength ) | |||
| Length = maxLength; | |||
| if( Length < 0 ) | |||
| Length = 0; | |||
| this->Length = Length; | |||
| } | |||
| void Clear() | |||
| { | |||
| std::memset(buffer, 0, sizeof(buffer)); | |||
| index1 = index2 = index3 = index4 = 0; | |||
| } | |||
| int GetLength() const | |||
| { | |||
| return Length; | |||
| } | |||
| }; | |||
| template<typename T, int maxLength> | |||
| class StaticDelayLineEightTap | |||
| { | |||
| private: | |||
| T buffer[maxLength]; | |||
| int index1, index2, index3, index4, index5, index6, index7, index8; | |||
| int Length; | |||
| T Feedback; | |||
| public: | |||
| StaticDelayLineEightTap() | |||
| { | |||
| SetLength ( maxLength - 1 ); | |||
| Clear(); | |||
| } | |||
| //get ouput and iterate | |||
| T operator()(T input) | |||
| { | |||
| T output = buffer[index1]; | |||
| buffer[index1++] = input; | |||
| if(index1 >= Length) | |||
| index1 = 0; | |||
| if(++index2 >= Length) | |||
| index2 = 0; | |||
| if(++index3 >= Length) | |||
| index3 = 0; | |||
| if(++index4 >= Length) | |||
| index4 = 0; | |||
| if(++index5 >= Length) | |||
| index5 = 0; | |||
| if(++index6 >= Length) | |||
| index6 = 0; | |||
| if(++index7 >= Length) | |||
| index7 = 0; | |||
| if(++index8 >= Length) | |||
| index8 = 0; | |||
| return output; | |||
| } | |||
| void SetIndex (int Index1, int Index2, int Index3, int Index4, int Index5, int Index6, int Index7, int Index8) | |||
| { | |||
| index1 = Index1; | |||
| index2 = Index2; | |||
| index3 = Index3; | |||
| index4 = Index4; | |||
| index5 = Index5; | |||
| index6 = Index6; | |||
| index7 = Index7; | |||
| index8 = Index8; | |||
| } | |||
| T GetIndex (int Index) | |||
| { | |||
| switch (Index) | |||
| { | |||
| case 0: | |||
| return buffer[index1]; | |||
| break; | |||
| case 1: | |||
| return buffer[index2]; | |||
| break; | |||
| case 2: | |||
| return buffer[index3]; | |||
| break; | |||
| case 3: | |||
| return buffer[index4]; | |||
| break; | |||
| case 4: | |||
| return buffer[index5]; | |||
| break; | |||
| case 5: | |||
| return buffer[index6]; | |||
| break; | |||
| case 6: | |||
| return buffer[index7]; | |||
| break; | |||
| case 7: | |||
| return buffer[index8]; | |||
| break; | |||
| default: | |||
| return buffer[index1]; | |||
| break; | |||
| } | |||
| } | |||
| void SetLength (int Length) | |||
| { | |||
| if( Length >= maxLength ) | |||
| Length = maxLength; | |||
| if( Length < 0 ) | |||
| Length = 0; | |||
| this->Length = Length; | |||
| } | |||
| void Clear() | |||
| { | |||
| std::memset(buffer, 0, sizeof(buffer)); | |||
| index1 = index2 = index3 = index4 = index5 = index6 = index7 = index8 = 0; | |||
| } | |||
| int GetLength() const | |||
| { | |||
| return Length; | |||
| } | |||
| }; | |||
| template<typename T, int OverSampleCount> | |||
| class StateVariable | |||
| { | |||
| public: | |||
| enum FilterType | |||
| { | |||
| LOWPASS, | |||
| HIGHPASS, | |||
| BANDPASS, | |||
| NOTCH, | |||
| FilterTypeCount | |||
| }; | |||
| private: | |||
| T sampleRate; | |||
| T frequency; | |||
| T q; | |||
| T f; | |||
| T low; | |||
| T high; | |||
| T band; | |||
| T notch; | |||
| T *out; | |||
| public: | |||
| StateVariable() | |||
| { | |||
| SetSampleRate(44100.); | |||
| Frequency(1000.); | |||
| Resonance(0); | |||
| Type(LOWPASS); | |||
| Reset(); | |||
| } | |||
| T operator()(T input) | |||
| { | |||
| for(unsigned int i = 0; i < OverSampleCount; i++) | |||
| { | |||
| low += f * band + 1e-25; | |||
| high = input - low - q * band; | |||
| band += f * high; | |||
| notch = low + high; | |||
| } | |||
| return *out; | |||
| } | |||
| void Reset() | |||
| { | |||
| low = high = band = notch = 0; | |||
| } | |||
| void SetSampleRate(T sampleRate) | |||
| { | |||
| this->sampleRate = sampleRate * OverSampleCount; | |||
| UpdateCoefficient(); | |||
| } | |||
| void Frequency(T frequency) | |||
| { | |||
| this->frequency = frequency; | |||
| UpdateCoefficient(); | |||
| } | |||
| void Resonance(T resonance) | |||
| { | |||
| this->q = 2 - 2 * resonance; | |||
| } | |||
| void Type(int type) | |||
| { | |||
| switch(type) | |||
| { | |||
| case LOWPASS: | |||
| out = &low; | |||
| break; | |||
| case HIGHPASS: | |||
| out = &high; | |||
| break; | |||
| case BANDPASS: | |||
| out = &band; | |||
| break; | |||
| case NOTCH: | |||
| out = ¬ch; | |||
| break; | |||
| default: | |||
| out = &low; | |||
| break; | |||
| } | |||
| } | |||
| private: | |||
| void UpdateCoefficient() | |||
| { | |||
| f = 2. * std::sin(M_PI * frequency / sampleRate); | |||
| } | |||
| }; | |||
| #endif | |||
| @@ -70,7 +70,6 @@ struct PluginListManager { | |||
| std::strcmp(desc->label, "3bandeq" ) == 0 || | |||
| std::strcmp(desc->label, "3bandsplitter") == 0 || | |||
| std::strcmp(desc->label, "kars" ) == 0 || | |||
| std::strcmp(desc->label, "mverb" ) == 0 || | |||
| std::strcmp(desc->label, "nekobi" ) == 0 || | |||
| std::strcmp(desc->label, "pingpongpan" ) == 0 || | |||
| std::strcmp(desc->label, "prom" ) == 0 || | |||