aboutsummaryrefslogtreecommitdiff
path: root/src/iemlib2
diff options
context:
space:
mode:
Diffstat (limited to 'src/iemlib2')
-rw-r--r--src/iemlib2/LFO_noise~.c122
-rw-r--r--src/iemlib2/fade~.c176
-rw-r--r--src/iemlib2/iem_blocksize~.c55
-rw-r--r--src/iemlib2/iem_samplerate~.c55
-rw-r--r--src/iemlib2/iemlib2.c20
-rw-r--r--src/iemlib2/m2f~.c119
-rw-r--r--src/iemlib2/makefile_linux10
-rw-r--r--src/iemlib2/makefile_win11
8 files changed, 547 insertions, 21 deletions
diff --git a/src/iemlib2/LFO_noise~.c b/src/iemlib2/LFO_noise~.c
new file mode 100644
index 0000000..95316a2
--- /dev/null
+++ b/src/iemlib2/LFO_noise~.c
@@ -0,0 +1,122 @@
+/* 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 *LFO_noise_tilde_class;
+
+typedef struct _LFO_noise_tilde
+{
+ 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_LFO_noise_tilde;
+
+static int LFO_noise_makeseed(void)
+{
+ static unsigned int LFO_noise_nextseed = 1489853723;
+
+ LFO_noise_nextseed = LFO_noise_nextseed * 435898247 + 938284287;
+ return(LFO_noise_nextseed & 0x7fffffff);
+}
+
+static float LFO_noise_new_rand(t_LFO_noise_tilde *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 *LFO_noise_new(t_float freq)
+{
+ t_LFO_noise_tilde *x = (t_LFO_noise_tilde *)pd_new(LFO_noise_tilde_class);
+
+ x->x_range = 65535.0;
+ x->x_rcp_range = (double)x->x_range * (1.0/4294967296.0);
+ x->x_state = LFO_noise_makeseed();
+ x->x_fact = 2.0f / 44100.0f;
+ x->x_incr = freq * x->x_fact;
+ if(x->x_incr < 0.0f)
+ x->x_incr = 0.0f;
+ else if(x->x_incr > 0.1f)
+ x->x_incr = 0.1f;
+ x->x_y1 = LFO_noise_new_rand(x);
+ x->x_y2 = LFO_noise_new_rand(x);
+ x->x_phase = 0.0f;
+ outlet_new(&x->x_obj, gensym("signal"));
+ return (x);
+}
+
+static t_int *LFO_noise_perform(t_int *w)
+{
+ t_float *out = (t_float *)(w[1]);
+ t_LFO_noise_tilde *x = (t_LFO_noise_tilde *)(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.0f)
+ {
+ x_y1 = x_y2;
+ x_y2 = LFO_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 LFO_noise_float(t_LFO_noise_tilde *x, t_floatarg freq)
+{
+ x->x_incr = freq * x->x_fact;
+ if(x->x_incr < 0.0f)
+ x->x_incr = 0.0f;
+ else if(x->x_incr > 0.1f)
+ x->x_incr = 0.1f;
+}
+
+static void LFO_noise_dsp(t_LFO_noise_tilde *x, t_signal **sp)
+{
+ x->x_fact = 2.0f / sp[0]->s_sr;
+ dsp_add(LFO_noise_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+void LFO_noise_tilde_setup(void)
+{
+ LFO_noise_tilde_class = class_new(gensym("LFO_noise~"),
+ (t_newmethod)LFO_noise_new, 0,
+ sizeof(t_LFO_noise_tilde), 0, A_DEFFLOAT, 0);
+ class_addmethod(LFO_noise_tilde_class, (t_method)LFO_noise_dsp,
+ gensym("dsp"), 0);
+ class_addfloat(LFO_noise_tilde_class, (t_method)LFO_noise_float);
+ class_sethelpsymbol(LFO_noise_tilde_class, gensym("iemhelp/help-LFO_noise~"));
+}
diff --git a/src/iemlib2/fade~.c b/src/iemlib2/fade~.c
new file mode 100644
index 0000000..2cae70d
--- /dev/null
+++ b/src/iemlib2/fade~.c
@@ -0,0 +1,176 @@
+/* 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 -- */
+
+t_float *iem_fade_tilde_table_lin=(t_float *)0L;
+t_float *iem_fade_tilde_table_linsqrt=(t_float *)0L;
+t_float *iem_fade_tilde_table_sqrt=(t_float *)0L;
+t_float *iem_fade_tilde_table_sin=(t_float *)0L;
+t_float *iem_fade_tilde_table_sinhann=(t_float *)0L;
+t_float *iem_fade_tilde_table_hann=(t_float *)0L;
+
+static t_class *fade_tilde_class;
+
+typedef struct _fade
+{
+ t_object x_obj;
+ t_float *x_table;
+ t_float x_f;
+} t_fade_tilde;
+
+static void fade_set(t_fade_tilde *x, t_symbol *s)
+{
+ if(s == gensym("_lin"))
+ x->x_table = iem_fade_tilde_table_lin;
+ else if(s == gensym("_linsqrt"))
+ x->x_table = iem_fade_tilde_table_linsqrt;
+ else if(s == gensym("_sqrt"))
+ x->x_table = iem_fade_tilde_table_sqrt;
+ else if(s == gensym("_sin"))
+ x->x_table = iem_fade_tilde_table_sin;
+ else if(s == gensym("_sinhann"))
+ x->x_table = iem_fade_tilde_table_sinhann;
+ else if(s == gensym("_hann"))
+ x->x_table = iem_fade_tilde_table_hann;
+}
+
+static void *fade_new(t_symbol *s)
+{
+ t_fade_tilde *x = (t_fade_tilde *)pd_new(fade_tilde_class);
+ outlet_new(&x->x_obj, gensym("signal"));
+ x->x_f = 0;
+ x->x_table = iem_fade_tilde_table_lin;
+ fade_set(x, s);
+ return (x);
+}
+
+static t_int *fade_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_float *out = (t_float *)(w[2]);
+ t_fade_tilde *x = (t_fade_tilde *)(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 fade_dsp(t_fade_tilde *x, t_signal **sp)
+{
+ dsp_add(fade_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
+}
+
+static void fade_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_tilde_table_sin)
+ {
+ iem_fade_tilde_table_sin = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
+ for(i=COSTABSIZE+1, fp=iem_fade_tilde_table_sin, phase=0; i--; fp++, phase+=phsinc)
+ *fp = sin(phase);
+ }
+ if(!iem_fade_tilde_table_sinhann)
+ {
+ iem_fade_tilde_table_sinhann = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
+ for(i=COSTABSIZE+1, fp=iem_fade_tilde_table_sinhann, phase=0; i--; fp++, phase+=phsinc)
+ {
+ fff = sin(phase);
+ *fp = fff*sqrt(fff);
+ }
+ }
+ if(!iem_fade_tilde_table_hann)
+ {
+ iem_fade_tilde_table_hann = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
+ for(i=COSTABSIZE+1, fp=iem_fade_tilde_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_tilde_table_lin)
+ {
+ iem_fade_tilde_table_lin = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
+ for(i=COSTABSIZE+1, fp=iem_fade_tilde_table_lin, phase=0; i--; fp++, phase+=phsinc)
+ *fp = phase;
+ }
+ if(!iem_fade_tilde_table_linsqrt)
+ {
+ iem_fade_tilde_table_linsqrt = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
+ for(i=COSTABSIZE+1, fp=iem_fade_tilde_table_linsqrt, phase=0; i--; fp++, phase+=phsinc)
+ *fp = pow(phase, 0.75);
+ }
+ if(!iem_fade_tilde_table_sqrt)
+ {
+ iem_fade_tilde_table_sqrt = (t_float *)getbytes(sizeof(t_float) * (COSTABSIZE+1));
+ for(i=COSTABSIZE+1, fp=iem_fade_tilde_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 fade_tilde_setup(void)
+{
+ fade_tilde_class = class_new(gensym("fade~"), (t_newmethod)fade_new, 0,
+ sizeof(t_fade_tilde), 0, A_DEFSYM, 0);
+ CLASS_MAINSIGNALIN(fade_tilde_class, t_fade_tilde, x_f);
+ class_addmethod(fade_tilde_class, (t_method)fade_dsp, gensym("dsp"), 0);
+ class_addmethod(fade_tilde_class, (t_method)fade_set, gensym("set"), A_DEFSYM, 0);
+ class_sethelpsymbol(fade_tilde_class, gensym("iemhelp/help-fade~"));
+ fade_maketable();
+}
diff --git a/src/iemlib2/iem_blocksize~.c b/src/iemlib2/iem_blocksize~.c
new file mode 100644
index 0000000..d10110d
--- /dev/null
+++ b/src/iemlib2/iem_blocksize~.c
@@ -0,0 +1,55 @@
+/* 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 *iem_blocksize_tilde_class;
+
+typedef struct _iem_blocksize
+{
+ t_object x_obj;
+ t_float x_blocksize;
+ t_clock *x_clock;
+ t_float x_f;
+} t_iem_blocksize_tilde;
+
+static void iem_blocksize_out(t_iem_blocksize_tilde *x)
+{
+ outlet_float(x->x_obj.ob_outlet, x->x_blocksize);
+}
+
+static void iem_blocksize_free(t_iem_blocksize_tilde *x)
+{
+ clock_free(x->x_clock);
+}
+
+static void *iem_blocksize_new(t_symbol *s)
+{
+ t_iem_blocksize_tilde *x = (t_iem_blocksize_tilde *)pd_new(iem_blocksize_tilde_class);
+ x->x_clock = clock_new(x, (t_method)iem_blocksize_out);
+ outlet_new(&x->x_obj, &s_float);
+ x->x_blocksize = 64.0f;
+ x->x_f = 0.0f;
+ return (x);
+}
+
+static void iem_blocksize_dsp(t_iem_blocksize_tilde *x, t_signal **sp)
+{
+ x->x_blocksize = (t_float)(sp[0]->s_n);
+ clock_delay(x->x_clock, 0.0f);
+}
+
+void iem_blocksize_tilde_setup(void)
+{
+ iem_blocksize_tilde_class = class_new(gensym("iem_blocksize~"), (t_newmethod)iem_blocksize_new,
+ (t_method)iem_blocksize_free, sizeof(t_iem_blocksize_tilde), 0, 0);
+ CLASS_MAINSIGNALIN(iem_blocksize_tilde_class, t_iem_blocksize_tilde, x_f);
+ class_addmethod(iem_blocksize_tilde_class, (t_method)iem_blocksize_dsp, gensym("dsp"), 0);
+}
diff --git a/src/iemlib2/iem_samplerate~.c b/src/iemlib2/iem_samplerate~.c
new file mode 100644
index 0000000..184a66d
--- /dev/null
+++ b/src/iemlib2/iem_samplerate~.c
@@ -0,0 +1,55 @@
+/* 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 *iem_samplerate_tilde_class;
+
+typedef struct _iem_samplerate
+{
+ t_object x_obj;
+ t_float x_samplerate;
+ t_clock *x_clock;
+ t_float x_f;
+} t_iem_samplerate_tilde;
+
+static void iem_samplerate_out(t_iem_samplerate_tilde *x)
+{
+ outlet_float(x->x_obj.ob_outlet, x->x_samplerate);
+}
+
+static void iem_samplerate_free(t_iem_samplerate_tilde *x)
+{
+ clock_free(x->x_clock);
+}
+
+static void *iem_samplerate_new(t_symbol *s)
+{
+ t_iem_samplerate_tilde *x = (t_iem_samplerate_tilde *)pd_new(iem_samplerate_tilde_class);
+ x->x_clock = clock_new(x, (t_method)iem_samplerate_out);
+ outlet_new(&x->x_obj, &s_float);
+ x->x_samplerate = 44100.0f;
+ x->x_f = 0.0f;
+ return (x);
+}
+
+static void iem_samplerate_dsp(t_iem_samplerate_tilde *x, t_signal **sp)
+{
+ x->x_samplerate = (t_float)(sp[0]->s_sr);
+ clock_delay(x->x_clock, 0.0f);
+}
+
+void iem_samplerate_tilde_setup(void)
+{
+ iem_samplerate_tilde_class = class_new(gensym("iem_samplerate~"), (t_newmethod)iem_samplerate_new,
+ (t_method)iem_samplerate_free, sizeof(t_iem_samplerate_tilde), 0, 0);
+ CLASS_MAINSIGNALIN(iem_samplerate_tilde_class, t_iem_samplerate_tilde, x_f);
+ class_addmethod(iem_samplerate_tilde_class, (t_method)iem_samplerate_dsp, gensym("dsp"), 0);
+}
diff --git a/src/iemlib2/iemlib2.c b/src/iemlib2/iemlib2.c
index 3b31b4a..5af4826 100644
--- a/src/iemlib2/iemlib2.c
+++ b/src/iemlib2/iemlib2.c
@@ -20,18 +20,23 @@ void add2_comma_setup(void);
void bpe_setup(void);
void dollarg_setup(void);
void exp_inc_setup(void);
+void fade_tilde_setup(void);
void float24_setup(void);
void iem_anything_setup(void);
void iem_append_setup(void);
+void iem_blocksize_tilde_setup(void);
void iem_i_route_setup(void);
void iem_pbank_csv_setup(void);
void iem_prepend_setup(void);
void iem_receive_setup(void);
void iem_route_setup(void);
+void iem_samplerate_tilde_setup(void);
void iem_sel_any_setup(void);
void iem_send_setup(void);
void init_setup(void);
+void LFO_noise_tilde_setup(void);
void list2send_setup(void);
+void m2f_tilde_setup(void);
void mergefilename_setup(void);
void modulo_counter_setup(void);
void parentdollarzero_setup(void);
@@ -41,11 +46,6 @@ void prepend_ascii_setup(void);
void protect_against_open_setup(void);
void receive2list_setup(void);
void round_zero_setup(void);
-void sigfade_setup(void);
-void sigiem_blocksize_setup(void);
-void sigiem_samplerate_setup(void);
-void sigLFO_noise_setup(void);
-void sigm2f_setup(void);
void speedlim_setup(void);
void splitfilename_setup(void);
void stripfilename_setup(void);
@@ -64,18 +64,23 @@ void iemlib2_setup(void)
bpe_setup();
dollarg_setup();
exp_inc_setup();
+ fade_tilde_setup();
float24_setup();
iem_anything_setup();
iem_append_setup();
+ iem_blocksize_tilde_setup();
iem_i_route_setup();
iem_pbank_csv_setup();
iem_prepend_setup();
iem_receive_setup();
iem_route_setup();
+ iem_samplerate_tilde_setup();
iem_sel_any_setup();
iem_send_setup();
init_setup();
+ LFO_noise_tilde_setup();
list2send_setup();
+ m2f_tilde_setup();
mergefilename_setup();
modulo_counter_setup();
parentdollarzero_setup();
@@ -85,11 +90,6 @@ void iemlib2_setup(void)
protect_against_open_setup();
receive2list_setup();
round_zero_setup();
- sigfade_setup();
- sigiem_blocksize_setup();
- sigiem_samplerate_setup();
- sigLFO_noise_setup();
- sigm2f_setup();
speedlim_setup();
splitfilename_setup();
stripfilename_setup();
diff --git a/src/iemlib2/m2f~.c b/src/iemlib2/m2f~.c
new file mode 100644
index 0000000..7139d87
--- /dev/null
+++ b/src/iemlib2/m2f~.c
@@ -0,0 +1,119 @@
+/* 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_tilde_table=(t_float *)0L;
+
+static t_class *m2f_tilde_class;
+
+typedef struct _m2f
+{
+ t_object x_obj;
+ t_float x_msi;
+} t_m2f_tilde;
+
+static void *m2f_new(void)
+{
+ t_m2f_tilde *x = (t_m2f_tilde *)pd_new(m2f_tilde_class);
+ outlet_new(&x->x_obj, gensym("signal"));
+ x->x_msi = 0;
+ return (x);
+}
+
+static t_int *m2f_perform(t_int *w)
+{
+ t_float *in = (t_float *)(w[1]);
+ t_float *out = (t_float *)(w[2]);
+ t_m2f_tilde *x = (t_m2f_tilde *)(w[3]);
+ int n = (int)(w[4]);
+ t_float *tab = iem_m2f_tilde_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 m2f_dsp(t_m2f_tilde *x, t_signal **sp)
+{
+ dsp_add(m2f_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x, sp[0]->s_n);
+}
+
+static void m2f_maketable(void)
+{
+ union tabfudge tf;
+
+ if(!iem_m2f_tilde_table)
+ {
+ int i;
+ t_float *fp, midi, refexp=440.0*exp(-5.75*log(2.0));
+
+ iem_m2f_tilde_table = (t_float *)getbytes(sizeof(t_float) * (M2FTABSIZE+1));
+ for(i=0, fp=iem_m2f_tilde_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 m2f_tilde_setup(void)
+{
+ m2f_tilde_class = class_new(gensym("m2f~"), (t_newmethod)m2f_new, 0,
+ sizeof(t_m2f_tilde), 0, 0);
+ CLASS_MAINSIGNALIN(m2f_tilde_class, t_m2f_tilde, x_msi);
+ class_addmethod(m2f_tilde_class, (t_method)m2f_dsp, gensym("dsp"), 0);
+ m2f_maketable();
+ class_sethelpsymbol(m2f_tilde_class, gensym("iemhelp/help-m2f~"));
+}
diff --git a/src/iemlib2/makefile_linux b/src/iemlib2/makefile_linux
index 57bfe48..ea9e468 100644
--- a/src/iemlib2/makefile_linux
+++ b/src/iemlib2/makefile_linux
@@ -21,18 +21,23 @@ SRC = add2_comma.c \
bpe.c \
dollarg.c \
exp_inc.c \
+ fade~.c \
float24.c \
iem_anything.c \
iem_append.c \
+ iem_blocksize~.c \
iem_i_route.c \
iem_pbank_csv.c \
iem_prepend.c \
iem_receive.c \
iem_route.c \
+ iem_samplerate~.c \
iem_sel_any.c \
iem_send.c \
init.c \
+ LFO_noise~.c \
list2send.c \
+ m2f~.c \
mergefilename.c \
modulo_counter.c \
parentdollarzero.c \
@@ -42,11 +47,6 @@ SRC = add2_comma.c \
protect_against_open.c \
receive2list.c \
round_zero.c \
- sigfade.c \
- sigiem_blocksize.c \
- sigiem_samplerate.c \
- sigLFO_noise.c \
- sigm2f.c \
speedlim.c \
splitfilename.c \
stripfilename.c \
diff --git a/src/iemlib2/makefile_win b/src/iemlib2/makefile_win
index 80822d2..1ca5cba 100644
--- a/src/iemlib2/makefile_win
+++ b/src/iemlib2/makefile_win
@@ -20,19 +20,23 @@ SRC = add2_comma.c \
bpe.c \
dollarg.c \
exp_inc.c \
+ fade~.c \
float24.c \
iem_anything.c \
iem_append.c \
+ iem_blocksize~.c \
iem_i_route.c \
iem_pbank_csv.c \
- iem_prepend_kernel.c \
iem_prepend.c \
iem_receive.c \
iem_route.c \
+ iem_samplerate~.c \
iem_sel_any.c \
iem_send.c \
init.c \
+ LFO_noise~.c \
list2send.c \
+ m2f~.c \
mergefilename.c \
modulo_counter.c \
parentdollarzero.c \
@@ -42,11 +46,6 @@ SRC = add2_comma.c \
protect_against_open.c \
receive2list.c \
round_zero.c \
- sigfade.c \
- sigiem_blocksize.c \
- sigiem_samplerate.c \
- sigLFO_noise.c \
- sigm2f.c \
speedlim.c \
splitfilename.c \
stripfilename.c \