aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/iemlib2/sigLFO_noise.c122
-rw-r--r--src/iemlib2/sigfade.c188
-rw-r--r--src/iemlib2/sigiem_blocksize.c55
-rw-r--r--src/iemlib2/sigiem_samplerate.c55
-rw-r--r--src/iemlib2/sigm2f.c119
5 files changed, 0 insertions, 539 deletions
diff --git a/src/iemlib2/sigLFO_noise.c b/src/iemlib2/sigLFO_noise.c
deleted file mode 100644
index 0547dfe..0000000
--- a/src/iemlib2/sigLFO_noise.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-
-iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
-
-
-#include "m_pd.h"
-#include "iemlib.h"
-
-
-/* -------------------- LFO_noise~ --------------------- */
-/* ---- outputs a 2 point interpolated white noise ----- */
-/* -- with lower cutoff frequency than 0.5 samplerate -- */
-
-static t_class *sigLFO_noise_class;
-
-typedef struct _sigLFO_noise
-{
- t_object x_obj;
- double x_range;
- double x_rcp_range;
- unsigned int x_state;
- t_float x_fact;
- t_float x_incr;
- t_float x_y1;
- t_float x_y2;
- t_float x_phase;
-} t_sigLFO_noise;
-
-static int sigLFO_noise_makeseed(void)
-{
- static unsigned int sigLFO_noise_nextseed = 1489853723;
-
- sigLFO_noise_nextseed = sigLFO_noise_nextseed * 435898247 + 938284287;
- return(sigLFO_noise_nextseed & 0x7fffffff);
-}
-
-static float sigLFO_noise_new_rand(t_sigLFO_noise *x)
-{
- unsigned int state = x->x_state;
- double new_val, range = x->x_range;
-
- x->x_state = state = state * 472940017 + 832416023;
- new_val = range * ((double)state) * (1./4294967296.);
- if(new_val >= range)
- new_val = range-1;
- new_val -= 32767.0;
- return(new_val*(1.0/32767.0));
-}
-
-static void *sigLFO_noise_new(t_float freq)
-{
- t_sigLFO_noise *x = (t_sigLFO_noise *)pd_new(sigLFO_noise_class);
-
- x->x_range = 65535.0;
- x->x_rcp_range = (double)x->x_range * (1.0/4294967296.0);
- x->x_state = sigLFO_noise_makeseed();
- x->x_fact = 2. / 44100.0;
- x->x_incr = freq * x->x_fact;
- if(x->x_incr < 0.0)
- x->x_incr = 0.0;
- else if(x->x_incr > 0.1)
- x->x_incr = 0.1;
- x->x_y1 = sigLFO_noise_new_rand(x);
- x->x_y2 = sigLFO_noise_new_rand(x);
- x->x_phase = 0.0;
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-static t_int *sigLFO_noise_perform(t_int *w)
-{
- t_float *out = (t_float *)(w[1]);
- t_sigLFO_noise *x = (t_sigLFO_noise *)(w[2]);
- int n = (int)(w[3]);
- t_float phase = x->x_phase;
- t_float x_y1 = x->x_y1;
- t_float x_y2 = x->x_y2;
- t_float incr = x->x_incr;
-
- while(n--)
- {
- if(phase > 1.0)
- {
- x_y1 = x_y2;
- x_y2 = sigLFO_noise_new_rand(x);
- phase -= 1.0;
- }
- *out++ = (x_y2 - x_y1) * phase + x_y1;
- phase += incr;
- }
- x->x_phase = phase;
- x->x_y1 = x_y1;
- x->x_y2 = x_y2;
- return (w+4);
-}
-
-static void sigLFO_noise_float(t_sigLFO_noise *x, t_floatarg freq)
-{
- x->x_incr = freq * x->x_fact;
- if(x->x_incr < 0.0)
- x->x_incr = 0.0;
- else if(x->x_incr > 0.1)
- x->x_incr = 0.1;
-}
-
-static void sigLFO_noise_dsp(t_sigLFO_noise *x, t_signal **sp)
-{
- x->x_fact = 2. / sp[0]->s_sr;
- dsp_add(sigLFO_noise_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
-}
-
-void sigLFO_noise_setup(void)
-{
- sigLFO_noise_class = class_new(gensym("LFO_noise~"),
- (t_newmethod)sigLFO_noise_new, 0,
- sizeof(t_sigLFO_noise), 0, A_DEFFLOAT, 0);
- class_addmethod(sigLFO_noise_class, (t_method)sigLFO_noise_dsp,
- gensym("dsp"), 0);
- class_addfloat(sigLFO_noise_class, (t_method)sigLFO_noise_float);
- class_sethelpsymbol(sigLFO_noise_class, gensym("iemhelp/help-LFO_noise~"));
-}
diff --git a/src/iemlib2/sigfade.c b/src/iemlib2/sigfade.c
deleted file mode 100644
index a73a3a7..0000000
--- a/src/iemlib2/sigfade.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-
-iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
-
-#include "m_pd.h"
-#include "iemlib.h"
-#include <math.h>
-
-/* ------------------------- fade~ ----------------------------- */
-/* --- signal lookup tabel object with input range of 0 to 1 --- */
-/* ---- converts a linear signal ramp to the half of a : ------ */
-/* -- sine-wave, hanning-wave, squareroot-wave or mixes of it -- */
-
-float *iem_fade_table_lin=(float *)0L;
-float *iem_fade_table_linsqrt=(float *)0L;
-float *iem_fade_table_sqrt=(float *)0L;
-float *iem_fade_table_sin=(float *)0L;
-float *iem_fade_table_sinhann=(float *)0L;
-float *iem_fade_table_hann=(float *)0L;
-
-static t_class *sigfade_class;
-
-typedef struct _sigfade
-{
- t_object x_obj;
- t_float *x_table;
- t_float x_f;
-} t_sigfade;
-
-static void sigfade_set(t_sigfade *x, t_symbol *s)
-{
- /*if(!strcmp(s->s_name, "_lin"))
- x->x_table = iem_fade_table_lin;
- else if(!strcmp(s->s_name, "_linsqrt"))
- x->x_table = iem_fade_table_linsqrt;
- else if(!strcmp(s->s_name, "_sqrt"))
- x->x_table = iem_fade_table_sqrt;
- else if(!strcmp(s->s_name, "_sin"))
- x->x_table = iem_fade_table_sin;
- else if(!strcmp(s->s_name, "_sinhann"))
- x->x_table = iem_fade_table_sinhann;
- else if(!strcmp(s->s_name, "_hann"))
- x->x_table = iem_fade_table_hann;*/
- if(s == gensym("_lin"))
- x->x_table = iem_fade_table_lin;
- else if(s == gensym("_linsqrt"))
- x->x_table = iem_fade_table_linsqrt;
- else if(s == gensym("_sqrt"))
- x->x_table = iem_fade_table_sqrt;
- else if(s == gensym("_sin"))
- x->x_table = iem_fade_table_sin;
- else if(s == gensym("_sinhann"))
- x->x_table = iem_fade_table_sinhann;
- else if(s == gensym("_hann"))
- x->x_table = iem_fade_table_hann;
-}
-
-static void *sigfade_new(t_symbol *s)
-{
- t_sigfade *x = (t_sigfade *)pd_new(sigfade_class);
- outlet_new(&x->x_obj, gensym("signal"));
- x->x_f = 0;
- x->x_table = iem_fade_table_lin;
- sigfade_set(x, s);
- return (x);
-}
-
-static t_int *sigfade_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- t_sigfade *x = (t_sigfade *)(w[3]);
- int n = (int)(w[4]);
- t_float *tab = x->x_table, *addr, f1, f2, frac;
- double dphase;
- int normhipart;
- union tabfudge tf;
-
- tf.tf_d = UNITBIT32;
- normhipart = tf.tf_i[HIOFFSET];
-
-#if 0 /* this is the readable version of the code. */
- while (n--)
- {
- dphase = (double)(*in++ * (t_float)(COSTABSIZE) * 0.99999) + UNITBIT32;
- tf.tf_d = dphase;
- addr = tab + (tf.tf_i[HIOFFSET] & (COSTABSIZE-1));
- tf.tf_i[HIOFFSET] = normhipart;
- frac = tf.tf_d - UNITBIT32;
- f1 = addr[0];
- f2 = addr[1];
- *out++ = f1 + frac * (f2 - f1);
- }
-#endif
-#if 1 /* this is the same, unwrapped by hand. */
- dphase = (double)(*in++ * (t_float)(COSTABSIZE) * 0.99999) + UNITBIT32;
- tf.tf_d = dphase;
- addr = tab + (tf.tf_i[HIOFFSET] & (COSTABSIZE-1));
- tf.tf_i[HIOFFSET] = normhipart;
- while (--n)
- {
- dphase = (double)(*in++ * (t_float)(COSTABSIZE) * 0.99999) + UNITBIT32;
- frac = tf.tf_d - UNITBIT32;
- tf.tf_d = dphase;
- f1 = addr[0];
- f2 = addr[1];
- addr = tab + (tf.tf_i[HIOFFSET] & (COSTABSIZE-1));
- *out++ = f1 + frac * (f2 - f1);
- tf.tf_i[HIOFFSET] = normhipart;
- }
- frac = tf.tf_d - UNITBIT32;
- f1 = addr[0];
- f2 = addr[1];
- *out++ = f1 + frac * (f2 - f1);
-#endif
- return (w+5);
-}
-
-static void sigfade_dsp(t_sigfade *x, t_signal **sp)
-{
- dsp_add(sigfade_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
-}
-
-static void sigfade_maketable(void)
-{
- int i;
- t_float *fp, phase, fff,phsinc = 0.5*3.141592653 / ((t_float)COSTABSIZE*0.99999);
- union tabfudge tf;
-
- if(!iem_fade_table_sin)
- {
- iem_fade_table_sin = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
- for(i=COSTABSIZE+1, fp=iem_fade_table_sin, phase=0; i--; fp++, phase+=phsinc)
- *fp = sin(phase);
- }
- if(!iem_fade_table_sinhann)
- {
- iem_fade_table_sinhann = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
- for(i=COSTABSIZE+1, fp=iem_fade_table_sinhann, phase=0; i--; fp++, phase+=phsinc)
- {
- fff = sin(phase);
- *fp = fff*sqrt(fff);
- }
- }
- if(!iem_fade_table_hann)
- {
- iem_fade_table_hann = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
- for(i=COSTABSIZE+1, fp=iem_fade_table_hann, phase=0; i--; fp++, phase+=phsinc)
- {
- fff = sin(phase);
- *fp = fff*fff;
- }
- }
- phsinc = 1.0 / ((t_float)COSTABSIZE*0.99999);
- if(!iem_fade_table_lin)
- {
- iem_fade_table_lin = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
- for(i=COSTABSIZE+1, fp=iem_fade_table_lin, phase=0; i--; fp++, phase+=phsinc)
- *fp = phase;
- }
- if(!iem_fade_table_linsqrt)
- {
- iem_fade_table_linsqrt = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
- for(i=COSTABSIZE+1, fp=iem_fade_table_linsqrt, phase=0; i--; fp++, phase+=phsinc)
- *fp = pow(phase, 0.75);
- }
- if(!iem_fade_table_sqrt)
- {
- iem_fade_table_sqrt = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
- for(i=COSTABSIZE+1, fp=iem_fade_table_sqrt, phase=0; i--; fp++, phase+=phsinc)
- *fp = sqrt(phase);
- }
- tf.tf_d = UNITBIT32 + 0.5;
- if((unsigned)tf.tf_i[LOWOFFSET] != 0x80000000)
- bug("fade~: unexpected machine alignment");
-}
-
-void sigfade_setup(void)
-{
- sigfade_class = class_new(gensym("fade~"), (t_newmethod)sigfade_new, 0,
- sizeof(t_sigfade), 0, A_DEFSYM, 0);
- CLASS_MAINSIGNALIN(sigfade_class, t_sigfade, x_f);
- class_addmethod(sigfade_class, (t_method)sigfade_dsp, gensym("dsp"), 0);
- class_addmethod(sigfade_class, (t_method)sigfade_set, gensym("set"), A_DEFSYM, 0);
- class_sethelpsymbol(sigfade_class, gensym("iemhelp/help-fade~"));
- sigfade_maketable();
-}
diff --git a/src/iemlib2/sigiem_blocksize.c b/src/iemlib2/sigiem_blocksize.c
deleted file mode 100644
index 46ba275..0000000
--- a/src/iemlib2/sigiem_blocksize.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-
-iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
-
-
-#include "m_pd.h"
-#include "iemlib.h"
-
-/* ------------------- iem_blocksize~ -------------------- */
-/* -- outputs the current signal-blocksize of a window --- */
-
-static t_class *sigiem_blocksize_class;
-
-typedef struct _sigiem_blocksize
-{
- t_object x_obj;
- t_float x_blocksize;
- t_clock *x_clock;
- t_float x_f;
-} t_sigiem_blocksize;
-
-static void sigiem_blocksize_out(t_sigiem_blocksize *x)
-{
- outlet_float(x->x_obj.ob_outlet, x->x_blocksize);
-}
-
-static void sigiem_blocksize_free(t_sigiem_blocksize *x)
-{
- clock_free(x->x_clock);
-}
-
-static void *sigiem_blocksize_new(t_symbol *s)
-{
- t_sigiem_blocksize *x = (t_sigiem_blocksize *)pd_new(sigiem_blocksize_class);
- x->x_clock = clock_new(x, (t_method)sigiem_blocksize_out);
- outlet_new(&x->x_obj, &s_float);
- x->x_blocksize = 64.0f;
- x->x_f = 0.0f;
- return (x);
-}
-
-static void sigiem_blocksize_dsp(t_sigiem_blocksize *x, t_signal **sp)
-{
- x->x_blocksize = (t_float)(sp[0]->s_n);
- clock_delay(x->x_clock, 0.0f);
-}
-
-void sigiem_blocksize_setup(void)
-{
- sigiem_blocksize_class = class_new(gensym("iem_blocksize~"), (t_newmethod)sigiem_blocksize_new,
- (t_method)sigiem_blocksize_free, sizeof(t_sigiem_blocksize), 0, 0);
- CLASS_MAINSIGNALIN(sigiem_blocksize_class, t_sigiem_blocksize, x_f);
- class_addmethod(sigiem_blocksize_class, (t_method)sigiem_blocksize_dsp, gensym("dsp"), 0);
-}
diff --git a/src/iemlib2/sigiem_samplerate.c b/src/iemlib2/sigiem_samplerate.c
deleted file mode 100644
index 7f9e86b..0000000
--- a/src/iemlib2/sigiem_samplerate.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-
-iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
-
-
-#include "m_pd.h"
-#include "iemlib.h"
-
-/* --------------- iem_samplerate~ ----------------- */
-/* -- outputs the current samplerate of a window --- */
-
-static t_class *sigiem_samplerate_class;
-
-typedef struct _sigiem_samplerate
-{
- t_object x_obj;
- t_float x_samplerate;
- t_clock *x_clock;
- t_float x_f;
-} t_sigiem_samplerate;
-
-static void sigiem_samplerate_out(t_sigiem_samplerate *x)
-{
- outlet_float(x->x_obj.ob_outlet, x->x_samplerate);
-}
-
-static void sigiem_samplerate_free(t_sigiem_samplerate *x)
-{
- clock_free(x->x_clock);
-}
-
-static void *sigiem_samplerate_new(t_symbol *s)
-{
- t_sigiem_samplerate *x = (t_sigiem_samplerate *)pd_new(sigiem_samplerate_class);
- x->x_clock = clock_new(x, (t_method)sigiem_samplerate_out);
- outlet_new(&x->x_obj, &s_float);
- x->x_samplerate = 44100.0f;
- x->x_f = 0.0f;
- return (x);
-}
-
-static void sigiem_samplerate_dsp(t_sigiem_samplerate *x, t_signal **sp)
-{
- x->x_samplerate = (t_float)(sp[0]->s_sr);
- clock_delay(x->x_clock, 0.0f);
-}
-
-void sigiem_samplerate_setup(void)
-{
- sigiem_samplerate_class = class_new(gensym("iem_samplerate~"), (t_newmethod)sigiem_samplerate_new,
- (t_method)sigiem_samplerate_free, sizeof(t_sigiem_samplerate), 0, 0);
- CLASS_MAINSIGNALIN(sigiem_samplerate_class, t_sigiem_samplerate, x_f);
- class_addmethod(sigiem_samplerate_class, (t_method)sigiem_samplerate_dsp, gensym("dsp"), 0);
-}
diff --git a/src/iemlib2/sigm2f.c b/src/iemlib2/sigm2f.c
deleted file mode 100644
index e6d3c26..0000000
--- a/src/iemlib2/sigm2f.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
-* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-
-iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
-
-
-#include "m_pd.h"
-#include "iemlib.h"
-#include <math.h>
-
-/* ----------- m2f~ ----------- */
-/* --------- obsolete --------- */
-
-#define M2FTABSIZE 2048
-
-t_float *iem_m2f_table=(t_float *)0L;
-
-static t_class *sigm2f_class;
-
-typedef struct _sigm2f
-{
- t_object x_obj;
- t_float x_msi;
-} t_sigm2f;
-
-static void *sigm2f_new(void)
-{
- t_sigm2f *x = (t_sigm2f *)pd_new(sigm2f_class);
- outlet_new(&x->x_obj, gensym("signal"));
- x->x_msi = 0;
- return (x);
-}
-
-static t_int *sigm2f_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- t_sigm2f *x = (t_sigm2f *)(w[3]);
- int n = (int)(w[4]);
- t_float *tab = iem_m2f_table, *addr, f1, f2, frac, iinn;
- double dphase;
- int normhipart;
- union tabfudge tf;
-
- tf.tf_d = UNITBIT32;
- normhipart = tf.tf_i[HIOFFSET];
-
-#if 0 /* this is the readable version of the code. */
- while (n--)
- {
- iinn = (*in++)*10.0+670.0;
- dphase = (double)iinn + UNITBIT32;
- tf.tf_d = dphase;
- addr = tab + (tf.tf_i[HIOFFSET] & (M2FTABSIZE-1));
- tf.tf_i[HIOFFSET] = normhipart;
- frac = tf.tf_d - UNITBIT32;
- f1 = addr[0];
- f2 = addr[1];
- *out++ = f1 + frac * (f2 - f1);
- }
-#endif
-#if 1 /* this is the same, unwrapped by hand. */
- iinn = (*in++)*10.0+670.0;
- dphase = (double)iinn + UNITBIT32;
- tf.tf_d = dphase;
- addr = tab + (tf.tf_i[HIOFFSET] & (M2FTABSIZE-1));
- tf.tf_i[HIOFFSET] = normhipart;
- while (--n)
- {
- iinn = (*in++)*10.0+670.0;
- dphase = (double)iinn + UNITBIT32;
- frac = tf.tf_d - UNITBIT32;
- tf.tf_d = dphase;
- f1 = addr[0];
- f2 = addr[1];
- addr = tab + (tf.tf_i[HIOFFSET] & (M2FTABSIZE-1));
- *out++ = f1 + frac * (f2 - f1);
- tf.tf_i[HIOFFSET] = normhipart;
- }
- frac = tf.tf_d - UNITBIT32;
- f1 = addr[0];
- f2 = addr[1];
- *out++ = f1 + frac * (f2 - f1);
-#endif
- return (w+5);
-}
-
-static void sigm2f_dsp(t_sigm2f *x, t_signal **sp)
-{
- dsp_add(sigm2f_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
-}
-
-static void sigm2f_maketable(void)
-{
- union tabfudge tf;
-
- if(!iem_m2f_table)
- {
- int i;
- t_float *fp, midi, refexp=440.0*exp(-5.75*log(2.0));
-
- iem_m2f_table = (t_float *)getbytes(sizeof(t_float) * (M2FTABSIZE+1));
- for(i=0, fp=iem_m2f_table, midi=-67.0; i<=M2FTABSIZE; i++, fp++, midi+=0.1)
- *fp = refexp * exp(0.057762265047 * midi);
- }
- tf.tf_d = UNITBIT32 + 0.5;
- if((unsigned)tf.tf_i[LOWOFFSET] != 0x80000000)
- bug("m2f~: unexpected machine alignment");
-}
-
-void sigm2f_setup(void)
-{
- sigm2f_class = class_new(gensym("m2f~"), (t_newmethod)sigm2f_new, 0,
- sizeof(t_sigm2f), 0, 0);
- CLASS_MAINSIGNALIN(sigm2f_class, t_sigm2f, x_msi);
- class_addmethod(sigm2f_class, (t_method)sigm2f_dsp, gensym("dsp"), 0);
- sigm2f_maketable();
- class_sethelpsymbol(sigm2f_class, gensym("iemhelp/help-m2f~"));
-}