diff options
Diffstat (limited to 'desiredata/extra/loop~')
-rw-r--r-- | desiredata/extra/loop~/loop~.c | 164 | ||||
-rw-r--r-- | desiredata/extra/loop~/makefile | 4 | ||||
-rw-r--r-- | desiredata/extra/loop~/test-loop~.pd | 58 |
3 files changed, 0 insertions, 226 deletions
diff --git a/desiredata/extra/loop~/loop~.c b/desiredata/extra/loop~/loop~.c deleted file mode 100644 index 2f440030..00000000 --- a/desiredata/extra/loop~/loop~.c +++ /dev/null @@ -1,164 +0,0 @@ -/* loop~ -- loop generator for sampling */ - -/* Copyright 1997-1999 Miller Puckette. -Permission is granted to use this software for any purpose provided you -keep this copyright notice intact. - -THE AUTHOR AND HIS EMPLOYERS MAKE NO WARRANTY, EXPRESS OR IMPLIED, -IN CONNECTION WITH THIS SOFTWARE. - -This file is downloadable from http://www.crca.ucsd.edu/~msp . - -*/ - -#ifdef PD -#include "m_pd.h" -#endif - -typedef struct _loopctl -{ - double l_phase; - float l_invwindow; - float l_window; - int l_resync; -} t_loopctl; - -static void loopctl_run(t_loopctl *x, float *transposein, - float *windowin, float *rawout, float *windowout, int n) -{ - float window, invwindow; - double phase = x->l_phase; - if (x->l_resync) - { - window = *windowin; - if (window < 0) - { - if (window > -1) - window = -1; - invwindow = -1/window; - } - else - { - if (window < 1) - window = 1; - invwindow = 1/window; - } - x->l_resync = 0; - } - else - { - window = x->l_window; - phase = x->l_phase; - invwindow = x->l_invwindow; - } - while (n--) - { - double phaseinc = invwindow * *transposein++; - double newphase; - float nwind = *windowin++; - if (phaseinc >= 1 || phaseinc < 0) - phaseinc = 0; - newphase = phase + phaseinc; - if (newphase >= 1) - { - window = nwind; - if (window < 0) - { - if (window > -1) - window = -1; - invwindow = -1/window; - } - else - { - if (window < 1) - window = 1; - invwindow = 1/window; - } - newphase -= 1.; - } - phase = newphase; - *rawout++ = (float)phase; - *windowout++ = window; - } - x->l_invwindow = invwindow; - x->l_window = window; - x->l_phase = phase; -} - -static void loopctl_init(t_loopctl *x) -{ - x->l_window = 1; - x->l_invwindow = 1; - x->l_phase = 0; -} - -static void loopctl_set(t_loopctl *x, float val) -{ - if (val < 0 || val > 1) - val = 0; - x->l_phase = val; - x->l_resync = 1; -} - -#ifdef PD - -typedef struct _loop -{ - t_object x_obj; - t_float x_f; - t_loopctl x_loopctl; -} t_loop; - -static t_class *loop_class; - -static void *loop_new(void) -{ - t_loop *x = (t_loop *)pd_new(loop_class); - loopctl_init(&x->x_loopctl); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); - outlet_new(&x->x_obj, gensym("signal")); - outlet_new(&x->x_obj, gensym("signal")); - return (x); -} - -static t_int *loop_perform(t_int *w) -{ - t_loopctl *ctl = (t_loopctl *)(w[1]); - t_float *in1 = (t_float *)(w[2]); - t_float *in2 = (t_float *)(w[3]); - t_float *out1 = (t_float *)(w[4]); - t_float *out2 = (t_float *)(w[5]); - int n = (int)(w[6]); - loopctl_run(ctl, in1, in2, out1, out2, n); - return (w+7); -} - -static void loop_dsp(t_loop *x, t_signal **sp) -{ - dsp_add(loop_perform, 6, - &x->x_loopctl, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, - sp[0]->s_n); -} - -static void loop_set(t_loop *x, t_floatarg val) -{ - loopctl_set(&x->x_loopctl, val); -} - -static void loop_bang(t_loop *x) -{ - loopctl_set(&x->x_loopctl, 0); -} - -void loop_tilde_setup(void) -{ - loop_class = class_new(gensym("loop~"), (t_newmethod)loop_new, 0, - sizeof(t_loop), 0, 0); - class_addmethod(loop_class, (t_method)loop_dsp, gensym("dsp"), A_CANT, 0); - CLASS_MAINSIGNALIN(loop_class, t_loop, x_f); - class_addmethod(loop_class, (t_method)loop_set, gensym("set"), - A_DEFFLOAT, 0); - class_addbang(loop_class, loop_bang); -} - -#endif /* PD */ diff --git a/desiredata/extra/loop~/makefile b/desiredata/extra/loop~/makefile deleted file mode 100644 index fd21f2b4..00000000 --- a/desiredata/extra/loop~/makefile +++ /dev/null @@ -1,4 +0,0 @@ -NAME=loop~ -CSYM=loop_tilde - -include ../makefile diff --git a/desiredata/extra/loop~/test-loop~.pd b/desiredata/extra/loop~/test-loop~.pd deleted file mode 100644 index 9966483d..00000000 --- a/desiredata/extra/loop~/test-loop~.pd +++ /dev/null @@ -1,58 +0,0 @@ -#N canvas 33 0 680 609 12; -#X floatatom 52 262 0 0 0 0 - - -; -#X obj 261 346 print~; -#X msg 47 373 bang; -#X msg 274 313 bang; -#X obj 52 306 loop~; -#X floatatom 102 245 0 0 0 0 - - -; -#N canvas 0 0 450 300 graph1 0; -#X array array1 44100 float 0; -#X coords 0 10 44100 0 200 150 1; -#X restore 65 17 graph; -#X msg 43 204 \; array1 resize 44100; -#X obj 25 401 tabwrite~ array1; -#X msg 208 371 bang; -#X obj 176 402 tabwrite~ array1; -#X msg 194 261 bang; -#X obj 204 347 print~; -#X msg 217 314 bang; -#N canvas 0 0 450 300 graph1 0; -#X array array2 150000 float 0; -#X coords 0 1 150000 -1 200 150 1; -#X restore 332 398 graph; -#X msg 326 274 \; array2 resize 150000; -#X obj 103 529 tabread4~ array2; -#X obj 64 481 *~; -#X obj 107 581 dac~; -#X obj 105 552 hip~ 5; -#X obj 123 482 samphold~; -#X obj 102 506 +~; -#X floatatom 106 430 0 0 0 0 - - -; -#X obj 108 453 *~ 1000; -#X obj 312 215 soundfiler; -#X msg 330 170 read ../doc/sound/bell.aiff array2; -#X msg 330 193 read ../doc/sound/vocal.aiff array2; -#X connect 0 0 4 0; -#X connect 2 0 8 0; -#X connect 3 0 1 0; -#X connect 4 0 12 0; -#X connect 4 0 17 0; -#X connect 4 0 8 0; -#X connect 4 0 20 1; -#X connect 4 1 10 0; -#X connect 4 1 1 0; -#X connect 4 1 17 1; -#X connect 5 0 4 1; -#X connect 9 0 10 0; -#X connect 11 0 4 0; -#X connect 13 0 12 0; -#X connect 16 0 19 0; -#X connect 17 0 21 0; -#X connect 19 0 18 0; -#X connect 19 0 18 1; -#X connect 20 0 21 1; -#X connect 21 0 16 0; -#X connect 22 0 23 0; -#X connect 23 0 20 0; -#X connect 25 0 24 0; -#X connect 26 0 24 0; |