aboutsummaryrefslogtreecommitdiff
path: root/src/z_dfreq.c
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-03-22 20:58:25 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-03-22 20:58:25 +0000
commit2b60d55c919e7588f5aff15936e83c300b3660bb (patch)
tree14d860de7f28083d3756ad91b627de70f26788f6 /src/z_dfreq.c
parentc500bc542cb7cc78d6dac3f7da3bff626056b1aa (diff)
zexy-2.0:
- use of abstractions for objects that allow it - some objects are build both as externals and abstractions (as slower fallbacks) - code-layout is now 1:1 c-file<->object (this should allow for building of zexy as a collection of externals instead as a big library) - matrix-objects have moved to iemmatrix !! svn path=/trunk/externals/zexy/; revision=2641
Diffstat (limited to 'src/z_dfreq.c')
-rw-r--r--src/z_dfreq.c101
1 files changed, 0 insertions, 101 deletions
diff --git a/src/z_dfreq.c b/src/z_dfreq.c
deleted file mode 100644
index e5074a5..0000000
--- a/src/z_dfreq.c
+++ /dev/null
@@ -1,101 +0,0 @@
-#include <stdio.h>
-
-#include "zexy.h"
-
-#ifdef NT
-#pragma warning( disable : 4244 )
-#pragma warning( disable : 4305 )
-#endif
-
-/* ------------------------ dspobj~ ----------------------------- */
-
-/* datendefinition */
-
-static t_class *dfreq_class;
-
-typedef struct _dfreq
-{
- t_object x_obj;
-
- t_float freq; /*freqenz variable */
- t_float alt;
- float sampcount;
- t_float sr;
-} t_dfreq;
-
-
-static t_int *dfreq_perform(t_int *w)
-{
- t_float *in = (t_float *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
- t_dfreq *x = (t_dfreq *) w[4];
-
- t_float a = x->alt, c = x->sampcount;
- t_float freq = x->freq, sr=x->sr;
-
- t_float delta_inv;
-
- while (n--) {
-
- if( (a * *in) < 0 && (a < *in)){
-
- /* interpolate for real zerocross */
- delta_inv = 1./(*in-a);
- if(c > 0.0)
- freq = sr / ((t_float) c + a*delta_inv);
- else
- freq = sr;
-
- c = *in*delta_inv; /*rest of time */
- };
-
- a = *in;
- in++;
- c += 1.0;
- *out++ = freq;
- }
-
- x->alt = a;
- x->sampcount = c;
- x->freq=freq;
-
- return (w+5);
-}
-
-static void dfreq_dsp(t_dfreq *x, t_signal **sp)
-{
- dsp_add(dfreq_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n,x);
-}
-
-
-
-static void *dfreq_new()
-{
- t_dfreq *x = (t_dfreq *)pd_new(dfreq_class);
- outlet_new(&x->x_obj, gensym("signal"));
-
- x->sr = sys_getsr();
-
- return (x);
-}
-
-static void helper(void)
-{
- post("\n%c dfreq~\t :: pitch-detector that counts zero-crossings", HEARTSYMBOL);
- post("\noutputs a frequency estimate as a stream~ that will be updated every zero-X");
- post("\ncreation::\t'dfreq~': that's all");
-}
-
-
-void z_dfreq_setup(void)
-{
- dfreq_class = class_new(gensym("dfreq~"), (t_newmethod)dfreq_new, 0,
- sizeof(t_dfreq), 0, A_DEFFLOAT, 0);
- class_addmethod(dfreq_class, nullfn, gensym("signal"), 0);
- class_addmethod(dfreq_class, (t_method)dfreq_dsp, gensym("dsp"), 0);
-
- class_addmethod(dfreq_class, (t_method)helper, gensym("help"), 0);
- class_sethelpsymbol(dfreq_class, gensym("zexy/dfreq~"));
-}
-