aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
authorKatja <katjav@users.sourceforge.net>2011-11-16 23:02:45 +0000
committerKatja <katjav@users.sourceforge.net>2011-11-16 23:02:45 +0000
commita7b3adb88be72fed88bb89a495482691da58d496 (patch)
tree641944fc14ee9993c7bd105a8efddb9731b822d5 /externals
parent96e0cea2e3cf39a0ed3d92aa0b69e5acebb93c22 (diff)
'float' to 't_float' changes in externals/extra/
svn path=/trunk/; revision=15777
Diffstat (limited to 'externals')
-rw-r--r--externals/extra/bonk~/bonk~.c150
-rw-r--r--externals/extra/choice/choice.c16
-rw-r--r--externals/extra/expr~/vexp.c28
-rw-r--r--externals/extra/expr~/vexp.h6
-rw-r--r--externals/extra/expr~/vexp_fun.c242
-rw-r--r--externals/extra/expr~/vexp_if.c12
-rw-r--r--externals/extra/fiddle~/fiddle~.c214
-rw-r--r--externals/extra/loop~/loop~.c3
-rw-r--r--externals/extra/lrshift~/lrshift~.c2
-rw-r--r--externals/extra/pd~/pd~.c8
-rw-r--r--externals/extra/pique/pique.c72
-rw-r--r--externals/extra/sigmund~/sigmund~.c221
12 files changed, 488 insertions, 486 deletions
diff --git a/externals/extra/bonk~/bonk~.c b/externals/extra/bonk~/bonk~.c
index f1d49c9c..c3516775 100644
--- a/externals/extra/bonk~/bonk~.c
+++ b/externals/extra/bonk~/bonk~.c
@@ -114,19 +114,19 @@ typedef struct _filterkernel
int k_hoppoints;
int k_skippoints;
int k_nhops;
- float k_centerfreq; /* center frequency, bins */
- float k_bandwidth; /* bandwidth, bins */
- float *k_stuff;
+ t_float k_centerfreq; /* center frequency, bins */
+ t_float k_bandwidth; /* bandwidth, bins */
+ t_float *k_stuff;
} t_filterkernel;
typedef struct _filterbank
{
int b_nfilters; /* number of filters in bank */
int b_npoints; /* input vector size */
- float b_halftones; /* filter bandwidth in halftones */
- float b_overlap; /* overlap; default 1 for 1/2-power pts */
- float b_firstbin; /* freq of first filter in bins, default 1 */
- float b_minbandwidth; /* minimum bandwidth, default 1.5 */
+ t_float b_halftones; /* filter bandwidth in halftones */
+ t_float b_overlap; /* overlap; default 1 for 1/2-power pts */
+ t_float b_firstbin; /* freq of first filter in bins, default 1 */
+ t_float b_minbandwidth; /* minimum bandwidth, default 1.5 */
t_filterkernel *b_vec; /* filter kernels */
int b_refcount; /* number of bonk~ objects using this */
struct _filterbank *b_next; /* next in linked list */
@@ -166,16 +166,16 @@ static t_filterbank *bonk_filterbanklist;
typedef struct _hist
{
- float h_power;
- float h_before;
- float h_outpower;
+ t_float h_power;
+ t_float h_before;
+ t_float h_outpower;
int h_countup;
- float h_mask[MASKHIST];
+ t_float h_mask[MASKHIST];
} t_hist;
typedef struct template
{
- float t_amp[MAXNFILTERS];
+ t_float t_amp[MAXNFILTERS];
} t_template;
typedef struct _insig
@@ -187,7 +187,7 @@ typedef struct _insig
#ifdef MSP
void *g_outlet; /* outlet for raw data */
#endif
- float *g_inbuf; /* buffered input samples */
+ t_float *g_inbuf; /* buffered input samples */
t_float *g_invec; /* new input samples */
} t_insig;
@@ -209,18 +209,18 @@ typedef struct _bonk
int x_npoints; /* number of points in input buffer */
int x_period; /* number of input samples between analyses */
int x_nfilters; /* number of filters requested */
- float x_halftones; /* nominal halftones between filters */
- float x_overlap;
- float x_firstbin;
- float x_minbandwidth;
- float x_hithresh; /* threshold for total growth to trigger */
- float x_lothresh; /* threshold for total growth to re-arm */
- float x_minvel; /* minimum velocity we output */
- float x_maskdecay;
+ t_float x_halftones; /* nominal halftones between filters */
+ t_float x_overlap;
+ t_float x_firstbin;
+ t_float x_minbandwidth;
+ t_float x_hithresh; /* threshold for total growth to trigger */
+ t_float x_lothresh; /* threshold for total growth to re-arm */
+ t_float x_minvel; /* minimum velocity we output */
+ t_float x_maskdecay;
int x_masktime;
int x_useloudness; /* use loudness spectra instead of power */
- float x_debouncedecay;
- float x_debouncevel;
+ t_float x_debouncedecay;
+ t_float x_debouncevel;
double x_learndebounce; /* debounce time (in "learn" mode only) */
int x_attackbins; /* number of bins to wait for attack */
@@ -239,7 +239,7 @@ typedef struct _bonk
int x_learncount; /* countup for "learn" mode */
int x_spew; /* if true, always generate output! */
int x_maskphase; /* phase, 0 to MASKHIST-1, for mask history */
- float x_sr; /* current sample rate in Hz. */
+ t_float x_sr; /* current sample rate in Hz. */
int x_hit; /* next "tick" called because of a hit, not a poll */
} t_bonk;
@@ -278,7 +278,7 @@ void bonk_useloudness_set(t_bonk *x, void *attr, long ac, t_atom *av);
void bonk_attackbins_set(t_bonk *x, void *attr, long ac, t_atom *av);
void bonk_learn_set(t_bonk *x, void *attr, long ac, t_atom *av);
-float qrsqrt(float f);
+t_float qrsqrt(t_float f);
double clock_getsystime();
double clock_gettimesince(double prevsystime);
char *strcpy(char *s1, const char *s2);
@@ -290,10 +290,10 @@ static void bonk_tick(t_bonk *x);
#define SLIDE 0.25 /* relative slide between filter subwindows */
static t_filterbank *bonk_newfilterbank(int npoints, int nfilters,
- float halftones, float overlap, float firstbin, float minbandwidth)
+ t_float halftones, t_float overlap, t_float firstbin, t_float minbandwidth)
{
int i, j;
- float cf, bw, h, relspace;
+ t_float cf, bw, h, relspace;
t_filterbank *b = (t_filterbank *)getbytes(sizeof(*b));
b->b_npoints = npoints;
b->b_nfilters = nfilters;
@@ -319,8 +319,8 @@ static t_filterbank *bonk_newfilterbank(int npoints, int nfilters,
bw = (0.5*minbandwidth);
for (i = 0; i < nfilters; i++)
{
- float *fp, newcf, newbw;
- float normalizer = 0;
+ t_float *fp, newcf, newbw;
+ t_float normalizer = 0;
int filterpoints, skippoints, hoppoints, nhops;
filterpoints = npoints * HALFWIDTH/bw;
@@ -339,11 +339,11 @@ static t_filterbank *bonk_newfilterbank(int npoints, int nfilters,
hoppoints = SLIDE * npoints * HALFWIDTH/bw;
- nhops = 1. + (npoints-filterpoints)/(float)hoppoints;
+ nhops = 1. + (npoints-filterpoints)/(t_float)hoppoints;
skippoints = 0.5 * (npoints-filterpoints - (nhops-1) * hoppoints);
b->b_vec[i].k_stuff =
- (float *)getbytes(2 * sizeof(float) * filterpoints);
+ (t_float *)getbytes(2 * sizeof(t_float) * filterpoints);
b->b_vec[i].k_filterpoints = filterpoints;
b->b_vec[i].k_nhops = nhops;
b->b_vec[i].k_hoppoints = hoppoints;
@@ -353,9 +353,9 @@ static t_filterbank *bonk_newfilterbank(int npoints, int nfilters,
for (fp = b->b_vec[i].k_stuff, j = 0; j < filterpoints; j++, fp+= 2)
{
- float phase = j * cf * (2*3.14159/ npoints);
- float wphase = j * (2*3.14159 / filterpoints);
- float window = sin(0.5*wphase);
+ t_float phase = j * cf * (2*3.141592653589793 / npoints);
+ t_float wphase = j * (2*3.141592653589793 / filterpoints);
+ t_float window = sin(0.5*wphase);
fp[0] = window * cos(phase);
fp[1] = window * sin(phase);
normalizer += window;
@@ -398,17 +398,17 @@ static void bonk_freefilterbank(t_filterbank *b)
for (i = 0; i < b->b_nfilters; i++)
if (b->b_vec[i].k_stuff)
freebytes(b->b_vec[i].k_stuff,
- b->b_vec[i].k_filterpoints * sizeof(float));
+ b->b_vec[i].k_filterpoints * sizeof(t_float));
freebytes(b, sizeof(*b));
}
static void bonk_donew(t_bonk *x, int npoints, int period, int nsig,
- int nfilters, float halftones, float overlap, float firstbin,
- float minbandwidth, float samplerate)
+ int nfilters, t_float halftones, t_float overlap, t_float firstbin,
+ t_float minbandwidth, t_float samplerate)
{
int i, j;
t_hist *h;
- float *fp;
+ t_float *fp;
t_insig *g;
t_filterbank *fb;
for (j = 0, g = x->x_insig; j < nsig; j++, g++)
@@ -420,7 +420,7 @@ static void bonk_donew(t_bonk *x, int npoints, int period, int nsig,
h->h_mask[j] = 0;
}
/* we ought to check for failure to allocate memory here */
- g->g_inbuf = (float *)getbytes(npoints * sizeof(float));
+ g->g_inbuf = (t_float *)getbytes(npoints * sizeof(t_float));
for (i = npoints, fp = g->g_inbuf; i--; fp++) *fp = 0;
}
if (!period) period = npoints/2;
@@ -475,25 +475,25 @@ static void bonk_tick(t_bonk *x)
t_atom at[MAXNFILTERS], *ap, at2[3];
int i, j, k, n;
t_hist *h;
- float *pp, vel = 0, temperature = 0;
- float *fp;
+ t_float *pp, vel = 0., temperature = 0.;
+ t_float *fp;
t_template *tp;
int nfit, ninsig = x->x_ninsig, ntemplate = x->x_ntemplate, nfilters = x->x_nfilters;
t_insig *gp;
#ifdef _MSC_VER
- float powerout[MAXNFILTERS*MAXCHANNELS];
+ t_float powerout[MAXNFILTERS*MAXCHANNELS];
#else
- float *powerout = alloca(x->x_nfilters * x->x_ninsig * sizeof(*powerout));
+ t_float *powerout = alloca(x->x_nfilters * x->x_ninsig * sizeof(*powerout));
#endif
for (i = ninsig, pp = powerout, gp = x->x_insig; i--; gp++)
{
for (j = 0, h = gp->g_hist; j < nfilters; j++, h++, pp++)
{
- float power = h->h_outpower;
- float intensity = *pp = (power > 0 ? 100. * qrsqrt(qrsqrt(power)) : 0);
+ t_float power = h->h_outpower;
+ t_float intensity = *pp = (power > 0. ? 100. * qrsqrt(qrsqrt(power)) : 0.);
vel += intensity;
- temperature += intensity * (float)j;
+ temperature += intensity * (t_float)j;
}
}
if (vel > 0) temperature /= vel;
@@ -527,11 +527,11 @@ static void bonk_tick(t_bonk *x)
{
int countup = x->x_learncount;
/* normalize to 100 */
- float norm;
+ t_float norm;
for (i = nfilters * ninsig, norm = 0, pp = powerout; i--; pp++)
norm += *pp * *pp;
if (norm < 1.0e-15) norm = 1.0e-15;
- norm = 100.f * qrsqrt(norm);
+ norm = 100. * qrsqrt(norm);
/* check if this is the first strike for a new template */
if (!countup)
{
@@ -554,7 +554,7 @@ static void bonk_tick(t_bonk *x)
for (j = nfilters, fp = x->x_template[oldn].t_amp; j--;
pp++, fp++)
*fp = (countup * *fp + *pp * norm)
- /(countup + 1.0f);
+ /(countup + 1.0);
}
}
countup++;
@@ -566,13 +566,13 @@ static void bonk_tick(t_bonk *x)
x->x_learndebounce = clock_getsystime();
if (ntemplate)
{
- float bestfit = -1e30;
+ t_float bestfit = -1e30;
int templatecount;
nfit = -1;
for (i = 0, templatecount = 0, tp = x->x_template;
templatecount < ntemplate; i++)
{
- float dotprod = 0;
+ t_float dotprod = 0;
for (k = 0, pp = powerout;
k < ninsig && templatecount < ntemplate;
k++, tp++, templatecount++)
@@ -610,7 +610,7 @@ static void bonk_tick(t_bonk *x)
pp = powerout + nfilters * (ninsig-1); n < ninsig;
n++, gp--, pp -= nfilters)
{
- float *pp2;
+ t_float *pp2;
for (i = 0, ap = at, pp2 = pp; i < nfilters;
i++, ap++, pp2++)
{
@@ -626,7 +626,7 @@ static void bonk_doit(t_bonk *x)
int i, j, ch, n;
t_filterkernel *k;
t_hist *h;
- float growth = 0, *fp1, *fp3, *fp4, hithresh, lothresh;
+ t_float growth = 0, *fp1, *fp3, *fp4, hithresh, lothresh;
int ninsig = x->x_ninsig, nfilters = x->x_nfilters,
maskphase = x->x_maskphase, nextphase, oldmaskphase;
t_insig *gp;
@@ -646,8 +646,8 @@ static void bonk_doit(t_bonk *x)
for (i = 0, k = x->x_filterbank->b_vec, h = gp->g_hist;
i < nfilters; i++, k++, h++)
{
- float power = 0, maskpow = h->h_mask[maskphase];
- float *inbuf= gp->g_inbuf + k->k_skippoints;
+ t_float power = 0, maskpow = h->h_mask[maskphase];
+ t_float *inbuf= gp->g_inbuf + k->k_skippoints;
int countup = h->h_countup;
int filterpoints = k->k_filterpoints;
/* if the user asked for more filters that fit under the
@@ -665,10 +665,10 @@ static void bonk_doit(t_bonk *x)
for (fp1 = inbuf, n = 0;
n < k->k_nhops; fp1 += k->k_hoppoints, n++)
{
- float rsum = 0, isum = 0;
+ t_float rsum = 0, isum = 0;
for (fp3 = fp1, fp4 = k->k_stuff, j = filterpoints; j--;)
{
- float g = *fp3++;
+ t_float g = *fp3++;
rsum += g * *fp4++;
isum += g * *fp4++;
}
@@ -681,8 +681,8 @@ static void bonk_doit(t_bonk *x)
{
if (x->x_useloudness)
growth += qrsqrt(qrsqrt(
- power/(h->h_mask[oldmaskphase] + 1.0e-15))) - 1.f;
- else growth += power/(h->h_mask[oldmaskphase] + 1.0e-15) - 1.f;
+ power/(h->h_mask[oldmaskphase] + 1.0e-15))) - 1.;
+ else growth += power/(h->h_mask[oldmaskphase] + 1.0e-15) - 1.;
}
if (!x->x_willattack && countup >= x->x_masktime)
maskpow *= x->x_maskdecay;
@@ -762,7 +762,7 @@ static t_int *bonk_perform(t_int *w)
n : (x->x_npoints - infill));
for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
{
- float *fp = gp->g_inbuf + infill;
+ t_float *fp = gp->g_inbuf + infill;
t_float *in1 = gp->g_invec + onset;
for (j = 0; j < m; j++)
*fp++ = *in1++;
@@ -780,7 +780,7 @@ static t_int *bonk_perform(t_int *w)
if (x->x_period < x->x_npoints)
{
int overlap = x->x_npoints - x->x_period;
- float *fp1, *fp2;
+ t_float *fp1, *fp2;
for (n = 0, gp = x->x_insig; n < ninsig; n++, gp++)
for (i = overlap, fp1 = gp->g_inbuf,
fp2 = fp1 + x->x_period; i--;)
@@ -971,9 +971,9 @@ static void bonk_bang(t_bonk *x)
#ifdef PD
static void bonk_read(t_bonk *x, t_symbol *s)
{
- float vec[MAXNFILTERS];
+ t_float vec[MAXNFILTERS];
int i, ntemplate = 0, remaining;
- float *fp, *fp2;
+ t_float *fp, *fp2;
/* fbar: canvas_open code taken from g_array.c */
FILE *fd;
@@ -1043,9 +1043,9 @@ static void bonk_doread(t_bonk *x, t_symbol *s)
}
static void bonk_openfile(t_bonk *x, char *filename, short path) {
- float vec[MAXNFILTERS];
+ t_float vec[MAXNFILTERS];
int i, ntemplate = 0, remaining;
- float *fp, *fp2;
+ t_float *fp, *fp2;
t_filehandle fh;
char **texthandle;
@@ -1103,7 +1103,7 @@ static void bonk_write(t_bonk *x, t_symbol *s)
char buf[MAXPDSTRING]; /* fbar */
int i, ntemplate = x->x_ntemplate;
t_template *tp = x->x_template;
- float *fp;
+ t_float *fp;
/* fbar: canvas-code as in g_array.c */
canvas_makefilename(x->x_canvas, s->s_name,
@@ -1154,7 +1154,7 @@ void bonk_writefile(t_bonk *x, char *filename, short path)
{
int i, ntemplate = x->x_ntemplate;
t_template *tp = x->x_template;
- float *fp;
+ t_float *fp;
long err;
long buflen;
@@ -1191,7 +1191,7 @@ static void bonk_free(t_bonk *x)
dsp_free((t_pxobject *)x);
#endif
for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- freebytes(gp->g_inbuf, x->x_npoints * sizeof(float));
+ freebytes(gp->g_inbuf, x->x_npoints * sizeof(t_float));
clock_free(x->x_clock);
if (!--(x->x_filterbank->b_refcount))
bonk_freefilterbank(x->x_filterbank);
@@ -1206,7 +1206,7 @@ static void *bonk_new(t_symbol *s, int argc, t_atom *argv)
t_bonk *x = (t_bonk *)pd_new(bonk_class);
int nsig = 1, period = DEFPERIOD, npts = DEFNPOINTS,
nfilters = DEFNFILTERS, j;
- float halftones = DEFHALFTONES, overlap = DEFOVERLAP,
+ t_float halftones = DEFHALFTONES, overlap = DEFOVERLAP,
firstbin = DEFFIRSTBIN, minbandwidth = DEFMINBANDWIDTH;
t_insig *g;
@@ -1512,7 +1512,7 @@ static void *bonk_new(t_symbol *s, long ac, t_atom *av)
void bonk_minvel_set(t_bonk *x, void *attr, long ac, t_atom *av)
{
if (ac && av) {
- float f = atom_getfloat(av);
+ t_float f = atom_getfloat(av);
if (f < 0) f = 0;
x->x_minvel = f;
}
@@ -1521,7 +1521,7 @@ void bonk_minvel_set(t_bonk *x, void *attr, long ac, t_atom *av)
void bonk_lothresh_set(t_bonk *x, void *attr, long ac, t_atom *av)
{
if (ac && av) {
- float f = atom_getfloat(av);
+ t_float f = atom_getfloat(av);
if (f > x->x_hithresh)
post("bonk: warning: low threshold greater than hi threshold");
x->x_lothresh = (f <= 0 ? 0.0001 : f);
@@ -1531,7 +1531,7 @@ void bonk_lothresh_set(t_bonk *x, void *attr, long ac, t_atom *av)
void bonk_hithresh_set(t_bonk *x, void *attr, long ac, t_atom *av)
{
if (ac && av) {
- float f = atom_getfloat(av);
+ t_float f = atom_getfloat(av);
if (f < x->x_lothresh)
post("bonk: warning: low threshold greater than hi threshold");
x->x_hithresh = (f <= 0 ? 0.0001 : f);
@@ -1549,7 +1549,7 @@ void bonk_masktime_set(t_bonk *x, void *attr, long ac, t_atom *av)
void bonk_maskdecay_set(t_bonk *x, void *attr, long ac, t_atom *av)
{
if (ac && av) {
- float f = atom_getfloat(av);
+ t_float f = atom_getfloat(av);
f = (f < 0) ? 0 : f;
f = (f > 1) ? 1 : f;
x->x_maskdecay = f;
@@ -1559,7 +1559,7 @@ void bonk_maskdecay_set(t_bonk *x, void *attr, long ac, t_atom *av)
void bonk_debouncedecay_set(t_bonk *x, void *attr, long ac, t_atom *av)
{
if (ac && av) {
- float f = atom_getfloat(av);
+ t_float f = atom_getfloat(av);
f = (f < 0) ? 0 : f;
f = (f > 1) ? 1 : f;
x->x_debouncedecay = f;
@@ -1631,7 +1631,7 @@ double clock_gettimesince(double prevsystime)
return ((gettime() - prevsystime));
}
-float qrsqrt(float f)
+t_float qrsqrt(t_float f)
{
return 1/sqrt(f);
}
diff --git a/externals/extra/choice/choice.c b/externals/extra/choice/choice.c
index a50c66ac..9b8bfb1c 100644
--- a/externals/extra/choice/choice.c
+++ b/externals/extra/choice/choice.c
@@ -17,7 +17,7 @@ static t_class *choice_class;
typedef struct _elem
{
- float e_age;
+ t_float e_age;
t_float e_weight[DIMENSION];
} t_elem;
@@ -63,7 +63,7 @@ static void choice_add(t_choice *x, t_symbol *s, int argc, t_atom *argv)
{
int oldn = x->x_n, newn = oldn + 1, i;
t_elem *e;
- float sum, normal;
+ t_float sum, normal;
x->x_vec = (t_elem *)resizebytes(x->x_vec, oldn * sizeof(t_elem),
newn * sizeof(t_elem));
x->x_n = newn;
@@ -72,11 +72,11 @@ static void choice_add(t_choice *x, t_symbol *s, int argc, t_atom *argv)
for (i = 0, sum = 0; i < DIMENSION; i++)
{
- float f = atom_getfloatarg(i, argc, argv);
+ t_float f = atom_getfloatarg(i, argc, argv);
e->e_weight[i] = f;
sum += f*f;
}
- normal = (float)(sum > 0 ? 1./sqrt(sum) : 1);
+ normal = (t_float)(sum > 0 ? 1./sqrt(sum) : 1);
for (i = 0; i < DIMENSION; i++)
e->e_weight[i] *= normal;
}
@@ -84,7 +84,7 @@ static void choice_add(t_choice *x, t_symbol *s, int argc, t_atom *argv)
static void choice_list(t_choice *x, t_symbol *s, int argc, t_atom *argv)
{
int i, j;
- float bestsum = 0;
+ t_float bestsum = 0;
int bestindex = -1;
t_float invec[DIMENSION];
for (i = 0; i < DIMENSION; i++)
@@ -92,10 +92,10 @@ static void choice_list(t_choice *x, t_symbol *s, int argc, t_atom *argv)
for (j = 0; j < x->x_n; j++)
{
t_elem *e = x->x_vec + j;
- float sum;
+ t_float sum;
for (i = 0, sum = 0; i < DIMENSION; i++)
sum += e->e_weight[i] * invec[i];
- if (x->x_nonrepeat) sum *= (float)(log(e->e_age));
+ if (x->x_nonrepeat) sum *= (t_float)(log(e->e_age));
if (sum > bestsum)
{
bestsum = sum;
@@ -109,7 +109,7 @@ static void choice_list(t_choice *x, t_symbol *s, int argc, t_atom *argv)
x->x_vec[j].e_age += 1.;
x->x_vec[bestindex].e_age = 1;
}
- outlet_float(x->x_obj.ob_outlet, (float)bestindex);
+ outlet_float(x->x_obj.ob_outlet, (t_float)bestindex);
}
static void choice_free(t_choice *x)
diff --git a/externals/extra/expr~/vexp.c b/externals/extra/expr~/vexp.c
index 732944de..8f8ff46c 100644
--- a/externals/extra/expr~/vexp.c
+++ b/externals/extra/expr~/vexp.c
@@ -97,10 +97,10 @@ struct ex_ex *eval_store(struct expr *expr, struct ex_ex *eptr,
struct ex_ex *eval_sigidx(struct expr *expr, struct ex_ex *eptr,
struct ex_ex *optr, int i);
static int cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, float rem_i, /* integer and fractinal part of index */
+ int i, t_float rem_i, /* integer and fractinal part of index */
int idx, /* index of current fexpr~ processing */
int vsize, /* vector size */
- float *curvec, float *prevec); /* current and previous table */
+ t_float *curvec, t_float *prevec); /* current and previous table */
t_ex_func *find_func(char *s);
void ex_dzdetect(struct expr *expr);
@@ -691,7 +691,7 @@ case ET_INT: \
case ET_INT: \
if (optr->ex_type == ET_VEC) { \
op = optr->ex_vec; \
- scalar = (float)DZC(left.ex_int, OPR, right.ex_int); \
+ scalar = (t_float)DZC(left.ex_int, OPR, right.ex_int); \
for (j = 0; j < expr->exp_vsize; j++) \
*op++ = scalar; \
} else { \
@@ -702,12 +702,12 @@ case ET_INT: \
case ET_FLT: \
if (optr->ex_type == ET_VEC) { \
op = optr->ex_vec; \
- scalar = DZC(((float)left.ex_int), OPR, right.ex_flt);\
+ scalar = DZC(((t_float)left.ex_int), OPR, right.ex_flt);\
for (j = 0; j < expr->exp_vsize; j++) \
*op++ = scalar; \
} else { \
optr->ex_type = ET_FLT; \
- optr->ex_flt = DZC(((float)left.ex_int), OPR, \
+ optr->ex_flt = DZC(((t_float)left.ex_int), OPR, \
right.ex_flt); \
} \
break; \
@@ -743,7 +743,7 @@ case ET_FLT: \
case ET_INT: \
if (optr->ex_type == ET_VEC) { \
op = optr->ex_vec; \
- scalar = DZC((float) left.ex_flt, OPR, right.ex_int); \
+ scalar = DZC((t_float) left.ex_flt, OPR, right.ex_int); \
for (j = 0; j < expr->exp_vsize; j++) \
*op++ = scalar; \
} else { \
@@ -854,7 +854,7 @@ break;
switch(left.ex_type) { \
case ET_INT: \
if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec,(float)(OPR left.ex_int),\
+ ex_mkvector(optr->ex_vec,(t_float)(OPR left.ex_int),\
expr->exp_vsize);\
break; \
} \
@@ -960,7 +960,7 @@ ex_eval(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
switch (eptr->ex_type) {
case ET_INT:
if (optr->ex_type == ET_VEC)
- ex_mkvector(optr->ex_vec, (float) eptr->ex_int,
+ ex_mkvector(optr->ex_vec, (t_float) eptr->ex_int,
expr->exp_vsize);
else
*optr = *eptr;
@@ -1407,7 +1407,7 @@ eval_sigidx(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
struct ex_ex arg;
struct ex_ex *reteptr;
int i = 0, j = 0;
- float fi = 0, /* index in float */
+ t_float fi = 0, /* index in float */
rem_i = 0; /* remains of the float */
char *tbl;
@@ -1504,10 +1504,10 @@ eval_sigidx(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
*/
static int
cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, float rem_i, /* integer and fractinal part of index */
+ int i, t_float rem_i,/* integer and fractinal part of index */
int idx, /* index of current fexpr~ processing */
int vsize, /* vector size */
- float *curvec, float *prevec) /* current and previous table */
+ t_float *curvec, t_float *prevec) /* current and previous table */
{
int n;
@@ -1873,8 +1873,8 @@ atoif(char *s, long int *value, long int *type)
char *p;
long int_val = 0;
int flt = 0;
- float pos = 0;
- float flt_val = 0;
+ t_float pos = 0;
+ t_float flt_val = 0;
int base = 10;
p = s;
@@ -1940,7 +1940,7 @@ atoif(char *s, long int *value, long int *type)
default:
if (flt) {
*type = ET_FLT;
- *((float *) value) = flt_val;
+ *((t_float *) value) = flt_val;
} else {
*type = ET_INT;
*value = int_val;
diff --git a/externals/extra/expr~/vexp.h b/externals/extra/expr~/vexp.h
index d096842f..df5547ea 100644
--- a/externals/extra/expr~/vexp.h
+++ b/externals/extra/expr~/vexp.h
@@ -107,7 +107,7 @@ struct ex_ex;
struct ex_ex {
union {
long v_int;
- float v_flt;
+ t_float v_flt;
t_float *v_vec; /* this is an for allocated vector */
long op;
char *ptr;
@@ -206,10 +206,10 @@ typedef struct expr {
struct ex_ex exp_res[MAX_VARS]; /* the evluation result */
t_float *exp_p_var[MAX_VARS];
t_float *exp_p_res[MAX_VARS]; /* the previous evaluation result */
- t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */
+ t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */
int exp_vsize; /* the size of the signal vector */
int exp_nivec; /* # of vector inlets */
- float exp_f; /* control value to be transformed to signal */
+ t_float exp_f; /* control value to be transformed to signal */
} t_expr;
typedef struct ex_funcs {
diff --git a/externals/extra/expr~/vexp_fun.c b/externals/extra/expr~/vexp_fun.c
index 26b0b767..73c0b5c6 100644
--- a/externals/extra/expr~/vexp_fun.c
+++ b/externals/extra/expr~/vexp_fun.c
@@ -68,7 +68,7 @@
* the last argument is a pointer to a struct ex_ex for
* the result. Up do this point, the content of the
* struct ex_ex that these functions receive are either
- * ET_INT (long), ET_FLT (float), or ET_SYM (char **, it is
+ * ET_INT (long), ET_FLT (t_float), or ET_SYM (char **, it is
* char ** and not char * since NewHandle of Mac returns
* a char ** for relocatability.) The common practice in
* these functions is that they figure out the type of their
@@ -221,7 +221,7 @@ case ET_INT: \
case ET_INT: \
if (optr->ex_type == ET_VEC) { \
op = optr->ex_vec; \
- scalar = (float)func(leftfuncast left->ex_int, \
+ scalar = (t_float)func(leftfuncast left->ex_int, \
rightfuncast right->ex_int); \
j = e->exp_vsize; \
while (j--) \
@@ -229,7 +229,7 @@ case ET_INT: \
} else { \
if (fltret) { \
optr->ex_type = ET_FLT; \
- optr->ex_flt = (float)func(leftfuncast \
+ optr->ex_flt = (t_float)func(leftfuncast \
left->ex_int, rightfuncast right->ex_int); \
} else { \
optr->ex_type = ET_INT; \
@@ -241,14 +241,14 @@ case ET_INT: \
case ET_FLT: \
if (optr->ex_type == ET_VEC) { \
op = optr->ex_vec; \
- scalar = (float)func(leftfuncast left->ex_int, \
+ scalar = (t_float)func(leftfuncast left->ex_int, \
rightfuncast right->ex_flt); \
j = e->exp_vsize; \
while (j--) \
*op++ = scalar; \
} else { \
optr->ex_type = ET_FLT; \
- optr->ex_flt = (float)func(leftfuncast left->ex_int, \
+ optr->ex_flt = (t_float)func(leftfuncast left->ex_int, \
rightfuncast right->ex_flt); \
} \
break; \
@@ -268,7 +268,7 @@ case ET_INT: \
op = optr->ex_vec; \
j = e->exp_vsize; \
while (j--) { \
- *op++ = (float)func(leftfuncast scalar, \
+ *op++ = (t_float)func(leftfuncast scalar, \
rightfuncast *rp); \
rp++; \
} \
@@ -285,28 +285,28 @@ case ET_FLT: \
case ET_INT: \
if (optr->ex_type == ET_VEC) { \
op = optr->ex_vec; \
- scalar = (float)func(leftfuncast left->ex_flt, \
+ scalar = (t_float)func(leftfuncast left->ex_flt, \
rightfuncast right->ex_int); \
j = e->exp_vsize; \
while (j--) \
*op++ = scalar; \
} else { \
optr->ex_type = ET_FLT; \
- optr->ex_flt = (float)func(leftfuncast left->ex_flt, \
+ optr->ex_flt = (t_float)func(leftfuncast left->ex_flt, \
rightfuncast right->ex_int); \
} \
break; \
case ET_FLT: \
if (optr->ex_type == ET_VEC) { \
op = optr->ex_vec; \
- scalar = (float)func(leftfuncast left->ex_flt, \
+ scalar = (t_float)func(leftfuncast left->ex_flt, \
rightfuncast right->ex_flt); \
j = e->exp_vsize; \
while (j--) \
*op++ = scalar; \
} else { \
optr->ex_type = ET_FLT; \
- optr->ex_flt = (float)func(leftfuncast left->ex_flt, \
+ optr->ex_flt = (t_float)func(leftfuncast left->ex_flt, \
rightfuncast right->ex_flt); \
} \
break; \
@@ -326,7 +326,7 @@ case ET_FLT: \
op = optr->ex_vec; \
j = e->exp_vsize; \
while (j--) { \
- *op++ = (float)func(leftfuncast scalar, \
+ *op++ = (t_float)func(leftfuncast scalar, \
rightfuncast *rp); \
rp++; \
} \
@@ -356,7 +356,7 @@ case ET_VI: \
scalar = right->ex_int; \
j = e->exp_vsize; \
while (j--) { \
- *op++ = (float)func(leftfuncast *lp, \
+ *op++ = (t_float)func(leftfuncast *lp, \
rightfuncast scalar); \
lp++; \
} \
@@ -365,7 +365,7 @@ case ET_VI: \
scalar = right->ex_flt; \
j = e->exp_vsize; \
while (j--) { \
- *op++ = (float)func(leftfuncast *lp, \
+ *op++ = (t_float)func(leftfuncast *lp, \
rightfuncast scalar); \
lp++; \
} \
@@ -380,7 +380,7 @@ case ET_VI: \
* 8 times in each round to get a considerable \
* improvement \
*/ \
- *op++ = (float)func(leftfuncast *lp, \
+ *op++ = (t_float)func(leftfuncast *lp, \
rightfuncast *rp); \
rp++; lp++; \
} \
@@ -401,7 +401,7 @@ default: \
/*
* FUNC_EVAL_UNARY - evaluate a unary function,
- * if fltret is set return float
+ * if fltret is set return t_float
* otherwise return value based on regular typechecking,
*/
#define FUNC_EVAL_UNARY(left, func, leftcast, optr, fltret) \
@@ -409,12 +409,12 @@ switch(left->ex_type) { \
case ET_INT: \
if (optr->ex_type == ET_VEC) { \
ex_mkvector(optr->ex_vec, \
- (float)(func (leftcast left->ex_int)), e->exp_vsize);\
+ (t_float)(func (leftcast left->ex_int)), e->exp_vsize);\
break; \
} \
if (fltret) { \
optr->ex_type = ET_FLT; \
- optr->ex_flt = (float) func(leftcast left->ex_int); \
+ optr->ex_flt = (t_float) func(leftcast left->ex_int); \
break; \
} \
optr->ex_type = ET_INT; \
@@ -423,11 +423,11 @@ case ET_INT: \
case ET_FLT: \
if (optr->ex_type == ET_VEC) { \
ex_mkvector(optr->ex_vec, \
- (float)(func (leftcast left->ex_flt)), e->exp_vsize);\
+ (t_float)(func (leftcast left->ex_flt)), e->exp_vsize);\
break; \
} \
optr->ex_type = ET_FLT; \
- optr->ex_flt = (float) func(leftcast left->ex_flt); \
+ optr->ex_flt = (t_float) func(leftcast left->ex_flt); \
break; \
case ET_VI: \
case ET_VEC: \
@@ -440,7 +440,7 @@ case ET_VEC: \
lp = left->ex_vec; \
j = e->exp_vsize; \
while (j--) \
- *op++ = (float)(func (leftcast *lp++)); \
+ *op++ = (t_float)(func (leftcast *lp++)); \
break; \
default: \
post_error((fts_object_t *) e, \
@@ -458,9 +458,9 @@ static void \
ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
{ \
struct ex_ex *left, *right; \
- float *op; /* output pointer */ \
- float *lp, *rp; /* left and right vector pointers */ \
- float scalar; \
+ t_float *op; /* output pointer */ \
+ t_float *lp, *rp; /* left and right vector pointers */ \
+ t_float scalar; \
int j; \
\
left = argv++; \
@@ -474,9 +474,9 @@ static void \
ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
{ \
struct ex_ex *left; \
- float *op; /* output pointer */ \
- float *lp, *rp; /* left and right vector pointers */ \
- float scalar; \
+ t_float *op; /* output pointer */ \
+ t_float *lp, *rp; /* left and right vector pointers */ \
+ t_float scalar; \
int j; \
\
left = argv++; \
@@ -493,9 +493,9 @@ static void
ex_min(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -513,9 +513,9 @@ static void
ex_max(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -531,9 +531,9 @@ static void
ex_toint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -561,9 +561,9 @@ static void
ex_rint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -573,20 +573,20 @@ ex_rint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
}
/*
- * ex_tofloat -- convert to float
+ * ex_tofloat -- convert to t_float
*/
static void
ex_tofloat(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
-#define tofloat(x) ((float)(x))
+#define tofloat(x) ((t_float)(x))
FUNC_EVAL_UNARY(left, tofloat, (int), optr, 1);
}
@@ -598,9 +598,9 @@ static void
ex_pow(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -615,9 +615,9 @@ static void
ex_sqrt(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -632,9 +632,9 @@ static void
ex_exp(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -649,9 +649,9 @@ static void
ex_log(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -666,9 +666,9 @@ static void
ex_ln(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -680,9 +680,9 @@ static void
ex_sin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -694,9 +694,9 @@ static void
ex_cos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -709,9 +709,9 @@ static void
ex_tan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -723,9 +723,9 @@ static void
ex_asin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -737,9 +737,9 @@ static void
ex_acos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -752,9 +752,9 @@ static void
ex_atan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -769,9 +769,9 @@ static void
ex_atan2(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -786,9 +786,9 @@ static void
ex_fmod(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -804,9 +804,9 @@ static void
ex_floor(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -821,9 +821,9 @@ static void
ex_ceil(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -834,9 +834,9 @@ static void
ex_sinh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -848,9 +848,9 @@ static void
ex_cosh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -863,9 +863,9 @@ static void
ex_tanh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -879,9 +879,9 @@ static void
ex_asinh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -893,9 +893,9 @@ static void
ex_acosh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -907,9 +907,9 @@ static void
ex_atanh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -939,9 +939,9 @@ static void
ex_fact(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -961,9 +961,9 @@ static void
ex_random(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -976,9 +976,9 @@ static void
ex_abs(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float scalar;
int j;
left = argv++;
@@ -993,10 +993,10 @@ static void
ex_if(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
struct ex_ex *left, *right, *cond, *res;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float *cp; /* condition pointer */
- float leftvalue, rightvalue;
+ t_float *op; /* output pointer */
+ t_float *lp, *rp; /* left and right vector pointers */
+ t_float *cp; /* condition pointer */
+ t_float leftvalue, rightvalue;
int j;
cond = argv++;
@@ -1169,7 +1169,7 @@ ex_if(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
switch(res->ex_type) {
case ET_INT:
if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (float)res->ex_int,
+ ex_mkvector(optr->ex_vec, (t_float)res->ex_int,
e->exp_vsize);
return;
}
@@ -1177,7 +1177,7 @@ ex_if(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
return;
case ET_FLT:
if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (float)res->ex_flt,
+ ex_mkvector(optr->ex_vec, (t_float)res->ex_flt,
e->exp_vsize);
return;
}
diff --git a/externals/extra/expr~/vexp_if.c b/externals/extra/expr~/vexp_if.c
index aaaf4ef3..3028ff82 100644
--- a/externals/extra/expr~/vexp_if.c
+++ b/externals/extra/expr~/vexp_if.c
@@ -426,7 +426,7 @@ expr_perform(t_int *w)
if (x->exp_flags & EF_STOP) {
for (i = 0; i < x->exp_nexpr; i++)
memset(x->exp_res[i].ex_vec, 0,
- x->exp_vsize * sizeof (float));
+ x->exp_vsize * sizeof (t_float));
return (w + 2);
}
@@ -726,11 +726,11 @@ fexpr_tilde_clear(t_expr *x, t_symbol *s, int argc, t_atom *argv)
*/
if (!argc) {
for (i = 0; i < x->exp_nexpr; i++)
- memset(x->exp_p_res[i], 0, x->exp_vsize*sizeof(float));
+ memset(x->exp_p_res[i], 0, x->exp_vsize*sizeof(t_float));
for (i = 0; i < MAX_VARS; i++)
if (x->exp_var[i].ex_type == ET_XI)
memset(x->exp_p_var[i], 0,
- x->exp_vsize*sizeof(float));
+ x->exp_vsize*sizeof(t_float));
return;
}
if (argc > 1) {
@@ -760,7 +760,7 @@ fexpr_tilde_clear(t_expr *x, t_symbol *s, int argc, t_atom *argv)
post("fexpr~-clear: no signal at inlet %d", vecno + 1);
return;
}
- memset(x->exp_p_var[vecno], 0, x->exp_vsize*sizeof(float));
+ memset(x->exp_p_var[vecno], 0, x->exp_vsize*sizeof(t_float));
return;
case 'y':
if (!sx->s_name[1])
@@ -777,7 +777,7 @@ fexpr_tilde_clear(t_expr *x, t_symbol *s, int argc, t_atom *argv)
post("fexpr~.clear: only %d outlets", x->exp_nexpr);
return;
}
- memset(x->exp_p_res[vecno], 0, x->exp_vsize*sizeof(float));
+ memset(x->exp_p_res[vecno], 0, x->exp_vsize*sizeof(t_float));
return;
return;
default:
@@ -997,7 +997,7 @@ ex_sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
t_garray *garray;
int size;
t_word *wvec;
- float sum;
+ t_float sum;
int indx;
if (argv->ex_type != ET_SYM)
diff --git a/externals/extra/fiddle~/fiddle~.c b/externals/extra/fiddle~/fiddle~.c
index 4633b3c0..ea676784 100644
--- a/externals/extra/fiddle~/fiddle~.c
+++ b/externals/extra/fiddle~/fiddle~.c
@@ -145,7 +145,7 @@ static fts_symbol_t *dsp_symbol = 0;
#define BINPEROCT 48 /* bins per octave */
#define BPERO_OVER_LOG2 69.24936196f /* BINSPEROCT/log(2) */
-#define FACTORTOBINS (float)(4/0.0145453) /* 4 / (pow(2.,1/48.) - 1) */
+#define FACTORTOBINS (t_float)(4/0.0145453) /* 4 / (pow(2.,1/48.) - 1) */
#define BINGUARD 10 /* extra bins to throw in front */
#define PARTIALDEVIANCE 0.023f /* acceptable partial detuning in % */
#define LOGTODB 4.34294481903f /* 20/log(10) */
@@ -153,7 +153,7 @@ static fts_symbol_t *dsp_symbol = 0;
#define KNOCKTHRESH 10.f /* don't know how to describe this */
-static float sigfiddle_partialonset[] =
+static t_float sigfiddle_partialonset[] =
{
0,
48,
@@ -173,7 +173,7 @@ static float sigfiddle_partialonset[] =
192,
};
-#define NPARTIALONSET ((int)(sizeof(sigfiddle_partialonset)/sizeof(float)))
+#define NPARTIALONSET ((int)(sizeof(sigfiddle_partialonset)/sizeof(t_float)))
static int sigfiddle_intpartialonset[] =
{
@@ -201,43 +201,43 @@ the sound to be upsampled has no energy above half the Nyquist, i.e.,
that it's already 2x oversampled compared to the theoretically possible
sample rate. I got these by trial and error. */
-#define FILT1 ((float)(.5 * 1.227054))
-#define FILT2 ((float)(.5 * -0.302385))
-#define FILT3 ((float)(.5 * 0.095326))
-#define FILT4 ((float)(.5 * -0.022748))
-#define FILT5 ((float)(.5 * 0.002533))
+#define FILT1 ((t_float)(.5 * 1.227054))
+#define FILT2 ((t_float)(.5 * -0.302385))
+#define FILT3 ((t_float)(.5 * 0.095326))
+#define FILT4 ((t_float)(.5 * -0.022748))
+#define FILT5 ((t_float)(.5 * 0.002533))
#define FILTSIZE 5
typedef struct peakout /* a peak for output */
{
- float po_freq; /* frequency in hz */
- float po_amp; /* amplitude */
+ t_float po_freq; /* frequency in hz */
+ t_float po_amp; /* amplitude */
} t_peakout;
typedef struct peak /* a peak for analysis */
{
- float p_freq; /* frequency in bins */
- float p_width; /* peak width in bins */
- float p_pow; /* peak power */
- float p_loudness; /* 4th root of power */
- float *p_fp; /* pointer back to spectrum */
+ t_float p_freq; /* frequency in bins */
+ t_float p_width; /* peak width in bins */
+ t_float p_pow; /* peak power */
+ t_float p_loudness; /* 4th root of power */
+ t_float *p_fp; /* pointer back to spectrum */
} t_peak;
typedef struct histopeak
{
- float h_pitch; /* estimated pitch */
- float h_value; /* value of peak */
- float h_loud; /* combined strength of found partials */
+ t_float h_pitch; /* estimated pitch */
+ t_float h_value; /* value of peak */
+ t_float h_loud; /* combined strength of found partials */
int h_index; /* index of bin holding peak */
int h_used; /* true if an x_hist entry points here */
} t_histopeak;
typedef struct pitchhist /* struct for keeping history by pitch */
{
- float h_pitch; /* pitch to output */
- float h_amps[HISTORY]; /* past amplitudes */
- float h_pitches[HISTORY]; /* past pitches */
- float h_noted; /* last pitch output */
+ t_float h_pitch; /* pitch to output */
+ t_float h_amps[HISTORY]; /* past amplitudes */
+ t_float h_pitches[HISTORY]; /* past pitches */
+ t_float h_noted; /* last pitch output */
int h_age; /* number of frames pitch has been there */
t_histopeak *h_wherefrom; /* new histogram peak to incorporate */
void *h_outlet;
@@ -264,33 +264,33 @@ typedef struct sigfiddle /* instance struct */
long x_downsample; /* downsample feature because of
MSP's large sig vector sizes */
#endif
- float *x_inbuf; /* buffer to analyze, npoints/2 elems */
- float *x_lastanalysis; /* FT of last buffer (see main comment) */
- float *x_spiral; /* 1/4-wave complex exponential */
+ t_float *x_inbuf; /* buffer to analyze, npoints/2 elems */
+ t_float *x_lastanalysis; /* FT of last buffer (see main comment) */
+ t_float *x_spiral; /* 1/4-wave complex exponential */
t_peakout *x_peakbuf; /* spectral peaks for output */
int x_npeakout; /* number of spectral peaks to output */
int x_npeakanal; /* number of spectral peaks to analyze */
int x_phase; /* number of points since last output */
int x_histphase; /* phase into amplitude history vector */
int x_hop; /* period of output, npoints/2 */
- float x_sr; /* sample rate */
+ t_float x_sr; /* sample rate */
t_pitchhist x_hist[MAXNPITCH]; /* history of current pitches */
int x_nprint; /* how many periods to print */
int x_npitch; /* number of simultaneous pitches */
- float x_dbs[HISTORY]; /* DB history, indexed by "histphase" */
- float x_peaked; /* peak since last attack */
+ t_float x_dbs[HISTORY]; /* DB history, indexed by "histphase" */
+ t_float x_peaked; /* peak since last attack */
int x_dbage; /* number of bins DB has met threshold */
int x_auto; /* true if generating continuous output */
/* parameters */
- float x_amplo;
- float x_amphi;
+ t_float x_amplo;
+ t_float x_amphi;
int x_attacktime;
int x_attackbins;
- float x_attackthresh;
+ t_float x_attackthresh;
int x_vibtime;
int x_vibbins;
- float x_vibdepth;
- float x_npartial;
+ t_float x_vibdepth;
+ t_float x_npartial;
/* outlets & clock */
void *x_envout;
int x_attackvalue;
@@ -300,15 +300,15 @@ typedef struct sigfiddle /* instance struct */
} t_sigfiddle;
#if CHECKER
-float fiddle_checker[1024];
+t_float fiddle_checker[1024];
#endif
#ifdef MSP
/* Mac compiler requires prototypes for everything */
int sigfiddle_ilog2(int n);
-float fiddle_mtof(float f);
-float fiddle_ftom(float f);
+t_float fiddle_mtof(t_float f);
+t_float fiddle_ftom(t_float f);
void sigfiddle_doit(t_sigfiddle *x);
void sigfiddle_debug(t_sigfiddle *x);
void sigfiddle_print(t_sigfiddle *x);
@@ -330,8 +330,8 @@ void sigfiddle_bang(t_sigfiddle *x);
void sigfiddle_ff(t_sigfiddle *x);
void *sigfiddle_new(long npoints, long npitch,
long npeakanal, long npeakout);
-void msp_fft(float *buf, long np, long inv);
-float msp_ffttemp[MAXPOINTS*2];
+void msp_fft(t_float *buf, long np, long inv);
+t_float msp_ffttemp[MAXPOINTS*2];
int errno;
#endif
@@ -346,12 +346,12 @@ int sigfiddle_ilog2(int n)
return (ret);
}
-float fiddle_mtof(float f)
+t_float fiddle_mtof(t_float f)
{
return (8.17579891564 * exp(.0577622650 * f));
}
-float fiddle_ftom(float f)
+t_float fiddle_ftom(t_float f)
{
return (17.3123405046 * log(.12231220585 * f));
}
@@ -362,14 +362,14 @@ void sigfiddle_doit(t_sigfiddle *x)
{
#ifdef MSP
/* prevents interrupt-level stack overflow crash with Netscape. */
- static float spect1[4*MAXPOINTS];
- static float spect2[MAXPOINTS + 4*FILTSIZE];
+ static t_float spect1[4*MAXPOINTS];
+ static t_float spect2[MAXPOINTS + 4*FILTSIZE];
#else
- float spect1[4*MAXPOINTS];
- float spect2[MAXPOINTS + 4*FILTSIZE];
+ t_float spect1[4*MAXPOINTS];
+ t_float spect2[MAXPOINTS + 4*FILTSIZE];
#endif
#if CHECKER
- float checker3[4*MAXPOINTS];
+ t_float checker3[4*MAXPOINTS];
#endif
t_peak peaklist[MAXPEAK + 1], *pk1;
@@ -377,10 +377,10 @@ void sigfiddle_doit(t_sigfiddle *x)
t_histopeak histvec[MAXHIST], *hp1;
int i, j, k, hop = x->x_hop, n = 2*hop, npeak, npitch,
logn = sigfiddle_ilog2(n), newphase, oldphase;
- float *fp, *fp1, *fp2, *fp3, total_power, total_loudness, total_db;
- float maxbin = BINPEROCT * (logn-2), *histogram = spect2 + BINGUARD;
+ t_float *fp, *fp1, *fp2, *fp3, total_power, total_loudness, total_db;
+ t_float maxbin = BINPEROCT * (logn-2), *histogram = spect2 + BINGUARD;
t_pitchhist *phist;
- float hzperbin = x->x_sr / (2.0f * n);
+ t_float hzperbin = x->x_sr / (2.0f * n);
int npeakout = x->x_npeakout, npeakanal = x->x_npeakanal;
int npeaktot = (npeakout > npeakanal ? npeakout : npeakanal);
@@ -455,7 +455,7 @@ void sigfiddle_doit(t_sigfiddle *x)
fp3 = spect2 + 2*FILTSIZE;
i < (hop>>1); i++)
{
- float re, im;
+ t_float re, im;
re= FILT1 * ( fp2[ -2] -fp2[ 1] +fp3[ -2] -fp3[ 1]) +
FILT2 * ( fp2[ -3] -fp2[ 2] +fp3[ -3] -fp3[ 2]) +
@@ -511,8 +511,8 @@ void sigfiddle_doit(t_sigfiddle *x)
for (i = MINBIN, fp1 = spect1+4*MINBIN, total_power = 0;
i < n-2; i++, fp1 += 4)
{
- float re = fp1[0] - 0.5f * (fp1[-8] + fp1[8]);
- float im = fp1[1] - 0.5f * (fp1[-7] + fp1[9]);
+ t_float re = fp1[0] - 0.5 * (fp1[-8] + fp1[8]);
+ t_float im = fp1[1] - 0.5 * (fp1[-7] + fp1[9]);
fp1[3] = (total_power += (fp1[2] = re * re + im * im));
}
@@ -555,8 +555,8 @@ void sigfiddle_doit(t_sigfiddle *x)
for (i = MINBIN, fp = spect1+4*MINBIN, pk1 = peaklist;
i < n-2 && npeak < npeaktot; i++, fp += 4)
{
- float height = fp[2], h1 = fp[-2], h2 = fp[6];
- float totalfreq, pfreq, f1, f2, m, var, stdev;
+ t_float height = fp[2], h1 = fp[-2], h2 = fp[6];
+ t_float totalfreq, pfreq, f1, f2, m, var, stdev;
if (height < h1 || height < h2 ||
h1 < 0.00001f*total_power || h2 < 0.00001f*total_power)
@@ -619,10 +619,10 @@ void sigfiddle_doit(t_sigfiddle *x)
for (i = 0, pk1 = peaklist, pk2 = x->x_peakbuf; i < npeak;
i++, pk1++, pk2++)
{
- float loudness = pk1->p_loudness;
+ t_float loudness = pk1->p_loudness;
if (i >= npeakout) break;
pk2->po_freq = hzperbin * pk1->p_freq;
- pk2->po_amp = (2.f / (float)n) * (loudness * loudness);
+ pk2->po_amp = (2. / (t_float)n) * (loudness * loudness);
}
for (; i < npeakout; i++, pk2++) pk2->po_amp = pk2->po_freq = 0;
@@ -637,18 +637,18 @@ void sigfiddle_doit(t_sigfiddle *x)
for (i = 0, fp1 = histogram; i < maxbin; i++) *fp1++ = 0;
for (i = 0, pk1 = peaklist; i < npeak; i++, pk1++)
{
- float pit = BPERO_OVER_LOG2 * flog(pk1->p_freq) - 96.0f;
- float binbandwidth = FACTORTOBINS * pk1->p_width/pk1->p_freq;
- float putbandwidth = (binbandwidth < 2 ? 2 : binbandwidth);
- float weightbandwidth = (binbandwidth < 1.0f ? 1.0f : binbandwidth);
- /* float weightamp = 1.0f + 3.0f * pk1->p_pow / pow; */
- float weightamp = 4. * pk1->p_loudness / total_loudness;
+ t_float pit = BPERO_OVER_LOG2 * flog(pk1->p_freq) - 96.0;
+ t_float binbandwidth = FACTORTOBINS * pk1->p_width/pk1->p_freq;
+ t_float putbandwidth = (binbandwidth < 2 ? 2 : binbandwidth);
+ t_float weightbandwidth = (binbandwidth < 1.0 ? 1.0 : binbandwidth);
+ /* t_float weightamp = 1.0f + 3.0f * pk1->p_pow / pow; */
+ t_float weightamp = 4. * pk1->p_loudness / total_loudness;
for (j = 0, fp2 = sigfiddle_partialonset; j < NPARTIALONSET; j++, fp2++)
{
- float bin = pit - *fp2;
+ t_float bin = pit - *fp2;
if (bin < maxbin)
{
- float para, pphase, score = 30.0f * weightamp /
+ t_float para, pphase, score = 30.0 * weightamp /
((j+x->x_npartial) * weightbandwidth);
int firstbin = bin + 0.5f - 0.5f * putbandwidth;
int lastbin = bin + 0.5f + 0.5f * putbandwidth;
@@ -669,7 +669,7 @@ void sigfiddle_doit(t_sigfiddle *x)
{
for (i = 0; i < 6*5; i++)
{
- float fhz = hzperbin * exp ((8*i + 96) * (1./BPERO_OVER_LOG2));
+ t_float fhz = hzperbin * exp ((8*i + 96) * (1./BPERO_OVER_LOG2));
if (!(i % 6)) post("-- bin %d pitch %f freq %f----", 8*i,
ftom(fhz), fhz);;
post("%3d %3d %3d %3d %3d %3d %3d %3d",
@@ -695,7 +695,7 @@ void sigfiddle_doit(t_sigfiddle *x)
for (npitch = 0; npitch < x->x_npitch; npitch++)
{
int indx;
- float best;
+ t_float best;
if (npitch)
{
for (best = 0, indx = -1, j=1; j < maxbin-1; j++)
@@ -764,17 +764,17 @@ void sigfiddle_doit(t_sigfiddle *x)
for (i = 0; i < npitch; i++)
{
- float cumpow = 0, cumstrength = 0, freqnum = 0, freqden = 0;
+ t_float cumpow = 0, cumstrength = 0, freqnum = 0, freqden = 0;
int npartials = 0, nbelow8 = 0;
/* guessed-at frequency in bins */
- float putfreq = fexp((1.0f / BPERO_OVER_LOG2) *
+ t_float putfreq = fexp((1.0 / BPERO_OVER_LOG2) *
(histvec[i].h_index + 96.0f));
for (j = 0; j < npeak; j++)
{
- float fpnum = peaklist[j].p_freq/putfreq;
+ t_float fpnum = peaklist[j].p_freq/putfreq;
int pnum = fpnum + 0.5f;
- float fipnum = pnum;
- float deviation;
+ t_float fipnum = pnum;
+ t_float deviation;
if (pnum > 16 || pnum < 1) continue;
deviation = 1.0f - fpnum/fipnum;
if (deviation > -PARTIALDEVIANCE && deviation < PARTIALDEVIANCE)
@@ -784,7 +784,7 @@ void sigfiddle_doit(t_sigfiddle *x)
* a halftone of a multiple of the putative frequency.
*/
- float stdev, weight;
+ t_float stdev, weight;
npartials++;
if (pnum < 8) nbelow8++;
cumpow += peaklist[j].p_pow;
@@ -811,9 +811,9 @@ void sigfiddle_doit(t_sigfiddle *x)
histvec[i].h_value = 0;
else
{
- float pitchpow = (cumstrength * cumstrength) *
+ t_float pitchpow = (cumstrength * cumstrength) *
(cumstrength * cumstrength);
- float freqinbins = freqnum/freqden;
+ t_float freqinbins = freqnum/freqden;
/* check for minimum output frequency */
if (freqinbins < MINFREQINBINS)
@@ -849,7 +849,7 @@ void sigfiddle_doit(t_sigfiddle *x)
/* for each old pitch, try to match a new one to it. */
for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
{
- float thispitch = phist->h_pitches[oldphase];
+ t_float thispitch = phist->h_pitches[oldphase];
phist->h_pitch = 0; /* no output, thanks */
phist->h_wherefrom = 0;
if (thispitch == 0.0f) continue;
@@ -958,7 +958,7 @@ void sigfiddle_doit(t_sigfiddle *x)
{
if (phist->h_wherefrom && phist->h_age >= x->x_vibbins)
{
- float centroid = 0;
+ t_float centroid = 0;
int not = 0;
for (j = 0, k = newphase; j < x->x_vibbins; j++)
{
@@ -970,7 +970,7 @@ void sigfiddle_doit(t_sigfiddle *x)
for (j = 0, k = newphase; j < x->x_vibbins; j++)
{
/* calculate deviation from norm */
- float dev = centroid - phist->h_pitches[k];
+ t_float dev = centroid - phist->h_pitches[k];
k--;
if (k < 0) k = HISTORY-1;
if (dev > x->x_vibdepth ||
@@ -1057,18 +1057,18 @@ static void sigfiddle_freebird(t_sigfiddle *x)
{
if (x->x_inbuf)
{
- freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
+ freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
x->x_inbuf = 0;
}
if (x->x_lastanalysis)
{
freebytes(x->x_lastanalysis,
- sizeof(float) * (2 * x->x_hop + 4 * FILTSIZE));
+ sizeof(t_float) * (2 * x->x_hop + 4 * FILTSIZE));
x->x_lastanalysis = 0;
}
if (x->x_spiral)
{
- freebytes(x->x_spiral, sizeof(float) * 2 * x->x_hop);
+ freebytes(x->x_spiral, sizeof(t_float) * 2 * x->x_hop);
x->x_spiral = 0;
}
x->x_hop = 0;
@@ -1089,12 +1089,12 @@ int sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg fnpoints)
npoints = (1 << sigfiddle_ilog2(npoints)));
}
x->x_hop = npoints >> 1;
- if (!(x->x_inbuf = (float *)getbytes(sizeof(float) * x->x_hop)))
+ if (!(x->x_inbuf = (t_float *)getbytes(sizeof(t_float) * x->x_hop)))
goto fail;
- if (!(x->x_lastanalysis = (float *)getbytes(
- sizeof(float) * (2 * x->x_hop + 4 * FILTSIZE))))
+ if (!(x->x_lastanalysis = (t_float *)getbytes(
+ sizeof(t_float) * (2 * x->x_hop + 4 * FILTSIZE))))
goto fail;
- if (!(x->x_spiral = (float *)getbytes(sizeof(float) * 2 * x->x_hop)))
+ if (!(x->x_spiral = (t_float *)getbytes(sizeof(t_float) * 2 * x->x_hop)))
goto fail;
for (i = 0; i < x->x_hop; i++)
x->x_inbuf[i] = 0;
@@ -1113,7 +1113,7 @@ fail:
int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch,
long npeakanal, long npeakout)
{
- float *buf1, *buf2, *buf3;
+ t_float *buf1, *buf2, *buf3;
t_peakout *buf4;
int i;
@@ -1197,8 +1197,8 @@ void sigfiddle_amprange13(fts_object_t *o, int winlet, fts_symbol_t s,
int ac, const fts_atom_t *at)
{
t_sigfiddle *x = (t_sigfiddle *)o;
- float lo = (float) fts_get_float_arg(ac, at, 0, 0);
- float hi = (float) fts_get_float_arg(ac, at, 1, 0);
+ t_float lo = (t_float) fts_get_float_arg(ac, at, 0, 0);
+ t_float hi = (t_float) fts_get_float_arg(ac, at, 1, 0);
sigfiddle_amprange(x, lo, hi);
}
@@ -1207,7 +1207,7 @@ void sigfiddle_reattack13(fts_object_t *o, int winlet, fts_symbol_t s,
{
t_sigfiddle *x = (t_sigfiddle *)o;
long msec = fts_get_float_arg(ac, at, 0, 0);
- float db = (float) fts_get_float_arg(ac, at, 1, 0);
+ t_float db = (t_float) fts_get_float_arg(ac, at, 1, 0);
sigfiddle_reattack(x, msec, db);
}
@@ -1216,7 +1216,7 @@ void sigfiddle_vibrato13(fts_object_t *o, int winlet, fts_symbol_t s,
{
t_sigfiddle *x = (t_sigfiddle *)o;
long msec = fts_get_float_arg(ac, at, 0, 0);
- float halftones = (float) fts_get_float_arg(ac, at, 1, 0);
+ t_float halftones = (t_float) fts_get_float_arg(ac, at, 1, 0);
sigfiddle_vibrato(x, msec, halftones);
}
@@ -1224,7 +1224,7 @@ void sigfiddle_npartial13(fts_object_t *o, int winlet, fts_symbol_t s,
int ac, const fts_atom_t *at)
{
t_sigfiddle *x = (t_sigfiddle *)o;
- float npartial = (float) fts_get_float_arg(ac, at, 0, 0);
+ t_float npartial = (t_float) fts_get_float_arg(ac, at, 0, 0);
sigfiddle_npartial(x, npartial);
}
@@ -1232,11 +1232,11 @@ void sigfiddle_npartial13(fts_object_t *o, int winlet, fts_symbol_t s,
void ftl_sigfiddle(fts_word_t *a)
{
t_sigfiddle *x = (t_sigfiddle *)fts_word_get_long(a);
- float *in = (float *)fts_word_get_long(a + 1);
+ t_float *in = (t_float *)fts_word_get_long(a + 1);
long n_tick = fts_word_get_long(a + 2);
int count;
- float *fp, *fp2;
+ t_float *fp, *fp2;
for (count = 0, fp = x->x_inbuf + x->x_phase;
count < n_tick; count++) *fp++ = *in++;
if (fp == x->x_inbuf + x->x_hop)
@@ -1301,7 +1301,7 @@ static void sigfiddle_delete(fts_object_t *o, int winlet, fts_symbol_t *s, int a
static void sigfiddle_init(fts_object_t *o, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at)
{
t_sigfiddle *x = (t_sigfiddle *)o;
- float *buf1, *buf2, *buf3;
+ t_float *buf1, *buf2, *buf3;
int i, hop;
long npoints = fts_get_long_arg(ac, at, 1, 0);
long npitch = fts_get_long_arg(ac, at, 2, 0);
@@ -1395,7 +1395,7 @@ static t_int *fiddle_perform(t_int *w)
t_sigfiddle *x = (t_sigfiddle *)(w[2]);
int n = (int)(w[3]);
int count;
- float *fp;
+ t_float *fp;
if (!x->x_hop)
goto nono;
for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count++)
@@ -1458,9 +1458,9 @@ void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
{
if (x->x_inbuf)
{
- freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(float) * 2*x->x_hop);
+ freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
+ freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 * FILTSIZE));
+ freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
clock_free(x->x_clock);
}
@@ -1533,10 +1533,10 @@ void fiddle_setup(void)
#ifdef MAX26
-void cu_fiddle(float *in1, t_sigfiddle *x, int n)
+void cu_fiddle(t_float *in1, t_sigfiddle *x, int n)
{
int count;
- float *fp, *fp2;
+ t_float *fp, *fp2;
for (count = 0, fp = x->x_inbuf + x->x_phase;
count < n; count++) *fp++ = *in1++;
if (fp == x->x_inbuf + x->x_hop)
@@ -1583,9 +1583,9 @@ void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
{
if (x->x_inbuf)
{
- freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(float) * 2*x->x_hop);
+ freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
+ freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 * FILTSIZE));
+ freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
clock_free(x->x_clock);
u_clean(x);
}
@@ -1645,7 +1645,7 @@ static t_int *fiddle_perform(t_int *w)
t_sigfiddle *x = (t_sigfiddle *)(w[2]);
int n = (int)(w[3]);
int count,inc = x->x_downsample;
- float *fp;
+ t_float *fp;
if (x->x_obj.z_disabled)
goto skip;
@@ -1746,10 +1746,10 @@ void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free MSP */
if (x->x_inbuf)
{
- t_freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
- t_freebytes(x->x_lastanalysis, sizeof(float) * (2*x->x_hop + 4 *
+ t_freebytes(x->x_inbuf, sizeof(t_float) * x->x_hop);
+ t_freebytes(x->x_lastanalysis, sizeof(t_float) * (2*x->x_hop + 4 *
FILTSIZE));
- t_freebytes(x->x_spiral, sizeof(float) * 2*x->x_hop);
+ t_freebytes(x->x_spiral, sizeof(t_float) * 2*x->x_hop);
t_freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
}
dsp_free((t_pxobject *)x);
@@ -1814,9 +1814,9 @@ void sigfiddle_assist(t_sigfiddle *x, void *b, long m, long a, char *s)
assist_string(3748,m,a,1,2,s);
}
-void msp_fft(float *buf, long np, long inv)
+void msp_fft(t_float *buf, long np, long inv)
{
- float *src,*real,*rp,*imag,*ip;
+ t_float *src,*real,*rp,*imag,*ip;
long i;
/*
diff --git a/externals/extra/loop~/loop~.c b/externals/extra/loop~/loop~.c
index 2fc3193e..ebe3d9d5 100644
--- a/externals/extra/loop~/loop~.c
+++ b/externals/extra/loop~/loop~.c
@@ -15,6 +15,7 @@ This file is downloadable from http://www.crca.ucsd.edu/~msp .
#include "m_pd.h"
#else
#define t_sample float
+#define t_float float
#endif
@@ -96,7 +97,7 @@ static void loopctl_init(t_loopctl *x)
x->l_phase = 0;
}
-static void loopctl_set(t_loopctl *x, float val)
+static void loopctl_set(t_loopctl *x, t_float val)
{
if (val < 0 || val > 1)
val = 0;
diff --git a/externals/extra/lrshift~/lrshift~.c b/externals/extra/lrshift~/lrshift~.c
index b3c90ff6..19dcb93d 100644
--- a/externals/extra/lrshift~/lrshift~.c
+++ b/externals/extra/lrshift~/lrshift~.c
@@ -8,7 +8,7 @@ typedef struct _lrshift_tilde
{
t_object x_obj;
int x_n;
- float x_f;
+ t_float x_f;
} t_lrshift_tilde;
static t_int *leftshift_perform(t_int *w)
diff --git a/externals/extra/pd~/pd~.c b/externals/extra/pd~/pd~.c
index 8a1f5c39..5fa1adb5 100644
--- a/externals/extra/pd~/pd~.c
+++ b/externals/extra/pd~/pd~.c
@@ -91,7 +91,7 @@ typedef struct _pd_tilde
int x_ninsig;
int x_noutsig;
int x_fifo;
- float x_sr;
+ t_float x_sr;
t_symbol *x_pddir;
t_symbol *x_schedlibdir;
t_sample **x_insig;
@@ -171,7 +171,7 @@ static void pd_tilde_readmessages(t_pd_tilde *x)
static void pd_tilde_donew(t_pd_tilde *x, char *pddir, char *schedlibdir,
char *patchdir, char *pdargs, int ninsig, int noutsig, int fifo,
- float samplerate)
+ t_float samplerate)
{
int i, pid, pipe1[2], pipe2[2];
char cmdbuf[MAXPDSTRING], pdexecbuf[MAXPDSTRING], schedbuf[MAXPDSTRING];
@@ -516,7 +516,7 @@ static void *pd_tilde_new(t_symbol *s, int argc, t_atom *argv)
{
t_pd_tilde *x = (t_pd_tilde *)pd_new(pd_tilde_class);
int ninsig = 2, noutsig = 2, j, fifo = 5;
- float sr = sys_getsr();
+ t_float sr = sys_getsr();
t_sample **g;
t_symbol *pddir = sys_libdir,
*scheddir = gensym(class_gethelpdir(pd_tilde_class));
@@ -695,7 +695,7 @@ int main()
static void *pd_tilde_new(t_symbol *s, long ac, t_atom *av)
{
int ninsig = 2, noutsig = 2, fifo = 5, j;
- float sr = sys_getsr();
+ t_float sr = sys_getsr();
t_symbol *pddir = gensym("."), *scheddir = gensym(".");
t_pd_tilde *x;
diff --git a/externals/extra/pique/pique.c b/externals/extra/pique/pique.c
index 19cee2ae..7c8b899b 100644
--- a/externals/extra/pique/pique.c
+++ b/externals/extra/pique/pique.c
@@ -19,11 +19,11 @@ typedef struct _pique
{
t_object x_obj;
int x_n;
- float x_errthresh;
- float *x_freq;
- float *x_amp;
- float *x_ampre;
- float *x_ampim;
+ t_float x_errthresh;
+ t_float *x_freq;
+ t_float *x_amp;
+ t_float *x_ampre;
+ t_float *x_ampim;
} t_pique;
static void *pique_new(t_floatarg f)
@@ -41,9 +41,9 @@ static void *pique_new(t_floatarg f)
return (x);
}
-static float hanning(float pidetune, float sinpidetune)
+static t_float hanning(t_float pidetune, t_float sinpidetune)
{
- float pi = 3.14159;
+ t_float pi = 3.141592653589793;
if (pidetune < 0.01 && pidetune > -0.01) return (1);
else if (pidetune > 3.14 && pidetune < 3.143) return (0.5);
else if (pidetune < -3.14 && pidetune > -3.143) return (0.5);
@@ -51,21 +51,21 @@ static float hanning(float pidetune, float sinpidetune)
(sinpidetune/(pidetune+pi) + sinpidetune/(pidetune-pi)));
}
-static float peakerror(t_word *fpreal, t_word *fpimag, float pidetune,
- float norm, float peakreal, float peakimag)
+static t_float peakerror(t_word *fpreal, t_word *fpimag, t_float pidetune,
+ t_float norm, t_float peakreal, t_float peakimag)
{
- float sinpidetune = sin(pidetune);
- float cospidetune = cos(pidetune);
- float windowshould = hanning(pidetune, sinpidetune);
- float realshould = windowshould * (
+ t_float sinpidetune = sin(pidetune);
+ t_float cospidetune = cos(pidetune);
+ t_float windowshould = hanning(pidetune, sinpidetune);
+ t_float realshould = windowshould * (
peakreal * cospidetune + peakimag * sinpidetune);
- float imagshould = windowshould * (
+ t_float imagshould = windowshould * (
peakimag * cospidetune - peakreal * sinpidetune);
- float realgot = norm * (fpreal[0].w_float -
+ t_float realgot = norm * (fpreal[0].w_float -
0.5 * (fpreal[1].w_float + fpreal[-1].w_float));
- float imaggot = norm * (fpimag[0].w_float -
+ t_float imaggot = norm * (fpimag[0].w_float -
0.5 * (fpimag[1].w_float + fpimag[-1].w_float));
- float realdev = realshould - realgot, imagdev = imagshould - imaggot;
+ t_float realdev = realshould - realgot, imagdev = imagshould - imaggot;
/* post("real %f->%f; imag %f->%f", realshould, realgot,
imagshould, imaggot); */
@@ -74,16 +74,16 @@ static float peakerror(t_word *fpreal, t_word *fpimag, float pidetune,
static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
int npeak, int *nfound, t_float *fpfreq, t_float *fpamp,
- t_float *fpampre, t_float *fpampim, float errthresh)
+ t_float *fpampre, t_float *fpampim, t_float errthresh)
{
- float srate = sys_getsr(); /* not sure how to get this correctly */
- float oneovern = 1.0/ (float)npts;
- float fperbin = srate * oneovern;
- float pow1, pow2 = 0, pow3 = 0, pow4 = 0, pow5 = 0;
- float re1, re2 = 0, re3 = fpreal->w_float;
- float im1, im2 = 0, im3 = 0, powthresh, relativeerror;
+ t_float srate = sys_getsr(); /* not sure how to get this correctly */
+ t_float oneovern = 1.0/ (t_float)npts;
+ t_float fperbin = srate * oneovern;
+ t_float pow1, pow2 = 0, pow3 = 0, pow4 = 0, pow5 = 0;
+ t_float re1, re2 = 0, re3 = fpreal->w_float;
+ t_float im1, im2 = 0, im3 = 0, powthresh, relativeerror;
int count, peakcount = 0, n2 = (npts >> 1);
- float *fp1, *fp2;
+ t_float *fp1, *fp2;
t_word *wp1, *wp2;
for (count = n2, wp1 = fpreal, wp2 = fpimag, powthresh = 0;
count--; wp1++, wp2++)
@@ -92,12 +92,12 @@ static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
powthresh *= 0.00001;
for (count = 1; count < n2; count++)
{
- float windreal, windimag, pi = 3.14159;
- float detune, pidetune, sinpidetune, cospidetune,
+ t_float windreal, windimag, pi = 3.141592653589793;
+ t_float detune, pidetune, sinpidetune, cospidetune,
ampcorrect, freqout, ampout, ampoutreal, ampoutimag;
- float rpeak, rpeaknext, rpeakprev;
- float ipeak, ipeaknext, ipeakprev;
- float errleft, errright;
+ t_float rpeak, rpeaknext, rpeakprev;
+ t_float ipeak, ipeaknext, ipeakprev;
+ t_float errleft, errright;
fpreal++;
fpimag++;
re1 = re2;
@@ -140,7 +140,7 @@ static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
/* if (count < 30) post("detune %f", detune); */
if (detune > 0.7 || detune < -0.7) continue;
/* the frequency is the sum of the bin frequency and detuning */
- freqout = fperbin * ((float)(count-3) + detune);
+ freqout = fperbin * ((t_float)(count-3) + detune);
pidetune = pi * detune;
sinpidetune = sin(pidetune);
cospidetune = cos(pidetune);
@@ -198,16 +198,16 @@ static void pique_list(t_pique *x, t_symbol *s, int argc, t_atom *argv)
else
{
int nfound, i;
- float *fpfreq = x->x_freq;
- float *fpamp = x->x_amp;
- float *fpampre = x->x_ampre;
- float *fpampim = x->x_ampim;
+ t_float *fpfreq = x->x_freq;
+ t_float *fpamp = x->x_amp;
+ t_float *fpampre = x->x_ampre;
+ t_float *fpampim = x->x_ampim;
pique_doit(npts, fpreal, fpimag, npeak,
&nfound, fpfreq, fpamp, fpampre, fpampim, x->x_errthresh);
for (i = 0; i < nfound; i++, fpamp++, fpfreq++, fpampre++, fpampim++)
{
t_atom at[5];
- SETFLOAT(at, (float)i);
+ SETFLOAT(at, (t_float)i);
SETFLOAT(at+1, *fpfreq);
SETFLOAT(at+2, *fpamp);
SETFLOAT(at+3, *fpampre);
diff --git a/externals/extra/sigmund~/sigmund~.c b/externals/extra/sigmund~/sigmund~.c
index 968c5c63..5d1d72f6 100644
--- a/externals/extra/sigmund~/sigmund~.c
+++ b/externals/extra/sigmund~/sigmund~.c
@@ -9,14 +9,27 @@
implement block ("-b") mode
*/
-/* From here to the first "#ifdef PD" or "#ifdef Max" should be extractable
+#ifdef PD
+#include "m_pd.h"
+#endif
+#ifdef MSP
+#include "ext.h"
+#include "z_dsp.h"
+#include "ext_support.h"
+#include "ext_proto.h"
+#include "ext_obex.h"
+typedef double t_floatarg;
+#define t_resizebytes(a, b, c) t_resizebytes((char *)(a), (b), (c))
+#endif
+
+/* From here to the next "#ifdef PD" or "#ifdef Max" should be extractable
and usable in other contexts. The one external requirement is a real
single-precision FFT, invoked as in the Mayer one: */
#ifdef _MSC_VER /* this is only needed with Microsoft's compiler */
__declspec(dllimport) extern
#endif
-void mayer_realfft(int npoints, float *buf);
+void mayer_realfft(int npoints, t_sample *buf);
/* this routine is passed a buffer of npoints values, and returns the
N/2+1 real parts of the DFT (frequency zero through Nyquist), followed
@@ -39,14 +52,14 @@ for example, defines this in the file d_fft_mayer.c or d_fft_fftsg.c. */
typedef struct peak
{
- float p_freq;
- float p_amp;
- float p_ampreal;
- float p_ampimag;
- float p_pit;
- float p_db;
- float p_salience;
- float p_tmp;
+ t_float p_freq;
+ t_float p_amp;
+ t_float p_ampreal;
+ t_float p_ampimag;
+ t_float p_pit;
+ t_float p_db;
+ t_float p_salience;
+ t_float p_tmp;
} t_peak;
/********************** service routines **************************/
@@ -64,18 +77,18 @@ static int sigmund_ilog2(int n)
return (ret);
}
-static float sigmund_ftom(float f)
+static t_float sigmund_ftom(t_float f)
{
return (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500);
}
#define LOGTEN 2.302585092994
-static float sigmund_powtodb(float f)
+static t_float sigmund_powtodb(t_float f)
{
if (f <= 0) return (0);
else
{
- float val = 100 + 10./LOGTEN * log(f);
+ t_float val = 100 + 10./LOGTEN * log(f);
return (val < 0 ? 0 : val);
}
}
@@ -85,25 +98,25 @@ static float sigmund_powtodb(float f)
#define W_BETA 0.5
#define NEGBINS 4 /* number of bins of negative frequency we'll need */
-#define PI 3.14159265
-#define LOG2 0.69314718
-#define LOG10 2.30258509
+#define PI 3.141592653589793
+#define LOG2 0.693147180559945
+#define LOG10 2.302585092994046
-static float sinx(float theta, float sintheta)
+static t_float sinx(t_float theta, t_float sintheta)
{
if (theta > -0.003 && theta < 0.003)
return (1);
else return (sintheta/theta);
}
-static float window_hann_mag(float pidetune, float sinpidetune)
+static t_float window_hann_mag(t_float pidetune, t_float sinpidetune)
{
return (W_ALPHA * sinx(pidetune, sinpidetune)
- 0.5 * W_BETA *
(sinx(pidetune+PI, sinpidetune) + sinx(pidetune-PI, sinpidetune)));
}
-static float window_mag(float pidetune, float cospidetune)
+static t_float window_mag(t_float pidetune, t_float cospidetune)
{
return (sinx(pidetune + (PI/2), cospidetune)
+ sinx(pidetune - (PI/2), -cospidetune));
@@ -120,15 +133,15 @@ static int sigmund_cmp_freq(const void *p1, const void *p2)
else return (0);
}
-static void sigmund_tweak(int npts, float *ftreal, float *ftimag,
- int npeak, t_peak *peaks, float fperbin, int loud)
+static void sigmund_tweak(int npts, t_float *ftreal, t_float *ftimag,
+ int npeak, t_peak *peaks, t_float fperbin, int loud)
{
t_peak **peakptrs = (t_peak **)alloca(sizeof (*peakptrs) * (npeak+1));
t_peak negpeak;
int peaki, j, k;
- float ampreal[3], ampimag[3];
- float binperf = 1./fperbin;
- float phaseperbin = (npts-0.5)/npts, oneovern = 1./npts;
+ t_float ampreal[3], ampimag[3];
+ t_float binperf = 1./fperbin;
+ t_float phaseperbin = (npts-0.5)/npts, oneovern = 1./npts;
if (npeak < 1)
return;
for (peaki = 0; peaki < npeak; peaki++)
@@ -142,7 +155,7 @@ static void sigmund_tweak(int npts, float *ftreal, float *ftimag,
{
int cbin = peakptrs[peaki]->p_freq*binperf + 0.5;
int nsub = (peaki == npeak ? 1:2);
- float windreal, windimag, windpower, detune, pidetune, sinpidetune,
+ t_float windreal, windimag, windpower, detune, pidetune, sinpidetune,
cospidetune, ampcorrect, ampout, ampoutreal, ampoutimag, freqout;
/* post("3 nsub %d amp %f freq %f", nsub,
peakptrs[peaki]->p_amp, peakptrs[peaki]->p_freq); */
@@ -154,15 +167,15 @@ static void sigmund_tweak(int npts, float *ftreal, float *ftimag,
for (j = 0; j < nsub; j++)
{
t_peak *neighbor = peakptrs[(peaki-1) + 2*j];
- float neighborreal = npts * neighbor->p_ampreal;
- float neighborimag = npts * neighbor->p_ampimag;
+ t_float neighborreal = npts * neighbor->p_ampreal;
+ t_float neighborimag = npts * neighbor->p_ampimag;
for (k = 0; k < 3; k++)
{
- float freqdiff = (0.5*PI) * ((cbin + 2*k-2)
+ t_float freqdiff = (0.5*PI) * ((cbin + 2*k-2)
-binperf * neighbor->p_freq);
- float sx = sinx(freqdiff, sin(freqdiff));
- float phasere = cos(freqdiff * phaseperbin);
- float phaseim = sin(freqdiff * phaseperbin);
+ t_float sx = sinx(freqdiff, sin(freqdiff));
+ t_float phasere = cos(freqdiff * phaseperbin);
+ t_float phaseim = sin(freqdiff * phaseperbin);
ampreal[k] -=
sx * (phasere * neighborreal - phaseim * neighborimag);
ampimag[k] -=
@@ -212,16 +225,16 @@ static void sigmund_tweak(int npts, float *ftreal, float *ftimag,
}
}
-static void sigmund_remask(int maxbin, int bestindex, float powmask,
- float maxpower, float *maskbuf)
+static void sigmund_remask(int maxbin, int bestindex, t_float powmask,
+ t_float maxpower, t_float *maskbuf)
{
int bin;
int bin1 = (bestindex > 52 ? bestindex-50:2);
int bin2 = (maxbin < bestindex + 50 ? bestindex + 50 : maxbin);
for (bin = bin1; bin < bin2; bin++)
{
- float bindiff = bin - bestindex;
- float mymask;
+ t_float bindiff = bin - bestindex;
+ t_float mymask;
mymask = powmask/ (1. + bindiff * bindiff * bindiff * bindiff);
if (bindiff < 2 && bindiff > -2)
mymask = 2*maxpower;
@@ -233,17 +246,17 @@ static void sigmund_remask(int maxbin, int bestindex, float powmask,
#define PEAKMASKFACTOR 1.
#define PEAKTHRESHFACTOR 0.6
-static void sigmund_getrawpeaks(int npts, float *insamps,
- int npeak, t_peak *peakv, int *nfound, float *power, float srate, int loud,
- float hifreq)
+static void sigmund_getrawpeaks(int npts, t_float *insamps,
+ int npeak, t_peak *peakv, int *nfound, t_float *power, t_float srate, int loud,
+ t_float hifreq)
{
- float oneovern = 1.0/ (float)npts;
- float fperbin = 0.5 * srate * oneovern, totalpower = 0;
+ t_float oneovern = 1.0/ (t_float)npts;
+ t_float fperbin = 0.5 * srate * oneovern, totalpower = 0;
int npts2 = 2*npts, i, bin;
int peakcount = 0;
- float *fp1, *fp2;
- float *rawreal, *rawimag, *maskbuf, *powbuf;
- float *bigbuf = alloca(sizeof (float ) * (2*NEGBINS + 6*npts));
+ t_float *fp1, *fp2;
+ t_float *rawreal, *rawimag, *maskbuf, *powbuf;
+ t_float *bigbuf = alloca(sizeof (t_float ) * (2*NEGBINS + 6*npts));
int maxbin = hifreq/fperbin;
if (maxbin > npts - NEGBINS)
maxbin = npts - NEGBINS;
@@ -276,7 +289,7 @@ static void sigmund_getrawpeaks(int npts, float *insamps,
#if 1
for (i = 0, fp1 = rawreal, fp2 = rawimag; i < maxbin; i++, fp1++, fp2++)
{
- float x1 = fp1[1] - fp1[-1], x2 = fp2[1] - fp2[-1], p = powbuf[i] = x1*x1+x2*x2;
+ t_float x1 = fp1[1] - fp1[-1], x2 = fp2[1] - fp2[-1], p = powbuf[i] = x1*x1+x2*x2;
if (i >= 2)
totalpower += p;
}
@@ -285,7 +298,7 @@ static void sigmund_getrawpeaks(int npts, float *insamps,
#endif
for (peakcount = 0; peakcount < npeak; peakcount++)
{
- float pow1, maxpower = 0, windreal, windimag, windpower,
+ t_float pow1, maxpower = 0, windreal, windimag, windpower,
detune, pidetune, sinpidetune, cospidetune, ampcorrect, ampout,
ampoutreal, ampoutimag, freqout, powmask;
int bestindex = -1;
@@ -296,7 +309,7 @@ static void sigmund_getrawpeaks(int npts, float *insamps,
pow1 = powbuf[bin];
if (pow1 > maxpower && pow1 > maskbuf[bin])
{
- float thresh = PEAKTHRESHFACTOR * (powbuf[bin-2]+powbuf[bin+2]);
+ t_float thresh = PEAKTHRESHFACTOR * (powbuf[bin-2]+powbuf[bin+2]);
if (pow1 > thresh)
maxpower = pow1, bestindex = bin;
}
@@ -363,13 +376,13 @@ static void sigmund_getrawpeaks(int npts, float *insamps,
#define SUBHARMONICS 16
#define DBPERHALFTONE 0.0
-static void sigmund_getpitch(int npeak, t_peak *peakv, float *freqp,
- float npts, float srate, float nharmonics, float amppower, int loud)
+static void sigmund_getpitch(int npeak, t_peak *peakv, t_float *freqp,
+ t_float npts, t_float srate, t_float nharmonics, t_float amppower, int loud)
{
- float fperbin = 0.5 * srate / npts;
+ t_float fperbin = 0.5 * srate / npts;
int npit = 48 * sigmund_ilog2(npts), i, j, k, nsalient;
- float bestbin, bestweight, sumamp, sumweight, sumfreq, freq;
- float *weights = (float *)alloca(sizeof(float) * npit);
+ t_float bestbin, bestweight, sumamp, sumweight, sumfreq, freq;
+ t_float *weights = (t_float *)alloca(sizeof(t_float) * npit);
t_peak *bigpeaks[PITCHNPEAK];
if (npeak < 1)
{
@@ -386,7 +399,7 @@ static void sigmund_getpitch(int npeak, t_peak *peakv, float *freqp,
for (nsalient = 0; nsalient < PITCHNPEAK; nsalient++)
{
t_peak *bestpeak = 0;
- float bestsalience = -1e20;
+ t_float bestsalience = -1e20;
for (j = 0; j < npeak; j++)
if (peakv[j].p_tmp == 0 && peakv[j].p_salience > bestsalience)
{
@@ -403,13 +416,13 @@ static void sigmund_getpitch(int npeak, t_peak *peakv, float *freqp,
for (i = 0; i < nsalient; i++)
{
t_peak *thispeak = bigpeaks[i];
- float weightindex = (48./LOG2) *
+ t_float weightindex = (48./LOG2) *
log(thispeak->p_freq/(2.*fperbin));
- float loudness = pow(thispeak->p_amp, amppower);
+ t_float loudness = pow(thispeak->p_amp, amppower);
/* post("index %f, uncertainty %f", weightindex, pitchuncertainty); */
for (j = 0; j < SUBHARMONICS; j++)
{
- float subindex = weightindex -
+ t_float subindex = weightindex -
(48./LOG2) * log(j + 1.);
int loindex = subindex - 0.5;
int hiindex = loindex+2;
@@ -447,11 +460,11 @@ static void sigmund_getpitch(int npeak, t_peak *peakv, float *freqp,
for (sumamp = sumweight = sumfreq = 0, i = 0; i < nsalient; i++)
{
t_peak *thispeak = bigpeaks[i];
- float thisloudness = thispeak->p_amp;
- float thisfreq = thispeak->p_freq;
- float harmonic = thisfreq/freq;
- float intpart = (int)(0.5 + harmonic);
- float inharm = harmonic - intpart;
+ t_float thisloudness = thispeak->p_amp;
+ t_float thisfreq = thispeak->p_freq;
+ t_float harmonic = thisfreq/freq;
+ t_float intpart = (int)(0.5 + harmonic);
+ t_float inharm = harmonic - intpart;
#if 0
if (loud)
post("freq %f intpart %f inharm %f", freq, intpart, inharm);
@@ -459,7 +472,7 @@ static void sigmund_getpitch(int npeak, t_peak *peakv, float *freqp,
if (intpart >= 1 && intpart <= 16 &&
inharm < 0.015 * intpart && inharm > - (0.015 * intpart))
{
- float weight = thisloudness * intpart;
+ t_float weight = thisloudness * intpart;
sumweight += weight;
sumfreq += weight*thisfreq/intpart;
#if 0
@@ -492,12 +505,12 @@ static void sigmund_peaktrack(int ninpeak, t_peak *inpeakv,
"out" peak, but no two to the same one. */
for (incnt = 0; incnt < ninpeak; incnt++)
{
- float besterror = 1e20;
+ t_float besterror = 1e20;
int bestcnt = -1;
inpeakv[incnt].p_tmp = -1;
for (outcnt = 0; outcnt < noutpeak; outcnt++)
{
- float thiserror =
+ t_float thiserror =
inpeakv[incnt].p_freq - outpeakv[outcnt].p_freq;
if (thiserror < 0)
thiserror = -thiserror;
@@ -539,15 +552,15 @@ static void sigmund_peaktrack(int ninpeak, t_peak *inpeakv,
typedef struct _histpoint
{
- float h_freq;
- float h_power;
+ t_float h_freq;
+ t_float h_power;
} t_histpoint;
typedef struct _notefinder
{
- float n_age;
- float n_hifreq;
- float n_lofreq;
+ t_float n_age;
+ t_float n_hifreq;
+ t_float n_lofreq;
int n_peaked;
t_histpoint n_hist[NHISTPOINT];
int n_histphase;
@@ -564,13 +577,13 @@ static void notefinder_init(t_notefinder *x)
x->n_hist[i].h_freq =x->n_hist[i].h_power = 0;
}
-static void notefinder_doit(t_notefinder *x, float freq, float power,
- float *note, float vibrato, int stableperiod, float powerthresh,
- float growththresh, int loud)
+static void notefinder_doit(t_notefinder *x, t_float freq, t_float power,
+ t_float *note, t_float vibrato, int stableperiod, t_float powerthresh,
+ t_float growththresh, int loud)
{
/* calculate frequency ratio between allowable vibrato extremes
(equal to twice the vibrato deviation from center) */
- float vibmultiple = exp((2*LOG2/12) * vibrato);
+ t_float vibmultiple = exp((2*LOG2/12) * vibrato);
int oldhistphase, i, k;
if (stableperiod > NHISTPOINT - 1)
stableperiod = NHISTPOINT - 1;
@@ -611,7 +624,7 @@ static void notefinder_doit(t_notefinder *x, float freq, float power,
steady. */
if (x->n_hifreq <= 0 && x->n_age > stableperiod)
{
- float maxpow = 0, freqatmaxpow = 0,
+ t_float maxpow = 0, freqatmaxpow = 0,
localhifreq = -1e20, locallofreq = 1e20;
int startphase = x->n_histphase - stableperiod + 1;
if (startphase < 0)
@@ -707,7 +720,7 @@ static void notefinder_doit(t_notefinder *x, float freq, float power,
if (freq >= 0 &&
(x->n_hifreq <= 0 || freq > x->n_hifreq || freq < x->n_lofreq))
{
- float testfhi = freq, testflo = freq,
+ t_float testfhi = freq, testflo = freq,
maxpow = x->n_hist[x->n_histphase].h_freq;
for (i = 0, k = x->n_histphase; i < stableperiod-1; i++)
{
@@ -729,7 +742,7 @@ static void notefinder_doit(t_notefinder *x, float freq, float power,
&& maxpow > powerthresh)
{
/* report new note */
- float sumf = 0, sumw = 0, thisw;
+ t_float sumf = 0, sumw = 0, thisw;
for (i = 0, k = x->n_histphase; i < stableperiod; i++)
{
thisw = x->n_hist[k].h_power;
@@ -764,18 +777,6 @@ static void notefinder_doit(t_notefinder *x, float freq, float power,
/* From here onward, the code is specific to eithr Pd, Max, or both. If
neither "PD 'nor "MSP" is defined, none of this is compiled, so that the
whole file can be included in other, non-PD and non-Max projects. */
-#ifdef PD
-#include "m_pd.h"
-#endif
-#ifdef MSP
-#include "ext.h"
-#include "z_dsp.h"
-#include "ext_support.h"
-#include "ext_proto.h"
-#include "ext_obex.h"
-typedef float t_floatarg;
-#define t_resizebytes(a, b, c) t_resizebytes((char *)(a), (b), (c))
-#endif
#if (defined(PD) || defined (MSP))
@@ -820,7 +821,7 @@ typedef struct _sigmund
#ifdef PD
t_object x_obj;
t_clock *x_clock;
- float x_f; /* for main signal inlet */
+ t_float x_f; /* for main signal inlet */
#endif /* PD */
#ifdef MSP
t_pxobject x_obj;
@@ -830,7 +831,7 @@ typedef struct _sigmund
#endif /* MSP */
t_varout *x_varoutv;
int x_nvarout;
- float x_sr; /* sample rate */
+ t_float x_sr; /* sample rate */
int x_mode; /* MODE_STREAM, etc. */
int x_npts; /* number of points in analysis window */
int x_npeak; /* number of peaks to find */
@@ -839,14 +840,14 @@ typedef struct _sigmund
int x_infill; /* number of points filled */
int x_countdown; /* countdown to start filling buffer */
int x_hop; /* samples between analyses */
- float x_maxfreq; /* highest-frequency peak to report */
- float x_vibrato; /* vibrato depth in half tones */
- float x_stabletime; /* period of stability needed for note */
- float x_growth; /* growth to set off a new note */
- float x_minpower; /* minimum power, in DB, for a note */
- float x_param1; /* three parameters for temporary use */
- float x_param2;
- float x_param3;
+ t_float x_maxfreq; /* highest-frequency peak to report */
+ t_float x_vibrato; /* vibrato depth in half tones */
+ t_float x_stabletime; /* period of stability needed for note */
+ t_float x_growth; /* growth to set off a new note */
+ t_float x_minpower; /* minimum power, in DB, for a note */
+ t_float x_param1; /* three parameters for temporary use */
+ t_float x_param2;
+ t_float x_param3;
t_notefinder x_notefinder; /* note parsing state */
t_peak *x_trackv; /* peak tracking state */
int x_ntrack; /* number of peaks tracked */
@@ -968,12 +969,12 @@ static void sigmund_minpower(t_sigmund *x, t_floatarg f)
x->x_minpower = f;
}
-static void sigmund_doit(t_sigmund *x, int npts, float *arraypoints,
- int loud, float srate)
+static void sigmund_doit(t_sigmund *x, int npts, t_float *arraypoints,
+ int loud, t_float srate)
{
t_peak *peakv = (t_peak *)alloca(sizeof(t_peak) * x->x_npeak);
int nfound, i, cnt;
- float freq = 0, power, note = 0;
+ t_float freq = 0, power, note = 0;
sigmund_getrawpeaks(npts, arraypoints, x->x_npeak, peakv,
&nfound, &power, srate, loud, x->x_maxfreq);
if (x->x_dopitch)
@@ -981,7 +982,7 @@ static void sigmund_doit(t_sigmund *x, int npts, float *arraypoints,
x->x_param1, x->x_param2, loud);
if (x->x_donote)
notefinder_doit(&x->x_notefinder, freq, power, &note, x->x_vibrato,
- 1 + x->x_stabletime * 0.001f * x->x_sr / (float)x->x_hop,
+ 1 + x->x_stabletime * 0.001 * x->x_sr / (t_float)x->x_hop,
exp(LOG10*0.1*(x->x_minpower - 100)), x->x_growth, loud);
if (x->x_dotracks)
sigmund_peaktrack(nfound, peakv, x->x_ntrack, x->x_trackv, loud);
@@ -1005,7 +1006,7 @@ static void sigmund_doit(t_sigmund *x, int npts, float *arraypoints,
for (i = 0; i < nfound; i++)
{
t_atom at[5];
- SETFLOAT(at, (float)i);
+ SETFLOAT(at, (t_float)i);
SETFLOAT(at+1, peakv[i].p_freq);
SETFLOAT(at+2, 2*peakv[i].p_amp);
SETFLOAT(at+3, 2*peakv[i].p_ampreal);
@@ -1017,7 +1018,7 @@ static void sigmund_doit(t_sigmund *x, int npts, float *arraypoints,
for (i = 0; i < x->x_ntrack; i++)
{
t_atom at[4];
- SETFLOAT(at, (float)i);
+ SETFLOAT(at, (t_float)i);
SETFLOAT(at+1, x->x_trackv[i].p_freq);
SETFLOAT(at+2, 2*x->x_trackv[i].p_amp);
SETFLOAT(at+3, x->x_trackv[i].p_tmp);
@@ -1110,7 +1111,7 @@ static void sigmund_tick(t_sigmund *x)
static t_int *sigmund_perform(t_int *w)
{
t_sigmund *x = (t_sigmund *)(w[1]);
- t_sample *in = (float *)(w[2]);
+ t_sample *in = (t_sample *)(w[2]);
int n = (int)(w[3]);
if (x->x_hop % n)
@@ -1120,7 +1121,7 @@ static t_int *sigmund_perform(t_int *w)
else if (x->x_infill != x->x_npts)
{
int j;
- float *fp = x->x_inbuf + x->x_infill;
+ t_float *fp = x->x_inbuf + x->x_infill;
for (j = 0; j < n; j++)
*fp++ = *in++;
x->x_infill += n;
@@ -1292,11 +1293,11 @@ static void sigmund_list(t_sigmund *x, t_symbol *s, int argc, t_atom *argv)
t_symbol *syminput = atom_getsymbolarg(0, argc, argv);
int npts = atom_getintarg(1, argc, argv);
int onset = atom_getintarg(2, argc, argv);
- float srate = atom_getfloatarg(3, argc, argv);
+ t_float srate = atom_getfloatarg(3, argc, argv);
int loud = atom_getfloatarg(4, argc, argv);
int arraysize, totstorage, nfound, i;
t_garray *a;
- float *arraypoints, pit;
+ t_float *arraypoints, pit;
t_word *wordarray = 0;
if (argc < 5)
{
@@ -1314,7 +1315,7 @@ static void sigmund_list(t_sigmund *x, t_symbol *s, int argc, t_atom *argv)
error("sigmund: negative onset");
return;
}
- arraypoints = alloca(sizeof(float)*npts);
+ arraypoints = alloca(sizeof(t_float)*npts);
if (!(a = (t_garray *)pd_findbyclass(syminput, garray_class)) ||
!garray_getfloatwords(a, &arraysize, &wordarray) ||
arraysize < onset + npts)
@@ -1423,10 +1424,10 @@ static void sigmund_tick(t_sigmund *x)
static t_int *sigmund_perform(t_int *w)
{
t_sigmund *x = (t_sigmund *)(w[1]);
- float *in = (float *)(w[2]);
+ t_float *in = (t_float *)(w[2]);
int n = (int)(w[3]), j;
int infill = x->x_infill;
- float *fp = x->x_inbuf2 + infill;
+ t_float *fp = x->x_inbuf2 + infill;
if (x->x_obj.z_disabled) /* return if in muted MSP subpatch -Rd */
return (w+4);