From d020e24f8d81d124256ca585a6136210048fa76b Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 18 Nov 2016 11:51:26 +0000 Subject: [PATCH] Manually change generated code to use t_param type for parameters --- plugins/bitcrush/Makefile | 3 +-- plugins/bitcrush/gen_exported.cpp | 10 +++++----- plugins/bitcrush/gen_exported.h | 6 +++--- plugins/common/DistrhoPluginMaxGen.cpp | 6 +++--- plugins/freeverb/Makefile | 3 +-- plugins/freeverb/gen_exported.cpp | 10 +++++----- plugins/freeverb/gen_exported.h | 6 +++--- plugins/gigaverb/Makefile | 3 +-- plugins/gigaverb/gen_exported.cpp | 10 +++++----- plugins/gigaverb/gen_exported.h | 6 +++--- plugins/pitchshift/Makefile | 3 +-- plugins/pitchshift/gen_exported.cpp | 10 +++++----- plugins/pitchshift/gen_exported.h | 6 +++--- 13 files changed, 39 insertions(+), 43 deletions(-) diff --git a/plugins/bitcrush/Makefile b/plugins/bitcrush/Makefile index 172fc4b..da5ea1f 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..6011024 100644 --- a/plugins/bitcrush/gen_exported.cpp +++ b/plugins/bitcrush/gen_exported.cpp @@ -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 e718678..5afac86 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..c85a1d8 100644 --- a/plugins/freeverb/gen_exported.cpp +++ b/plugins/freeverb/gen_exported.cpp @@ -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 c3ea688..b4e290f 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..ac1d280 100644 --- a/plugins/gigaverb/gen_exported.cpp +++ b/plugins/gigaverb/gen_exported.cpp @@ -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 def9824..e043aca 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..59449c3 100644 --- a/plugins/pitchshift/gen_exported.cpp +++ b/plugins/pitchshift/gen_exported.cpp @@ -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::