Browse Source

further updates to projects and headers for Max 7.3 (fix use of double)

pull/3/head
Jeremy Bernstein 8 years ago
parent
commit
84ab6884cc
10 changed files with 1344 additions and 953 deletions
  1. +127
    -62
      plugins/bitcrush/gen_exported.cpp
  2. +31
    -19
      plugins/bitcrush/gen_exported.h
  3. +162
    -79
      plugins/bitcrush/gen~.bitcrush.maxpat
  4. +1
    -1
      plugins/common/DistrhoPluginMaxGen.cpp
  5. +296
    -231
      plugins/freeverb/gen_exported.cpp
  6. +31
    -19
      plugins/freeverb/gen_exported.h
  7. +383
    -318
      plugins/gigaverb/gen_exported.cpp
  8. +31
    -19
      plugins/gigaverb/gen_exported.h
  9. +251
    -186
      plugins/pitchshift/gen_exported.cpp
  10. +31
    -19
      plugins/pitchshift/gen_exported.h

+ 127
- 62
plugins/bitcrush/gen_exported.cpp View File

@@ -2,41 +2,43 @@

namespace gen_exported {


/*******************************************************************************************************************
Copyright (c) 2012 Cycling '74

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Cycling '74 License for Max-Generated Code for Export
Copyright (c) 2016 Cycling '74
The code that Max generates automatically and that end users are capable of exporting and using, and any
associated documentation files (the “Software”) is a work of authorship for which Cycling '74 is the author
and owner for copyright purposes. A license is hereby granted, free of charge, to any person obtaining a
copy of the Software (“Licensee”) to use, copy, modify, merge, publish, and distribute copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The Software is licensed to Licensee only for non-commercial use. Users who wish to make commercial use of the
Software must contact the copyright owner to determine if a license for commercial use is available, and the
terms and conditions for same, which may include fees or royalties. For commercial use, please send inquiries
to licensing (at) cycling74.com. The determination of whether a use is commercial use or non-commercial use is based
upon the use, not the user. The Software may be used by individuals, institutions, governments, corporations, or
other business whether for-profit or non-profit so long as the use itself is not a commercialization of the
materials or a use that generates or is intended to generate income, revenue, sales or profit.
The above copyright notice and this license shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*******************************************************************************************************************/


// global noise generator
Noise noise;
static const int GENLIB_LOOPCOUNT_BAIL = 100000;


// The State struct contains all the state and procedures for the gendsp kernel
typedef struct State {
typedef struct State {
CommonState __commonstate;
double m_resolution_1;
double samplerate;
int vectorsize;
int __exception;
int vectorsize;
t_sample samplerate;
t_sample m_resolution_1;
// re-initialize all member variables;
inline void reset(double __sr, int __vs) {
inline void reset(t_param __sr, int __vs) {
__exception = 0;
vectorsize = __vs;
samplerate = __sr;
@@ -45,31 +47,31 @@ typedef struct State {
};
// the signal processing routine;
inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) {
inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) {
vectorsize = __n;
const t_sample * __in1 = __ins[0];
t_sample * __out1 = __outs[0];
t_sample * __out2 = __outs[1];
if (__exception) {
if (__exception) {
return __exception;
} else if (( (__in1 == 0) || (__out1 == 0) || (__out2 == 0) )) {
} else if (( (__in1 == 0) || (__out1 == 0) || (__out2 == 0) )) {
__exception = GENLIB_ERR_NULL_BUFFER;
return __exception;
};
// 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;
while ((__n--)) {
const t_sample in1 = (*(__in1++));
t_sample mul_649 = (in1 * m_resolution_1);
t_sample ceil_648 = ceil(mul_649);
t_sample div_647 = safediv(ceil_648, m_resolution_1);
t_sample out1 = div_647;
t_sample add_644 = (mul_649 + 0.5);
t_sample floor_645 = floor(add_644);
t_sample sub_643 = (floor_645 - 0.5);
t_sample div_646 = safediv(sub_643, m_resolution_1);
t_sample out2 = div_646;
// assign results to output buffer;
(*(__out1++)) = out1;
(*(__out2++)) = out2;
@@ -78,18 +80,18 @@ typedef struct State {
return __exception;
};
inline void set_resolution(double _value) {
m_resolution_1 = (_value < 1 ? 1 : (_value > 16 ? 16 : _value));
inline void set_resolution(t_param _value) {
m_resolution_1 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
} State;


///
///
/// Configuration for the genlib API
///

/// Number of signal inputs and outputs
/// Number of signal inputs and outputs

int gen_kernel_numins = 1;
int gen_kernel_numouts = 2;
@@ -98,29 +100,29 @@ int num_inputs() { return gen_kernel_numins; }
int num_outputs() { return gen_kernel_numouts; }
int num_params() { return 1; }

/// Assistive lables for the signal inputs and outputs
/// Assistive lables for the signal inputs and outputs

const char * gen_kernel_innames[] = { "in1" };
const char * gen_kernel_outnames[] = { "out1", "out2" };
const char *gen_kernel_innames[] = { "in1" };
const char *gen_kernel_outnames[] = { "out1", "out2" };

/// Invoke the signal process of a State object

int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n) {
State * self = (State *)cself;
int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n) {
State* self = (State *)cself;
return self->perform(ins, outs, n);
}

/// Reset all parameters and stateful operators of a State object

void reset(CommonState *cself) {
State * self = (State *)cself;
self->reset(cself->sr, cself->vs);
void reset(CommonState *cself) {
State* self = (State *)cself;
self->reset(cself->sr, cself->vs);
}

/// Set a parameter of a State object
/// Set a parameter of a State object

void setparameter(CommonState *cself, long index, double value, void *ref) {
State * self = (State *)cself;
void setparameter(CommonState *cself, long index, t_param value, void *ref) {
State *self = (State *)cself;
switch (index) {
case 0: self->set_resolution(value); break;
@@ -128,9 +130,9 @@ void setparameter(CommonState *cself, long index, double value, void *ref) {
}
}

/// Get the value of a parameter of a State object
/// 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;
@@ -139,9 +141,72 @@ void getparameter(CommonState *cself, long index, double *value) {
}
}

/// Get the name of a parameter of a State object

const char *getparametername(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].name;
}
return 0;
}

/// Get the minimum value of a parameter of a State object

t_param getparametermin(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].outputmin;
}
return 0;
}

/// Get the maximum value of a parameter of a State object

t_param getparametermax(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].outputmax;
}
return 0;
}

/// Get parameter of a State object has a minimum and maximum value

char getparameterhasminmax(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].hasminmax;
}
return 0;
}

/// Get the units of a parameter of a State object

const char *getparameterunits(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].units;
}
return 0;
}

/// Get the size of the state of all parameters of a State object

size_t getstatesize(CommonState *cself) {
return genlib_getstatesize(cself, &getparameter);
}

/// Get the state of all parameters of a State object

short getstate(CommonState *cself, char *state) {
return genlib_getstate(cself, state, &getparameter);
}

/// set the state of all parameters of a State object

short setstate(CommonState *cself, const char *state) {
return genlib_setstate(cself, state, &setparameter);
}

/// 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;
@@ -160,24 +225,24 @@ void * create(double sr, long vs) {
pi->defaultvalue = self->m_resolution_1;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 1;
pi->outputmax = 16;
pi->outputmin = 0;
pi->outputmax = 1;
pi->exp = 0;
pi->units = "bits"; // no units defined
pi->units = ""; // no units defined
return self;
}

/// Release all resources and memory used by a State object:

void destroy(CommonState *cself) {
State * self = (State *)cself;
void destroy(CommonState *cself) {
State *self = (State *)cself;
genlib_sysmem_freeptr(cself->params);
delete self;
delete self;
}




+ 31
- 19
plugins/bitcrush/gen_exported.h View File

@@ -1,20 +1,24 @@
/*******************************************************************************************************************
Copyright (c) 2012 Cycling '74

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Cycling '74 License for Max-Generated Code for Export
Copyright (c) 2016 Cycling '74
The code that Max generates automatically and that end users are capable of exporting and using, and any
associated documentation files (the “Software”) is a work of authorship for which Cycling '74 is the author
and owner for copyright purposes. A license is hereby granted, free of charge, to any person obtaining a
copy of the Software (“Licensee”) to use, copy, modify, merge, publish, and distribute copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The Software is licensed to Licensee only for non-commercial use. Users who wish to make commercial use of the
Software must contact the copyright owner to determine if a license for commercial use is available, and the
terms and conditions for same, which may include fees or royalties. For commercial use, please send inquiries
to licensing (at) cycling74.com. The determination of whether a use is commercial use or non-commercial use is based
upon the use, not the user. The Software may be used by individuals, institutions, governments, corporations, or
other business whether for-profit or non-profit so long as the use itself is not a commercialization of the
materials or a use that generates or is intended to generate income, revenue, sales or profit.
The above copyright notice and this license shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*******************************************************************************************************************/


@@ -29,9 +33,17 @@ 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);
const char *getparametername(CommonState *cself, long index);
t_param getparametermin(CommonState *cself, long index);
t_param getparametermax(CommonState *cself, long index);
char getparameterhasminmax(CommonState *cself, long index);
const char *getparameterunits(CommonState *cself, long index);
size_t getstatesize(CommonState *cself);
short getstate(CommonState *cself, char *state);
short setstate(CommonState *cself, const char *state);
void *create(t_param sr, long vs);
void destroy(CommonState *cself);

} // gen_exported::

+ 162
- 79
plugins/bitcrush/gen~.bitcrush.maxpat View File

@@ -2,10 +2,11 @@
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 6,
"minor" : 1,
"revision" : 0,
"architecture" : "x64"
"major" : 7,
"minor" : 3,
"revision" : 1,
"architecture" : "x86",
"modernui" : 1
}
,
"rect" : [ 227.0, 271.0, 872.0, 406.0 ],
@@ -14,20 +15,41 @@
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridonopen" : 1,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"gridsnaponopen" : 1,
"objectsnaponopen" : 1,
"statusbarvisible" : 2,
"toolbarvisible" : 1,
"lefttoolbarpinned" : 0,
"toptoolbarpinned" : 0,
"righttoolbarpinned" : 0,
"bottomtoolbarpinned" : 0,
"toolbars_unpinned_last_save" : 0,
"tallnewobj" : 0,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"description" : "",
"digest" : "",
"tags" : "",
"style" : "",
"subpatcher_template" : "",
"boxes" : [ {
"box" : {
"id" : "obj-19",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 93.0, 153.0, 70.0, 22.0 ],
"style" : "",
"text" : "exportcode"
}

}
, {
"box" : {
"channels" : 1,
"fontsize" : 13.0,
@@ -43,13 +65,13 @@
"saved_attribute_attributes" : {
"valueof" : {
"parameter_longname" : "live.gain~[1]",
"parameter_unitstyle" : 4,
"parameter_mmax" : 6.0,
"parameter_mmin" : -70.0,
"parameter_initial" : [ -70 ],
"parameter_shortname" : "live.gain~",
"parameter_type" : 0,
"parameter_mmin" : -70.0,
"parameter_mmax" : 6.0,
"parameter_initial_enable" : 1,
"parameter_shortname" : "live.gain~"
"parameter_initial" : [ -70 ],
"parameter_unitstyle" : 4
}

}
@@ -62,15 +84,14 @@
, {
"box" : {
"bgcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
"border" : 1.75,
"bordercolor" : [ 0.501961, 0.501961, 0.501961, 1.0 ],
"id" : "obj-12",
"local" : 1,
"maxclass" : "ezdac~",
"numinlets" : 2,
"numoutlets" : 0,
"patching_rect" : [ 533.0, 318.5, 44.0, 44.0 ],
"prototypename" : "helpfile"
"prototypename" : "helpfile",
"style" : ""
}

}
@@ -86,32 +107,42 @@
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 6,
"minor" : 1,
"revision" : 0,
"architecture" : "x64"
"major" : 7,
"minor" : 3,
"revision" : 1,
"architecture" : "x86",
"modernui" : 1
}
,
"rect" : [ 309.0, 189.0, 399.0, 327.0 ],
"bgcolor" : [ 0.9, 0.9, 0.9, 1.0 ],
"editing_bgcolor" : [ 0.9, 0.9, 0.9, 1.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridonopen" : 1,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"gridsnaponopen" : 1,
"objectsnaponopen" : 1,
"statusbarvisible" : 2,
"toolbarvisible" : 1,
"lefttoolbarpinned" : 0,
"toptoolbarpinned" : 0,
"righttoolbarpinned" : 0,
"bottomtoolbarpinned" : 0,
"toolbars_unpinned_last_save" : 0,
"tallnewobj" : 0,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"description" : "",
"digest" : "",
"tags" : "",
"style" : "",
"subpatcher_template" : "",
"boxes" : [ {
"box" : {
"fontname" : "Arial",
@@ -121,7 +152,8 @@
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 65.0, 94.0, 24.0, 20.0 ],
"patching_rect" : [ 65.0, 94.0, 24.0, 22.0 ],
"style" : "",
"text" : "f 1"
}

@@ -135,7 +167,8 @@
"numinlets" : 3,
"numoutlets" : 3,
"outlettype" : [ "", "", "" ],
"patching_rect" : [ 65.0, 127.0, 51.0, 20.0 ],
"patching_rect" : [ 65.0, 127.0, 51.0, 22.0 ],
"style" : "",
"text" : "counter"
}

@@ -149,7 +182,8 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 31.25, 196.0, 36.0, 20.0 ],
"patching_rect" : [ 31.25, 196.0, 36.0, 22.0 ],
"style" : "",
"text" : "latch"
}

@@ -163,7 +197,8 @@
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 97.0, 94.0, 213.0, 20.0 ],
"patching_rect" : [ 97.0, 94.0, 213.0, 22.0 ],
"style" : "",
"text" : "in 2 @comment \"downsample factor\""
}

@@ -172,12 +207,12 @@
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"frgb" : 0.0,
"id" : "obj-20",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 75.0, 196.0, 101.0, 20.0 ],
"style" : "",
"text" : "sample & hold"
}

@@ -191,7 +226,8 @@
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 31.25, 12.0, 127.0, 20.0 ],
"patching_rect" : [ 31.25, 12.0, 127.0, 22.0 ],
"style" : "",
"text" : "in 1 @comment input"
}

@@ -204,7 +240,8 @@
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 31.25, 234.0, 38.0, 20.0 ],
"patching_rect" : [ 31.25, 234.0, 38.0, 22.0 ],
"style" : "",
"text" : "out 1"
}

@@ -258,7 +295,8 @@
]
}
,
"patching_rect" : [ 533.0, 201.0, 38.0, 20.0 ],
"patching_rect" : [ 533.0, 201.0, 38.0, 22.0 ],
"style" : "",
"text" : "gen~"
}

@@ -267,12 +305,12 @@
"box" : {
"fontname" : "Arial Bold Italic",
"fontsize" : 18.0,
"frgb" : 0.0,
"id" : "obj-14",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 533.0, 15.0, 226.0, 27.0 ],
"style" : "",
"text" : "Like downsamp~"
}

@@ -281,12 +319,12 @@
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"frgb" : 0.0,
"id" : "obj-15",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 728.0, 120.0, 83.0, 20.0 ],
"style" : "",
"text" : "n samples"
}

@@ -300,7 +338,8 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 533.0, 149.0, 70.0, 20.0 ],
"patching_rect" : [ 533.0, 149.0, 70.0, 22.0 ],
"style" : "",
"text" : "cycle~ 440"
}

@@ -309,13 +348,15 @@
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"format" : 6,
"id" : "obj-18",
"maxclass" : "flonum",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "float", "bang" ],
"outlettype" : [ "", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 728.0, 150.0, 63.0, 20.0 ]
"patching_rect" : [ 728.0, 150.0, 63.0, 22.0 ],
"style" : ""
}

}
@@ -333,13 +374,13 @@
"saved_attribute_attributes" : {
"valueof" : {
"parameter_longname" : "live.gain~",
"parameter_unitstyle" : 4,
"parameter_mmax" : 6.0,
"parameter_mmin" : -70.0,
"parameter_initial" : [ -70 ],
"parameter_shortname" : "live.gain~",
"parameter_type" : 0,
"parameter_mmin" : -70.0,
"parameter_mmax" : 6.0,
"parameter_initial_enable" : 1,
"parameter_shortname" : "live.gain~"
"parameter_initial" : [ -70 ],
"parameter_unitstyle" : 4
}

}
@@ -352,15 +393,14 @@
, {
"box" : {
"bgcolor" : [ 1.0, 1.0, 1.0, 1.0 ],
"border" : 1.75,
"bordercolor" : [ 0.501961, 0.501961, 0.501961, 1.0 ],
"id" : "obj-8",
"local" : 1,
"maxclass" : "ezdac~",
"numinlets" : 2,
"numoutlets" : 0,
"patching_rect" : [ 31.0, 325.0, 44.0, 44.0 ],
"prototypename" : "helpfile"
"prototypename" : "helpfile",
"style" : ""
}

}
@@ -368,12 +408,12 @@
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"frgb" : 0.0,
"id" : "obj-5",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 211.0, 149.0, 150.0, 20.0 ],
"style" : "",
"text" : "stereo crush!!"
}

@@ -382,12 +422,12 @@
"box" : {
"fontname" : "Arial Bold Italic",
"fontsize" : 18.0,
"frgb" : 0.0,
"id" : "obj-9",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 15.0, 15.0, 463.0, 27.0 ],
"style" : "",
"text" : "Crushing by reducing sample resolution"
}

@@ -396,13 +436,15 @@
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"format" : 6,
"id" : "obj-11",
"maxclass" : "flonum",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "float", "bang" ],
"outlettype" : [ "", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 31.0, 74.0, 50.0, 20.0 ]
"patching_rect" : [ 31.0, 74.0, 50.0, 22.0 ],
"style" : ""
}

}
@@ -415,7 +457,8 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "signal" ],
"patching_rect" : [ 31.0, 104.0, 62.0, 20.0 ],
"patching_rect" : [ 31.0, 104.0, 62.0, 22.0 ],
"style" : "",
"text" : "cycle~ 40"
}

@@ -426,7 +469,8 @@
"maxclass" : "scope~",
"numinlets" : 2,
"numoutlets" : 0,
"patching_rect" : [ 86.0, 195.5, 321.0, 103.0 ]
"patching_rect" : [ 86.0, 195.5, 321.0, 103.0 ],
"style" : ""
}

}
@@ -434,13 +478,15 @@
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"format" : 6,
"id" : "obj-6",
"maxclass" : "flonum",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "float", "bang" ],
"outlettype" : [ "", "bang" ],
"parameter_enable" : 0,
"patching_rect" : [ 166.0, 74.0, 63.0, 20.0 ]
"patching_rect" : [ 166.0, 74.0, 63.0, 22.0 ],
"style" : ""
}

}
@@ -453,7 +499,8 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 166.0, 104.0, 79.0, 18.0 ],
"patching_rect" : [ 166.0, 104.0, 79.0, 22.0 ],
"style" : "",
"text" : "resolution $1"
}

@@ -470,42 +517,52 @@
"patcher" : {
"fileversion" : 1,
"appversion" : {
"major" : 6,
"minor" : 1,
"revision" : 0,
"architecture" : "x64"
"major" : 7,
"minor" : 3,
"revision" : 1,
"architecture" : "x86",
"modernui" : 1
}
,
"rect" : [ 25.0, 69.0, 455.0, 400.0 ],
"rect" : [ 34.0, 79.0, 455.0, 400.0 ],
"bgcolor" : [ 0.9, 0.9, 0.9, 1.0 ],
"editing_bgcolor" : [ 0.9, 0.9, 0.9, 1.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridonopen" : 1,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"gridsnaponopen" : 1,
"objectsnaponopen" : 1,
"statusbarvisible" : 2,
"toolbarvisible" : 1,
"lefttoolbarpinned" : 0,
"toptoolbarpinned" : 0,
"righttoolbarpinned" : 0,
"bottomtoolbarpinned" : 0,
"toolbars_unpinned_last_save" : 0,
"tallnewobj" : 0,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"description" : "",
"digest" : "",
"tags" : "",
"style" : "",
"subpatcher_template" : "",
"boxes" : [ {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"frgb" : 0.0,
"id" : "obj-10",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 16.0, 15.0, 325.0, 20.0 ],
"style" : "",
"text" : "This isn't the only way to reduce sample resolution..."
}

@@ -514,12 +571,12 @@
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"frgb" : 0.0,
"id" : "obj-9",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 31.0, 285.0, 75.0, 20.0 ],
"style" : "",
"text" : "scale down"
}

@@ -528,12 +585,12 @@
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"frgb" : 0.0,
"id" : "obj-8",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 31.0, 195.0, 75.0, 20.0 ],
"style" : "",
"text" : "quantize"
}

@@ -542,12 +599,12 @@
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"frgb" : 0.0,
"id" : "obj-7",
"maxclass" : "comment",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 31.0, 105.0, 75.0, 20.0 ],
"style" : "",
"text" : "scale up"
}

@@ -561,7 +618,8 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 181.0, 225.0, 35.0, 20.0 ],
"patching_rect" : [ 181.0, 225.0, 35.0, 22.0 ],
"style" : "",
"text" : "- 0.5"
}

@@ -575,7 +633,8 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 181.0, 165.0, 38.0, 20.0 ],
"patching_rect" : [ 181.0, 165.0, 38.0, 22.0 ],
"style" : "",
"text" : "+ 0.5"
}

@@ -589,7 +648,8 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 181.0, 195.0, 34.0, 20.0 ],
"patching_rect" : [ 181.0, 195.0, 34.0, 22.0 ],
"style" : "",
"text" : "floor"
}

@@ -603,7 +663,8 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 181.0, 285.0, 32.5, 20.0 ],
"patching_rect" : [ 181.0, 285.0, 32.5, 22.0 ],
"style" : "",
"text" : "/"
}

@@ -616,7 +677,8 @@
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 181.0, 315.0, 37.0, 20.0 ],
"patching_rect" : [ 181.0, 315.0, 37.0, 22.0 ],
"style" : "",
"text" : "out 2"
}

@@ -631,7 +693,8 @@
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 286.0, 60.0, 111.0, 20.0 ],
"patching_rect" : [ 286.0, 60.0, 111.0, 22.0 ],
"style" : "",
"text" : "param resolution 6"
}

@@ -645,7 +708,8 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 121.0, 285.0, 32.5, 20.0 ],
"patching_rect" : [ 121.0, 285.0, 32.5, 22.0 ],
"style" : "",
"text" : "/"
}

@@ -659,7 +723,8 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 121.0, 195.0, 32.5, 20.0 ],
"patching_rect" : [ 121.0, 195.0, 32.5, 22.0 ],
"style" : "",
"text" : "ceil"
}

@@ -673,7 +738,8 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 121.0, 105.0, 32.5, 20.0 ],
"patching_rect" : [ 121.0, 105.0, 32.5, 22.0 ],
"style" : "",
"text" : "*"
}

@@ -686,7 +752,8 @@
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 121.0, 315.0, 37.0, 20.0 ],
"patching_rect" : [ 121.0, 315.0, 37.0, 22.0 ],
"style" : "",
"text" : "out 1"
}

@@ -700,7 +767,8 @@
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 121.0, 75.0, 32.5, 20.0 ],
"patching_rect" : [ 121.0, 75.0, 32.5, 22.0 ],
"style" : "",
"text" : "in 1"
}

@@ -821,7 +889,12 @@
]
}
,
"patching_rect" : [ 31.0, 149.0, 38.0, 20.0 ],
"patching_rect" : [ 31.0, 149.0, 38.0, 22.0 ],
"saved_object_attributes" : {
"exportfolder" : "Obst:/Users/jeremydb/Desktop/C74_tests/genexport2/"
}
,
"style" : "",
"text" : "gen~"
}

@@ -898,6 +971,15 @@
"source" : [ "obj-18", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-1", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-19", 0 ]
}

}
, {
"patchline" : {
@@ -956,11 +1038,12 @@
}
],
"parameters" : {
"obj-7" : [ "live.gain~", "live.gain~", 0 ],
"obj-2" : [ "live.gain~[1]", "live.gain~", 0 ]
"obj-2" : [ "live.gain~[1]", "live.gain~", 0 ],
"obj-7" : [ "live.gain~", "live.gain~", 0 ]
}
,
"dependency_cache" : [ ]
"dependency_cache" : [ ],
"autosave" : 0
}

}

+ 1
- 1
plugins/common/DistrhoPluginMaxGen.cpp View File

@@ -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.0;
gen::getparameter(fGenState, index, &value);
return value;
}


+ 296
- 231
plugins/freeverb/gen_exported.cpp View File

@@ -2,34 +2,36 @@

namespace gen_exported {


/*******************************************************************************************************************
Copyright (c) 2012 Cycling '74

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Cycling '74 License for Max-Generated Code for Export
Copyright (c) 2016 Cycling '74
The code that Max generates automatically and that end users are capable of exporting and using, and any
associated documentation files (the “Software”) is a work of authorship for which Cycling '74 is the author
and owner for copyright purposes. A license is hereby granted, free of charge, to any person obtaining a
copy of the Software (“Licensee”) to use, copy, modify, merge, publish, and distribute copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The Software is licensed to Licensee only for non-commercial use. Users who wish to make commercial use of the
Software must contact the copyright owner to determine if a license for commercial use is available, and the
terms and conditions for same, which may include fees or royalties. For commercial use, please send inquiries
to licensing (at) cycling74.com. The determination of whether a use is commercial use or non-commercial use is based
upon the use, not the user. The Software may be used by individuals, institutions, governments, corporations, or
other business whether for-profit or non-profit so long as the use itself is not a commercialization of the
materials or a use that generates or is intended to generate income, revenue, sales or profit.
The above copyright notice and this license shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*******************************************************************************************************************/


// global noise generator
Noise noise;
static const int GENLIB_LOOPCOUNT_BAIL = 100000;


// The State struct contains all the state and procedures for the gendsp kernel
typedef struct State {
typedef struct State {
CommonState __commonstate;
Delay m_delay_24;
Delay m_delay_15;
@@ -43,30 +45,30 @@ 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;
int vectorsize;
int __exception;
t_sample m_fb_1;
t_sample m_history_20;
t_sample samplerate;
t_sample m_history_18;
t_sample m_spread_2;
t_sample m_history_16;
t_sample m_damp_3;
t_sample m_history_10;
t_sample m_history_8;
t_sample m_history_12;
t_sample m_history_14;
t_sample m_fb_4;
t_sample m_history_6;
// re-initialize all member variables;
inline void reset(double __sr, int __vs) {
inline void reset(t_param __sr, int __vs) {
__exception = 0;
vectorsize = __vs;
samplerate = __sr;
m_fb_1 = 0.5;
m_damp_2 = 0.5;
m_fb_3 = 0.9;
m_spread_4 = 0;
m_spread_2 = 0;
m_damp_3 = 0.5;
m_fb_4 = 0.9;
m_delay_5.reset("m_delay_5", 2000);
m_history_6 = 0;
m_delay_7.reset("m_delay_7", 2000);
@@ -88,156 +90,156 @@ typedef struct State {
m_delay_23.reset("m_delay_23", 2000);
m_delay_24.reset("m_delay_24", 2000);
genlib_reset_complete(this);
};
// the signal processing routine;
inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) {
inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) {
vectorsize = __n;
const t_sample * __in1 = __ins[0];
t_sample * __out1 = __outs[0];
if (__exception) {
if (__exception) {
return __exception;
} else if (( (__in1 == 0) || (__out1 == 0) )) {
} else if (( (__in1 == 0) || (__out1 == 0) )) {
__exception = GENLIB_ERR_NULL_BUFFER;
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_408 = (m_fb_1 * 0.5);
t_sample add_394 = (225 + m_spread_2);
t_sample add_396 = (341 + m_spread_2);
t_sample add_406 = (441 + m_spread_2);
t_sample add_392 = (556 + m_spread_2);
t_sample damp_378 = m_damp_3;
t_sample damp_377 = damp_378;
t_sample damp_376 = damp_378;
t_sample damp_379 = damp_378;
t_sample damp_380 = damp_378;
t_sample damp_381 = damp_378;
t_sample damp_382 = damp_378;
t_sample damp_383 = damp_378;
t_sample add_399 = (1557 + m_spread_2);
t_sample rsub_345 = (1 - damp_377);
t_sample add_398 = (1617 + m_spread_2);
t_sample rsub_525 = (1 - damp_376);
t_sample add_400 = (1491 + m_spread_2);
t_sample rsub_537 = (1 - damp_378);
t_sample add_401 = (1422 + m_spread_2);
t_sample rsub_549 = (1 - damp_379);
t_sample add_402 = (1356 + m_spread_2);
t_sample rsub_561 = (1 - damp_380);
t_sample add_403 = (1277 + m_spread_2);
t_sample rsub_573 = (1 - damp_381);
t_sample add_404 = (1188 + m_spread_2);
t_sample rsub_585 = (1 - damp_382);
t_sample add_405 = (1116 + m_spread_2);
t_sample rsub_597 = (1 - damp_383);
// 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;
m_delay_5.write(add_303);
m_delay_24.write(add_556);
m_delay_23.write(add_550);
m_delay_22.write(add_544);
m_delay_21.write(add_280);
m_history_20 = history_297_next_533;
m_delay_19.write(add_534);
m_history_18 = history_297_next_522;
m_delay_17.write(add_527);
m_history_16 = history_297_next_509;
m_delay_15.write(add_514);
m_history_14 = history_297_next_497;
m_delay_13.write(add_503);
m_history_12 = history_297_next_485;
m_delay_11.write(add_490);
m_history_10 = history_297_next_475;
m_delay_9.write(add_477);
m_history_8 = history_297_next_461;
m_delay_7.write(add_463);
m_history_6 = history_297_next_304;
while ((__n--)) {
const t_sample in1 = (*(__in1++));
t_sample mul_419 = (in1 * 0.015);
t_sample tap_352 = m_delay_5.read_linear(add_399);
t_sample gen_390 = tap_352;
t_sample mul_350 = (tap_352 * damp_377);
t_sample mul_348 = (m_history_6 * rsub_345);
t_sample add_349 = (mul_350 + mul_348);
t_sample mul_346 = (add_349 * m_fb_4);
t_sample add_353 = (mul_419 + mul_346);
t_sample history_347_next_354 = fixdenorm(add_349);
t_sample tap_533 = m_delay_7.read_linear(add_398);
t_sample gen_418 = tap_533;
t_sample mul_528 = (tap_533 * damp_376);
t_sample mul_530 = (m_history_8 * rsub_525);
t_sample add_527 = (mul_528 + mul_530);
t_sample mul_529 = (add_527 * m_fb_4);
t_sample add_532 = (mul_419 + mul_529);
t_sample history_347_next_531 = fixdenorm(add_527);
t_sample tap_545 = m_delay_9.read_linear(add_400);
t_sample gen_389 = tap_545;
t_sample mul_540 = (tap_545 * damp_378);
t_sample mul_542 = (m_history_10 * rsub_537);
t_sample add_539 = (mul_540 + mul_542);
t_sample mul_541 = (add_539 * m_fb_4);
t_sample add_544 = (mul_419 + mul_541);
t_sample history_347_next_543 = fixdenorm(add_539);
t_sample tap_558 = m_delay_11.read_linear(add_401);
t_sample gen_388 = tap_558;
t_sample mul_556 = (tap_558 * damp_379);
t_sample mul_557 = (m_history_12 * rsub_549);
t_sample add_554 = (mul_556 + mul_557);
t_sample mul_551 = (add_554 * m_fb_4);
t_sample add_555 = (mul_419 + mul_551);
t_sample history_347_next_552 = fixdenorm(add_554);
t_sample tap_568 = m_delay_13.read_linear(add_402);
t_sample gen_387 = tap_568;
t_sample mul_567 = (tap_568 * damp_380);
t_sample mul_569 = (m_history_14 * rsub_561);
t_sample add_565 = (mul_567 + mul_569);
t_sample mul_563 = (add_565 * m_fb_4);
t_sample add_566 = (mul_419 + mul_563);
t_sample history_347_next_570 = fixdenorm(add_565);
t_sample tap_581 = m_delay_15.read_linear(add_403);
t_sample gen_386 = tap_581;
t_sample mul_580 = (tap_581 * damp_381);
t_sample mul_582 = (m_history_16 * rsub_573);
t_sample add_578 = (mul_580 + mul_582);
t_sample mul_575 = (add_578 * m_fb_4);
t_sample add_579 = (mul_419 + mul_575);
t_sample history_347_next_576 = fixdenorm(add_578);
t_sample tap_594 = m_delay_17.read_linear(add_404);
t_sample gen_385 = tap_594;
t_sample mul_591 = (tap_594 * damp_382);
t_sample mul_592 = (m_history_18 * rsub_585);
t_sample add_589 = (mul_591 + mul_592);
t_sample mul_587 = (add_589 * m_fb_4);
t_sample add_590 = (mul_419 + mul_587);
t_sample history_347_next_593 = fixdenorm(add_589);
t_sample tap_605 = m_delay_19.read_linear(add_405);
t_sample gen_384 = tap_605;
t_sample mul_604 = (tap_605 * damp_383);
t_sample mul_606 = (m_history_20 * rsub_597);
t_sample add_602 = (mul_604 + mul_606);
t_sample mul_599 = (add_602 * m_fb_4);
t_sample add_603 = (mul_419 + mul_599);
t_sample history_347_next_600 = fixdenorm(add_602);
t_sample add_407 = ((((((((gen_384 + gen_385) + gen_386) + gen_387) + gen_388) + gen_389) + gen_418) + gen_390) + 0);
t_sample tap_343 = m_delay_21.read_linear(add_392);
t_sample sub_339 = (add_407 - tap_343);
t_sample mul_341 = (tap_343 * mul_408);
t_sample add_340 = (add_407 + mul_341);
t_sample tap_612 = m_delay_22.read_linear(add_406);
t_sample sub_611 = (sub_339 - tap_612);
t_sample mul_609 = (tap_612 * mul_408);
t_sample add_610 = (sub_339 + mul_609);
t_sample tap_618 = m_delay_23.read_linear(add_396);
t_sample sub_617 = (sub_611 - tap_618);
t_sample mul_615 = (tap_618 * mul_408);
t_sample add_616 = (sub_611 + mul_615);
t_sample tap_624 = m_delay_24.read_linear(add_394);
t_sample sub_623 = (sub_617 - tap_624);
t_sample mul_621 = (tap_624 * mul_408);
t_sample add_622 = (sub_617 + mul_621);
t_sample out1 = sub_623;
m_delay_5.write(add_353);
m_delay_24.write(add_622);
m_delay_23.write(add_616);
m_delay_22.write(add_610);
m_delay_21.write(add_340);
m_history_20 = history_347_next_600;
m_delay_19.write(add_603);
m_history_18 = history_347_next_593;
m_delay_17.write(add_590);
m_history_16 = history_347_next_576;
m_delay_15.write(add_579);
m_history_14 = history_347_next_570;
m_delay_13.write(add_566);
m_history_12 = history_347_next_552;
m_delay_11.write(add_555);
m_history_10 = history_347_next_543;
m_delay_9.write(add_544);
m_history_8 = history_347_next_531;
m_delay_7.write(add_532);
m_history_6 = history_347_next_354;
m_delay_5.step();
m_delay_7.step();
m_delay_9.step();
@@ -252,32 +254,32 @@ typedef struct State {
m_delay_24.step();
// assign results to output buffer;
(*(__out1++)) = out1;
};
return __exception;
};
inline void set_fb2(double _value) {
inline void set_fb2(t_param _value) {
m_fb_1 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
inline void set_damp(double _value) {
m_damp_2 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
inline void set_spread(t_param _value) {
m_spread_2 = (_value < 0 ? 0 : (_value > 400 ? 400 : _value));
};
inline void set_fb1(double _value) {
m_fb_3 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
inline void set_damp(t_param _value) {
m_damp_3 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
inline void set_spread(double _value) {
m_spread_4 = (_value < 0 ? 0 : (_value > 400 ? 400 : _value));
inline void set_fb1(t_param _value) {
m_fb_4 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
} State;


///
///
/// Configuration for the genlib API
///

/// Number of signal inputs and outputs
/// Number of signal inputs and outputs

int gen_kernel_numins = 1;
int gen_kernel_numouts = 1;
@@ -286,56 +288,119 @@ int num_inputs() { return gen_kernel_numins; }
int num_outputs() { return gen_kernel_numouts; }
int num_params() { return 4; }

/// Assistive lables for the signal inputs and outputs
/// Assistive lables for the signal inputs and outputs

const char * gen_kernel_innames[] = { "in1" };
const char * gen_kernel_outnames[] = { "out1" };
const char *gen_kernel_innames[] = { "in1" };
const char *gen_kernel_outnames[] = { "out1" };

/// Invoke the signal process of a State object

int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n) {
State * self = (State *)cself;
int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n) {
State* self = (State *)cself;
return self->perform(ins, outs, n);
}

/// Reset all parameters and stateful operators of a State object

void reset(CommonState *cself) {
State * self = (State *)cself;
self->reset(cself->sr, cself->vs);
void reset(CommonState *cself) {
State* self = (State *)cself;
self->reset(cself->sr, cself->vs);
}

/// Set a parameter of a State object
/// Set a parameter of a State object

void setparameter(CommonState *cself, long index, double value, void *ref) {
State * self = (State *)cself;
void setparameter(CommonState *cself, long index, t_param value, void *ref) {
State *self = (State *)cself;
switch (index) {
case 0: self->set_fb2(value); break;
case 1: self->set_damp(value); break;
case 2: self->set_fb1(value); break;
case 0: self->set_damp(value); break;
case 1: self->set_fb1(value); break;
case 2: self->set_fb2(value); break;
case 3: self->set_spread(value); break;
default: break;
}
}

/// Get the value of a parameter of a State object
/// 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;
case 1: *value = self->m_damp_2; break;
case 2: *value = self->m_fb_3; break;
case 3: *value = self->m_spread_4; break;
case 0: *value = self->m_damp_3; break;
case 1: *value = self->m_fb_4; break;
case 2: *value = self->m_fb_1; break;
case 3: *value = self->m_spread_2; break;
default: break;
}
}

/// Get the name of a parameter of a State object

const char *getparametername(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].name;
}
return 0;
}

/// Get the minimum value of a parameter of a State object

t_param getparametermin(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].outputmin;
}
return 0;
}

/// Get the maximum value of a parameter of a State object

t_param getparametermax(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].outputmax;
}
return 0;
}

/// Get parameter of a State object has a minimum and maximum value

char getparameterhasminmax(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].hasminmax;
}
return 0;
}

/// Get the units of a parameter of a State object

const char *getparameterunits(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].units;
}
return 0;
}

/// Get the size of the state of all parameters of a State object

size_t getstatesize(CommonState *cself) {
return genlib_getstatesize(cself, &getparameter);
}

/// Get the state of all parameters of a State object

short getstate(CommonState *cself, char *state) {
return genlib_getstate(cself, state, &getparameter);
}

/// set the state of all parameters of a State object

short setstate(CommonState *cself, const char *state) {
return genlib_setstate(cself, state, &setparameter);
}

/// 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;
@@ -347,73 +412,73 @@ void * create(double sr, long vs) {
self->__commonstate.vs = vs;
self->__commonstate.params = (ParamInfo *)genlib_sysmem_newptr(4 * sizeof(ParamInfo));
self->__commonstate.numparams = 4;
// initialize parameter 0 ("m_fb_1")
// initialize parameter 0 ("m_damp_3")
pi = self->__commonstate.params + 0;
pi->name = "fb2";
pi->name = "damp";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_fb_1;
pi->defaultvalue = self->m_damp_3;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 1;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 1 ("m_damp_2")
// initialize parameter 1 ("m_fb_4")
pi = self->__commonstate.params + 1;
pi->name = "damp";
pi->name = "fb1";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_damp_2;
pi->defaultvalue = self->m_fb_4;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 1;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 2 ("m_fb_3")
// initialize parameter 2 ("m_fb_1")
pi = self->__commonstate.params + 2;
pi->name = "fb1";
pi->name = "fb2";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_fb_3;
pi->defaultvalue = self->m_fb_1;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 1;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 3 ("m_spread_4")
// initialize parameter 3 ("m_spread_2")
pi = self->__commonstate.params + 3;
pi->name = "spread";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_spread_4;
pi->defaultvalue = self->m_spread_2;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 400;
pi->exp = 0;
pi->units = ""; // no units defined
return self;
}

/// Release all resources and memory used by a State object:

void destroy(CommonState *cself) {
State * self = (State *)cself;
void destroy(CommonState *cself) {
State *self = (State *)cself;
genlib_sysmem_freeptr(cself->params);
delete self;
delete self;
}




+ 31
- 19
plugins/freeverb/gen_exported.h View File

@@ -1,20 +1,24 @@
/*******************************************************************************************************************
Copyright (c) 2012 Cycling '74

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Cycling '74 License for Max-Generated Code for Export
Copyright (c) 2016 Cycling '74
The code that Max generates automatically and that end users are capable of exporting and using, and any
associated documentation files (the “Software”) is a work of authorship for which Cycling '74 is the author
and owner for copyright purposes. A license is hereby granted, free of charge, to any person obtaining a
copy of the Software (“Licensee”) to use, copy, modify, merge, publish, and distribute copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The Software is licensed to Licensee only for non-commercial use. Users who wish to make commercial use of the
Software must contact the copyright owner to determine if a license for commercial use is available, and the
terms and conditions for same, which may include fees or royalties. For commercial use, please send inquiries
to licensing (at) cycling74.com. The determination of whether a use is commercial use or non-commercial use is based
upon the use, not the user. The Software may be used by individuals, institutions, governments, corporations, or
other business whether for-profit or non-profit so long as the use itself is not a commercialization of the
materials or a use that generates or is intended to generate income, revenue, sales or profit.
The above copyright notice and this license shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*******************************************************************************************************************/


@@ -29,9 +33,17 @@ 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);
const char *getparametername(CommonState *cself, long index);
t_param getparametermin(CommonState *cself, long index);
t_param getparametermax(CommonState *cself, long index);
char getparameterhasminmax(CommonState *cself, long index);
const char *getparameterunits(CommonState *cself, long index);
size_t getstatesize(CommonState *cself);
short getstate(CommonState *cself, char *state);
short setstate(CommonState *cself, const char *state);
void *create(t_param sr, long vs);
void destroy(CommonState *cself);

} // gen_exported::

+ 383
- 318
plugins/gigaverb/gen_exported.cpp View File

@@ -2,65 +2,67 @@

namespace gen_exported {


/*******************************************************************************************************************
Copyright (c) 2012 Cycling '74

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Cycling '74 License for Max-Generated Code for Export
Copyright (c) 2016 Cycling '74
The code that Max generates automatically and that end users are capable of exporting and using, and any
associated documentation files (the “Software”) is a work of authorship for which Cycling '74 is the author
and owner for copyright purposes. A license is hereby granted, free of charge, to any person obtaining a
copy of the Software (“Licensee”) to use, copy, modify, merge, publish, and distribute copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The Software is licensed to Licensee only for non-commercial use. Users who wish to make commercial use of the
Software must contact the copyright owner to determine if a license for commercial use is available, and the
terms and conditions for same, which may include fees or royalties. For commercial use, please send inquiries
to licensing (at) cycling74.com. The determination of whether a use is commercial use or non-commercial use is based
upon the use, not the user. The Software may be used by individuals, institutions, governments, corporations, or
other business whether for-profit or non-profit so long as the use itself is not a commercialization of the
materials or a use that generates or is intended to generate income, revenue, sales or profit.
The above copyright notice and this license shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*******************************************************************************************************************/


// global noise generator
Noise noise;
static const int GENLIB_LOOPCOUNT_BAIL = 100000;


// The State struct contains all the state and procedures for the gendsp kernel
typedef struct State {
typedef struct State {
CommonState __commonstate;
Delay m_delay_11;
Delay m_delay_9;
Delay m_delay_8;
Delay m_delay_7;
Delay m_delay_10;
Delay m_delay_12;
Delay m_delay_16;
Delay m_delay_13;
Delay m_delay_14;
Delay m_delay_6;
Delay m_delay_7;
Delay m_delay_8;
Delay m_delay_13;
Delay m_delay_15;
Delay m_delay_14;
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;
int vectorsize;
Delay m_delay_16;
Delay m_delay_9;
int __exception;
int vectorsize;
t_sample m_roomsize_20;
t_sample m_revtime_19;
t_sample m_damping_24;
t_sample m_dry_21;
t_sample m_bandwidth_23;
t_sample m_tail_22;
t_sample m_history_5;
t_sample m_early_18;
t_sample m_history_1;
t_sample m_history_4;
t_sample samplerate;
t_sample m_history_3;
t_sample m_history_2;
t_sample m_spread_25;
// re-initialize all member variables;
inline void reset(double __sr, int __vs) {
inline void reset(t_param __sr, int __vs) {
__exception = 0;
vectorsize = __vs;
samplerate = __sr;
@@ -69,215 +71,215 @@ typedef struct State {
m_history_3 = 0;
m_history_4 = 0;
m_history_5 = 0;
m_delay_6.reset("m_delay_6", 5000);
m_delay_7.reset("m_delay_7", 7000);
m_delay_8.reset("m_delay_8", 15000);
m_delay_6.reset("m_delay_6", 7000);
m_delay_7.reset("m_delay_7", 5000);
m_delay_8.reset("m_delay_8", 16000);
m_delay_9.reset("m_delay_9", 6000);
m_delay_10.reset("m_delay_10", 16000);
m_delay_11.reset("m_delay_11", 48000);
m_delay_12.reset("m_delay_12", 10000);
m_delay_13.reset("m_delay_13", 12000);
m_delay_10.reset("m_delay_10", 15000);
m_delay_11.reset("m_delay_11", 12000);
m_delay_12.reset("m_delay_12", 48000);
m_delay_13.reset("m_delay_13", 10000);
m_delay_14.reset("m_delay_14", 48000);
m_delay_15.reset("m_delay_15", 48000);
m_delay_16.reset("m_delay_16", 48000);
m_delay_17.reset("m_delay_17", 48000);
m_damping_18 = 0.7;
m_early_18 = 0.25;
m_revtime_19 = 11;
m_roomsize_20 = 75;
m_spread_21 = 23;
m_bandwidth_22 = 0.5;
m_tail_23 = 0.25;
m_dry_24 = 1;
m_early_25 = 0.25;
m_dry_21 = 1;
m_tail_22 = 0.25;
m_bandwidth_23 = 0.5;
m_damping_24 = 0.7;
m_spread_25 = 23;
genlib_reset_complete(this);
};
// the signal processing routine;
inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) {
inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) {
vectorsize = __n;
const t_sample * __in1 = __ins[0];
const t_sample * __in2 = __ins[1];
t_sample * __out1 = __outs[0];
t_sample * __out2 = __outs[1];
if (__exception) {
if (__exception) {
return __exception;
} else if (( (__in1 == 0) || (__in2 == 0) || (__out1 == 0) || (__out2 == 0) )) {
} else if (( (__in1 == 0) || (__in2 == 0) || (__out1 == 0) || (__out2 == 0) )) {
__exception = GENLIB_ERR_NULL_BUFFER;
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);
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 expr_317 = ((m_roomsize_20 * samplerate) * 0.0029411764705882);
t_sample expr_316 = safepow(0.001, safediv(1, (m_revtime_19 * samplerate)));
t_sample add_221 = (expr_317 + 5);
t_sample expr_311 = safepow(expr_316, add_221);
t_sample mul_298 = (expr_317 * 1);
t_sample expr_315 = (-safepow(expr_316, mul_298));
t_sample mul_297 = (expr_317 * 0.81649);
t_sample expr_310 = (-safepow(expr_316, mul_297));
t_sample mul_295 = (expr_317 * 0.63245);
t_sample expr_308 = (-safepow(expr_316, mul_295));
t_sample mul_296 = (expr_317 * 0.7071);
t_sample expr_309 = (-safepow(expr_316, mul_296));
t_sample mul_227 = (expr_317 * 0.41);
t_sample add_224 = (mul_227 + 5);
t_sample expr_314 = safepow(expr_316, add_224);
t_sample mul_226 = (expr_317 * 0.3);
t_sample add_223 = (mul_226 + 5);
t_sample expr_313 = safepow(expr_316, add_223);
t_sample mul_225 = (expr_317 * 0.155);
t_sample add_222 = (mul_225 + 5);
t_sample expr_312 = safepow(expr_316, add_222);
t_sample rsub_306 = (1 - m_bandwidth_23);
t_sample mul_292 = (expr_317 * 0.000527);
int int_291 = int(mul_292);
t_sample mul_260 = (m_spread_25 * 0.376623);
t_sample add_259 = (mul_260 + 931);
t_sample rsub_256 = (1341 - add_259);
t_sample mul_267 = (int_291 * rsub_256);
t_sample mul_232 = (m_spread_25 * (-0.380445));
t_sample add_231 = (mul_232 + 931);
t_sample rsub_228 = (1341 - add_231);
t_sample mul_241 = (int_291 * rsub_228);
t_sample mul_276 = (m_spread_25 * 0.125541);
t_sample add_258 = (mul_276 + 369);
t_sample rsub_257 = (add_259 - add_258);
t_sample mul_274 = (int_291 * rsub_257);
t_sample mul_290 = (expr_317 * 0.110732);
t_sample mul_234 = (m_spread_25 * (-0.568366));
t_sample add_230 = (mul_234 + 369);
t_sample rsub_229 = (add_231 - add_230);
t_sample mul_248 = (int_291 * rsub_229);
t_sample add_275 = (mul_276 + 159);
t_sample mul_283 = (int_291 * add_275);
t_sample add_233 = (mul_234 + 159);
t_sample mul_255 = (int_291 * add_233);
// 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;
m_delay_17.write(add_879);
m_delay_16.write(add_881);
m_delay_15.write(add_880);
m_delay_14.write(add_882);
m_delay_13.write(sub_930);
m_delay_12.write(sub_956);
m_delay_11.write(add_977);
m_delay_10.write(sub_937);
m_delay_9.write(sub_979);
m_delay_8.write(sub_963);
m_delay_7.write(sub_944);
m_delay_6.write(sub_972);
m_history_5 = history_997_next_1065;
m_history_4 = history_885_next_1066;
m_history_3 = history_897_next_1067;
m_history_2 = history_891_next_1068;
m_history_1 = history_993_next_1069;
while ((__n--)) {
const t_sample in1 = (*(__in1++));
const t_sample in2 = (*(__in2++));
t_sample mul_165 = (in1 * m_dry_21);
t_sample mul_153 = (in2 * m_dry_21);
t_sample mul_155 = ((in1 + in2) * 0.707);
t_sample mix_323 = (mul_155 + (rsub_306 * (m_history_5 - mul_155)));
t_sample mix_305 = mix_323;
t_sample tap_201 = m_delay_17.read_linear(mul_296);
t_sample mul_197 = (tap_201 * expr_309);
t_sample mix_324 = (mul_197 + (m_damping_24 * (m_history_4 - mul_197)));
t_sample mix_199 = mix_324;
t_sample tap_207 = m_delay_16.read_linear(mul_297);
t_sample mul_203 = (tap_207 * expr_310);
t_sample mix_325 = (mul_203 + (m_damping_24 * (m_history_3 - mul_203)));
t_sample mix_205 = mix_325;
t_sample tap_303 = m_delay_15.read_linear(mul_298);
t_sample mul_294 = (tap_303 * expr_315);
t_sample mix_326 = (mul_294 + (m_damping_24 * (m_history_2 - mul_294)));
t_sample mix_301 = mix_326;
t_sample tap_195 = m_delay_14.read_linear(mul_295);
t_sample mul_191 = (tap_195 * expr_308);
t_sample mix_327 = (mul_191 + (m_damping_24 * (m_history_1 - mul_191)));
t_sample mix_193 = mix_327;
t_sample tap_266 = m_delay_13.read_linear(mul_267);
t_sample mul_264 = (tap_266 * 0.625);
t_sample tap_209 = m_delay_12.read_linear(add_224);
t_sample tap_210 = m_delay_12.read_linear(add_223);
t_sample tap_211 = m_delay_12.read_linear(add_222);
t_sample tap_212 = m_delay_12.read_linear(add_221);
t_sample mul_215 = (tap_211 * expr_312);
t_sample mul_217 = (tap_210 * expr_313);
t_sample mul_219 = (tap_209 * expr_314);
t_sample mul_213 = (tap_212 * expr_311);
t_sample tap_240 = m_delay_11.read_linear(mul_241);
t_sample mul_238 = (tap_240 * 0.625);
t_sample sub_184 = (mix_301 - mix_205);
t_sample sub_181 = (mix_199 - mix_193);
t_sample sub_180 = (sub_184 - sub_181);
t_sample mul_163 = (sub_180 * 0.5);
t_sample add_188 = (mul_163 + mul_217);
t_sample add_179 = (sub_184 + sub_181);
t_sample rsub_177 = (0 - add_179);
t_sample mul_162 = (rsub_177 * 0.5);
t_sample add_187 = (mul_162 + mul_215);
t_sample add_185 = (mix_301 + mix_205);
t_sample add_183 = (mix_199 + mix_193);
t_sample sub_182 = (add_185 - add_183);
t_sample mul_164 = (sub_182 * 0.5);
t_sample add_189 = (mul_164 + mul_219);
t_sample add_178 = (add_185 + add_183);
t_sample mul_161 = (add_178 * 0.5);
t_sample add_186 = (mul_161 + mul_213);
t_sample tap_273 = m_delay_10.read_linear(mul_274);
t_sample mul_271 = (tap_273 * 0.625);
t_sample tap_289 = m_delay_9.read_linear(mul_290);
t_sample tap_247 = m_delay_8.read_linear(mul_248);
t_sample mul_245 = (tap_247 * 0.625);
t_sample tap_282 = m_delay_7.read_linear(mul_283);
t_sample mul_280 = (tap_282 * 0.75);
t_sample mul_287 = (tap_289 * 0.75);
t_sample sub_286 = (mix_305 - mul_287);
t_sample mul_285 = (sub_286 * 0.75);
t_sample add_284 = (mul_285 + tap_289);
t_sample tap_254 = m_delay_6.read_linear(mul_255);
t_sample mul_252 = (tap_254 * 0.75);
t_sample mul_176 = (mul_164 * m_tail_22);
t_sample mul_174 = (mul_162 * m_tail_22);
t_sample add_160 = (mul_176 + mul_174);
t_sample mul_175 = (mul_163 * m_tail_22);
t_sample mul_173 = (mul_161 * m_tail_22);
t_sample add_159 = (mul_175 + mul_173);
t_sample sub_168 = (add_160 - add_159);
t_sample mul_172 = (mul_219 * m_early_18);
t_sample mul_170 = (mul_215 * m_early_18);
t_sample add_158 = (mul_172 + mul_170);
t_sample mul_171 = (mul_217 * m_early_18);
t_sample mul_169 = (mul_213 * m_early_18);
t_sample add_157 = (mul_171 + mul_169);
t_sample sub_167 = (add_158 - add_157);
t_sample add_154 = (sub_168 + sub_167);
t_sample add_166 = (add_154 + in1);
t_sample sub_279 = (add_166 - mul_280);
t_sample mul_278 = (sub_279 * 0.75);
t_sample add_277 = (mul_278 + tap_282);
t_sample sub_270 = (add_277 - mul_271);
t_sample mul_269 = (sub_270 * 0.625);
t_sample add_268 = (mul_269 + tap_273);
t_sample sub_263 = (add_268 - mul_264);
t_sample mul_262 = (sub_263 * 0.625);
t_sample add_261 = (mul_262 + tap_266);
t_sample out1 = (mul_165 + add_261);
t_sample add_156 = (add_154 + in2);
t_sample sub_251 = (add_156 - mul_252);
t_sample mul_250 = (sub_251 * 0.75);
t_sample add_249 = (mul_250 + tap_254);
t_sample sub_244 = (add_249 - mul_245);
t_sample mul_243 = (sub_244 * 0.625);
t_sample add_242 = (mul_243 + tap_247);
t_sample sub_237 = (add_242 - mul_238);
t_sample mul_236 = (sub_237 * 0.625);
t_sample add_235 = (mul_236 + tap_240);
t_sample out2 = (mul_153 + add_235);
t_sample history_304_next_318 = fixdenorm(mix_305);
t_sample history_198_next_319 = fixdenorm(mix_199);
t_sample history_204_next_320 = fixdenorm(mix_205);
t_sample history_300_next_321 = fixdenorm(mix_301);
t_sample history_192_next_322 = fixdenorm(mix_193);
m_delay_17.write(add_187);
m_delay_16.write(add_188);
m_delay_15.write(add_189);
m_delay_14.write(add_186);
m_delay_13.write(sub_263);
m_delay_12.write(add_284);
m_delay_11.write(sub_237);
m_delay_10.write(sub_270);
m_delay_9.write(sub_286);
m_delay_8.write(sub_244);
m_delay_7.write(sub_279);
m_delay_6.write(sub_251);
m_history_5 = history_304_next_318;
m_history_4 = history_198_next_319;
m_history_3 = history_204_next_320;
m_history_2 = history_300_next_321;
m_history_1 = history_192_next_322;
m_delay_6.step();
m_delay_7.step();
m_delay_8.step();
@@ -298,39 +300,39 @@ typedef struct State {
return __exception;
};
inline void set_damping(double _value) {
m_damping_18 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
inline void set_early(t_param _value) {
m_early_18 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
inline void set_revtime(double _value) {
inline void set_revtime(t_param _value) {
m_revtime_19 = (_value < 0.1 ? 0.1 : (_value > 360 ? 360 : _value));
};
inline void set_roomsize(double _value) {
inline void set_roomsize(t_param _value) {
m_roomsize_20 = (_value < 0.1 ? 0.1 : (_value > 300 ? 300 : _value));
};
inline void set_spread(double _value) {
m_spread_21 = (_value < 0 ? 0 : (_value > 100 ? 100 : _value));
inline void set_dry(t_param _value) {
m_dry_21 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
inline void set_bandwidth(double _value) {
m_bandwidth_22 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
inline void set_tail(t_param _value) {
m_tail_22 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
inline void set_tail(double _value) {
m_tail_23 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
inline void set_bandwidth(t_param _value) {
m_bandwidth_23 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
inline void set_dry(double _value) {
m_dry_24 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
inline void set_damping(t_param _value) {
m_damping_24 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
inline void set_early(double _value) {
m_early_25 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
inline void set_spread(t_param _value) {
m_spread_25 = (_value < 0 ? 0 : (_value > 100 ? 100 : _value));
};
} State;


///
///
/// Configuration for the genlib API
///

/// Number of signal inputs and outputs
/// Number of signal inputs and outputs

int gen_kernel_numins = 2;
int gen_kernel_numouts = 2;
@@ -339,64 +341,127 @@ int num_inputs() { return gen_kernel_numins; }
int num_outputs() { return gen_kernel_numouts; }
int num_params() { return 8; }

/// Assistive lables for the signal inputs and outputs
/// Assistive lables for the signal inputs and outputs

const char * gen_kernel_innames[] = { "in1", "in2" };
const char * gen_kernel_outnames[] = { "out1", "out2" };
const char *gen_kernel_innames[] = { "in1", "in2" };
const char *gen_kernel_outnames[] = { "out1", "out2" };

/// Invoke the signal process of a State object

int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n) {
State * self = (State *)cself;
int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n) {
State* self = (State *)cself;
return self->perform(ins, outs, n);
}

/// Reset all parameters and stateful operators of a State object

void reset(CommonState *cself) {
State * self = (State *)cself;
self->reset(cself->sr, cself->vs);
void reset(CommonState *cself) {
State* self = (State *)cself;
self->reset(cself->sr, cself->vs);
}

/// Set a parameter of a State object
/// Set a parameter of a State object

void setparameter(CommonState *cself, long index, double value, void *ref) {
State * self = (State *)cself;
void setparameter(CommonState *cself, long index, t_param value, void *ref) {
State *self = (State *)cself;
switch (index) {
case 0: self->set_damping(value); break;
case 1: self->set_revtime(value); break;
case 2: self->set_roomsize(value); break;
case 3: self->set_spread(value); break;
case 4: self->set_bandwidth(value); break;
case 5: self->set_tail(value); break;
case 6: self->set_dry(value); break;
case 7: self->set_early(value); break;
case 0: self->set_bandwidth(value); break;
case 1: self->set_damping(value); break;
case 2: self->set_dry(value); break;
case 3: self->set_early(value); break;
case 4: self->set_revtime(value); break;
case 5: self->set_roomsize(value); break;
case 6: self->set_spread(value); break;
case 7: self->set_tail(value); break;
default: break;
}
}

/// Get the value of a parameter of a State object
/// 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;
case 1: *value = self->m_revtime_19; break;
case 2: *value = self->m_roomsize_20; break;
case 3: *value = self->m_spread_21; break;
case 4: *value = self->m_bandwidth_22; break;
case 5: *value = self->m_tail_23; break;
case 6: *value = self->m_dry_24; break;
case 7: *value = self->m_early_25; break;
case 0: *value = self->m_bandwidth_23; break;
case 1: *value = self->m_damping_24; break;
case 2: *value = self->m_dry_21; break;
case 3: *value = self->m_early_18; break;
case 4: *value = self->m_revtime_19; break;
case 5: *value = self->m_roomsize_20; break;
case 6: *value = self->m_spread_25; break;
case 7: *value = self->m_tail_22; break;
default: break;
}
}

/// Get the name of a parameter of a State object

const char *getparametername(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].name;
}
return 0;
}

/// Get the minimum value of a parameter of a State object

t_param getparametermin(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].outputmin;
}
return 0;
}

/// Get the maximum value of a parameter of a State object

t_param getparametermax(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].outputmax;
}
return 0;
}

/// Get parameter of a State object has a minimum and maximum value

char getparameterhasminmax(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].hasminmax;
}
return 0;
}

/// Get the units of a parameter of a State object

const char *getparameterunits(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].units;
}
return 0;
}

/// Get the size of the state of all parameters of a State object

size_t getstatesize(CommonState *cself) {
return genlib_getstatesize(cself, &getparameter);
}

/// Get the state of all parameters of a State object

short getstate(CommonState *cself, char *state) {
return genlib_getstate(cself, state, &getparameter);
}

/// set the state of all parameters of a State object

short setstate(CommonState *cself, const char *state) {
return genlib_setstate(cself, state, &setparameter);
}

/// 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;
@@ -408,112 +473,112 @@ void * create(double sr, long vs) {
self->__commonstate.vs = vs;
self->__commonstate.params = (ParamInfo *)genlib_sysmem_newptr(8 * sizeof(ParamInfo));
self->__commonstate.numparams = 8;
// initialize parameter 0 ("m_damping_18")
// initialize parameter 0 ("m_bandwidth_23")
pi = self->__commonstate.params + 0;
pi->name = "damping";
pi->name = "bandwidth";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_damping_18;
pi->defaultvalue = self->m_bandwidth_23;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 1;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 1 ("m_revtime_19")
// initialize parameter 1 ("m_damping_24")
pi = self->__commonstate.params + 1;
pi->name = "revtime";
pi->name = "damping";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_revtime_19;
pi->defaultvalue = self->m_damping_24;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0.1;
pi->outputmax = 360;
pi->outputmin = 0;
pi->outputmax = 1;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 2 ("m_roomsize_20")
// initialize parameter 2 ("m_dry_21")
pi = self->__commonstate.params + 2;
pi->name = "roomsize";
pi->name = "dry";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_roomsize_20;
pi->defaultvalue = self->m_dry_21;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0.1;
pi->outputmax = 300;
pi->outputmin = 0;
pi->outputmax = 1;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 3 ("m_spread_21")
// initialize parameter 3 ("m_early_18")
pi = self->__commonstate.params + 3;
pi->name = "spread";
pi->name = "early";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_spread_21;
pi->defaultvalue = self->m_early_18;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 100;
pi->outputmax = 1;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 4 ("m_bandwidth_22")
// initialize parameter 4 ("m_revtime_19")
pi = self->__commonstate.params + 4;
pi->name = "bandwidth";
pi->name = "revtime";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_bandwidth_22;
pi->defaultvalue = self->m_revtime_19;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 1;
pi->outputmin = 0.1;
pi->outputmax = 360;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 5 ("m_tail_23")
// initialize parameter 5 ("m_roomsize_20")
pi = self->__commonstate.params + 5;
pi->name = "tail";
pi->name = "roomsize";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_tail_23;
pi->defaultvalue = self->m_roomsize_20;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 1;
pi->outputmin = 0.1;
pi->outputmax = 300;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 6 ("m_dry_24")
// initialize parameter 6 ("m_spread_25")
pi = self->__commonstate.params + 6;
pi->name = "dry";
pi->name = "spread";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_dry_24;
pi->defaultvalue = self->m_spread_25;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 1;
pi->outputmax = 100;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 7 ("m_early_25")
// initialize parameter 7 ("m_tail_22")
pi = self->__commonstate.params + 7;
pi->name = "early";
pi->name = "tail";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_early_25;
pi->defaultvalue = self->m_tail_22;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
@@ -526,11 +591,11 @@ void * create(double sr, long vs) {

/// Release all resources and memory used by a State object:

void destroy(CommonState *cself) {
State * self = (State *)cself;
void destroy(CommonState *cself) {
State *self = (State *)cself;
genlib_sysmem_freeptr(cself->params);
delete self;
delete self;
}




+ 31
- 19
plugins/gigaverb/gen_exported.h View File

@@ -1,20 +1,24 @@
/*******************************************************************************************************************
Copyright (c) 2012 Cycling '74

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Cycling '74 License for Max-Generated Code for Export
Copyright (c) 2016 Cycling '74
The code that Max generates automatically and that end users are capable of exporting and using, and any
associated documentation files (the “Software”) is a work of authorship for which Cycling '74 is the author
and owner for copyright purposes. A license is hereby granted, free of charge, to any person obtaining a
copy of the Software (“Licensee”) to use, copy, modify, merge, publish, and distribute copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The Software is licensed to Licensee only for non-commercial use. Users who wish to make commercial use of the
Software must contact the copyright owner to determine if a license for commercial use is available, and the
terms and conditions for same, which may include fees or royalties. For commercial use, please send inquiries
to licensing (at) cycling74.com. The determination of whether a use is commercial use or non-commercial use is based
upon the use, not the user. The Software may be used by individuals, institutions, governments, corporations, or
other business whether for-profit or non-profit so long as the use itself is not a commercialization of the
materials or a use that generates or is intended to generate income, revenue, sales or profit.
The above copyright notice and this license shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*******************************************************************************************************************/


@@ -29,9 +33,17 @@ 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);
const char *getparametername(CommonState *cself, long index);
t_param getparametermin(CommonState *cself, long index);
t_param getparametermax(CommonState *cself, long index);
char getparameterhasminmax(CommonState *cself, long index);
const char *getparameterunits(CommonState *cself, long index);
size_t getstatesize(CommonState *cself);
short getstate(CommonState *cself, char *state);
short setstate(CommonState *cself, const char *state);
void *create(t_param sr, long vs);
void destroy(CommonState *cself);

} // gen_exported::

+ 251
- 186
plugins/pitchshift/gen_exported.cpp View File

@@ -2,63 +2,65 @@

namespace gen_exported {


/*******************************************************************************************************************
Copyright (c) 2012 Cycling '74

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Cycling '74 License for Max-Generated Code for Export
Copyright (c) 2016 Cycling '74
The code that Max generates automatically and that end users are capable of exporting and using, and any
associated documentation files (the “Software”) is a work of authorship for which Cycling '74 is the author
and owner for copyright purposes. A license is hereby granted, free of charge, to any person obtaining a
copy of the Software (“Licensee”) to use, copy, modify, merge, publish, and distribute copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The Software is licensed to Licensee only for non-commercial use. Users who wish to make commercial use of the
Software must contact the copyright owner to determine if a license for commercial use is available, and the
terms and conditions for same, which may include fees or royalties. For commercial use, please send inquiries
to licensing (at) cycling74.com. The determination of whether a use is commercial use or non-commercial use is based
upon the use, not the user. The Software may be used by individuals, institutions, governments, corporations, or
other business whether for-profit or non-profit so long as the use itself is not a commercialization of the
materials or a use that generates or is intended to generate income, revenue, sales or profit.
The above copyright notice and this license shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*******************************************************************************************************************/


// global noise generator
Noise noise;
static const int GENLIB_LOOPCOUNT_BAIL = 100000;


// The State struct contains all the state and procedures for the gendsp kernel
typedef struct State {
typedef struct State {
CommonState __commonstate;
Delay m_delay_5;
Delta m_delta_14;
Delta m_delta_11;
Delta m_delta_20;
Delta m_delta_17;
Phasor m_phasor_10;
Sah m_sah_13;
Sah m_sah_12;
Sah m_sah_15;
Sah m_sah_16;
Sah m_sah_21;
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;
int vectorsize;
Delta __m_delta_14;
Delta __m_delta_11;
Delta __m_delta_20;
Delta __m_delta_17;
Phasor __m_phasor_10;
Sah __m_sah_13;
Sah __m_sah_12;
Sah __m_sah_15;
Sah __m_sah_16;
Sah __m_sah_21;
Sah __m_sah_19;
Sah __m_sah_18;
Sah __m_sah_22;
int __exception;
int vectorsize;
t_sample m_window_8;
t_sample m_history_1;
t_sample samplerate;
t_sample m_xfade_9;
t_sample m_history_2;
t_sample m_history_4;
t_sample m_history_3;
t_sample m_ratio_7;
t_sample m_blur_6;
t_sample samples_to_seconds;
// re-initialize all member variables;
inline void reset(double __sr, int __vs) {
inline void reset(t_param __sr, int __vs) {
__exception = 0;
vectorsize = __vs;
samplerate = __sr;
@@ -68,124 +70,124 @@ typedef struct State {
m_history_4 = 0;
m_delay_5.reset("m_delay_5", 88200);
m_blur_6 = 0;
m_window_7 = 100;
m_ratio_8 = 1;
m_ratio_7 = 0;
m_window_8 = 100;
m_xfade_9 = 1;
samples_to_seconds = (1 / samplerate);
m_phasor_10.reset(0);
m_delta_11.reset(0);
m_sah_12.reset(0);
m_sah_13.reset(0);
m_delta_14.reset(0);
m_sah_15.reset(0);
m_sah_16.reset(0);
m_delta_17.reset(0);
m_sah_18.reset(0);
m_sah_19.reset(0);
m_delta_20.reset(0);
m_sah_21.reset(0);
m_sah_22.reset(0);
__m_phasor_10.reset(0);
__m_delta_11.reset(0);
__m_sah_12.reset(0);
__m_sah_13.reset(0);
__m_delta_14.reset(0);
__m_sah_15.reset(0);
__m_sah_16.reset(0);
__m_delta_17.reset(0);
__m_sah_18.reset(0);
__m_sah_19.reset(0);
__m_delta_20.reset(0);
__m_sah_21.reset(0);
__m_sah_22.reset(0);
genlib_reset_complete(this);
};
// the signal processing routine;
inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) {
inline int perform(t_sample ** __ins, t_sample ** __outs, int __n) {
vectorsize = __n;
const t_sample * __in1 = __ins[0];
t_sample * __out1 = __outs[0];
t_sample * __out2 = __outs[1];
if (__exception) {
if (__exception) {
return __exception;
} else if (( (__in1 == 0) || (__out1 == 0) || (__out2 == 0) )) {
} else if (( (__in1 == 0) || (__out1 == 0) || (__out2 == 0) )) {
__exception = GENLIB_ERR_NULL_BUFFER;
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_138 = (m_window_8 * (samplerate * 0.001));
t_sample rsub_124 = (1 - m_ratio_7);
t_sample mul_123 = (rsub_124 * 1000);
t_sample div_122 = safediv(mul_123, m_window_8);
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;
while ((__n--)) {
const t_sample in1 = (*(__in1++));
t_sample noise_76 = noise();
t_sample abs_94 = fabs(noise_76);
t_sample mul_104 = (abs_94 * m_blur_6);
t_sample noise_74 = noise();
t_sample abs_92 = fabs(noise_74);
t_sample mul_98 = (abs_92 * m_blur_6);
t_sample noise_75 = noise();
t_sample abs_93 = fabs(noise_75);
t_sample mul_101 = (abs_93 * m_blur_6);
t_sample noise_73 = noise();
t_sample abs_91 = fabs(noise_73);
t_sample mul_95 = (abs_91 * m_blur_6);
t_sample phasor_144 = __m_phasor_10(div_122, samples_to_seconds);
t_sample add_143 = ((m_history_4 + phasor_144) + 0);
t_sample mod_142 = safemod(add_143, 1);
t_sample delta_84 = __m_delta_11(mod_142);
t_sample sah_83 = __m_sah_12(mul_104, delta_84, 0);
t_sample sah_105 = __m_sah_13(mstosamps_138, delta_84, 0);
t_sample mul_90 = (sah_105 * mod_142);
t_sample sub_141 = (mod_142 - 0.5);
t_sample mul_140 = (sub_141 * 3.1415926535898);
t_sample cos_139 = cos(mul_140);
t_sample mul_109 = (cos_139 * cos_139);
t_sample add_121 = ((m_history_3 + phasor_144) + 0.5);
t_sample mod_120 = safemod(add_121, 1);
t_sample delta_100 = __m_delta_14(mod_120);
t_sample sah_79 = __m_sah_15(mul_98, delta_100, 0);
t_sample sah_99 = __m_sah_16(mstosamps_138, delta_100, 0);
t_sample mul_88 = (sah_99 * mod_120);
t_sample sub_119 = (mod_120 - 0.5);
t_sample mul_118 = (sub_119 * 3.1415926535898);
t_sample cos_117 = cos(mul_118);
t_sample mul_107 = (cos_117 * cos_117);
t_sample add_137 = ((m_history_2 + phasor_144) + 0.25);
t_sample mod_136 = safemod(add_137, 1);
t_sample delta_103 = __m_delta_17(mod_136);
t_sample sah_81 = __m_sah_18(mul_101, delta_103, 0);
t_sample sah_102 = __m_sah_19(mstosamps_138, delta_103, 0);
t_sample mul_89 = (sah_102 * mod_136);
t_sample sub_135 = (mod_136 - 0.5);
t_sample mul_134 = (sub_135 * 3.1415926535898);
t_sample cos_133 = cos(mul_134);
t_sample mul_108 = (cos_133 * cos_133);
t_sample add_115 = ((m_history_1 + phasor_144) + 0.75);
t_sample mod_114 = safemod(add_115, 1);
t_sample delta_97 = __m_delta_20(mod_114);
t_sample sah_77 = __m_sah_21(mul_95, delta_97, 0);
t_sample sah_96 = __m_sah_22(mstosamps_138, delta_97, 0);
t_sample mul_87 = (sah_96 * mod_114);
t_sample tap_129 = m_delay_5.read_linear(mul_90);
t_sample tap_130 = m_delay_5.read_linear(mul_89);
t_sample tap_131 = m_delay_5.read_linear(mul_88);
t_sample tap_132 = m_delay_5.read_linear(mul_87);
t_sample mul_126 = (tap_130 * mul_108);
t_sample mul_127 = (tap_129 * mul_109);
t_sample mul_116 = (tap_131 * mul_107);
t_sample add_150 = (mul_116 + mul_127);
t_sample mix_149 = (in1 + (m_xfade_9 * (add_150 - in1)));
t_sample out1 = mix_149;
t_sample sub_113 = (mod_114 - 0.5);
t_sample mul_112 = (sub_113 * 3.1415926535898);
t_sample cos_111 = cos(mul_112);
t_sample mul_106 = (cos_111 * cos_111);
t_sample mul_110 = (tap_132 * mul_106);
t_sample add_152 = (mul_110 + mul_126);
t_sample mix_151 = (in1 + (m_xfade_9 * (add_152 - in1)));
t_sample out2 = mix_151;
t_sample history_85_next_145 = fixdenorm(sah_83);
t_sample history_80_next_146 = fixdenorm(sah_79);
t_sample history_82_next_147 = fixdenorm(sah_81);
t_sample history_78_next_148 = fixdenorm(sah_77);
m_delay_5.write(in1);
m_history_4 = history_1165_next_1240;
m_history_3 = history_1170_next_1241;
m_history_2 = history_1167_next_1242;
m_history_1 = history_1163_next_1243;
m_history_4 = history_85_next_145;
m_history_3 = history_80_next_146;
m_history_2 = history_82_next_147;
m_history_1 = history_78_next_148;
m_delay_5.step();
// assign results to output buffer;
(*(__out1++)) = out1;
@@ -195,27 +197,27 @@ typedef struct State {
return __exception;
};
inline void set_blur(double _value) {
inline void set_blur(t_param _value) {
m_blur_6 = (_value < 0 ? 0 : (_value > 0.25 ? 0.25 : _value));
};
inline void set_window(double _value) {
m_window_7 = (_value < 0.1 ? 0.1 : (_value > 1000 ? 1000 : _value));
inline void set_ratio(t_param _value) {
m_ratio_7 = (_value < 0.25 ? 0.25 : (_value > 4 ? 4 : _value));
};
inline void set_ratio(double _value) {
m_ratio_8 = (_value < 0.25 ? 0.25 : (_value > 4 ? 4 : _value));
inline void set_window(t_param _value) {
m_window_8 = (_value < 0.1 ? 0.1 : (_value > 1000 ? 1000 : _value));
};
inline void set_xfade(double _value) {
inline void set_xfade(t_param _value) {
m_xfade_9 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value));
};
} State;


///
///
/// Configuration for the genlib API
///

/// Number of signal inputs and outputs
/// Number of signal inputs and outputs

int gen_kernel_numins = 1;
int gen_kernel_numouts = 2;
@@ -224,56 +226,119 @@ int num_inputs() { return gen_kernel_numins; }
int num_outputs() { return gen_kernel_numouts; }
int num_params() { return 4; }

/// Assistive lables for the signal inputs and outputs
/// Assistive lables for the signal inputs and outputs

const char * gen_kernel_innames[] = { "in1" };
const char * gen_kernel_outnames[] = { "out1", "out2" };
const char *gen_kernel_innames[] = { "in1" };
const char *gen_kernel_outnames[] = { "out1", "out2" };

/// Invoke the signal process of a State object

int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n) {
State * self = (State *)cself;
int perform(CommonState *cself, t_sample **ins, long numins, t_sample **outs, long numouts, long n) {
State* self = (State *)cself;
return self->perform(ins, outs, n);
}

/// Reset all parameters and stateful operators of a State object

void reset(CommonState *cself) {
State * self = (State *)cself;
self->reset(cself->sr, cself->vs);
void reset(CommonState *cself) {
State* self = (State *)cself;
self->reset(cself->sr, cself->vs);
}

/// Set a parameter of a State object
/// Set a parameter of a State object

void setparameter(CommonState *cself, long index, double value, void *ref) {
State * self = (State *)cself;
void setparameter(CommonState *cself, long index, t_param value, void *ref) {
State *self = (State *)cself;
switch (index) {
case 0: self->set_blur(value); break;
case 1: self->set_window(value); break;
case 2: self->set_ratio(value); break;
case 1: self->set_ratio(value); break;
case 2: self->set_window(value); break;
case 3: self->set_xfade(value); break;
default: break;
}
}

/// Get the value of a parameter of a State object
/// 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;
case 1: *value = self->m_window_7; break;
case 2: *value = self->m_ratio_8; break;
case 1: *value = self->m_ratio_7; break;
case 2: *value = self->m_window_8; break;
case 3: *value = self->m_xfade_9; break;
default: break;
}
}

/// Get the name of a parameter of a State object

const char *getparametername(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].name;
}
return 0;
}

/// Get the minimum value of a parameter of a State object

t_param getparametermin(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].outputmin;
}
return 0;
}

/// Get the maximum value of a parameter of a State object

t_param getparametermax(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].outputmax;
}
return 0;
}

/// Get parameter of a State object has a minimum and maximum value

char getparameterhasminmax(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].hasminmax;
}
return 0;
}

/// Get the units of a parameter of a State object

const char *getparameterunits(CommonState *cself, long index) {
if (index >= 0 && index < cself->numparams) {
return cself->params[index].units;
}
return 0;
}

/// Get the size of the state of all parameters of a State object

size_t getstatesize(CommonState *cself) {
return genlib_getstatesize(cself, &getparameter);
}

/// Get the state of all parameters of a State object

short getstate(CommonState *cself, char *state) {
return genlib_getstate(cself, state, &getparameter);
}

/// set the state of all parameters of a State object

short setstate(CommonState *cself, const char *state) {
return genlib_setstate(cself, state, &setparameter);
}

/// 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;
@@ -292,39 +357,39 @@ void * create(double sr, long vs) {
pi->defaultvalue = self->m_blur_6;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
pi->outputmax = 0.25;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 1 ("m_window_7")
// initialize parameter 1 ("m_ratio_7")
pi = self->__commonstate.params + 1;
pi->name = "window";
pi->name = "ratio";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_window_7;
pi->defaultvalue = self->m_ratio_7;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0.1;
pi->outputmax = 1000;
pi->outputmin = 0.25;
pi->outputmax = 4;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 2 ("m_ratio_8")
// initialize parameter 2 ("m_window_8")
pi = self->__commonstate.params + 2;
pi->name = "ratio";
pi->name = "window";
pi->paramtype = GENLIB_PARAMTYPE_FLOAT;
pi->defaultvalue = self->m_ratio_8;
pi->defaultvalue = self->m_window_8;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0.25;
pi->outputmax = 4;
pi->outputmin = 0.1;
pi->outputmax = 1000;
pi->exp = 0;
pi->units = ""; // no units defined
// initialize parameter 3 ("m_xfade_9")
@@ -334,7 +399,7 @@ void * create(double sr, long vs) {
pi->defaultvalue = self->m_xfade_9;
pi->defaultref = 0;
pi->hasinputminmax = false;
pi->inputmin = 0;
pi->inputmin = 0;
pi->inputmax = 1;
pi->hasminmax = true;
pi->outputmin = 0;
@@ -347,11 +412,11 @@ void * create(double sr, long vs) {

/// Release all resources and memory used by a State object:

void destroy(CommonState *cself) {
State * self = (State *)cself;
void destroy(CommonState *cself) {
State *self = (State *)cself;
genlib_sysmem_freeptr(cself->params);
delete self;
delete self;
}




+ 31
- 19
plugins/pitchshift/gen_exported.h View File

@@ -1,20 +1,24 @@
/*******************************************************************************************************************
Copyright (c) 2012 Cycling '74

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Cycling '74 License for Max-Generated Code for Export
Copyright (c) 2016 Cycling '74
The code that Max generates automatically and that end users are capable of exporting and using, and any
associated documentation files (the “Software”) is a work of authorship for which Cycling '74 is the author
and owner for copyright purposes. A license is hereby granted, free of charge, to any person obtaining a
copy of the Software (“Licensee”) to use, copy, modify, merge, publish, and distribute copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The Software is licensed to Licensee only for non-commercial use. Users who wish to make commercial use of the
Software must contact the copyright owner to determine if a license for commercial use is available, and the
terms and conditions for same, which may include fees or royalties. For commercial use, please send inquiries
to licensing (at) cycling74.com. The determination of whether a use is commercial use or non-commercial use is based
upon the use, not the user. The Software may be used by individuals, institutions, governments, corporations, or
other business whether for-profit or non-profit so long as the use itself is not a commercialization of the
materials or a use that generates or is intended to generate income, revenue, sales or profit.
The above copyright notice and this license shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*******************************************************************************************************************/


@@ -29,9 +33,17 @@ 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);
const char *getparametername(CommonState *cself, long index);
t_param getparametermin(CommonState *cself, long index);
t_param getparametermax(CommonState *cself, long index);
char getparameterhasminmax(CommonState *cself, long index);
const char *getparameterunits(CommonState *cself, long index);
size_t getstatesize(CommonState *cself);
short getstate(CommonState *cself, char *state);
short setstate(CommonState *cself, const char *state);
void *create(t_param sr, long vs);
void destroy(CommonState *cself);

} // gen_exported::

Loading…
Cancel
Save