diff --git a/dpf/dgl/Makefile b/dpf/dgl/Makefile index 7565962..fc61422 100644 --- a/dpf/dgl/Makefile +++ b/dpf/dgl/Makefile @@ -12,6 +12,14 @@ BUILD_C_FLAGS += $(DGL_FLAGS) -I. -Isrc BUILD_CXX_FLAGS += $(DGL_FLAGS) -I. -Isrc LINK_FLAGS += $(DGL_LIBS) +ifneq ($(MACOS_OLD),true) +# needed by sofd right now, fix later +BUILD_CXX_FLAGS += -Wno-type-limits -fpermissive + +# needed by stb_image +BUILD_CXX_FLAGS += -Wno-misleading-indentation -Wno-shift-negative-value +endif + # -------------------------------------------------------------- OBJS = \ diff --git a/dpf/dgl/src/Window.cpp b/dpf/dgl/src/Window.cpp index 6262644..784fe89 100644 --- a/dpf/dgl/src/Window.cpp +++ b/dpf/dgl/src/Window.cpp @@ -29,14 +29,12 @@ # include "pugl/pugl_win.cpp" #elif defined(DISTRHO_OS_MAC) # include "pugl/pugl_osx.m" -#elif defined(DISTRHO_OS_LINUX) +#else # include # include extern "C" { # include "pugl/pugl_x11.c" } -#else -# error Unsupported platform #endif #include "ApplicationPrivateData.hpp" @@ -81,13 +79,13 @@ struct Window::PrivateData { fModal(), #if defined(DISTRHO_OS_WINDOWS) hwnd(0) -#elif defined(DISTRHO_OS_LINUX) - xDisplay(nullptr), - xWindow(0) #elif defined(DISTRHO_OS_MAC) fNeedsIdle(true), mView(nullptr), mWindow(nullptr) +#else + xDisplay(nullptr), + xWindow(0) #endif { DBG("Creating window without parent..."); DBGF; @@ -109,26 +107,26 @@ struct Window::PrivateData { fModal(parent.pData), #if defined(DISTRHO_OS_WINDOWS) hwnd(0) -#elif defined(DISTRHO_OS_LINUX) - xDisplay(nullptr), - xWindow(0) #elif defined(DISTRHO_OS_MAC) fNeedsIdle(false), mView(nullptr), mWindow(nullptr) +#else + xDisplay(nullptr), + xWindow(0) #endif { DBG("Creating window with parent..."); DBGF; init(); const PuglInternals* const parentImpl(parent.pData->fView->impl); -#if defined(DISTRHO_OS_LINUX) - XSetTransientForHint(xDisplay, xWindow, parentImpl->win); -//#elif defined(DISTRHO_OS_MAC) -// [parentImpl->window orderWindow:NSWindowBelow relativeTo:[[mView window] windowNumber]]; +#if defined(DISTRHO_OS_WINDOWS) + // TODO +#elif defined(DISTRHO_OS_MAC) + // TODO + //[parentImpl->window orderWindow:NSWindowBelow relativeTo:[[mView window] windowNumber]]; #else - // unused - return; (void)parentImpl; + XSetTransientForHint(xDisplay, xWindow, parentImpl->win); #endif } @@ -147,13 +145,13 @@ struct Window::PrivateData { fModal(), #if defined(DISTRHO_OS_WINDOWS) hwnd(0) -#elif defined(DISTRHO_OS_LINUX) - xDisplay(nullptr), - xWindow(0) #elif defined(DISTRHO_OS_MAC) fNeedsIdle(parentId == 0), mView(nullptr), mWindow(nullptr) +#else + xDisplay(nullptr), + xWindow(0) #endif { if (fUsingEmbed) @@ -215,7 +213,7 @@ struct Window::PrivateData { } else { DISTRHO_SAFE_ASSERT(mWindow != nullptr); } -#elif defined(DISTRHO_OS_LINUX) +#else xDisplay = impl->display; xWindow = impl->win; DISTRHO_SAFE_ASSERT(xWindow != 0); @@ -275,7 +273,7 @@ struct Window::PrivateData { #elif defined(DISTRHO_OS_MAC) mView = nullptr; mWindow = nullptr; -#elif defined(DISTRHO_OS_LINUX) +#else xDisplay = nullptr; xWindow = 0; #endif @@ -369,7 +367,7 @@ struct Window::PrivateData { // TODO #elif defined(DISTRHO_OS_MAC) // TODO -#elif defined(DISTRHO_OS_LINUX) +#else int i, wx, wy; uint u; ::Window w; @@ -397,7 +395,7 @@ struct Window::PrivateData { //[NSApp activateIgnoringOtherApps:YES]; //[mWindow makeKeyAndOrderFront:mWindow]; } -#elif defined(DISTRHO_OS_LINUX) +#else XRaiseWindow(xDisplay, xWindow); XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime); XFlush(xDisplay); @@ -448,7 +446,7 @@ struct Window::PrivateData { else [mView setHidden:YES]; } -#elif defined(DISTRHO_OS_LINUX) +#else if (yesNo) XMapRaised(xDisplay, xWindow); else @@ -552,7 +550,7 @@ struct Window::PrivateData { [[mWindow standardWindowButton:NSWindowZoomButton] setHidden:YES]; } } -#elif defined(DISTRHO_OS_LINUX) +#else XResizeWindow(xDisplay, xWindow, width, height); if (! fResizable) @@ -608,19 +606,19 @@ struct Window::PrivateData { [mWindow setTitle:titleString]; } -#elif defined(DISTRHO_OS_LINUX) +#else XStoreName(xDisplay, xWindow, title); #endif } void setTransientWinId(const uintptr_t winId) { -#if defined(DISTRHO_OS_LINUX) - XSetTransientForHint(xDisplay, xWindow, static_cast< ::Window>(winId)); +#if defined(DISTRHO_OS_WINDOWS) + // TODO +#elif defined(DISTRHO_OS_MAC) + // TODO #else - return; - // unused - (void)winId; + XSetTransientForHint(xDisplay, xWindow, static_cast< ::Window>(winId)); #endif } @@ -886,13 +884,13 @@ struct Window::PrivateData { #if defined(DISTRHO_OS_WINDOWS) HWND hwnd; -#elif defined(DISTRHO_OS_LINUX) - Display* xDisplay; - ::Window xWindow; #elif defined(DISTRHO_OS_MAC) bool fNeedsIdle; PuglOpenGLView* mView; id mWindow; +#else + Display* xDisplay; + ::Window xWindow; #endif // ------------------------------------------------------------------- diff --git a/dpf/distrho/DistrhoPlugin.hpp b/dpf/distrho/DistrhoPlugin.hpp index ebb9a9d..b31c375 100644 --- a/dpf/distrho/DistrhoPlugin.hpp +++ b/dpf/distrho/DistrhoPlugin.hpp @@ -289,6 +289,14 @@ struct Parameter { */ ParameterRanges ranges; + /** + MIDI CC to use by default on this parameter.@n + A value of 0 or 32 (bank change) is considered invalid.@n + Must also be less or equal to 120. + @note This value is only a hint! Hosts might map it automatically or completely ignore it. + */ + uint8_t midiCC; + /** Default constructor for a null parameter. */ @@ -297,7 +305,8 @@ struct Parameter { name(), symbol(), unit(), - ranges() {} + ranges(), + midiCC(0) {} /** Constructor using custom values. @@ -307,7 +316,8 @@ struct Parameter { name(n), symbol(s), unit(u), - ranges(def, min, max) {} + ranges(def, min, max), + midiCC(0) {} }; /** diff --git a/dpf/distrho/extra/ExternalWindow.hpp b/dpf/distrho/extra/ExternalWindow.hpp index 392a57e..8ad2df0 100644 --- a/dpf/distrho/extra/ExternalWindow.hpp +++ b/dpf/distrho/extra/ExternalWindow.hpp @@ -19,13 +19,13 @@ #include "String.hpp" -#ifdef DISTRHO_OS_UNIX +#ifdef DISTRHO_OS_WINDOWS +# error Unsupported platform! +#else # include # include # include # include -#else -# error Unsupported platform! #endif START_NAMESPACE_DISTRHO diff --git a/dpf/distrho/extra/Thread.hpp b/dpf/distrho/extra/Thread.hpp index 5738fc6..b3d92c9 100644 --- a/dpf/distrho/extra/Thread.hpp +++ b/dpf/distrho/extra/Thread.hpp @@ -21,7 +21,7 @@ #include "Sleep.hpp" #include "String.hpp" -#ifdef DISTRHO_OS_LINUX_FULL +#ifdef DISTRHO_OS_LINUX # include #endif @@ -198,7 +198,7 @@ public: { DISTRHO_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); -#ifdef DISTRHO_OS_LINUX_FULL +#ifdef DISTRHO_OS_LINUX prctl(PR_SET_NAME, name, 0, 0, 0); #endif #if defined(__GLIBC__) && (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012 diff --git a/dpf/distrho/src/DistrhoDefines.h b/dpf/distrho/src/DistrhoDefines.h index 4449998..16c0694 100644 --- a/dpf/distrho/src/DistrhoDefines.h +++ b/dpf/distrho/src/DistrhoDefines.h @@ -38,17 +38,10 @@ # elif defined(__HAIKU__) # define DISTRHO_OS_HAIKU 1 # elif defined(__linux__) || defined(__linux) -# define DISTRHO_OS_LINUX 1 -# define DISTRHO_OS_LINUX_FULL 1 -# elif defined(__FreeBSD__) || defined(__GNU__) -# define DISTRHO_OS_LINUX 1 +# define DISTRHO_OS_LINUX 1 # endif #endif -#if defined(DISTRHO_OS_LINUX) || defined(DISTRHO_OS_MAC) -# define DISTRHO_OS_UNIX -#endif - #ifndef DISTRHO_DLL_EXTENSION # define DISTRHO_DLL_EXTENSION "so" #endif diff --git a/dpf/distrho/src/DistrhoPluginInternal.hpp b/dpf/distrho/src/DistrhoPluginInternal.hpp index d857d6e..2781dfa 100644 --- a/dpf/distrho/src/DistrhoPluginInternal.hpp +++ b/dpf/distrho/src/DistrhoPluginInternal.hpp @@ -323,6 +323,13 @@ public: return fData->parameters[index].ranges; } + uint8_t getParameterMidiCC(const uint32_t index) const noexcept + { + DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr && index < fData->parameterCount, 0); + + return fData->parameters[index].midiCC; + } + float getParameterValue(const uint32_t index) const { DISTRHO_SAFE_ASSERT_RETURN(fPlugin != nullptr, 0.0f); diff --git a/dpf/distrho/src/DistrhoPluginJack.cpp b/dpf/distrho/src/DistrhoPluginJack.cpp index 93e5d41..8b0b0eb 100644 --- a/dpf/distrho/src/DistrhoPluginJack.cpp +++ b/dpf/distrho/src/DistrhoPluginJack.cpp @@ -70,20 +70,14 @@ static void closeSignalHandler(int) noexcept static void initSignalHandler() { - struct sigaction sint; - struct sigaction sterm; - - sint.sa_handler = closeSignalHandler; - sint.sa_flags = SA_RESTART; - sint.sa_restorer = nullptr; - sigemptyset(&sint.sa_mask); - sigaction(SIGINT, &sint, nullptr); - - sterm.sa_handler = closeSignalHandler; - sterm.sa_flags = SA_RESTART; - sterm.sa_restorer = nullptr; - sigemptyset(&sterm.sa_mask); - sigaction(SIGTERM, &sterm, nullptr); + struct sigaction sig; + memset(&sig, 0, sizeof(sig)); + + sig.sa_handler = closeSignalHandler; + sig.sa_flags = SA_RESTART; + sigemptyset(&sig.sa_mask); + sigaction(SIGINT, &sig, nullptr); + sigaction(SIGTERM, &sig, nullptr); } #endif diff --git a/dpf/distrho/src/DistrhoPluginLADSPA+DSSI.cpp b/dpf/distrho/src/DistrhoPluginLADSPA+DSSI.cpp index 455f9a8..2e2091c 100644 --- a/dpf/distrho/src/DistrhoPluginLADSPA+DSSI.cpp +++ b/dpf/distrho/src/DistrhoPluginLADSPA+DSSI.cpp @@ -250,17 +250,16 @@ public: midiEvents[j].data[2] = 0; midiEvents[j].data[3] = 0; break; -#if 0 // TODO case SND_SEQ_EVENT_PITCHBEND: j = midiEventCount++; midiEvents[j].frame = seqEvent.time.tick; midiEvents[j].size = 3; midiEvents[j].data[0] = 0xE0 + seqEvent.data.control.channel; - midiEvents[j].data[1] = 0; - midiEvents[j].data[2] = 0; + uint16_t tempvalue = seqEvent.data.control.value + 8192; + midiEvents[j].data[1] = tempvalue & 0x7F; + midiEvents[j].data[2] = tempvalue >> 7; midiEvents[j].data[3] = 0; break; -#endif } } @@ -329,6 +328,16 @@ public: } } # endif + + int dssi_get_midi_controller_for_port(const ulong port) noexcept + { + const uint8_t midiCC = fPlugin.getParameterMidiCC(port); + + if (midiCC == 0 || midiCC == 32 || midiCC >= 0x78) + return DSSI_NONE; + + return DSSI_CC(midiCC); + } #endif // ------------------------------------------------------------------- @@ -435,6 +444,11 @@ static void dssi_select_program(LADSPA_Handle instance, ulong bank, ulong progra } # endif +static int dssi_get_midi_controller_for_port(LADSPA_Handle instance, ulong port) +{ + return instancePtr->dssi_get_midi_controller_for_port(port); +} + # if DISTRHO_PLUGIN_WANT_MIDI_INPUT static void dssi_run_synth(LADSPA_Handle instance, ulong sampleCount, snd_seq_event_t* events, ulong eventCount) { @@ -489,7 +503,7 @@ static DSSI_Descriptor sDssiDescriptor = { /* get_program */ nullptr, /* select_program */ nullptr, # endif - /* get_midi_controller_for_port */ nullptr, + dssi_get_midi_controller_for_port, # if DISTRHO_PLUGIN_WANT_MIDI_INPUT dssi_run_synth, # else @@ -614,11 +628,16 @@ public: const uint32_t hints(plugin.getParameterHints(i)); if (hints & kParameterIsBoolean) + { portRangeHints[port].HintDescriptor |= LADSPA_HINT_TOGGLED; - if (hints & kParameterIsInteger) - portRangeHints[port].HintDescriptor |= LADSPA_HINT_INTEGER; - if (hints & kParameterIsLogarithmic) - portRangeHints[port].HintDescriptor |= LADSPA_HINT_LOGARITHMIC; + } + else + { + if (hints & kParameterIsInteger) + portRangeHints[port].HintDescriptor |= LADSPA_HINT_INTEGER; + if (hints & kParameterIsLogarithmic) + portRangeHints[port].HintDescriptor |= LADSPA_HINT_LOGARITHMIC; + } } } diff --git a/plugins/bitcrush/Makefile b/plugins/bitcrush/Makefile index 34d0c79..b712765 100644 --- a/plugins/bitcrush/Makefile +++ b/plugins/bitcrush/Makefile @@ -13,8 +13,7 @@ NAME = MaBitcrush # Files to build OBJS_DSP = \ - DistrhoPluginMaxGen.cpp.o \ - gen_exported.cpp.o + DistrhoPluginMaxGen.cpp.o # -------------------------------------------------------------- # Do some magic diff --git a/plugins/bitcrush/gen_exported.cpp b/plugins/bitcrush/gen_exported.cpp index 9637621..d4ec962 100644 --- a/plugins/bitcrush/gen_exported.cpp +++ b/plugins/bitcrush/gen_exported.cpp @@ -31,12 +31,12 @@ static const int GENLIB_LOOPCOUNT_BAIL = 100000; // The State struct contains all the state and procedures for the gendsp kernel typedef struct State { CommonState __commonstate; - double m_resolution_1; - double samplerate; + t_sample m_resolution_1; + t_sample samplerate; int vectorsize; int __exception; // re-initialize all member variables; - inline void reset(double __sr, int __vs) { + inline void reset(t_sample __sr, int __vs) { __exception = 0; vectorsize = __vs; samplerate = __sr; @@ -60,16 +60,16 @@ typedef struct State { }; // the main sample loop; while ((__n--)) { - const double in1 = (*(__in1++)); - double mul_50 = (in1 * m_resolution_1); - double ceil_49 = ceil(mul_50); - double div_48 = safediv(ceil_49, m_resolution_1); - double out1 = div_48; - double add_45 = (mul_50 + 0.5); - double floor_46 = floor(add_45); - double sub_44 = (floor_46 - 0.5); - double div_47 = safediv(sub_44, m_resolution_1); - double out2 = div_47; + const t_sample in1 = (*(__in1++)); + t_sample mul_50 = (in1 * m_resolution_1); + t_sample ceil_49 = ceil(mul_50); + t_sample div_48 = safediv(ceil_49, m_resolution_1); + t_sample out1 = div_48; + t_sample add_45 = (mul_50 + 0.5); + t_sample floor_46 = floor(add_45); + t_sample sub_44 = (floor_46 - 0.5); + t_sample div_47 = safediv(sub_44, m_resolution_1); + t_sample out2 = div_47; // assign results to output buffer; (*(__out1++)) = out1; (*(__out2++)) = out2; @@ -78,7 +78,7 @@ typedef struct State { return __exception; }; - inline void set_resolution(double _value) { + inline void set_resolution(t_sample _value) { m_resolution_1 = (_value < 1 ? 1 : (_value > 16 ? 16 : _value)); }; @@ -91,8 +91,8 @@ typedef struct State { /// Number of signal inputs and outputs -int gen_kernel_numins = 1; -int gen_kernel_numouts = 2; +const int gen_kernel_numins = 1; +const int gen_kernel_numouts = 2; int num_inputs() { return gen_kernel_numins; } int num_outputs() { return gen_kernel_numouts; } @@ -119,7 +119,7 @@ void reset(CommonState *cself) { /// Set a parameter of a State object -void setparameter(CommonState *cself, long index, double value, void *ref) { +void setparameter(CommonState *cself, long index, t_param value, void *ref) { State * self = (State *)cself; switch (index) { case 0: self->set_resolution(value); break; @@ -130,7 +130,7 @@ void setparameter(CommonState *cself, long index, double value, void *ref) { /// Get the value of a parameter of a State object -void getparameter(CommonState *cself, long index, double *value) { +void getparameter(CommonState *cself, long index, t_param *value) { State *self = (State *)cself; switch (index) { case 0: *value = self->m_resolution_1; break; @@ -141,7 +141,7 @@ void getparameter(CommonState *cself, long index, double *value) { /// Allocate and configure a new State object and it's internal CommonState: -void * create(double sr, long vs) { +void * create(t_param sr, long vs) { State *self = new State; self->reset(sr, vs); ParamInfo *pi; diff --git a/plugins/bitcrush/gen_exported.h b/plugins/bitcrush/gen_exported.h index ab06792..c5848bb 100644 --- a/plugins/bitcrush/gen_exported.h +++ b/plugins/bitcrush/gen_exported.h @@ -29,9 +29,9 @@ int num_outputs(); int num_params(); int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n); void reset(CommonState *cself); -void setparameter(CommonState *cself, long index, double value, void *ref); -void getparameter(CommonState *cself, long index, double *value); -void * create(double sr, long vs); +void setparameter(CommonState *cself, long index, t_param value, void *ref); +void getparameter(CommonState *cself, long index, t_param *value); +void * create(t_param sr, long vs); void destroy(CommonState *cself); } // gen_exported:: diff --git a/plugins/common/DistrhoPluginMaxGen.cpp b/plugins/common/DistrhoPluginMaxGen.cpp index e48f285..1994293 100644 --- a/plugins/common/DistrhoPluginMaxGen.cpp +++ b/plugins/common/DistrhoPluginMaxGen.cpp @@ -16,7 +16,7 @@ #include "DistrhoPluginMaxGen.hpp" -#include "gen_exported.h" +#include "gen_exported.cpp" namespace gen = gen_exported; @@ -57,7 +57,7 @@ void DistrhoPluginMaxGen::initParameter(uint32_t index, Parameter& parameter) float DistrhoPluginMaxGen::getParameterValue(uint32_t index) const { - double value = 0.0; + t_param value = 0.0f; gen::getparameter(fGenState, index, &value); return value; } @@ -72,7 +72,7 @@ void DistrhoPluginMaxGen::setParameterValue(uint32_t index, float value) void DistrhoPluginMaxGen::run(const float** inputs, float** outputs, uint32_t frames) { - gen::perform(fGenState, (float**)inputs, DISTRHO_PLUGIN_NUM_INPUTS, outputs, DISTRHO_PLUGIN_NUM_OUTPUTS, frames); + gen::perform(fGenState, (float**)inputs, gen::gen_kernel_numins, outputs, gen::gen_kernel_numouts, frames); } // ----------------------------------------------------------------------- diff --git a/plugins/freeverb/Makefile b/plugins/freeverb/Makefile index a1e34a3..d0aebf7 100644 --- a/plugins/freeverb/Makefile +++ b/plugins/freeverb/Makefile @@ -13,8 +13,7 @@ NAME = MaFreeverb # Files to build OBJS_DSP = \ - DistrhoPluginMaxGen.cpp.o \ - gen_exported.cpp.o + DistrhoPluginMaxGen.cpp.o # -------------------------------------------------------------- # Do some magic diff --git a/plugins/freeverb/gen_exported.cpp b/plugins/freeverb/gen_exported.cpp index d6b6a81..cd8bdf9 100644 --- a/plugins/freeverb/gen_exported.cpp +++ b/plugins/freeverb/gen_exported.cpp @@ -43,23 +43,23 @@ typedef struct State { Delay m_delay_7; Delay m_delay_11; Delay m_delay_5; - double m_history_6; - double m_history_18; - double m_fb_1; - double m_history_20; - double samplerate; - double m_damp_2; - double m_history_8; - double m_history_16; - double m_history_14; - double m_fb_3; - double m_history_12; - double m_history_10; - double m_spread_4; + t_sample m_history_6; + t_sample m_history_18; + t_sample m_fb_1; + t_sample m_history_20; + t_sample samplerate; + t_sample m_damp_2; + t_sample m_history_8; + t_sample m_history_16; + t_sample m_history_14; + t_sample m_fb_3; + t_sample m_history_12; + t_sample m_history_10; + t_sample m_spread_4; int vectorsize; int __exception; // re-initialize all member variables; - inline void reset(double __sr, int __vs) { + inline void reset(t_sample __sr, int __vs) { __exception = 0; vectorsize = __vs; samplerate = __sr; @@ -103,121 +103,121 @@ typedef struct State { return __exception; }; - double mul_448 = (m_fb_1 * 0.5); - double add_424 = (225 + m_spread_4); - double add_431 = (341 + m_spread_4); - double add_446 = (441 + m_spread_4); - double add_417 = (556 + m_spread_4); - double damp_327 = m_damp_2; - double damp_326 = damp_327; - double damp_328 = damp_327; - double damp_329 = damp_327; - double damp_330 = damp_327; - double damp_331 = damp_327; - double damp_332 = damp_327; - double damp_333 = damp_327; - double add_439 = (1557 + m_spread_4); - double rsub_295 = (1 - damp_327); - double add_438 = (1617 + m_spread_4); - double rsub_466 = (1 - damp_326); - double add_440 = (1491 + m_spread_4); - double rsub_479 = (1 - damp_328); - double add_441 = (1422 + m_spread_4); - double rsub_484 = (1 - damp_329); - double add_442 = (1356 + m_spread_4); - double rsub_496 = (1 - damp_330); - double add_443 = (1277 + m_spread_4); - double rsub_508 = (1 - damp_331); - double add_444 = (1188 + m_spread_4); - double rsub_520 = (1 - damp_332); - double add_445 = (1116 + m_spread_4); - double rsub_532 = (1 - damp_333); + t_sample mul_448 = (m_fb_1 * 0.5); + t_sample add_424 = (225 + m_spread_4); + t_sample add_431 = (341 + m_spread_4); + t_sample add_446 = (441 + m_spread_4); + t_sample add_417 = (556 + m_spread_4); + t_sample damp_327 = m_damp_2; + t_sample damp_326 = damp_327; + t_sample damp_328 = damp_327; + t_sample damp_329 = damp_327; + t_sample damp_330 = damp_327; + t_sample damp_331 = damp_327; + t_sample damp_332 = damp_327; + t_sample damp_333 = damp_327; + t_sample add_439 = (1557 + m_spread_4); + t_sample rsub_295 = (1 - damp_327); + t_sample add_438 = (1617 + m_spread_4); + t_sample rsub_466 = (1 - damp_326); + t_sample add_440 = (1491 + m_spread_4); + t_sample rsub_479 = (1 - damp_328); + t_sample add_441 = (1422 + m_spread_4); + t_sample rsub_484 = (1 - damp_329); + t_sample add_442 = (1356 + m_spread_4); + t_sample rsub_496 = (1 - damp_330); + t_sample add_443 = (1277 + m_spread_4); + t_sample rsub_508 = (1 - damp_331); + t_sample add_444 = (1188 + m_spread_4); + t_sample rsub_520 = (1 - damp_332); + t_sample add_445 = (1116 + m_spread_4); + t_sample rsub_532 = (1 - damp_333); // the main sample loop; while ((__n--)) { - const double in1 = (*(__in1++)); - double mul_459 = (in1 * 0.015); - double tap_302 = m_delay_5.read_linear(add_439); - double gen_410 = tap_302; - double mul_300 = (tap_302 * damp_327); - double mul_298 = (m_history_6 * rsub_295); - double add_299 = (mul_300 + mul_298); - double mul_296 = (add_299 * m_fb_3); - double add_303 = (mul_459 + mul_296); - double history_297_next_304 = add_299; - double tap_469 = m_delay_7.read_linear(add_438); - double gen_458 = tap_469; - double mul_468 = (tap_469 * damp_326); - double mul_465 = (m_history_8 * rsub_466); - double add_464 = (mul_468 + mul_465); - double mul_462 = (add_464 * m_fb_3); - double add_463 = (mul_459 + mul_462); - double history_297_next_461 = add_464; - double tap_474 = m_delay_9.read_linear(add_440); - double gen_399 = tap_474; - double mul_480 = (tap_474 * damp_328); - double mul_478 = (m_history_10 * rsub_479); - double add_476 = (mul_480 + mul_478); - double mul_473 = (add_476 * m_fb_3); - double add_477 = (mul_459 + mul_473); - double history_297_next_475 = add_476; - double tap_489 = m_delay_11.read_linear(add_441); - double gen_388 = tap_489; - double mul_493 = (tap_489 * damp_329); - double mul_487 = (m_history_12 * rsub_484); - double add_492 = (mul_493 + mul_487); - double mul_491 = (add_492 * m_fb_3); - double add_490 = (mul_459 + mul_491); - double history_297_next_485 = add_492; - double tap_500 = m_delay_13.read_linear(add_442); - double gen_377 = tap_500; - double mul_501 = (tap_500 * damp_330); - double mul_499 = (m_history_14 * rsub_496); - double add_505 = (mul_501 + mul_499); - double mul_504 = (add_505 * m_fb_3); - double add_503 = (mul_459 + mul_504); - double history_297_next_497 = add_505; - double tap_512 = m_delay_15.read_linear(add_443); - double gen_366 = tap_512; - double mul_517 = (tap_512 * damp_331); - double mul_511 = (m_history_16 * rsub_508); - double add_516 = (mul_517 + mul_511); - double mul_513 = (add_516 * m_fb_3); - double add_514 = (mul_459 + mul_513); - double history_297_next_509 = add_516; - double tap_525 = m_delay_17.read_linear(add_444); - double gen_355 = tap_525; - double mul_521 = (tap_525 * damp_332); - double mul_524 = (m_history_18 * rsub_520); - double add_529 = (mul_521 + mul_524); - double mul_526 = (add_529 * m_fb_3); - double add_527 = (mul_459 + mul_526); - double history_297_next_522 = add_529; - double tap_537 = m_delay_19.read_linear(add_445); - double gen_344 = tap_537; - double mul_541 = (tap_537 * damp_333); - double mul_536 = (m_history_20 * rsub_532); - double add_538 = (mul_541 + mul_536); - double mul_540 = (add_538 * m_fb_3); - double add_534 = (mul_459 + mul_540); - double history_297_next_533 = add_538; - double add_447 = ((((((((gen_344 + gen_355) + gen_366) + gen_377) + gen_388) + gen_399) + gen_458) + gen_410) + 0); - double tap_283 = m_delay_21.read_linear(add_417); - double sub_279 = (add_447 - tap_283); - double mul_281 = (tap_283 * mul_448); - double add_280 = (add_447 + mul_281); - double tap_548 = m_delay_22.read_linear(add_446); - double sub_546 = (sub_279 - tap_548); - double mul_547 = (tap_548 * mul_448); - double add_544 = (sub_279 + mul_547); - double tap_554 = m_delay_23.read_linear(add_431); - double sub_552 = (sub_546 - tap_554); - double mul_553 = (tap_554 * mul_448); - double add_550 = (sub_546 + mul_553); - double tap_560 = m_delay_24.read_linear(add_424); - double sub_558 = (sub_552 - tap_560); - double mul_559 = (tap_560 * mul_448); - double add_556 = (sub_552 + mul_559); - double out1 = sub_558; + const t_sample in1 = (*(__in1++)); + t_sample mul_459 = (in1 * 0.015); + t_sample tap_302 = m_delay_5.read_linear(add_439); + t_sample gen_410 = tap_302; + t_sample mul_300 = (tap_302 * damp_327); + t_sample mul_298 = (m_history_6 * rsub_295); + t_sample add_299 = (mul_300 + mul_298); + t_sample mul_296 = (add_299 * m_fb_3); + t_sample add_303 = (mul_459 + mul_296); + t_sample history_297_next_304 = add_299; + t_sample tap_469 = m_delay_7.read_linear(add_438); + t_sample gen_458 = tap_469; + t_sample mul_468 = (tap_469 * damp_326); + t_sample mul_465 = (m_history_8 * rsub_466); + t_sample add_464 = (mul_468 + mul_465); + t_sample mul_462 = (add_464 * m_fb_3); + t_sample add_463 = (mul_459 + mul_462); + t_sample history_297_next_461 = add_464; + t_sample tap_474 = m_delay_9.read_linear(add_440); + t_sample gen_399 = tap_474; + t_sample mul_480 = (tap_474 * damp_328); + t_sample mul_478 = (m_history_10 * rsub_479); + t_sample add_476 = (mul_480 + mul_478); + t_sample mul_473 = (add_476 * m_fb_3); + t_sample add_477 = (mul_459 + mul_473); + t_sample history_297_next_475 = add_476; + t_sample tap_489 = m_delay_11.read_linear(add_441); + t_sample gen_388 = tap_489; + t_sample mul_493 = (tap_489 * damp_329); + t_sample mul_487 = (m_history_12 * rsub_484); + t_sample add_492 = (mul_493 + mul_487); + t_sample mul_491 = (add_492 * m_fb_3); + t_sample add_490 = (mul_459 + mul_491); + t_sample history_297_next_485 = add_492; + t_sample tap_500 = m_delay_13.read_linear(add_442); + t_sample gen_377 = tap_500; + t_sample mul_501 = (tap_500 * damp_330); + t_sample mul_499 = (m_history_14 * rsub_496); + t_sample add_505 = (mul_501 + mul_499); + t_sample mul_504 = (add_505 * m_fb_3); + t_sample add_503 = (mul_459 + mul_504); + t_sample history_297_next_497 = add_505; + t_sample tap_512 = m_delay_15.read_linear(add_443); + t_sample gen_366 = tap_512; + t_sample mul_517 = (tap_512 * damp_331); + t_sample mul_511 = (m_history_16 * rsub_508); + t_sample add_516 = (mul_517 + mul_511); + t_sample mul_513 = (add_516 * m_fb_3); + t_sample add_514 = (mul_459 + mul_513); + t_sample history_297_next_509 = add_516; + t_sample tap_525 = m_delay_17.read_linear(add_444); + t_sample gen_355 = tap_525; + t_sample mul_521 = (tap_525 * damp_332); + t_sample mul_524 = (m_history_18 * rsub_520); + t_sample add_529 = (mul_521 + mul_524); + t_sample mul_526 = (add_529 * m_fb_3); + t_sample add_527 = (mul_459 + mul_526); + t_sample history_297_next_522 = add_529; + t_sample tap_537 = m_delay_19.read_linear(add_445); + t_sample gen_344 = tap_537; + t_sample mul_541 = (tap_537 * damp_333); + t_sample mul_536 = (m_history_20 * rsub_532); + t_sample add_538 = (mul_541 + mul_536); + t_sample mul_540 = (add_538 * m_fb_3); + t_sample add_534 = (mul_459 + mul_540); + t_sample history_297_next_533 = add_538; + t_sample add_447 = ((((((((gen_344 + gen_355) + gen_366) + gen_377) + gen_388) + gen_399) + gen_458) + gen_410) + 0); + t_sample tap_283 = m_delay_21.read_linear(add_417); + t_sample sub_279 = (add_447 - tap_283); + t_sample mul_281 = (tap_283 * mul_448); + t_sample add_280 = (add_447 + mul_281); + t_sample tap_548 = m_delay_22.read_linear(add_446); + t_sample sub_546 = (sub_279 - tap_548); + t_sample mul_547 = (tap_548 * mul_448); + t_sample add_544 = (sub_279 + mul_547); + t_sample tap_554 = m_delay_23.read_linear(add_431); + t_sample sub_552 = (sub_546 - tap_554); + t_sample mul_553 = (tap_554 * mul_448); + t_sample add_550 = (sub_546 + mul_553); + t_sample tap_560 = m_delay_24.read_linear(add_424); + t_sample sub_558 = (sub_552 - tap_560); + t_sample mul_559 = (tap_560 * mul_448); + t_sample add_556 = (sub_552 + mul_559); + t_sample out1 = sub_558; m_delay_5.write(add_303); m_delay_24.write(add_556); m_delay_23.write(add_550); @@ -257,16 +257,16 @@ typedef struct State { return __exception; }; - inline void set_fb2(double _value) { + inline void set_fb2(t_sample _value) { m_fb_1 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_damp(double _value) { + inline void set_damp(t_sample _value) { m_damp_2 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_fb1(double _value) { + inline void set_fb1(t_sample _value) { m_fb_3 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_spread(double _value) { + inline void set_spread(t_sample _value) { m_spread_4 = (_value < 0 ? 0 : (_value > 400 ? 400 : _value)); }; @@ -279,8 +279,8 @@ typedef struct State { /// Number of signal inputs and outputs -int gen_kernel_numins = 1; -int gen_kernel_numouts = 1; +const int gen_kernel_numins = 1; +const int gen_kernel_numouts = 1; int num_inputs() { return gen_kernel_numins; } int num_outputs() { return gen_kernel_numouts; } @@ -307,7 +307,7 @@ void reset(CommonState *cself) { /// Set a parameter of a State object -void setparameter(CommonState *cself, long index, double value, void *ref) { +void setparameter(CommonState *cself, long index, t_param value, void *ref) { State * self = (State *)cself; switch (index) { case 0: self->set_fb2(value); break; @@ -321,7 +321,7 @@ void setparameter(CommonState *cself, long index, double value, void *ref) { /// Get the value of a parameter of a State object -void getparameter(CommonState *cself, long index, double *value) { +void getparameter(CommonState *cself, long index, t_param *value) { State *self = (State *)cself; switch (index) { case 0: *value = self->m_fb_1; break; @@ -335,7 +335,7 @@ void getparameter(CommonState *cself, long index, double *value) { /// Allocate and configure a new State object and it's internal CommonState: -void * create(double sr, long vs) { +void * create(t_param sr, long vs) { State *self = new State; self->reset(sr, vs); ParamInfo *pi; diff --git a/plugins/freeverb/gen_exported.h b/plugins/freeverb/gen_exported.h index ab06792..c5848bb 100644 --- a/plugins/freeverb/gen_exported.h +++ b/plugins/freeverb/gen_exported.h @@ -29,9 +29,9 @@ int num_outputs(); int num_params(); int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n); void reset(CommonState *cself); -void setparameter(CommonState *cself, long index, double value, void *ref); -void getparameter(CommonState *cself, long index, double *value); -void * create(double sr, long vs); +void setparameter(CommonState *cself, long index, t_param value, void *ref); +void getparameter(CommonState *cself, long index, t_param *value); +void * create(t_param sr, long vs); void destroy(CommonState *cself); } // gen_exported:: diff --git a/plugins/gigaverb/Makefile b/plugins/gigaverb/Makefile index b5cc0d6..1a871f5 100644 --- a/plugins/gigaverb/Makefile +++ b/plugins/gigaverb/Makefile @@ -13,8 +13,7 @@ NAME = MaGigaverb # Files to build OBJS_DSP = \ - DistrhoPluginMaxGen.cpp.o \ - gen_exported.cpp.o + DistrhoPluginMaxGen.cpp.o # -------------------------------------------------------------- # Do some magic diff --git a/plugins/gigaverb/gen_exported.cpp b/plugins/gigaverb/gen_exported.cpp index c22bbff..d98086c 100644 --- a/plugins/gigaverb/gen_exported.cpp +++ b/plugins/gigaverb/gen_exported.cpp @@ -43,24 +43,24 @@ typedef struct State { Delay m_delay_6; Delay m_delay_15; Delay m_delay_17; - double m_bandwidth_22; - double m_tail_23; - double m_spread_21; - double m_revtime_19; - double m_roomsize_20; - double m_damping_18; - double m_early_25; - double m_history_5; - double m_dry_24; - double samplerate; - double m_history_2; - double m_history_1; - double m_history_4; - double m_history_3; + t_sample m_bandwidth_22; + t_sample m_tail_23; + t_sample m_spread_21; + t_sample m_revtime_19; + t_sample m_roomsize_20; + t_sample m_damping_18; + t_sample m_early_25; + t_sample m_history_5; + t_sample m_dry_24; + t_sample samplerate; + t_sample m_history_2; + t_sample m_history_1; + t_sample m_history_4; + t_sample m_history_3; int vectorsize; int __exception; // re-initialize all member variables; - inline void reset(double __sr, int __vs) { + inline void reset(t_sample __sr, int __vs) { __exception = 0; vectorsize = __vs; samplerate = __sr; @@ -107,160 +107,160 @@ typedef struct State { return __exception; }; - double rsub_999 = (1 - m_bandwidth_22); - double expr_1051 = safepow(0.001, safediv(1, (m_revtime_19 * 44100))); - double expr_1052 = safediv((m_roomsize_20 * 44100), 340); - double mul_988 = (expr_1052 * 0.63245); - double expr_1043 = (-safepow(expr_1051, mul_988)); - double mul_990 = (expr_1052 * 0.81649); - double expr_1045 = (-safepow(expr_1051, mul_990)); - double mul_989 = (expr_1052 * 0.7071); - double expr_1044 = (-safepow(expr_1051, mul_989)); - double mul_991 = (expr_1052 * 1); - double expr_1050 = (-safepow(expr_1051, mul_991)); - double mul_985 = (expr_1052 * 0.000527); + t_sample rsub_999 = (1 - m_bandwidth_22); + t_sample expr_1051 = safepow(0.001, safediv(1, (m_revtime_19 * 44100))); + t_sample expr_1052 = safediv((m_roomsize_20 * 44100), 340); + t_sample mul_988 = (expr_1052 * 0.63245); + t_sample expr_1043 = (-safepow(expr_1051, mul_988)); + t_sample mul_990 = (expr_1052 * 0.81649); + t_sample expr_1045 = (-safepow(expr_1051, mul_990)); + t_sample mul_989 = (expr_1052 * 0.7071); + t_sample expr_1044 = (-safepow(expr_1051, mul_989)); + t_sample mul_991 = (expr_1052 * 1); + t_sample expr_1050 = (-safepow(expr_1051, mul_991)); + t_sample mul_985 = (expr_1052 * 0.000527); int int_984 = int(mul_985); - double mul_925 = (m_spread_21 * -0.380445); - double add_924 = (mul_925 + 931); - double rsub_921 = (1341 - add_924); - double mul_934 = (int_984 * rsub_921); - double mul_953 = (m_spread_21 * 0.376623); - double add_952 = (mul_953 + 931); - double rsub_949 = (1341 - add_952); - double mul_960 = (int_984 * rsub_949); - double add_914 = (expr_1052 + 5); - double expr_1046 = safepow(expr_1051, add_914); - double mul_920 = (expr_1052 * 0.41); - double add_917 = (mul_920 + 5); - double expr_1049 = safepow(expr_1051, add_917); - double mul_919 = (expr_1052 * 0.3); - double add_916 = (mul_919 + 5); - double expr_1048 = safepow(expr_1051, add_916); - double mul_918 = (expr_1052 * 0.155); - double add_915 = (mul_918 + 5); - double expr_1047 = safepow(expr_1051, add_915); - double mul_927 = (m_spread_21 * -0.568366); - double add_923 = (mul_927 + 369); - double rsub_922 = (add_924 - add_923); - double mul_941 = (int_984 * rsub_922); - double mul_983 = (expr_1052 * 0.110732); - double mul_969 = (m_spread_21 * 0.125541); - double add_951 = (mul_969 + 369); - double rsub_950 = (add_952 - add_951); - double mul_967 = (int_984 * rsub_950); - double add_926 = (mul_927 + 159); - double mul_948 = (int_984 * add_926); - double add_968 = (mul_969 + 159); - double mul_976 = (int_984 * add_968); + t_sample mul_925 = (m_spread_21 * -0.380445); + t_sample add_924 = (mul_925 + 931); + t_sample rsub_921 = (1341 - add_924); + t_sample mul_934 = (int_984 * rsub_921); + t_sample mul_953 = (m_spread_21 * 0.376623); + t_sample add_952 = (mul_953 + 931); + t_sample rsub_949 = (1341 - add_952); + t_sample mul_960 = (int_984 * rsub_949); + t_sample add_914 = (expr_1052 + 5); + t_sample expr_1046 = safepow(expr_1051, add_914); + t_sample mul_920 = (expr_1052 * 0.41); + t_sample add_917 = (mul_920 + 5); + t_sample expr_1049 = safepow(expr_1051, add_917); + t_sample mul_919 = (expr_1052 * 0.3); + t_sample add_916 = (mul_919 + 5); + t_sample expr_1048 = safepow(expr_1051, add_916); + t_sample mul_918 = (expr_1052 * 0.155); + t_sample add_915 = (mul_918 + 5); + t_sample expr_1047 = safepow(expr_1051, add_915); + t_sample mul_927 = (m_spread_21 * -0.568366); + t_sample add_923 = (mul_927 + 369); + t_sample rsub_922 = (add_924 - add_923); + t_sample mul_941 = (int_984 * rsub_922); + t_sample mul_983 = (expr_1052 * 0.110732); + t_sample mul_969 = (m_spread_21 * 0.125541); + t_sample add_951 = (mul_969 + 369); + t_sample rsub_950 = (add_952 - add_951); + t_sample mul_967 = (int_984 * rsub_950); + t_sample add_926 = (mul_927 + 159); + t_sample mul_948 = (int_984 * add_926); + t_sample add_968 = (mul_969 + 159); + t_sample mul_976 = (int_984 * add_968); // the main sample loop; while ((__n--)) { - const double in1 = (*(__in1++)); - const double in2 = (*(__in2++)); - double mul_846 = (in2 * m_dry_24); - double mul_858 = (in1 * m_dry_24); - double mul_848 = ((in1 + in2) * 0.707); - double mix_1070 = (mul_848 + (rsub_999 * (m_history_5 - mul_848))); - double mix_998 = mix_1070; - double tap_888 = m_delay_17.read_linear(mul_988); - double mul_884 = (tap_888 * expr_1043); - double mix_1071 = (mul_884 + (m_damping_18 * (m_history_4 - mul_884))); - double mix_886 = mix_1071; - double tap_900 = m_delay_16.read_linear(mul_990); - double mul_896 = (tap_900 * expr_1045); - double mix_1072 = (mul_896 + (m_damping_18 * (m_history_3 - mul_896))); - double mix_898 = mix_1072; - double tap_894 = m_delay_15.read_linear(mul_989); - double mul_890 = (tap_894 * expr_1044); - double mix_1073 = (mul_890 + (m_damping_18 * (m_history_2 - mul_890))); - double mix_892 = mix_1073; - double tap_996 = m_delay_14.read_linear(mul_991); - double mul_987 = (tap_996 * expr_1050); - double mix_1074 = (mul_987 + (m_damping_18 * (m_history_1 - mul_987))); - double mix_994 = mix_1074; - double tap_933 = m_delay_13.read_linear(mul_934); - double mul_931 = (tap_933 * 0.625); - double tap_959 = m_delay_12.read_linear(mul_960); - double mul_957 = (tap_959 * 0.625); - double add_878 = (mix_994 + mix_898); - double add_876 = (mix_892 + mix_886); - double add_871 = (add_878 + add_876); - double mul_854 = (add_871 * 0.5); - double sub_875 = (add_878 - add_876); - double mul_857 = (sub_875 * 0.5); - double sub_877 = (mix_994 - mix_898); - double sub_874 = (mix_892 - mix_886); - double sub_873 = (sub_877 - sub_874); - double mul_856 = (sub_873 * 0.5); - double add_872 = (sub_877 + sub_874); - double rsub_870 = (0 - add_872); - double mul_855 = (rsub_870 * 0.5); - double tap_902 = m_delay_11.read_linear(add_917); - double tap_903 = m_delay_11.read_linear(add_916); - double tap_904 = m_delay_11.read_linear(add_915); - double tap_905 = m_delay_11.read_linear(add_914); - double mul_906 = (tap_905 * expr_1046); - double add_879 = (mul_854 + mul_906); - double mul_910 = (tap_903 * expr_1048); - double add_881 = (mul_856 + mul_910); - double mul_912 = (tap_902 * expr_1049); - double add_882 = (mul_857 + mul_912); - double mul_908 = (tap_904 * expr_1047); - double add_880 = (mul_855 + mul_908); - double tap_940 = m_delay_10.read_linear(mul_941); - double mul_938 = (tap_940 * 0.625); - double tap_982 = m_delay_9.read_linear(mul_983); - double tap_966 = m_delay_8.read_linear(mul_967); - double mul_964 = (tap_966 * 0.625); - double tap_947 = m_delay_7.read_linear(mul_948); - double mul_945 = (tap_947 * 0.75); - double mul_980 = (tap_982 * 0.75); - double sub_979 = (mix_998 - mul_980); - double mul_978 = (sub_979 * 0.75); - double add_977 = (mul_978 + tap_982); - double tap_975 = m_delay_6.read_linear(mul_976); - double mul_973 = (tap_975 * 0.75); - double mul_869 = (mul_857 * m_tail_23); - double mul_867 = (mul_855 * m_tail_23); - double add_853 = (mul_869 + mul_867); - double mul_868 = (mul_856 * m_tail_23); - double mul_866 = (mul_854 * m_tail_23); - double add_852 = (mul_868 + mul_866); - double sub_861 = (add_853 - add_852); - double mul_865 = (mul_912 * m_early_25); - double mul_863 = (mul_908 * m_early_25); - double add_851 = (mul_865 + mul_863); - double mul_864 = (mul_910 * m_early_25); - double mul_862 = (mul_906 * m_early_25); - double add_850 = (mul_864 + mul_862); - double sub_860 = (add_851 - add_850); - double add_847 = (sub_861 + sub_860); - double add_849 = (add_847 + in2); - double sub_944 = (add_849 - mul_945); - double mul_943 = (sub_944 * 0.75); - double add_942 = (mul_943 + tap_947); - double sub_937 = (add_942 - mul_938); - double mul_936 = (sub_937 * 0.625); - double add_935 = (mul_936 + tap_940); - double sub_930 = (add_935 - mul_931); - double mul_929 = (sub_930 * 0.625); - double add_928 = (mul_929 + tap_933); - double out2 = (mul_846 + add_928); - double add_859 = (add_847 + in1); - double sub_972 = (add_859 - mul_973); - double mul_971 = (sub_972 * 0.75); - double add_970 = (mul_971 + tap_975); - double sub_963 = (add_970 - mul_964); - double mul_962 = (sub_963 * 0.625); - double add_961 = (mul_962 + tap_966); - double sub_956 = (add_961 - mul_957); - double mul_955 = (sub_956 * 0.625); - double add_954 = (mul_955 + tap_959); - double out1 = (mul_858 + add_954); - double history_997_next_1065 = mix_998; - double history_885_next_1066 = mix_886; - double history_897_next_1067 = mix_898; - double history_891_next_1068 = mix_892; - double history_993_next_1069 = mix_994; + const t_sample in1 = (*(__in1++)); + const t_sample in2 = (*(__in2++)); + t_sample mul_846 = (in2 * m_dry_24); + t_sample mul_858 = (in1 * m_dry_24); + t_sample mul_848 = ((in1 + in2) * 0.707); + t_sample mix_1070 = (mul_848 + (rsub_999 * (m_history_5 - mul_848))); + t_sample mix_998 = mix_1070; + t_sample tap_888 = m_delay_17.read_linear(mul_988); + t_sample mul_884 = (tap_888 * expr_1043); + t_sample mix_1071 = (mul_884 + (m_damping_18 * (m_history_4 - mul_884))); + t_sample mix_886 = mix_1071; + t_sample tap_900 = m_delay_16.read_linear(mul_990); + t_sample mul_896 = (tap_900 * expr_1045); + t_sample mix_1072 = (mul_896 + (m_damping_18 * (m_history_3 - mul_896))); + t_sample mix_898 = mix_1072; + t_sample tap_894 = m_delay_15.read_linear(mul_989); + t_sample mul_890 = (tap_894 * expr_1044); + t_sample mix_1073 = (mul_890 + (m_damping_18 * (m_history_2 - mul_890))); + t_sample mix_892 = mix_1073; + t_sample tap_996 = m_delay_14.read_linear(mul_991); + t_sample mul_987 = (tap_996 * expr_1050); + t_sample mix_1074 = (mul_987 + (m_damping_18 * (m_history_1 - mul_987))); + t_sample mix_994 = mix_1074; + t_sample tap_933 = m_delay_13.read_linear(mul_934); + t_sample mul_931 = (tap_933 * 0.625); + t_sample tap_959 = m_delay_12.read_linear(mul_960); + t_sample mul_957 = (tap_959 * 0.625); + t_sample add_878 = (mix_994 + mix_898); + t_sample add_876 = (mix_892 + mix_886); + t_sample add_871 = (add_878 + add_876); + t_sample mul_854 = (add_871 * 0.5); + t_sample sub_875 = (add_878 - add_876); + t_sample mul_857 = (sub_875 * 0.5); + t_sample sub_877 = (mix_994 - mix_898); + t_sample sub_874 = (mix_892 - mix_886); + t_sample sub_873 = (sub_877 - sub_874); + t_sample mul_856 = (sub_873 * 0.5); + t_sample add_872 = (sub_877 + sub_874); + t_sample rsub_870 = (0 - add_872); + t_sample mul_855 = (rsub_870 * 0.5); + t_sample tap_902 = m_delay_11.read_linear(add_917); + t_sample tap_903 = m_delay_11.read_linear(add_916); + t_sample tap_904 = m_delay_11.read_linear(add_915); + t_sample tap_905 = m_delay_11.read_linear(add_914); + t_sample mul_906 = (tap_905 * expr_1046); + t_sample add_879 = (mul_854 + mul_906); + t_sample mul_910 = (tap_903 * expr_1048); + t_sample add_881 = (mul_856 + mul_910); + t_sample mul_912 = (tap_902 * expr_1049); + t_sample add_882 = (mul_857 + mul_912); + t_sample mul_908 = (tap_904 * expr_1047); + t_sample add_880 = (mul_855 + mul_908); + t_sample tap_940 = m_delay_10.read_linear(mul_941); + t_sample mul_938 = (tap_940 * 0.625); + t_sample tap_982 = m_delay_9.read_linear(mul_983); + t_sample tap_966 = m_delay_8.read_linear(mul_967); + t_sample mul_964 = (tap_966 * 0.625); + t_sample tap_947 = m_delay_7.read_linear(mul_948); + t_sample mul_945 = (tap_947 * 0.75); + t_sample mul_980 = (tap_982 * 0.75); + t_sample sub_979 = (mix_998 - mul_980); + t_sample mul_978 = (sub_979 * 0.75); + t_sample add_977 = (mul_978 + tap_982); + t_sample tap_975 = m_delay_6.read_linear(mul_976); + t_sample mul_973 = (tap_975 * 0.75); + t_sample mul_869 = (mul_857 * m_tail_23); + t_sample mul_867 = (mul_855 * m_tail_23); + t_sample add_853 = (mul_869 + mul_867); + t_sample mul_868 = (mul_856 * m_tail_23); + t_sample mul_866 = (mul_854 * m_tail_23); + t_sample add_852 = (mul_868 + mul_866); + t_sample sub_861 = (add_853 - add_852); + t_sample mul_865 = (mul_912 * m_early_25); + t_sample mul_863 = (mul_908 * m_early_25); + t_sample add_851 = (mul_865 + mul_863); + t_sample mul_864 = (mul_910 * m_early_25); + t_sample mul_862 = (mul_906 * m_early_25); + t_sample add_850 = (mul_864 + mul_862); + t_sample sub_860 = (add_851 - add_850); + t_sample add_847 = (sub_861 + sub_860); + t_sample add_849 = (add_847 + in2); + t_sample sub_944 = (add_849 - mul_945); + t_sample mul_943 = (sub_944 * 0.75); + t_sample add_942 = (mul_943 + tap_947); + t_sample sub_937 = (add_942 - mul_938); + t_sample mul_936 = (sub_937 * 0.625); + t_sample add_935 = (mul_936 + tap_940); + t_sample sub_930 = (add_935 - mul_931); + t_sample mul_929 = (sub_930 * 0.625); + t_sample add_928 = (mul_929 + tap_933); + t_sample out2 = (mul_846 + add_928); + t_sample add_859 = (add_847 + in1); + t_sample sub_972 = (add_859 - mul_973); + t_sample mul_971 = (sub_972 * 0.75); + t_sample add_970 = (mul_971 + tap_975); + t_sample sub_963 = (add_970 - mul_964); + t_sample mul_962 = (sub_963 * 0.625); + t_sample add_961 = (mul_962 + tap_966); + t_sample sub_956 = (add_961 - mul_957); + t_sample mul_955 = (sub_956 * 0.625); + t_sample add_954 = (mul_955 + tap_959); + t_sample out1 = (mul_858 + add_954); + t_sample history_997_next_1065 = mix_998; + t_sample history_885_next_1066 = mix_886; + t_sample history_897_next_1067 = mix_898; + t_sample history_891_next_1068 = mix_892; + t_sample history_993_next_1069 = mix_994; m_delay_17.write(add_879); m_delay_16.write(add_881); m_delay_15.write(add_880); @@ -298,28 +298,28 @@ typedef struct State { return __exception; }; - inline void set_damping(double _value) { + inline void set_damping(t_sample _value) { m_damping_18 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_revtime(double _value) { + inline void set_revtime(t_sample _value) { m_revtime_19 = (_value < 0.1 ? 0.1 : (_value > 360 ? 360 : _value)); }; - inline void set_roomsize(double _value) { + inline void set_roomsize(t_sample _value) { m_roomsize_20 = (_value < 0.1 ? 0.1 : (_value > 300 ? 300 : _value)); }; - inline void set_spread(double _value) { + inline void set_spread(t_sample _value) { m_spread_21 = (_value < 0 ? 0 : (_value > 100 ? 100 : _value)); }; - inline void set_bandwidth(double _value) { + inline void set_bandwidth(t_sample _value) { m_bandwidth_22 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_tail(double _value) { + inline void set_tail(t_sample _value) { m_tail_23 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_dry(double _value) { + inline void set_dry(t_sample _value) { m_dry_24 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_early(double _value) { + inline void set_early(t_sample _value) { m_early_25 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; @@ -332,8 +332,8 @@ typedef struct State { /// Number of signal inputs and outputs -int gen_kernel_numins = 2; -int gen_kernel_numouts = 2; +const int gen_kernel_numins = 2; +const int gen_kernel_numouts = 2; int num_inputs() { return gen_kernel_numins; } int num_outputs() { return gen_kernel_numouts; } @@ -360,7 +360,7 @@ void reset(CommonState *cself) { /// Set a parameter of a State object -void setparameter(CommonState *cself, long index, double value, void *ref) { +void setparameter(CommonState *cself, long index, t_param value, void *ref) { State * self = (State *)cself; switch (index) { case 0: self->set_damping(value); break; @@ -378,7 +378,7 @@ void setparameter(CommonState *cself, long index, double value, void *ref) { /// Get the value of a parameter of a State object -void getparameter(CommonState *cself, long index, double *value) { +void getparameter(CommonState *cself, long index, t_param *value) { State *self = (State *)cself; switch (index) { case 0: *value = self->m_damping_18; break; @@ -396,7 +396,7 @@ void getparameter(CommonState *cself, long index, double *value) { /// Allocate and configure a new State object and it's internal CommonState: -void * create(double sr, long vs) { +void * create(t_param sr, long vs) { State *self = new State; self->reset(sr, vs); ParamInfo *pi; diff --git a/plugins/gigaverb/gen_exported.h b/plugins/gigaverb/gen_exported.h index ab06792..c5848bb 100644 --- a/plugins/gigaverb/gen_exported.h +++ b/plugins/gigaverb/gen_exported.h @@ -29,9 +29,9 @@ int num_outputs(); int num_params(); int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n); void reset(CommonState *cself); -void setparameter(CommonState *cself, long index, double value, void *ref); -void getparameter(CommonState *cself, long index, double *value); -void * create(double sr, long vs); +void setparameter(CommonState *cself, long index, t_param value, void *ref); +void getparameter(CommonState *cself, long index, t_param *value); +void * create(t_param sr, long vs); void destroy(CommonState *cself); } // gen_exported:: diff --git a/plugins/pitchshift/Makefile b/plugins/pitchshift/Makefile index b62719a..73d0ab0 100644 --- a/plugins/pitchshift/Makefile +++ b/plugins/pitchshift/Makefile @@ -13,8 +13,7 @@ NAME = MaPitchshift # Files to build OBJS_DSP = \ - DistrhoPluginMaxGen.cpp.o \ - gen_exported.cpp.o + DistrhoPluginMaxGen.cpp.o # -------------------------------------------------------------- # Do some magic diff --git a/plugins/pitchshift/gen_exported.cpp b/plugins/pitchshift/gen_exported.cpp index a76fdc7..7afe4df 100644 --- a/plugins/pitchshift/gen_exported.cpp +++ b/plugins/pitchshift/gen_exported.cpp @@ -45,20 +45,20 @@ typedef struct State { Sah m_sah_19; Sah m_sah_18; Sah m_sah_22; - double samples_to_seconds; - double m_ratio_8; - double m_xfade_9; - double m_history_1; - double samplerate; - double m_history_3; - double m_history_2; - double m_blur_6; - double m_window_7; - double m_history_4; + t_sample samples_to_seconds; + t_sample m_ratio_8; + t_sample m_xfade_9; + t_sample m_history_1; + t_sample samplerate; + t_sample m_history_3; + t_sample m_history_2; + t_sample m_blur_6; + t_sample m_window_7; + t_sample m_history_4; int vectorsize; int __exception; // re-initialize all member variables; - inline void reset(double __sr, int __vs) { + inline void reset(t_sample __sr, int __vs) { __exception = 0; vectorsize = __vs; samplerate = __sr; @@ -102,85 +102,85 @@ typedef struct State { return __exception; }; - double mstosamps_1223 = (m_window_7 * (samplerate * 0.001)); - double rsub_1209 = (1 - m_ratio_8); - double mul_1208 = (rsub_1209 * 1000); - double div_1207 = safediv(mul_1208, m_window_7); + t_sample mstosamps_1223 = (m_window_7 * (samplerate * 0.001)); + t_sample rsub_1209 = (1 - m_ratio_8); + t_sample mul_1208 = (rsub_1209 * 1000); + t_sample div_1207 = safediv(mul_1208, m_window_7); samples_to_seconds = (1 / samplerate); // the main sample loop; while ((__n--)) { - const double in1 = (*(__in1++)); - double noise_1159 = noise(); - double abs_1177 = fabs(noise_1159); - double mul_1183 = (abs_1177 * m_blur_6); - double noise_1161 = noise(); - double abs_1179 = fabs(noise_1161); - double mul_1189 = (abs_1179 * m_blur_6); - double noise_1160 = noise(); - double abs_1178 = fabs(noise_1160); - double mul_1186 = (abs_1178 * m_blur_6); - double noise_1158 = noise(); - double abs_1176 = fabs(noise_1158); - double mul_1180 = (abs_1176 * m_blur_6); - double phasor_1229 = m_phasor_10(div_1207, samples_to_seconds); - double add_1206 = ((m_history_4 + phasor_1229) + 0.5); - double mod_1205 = safemod(add_1206, 1); - double delta_1185 = m_delta_11(mod_1205); - double sah_1164 = m_sah_12(mul_1183, delta_1185, 0); - double sah_1184 = m_sah_13(mstosamps_1223, delta_1185, 0); - double mul_1173 = (sah_1184 * mod_1205); - double sub_1204 = (mod_1205 - 0.5); - double mul_1203 = (sub_1204 * 3.1415926535898); - double cos_1202 = cos(mul_1203); - double mul_1192 = (cos_1202 * cos_1202); - double add_1228 = ((m_history_3 + phasor_1229) + 0); - double mod_1227 = safemod(add_1228, 1); - double delta_1169 = m_delta_14(mod_1227); - double sah_1168 = m_sah_15(mul_1189, delta_1169, 0); - double sah_1190 = m_sah_16(mstosamps_1223, delta_1169, 0); - double mul_1175 = (sah_1190 * mod_1227); - double sub_1226 = (mod_1227 - 0.5); - double mul_1225 = (sub_1226 * 3.1415926535898); - double cos_1224 = cos(mul_1225); - double mul_1194 = (cos_1224 * cos_1224); - double add_1222 = ((m_history_2 + phasor_1229) + 0.25); - double mod_1221 = safemod(add_1222, 1); - double delta_1188 = m_delta_17(mod_1221); - double sah_1166 = m_sah_18(mul_1186, delta_1188, 0); - double sah_1187 = m_sah_19(mstosamps_1223, delta_1188, 0); - double mul_1174 = (sah_1187 * mod_1221); - double sub_1220 = (mod_1221 - 0.5); - double mul_1219 = (sub_1220 * 3.1415926535898); - double cos_1218 = cos(mul_1219); - double mul_1193 = (cos_1218 * cos_1218); - double add_1200 = ((m_history_1 + phasor_1229) + 0.75); - double mod_1199 = safemod(add_1200, 1); - double delta_1182 = m_delta_20(mod_1199); - double sah_1162 = m_sah_21(mul_1180, delta_1182, 0); - double sah_1181 = m_sah_22(mstosamps_1223, delta_1182, 0); - double mul_1172 = (sah_1181 * mod_1199); - double tap_1214 = m_delay_5.read_linear(mul_1175); - double tap_1215 = m_delay_5.read_linear(mul_1174); - double tap_1216 = m_delay_5.read_linear(mul_1173); - double tap_1217 = m_delay_5.read_linear(mul_1172); - double mul_1212 = (tap_1214 * mul_1194); - double mul_1201 = (tap_1216 * mul_1192); - double add_1245 = (mul_1201 + mul_1212); - double mix_1244 = (in1 + (m_xfade_9 * (add_1245 - in1))); - double out1 = mix_1244; - double mul_1211 = (tap_1215 * mul_1193); - double sub_1198 = (mod_1199 - 0.5); - double mul_1197 = (sub_1198 * 3.1415926535898); - double cos_1196 = cos(mul_1197); - double mul_1191 = (cos_1196 * cos_1196); - double mul_1195 = (tap_1217 * mul_1191); - double add_1247 = (mul_1195 + mul_1211); - double mix_1246 = (in1 + (m_xfade_9 * (add_1247 - in1))); - double out2 = mix_1246; - double history_1165_next_1240 = sah_1164; - double history_1170_next_1241 = sah_1168; - double history_1167_next_1242 = sah_1166; - double history_1163_next_1243 = sah_1162; + const t_sample in1 = (*(__in1++)); + t_sample noise_1159 = noise(); + t_sample abs_1177 = fabs(noise_1159); + t_sample mul_1183 = (abs_1177 * m_blur_6); + t_sample noise_1161 = noise(); + t_sample abs_1179 = fabs(noise_1161); + t_sample mul_1189 = (abs_1179 * m_blur_6); + t_sample noise_1160 = noise(); + t_sample abs_1178 = fabs(noise_1160); + t_sample mul_1186 = (abs_1178 * m_blur_6); + t_sample noise_1158 = noise(); + t_sample abs_1176 = fabs(noise_1158); + t_sample mul_1180 = (abs_1176 * m_blur_6); + t_sample phasor_1229 = m_phasor_10(div_1207, samples_to_seconds); + t_sample add_1206 = ((m_history_4 + phasor_1229) + 0.5); + t_sample mod_1205 = safemod(add_1206, 1); + t_sample delta_1185 = m_delta_11(mod_1205); + t_sample sah_1164 = m_sah_12(mul_1183, delta_1185, 0); + t_sample sah_1184 = m_sah_13(mstosamps_1223, delta_1185, 0); + t_sample mul_1173 = (sah_1184 * mod_1205); + t_sample sub_1204 = (mod_1205 - 0.5); + t_sample mul_1203 = (sub_1204 * 3.1415926535898); + t_sample cos_1202 = cos(mul_1203); + t_sample mul_1192 = (cos_1202 * cos_1202); + t_sample add_1228 = ((m_history_3 + phasor_1229) + 0); + t_sample mod_1227 = safemod(add_1228, 1); + t_sample delta_1169 = m_delta_14(mod_1227); + t_sample sah_1168 = m_sah_15(mul_1189, delta_1169, 0); + t_sample sah_1190 = m_sah_16(mstosamps_1223, delta_1169, 0); + t_sample mul_1175 = (sah_1190 * mod_1227); + t_sample sub_1226 = (mod_1227 - 0.5); + t_sample mul_1225 = (sub_1226 * 3.1415926535898); + t_sample cos_1224 = cos(mul_1225); + t_sample mul_1194 = (cos_1224 * cos_1224); + t_sample add_1222 = ((m_history_2 + phasor_1229) + 0.25); + t_sample mod_1221 = safemod(add_1222, 1); + t_sample delta_1188 = m_delta_17(mod_1221); + t_sample sah_1166 = m_sah_18(mul_1186, delta_1188, 0); + t_sample sah_1187 = m_sah_19(mstosamps_1223, delta_1188, 0); + t_sample mul_1174 = (sah_1187 * mod_1221); + t_sample sub_1220 = (mod_1221 - 0.5); + t_sample mul_1219 = (sub_1220 * 3.1415926535898); + t_sample cos_1218 = cos(mul_1219); + t_sample mul_1193 = (cos_1218 * cos_1218); + t_sample add_1200 = ((m_history_1 + phasor_1229) + 0.75); + t_sample mod_1199 = safemod(add_1200, 1); + t_sample delta_1182 = m_delta_20(mod_1199); + t_sample sah_1162 = m_sah_21(mul_1180, delta_1182, 0); + t_sample sah_1181 = m_sah_22(mstosamps_1223, delta_1182, 0); + t_sample mul_1172 = (sah_1181 * mod_1199); + t_sample tap_1214 = m_delay_5.read_linear(mul_1175); + t_sample tap_1215 = m_delay_5.read_linear(mul_1174); + t_sample tap_1216 = m_delay_5.read_linear(mul_1173); + t_sample tap_1217 = m_delay_5.read_linear(mul_1172); + t_sample mul_1212 = (tap_1214 * mul_1194); + t_sample mul_1201 = (tap_1216 * mul_1192); + t_sample add_1245 = (mul_1201 + mul_1212); + t_sample mix_1244 = (in1 + (m_xfade_9 * (add_1245 - in1))); + t_sample out1 = mix_1244; + t_sample mul_1211 = (tap_1215 * mul_1193); + t_sample sub_1198 = (mod_1199 - 0.5); + t_sample mul_1197 = (sub_1198 * 3.1415926535898); + t_sample cos_1196 = cos(mul_1197); + t_sample mul_1191 = (cos_1196 * cos_1196); + t_sample mul_1195 = (tap_1217 * mul_1191); + t_sample add_1247 = (mul_1195 + mul_1211); + t_sample mix_1246 = (in1 + (m_xfade_9 * (add_1247 - in1))); + t_sample out2 = mix_1246; + t_sample history_1165_next_1240 = sah_1164; + t_sample history_1170_next_1241 = sah_1168; + t_sample history_1167_next_1242 = sah_1166; + t_sample history_1163_next_1243 = sah_1162; m_delay_5.write(in1); m_history_4 = history_1165_next_1240; m_history_3 = history_1170_next_1241; @@ -195,16 +195,16 @@ typedef struct State { return __exception; }; - inline void set_blur(double _value) { + inline void set_blur(t_sample _value) { m_blur_6 = (_value < 0 ? 0 : (_value > 0.25 ? 0.25 : _value)); }; - inline void set_window(double _value) { + inline void set_window(t_sample _value) { m_window_7 = (_value < 0.1 ? 0.1 : (_value > 1000 ? 1000 : _value)); }; - inline void set_ratio(double _value) { + inline void set_ratio(t_sample _value) { m_ratio_8 = (_value < 0.25 ? 0.25 : (_value > 4 ? 4 : _value)); }; - inline void set_xfade(double _value) { + inline void set_xfade(t_sample _value) { m_xfade_9 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; @@ -217,8 +217,8 @@ typedef struct State { /// Number of signal inputs and outputs -int gen_kernel_numins = 1; -int gen_kernel_numouts = 2; +const int gen_kernel_numins = 1; +const int gen_kernel_numouts = 2; int num_inputs() { return gen_kernel_numins; } int num_outputs() { return gen_kernel_numouts; } @@ -245,7 +245,7 @@ void reset(CommonState *cself) { /// Set a parameter of a State object -void setparameter(CommonState *cself, long index, double value, void *ref) { +void setparameter(CommonState *cself, long index, t_param value, void *ref) { State * self = (State *)cself; switch (index) { case 0: self->set_blur(value); break; @@ -259,7 +259,7 @@ void setparameter(CommonState *cself, long index, double value, void *ref) { /// Get the value of a parameter of a State object -void getparameter(CommonState *cself, long index, double *value) { +void getparameter(CommonState *cself, long index, t_param *value) { State *self = (State *)cself; switch (index) { case 0: *value = self->m_blur_6; break; @@ -273,7 +273,7 @@ void getparameter(CommonState *cself, long index, double *value) { /// Allocate and configure a new State object and it's internal CommonState: -void * create(double sr, long vs) { +void * create(t_param sr, long vs) { State *self = new State; self->reset(sr, vs); ParamInfo *pi; diff --git a/plugins/pitchshift/gen_exported.h b/plugins/pitchshift/gen_exported.h index ab06792..c5848bb 100644 --- a/plugins/pitchshift/gen_exported.h +++ b/plugins/pitchshift/gen_exported.h @@ -29,9 +29,9 @@ int num_outputs(); int num_params(); int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n); void reset(CommonState *cself); -void setparameter(CommonState *cself, long index, double value, void *ref); -void getparameter(CommonState *cself, long index, double *value); -void * create(double sr, long vs); +void setparameter(CommonState *cself, long index, t_param value, void *ref); +void getparameter(CommonState *cself, long index, t_param *value); +void * create(t_param sr, long vs); void destroy(CommonState *cself); } // gen_exported::