aboutsummaryrefslogtreecommitdiff
path: root/experimental
diff options
context:
space:
mode:
authorGuenter Geiger <ggeiger@users.sourceforge.net>2003-11-05 11:22:03 +0000
committerGuenter Geiger <ggeiger@users.sourceforge.net>2003-11-05 11:22:03 +0000
commit54f478fa93bfe21ce71c4ec56b448fe68ab39d54 (patch)
tree20a21edc12317d23d247fff04d06fb868a75cc5f /experimental
parentae42d58eef7923fa62458b8fffed92cd99d6c9bd (diff)
commit the rest
svn path=/trunk/externals/ggee/; revision=1163
Diffstat (limited to 'experimental')
-rwxr-xr-xexperimental/fasor.pd10
-rwxr-xr-xexperimental/fasor~.c149
2 files changed, 0 insertions, 159 deletions
diff --git a/experimental/fasor.pd b/experimental/fasor.pd
deleted file mode 100755
index 8294558..0000000
--- a/experimental/fasor.pd
+++ /dev/null
@@ -1,10 +0,0 @@
-#N canvas 166 117 500 171 10;
-#X obj 30 43 fasor~;
-#X obj 21 90 dac~;
-#X floatatom 30 14;
-#X text 110 8 fasor is similar to phasor~ \, but changes it's frequency;
-#X text 110 23 only at phase 0;
-#X text 28 142 (C) 1999 - 2000 Guenter Geiger;
-#X connect 0 0 1 0;
-#X connect 0 0 1 1;
-#X connect 2 0 0 0;
diff --git a/experimental/fasor~.c b/experimental/fasor~.c
deleted file mode 100755
index ac9b4d3..0000000
--- a/experimental/fasor~.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* (C) Guenter Geiger <geiger@epy.co.at> */
-
-
-#include <m_pd.h>
-#include "math.h"
-
-#define UNITBIT32 1572864. /* 3*2^19; bit 32 has place value 1 */
-
- /* machine-dependent definitions. These ifdefs really
- should have been by CPU type and not by operating system! */
-#ifdef IRIX
- /* big-endian. Most significant byte is at low address in memory */
-#define HIOFFSET 0 /* word offset to find MSB */
-#define LOWOFFSET 1 /* word offset to find LSB */
-#define int32 long /* a data type that has 32 bits */
-#else
-#ifdef NT
- /* little-endian; most significant byte is at highest address */
-#define HIOFFSET 1
-#define LOWOFFSET 0
-#define int32 long
-#else
-#ifdef __linux__
-
-#include <endian.h>
-
-#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN)
-#error No byte order defined
-#endif
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define HIOFFSET 1
-#define LOWOFFSET 0
-#else
-#define HIOFFSET 0 /* word offset to find MSB */
-#define LOWOFFSET 1 /* word offset to find LSB */
-#endif /* __BYTE_ORDER */
-
-#include <sys/types.h>
-#define int32 int32_t
-
-#endif /* __linux__ */
-#endif /* NT */
-#endif /* SGI */
-
-union tabfudge
-{
- double tf_d;
- int32 tf_i[2];
-};
-
-typedef struct fasor
-{
- t_object x_obj;
- double x_phase;
- float x_conv;
- float x_f; /* used for scalar only */
- float x_fnew; /* used for scalar only */
- double x_flast; /* used for scalar only */
-} t_fasor;
-
-static t_class *fasor_class;
-
-static void *fasor_new(t_symbol *s, int argc, t_atom *argv)
-{
- t_fasor *x;
- x = (t_fasor *)pd_new(fasor_class);
-
- if (argc)
- x->x_f = atom_getfloatarg(0, argc, argv);
- else
- x->x_f = 0;
-
-
- x->x_flast = 1.0;
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
- x->x_phase = 0;
- x->x_conv = 0;
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-static t_int *fasor_perform(t_int *w)
-{
- t_fasor *x = (t_fasor *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
-
- double dphase = x->x_phase + UNITBIT32;
- union tabfudge tf;
- int normhipart;
- float conv = x->x_conv;
- double freq = x->x_f;
- double flast = x->x_flast;
- double fout;
-
- tf.tf_d = UNITBIT32;
- normhipart = tf.tf_i[HIOFFSET];
- tf.tf_d = dphase;
- fout = tf.tf_d;
-
- while (n--)
- {
- tf.tf_i[HIOFFSET] = normhipart;
- dphase += freq * conv;
- *out++ = (t_float) (fout = tf.tf_d - UNITBIT32);
- tf.tf_d = dphase;
-
- if (fout <= flast) {
- freq = x->x_f = x->x_fnew; /*!! performance if freq = 0 ?? */
- }
-
- flast = fout;
- }
-
- x->x_flast = flast;
- tf.tf_i[HIOFFSET] = normhipart;
- x->x_phase = tf.tf_d - UNITBIT32;
- return (w+4);
-}
-
-static void fasor_dsp(t_fasor *x, t_signal **sp)
-{
-
- x->x_conv = 1.f/sp[0]->s_sr;
- dsp_add(fasor_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
-}
-
-static void fasor_ft1(t_fasor *x, t_float f)
-{
- x->x_phase = f;
-}
-
-static void fasor_float(t_fasor *x, t_float f)
-{
- x->x_fnew = (float) fabs(f);
-}
-
-
-void fasor_tilde_setup(void)
-{
- fasor_class = class_new(gensym("fasor~"), (t_newmethod)fasor_new, 0,
- sizeof(t_fasor), 0, A_GIMME, 0);
- class_addmethod(fasor_class, nullfn, gensym("signal"), 0);
- class_addmethod(fasor_class, (t_method)fasor_dsp, gensym("dsp"), 0);
- class_addmethod(fasor_class, (t_method)fasor_ft1,
- gensym("ft1"), A_FLOAT, 0);
- class_addfloat(fasor_class,fasor_float);
-}