From 58f89b0f9af18f0c60abca4ac0b31331b16bd1d3 Mon Sep 17 00:00:00 2001 From: nino de wit Date: Thu, 26 Nov 2015 14:55:39 +0100 Subject: [PATCH] Changed param min/max/defaults --- plugins/.DS_Store | Bin 6148 -> 6148 bytes plugins/shiroverb/gen_dsp/genlib.cpp | 362 +++++ plugins/shiroverb/gen_dsp/genlib.h | 152 ++ plugins/shiroverb/gen_dsp/genlib_common.h | 104 ++ plugins/shiroverb/gen_dsp/genlib_common_win.h | 43 + .../gen_dsp/genlib_exportfunctions.h | 38 + plugins/shiroverb/gen_dsp/genlib_ops.h | 1238 +++++++++++++++++ plugins/shiroverb/gen_exported.cpp | 871 ++++++------ plugins/shiroverb/gen~.shiroverb.maxpat | 307 +--- plugins/shiroverb/shiroverb.gendsp | 240 +--- 10 files changed, 2396 insertions(+), 959 deletions(-) create mode 100644 plugins/shiroverb/gen_dsp/genlib.cpp create mode 100644 plugins/shiroverb/gen_dsp/genlib.h create mode 100644 plugins/shiroverb/gen_dsp/genlib_common.h create mode 100644 plugins/shiroverb/gen_dsp/genlib_common_win.h create mode 100644 plugins/shiroverb/gen_dsp/genlib_exportfunctions.h create mode 100644 plugins/shiroverb/gen_dsp/genlib_ops.h diff --git a/plugins/.DS_Store b/plugins/.DS_Store index e0f73e584ed0fbf72c45d17d63e5c45dc5b113b4..ef7bd4da1a980ae8b4b7d16588438b70fdc69e43 100644 GIT binary patch delta 40 wcmZoMXfc@J&nU7nU^g?P$YcW+kb%7 delta 125 zcmZoMXfc@J&nU4mU^g?P#AE{&k5CL(voBbhD$|GzZpOPi<%THY9`NPRotx4>cO;`o#QV*0F3`1G5`Po diff --git a/plugins/shiroverb/gen_dsp/genlib.cpp b/plugins/shiroverb/gen_dsp/genlib.cpp new file mode 100644 index 0000000..4a926e0 --- /dev/null +++ b/plugins/shiroverb/gen_dsp/genlib.cpp @@ -0,0 +1,362 @@ +/******************************************************************************************************************* +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. +*******************************************************************************************************************/ + + +#include "genlib.h" +#include "genlib_exportfunctions.h" +#include "stdlib.h" +#include "stdio.h" +#include "string.h" +#ifndef GEN_WINDOWS + #include "malloc/malloc.h" +#endif + +// DATA_MAXIMUM_ELEMENTS * 8 bytes = 256 mb limit +#define DATA_MAXIMUM_ELEMENTS (33554432) + +//////////// export_genlib.cpp //////////// +// export version + +void my_memset(void *p, int c, long size); +void my_memcpy(void *dst, const void *src, long size); + +t_ptr sysmem_newptr(t_ptr_size size) +{ + return (t_ptr)malloc(size); +} + +t_ptr sysmem_newptrclear(t_ptr_size size) +{ + t_ptr p = (t_ptr)malloc(size); + + if (p) + my_memset(p, 0, size); + + return p; +} + +t_ptr sysmem_resizeptr(void *ptr, t_ptr_size newsize) +{ + return (t_ptr)realloc(ptr, newsize); +} + +t_ptr sysmem_resizeptrclear(void *ptr, t_ptr_size newsize) +{ + long oldsize = malloc_size(ptr); + t_ptr p = (t_ptr)realloc(ptr, newsize); + + if (p) { + if (newsize > oldsize) + my_memset((char *)p + oldsize, 0, newsize - oldsize); + } + return p; +} + +t_ptr_size sysmem_ptrsize(void *ptr) +{ + return malloc_size(ptr); +} + +void sysmem_freeptr(void *ptr) +{ + free(ptr); +} + +void sysmem_copyptr(const void *src, void *dst, t_ptr_size bytes) +{ + my_memcpy(dst, src, bytes); +} + +void my_memset(void *p, int c, long size) +{ + char *p2 = (char *)p; + int i; + + for (i = 0; i < size; i++, p2++) + *p2 = c; +} + +void my_memcpy(void *dst, const void *src, long size) +{ + char *s2 = (char *)src; + char *d2 = (char *)dst; + int i; + + for (i = 0; i < size; i++, s2++, d2++) + *d2 = *s2; +} + +void set_zero64(double *memory, long size) +{ + long i; + + for (i = 0; i < size; i++, memory++) { + *memory = 0.; + } +} + +void genlib_report_error(const char *s) +{ + fprintf(stderr, "%s\n", s); +} + +void genlib_report_message(const char *s) +{ + fprintf(stdout, "%s\n", s); +} + +unsigned long systime_ticks(void) +{ + return 0; // Gen code can deal with this +} + +// NEED THIS FOR WINDOWS: +void *operator new(size_t size) { return sysmem_newptr(size); } +void operator delete(void *p) { sysmem_freeptr(p); } +void *operator new[](size_t size) { return sysmem_newptr(size); } +void operator delete[](void *p) { sysmem_freeptr(p); } + +void * genlib_obtain_reference_from_string(const char * name) { + return 0; // to be implemented +} + +// the rest is stuff to isolate gensym, attrs, atoms, buffers etc. +t_genlib_buffer * genlib_obtain_buffer_from_reference(void *ref) +{ + return 0; // to be implemented +} + +t_genlib_err genlib_buffer_edit_begin(t_genlib_buffer *b) +{ + return 0; // to be implemented +} + +t_genlib_err genlib_buffer_edit_end(t_genlib_buffer *b, long valid) +{ + return 0; // to be implemented +} + +t_genlib_err genlib_buffer_getinfo(t_genlib_buffer *b, t_genlib_buffer_info *info) +{ + return 0; // to be implemented +} + +char *genlib_reference_getname(void *ref) +{ + return 0; // to be implemented +} + +void genlib_buffer_dirty(t_genlib_buffer *b) +{ + // to be implemented +} + +t_genlib_err genlib_buffer_perform_begin(t_genlib_buffer *b) +{ + return 0; // to be implemented +} +void genlib_buffer_perform_end(t_genlib_buffer *b) +{ + // to be implemented +} + +#ifdef pow +#undef pow +#endif +#include "math.h" + +double gen_msp_pow(double value, double power) +{ + return pow(value, power); +} + +void genlib_data_setbuffer(t_genlib_data *b, void *ref) { + genlib_report_error("not supported for export targets\n"); +} + +typedef struct { + t_genlib_data_info info; + double cursor; // used by Delay + //t_symbol * name; +} t_dsp_gen_data; + +t_genlib_data * genlib_obtain_data_from_reference(void *ref) +{ + t_dsp_gen_data * self = (t_dsp_gen_data *)malloc(sizeof(t_dsp_gen_data)); + self->info.dim = 0; + self->info.channels = 0; + self->info.data = 0; + self->cursor = 0; + return (t_genlib_data *)self; +} + +t_genlib_err genlib_data_getinfo(t_genlib_data *b, t_genlib_data_info *info) { + t_dsp_gen_data * self = (t_dsp_gen_data *)b; + info->dim = self->info.dim; + info->channels = self->info.channels; + info->data = self->info.data; + return GENLIB_ERR_NONE; +} + +void genlib_data_release(t_genlib_data *b) { + t_dsp_gen_data * self = (t_dsp_gen_data *)b; + + if (self->info.data) { + genlib_sysmem_freeptr(self->info.data); + self->info.data = 0; + } +} + +long genlib_data_getcursor(t_genlib_data *b) { + t_dsp_gen_data * self = (t_dsp_gen_data *)b; + return self->cursor; +} + +void genlib_data_setcursor(t_genlib_data *b, long cursor) { + t_dsp_gen_data * self = (t_dsp_gen_data *)b; + self->cursor = cursor; +} + +void genlib_data_resize(t_genlib_data *b, long s, long c) { + t_dsp_gen_data * self = (t_dsp_gen_data *)b; + + size_t sz, oldsz, copysz; + double * old = 0; + double * replaced = 0; + int i, j, copydim, copychannels, olddim, oldchannels; + + //printf("data resize %d %d\n", s, c); + + // cache old for copying: + old = self->info.data; + olddim = self->info.dim; + oldchannels = self->info.channels; + + // limit [data] size: + if (s * c > DATA_MAXIMUM_ELEMENTS) { + s = DATA_MAXIMUM_ELEMENTS/c; + genlib_report_message("warning: constraining [data] to < 256MB"); + } + // bytes required: + sz = sizeof(double) * s * c; + oldsz = sizeof(double) * olddim * oldchannels; + + if (old && sz == oldsz) { + // no need to re-allocate, just resize + // careful, audio thread may still be using it: + if (s > olddim) { + self->info.channels = c; + self->info.dim = s; + } else { + self->info.dim = s; + self->info.channels = c; + } + + set_zero64(self->info.data, s * c); + return; + + } else { + + // allocate new: + replaced = (double *)sysmem_newptr(sz); + + // check allocation: + if (replaced == 0) { + genlib_report_error("allocating [data]: out of memory"); + // try to reallocate with a default/minimal size instead: + if (s > 512 || c > 1) { + genlib_data_resize((t_genlib_data *)self, 512, 1); + } else { + // if this fails, then Max is kaput anyway... + genlib_data_resize((t_genlib_data *)self, 4, 1); + } + return; + } + + // fill with zeroes: + set_zero64(replaced, s * c); + + // copy in old data: + if (old) { + // frames to copy: + // clamped: + copydim = olddim > s ? s : olddim; + // use memcpy if channels haven't changed: + if (c == oldchannels) { + copysz = sizeof(double) * copydim * c; + //post("reset resize (same channels) %p %p, %d", self->info.data, old, copysz); + memcpy(replaced, old, copysz); + } else { + // memcpy won't work if channels have changed, + // because data is interleaved. + // clamp channels copied: + copychannels = oldchannels > c ? c : oldchannels; + //post("reset resize (different channels) %p %p, %d %d", self->info.data, old, copydim, copychannels); + for (i = 0; iinfo.data = replaced; + self->info.dim = s; + self->info.channels = c; + } else { + // need to be careful; the audio thread may still be using it + // since dsp_gen_data is preserved through edits + // the order of resizing has to be carefully done + // to prevent indexing out of bounds + // (or maybe I'm being too paranoid here...) + if (oldsz > sz) { + // shrink size first + if (s > olddim) { + self->info.channels = c; + self->info.dim = s; + } else { + self->info.dim = s; + self->info.channels = c; + } + self->info.data = replaced; + } else { + // shrink size after + self->info.data = replaced; + if (s > olddim) { + self->info.channels = c; + self->info.dim = s; + } else { + self->info.dim = s; + self->info.channels = c; + } + } + + // done with old: + sysmem_freeptr(old); + + } + + } +} + +void genlib_reset_complete(void *data) {} + + diff --git a/plugins/shiroverb/gen_dsp/genlib.h b/plugins/shiroverb/gen_dsp/genlib.h new file mode 100644 index 0000000..dae1a5d --- /dev/null +++ b/plugins/shiroverb/gen_dsp/genlib.h @@ -0,0 +1,152 @@ +/******************************************************************************************************************* +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. +*******************************************************************************************************************/ + + +#ifndef GENLIB_H +#define GENLIB_H 1 + +#include "genlib_common.h" + +//////////// genlib.h //////////// +// genlib.h -- max (gen~) version + +#ifndef GEN_WINDOWS +#ifndef _SIZE_T +#define _SIZE_T +typedef __typeof__(sizeof(int)) size_t; +#endif +#endif + +#ifndef __INT32_TYPE__ +#define __INT32_TYPE__ int +#endif + +#ifdef MSP_ON_CLANG + // gen~ hosted: + typedef unsigned __INT32_TYPE__ uint32_t; + typedef unsigned __INT64_TYPE__ uint64_t; +#else + #ifdef __GNUC__ + #include + #endif +#endif + +#define inf (__DBL_MAX__) +#define GEN_UINT_MAX (4294967295) +#define TWO_TO_32 (4294967296.0) + +#define C74_CONST const + +// max_types.h: +#ifdef C74_X64 + typedef unsigned long long t_ptr_uint; + typedef long long t_ptr_int; + typedef double t_atom_float; + typedef t_ptr_uint t_getbytes_size; +#else + typedef unsigned long t_ptr_uint; + typedef long t_ptr_int; + typedef float t_atom_float; + typedef short t_getbytes_size; +#endif + +typedef uint32_t t_uint32; +typedef t_ptr_int t_atom_long; // the type that is an A_LONG in an atom + +typedef t_ptr_int t_int; ///< an integer @ingroup misc +typedef t_ptr_uint t_ptr_size; ///< unsigned pointer-sized value for counting (like size_t) @ingroup misc +typedef t_ptr_int t_atom_long; ///< the type that is an A_LONG in a #t_atom @ingroup misc +typedef t_atom_long t_max_err; ///< an integer value suitable to be returned as an error code @ingroup misc + +extern "C" { + + // TODO: remove (for debugging only) + //int printf(const char * fmt, ...); + + // math.h: + extern double acos( double ); + extern double asin( double ); + extern double atan( double ); + extern double atan2( double, double ); + extern double cos( double ); + extern double sin( double ); + extern double tan( double ); + extern double acosh( double ); + extern double asinh( double ); + extern double atanh( double ); + extern double cosh( double ); + extern double sinh( double ); + extern double tanh( double ); + extern double exp ( double ); + extern double log ( double ); + extern double log10 ( double ); + extern double fmod ( double, double ); + extern double modf(double, double *); + extern double fabs( double ); + extern double hypot ( double, double ); + //extern double pow ( double, double ); + extern double gen_msp_pow ( double, double ); + #define pow gen_msp_pow + extern double sqrt( double ); + extern double ceil ( double ); + extern double floor ( double ); + extern double round ( double ); + extern int abs(int); + + extern char *strcpy(char *, const char *); + + // string reference handling: + void * genlib_obtain_reference_from_string(const char * name); + char *genlib_reference_getname(void *ref); + + // buffer handling: + t_genlib_buffer *genlib_obtain_buffer_from_reference(void *ref); + t_genlib_err genlib_buffer_edit_begin(t_genlib_buffer *b); + t_genlib_err genlib_buffer_edit_end(t_genlib_buffer *b, long valid); + t_genlib_err genlib_buffer_getinfo(t_genlib_buffer *b, t_genlib_buffer_info *info); + void genlib_buffer_dirty(t_genlib_buffer *b); + t_genlib_err genlib_buffer_perform_begin(t_genlib_buffer *b); + void genlib_buffer_perform_end(t_genlib_buffer *b); + + // data handling: + t_genlib_data *genlib_obtain_data_from_reference(void *ref); + t_genlib_err genlib_data_getinfo(t_genlib_data *b, t_genlib_data_info *info); + void genlib_data_resize(t_genlib_data *b, long dim, long channels); + void genlib_data_setbuffer(t_genlib_data *b, void *ref); + void genlib_data_release(t_genlib_data *b); + void genlib_data_setcursor(t_genlib_data *b, long cursor); + long genlib_data_getcursor(t_genlib_data *b); + + // other notification: + void genlib_reset_complete(void *data); + + +}; // extern "C" + +#define genlib_sysmem_newptr(s) sysmem_newptr(s) +#define genlib_sysmem_newptrclear(s) sysmem_newptrclear(s) +#define genlib_sysmem_resizeptr(p, s) sysmem_resizeptr(p, s) +#define genlib_sysmem_resizeptrclear(p, s) sysmem_resizeptrclear(p, s) +#define genlib_sysmem_ptrsize(p) sysmem_ptrsize(p) +#define genlib_sysmem_freeptr(p) sysmem_freeptr(p) +#define genlib_sysmem_copyptr(s, d, b) sysmem_copyptr(s, d, b) +#define genlib_set_zero64(d, n) set_zero64(d, n) +#define genlib_ticks systime_ticks + +#endif // GENLIB_H diff --git a/plugins/shiroverb/gen_dsp/genlib_common.h b/plugins/shiroverb/gen_dsp/genlib_common.h new file mode 100644 index 0000000..e516aa8 --- /dev/null +++ b/plugins/shiroverb/gen_dsp/genlib_common.h @@ -0,0 +1,104 @@ +/******************************************************************************************************************* +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. +*******************************************************************************************************************/ + + +#ifndef GENLIB_COMMON_H +#define GENLIB_COMMON_H 1 + +#include "genlib_common_win.h" + +//////////// genlib_common.h //////////// +// common data structure header file -- this is the stuff required by the +// common code and accessed by the export and max code + +#define DSP_GEN_MAX_SIGNALS 16 + +typedef double t_sample; +typedef char *t_ptr; + +typedef long t_genlib_err; +typedef enum { + GENLIB_ERR_NONE = 0, ///< No error + GENLIB_ERR_GENERIC = -1, ///< Generic error + GENLIB_ERR_INVALID_PTR = -2, ///< Invalid Pointer + GENLIB_ERR_DUPLICATE = -3, ///< Duplicate + GENLIB_ERR_OUT_OF_MEM = -4, ///< Out of memory + + GENLIB_ERR_LOOP_OVERFLOW = 100, // too many iterations of loops in perform() + GENLIB_ERR_NULL_BUFFER = 101 // missing signal data in perform() + +} e_genlib_errorcodes; + +typedef enum { + GENLIB_PARAMTYPE_FLOAT = 0, + GENLIB_PARAMTYPE_SYM = 1 +} e_genlib_paramtypes; + +struct ParamInfo +{ + double defaultvalue; + void * defaultref; + char hasinputminmax; + char hasminmax; + double inputmin, inputmax; + double outputmin, outputmax; + const char *name; + const char *units; + int paramtype; // 0 -> float64, 1 -> symbol (table name) + double exp; // future, for scaling +}; + +struct CommonState +{ + double sr; + int vs; + int numins; + int numouts; + const char **inputnames; + const char **outputnames; + int numparams; + ParamInfo *params; + + void * parammap; // implementation-dependent + void * api; // implementation-dependent +}; + +// opaque interface to float32 buffer: +typedef struct _genlib_buffer t_genlib_buffer; +typedef struct { + char b_name[256]; ///< name of the buffer + float *b_samples; ///< stored with interleaved channels if multi-channel + long b_frames; ///< number of sample frames (each one is sizeof(float) * b_nchans bytes) + long b_nchans; ///< number of channels + long b_size; ///< size of buffer in floats + float b_sr; ///< sampling rate of the buffer + long b_modtime; ///< last modified time ("dirty" method) + long b_rfu[57]; ///< reserved for future use +} t_genlib_buffer_info; + +// opaque interface to float64 buffer: +typedef struct _genlib_data t_genlib_data; +typedef struct { + int dim, channels; + double * data; +} t_genlib_data_info; + +#endif // GENLIB_COMMON_H + + diff --git a/plugins/shiroverb/gen_dsp/genlib_common_win.h b/plugins/shiroverb/gen_dsp/genlib_common_win.h new file mode 100644 index 0000000..150eeb1 --- /dev/null +++ b/plugins/shiroverb/gen_dsp/genlib_common_win.h @@ -0,0 +1,43 @@ +/******************************************************************************************************************* +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. +*******************************************************************************************************************/ + +#ifndef GENLIB_COMMON_WIN_H +#define GENLIB_COMMON_WIN_H + +#ifdef _MSC_VER + #define GEN_WINDOWS +#endif + +#ifdef GEN_WINDOWS + + #include + #include + + typedef __int32 int32_t; + typedef unsigned __int32 uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; + #define malloc_size _msize + + #define __DBL_EPSILON__ (DBL_EPSILON) + +#endif + +#endif + diff --git a/plugins/shiroverb/gen_dsp/genlib_exportfunctions.h b/plugins/shiroverb/gen_dsp/genlib_exportfunctions.h new file mode 100644 index 0000000..7a27eba --- /dev/null +++ b/plugins/shiroverb/gen_dsp/genlib_exportfunctions.h @@ -0,0 +1,38 @@ +/******************************************************************************************************************* +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. +*******************************************************************************************************************/ + +#ifndef GENLIB_EXPORT_FUNCTIONS_H +#define GENLIB_EXPORT_FUNCTIONS_H 1 + +typedef char *t_ptr; + +t_ptr sysmem_newptr(t_ptr_size size); +t_ptr sysmem_newptrclear(t_ptr_size size); +t_ptr sysmem_resizeptr(void *ptr, t_ptr_size newsize); +t_ptr sysmem_resizeptrclear(void *ptr, t_ptr_size newsize); +t_ptr_size sysmem_ptrsize(void *ptr); +void sysmem_freeptr(void *ptr); +void sysmem_copyptr(const void *src, void *dst, t_ptr_size bytes); +unsigned long systime_ticks(void); + +void genlib_report_error(const char *s); +void genlib_report_message(const char *s); +void set_zero64(double *mem, long size); + +#endif // GENLIB_EXPORT_FUNCTIONS_H diff --git a/plugins/shiroverb/gen_dsp/genlib_ops.h b/plugins/shiroverb/gen_dsp/genlib_ops.h new file mode 100644 index 0000000..df9e80d --- /dev/null +++ b/plugins/shiroverb/gen_dsp/genlib_ops.h @@ -0,0 +1,1238 @@ +/******************************************************************************************************************* +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. +*******************************************************************************************************************/ + +#ifndef GENLIB_OPS_H +#define GENLIB_OPS_H 1 + +#include "genlib_common.h" // common to common code and any host code +#include "genlib.h" // this file is different for different "hosts" + +//////////// genlib_ops.h //////////// + +// system constants +#define GENLIB_DBL_EPSILON (__DBL_EPSILON__) + +#define GENLIB_PI (3.14159265358979323846264338327950288) +#define GENLIB_PI_OVER_2 (1.57079632679489661923132169163975144) +#define GENLIB_PI_OVER_4 (0.785398163397448309615660845819875721) +#define GENLIB_1_OVER_LOG_2 (1.442695040888963) + +// denormal numbers cannot occur when hosted in MSP: +#ifdef MSP_ON_CLANG + #define GENLIB_NO_DENORM_TEST 1 +#endif + +// assumes v is a 64-bit double: +#define GENLIB_IS_NAN_DOUBLE(v) (((((uint32_t *)&(v))[1])&0x7fe00000)==0x7fe00000) +#define GENLIB_FIX_NAN_DOUBLE(v) ((v)=GENLIB_IS_NAN_DOUBLE(v)?0.:(v)) + +#ifdef GENLIB_NO_DENORM_TEST + #define GENLIB_IS_DENORM_DOUBLE(v) (v) + #define GENLIB_FIX_DENORM_DOUBLE(v) (v) +#else + #define GENLIB_IS_DENORM_DOUBLE(v) ((((((uint32_t *)&(v))[1])&0x7fe00000)==0)&&((v)!=0.)) + #define GENLIB_FIX_DENORM_DOUBLE(v) ((v)=GENLIB_IS_DENORM_DOUBLE(v)?0.f:(v)) +#endif + +#define GENLIB_QUANT(f1,f2) (floor((f1)*(f2)+0.5)/(f2)) + +inline double genlib_isnan(double v) { return GENLIB_IS_NAN_DOUBLE(v); } +inline double fixnan(double v) { return GENLIB_FIX_NAN_DOUBLE(v); } +inline double fixdenorm(double v) { return GENLIB_FIX_DENORM_DOUBLE(v); } +inline double isdenorm(double v) { return GENLIB_IS_DENORM_DOUBLE(v); } + +inline double safemod(double f, double m) { + if (m > GENLIB_DBL_EPSILON || m < -GENLIB_DBL_EPSILON) { + if (m<0) + m = -m; // modulus needs to be absolute value + if (f>=m) { + if (f>=(m*2.)) { + double d = f / m; + d = d - (long) d; + f = d * m; + } + else { + f -= m; + } + } + else if (f<=(-m)) { + if (f<=(-m*2.)) { + double d = f / m; + d = d - (long) d; + f = d * m; + } + else { + f += m; + } + } + } else { + f = 0.0; //don't divide by zero + } + return f; +} + + +inline double safediv(double num, double denom) { + return denom == 0. ? 0. : num/denom; +} + +// fixnan for case of negative base and non-integer exponent: +inline double safepow(double base, double exponent) { + return fixnan(pow(base, exponent)); +} + +inline double absdiff(double a, double b) { return fabs(a-b); } + +inline double exp2(double v) { return pow(2., v); } + +inline double trunc(double v) { + double epsilon = (v<0.0) * -2 * 1E-9 + 1E-9; + // copy to long so it gets truncated (probably cheaper than floor()) + long val = v + epsilon; + return val; +} + +inline double sign(double v) { return v > 0. ? 1. : v < 0. ? -1. : 0.; } + +inline long is_poweroftwo(long x) { + return (x & (x - 1)) == 0; +} + +inline uint64_t next_power_of_two(uint64_t v) { + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v |= v >> 32; + v++; + return v; +} + +inline double fold(double v, double lo1, double hi1){ + double lo; + double hi; + if(lo1 == hi1){ return lo1; } + if (lo1 > hi1) { + hi = lo1; lo = hi1; + } else { + lo = lo1; hi = hi1; + } + const double range = hi - lo; + long numWraps = 0; + if(v >= hi){ + v -= range; + if(v >= hi){ + numWraps = (long)((v - lo)/range); + v -= range * (double)numWraps; + } + numWraps++; + } else if(v < lo){ + v += range; + if(v < lo){ + numWraps = (long)((v - lo)/range) - 1; + v -= range * (double)numWraps; + } + numWraps--; + } + if(numWraps & 1) v = hi + lo - v; // flip sign for odd folds + return v; +} + +inline double wrap(double v, double lo1, double hi1){ + double lo; + double hi; + if(lo1 == hi1) return lo1; + if (lo1 > hi1) { + hi = lo1; lo = hi1; + } else { + lo = lo1; hi = hi1; + } + const double range = hi - lo; + if (v >= lo && v < hi) return v; + if (range <= 0.000000001) return lo; // no point... + const long numWraps = long((v-lo)/range) - (v < lo); + return v - range * double(numWraps); +} + +// this version gives far better performance when wrapping is relatively rare +// and typically double of wraps is very low (>1%) +// but catastrophic if wraps is high (1000%+) +inline double wrapfew(double v, double lo, double hi){ + const double range = hi - lo; + while (v >= hi) v -= range; + while (v < lo) v += range; + return v; +} + +inline double phasewrap_few(double val) { + return wrapfew(val, -GENLIB_PI, GENLIB_PI); +} + +inline double phasewrap(double val) { + const double twopi = GENLIB_PI*2.; + const double oneovertwopi = 1./twopi; + if (val>= twopi || val <= twopi) { + double d = val * oneovertwopi; //multiply faster + d = d - (long)d; + val = d * twopi; + } + if (val > GENLIB_PI) val -= twopi; + if (val < -GENLIB_PI) val += twopi; + return val; +} + +/// 8th order Taylor series approximation to a cosine. +/// r must be in [-pi, pi]. +inline double cosT8(double r) { + const double t84 = 56.; + const double t83 = 1680.; + const double t82 = 20160.; + const double t81 = 2.4801587302e-05; + const double t73 = 42.; + const double t72 = 840.; + const double t71 = 1.9841269841e-04; + if(r < GENLIB_PI_OVER_4 && r > -GENLIB_PI_OVER_4){ + double rr = r*r; + return 1. - rr * t81 * (t82 - rr * (t83 - rr * (t84 - rr))); + } + else if(r > 0.){ + r -= GENLIB_PI_OVER_2; + double rr = r*r; + return -r * (1. - t71 * rr * (t72 - rr * (t73 - rr))); + } + else{ + r += GENLIB_PI_OVER_2; + double rr = r*r; + return r * (1. - t71 * rr * (t72 - rr * (t73 - rr))); + } +} + +inline double sin_fast(const double r){ + const double y = (4./GENLIB_PI) * r + (-4./(GENLIB_PI*GENLIB_PI)) * r * fabs(r); + return 0.225 * (y * fabs(y) - y) + y; // Q * y + P * y * abs(y) +} + +inline double sinP7(double n){ + double nn = n*n; + return n * (3.138982 + nn * (-5.133625 + nn * (2.428288 - nn * 0.433645))); +} + +inline double sinP9(double n){ + double nn = n*n; + return n * (GENLIB_PI + nn * (-5.1662729 + nn * (2.5422065 + nn * (-0.5811243 + nn * 0.0636716)))); +} + +inline double sinT7(double r){ + const double t84 = 56.; + const double t83 = 1680.; + const double t82 = 20160.; + const double t81 = 2.4801587302e-05; + const double t73 = 42.; + const double t72 = 840.; + const double t71 = 1.9841269841e-04; + if(r < GENLIB_PI_OVER_4 && r > -GENLIB_PI_OVER_4){ + double rr = r*r; + return r * (1. - t71 * rr * (t72 - rr * (t73 - rr))); + } + else if(r > 0.){ + r -= GENLIB_PI_OVER_2; + double rr = r*r; + return 1. - rr * t81 * (t82 - rr * (t83 - rr * (t84 - rr))); + } + else{ + r += GENLIB_PI_OVER_2; + double rr = r*r; + return -1. + rr * t81 * (t82 - rr * (t83 - rr * (t84 - rr))); + } +} + +// use these if r is not known to be in [-pi, pi]: +inline double cosT8_safe(double r) { return cosT8(phasewrap(r)); } +inline double sin_fast_safe(double r) { return sin_fast(phasewrap(r)); } +inline double sinP7_safe(double r) { return sinP7(phasewrap(r)); } +inline double sinP9_safe(double r) { return sinP9(phasewrap(r)); } +inline double sinT7_safe(double r) { return sinT7(phasewrap(r)); } + +inline double minimum(double x, double y) { return (y +inline T smoothstep(double e0, double e1, T x) { + T t = clamp( safediv(x-T(e0),T(e1-e0)), 0., 1. ); + return t*t*(T(3) - T(2)*t); +} + +inline double mix(double x, double y, double a) { + return x+a*(y-x); +} + +inline double scale(double in, double inlow, double inhigh, double outlow, double outhigh, double power) +{ + double value; + double inscale = safediv(1., inhigh - inlow); + double outdiff = outhigh - outlow; + + value = (in - inlow) * inscale; + if (value > 0.0) + value = pow(value, power); + else if (value < 0.0) + value = -pow(-value, power); + value = (value * outdiff) + outlow; + + return value; +} + +inline double linear_interp(double a, double x, double y) { + return x+a*(y-x); +} + +inline double cosine_interp(double a, double x, double y) { + const double a2 = (1.-cosT8_safe(a*GENLIB_PI))/2.; + return(x*(1.-a2)+y*a2); +} + +inline double cubic_interp(double a, double w, double x, double y, double z) { + const double a2 = a*a; + const double f0 = z - y - w + x; + const double f1 = w - x - f0; + const double f2 = y - w; + const double f3 = x; + return(f0*a*a2 + f1*a2 + f2*a + f3); +} + +// Breeuwsma catmull-rom spline interpolation +inline double spline_interp(double a, double w, double x, double y, double z) { + const double a2 = a*a; + const double f0 = -0.5*w + 1.5*x - 1.5*y + 0.5*z; + const double f1 = w - 2.5*x + 2*y - 0.5*z; + const double f2 = -0.5*w + 0.5*y; + return(f0*a*a2 + f1*a2 + f2*a + x); +} + +template +inline T1 neqp(T1 x, T2 y) { + return ((((x) != T1(y))) ? (x) : T1(0)); +} + +template +inline T1 gtp(T1 x, T2 y) { return ((((x) > T1(y))) ? (x) : T1(0)); } +template +inline T1 gtep(T1 x, T2 y) { return ((((x) >= T1(y))) ? (x) : T1(0)); } +template +inline T1 ltp(T1 x, T2 y) { return ((((x) < T1(y))) ? (x) : T1(0)); } +template +inline T1 ltep(T1 x, T2 y) { return ((((x) <= T1(y))) ? (x) : T1(0)); } + +inline double fract(double x) { double unused; return modf(x, &unused); } + +// log2(x) = log(x)/log(2) +template +inline T log2(T x) { + return log(x)*GENLIB_1_OVER_LOG_2; +} + +inline double atodb(double in) { + return (in <=0.) ? -999. : (20. * log10(in)); +} + +inline double dbtoa(double in) { + return pow(10., in * 0.05); +} + +inline double ftom(double in, double tuning=440.) { + return 69. + 17.31234050465299 * log(safediv(in, tuning)); +} + +inline double mtof(double in, double tuning=440.) { + return tuning * exp(.057762265 * (in - 69.0)); +} + +inline double mstosamps(double ms, double samplerate=44100.) { + return samplerate * ms * 0.001; +} + +inline double sampstoms(double s, double samplerate=44100.) { + return 1000. * s / samplerate; +} + +inline double triangle(double phase, double p1) { + phase = wrap(phase, 0., 1.); + p1 = clamp(p1, 0., 1.); + if (phase < p1) + return (p1) ? phase/p1 : 0.; + else + return (p1==1.) ? phase : 1. - ((phase - p1) / (1. - p1)); +} + +struct Delta { + double history; + Delta() { reset(); } + inline void reset(double init=0) { history=init; } + + inline double operator()(double in1) { + double ret = in1 - history; + history = in1; + return ret; + } +}; +struct Change { + double history; + Change() { reset(); } + inline void reset(double init=0) { history=init; } + + inline double operator()(double in1) { + double ret = in1 - history; + history = in1; + return sign(ret); + } +}; + +struct Rate { + double phase, diff, mult, invmult, prev; + int wantlock, quant; + + Rate() { reset(); } + + inline void reset() { + phase = diff = prev = 0; + mult = invmult = 1; + wantlock = 1; + quant = 1; + } + + inline double perform_lock(double in1, double in2) { + // did multiplier change? + if (in2 != mult && !genlib_isnan(in2)) { + mult = in2; + invmult = safediv(1., mult); + wantlock = 1; + } + double diff = in1 - prev; + + if (diff < -0.5) { + diff += 1; + } else if (diff > 0.5) { + diff -= 1; + } + + if (wantlock) { + // recalculate phase + phase = (in1 - GENLIB_QUANT(in1, quant)) * invmult + + GENLIB_QUANT(in1, quant * mult); + diff = 0; + wantlock = 0; + } else { + // diff is always between -0.5 and 0.5 + phase += diff * invmult; + } + + if (phase > 1. || phase < -0.) { + phase = phase - (long)(phase); + } + + prev = in1; + + return phase; + } + + inline double perform_cycle(double in1, double in2) { + // did multiplier change? + if (in2 != mult && !genlib_isnan(in2)) { + mult = in2; + invmult = safediv(1., mult); + wantlock = 1; + } + double diff = in1 - prev; + + if (diff < -0.5) { + if (wantlock) { + wantlock = 0; + phase = in1 * invmult; + diff = 0; + } else { + diff += 1; + } + } else if (diff > 0.5) { + if (wantlock) { + wantlock = 0; + phase = in1 * invmult; + diff = 0; + } else { + diff -= 1; + } + } + + // diff is always between -0.5 and 0.5 + phase += diff * invmult; + + if (phase > 1. || phase < -0.) { + phase = phase - (long)(phase); + } + + prev = in1; + + return phase; + } + + inline double perform_off(double in1, double in2) { + // did multiplier change? + if (in2 != mult && !genlib_isnan(in2)) { + mult = in2; + invmult = safediv(1., mult); + wantlock = 1; + } + double diff = in1 - prev; + + if (diff < -0.5) { + diff += 1; + } else if (diff > 0.5) { + diff -= 1; + } + + phase += diff * invmult; + + if (phase > 1. || phase < -0.) { + phase = phase - (long)(phase); + } + + prev = in1; + + return phase; + } +}; + +struct DCBlock { + double x1, y1; + DCBlock() { reset(); } + inline void reset() { x1=0; y1=0; } + + inline double operator()(double in1) { + double y = in1 - x1 + y1*0.9997; + x1 = in1; + y1 = y; + return y; + } +}; + +struct Noise { + unsigned long last; + static long uniqueTickCount(void) { + static long lasttime = 0; + long time = genlib_ticks(); + return (time <= lasttime) ? (++lasttime) : (lasttime = time); + } + + Noise() { reset(); } + Noise(double seed) { reset(seed); } + void reset() { last = uniqueTickCount() * uniqueTickCount(); } + void reset(double seed) { last = seed; } + + inline double operator()() { + last = 1664525L * last + 1013904223L; + unsigned long itemp = 0x3f800000 | (0x007fffff & last); + return ((*(float *)&itemp) * 2.0) - 3.0; + } +}; + +struct Phasor { + double phase; + Phasor() { reset(); } + void reset(double v=0.) { phase=v; } + inline double operator()(double freq, double invsamplerate) { + const double pincr = freq * invsamplerate; + //phase = wrapfew(phase + pincr, 0., 1.); // faster for low frequencies, but explodes with high frequencies + phase = wrap(phase + pincr, 0., 1.); + return phase; + } +}; + +struct PlusEquals { + double count; + PlusEquals() { reset(); } + void reset(double v=0.) { count=v; } + + // reset post-application mode: + inline double post(double incr, double reset, double min, double max) { + count = reset ? min : wrap(count+incr, min, max); + return count; + } + inline double post(double incr=1., double reset=0., double min=0.) { + count = reset ? min : count+incr; + return count; + } + + // reset pre-application mode: + inline double pre(double incr, double reset, double min, double max) { + count = reset ? min+incr : wrap(count+incr, min, max); + return count; + } + inline double pre(double incr=1., double reset=0., double min=0.) { + count = reset ? min+incr : count+incr; + return count; + } +}; + +struct MulEquals { + double count; + MulEquals() { reset(); } + void reset(double v=0.) { count=v; } + + // reset post-application mode: + inline double post(double incr, double reset, double min, double max) { + count = reset ? min : wrap(fixdenorm(count*incr), min, max); + return count; + } + inline double post(double incr=1., double reset=0., double min=0.) { + count = reset ? min : fixdenorm(count*incr); + return count; + } + + // reset pre-application mode: + inline double pre(double incr, double reset, double min, double max) { + count = reset ? min*incr : wrap(fixdenorm(count*incr), min, max); + return count; + } + inline double pre(double incr=1., double reset=0., double min=0.) { + count = reset ? min*incr : fixdenorm(count*incr); + return count; + } +}; + +struct Sah { + double prev, output; + Sah() { reset(); } + void reset(double o=0.) { + output = prev = o; + } + + inline double operator()(double in, double trig, double thresh) { + if (prev <= thresh && trig > thresh) { + output = in; + } + prev = trig; + return output; + } +}; + +struct Train { + double phase; + double state; + Train() { reset(); } + void reset(double p=0) { phase = p; state = 0.; } + + inline double operator()(double pulseinterval, double width, double pulsephase) { + if (width <= 0.) { + state = 0.; // no pulse! + } else if (width >= 1.) { + state = 1.; // constant pulse! + } else { + const double interval = maximum(pulseinterval, 1.); // >= 1. + const double p1 = clamp(pulsephase, 0., 1.); // [0..1] + const double p2 = p1+width; // (p1..p1+1) + const double pincr = 1./interval; // (0..1] + phase += pincr; // +ve + if (state) { // on: + if (phase > p2) { + state = 0.; // turn off + phase -= (int)(1.+phase-p2); // wrap phase back down + } + } else { // off: + if (phase > p1) { + state = 1.; // turn on. + } + } + } + return state; + } +}; + +struct Delay { + double * memory; + long size, wrap, maxdelay; + long reader, writer; + + t_genlib_data * dataRef; + + Delay() : memory(0) { + size = wrap = maxdelay = 0; + reader = writer = 0; + dataRef = 0; + } + ~Delay() { + if (dataRef != 0) { + // store write position for persistence: + genlib_data_setcursor(dataRef, writer); + // decrement reference count: + genlib_data_release(dataRef); + } + } + + inline void reset(const char * name, long d) { + // if needed, acquire the Data's global reference: + if (dataRef == 0) { + + void * ref = genlib_obtain_reference_from_string(name); + dataRef = genlib_obtain_data_from_reference(ref); + if (dataRef == 0) { + genlib_report_error("failed to acquire data"); + return; + } + + // scale maxdelay to next highest power of 2: + maxdelay = d; + size = maximum(maxdelay,2); + size = next_power_of_two(size); + + // first reset should resize the memory: + genlib_data_resize(dataRef, size, 1); + + t_genlib_data_info info; + if (genlib_data_getinfo(dataRef, &info) == GENLIB_ERR_NONE) { + if (info.dim != size) { + // at this point, could resolve by reducing to + // maxdelay = size = next_power_of_two(info.dim+1)/2; + // but really, if this happens, it means more than one + // object is referring to the same t_gen_dsp_data. + // which is probably bad news. + genlib_report_error("delay memory size error"); + memory = 0; + return; + } + memory = info.data; + writer = genlib_data_getcursor(dataRef); + } else { + genlib_report_error("failed to acquire data info"); + } + + } else { + // subsequent reset should zero the memory & heads: + set_zero64(memory, size); + writer = 0; + } + + reader = writer; + wrap = size-1; + } + + // called at bufferloop end, updates read pointer time + inline void step() { + reader++; + if (reader >= size) reader = 0; + } + + inline void write(double x) { + writer = reader; // update write ptr + memory[writer] = x; + } + + inline double read_step(double d) { + // extra half for nice rounding: + // min 1 sample delay for read before write (r != w) + const double r = double(size + reader) - clamp(d-0.5, (reader != writer), maxdelay); + long r1 = long(r); + return memory[r1 & wrap]; + } + + inline double read_linear(double d) { + // min 1 sample delay for read before write (r != w) + double c = clamp(d, (reader != writer), maxdelay); + const double r = double(size + reader) - c; + long r1 = long(r); + long r2 = r1+1; + double a = r - (double)r1; + double x = memory[r1 & wrap]; + double y = memory[r2 & wrap]; + return linear_interp(a, x, y); + } + + inline double read_cosine(double d) { + // min 1 sample delay for read before write (r != w) + const double r = double(size + reader) - clamp(d, (reader != writer), maxdelay); + long r1 = long(r); + long r2 = r1+1; + double a = r - (double)r1; + double x = memory[r1 & wrap]; + double y = memory[r2 & wrap]; + return cosine_interp(a, x, y); + } + + // cubic requires extra sample of compensation: + inline double read_cubic(double d) { + // min 1 sample delay for read before write (r != w) + // plus extra 1 sample compensation for 4-point interpolation + const double r = double(size + reader) - clamp(d, 1.+(reader != writer), maxdelay); + long r1 = long(r); + long r2 = r1+1; + long r3 = r1+2; + long r4 = r1+3; + double a = r - (double)r1; + double w = memory[r1 & wrap]; + double x = memory[r2 & wrap]; + double y = memory[r3 & wrap]; + double z = memory[r4 & wrap]; + return cubic_interp(a, w, x, y, z); + } + + // spline requires extra sample of compensation: + inline double read_spline(double d) { + // min 1 sample delay for read before write (r != w) + // plus extra 1 sample compensation for 4-point interpolation + const double r = double(size + reader) - clamp(d, 1.+(reader != writer), maxdelay); + long r1 = long(r); + long r2 = r1+1; + long r3 = r1+2; + long r4 = r1+3; + double a = r - (double)r1; + double w = memory[r1 & wrap]; + double x = memory[r2 & wrap]; + double y = memory[r3 & wrap]; + double z = memory[r4 & wrap]; + return spline_interp(a, w, x, y, z); + } +}; + +template +struct DataInterface { + long dim, channels; + T * mData; + void * mDataReference; // this was t_symbol *mName + int modified; + + DataInterface() : dim(0), channels(1), mData(0), modified(0) { mDataReference = 0; } + + // raw reading/writing/overdubbing (internal use only, no bounds checking) + inline double read(long index, long channel=0) const { + return mData[channel+index*channels]; + } + inline void write(double value, long index, long channel=0) { + mData[channel+index*channels] = value; + modified = 1; + } + inline void overdub(double value, long index, long channel=0) { + mData[channel+index*channels] += value; + modified = 1; + } + + // averaging overdub (used by splat) + inline void blend(double value, long index, long channel, double alpha) { + long offset = channel+index*channels; + const double old = mData[offset]; + mData[offset] = old + alpha * (value - old); + modified = 1; + } + + inline void read_ok(long index, long channel=0, bool ok=1) const { + return ok ? mData[channel+index*channels] : T(0); + } + inline void write_ok(double value, long index, long channel=0, bool ok=1) { + if (ok) mData[channel+index*channels] = value; + } + inline void overdub_ok(double value, long index, long channel=0, bool ok=1) { + if (ok) mData[channel+index*channels] += value; + } + + // Bounds strategies: + inline long index_clamp(long index) const { return clamp(index, 0, dim-1); } + inline long index_wrap(long index) const { return wrap(index, 0, dim); } + inline long index_fold(long index) const { return fold(index, 0, dim); } + inline bool index_oob(long index) const { return (index < 0 || index >= dim); } + inline bool index_inbounds(long index) const { return (index >=0 && index < dim); } + + // channel bounds: + inline long channel_clamp(long c) const { return clamp(c, 0, channels-1); } + inline long channel_wrap(long c) const { return wrap(c, 0, channels); } + inline long channel_fold(long c) const { return fold(c, 0, channels); } + inline bool channel_oob(long c) const { return (c < 0 || c >= channels); } + inline bool channel_inbounds(long c) const { return !channel_oob(c); } + + // Indexing strategies: + // [0..1] -> [0..(dim-1)] + inline double phase2index(double phase) const { return phase * (dim-1); } + // [0..1] -> [min..max] + inline double subphase2index(double phase, long min, long max) const { + min = index_clamp(min); + max = index_clamp(max); + return min + phase * (max-min); + } + // [-1..1] -> [0..(dim-1)] + inline double signal2index(double signal) const { return phase2index((signal+1.) * 0.5); } + + inline double peek(double index, long channel=0) const { + const long i = (long)index; + if (index_oob(i) || channel_oob(channel)) { + return 0.; + } else { + return read(i, channel); + } + } + + inline double index(double index, long channel=0) const { + channel = channel_clamp(channel); + // no-interp: + long i = (long)index; + // bound: + i = index_clamp(i); + return read(i, channel); + } + + inline double cell(double index, long channel=0) const { + channel = channel_clamp(channel); + // no-interp: + long i = (long)index; + // bound: + i = index_wrap(i); + return read(i, channel); + } + + inline double cycle(double phase, long channel=0) const { + channel = channel_clamp(channel); + double index = phase2index(phase); + // interp: + long i1 = (long)index; + long i2 = i1+1; + const double alpha = index - (double)i1; + // bound: + i1 = index_wrap(i1); + i2 = index_wrap(i2); + // interp: + double v1 = read(i1, channel); + double v2 = read(i2, channel); + return mix(v1, v2, alpha); + } + + inline double lookup(double signal, long channel=0) const { + channel = channel_clamp(channel); + double index = signal2index(signal); + // interp: + long i1 = (long)index; + long i2 = i1+1; + double alpha = index - (double)i1; + // bound: + i1 = index_clamp(i1); + i2 = index_clamp(i2); + // interp: + double v1 = read(i1, channel); + double v2 = read(i2, channel); + return mix(v1, v2, alpha); + } + + inline void poke(double value, double index, long channel=0) { + const long i = (long)index; + if (!(index_oob(i) || channel_oob(channel))) { + write(fixdenorm(value), i, channel); + } + } + + inline void splat_adding(double value, double phase, long channel=0) { + const double valuef = fixdenorm(value); + channel = channel_clamp(channel); + double index = phase2index(phase); + // interp: + long i1 = (long)index; + long i2 = i1+1; + const double alpha = index - (double)i1; + // bound: + i1 = index_wrap(i1); + i2 = index_wrap(i2); + // interp: + overdub(valuef*(1.-alpha), i1, channel); + overdub(valuef*alpha, i2, channel); + } + + inline void splat(double value, double phase, long channel=0) { + const double valuef = fixdenorm(value); + channel = channel_clamp(channel); + double index = phase2index(phase); + // interp: + long i1 = (long)index; + long i2 = i1+1; + const double alpha = index - (double)i1; + // bound: + i1 = index_wrap(i1); + i2 = index_wrap(i2); + // interp: + const double v1 = read(i1, channel); + const double v2 = read(i2, channel); + write(v1 + (1.-alpha)*(valuef-v1), i1, channel); + write(v2 + (alpha)*(valuef-v2), i2, channel); + } +}; + +// DATA_MAXIMUM_ELEMENTS * 8 bytes = 256 mb limit +#define DATA_MAXIMUM_ELEMENTS (33554432) + +struct Data : public DataInterface { + t_genlib_data * dataRef; // a pointer to some external source of the data + + Data() : DataInterface() { + dataRef = 0; + } + ~Data() { + //genlib_report_message("releasing data handle %d", dataRef); + if (dataRef != 0) { + genlib_data_release(dataRef); + } + } + void reset(const char * name, long s, long c) { + // if needed, acquire the Data's global reference: + if (dataRef == 0) { + void * ref = genlib_obtain_reference_from_string(name); + dataRef = genlib_obtain_data_from_reference(ref); + if (dataRef == 0) { + genlib_report_error("failed to acquire data"); + return; + } + } + genlib_data_resize(dataRef, s, c); + getinfo(); + } + bool setbuffer(void * bufferRef) { + //genlib_report_message("set buffer %p", bufferRef); + if (dataRef == 0) { + // error: no data, or obtain? + return false; + } + genlib_data_setbuffer(dataRef, bufferRef); + getinfo(); + return true; + } + + void getinfo() { + t_genlib_data_info info; + if (genlib_data_getinfo(dataRef, &info) == GENLIB_ERR_NONE) { + mData = info.data; + dim = info.dim; + channels = info.channels; + } else { + genlib_report_error("failed to acquire data info"); + } + } +}; + +// Used by SineData +struct DataLocal : public DataInterface { + DataLocal() : DataInterface() {} + ~DataLocal() { + if (mData) sysmem_freeptr(mData); + mData = 0; + } + + void reset(long s, long c) { + mData=0; + resize(s, c); + } + + void resize(long s, long c) { + if (s * c > DATA_MAXIMUM_ELEMENTS) { + s = DATA_MAXIMUM_ELEMENTS/c; + genlib_report_message("warning: resizing data to < 256MB"); + } + if (mData) { + sysmem_resizeptr(mData, sizeof(double) * s * c); + } else { + mData = (double *)sysmem_newptr(sizeof(double) * s * c); + } + if (!mData) { + genlib_report_error("out of memory"); + resize(512, 1); + return; + } else { + dim = s; + channels = c; + } + set_zero64(mData, dim * channels); + } + + // copy from a buffer~ + // resizing is safe only during initialization! + bool setbuffer(void *dataReference) { + mDataReference = dataReference; // replaced mName + bool result = false; + t_genlib_buffer * b; + t_genlib_buffer_info info; + if (mDataReference != 0) { + b = (t_genlib_buffer *)genlib_obtain_buffer_from_reference(mDataReference); + if (b) { + if (genlib_buffer_edit_begin(b)==GENLIB_ERR_NONE) { + if (genlib_buffer_getinfo(b, &info)==GENLIB_ERR_NONE) { + float * samples = info.b_samples; + long frames = info.b_frames; + long nchans = info.b_nchans; + //long size = info.b_size; + //long modtime = info.b_modtime; // cache & compare? + + // resizing is safe only during initialization! + if (mData == 0) resize(frames, nchans); + + long frames_safe = frames < dim ? frames : dim; + long channels_safe = nchans < channels ? nchans : channels; + // copy: + for (int f=0; f { + t_genlib_buffer * mBuf; + t_genlib_buffer_info mInfo; + float mDummy; // safe access in case buffer is not valid + + Buffer() : DataInterface() {} + + void reset(const char * name) { + dim = 1; + channels = 1; + mData = &mDummy; + mDummy = 0.f; + mBuf = 0; + + // call into genlib: + mDataReference = genlib_obtain_reference_from_string(name); + } + + void setbuffer(void * ref) { + mDataReference = ref; + } + + void begin() { + t_genlib_buffer * b = genlib_obtain_buffer_from_reference(mDataReference); + mBuf = 0; + if (b) { + if (genlib_buffer_perform_begin(b) == GENLIB_ERR_NONE) { + mBuf = b; + } else { + //genlib_report_message ("not a buffer~ %s", mName->s_name); + } + } else { + //genlib_report_message("no object %s\n", mName->s_name); + } + + if (mBuf && genlib_buffer_getinfo(mBuf, &mInfo)==GENLIB_ERR_NONE) { + // grab data: + mBuf = b; + mData = mInfo.b_samples; + dim = mInfo.b_frames; + channels = mInfo.b_nchans; + } else { + //genlib_report_message("couldn't get info"); + mBuf = 0; + mData = &mDummy; + dim = 1; + channels = 1; + } + } + + void end() { + if (mBuf) { + genlib_buffer_perform_end(mBuf); + if (modified) { + genlib_buffer_dirty(mBuf); + } + modified = 0; + } + mBuf = 0; + } +}; + +struct SineData : public DataLocal { + SineData() : DataLocal() { + const int costable_size = 1 << 14; // 14 bit index (noise floor at around -156 dB) + mData=0; + resize(costable_size, 1); + for (int i=0; i +inline int dim(const T& data) { return data.dim; } + +template +inline int channels(const T& data) { return data.channels; } + +// used by cycle when no buffer/data is specified: +struct SineCycle { + + uint32_t phasei, pincr; + double f2i; + + void reset(double samplerate, double init = 0) { + phasei = init * 4294967296.0; + pincr = 0; + f2i = 4294967296.0 / samplerate; + } + + inline void freq(double f) { + pincr = f * f2i; + } + + inline void phase(double f) { + phasei = f * 4294967296.0; + } + + inline double phase() const { + return phasei * 0.232830643653869629e-9; + } + + template + inline double operator()(const DataInterface& buf) { + T * data = buf.mData; + // divide uint32_t range down to buffer size (32-bit to 14-bit) + uint32_t idx = phasei >> 18; + // compute fractional portion and divide by 18-bit range + const double frac = (phasei & 262143) * 3.81471181759574e-6; + // index safely in 14-bit range: + const double y0 = data[idx]; + const double y1 = data[(idx+1) & 16383]; + const double y = linear_interp(frac, y0, y1); + phasei += pincr; + return y; + } +}; + +#endif diff --git a/plugins/shiroverb/gen_exported.cpp b/plugins/shiroverb/gen_exported.cpp index 8c7c63f..9489e8c 100644 --- a/plugins/shiroverb/gen_exported.cpp +++ b/plugins/shiroverb/gen_exported.cpp @@ -31,59 +31,58 @@ static const int GENLIB_LOOPCOUNT_BAIL = 100000; // The State struct contains all the state and procedures for the gendsp kernel typedef struct State { CommonState __commonstate; + Delay m_delay_24; Delay m_delay_14; - Delay m_delay_18; - Delay m_delay_19; Delay m_delay_15; + Delay m_delay_13; Delay m_delay_12; + Delay m_delay_23; + Delay m_delay_16; + Delay m_delay_18; Delay m_delay_17; - Delay m_delay_13; - Delay m_delay_21; Delay m_delay_20; + Delay m_delay_19; + Delay m_delay_21; Delay m_delay_22; - Delay m_delay_24; - Delay m_delay_23; - Delay m_delay_16; - Delta m_delta_43; - Delta m_delta_49; - Delta m_delta_46; - Delta m_delta_40; - Phasor m_phasor_39; - Sah m_sah_50; - Sah m_sah_51; + Delta m_delta_39; + Delta m_delta_48; + Delta m_delta_42; + Delta m_delta_45; + Phasor m_phasor_38; Sah m_sah_47; - Sah m_sah_48; - Sah m_sah_45; - Sah m_sah_42; + Sah m_sah_46; Sah m_sah_44; Sah m_sah_41; - double m_mix_34; - double m_resonance_35; - double m_cutoff_36; - double m_window_38; - double m_blur_33; - double m_shift_37; + Sah m_sah_43; + Sah m_sah_40; + Sah m_sah_49; + Sah m_sah_50; + double m_history_10; + double m_history_7; + double m_history_6; + double m_history_8; + double m_history_9; double samples_to_seconds; - double m_tail_32; - double m_ratio_25; - double m_damping_30; - double m_history_4; double m_history_5; - double m_history_6; double m_history_3; + double samplerate; + double m_history_4; double m_history_1; double m_y_2; - double samplerate; - double m_spread_31; - double m_history_7; - double m_history_9; - double m_roomsize_28; - double m_decay_29; - double m_history_8; - double m_early_27; double m_y_11; - double m_history_10; - double m_tone_26; + double m_window_37; + double m_early_35; + double m_damping_27; + double m_spread_28; + double m_ratio_26; + double m_shift_25; + double m_mix_36; + double m_blur_29; + double m_decay_31; + double m_roomsize_30; + double m_cutoff_33; + double m_tail_34; + double m_tone_32; int vectorsize; int __exception; // re-initialize all member variables; @@ -102,47 +101,46 @@ typedef struct State { m_history_9 = 0; m_history_10 = 0; m_y_11 = 0; - m_delay_12.reset("m_delay_12", 7000); - m_delay_13.reset("m_delay_13", 5000); - m_delay_14.reset("m_delay_14", 16000); - m_delay_15.reset("m_delay_15", 15000); + m_delay_12.reset("m_delay_12", 5000); + m_delay_13.reset("m_delay_13", 7000); + m_delay_14.reset("m_delay_14", 15000); + m_delay_15.reset("m_delay_15", 16000); m_delay_16.reset("m_delay_16", 6000); m_delay_17.reset("m_delay_17", 88200); m_delay_18.reset("m_delay_18", 48000); - m_delay_19.reset("m_delay_19", 12000); - m_delay_20.reset("m_delay_20", 10000); + m_delay_19.reset("m_delay_19", 10000); + m_delay_20.reset("m_delay_20", 12000); m_delay_21.reset("m_delay_21", 48000); m_delay_22.reset("m_delay_22", 48000); m_delay_23.reset("m_delay_23", 48000); m_delay_24.reset("m_delay_24", 48000); - m_ratio_25 = 2; - m_tone_26 = 0.5; - m_early_27 = 0.25; - m_roomsize_28 = 75; - m_decay_29 = 11; - m_damping_30 = 0.7; - m_spread_31 = 23; - m_tail_32 = 0.25; - m_blur_33 = 0; - m_mix_34 = 1; - m_resonance_35 = 0; - m_cutoff_36 = 8000; - m_shift_37 = 1; - m_window_38 = 100; + m_shift_25 = 0.5; + m_ratio_26 = 2; + m_damping_27 = 0.75; + m_spread_28 = 25; + m_blur_29 = 0.25; + m_roomsize_30 = 75; + m_decay_31 = 11; + m_tone_32 = 0.5; + m_cutoff_33 = 3000; + m_tail_34 = 0.25; + m_early_35 = 0.25; + m_mix_36 = 0.75; + m_window_37 = 100; samples_to_seconds = (1 / samplerate); - m_phasor_39.reset(0); - m_delta_40.reset(0); + m_phasor_38.reset(0); + m_delta_39.reset(0); + m_sah_40.reset(0); m_sah_41.reset(0); - m_sah_42.reset(0); - m_delta_43.reset(0); + m_delta_42.reset(0); + m_sah_43.reset(0); m_sah_44.reset(0); - m_sah_45.reset(0); - m_delta_46.reset(0); + m_delta_45.reset(0); + m_sah_46.reset(0); m_sah_47.reset(0); - m_sah_48.reset(0); - m_delta_49.reset(0); + m_delta_48.reset(0); + m_sah_49.reset(0); m_sah_50.reset(0); - m_sah_51.reset(0); genlib_reset_complete(this); }; @@ -160,270 +158,264 @@ typedef struct State { return __exception; }; - double rsub_11547 = (1 - m_tone_26); - double expr_11686 = safepow(0.001, safediv(1, (m_decay_29 * 44100))); - double expr_11687 = safediv((m_roomsize_28 * 44100), 340); - double mul_11539 = (expr_11687 * 1); - double expr_11685 = (-safepow(expr_11686, mul_11539)); - double mul_11537 = (expr_11687 * 0.7071); - double expr_11679 = (-safepow(expr_11686, mul_11537)); - double mul_11538 = (expr_11687 * 0.81649); - double expr_11680 = (-safepow(expr_11686, mul_11538)); - double mul_11536 = (expr_11687 * 0.63245); - double expr_11678 = (-safepow(expr_11686, mul_11536)); - double expr_11677 = safediv(((m_cutoff_36 * 2) * 3.1415926535898), 44100); - double cos_11390 = cos(expr_11677); - double mul_11392 = (m_resonance_35 * 0.125); - double exp_11393 = exp(mul_11392); - double mul_11391 = (exp_11393 * 0.882497); - double mul_11387 = (mul_11391 * mul_11391); - double mul_11389 = (cos_11390 * mul_11391); - double mul_11388 = (mul_11389 * -2); - double add_11386 = ((mul_11387 + mul_11388) + 1); - double mul_11533 = (expr_11687 * 0.000527); - int int_11532 = int(mul_11533); - double mstosamps_11374 = (m_window_38 * (samplerate * 0.001)); - double add_11462 = (expr_11687 + 5); - double expr_11681 = safepow(expr_11686, add_11462); - double mul_11501 = (m_spread_31 * 0.376623); - double add_11500 = (mul_11501 + 931); - double rsub_11497 = (1341 - add_11500); - double mul_11508 = (int_11532 * rsub_11497); - double mul_11473 = (m_spread_31 * -0.380445); - double add_11472 = (mul_11473 + 931); - double rsub_11469 = (1341 - add_11472); - double mul_11482 = (int_11532 * rsub_11469); - double mul_11468 = (expr_11687 * 0.41); - double add_11465 = (mul_11468 + 5); - double expr_11684 = safepow(expr_11686, add_11465); - double mul_11467 = (expr_11687 * 0.3); - double add_11464 = (mul_11467 + 5); - double expr_11683 = safepow(expr_11686, add_11464); - double mul_11466 = (expr_11687 * 0.155); - double add_11463 = (mul_11466 + 5); - double expr_11682 = safepow(expr_11686, add_11463); - double rsub_11361 = (1 - m_ratio_25); - double mul_11360 = (rsub_11361 * 1000); - double div_11359 = safediv(mul_11360, m_window_38); + double rsub_1933 = (1 - m_tone_32); + double expr_2527 = safepow(0.001, safediv(1, (m_decay_31 * 44100))); + double expr_2518 = safediv(((m_cutoff_33 * 2) * 3.1415926535898), 44100); + double cos_1776 = cos(expr_2518); + double mul_1774 = (cos_1776 * -2); + double add_1772 = (mul_1774 + 1); + double expr_2528 = safediv((m_roomsize_30 * 44100), 340); + double mul_1922 = (expr_2528 * 0.63245); + double expr_2519 = (-safepow(expr_2527, mul_1922)); + double mul_1923 = (expr_2528 * 0.7071); + double expr_2520 = (-safepow(expr_2527, mul_1923)); + double mul_1925 = (expr_2528 * 1); + double expr_2526 = (-safepow(expr_2527, mul_1925)); + double mul_1924 = (expr_2528 * 0.81649); + double expr_2521 = (-safepow(expr_2527, mul_1924)); + double mul_1919 = (expr_2528 * 0.000527); + int int_1918 = int(mul_1919); + double mstosamps_1760 = (m_window_37 * (samplerate * 0.001)); + double mul_1859 = (m_spread_28 * -0.380445); + double add_1858 = (mul_1859 + 931); + double rsub_1855 = (1341 - add_1858); + double mul_1868 = (int_1918 * rsub_1855); + double add_1848 = (expr_2528 + 5); + double expr_2522 = safepow(expr_2527, add_1848); + double mul_1887 = (m_spread_28 * 0.376623); + double add_1886 = (mul_1887 + 931); + double rsub_1883 = (1341 - add_1886); + double mul_1894 = (int_1918 * rsub_1883); + double mul_1854 = (expr_2528 * 0.41); + double add_1851 = (mul_1854 + 5); + double expr_2525 = safepow(expr_2527, add_1851); + double mul_1853 = (expr_2528 * 0.3); + double add_1850 = (mul_1853 + 5); + double expr_2524 = safepow(expr_2527, add_1850); + double mul_1852 = (expr_2528 * 0.155); + double add_1849 = (mul_1852 + 5); + double expr_2523 = safepow(expr_2527, add_1849); + double rsub_1747 = (1 - m_ratio_26); + double mul_1746 = (rsub_1747 * 1000); + double div_1745 = safediv(mul_1746, m_window_37); samples_to_seconds = (1 / samplerate); - double mul_11531 = (expr_11687 * 0.110732); - double mul_11517 = (m_spread_31 * 0.125541); - double add_11499 = (mul_11517 + 369); - double rsub_11498 = (add_11500 - add_11499); - double mul_11515 = (int_11532 * rsub_11498); - double mul_11475 = (m_spread_31 * -0.568366); - double add_11471 = (mul_11475 + 369); - double rsub_11470 = (add_11472 - add_11471); - double mul_11489 = (int_11532 * rsub_11470); - double add_11516 = (mul_11517 + 159); - double mul_11524 = (int_11532 * add_11516); - double add_11474 = (mul_11475 + 159); - double mul_11496 = (int_11532 * add_11474); + double mul_1917 = (expr_2528 * 0.110732); + double mul_1861 = (m_spread_28 * -0.568366); + double add_1857 = (mul_1861 + 369); + double rsub_1856 = (add_1858 - add_1857); + double mul_1875 = (int_1918 * rsub_1856); + double mul_1903 = (m_spread_28 * 0.125541); + double add_1885 = (mul_1903 + 369); + double rsub_1884 = (add_1886 - add_1885); + double mul_1901 = (int_1918 * rsub_1884); + double add_1860 = (mul_1861 + 159); + double mul_1882 = (int_1918 * add_1860); + double add_1902 = (mul_1903 + 159); + double mul_1910 = (int_1918 * add_1902); // the main sample loop; while ((__n--)) { const double in1 = (*(__in1++)); - double noise_11310 = noise(); - double abs_11328 = fabs(noise_11310); - double mul_11332 = (abs_11328 * m_blur_33); - double noise_11311 = noise(); - double abs_11329 = fabs(noise_11311); - double mul_11335 = (abs_11329 * m_blur_33); - double noise_11313 = noise(); - double abs_11331 = fabs(noise_11313); - double mul_11341 = (abs_11331 * m_blur_33); - double noise_11312 = noise(); - double abs_11330 = fabs(noise_11312); - double mul_11338 = (abs_11330 * m_blur_33); - double tap_11544 = m_delay_24.read_linear(mul_11539); - double mul_11535 = (tap_11544 * expr_11685); - double mix_11730 = (mul_11535 + (m_damping_30 * (m_history_10 - mul_11535))); - double mix_11542 = mix_11730; - double tap_11442 = m_delay_23.read_linear(mul_11537); - double mul_11438 = (tap_11442 * expr_11679); - double mix_11731 = (mul_11438 + (m_damping_30 * (m_history_9 - mul_11438))); - double mix_11440 = mix_11731; - double tap_11448 = m_delay_22.read_linear(mul_11538); - double mul_11444 = (tap_11448 * expr_11680); - double mix_11732 = (mul_11444 + (m_damping_30 * (m_history_8 - mul_11444))); - double mix_11446 = mix_11732; - double tap_11436 = m_delay_21.read_linear(mul_11536); - double mul_11432 = (tap_11436 * expr_11678); - double mix_11733 = (mul_11432 + (m_damping_30 * (m_history_7 - mul_11432))); - double mix_11434 = mix_11733; - double mul_11383 = (mul_11387 * m_y_11); - double mul_11384 = (mul_11388 * m_y_2); - double add_11426 = (mix_11542 + mix_11446); - double add_11424 = (mix_11440 + mix_11434); - double sub_11423 = (add_11426 - add_11424); - double mul_11405 = (sub_11423 * 0.5); - double add_11419 = (add_11426 + add_11424); - double mul_11402 = (add_11419 * 0.5); - double tap_11507 = m_delay_20.read_linear(mul_11508); - double mul_11505 = (tap_11507 * 0.625); - double tap_11481 = m_delay_19.read_linear(mul_11482); - double mul_11479 = (tap_11481 * 0.625); - double sub_11425 = (mix_11542 - mix_11446); - double sub_11422 = (mix_11440 - mix_11434); - double sub_11421 = (sub_11425 - sub_11422); - double mul_11404 = (sub_11421 * 0.5); - double add_11420 = (sub_11425 + sub_11422); - double rsub_11418 = (0 - add_11420); - double mul_11403 = (rsub_11418 * 0.5); - double tap_11450 = m_delay_18.read_linear(add_11465); - double tap_11451 = m_delay_18.read_linear(add_11464); - double tap_11452 = m_delay_18.read_linear(add_11463); - double tap_11453 = m_delay_18.read_linear(add_11462); - double mul_11460 = (tap_11450 * expr_11684); - double add_11430 = (mul_11405 + mul_11460); - double mul_11458 = (tap_11451 * expr_11683); - double add_11429 = (mul_11404 + mul_11458); - double mul_11454 = (tap_11453 * expr_11681); - double add_11427 = (mul_11402 + mul_11454); - double mul_11456 = (tap_11452 * expr_11682); - double add_11428 = (mul_11403 + mul_11456); - double phasor_11380 = m_phasor_39(div_11359, samples_to_seconds); - double add_11352 = ((m_history_6 + phasor_11380) + 0.75); - double mod_11351 = safemod(add_11352, 1); - double delta_11334 = m_delta_40(mod_11351); - double sah_11314 = m_sah_41(mul_11332, delta_11334, 0); - double sah_11333 = m_sah_42(mstosamps_11374, delta_11334, 0); - double mul_11324 = (sah_11333 * mod_11351); - double sub_11350 = (mod_11351 - 0.5); - double mul_11349 = (sub_11350 * 3.1415926535898); - double cos_11348 = cos(mul_11349); - double mul_11343 = (cos_11348 * cos_11348); - double add_11358 = ((m_history_5 + phasor_11380) + 0.5); - double mod_11357 = safemod(add_11358, 1); - double delta_11337 = m_delta_43(mod_11357); - double sah_11316 = m_sah_44(mul_11335, delta_11337, 0); - double sah_11336 = m_sah_45(mstosamps_11374, delta_11337, 0); - double mul_11325 = (sah_11336 * mod_11357); - double sub_11356 = (mod_11357 - 0.5); - double mul_11355 = (sub_11356 * 3.1415926535898); - double cos_11354 = cos(mul_11355); - double mul_11344 = (cos_11354 * cos_11354); - double add_11379 = ((m_history_4 + phasor_11380) + 0); - double mod_11378 = safemod(add_11379, 1); - double delta_11321 = m_delta_46(mod_11378); - double sah_11320 = m_sah_47(mul_11341, delta_11321, 0); - double sah_11342 = m_sah_48(mstosamps_11374, delta_11321, 0); - double mul_11327 = (sah_11342 * mod_11378); - double sub_11377 = (mod_11378 - 0.5); - double mul_11376 = (sub_11377 * 3.1415926535898); - double cos_11375 = cos(mul_11376); - double mul_11346 = (cos_11375 * cos_11375); - double add_11373 = ((m_history_3 + phasor_11380) + 0.25); - double mod_11372 = safemod(add_11373, 1); - double delta_11340 = m_delta_49(mod_11372); - double sah_11318 = m_sah_50(mul_11338, delta_11340, 0); - double sah_11339 = m_sah_51(mstosamps_11374, delta_11340, 0); - double mul_11326 = (sah_11339 * mod_11372); - double tap_11365 = m_delay_17.read_linear(mul_11327); - double tap_11366 = m_delay_17.read_linear(mul_11326); - double tap_11367 = m_delay_17.read_linear(mul_11325); - double tap_11368 = m_delay_17.read_linear(mul_11324); - double mul_11347 = (tap_11368 * mul_11343); - double mul_11353 = (tap_11367 * mul_11344); - double mul_11363 = (tap_11365 * mul_11346); - double sub_11371 = (mod_11372 - 0.5); - double mul_11370 = (sub_11371 * 3.1415926535898); - double cos_11369 = cos(mul_11370); - double mul_11345 = (cos_11369 * cos_11369); - double mul_11362 = (tap_11366 * mul_11345); - double mul_11385 = ((((mul_11363 + mul_11362) + mul_11353) + mul_11347) * add_11386); - double sub_11382 = (mul_11385 - (mul_11383 + mul_11384)); - double mix_11734 = (in1 + (m_shift_37 * (sub_11382 - in1))); - double mix_11323 = mix_11734; - double mul_11396 = (mix_11323 * 0.707); - double mix_11735 = (mul_11396 + (rsub_11547 * (m_history_1 - mul_11396))); - double mix_11546 = mix_11735; - double tap_11530 = m_delay_16.read_linear(mul_11531); - double mul_11528 = (tap_11530 * 0.75); - double sub_11527 = (mix_11546 - mul_11528); - double mul_11526 = (sub_11527 * 0.75); - double add_11525 = (mul_11526 + tap_11530); - double tap_11514 = m_delay_15.read_linear(mul_11515); - double mul_11512 = (tap_11514 * 0.625); - double tap_11488 = m_delay_14.read_linear(mul_11489); - double mul_11486 = (tap_11488 * 0.625); - double tap_11523 = m_delay_13.read_linear(mul_11524); - double mul_11521 = (tap_11523 * 0.75); - double tap_11495 = m_delay_12.read_linear(mul_11496); - double mul_11493 = (tap_11495 * 0.75); - double mul_11417 = (mul_11405 * m_tail_32); - double mul_11415 = (mul_11403 * m_tail_32); - double add_11401 = (mul_11417 + mul_11415); - double mul_11416 = (mul_11404 * m_tail_32); - double mul_11414 = (mul_11402 * m_tail_32); - double add_11400 = (mul_11416 + mul_11414); - double sub_11409 = (add_11401 - add_11400); - double mul_11413 = (mul_11460 * m_early_27); - double mul_11411 = (mul_11456 * m_early_27); - double add_11399 = (mul_11413 + mul_11411); - double mul_11412 = (mul_11458 * m_early_27); - double mul_11410 = (mul_11454 * m_early_27); - double add_11398 = (mul_11412 + mul_11410); - double sub_11408 = (add_11399 - add_11398); - double add_11395 = (sub_11409 + sub_11408); - double add_11407 = (add_11395 + mix_11323); - double sub_11520 = (add_11407 - mul_11521); - double mul_11519 = (sub_11520 * 0.75); - double add_11518 = (mul_11519 + tap_11523); - double sub_11511 = (add_11518 - mul_11512); - double mul_11510 = (sub_11511 * 0.625); - double add_11509 = (mul_11510 + tap_11514); - double sub_11504 = (add_11509 - mul_11505); - double mul_11503 = (sub_11504 * 0.625); - double add_11502 = (mul_11503 + tap_11507); - double mul_11406 = (add_11502 * m_mix_34); - double out1 = (mul_11406 + in1); - double add_11397 = (add_11395 + mix_11323); - double sub_11492 = (add_11397 - mul_11493); - double mul_11491 = (sub_11492 * 0.75); - double add_11490 = (mul_11491 + tap_11495); - double sub_11485 = (add_11490 - mul_11486); - double mul_11484 = (sub_11485 * 0.625); - double add_11483 = (mul_11484 + tap_11488); - double sub_11478 = (add_11483 - mul_11479); - double mul_11477 = (sub_11478 * 0.625); - double add_11476 = (mul_11477 + tap_11481); - double mul_11394 = (add_11476 * m_mix_34); - double out2 = (mul_11394 + in1); - double y2_next_11701 = m_y_2; - double history_11541_next_11702 = mix_11542; - double history_11439_next_11703 = mix_11440; - double history_11445_next_11704 = mix_11446; - double history_11433_next_11705 = mix_11434; - double history_11315_next_11706 = sah_11314; - double history_11317_next_11707 = sah_11316; - double history_11322_next_11708 = sah_11320; - double history_11319_next_11709 = sah_11318; - double y1_next_11710 = sub_11382; - double history_11545_next_11711 = mix_11546; - m_delay_24.write(add_11430); - m_delay_23.write(add_11428); - m_delay_22.write(add_11429); - m_delay_21.write(add_11427); - m_delay_20.write(sub_11504); - m_delay_19.write(sub_11478); - m_delay_18.write(add_11525); + double noise_1697 = noise(); + double abs_1715 = fabs(noise_1697); + double mul_1721 = (abs_1715 * m_blur_29); + double noise_1698 = noise(); + double abs_1716 = fabs(noise_1698); + double mul_1724 = (abs_1716 * m_blur_29); + double noise_1699 = noise(); + double abs_1717 = fabs(noise_1699); + double mul_1727 = (abs_1717 * m_blur_29); + double noise_1696 = noise(); + double abs_1714 = fabs(noise_1696); + double mul_1718 = (abs_1714 * m_blur_29); + double mul_1770 = (mul_1774 * m_y_2); + double tap_1822 = m_delay_24.read_linear(mul_1922); + double mul_1818 = (tap_1822 * expr_2519); + double mix_2553 = (mul_1818 + (m_damping_27 * (m_history_10 - mul_1818))); + double mix_1820 = mix_2553; + double tap_1828 = m_delay_23.read_linear(mul_1923); + double mul_1824 = (tap_1828 * expr_2520); + double mix_2554 = (mul_1824 + (m_damping_27 * (m_history_9 - mul_1824))); + double mix_1826 = mix_2554; + double tap_1930 = m_delay_22.read_linear(mul_1925); + double mul_1921 = (tap_1930 * expr_2526); + double mix_2555 = (mul_1921 + (m_damping_27 * (m_history_8 - mul_1921))); + double mix_1928 = mix_2555; + double tap_1834 = m_delay_21.read_linear(mul_1924); + double mul_1830 = (tap_1834 * expr_2521); + double mix_2556 = (mul_1830 + (m_damping_27 * (m_history_7 - mul_1830))); + double mix_1832 = mix_2556; + double tap_1867 = m_delay_20.read_linear(mul_1868); + double mul_1865 = (tap_1867 * 0.625); + double add_1812 = (mix_1928 + mix_1832); + double add_1810 = (mix_1826 + mix_1820); + double add_1805 = (add_1812 + add_1810); + double mul_1788 = (add_1805 * 0.5); + double sub_1809 = (add_1812 - add_1810); + double mul_1791 = (sub_1809 * 0.5); + double tap_1893 = m_delay_19.read_linear(mul_1894); + double mul_1891 = (tap_1893 * 0.625); + double sub_1811 = (mix_1928 - mix_1832); + double sub_1808 = (mix_1826 - mix_1820); + double sub_1807 = (sub_1811 - sub_1808); + double mul_1790 = (sub_1807 * 0.5); + double add_1806 = (sub_1811 + sub_1808); + double rsub_1804 = (0 - add_1806); + double mul_1789 = (rsub_1804 * 0.5); + double tap_1836 = m_delay_18.read_linear(add_1851); + double tap_1837 = m_delay_18.read_linear(add_1850); + double tap_1838 = m_delay_18.read_linear(add_1849); + double tap_1839 = m_delay_18.read_linear(add_1848); + double mul_1840 = (tap_1839 * expr_2522); + double add_1813 = (mul_1788 + mul_1840); + double mul_1846 = (tap_1836 * expr_2525); + double add_1816 = (mul_1791 + mul_1846); + double mul_1844 = (tap_1837 * expr_2524); + double add_1815 = (mul_1790 + mul_1844); + double mul_1842 = (tap_1838 * expr_2523); + double add_1814 = (mul_1789 + mul_1842); + double phasor_1766 = m_phasor_38(div_1745, samples_to_seconds); + double add_1744 = ((m_history_6 + phasor_1766) + 0.5); + double mod_1743 = safemod(add_1744, 1); + double delta_1723 = m_delta_39(mod_1743); + double sah_1702 = m_sah_40(mul_1721, delta_1723, 0); + double sah_1722 = m_sah_41(mstosamps_1760, delta_1723, 0); + double mul_1711 = (sah_1722 * mod_1743); + double sub_1742 = (mod_1743 - 0.5); + double mul_1741 = (sub_1742 * 3.1415926535898); + double cos_1740 = cos(mul_1741); + double mul_1730 = (cos_1740 * cos_1740); + double add_1759 = ((m_history_5 + phasor_1766) + 0.25); + double mod_1758 = safemod(add_1759, 1); + double delta_1726 = m_delta_42(mod_1758); + double sah_1704 = m_sah_43(mul_1724, delta_1726, 0); + double sah_1725 = m_sah_44(mstosamps_1760, delta_1726, 0); + double mul_1712 = (sah_1725 * mod_1758); + double sub_1757 = (mod_1758 - 0.5); + double mul_1756 = (sub_1757 * 3.1415926535898); + double cos_1755 = cos(mul_1756); + double mul_1731 = (cos_1755 * cos_1755); + double add_1765 = ((m_history_4 + phasor_1766) + 0); + double mod_1764 = safemod(add_1765, 1); + double delta_1707 = m_delta_45(mod_1764); + double sah_1706 = m_sah_46(mul_1727, delta_1707, 0); + double sah_1728 = m_sah_47(mstosamps_1760, delta_1707, 0); + double mul_1713 = (sah_1728 * mod_1764); + double sub_1763 = (mod_1764 - 0.5); + double mul_1762 = (sub_1763 * 3.1415926535898); + double cos_1761 = cos(mul_1762); + double mul_1732 = (cos_1761 * cos_1761); + double add_1738 = ((m_history_3 + phasor_1766) + 0.75); + double mod_1737 = safemod(add_1738, 1); + double delta_1720 = m_delta_48(mod_1737); + double sah_1700 = m_sah_49(mul_1718, delta_1720, 0); + double sah_1719 = m_sah_50(mstosamps_1760, delta_1720, 0); + double mul_1710 = (sah_1719 * mod_1737); + double tap_1751 = m_delay_17.read_linear(mul_1713); + double tap_1752 = m_delay_17.read_linear(mul_1712); + double tap_1753 = m_delay_17.read_linear(mul_1711); + double tap_1754 = m_delay_17.read_linear(mul_1710); + double mul_1739 = (tap_1753 * mul_1730); + double mul_1748 = (tap_1752 * mul_1731); + double mul_1749 = (tap_1751 * mul_1732); + double sub_1736 = (mod_1737 - 0.5); + double mul_1735 = (sub_1736 * 3.1415926535898); + double cos_1734 = cos(mul_1735); + double mul_1729 = (cos_1734 * cos_1734); + double mul_1733 = (tap_1754 * mul_1729); + double mul_1771 = ((((mul_1749 + mul_1748) + mul_1739) + mul_1733) * add_1772); + double sub_1768 = (mul_1771 - (m_y_11 + mul_1770)); + double mix_2557 = (in1 + (m_shift_25 * (sub_1768 - in1))); + double mix_1709 = mix_2557; + double mul_1782 = (mix_1709 * 0.707); + double mix_2558 = (mul_1782 + (rsub_1933 * (m_history_1 - mul_1782))); + double mix_1932 = mix_2558; + double tap_1916 = m_delay_16.read_linear(mul_1917); + double tap_1874 = m_delay_15.read_linear(mul_1875); + double mul_1872 = (tap_1874 * 0.625); + double mul_1914 = (tap_1916 * 0.75); + double sub_1913 = (mix_1932 - mul_1914); + double mul_1912 = (sub_1913 * 0.75); + double add_1911 = (mul_1912 + tap_1916); + double tap_1900 = m_delay_14.read_linear(mul_1901); + double mul_1898 = (tap_1900 * 0.625); + double tap_1881 = m_delay_13.read_linear(mul_1882); + double mul_1879 = (tap_1881 * 0.75); + double tap_1909 = m_delay_12.read_linear(mul_1910); + double mul_1907 = (tap_1909 * 0.75); + double mul_1803 = (mul_1791 * m_tail_34); + double mul_1801 = (mul_1789 * m_tail_34); + double add_1787 = (mul_1803 + mul_1801); + double mul_1802 = (mul_1790 * m_tail_34); + double mul_1800 = (mul_1788 * m_tail_34); + double add_1786 = (mul_1802 + mul_1800); + double sub_1795 = (add_1787 - add_1786); + double mul_1799 = (mul_1846 * m_early_35); + double mul_1797 = (mul_1842 * m_early_35); + double add_1785 = (mul_1799 + mul_1797); + double mul_1798 = (mul_1844 * m_early_35); + double mul_1796 = (mul_1840 * m_early_35); + double add_1784 = (mul_1798 + mul_1796); + double sub_1794 = (add_1785 - add_1784); + double add_1781 = (sub_1795 + sub_1794); + double add_1783 = (add_1781 + mix_1709); + double sub_1878 = (add_1783 - mul_1879); + double mul_1877 = (sub_1878 * 0.75); + double add_1876 = (mul_1877 + tap_1881); + double sub_1871 = (add_1876 - mul_1872); + double mul_1870 = (sub_1871 * 0.625); + double add_1869 = (mul_1870 + tap_1874); + double sub_1864 = (add_1869 - mul_1865); + double mul_1863 = (sub_1864 * 0.625); + double add_1862 = (mul_1863 + tap_1867); + double mul_1780 = (add_1862 * m_mix_36); + double out2 = (mul_1780 + in1); + double add_1793 = (add_1781 + mix_1709); + double sub_1906 = (add_1793 - mul_1907); + double mul_1905 = (sub_1906 * 0.75); + double add_1904 = (mul_1905 + tap_1909); + double sub_1897 = (add_1904 - mul_1898); + double mul_1896 = (sub_1897 * 0.625); + double add_1895 = (mul_1896 + tap_1900); + double sub_1890 = (add_1895 - mul_1891); + double mul_1889 = (sub_1890 * 0.625); + double add_1888 = (mul_1889 + tap_1893); + double mul_1792 = (add_1888 * m_mix_36); + double out1 = (mul_1792 + in1); + double y2_next_2542 = m_y_2; + double history_1819_next_2543 = mix_1820; + double history_1825_next_2544 = mix_1826; + double history_1927_next_2545 = mix_1928; + double history_1831_next_2546 = mix_1832; + double history_1703_next_2547 = sah_1702; + double history_1705_next_2548 = sah_1704; + double history_1708_next_2549 = sah_1706; + double history_1701_next_2550 = sah_1700; + double y1_next_2551 = sub_1768; + double history_1931_next_2552 = mix_1932; + m_delay_24.write(add_1813); + m_delay_23.write(add_1814); + m_delay_22.write(add_1816); + m_delay_21.write(add_1815); + m_delay_20.write(sub_1864); + m_delay_19.write(sub_1890); + m_delay_18.write(add_1911); m_delay_17.write(in1); - m_delay_16.write(sub_11527); - m_delay_15.write(sub_11511); - m_delay_14.write(sub_11485); - m_delay_13.write(sub_11520); - m_delay_12.write(sub_11492); - m_y_11 = y2_next_11701; - m_history_10 = history_11541_next_11702; - m_history_9 = history_11439_next_11703; - m_history_8 = history_11445_next_11704; - m_history_7 = history_11433_next_11705; - m_history_6 = history_11315_next_11706; - m_history_5 = history_11317_next_11707; - m_history_4 = history_11322_next_11708; - m_history_3 = history_11319_next_11709; - m_y_2 = y1_next_11710; - m_history_1 = history_11545_next_11711; + m_delay_16.write(sub_1913); + m_delay_15.write(sub_1871); + m_delay_14.write(sub_1897); + m_delay_13.write(sub_1878); + m_delay_12.write(sub_1906); + m_y_11 = y2_next_2542; + m_history_10 = history_1819_next_2543; + m_history_9 = history_1825_next_2544; + m_history_8 = history_1927_next_2545; + m_history_7 = history_1831_next_2546; + m_history_6 = history_1703_next_2547; + m_history_5 = history_1705_next_2548; + m_history_4 = history_1708_next_2549; + m_history_3 = history_1701_next_2550; + m_y_2 = y1_next_2551; + m_history_1 = history_1931_next_2552; m_delay_12.step(); m_delay_13.step(); m_delay_14.step(); @@ -445,47 +437,44 @@ typedef struct State { return __exception; }; + inline void set_shift(double _value) { + m_shift_25 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); + }; inline void set_ratio(double _value) { - m_ratio_25 = (_value < 0.5 ? 0.5 : (_value > 2 ? 2 : _value)); + m_ratio_26 = (_value < 0.5 ? 0.5 : (_value > 2 ? 2 : _value)); }; - inline void set_tone(double _value) { - m_tone_26 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); + inline void set_damping(double _value) { + m_damping_27 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_early(double _value) { - m_early_27 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); + inline void set_spread(double _value) { + m_spread_28 = (_value < 0 ? 0 : (_value > 100 ? 100 : _value)); + }; + inline void set_blur(double _value) { + m_blur_29 = (_value < 0.01 ? 0.01 : (_value > 0.25 ? 0.25 : _value)); }; inline void set_roomsize(double _value) { - m_roomsize_28 = (_value < 0.1 ? 0.1 : (_value > 300 ? 300 : _value)); + m_roomsize_30 = (_value < 0.1 ? 0.1 : (_value > 300 ? 300 : _value)); }; inline void set_decay(double _value) { - m_decay_29 = (_value < 0.1 ? 0.1 : (_value > 360 ? 360 : _value)); + m_decay_31 = (_value < 0.1 ? 0.1 : (_value > 360 ? 360 : _value)); }; - inline void set_damping(double _value) { - m_damping_30 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); + inline void set_tone(double _value) { + m_tone_32 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_spread(double _value) { - m_spread_31 = (_value < 0 ? 0 : (_value > 100 ? 100 : _value)); + inline void set_cutoff(double _value) { + m_cutoff_33 = (_value < 0 ? 0 : (_value > 6000 ? 6000 : _value)); }; inline void set_tail(double _value) { - m_tail_32 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); + m_tail_34 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; - inline void set_blur(double _value) { - m_blur_33 = (_value < 0 ? 0 : (_value > 0.25 ? 0.25 : _value)); + inline void set_early(double _value) { + m_early_35 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; inline void set_mix(double _value) { - m_mix_34 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); - }; - inline void set_resonance(double _value) { - m_resonance_35 = (_value < 0 ? 0 : (_value > 0.5 ? 0.5 : _value)); - }; - inline void set_cutoff(double _value) { - m_cutoff_36 = (_value < 0 ? 0 : (_value > 8000 ? 8000 : _value)); - }; - inline void set_shift(double _value) { - m_shift_37 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); + m_mix_36 = (_value < 0 ? 0 : (_value > 1 ? 1 : _value)); }; inline void set_window(double _value) { - m_window_38 = (_value < 0.1 ? 0.1 : (_value > 1000 ? 1000 : _value)); + m_window_37 = (_value < 0.1 ? 0.1 : (_value > 1000 ? 1000 : _value)); }; } State; @@ -502,7 +491,7 @@ int gen_kernel_numouts = 2; int num_inputs() { return gen_kernel_numins; } int num_outputs() { return gen_kernel_numouts; } -int num_params() { return 14; } +int num_params() { return 13; } /// Assistive lables for the signal inputs and outputs @@ -528,20 +517,19 @@ void reset(CommonState *cself) { void setparameter(CommonState *cself, long index, double value, void *ref) { State * self = (State *)cself; switch (index) { - case 0: self->set_ratio(value); break; - case 1: self->set_tone(value); break; - case 2: self->set_early(value); break; - case 3: self->set_roomsize(value); break; - case 4: self->set_decay(value); break; - case 5: self->set_damping(value); break; - case 6: self->set_spread(value); break; - case 7: self->set_tail(value); break; - case 8: self->set_blur(value); break; - case 9: self->set_mix(value); break; - case 10: self->set_resonance(value); break; - case 11: self->set_cutoff(value); break; - case 12: self->set_shift(value); break; - case 13: self->set_window(value); break; + case 0: self->set_shift(value); break; + case 1: self->set_ratio(value); break; + case 2: self->set_damping(value); break; + case 3: self->set_spread(value); break; + case 4: self->set_blur(value); break; + case 5: self->set_roomsize(value); break; + case 6: self->set_decay(value); break; + case 7: self->set_tone(value); break; + case 8: self->set_cutoff(value); break; + case 9: self->set_tail(value); break; + case 10: self->set_early(value); break; + case 11: self->set_mix(value); break; + case 12: self->set_window(value); break; default: break; } @@ -552,20 +540,19 @@ void setparameter(CommonState *cself, long index, double value, void *ref) { void getparameter(CommonState *cself, long index, double *value) { State *self = (State *)cself; switch (index) { - case 0: *value = self->m_ratio_25; break; - case 1: *value = self->m_tone_26; break; - case 2: *value = self->m_early_27; break; - case 3: *value = self->m_roomsize_28; break; - case 4: *value = self->m_decay_29; break; - case 5: *value = self->m_damping_30; break; - case 6: *value = self->m_spread_31; break; - case 7: *value = self->m_tail_32; break; - case 8: *value = self->m_blur_33; break; - case 9: *value = self->m_mix_34; break; - case 10: *value = self->m_resonance_35; break; - case 11: *value = self->m_cutoff_36; break; - case 12: *value = self->m_shift_37; break; - case 13: *value = self->m_window_38; break; + case 0: *value = self->m_shift_25; break; + case 1: *value = self->m_ratio_26; break; + case 2: *value = self->m_damping_27; break; + case 3: *value = self->m_spread_28; break; + case 4: *value = self->m_blur_29; break; + case 5: *value = self->m_roomsize_30; break; + case 6: *value = self->m_decay_31; break; + case 7: *value = self->m_tone_32; break; + case 8: *value = self->m_cutoff_33; break; + case 9: *value = self->m_tail_34; break; + case 10: *value = self->m_early_35; break; + case 11: *value = self->m_mix_36; break; + case 12: *value = self->m_window_37; break; default: break; } @@ -583,41 +570,41 @@ void * create(double sr, long vs) { self->__commonstate.numouts = gen_kernel_numouts; self->__commonstate.sr = sr; self->__commonstate.vs = vs; - self->__commonstate.params = (ParamInfo *)genlib_sysmem_newptr(14 * sizeof(ParamInfo)); - self->__commonstate.numparams = 14; - // initialize parameter 0 ("m_ratio_25") + self->__commonstate.params = (ParamInfo *)genlib_sysmem_newptr(13 * sizeof(ParamInfo)); + self->__commonstate.numparams = 13; + // initialize parameter 0 ("m_shift_25") pi = self->__commonstate.params + 0; - pi->name = "ratio"; + pi->name = "shift"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_ratio_25; + pi->defaultvalue = self->m_shift_25; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; pi->inputmax = 1; pi->hasminmax = true; - pi->outputmin = 0.5; - pi->outputmax = 2; + pi->outputmin = 0; + pi->outputmax = 1; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 1 ("m_tone_26") + // initialize parameter 1 ("m_ratio_26") pi = self->__commonstate.params + 1; - pi->name = "tone"; + pi->name = "ratio"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_tone_26; + pi->defaultvalue = self->m_ratio_26; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; pi->inputmax = 1; pi->hasminmax = true; - pi->outputmin = 0; - pi->outputmax = 1; + pi->outputmin = 0.5; + pi->outputmax = 2; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 2 ("m_early_27") + // initialize parameter 2 ("m_damping_27") pi = self->__commonstate.params + 2; - pi->name = "early"; + pi->name = "damping"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_early_27; + pi->defaultvalue = self->m_damping_27; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; @@ -627,67 +614,67 @@ void * create(double sr, long vs) { pi->outputmax = 1; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 3 ("m_roomsize_28") + // initialize parameter 3 ("m_spread_28") pi = self->__commonstate.params + 3; - pi->name = "roomsize"; + pi->name = "spread"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_roomsize_28; + pi->defaultvalue = self->m_spread_28; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; pi->inputmax = 1; pi->hasminmax = true; - pi->outputmin = 0.1; - pi->outputmax = 300; + pi->outputmin = 0; + pi->outputmax = 100; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 4 ("m_decay_29") + // initialize parameter 4 ("m_blur_29") pi = self->__commonstate.params + 4; - pi->name = "decay"; + pi->name = "blur"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_decay_29; + pi->defaultvalue = self->m_blur_29; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; pi->inputmax = 1; pi->hasminmax = true; - pi->outputmin = 0.1; - pi->outputmax = 360; + pi->outputmin = 0.01; + pi->outputmax = 0.25; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 5 ("m_damping_30") + // initialize parameter 5 ("m_roomsize_30") pi = self->__commonstate.params + 5; - pi->name = "damping"; + pi->name = "roomsize"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_damping_30; + pi->defaultvalue = self->m_roomsize_30; pi->defaultref = 0; pi->hasinputminmax = false; 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_spread_31") + // initialize parameter 6 ("m_decay_31") pi = self->__commonstate.params + 6; - pi->name = "spread"; + pi->name = "decay"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_spread_31; + pi->defaultvalue = self->m_decay_31; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; pi->inputmax = 1; pi->hasminmax = true; - pi->outputmin = 0; - pi->outputmax = 100; + pi->outputmin = 0.1; + pi->outputmax = 360; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 7 ("m_tail_32") + // initialize parameter 7 ("m_tone_32") pi = self->__commonstate.params + 7; - pi->name = "tail"; + pi->name = "tone"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_tail_32; + pi->defaultvalue = self->m_tone_32; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; @@ -697,25 +684,25 @@ void * create(double sr, long vs) { pi->outputmax = 1; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 8 ("m_blur_33") + // initialize parameter 8 ("m_cutoff_33") pi = self->__commonstate.params + 8; - pi->name = "blur"; + pi->name = "cutoff"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_blur_33; + pi->defaultvalue = self->m_cutoff_33; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; pi->inputmax = 1; pi->hasminmax = true; pi->outputmin = 0; - pi->outputmax = 0.25; + pi->outputmax = 6000; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 9 ("m_mix_34") + // initialize parameter 9 ("m_tail_34") pi = self->__commonstate.params + 9; - pi->name = "mix"; + pi->name = "tail"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_mix_34; + pi->defaultvalue = self->m_tail_34; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; @@ -725,39 +712,25 @@ void * create(double sr, long vs) { pi->outputmax = 1; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 10 ("m_resonance_35") + // initialize parameter 10 ("m_early_35") pi = self->__commonstate.params + 10; - pi->name = "resonance"; + pi->name = "early"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_resonance_35; + pi->defaultvalue = self->m_early_35; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; pi->inputmax = 1; pi->hasminmax = true; pi->outputmin = 0; - pi->outputmax = 0.5; + pi->outputmax = 1; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 11 ("m_cutoff_36") + // initialize parameter 11 ("m_mix_36") pi = self->__commonstate.params + 11; - pi->name = "cutoff"; - pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_cutoff_36; - pi->defaultref = 0; - pi->hasinputminmax = false; - pi->inputmin = 0; - pi->inputmax = 1; - pi->hasminmax = true; - pi->outputmin = 0; - pi->outputmax = 8000; - pi->exp = 0; - pi->units = ""; // no units defined - // initialize parameter 12 ("m_shift_37") - pi = self->__commonstate.params + 12; - pi->name = "shift"; + pi->name = "mix"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_shift_37; + pi->defaultvalue = self->m_mix_36; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; @@ -767,11 +740,11 @@ void * create(double sr, long vs) { pi->outputmax = 1; pi->exp = 0; pi->units = ""; // no units defined - // initialize parameter 13 ("m_window_38") - pi = self->__commonstate.params + 13; + // initialize parameter 12 ("m_window_37") + pi = self->__commonstate.params + 12; pi->name = "window"; pi->paramtype = GENLIB_PARAMTYPE_FLOAT; - pi->defaultvalue = self->m_window_38; + pi->defaultvalue = self->m_window_37; pi->defaultref = 0; pi->hasinputminmax = false; pi->inputmin = 0; diff --git a/plugins/shiroverb/gen~.shiroverb.maxpat b/plugins/shiroverb/gen~.shiroverb.maxpat index 1692ae1..a2683aa 100644 --- a/plugins/shiroverb/gen~.shiroverb.maxpat +++ b/plugins/shiroverb/gen~.shiroverb.maxpat @@ -108,7 +108,7 @@ "id" : "obj-50", "maxclass" : "flonum", "maximum" : 0.25, - "minimum" : 0.0, + "minimum" : 0.01, "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "float", "bang" ], @@ -116,20 +116,6 @@ "patching_rect" : [ 189.0, 188.0, 50.0, 20.0 ] } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-48", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 369.0, 218.0, 83.0, 18.0 ], - "text" : "resonance $1" - } - } , { "box" : { @@ -151,7 +137,7 @@ "fontsize" : 12.0, "id" : "obj-44", "maxclass" : "flonum", - "maximum" : 12000.0, + "maximum" : 600.0, "minimum" : 0.0, "numinlets" : 1, "numoutlets" : 2, @@ -160,22 +146,6 @@ "patching_rect" : [ 106.0, 188.0, 50.0, 20.0 ] } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-42", - "maxclass" : "flonum", - "maximum" : 0.5, - "minimum" : 0.0, - "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "float", "bang" ], - "parameter_enable" : 0, - "patching_rect" : [ 369.0, 188.0, 50.0, 20.0 ] - } - } , { "box" : { @@ -805,8 +775,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 931.0, 768.0, 183.0, 20.0 ], - "text" : "param shift 1. @min 0. @max 1." + "patching_rect" : [ 931.0, 768.0, 190.0, 20.0 ], + "text" : "param shift 0.5 @min 0. @max 1." } } @@ -931,8 +901,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 1225.0, 91.0, 194.0, 20.0 ], - "text" : "param blur 0. @min 0. @max 0.25" + "patching_rect" : [ 1225.0, 91.0, 221.0, 20.0 ], + "text" : "param blur 0.25 @min 0.01 @max 0.25" } } @@ -1636,20 +1606,6 @@ "text" : "-" } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-8", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 696.0, 32.5, 20.0 ], - "text" : "*" - } - } , { "box" : { @@ -1720,20 +1676,6 @@ "text" : "+ 1" } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-21", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 596.0, 32.5, 20.0 ], - "text" : "*" - } - } , { "box" : { @@ -1748,20 +1690,6 @@ "text" : "* -2" } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-19", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1378.25, 566.0, 32.5, 20.0 ], - "text" : "*" - } - } , { "box" : { @@ -1776,90 +1704,18 @@ "text" : "cos" } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-18", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 536.0, 70.0, 20.0 ], - "text" : "* 0.882497" - } - - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-24", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 486.0, 50.0, 20.0 ], - "text" : "* 0.125" - } - - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-29", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 511.0, 30.0, 20.0 ], - "text" : "exp" - } - - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-36", - "linecount" : 2, - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 448.0, 127.0, 33.0 ], - "text" : "param resonance 0. @min 0. @max 0.5" - } - } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-38", - "linecount" : 2, "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 1318.25, 448.0, 137.0, 33.0 ], - "text" : "param cutoff 8000. @min 0. @max 8000." - } - - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "frgb" : 0.0, - "id" : "obj-307", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 1171.0, 2068.0, 60.0, 20.0 ], - "text" : "Dry mix" + "patching_rect" : [ 1318.25, 448.0, 230.0, 20.0 ], + "text" : "param cutoff 3000. @min 0. @max 6000." } } @@ -1886,8 +1742,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 976.0, 2068.0, 180.0, 20.0 ], - "text" : "param mix 1. @min 0. @max 1." + "patching_rect" : [ 976.0, 2068.0, 193.0, 20.0 ], + "text" : "param mix 0.75 @min 0. @max 1." } } @@ -4016,13 +3872,12 @@ "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-6", - "linecount" : 2, "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 856.0, 1693.0, 132.0, 33.0 ], - "text" : "param spread 23. @min 0. @max 100." + "patching_rect" : [ 856.0, 1693.0, 218.0, 20.0 ], + "text" : "param spread 25. @min 0. @max 100." } } @@ -4031,13 +3886,12 @@ "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-5", - "linecount" : 2, "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 511.0, 1258.0, 137.5, 33.0 ], - "text" : "param damping 0.7 @min 0. @max 1." + "patching_rect" : [ 511.0, 1258.0, 220.0, 20.0 ], + "text" : "param damping 0.75 @min 0. @max 1." } } @@ -4808,7 +4662,7 @@ } , { "patchline" : { - "destination" : [ "obj-19", 0 ], + "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 1327.75, 560.5, 1387.75, 560.5 ], @@ -5236,36 +5090,6 @@ "source" : [ "obj-179", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-19", 1 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 560.5, 1401.25, 560.5 ], - "source" : [ "obj-18", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-21", 1 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 575.5, 1521.25, 575.5 ], - "source" : [ "obj-18", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-21", 0 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 575.5, 1507.75, 575.5 ], - "source" : [ "obj-18", 0 ] - } - } , { "patchline" : { @@ -5427,15 +5251,6 @@ "source" : [ "obj-188", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-20", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-19", 0 ] - } - } , { "patchline" : { @@ -5671,25 +5486,6 @@ "source" : [ "obj-205", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-22", 0 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 624.5, 1207.75, 624.5 ], - "source" : [ "obj-21", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-8", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-21", 0 ] - } - } , { "patchline" : { @@ -5898,15 +5694,6 @@ "source" : [ "obj-239", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-29", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-24", 0 ] - } - } , { "patchline" : { @@ -5995,9 +5782,10 @@ } , { "patchline" : { - "destination" : [ "obj-8", 1 ], + "destination" : [ "obj-26", 1 ], "disabled" : 0, "hidden" : 0, + "midpoints" : [ 1521.75, 732.0, 1191.25, 732.0 ], "source" : [ "obj-25", 0 ] } @@ -6370,15 +6158,6 @@ "source" : [ "obj-289", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-18", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-29", 0 ] - } - } , { "patchline" : { @@ -6633,15 +6412,6 @@ "source" : [ "obj-35", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-24", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-36", 0 ] - } - } , { "patchline" : { @@ -7257,16 +7027,6 @@ "source" : [ "obj-79", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-26", 1 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 732.0, 1191.25, 732.0 ], - "source" : [ "obj-8", 0 ] - } - } , { "patchline" : { @@ -7470,10 +7230,6 @@ } , "patching_rect" : [ 15.0, 494.0, 150.0, 20.0 ], - "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/Nino/Downloads/untitled folder/untitled folder/" - } -, "text" : "gen~" } @@ -7665,15 +7421,6 @@ "source" : [ "obj-4", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-48", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-42", 0 ] - } - } , { "patchline" : { @@ -7693,16 +7440,6 @@ "source" : [ "obj-46", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-4", 0 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 378.5, 432.0, 24.5, 432.0 ], - "source" : [ "obj-48", 0 ] - } - } , { "patchline" : { @@ -7820,35 +7557,35 @@ "dependency_cache" : [ { "name" : "demosound.maxpat", "bootpath" : "/Applications/Max 6.1/Cycling '74/msp-help", - "patcherrelativepath" : "../../../../../../Applications/Max 6.1/Cycling '74/msp-help", + "patcherrelativepath" : "../../../../../../../Applications/Max 6.1/Cycling '74/msp-help", "type" : "JSON", "implicit" : 1 } , { "name" : "sine.svg", "bootpath" : "/Applications/Max 6.1/patches/picts/m4l-picts", - "patcherrelativepath" : "../../../../../../Applications/Max 6.1/patches/picts/m4l-picts", + "patcherrelativepath" : "../../../../../../../Applications/Max 6.1/patches/picts/m4l-picts", "type" : "svg ", "implicit" : 1 } , { "name" : "saw.svg", "bootpath" : "/Applications/Max 6.1/patches/picts/m4l-picts", - "patcherrelativepath" : "../../../../../../Applications/Max 6.1/patches/picts/m4l-picts", + "patcherrelativepath" : "../../../../../../../Applications/Max 6.1/patches/picts/m4l-picts", "type" : "svg ", "implicit" : 1 } , { "name" : "square.svg", "bootpath" : "/Applications/Max 6.1/patches/picts/m4l-picts", - "patcherrelativepath" : "../../../../../../Applications/Max 6.1/patches/picts/m4l-picts", + "patcherrelativepath" : "../../../../../../../Applications/Max 6.1/patches/picts/m4l-picts", "type" : "svg ", "implicit" : 1 } , { "name" : "random.svg", "bootpath" : "/Applications/Max 6.1/patches/picts/m4l-picts", - "patcherrelativepath" : "../../../../../../Applications/Max 6.1/patches/picts/m4l-picts", + "patcherrelativepath" : "../../../../../../../Applications/Max 6.1/patches/picts/m4l-picts", "type" : "svg ", "implicit" : 1 } diff --git a/plugins/shiroverb/shiroverb.gendsp b/plugins/shiroverb/shiroverb.gendsp index a04d921..adcd688 100644 --- a/plugins/shiroverb/shiroverb.gendsp +++ b/plugins/shiroverb/shiroverb.gendsp @@ -261,8 +261,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 931.0, 768.0, 183.0, 20.0 ], - "text" : "param shift 1. @min 0. @max 1." + "patching_rect" : [ 931.0, 768.0, 190.0, 20.0 ], + "text" : "param shift 0.5 @min 0. @max 1." } } @@ -387,8 +387,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 1225.0, 91.0, 194.0, 20.0 ], - "text" : "param blur 0. @min 0. @max 0.25" + "patching_rect" : [ 1225.0, 91.0, 221.0, 20.0 ], + "text" : "param blur 0.25 @min 0.01 @max 0.25" } } @@ -1092,20 +1092,6 @@ "text" : "-" } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-8", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 696.0, 32.5, 20.0 ], - "text" : "*" - } - } , { "box" : { @@ -1176,20 +1162,6 @@ "text" : "+ 1" } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-21", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 596.0, 32.5, 20.0 ], - "text" : "*" - } - } , { "box" : { @@ -1204,20 +1176,6 @@ "text" : "* -2" } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-19", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1378.25, 566.0, 32.5, 20.0 ], - "text" : "*" - } - } , { "box" : { @@ -1232,90 +1190,18 @@ "text" : "cos" } - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-18", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 536.0, 70.0, 20.0 ], - "text" : "* 0.882497" - } - - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-24", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 486.0, 50.0, 20.0 ], - "text" : "* 0.125" - } - - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-29", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 511.0, 30.0, 20.0 ], - "text" : "exp" - } - - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "id" : "obj-36", - "linecount" : 2, - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 1498.25, 448.0, 127.0, 33.0 ], - "text" : "param resonance 0. @min 0. @max 0.5" - } - } , { "box" : { "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-38", - "linecount" : 2, "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 1318.25, 448.0, 137.0, 33.0 ], - "text" : "param cutoff 8000. @min 0. @max 8000." - } - - } -, { - "box" : { - "fontname" : "Arial", - "fontsize" : 12.0, - "frgb" : 0.0, - "id" : "obj-307", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 1171.0, 2068.0, 60.0, 20.0 ], - "text" : "Dry mix" + "patching_rect" : [ 1318.25, 448.0, 230.0, 20.0 ], + "text" : "param cutoff 3000. @min 0. @max 6000." } } @@ -1342,8 +1228,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 976.0, 2068.0, 180.0, 20.0 ], - "text" : "param mix 1. @min 0. @max 1." + "patching_rect" : [ 976.0, 2068.0, 193.0, 20.0 ], + "text" : "param mix 0.75 @min 0. @max 1." } } @@ -3472,13 +3358,12 @@ "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-6", - "linecount" : 2, "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 856.0, 1693.0, 132.0, 33.0 ], - "text" : "param spread 23. @min 0. @max 100." + "patching_rect" : [ 856.0, 1693.0, 218.0, 20.0 ], + "text" : "param spread 25. @min 0. @max 100." } } @@ -3487,13 +3372,12 @@ "fontname" : "Arial", "fontsize" : 12.0, "id" : "obj-5", - "linecount" : 2, "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 511.0, 1258.0, 137.5, 33.0 ], - "text" : "param damping 0.7 @min 0. @max 1." + "patching_rect" : [ 511.0, 1258.0, 220.0, 20.0 ], + "text" : "param damping 0.75 @min 0. @max 1." } } @@ -4264,7 +4148,7 @@ } , { "patchline" : { - "destination" : [ "obj-19", 0 ], + "destination" : [ "obj-20", 0 ], "disabled" : 0, "hidden" : 0, "midpoints" : [ 1327.75, 560.5, 1387.75, 560.5 ], @@ -4692,36 +4576,6 @@ "source" : [ "obj-179", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-19", 1 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 560.5, 1401.25, 560.5 ], - "source" : [ "obj-18", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-21", 1 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 575.5, 1521.25, 575.5 ], - "source" : [ "obj-18", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-21", 0 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 575.5, 1507.75, 575.5 ], - "source" : [ "obj-18", 0 ] - } - } , { "patchline" : { @@ -4883,15 +4737,6 @@ "source" : [ "obj-188", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-20", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-19", 0 ] - } - } , { "patchline" : { @@ -5127,25 +4972,6 @@ "source" : [ "obj-205", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-22", 0 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 624.5, 1207.75, 624.5 ], - "source" : [ "obj-21", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-8", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-21", 0 ] - } - } , { "patchline" : { @@ -5354,15 +5180,6 @@ "source" : [ "obj-239", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-29", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-24", 0 ] - } - } , { "patchline" : { @@ -5451,9 +5268,10 @@ } , { "patchline" : { - "destination" : [ "obj-8", 1 ], + "destination" : [ "obj-26", 1 ], "disabled" : 0, "hidden" : 0, + "midpoints" : [ 1521.75, 732.0, 1191.25, 732.0 ], "source" : [ "obj-25", 0 ] } @@ -5826,15 +5644,6 @@ "source" : [ "obj-289", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-18", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-29", 0 ] - } - } , { "patchline" : { @@ -6089,15 +5898,6 @@ "source" : [ "obj-35", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-24", 0 ], - "disabled" : 0, - "hidden" : 0, - "source" : [ "obj-36", 0 ] - } - } , { "patchline" : { @@ -6713,16 +6513,6 @@ "source" : [ "obj-79", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-26", 1 ], - "disabled" : 0, - "hidden" : 0, - "midpoints" : [ 1507.75, 732.0, 1191.25, 732.0 ], - "source" : [ "obj-8", 0 ] - } - } , { "patchline" : {