summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/intern/print~.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/intern/print~.c')
-rw-r--r--apps/plugins/pdbox/PDa/intern/print~.c77
1 files changed, 0 insertions, 77 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/print~.c b/apps/plugins/pdbox/PDa/intern/print~.c
index 3051ca37be..699555a1bc 100644
--- a/apps/plugins/pdbox/PDa/intern/print~.c
+++ b/apps/plugins/pdbox/PDa/intern/print~.c
@@ -76,81 +76,4 @@ void print_tilde_setup(void)
76 class_addbang(print_class, print_bang); 76 class_addbang(print_class, print_bang);
77 class_addfloat(print_class, print_float); 77 class_addfloat(print_class, print_float);
78} 78}
79#include <m_pd.h>
80#include <m_fixed.h>
81
82static t_class *print_class;
83
84typedef struct _print
85{
86 t_object x_obj;
87 float x_f;
88 t_symbol *x_sym;
89 int x_count;
90} t_print;
91 79
92static t_int *print_perform(t_int *w)
93{
94 t_print *x = (t_print *)(w[1]);
95 t_sample *in = (t_sample *)(w[2]);
96 int n = (int)(w[3]);
97 if (x->x_count)
98 {
99 post("%s:", x->x_sym->s_name);
100 if (n == 1) post("%8g", in[0]);
101 else if (n == 2) post("%8g %8g", in[0], in[1]);
102 else if (n == 4) post("%8g %8g %8g %8g",
103 in[0], in[1], in[2], in[3]);
104 else while (n > 0)
105 {
106 post("%-8.5g %-8.5g %-8.5g %-8.5g %-8.5g %-8.5g %-8.5g %-8.5g",
107 fixtof(in[0]),
108 fixtof(in[1]),
109 fixtof(in[2]),
110 fixtof(in[3]),
111 fixtof(in[4]),
112 fixtof(in[5]),
113 fixtof(in[6]),
114 fixtof(in[7]));
115 n -= 8;
116 in += 8;
117 }
118 x->x_count--;
119 }
120 return (w+4);
121}
122
123static void print_dsp(t_print *x, t_signal **sp)
124{
125 dsp_add(print_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
126}
127
128static void print_float(t_print *x, t_float f)
129{
130 if (f < 0) f = 0;
131 x->x_count = f;
132}
133
134static void print_bang(t_print *x)
135{
136 x->x_count = 1;
137}
138
139static void *print_new(t_symbol *s)
140{
141 t_print *x = (t_print *)pd_new(print_class);
142 x->x_sym = (s->s_name[0]? s : gensym("print~"));
143 x->x_count = 0;
144 x->x_f = 0;
145 return (x);
146}
147
148void print_tilde_setup(void)
149{
150 print_class = class_new(gensym("print~"), (t_newmethod)print_new, 0,
151 sizeof(t_print), 0, A_DEFSYM, 0);
152 CLASS_MAINSIGNALIN(print_class, t_print, x_f);
153 class_addmethod(print_class, (t_method)print_dsp, gensym("dsp"), 0);
154 class_addbang(print_class, print_bang);
155 class_addfloat(print_class, print_float);
156}