From e2407c2da010b59e586705ef10dd4b16ea5a80f0 Mon Sep 17 00:00:00 2001 From: Miller Puckette <msp@ucsd.edu> Date: Mon, 17 Dec 2007 19:11:01 -0800 Subject: [PATCH] took big patches to rely more on t_float, etc. --- msw/makesfx.bat | 6 +- src/d_arithmetic.c | 224 +++++++++++++++++------------------ src/d_array.c | 56 ++++----- src/d_ctl.c | 118 +++++++++---------- src/d_dac.c | 26 ++--- src/d_delay.c | 45 +++---- src/d_fft.c | 68 +++++------ src/d_fft_fftsg.c | 18 +-- src/d_fft_mayer.c | 2 +- src/d_filter.c | 286 ++++++++++++++++++++++----------------------- src/d_global.c | 46 ++++---- src/d_math.c | 74 ++++++------ src/d_misc.c | 4 +- src/d_osc.c | 2 +- src/d_resample.c | 38 +++--- src/d_ugen.c | 24 ++-- src/g_all_guis.h | 8 +- src/g_array.c | 90 +++++++------- src/g_canvas.c | 24 ++-- src/g_canvas.h | 60 +++++----- src/g_editor.c | 22 ++-- src/g_graph.c | 40 +++---- src/g_hdial.c | 14 +-- src/g_hslider.c | 2 +- src/g_io.c | 24 ++-- src/g_numbox.c | 2 +- src/g_readwrite.c | 10 +- src/g_rtext.c | 2 +- src/g_scalar.c | 18 +-- src/g_template.c | 140 +++++++++++----------- src/g_text.c | 2 +- src/g_toggle.c | 10 +- src/g_traversal.c | 4 +- src/g_vdial.c | 14 +-- src/g_vslider.c | 2 +- src/g_vumeter.c | 6 +- src/m_binbuf.c | 4 +- src/m_class.c | 2 +- src/m_obj.c | 6 +- src/m_pd.h | 49 ++++---- src/m_sched.c | 4 +- src/s_audio.c | 28 ++--- src/s_audio_oss.c | 10 +- src/s_main.c | 2 +- src/s_print.c | 4 +- src/s_stuff.h | 6 +- src/x_acoustics.c | 16 +-- src/x_arithmetic.c | 20 ++-- src/x_connective.c | 6 +- src/x_list.c | 4 +- src/x_midi.c | 30 ++--- src/x_misc.c | 6 +- src/x_qlist.c | 10 +- src/x_time.c | 4 +- 54 files changed, 874 insertions(+), 868 deletions(-) diff --git a/msw/makesfx.bat b/msw/makesfx.bat index ce10aa4cd..5e54224c9 100644 --- a/msw/makesfx.bat +++ b/msw/makesfx.bat @@ -1 +1,5 @@ -makesfx /zip=pd-0.37-1test6.zip /sfx=pd-x.msw.exe /title=Pd /website=crca.ucsd.edu/~msp /defaultpath=$programfiles$ +zip -r pd-0.41-0test09.msw.zip pd + +makesfx /zip=pd-0.41-0test09.msw.zip /sfx=pd-0.41-0test09.msw.exe /title=Pd /website=crca.ucsd.edu/~msp /defaultpath=$programfiles$ + +pscp pd-0.41-0test09.msw.zip pd-0.41-0test09.msw.exe msp@crca.ucsd.edu:public_html/Software diff --git a/src/d_arithmetic.c b/src/d_arithmetic.c index adbcfb156..02671e36c 100644 --- a/src/d_arithmetic.c +++ b/src/d_arithmetic.c @@ -16,13 +16,13 @@ static t_class *plus_class, *scalarplus_class; typedef struct _plus { t_object x_obj; - float x_f; + t_float x_f; } t_plus; typedef struct _scalarplus { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; /* inlet value */ } t_scalarplus; @@ -50,9 +50,9 @@ static void *plus_new(t_symbol *s, int argc, t_atom *argv) t_int *plus_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in1++ + *in2++; return (w+5); @@ -60,17 +60,17 @@ t_int *plus_perform(t_int *w) t_int *plus_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = f0 + g0; out[1] = f1 + g1; out[2] = f2 + g2; out[3] = f3 + g3; out[4] = f4 + g4; out[5] = f5 + g5; out[6] = f6 + g6; out[7] = f7 + g7; @@ -80,9 +80,9 @@ t_int *plus_perf8(t_int *w) t_int *scalarplus_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in++ + f; return (w+5); @@ -90,14 +90,14 @@ t_int *scalarplus_perform(t_int *w) t_int *scalarplus_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = f0 + g; out[1] = f1 + g; out[2] = f2 + g; out[3] = f3 + g; out[4] = f4 + g; out[5] = f5 + g; out[6] = f6 + g; out[7] = f7 + g; @@ -149,13 +149,13 @@ static t_class *minus_class, *scalarminus_class; typedef struct _minus { t_object x_obj; - float x_f; + t_float x_f; } t_minus; typedef struct _scalarminus { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; } t_scalarminus; @@ -183,9 +183,9 @@ static void *minus_new(t_symbol *s, int argc, t_atom *argv) t_int *minus_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in1++ - *in2++; return (w+5); @@ -193,17 +193,17 @@ t_int *minus_perform(t_int *w) t_int *minus_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = f0 - g0; out[1] = f1 - g1; out[2] = f2 - g2; out[3] = f3 - g3; out[4] = f4 - g4; out[5] = f5 - g5; out[6] = f6 - g6; out[7] = f7 - g7; @@ -213,9 +213,9 @@ t_int *minus_perf8(t_int *w) t_int *scalarminus_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in++ - f; return (w+5); @@ -223,14 +223,14 @@ t_int *scalarminus_perform(t_int *w) t_int *scalarminus_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = f0 - g; out[1] = f1 - g; out[2] = f2 - g; out[3] = f3 - g; out[4] = f4 - g; out[5] = f5 - g; out[6] = f6 - g; out[7] = f7 - g; @@ -280,13 +280,13 @@ static t_class *times_class, *scalartimes_class; typedef struct _times { t_object x_obj; - float x_f; + t_float x_f; } t_times; typedef struct _scalartimes { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; } t_scalartimes; @@ -314,9 +314,9 @@ static void *times_new(t_symbol *s, int argc, t_atom *argv) t_int *times_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in1++ * *in2++; return (w+5); @@ -324,17 +324,17 @@ t_int *times_perform(t_int *w) t_int *times_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = f0 * g0; out[1] = f1 * g1; out[2] = f2 * g2; out[3] = f3 * g3; out[4] = f4 * g4; out[5] = f5 * g5; out[6] = f6 * g6; out[7] = f7 * g7; @@ -344,9 +344,9 @@ t_int *times_perf8(t_int *w) t_int *scalartimes_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = *in++ * f; return (w+5); @@ -354,14 +354,14 @@ t_int *scalartimes_perform(t_int *w) t_int *scalartimes_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = f0 * g; out[1] = f1 * g; out[2] = f2 * g; out[3] = f3 * g; out[4] = f4 * g; out[5] = f5 * g; out[6] = f6 * g; out[7] = f7 * g; @@ -410,13 +410,13 @@ static t_class *over_class, *scalarover_class; typedef struct _over { t_object x_obj; - float x_f; + t_float x_f; } t_over; typedef struct _scalarover { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; } t_scalarover; @@ -444,13 +444,13 @@ static void *over_new(t_symbol *s, int argc, t_atom *argv) t_int *over_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - float g = *in2++; + t_sample g = *in2++; *out++ = (g ? *in1++ / g : 0); } return (w+5); @@ -458,17 +458,17 @@ t_int *over_perform(t_int *w) t_int *over_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = (g0? f0 / g0 : 0); out[1] = (g1? f1 / g1 : 0); @@ -484,9 +484,9 @@ t_int *over_perf8(t_int *w) t_int *scalarover_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); if(f) f = 1./f; while (n--) *out++ = *in++ * f; @@ -495,15 +495,15 @@ t_int *scalarover_perform(t_int *w) t_int *scalarover_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); if (g) g = 1.f / g; for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = f0 * g; out[1] = f1 * g; out[2] = f2 * g; out[3] = f3 * g; out[4] = f4 * g; out[5] = f5 * g; out[6] = f6 * g; out[7] = f7 * g; @@ -552,13 +552,13 @@ static t_class *max_class, *scalarmax_class; typedef struct _max { t_object x_obj; - float x_f; + t_float x_f; } t_max; typedef struct _scalarmax { t_object x_obj; - float x_f; + t_float x_f; t_float x_g; } t_scalarmax; @@ -586,13 +586,13 @@ static void *max_new(t_symbol *s, int argc, t_atom *argv) t_int *max_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - float f = *in1++, g = *in2++; + t_sample f = *in1++, g = *in2++; *out++ = (f > g ? f : g); } return (w+5); @@ -600,17 +600,17 @@ t_int *max_perform(t_int *w) t_int *max_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = (f0 > g0 ? f0 : g0); out[1] = (f1 > g1 ? f1 : g1); out[2] = (f2 > g2 ? f2 : g2); out[3] = (f3 > g3 ? f3 : g3); @@ -622,13 +622,13 @@ t_int *max_perf8(t_int *w) t_int *scalarmax_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - t_float g = *in++; + t_sample g = *in++; *out++ = (f > g ? f : g); } return (w+5); @@ -636,14 +636,14 @@ t_int *scalarmax_perform(t_int *w) t_int *scalarmax_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = (f0 > g ? f0 : g); out[1] = (f1 > g ? f1 : g); out[2] = (f2 > g ? f2 : g); out[3] = (f3 > g ? f3 : g); @@ -694,14 +694,14 @@ static t_class *min_class, *scalarmin_class; typedef struct _min { t_object x_obj; - float x_f; + t_float x_f; } t_min; typedef struct _scalarmin { t_object x_obj; t_float x_g; - float x_f; + t_float x_f; } t_scalarmin; static void *min_new(t_symbol *s, int argc, t_atom *argv) @@ -728,13 +728,13 @@ static void *min_new(t_symbol *s, int argc, t_atom *argv) t_int *min_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - float f = *in1++, g = *in2++; + t_sample f = *in1++, g = *in2++; *out++ = (f < g ? f : g); } return (w+5); @@ -742,17 +742,17 @@ t_int *min_perform(t_int *w) t_int *min_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *in2 = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { - float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; - float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + t_sample f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + t_sample f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; - float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; - float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + t_sample g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + t_sample g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = (f0 < g0 ? f0 : g0); out[1] = (f1 < g1 ? f1 : g1); out[2] = (f2 < g2 ? f2 : g2); out[3] = (f3 < g3 ? f3 : g3); @@ -764,13 +764,13 @@ t_int *min_perf8(t_int *w) t_int *scalarmin_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float f = *(t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - t_float g = *in++; + t_sample g = *in++; *out++ = (f < g ? f : g); } return (w+5); @@ -778,14 +778,14 @@ t_int *scalarmin_perform(t_int *w) t_int *scalarmin_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_float g = *(t_float *)(w[2]); t_float *out = (t_float *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in += 8, out += 8) { - float f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; - float f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; + t_sample f0 = in[0], f1 = in[1], f2 = in[2], f3 = in[3]; + t_sample f4 = in[4], f5 = in[5], f6 = in[6], f7 = in[7]; out[0] = (f0 < g ? f0 : g); out[1] = (f1 < g ? f1 : g); out[2] = (f2 < g ? f2 : g); out[3] = (f3 < g ? f3 : g); diff --git a/src/d_array.c b/src/d_array.c index d78c26aee..73a18418f 100644 --- a/src/d_array.c +++ b/src/d_array.c @@ -20,7 +20,7 @@ typedef struct _tabwrite_tilde int x_nsampsintab; t_word *x_vec; t_symbol *x_arrayname; - float x_f; + t_float x_f; } t_tabwrite_tilde; static void tabwrite_tilde_tick(t_tabwrite_tilde *x); @@ -45,7 +45,7 @@ static void tabwrite_tilde_redraw(t_tabwrite_tilde *x) static t_int *tabwrite_tilde_perform(t_int *w) { t_tabwrite_tilde *x = (t_tabwrite_tilde *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = (int)(w[3]), phase = x->x_phase, endphase = x->x_nsampsintab; if (!x->x_vec) goto bad; @@ -57,7 +57,7 @@ static t_int *tabwrite_tilde_perform(t_int *w) phase += nxfer; while (nxfer--) { - float f = *in++; + t_sample f = *in++; if (PD_BIGORSMALL(f)) f = 0; (wp++)->w_float = f; @@ -168,7 +168,7 @@ static void *tabplay_tilde_new(t_symbol *s) static t_int *tabplay_tilde_perform(t_int *w) { t_tabplay_tilde *x = (t_tabplay_tilde *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); t_word *wp; int n = (int)(w[3]), phase = x->x_phase, endphase = (x->x_nsampsintab < x->x_limit ? @@ -276,7 +276,7 @@ typedef struct _tabread_tilde int x_npoints; t_word *x_vec; t_symbol *x_arrayname; - float x_f; + t_float x_f; } t_tabread_tilde; static void *tabread_tilde_new(t_symbol *s) @@ -292,8 +292,8 @@ static void *tabread_tilde_new(t_symbol *s) static t_int *tabread_tilde_perform(t_int *w) { t_tabread_tilde *x = (t_tabread_tilde *)(w[1]); - t_float *in = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); int maxindex; t_word *buf = x->x_vec; @@ -372,7 +372,7 @@ typedef struct _tabread4_tilde int x_npoints; t_word *x_vec; t_symbol *x_arrayname; - float x_f; + t_float x_f; } t_tabread4_tilde; static void *tabread4_tilde_new(t_symbol *s) @@ -388,8 +388,8 @@ static void *tabread4_tilde_new(t_symbol *s) static t_int *tabread4_tilde_perform(t_int *w) { t_tabread4_tilde *x = (t_tabread4_tilde *)(w[1]); - t_float *in = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); int maxindex; t_word *buf = x->x_vec, *wp; @@ -402,7 +402,7 @@ static t_int *tabread4_tilde_perform(t_int *w) #if 0 /* test for spam -- I'm not ready to deal with this */ for (i = 0, xmax = 0, xmin = maxindex, fp = in1; i < n; i++, fp++) { - float f = *in1; + t_sample f = *in1; if (f < xmin) xmin = f; else if (f > xmax) xmax = f; } @@ -410,16 +410,16 @@ static t_int *tabread4_tilde_perform(t_int *w) for (i = 0, splitlo = xmin+ x->c_maxextent, splithi = xmax - x->c_maxextent, fp = in1; i < n; i++, fp++) { - float f = *in1; + t_sample f = *in1; if (f > splitlo && f < splithi) goto zero; } #endif for (i = 0; i < n; i++) { - float findex = *in++; + t_sample findex = *in++; int index = findex; - float frac, a, b, c, d, cminusb; + t_sample frac, a, b, c, d, cminusb; static int count; if (index < 1) index = 1, frac = 0; @@ -547,13 +547,13 @@ static t_class *tabosc4_tilde_class; typedef struct _tabosc4_tilde { t_object x_obj; - float x_fnpoints; - float x_finvnpoints; + t_float x_fnpoints; + t_float x_finvnpoints; t_word *x_vec; t_symbol *x_arrayname; - float x_f; + t_float x_f; double x_phase; - float x_conv; + t_float x_conv; } t_tabosc4_tilde; static void *tabosc4_tilde_new(t_symbol *s) @@ -572,14 +572,14 @@ static void *tabosc4_tilde_new(t_symbol *s) static t_int *tabosc4_tilde_perform(t_int *w) { t_tabosc4_tilde *x = (t_tabosc4_tilde *)(w[1]); - t_float *in = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); int normhipart; union tabfudge tf; - float fnpoints = x->x_fnpoints; + t_float fnpoints = x->x_fnpoints; int mask = fnpoints - 1; - float conv = fnpoints * x->x_conv; + t_float conv = fnpoints * x->x_conv; int maxindex; t_word *tab = x->x_vec, *addr; int i; @@ -592,7 +592,7 @@ static t_int *tabosc4_tilde_perform(t_int *w) #if 1 while (n--) { - float frac, a, b, c, d, cminusb; + t_sample frac, a, b, c, d, cminusb; tf.tf_d = dphase; dphase += *in++ * conv; addr = tab + (tf.tf_i[HIOFFSET] & mask); @@ -694,7 +694,7 @@ typedef struct _tabsend int x_graphperiod; int x_graphcount; t_symbol *x_arrayname; - float x_f; + t_float x_f; } t_tabsend; static void tabsend_tick(t_tabsend *x); @@ -711,7 +711,7 @@ static void *tabsend_new(t_symbol *s) static t_int *tabsend_perform(t_int *w) { t_tabsend *x = (t_tabsend *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = w[3]; t_word *dest = x->x_vec; int i = x->x_graphcount; @@ -719,7 +719,7 @@ static t_int *tabsend_perform(t_int *w) while (n--) { - float f = *in++; + t_sample f = *in++; if (PD_BIGORSMALL(f)) f = 0; (dest++)->w_float = f; @@ -785,7 +785,7 @@ typedef struct _tabreceive static t_int *tabreceive_perform(t_int *w) { t_tabreceive *x = (t_tabreceive *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = w[3]; t_word *from = x->x_vec; if (from) @@ -964,7 +964,7 @@ typedef struct _tabwrite { t_object x_obj; t_symbol *x_arrayname; - float x_ft1; + t_float x_ft1; } t_tabwrite; static void tabwrite_float(t_tabwrite *x, t_float f) diff --git a/src/d_ctl.c b/src/d_ctl.c index a33647ce6..92467abe0 100644 --- a/src/d_ctl.c +++ b/src/d_ctl.c @@ -15,13 +15,13 @@ static t_class *sig_tilde_class; typedef struct _sig { t_object x_obj; - float x_f; + t_float x_f; } t_sig; static t_int *sig_tilde_perform(t_int *w) { t_float f = *(t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); while (n--) *out++ = f; @@ -31,7 +31,7 @@ static t_int *sig_tilde_perform(t_int *w) static t_int *sig_tilde_perf8(t_int *w) { t_float f = *(t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); for (; n; n -= 8, out += 8) @@ -48,7 +48,7 @@ static t_int *sig_tilde_perf8(t_int *w) return (w+4); } -void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n) +void dsp_add_scalarcopy(t_float *in, t_sample *out, int n) { if (n&7) dsp_add(sig_tilde_perform, 3, in, out, n); @@ -88,14 +88,14 @@ static t_class *line_tilde_class; typedef struct _line { t_object x_obj; - float x_target; - float x_value; - float x_biginc; - float x_inc; - float x_1overn; - float x_dspticktomsec; - float x_inletvalue; - float x_inletwas; + t_sample x_target; /* target value of ramp */ + t_sample x_value; /* current value of ramp at block-borders */ + t_sample x_biginc; + t_sample x_inc; + t_float x_1overn; + t_float x_dspticktomsec; + t_float x_inletvalue; + t_float x_inletwas; int x_ticksleft; int x_retarget; } t_line; @@ -103,9 +103,9 @@ typedef struct _line static t_int *line_tilde_perform(t_int *w) { t_line *x = (t_line *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - float f = x->x_value; + t_sample f = x->x_value; if (PD_BIGORSMALL(f)) x->x_value = f = 0; @@ -114,20 +114,20 @@ static t_int *line_tilde_perform(t_int *w) int nticks = x->x_inletwas * x->x_dspticktomsec; if (!nticks) nticks = 1; x->x_ticksleft = nticks; - x->x_biginc = (x->x_target - x->x_value)/(float)nticks; + x->x_biginc = (x->x_target - x->x_value)/(t_float)nticks; x->x_inc = x->x_1overn * x->x_biginc; x->x_retarget = 0; } if (x->x_ticksleft) { - float f = x->x_value; + t_sample f = x->x_value; while (n--) *out++ = f, f += x->x_inc; x->x_value += x->x_biginc; x->x_ticksleft--; } else { - float g = x->x_value = x->x_target; + t_sample g = x->x_value = x->x_target; while (n--) *out++ = g; } @@ -138,9 +138,9 @@ static t_int *line_tilde_perform(t_int *w) static t_int *line_tilde_perf8(t_int *w) { t_line *x = (t_line *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - float f = x->x_value; + t_sample f = x->x_value; if (PD_BIGORSMALL(f)) x->x_value = f = 0; @@ -149,20 +149,20 @@ static t_int *line_tilde_perf8(t_int *w) int nticks = x->x_inletwas * x->x_dspticktomsec; if (!nticks) nticks = 1; x->x_ticksleft = nticks; - x->x_biginc = (x->x_target - x->x_value)/(float)nticks; + x->x_biginc = (x->x_target - x->x_value)/(t_sample)nticks; x->x_inc = x->x_1overn * x->x_biginc; x->x_retarget = 0; } if (x->x_ticksleft) { - float f = x->x_value; + t_sample f = x->x_value; while (n--) *out++ = f, f += x->x_inc; x->x_value += x->x_biginc; x->x_ticksleft--; } else { - float f = x->x_value = x->x_target; + t_sample f = x->x_value = x->x_target; for (; n; n -= 8, out += 8) { out[0] = f; out[1] = f; out[2] = f; out[3] = f; @@ -232,7 +232,7 @@ typedef struct _vseg { double s_targettime; double s_starttime; - float s_target; + t_sample s_target; struct _vseg *s_next; } t_vseg; @@ -245,9 +245,9 @@ typedef struct _vline double x_samppermsec; double x_msecpersamp; double x_targettime; - float x_target; - float x_inlet1; - float x_inlet2; + t_sample x_target; + t_float x_inlet1; + t_float x_inlet2; t_vseg *x_list; } t_vline; @@ -320,8 +320,8 @@ static void vline_tilde_stop(t_vline *x) static void vline_tilde_float(t_vline *x, t_float f) { double timenow = clock_gettimesince(x->x_referencetime); - float inlet1 = (x->x_inlet1 < 0 ? 0 : x->x_inlet1); - float inlet2 = x->x_inlet2; + t_float inlet1 = (x->x_inlet1 < 0 ? 0 : x->x_inlet1); + t_float inlet2 = x->x_inlet2; double starttime = timenow + inlet2; t_vseg *s1, *s2, *deletefrom = 0, *snew; if (PD_BIGORSMALL(f)) @@ -416,7 +416,7 @@ typedef struct _snapshot { t_object x_obj; t_sample x_value; - float x_f; + t_float x_f; } t_snapshot; static void *snapshot_tilde_new(void) @@ -430,8 +430,8 @@ static void *snapshot_tilde_new(void) static t_int *snapshot_tilde_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); *out = *in; return (w+3); } @@ -473,8 +473,8 @@ typedef struct _vsnapshot int x_n; int x_gotone; t_sample *x_vec; - float x_f; - float x_sampspermsec; + t_float x_f; + t_float x_sampspermsec; double x_time; } t_vsnapshot; @@ -491,9 +491,9 @@ static void *vsnapshot_tilde_new(void) static t_int *vsnapshot_tilde_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_vsnapshot *x = (t_vsnapshot *)(w[2]); - t_float *out = x->x_vec; + t_sample *out = x->x_vec; int n = x->x_n, i; for (i = 0; i < n; i++) out[i] = in[i]; @@ -519,7 +519,7 @@ static void vsnapshot_tilde_dsp(t_vsnapshot *x, t_signal **sp) static void vsnapshot_tilde_bang(t_vsnapshot *x) { - float val; + t_sample val; if (x->x_gotone) { int indx = clock_gettimesince(x->x_time) * x->x_sampspermsec; @@ -560,14 +560,14 @@ typedef struct sigenv t_object x_obj; /* header */ void *x_outlet; /* a "float" outlet */ void *x_clock; /* a "clock" object */ - float *x_buf; /* a Hanning window */ + t_sample *x_buf; /* a Hanning window */ int x_phase; /* number of points since last output */ int x_period; /* requested period of output */ int x_realperiod; /* period rounded up to vecsize multiple */ int x_npoints; /* analysis window size in samples */ - float x_result; /* result to output */ - float x_sumbuf[MAXOVERLAP]; /* summing buffer */ - float x_f; + t_float x_result; /* result to output */ + t_sample x_sumbuf[MAXOVERLAP]; /* summing buffer */ + t_float x_f; int x_allocforvs; /* extra buffer for DSP vector size */ } t_sigenv; @@ -579,14 +579,14 @@ static void *env_tilde_new(t_floatarg fnpoints, t_floatarg fperiod) int npoints = fnpoints; int period = fperiod; t_sigenv *x; - float *buf; + t_sample *buf; int i; if (npoints < 1) npoints = 1024; if (period < 1) period = npoints/2; if (period < npoints / MAXOVERLAP + 1) period = npoints / MAXOVERLAP + 1; - if (!(buf = getbytes(sizeof(float) * (npoints + INITVSTAKEN)))) + if (!(buf = getbytes(sizeof(t_sample) * (npoints + INITVSTAKEN)))) { error("env: couldn't allocate buffer"); return (0); @@ -610,17 +610,17 @@ static void *env_tilde_new(t_floatarg fnpoints, t_floatarg fperiod) static t_int *env_tilde_perform(t_int *w) { t_sigenv *x = (t_sigenv *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = (int)(w[3]); int count; - float *sump; + t_sample *sump; in += n; for (count = x->x_phase, sump = x->x_sumbuf; count < x->x_npoints; count += x->x_realperiod, sump++) { - float *hp = x->x_buf + count; - float *fp = in; - float sum = *sump; + t_sample *hp = x->x_buf + count; + t_sample *fp = in; + t_sample sum = *sump; int i; for (i = 0; i < n; i++) @@ -653,14 +653,14 @@ static void env_tilde_dsp(t_sigenv *x, t_signal **sp) if (sp[0]->s_n > x->x_allocforvs) { void *xx = resizebytes(x->x_buf, - (x->x_npoints + x->x_allocforvs) * sizeof(float), - (x->x_npoints + sp[0]->s_n) * sizeof(float)); + (x->x_npoints + x->x_allocforvs) * sizeof(t_sample), + (x->x_npoints + sp[0]->s_n) * sizeof(t_sample)); if (!xx) { post("env~: out of memory"); return; } - x->x_buf = (t_float *)xx; + x->x_buf = (t_sample *)xx; x->x_allocforvs = sp[0]->s_n; } dsp_add(env_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); @@ -674,7 +674,7 @@ static void env_tilde_tick(t_sigenv *x) /* callback function for the clock */ static void env_tilde_ff(t_sigenv *x) /* cleanup on free */ { clock_free(x->x_clock); - freebytes(x->x_buf, (x->x_npoints + x->x_allocforvs) * sizeof(float)); + freebytes(x->x_buf, (x->x_npoints + x->x_allocforvs) * sizeof(*x->x_buf)); } @@ -696,14 +696,14 @@ typedef struct _threshold_tilde t_outlet *x_outlet1; /* bang out for high thresh */ t_outlet *x_outlet2; /* bang out for low thresh */ t_clock *x_clock; /* wakeup for message output */ - float x_f; /* scalar inlet */ + t_float x_f; /* scalar inlet */ int x_state; /* 1 = high, 0 = low */ - float x_hithresh; /* value of high threshold */ - float x_lothresh; /* value of low threshold */ - float x_deadwait; /* msec remaining in dead period */ - float x_msecpertick; /* msec per DSP tick */ - float x_hideadtime; /* hi dead time in msec */ - float x_lodeadtime; /* lo dead time in msec */ + t_float x_hithresh; /* value of high threshold */ + t_float x_lothresh; /* value of low threshold */ + t_float x_deadwait; /* msec remaining in dead period */ + t_float x_msecpertick; /* msec per DSP tick */ + t_float x_hideadtime; /* hi dead time in msec */ + t_float x_lodeadtime; /* lo dead time in msec */ } t_threshold_tilde; static void threshold_tilde_tick(t_threshold_tilde *x); @@ -758,7 +758,7 @@ static void threshold_tilde_tick(t_threshold_tilde *x) static t_int *threshold_tilde_perform(t_int *w) { - float *in1 = (float *)(w[1]); + t_sample *in1 = (t_sample *)(w[1]); t_threshold_tilde *x = (t_threshold_tilde *)(w[2]); int n = (t_int)(w[3]); if (x->x_deadwait > 0) diff --git a/src/d_dac.c b/src/d_dac.c index 776438441..9d206c757 100644 --- a/src/d_dac.c +++ b/src/d_dac.c @@ -16,7 +16,7 @@ typedef struct _dac t_object x_obj; t_int x_n; t_int *x_vec; - float x_f; + t_float x_f; } t_dac; static void *dac_new(t_symbol *s, int argc, t_atom *argv) @@ -103,8 +103,8 @@ static void *adc_new(t_symbol *s, int argc, t_atom *argv) t_int *copy_perform(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); while (n--) *out++ = *in1++; return (w+4); @@ -112,20 +112,20 @@ t_int *copy_perform(t_int *w) t_int *copy_perf8(t_int *w) { - t_float *in1 = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); for (; n; n -= 8, in1 += 8, out += 8) { - float f0 = in1[0]; - float f1 = in1[1]; - float f2 = in1[2]; - float f3 = in1[3]; - float f4 = in1[4]; - float f5 = in1[5]; - float f6 = in1[6]; - float f7 = in1[7]; + t_sample f0 = in1[0]; + t_sample f1 = in1[1]; + t_sample f2 = in1[2]; + t_sample f3 = in1[3]; + t_sample f4 = in1[4]; + t_sample f5 = in1[5]; + t_sample f6 = in1[6]; + t_sample f7 = in1[7]; out[0] = f0; out[1] = f1; diff --git a/src/d_delay.c b/src/d_delay.c index 8ba5a0a50..98cc1149a 100644 --- a/src/d_delay.c +++ b/src/d_delay.c @@ -16,7 +16,7 @@ static t_class *sigdelwrite_class; typedef struct delwritectl { int c_n; - float *c_vec; + t_sample *c_vec; int c_phase; } t_delwritectl; @@ -28,7 +28,7 @@ typedef struct _sigdelwrite int x_sortno; /* DSP sort number at which this was last put on chain */ int x_rsortno; /* DSP sort # for first delread or write in chain */ int x_vecsize; /* vector size for delread~ to use */ - float x_f; + t_float x_f; } t_sigdelwrite; #define XTRASAMPS 4 @@ -59,13 +59,13 @@ static void *sigdelwrite_new(t_symbol *s, t_floatarg msec) if (!*s->s_name) s = gensym("delwrite~"); pd_bind(&x->x_obj.ob_pd, s); x->x_sym = s; - nsamps = msec * sys_getsr() * (float)(0.001f); + nsamps = msec * sys_getsr() * (t_float)(0.001f); if (nsamps < 1) nsamps = 1; nsamps += ((- nsamps) & (SAMPBLK - 1)); nsamps += DEFDELVS; x->x_cspace.c_n = nsamps; x->x_cspace.c_vec = - (float *)getbytes((nsamps + XTRASAMPS) * sizeof(float)); + (t_sample *)getbytes((nsamps + XTRASAMPS) * sizeof(t_sample)); x->x_cspace.c_phase = XTRASAMPS; x->x_sortno = 0; x->x_vecsize = 0; @@ -75,15 +75,16 @@ static void *sigdelwrite_new(t_symbol *s, t_floatarg msec) static t_int *sigdelwrite_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); t_delwritectl *c = (t_delwritectl *)(w[2]); int n = (int)(w[3]); int phase = c->c_phase, nsamps = c->c_n; - float *vp = c->c_vec, *bp = vp + phase, *ep = vp + (c->c_n + XTRASAMPS); + t_sample *vp = c->c_vec, *bp = vp + phase, *ep = vp + (c->c_n + XTRASAMPS); phase += n; + while (n--) { - float f = *in++; + t_sample f = *in++; if (PD_BIGORSMALL(f)) f = 0; *bp++ = f; @@ -97,6 +98,8 @@ static t_int *sigdelwrite_perform(t_int *w) phase -= nsamps; } } + bp = vp + c->c_phase; + c->c_phase = phase; return (w+4); } @@ -112,7 +115,7 @@ static void sigdelwrite_free(t_sigdelwrite *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); freebytes(x->x_cspace.c_vec, - (x->x_cspace.c_n + XTRASAMPS) * sizeof(float)); + (x->x_cspace.c_n + XTRASAMPS) * sizeof(t_sample)); } static void sigdelwrite_setup(void) @@ -172,15 +175,15 @@ static void sigdelread_float(t_sigdelread *x, t_float f) static t_int *sigdelread_perform(t_int *w) { - t_float *out = (t_float *)(w[1]); + t_sample *out = (t_sample *)(w[1]); t_delwritectl *c = (t_delwritectl *)(w[2]); int delsamps = *(int *)(w[3]); int n = (int)(w[4]); int phase = c->c_phase - delsamps, nsamps = c->c_n; - float *vp = c->c_vec, *bp, *ep = vp + (c->c_n + XTRASAMPS); - + t_sample *vp = c->c_vec, *bp, *ep = vp + (c->c_n + XTRASAMPS); if (phase < 0) phase += nsamps; bp = vp + phase; + while (n--) { *out++ = *bp++; @@ -228,7 +231,7 @@ typedef struct _sigvd t_symbol *x_sym; t_float x_sr; /* samples per msec */ int x_zerodel; /* 0 or vecsize depending on read/write order */ - float x_f; + t_float x_f; } t_sigvd; static void *sigvd_new(t_symbol *s) @@ -245,28 +248,28 @@ static void *sigvd_new(t_symbol *s) static t_int *sigvd_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_delwritectl *ctl = (t_delwritectl *)(w[3]); t_sigvd *x = (t_sigvd *)(w[4]); int n = (int)(w[5]); int nsamps = ctl->c_n; - float limit = nsamps - n - 1; - float fn = n-1; - float *vp = ctl->c_vec, *bp, *wp = vp + ctl->c_phase; - float zerodel = x->x_zerodel; + t_sample limit = nsamps - n - 1; + t_sample fn = n-1; + t_sample *vp = ctl->c_vec, *bp, *wp = vp + ctl->c_phase; + t_sample zerodel = x->x_zerodel; while (n--) { - float delsamps = x->x_sr * *in++ - zerodel, frac; + t_sample delsamps = x->x_sr * *in++ - zerodel, frac; int idelsamps; - float a, b, c, d, cminusb; + t_sample a, b, c, d, cminusb; if (delsamps < 1.00001f) delsamps = 1.00001f; if (delsamps > limit) delsamps = limit; delsamps += fn; fn = fn - 1.0f; idelsamps = delsamps; - frac = delsamps - (float)idelsamps; + frac = delsamps - (t_sample)idelsamps; bp = wp - idelsamps; if (bp < vp + 4) bp += nsamps; d = bp[-3]; diff --git a/src/d_fft.c b/src/d_fft.c index 006a985a4..464f48d10 100644 --- a/src/d_fft.c +++ b/src/d_fft.c @@ -16,12 +16,12 @@ linked in. The configure script can be used to select which one. /* swap two arrays */ static t_int *sigfft_swap(t_int *w) { - float *in1 = (t_float *)(w[1]); - float *in2 = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); int n = w[3]; for (;n--; in1++, in2++) { - float f = *in1; + t_sample f = *in1; *in1 = *in2; *in2 = f; } @@ -34,8 +34,8 @@ static t_int *sigfft_swap(t_int *w) static t_int *sigrfft_flip(t_int *w) { - float *in = (t_float *)(w[1]); - float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = w[3]; while (n--) *(--out) = - *in++; @@ -48,7 +48,7 @@ static t_class *sigfft_class, *sigifft_class; typedef struct fft { t_object x_obj; - float x_f; + t_float x_f; } t_sigfft; static void *sigfft_new(void) @@ -73,8 +73,8 @@ static void *sigifft_new(void) static t_int *sigfft_perform(t_int *w) { - float *in1 = (t_float *)(w[1]); - float *in2 = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); int n = w[3]; mayer_fft(n, in1, in2); return (w+4); @@ -82,8 +82,8 @@ static t_int *sigfft_perform(t_int *w) static t_int *sigifft_perform(t_int *w) { - float *in1 = (t_float *)(w[1]); - float *in2 = (t_float *)(w[2]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); int n = w[3]; mayer_ifft(n, in1, in2); return (w+4); @@ -92,10 +92,10 @@ static t_int *sigifft_perform(t_int *w) static void sigfft_dspx(t_sigfft *x, t_signal **sp, t_int *(*f)(t_int *w)) { int n = sp[0]->s_n; - float *in1 = sp[0]->s_vec; - float *in2 = sp[1]->s_vec; - float *out1 = sp[2]->s_vec; - float *out2 = sp[3]->s_vec; + t_sample *in1 = sp[0]->s_vec; + t_sample *in2 = sp[1]->s_vec; + t_sample *out1 = sp[2]->s_vec; + t_sample *out2 = sp[3]->s_vec; if (out1 == in2 && out2 == in1) dsp_add(sigfft_swap, 3, out1, out2, n); else if (out1 == in2) @@ -142,7 +142,7 @@ static t_class *sigrfft_class; typedef struct rfft { t_object x_obj; - float x_f; + t_float x_f; } t_sigrfft; static void *sigrfft_new(void) @@ -156,7 +156,7 @@ static void *sigrfft_new(void) static t_int *sigrfft_perform(t_int *w) { - float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); int n = w[2]; mayer_realfft(n, in); return (w+3); @@ -165,9 +165,9 @@ static t_int *sigrfft_perform(t_int *w) static void sigrfft_dsp(t_sigrfft *x, t_signal **sp) { int n = sp[0]->s_n, n2 = (n>>1); - float *in1 = sp[0]->s_vec; - float *out1 = sp[1]->s_vec; - float *out2 = sp[2]->s_vec; + t_sample *in1 = sp[0]->s_vec; + t_sample *out1 = sp[1]->s_vec; + t_sample *out2 = sp[2]->s_vec; if (n < 4) { error("fft: minimum 4 points"); @@ -199,7 +199,7 @@ static t_class *sigrifft_class; typedef struct rifft { t_object x_obj; - float x_f; + t_float x_f; } t_sigrifft; static void *sigrifft_new(void) @@ -213,7 +213,7 @@ static void *sigrifft_new(void) static t_int *sigrifft_perform(t_int *w) { - float *in = (t_float *)(w[1]); + t_sample *in = (t_sample *)(w[1]); int n = w[2]; mayer_realifft(n, in); return (w+3); @@ -222,9 +222,9 @@ static t_int *sigrifft_perform(t_int *w) static void sigrifft_dsp(t_sigrifft *x, t_signal **sp) { int n = sp[0]->s_n, n2 = (n>>1); - float *in1 = sp[0]->s_vec; - float *in2 = sp[1]->s_vec; - float *out1 = sp[2]->s_vec; + t_sample *in1 = sp[0]->s_vec; + t_sample *in2 = sp[1]->s_vec; + t_sample *out1 = sp[2]->s_vec; if (n < 4) { error("fft: minimum 4 points"); @@ -259,7 +259,7 @@ static t_class *sigframp_class; typedef struct framp { t_object x_obj; - float x_f; + t_float x_f; } t_sigframp; static void *sigframp_new(void) @@ -274,15 +274,15 @@ static void *sigframp_new(void) static t_int *sigframp_perform(t_int *w) { - float *inreal = (t_float *)(w[1]); - float *inimag = (t_float *)(w[2]); - float *outfreq = (t_float *)(w[3]); - float *outamp = (t_float *)(w[4]); - float lastreal = 0, currentreal = inreal[0], nextreal = inreal[1]; - float lastimag = 0, currentimag = inimag[0], nextimag = inimag[1]; + t_sample *inreal = (t_sample *)(w[1]); + t_sample *inimag = (t_sample *)(w[2]); + t_sample *outfreq = (t_sample *)(w[3]); + t_sample *outamp = (t_sample *)(w[4]); + t_sample lastreal = 0, currentreal = inreal[0], nextreal = inreal[1]; + t_sample lastimag = 0, currentimag = inimag[0], nextimag = inimag[1]; int n = w[5]; int m = n + 1; - float fbin = 1, oneovern2 = 1.f/((float)n * (float)n); + t_sample fbin = 1, oneovern2 = 1.f/((t_sample)n * (t_sample)n); inreal += 2; inimag += 2; @@ -290,7 +290,7 @@ static t_int *sigframp_perform(t_int *w) n -= 2; while (n--) { - float re, im, pow, freq; + t_sample re, im, pow, freq; lastreal = currentreal; currentreal = nextreal; nextreal = *inreal++; @@ -302,7 +302,7 @@ static t_int *sigframp_perform(t_int *w) pow = re * re + im * im; if (pow > 1e-19) { - float detune = ((lastreal - nextreal) * re + + t_sample detune = ((lastreal - nextreal) * re + (lastimag - nextimag) * im) / (2.0f * pow); if (detune > 2 || detune < -2) freq = pow = 0; else freq = fbin + detune; diff --git a/src/d_fft_fftsg.c b/src/d_fft_fftsg.c index 4d89ef7b0..1fed1e6ec 100644 --- a/src/d_fft_fftsg.c +++ b/src/d_fft_fftsg.c @@ -71,16 +71,16 @@ static int ooura_init( int n) return (1); } -EXTERN void mayer_fht(float *fz, int n) +EXTERN void mayer_fht(t_sample *fz, int n) { post("FHT: not yet implemented"); } -EXTERN void mayer_dofft(float *fz1, float *fz2, int n, int sgn) +EXTERN void mayer_dofft(t_sample *fz1, t_sample *fz2, int n, int sgn) { FFTFLT *buf, *fp3; int i; - float *fp1, *fp2; + t_sample *fp1, *fp2; buf = alloca(n * (2 * sizeof(FFTFLT))); if (!ooura_init(n)) return; @@ -99,21 +99,21 @@ EXTERN void mayer_dofft(float *fz1, float *fz2, int n, int sgn) } } -EXTERN void mayer_fft(int n, float *fz1, float *fz2) +EXTERN void mayer_fft(int n, t_sample *fz1, t_sample *fz2) { mayer_dofft(fz1, fz2, n, -1); } -EXTERN void mayer_ifft(int n, float *fz1, float *fz2) +EXTERN void mayer_ifft(int n, t_sample *fz1, t_sample *fz2) { mayer_dofft(fz1, fz2, n, 1); } -EXTERN void mayer_realfft(int n, float *fz) +EXTERN void mayer_realfft(int n, t_sample *fz) { FFTFLT *buf, *fp3; int i, nover2 = n/2; - float *fp1, *fp2; + t_sample *fp1, *fp2; buf = alloca(n * sizeof(FFTFLT)); if (!ooura_init(n)) return; @@ -127,11 +127,11 @@ EXTERN void mayer_realfft(int n, float *fz) *fp1 = fp3[0], *fp2 = fp3[1]; } -EXTERN void mayer_realifft(int n, float *fz) +EXTERN void mayer_realifft(int n, t_sample *fz) { FFTFLT *buf, *fp3; int i, nover2 = n/2; - float *fp1, *fp2; + t_sample *fp1, *fp2; buf = alloca(n * sizeof(FFTFLT)); if (!ooura_init(n)) return; diff --git a/src/d_fft_mayer.c b/src/d_fft_mayer.c index 860b31209..8df7fb3ff 100644 --- a/src/d_fft_mayer.c +++ b/src/d_fft_mayer.c @@ -58,7 +58,7 @@ /* the following is needed only to declare pd_fft() as exportable in MSW */ #include "m_pd.h" -#define REAL float +#define REAL t_sample #define GOOD_TRIG #ifdef GOOD_TRIG diff --git a/src/d_filter.c b/src/d_filter.c index 93aeac4cc..18b3b145d 100644 --- a/src/d_filter.c +++ b/src/d_filter.c @@ -11,18 +11,18 @@ typedef struct hipctl { - float c_x; - float c_coef; + t_sample c_x; + t_sample c_coef; } t_hipctl; typedef struct sighip { t_object x_obj; - float x_sr; - float x_hz; + t_float x_sr; + t_float x_hz; t_hipctl x_cspace; t_hipctl *x_ctl; - float x_f; + t_float x_f; } t_sighip; t_class *sighip_class; @@ -54,18 +54,18 @@ static void sighip_ft1(t_sighip *x, t_floatarg f) static t_int *sighip_perform(t_int *w) { - float *in = (float *)(w[1]); - float *out = (float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_hipctl *c = (t_hipctl *)(w[3]); int n = (t_int)(w[4]); int i; - float last = c->c_x; - float coef = c->c_coef; + t_sample last = c->c_x; + t_sample coef = c->c_coef; if (coef < 1) { for (i = 0; i < n; i++) { - float new = *in++ + coef * last; + t_sample new = *in++ + coef * last; *out++ = new - last; last = new; } @@ -112,18 +112,18 @@ void sighip_setup(void) typedef struct lopctl { - float c_x; - float c_coef; + t_sample c_x; + t_sample c_coef; } t_lopctl; typedef struct siglop { t_object x_obj; - float x_sr; - float x_hz; + t_float x_sr; + t_float x_hz; t_lopctl x_cspace; t_lopctl *x_ctl; - float x_f; + t_float x_f; } t_siglop; t_class *siglop_class; @@ -161,14 +161,14 @@ static void siglop_clear(t_siglop *x, t_floatarg q) static t_int *siglop_perform(t_int *w) { - float *in = (float *)(w[1]); - float *out = (float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_lopctl *c = (t_lopctl *)(w[3]); int n = (t_int)(w[4]); int i; - float last = c->c_x; - float coef = c->c_coef; - float feedback = 1 - coef; + t_sample last = c->c_x; + t_sample coef = c->c_coef; + t_sample feedback = 1 - coef; for (i = 0; i < n; i++) last = *out++ = coef * *in++ + feedback * last; if (PD_BIGORSMALL(last)) @@ -202,22 +202,22 @@ void siglop_setup(void) typedef struct bpctl { - float c_x1; - float c_x2; - float c_coef1; - float c_coef2; - float c_gain; + t_sample c_x1; + t_sample c_x2; + t_sample c_coef1; + t_sample c_coef2; + t_sample c_gain; } t_bpctl; typedef struct sigbp { t_object x_obj; - float x_sr; - float x_freq; - float x_q; + t_float x_sr; + t_float x_freq; + t_float x_q; t_bpctl x_cspace; t_bpctl *x_ctl; - float x_f; + t_float x_f; } t_sigbp; t_class *sigbp_class; @@ -239,11 +239,11 @@ static void *sigbp_new(t_floatarg f, t_floatarg q) return (x); } -static float sigbp_qcos(float f) +static t_float sigbp_qcos(t_float f) { if (f >= -(0.5f*3.14159f) && f <= 0.5f*3.14159f) { - float g = f*f; + t_float g = f*f; return (((g*g*g * (-1.0f/720.0f) + g*g*(1.0f/24.0f)) - g*0.5) + 1); } else return (0); @@ -251,7 +251,7 @@ static float sigbp_qcos(float f) static void sigbp_docoef(t_sigbp *x, t_floatarg f, t_floatarg q) { - float r, oneminusr, omega; + t_float r, oneminusr, omega; if (f < 0.001) f = 10; if (q < 0) q = 0; x->x_freq = f; @@ -285,19 +285,19 @@ static void sigbp_clear(t_sigbp *x, t_floatarg q) static t_int *sigbp_perform(t_int *w) { - float *in = (float *)(w[1]); - float *out = (float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_bpctl *c = (t_bpctl *)(w[3]); int n = (t_int)(w[4]); int i; - float last = c->c_x1; - float prev = c->c_x2; - float coef1 = c->c_coef1; - float coef2 = c->c_coef2; - float gain = c->c_gain; + t_sample last = c->c_x1; + t_sample prev = c->c_x2; + t_sample coef1 = c->c_coef1; + t_sample coef2 = c->c_coef2; + t_sample gain = c->c_gain; for (i = 0; i < n; i++) { - float output = *in++ + coef1 * last + coef2 * prev; + t_sample output = *in++ + coef1 * last + coef2 * prev; *out++ = gain * output; prev = last; last = output; @@ -338,19 +338,19 @@ void sigbp_setup(void) typedef struct biquadctl { - float c_x1; - float c_x2; - float c_fb1; - float c_fb2; - float c_ff1; - float c_ff2; - float c_ff3; + t_sample c_x1; + t_sample c_x2; + t_sample c_fb1; + t_sample c_fb2; + t_sample c_ff1; + t_sample c_ff2; + t_sample c_ff3; } t_biquadctl; typedef struct sigbiquad { t_object x_obj; - float x_f; + t_float x_f; t_biquadctl x_cspace; t_biquadctl *x_ctl; } t_sigbiquad; @@ -372,21 +372,21 @@ static void *sigbiquad_new(t_symbol *s, int argc, t_atom *argv) static t_int *sigbiquad_perform(t_int *w) { - float *in = (float *)(w[1]); - float *out = (float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); t_biquadctl *c = (t_biquadctl *)(w[3]); int n = (t_int)(w[4]); int i; - float last = c->c_x1; - float prev = c->c_x2; - float fb1 = c->c_fb1; - float fb2 = c->c_fb2; - float ff1 = c->c_ff1; - float ff2 = c->c_ff2; - float ff3 = c->c_ff3; + t_sample last = c->c_x1; + t_sample prev = c->c_x2; + t_sample fb1 = c->c_fb1; + t_sample fb2 = c->c_fb2; + t_sample ff1 = c->c_ff1; + t_sample ff2 = c->c_ff2; + t_sample ff3 = c->c_ff3; for (i = 0; i < n; i++) { - float output = *in++ + fb1 * last + fb2 * prev; + t_sample output = *in++ + fb1 * last + fb2 * prev; if (PD_BIGORSMALL(output)) output = 0; *out++ = ff1 * output + ff2 * last + ff3 * prev; @@ -400,12 +400,12 @@ static t_int *sigbiquad_perform(t_int *w) static void sigbiquad_list(t_sigbiquad *x, t_symbol *s, int argc, t_atom *argv) { - float fb1 = atom_getfloatarg(0, argc, argv); - float fb2 = atom_getfloatarg(1, argc, argv); - float ff1 = atom_getfloatarg(2, argc, argv); - float ff2 = atom_getfloatarg(3, argc, argv); - float ff3 = atom_getfloatarg(4, argc, argv); - float discriminant = fb1 * fb1 + 4 * fb2; + t_float fb1 = atom_getfloatarg(0, argc, argv); + t_float fb2 = atom_getfloatarg(1, argc, argv); + t_float ff1 = atom_getfloatarg(2, argc, argv); + t_float ff2 = atom_getfloatarg(3, argc, argv); + t_float ff3 = atom_getfloatarg(4, argc, argv); + t_float discriminant = fb1 * fb1 + 4 * fb2; t_biquadctl *c = x->x_ctl; if (discriminant < 0) /* imaginary roots -- resonant filter */ { @@ -465,9 +465,9 @@ void sigbiquad_setup(void) typedef struct sigsamphold { t_object x_obj; - float x_f; - float x_lastin; - float x_lastout; + t_float x_f; + t_sample x_lastin; + t_sample x_lastout; } t_sigsamphold; t_class *sigsamphold_class; @@ -485,17 +485,17 @@ static void *sigsamphold_new(void) static t_int *sigsamphold_perform(t_int *w) { - float *in1 = (float *)(w[1]); - float *in2 = (float *)(w[2]); - float *out = (float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); t_sigsamphold *x = (t_sigsamphold *)(w[4]); int n = (t_int)(w[5]); int i; - float lastin = x->x_lastin; - float lastout = x->x_lastout; + t_sample lastin = x->x_lastin; + t_sample lastout = x->x_lastout; for (i = 0; i < n; i++, *in1++) { - float next = *in2++; + t_sample next = *in2++; if (next < lastin) lastout = *in1; *out++ = lastout; lastin = next; @@ -542,8 +542,8 @@ void sigsamphold_setup(void) typedef struct sigrpole { t_object x_obj; - float x_f; - float x_last; + t_float x_f; + t_sample x_last; } t_sigrpole; t_class *sigrpole_class; @@ -561,17 +561,17 @@ static void *sigrpole_new(t_float f) static t_int *sigrpole_perform(t_int *w) { - float *in1 = (float *)(w[1]); - float *in2 = (float *)(w[2]); - float *out = (float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); t_sigrpole *x = (t_sigrpole *)(w[4]); int n = (t_int)(w[5]); int i; - float last = x->x_last; + t_sample last = x->x_last; for (i = 0; i < n; i++) { - float next = *in1++; - float coef = *in2++; + t_sample next = *in1++; + t_sample coef = *in2++; *out++ = last = coef * last + next; } if (PD_BIGORSMALL(last)) @@ -615,8 +615,8 @@ void sigrpole_setup(void) typedef struct sigrzero { t_object x_obj; - float x_f; - float x_last; + t_float x_f; + t_sample x_last; } t_sigrzero; t_class *sigrzero_class; @@ -634,17 +634,17 @@ static void *sigrzero_new(t_float f) static t_int *sigrzero_perform(t_int *w) { - float *in1 = (float *)(w[1]); - float *in2 = (float *)(w[2]); - float *out = (float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); t_sigrzero *x = (t_sigrzero *)(w[4]); int n = (t_int)(w[5]); int i; - float last = x->x_last; + t_sample last = x->x_last; for (i = 0; i < n; i++) { - float next = *in1++; - float coef = *in2++; + t_sample next = *in1++; + t_sample coef = *in2++; *out++ = next - coef * last; last = next; } @@ -687,8 +687,8 @@ void sigrzero_setup(void) typedef struct sigrzero_rev { t_object x_obj; - float x_f; - float x_last; + t_float x_f; + t_sample x_last; } t_sigrzero_rev; t_class *sigrzero_rev_class; @@ -706,17 +706,17 @@ static void *sigrzero_rev_new(t_float f) static t_int *sigrzero_rev_perform(t_int *w) { - float *in1 = (float *)(w[1]); - float *in2 = (float *)(w[2]); - float *out = (float *)(w[3]); + t_sample *in1 = (t_sample *)(w[1]); + t_sample *in2 = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); t_sigrzero_rev *x = (t_sigrzero_rev *)(w[4]); int n = (t_int)(w[5]); int i; - float last = x->x_last; + t_sample last = x->x_last; for (i = 0; i < n; i++) { - float next = *in1++; - float coef = *in2++; + t_sample next = *in1++; + t_sample coef = *in2++; *out++ = last - coef * next; last = next; } @@ -760,9 +760,9 @@ void sigrzero_rev_setup(void) typedef struct sigcpole { t_object x_obj; - float x_f; - float x_lastre; - float x_lastim; + t_float x_f; + t_sample x_lastre; + t_sample x_lastim; } t_sigcpole; t_class *sigcpole_class; @@ -786,24 +786,24 @@ static void *sigcpole_new(t_float re, t_float im) static t_int *sigcpole_perform(t_int *w) { - float *inre1 = (float *)(w[1]); - float *inim1 = (float *)(w[2]); - float *inre2 = (float *)(w[3]); - float *inim2 = (float *)(w[4]); - float *outre = (float *)(w[5]); - float *outim = (float *)(w[6]); + t_sample *inre1 = (t_sample *)(w[1]); + t_sample *inim1 = (t_sample *)(w[2]); + t_sample *inre2 = (t_sample *)(w[3]); + t_sample *inim2 = (t_sample *)(w[4]); + t_sample *outre = (t_sample *)(w[5]); + t_sample *outim = (t_sample *)(w[6]); t_sigcpole *x = (t_sigcpole *)(w[7]); int n = (t_int)(w[8]); int i; - float lastre = x->x_lastre; - float lastim = x->x_lastim; + t_sample lastre = x->x_lastre; + t_sample lastim = x->x_lastim; for (i = 0; i < n; i++) { - float nextre = *inre1++; - float nextim = *inim1++; - float coefre = *inre2++; - float coefim = *inim2++; - float tempre = *outre++ = nextre + lastre * coefre - lastim * coefim; + t_sample nextre = *inre1++; + t_sample nextim = *inim1++; + t_sample coefre = *inre2++; + t_sample coefim = *inim2++; + t_sample tempre = *outre++ = nextre + lastre * coefre - lastim * coefim; lastim = *outim++ = nextim + lastre * coefim + lastim * coefre; lastre = tempre; } @@ -853,9 +853,9 @@ void sigcpole_setup(void) typedef struct sigczero { t_object x_obj; - float x_f; - float x_lastre; - float x_lastim; + t_float x_f; + t_sample x_lastre; + t_sample x_lastim; } t_sigczero; t_class *sigczero_class; @@ -879,23 +879,23 @@ static void *sigczero_new(t_float re, t_float im) static t_int *sigczero_perform(t_int *w) { - float *inre1 = (float *)(w[1]); - float *inim1 = (float *)(w[2]); - float *inre2 = (float *)(w[3]); - float *inim2 = (float *)(w[4]); - float *outre = (float *)(w[5]); - float *outim = (float *)(w[6]); + t_sample *inre1 = (t_sample *)(w[1]); + t_sample *inim1 = (t_sample *)(w[2]); + t_sample *inre2 = (t_sample *)(w[3]); + t_sample *inim2 = (t_sample *)(w[4]); + t_sample *outre = (t_sample *)(w[5]); + t_sample *outim = (t_sample *)(w[6]); t_sigczero *x = (t_sigczero *)(w[7]); int n = (t_int)(w[8]); int i; - float lastre = x->x_lastre; - float lastim = x->x_lastim; + t_sample lastre = x->x_lastre; + t_sample lastim = x->x_lastim; for (i = 0; i < n; i++) { - float nextre = *inre1++; - float nextim = *inim1++; - float coefre = *inre2++; - float coefim = *inim2++; + t_sample nextre = *inre1++; + t_sample nextim = *inim1++; + t_sample coefre = *inre2++; + t_sample coefim = *inim2++; *outre++ = nextre - lastre * coefre + lastim * coefim; *outim++ = nextim - lastre * coefim - lastim * coefre; lastre = nextre; @@ -943,9 +943,9 @@ void sigczero_setup(void) typedef struct sigczero_rev { t_object x_obj; - float x_f; - float x_lastre; - float x_lastim; + t_float x_f; + t_sample x_lastre; + t_sample x_lastim; } t_sigczero_rev; t_class *sigczero_rev_class; @@ -969,23 +969,23 @@ static void *sigczero_rev_new(t_float re, t_float im) static t_int *sigczero_rev_perform(t_int *w) { - float *inre1 = (float *)(w[1]); - float *inim1 = (float *)(w[2]); - float *inre2 = (float *)(w[3]); - float *inim2 = (float *)(w[4]); - float *outre = (float *)(w[5]); - float *outim = (float *)(w[6]); + t_sample *inre1 = (t_sample *)(w[1]); + t_sample *inim1 = (t_sample *)(w[2]); + t_sample *inre2 = (t_sample *)(w[3]); + t_sample *inim2 = (t_sample *)(w[4]); + t_sample *outre = (t_sample *)(w[5]); + t_sample *outim = (t_sample *)(w[6]); t_sigczero_rev *x = (t_sigczero_rev *)(w[7]); int n = (t_int)(w[8]); int i; - float lastre = x->x_lastre; - float lastim = x->x_lastim; + t_sample lastre = x->x_lastre; + t_sample lastim = x->x_lastim; for (i = 0; i < n; i++) { - float nextre = *inre1++; - float nextim = *inim1++; - float coefre = *inre2++; - float coefim = *inim2++; + t_sample nextre = *inre1++; + t_sample nextim = *inim1++; + t_sample coefre = *inre2++; + t_sample coefim = *inim2++; /* transfer function is (A bar) - Z^-1, for the same frequency response as 1 - AZ^-1 from czero_tilde. */ *outre++ = lastre - nextre * coefre - nextim * coefim; diff --git a/src/d_global.c b/src/d_global.c index ea6615be7..b9a7cae10 100644 --- a/src/d_global.c +++ b/src/d_global.c @@ -17,8 +17,8 @@ typedef struct _sigsend t_object x_obj; t_symbol *x_sym; int x_n; - float *x_vec; - float x_f; + t_sample *x_vec; + t_float x_f; } t_sigsend; static void *sigsend_new(t_symbol *s) @@ -27,16 +27,16 @@ static void *sigsend_new(t_symbol *s) pd_bind(&x->x_obj.ob_pd, s); x->x_sym = s; x->x_n = DEFSENDVS; - x->x_vec = (float *)getbytes(DEFSENDVS * sizeof(float)); - memset((char *)(x->x_vec), 0, DEFSENDVS * sizeof(float)); + x->x_vec = (t_sample *)getbytes(DEFSENDVS * sizeof(t_sample)); + memset((char *)(x->x_vec), 0, DEFSENDVS * sizeof(t_sample)); x->x_f = 0; return (x); } static t_int *sigsend_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); while (n--) { @@ -57,7 +57,7 @@ static void sigsend_dsp(t_sigsend *x, t_signal **sp) static void sigsend_free(t_sigsend *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); - freebytes(x->x_vec, x->x_n * sizeof(float)); + freebytes(x->x_vec, x->x_n * sizeof(t_sample)); } static void sigsend_setup(void) @@ -76,7 +76,7 @@ typedef struct _sigreceive { t_object x_obj; t_symbol *x_sym; - t_float *x_wherefrom; + t_sample *x_wherefrom; int x_n; } t_sigreceive; @@ -93,9 +93,9 @@ static void *sigreceive_new(t_symbol *s) static t_int *sigreceive_perform(t_int *w) { t_sigreceive *x = (t_sigreceive *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - t_float *in = x->x_wherefrom; + t_sample *in = x->x_wherefrom; if (in) { while (n--) @@ -113,9 +113,9 @@ static t_int *sigreceive_perform(t_int *w) static t_int *sigreceive_perf8(t_int *w) { t_sigreceive *x = (t_sigreceive *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - t_float *in = x->x_wherefrom; + t_sample *in = x->x_wherefrom; if (in) { for (; n; n -= 8, in += 8, out += 8) @@ -194,7 +194,7 @@ typedef struct _sigcatch t_object x_obj; t_symbol *x_sym; int x_n; - float *x_vec; + t_sample *x_vec; } t_sigcatch; static void *sigcatch_new(t_symbol *s) @@ -203,16 +203,16 @@ static void *sigcatch_new(t_symbol *s) pd_bind(&x->x_obj.ob_pd, s); x->x_sym = s; x->x_n = DEFSENDVS; - x->x_vec = (float *)getbytes(DEFSENDVS * sizeof(float)); - memset((char *)(x->x_vec), 0, DEFSENDVS * sizeof(float)); + x->x_vec = (t_sample *)getbytes(DEFSENDVS * sizeof(t_sample)); + memset((char *)(x->x_vec), 0, DEFSENDVS * sizeof(t_sample)); outlet_new(&x->x_obj, &s_signal); return (x); } static t_int *sigcatch_perform(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); while (n--) *out++ = *in, *in++ = 0; return (w+4); @@ -221,8 +221,8 @@ static t_int *sigcatch_perform(t_int *w) /* tb: vectorized catch function */ static t_int *sigcatch_perf8(t_int *w) { - t_float *in = (t_float *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[1]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); for (; n; n -= 8, in += 8, out += 8) { @@ -250,7 +250,7 @@ static void sigcatch_dsp(t_sigcatch *x, t_signal **sp) static void sigcatch_free(t_sigcatch *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); - freebytes(x->x_vec, x->x_n * sizeof(float)); + freebytes(x->x_vec, x->x_n * sizeof(t_sample)); } static void sigcatch_setup(void) @@ -268,7 +268,7 @@ typedef struct _sigthrow { t_object x_obj; t_symbol *x_sym; - t_float *x_whereto; + t_sample *x_whereto; int x_n; t_float x_f; } t_sigthrow; @@ -286,9 +286,9 @@ static void *sigthrow_new(t_symbol *s) static t_int *sigthrow_perform(t_int *w) { t_sigthrow *x = (t_sigthrow *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = (int)(w[3]); - t_float *out = x->x_whereto; + t_sample *out = x->x_whereto; if (out) { while (n--) diff --git a/src/d_math.c b/src/d_math.c index 44f23e3db..213b866e5 100644 --- a/src/d_math.c +++ b/src/d_math.c @@ -16,9 +16,9 @@ static t_class *clip_class; typedef struct _clip { t_object x_obj; - float x_f; - t_sample x_lo; - t_sample x_hi; + t_float x_f; + t_float x_lo; + t_float x_hi; } t_clip; static void *clip_new(t_floatarg lo, t_floatarg hi) @@ -36,12 +36,12 @@ static void *clip_new(t_floatarg lo, t_floatarg hi) static t_int *clip_perform(t_int *w) { t_clip *x = (t_clip *)(w[1]); - t_float *in = (t_float *)(w[2]); - t_float *out = (t_float *)(w[3]); + t_sample *in = (t_sample *)(w[2]); + t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); while (n--) { - float f = *in++; + t_sample f = *in++; if (f < x->x_lo) f = x->x_lo; if (f > x->x_hi) f = x->x_hi; *out++ = f; @@ -125,7 +125,7 @@ float qrsqrt(float f) {return (q8_rsqrt(f)); } typedef struct sigrsqrt { t_object x_obj; - float x_f; + t_float x_f; } t_sigrsqrt; static t_class *sigrsqrt_class; @@ -140,16 +140,16 @@ static void *sigrsqrt_new(void) static t_int *sigrsqrt_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); while (n--) { - float f = *in; + t_sample f = *in; long l = *(long *)(in++); if (f < 0) *out++ = 0; else { - float g = rsqrt_exptab[(l >> 23) & 0xff] * + t_sample g = rsqrt_exptab[(l >> 23) & 0xff] * rsqrt_mantissatab[(l >> 13) & 0x3ff]; *out++ = 1.5 * g - 0.5 * g * g * g * f; } @@ -179,7 +179,7 @@ void sigrsqrt_setup(void) typedef struct sigsqrt { t_object x_obj; - float x_f; + t_float x_f; } t_sigsqrt; static t_class *sigsqrt_class; @@ -194,16 +194,16 @@ static void *sigsqrt_new(void) t_int *sigsqrt_perform(t_int *w) /* not static; also used in d_fft.c */ { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); while (n--) { - float f = *in; + t_sample f = *in; long l = *(long *)(in++); if (f < 0) *out++ = 0; else { - float g = rsqrt_exptab[(l >> 23) & 0xff] * + t_sample g = rsqrt_exptab[(l >> 23) & 0xff] * rsqrt_mantissatab[(l >> 13) & 0x3ff]; *out++ = f * (1.5 * g - 0.5 * g * g * g * f); } @@ -230,7 +230,7 @@ void sigsqrt_setup(void) typedef struct wrap { t_object x_obj; - float x_f; + t_float x_f; } t_sigwrap; t_class *sigwrap_class; @@ -245,11 +245,11 @@ static void *sigwrap_new(void) static t_int *sigwrap_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); while (n--) { - float f = *in++; + t_sample f = *in++; int k = f; if (f > 0) *out++ = f-k; else *out++ = f - (k-1); @@ -275,7 +275,7 @@ void sigwrap_setup(void) typedef struct mtof_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_mtof_tilde; t_class *mtof_tilde_class; @@ -290,11 +290,11 @@ static void *mtof_tilde_new(void) static t_int *mtof_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= -1500) *out = 0; else { @@ -323,7 +323,7 @@ void mtof_tilde_setup(void) typedef struct ftom_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_ftom_tilde; t_class *ftom_tilde_class; @@ -338,11 +338,11 @@ static void *ftom_tilde_new(void) static t_int *ftom_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; *in++, out++) { - float f = *in; + t_sample f = *in; *out = (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500); } return (w + 4); @@ -366,7 +366,7 @@ void ftom_tilde_setup(void) typedef struct dbtorms_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_dbtorms_tilde; t_class *dbtorms_tilde_class; @@ -381,11 +381,11 @@ static void *dbtorms_tilde_new(void) static t_int *dbtorms_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= 0) *out = 0; else { @@ -415,7 +415,7 @@ void dbtorms_tilde_setup(void) typedef struct rmstodb_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_rmstodb_tilde; t_class *rmstodb_tilde_class; @@ -430,15 +430,15 @@ static void *rmstodb_tilde_new(void) static t_int *rmstodb_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= 0) *out = 0; else { - float g = 100 + 20./LOGTEN * log(f); + t_sample g = 100 + 20./LOGTEN * log(f); *out = (g < 0 ? 0 : g); } } @@ -463,7 +463,7 @@ void rmstodb_tilde_setup(void) typedef struct dbtopow_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_dbtopow_tilde; t_class *dbtopow_tilde_class; @@ -478,11 +478,11 @@ static void *dbtopow_tilde_new(void) static t_int *dbtopow_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= 0) *out = 0; else { @@ -512,7 +512,7 @@ void dbtopow_tilde_setup(void) typedef struct powtodb_tilde { t_object x_obj; - float x_f; + t_float x_f; } t_powtodb_tilde; t_class *powtodb_tilde_class; @@ -527,15 +527,15 @@ static void *powtodb_tilde_new(void) static t_int *powtodb_tilde_perform(t_int *w) { - float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); + t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2); t_int n = *(t_int *)(w+3); for (; n--; in++, out++) { - float f = *in; + t_sample f = *in; if (f <= 0) *out = 0; else { - float g = 100 + 10./LOGTEN * log(f); + t_sample g = 100 + 10./LOGTEN * log(f); *out = (g < 0 ? 0 : g); } } diff --git a/src/d_misc.c b/src/d_misc.c index cdb99bb8b..444986ea2 100644 --- a/src/d_misc.c +++ b/src/d_misc.c @@ -15,7 +15,7 @@ static t_class *print_class; typedef struct _print { t_object x_obj; - float x_f; + t_float x_f; t_symbol *x_sym; int x_count; } t_print; @@ -23,7 +23,7 @@ typedef struct _print static t_int *print_perform(t_int *w) { t_print *x = (t_print *)(w[1]); - t_float *in = (t_float *)(w[2]); + t_sample *in = (t_sample *)(w[2]); int n = (int)(w[3]); if (x->x_count) { diff --git a/src/d_osc.c b/src/d_osc.c index b0becdba7..93b1a89ee 100644 --- a/src/d_osc.c +++ b/src/d_osc.c @@ -479,7 +479,7 @@ static void *noise_new(void) static t_int *noise_perform(t_int *w) { - t_float *out = (t_float *)(w[1]); + t_sample *out = (t_sample *)(w[1]); int *vp = (int *)(w[2]); int n = (int)(w[3]); int val = *vp; diff --git a/src/d_resample.c b/src/d_resample.c index 97ba17433..255af71d9 100644 --- a/src/d_resample.c +++ b/src/d_resample.c @@ -8,8 +8,8 @@ /* --------------------- up/down-sampling --------------------- */ t_int *downsampling_perform_0(t_int *w) { - t_float *in = (t_float *)(w[1]); /* original signal */ - t_float *out = (t_float *)(w[2]); /* downsampled signal */ + t_sample *in = (t_sample *)(w[1]); /* original signal */ + t_sample *out = (t_sample *)(w[2]); /* downsampled signal */ int down = (int)(w[3]); /* downsampling factor */ int parent = (int)(w[4]); /* original vectorsize */ @@ -25,13 +25,13 @@ t_int *downsampling_perform_0(t_int *w) t_int *upsampling_perform_0(t_int *w) { - t_float *in = (t_float *)(w[1]); /* original signal */ - t_float *out = (t_float *)(w[2]); /* upsampled signal */ + t_sample *in = (t_sample *)(w[1]); /* original signal */ + t_sample *out = (t_sample *)(w[2]); /* upsampled signal */ int up = (int)(w[3]); /* upsampling factor */ int parent = (int)(w[4]); /* original vectorsize */ int n=parent*up; - t_float *dummy = out; + t_sample *dummy = out; while(n--)*out++=0; @@ -47,15 +47,15 @@ t_int *upsampling_perform_0(t_int *w) t_int *upsampling_perform_hold(t_int *w) { - t_float *in = (t_float *)(w[1]); /* original signal */ - t_float *out = (t_float *)(w[2]); /* upsampled signal */ + t_sample *in = (t_sample *)(w[1]); /* original signal */ + t_sample *out = (t_sample *)(w[2]); /* upsampled signal */ int up = (int)(w[3]); /* upsampling factor */ int parent = (int)(w[4]); /* original vectorsize */ int i=up; int n=parent; - t_float *dum_out = out; - t_float *dum_in = in; + t_sample *dum_out = out; + t_sample *dum_in = in; while (i--) { n = parent; @@ -72,20 +72,20 @@ t_int *upsampling_perform_hold(t_int *w) t_int *upsampling_perform_linear(t_int *w) { t_resample *x= (t_resample *)(w[1]); - t_float *in = (t_float *)(w[2]); /* original signal */ - t_float *out = (t_float *)(w[3]); /* upsampled signal */ + t_sample *in = (t_sample *)(w[2]); /* original signal */ + t_sample *out = (t_sample *)(w[3]); /* upsampled signal */ int up = (int)(w[4]); /* upsampling factor */ int parent = (int)(w[5]); /* original vectorsize */ int length = parent*up; int n; - t_float *fp; - t_float a=*x->buffer, b=*in; + t_sample *fp; + t_sample a=*x->buffer, b=*in; for (n=0; n<length; n++) { - t_float findex = (t_float)(n+1)/up; + t_sample findex = (t_sample)(n+1)/up; int index = findex; - t_float frac=findex - index; + t_sample frac=findex - index; if (frac==0.)frac=1.; *out++ = frac * b + (1.-frac) * a; fp = in+index; @@ -180,9 +180,9 @@ void resamplefrom_dsp(t_resample *x, } if (x->s_n != outsize) { - t_float *buf=x->s_vec; + t_sample *buf=x->s_vec; t_freebytes(buf, x->s_n * sizeof(*buf)); - buf = (t_float *)t_getbytes(outsize * sizeof(*buf)); + buf = (t_sample *)t_getbytes(outsize * sizeof(*buf)); x->s_vec = buf; x->s_n = outsize; } @@ -203,9 +203,9 @@ void resampleto_dsp(t_resample *x, } if (x->s_n != insize) { - t_float *buf=x->s_vec; + t_sample *buf=x->s_vec; t_freebytes(buf, x->s_n * sizeof(*buf)); - buf = (t_float *)t_getbytes(insize * sizeof(*buf)); + buf = (t_sample *)t_getbytes(insize * sizeof(*buf)); x->s_vec = buf; x->s_n = insize; } diff --git a/src/d_ugen.c b/src/d_ugen.c index f7f27aa75..fe49b7dee 100644 --- a/src/d_ugen.c +++ b/src/d_ugen.c @@ -18,7 +18,7 @@ #include <stdarg.h> extern t_class *vinlet_class, *voutlet_class, *canvas_class; -t_sample *obj_findsignalscalar(t_object *x, int m); +t_float *obj_findsignalscalar(t_object *x, int m); static int ugen_loud; static t_int *dsp_chain; static int dsp_chainsize; @@ -38,7 +38,7 @@ void voutlet_dspepilog(struct _voutlet *x, t_signal **parentsigs, t_int *zero_perform(t_int *w) /* zero out a vector */ { - t_float *out = (t_float *)(w[1]); + t_sample *out = (t_sample *)(w[1]); int n = (int)(w[2]); while (n--) *out++ = 0; return (w+3); @@ -46,7 +46,7 @@ t_int *zero_perform(t_int *w) /* zero out a vector */ t_int *zero_perf8(t_int *w) { - t_float *out = (t_float *)(w[1]); + t_sample *out = (t_sample *)(w[1]); int n = (int)(w[2]); for (; n; n -= 8, out += 8) @@ -427,7 +427,7 @@ void signal_makereusable(t_signal *sig) signal whose buffer and size will be obtained later via signal_setborrowed(). */ -t_signal *signal_new(int n, float sr) +t_signal *signal_new(int n, t_float sr) { int logn, n2, vecsize = 0; t_signal *ret, **whichlist; @@ -539,7 +539,7 @@ struct _dspcontext int dc_ninlets; int dc_noutlets; t_signal **dc_iosigs; - float dc_srate; + t_float dc_srate; int dc_vecsize; /* vector size, power of two */ int dc_calcsize; /* number of elements to calculate */ char dc_toplevel; /* true if "iosigs" is invalid. */ @@ -612,7 +612,7 @@ t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp, int ninlets, int noutlets) { t_dspcontext *dc = (t_dspcontext *)getbytes(sizeof(*dc)); - float parent_srate, srate; + t_float parent_srate, srate; int parent_vecsize, vecsize; if (ugen_loud) post("ugen_start_graph..."); @@ -732,7 +732,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) { if (!uin->i_nconnect) { - t_sample *scalar; + t_float *scalar; s3 = signal_new(dc->dc_vecsize, dc->dc_srate); /* post("%s: unconnected signal inlet set to zero", class_getname(u->u_obj->ob_pd)); */ @@ -867,10 +867,10 @@ void ugen_done_graph(t_dspcontext *dc) int i, n; t_block *blk; t_dspcontext *parent_context = dc->dc_parentcontext; - float parent_srate; + t_float parent_srate; int parent_vecsize; int period, frequency, phase, vecsize, calcsize; - float srate; + t_float srate; int chainblockbegin; /* DSP chain onset before block prolog code */ int chainblockend; /* and after block epilog code */ int chainafterall; /* and after signal outlet epilog */ @@ -1153,7 +1153,7 @@ static t_class *samplerate_tilde_class; typedef struct _samplerate { t_object x_obj; - float x_sr; + t_float x_sr; t_canvas *x_canvas; } t_samplerate; @@ -1161,13 +1161,13 @@ void *canvas_getblock(t_class *blockclass, t_canvas **canvasp); static void samplerate_tilde_bang(t_samplerate *x) { - float srate = sys_getsr(); + t_float srate = sys_getsr(); t_canvas *canvas = x->x_canvas; while (canvas) { t_block *b = (t_block *)canvas_getblock(block_class, &canvas); if (b) - srate *= (float)(b->x_upsample) / (float)(b->x_downsample); + srate *= (t_float)(b->x_upsample) / (t_float)(b->x_downsample); } outlet_float(x->x_obj.ob_outlet, srate); } diff --git a/src/g_all_guis.h b/src/g_all_guis.h index 189d2c768..b352fb9cd 100644 --- a/src/g_all_guis.h +++ b/src/g_all_guis.h @@ -208,8 +208,8 @@ typedef struct _hdial typedef struct _toggle { t_iemgui x_gui; - float x_on; - float x_nonzero; + t_float x_on; + t_float x_nonzero; } t_toggle; typedef struct _my_canvas @@ -238,8 +238,8 @@ typedef struct _vu int x_led_size; int x_peak; int x_rms; - float x_fp; - float x_fr; + t_float x_fp; + t_float x_fr; int x_scale; void *x_out_rms; void *x_out_peak; diff --git a/src/g_array.c b/src/g_array.c index 543823f67..0ebc99fb8 100644 --- a/src/g_array.c +++ b/src/g_array.c @@ -394,7 +394,7 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, int flags = fflags; int saveit = ((flags & 1) != 0); int style = ((flags & 6) >> 1); - float stylewas = template_getfloat( + t_float stylewas = template_getfloat( template_findbyname(x->x_scalar->sc_template), gensym("style"), x->x_scalar->sc_vec, 1); if (deleteit != 0) @@ -449,7 +449,7 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, else if (style != stylewas) garray_fittograph(x, size, style); template_setfloat(scalartemplate, gensym("style"), - x->x_scalar->sc_vec, (float)style, 0); + x->x_scalar->sc_vec, (t_float)style, 0); garray_setsaveit(x, (saveit != 0)); garray_redraw(x); @@ -460,7 +460,7 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, void garray_arrayviewlist_new(t_garray *x) { int i, xonset=0, yonset=0, type=0, elemsize=0; - float yval; + t_float yval; char cmdbuf[200]; t_symbol *arraytype; t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize); @@ -478,7 +478,7 @@ void garray_arrayviewlist_new(t_garray *x) gfxstub_new(&x->x_gobj.g_pd, x, cmdbuf); for (i = 0; i < ARRAYPAGESIZE && i < a->a_n; i++) { - yval = *(float *)(a->a_vec + + yval = *(t_float *)(a->a_vec + elemsize * i + yonset); sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->x_realname->s_name, @@ -493,7 +493,7 @@ void garray_arrayviewlist_fillpage(t_garray *x, t_float fTopItem) { int i, xonset=0, yonset=0, type=0, elemsize=0, topItem; - float yval; + t_float yval; char cmdbuf[200]; t_symbol *arraytype; t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize); @@ -524,7 +524,7 @@ void garray_arrayviewlist_fillpage(t_garray *x, (i < (page + 1) * ARRAYPAGESIZE && i < a->a_n); i++) { - yval = *(float *)(a->a_vec + \ + yval = *(t_float *)(a->a_vec + \ elemsize * i + yonset); sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->x_realname->s_name, @@ -575,23 +575,23 @@ void array_redraw(t_array *a, t_glist *glist) /* routine to get screen coordinates of a point in an array */ void array_getcoordinate(t_glist *glist, char *elem, int xonset, int yonset, int wonset, int indx, - float basex, float basey, float xinc, + t_float basex, t_float basey, t_float xinc, t_fielddesc *xfielddesc, t_fielddesc *yfielddesc, t_fielddesc *wfielddesc, - float *xp, float *yp, float *wp) + t_float *xp, t_float *yp, t_float *wp) { - float xval, yval, ypix, wpix; + t_float xval, yval, ypix, wpix; if (xonset >= 0) - xval = *(float *)(elem + xonset); + xval = *(t_float *)(elem + xonset); else xval = indx * xinc; if (yonset >= 0) - yval = *(float *)(elem + yonset); + yval = *(t_float *)(elem + yonset); else yval = 0; ypix = glist_ytopixels(glist, basey + fielddesc_cvttocoord(yfielddesc, yval)); if (wonset >= 0) { /* found "w" field which controls linewidth. */ - float wval = *(float *)(elem + wonset); + t_float wval = *(t_float *)(elem + wonset); wpix = glist_ytopixels(glist, basey + fielddesc_cvttocoord(yfielddesc, yval) + fielddesc_cvttocoord(wfielddesc, wval)) - ypix; @@ -605,8 +605,8 @@ void array_getcoordinate(t_glist *glist, *wp = wpix; } -static float array_motion_xcumulative; -static float array_motion_ycumulative; +static t_float array_motion_xcumulative; +static t_float array_motion_ycumulative; static t_fielddesc *array_motion_xfield; static t_fielddesc *array_motion_yfield; static t_glist *array_motion_glist; @@ -617,9 +617,9 @@ static t_template *array_motion_template; static int array_motion_npoints; static int array_motion_elemsize; static int array_motion_altkey; -static float array_motion_initx; -static float array_motion_xperpix; -static float array_motion_yperpix; +static t_float array_motion_initx; +static t_float array_motion_xperpix; +static t_float array_motion_yperpix; static int array_motion_lastx; static int array_motion_fatten; @@ -638,9 +638,9 @@ static void array_motion(void *z, t_floatarg dx, t_floatarg dy) { t_word *thisword = (t_word *)(((char *)array_motion_wp) + i * array_motion_elemsize); - float xwas = fielddesc_getcoord(array_motion_xfield, + t_float xwas = fielddesc_getcoord(array_motion_xfield, array_motion_template, thisword, 1); - float ywas = (array_motion_yfield ? + t_float ywas = (array_motion_yfield ? fielddesc_getcoord(array_motion_yfield, array_motion_template, thisword, 1) : 0); fielddesc_setcoord(array_motion_xfield, @@ -651,7 +651,7 @@ static void array_motion(void *z, t_floatarg dx, t_floatarg dy) { if (i == 0) { - float newy = ywas + dy * array_motion_yperpix; + t_float newy = ywas + dy * array_motion_yperpix; if (newy < 0) newy = 0; fielddesc_setcoord(array_motion_yfield, @@ -672,13 +672,13 @@ static void array_motion(void *z, t_floatarg dx, t_floatarg dy) /* a y-only plot. */ int thisx = array_motion_initx + array_motion_xcumulative + 0.5, x2; int increment, i, nchange; - float newy = array_motion_ycumulative, + t_float newy = array_motion_ycumulative, oldy = fielddesc_getcoord(array_motion_yfield, array_motion_template, (t_word *)(((char *)array_motion_wp) + array_motion_elemsize * array_motion_lastx), 1); - float ydiff = newy - oldy; + t_float ydiff = newy - oldy; if (thisx < 0) thisx = 0; else if (thisx >= array_motion_npoints) thisx = array_motion_npoints - 1; @@ -704,7 +704,7 @@ static void array_motion(void *z, t_floatarg dx, t_floatarg dy) int scalar_doclick(t_word *data, t_template *template, t_scalar *sc, t_array *ap, struct _glist *owner, - float xloc, float yloc, int xpix, int ypix, + t_float xloc, t_float yloc, int xpix, int ypix, int shift, int alt, int dbl, int doit); /* try clicking on an element of the array as a scalar (if clicking @@ -712,14 +712,14 @@ int scalar_doclick(t_word *data, t_template *template, t_scalar *sc, static int array_doclick_element(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, t_symbol *elemtemplatesym, - float linewidth, float xloc, float xinc, float yloc, + t_float linewidth, t_float xloc, t_float xinc, t_float yloc, t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_canvas *elemtemplatecanvas; t_template *elemtemplate; int elemsize, yonset, wonset, xonset, i, incr, hit; - float xsum; + t_float xsum; if (elemtemplatesym == &s_float) return (0); @@ -733,13 +733,13 @@ static int array_doclick_element(t_array *array, t_glist *glist, else incr = array->a_n / 300; for (i = 0, xsum = 0; i < array->a_n; i += incr) { - float usexloc, useyloc; + t_float usexloc, useyloc; if (xonset >= 0) usexloc = xloc + fielddesc_cvttocoord(xfield, - *(float *)(((char *)(array->a_vec) + elemsize * i) + xonset)); + *(t_float *)(((char *)(array->a_vec) + elemsize * i) + xonset)); else usexloc = xloc + xsum, xsum += xinc; useyloc = yloc + (yonset >= 0 ? fielddesc_cvttocoord(yfield, - *(float *)(((char *)(array->a_vec) + elemsize * i) + yonset)) : 0); + *(t_float *)(((char *)(array->a_vec) + elemsize * i) + yonset)) : 0); if (hit = scalar_doclick( (t_word *)((char *)(array->a_vec) + i * elemsize), @@ -755,7 +755,7 @@ static int array_doclick_element(t_array *array, t_glist *glist, they can be static (look in g_canvas.h for candidates). */ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, t_symbol *elemtemplatesym, - float linewidth, float xloc, float xinc, float yloc, float scalarvis, + t_float linewidth, t_float xloc, t_float xinc, t_float yloc, t_float scalarvis, t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield, int xpix, int ypix, int shift, int alt, int dbl, int doit) { @@ -767,12 +767,12 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, &elemtemplate, &elemsize, xfield, yfield, wfield, &xonset, &yonset, &wonset)) { - float best = 100; + t_float best = 100; /* if it has more than 2000 points, just check 1000 of them. */ int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000); for (i = 0; i < array->a_n; i += incr) { - float pxpix, pypix, pwpix, dx, dy; + t_float pxpix, pypix, pwpix, dx, dy; array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, xloc, yloc, xinc, xfield, yfield, wfield, &pxpix, &pypix, &pwpix); @@ -810,7 +810,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, best += 0.001; /* add truncation error margin */ for (i = 0; i < array->a_n; i += incr) { - float pxpix, pypix, pwpix, dx, dy, dy2, dy3; + t_float pxpix, pypix, pwpix, dx, dy, dy2, dy3; array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, xloc, yloc, xinc, xfield, yfield, wfield, &pxpix, &pypix, &pwpix); @@ -903,7 +903,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, array_motion_ycumulative = fielddesc_getcoord(yfield, array_motion_template, (t_word *)(elem + i * elemsize), 1); - /* *(float *)((elem + elemsize * i) + yonset); */ + /* *(t_float *)((elem + elemsize * i) + yonset); */ } else { @@ -929,7 +929,7 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, static void array_getrect(t_array *array, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { - float x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff; + t_float x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff; t_canvas *elemtemplatecanvas; t_template *elemtemplate; int elemsize, yonset, wonset, xonset, i; @@ -944,7 +944,7 @@ static void array_getrect(t_array *array, t_glist *glist, else incr = array->a_n / 300; for (i = 0; i < array->a_n; i += incr) { - float pxpix, pypix, pwpix, dx, dy; + t_float pxpix, pypix, pwpix, dx, dy; array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, 0, 0, 1, @@ -1152,7 +1152,7 @@ int garray_getfloatwords(t_garray *x, int *size, t_word **vec) int garray_getfloatarray(t_garray *x, int *size, t_float **vec) { - if (sizeof(t_word) != sizeof(float)) + if (sizeof(t_word) != sizeof(t_float)) { static int warned; if (!warned) @@ -1180,13 +1180,13 @@ static void garray_const(t_garray *x, t_floatarg g) if (!array) error("%s: needs floating-point 'y' field", x->x_realname); else for (i = 0; i < array->a_n; i++) - *((float *)((char *)array->a_vec + *((t_float *)((char *)array->a_vec + elemsize * i) + yonset) = g; garray_redraw(x); } /* sum of Fourier components; called from routines below */ -static void garray_dofo(t_garray *x, int npoints, float dcval, +static void garray_dofo(t_garray *x, int npoints, t_float dcval, int nsin, t_float *vsin, int sineflag) { double phase, phaseincr, fj; @@ -1213,7 +1213,7 @@ static void garray_dofo(t_garray *x, int npoints, float dcval, else for (j = 0, fj = 0; j < nsin; j++, fj += phase) sum += vsin[j] * cos(fj); - *((float *)((array->a_vec + elemsize * i)) + yonset) + *((t_float *)((array->a_vec + elemsize * i)) + yonset) = sum; } garray_redraw(x); @@ -1282,7 +1282,7 @@ static void garray_normalize(t_garray *x, t_float f) for (i = 0, maxv = 0; i < array->a_n; i++) { - double v = *((float *)(array->a_vec + elemsize * i) + double v = *((t_float *)(array->a_vec + elemsize * i) + yonset); if (v > maxv) maxv = v; @@ -1293,7 +1293,7 @@ static void garray_normalize(t_garray *x, t_float f) { renormer = f / maxv; for (i = 0; i < array->a_n; i++) - *((float *)(array->a_vec + elemsize * i) + yonset) + *((t_float *)(array->a_vec + elemsize * i) + yonset) *= renormer; } garray_redraw(x); @@ -1331,7 +1331,7 @@ static void garray_list(t_garray *x, t_symbol *s, int argc, t_atom *argv) if (argc <= 0) return; } for (i = 0; i < argc; i++) - *((float *)(array->a_vec + elemsize * (i + firstindex)) + yonset) + *((t_float *)(array->a_vec + elemsize * (i + firstindex)) + yonset) = atom_getfloat(argv + i); } garray_redraw(x); @@ -1402,7 +1402,7 @@ static void garray_read(t_garray *x, t_symbol *filename) } for (i = 0; i < nelem; i++) { - if (!fscanf(fd, "%f", ((float *)(array->a_vec + + if (!fscanf(fd, "%f", ((t_float *)(array->a_vec + elemsize * i) + yonset))) { post("%s: read %d elements into table of size %d", @@ -1411,7 +1411,7 @@ static void garray_read(t_garray *x, t_symbol *filename) } } while (i < nelem) - *((float *)(array->a_vec + + *((t_float *)(array->a_vec + elemsize * i) + yonset) = 0, i++; fclose(fd); garray_redraw(x); @@ -1439,7 +1439,7 @@ static void garray_write(t_garray *x, t_symbol *filename) for (i = 0; i < array->a_n; i++) { if (fprintf(fd, "%g\n", - *(float *)(((array->a_vec + sizeof(t_word) * i)) + yonset)) < 1) + *(t_float *)(((array->a_vec + sizeof(t_word) * i)) + yonset)) < 1) { post("%s: write error", filename->s_name); break; diff --git a/src/g_canvas.c b/src/g_canvas.c index 8266279a0..36d3d3d64 100644 --- a/src/g_canvas.c +++ b/src/g_canvas.c @@ -448,8 +448,8 @@ static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv) /* make a new glist and add it to this glist. It will appear as a "graph", not a text object. */ t_glist *glist_addglist(t_glist *g, t_symbol *sym, - float x1, float y1, float x2, float y2, - float px1, float py1, float px2, float py2) + t_float x1, t_float y1, t_float x2, t_float y2, + t_float px1, t_float py1, t_float px2, t_float py2) { static int gcount = 0; int zz; @@ -474,7 +474,7 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, that is higher on the screen. */ if (py2 < py1) { - float zz; + t_float zz; zz = y2; y2 = y1; y1 = zz; @@ -520,14 +520,14 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv) { t_symbol *sym = atom_getsymbolarg(0, argc, argv); - float x1 = atom_getfloatarg(1, argc, argv); - float y1 = atom_getfloatarg(2, argc, argv); - float x2 = atom_getfloatarg(3, argc, argv); - float y2 = atom_getfloatarg(4, argc, argv); - float px1 = atom_getfloatarg(5, argc, argv); - float py1 = atom_getfloatarg(6, argc, argv); - float px2 = atom_getfloatarg(7, argc, argv); - float py2 = atom_getfloatarg(8, argc, argv); + t_float x1 = atom_getfloatarg(1, argc, argv); + t_float y1 = atom_getfloatarg(2, argc, argv); + t_float x2 = atom_getfloatarg(3, argc, argv); + t_float y2 = atom_getfloatarg(4, argc, argv); + t_float px1 = atom_getfloatarg(5, argc, argv); + t_float py1 = atom_getfloatarg(6, argc, argv); + t_float px2 = atom_getfloatarg(7, argc, argv); + t_float py2 = atom_getfloatarg(8, argc, argv); glist_addglist(g, sym, x1, y1, x2, y2, px1, py1, px2, py2); } @@ -557,7 +557,7 @@ static void canvas_setbounds(t_canvas *x, int x1, int y1, int x2, int y2) fix so that zero is bottom edge and redraw. This is only appropriate if we're a regular "text" object on the parent. */ - float diff = x->gl_y1 - x->gl_y2; + t_float diff = x->gl_y1 - x->gl_y2; t_gobj *y; x->gl_y1 = heightwas * diff; x->gl_y2 = x->gl_y1 - diff; diff --git a/src/g_canvas.h b/src/g_canvas.h index d3dee3d3c..e2b6626a4 100644 --- a/src/g_canvas.h +++ b/src/g_canvas.h @@ -131,8 +131,8 @@ typedef struct _arrayvis typedef struct _tick /* where to put ticks on x or y axes */ { - float k_point; /* one point to draw a big tick at */ - float k_inc; /* x or y increment per little tick */ + t_float k_point; /* one point to draw a big tick at */ + t_float k_inc; /* x or y increment per little tick */ int k_lperb; /* little ticks per big; 0 if no ticks to draw */ } t_tick; @@ -150,10 +150,10 @@ struct _glist struct _glist *gl_owner; /* parent glist, supercanvas, or 0 if none */ int gl_pixwidth; /* width in pixels (on parent, if a graph) */ int gl_pixheight; - float gl_x1; /* bounding rectangle in our own coordinates */ - float gl_y1; - float gl_x2; - float gl_y2; + t_float gl_x1; /* bounding rectangle in our own coordinates */ + t_float gl_y1; + t_float gl_x2; + t_float gl_y2; int gl_screenx1; /* screen coordinates when toplevel */ int gl_screeny1; int gl_screenx2; @@ -163,11 +163,11 @@ struct _glist t_tick gl_xtick; /* ticks marking X values */ int gl_nxlabels; /* number of X coordinate labels */ t_symbol **gl_xlabel; /* ... an array to hold them */ - float gl_xlabely; /* ... and their Y coordinates */ + t_float gl_xlabely; /* ... and their Y coordinates */ t_tick gl_ytick; /* same as above for Y ticks and labels */ int gl_nylabels; t_symbol **gl_ylabel; - float gl_ylabelx; + t_float gl_ylabelx; t_editor *gl_editor; /* editor structure when visible */ t_symbol *gl_name; /* symbol bound here */ int gl_font; /* nominal font size in points, e.g., 10 */ @@ -286,28 +286,28 @@ doesn't work on array elements... LATER reconsider this */ /* bounding rectangle: */ typedef void (*t_parentgetrectfn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int *x1, int *y1, int *x2, int *y2); /* displace it */ typedef void (*t_parentdisplacefn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int dx, int dy); /* change color to show selection */ typedef void (*t_parentselectfn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int state); /* change appearance to show activation/deactivation: */ typedef void (*t_parentactivatefn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int state); /* making visible or invisible */ typedef void (*t_parentvisfn)(t_gobj *x, struct _glist *glist, - t_word *data, t_template *tmpl, float basex, float basey, + t_word *data, t_template *tmpl, t_float basex, t_float basey, int flag); /* field a mouse click */ typedef int (*t_parentclickfn)(t_gobj *x, struct _glist *glist, t_word *data, t_template *tmpl, t_scalar *sc, t_array *ap, - float basex, float basey, + t_float basex, t_float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit); struct _parentwidgetbehavior @@ -380,18 +380,18 @@ EXTERN void glist_sort(t_glist *canvas); EXTERN void glist_read(t_glist *x, t_symbol *filename, t_symbol *format); EXTERN void glist_mergefile(t_glist *x, t_symbol *filename, t_symbol *format); -EXTERN float glist_pixelstox(t_glist *x, float xpix); -EXTERN float glist_pixelstoy(t_glist *x, float ypix); -EXTERN float glist_xtopixels(t_glist *x, float xval); -EXTERN float glist_ytopixels(t_glist *x, float yval); -EXTERN float glist_dpixtodx(t_glist *x, float dxpix); -EXTERN float glist_dpixtody(t_glist *x, float dypix); +EXTERN t_float glist_pixelstox(t_glist *x, t_float xpix); +EXTERN t_float glist_pixelstoy(t_glist *x, t_float ypix); +EXTERN t_float glist_xtopixels(t_glist *x, t_float xval); +EXTERN t_float glist_ytopixels(t_glist *x, t_float yval); +EXTERN t_float glist_dpixtodx(t_glist *x, t_float dxpix); +EXTERN t_float glist_dpixtody(t_glist *x, t_float dypix); EXTERN void glist_getnextxy(t_glist *gl, int *xval, int *yval); EXTERN void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv); EXTERN t_glist *glist_addglist(t_glist *g, t_symbol *sym, - float x1, float y1, float x2, float y2, - float px1, float py1, float px2, float py2); + t_float x1, t_float y1, t_float x2, t_float y2, + t_float px1, t_float py1, t_float px2, t_float py2); EXTERN void glist_arraydialog(t_glist *parent, t_symbol *name, t_floatarg size, t_floatarg saveit, t_floatarg newgraph); EXTERN t_binbuf *glist_writetobinbuf(t_glist *x, int wholething); @@ -502,7 +502,7 @@ EXTERN int canvas_getindex(t_canvas *x, t_gobj *y); EXTERN void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,t_floatarg fwhoin, t_floatarg finno); EXTERN void canvas_disconnect(t_canvas *x, - float index1, float outno, float index2, float inno); + t_float index1, t_float outno, t_float index2, t_float inno); EXTERN int canvas_isconnected (t_canvas *x, t_text *ob1, int n1, t_text *ob2, int n2); EXTERN void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy); @@ -545,21 +545,21 @@ EXTERN void word_restore(t_word *wp, t_template *tmpl, EXTERN t_scalar *scalar_new(t_glist *owner, t_symbol *templatesym); EXTERN void word_free(t_word *wp, t_template *tmpl); -EXTERN void scalar_getbasexy(t_scalar *x, float *basex, float *basey); +EXTERN void scalar_getbasexy(t_scalar *x, t_float *basex, t_float *basey); EXTERN void scalar_redraw(t_scalar *x, t_glist *glist); /* ------helper routines for "garrays" and "plots" -------------- */ EXTERN int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, t_symbol *elemtemplatesym, - float linewidth, float xloc, float xinc, float yloc, float scalarvis, + t_float linewidth, t_float xloc, t_float xinc, t_float yloc, t_float scalarvis, t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield, int xpix, int ypix, int shift, int alt, int dbl, int doit); EXTERN void array_getcoordinate(t_glist *glist, char *elem, int xonset, int yonset, int wonset, int indx, - float basex, float basey, float xinc, + t_float basex, t_float basey, t_float xinc, t_fielddesc *xfielddesc, t_fielddesc *yfielddesc, t_fielddesc *wfielddesc, - float *xp, float *yp, float *wp); + t_float *xp, t_float *yp, t_float *wp); EXTERN int array_getfields(t_symbol *elemtemplatesym, t_canvas **elemtemplatecanvasp, @@ -599,9 +599,9 @@ EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname, EXTERN t_float fielddesc_getcoord(t_fielddesc *f, t_template *tmpl, t_word *wp, int loud); EXTERN void fielddesc_setcoord(t_fielddesc *f, t_template *tmpl, - t_word *wp, float pix, int loud); -EXTERN t_float fielddesc_cvttocoord(t_fielddesc *f, float val); -EXTERN float fielddesc_cvtfromcoord(t_fielddesc *f, float coord); + t_word *wp, t_float pix, int loud); +EXTERN t_float fielddesc_cvttocoord(t_fielddesc *f, t_float val); +EXTERN t_float fielddesc_cvtfromcoord(t_fielddesc *f, t_float coord); /* ----------------------- guiconnects, g_guiconnect.c --------- */ diff --git a/src/g_editor.c b/src/g_editor.c index 819785fce..9f3097dec 100644 --- a/src/g_editor.c +++ b/src/g_editor.c @@ -381,7 +381,7 @@ static void *canvas_undo_set_disconnect(t_canvas *x, } void canvas_disconnect(t_canvas *x, - float index1, float outno, float index2, float inno) + t_float index1, t_float outno, t_float index2, t_float inno) { t_linetraverser t; t_outconnect *oc; @@ -904,7 +904,7 @@ static void canvas_donecanvasdialog(t_glist *x, { - float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin; + t_float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin; int graphme, redraw = 0; xperpix = atom_getfloatarg(0, argc, argv); @@ -977,7 +977,7 @@ static void canvas_donecanvasdialog(t_glist *x, /* called from the gui when a popup menu comes back with "properties," "open," or "help." */ -static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos) +static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float ypos) { char pathbuf[MAXPDSTRING], namebuf[MAXPDSTRING]; t_gobj *y; @@ -1212,16 +1212,16 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, { t_linetraverser t; t_outconnect *oc; - float fx = xpos, fy = ypos; + t_float fx = xpos, fy = ypos; t_glist *glist2 = glist_getcanvas(x); linetraverser_start(&t, glist2); while (oc = linetraverser_next(&t)) { - float lx1 = t.tr_lx1, ly1 = t.tr_ly1, + t_float lx1 = t.tr_lx1, ly1 = t.tr_ly1, lx2 = t.tr_lx2, ly2 = t.tr_ly2; - float area = (lx2 - lx1) * (fy - ly1) - + t_float area = (lx2 - lx1) * (fy - ly1) - (ly2 - ly1) * (fx - lx1); - float dsquare = (lx2-lx1) * (lx2-lx1) + (ly2-ly1) * (ly2-ly1); + t_float dsquare = (lx2-lx1) * (lx2-lx1) + (ly2-ly1) * (ly2-ly1); if (area * area >= 50 * dsquare) continue; if ((lx2-lx1) * (fx-lx1) + (ly2-ly1) * (fy-ly1) < 0) continue; if ((lx2-lx1) * (lx2-fx) + (ly2-ly1) * (ly2-fy) < 0) continue; @@ -1504,9 +1504,9 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) keynum = 0, gotkeysym = gensym("Right"); #endif if (keynumsym->s_thing && down) - pd_float(keynumsym->s_thing, (float)keynum); + pd_float(keynumsym->s_thing, (t_float)keynum); if (keyupsym->s_thing && !down) - pd_float(keyupsym->s_thing, (float)keynum); + pd_float(keyupsym->s_thing, (t_float)keynum); if (keynamesym->s_thing) { t_atom at[2]; @@ -1523,7 +1523,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) if (x->gl_editor->e_grab && x->gl_editor->e_keyfn && keynum) (* x->gl_editor->e_keyfn) - (x->gl_editor->e_grab, (float)keynum); + (x->gl_editor->e_grab, (t_float)keynum); /* if a text editor is open send the key on, as long as it is either "real" (has a key number) or else is an arrow key. */ else if (x->gl_editor->e_textedfor && (keynum @@ -2393,7 +2393,7 @@ static void canvas_dofont(t_canvas *x, t_floatarg font, t_floatarg xresize, static void canvas_font(t_canvas *x, t_floatarg font, t_floatarg resize, t_floatarg whichresize) { - float realresize, realresx = 1, realresy = 1; + t_float realresize, realresx = 1, realresy = 1; t_canvas *x2 = canvas_getrootfor(x); if (!resize) realresize = 1; else diff --git a/src/g_graph.c b/src/g_graph.c index 9b69fe711..f4196def1 100644 --- a/src/g_graph.c +++ b/src/g_graph.c @@ -181,11 +181,11 @@ t_canvas *glist_getcanvas(t_glist *x) return((t_canvas *)x); } -static float gobj_getxforsort(t_gobj *g) +static t_float gobj_getxforsort(t_gobj *g) { if (pd_class(&g->g_pd) == scalar_class) { - float x1, y1; + t_float x1, y1; scalar_getbasexy((t_scalar *)g, &x1, &y1); return(x1); } @@ -195,7 +195,7 @@ static float gobj_getxforsort(t_gobj *g) static t_gobj *glist_merge(t_glist *x, t_gobj *g1, t_gobj *g2) { t_gobj *g = 0, *g9 = 0; - float f1 = 0, f2 = 0; + t_float f1 = 0, f2 = 0; if (g1) f1 = gobj_getxforsort(g1); if (g2) @@ -257,11 +257,11 @@ static t_gobj *glist_dosort(t_glist *x, void glist_sort(t_glist *x) { int nitems = 0, foo = 0; - float lastx = -1e37; + t_float lastx = -1e37; t_gobj *g; for (g = x->gl_list; g; g = g->g_next) { - float x1 = gobj_getxforsort(g); + t_float x1 = gobj_getxforsort(g); if (x1 < lastx) foo = 1; lastx = x1; @@ -505,7 +505,7 @@ static void graph_ylabel(t_glist *x, t_symbol *s, int argc, t_atom *argv) /****** routines to convert pixels to X or Y value and vice versa ******/ /* convert an x pixel value to an x coordinate value */ -float glist_pixelstox(t_glist *x, float xpix) +t_float glist_pixelstox(t_glist *x, t_float xpix) { /* if we appear as a text box on parent, our range in our coordinates (x1, etc.) specifies the coordinate range @@ -533,7 +533,7 @@ float glist_pixelstox(t_glist *x, float xpix) } } -float glist_pixelstoy(t_glist *x, float ypix) +t_float glist_pixelstoy(t_glist *x, t_float ypix) { if (!x->gl_isgraph) return (x->gl_y1 + (x->gl_y2 - x->gl_y1) * ypix); @@ -552,7 +552,7 @@ float glist_pixelstoy(t_glist *x, float ypix) } /* convert an x coordinate value to an x pixel location in window */ -float glist_xtopixels(t_glist *x, float xval) +t_float glist_xtopixels(t_glist *x, t_float xval) { if (!x->gl_isgraph) return ((xval - x->gl_x1) / (x->gl_x2 - x->gl_x1)); @@ -569,7 +569,7 @@ float glist_xtopixels(t_glist *x, float xval) } } -float glist_ytopixels(t_glist *x, float yval) +t_float glist_ytopixels(t_glist *x, t_float yval) { if (!x->gl_isgraph) return ((yval - x->gl_y1) / (x->gl_y2 - x->gl_y1)); @@ -589,12 +589,12 @@ float glist_ytopixels(t_glist *x, float yval) /* convert an X screen distance to an X coordinate increment. This is terribly inefficient; but probably not a big enough CPU hog to warrant optimizing. */ -float glist_dpixtodx(t_glist *x, float dxpix) +t_float glist_dpixtodx(t_glist *x, t_float dxpix) { return (dxpix * (glist_pixelstox(x, 1) - glist_pixelstox(x, 0))); } -float glist_dpixtody(t_glist *x, float dypix) +t_float glist_dpixtody(t_glist *x, t_float dypix) { return (dypix * (glist_pixelstoy(x, 1) - glist_pixelstoy(x, 0))); } @@ -723,7 +723,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) if (vis) { int i; - float f; + t_float f; t_gobj *g; t_symbol *arrayname; t_garray *ga; @@ -750,7 +750,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) zero, this is disabled. */ if (x->gl_xtick.k_lperb) { - float upix, lpix; + t_float upix, lpix; if (y2 < y1) upix = y1, lpix = y2; else upix = y2, lpix = y1; @@ -787,7 +787,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) /* draw ticks in vertical borders*/ if (x->gl_ytick.k_lperb) { - float ubound, lbound; + t_float ubound, lbound; if (x->gl_y2 < x->gl_y1) ubound = x->gl_y1, lbound = x->gl_y2; else ubound = x->gl_y2, lbound = x->gl_y1; @@ -991,19 +991,19 @@ static void graph_delete(t_gobj *z, t_glist *glist) glist_delete(x, y); } -static float graph_lastxpix, graph_lastypix; +static t_float graph_lastxpix, graph_lastypix; static void graph_motion(void *z, t_floatarg dx, t_floatarg dy) { t_glist *x = (t_glist *)z; - float newxpix = graph_lastxpix + dx, newypix = graph_lastypix + dy; + t_float newxpix = graph_lastxpix + dx, newypix = graph_lastypix + dy; t_garray *a = (t_garray *)(x->gl_list); int oldx = 0.5 + glist_pixelstox(x, graph_lastxpix); int newx = 0.5 + glist_pixelstox(x, newxpix); t_word *vec; int nelem, i; - float oldy = glist_pixelstoy(x, graph_lastypix); - float newy = glist_pixelstoy(x, newypix); + t_float oldy = glist_pixelstoy(x, graph_lastypix); + t_float newy = glist_pixelstoy(x, newypix); graph_lastxpix = newxpix; graph_lastypix = newypix; /* verify that the array is OK */ @@ -1021,13 +1021,13 @@ static void graph_motion(void *z, t_floatarg dx, t_floatarg dy) { for (i = oldx + 1; i <= newx; i++) vec[i].w_float = newy + (oldy - newy) * - ((float)(newx - i))/(float)(newx - oldx); + ((t_float)(newx - i))/(t_float)(newx - oldx); } else if (oldx > newx + 1) { for (i = oldx - 1; i >= newx; i--) vec[i].w_float = newy + (oldy - newy) * - ((float)(newx - i))/(float)(newx - oldx); + ((t_float)(newx - i))/(t_float)(newx - oldx); } else vec[newx].w_float = newy; garray_redraw(a); diff --git a/src/g_hdial.c b/src/g_hdial.c index b08209f92..ace2ce666 100644 --- a/src/g_hdial.c +++ b/src/g_hdial.c @@ -347,14 +347,14 @@ static void hradio_bang(t_hradio *x) { if((x->x_change)&&(x->x_on != x->x_on_old)) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -381,7 +381,7 @@ static void hradio_fout(t_hradio *x, t_floatarg f) { if((x->x_change)&&(i != x->x_on_old)) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -392,7 +392,7 @@ static void hradio_fout(t_hradio *x, t_floatarg f) x->x_on = i; (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -425,7 +425,7 @@ static void hradio_float(t_hradio *x, t_floatarg f) { if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -439,7 +439,7 @@ static void hradio_float(t_hradio *x, t_floatarg f) x->x_on_old = x->x_on; if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -464,7 +464,7 @@ static void hradio_click(t_hradio *x, t_floatarg xpos, t_floatarg ypos, t_floata { int xx = (int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); - hradio_fout(x, (float)(xx / x->x_gui.x_w)); + hradio_fout(x, (t_float)(xx / x->x_gui.x_w)); } static int hradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) diff --git a/src/g_hslider.c b/src/g_hslider.c index 3d0720943..8dc3d0e6b 100644 --- a/src/g_hslider.c +++ b/src/g_hslider.c @@ -223,7 +223,7 @@ static void hslider_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"), (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, gensym("hsl"), x->x_gui.x_w, x->x_gui.x_h, - (float)x->x_min, (float)x->x_max, + (t_float)x->x_min, (t_float)x->x_max, x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, diff --git a/src/g_io.c b/src/g_io.c index 6c173c276..2ee89c1cd 100644 --- a/src/g_io.c +++ b/src/g_io.c @@ -292,10 +292,10 @@ typedef struct _voutlet t_canvas *x_canvas; t_outlet *x_parentoutlet; int x_bufsize; - t_float *x_buf; /* signal buffer; zero if not a signal */ - t_float *x_endbuf; - t_float *x_empty; /* next to read out of buffer in epilog code */ - t_float *x_write; /* next to write in to buffer */ + t_sample *x_buf; /* signal buffer; zero if not a signal */ + t_sample *x_endbuf; + t_sample *x_empty; /* next to read out of buffer in epilog code */ + t_sample *x_write; /* next to write in to buffer */ int x_hop; /* hopsize */ /* vice versa from the inlet, if we don't block, this holds the parent's outlet signal, valid between the prolog and the dsp setup @@ -373,7 +373,7 @@ t_int *voutlet_perform(t_int *w) t_voutlet *x = (t_voutlet *)(w[1]); t_float *in = (t_float *)(w[2]); int n = (int)(w[3]); - t_float *out = x->x_write, *outwas = out; + t_sample *out = x->x_write, *outwas = out; #if 0 if (tot < 5) post("-in %lx out %lx n %d", in, out, n); if (tot < 5) post("-buf %lx endbuf %lx", x->x_buf, x->x_endbuf); @@ -393,10 +393,10 @@ t_int *voutlet_perform(t_int *w) static t_int *voutlet_doepilog(t_int *w) { t_voutlet *x = (t_voutlet *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); - t_float *in = x->x_empty; + t_sample *in = x->x_empty; if (x->x_updown.downsample != x->x_updown.upsample) out = x->x_updown.s_vec; @@ -413,8 +413,8 @@ static t_int *voutlet_doepilog_resampling(t_int *w) { t_voutlet *x = (t_voutlet *)(w[1]); int n = (int)(w[2]); - t_float *in = x->x_empty; - t_float *out = x->x_updown.s_vec; + t_sample *in = x->x_empty; + t_sample *out = x->x_updown.s_vec; #if 0 if (tot < 5) post("outlet in %lx out %lx n %lx", in, out, n), tot++; @@ -504,9 +504,9 @@ void voutlet_dspepilog(struct _voutlet *x, t_signal **parentsigs, if (bufsize < myvecsize) bufsize = myvecsize; if (bufsize != (oldbufsize = x->x_bufsize)) { - t_float *buf = x->x_buf; + t_sample *buf = x->x_buf; t_freebytes(buf, oldbufsize * sizeof(*buf)); - buf = (t_float *)t_getbytes(bufsize * sizeof(*buf)); + buf = (t_sample *)t_getbytes(bufsize * sizeof(*buf)); memset((char *)buf, 0, bufsize * sizeof(*buf)); x->x_bufsize = bufsize; x->x_endbuf = buf + bufsize; @@ -556,7 +556,7 @@ static void *voutlet_newsig(t_symbol *s) x->x_parentoutlet = canvas_addoutlet(x->x_canvas, &x->x_obj.ob_pd, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); - x->x_endbuf = x->x_buf = (t_float *)getbytes(0); + x->x_endbuf = x->x_buf = (t_sample *)getbytes(0); x->x_bufsize = 0; resample_init(&x->x_updown); diff --git a/src/g_numbox.c b/src/g_numbox.c index 87864b61f..db25e9183 100644 --- a/src/g_numbox.c +++ b/src/g_numbox.c @@ -391,7 +391,7 @@ static void my_numbox_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, "ssiisiiffiisssiiiiiiifi", gensym("#X"),gensym("obj"), (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, gensym("nbx"), x->x_gui.x_w, x->x_gui.x_h, - (float)x->x_min, (float)x->x_max, + (t_float)x->x_min, (t_float)x->x_max, x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, diff --git a/src/g_readwrite.c b/src/g_readwrite.c index ff93a4dd3..97b56c020 100644 --- a/src/g_readwrite.c +++ b/src/g_readwrite.c @@ -619,15 +619,15 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b) binbuf_addv(b, "ssfffffffff;", gensym("#X"), gensym("coords"), x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, - (float)x->gl_pixwidth, (float)x->gl_pixheight, - (float)((x->gl_hidetext)?2.:1.), - (float)x->gl_xmargin, (float)x->gl_ymargin); + (t_float)x->gl_pixwidth, (t_float)x->gl_pixheight, + (t_float)((x->gl_hidetext)?2.:1.), + (t_float)x->gl_xmargin, (t_float)x->gl_ymargin); /* otherwise write in 0.38-compatible form */ else binbuf_addv(b, "ssfffffff;", gensym("#X"), gensym("coords"), x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, - (float)x->gl_pixwidth, (float)x->gl_pixheight, - (float)x->gl_isgraph); + (t_float)x->gl_pixwidth, (t_float)x->gl_pixheight, + (t_float)x->gl_isgraph); } } diff --git a/src/g_rtext.c b/src/g_rtext.c index 8af48b1a5..948ebcb4c 100644 --- a/src/g_rtext.c +++ b/src/g_rtext.c @@ -156,7 +156,7 @@ extern int sys_oldtclversion; static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, int *indexp) { - float dispx, dispy; + t_float dispx, dispy; char smallbuf[200], *tempbuf; int outchars = 0, nlines = 0, ncolumns = 0, pixwide, pixhigh, font, fontwidth, fontheight, findx, findy; diff --git a/src/g_scalar.c b/src/g_scalar.c index 76d54007a..675df5005 100644 --- a/src/g_scalar.c +++ b/src/g_scalar.c @@ -49,7 +49,7 @@ void word_restore(t_word *wp, t_template *template, int type = datatypes->ds_type; if (type == DT_FLOAT) { - float f; + t_float f; if (argc) { f = atom_getfloat(argv); @@ -145,7 +145,7 @@ void glist_scalar(t_glist *glist, } /* -------------------- widget behavior for scalar ------------ */ -void scalar_getbasexy(t_scalar *x, float *basex, float *basey) +void scalar_getbasexy(t_scalar *x, t_float *basex, t_float *basey) { t_template *template = template_findbyname(x->sc_template); *basex = template_getfloat(template, gensym("x"), x->sc_vec, 0); @@ -160,7 +160,7 @@ static void scalar_getrect(t_gobj *z, t_glist *owner, t_canvas *templatecanvas = template_findcanvas(template); int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff; t_gobj *y; - float basex, basey; + t_float basex, basey; scalar_getbasexy(x, &basex, &basey); /* if someone deleted the template canvas, we're just a point */ if (!templatecanvas) @@ -260,8 +260,8 @@ static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy) gpointer_init(&gp); gpointer_setglist(&gp, glist, x); SETPOINTER(&at[0], &gp); - SETFLOAT(&at[1], (float)dx); - SETFLOAT(&at[2], (float)dy); + SETFLOAT(&at[1], (t_float)dx); + SETFLOAT(&at[2], (t_float)dy); template_notify(template, gensym("displace"), 2, at); scalar_redraw(x, glist); } @@ -283,7 +283,7 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis) t_template *template = template_findbyname(x->sc_template); t_canvas *templatecanvas = template_findcanvas(template); t_gobj *y; - float basex, basey; + t_float basex, basey; scalar_getbasexy(x, &basex, &basey); /* if we don't know how to draw it, make a small rectangle */ if (!templatecanvas) @@ -327,14 +327,14 @@ void scalar_redraw(t_scalar *x, t_glist *glist) int scalar_doclick(t_word *data, t_template *template, t_scalar *sc, t_array *ap, struct _glist *owner, - float xloc, float yloc, int xpix, int ypix, + t_float xloc, t_float yloc, int xpix, int ypix, int shift, int alt, int dbl, int doit) { int hit = 0; t_canvas *templatecanvas = template_findcanvas(template); t_gobj *y; - float basex = template_getfloat(template, gensym("x"), data, 0); - float basey = template_getfloat(template, gensym("y"), data, 0); + t_float basex = template_getfloat(template, gensym("x"), data, 0); + t_float basey = template_getfloat(template, gensym("y"), data, 0); for (y = templatecanvas->gl_list; y; y = y->g_next) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); diff --git a/src/g_template.c b/src/g_template.c index 279fa2c3e..4d66bbed5 100644 --- a/src/g_template.c +++ b/src/g_template.c @@ -147,7 +147,7 @@ t_float template_getfloat(t_template *x, t_symbol *fieldname, t_word *wp, { int onset, type; t_symbol *arraytype; - float val = 0; + t_float val = 0; if (template_find_field(x, fieldname, &onset, &type, &arraytype)) { if (type == DT_FLOAT) @@ -721,14 +721,14 @@ struct _fielddesc t_symbol *fd_symbol; /* the field is a constant symbol */ t_symbol *fd_varsym; /* the field is variable and this is the name */ } fd_un; - float fd_v1; /* min and max values */ - float fd_v2; - float fd_screen1; /* min and max screen values */ - float fd_screen2; - float fd_quantum; /* quantization in value */ + t_float fd_v1; /* min and max values */ + t_float fd_v2; + t_float fd_screen1; /* min and max screen values */ + t_float fd_screen2; + t_float fd_quantum; /* quantization in value */ }; -static void fielddesc_setfloat_const(t_fielddesc *fd, float f) +static void fielddesc_setfloat_const(t_fielddesc *fd, t_float f) { fd->fd_type = A_FLOAT; fd->fd_var = 0; @@ -851,9 +851,9 @@ static t_float fielddesc_getfloat(t_fielddesc *f, t_template *template, } /* convert a variable's value to a screen coordinate via its fielddesc */ -t_float fielddesc_cvttocoord(t_fielddesc *f, float val) +t_float fielddesc_cvttocoord(t_fielddesc *f, t_float val) { - float coord, pix, extreme, div; + t_float coord, pix, extreme, div; if (f->fd_v2 == f->fd_v1) return (val); div = (f->fd_screen2 - f->fd_screen1)/(f->fd_v2 - f->fd_v1); @@ -877,7 +877,7 @@ t_float fielddesc_getcoord(t_fielddesc *f, t_template *template, { if (f->fd_var) { - float val = template_getfloat(template, + t_float val = template_getfloat(template, f->fd_un.fd_varsym, wp, loud); return (fielddesc_cvttocoord(f, val)); } @@ -909,15 +909,15 @@ static t_symbol *fielddesc_getsymbol(t_fielddesc *f, t_template *template, } /* convert from a screen coordinate to a variable value */ -float fielddesc_cvtfromcoord(t_fielddesc *f, float coord) +t_float fielddesc_cvtfromcoord(t_fielddesc *f, t_float coord) { - float val; + t_float val; if (f->fd_screen2 == f->fd_screen1) val = coord; else { - float div = (f->fd_v2 - f->fd_v1)/(f->fd_screen2 - f->fd_screen1); - float extreme; + t_float div = (f->fd_v2 - f->fd_v1)/(f->fd_screen2 - f->fd_screen1); + t_float extreme; val = f->fd_v1 + (coord - f->fd_screen1) * div; if (f->fd_quantum != 0) val = ((int)((val/f->fd_quantum) + 0.5)) * f->fd_quantum; @@ -932,11 +932,11 @@ float fielddesc_cvtfromcoord(t_fielddesc *f, float coord) } void fielddesc_setcoord(t_fielddesc *f, t_template *template, - t_word *wp, float coord, int loud) + t_word *wp, t_float coord, int loud) { if (f->fd_type == A_FLOAT && f->fd_var) { - float val = fielddesc_cvtfromcoord(f, coord); + t_float val = fielddesc_cvtfromcoord(f, coord); template_setfloat(template, f->fd_un.fd_varsym, wp, val, loud); } @@ -1040,7 +1040,7 @@ void curve_float(t_curve *x, t_floatarg f) /* -------------------- widget behavior for curve ------------ */ static void curve_getrect(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int *xp1, int *yp1, int *xp2, int *yp2) { t_curve *x = (t_curve *)z; @@ -1072,21 +1072,21 @@ static void curve_getrect(t_gobj *z, t_glist *glist, } static void curve_displace(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int dx, int dy) { /* refuse */ } static void curve_select(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { /* fill in later */ } static void curve_activate(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { /* fill in later */ @@ -1122,7 +1122,7 @@ static void numbertocolor(int n, char *s) } static void curve_vis(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int vis) { t_curve *x = (t_curve *)z; @@ -1137,7 +1137,7 @@ static void curve_vis(t_gobj *z, t_glist *glist, if (n > 1) { int flags = x->x_flags, closed = (flags & CLOSED); - float width = fielddesc_getfloat(&x->x_width, template, data, 1); + t_float width = fielddesc_getfloat(&x->x_width, template, data, 1); char outline[20], fill[20]; int pix[200]; if (n > 100) @@ -1185,12 +1185,12 @@ static void curve_vis(t_gobj *z, t_glist *glist, } static int curve_motion_field; -static float curve_motion_xcumulative; -static float curve_motion_xbase; -static float curve_motion_xper; -static float curve_motion_ycumulative; -static float curve_motion_ybase; -static float curve_motion_yper; +static t_float curve_motion_xcumulative; +static t_float curve_motion_xbase; +static t_float curve_motion_xper; +static t_float curve_motion_ycumulative; +static t_float curve_motion_ybase; +static t_float curve_motion_yper; static t_glist *curve_motion_glist; static t_scalar *curve_motion_scalar; static t_array *curve_motion_array; @@ -1237,7 +1237,7 @@ static void curve_motion(void *z, t_floatarg dx, t_floatarg dy) static int curve_click(t_gobj *z, t_glist *glist, t_word *data, t_template *template, t_scalar *sc, t_array *ap, - float basex, float basey, + t_float basex, t_float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_curve *x = (t_curve *)z; @@ -1438,8 +1438,8 @@ void plot_float(t_plot *x, t_floatarg f) static int plot_readownertemplate(t_plot *x, t_word *data, t_template *ownertemplate, t_symbol **elemtemplatesymp, t_array **arrayp, - float *linewidthp, float *xlocp, float *xincp, float *ylocp, float *stylep, - float *visp, float *scalarvisp, + t_float *linewidthp, t_float *xlocp, t_float *xincp, t_float *ylocp, t_float *stylep, + t_float *visp, t_float *scalarvisp, t_fielddesc **xfield, t_fielddesc **yfield, t_fielddesc **wfield) { int arrayonset, type; @@ -1538,7 +1538,7 @@ int array_getfields(t_symbol *elemtemplatesym, } static void plot_getrect(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int *xp1, int *yp1, int *xp2, int *yp2) { t_plot *x = (t_plot *)z; @@ -1546,11 +1546,11 @@ static void plot_getrect(t_gobj *z, t_glist *glist, t_canvas *elemtemplatecanvas; t_template *elemtemplate; t_symbol *elemtemplatesym; - float linewidth, xloc, xinc, yloc, style, xsum, yval, vis, scalarvis; + t_float linewidth, xloc, xinc, yloc, style, xsum, yval, vis, scalarvis; t_array *array; int x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff; int i; - float xpix, ypix, wpix; + t_float xpix, ypix, wpix; t_fielddesc *xfielddesc, *yfielddesc, *wfielddesc; if (!plot_readownertemplate(x, data, template, &elemtemplatesym, &array, &linewidth, &xloc, &xinc, &yloc, &style, @@ -1565,7 +1565,7 @@ static void plot_getrect(t_gobj *z, t_glist *glist, int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000); for (i = 0, xsum = 0; i < array->a_n; i += incr) { - float usexloc, useyloc; + t_float usexloc, useyloc; t_gobj *y; /* get the coords of the point proper */ array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, @@ -1585,11 +1585,11 @@ static void plot_getrect(t_gobj *z, t_glist *glist, /* check also the drawing instructions for the scalar */ if (xonset >= 0) usexloc = basex + xloc + fielddesc_cvttocoord(xfielddesc, - *(float *)(((char *)(array->a_vec) + elemsize * i) + *(t_float *)(((char *)(array->a_vec) + elemsize * i) + xonset)); else usexloc = basex + xsum, xsum += xinc; if (yonset >= 0) - yval = *(float *)(((char *)(array->a_vec) + elemsize * i) + yval = *(t_float *)(((char *)(array->a_vec) + elemsize * i) + yonset); else yval = 0; useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval); @@ -1622,28 +1622,28 @@ static void plot_getrect(t_gobj *z, t_glist *glist, } static void plot_displace(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int dx, int dy) { /* not yet */ } static void plot_select(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { /* not yet */ } static void plot_activate(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { /* not yet */ } static void plot_vis(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int tovis) { t_plot *x = (t_plot *)z; @@ -1651,7 +1651,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_canvas *elemtemplatecanvas; t_template *elemtemplate; t_symbol *elemtemplatesym; - float linewidth, xloc, xinc, yloc, style, usexloc, xsum, yval, vis, + t_float linewidth, xloc, xinc, yloc, style, usexloc, xsum, yval, vis, scalarvis; t_array *array; int nelem; @@ -1681,17 +1681,17 @@ static void plot_vis(t_gobj *z, t_glist *glist, { if (style == PLOTSTYLE_POINTS) { - float minyval = 1e20, maxyval = -1e20; + t_float minyval = 1e20, maxyval = -1e20; int ndrawn = 0; for (xsum = basex + xloc, i = 0; i < nelem; i++) { - float yval, xpix, ypix, nextxloc; + t_float yval, xpix, ypix, nextxloc; int ixpix, inextx; if (xonset >= 0) { usexloc = basex + xloc + - *(float *)((elem + elemsize * i) + xonset); + *(t_float *)((elem + elemsize * i) + xonset); ixpix = glist_xtopixels(glist, fielddesc_cvttocoord(xfielddesc, usexloc)); inextx = ixpix + 2; @@ -1707,7 +1707,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, } if (yonset >= 0) - yval = yloc + *(float *)((elem + elemsize * i) + yonset); + yval = yloc + *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; if (yval > maxyval) maxyval = yval; @@ -1734,7 +1734,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, { char outline[20]; int lastpixel = -1, ndrawn = 0; - float yval = 0, wval = 0, xpix; + t_float yval = 0, wval = 0, xpix; int ixpix = 0; /* draw the trace */ numbertocolor(fielddesc_getfloat(&x->x_outlinecolor, template, @@ -1749,13 +1749,13 @@ static void plot_vis(t_gobj *z, t_glist *glist, for (i = 0, xsum = xloc; i < nelem; i++) { if (xonset >= 0) - usexloc = xloc + *(float *)((elem + elemsize * i) + usexloc = xloc + *(t_float *)((elem + elemsize * i) + xonset); else usexloc = xsum, xsum += xinc; if (yonset >= 0) - yval = *(float *)((elem + elemsize * i) + yonset); + yval = *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; - wval = *(float *)((elem + elemsize * i) + wonset); + wval = *(t_float *)((elem + elemsize * i) + wonset); xpix = glist_xtopixels(glist, basex + fielddesc_cvttocoord(xfielddesc, usexloc)); ixpix = xpix + 0.5; @@ -1774,15 +1774,15 @@ static void plot_vis(t_gobj *z, t_glist *glist, lastpixel = -1; for (i = nelem-1; i >= 0; i--) { - float usexloc; + t_float usexloc; if (xonset >= 0) - usexloc = xloc + *(float *)((elem + elemsize * i) + usexloc = xloc + *(t_float *)((elem + elemsize * i) + xonset); else xsum -= xinc, usexloc = xsum; if (yonset >= 0) - yval = *(float *)((elem + elemsize * i) + yonset); + yval = *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; - wval = *(float *)((elem + elemsize * i) + wonset); + wval = *(t_float *)((elem + elemsize * i) + wonset); xpix = glist_xtopixels(glist, basex + fielddesc_cvttocoord(xfielddesc, usexloc)); ixpix = xpix + 0.5; @@ -1826,13 +1826,13 @@ static void plot_vis(t_gobj *z, t_glist *glist, for (xsum = xloc, i = 0; i < nelem; i++) { - float usexloc; + t_float usexloc; if (xonset >= 0) - usexloc = xloc + *(float *)((elem + elemsize * i) + + usexloc = xloc + *(t_float *)((elem + elemsize * i) + xonset); else usexloc = xsum, xsum += xinc; if (yonset >= 0) - yval = *(float *)((elem + elemsize * i) + yonset); + yval = *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; xpix = glist_xtopixels(glist, basex + fielddesc_cvttocoord(xfielddesc, usexloc)); @@ -1868,14 +1868,14 @@ static void plot_vis(t_gobj *z, t_glist *glist, { for (xsum = xloc, i = 0; i < nelem; i++) { - float usexloc, useyloc; + t_float usexloc, useyloc; t_gobj *y; if (xonset >= 0) usexloc = basex + xloc + - *(float *)((elem + elemsize * i) + xonset); + *(t_float *)((elem + elemsize * i) + xonset); else usexloc = basex + xsum, xsum += xinc; if (yonset >= 0) - yval = *(float *)((elem + elemsize * i) + yonset); + yval = *(t_float *)((elem + elemsize * i) + yonset); else yval = 0; useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval); @@ -1917,12 +1917,12 @@ static void plot_vis(t_gobj *z, t_glist *glist, static int plot_click(t_gobj *z, t_glist *glist, t_word *data, t_template *template, t_scalar *sc, t_array *ap, - float basex, float basey, + t_float basex, t_float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_plot *x = (t_plot *)z; t_symbol *elemtemplatesym; - float linewidth, xloc, xinc, yloc, style, vis, scalarvis; + t_float linewidth, xloc, xinc, yloc, style, vis, scalarvis; t_array *array; t_fielddesc *xfielddesc, *yfielddesc, *wfielddesc; @@ -2058,7 +2058,7 @@ static void drawnumber_sprintf(t_drawnumber *x, char *buf, t_atom *ap) } static void drawnumber_getrect(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int *xp1, int *yp1, int *xp2, int *yp2) { t_drawnumber *x = (t_drawnumber *)z; @@ -2090,14 +2090,14 @@ static void drawnumber_getrect(t_gobj *z, t_glist *glist, } static void drawnumber_displace(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int dx, int dy) { /* refuse */ } static void drawnumber_select(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { post("drawnumber_select %d", state); @@ -2105,14 +2105,14 @@ static void drawnumber_select(t_gobj *z, t_glist *glist, } static void drawnumber_activate(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int state) { post("drawnumber_activate %d", state); } static void drawnumber_vis(t_gobj *z, t_glist *glist, - t_word *data, t_template *template, float basex, float basey, + t_word *data, t_template *template, t_float basex, t_float basey, int vis) { t_drawnumber *x = (t_drawnumber *)z; @@ -2143,7 +2143,7 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist, else sys_vgui(".x%lx.c delete drawnumber%lx\n", glist_getcanvas(glist), data); } -static float drawnumber_motion_ycumulative; +static t_float drawnumber_motion_ycumulative; static t_glist *drawnumber_motion_glist; static t_scalar *drawnumber_motion_scalar; static t_array *drawnumber_motion_array; @@ -2225,7 +2225,7 @@ static void drawnumber_key(void *z, t_floatarg fkey) else { /* key entry for a numeric field. This is just a stopgap. */ - float newf; + t_float newf; if (drawnumber_motion_firstkey) sbuf[0] = 0; else sprintf(sbuf, "%g", template_getfloat(drawnumber_motion_template, @@ -2258,7 +2258,7 @@ static void drawnumber_key(void *z, t_floatarg fkey) static int drawnumber_click(t_gobj *z, t_glist *glist, t_word *data, t_template *template, t_scalar *sc, t_array *ap, - float basex, float basey, + t_float basex, t_float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_drawnumber *x = (t_drawnumber *)z; diff --git a/src/g_text.c b/src/g_text.c index fa28f70e1..5affd00c9 100644 --- a/src/g_text.c +++ b/src/g_text.c @@ -922,7 +922,7 @@ static void text_getrect(t_gobj *z, t_glist *glist, { t_text *x = (t_text *)z; int width, height, iscomment = (x->te_type == T_TEXT); - float x1, y1, x2, y2; + t_float x1, y1, x2, y2; /* for number boxes, we know width and height a priori, and should report them here so that graphs can get swelled to fit. */ diff --git a/src/g_toggle.c b/src/g_toggle.c index 6a71b5e11..830e99cb3 100644 --- a/src/g_toggle.c +++ b/src/g_toggle.c @@ -257,7 +257,7 @@ static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv) { t_symbol *srl[3]; int a = (int)atom_getintarg(0, argc, argv); - float nonzero = (float)atom_getfloatarg(2, argc, argv); + t_float nonzero = (t_float)atom_getfloatarg(2, argc, argv); int sr_flags; if(nonzero == 0.0) @@ -314,7 +314,7 @@ static void toggle_fout(t_toggle *x, t_floatarg f) static void toggle_loadbang(t_toggle *x) { if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) - toggle_fout(x, (float)x->x_on); + toggle_fout(x, (t_float)x->x_on); } static void toggle_size(t_toggle *x, t_symbol *s, int ac, t_atom *av) @@ -366,7 +366,7 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv) int a=IEM_GUI_DEFAULTSIZE, f=0; int ldx=17, ldy=7; int fs=10; - float on=0.0, nonzero=1.0; + t_float on=0.0, nonzero=1.0; char str[144]; iem_inttosymargs(&x->x_gui.x_isa, 0); @@ -391,11 +391,11 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv) bflcol[0] = (int)atom_getintarg(9, argc, argv); bflcol[1] = (int)atom_getintarg(10, argc, argv); bflcol[2] = (int)atom_getintarg(11, argc, argv); - on = (float)atom_getfloatarg(12, argc, argv); + on = (t_float)atom_getfloatarg(12, argc, argv); } else iemgui_new_getnames(&x->x_gui, 2, 0); if((argc == 14)&&IS_A_FLOAT(argv,13)) - nonzero = (float)atom_getfloatarg(13, argc, argv); + nonzero = (t_float)atom_getfloatarg(13, argc, argv); x->x_gui.x_draw = (t_iemfunptr)toggle_draw; x->x_gui.x_fsf.x_snd_able = 1; diff --git a/src/g_traversal.c b/src/g_traversal.c index 7de678489..de8f23c87 100644 --- a/src/g_traversal.c +++ b/src/g_traversal.c @@ -206,7 +206,7 @@ static void ptrobj_traverse(t_ptrobj *x, t_symbol *s) else pd_error(x, "pointer: list '%s' not found", s->s_name); } -static void ptrobj_vnext(t_ptrobj *x, float f) +static void ptrobj_vnext(t_ptrobj *x, t_float f) { t_gobj *gobj; t_gpointer *gp = &x->x_gp; @@ -774,7 +774,7 @@ static void getsize_pointer(t_getsize *x, t_gpointer *gp) else w = gp->gp_un.gp_scalar->sc_vec; array = *(t_array **)(((char *)w) + onset); - outlet_float(x->x_obj.ob_outlet, (float)(array->a_n)); + outlet_float(x->x_obj.ob_outlet, (t_float)(array->a_n)); } static void getsize_setup(void) diff --git a/src/g_vdial.c b/src/g_vdial.c index 0fa65da7a..9f7732f53 100644 --- a/src/g_vdial.c +++ b/src/g_vdial.c @@ -347,14 +347,14 @@ static void vradio_bang(t_vradio *x) { if((x->x_change)&&(x->x_on != x->x_on_old)) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -382,7 +382,7 @@ static void vradio_fout(t_vradio *x, t_floatarg f) /* compatibility with earlier "vdial" behavior */ if((x->x_change)&&(i != x->x_on_old)) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -393,7 +393,7 @@ static void vradio_fout(t_vradio *x, t_floatarg f) x->x_on = i; (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -426,7 +426,7 @@ static void vradio_float(t_vradio *x, t_floatarg f) { if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on_old); + SETFLOAT(x->x_at, (t_float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -440,7 +440,7 @@ static void vradio_float(t_vradio *x, t_floatarg f) x->x_on_old = x->x_on; if(x->x_gui.x_fsf.x_put_in2out) { - SETFLOAT(x->x_at, (float)x->x_on); + SETFLOAT(x->x_at, (t_float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) @@ -466,7 +466,7 @@ static void vradio_click(t_vradio *x, t_floatarg xpos, t_floatarg ypos, { int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist); - vradio_fout(x, (float)(yy / x->x_gui.x_h)); + vradio_fout(x, (t_float)(yy / x->x_gui.x_h)); } static int vradio_newclick(t_gobj *z, struct _glist *glist, diff --git a/src/g_vslider.c b/src/g_vslider.c index c49c51f2e..87309029e 100644 --- a/src/g_vslider.c +++ b/src/g_vslider.c @@ -215,7 +215,7 @@ static void vslider_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, "ssiisiiffiisssiiiiiiiii", gensym("#X"),gensym("obj"), (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix, gensym("vsl"), x->x_gui.x_w, x->x_gui.x_h, - (float)x->x_min, (float)x->x_max, + (t_float)x->x_min, (t_float)x->x_max, x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, diff --git a/src/g_vumeter.c b/src/g_vumeter.c index 6e06a967f..f0ec30aa0 100644 --- a/src/g_vumeter.c +++ b/src/g_vumeter.c @@ -538,7 +538,7 @@ static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) vu_check_height(x, h); if(scale != 0) scale = 1; - vu_scale(x, (float)scale); + vu_scale(x, (t_float)scale); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); @@ -593,7 +593,7 @@ static void vu_float(t_vu *x, t_floatarg rms) x->x_rms = iemgui_vu_db2i[i]; } i = (int)(100.0*rms + 10000.5); - rms = 0.01*(float)(i - 10000); + rms = 0.01*(t_float)(i - 10000); x->x_fr = rms; outlet_float(x->x_out_rms, rms); x->x_updaterms = 1; @@ -614,7 +614,7 @@ static void vu_ft1(t_vu *x, t_floatarg peak) x->x_peak = iemgui_vu_db2i[i]; } i = (int)(100.0*peak + 10000.5); - peak = 0.01*(float)(i - 10000); + peak = 0.01*(t_float)(i - 10000); x->x_fp = peak; x->x_updatepeak = 1; sys_queuegui(x, x->x_gui.x_glist, vu_draw_update); diff --git a/src/m_binbuf.c b/src/m_binbuf.c index 3d909a75b..c2ebd2cad 100644 --- a/src/m_binbuf.c +++ b/src/m_binbuf.c @@ -1007,7 +1007,7 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) atom_getfloatarg(2, natom, nextmess), atom_getfloatarg(5, natom, nextmess) - atom_getfloatarg(3, natom, nextmess), - (float)sys_defaultfont); + (t_float)sys_defaultfont); } } if (!strcmp(first, "#P")) @@ -1090,7 +1090,7 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) } else if (!strcmp(second, "slider")) { - float inc = atom_getfloatarg(7, natom, nextmess); + t_float inc = atom_getfloatarg(7, natom, nextmess); if (inc <= 0) inc = 1; binbuf_addv(newb, "ssffsffffffsssfffffffff;", diff --git a/src/m_class.c b/src/m_class.c index 0737a660a..622fbd2da 100644 --- a/src/m_class.c +++ b/src/m_class.c @@ -400,7 +400,7 @@ static void pd_floatforsignal(t_pd *x, t_float f) { int offset = (*x)->c_floatsignalin; if (offset > 0) - *(t_sample *)(((char *)x) + offset) = f; + *(t_float *)(((char *)x) + offset) = f; else pd_error(x, "%s: float unexpected for signal input", (*x)->c_name->s_name); diff --git a/src/m_obj.c b/src/m_obj.c index f5c91cdf0..3f8bcda41 100644 --- a/src/m_obj.c +++ b/src/m_obj.c @@ -15,7 +15,7 @@ union inletunion t_gpointer *iu_pointerslot; t_float *iu_floatslot; t_symbol **iu_symslot; - t_sample iu_floatsignalvalue; + t_float iu_floatsignalvalue; }; struct _inlet @@ -660,7 +660,7 @@ int obj_issignaloutlet(t_object *x, int m) return (o2 && (o2->o_sym == &s_signal)); } -t_sample *obj_findsignalscalar(t_object *x, int m) +t_float *obj_findsignalscalar(t_object *x, int m) { int n = 0; t_inlet *i; @@ -668,7 +668,7 @@ t_sample *obj_findsignalscalar(t_object *x, int m) { if (!m--) return (x->ob_pd->c_floatsignalin > 0 ? - (t_sample *)(((char *)x) + x->ob_pd->c_floatsignalin) : 0); + (t_float *)(((char *)x) + x->ob_pd->c_floatsignalin) : 0); n++; } for (i = x->ob_inlet; i; i = i->i_next, m--) diff --git a/src/m_pd.h b/src/m_pd.h index 2a9a1dafe..53238d60d 100644 --- a/src/m_pd.h +++ b/src/m_pd.h @@ -481,7 +481,7 @@ typedef struct _signal { int s_n; /* number of points in the array */ t_sample *s_vec; /* the array */ - float s_sr; /* sample rate */ + t_float s_sr; /* sample rate */ int s_refcount; /* number of times used */ int s_isborrowed; /* whether we're going to borrow our array */ struct _signal *s_borrowedfrom; /* signal to borrow it from */ @@ -498,24 +498,24 @@ EXTERN t_int *copy_perform(t_int *args); EXTERN void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n); EXTERN void dsp_add_copy(t_sample *in, t_sample *out, int n); -EXTERN void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n); +EXTERN void dsp_add_scalarcopy(t_float *in, t_sample *out, int n); EXTERN void dsp_add_zero(t_sample *out, int n); EXTERN int sys_getblksize(void); -EXTERN float sys_getsr(void); +EXTERN t_float sys_getsr(void); EXTERN int sys_get_inchannels(void); EXTERN int sys_get_outchannels(void); EXTERN void dsp_add(t_perfroutine f, int n, ...); EXTERN void dsp_addv(t_perfroutine f, int n, t_int *vec); -EXTERN void pd_fft(float *buf, int npoints, int inverse); +EXTERN void pd_fft(t_float *buf, int npoints, int inverse); EXTERN int ilog2(int n); -EXTERN void mayer_fht(float *fz, int n); -EXTERN void mayer_fft(int n, float *real, float *imag); -EXTERN void mayer_ifft(int n, float *real, float *imag); -EXTERN void mayer_realfft(int n, float *real); -EXTERN void mayer_realifft(int n, float *real); +EXTERN void mayer_fht(t_sample *fz, int n); +EXTERN void mayer_fft(int n, t_sample *real, t_sample *imag); +EXTERN void mayer_ifft(int n, t_sample *real, t_sample *imag); +EXTERN void mayer_realfft(int n, t_sample *real); +EXTERN void mayer_realifft(int n, t_sample *real); EXTERN float *cos_table; #define LOGCOSTABSIZE 9 @@ -534,13 +534,13 @@ typedef struct _resample t_int downsample; /* downsampling factor */ t_int upsample; /* upsampling factor */ - t_float *s_vec; /* here we hold the resampled data */ + t_sample *s_vec; /* here we hold the resampled data */ int s_n; - t_float *coeffs; /* coefficients for filtering... */ + t_sample *coeffs; /* coefficients for filtering... */ int coefsize; - t_float *buffer; /* buffer for filtering */ + t_sample *buffer; /* buffer for filtering */ int bufsize; } t_resample; @@ -552,18 +552,18 @@ EXTERN void resamplefrom_dsp(t_resample *x, t_sample *in, int insize, int outsiz EXTERN void resampleto_dsp(t_resample *x, t_sample *out, int insize, int outsize, int method); /* ----------------------- utility functions for signals -------------- */ -EXTERN float mtof(float); -EXTERN float ftom(float); -EXTERN float rmstodb(float); -EXTERN float powtodb(float); -EXTERN float dbtorms(float); -EXTERN float dbtopow(float); - -EXTERN float q8_sqrt(float); -EXTERN float q8_rsqrt(float); +EXTERN t_float mtof(t_float); +EXTERN t_float ftom(t_float); +EXTERN t_float rmstodb(t_float); +EXTERN t_float powtodb(t_float); +EXTERN t_float dbtorms(t_float); +EXTERN t_float dbtopow(t_float); + +EXTERN t_float q8_sqrt(t_float); +EXTERN t_float q8_rsqrt(t_float); #ifndef N32 -EXTERN float qsqrt(float); /* old names kept for extern compatibility */ -EXTERN float qrsqrt(float); +EXTERN t_float qsqrt(t_float); /* old names kept for extern compatibility */ +EXTERN t_float qrsqrt(t_float); #endif /* --------------------- data --------------------------------- */ @@ -574,7 +574,7 @@ EXTERN_STRUCT _garray; EXTERN t_class *garray_class; EXTERN int garray_getfloatarray(t_garray *x, int *size, t_float **vec); EXTERN int garray_getfloatwords(t_garray *x, int *size, t_word **vec); -EXTERN float garray_get(t_garray *x, t_symbol *s, t_int indx); +EXTERN t_float garray_get(t_garray *x, t_symbol *s, t_int indx); EXTERN void garray_redraw(t_garray *x); EXTERN int garray_npoints(t_garray *x); EXTERN char *garray_vec(t_garray *x); @@ -624,7 +624,6 @@ defined, there is a "te_xpix" field in objects, not a "te_xpos" as before: */ #define PD_USE_TE_XPIX - #if defined(__i386__) || defined(__x86_64__) /* a test for NANs and denormals. Should only be necessary on i386. */ #define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \ diff --git a/src/m_sched.c b/src/m_sched.c index 549d34708..8801e285d 100644 --- a/src/m_sched.c +++ b/src/m_sched.c @@ -288,7 +288,7 @@ static void sched_pollformeters( void) } if (sched_meterson) { - float inmax, outmax; + t_sample inmax, outmax; sys_getmeters(&inmax, &outmax); indb = 0.5 + rmstodb(inmax); outdb = 0.5 + rmstodb(outmax); @@ -313,7 +313,7 @@ static void sched_pollformeters( void) sched_diddsp + (int)(sys_dacsr /(double)sys_schedblocksize); } -void glob_meters(void *dummy, float f) +void glob_meters(void *dummy, t_float f) { if (f == 0) sys_getmeters(0, 0); diff --git a/src/s_audio.c b/src/s_audio.c index 79d56dc94..ca8713c8b 100644 --- a/src/s_audio.c +++ b/src/s_audio.c @@ -41,12 +41,12 @@ int sys_blocksize = 0; /* audio I/O block size in sample frames */ int sys_audioapi = API_DEFAULT; int sys_audioapiopened = -1; /* save last API opened for later closing */ static int sys_meters; /* true if we're metering */ -static float sys_inmax; /* max input amplitude */ -static float sys_outmax; /* max output amplitude */ +static t_sample sys_inmax; /* max input amplitude */ +static t_sample sys_outmax; /* max output amplitude */ /* exported variables */ int sys_schedadvance; /* scheduler advance in microseconds */ -float sys_dacsr; +t_float sys_dacsr; t_sample *sys_soundout; t_sample *sys_soundin; @@ -138,18 +138,18 @@ void sys_setchsr(int chin, int chout, int sr) { int nblk; int inbytes = (chin ? chin : 2) * - (DEFDACBLKSIZE*sizeof(float)); + (DEFDACBLKSIZE*sizeof(t_sample)); int outbytes = (chout ? chout : 2) * - (DEFDACBLKSIZE*sizeof(float)); + (DEFDACBLKSIZE*sizeof(t_sample)); if (sys_soundin) freebytes(sys_soundin, (sys_inchannels? sys_inchannels : 2) * - (DEFDACBLKSIZE*sizeof(float))); + (DEFDACBLKSIZE*sizeof(t_sample))); if (sys_soundout) freebytes(sys_soundout, (sys_outchannels? sys_outchannels : 2) * - (DEFDACBLKSIZE*sizeof(float))); + (DEFDACBLKSIZE*sizeof(t_sample))); sys_inchannels = chin; sys_outchannels = chout; sys_dacsr = sr; @@ -157,10 +157,10 @@ void sys_setchsr(int chin, int chout, int sr) if (sys_advance_samples < 3 * DEFDACBLKSIZE) sys_advance_samples = 3 * DEFDACBLKSIZE; - sys_soundin = (t_float *)getbytes(inbytes); + sys_soundin = (t_sample *)getbytes(inbytes); memset(sys_soundin, 0, inbytes); - sys_soundout = (t_float *)getbytes(outbytes); + sys_soundout = (t_sample *)getbytes(outbytes); memset(sys_soundout, 0, outbytes); if (sys_verbose) @@ -445,11 +445,11 @@ int sys_send_dacs(void) if (sys_meters) { int i, n; - float maxsamp; + t_sample maxsamp; for (i = 0, n = sys_inchannels * DEFDACBLKSIZE, maxsamp = sys_inmax; i < n; i++) { - float f = sys_soundin[i]; + t_sample f = sys_soundin[i]; if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } @@ -457,7 +457,7 @@ int sys_send_dacs(void) for (i = 0, n = sys_outchannels * DEFDACBLKSIZE, maxsamp = sys_outmax; i < n; i++) { - float f = sys_soundout[i]; + t_sample f = sys_soundout[i]; if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } @@ -493,7 +493,7 @@ int sys_send_dacs(void) return (0); } -float sys_getsr(void) +t_float sys_getsr(void) { return (sys_dacsr); } @@ -508,7 +508,7 @@ int sys_get_inchannels(void) return (sys_inchannels); } -void sys_getmeters(float *inmax, float *outmax) +void sys_getmeters(t_sample *inmax, t_sample *outmax) { if (inmax) { diff --git a/src/s_audio_oss.c b/src/s_audio_oss.c index 081fabcd2..2649d4e1a 100644 --- a/src/s_audio_oss.c +++ b/src/s_audio_oss.c @@ -42,8 +42,8 @@ typedef int32_t t_oss_int32; /* GLOBALS */ static int linux_meters; /* true if we're metering */ -static float linux_inmax; /* max input amplitude */ -static float linux_outmax; /* max output amplitude */ +static t_sample linux_inmax; /* max input amplitude */ +static t_sample linux_outmax; /* max output amplitude */ static int linux_fragsize = 0; /* for block mode; block size (sample frames) */ /* our device handles */ @@ -64,7 +64,7 @@ static int linux_noutdevs = 0; static int linux_nindevs = 0; /* exported variables */ -float sys_dacsr; +t_float sys_dacsr; t_sample *sys_soundout; t_sample *sys_soundin; @@ -645,7 +645,7 @@ static void oss_doresync( void) int oss_send_dacs(void) { - float *fp1, *fp2; + t_sample *fp1, *fp2; long fill; int i, j, dev, rtnval = SENDDACS_YES; char buf[OSS_MAXSAMPLEWIDTH * DEFDACBLKSIZE * OSS_MAXCHPERDEV]; @@ -779,7 +779,7 @@ int oss_send_dacs(void) thischan += nchannels; } memset(sys_soundout, 0, - sys_outchannels * (sizeof(float) * DEFDACBLKSIZE)); + sys_outchannels * (sizeof(t_sample) * DEFDACBLKSIZE)); /* do input */ diff --git a/src/s_main.c b/src/s_main.c index 002866d51..3396e9939 100644 --- a/src/s_main.c +++ b/src/s_main.c @@ -95,7 +95,7 @@ int* get_sys_main_advance() { return &sys_main_advance; } double* get_sys_time_per_dsp_tick() { return &sys_time_per_dsp_tick; } int* get_sys_schedblocksize() { return &sys_schedblocksize; } double* get_sys_time() { return &sys_time; } -float* get_sys_dacsr() { return &sys_dacsr; } +t_float* get_sys_dacsr() { return &sys_dacsr; } int* get_sys_sleepgrain() { return &sys_sleepgrain; } int* get_sys_schedadvance() { return &sys_schedadvance; } diff --git a/src/s_print.c b/src/s_print.c index 23bacff27..3aacd188b 100644 --- a/src/s_print.c +++ b/src/s_print.c @@ -83,7 +83,7 @@ void postatom(int argc, t_atom *argv) } } -void postfloat(float f) +void postfloat(t_float f) { char buf[80]; t_atom a; @@ -118,7 +118,7 @@ void verbose(int level, const char *fmt, ...) int i; if(level>sys_verbose)return; dopost("verbose("); - postfloat((float)level); + postfloat((t_float)level); dopost("):"); va_start(ap, fmt); diff --git a/src/s_stuff.h b/src/s_stuff.h index 813e5fd49..a1f9026c4 100644 --- a/src/s_stuff.h +++ b/src/s_stuff.h @@ -68,7 +68,7 @@ extern int sys_inchannels; extern int sys_outchannels; extern int sys_advance_samples; /* scheduler advance in samples */ extern int sys_blocksize; /* audio I/O block size in sample frames */ -extern float sys_dacsr; +extern t_float sys_dacsr; extern int sys_schedadvance; extern int sys_sleepgrain; void sys_set_audio_settings(int naudioindev, int *audioindev, @@ -83,7 +83,7 @@ int sys_send_dacs(void); void sys_reportidle(void); void sys_set_priority(int higher); void sys_audiobuf(int nbufs); -void sys_getmeters(float *inmax, float *outmax); +void sys_getmeters(t_sample *inmax, t_sample *outmax); void sys_listdevs(void); void sys_setblocksize(int n); @@ -299,7 +299,7 @@ EXTERN int* get_sys_main_advance(void ) ; EXTERN double* get_sys_time_per_dsp_tick(void ) ; EXTERN int* get_sys_schedblocksize(void ) ; EXTERN double* get_sys_time(void ) ; -EXTERN float* get_sys_dacsr(void ) ; +EXTERN t_float* get_sys_dacsr(void ) ; EXTERN int* get_sys_sleepgrain(void ) ; EXTERN int* get_sys_schedadvance(void ) ; diff --git a/src/x_acoustics.c b/src/x_acoustics.c index eca2d32b6..e07a4231c 100644 --- a/src/x_acoustics.c +++ b/src/x_acoustics.c @@ -9,39 +9,39 @@ #include <math.h> #define LOGTEN 2.302585092994 -float mtof(float f) +t_float mtof(t_float f) { if (f <= -1500) return(0); else if (f > 1499) return(mtof(1499)); else return (8.17579891564 * exp(.0577622650 * f)); } -float ftom(float f) +t_float ftom(t_float f) { return (f > 0 ? 17.3123405046 * log(.12231220585 * f) : -1500); } -float powtodb(float f) +t_float 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); } } -float rmstodb(float f) +t_float rmstodb(t_float f) { if (f <= 0) return (0); else { - float val = 100 + 20./LOGTEN * log(f); + t_float val = 100 + 20./LOGTEN * log(f); return (val < 0 ? 0 : val); } } -float dbtopow(float f) +t_float dbtopow(t_float f) { if (f <= 0) return(0); @@ -53,7 +53,7 @@ float dbtopow(float f) } } -float dbtorms(float f) +t_float dbtorms(t_float f) { if (f <= 0) return(0); diff --git a/src/x_arithmetic.c b/src/x_arithmetic.c index c55e3ea81..f64c8cbd4 100644 --- a/src/x_arithmetic.c +++ b/src/x_arithmetic.c @@ -551,8 +551,8 @@ static void *tan_new(void) static void tan_float(t_object *x, t_float f) { - float c = cosf(f); - float t = (c == 0 ? 0 : sinf(f)/c); + t_float c = cosf(f); + t_float t = (c == 0 ? 0 : sinf(f)/c); outlet_float(x->ob_outlet, t); } @@ -575,7 +575,7 @@ static t_class *atan2_class; /* ----------- atan2 --------------- */ typedef struct _atan2 { t_object x_ob; - float x_f; + t_float x_f; } t_atan2; static void *atan2_new(void) @@ -589,7 +589,7 @@ static void *atan2_new(void) static void atan2_float(t_atan2 *x, t_float f) { - float r = (f == 0 && x->x_f == 0 ? 0 : atan2f(f, x->x_f)); + t_float r = (f == 0 && x->x_f == 0 ? 0 : atan2f(f, x->x_f)); outlet_float(x->x_ob.ob_outlet, r); } @@ -604,7 +604,7 @@ static void *sqrt_new(void) static void sqrt_float(t_object *x, t_float f) { - float r = (f > 0 ? sqrtf(f) : 0); + t_float r = (f > 0 ? sqrtf(f) : 0); outlet_float(x->ob_outlet, r); } @@ -619,7 +619,7 @@ static void *log_new(void) static void log_float(t_object *x, t_float f) { - float r = (f > 0 ? logf(f) : -1000); + t_float r = (f > 0 ? logf(f) : -1000); outlet_float(x->ob_outlet, r); } @@ -636,7 +636,7 @@ static void *exp_new(void) #define MAXLOG 87.3365 static void exp_float(t_object *x, t_float f) { - float g; + t_float g; #ifdef MSW char buf[10]; #endif @@ -666,9 +666,9 @@ static t_class *clip_class; typedef struct _clip { t_object x_ob; - float x_f1; - float x_f2; - float x_f3; + t_float x_f1; + t_float x_f2; + t_float x_f3; } t_clip; static void *clip_new(t_floatarg f1, t_floatarg f2) diff --git a/src/x_connective.c b/src/x_connective.c index c26877791..83d7f34ac 100644 --- a/src/x_connective.c +++ b/src/x_connective.c @@ -506,7 +506,7 @@ static void route_list(t_route *x, t_symbol *sel, int argc, t_atom *argv) int nelement; if (x->x_type == A_FLOAT) { - float f; + t_float f; if (!argc) return; f = atom_getfloat(argv); for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) @@ -1057,7 +1057,7 @@ static t_class *spigot_class; typedef struct _spigot { t_object x_obj; - float x_state; + t_float x_state; } t_spigot; static void *spigot_new(t_floatarg f) @@ -1118,7 +1118,7 @@ typedef struct _moses { t_object x_ob; t_outlet *x_out2; - float x_y; + t_float x_y; } t_moses; static void *moses_new(t_floatarg f) diff --git a/src/x_list.c b/src/x_list.c index 8156704aa..bb21a8f59 100644 --- a/src/x_list.c +++ b/src/x_list.c @@ -484,13 +484,13 @@ static void *list_length_new( void) static void list_length_list(t_list_length *x, t_symbol *s, int argc, t_atom *argv) { - outlet_float(x->x_obj.ob_outlet, (float)argc); + outlet_float(x->x_obj.ob_outlet, (t_float)argc); } static void list_length_anything(t_list_length *x, t_symbol *s, int argc, t_atom *argv) { - outlet_float(x->x_obj.ob_outlet, (float)argc+1); + outlet_float(x->x_obj.ob_outlet, (t_float)argc+1); } static void list_length_setup(void) diff --git a/src/x_midi.c b/src/x_midi.c index 3e25cf4ed..970581080 100644 --- a/src/x_midi.c +++ b/src/x_midi.c @@ -135,9 +135,9 @@ static void *notein_new(t_floatarg f) static void notein_list(t_notein *x, t_symbol *s, int argc, t_atom *argv) { - float pitch = atom_getfloatarg(0, argc, argv); - float velo = atom_getfloatarg(1, argc, argv); - float channel = atom_getfloatarg(2, argc, argv); + t_float pitch = atom_getfloatarg(0, argc, argv); + t_float velo = atom_getfloatarg(1, argc, argv); + t_float channel = atom_getfloatarg(2, argc, argv); if (x->x_channel != 0) { if (channel != x->x_channel) return; @@ -278,8 +278,8 @@ static void *pgmin_new(t_floatarg f) static void pgmin_list(t_pgmin *x, t_symbol *s, int argc, t_atom *argv) { - float value = atom_getfloatarg(0, argc, argv); - float channel = atom_getfloatarg(1, argc, argv); + t_float value = atom_getfloatarg(0, argc, argv); + t_float channel = atom_getfloatarg(1, argc, argv); if (x->x_channel != 0) { if (channel != x->x_channel) return; @@ -546,8 +546,8 @@ static void *midiclkin_new(t_floatarg f) static void midiclkin_list(t_midiclkin *x, t_symbol *s, int argc, t_atom *argv) { - float value = atom_getfloatarg(0, argc, argv); - float count = atom_getfloatarg(1, argc, argv); + t_float value = atom_getfloatarg(0, argc, argv); + t_float count = atom_getfloatarg(1, argc, argv); outlet_float(x->x_outlet2, count); outlet_float(x->x_outlet1, value); } @@ -570,9 +570,9 @@ static void midiclkin_setup(void) void inmidi_clk(double timing) { - static float prev = 0; - static float count = 0; - float cur,diff; + static t_float prev = 0; + static t_float count = 0; + t_float cur,diff; if (midiclkin_sym->s_thing) { @@ -621,8 +621,8 @@ static void *midirealtimein_new( void) static void midirealtimein_list(t_midirealtimein *x, t_symbol *s, int argc, t_atom *argv) { - float portno = atom_getfloatarg(0, argc, argv); - float byte = atom_getfloatarg(1, argc, argv); + t_float portno = atom_getfloatarg(0, argc, argv); + t_float byte = atom_getfloatarg(1, argc, argv); outlet_float(x->x_outlet2, portno); outlet_float(x->x_outlet1, byte); @@ -1068,7 +1068,7 @@ static t_class *poly_class; typedef struct voice { - float v_pitch; + t_float v_pitch; int v_used; unsigned long v_serial; } t_voice; @@ -1078,14 +1078,14 @@ typedef struct poly t_object x_obj; int x_n; t_voice *x_vec; - float x_vel; + t_float x_vel; t_outlet *x_pitchout; t_outlet *x_velout; unsigned long x_serial; int x_steal; } t_poly; -static void *poly_new(float fnvoice, float fsteal) +static void *poly_new(t_float fnvoice, t_float fsteal) { int i, n = fnvoice; t_poly *x = (t_poly *)pd_new(poly_class); diff --git a/src/x_misc.c b/src/x_misc.c index 0c894c723..8a67a5d15 100644 --- a/src/x_misc.c +++ b/src/x_misc.c @@ -70,7 +70,7 @@ static void random_bang(t_random *x) outlet_float(x->x_obj.ob_outlet, nval); } -static void random_seed(t_random *x, float f, float glob) +static void random_seed(t_random *x, t_float f, t_float glob) { x->x_state = f; } @@ -228,7 +228,7 @@ static void cputime_bang(t_cputime *x) static void cputime_bang2(t_cputime *x) { #ifdef UNISTD - float elapsedcpu; + t_float elapsedcpu; struct tms newcputime; times(&newcputime); elapsedcpu = 1000 * ( @@ -237,7 +237,7 @@ static void cputime_bang2(t_cputime *x) outlet_float(x->x_obj.ob_outlet, elapsedcpu); #endif #ifdef MSW - float elapsedcpu; + t_float elapsedcpu; FILETIME ignorethis, ignorethat; LARGE_INTEGER usertime, kerneltime; BOOL retval; diff --git a/src/x_qlist.c b/src/x_qlist.c index c0be1d52f..fe6df0f38 100644 --- a/src/x_qlist.c +++ b/src/x_qlist.c @@ -18,9 +18,9 @@ typedef struct _qlist void *x_binbuf; int x_onset; /* playback position */ t_clock *x_clock; - float x_tempo; + t_float x_tempo; double x_whenclockset; - float x_clockdelay; + t_float x_clockdelay; t_symbol *x_dir; t_canvas *x_canvas; int x_reentered; @@ -211,14 +211,14 @@ static void qlist_print(t_qlist *x) static void qlist_tempo(t_qlist *x, t_float f) { - float newtempo; + t_float newtempo; if (f < 1e-20) f = 1e-20; else if (f > 1e20) f = 1e20; newtempo = 1./f; if (x->x_whenclockset != 0) { - float elapsed = clock_gettimesince(x->x_whenclockset); - float left = x->x_clockdelay - elapsed; + t_float elapsed = clock_gettimesince(x->x_whenclockset); + t_float left = x->x_clockdelay - elapsed; if (left < 0) left = 0; left *= newtempo / x->x_tempo; clock_delay(x->x_clock, left); diff --git a/src/x_time.c b/src/x_time.c index 702854558..60dcf9a50 100644 --- a/src/x_time.c +++ b/src/x_time.c @@ -313,7 +313,7 @@ typedef struct _pipe t_object x_obj; int x_n; int x_nptr; - float x_deltime; + t_float x_deltime; t_pipeout *x_vec; t_gpointer *x_gp; t_hang *x_hang; @@ -327,7 +327,7 @@ static void *pipe_new(t_symbol *s, int argc, t_atom *argv) t_gpointer *gp; int nptr = 0; int i; - float deltime; + t_float deltime; if (argc) { if (argv[argc-1].a_type != A_FLOAT) -- GitLab