summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/intern/rmstodb~.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/intern/rmstodb~.c')
-rw-r--r--apps/plugins/pdbox/PDa/intern/rmstodb~.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/rmstodb~.c b/apps/plugins/pdbox/PDa/intern/rmstodb~.c
index e57345880a..ee2b2a9874 100644
--- a/apps/plugins/pdbox/PDa/intern/rmstodb~.c
+++ b/apps/plugins/pdbox/PDa/intern/rmstodb~.c
@@ -50,55 +50,4 @@ void rmstodb_tilde_setup(void)
50 CLASS_MAINSIGNALIN(rmstodb_tilde_class, t_rmstodb_tilde, x_f); 50 CLASS_MAINSIGNALIN(rmstodb_tilde_class, t_rmstodb_tilde, x_f);
51 class_addmethod(rmstodb_tilde_class, (t_method)rmstodb_tilde_dsp, gensym("dsp"), 0); 51 class_addmethod(rmstodb_tilde_class, (t_method)rmstodb_tilde_dsp, gensym("dsp"), 0);
52} 52}
53#include <m_pd.h>
54#include <m_fixed.h>
55
56#define LOGTEN 2.302585092994
57
58
59typedef struct rmstodb_tilde
60{
61 t_object x_obj;
62 float x_f;
63} t_rmstodb_tilde;
64
65t_class *rmstodb_tilde_class;
66 53
67static void *rmstodb_tilde_new(void)
68{
69 t_rmstodb_tilde *x = (t_rmstodb_tilde *)pd_new(rmstodb_tilde_class);
70 outlet_new(&x->x_obj, gensym("signal"));
71 x->x_f = 0;
72 return (x);
73}
74
75static t_int *rmstodb_tilde_perform(t_int *w)
76{
77 float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2);
78 t_int n = *(t_int *)(w+3);
79 for (; n--; in++, out++)
80 {
81 float f = *in;
82 if (f <= 0) *out = 0;
83 else
84 {
85 float g = 100 + 20./LOGTEN * log(f);
86 *out = (g < 0 ? 0 : g);
87 }
88 }
89 return (w + 4);
90}
91
92static void rmstodb_tilde_dsp(t_rmstodb_tilde *x, t_signal **sp)
93{
94 post("warning: %s not usable yet",__FUNCTION__);
95 dsp_add(rmstodb_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
96}
97
98void rmstodb_tilde_setup(void)
99{
100 rmstodb_tilde_class = class_new(gensym("rmstodb~"), (t_newmethod)rmstodb_tilde_new, 0,
101 sizeof(t_rmstodb_tilde), 0, 0);
102 CLASS_MAINSIGNALIN(rmstodb_tilde_class, t_rmstodb_tilde, x_f);
103 class_addmethod(rmstodb_tilde_class, (t_method)rmstodb_tilde_dsp, gensym("dsp"), 0);
104}