summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/intern/snapshot~.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/intern/snapshot~.c')
-rw-r--r--apps/plugins/pdbox/PDa/intern/snapshot~.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/snapshot~.c b/apps/plugins/pdbox/PDa/intern/snapshot~.c
index f63aeb76cd..cd3557a3df 100644
--- a/apps/plugins/pdbox/PDa/intern/snapshot~.c
+++ b/apps/plugins/pdbox/PDa/intern/snapshot~.c
@@ -55,60 +55,4 @@ void snapshot_tilde_setup(void)
55 gensym("set"), A_DEFFLOAT, 0); 55 gensym("set"), A_DEFFLOAT, 0);
56 class_addbang(snapshot_tilde_class, snapshot_tilde_bang); 56 class_addbang(snapshot_tilde_class, snapshot_tilde_bang);
57} 57}
58#include <m_pd.h>
59#include <m_fixed.h>
60
61
62static t_class *snapshot_tilde_class;
63
64typedef struct _snapshot
65{
66 t_object x_obj;
67 t_sample x_value;
68 float x_f;
69} t_snapshot;
70
71static void *snapshot_tilde_new(void)
72{
73 t_snapshot *x = (t_snapshot *)pd_new(snapshot_tilde_class);
74 x->x_value = 0;
75 outlet_new(&x->x_obj, &s_float);
76 x->x_f = 0;
77 return (x);
78}
79
80static t_int *snapshot_tilde_perform(t_int *w)
81{
82 t_sample *in = (t_sample *)(w[1]);
83 t_sample *out = (t_sample *)(w[2]);
84 *out = *in;
85 return (w+3);
86}
87
88static void snapshot_tilde_dsp(t_snapshot *x, t_signal **sp)
89{
90 dsp_add(snapshot_tilde_perform, 2, sp[0]->s_vec + (sp[0]->s_n-1),
91 &x->x_value);
92}
93
94static void snapshot_tilde_bang(t_snapshot *x)
95{
96 outlet_float(x->x_obj.ob_outlet, fixtof(x->x_value));
97}
98
99static void snapshot_tilde_set(t_snapshot *x, t_floatarg f)
100{
101 x->x_value = ftofix(f);
102}
103 58
104void snapshot_tilde_setup(void)
105{
106 snapshot_tilde_class = class_new(gensym("snapshot~"), snapshot_tilde_new, 0,
107 sizeof(t_snapshot), 0, 0);
108 CLASS_MAINSIGNALIN(snapshot_tilde_class, t_snapshot, x_f);
109 class_addmethod(snapshot_tilde_class, (t_method)snapshot_tilde_dsp,
110 gensym("dsp"), 0);
111 class_addmethod(snapshot_tilde_class, (t_method)snapshot_tilde_set,
112 gensym("set"), A_DEFFLOAT, 0);
113 class_addbang(snapshot_tilde_class, snapshot_tilde_bang);
114}