aboutsummaryrefslogtreecommitdiff
path: root/zeroxpos~
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2010-08-19 05:04:28 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2010-08-19 05:04:28 +0000
commit79096fd626b946efd6947fa94ab15d30bf003ba0 (patch)
tree9a10305d0ade28bb3f5139c37ab8fa76f4e603d4 /zeroxpos~
parent633eaa4b2350c00ddc1b338c357096a441944784 (diff)
converted to new library template and debianized
svn path=/trunk/externals/ekext/; revision=13835
Diffstat (limited to 'zeroxpos~')
-rw-r--r--zeroxpos~/makefile106
-rw-r--r--zeroxpos~/zeroxpos~-help.pd96
-rw-r--r--zeroxpos~/zeroxpos~.c194
3 files changed, 0 insertions, 396 deletions
diff --git a/zeroxpos~/makefile b/zeroxpos~/makefile
deleted file mode 100644
index 10c4cd9..0000000
--- a/zeroxpos~/makefile
+++ /dev/null
@@ -1,106 +0,0 @@
-current:
- echo make pd_linux, pd_nt, pd_irix5, pd_irix6 or pd_darwin
-
-clean: ; rm -f *.pd_* *.o
-
-# ----------------------- NT -----------------------
-
-pd_nt: zeroxpos~.dll
-
-INSTALL_PREFIX = "C:\pd\extra"
-EXT = dll
-.SUFFIXES: .obj .dll
-
-PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
-VC="D:\Program Files\Microsoft Visual Studio\Vc98"
-
-PDNTINCLUDE = /I. /I\tcl\include /I..\..\src /I$(VC)\include
-
-PDNTLDIR = $(VC)\lib
-PDNTLIB = $(PDNTLDIR)\libc.lib \
- $(PDNTLDIR)\oldnames.lib \
- $(PDNTLDIR)\kernel32.lib \
- ..\..\bin\pd.lib
-
-.c.dll:
- cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
- link /dll /export:$*_setup $*.obj $(PDNTLIB)
-
-# ----------------------- IRIX 5.x -----------------------
-
-pd_irix5: zeroxpos~.pd_irix5
-
-INSTALL_PREFIX = /usr/local
-EXT = pd_irix5
-.SUFFIXES: .pd_irix5
-
-SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2
-
-SGIINCLUDE = -I/usr/local/include
-
-.c.pd_irix5:
- cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
- rm $*.o
-
-# ----------------------- IRIX 5.x -----------------------
-
-pd_irix6: zeroxpos~.pd_irix6
-
-INSTALL_PREFIX = /usr/local
-EXT = pd_irix6
-.SUFFIXES: .pd_irix6
-
-SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2
-
-SGIINCLUDE = -I/usr/local/include
-
-.c.pd_irix6:
- cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -elf -shared -rdata_shared -o $*.pd_irix6 $*.o
- rm $*.o
-
-# ----------------------- LINUX i386 -----------------------
-
-pd_linux: zeroxpos~.pd_linux
-
-INSTALL_PREFIX = /usr
-EXT = pd_linux
-.SUFFIXES: .pd_linux
-
-LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \
- -Wall -W -Wshadow -Wstrict-prototypes -Werror \
- -Wno-unused -Wno-parentheses -Wno-switch
-
-LINUXINCLUDE = -I/usr/local/include
-
-.c.pd_linux:
- cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- ld --export-dynamic -shared -o $*.pd_linux $*.o -lc -lm
- strip --strip-unneeded $*.pd_linux
- rm $*.o
-
-# ----------------------- Mac OSX -----------------------
-
-pd_darwin: zeroxpos~.pd_darwin
-
-INSTALL_PREFIX = /usr/local
-EXT = pd_darwin
-.SUFFIXES: .pd_darwin
-
-DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
- -Wno-unused -Wno-parentheses -Wno-switch
-
-.c.pd_darwin:
- cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
- rm -f $*.o
-
-# ----------------------------------------------
-
-install::
- install -d $(INSTALL_PREFIX)/lib/pd/extra
-# install -m 644 *.$(EXT) $(INSTALL_PREFIX)/lib/pd/externs
- -install -m 644 zeroxpos~.$(EXT) $(INSTALL_PREFIX)/lib/pd/extra
- install -m 644 *.pd $(INSTALL_PREFIX)/lib/pd/doc/5.reference
-
diff --git a/zeroxpos~/zeroxpos~-help.pd b/zeroxpos~/zeroxpos~-help.pd
deleted file mode 100644
index 7bb2f23..0000000
--- a/zeroxpos~/zeroxpos~-help.pd
+++ /dev/null
@@ -1,96 +0,0 @@
-#N canvas 0 0 603 357 10;
-#X obj 251 132 block~ 256;
-#X obj 144 150 zeroxpos~ 3;
-#X obj 40 150 zeroxpos~ -3;
-#X text 30 30 Zeroxpos~ finds a zero-crossing point within a dsp-block
-;
-#X obj 31 96 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X floatatom 40 167 5 0 0 0 - - -;
-#X floatatom 144 167 5 0 0 0 - - -;
-#X text 228 156 <-- creation argument sets the;
-#X text 252 167 zero-crossing point to find;
-#X text 251 178 1st \, 2nd \, 3rd etc.;
-#X text 249 220 a positive argument finds;
-#X text 247 233 the n-th zero crossing from;
-#X text 247 245 the start of the block.;
-#X text 35 222 a negative argument finds;
-#X text 33 233 the n-th zero crossing from;
-#X text 33 244 the end of the block.;
-#X floatatom 177 107 5 0 0 0 - - -;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X array block 256 float 3;
-#A 0 0.253416 0.130458 0.00545404 -0.119636 -0.242851 -0.362248 -0.475957
--0.582198 -0.679303 -0.765742 -0.840147 -0.901368 -0.948445 -0.980638
--0.997421 -0.998542 -0.983994 -0.954005 -0.909041 -0.849786 -0.777197
--0.692413 -0.596762 -0.491735 -0.378986 -0.26029 -0.137509 -0.012569
-0.112569 0.235939 0.355605 0.469692 0.576406 0.67406 0.761136 0.836267
-0.898277 0.946171 0.979207 0.996877 0.998904 0.985256 0.956116 0.911974
-0.853521 0.781673 0.697548 0.602464 0.497928 0.385577 0.267174 0.144571
-0.0197003 -0.105479 -0.229003 -0.348935 -0.463381 -0.570554 -0.668774
--0.7565 -0.832341 -0.895109 -0.94383 -0.977741 -0.996308 -0.99921 -0.986431
--0.958173 -0.914879 -0.857217 -0.786086 -0.70262 -0.608129 -0.504093
--0.392134 -0.27402 -0.151607 -0.0268136 0.0984023 0.222071 0.342253
-0.457064 0.564703 0.663473 0.75182 0.828368 0.891918 0.941472 0.976224
-0.995654 0.999461 0.987585 0.960201 0.917728 0.860855 0.790474 0.707687
-0.613778 0.510233 0.398682 0.280874 0.158655 0.0339427 -0.0913004 -0.21511
--0.335546 -0.450712 -0.558797 -0.658112 -0.7471 -0.824365 -0.888672
--0.939028 -0.974648 -0.994974 -0.999679 -0.988672 -0.962151 -0.920532
--0.864466 -0.794818 -0.712687 -0.619375 -0.516342 -0.405204 -0.287695
--0.165673 -0.0410526 0.0842137 0.208159 0.328832 0.444344 0.552884
-0.652749 0.742354 0.820304 0.885381 0.936565 0.973047 0.994233 0.999818
-0.989715 0.964081 0.923301 0.868019 0.799117 0.717675 0.624969 0.522437
-0.411707 0.294517 0.172705 0.0481785 -0.0771039 -0.201175 -0.322089
--0.43795 -0.546929 -0.647319 -0.737551 -0.816209 -0.882057 -0.934039
--0.971362 -0.993442 -0.999933 -0.990717 -0.965937 -0.926001 -0.871533
--0.803388 -0.722613 -0.630497 -0.528488 -0.418184 -0.301313 -0.179707
--0.0552834 0.0700081 0.194203 0.315346 0.431537 0.540954 0.641883 0.732741
-0.812077 0.878668 0.931471 0.969657 0.992614 0.999977 0.991649 0.967759
-0.928683 0.87501 0.807601 0.72752 0.636021 0.534537 0.42465 0.308102
-0.186719 0.0624042 -0.0628919 -0.187199 -0.308567 -0.425094 -0.534951
--0.636398 -0.727855 -0.807891 -0.875249 -0.928863 -0.967882 -0.991712
--0.99998 -0.992555 -0.969531 -0.931286 -0.878427 -0.811782 -0.732395
--0.641494 -0.540528 -0.43108 -0.314867 -0.193706 -0.0695031 0.0557888
-0.180206 0.301797 0.418643 0.528917 0.63089 0.722964 0.803687 0.87178
-0.926192 0.966069 0.990788 0.999936 0.993385 0.971245 0.933864 0.881826
-0.815924 0.73722 0.646947 0.546521 0.437509 0.321625 0.200696 0.0766166
--0.0486669 -0.173186 -0.294984;
-#X coords 0 1 255 -1 100 50 1;
-#X restore 207 268 graph;
-#X obj 220 87 tabwrite~ block;
-#X obj 107 75 osc~ 880;
-#X obj 79 284 tabread block;
-#X floatatom 79 270 5 0 0 0 - - -;
-#X floatatom 79 301 5 0 0 0 - - -;
-#X floatatom 119 167 2 0 0 0 - - -;
-#X floatatom 216 167 2 0 0 0 - - -;
-#X text 36 193 output is in samples \, right output is direction (polarity)
-of zero crossing.;
-#X msg 320 94 mode \$1;
-#X obj 320 79 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
-1;
-#X text 349 77 <--- if the mode is zero \,;
-#X text 389 89 zeroxpos will not look;
-#X text 395 102 for zero-crossing points;
-#X text 404 114 until after it receives a;
-#X text 412 126 bang. But if it is set to 1 \,;
-#X text 418 138 zeroxpos will continuously;
-#X text 424 150 look for zero-crossings \,;
-#X text 431 163 and output those stored;
-#X text 437 175 in memory when banged.;
-#X connect 1 0 6 0;
-#X connect 1 1 24 0;
-#X connect 2 0 5 0;
-#X connect 2 1 23 0;
-#X connect 4 0 2 0;
-#X connect 4 0 1 0;
-#X connect 4 0 18 0;
-#X connect 16 0 2 1;
-#X connect 19 0 2 0;
-#X connect 19 0 1 0;
-#X connect 19 0 18 0;
-#X connect 20 0 22 0;
-#X connect 21 0 20 0;
-#X connect 26 0 1 0;
-#X connect 26 0 2 0;
-#X connect 27 0 26 0;
diff --git a/zeroxpos~/zeroxpos~.c b/zeroxpos~/zeroxpos~.c
deleted file mode 100644
index d650537..0000000
--- a/zeroxpos~/zeroxpos~.c
+++ /dev/null
@@ -1,194 +0,0 @@
-#include "m_pd.h"
-#include <math.h>
-
-static t_class *zeroxpos_tilde_class;
-
-typedef struct _zeroxpos_control
-{
- t_float *c_input;
- t_int final_pol;
-} t_zeroxpos_control;
-
-typedef struct _zeroxpos_tilde
-{
- t_object x_obj;
- t_zeroxpos_control x_ctl;
- t_float f_num, f_dummy, f_dir;
- t_int i_bang, i_pol, i_count, i_ndx, i_mode;
- t_outlet *f_pos, *f_pol;
-} t_zeroxpos_tilde;
-
-t_int *zeroxpos_tilde_perform(t_int *w)
-{
- t_zeroxpos_tilde *x = (t_zeroxpos_tilde *)(w[1]);
- t_zeroxpos_control *ctl = (t_zeroxpos_control *)(w[2]);
- int n = (int)(w[3]);
- t_float *in = ctl->c_input;
- x->f_dir = x->f_num >= 0 ? 1 : -1;
- int number = x->f_num >= 1 || x->f_num <= -1 ? (int)fabs(x->f_num) : 1;
- int count = x->i_count;
- int polarity = 1;
- int i = 0;
- x->i_pol = 0;
- x->i_ndx = -1;
- int prev = ctl->final_pol == 0 ? in[0] : ctl->final_pol;
-
- if(x->i_mode == 0)
- {
- if(x->f_dir > 0)
- {
- for(i=0;i<n;i++)
- {
- polarity = in[i] >= 0 ? 1 : -1;
- if((polarity < prev || polarity > prev) && count == number && x->i_bang == 1)
- {
- x->i_ndx = i;
- x->i_pol = polarity;
- count += 1e+06;
- x->i_bang = 0;
- outlet_float(x->f_pol, (float)x->i_pol);
- outlet_float(x->f_pos, (float)x->i_ndx);
- }
- if((polarity < prev || polarity > prev) && count < number) count++;
- if(i==n-1&&count<number)
- {
- ctl->final_pol = polarity;
- x->i_count = count;
- }
- prev = polarity;
- }
- }
- else if(x->f_dir < 0)
- {
- for(i=n-1;i>=0;i--)
- {
- polarity = in[i] >= 0 ? 1 : -1;
- if((polarity < prev || polarity > prev) && count == number && x->i_bang == 1)
- {
- x->i_ndx = i;
- x->i_pol = polarity;
- count += 1e+06;
- x->i_bang = 0;
- outlet_float(x->f_pol, (float)(x->i_pol*-1));
- outlet_float(x->f_pos, (float)x->i_ndx+1);
- }
- if((polarity < prev || polarity > prev) && count < number) count++;
- if(i==0&&count<number)
- {
- ctl->final_pol = polarity;
- x->i_count = count;
- }
- prev = polarity;
- }
- }
- }
- else if(x->i_mode != 0)
- {
- if(x->f_dir > 0)
- {
- for(i=0;i<n;i++)
- {
- polarity = in[i] >= 0 ? 1 : -1;
- if((polarity < prev || polarity > prev) && count == number)
- {
- x->i_ndx = i;
- x->i_pol = polarity;
- count += 1e+06;
- x->i_bang = 0;
- }
- if((polarity < prev || polarity > prev) && count < number) count++;
- if(i==n-1&&count<number)
- {
- ctl->final_pol = polarity;
- x->i_count = count;
- }
- prev = polarity;
- }
- }
- else if(x->f_dir < 0)
- {
- for(i=n-1;i>=0;i--)
- {
- polarity = in[i] >= 0 ? 1 : -1;
- if((polarity < prev || polarity > prev) && count == number)
- {
- x->i_ndx = i;
- x->i_pol = polarity;
- count += 1e+06;
- x->i_bang = 0;
- }
- if((polarity < prev || polarity > prev) && count < number) count++;
- if(i==0&&count<number)
- {
- ctl->final_pol = polarity;
- x->i_count = count;
- }
- prev = polarity;
- }
- }
- }
- return(w+4);
-}
-
-void zeroxpos_tilde_bang(t_zeroxpos_tilde *x)
-{
- if(x->i_mode == 0)
- {
- x->i_bang = 1;
- x->i_count = 0;
- }
- else if(x->i_mode != 0 && x->f_dir > 0)
- {
- outlet_float(x->f_pol, (float)x->i_pol);
- outlet_float(x->f_pos, (float)x->i_ndx);
- }
- else if(x->i_mode != 0 && x->f_dir < 0)
- {
- outlet_float(x->f_pol, (float)(x->i_pol*-1));
- outlet_float(x->f_pos, (float)x->i_ndx+1);
- }
-}
-
-void zeroxpos_tilde_mode(t_zeroxpos_tilde *x, t_floatarg fmode)
-{
- x->i_mode = (int)fmode;
-}
-
-void *zeroxpos_tilde_dsp(t_zeroxpos_tilde *x, t_signal **sp)
-{
- x->x_ctl.c_input = sp[0]->s_vec;
- dsp_add(zeroxpos_tilde_perform, 3, x, &x->x_ctl, sp[0]->s_n);
- return (void *)x;
-}
-
-void *zeroxpos_tilde_new(t_floatarg f)
-{
- t_zeroxpos_tilde *x = (t_zeroxpos_tilde *)pd_new(zeroxpos_tilde_class);
- x->f_dir = f >= 0 ? 1 : -1;
- x->f_num = f >= 1 || f <= -1 ? (int)fabs(f) : 1;
- x->x_ctl.final_pol = 0;
- x->i_count = 0;
- floatinlet_new (&x->x_obj, &x->f_num);
- x->f_pos = outlet_new(&x->x_obj, gensym("float"));
- x->f_pol = outlet_new(&x->x_obj, gensym("float"));
- return (void *)x;
-}
-
-void zeroxpos_tilde_setup(void)
-{
- zeroxpos_tilde_class = class_new(gensym("zeroxpos~"),
- (t_newmethod)zeroxpos_tilde_new,
- 0, sizeof(t_zeroxpos_tilde),
- CLASS_DEFAULT, A_DEFFLOAT, 0);
-
- post("|¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬zeroxpos~``````````````````````|");
- post("|find 1st, 2nd or 3rd etc zero crossing point in frame|");
- post("|````edward¬¬¬¬¬¬¬¬¬¬¬¬kelly``````````````````2005¬¬¬¬|");
-
-
- class_addbang(zeroxpos_tilde_class, zeroxpos_tilde_bang);
- class_addmethod(zeroxpos_tilde_class, (t_method)zeroxpos_tilde_dsp, gensym("dsp"), 0);
- class_addmethod(zeroxpos_tilde_class, (t_method)zeroxpos_tilde_mode, gensym("mode"), A_DEFFLOAT, 0);
- CLASS_MAINSIGNALIN(zeroxpos_tilde_class, t_zeroxpos_tilde, f_dummy);
-}
-