[PD-cvs] externals/cxc bfilt.c, 1.1, 1.2 bfilt2.c, 1.1, 1.2 delta~.c, 1.1, 1.2 reson~.c, 1.1, 1.2 utime.c, 1.1, 1.2 ENV.c, 1.3, 1.4 makefile, 1.5, 1.6 makefile.in, 1.1, 1.2 proc.c, 1.2, 1.3 bangfilt.c, 1.1.1.1, NONE bangfilt2.c, 1.1.1.1, NONE microtime.c, 1.3, NONE reson.c, 1.1.1.1, NONE sigdelta.c, 1.2, NONE
Hans-Christoph Steiner
eighthave at users.sourceforge.net
Mon Apr 2 22:38:59 CEST 2007
- Previous message: [PD-cvs] externals/cxc/reference ENV-help.pd, NONE, 1.1.2.1 ascseq-help.pd, NONE, 1.1.2.1 ascwave-help.pd, NONE, 1.1.2.1 bfilt-help.pd, NONE, 1.1.2.1 bfilt2-help.pd, NONE, 1.1.2.1 delta~-help.pd, NONE, 1.1.2.1 proc-help.pd, NONE, 1.1.2.1 randomix-help.pd, NONE, 1.1.2.1 reson~-help.pd, NONE, 1.1.2.1 serialize-help.pd, NONE, 1.1.2.1 utime-help.pd, NONE, 1.1.2.1 ENV.pd, 1.1.1.1, NONE ascseq.pd, 1.1.1.1, NONE ascwave.pd, 1.1.1.1, NONE bfilt.pd, 1.1.1.1, NONE delta.pd, 1.1.1.1, NONE proc.pd, 1.1.1.1, NONE randomix.pd, 1.2, NONE reson~.pd, 1.1, NONE serialize.pd, 1.1.1.1, NONE utime.pd, 1.1.1.1, NONE
- Next message: [PD-cvs] externals/cxc/reference ENV-help.pd, 1.1, 1.2 ascseq-help.pd, 1.1, 1.2 ascwave-help.pd, 1.1, 1.2 bfilt-help.pd, 1.1, 1.2 bfilt2-help.pd, 1.1, 1.2 delta~-help.pd, 1.1, 1.2 proc-help.pd, 1.1, 1.2 randomix-help.pd, 1.1, 1.2 reson~-help.pd, 1.1, 1.2 serialize-help.pd, 1.1, 1.2 utime-help.pd, 1.1, 1.2 ENV.pd, 1.1.1.1, NONE ascseq.pd, 1.1.1.1, NONE ascwave.pd, 1.1.1.1, NONE bfilt.pd, 1.1.1.1, NONE delta.pd, 1.1.1.1, NONE proc.pd, 1.1.1.1, NONE randomix.pd, 1.2, NONE reson~.pd, 1.1, NONE serialize.pd, 1.1.1.1, NONE utime.pd, 1.1.1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/externals/cxc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3529
Modified Files:
ENV.c makefile makefile.in proc.c
Added Files:
bfilt.c bfilt2.c delta~.c reson~.c utime.c
Removed Files:
bangfilt.c bangfilt2.c microtime.c reson.c sigdelta.c
Log Message:
cleaned up cxc so that it passes the automated test in scripts/load_every_help.sh: renamed help files to standard name; made each file named after the class; removed non-functional aliases in flatspace
--- NEW FILE: bfilt.c ---
/* bangfilter: = % x plus sel 0
* spaeter: % x plus sel y mit 2 arguments
*/
#include "m_pd.h"
#include <math.h>
static t_class *bfilt_class;
typedef struct _bfilt
{
t_object x_obj;
t_float x_f1;
t_float x_f2;
} t_bfilt;
static void *bfilt_new(t_floatarg f)
{
t_bfilt *x = (t_bfilt *)pd_new(bfilt_class);
outlet_new(&x->x_obj, &s_bang);
floatinlet_new(&x->x_obj, &x->x_f2);
x->x_f1 = 0;
x->x_f2 = f;
return (x);
}
static void bfilt_bang(t_bfilt *x)
{
int n2 = x->x_f2, result;
if (n2 < 0) n2 = -n2;
else if (!n2) n2 = 1;
result = ((int)(x->x_f1)) % n2;
if (result == 0) //result += n2;
{
outlet_bang(x->x_obj.ob_outlet);
}
//outlet_float(x->x_obj.ob_outlet, (t_float)result);
}
static void bfilt_float(t_bfilt *x, t_float f)
{
x->x_f1 = f;
bfilt_bang(x);
}
void bfilt_setup()
{
bfilt_class = class_new(gensym("bfilt"), (t_newmethod)bfilt_new, 0,
sizeof(t_bfilt), 0, A_DEFFLOAT, 0);
class_addbang(bfilt_class, bfilt_bang);
class_addfloat(bfilt_class, (t_method)bfilt_float);
}
--- sigdelta.c DELETED ---
Index: makefile.in
===================================================================
RCS file: /cvsroot/pure-data/externals/cxc/makefile.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** makefile.in 1 Mar 2003 18:37:24 -0000 1.1
--- makefile.in 2 Apr 2007 20:38:57 -0000 1.2
***************
*** 23,27 ****
LIBS = -lc -lm
#LIBS = -lpthread -lm -lc
! SOURCES = ENV.c ascseq.c ascwave.c bangfilt.c bangfilt2.c binshift.c counter.c cx.c ixprint.c mean.c microtime.c prepend.c proc.c randomix.c reson.c sigdelta.c split.c
TARGETS = $(SOURCES:.c=.$(EXT))
--- 23,27 ----
LIBS = -lc -lm
#LIBS = -lpthread -lm -lc
! SOURCES = ENV.c ascseq.c ascwave.c bangfilt.c bangfilt2.c binshift.c counter.c cx.c ixprint.c mean.c utime.c prepend.c proc.c randomix.c reson~.c sigdelta.c split.c
TARGETS = $(SOURCES:.c=.$(EXT))
--- NEW FILE: delta~.c ---
#include "m_pd.h"
#include <math.h>
#ifdef NT
#pragma warning( disable : 4244 )
#pragma warning( disable : 4305 )
#endif
/* ------------------------ delta~ ----------------------------- */
/* tilde object to take difference value. */
static t_class *delta_class;
typedef struct _delta
{
t_object x_obj;
t_sample x_last;
} t_delta;
static t_int *delta_perform(t_int *w)
{
t_delta *x = (t_delta *)(w[1]);
t_float *in = (t_float *)(w[2]);
t_float *out = (t_float *)(w[3]);
int n = (int)(w[4]);
while (n--)
{
float f = *(in++);
// *out++ = (f > 0 ? f : -f);
*out++ = (f > x->x_last ? fabs(f - x->x_last) : -fabs(f - x->x_last));
x->x_last = f;
}
return (w+5);
}
static void delta_dsp(t_delta *x, t_signal **sp)
{
dsp_add(delta_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
}
static void *delta_new(void)
{
t_delta *x = (t_delta *)pd_new(delta_class);
x->x_last = 0.;
outlet_new(&x->x_obj, gensym("signal"));
return (x);
}
void delta_tilde_setup(void)
{
delta_class = class_new(gensym("delta~"), (t_newmethod)delta_new, 0,
sizeof(t_delta), 0, A_DEFFLOAT, 0);
class_addmethod(delta_class, nullfn, gensym("signal"), 0);
class_addmethod(delta_class, (t_method)delta_dsp, gensym("dsp"), 0);
}
--- bangfilt2.c DELETED ---
Index: makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/cxc/makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** makefile 4 Nov 2004 20:59:42 -0000 1.5
--- makefile 2 Apr 2007 20:38:57 -0000 1.6
***************
*** 23,27 ****
LIBS = -lc -lm
#LIBS = -lpthread -lm -lc
! SOURCES = ENV.c ascseq.c ascwave.c bangfilt.c bangfilt2.c binshift.c cx.c ixprint.c mean.c microtime.c proc.c randomix.c reson.c sigdelta.c split.c
TARGETS = $(SOURCES:.c=.$(EXT))
--- 23,27 ----
LIBS = -lc -lm
#LIBS = -lpthread -lm -lc
! SOURCES = ENV.c ascseq.c ascwave.c bangfilt.c bangfilt2.c binshift.c cx.c ixprint.c mean.c utime.c proc.c randomix.c reson~.c sigdelta.c split.c
TARGETS = $(SOURCES:.c=.$(EXT))
--- bangfilt.c DELETED ---
--- reson.c DELETED ---
--- microtime.c DELETED ---
--- NEW FILE: bfilt2.c ---
/* bangfilter: = % x plus sel 0
* spaeter: % x plus sel y mit 2 arguments
*/
#include "m_pd.h"
#include <math.h>
static t_class *bfilt2_class;
typedef struct _bfilt2
{
t_object x_obj;
t_float x_f1;
t_float x_f2;
} t_bfilt2;
static void *bfilt2_new(t_floatarg f)
{
t_bfilt2 *x = (t_bfilt2 *)pd_new(bfilt2_class);
outlet_new(&x->x_obj, &s_bang);
floatinlet_new(&x->x_obj, &x->x_f2);
x->x_f1 = 0;
x->x_f2 = f;
return (x);
}
static void bfilt2_bang(t_bfilt2 *x)
{
int n2 = x->x_f2, result;
if (n2 < 0) n2 = -n2;
else if (!n2) n2 = 1;
x->x_f1++;
result = ((int)(x->x_f1)) % n2;
if (result == 0) //result += n2;
{
outlet_bang(x->x_obj.ob_outlet);
}
//outlet_float(x->x_obj.ob_outlet, (t_float)result);
}
static void bfilt2_float(t_bfilt2 *x, t_float f)
{
x->x_f1 = f;
bfilt2_bang(x);
}
void bfilt2_setup()
{
bfilt2_class = class_new(gensym("bfilt2"), (t_newmethod)bfilt2_new, 0,
sizeof(t_bfilt2), 0, A_DEFFLOAT, 0);
class_addbang(bfilt2_class, bfilt2_bang);
class_addfloat(bfilt2_class, (t_method)bfilt2_float);
}
--- NEW FILE: reson~.c ---
/*
* Copyright (c) 1997-1999 Mark Danks.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
*/
/* Original code by Miller Puckette */
/* a non-interpolating reson filter, not very carefully coded... */
/* 11/29/94 modified to do interpolation - M. Danks */
#include "m_pd.h"
#include <stdlib.h>
#define BUFSIZE 4096
typedef struct resonctl
{
float c_freq;
float c_samprate;
float c_feedback;
int c_delayinsamps;
float c_fraction;
int c_phase;
float *c_buf;
} t_resonctl;
typedef struct sigreson
{
t_object x_obj; /* header */
t_resonctl *x_ctl; /* pointer to state */
t_resonctl x_cspace; /* garage for state when not in a chain */
} t_sigreson;
/* the DSP routine -- called for every n samples of input */
static t_int *cu_reson(t_int *w)
{
t_float *in1 = (t_float *)(w[1]);
t_float *in2 = (t_float *)(w[2]);
t_float *out = (t_float *)(w[3]);
t_resonctl *x = (t_resonctl *)(w[4]);
int n = (int)(w[5]);
long i;
int writephase = x->c_phase;
for (i = 0; i < n; i++)
{
/* note two tricks: 1. input is read before output
* is written, because the routine might be called
* in-place;
* 2 - a seed of 1E-20 is thrown in to avoid floating
* underflow which slows the calculation down.
*/
int readphase, phase, delayinsamps;
float fraction, f, g, freq, freqtemp;
float ftemp;
freq = *in2++;
freqtemp = (freq < 1 ? 1 : freq);
ftemp = x->c_samprate/freqtemp;
if (ftemp >= BUFSIZE-1)
ftemp = BUFSIZE - 1.f;
else if (ftemp < 1.0)
ftemp = 1.f;
delayinsamps = (int)ftemp;
fraction = ftemp - delayinsamps;
readphase = writephase - delayinsamps;
phase = readphase & (BUFSIZE-1);
f = x->c_buf[phase] + fraction *
(x->c_buf[(phase-1)& (BUFSIZE-1)] - x->c_buf[phase]);
g = *in1++;
*out++ = x->c_buf[(writephase++) & (BUFSIZE-1)] =
g + x->c_feedback * f + 1E-20f;
}
x->c_phase = writephase & (BUFSIZE-1);
return (w+6);
}
/* sets the reson frequency */
void sigreson_float(t_sigreson *x, t_floatarg f)
{
float ftemp;
x->x_ctl->c_freq = (f < 1 ? 1 : f);
ftemp = x->x_ctl->c_samprate/x->x_ctl->c_freq;
if (ftemp >= BUFSIZE - 1)
ftemp = BUFSIZE - 1.f;
else if (ftemp < 1.0)
ftemp = 1.f;
x->x_ctl->c_delayinsamps = (int)ftemp;
x->x_ctl->c_fraction = ftemp - x->x_ctl->c_delayinsamps;
}
/* routine which FTS calls to put you on the DSP chain or take you off. */
static void sigreson_dsp(t_sigreson *x, t_signal **sp)
{
x->x_ctl->c_samprate = sp[0]->s_sr;
sigreson_float(x, x->x_ctl->c_freq);
dsp_add(cu_reson, 5, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec,
x->x_ctl, sp[0]->s_n);
}
static void sigreson_ft1(t_sigreson *x, t_floatarg f) /* sets feedback */
{
if (f > .99999) f = .99999f;
else if (f < -.99999) f = -.99999f;
x->x_ctl->c_feedback = (float)f;
}
static void sigreson_ff(t_sigreson *x) /* cleanup on free */
{
free(x->x_ctl->c_buf);
}
static t_class *sigreson_class;
void *sigreson_new(t_floatarg f, t_floatarg g)
{
t_sigreson *x = (t_sigreson *)pd_new(sigreson_class);
outlet_new(&x->x_obj, &s_signal);
/* things in "cspace" are things you'll actually use at DSP time */
x->x_cspace.c_phase = 0;
if (!(x->x_cspace.c_buf = (float *)malloc(BUFSIZE * sizeof(float))))
{
error("buffer alloc failed");
return (0);
}
x->x_cspace.c_samprate = 44100.f; /* just a plausible default */
/* control block is in the garage at startup */
x->x_ctl = &x->x_cspace;
sigreson_float(x, (t_float)f); /* setup params */
sigreson_ft1(x, g);
/* make a "float" inlet */
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
return (x);
}
void reson_tilde_setup()
{
sigreson_class = class_new(gensym("reson~"), (t_newmethod)sigreson_new,
(t_method)sigreson_ff, sizeof(t_sigreson), 0,
A_DEFFLOAT, A_DEFFLOAT, 0);
class_addfloat(sigreson_class, (t_method)sigreson_float);
class_addmethod(sigreson_class, (t_method)sigreson_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(sigreson_class, (t_method)nullfn, &s_signal, A_NULL);
class_addmethod(sigreson_class, (t_method)sigreson_dsp, gensym("dsp"), A_NULL);
}
Index: ENV.c
===================================================================
RCS file: /cvsroot/pure-data/externals/cxc/ENV.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ENV.c 18 Dec 2005 18:56:21 -0000 1.3
--- ENV.c 2 Apr 2007 20:38:57 -0000 1.4
***************
*** 85,89 ****
class_addmethod(ENV_class, (t_method)ENV_setenv, gensym("setenv"), A_SYMBOL, A_SYMBOL);
class_addfloat(ENV_class, ENV_float);
- class_sethelpsymbol(ENV_class, gensym("ENV.pd"));
}
--- 85,88 ----
Index: proc.c
===================================================================
RCS file: /cvsroot/pure-data/externals/cxc/proc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** proc.c 1 Mar 2003 21:10:12 -0000 1.2
--- proc.c 2 Apr 2007 20:38:57 -0000 1.3
***************
*** 219,223 ****
//class_addmethod(proc_class, (t_method)proc_setenv, gensym("setenv"), A_SYMBOL, A_SYMBOL);
class_addfloat(proc_class, proc_float);
- class_sethelpsymbol(proc_class, gensym("proc.pd"));
}
--- 219,222 ----
--- NEW FILE: utime.c ---
/*
(c) 2002:cxc at web.fm
microtime: seconds since epoch plus microsecs
*/
#include <m_pd.h>
#ifdef NT
#include <windows.h>
#else
#include <sys/time.h>
#endif
#include <time.h>
/* ----------------------- utime --------------------- */
static t_class *utime_class;
typedef struct _utime
{
t_object x_obj;
t_outlet *x_outlet1;
t_outlet *x_outlet2;
} t_utime;
static void *utime_new(t_symbol *s, int argc, t_atom *argv) {
t_utime *x = (t_utime *)pd_new(utime_class);
x->x_outlet1 = outlet_new(&x->x_obj, &s_float);
x->x_outlet2 = outlet_new(&x->x_obj, &s_float);
return (x);
}
#ifndef NT
static void utime_bang(t_utime *x)
{
struct timeval myutime;
struct timezone mytz;
gettimeofday(&myutime, &mytz);
outlet_float(x->x_outlet2, (t_float)myutime.tv_usec);
outlet_float(x->x_outlet1, (t_float)myutime.tv_sec);
}
#else
static void utime_bang(t_utime *x)
{
FILETIME myfiletime;
ULARGE_INTEGER ulfiletime, ulSec, uluSec;
GetSystemTimeAsFileTime(&myfiletime);
ulfiletime.LowPart = myfiletime.dwLowDateTime;
ulfiletime.HighPart = myfiletime.dwHighDateTime;
ulfiletime.QuadPart -= 116444736000000000; // number of 100ns ticks from 1601-01-01 to 1970-01-01
ulSec.QuadPart = ulfiletime.QuadPart / (10 * 1000 * 1000); // FILETIME uses 100ns ticks
uluSec.QuadPart = (ulfiletime.QuadPart - ulSec.QuadPart * 10 * 1000 * 1000) / 10; // FILETIME uses 100ns ticks
outlet_float(x->x_outlet2, (t_float)(__int64)ulSec.QuadPart );
outlet_float(x->x_outlet1, (t_float)(__int64)uluSec.QuadPart);
}
#endif
static void help_utime(t_utime *x)
{
post("\n%c utime\t\t:: get the current system time", 70);
post("\noutputs are\t: seconds since epoch / remaining microseconds");
}
void utime_setup(void)
{
utime_class = class_new(gensym("utime"),
(t_newmethod)utime_new, 0,
sizeof(t_utime), 0, A_GIMME, 0);
class_addbang(utime_class, utime_bang);
class_addmethod(utime_class, (t_method)help_utime, gensym("help"), 0);
}
- Previous message: [PD-cvs] externals/cxc/reference ENV-help.pd, NONE, 1.1.2.1 ascseq-help.pd, NONE, 1.1.2.1 ascwave-help.pd, NONE, 1.1.2.1 bfilt-help.pd, NONE, 1.1.2.1 bfilt2-help.pd, NONE, 1.1.2.1 delta~-help.pd, NONE, 1.1.2.1 proc-help.pd, NONE, 1.1.2.1 randomix-help.pd, NONE, 1.1.2.1 reson~-help.pd, NONE, 1.1.2.1 serialize-help.pd, NONE, 1.1.2.1 utime-help.pd, NONE, 1.1.2.1 ENV.pd, 1.1.1.1, NONE ascseq.pd, 1.1.1.1, NONE ascwave.pd, 1.1.1.1, NONE bfilt.pd, 1.1.1.1, NONE delta.pd, 1.1.1.1, NONE proc.pd, 1.1.1.1, NONE randomix.pd, 1.2, NONE reson~.pd, 1.1, NONE serialize.pd, 1.1.1.1, NONE utime.pd, 1.1.1.1, NONE
- Next message: [PD-cvs] externals/cxc/reference ENV-help.pd, 1.1, 1.2 ascseq-help.pd, 1.1, 1.2 ascwave-help.pd, 1.1, 1.2 bfilt-help.pd, 1.1, 1.2 bfilt2-help.pd, 1.1, 1.2 delta~-help.pd, 1.1, 1.2 proc-help.pd, 1.1, 1.2 randomix-help.pd, 1.1, 1.2 reson~-help.pd, 1.1, 1.2 serialize-help.pd, 1.1, 1.2 utime-help.pd, 1.1, 1.2 ENV.pd, 1.1.1.1, NONE ascseq.pd, 1.1.1.1, NONE ascwave.pd, 1.1.1.1, NONE bfilt.pd, 1.1.1.1, NONE delta.pd, 1.1.1.1, NONE proc.pd, 1.1.1.1, NONE randomix.pd, 1.2, NONE reson~.pd, 1.1, NONE serialize.pd, 1.1.1.1, NONE utime.pd, 1.1.1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list