diff options
author | N.N. <krzyszcz@users.sourceforge.net> | 2003-09-11 09:04:32 +0000 |
---|---|---|
committer | N.N. <krzyszcz@users.sourceforge.net> | 2003-09-11 09:04:32 +0000 |
commit | 49cc44f855c16ae11988e9ff3739fdc01ac8aebe (patch) | |
tree | 4a47d1b56d0cda8f8f34965c881c0bba1e4f46fd /cyclone | |
parent | 53f05d96ff8e49c87977fa91a06ebade8893606e (diff) |
*** empty log message ***
svn path=/trunk/externals/miXed/; revision=947
Diffstat (limited to 'cyclone')
-rw-r--r-- | cyclone/Makefile.objects | 2 | ||||
-rw-r--r-- | cyclone/build_counter | 2 | ||||
-rw-r--r-- | cyclone/hammer/coll.c | 4 | ||||
-rw-r--r-- | cyclone/hammer/funbuff.c | 2 | ||||
-rw-r--r-- | cyclone/hammer/hammer.c | 19 | ||||
-rw-r--r-- | cyclone/hammer/mtr.c | 6 | ||||
-rw-r--r-- | cyclone/hammer/seq.c | 4 | ||||
-rw-r--r-- | cyclone/hammer/zl.c | 60 | ||||
-rw-r--r-- | cyclone/shadow/cyclone.c | 20 | ||||
-rw-r--r-- | cyclone/sickle/peek.c | 8 | ||||
-rw-r--r-- | cyclone/sickle/poke.c | 4 | ||||
-rw-r--r-- | cyclone/sickle/record.c | 68 | ||||
-rw-r--r-- | cyclone/sickle/sickle.c | 19 |
13 files changed, 130 insertions, 88 deletions
diff --git a/cyclone/Makefile.objects b/cyclone/Makefile.objects index 87d7ae4..4bd1695 100644 --- a/cyclone/Makefile.objects +++ b/cyclone/Makefile.objects @@ -21,5 +21,5 @@ SVEFL_OBJECTS = common/vefl.o sickle/sic.o common/loud.o unstable/fragile.o SARSIC_OBJECTS = sickle/sic.o sickle/arsic.o common/vefl.o \ common/loud.o unstable/fragile.o SFILE_OBJECTS = hammer/file.o sickle/sic.o common/loud.o unstable/forky.o -RELEASE_LIBS = cyclone hammer sickle +RELEASE_LIBS = cyclone hammer sickle dummies RELEASE_APPS = cyclist diff --git a/cyclone/build_counter b/cyclone/build_counter index 0414f92..3381c8b 100644 --- a/cyclone/build_counter +++ b/cyclone/build_counter @@ -1,3 +1,3 @@ #define CYCLONE_VERSION "0.1" #define CYCLONE_RELEASE "alpha" -#define CYCLONE_BUILD 45 +#define CYCLONE_BUILD 46 diff --git a/cyclone/hammer/coll.c b/cyclone/hammer/coll.c index c4a3388..3d9aa68 100644 --- a/cyclone/hammer/coll.c +++ b/cyclone/hammer/coll.c @@ -1373,7 +1373,7 @@ static void coll_read(t_coll *x, t_symbol *s) if (s && s != &s_) collcommon_doread(cc, s, x->x_canvas); else - hammerpanel_open(cc->c_filehandle); + hammerpanel_open(cc->c_filehandle, 0); } static void coll_write(t_coll *x, t_symbol *s) @@ -1391,7 +1391,7 @@ static void coll_readagain(t_coll *x) if (cc->c_filename) collcommon_doread(cc, 0, 0); else - hammerpanel_open(cc->c_filehandle); + hammerpanel_open(cc->c_filehandle, 0); } static void coll_writeagain(t_coll *x) diff --git a/cyclone/hammer/funbuff.c b/cyclone/hammer/funbuff.c index 8d9d698..5791b1e 100644 --- a/cyclone/hammer/funbuff.c +++ b/cyclone/hammer/funbuff.c @@ -260,7 +260,7 @@ static void funbuff_read(t_funbuff *x, t_symbol *s) if (s && s != &s_) funbuff_doread(x, s); else - hammerpanel_open(x->x_filehandle); + hammerpanel_open(x->x_filehandle, 0); } /* CHECKED symbol arg not allowed -- diff --git a/cyclone/hammer/hammer.c b/cyclone/hammer/hammer.c index a4d7efe..3c4f3c2 100644 --- a/cyclone/hammer/hammer.c +++ b/cyclone/hammer/hammer.c @@ -27,21 +27,24 @@ static void hammer_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) import_max(fn->s_name, ""); } -static void hammer_import(t_hammer *x, t_symbol *fn, t_symbol *dir) +static void hammer_doimport(t_hammer *x, t_symbol *fn, t_symbol *dir) { + if (!dir || dir == &s_) dir = x->x_dir; if (fn && fn != &s_) - { - if (!dir || dir == &s_) dir = x->x_dir; import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : ""); - } else - hammerpanel_open(x->x_filehandle); + hammerpanel_open(x->x_filehandle, dir); } static void hammer_click(t_hammer *x, t_floatarg xpos, t_floatarg ypos, - t_floatarg shift, t_floatarg ctrl, t_floatarg alt) + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + hammer_doimport(x, 0, 0); +} + +static void hammer_import(t_hammer *x, t_symbol *fn) { - hammer_import(x, 0, 0); + hammer_doimport(x, fn, 0); } static void hammer_bang(t_hammer *x) @@ -82,7 +85,7 @@ void hammer_setup(void) sizeof(t_hammer), 0, A_DEFSYM, 0); class_addbang(hammer_class, hammer_bang); class_addmethod(hammer_class, (t_method)hammer_import, - gensym("import"), A_DEFSYM, A_DEFSYM, 0); + gensym("import"), A_DEFSYM, 0); class_addmethod(hammer_class, (t_method)hammer_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); diff --git a/cyclone/hammer/mtr.c b/cyclone/hammer/mtr.c index edc5e20..ecc80d3 100644 --- a/cyclone/hammer/mtr.c +++ b/cyclone/hammer/mtr.c @@ -321,7 +321,7 @@ static void mtrack_read(t_mtrack *tp, t_symbol *s) if (s && s != &s_) mtr_doread(tp->tr_owner, tp, s); else /* CHECKED no default */ - hammerpanel_open(tp->tr_filehandle); + hammerpanel_open(tp->tr_filehandle, 0); } static void mtrack_write(t_mtrack *tp, t_symbol *s) @@ -553,7 +553,7 @@ static void mtr_doread(t_mtr *x, t_mtrack *target, t_symbol *fname) { /* CHECKED no complaint, open dialog not presented... */ /* LATER rethink */ - hammerpanel_open(target ? target->tr_filehandle : x->x_filehandle); + hammerpanel_open(target ? target->tr_filehandle : x->x_filehandle, 0); } } @@ -672,7 +672,7 @@ static void mtr_read(t_mtr *x, t_symbol *s) if (s && s != &s_) mtr_doread(x, 0, s); else /* CHECKED no default */ - hammerpanel_open(x->x_filehandle); + hammerpanel_open(x->x_filehandle, 0); } static void mtr_write(t_mtr *x, t_symbol *s) diff --git a/cyclone/hammer/seq.c b/cyclone/hammer/seq.c index 5997d31..011c97d 100644 --- a/cyclone/hammer/seq.c +++ b/cyclone/hammer/seq.c @@ -782,7 +782,7 @@ static void seq_textread(t_seq *x, char *path) if (binbuf_read(bb, path, "", 0)) { /* CHECKED no complaint, open dialog presented */ - hammerpanel_open(x->x_filehandle); /* LATER rethink */ + hammerpanel_open(x->x_filehandle, 0); /* LATER rethink */ } else { @@ -872,7 +872,7 @@ static void seq_read(t_seq *x, t_symbol *s) if (s && s != &s_) seq_doread(x, s, 0); else /* CHECKED no default */ - hammerpanel_open(x->x_filehandle); + hammerpanel_open(x->x_filehandle, 0); } static void seq_write(t_seq *x, t_symbol *s) diff --git a/cyclone/hammer/zl.c b/cyclone/hammer/zl.c index 566c18e..59e8f84 100644 --- a/cyclone/hammer/zl.c +++ b/cyclone/hammer/zl.c @@ -7,6 +7,7 @@ #include "common/loud.h" #include "common/grow.h" +/* CHECKME bang behaviour (every mode) */ /* LATER test reentrancy, tune speedwise */ #define ZL_DEBUG @@ -20,7 +21,7 @@ struct _zl; typedef int (*t_zlintargfn)(struct _zl *, int); typedef void (*t_zlanyargfn)(struct _zl *, t_symbol *, int, t_atom *); typedef int (*t_zlnatomsfn)(struct _zl *); -typedef void (*t_zldoitfn)(struct _zl *, int, t_atom *); +typedef void (*t_zldoitfn)(struct _zl *, int, t_atom *, int); static int zl_nmodes = 0; static t_symbol *zl_modesym[ZL_MAXMODES]; @@ -255,7 +256,7 @@ static int zl_nop_count(t_zl *x) return (0); } -static void zl_nop(t_zl *x, int natoms, t_atom *buf) +static void zl_nop(t_zl *x, int natoms, t_atom *buf, int banged) { loud_warning((t_pd *)x, "unknown mode"); } @@ -270,7 +271,7 @@ static int zl_ecils_count(t_zl *x) return (x->x_entered ? -1 : 0); } -static void zl_ecils(t_zl *x, int natoms, t_atom *buf) +static void zl_ecils(t_zl *x, int natoms, t_atom *buf, int banged) { int cnt1, cnt2 = x->x_modearg; natoms = x->x_inbuf1.d_natoms; @@ -296,7 +297,7 @@ static int zl_group_count(t_zl *x) return (x->x_entered ? -1 : 0); } -static void zl_group(t_zl *x, int natoms, t_atom *buf) +static void zl_group(t_zl *x, int natoms, t_atom *buf, int banged) { int cnt = x->x_modearg; if (cnt > 0) @@ -312,6 +313,11 @@ static void zl_group(t_zl *x, int natoms, t_atom *buf) x->x_inbuf1.d_natoms = natoms; while (natoms--) *buf++ = *from++; } + if (banged && x->x_inbuf1.d_natoms) + { + zl_output(x, x->x_inbuf1.d_natoms, buf); + x->x_inbuf1.d_natoms = 0; + } } else x->x_inbuf1.d_natoms = 0; /* CHECKED */ } @@ -329,7 +335,7 @@ static int zl_iter_count(t_zl *x) : 0); } -static void zl_iter(t_zl *x, int natoms, t_atom *buf) +static void zl_iter(t_zl *x, int natoms, t_atom *buf, int banged) { int nremaining = x->x_inbuf1.d_natoms; t_atom *ptr = x->x_inbuf1.d_buf; @@ -361,7 +367,7 @@ static int zl_join_count(t_zl *x) return (x->x_inbuf1.d_natoms + x->x_inbuf2.d_natoms); } -static void zl_join(t_zl *x, int natoms, t_atom *buf) +static void zl_join(t_zl *x, int natoms, t_atom *buf, int banged) { if (buf) { @@ -379,9 +385,11 @@ static int zl_len_count(t_zl *x) return (0); } -static void zl_len(t_zl *x, int natoms, t_atom *buf) +static void zl_len(t_zl *x, int natoms, t_atom *buf, int banged) { - outlet_float(((t_object *)x)->ob_outlet, x->x_inbuf1.d_natoms); +/* CHECKED 'mode len, bang'->[zl]->[print] crashes max 4.0.7... */ + if (!banged) /* CHECKED bang is a nop in len mode */ + outlet_float(((t_object *)x)->ob_outlet, x->x_inbuf1.d_natoms); } static int zl_nth_intarg(t_zl *x, int i) @@ -408,7 +416,7 @@ static int zl_nth_count(t_zl *x) else return (-1); } -static void zl_nth(t_zl *x, int natoms, t_atom *buf) +static void zl_nth(t_zl *x, int natoms, t_atom *buf, int banged) { int ac1 = x->x_inbuf1.d_natoms, ndx = x->x_modearg - 1; /* CHECKED one-based */ @@ -462,7 +470,7 @@ static int zl_reg_count(t_zl *x) return (x->x_entered ? x->x_inbuf1.d_natoms : 0); } -static void zl_reg(t_zl *x, int natoms, t_atom *buf) +static void zl_reg(t_zl *x, int natoms, t_atom *buf, int banged) { if (buf) memcpy(buf, x->x_inbuf1.d_buf, natoms * sizeof(*buf)); else @@ -480,7 +488,7 @@ static int zl_rev_count(t_zl *x) return (x->x_inbuf1.d_natoms); } -static void zl_rev(t_zl *x, int natoms, t_atom *buf) +static void zl_rev(t_zl *x, int natoms, t_atom *buf, int banged) { if (buf) { @@ -501,7 +509,7 @@ static int zl_rot_count(t_zl *x) return (x->x_inbuf1.d_natoms); } -static void zl_rot(t_zl *x, int natoms, t_atom *buf) +static void zl_rot(t_zl *x, int natoms, t_atom *buf, int banged) { if (buf) { @@ -554,7 +562,7 @@ static int zl_sect_count(t_zl *x) } /* CHECKED in-buffer duplicates are skipped */ -static void zl_sect(t_zl *x, int natoms, t_atom *buf) +static void zl_sect(t_zl *x, int natoms, t_atom *buf, int banged) { if (buf) { @@ -591,7 +599,7 @@ static int zl_slice_count(t_zl *x) return (x->x_entered ? -1 : 0); } -static void zl_slice(t_zl *x, int natoms, t_atom *buf) +static void zl_slice(t_zl *x, int natoms, t_atom *buf, int banged) { int cnt1 = x->x_modearg, cnt2; natoms = x->x_inbuf1.d_natoms; @@ -612,7 +620,7 @@ static int zl_sub_count(t_zl *x) return (0); } -static void zl_sub(t_zl *x, int natoms, t_atom *buf) +static void zl_sub(t_zl *x, int natoms, t_atom *buf, int banged) { int natoms2 = x->x_inbuf2.d_natoms; if (natoms2) @@ -656,7 +664,7 @@ static int zl_union_count(t_zl *x) } /* CHECKED in-buffer duplicates not skipped */ -static void zl_union(t_zl *x, int natoms, t_atom *buf) +static void zl_union(t_zl *x, int natoms, t_atom *buf, int banged) { if (buf) { @@ -682,7 +690,7 @@ static void zl_union(t_zl *x, int natoms, t_atom *buf) } } -static void zl_doit(t_zl *x) +static void zl_doit(t_zl *x, int banged) { int reentered = x->x_entered; int prealloc = !reentered; @@ -711,21 +719,19 @@ static void zl_doit(t_zl *x) /* LATER consider using the stack if !prealloc && natoms <= MAXSTACK */ if (buf = (prealloc ? d->d_buf : getbytes(natoms * sizeof(*buf)))) { - (*zl_doitfn[x->x_mode])(x, natoms, buf); + (*zl_doitfn[x->x_mode])(x, natoms, buf, banged); if (buf != d->d_buf) freebytes(buf, natoms * sizeof(*buf)); } } - else (*zl_doitfn[x->x_mode])(x, 0, 0); + else (*zl_doitfn[x->x_mode])(x, 0, 0, banged); if (!reentered) x->x_entered = x->x_locked = 0; } static void zl_bang(t_zl *x) { - /* CHECKED bang is a nop in len mode, LATER consider emulating this */ - /* CHECKED 'mode len, bang'->[zl]->[print] crashes max 4.0.7... */ - zl_doit(x); + zl_doit(x, 1); } static void zl_float(t_zl *x, t_float f) @@ -737,7 +743,7 @@ static void zl_float(t_zl *x, t_float f) else zldata_setfloat(&x->x_inbuf1, f); } - zl_doit(x); + zl_doit(x, 0); } static void zl_symbol(t_zl *x, t_symbol *s) @@ -749,7 +755,7 @@ static void zl_symbol(t_zl *x, t_symbol *s) else zldata_setsymbol(&x->x_inbuf1, s); } - zl_doit(x); + zl_doit(x, 0); } /* LATER gpointer */ @@ -763,7 +769,7 @@ static void zl_list(t_zl *x, t_symbol *s, int ac, t_atom *av) else zldata_setlist(&x->x_inbuf1, ac, av); } - zl_doit(x); + zl_doit(x, 0); } static void zl_anything(t_zl *x, t_symbol *s, int ac, t_atom *av) @@ -775,7 +781,7 @@ static void zl_anything(t_zl *x, t_symbol *s, int ac, t_atom *av) else zldata_set(&x->x_inbuf1, s, ac, av); } - zl_doit(x); + zl_doit(x, 0); } static int zl_modeargfn(t_zl *x) @@ -944,7 +950,7 @@ static void zl_setupallmodes(void) zl_setupmode("nth", 0, zl_nth_intarg, zl_nth_anyarg, zl_nth_count, zl_nth); zl_setupmode("reg", 0, 0, zl_reg_anyarg, zl_reg_count, zl_reg); zl_setupmode("rev", 0, 0, 0, zl_rev_count, zl_rev); - zl_setupmode("rot", /* CHECKED (refman error) */ + zl_setupmode("rot", /* CHECKED (refman's error) */ 0, zl_rot_intarg, 0, zl_rot_count, zl_rot); zl_setupmode("sect", 0, 0, 0, zl_sect_count, zl_sect); zl_setupmode("slice", 0, zl_slice_intarg, 0, zl_slice_count, zl_slice); diff --git a/cyclone/shadow/cyclone.c b/cyclone/shadow/cyclone.c index 10ae142..f6c5e8c 100644 --- a/cyclone/shadow/cyclone.c +++ b/cyclone/shadow/cyclone.c @@ -4,6 +4,9 @@ /* Never use forked calls in shadow code... */ +/* LATER support multi-atom dir (creation args), and fn ('import' message) + (same in hammer and sickle) */ + #include <stdio.h> #include "m_pd.h" #include "common/loud.h" @@ -35,21 +38,24 @@ static void cyclone_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) import_max(fn->s_name, ""); } -static void cyclone_import(t_cyclone *x, t_symbol *fn, t_symbol *dir) +static void cyclone_doimport(t_cyclone *x, t_symbol *fn, t_symbol *dir) { + if (!dir || dir == &s_) dir = x->x_dir; if (fn && fn != &s_) - { - if (!dir || dir == &s_) dir = x->x_dir; import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : ""); - } else - hammerpanel_open(x->x_filehandle); + hammerpanel_open(x->x_filehandle, dir); } static void cyclone_click(t_cyclone *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { - cyclone_import(x, 0, 0); + cyclone_doimport(x, 0, 0); +} + +static void cyclone_import(t_cyclone *x, t_symbol *fn) +{ + cyclone_doimport(x, fn, 0); } static void cyclone_bang(t_cyclone *x) @@ -127,7 +133,7 @@ void cyclone_setup(void) class_addmethod(cyclone_class, (t_method)cyclone_dummies, gensym("dummies"), 0); class_addmethod(cyclone_class, (t_method)cyclone_import, - gensym("import"), A_DEFSYM, A_DEFSYM, 0); + gensym("import"), A_DEFSYM, 0); class_addmethod(cyclone_class, (t_method)cyclone_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); diff --git a/cyclone/sickle/peek.c b/cyclone/sickle/peek.c index 534cc49..333f427 100644 --- a/cyclone/sickle/peek.c +++ b/cyclone/sickle/peek.c @@ -31,7 +31,7 @@ static void peek_tick(t_peek *x) { arsic_redraw((t_arsic *)x); /* LATER redraw only dirty channel(s!) */ x->x_clockset = 0; - x->x_clocklasttick = clock_getsystime(); + x->x_clocklasttick = clock_getlogicaltime(); } static void peek_set(t_peek *x, t_symbol *s) @@ -41,7 +41,7 @@ static void peek_set(t_peek *x, t_symbol *s) #define peek_doclip(f) (f < -1. ? -1. : (f > 1. ? 1. : f)) -/* CHECKED refman error: ``if the number received in the left inlet +/* CHECKED refman's error: ``if the number received in the left inlet specifies a sample index that does not exist in the buffer~ object's currently allocated memory, nothing happens.'' This is plainly wrong, at least for max/msp 4.0.7 bundle: the index is clipped (just like @@ -115,14 +115,14 @@ static void *peek_new(t_symbol *s, t_floatarg f1, t_floatarg f2) ch = PEEK_MAXCHANNELS; x->x_maxchannels = (ch ? PEEK_MAXCHANNELS : 1); x->x_effchannel = x->x_reqchannel = (ch ? ch - 1 : 0); - /* CHECKED (refman error) clipping is disabled by default */ + /* CHECKED (refman's error) clipping is disabled by default */ x->x_clipmode = ((int)f2 != 0); x->x_pokemode = 0; inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft2")); outlet_new((t_object *)x, &s_float); x->x_clock = clock_new(x, (t_method)peek_tick); - x->x_clocklasttick = clock_getsystime(); + x->x_clocklasttick = clock_getlogicaltime(); x->x_clockset = 0; } return (x); diff --git a/cyclone/sickle/poke.c b/cyclone/sickle/poke.c index d0fb22a..7e45558 100644 --- a/cyclone/sickle/poke.c +++ b/cyclone/sickle/poke.c @@ -29,7 +29,7 @@ static void poke_tick(t_poke *x) { arsic_redraw((t_arsic *)x); /* LATER redraw only dirty channel(s!) */ x->x_clockset = 0; - x->x_clocklasttick = clock_getsystime(); + x->x_clocklasttick = clock_getlogicaltime(); } static void poke_set(t_poke *x, t_symbol *s) @@ -132,7 +132,7 @@ static void *poke_new(t_symbol *s, t_floatarg f) x->x_indexptr = fragile_inlet_signalscalar(in2); inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft2")); x->x_clock = clock_new(x, (t_method)poke_tick); - x->x_clocklasttick = clock_getsystime(); + x->x_clocklasttick = clock_getlogicaltime(); x->x_clockset = 0; } return (x); diff --git a/cyclone/sickle/record.c b/cyclone/sickle/record.c index ba2e3b5..f03e784 100644 --- a/cyclone/sickle/record.c +++ b/cyclone/sickle/record.c @@ -8,6 +8,8 @@ #include "sickle/sic.h" #include "sickle/arsic.h" +#define RECORD_REDRAWPAUSE 1000. /* refractory period */ + typedef struct _record { t_arsic x_arsic; @@ -23,13 +25,20 @@ typedef struct _record float x_syncincr; int x_isrunning; /* to know if sync should be 0.0 or 1.0 */ t_clock *x_clock; + double x_clocklasttick; } t_record; static t_class *record_class; static void record_tick(t_record *x) { - arsic_redraw((t_arsic *)x); + double timesince = clock_gettimesince(x->x_clocklasttick); + if (timesince >= RECORD_REDRAWPAUSE) + { + arsic_redraw((t_arsic *)x); + x->x_clocklasttick = clock_getlogicaltime(); + } + else clock_delay(x->x_clock, RECORD_REDRAWPAUSE - timesince); } static void record_setsync(t_record *x) @@ -37,15 +46,15 @@ static void record_setsync(t_record *x) /* CHECKED: clipped to array size -- using indices, not points */ float range = (float)(x->x_endindex - x->x_startindex); int phase = x->x_phase; - if (phase == SHARED_INT_MAX || range < 1.0) + if (phase == SHARED_INT_MAX || range < 1.) { - x->x_sync = (x->x_isrunning ? 1.0 : 0); /* CHECKED */ - x->x_syncincr = 0; + x->x_sync = (x->x_isrunning ? 1. : 0.); /* CHECKED */ + x->x_syncincr = 0.; } else { x->x_sync = (float)(phase - x->x_startindex) / range; - x->x_syncincr = 1.0 / range; + x->x_syncincr = 1. / range; } } @@ -68,6 +77,15 @@ static void record_set(t_record *x, t_symbol *s) record_mstoindex(x); } +static void record_reset(t_record *x) +{ + x->x_startpoint = x->x_endpoint = 0.; + x->x_pauseindex = SHARED_INT_MAX; + x->x_phase = SHARED_INT_MAX; + x->x_isrunning = 0; + record_mstoindex(x); +} + static void record_startpoint(t_record *x, t_floatarg f) { x->x_startpoint = f; @@ -91,7 +109,7 @@ static void record_float(t_record *x, t_float f) } else if (x->x_phase != SHARED_INT_MAX) /* CHECKED: no rewind */ { - record_tick(x); + clock_delay(x->x_clock, 10.); x->x_pauseindex = x->x_phase; x->x_phase = SHARED_INT_MAX; } @@ -126,7 +144,7 @@ static t_int *record_perform(t_int *w) { int vecsize = sic->s_vecsize; float syncincr = x->x_syncincr; - int ch, over, i, nxfer; + int ch, over, i, nxfer, ndone = 0; loopover: if ((nxfer = endphase - phase) > nblock) { @@ -140,7 +158,7 @@ loopover: t_float *vp = sic->s_vectors[ch]; if (vp) { - t_float *ip = (t_float *)(w[3 + ch]); + t_float *ip = (t_float *)(w[3 + ch]) + ndone; vp += phase; i = nxfer; /* LATER consider handling under and overflows */ @@ -148,6 +166,10 @@ loopover: } } i = nxfer; + + sync = phase; + syncincr = 1.; + while (i--) { *out++ = sync; @@ -155,31 +177,35 @@ loopover: } if (over) { + clock_delay(x->x_clock, 0); nblock -= nxfer; if (x->x_loopmode && (phase = x->x_startindex) < endphase) { x->x_phase = phase; x->x_sync = sync = 0; - if (nblock > 0) goto loopover; - goto done; + if (nblock > 0) + { + ndone += nxfer; + goto loopover; + } + goto alldone; } - clock_delay(x->x_clock, 0); /* CHECKED: no restart in append mode */ x->x_pauseindex = SHARED_INT_MAX; x->x_phase = SHARED_INT_MAX; - x->x_sync = 1.0; - x->x_syncincr = 0; + x->x_sync = 1.; + x->x_syncincr = 0.; } else { x->x_phase += nxfer; x->x_sync = sync; - goto done; + goto alldone; } } - while (nblock--) *out++ = sync; -done: + while (nblock--) *out++ = -1; //sync; +alldone: return (w + sic->s_nperfargs + 1); } @@ -203,15 +229,11 @@ static void *record_new(t_symbol *s, t_floatarg f) { int nch = arsic_getnchannels((t_arsic *)x); arsic_setminsize((t_arsic *)x, 2); - x->x_startpoint = 0; - x->x_endpoint = 0; x->x_appendmode = 0; x->x_loopmode = 0; - x->x_pauseindex = SHARED_INT_MAX; - x->x_phase = SHARED_INT_MAX; - x->x_isrunning = 0; - record_mstoindex(x); + record_reset(x); x->x_clock = clock_new(x, (t_method)record_tick); + x->x_clocklasttick = clock_getlogicaltime(); while (--nch) inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft-2")); @@ -239,4 +261,6 @@ void record_tilde_setup(void) gensym("loop"), A_FLOAT, 0); class_addmethod(record_class, (t_method)record_set, gensym("set"), A_SYMBOL, 0); + class_addmethod(record_class, (t_method)record_reset, + gensym("reset"), 0); } diff --git a/cyclone/sickle/sickle.c b/cyclone/sickle/sickle.c index 765209a..8df7974 100644 --- a/cyclone/sickle/sickle.c +++ b/cyclone/sickle/sickle.c @@ -27,21 +27,24 @@ static void sickle_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) import_max(fn->s_name, ""); } -static void sickle_import(t_sickle *x, t_symbol *fn, t_symbol *dir) +static void sickle_doimport(t_sickle *x, t_symbol *fn, t_symbol *dir) { + if (!dir || dir == &s_) dir = x->x_dir; if (fn && fn != &s_) - { - if (!dir || dir == &s_) dir = x->x_dir; import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : ""); - } else - hammerpanel_open(x->x_filehandle); + hammerpanel_open(x->x_filehandle, dir); } static void sickle_click(t_sickle *x, t_floatarg xpos, t_floatarg ypos, - t_floatarg shift, t_floatarg ctrl, t_floatarg alt) + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + sickle_doimport(x, 0, 0); +} + +static void sickle_import(t_sickle *x, t_symbol *fn) { - sickle_import(x, 0, 0); + sickle_doimport(x, fn, 0); } static void sickle_bang(t_sickle *x) @@ -82,7 +85,7 @@ void sickle_setup(void) sizeof(t_sickle), 0, A_DEFSYM, 0); class_addbang(sickle_class, sickle_bang); class_addmethod(sickle_class, (t_method)sickle_import, - gensym("import"), A_DEFSYM, A_DEFSYM, 0); + gensym("import"), A_DEFSYM, 0); class_addmethod(sickle_class, (t_method)sickle_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); |