From 2c6c8032966d625a86dc52975573f668c3b6c6a5 Mon Sep 17 00:00:00 2001 From: Sojourner Truth <jon.w.wilkes@gmail.com> Date: Sat, 9 Jul 2016 21:02:22 -0400 Subject: [PATCH] put miXed back in tree to accommodate the ported gui objects like Scope~ and comment --- externals/miXed/LICENSE.txt | 30 + externals/miXed/Makefile | 46 + externals/miXed/Makefile.common | 432 +++ externals/miXed/Makefile.dirs | 10 + externals/miXed/SConscript | 52 + externals/miXed/ViCious/cyclone/makefile | 87 + externals/miXed/ViCious/cyclone/objects | 239 ++ externals/miXed/ViCious/cyclone/snapfiles | 19 + externals/miXed/ViCious/notes.txt | 8 + externals/miXed/ViCious/pddp/makefile | 53 + externals/miXed/ViCious/pddp/objects | 3 + externals/miXed/ViCious/pddp/snapfiles | 10 + externals/miXed/ViCious/toxy/makefile | 59 + externals/miXed/ViCious/toxy/objects | 25 + externals/miXed/ViCious/toxy/snapfiles | 11 + externals/miXed/bin/Clip-help.pd | 3 + externals/miXed/bin/Clip~-help.pd | 3 + externals/miXed/bin/Line~-help.pd | 10 + externals/miXed/bin/Scope~-help.pd | 4 + externals/miXed/bin/Snapshot~-help.pd | 8 + externals/miXed/bin/Table-help.pd | 11 + externals/miXed/bin/notes.txt | 14 + externals/miXed/bin/pddp/pddpboot.tcl | 32 + externals/miXed/bin/pddp/pddpclient.tcl | 82 + externals/miXed/bin/pddp/pddpserver.tcl | 507 ++++ externals/miXed/bin/pddp/pkgIndex.tcl | 10 + externals/miXed/cyclone/Makefile | 2 + externals/miXed/cyclone/Makefile.dirs | 2 + externals/miXed/cyclone/Makefile.libdir | 128 + externals/miXed/cyclone/Makefile.objects | 40 + externals/miXed/cyclone/Makefile.sources | 228 ++ externals/miXed/cyclone/README.txt | 78 + externals/miXed/cyclone/build_counter | 7 + externals/miXed/cyclone/cyclone-all.exclude | 9 + externals/miXed/cyclone/cyclone-help.include | 7 + externals/miXed/cyclone/cyclone-meta.pd | 9 + .../miXed/cyclone/cyclone-shared.include | 45 + externals/miXed/cyclone/cyclone-test.exclude | 6 + .../miXed/cyclone/cyclone-vicious.exclude | 3 + externals/miXed/cyclone/hammer/Append.c | 361 +++ externals/miXed/cyclone/hammer/Borax.c | 184 ++ externals/miXed/cyclone/hammer/Bucket.c | 152 ++ externals/miXed/cyclone/hammer/Clip.c | 156 ++ externals/miXed/cyclone/hammer/Decode.c | 119 + externals/miXed/cyclone/hammer/Histo.c | 110 + externals/miXed/cyclone/hammer/Makefile | 3 + .../miXed/cyclone/hammer/Makefile.objects | 17 + .../miXed/cyclone/hammer/Makefile.sources | 82 + externals/miXed/cyclone/hammer/MouseState.c | 160 ++ externals/miXed/cyclone/hammer/Peak.c | 70 + externals/miXed/cyclone/hammer/Table.c | 951 +++++++ externals/miXed/cyclone/hammer/TogEdge.c | 78 + externals/miXed/cyclone/hammer/Trough.c | 70 + externals/miXed/cyclone/hammer/Uzi.c | 115 + externals/miXed/cyclone/hammer/accum.c | 68 + externals/miXed/cyclone/hammer/acos.c | 48 + externals/miXed/cyclone/hammer/active.c | 55 + externals/miXed/cyclone/hammer/allhammers.c | 164 ++ externals/miXed/cyclone/hammer/anal.c | 108 + externals/miXed/cyclone/hammer/asin.c | 48 + externals/miXed/cyclone/hammer/atodb.c | 96 + externals/miXed/cyclone/hammer/bangbang.c | 75 + externals/miXed/cyclone/hammer/bondo.c | 394 +++ externals/miXed/cyclone/hammer/buddy.c | 253 ++ externals/miXed/cyclone/hammer/capture.c | 291 ++ externals/miXed/cyclone/hammer/cartopol.c | 44 + externals/miXed/cyclone/hammer/coll.c | 2059 ++++++++++++++ externals/miXed/cyclone/hammer/comment.c | 904 +++++++ externals/miXed/cyclone/hammer/cosh.c | 48 + externals/miXed/cyclone/hammer/counter.c | 402 +++ externals/miXed/cyclone/hammer/cycle.c | 155 ++ externals/miXed/cyclone/hammer/dbtoa.c | 91 + externals/miXed/cyclone/hammer/decide.c | 83 + externals/miXed/cyclone/hammer/drunk.c | 140 + externals/miXed/cyclone/hammer/flush.c | 79 + externals/miXed/cyclone/hammer/forward.c | 71 + externals/miXed/cyclone/hammer/fromsymbol.c | 88 + externals/miXed/cyclone/hammer/funbuff.c | 535 ++++ externals/miXed/cyclone/hammer/funnel.c | 179 ++ externals/miXed/cyclone/hammer/gate.c | 149 + externals/miXed/cyclone/hammer/grab.c | 278 ++ externals/miXed/cyclone/hammer/hammer.c | 119 + externals/miXed/cyclone/hammer/iter.c | 112 + externals/miXed/cyclone/hammer/loadmess.c | 247 ++ externals/miXed/cyclone/hammer/match.c | 216 ++ externals/miXed/cyclone/hammer/maximum.c | 93 + externals/miXed/cyclone/hammer/mean.c | 79 + externals/miXed/cyclone/hammer/midiflush.c | 102 + externals/miXed/cyclone/hammer/midiformat.c | 112 + externals/miXed/cyclone/hammer/midiparse.c | 132 + externals/miXed/cyclone/hammer/minimum.c | 93 + externals/miXed/cyclone/hammer/mousefilter.c | 70 + externals/miXed/cyclone/hammer/mtr.c | 862 ++++++ externals/miXed/cyclone/hammer/next.c | 58 + externals/miXed/cyclone/hammer/offer.c | 93 + externals/miXed/cyclone/hammer/onebang.c | 46 + externals/miXed/cyclone/hammer/past.c | 156 ++ .../miXed/cyclone/hammer/pd-lib-notes.txt | 61 + externals/miXed/cyclone/hammer/poltocar.c | 44 + externals/miXed/cyclone/hammer/pong.c | 283 ++ externals/miXed/cyclone/hammer/prepend.c | 368 +++ externals/miXed/cyclone/hammer/prob.c | 312 +++ externals/miXed/cyclone/hammer/pv.c | 457 ++++ externals/miXed/cyclone/hammer/round.c | 182 ++ externals/miXed/cyclone/hammer/seq.c | 1246 +++++++++ externals/miXed/cyclone/hammer/sinh.c | 48 + externals/miXed/cyclone/hammer/speedlim.c | 173 ++ externals/miXed/cyclone/hammer/spell.c | 149 + externals/miXed/cyclone/hammer/split.c | 64 + externals/miXed/cyclone/hammer/spray.c | 93 + externals/miXed/cyclone/hammer/sprintf.c | 643 +++++ externals/miXed/cyclone/hammer/substitute.c | 344 +++ externals/miXed/cyclone/hammer/sustain.c | 86 + externals/miXed/cyclone/hammer/switch.c | 154 ++ externals/miXed/cyclone/hammer/tanh.c | 48 + externals/miXed/cyclone/hammer/testmess.c | 359 +++ externals/miXed/cyclone/hammer/thresh.c | 134 + externals/miXed/cyclone/hammer/tosymbol.c | 185 ++ externals/miXed/cyclone/hammer/universal.c | 167 ++ externals/miXed/cyclone/hammer/urn.c | 150 ++ externals/miXed/cyclone/hammer/xbendin.c | 93 + externals/miXed/cyclone/hammer/xbendin2.c | 99 + externals/miXed/cyclone/hammer/xbendout.c | 54 + externals/miXed/cyclone/hammer/xbendout2.c | 60 + externals/miXed/cyclone/hammer/xnotein.c | 100 + externals/miXed/cyclone/hammer/xnoteout.c | 62 + externals/miXed/cyclone/hammer/zl.c | 994 +++++++ externals/miXed/cyclone/notes.txt | 62 + externals/miXed/cyclone/shadow/Makefile | 7 + .../miXed/cyclone/shadow/Makefile.objects | 14 + .../miXed/cyclone/shadow/Makefile.sources | 7 + externals/miXed/cyclone/shadow/cyclone.c | 163 ++ externals/miXed/cyclone/shadow/dummies.c | 643 +++++ externals/miXed/cyclone/shadow/maxmode.c | 202 ++ externals/miXed/cyclone/shadow/nettles.c | 549 ++++ externals/miXed/cyclone/shadow/shadow.h | 10 + externals/miXed/cyclone/sickle/Clip.c | 66 + externals/miXed/cyclone/sickle/Line.c | 347 +++ externals/miXed/cyclone/sickle/Makefile | 3 + .../miXed/cyclone/sickle/Makefile.objects | 16 + .../miXed/cyclone/sickle/Makefile.sources | 83 + externals/miXed/cyclone/sickle/Scope.c | 1073 ++++++++ externals/miXed/cyclone/sickle/Scope.c.old | 1055 ++++++++ externals/miXed/cyclone/sickle/Snapshot.c | 168 ++ externals/miXed/cyclone/sickle/abs.c | 97 + externals/miXed/cyclone/sickle/acos.c | 48 + externals/miXed/cyclone/sickle/acosh.c | 48 + externals/miXed/cyclone/sickle/allpass.c | 153 ++ externals/miXed/cyclone/sickle/allsickles.c | 166 ++ externals/miXed/cyclone/sickle/asin.c | 48 + externals/miXed/cyclone/sickle/asinh.c | 48 + externals/miXed/cyclone/sickle/atan.c | 48 + externals/miXed/cyclone/sickle/atan2.c | 53 + externals/miXed/cyclone/sickle/atanh.c | 48 + externals/miXed/cyclone/sickle/atodb.c | 72 + externals/miXed/cyclone/sickle/average.c | 195 ++ externals/miXed/cyclone/sickle/avg.c | 62 + externals/miXed/cyclone/sickle/bitand.c | 144 + externals/miXed/cyclone/sickle/bitnot.c | 66 + externals/miXed/cyclone/sickle/bitor.c | 144 + externals/miXed/cyclone/sickle/bitshift.c | 133 + externals/miXed/cyclone/sickle/bitxor.c | 190 ++ externals/miXed/cyclone/sickle/buffir.c | 219 ++ externals/miXed/cyclone/sickle/capture.c | 409 +++ externals/miXed/cyclone/sickle/cartopol.c | 79 + externals/miXed/cyclone/sickle/change.c | 52 + externals/miXed/cyclone/sickle/click.c | 119 + externals/miXed/cyclone/sickle/comb.c | 162 ++ externals/miXed/cyclone/sickle/cosh.c | 48 + externals/miXed/cyclone/sickle/cosx.c | 51 + externals/miXed/cyclone/sickle/count.c | 163 ++ externals/miXed/cyclone/sickle/curve.c | 425 +++ externals/miXed/cyclone/sickle/curve.gp | 9 + externals/miXed/cyclone/sickle/cycle.c | 186 ++ externals/miXed/cyclone/sickle/dbtoa.c | 64 + externals/miXed/cyclone/sickle/delay.c | 101 + externals/miXed/cyclone/sickle/delta.c | 52 + externals/miXed/cyclone/sickle/deltaclip.c | 86 + externals/miXed/cyclone/sickle/edge.c | 106 + externals/miXed/cyclone/sickle/frameaccum.c | 71 + externals/miXed/cyclone/sickle/framedelta.c | 76 + externals/miXed/cyclone/sickle/index.c | 110 + externals/miXed/cyclone/sickle/kink.c | 62 + externals/miXed/cyclone/sickle/linedrive.c | 141 + externals/miXed/cyclone/sickle/log.c | 74 + externals/miXed/cyclone/sickle/lookup.c | 99 + externals/miXed/cyclone/sickle/lores.c | 109 + externals/miXed/cyclone/sickle/matrix.c | 591 ++++ externals/miXed/cyclone/sickle/maximum.c | 50 + externals/miXed/cyclone/sickle/minimum.c | 50 + externals/miXed/cyclone/sickle/minmax.c | 78 + externals/miXed/cyclone/sickle/mstosamps.c | 55 + externals/miXed/cyclone/sickle/onepole.c | 151 ++ externals/miXed/cyclone/sickle/overdrive.c | 80 + externals/miXed/cyclone/sickle/peakamp.c | 107 + externals/miXed/cyclone/sickle/peek.c | 150 ++ externals/miXed/cyclone/sickle/phasewrap.c | 131 + externals/miXed/cyclone/sickle/pink.c | 100 + externals/miXed/cyclone/sickle/play.c | 125 + externals/miXed/cyclone/sickle/poke.c | 158 ++ externals/miXed/cyclone/sickle/poltocar.c | 79 + externals/miXed/cyclone/sickle/pong.c | 359 +++ externals/miXed/cyclone/sickle/pow.c | 54 + externals/miXed/cyclone/sickle/rampsmooth.c | 210 ++ externals/miXed/cyclone/sickle/rand.c | 96 + externals/miXed/cyclone/sickle/record.c | 274 ++ externals/miXed/cyclone/sickle/reson.c | 123 + externals/miXed/cyclone/sickle/round.c | 150 ++ externals/miXed/cyclone/sickle/sah.c | 70 + externals/miXed/cyclone/sickle/sampstoms.c | 55 + externals/miXed/cyclone/sickle/sickle.c | 119 + externals/miXed/cyclone/sickle/sinh.c | 48 + externals/miXed/cyclone/sickle/sinx.c | 51 + externals/miXed/cyclone/sickle/slide.c | 78 + externals/miXed/cyclone/sickle/spike.c | 109 + externals/miXed/cyclone/sickle/svf.c | 188 ++ externals/miXed/cyclone/sickle/tanh.c | 48 + externals/miXed/cyclone/sickle/tanx.c | 51 + externals/miXed/cyclone/sickle/train.c | 117 + externals/miXed/cyclone/sickle/trapezoid.c | 105 + externals/miXed/cyclone/sickle/triangle.c | 95 + externals/miXed/cyclone/sickle/trunc.c | 89 + externals/miXed/cyclone/sickle/vectral.c | 235 ++ externals/miXed/cyclone/sickle/wave.c | 164 ++ externals/miXed/cyclone/sickle/zerox.c | 78 + .../miXed/doc/help/cyclone/Borax-help.pd | 126 + .../miXed/doc/help/cyclone/Bucket-help.pd | 95 + externals/miXed/doc/help/cyclone/Clip-help.pd | 71 + .../miXed/doc/help/cyclone/Clip~-help.pd | 90 + .../miXed/doc/help/cyclone/Decode-help.pd | 79 + .../miXed/doc/help/cyclone/Histo-help.pd | 72 + .../miXed/doc/help/cyclone/Line~-help.pd | 99 + .../miXed/doc/help/cyclone/MouseState-help.pd | 106 + externals/miXed/doc/help/cyclone/Peak-help.pd | 96 + externals/miXed/doc/help/cyclone/README | 6 + .../miXed/doc/help/cyclone/Scope~-help.pd | 69 + .../miXed/doc/help/cyclone/Snapshot~-help.pd | 102 + externals/miXed/doc/help/cyclone/TODO | 10 + .../miXed/doc/help/cyclone/Table-help.pd | 116 + .../miXed/doc/help/cyclone/TogEdge-help.pd | 73 + .../miXed/doc/help/cyclone/Trough-help.pd | 94 + externals/miXed/doc/help/cyclone/Uzi-help.pd | 88 + .../miXed/doc/help/cyclone/accum-help.pd | 82 + externals/miXed/doc/help/cyclone/acos-help.pd | 71 + .../miXed/doc/help/cyclone/acosh~-help.pd | 82 + .../miXed/doc/help/cyclone/acos~-help.pd | 111 + .../miXed/doc/help/cyclone/active-help.pd | 24 + .../doc/help/cyclone/all_about_cyclone.pd | 42 + .../miXed/doc/help/cyclone/allpass~-help.pd | 163 ++ externals/miXed/doc/help/cyclone/anal-help.pd | 48 + externals/miXed/doc/help/cyclone/asin-help.pd | 70 + .../miXed/doc/help/cyclone/asinh-help.pd | 38 + .../miXed/doc/help/cyclone/asin~-help.pd | 106 + .../miXed/doc/help/cyclone/atan2~-help.pd | 17 + .../miXed/doc/help/cyclone/atanh~-help.pd | 78 + .../miXed/doc/help/cyclone/atan~-help.pd | 79 + .../miXed/doc/help/cyclone/atodb-help.pd | 91 + .../miXed/doc/help/cyclone/atodb~-help.pd | 187 ++ .../miXed/doc/help/cyclone/average~-help.pd | 86 + externals/miXed/doc/help/cyclone/avg~-help.pd | 79 + .../miXed/doc/help/cyclone/bangbang-help.pd | 71 + .../miXed/doc/help/cyclone/bitand~-help.pd | 242 ++ .../miXed/doc/help/cyclone/bitnot~-help.pd | 84 + .../miXed/doc/help/cyclone/bitor~-help.pd | 240 ++ .../miXed/doc/help/cyclone/bitshift~-help.pd | 93 + .../miXed/doc/help/cyclone/bitxor~-help.pd | 398 +++ .../miXed/doc/help/cyclone/bondo-help.pd | 72 + .../miXed/doc/help/cyclone/buddy-help.pd | 64 + .../miXed/doc/help/cyclone/buffir~-help.pd | 151 ++ .../miXed/doc/help/cyclone/capture-help.pd | 102 + .../miXed/doc/help/cyclone/capture~-help.pd | 85 + .../miXed/doc/help/cyclone/cartopol-help.pd | 75 + .../miXed/doc/help/cyclone/cartopol~-help.pd | 72 + .../miXed/doc/help/cyclone/change~-help.pd | 95 + .../miXed/doc/help/cyclone/click~-help.pd | 66 + externals/miXed/doc/help/cyclone/coll-help.pd | 354 +++ externals/miXed/doc/help/cyclone/coll.txt | 14 + .../miXed/doc/help/cyclone/comb~-help.pd | 182 ++ externals/miXed/doc/help/cyclone/cosh-help.pd | 73 + .../miXed/doc/help/cyclone/cosh~-help.pd | 86 + .../miXed/doc/help/cyclone/cosx~-help.pd | 72 + .../miXed/doc/help/cyclone/counter-help.pd | 238 ++ .../miXed/doc/help/cyclone/count~-help.pd | 110 + .../miXed/doc/help/cyclone/curve~-help.pd | 836 ++++++ .../miXed/doc/help/cyclone/cycle-help.pd | 111 + .../miXed/doc/help/cyclone/cycle~-help.pd | 140 + .../miXed/doc/help/cyclone/dbtoa-help.pd | 85 + .../miXed/doc/help/cyclone/dbtoa~-help.pd | 186 ++ .../miXed/doc/help/cyclone/decide-help.pd | 75 + .../miXed/doc/help/cyclone/delay~-help.pd | 141 + .../miXed/doc/help/cyclone/deltaclip~-help.pd | 231 ++ .../miXed/doc/help/cyclone/delta~-help.pd | 88 + .../miXed/doc/help/cyclone/drunk-help.pd | 100 + .../miXed/doc/help/cyclone/edge~-help.pd | 39 + .../miXed/doc/help/cyclone/flush-help.pd | 95 + .../miXed/doc/help/cyclone/forward-help.pd | 63 + .../doc/help/cyclone/frameaccum~-help.pd | 63 + .../doc/help/cyclone/framedelta~-help.pd | 71 + .../miXed/doc/help/cyclone/fromsymbol-help.pd | 89 + .../miXed/doc/help/cyclone/funbuff-help.pd | 200 ++ .../miXed/doc/help/cyclone/funnel-help.pd | 79 + externals/miXed/doc/help/cyclone/gate-help.pd | 89 + externals/miXed/doc/help/cyclone/grab-help.pd | 99 + .../miXed/doc/help/cyclone/index~-help.pd | 125 + externals/miXed/doc/help/cyclone/iter-help.pd | 62 + .../miXed/doc/help/cyclone/kink~-help.pd | 106 + .../miXed/doc/help/cyclone/linedrive-help.pd | 91 + .../miXed/doc/help/cyclone/loadmess-help.pd | 99 + .../miXed/doc/help/cyclone/lookup~-help.pd | 142 + .../miXed/doc/help/cyclone/lores~-help.pd | 90 + .../miXed/doc/help/cyclone/match-help.pd | 67 + .../miXed/doc/help/cyclone/matrix~-help.pd | 130 + .../miXed/doc/help/cyclone/maximum-help.pd | 70 + .../miXed/doc/help/cyclone/maximum~-help.pd | 71 + .../miXed/doc/help/cyclone/maxmode-help.pd | 70 + externals/miXed/doc/help/cyclone/mean-help.pd | 74 + .../miXed/doc/help/cyclone/midiflush-help.pd | 60 + .../miXed/doc/help/cyclone/midiformat-help.pd | 102 + .../miXed/doc/help/cyclone/midiparse-help.pd | 116 + .../miXed/doc/help/cyclone/minimum-help.pd | 71 + .../miXed/doc/help/cyclone/minimum~-help.pd | 71 + .../miXed/doc/help/cyclone/minmax~-help.pd.pd | 50 + .../doc/help/cyclone/mousefilter-help.pd | 55 + .../miXed/doc/help/cyclone/mstosamps~-help.pd | 72 + externals/miXed/doc/help/cyclone/mtr-help.pd | 112 + externals/miXed/doc/help/cyclone/next-help.pd | 90 + .../miXed/doc/help/cyclone/offer-help.pd | 85 + .../miXed/doc/help/cyclone/onebang-help.pd | 65 + .../miXed/doc/help/cyclone/onepole~-help.pd | 78 + .../miXed/doc/help/cyclone/overdrive~-help.pd | 96 + externals/miXed/doc/help/cyclone/past-help.pd | 122 + .../miXed/doc/help/cyclone/peakamp~-help.pd | 104 + .../miXed/doc/help/cyclone/peek~-help.pd | 113 + .../miXed/doc/help/cyclone/phasewrap~-help.pd | 57 + .../miXed/doc/help/cyclone/pink~-help.pd | 58 + .../miXed/doc/help/cyclone/play~-help.pd | 133 + .../miXed/doc/help/cyclone/poke~-help.pd | 95 + .../miXed/doc/help/cyclone/poltocar-help.pd | 79 + .../miXed/doc/help/cyclone/poltocar~-help.pd | 68 + externals/miXed/doc/help/cyclone/pong-help.pd | 127 + .../miXed/doc/help/cyclone/pong~-help.pd | 238 ++ externals/miXed/doc/help/cyclone/pow~-help.pd | 98 + .../miXed/doc/help/cyclone/prepend-help.pd | 99 + externals/miXed/doc/help/cyclone/prepend.pd | 26 + externals/miXed/doc/help/cyclone/prob-help.pd | 108 + externals/miXed/doc/help/cyclone/pv-help.pd | 62 + .../doc/help/cyclone/rampsmooth~-help.pd | 88 + .../miXed/doc/help/cyclone/rand~-help.pd | 110 + .../miXed/doc/help/cyclone/record~-help.pd | 130 + .../miXed/doc/help/cyclone/reson~-help.pd | 101 + .../miXed/doc/help/cyclone/round-help.pd | 117 + .../miXed/doc/help/cyclone/round~-help.pd | 206 ++ externals/miXed/doc/help/cyclone/sah~-help.pd | 89 + .../miXed/doc/help/cyclone/sampstoms~-help.pd | 73 + externals/miXed/doc/help/cyclone/seq-help.pd | 100 + externals/miXed/doc/help/cyclone/sinh-help.pd | 64 + .../miXed/doc/help/cyclone/sinh~-help.pd | 75 + .../miXed/doc/help/cyclone/sinx~-help.pd | 62 + .../miXed/doc/help/cyclone/slide~-help.pd | 87 + .../miXed/doc/help/cyclone/speedlim-help.pd | 65 + .../miXed/doc/help/cyclone/spell-help.pd | 54 + .../miXed/doc/help/cyclone/spike~-help.pd | 75 + .../miXed/doc/help/cyclone/split-help.pd | 82 + .../miXed/doc/help/cyclone/spray-help.pd | 60 + .../miXed/doc/help/cyclone/sprintf-help.pd | 54 + .../miXed/doc/help/cyclone/substitute-help.pd | 64 + .../miXed/doc/help/cyclone/sustain-help.pd | 97 + externals/miXed/doc/help/cyclone/svf~-help.pd | 177 ++ .../miXed/doc/help/cyclone/switch-help.pd | 77 + externals/miXed/doc/help/cyclone/tanh-help.pd | 63 + .../miXed/doc/help/cyclone/tanh~-help.pd | 90 + .../miXed/doc/help/cyclone/tanx~-help.pd | 61 + externals/miXed/doc/help/cyclone/test.mid | Bin 0 -> 288 bytes .../miXed/doc/help/cyclone/testmess-help.pd | 23 + .../miXed/doc/help/cyclone/thresh-help.pd | 61 + .../miXed/doc/help/cyclone/tosymbol-help.pd | 99 + .../miXed/doc/help/cyclone/train~-help.pd | 109 + .../miXed/doc/help/cyclone/trapezoid~-help.pd | 94 + .../miXed/doc/help/cyclone/triangle~-help.pd | 91 + .../miXed/doc/help/cyclone/trunc~-help.pd | 181 ++ .../miXed/doc/help/cyclone/universal-help.pd | 213 ++ externals/miXed/doc/help/cyclone/urn-help.pd | 83 + .../miXed/doc/help/cyclone/vectral~-help.pd | 138 + .../miXed/doc/help/cyclone/wave~-help.pd | 185 ++ .../miXed/doc/help/cyclone/xbendin-help.pd | 73 + .../miXed/doc/help/cyclone/xbendin2-help.pd | 77 + .../miXed/doc/help/cyclone/xbendout-help.pd | 73 + .../miXed/doc/help/cyclone/xbendout2-help.pd | 82 + .../miXed/doc/help/cyclone/xnotein-help.pd | 61 + .../miXed/doc/help/cyclone/xnoteout-help.pd | 62 + .../miXed/doc/help/cyclone/zerox~-help.pd | 92 + externals/miXed/doc/help/cyclone/zl-help.pd | 271 ++ externals/miXed/doc/help/toxy/tot-help.pd | 118 + externals/miXed/doc/src/Makefile | 8 + externals/miXed/doc/src/Makefile.dirs | 2 + externals/miXed/doc/src/externs/keepme | 1 + externals/miXed/dumpsetups | 16 + externals/miXed/pddp/Makefile | 2 + externals/miXed/pddp/Makefile.objects | 3 + externals/miXed/pddp/Makefile.sources | 3 + externals/miXed/pddp/build_counter | 7 + externals/miXed/pddp/notes.txt | 31 + externals/miXed/pddp/pddp-all.exclude | 8 + externals/miXed/pddp/pddp-help.include | 0 externals/miXed/pddp/pddp-shared.include | 5 + externals/miXed/pddp/pddp-test.exclude | 5 + externals/miXed/pddp/pddp-vicious.exclude | 3 + externals/miXed/pddp/pddplink.c | 409 +++ externals/miXed/riddle/rdremote.c | 814 ++++++ externals/miXed/riddle/riddle.c | 1069 ++++++++ externals/miXed/riddle/riddle.h | 133 + externals/miXed/riddle/riddleguts.h | 35 + externals/miXed/shared/Makefile | 2 + externals/miXed/shared/Makefile.dirs | 1 + externals/miXed/shared/Makefile.objects | 0 externals/miXed/shared/Makefile.sources | 2 + externals/miXed/shared/common/Makefile | 4 + .../miXed/shared/common/Makefile.objects | 0 .../miXed/shared/common/Makefile.sources | 17 + externals/miXed/shared/common/binport.c | 853 ++++++ externals/miXed/shared/common/binport.h | 24 + externals/miXed/shared/common/clc.c | 85 + externals/miXed/shared/common/clc.h | 10 + externals/miXed/shared/common/dict.c | 288 ++ externals/miXed/shared/common/dict.h | 30 + externals/miXed/shared/common/fitter.c | 271 ++ externals/miXed/shared/common/fitter.h | 21 + externals/miXed/shared/common/grow.c | 105 + externals/miXed/shared/common/grow.h | 17 + externals/miXed/shared/common/lex.c | 272 ++ externals/miXed/shared/common/lex.h | 25 + externals/miXed/shared/common/loud.c | 446 +++ externals/miXed/shared/common/loud.h | 54 + externals/miXed/shared/common/messtree.c | 144 + externals/miXed/shared/common/messtree.h | 47 + externals/miXed/shared/common/mifi.c | 1508 +++++++++++ externals/miXed/shared/common/mifi.h | 110 + externals/miXed/shared/common/os.c | 334 +++ externals/miXed/shared/common/os.h | 28 + externals/miXed/shared/common/patchvalue.c | 265 ++ externals/miXed/shared/common/patchvalue.h | 24 + externals/miXed/shared/common/port.c | 1671 ++++++++++++ externals/miXed/shared/common/port.h | 13 + externals/miXed/shared/common/props.c | 661 +++++ externals/miXed/shared/common/props.h | 34 + externals/miXed/shared/common/qtree.c | 943 +++++++ externals/miXed/shared/common/qtree.h | 88 + externals/miXed/shared/common/rand.c | 69 + externals/miXed/shared/common/rand.h | 15 + externals/miXed/shared/common/vefl.c | 231 ++ externals/miXed/shared/common/vefl.h | 36 + externals/miXed/shared/getridof.baddeps | 22 + externals/miXed/shared/hammer/Makefile | 4 + .../miXed/shared/hammer/Makefile.objects | 0 .../miXed/shared/hammer/Makefile.sources | 4 + externals/miXed/shared/hammer/file.c | 593 ++++ externals/miXed/shared/hammer/file.h | 33 + externals/miXed/shared/hammer/gui.c | 538 ++++ externals/miXed/shared/hammer/gui.h | 30 + externals/miXed/shared/hammer/tree.c | 784 ++++++ externals/miXed/shared/hammer/tree.h | 86 + externals/miXed/shared/notes.txt | 76 + externals/miXed/shared/shared.c | 11 + externals/miXed/shared/shared.h | 189 ++ externals/miXed/shared/sickle/Makefile | 4 + .../miXed/shared/sickle/Makefile.objects | 0 .../miXed/shared/sickle/Makefile.sources | 3 + externals/miXed/shared/sickle/arsic.c | 222 ++ externals/miXed/shared/sickle/arsic.h | 38 + externals/miXed/shared/sickle/sic.c | 121 + externals/miXed/shared/sickle/sic.h | 25 + externals/miXed/shared/toxy/Makefile | 4 + externals/miXed/shared/toxy/Makefile.objects | 0 externals/miXed/shared/toxy/Makefile.sources | 3 + externals/miXed/shared/toxy/plusbob.c | 400 +++ externals/miXed/shared/toxy/plusbob.h | 72 + externals/miXed/shared/toxy/scriptlet.c | 1089 ++++++++ externals/miXed/shared/toxy/scriptlet.h | 50 + externals/miXed/shared/unstable/Makefile | 4 + .../miXed/shared/unstable/Makefile.objects | 0 .../miXed/shared/unstable/Makefile.sources | 5 + externals/miXed/shared/unstable/forky.c | 108 + externals/miXed/shared/unstable/forky.h | 32 + externals/miXed/shared/unstable/fragile.c | 345 +++ externals/miXed/shared/unstable/fragile.h | 28 + externals/miXed/shared/unstable/fringe.c | 106 + externals/miXed/shared/unstable/fringe.h | 10 + externals/miXed/shared/unstable/loader.c | 223 ++ externals/miXed/shared/unstable/loader.h | 15 + externals/miXed/shared/unstable/pd_imp.h | 62 + externals/miXed/shared/unstable/standalone.c | 80 + externals/miXed/shared/unstable/standalone.h | 57 + externals/miXed/test/cyclone/Borax-test.pd | 120 + externals/miXed/test/cyclone/Bucket-test.pd | 40 + externals/miXed/test/cyclone/Decode-test.pd | 18 + externals/miXed/test/cyclone/Histo-test.pd | 20 + .../miXed/test/cyclone/MouseState-test.pd | 54 + externals/miXed/test/cyclone/Table-test.pd | 62 + externals/miXed/test/cyclone/TogEdge-test.pd | 16 + externals/miXed/test/cyclone/Uzi-test.pd | 27 + externals/miXed/test/cyclone/a-mix2.pd | 41 + externals/miXed/test/cyclone/active-test.pd | 19 + externals/miXed/test/cyclone/anal-test.pd | 17 + externals/miXed/test/cyclone/append-test.pd | 78 + externals/miXed/test/cyclone/bad.coll | 4 + externals/miXed/test/cyclone/bondo-test.pd | 73 + externals/miXed/test/cyclone/buddy-test.pd | 28 + externals/miXed/test/cyclone/buffir-test.pd | 66 + externals/miXed/test/cyclone/capture-test.pd | 48 + externals/miXed/test/cyclone/click-test.pd | 26 + externals/miXed/test/cyclone/clip-test.pd | 41 + externals/miXed/test/cyclone/coll-print.pd | 12 + externals/miXed/test/cyclone/coll-test.pd | 117 + externals/miXed/test/cyclone/comb-test.pd | 80 + .../miXed/test/cyclone/comment-dotest.pd | 37 + .../miXed/test/cyclone/comment-ogonki.pd | 9 + externals/miXed/test/cyclone/comment-test.pd | 21 + externals/miXed/test/cyclone/count-test.pd | 19 + externals/miXed/test/cyclone/counter-test.pd | 46 + externals/miXed/test/cyclone/curve-test.pd | 89 + externals/miXed/test/cyclone/cycle-test.pd | 30 + externals/miXed/test/cyclone/cyclone-test.pd | 64 + externals/miXed/test/cyclone/decide-test.pd | 27 + externals/miXed/test/cyclone/drunk-test.pd | 45 + externals/miXed/test/cyclone/forward-test.pd | 27 + .../miXed/test/cyclone/frameaccum-test.pd | 15 + .../miXed/test/cyclone/fromsymbol-test.pd | 64 + externals/miXed/test/cyclone/funbuff-etest.pd | 164 ++ externals/miXed/test/cyclone/funbuff-test.pd | 149 + externals/miXed/test/cyclone/funnel-test.pd | 33 + externals/miXed/test/cyclone/gate-test.pd | 48 + externals/miXed/test/cyclone/good.coll | 4 + externals/miXed/test/cyclone/grab-test.pd | 42 + externals/miXed/test/cyclone/index-test.pd | 51 + externals/miXed/test/cyclone/kanon.mid | Bin 0 -> 5282 bytes externals/miXed/test/cyclone/kink-test.pd | 22 + externals/miXed/test/cyclone/line-test.pd | 54 + .../miXed/test/cyclone/linedrive-test.pd | 11 + externals/miXed/test/cyclone/lores-test.pd | 78 + .../miXed/test/cyclone/match-reentrant.pd | 20 + externals/miXed/test/cyclone/match-test.pd | 33 + externals/miXed/test/cyclone/matrix-test.pd | 173 ++ externals/miXed/test/cyclone/maxmin-test.pd | 65 + externals/miXed/test/cyclone/maxmode-test.pd | 38 + externals/miXed/test/cyclone/mean-test.pd | 16 + externals/miXed/test/cyclone/midi-test.pd | 33 + .../miXed/test/cyclone/midiparse-test.pd | 28 + .../miXed/test/cyclone/mousefilter-test.pd | 28 + .../miXed/test/cyclone/mstosamps-test.pd | 23 + externals/miXed/test/cyclone/mtr-test.pd | 85 + externals/miXed/test/cyclone/next-test.pd | 16 + externals/miXed/test/cyclone/offer-test.pd | 83 + externals/miXed/test/cyclone/onebang-test.pd | 26 + externals/miXed/test/cyclone/onepole-test.pd | 63 + externals/miXed/test/cyclone/past-test.pd | 38 + externals/miXed/test/cyclone/peakamp-test.pd | 25 + externals/miXed/test/cyclone/peek-test.pd | 51 + externals/miXed/test/cyclone/pink-test.pd | 55 + externals/miXed/test/cyclone/poke-test.pd | 58 + externals/miXed/test/cyclone/pong-test.pd | 17 + externals/miXed/test/cyclone/prepend-test.pd | 73 + externals/miXed/test/cyclone/prob-test.pd | 33 + externals/miXed/test/cyclone/pv-test.pd | 83 + externals/miXed/test/cyclone/rand-test.pd | 37 + .../miXed/test/cyclone/record-sync-test.pd | 64 + externals/miXed/test/cyclone/record-test.pd | 60 + externals/miXed/test/cyclone/reson-test.pd | 73 + externals/miXed/test/cyclone/scope-gop.pd | 2 + externals/miXed/test/cyclone/scope-test.pd | 125 + externals/miXed/test/cyclone/scope-test1.pd | 28 + externals/miXed/test/cyclone/scope-test2.pd | 31 + externals/miXed/test/cyclone/seq-test.pd | 125 + externals/miXed/test/cyclone/sigbits-test.pd | 157 ++ .../miXed/test/cyclone/sigcapture-test.pd | 25 + externals/miXed/test/cyclone/sigcycle-test.pd | 156 ++ .../miXed/test/cyclone/sigmeters-test.pd | 45 + externals/miXed/test/cyclone/sigops-test.pd | 64 + .../miXed/test/cyclone/sigsmoothers-test.pd | 34 + externals/miXed/test/cyclone/sigtrig-test.pd | 80 + .../miXed/test/cyclone/sigwrappers-speed.pd | 101 + .../miXed/test/cyclone/sigwrappers-speed20.pd | 63 + .../miXed/test/cyclone/sigwrappers-test.pd | 34 + externals/miXed/test/cyclone/spectrum-pm.pd | 34 + .../test/cyclone/speedlim-rescheduling.pd | 54 + externals/miXed/test/cyclone/speedlim-test.pd | 63 + externals/miXed/test/cyclone/spell-test.pd | 26 + externals/miXed/test/cyclone/spike-test.pd | 23 + externals/miXed/test/cyclone/split-test.pd | 48 + externals/miXed/test/cyclone/spray-test.pd | 82 + .../miXed/test/cyclone/substitute-test.pd | 56 + externals/miXed/test/cyclone/svf-test.pd | 81 + externals/miXed/test/cyclone/switch-test.pd | 35 + externals/miXed/test/cyclone/test.capture | 2 + externals/miXed/test/cyclone/test.funbuff | 10 + externals/miXed/test/cyclone/test.mid | Bin 0 -> 4855 bytes externals/miXed/test/cyclone/test.pool | 2 + externals/miXed/test/cyclone/test.seq | 1208 +++++++++ externals/miXed/test/cyclone/test1.seq | 1208 +++++++++ .../miXed/test/cyclone/testmess-reentrant.pd | 25 + externals/miXed/test/cyclone/testmess-test.pd | 69 + externals/miXed/test/cyclone/thresh-test.pd | 41 + externals/miXed/test/cyclone/tosymbol-test.pd | 44 + externals/miXed/test/cyclone/train-test.pd | 17 + externals/miXed/test/cyclone/trig-test.pd | 66 + .../miXed/test/cyclone/universal-test.pd | 55 + externals/miXed/test/cyclone/urn-test.pd | 15 + externals/miXed/test/cyclone/vectral-test.pd | 56 + externals/miXed/test/cyclone/xbend-test.pd | 89 + externals/miXed/test/cyclone/xnote-test.pd | 50 + externals/miXed/test/cyclone/zerox-test.pd | 33 + externals/miXed/test/cyclone/zl-test.pd | 148 + externals/miXed/test/pddp/pddp.css | 18 + .../miXed/test/pddp/pddplink-test-01.html | 5 + externals/miXed/test/pddp/pddplink-test-01.pd | 17 + .../miXed/test/pddp/pddplink-test-01.xml | 19 + .../miXed/test/pddp/pddplink-test-02.html | 5 + externals/miXed/test/pddp/pddplink-test-02.pd | 17 + .../miXed/test/pddp/pddplink-test-02.xml | 19 + externals/miXed/test/pddp/test.bg.jpg | Bin 0 -> 5491 bytes externals/miXed/test/pddp/toonepage | 21 + externals/miXed/test/pddp/topdf | 23 + externals/miXed/test/toxy/button-test.pd | 44 + externals/miXed/test/toxy/defaults-test.pd | 25 + externals/miXed/test/toxy/editors/bpf-test.pd | 13 + externals/miXed/test/toxy/editors/bpf.wid | 224 ++ externals/miXed/test/toxy/kb-test.pd | 63 + externals/miXed/test/toxy/kb.wid | 215 ++ externals/miXed/test/toxy/lbpict-test.pd | 3 + externals/miXed/test/toxy/lbpict.wid | 9 + externals/miXed/test/toxy/listbox-test.pd | 24 + externals/miXed/test/toxy/multiscale-test.pd | 58 + externals/miXed/test/toxy/multiscale.wid | 52 + externals/miXed/test/toxy/pop1.wid | 10 + externals/miXed/test/toxy/pop2.wid | 8 + externals/miXed/test/toxy/popcustom-test.pd | 39 + externals/miXed/test/toxy/popup-test.pd | 51 + externals/miXed/test/toxy/radio-test.pd | 50 + externals/miXed/test/toxy/scale-test.pd | 47 + externals/miXed/test/toxy/setup.wid | 344 +++ externals/miXed/test/toxy/stress/bulk.pd | 78 + externals/miXed/test/toxy/stress/bulkyhurd.pd | 163 ++ externals/miXed/test/toxy/stress/catchme.pd | 117 + externals/miXed/test/toxy/stress/mstots.pd | 50 + .../miXed/test/toxy/stress/nbulkyhurds.pd | 16 + externals/miXed/test/toxy/stress/pophurd.pd | 138 + externals/miXed/test/toxy/tclversion.pd | 20 + externals/miXed/test/toxy/test.wid | 6 + externals/miXed/test/toxy/test1.tot | 301 +++ externals/miXed/test/toxy/testmess-test.pd | 35 + externals/miXed/test/toxy/testmess.wid | 44 + externals/miXed/test/toxy/tot-color.pd | 27 + externals/miXed/test/toxy/tot-cover.pd | 87 + externals/miXed/test/toxy/tot-files.pd | 29 + externals/miXed/test/toxy/tot-head.pd | 17 + externals/miXed/test/toxy/tot-monkey.pd | 50 + externals/miXed/test/toxy/tot-nomenu.pd | 12 + externals/miXed/test/toxy/tot-qlist.pd | 59 + externals/miXed/test/toxy/tot-query.pd | 61 + externals/miXed/test/toxy/tot-rstring.pd | 15 + externals/miXed/test/toxy/tot.ql | 186 ++ externals/miXed/test/toxy/tow-test.pd | 65 + externals/miXed/test/toxy/txt-test.pd | 25 + externals/miXed/test/toxy/txt.wid | 9 + externals/miXed/toxy/Makefile | 20 + externals/miXed/toxy/Makefile.objects | 49 + externals/miXed/toxy/Makefile.sources | 10 + externals/miXed/toxy/build_counter | 7 + externals/miXed/toxy/notes.txt | 120 + externals/miXed/toxy/plustot.ar.c | 128 + externals/miXed/toxy/plustot.c | 2391 +++++++++++++++++ externals/miXed/toxy/plustot.env.c | 152 ++ externals/miXed/toxy/plustot.h | 120 + externals/miXed/toxy/plustot.in.c | 128 + externals/miXed/toxy/plustot.out.c | 74 + externals/miXed/toxy/plustot.print.c | 97 + externals/miXed/toxy/plustot.qlist.c | 218 ++ externals/miXed/toxy/plustot.var.c | 132 + externals/miXed/toxy/pluswidget.c | 271 ++ externals/miXed/toxy/setup.wiq | 347 +++ externals/miXed/toxy/tot.c | 687 +++++ externals/miXed/toxy/tow.c | 26 + externals/miXed/toxy/toxy-all.exclude | 8 + externals/miXed/toxy/toxy-help.include | 1 + externals/miXed/toxy/toxy-shared.include | 26 + externals/miXed/toxy/toxy-test.exclude | 5 + externals/miXed/toxy/toxy-vicious.exclude | 3 + externals/miXed/toxy/widget.c | 1577 +++++++++++ externals/miXed/toxy/widget.h | 46 + externals/miXed/toxy/widgethandlers.c | 211 ++ externals/miXed/toxy/widgettype.c | 452 ++++ 690 files changed, 88401 insertions(+) create mode 100644 externals/miXed/LICENSE.txt create mode 100644 externals/miXed/Makefile create mode 100644 externals/miXed/Makefile.common create mode 100644 externals/miXed/Makefile.dirs create mode 100644 externals/miXed/SConscript create mode 100644 externals/miXed/ViCious/cyclone/makefile create mode 100644 externals/miXed/ViCious/cyclone/objects create mode 100644 externals/miXed/ViCious/cyclone/snapfiles create mode 100644 externals/miXed/ViCious/notes.txt create mode 100644 externals/miXed/ViCious/pddp/makefile create mode 100644 externals/miXed/ViCious/pddp/objects create mode 100644 externals/miXed/ViCious/pddp/snapfiles create mode 100644 externals/miXed/ViCious/toxy/makefile create mode 100644 externals/miXed/ViCious/toxy/objects create mode 100644 externals/miXed/ViCious/toxy/snapfiles create mode 100644 externals/miXed/bin/Clip-help.pd create mode 100644 externals/miXed/bin/Clip~-help.pd create mode 100644 externals/miXed/bin/Line~-help.pd create mode 100644 externals/miXed/bin/Scope~-help.pd create mode 100644 externals/miXed/bin/Snapshot~-help.pd create mode 100644 externals/miXed/bin/Table-help.pd create mode 100644 externals/miXed/bin/notes.txt create mode 100755 externals/miXed/bin/pddp/pddpboot.tcl create mode 100644 externals/miXed/bin/pddp/pddpclient.tcl create mode 100644 externals/miXed/bin/pddp/pddpserver.tcl create mode 100644 externals/miXed/bin/pddp/pkgIndex.tcl create mode 100644 externals/miXed/cyclone/Makefile create mode 100644 externals/miXed/cyclone/Makefile.dirs create mode 100644 externals/miXed/cyclone/Makefile.libdir create mode 100644 externals/miXed/cyclone/Makefile.objects create mode 100644 externals/miXed/cyclone/Makefile.sources create mode 100644 externals/miXed/cyclone/README.txt create mode 100644 externals/miXed/cyclone/build_counter create mode 100644 externals/miXed/cyclone/cyclone-all.exclude create mode 100644 externals/miXed/cyclone/cyclone-help.include create mode 100644 externals/miXed/cyclone/cyclone-meta.pd create mode 100644 externals/miXed/cyclone/cyclone-shared.include create mode 100644 externals/miXed/cyclone/cyclone-test.exclude create mode 100644 externals/miXed/cyclone/cyclone-vicious.exclude create mode 100644 externals/miXed/cyclone/hammer/Append.c create mode 100644 externals/miXed/cyclone/hammer/Borax.c create mode 100644 externals/miXed/cyclone/hammer/Bucket.c create mode 100644 externals/miXed/cyclone/hammer/Clip.c create mode 100644 externals/miXed/cyclone/hammer/Decode.c create mode 100644 externals/miXed/cyclone/hammer/Histo.c create mode 100644 externals/miXed/cyclone/hammer/Makefile create mode 100644 externals/miXed/cyclone/hammer/Makefile.objects create mode 100644 externals/miXed/cyclone/hammer/Makefile.sources create mode 100644 externals/miXed/cyclone/hammer/MouseState.c create mode 100644 externals/miXed/cyclone/hammer/Peak.c create mode 100644 externals/miXed/cyclone/hammer/Table.c create mode 100644 externals/miXed/cyclone/hammer/TogEdge.c create mode 100644 externals/miXed/cyclone/hammer/Trough.c create mode 100644 externals/miXed/cyclone/hammer/Uzi.c create mode 100644 externals/miXed/cyclone/hammer/accum.c create mode 100644 externals/miXed/cyclone/hammer/acos.c create mode 100644 externals/miXed/cyclone/hammer/active.c create mode 100644 externals/miXed/cyclone/hammer/allhammers.c create mode 100644 externals/miXed/cyclone/hammer/anal.c create mode 100644 externals/miXed/cyclone/hammer/asin.c create mode 100644 externals/miXed/cyclone/hammer/atodb.c create mode 100644 externals/miXed/cyclone/hammer/bangbang.c create mode 100644 externals/miXed/cyclone/hammer/bondo.c create mode 100644 externals/miXed/cyclone/hammer/buddy.c create mode 100644 externals/miXed/cyclone/hammer/capture.c create mode 100644 externals/miXed/cyclone/hammer/cartopol.c create mode 100644 externals/miXed/cyclone/hammer/coll.c create mode 100644 externals/miXed/cyclone/hammer/comment.c create mode 100644 externals/miXed/cyclone/hammer/cosh.c create mode 100644 externals/miXed/cyclone/hammer/counter.c create mode 100644 externals/miXed/cyclone/hammer/cycle.c create mode 100644 externals/miXed/cyclone/hammer/dbtoa.c create mode 100644 externals/miXed/cyclone/hammer/decide.c create mode 100644 externals/miXed/cyclone/hammer/drunk.c create mode 100644 externals/miXed/cyclone/hammer/flush.c create mode 100644 externals/miXed/cyclone/hammer/forward.c create mode 100644 externals/miXed/cyclone/hammer/fromsymbol.c create mode 100644 externals/miXed/cyclone/hammer/funbuff.c create mode 100644 externals/miXed/cyclone/hammer/funnel.c create mode 100644 externals/miXed/cyclone/hammer/gate.c create mode 100644 externals/miXed/cyclone/hammer/grab.c create mode 100644 externals/miXed/cyclone/hammer/hammer.c create mode 100644 externals/miXed/cyclone/hammer/iter.c create mode 100644 externals/miXed/cyclone/hammer/loadmess.c create mode 100644 externals/miXed/cyclone/hammer/match.c create mode 100644 externals/miXed/cyclone/hammer/maximum.c create mode 100644 externals/miXed/cyclone/hammer/mean.c create mode 100644 externals/miXed/cyclone/hammer/midiflush.c create mode 100644 externals/miXed/cyclone/hammer/midiformat.c create mode 100644 externals/miXed/cyclone/hammer/midiparse.c create mode 100644 externals/miXed/cyclone/hammer/minimum.c create mode 100644 externals/miXed/cyclone/hammer/mousefilter.c create mode 100644 externals/miXed/cyclone/hammer/mtr.c create mode 100644 externals/miXed/cyclone/hammer/next.c create mode 100644 externals/miXed/cyclone/hammer/offer.c create mode 100644 externals/miXed/cyclone/hammer/onebang.c create mode 100644 externals/miXed/cyclone/hammer/past.c create mode 100644 externals/miXed/cyclone/hammer/pd-lib-notes.txt create mode 100644 externals/miXed/cyclone/hammer/poltocar.c create mode 100644 externals/miXed/cyclone/hammer/pong.c create mode 100644 externals/miXed/cyclone/hammer/prepend.c create mode 100644 externals/miXed/cyclone/hammer/prob.c create mode 100644 externals/miXed/cyclone/hammer/pv.c create mode 100644 externals/miXed/cyclone/hammer/round.c create mode 100644 externals/miXed/cyclone/hammer/seq.c create mode 100644 externals/miXed/cyclone/hammer/sinh.c create mode 100644 externals/miXed/cyclone/hammer/speedlim.c create mode 100644 externals/miXed/cyclone/hammer/spell.c create mode 100644 externals/miXed/cyclone/hammer/split.c create mode 100644 externals/miXed/cyclone/hammer/spray.c create mode 100644 externals/miXed/cyclone/hammer/sprintf.c create mode 100644 externals/miXed/cyclone/hammer/substitute.c create mode 100644 externals/miXed/cyclone/hammer/sustain.c create mode 100644 externals/miXed/cyclone/hammer/switch.c create mode 100644 externals/miXed/cyclone/hammer/tanh.c create mode 100644 externals/miXed/cyclone/hammer/testmess.c create mode 100644 externals/miXed/cyclone/hammer/thresh.c create mode 100644 externals/miXed/cyclone/hammer/tosymbol.c create mode 100644 externals/miXed/cyclone/hammer/universal.c create mode 100644 externals/miXed/cyclone/hammer/urn.c create mode 100644 externals/miXed/cyclone/hammer/xbendin.c create mode 100644 externals/miXed/cyclone/hammer/xbendin2.c create mode 100644 externals/miXed/cyclone/hammer/xbendout.c create mode 100644 externals/miXed/cyclone/hammer/xbendout2.c create mode 100644 externals/miXed/cyclone/hammer/xnotein.c create mode 100644 externals/miXed/cyclone/hammer/xnoteout.c create mode 100644 externals/miXed/cyclone/hammer/zl.c create mode 100644 externals/miXed/cyclone/notes.txt create mode 100644 externals/miXed/cyclone/shadow/Makefile create mode 100644 externals/miXed/cyclone/shadow/Makefile.objects create mode 100644 externals/miXed/cyclone/shadow/Makefile.sources create mode 100644 externals/miXed/cyclone/shadow/cyclone.c create mode 100644 externals/miXed/cyclone/shadow/dummies.c create mode 100644 externals/miXed/cyclone/shadow/maxmode.c create mode 100644 externals/miXed/cyclone/shadow/nettles.c create mode 100644 externals/miXed/cyclone/shadow/shadow.h create mode 100644 externals/miXed/cyclone/sickle/Clip.c create mode 100644 externals/miXed/cyclone/sickle/Line.c create mode 100644 externals/miXed/cyclone/sickle/Makefile create mode 100644 externals/miXed/cyclone/sickle/Makefile.objects create mode 100644 externals/miXed/cyclone/sickle/Makefile.sources create mode 100644 externals/miXed/cyclone/sickle/Scope.c create mode 100644 externals/miXed/cyclone/sickle/Scope.c.old create mode 100644 externals/miXed/cyclone/sickle/Snapshot.c create mode 100644 externals/miXed/cyclone/sickle/abs.c create mode 100644 externals/miXed/cyclone/sickle/acos.c create mode 100644 externals/miXed/cyclone/sickle/acosh.c create mode 100644 externals/miXed/cyclone/sickle/allpass.c create mode 100644 externals/miXed/cyclone/sickle/allsickles.c create mode 100644 externals/miXed/cyclone/sickle/asin.c create mode 100644 externals/miXed/cyclone/sickle/asinh.c create mode 100644 externals/miXed/cyclone/sickle/atan.c create mode 100644 externals/miXed/cyclone/sickle/atan2.c create mode 100644 externals/miXed/cyclone/sickle/atanh.c create mode 100644 externals/miXed/cyclone/sickle/atodb.c create mode 100644 externals/miXed/cyclone/sickle/average.c create mode 100644 externals/miXed/cyclone/sickle/avg.c create mode 100644 externals/miXed/cyclone/sickle/bitand.c create mode 100644 externals/miXed/cyclone/sickle/bitnot.c create mode 100644 externals/miXed/cyclone/sickle/bitor.c create mode 100644 externals/miXed/cyclone/sickle/bitshift.c create mode 100644 externals/miXed/cyclone/sickle/bitxor.c create mode 100644 externals/miXed/cyclone/sickle/buffir.c create mode 100644 externals/miXed/cyclone/sickle/capture.c create mode 100644 externals/miXed/cyclone/sickle/cartopol.c create mode 100644 externals/miXed/cyclone/sickle/change.c create mode 100644 externals/miXed/cyclone/sickle/click.c create mode 100644 externals/miXed/cyclone/sickle/comb.c create mode 100644 externals/miXed/cyclone/sickle/cosh.c create mode 100644 externals/miXed/cyclone/sickle/cosx.c create mode 100644 externals/miXed/cyclone/sickle/count.c create mode 100644 externals/miXed/cyclone/sickle/curve.c create mode 100644 externals/miXed/cyclone/sickle/curve.gp create mode 100644 externals/miXed/cyclone/sickle/cycle.c create mode 100644 externals/miXed/cyclone/sickle/dbtoa.c create mode 100644 externals/miXed/cyclone/sickle/delay.c create mode 100644 externals/miXed/cyclone/sickle/delta.c create mode 100644 externals/miXed/cyclone/sickle/deltaclip.c create mode 100644 externals/miXed/cyclone/sickle/edge.c create mode 100644 externals/miXed/cyclone/sickle/frameaccum.c create mode 100644 externals/miXed/cyclone/sickle/framedelta.c create mode 100644 externals/miXed/cyclone/sickle/index.c create mode 100644 externals/miXed/cyclone/sickle/kink.c create mode 100644 externals/miXed/cyclone/sickle/linedrive.c create mode 100644 externals/miXed/cyclone/sickle/log.c create mode 100644 externals/miXed/cyclone/sickle/lookup.c create mode 100644 externals/miXed/cyclone/sickle/lores.c create mode 100644 externals/miXed/cyclone/sickle/matrix.c create mode 100644 externals/miXed/cyclone/sickle/maximum.c create mode 100644 externals/miXed/cyclone/sickle/minimum.c create mode 100644 externals/miXed/cyclone/sickle/minmax.c create mode 100644 externals/miXed/cyclone/sickle/mstosamps.c create mode 100644 externals/miXed/cyclone/sickle/onepole.c create mode 100644 externals/miXed/cyclone/sickle/overdrive.c create mode 100644 externals/miXed/cyclone/sickle/peakamp.c create mode 100644 externals/miXed/cyclone/sickle/peek.c create mode 100644 externals/miXed/cyclone/sickle/phasewrap.c create mode 100644 externals/miXed/cyclone/sickle/pink.c create mode 100644 externals/miXed/cyclone/sickle/play.c create mode 100644 externals/miXed/cyclone/sickle/poke.c create mode 100644 externals/miXed/cyclone/sickle/poltocar.c create mode 100644 externals/miXed/cyclone/sickle/pong.c create mode 100644 externals/miXed/cyclone/sickle/pow.c create mode 100644 externals/miXed/cyclone/sickle/rampsmooth.c create mode 100644 externals/miXed/cyclone/sickle/rand.c create mode 100644 externals/miXed/cyclone/sickle/record.c create mode 100644 externals/miXed/cyclone/sickle/reson.c create mode 100644 externals/miXed/cyclone/sickle/round.c create mode 100644 externals/miXed/cyclone/sickle/sah.c create mode 100644 externals/miXed/cyclone/sickle/sampstoms.c create mode 100644 externals/miXed/cyclone/sickle/sickle.c create mode 100644 externals/miXed/cyclone/sickle/sinh.c create mode 100644 externals/miXed/cyclone/sickle/sinx.c create mode 100644 externals/miXed/cyclone/sickle/slide.c create mode 100644 externals/miXed/cyclone/sickle/spike.c create mode 100644 externals/miXed/cyclone/sickle/svf.c create mode 100644 externals/miXed/cyclone/sickle/tanh.c create mode 100644 externals/miXed/cyclone/sickle/tanx.c create mode 100644 externals/miXed/cyclone/sickle/train.c create mode 100644 externals/miXed/cyclone/sickle/trapezoid.c create mode 100644 externals/miXed/cyclone/sickle/triangle.c create mode 100644 externals/miXed/cyclone/sickle/trunc.c create mode 100644 externals/miXed/cyclone/sickle/vectral.c create mode 100644 externals/miXed/cyclone/sickle/wave.c create mode 100644 externals/miXed/cyclone/sickle/zerox.c create mode 100644 externals/miXed/doc/help/cyclone/Borax-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Bucket-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Clip-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Clip~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Decode-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Histo-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Line~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/MouseState-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Peak-help.pd create mode 100644 externals/miXed/doc/help/cyclone/README create mode 100644 externals/miXed/doc/help/cyclone/Scope~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Snapshot~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/TODO create mode 100644 externals/miXed/doc/help/cyclone/Table-help.pd create mode 100644 externals/miXed/doc/help/cyclone/TogEdge-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Trough-help.pd create mode 100644 externals/miXed/doc/help/cyclone/Uzi-help.pd create mode 100644 externals/miXed/doc/help/cyclone/accum-help.pd create mode 100644 externals/miXed/doc/help/cyclone/acos-help.pd create mode 100644 externals/miXed/doc/help/cyclone/acosh~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/acos~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/active-help.pd create mode 100644 externals/miXed/doc/help/cyclone/all_about_cyclone.pd create mode 100644 externals/miXed/doc/help/cyclone/allpass~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/anal-help.pd create mode 100644 externals/miXed/doc/help/cyclone/asin-help.pd create mode 100644 externals/miXed/doc/help/cyclone/asinh-help.pd create mode 100644 externals/miXed/doc/help/cyclone/asin~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/atan2~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/atanh~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/atan~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/atodb-help.pd create mode 100644 externals/miXed/doc/help/cyclone/atodb~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/average~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/avg~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/bangbang-help.pd create mode 100644 externals/miXed/doc/help/cyclone/bitand~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/bitnot~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/bitor~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/bitshift~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/bitxor~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/bondo-help.pd create mode 100644 externals/miXed/doc/help/cyclone/buddy-help.pd create mode 100644 externals/miXed/doc/help/cyclone/buffir~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/capture-help.pd create mode 100644 externals/miXed/doc/help/cyclone/capture~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/cartopol-help.pd create mode 100644 externals/miXed/doc/help/cyclone/cartopol~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/change~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/click~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/coll-help.pd create mode 100644 externals/miXed/doc/help/cyclone/coll.txt create mode 100644 externals/miXed/doc/help/cyclone/comb~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/cosh-help.pd create mode 100644 externals/miXed/doc/help/cyclone/cosh~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/cosx~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/counter-help.pd create mode 100644 externals/miXed/doc/help/cyclone/count~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/curve~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/cycle-help.pd create mode 100644 externals/miXed/doc/help/cyclone/cycle~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/dbtoa-help.pd create mode 100644 externals/miXed/doc/help/cyclone/dbtoa~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/decide-help.pd create mode 100644 externals/miXed/doc/help/cyclone/delay~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/deltaclip~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/delta~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/drunk-help.pd create mode 100644 externals/miXed/doc/help/cyclone/edge~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/flush-help.pd create mode 100644 externals/miXed/doc/help/cyclone/forward-help.pd create mode 100644 externals/miXed/doc/help/cyclone/frameaccum~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/framedelta~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/fromsymbol-help.pd create mode 100644 externals/miXed/doc/help/cyclone/funbuff-help.pd create mode 100644 externals/miXed/doc/help/cyclone/funnel-help.pd create mode 100644 externals/miXed/doc/help/cyclone/gate-help.pd create mode 100644 externals/miXed/doc/help/cyclone/grab-help.pd create mode 100644 externals/miXed/doc/help/cyclone/index~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/iter-help.pd create mode 100644 externals/miXed/doc/help/cyclone/kink~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/linedrive-help.pd create mode 100644 externals/miXed/doc/help/cyclone/loadmess-help.pd create mode 100644 externals/miXed/doc/help/cyclone/lookup~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/lores~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/match-help.pd create mode 100644 externals/miXed/doc/help/cyclone/matrix~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/maximum-help.pd create mode 100644 externals/miXed/doc/help/cyclone/maximum~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/maxmode-help.pd create mode 100644 externals/miXed/doc/help/cyclone/mean-help.pd create mode 100644 externals/miXed/doc/help/cyclone/midiflush-help.pd create mode 100644 externals/miXed/doc/help/cyclone/midiformat-help.pd create mode 100644 externals/miXed/doc/help/cyclone/midiparse-help.pd create mode 100644 externals/miXed/doc/help/cyclone/minimum-help.pd create mode 100644 externals/miXed/doc/help/cyclone/minimum~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/minmax~-help.pd.pd create mode 100644 externals/miXed/doc/help/cyclone/mousefilter-help.pd create mode 100644 externals/miXed/doc/help/cyclone/mstosamps~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/mtr-help.pd create mode 100644 externals/miXed/doc/help/cyclone/next-help.pd create mode 100644 externals/miXed/doc/help/cyclone/offer-help.pd create mode 100644 externals/miXed/doc/help/cyclone/onebang-help.pd create mode 100644 externals/miXed/doc/help/cyclone/onepole~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/overdrive~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/past-help.pd create mode 100644 externals/miXed/doc/help/cyclone/peakamp~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/peek~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/phasewrap~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/pink~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/play~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/poke~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/poltocar-help.pd create mode 100644 externals/miXed/doc/help/cyclone/poltocar~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/pong-help.pd create mode 100644 externals/miXed/doc/help/cyclone/pong~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/pow~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/prepend-help.pd create mode 100644 externals/miXed/doc/help/cyclone/prepend.pd create mode 100644 externals/miXed/doc/help/cyclone/prob-help.pd create mode 100644 externals/miXed/doc/help/cyclone/pv-help.pd create mode 100644 externals/miXed/doc/help/cyclone/rampsmooth~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/rand~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/record~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/reson~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/round-help.pd create mode 100644 externals/miXed/doc/help/cyclone/round~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/sah~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/sampstoms~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/seq-help.pd create mode 100644 externals/miXed/doc/help/cyclone/sinh-help.pd create mode 100644 externals/miXed/doc/help/cyclone/sinh~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/sinx~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/slide~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/speedlim-help.pd create mode 100644 externals/miXed/doc/help/cyclone/spell-help.pd create mode 100644 externals/miXed/doc/help/cyclone/spike~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/split-help.pd create mode 100644 externals/miXed/doc/help/cyclone/spray-help.pd create mode 100644 externals/miXed/doc/help/cyclone/sprintf-help.pd create mode 100644 externals/miXed/doc/help/cyclone/substitute-help.pd create mode 100644 externals/miXed/doc/help/cyclone/sustain-help.pd create mode 100644 externals/miXed/doc/help/cyclone/svf~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/switch-help.pd create mode 100644 externals/miXed/doc/help/cyclone/tanh-help.pd create mode 100644 externals/miXed/doc/help/cyclone/tanh~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/tanx~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/test.mid create mode 100644 externals/miXed/doc/help/cyclone/testmess-help.pd create mode 100644 externals/miXed/doc/help/cyclone/thresh-help.pd create mode 100644 externals/miXed/doc/help/cyclone/tosymbol-help.pd create mode 100644 externals/miXed/doc/help/cyclone/train~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/trapezoid~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/triangle~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/trunc~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/universal-help.pd create mode 100644 externals/miXed/doc/help/cyclone/urn-help.pd create mode 100644 externals/miXed/doc/help/cyclone/vectral~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/wave~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/xbendin-help.pd create mode 100644 externals/miXed/doc/help/cyclone/xbendin2-help.pd create mode 100644 externals/miXed/doc/help/cyclone/xbendout-help.pd create mode 100644 externals/miXed/doc/help/cyclone/xbendout2-help.pd create mode 100644 externals/miXed/doc/help/cyclone/xnotein-help.pd create mode 100644 externals/miXed/doc/help/cyclone/xnoteout-help.pd create mode 100644 externals/miXed/doc/help/cyclone/zerox~-help.pd create mode 100644 externals/miXed/doc/help/cyclone/zl-help.pd create mode 100644 externals/miXed/doc/help/toxy/tot-help.pd create mode 100644 externals/miXed/doc/src/Makefile create mode 100644 externals/miXed/doc/src/Makefile.dirs create mode 100644 externals/miXed/doc/src/externs/keepme create mode 100755 externals/miXed/dumpsetups create mode 100644 externals/miXed/pddp/Makefile create mode 100644 externals/miXed/pddp/Makefile.objects create mode 100644 externals/miXed/pddp/Makefile.sources create mode 100644 externals/miXed/pddp/build_counter create mode 100644 externals/miXed/pddp/notes.txt create mode 100644 externals/miXed/pddp/pddp-all.exclude create mode 100644 externals/miXed/pddp/pddp-help.include create mode 100644 externals/miXed/pddp/pddp-shared.include create mode 100644 externals/miXed/pddp/pddp-test.exclude create mode 100644 externals/miXed/pddp/pddp-vicious.exclude create mode 100644 externals/miXed/pddp/pddplink.c create mode 100644 externals/miXed/riddle/rdremote.c create mode 100644 externals/miXed/riddle/riddle.c create mode 100644 externals/miXed/riddle/riddle.h create mode 100644 externals/miXed/riddle/riddleguts.h create mode 100644 externals/miXed/shared/Makefile create mode 100644 externals/miXed/shared/Makefile.dirs create mode 100644 externals/miXed/shared/Makefile.objects create mode 100644 externals/miXed/shared/Makefile.sources create mode 100644 externals/miXed/shared/common/Makefile create mode 100644 externals/miXed/shared/common/Makefile.objects create mode 100644 externals/miXed/shared/common/Makefile.sources create mode 100644 externals/miXed/shared/common/binport.c create mode 100644 externals/miXed/shared/common/binport.h create mode 100644 externals/miXed/shared/common/clc.c create mode 100644 externals/miXed/shared/common/clc.h create mode 100644 externals/miXed/shared/common/dict.c create mode 100644 externals/miXed/shared/common/dict.h create mode 100644 externals/miXed/shared/common/fitter.c create mode 100644 externals/miXed/shared/common/fitter.h create mode 100644 externals/miXed/shared/common/grow.c create mode 100644 externals/miXed/shared/common/grow.h create mode 100644 externals/miXed/shared/common/lex.c create mode 100644 externals/miXed/shared/common/lex.h create mode 100644 externals/miXed/shared/common/loud.c create mode 100644 externals/miXed/shared/common/loud.h create mode 100644 externals/miXed/shared/common/messtree.c create mode 100644 externals/miXed/shared/common/messtree.h create mode 100644 externals/miXed/shared/common/mifi.c create mode 100644 externals/miXed/shared/common/mifi.h create mode 100644 externals/miXed/shared/common/os.c create mode 100644 externals/miXed/shared/common/os.h create mode 100644 externals/miXed/shared/common/patchvalue.c create mode 100644 externals/miXed/shared/common/patchvalue.h create mode 100644 externals/miXed/shared/common/port.c create mode 100644 externals/miXed/shared/common/port.h create mode 100644 externals/miXed/shared/common/props.c create mode 100644 externals/miXed/shared/common/props.h create mode 100644 externals/miXed/shared/common/qtree.c create mode 100644 externals/miXed/shared/common/qtree.h create mode 100644 externals/miXed/shared/common/rand.c create mode 100644 externals/miXed/shared/common/rand.h create mode 100644 externals/miXed/shared/common/vefl.c create mode 100644 externals/miXed/shared/common/vefl.h create mode 100644 externals/miXed/shared/getridof.baddeps create mode 100644 externals/miXed/shared/hammer/Makefile create mode 100644 externals/miXed/shared/hammer/Makefile.objects create mode 100644 externals/miXed/shared/hammer/Makefile.sources create mode 100644 externals/miXed/shared/hammer/file.c create mode 100644 externals/miXed/shared/hammer/file.h create mode 100644 externals/miXed/shared/hammer/gui.c create mode 100644 externals/miXed/shared/hammer/gui.h create mode 100644 externals/miXed/shared/hammer/tree.c create mode 100644 externals/miXed/shared/hammer/tree.h create mode 100644 externals/miXed/shared/notes.txt create mode 100644 externals/miXed/shared/shared.c create mode 100644 externals/miXed/shared/shared.h create mode 100644 externals/miXed/shared/sickle/Makefile create mode 100644 externals/miXed/shared/sickle/Makefile.objects create mode 100644 externals/miXed/shared/sickle/Makefile.sources create mode 100644 externals/miXed/shared/sickle/arsic.c create mode 100644 externals/miXed/shared/sickle/arsic.h create mode 100644 externals/miXed/shared/sickle/sic.c create mode 100644 externals/miXed/shared/sickle/sic.h create mode 100644 externals/miXed/shared/toxy/Makefile create mode 100644 externals/miXed/shared/toxy/Makefile.objects create mode 100644 externals/miXed/shared/toxy/Makefile.sources create mode 100644 externals/miXed/shared/toxy/plusbob.c create mode 100644 externals/miXed/shared/toxy/plusbob.h create mode 100644 externals/miXed/shared/toxy/scriptlet.c create mode 100644 externals/miXed/shared/toxy/scriptlet.h create mode 100644 externals/miXed/shared/unstable/Makefile create mode 100644 externals/miXed/shared/unstable/Makefile.objects create mode 100644 externals/miXed/shared/unstable/Makefile.sources create mode 100644 externals/miXed/shared/unstable/forky.c create mode 100644 externals/miXed/shared/unstable/forky.h create mode 100644 externals/miXed/shared/unstable/fragile.c create mode 100644 externals/miXed/shared/unstable/fragile.h create mode 100644 externals/miXed/shared/unstable/fringe.c create mode 100644 externals/miXed/shared/unstable/fringe.h create mode 100644 externals/miXed/shared/unstable/loader.c create mode 100644 externals/miXed/shared/unstable/loader.h create mode 100644 externals/miXed/shared/unstable/pd_imp.h create mode 100644 externals/miXed/shared/unstable/standalone.c create mode 100644 externals/miXed/shared/unstable/standalone.h create mode 100644 externals/miXed/test/cyclone/Borax-test.pd create mode 100644 externals/miXed/test/cyclone/Bucket-test.pd create mode 100644 externals/miXed/test/cyclone/Decode-test.pd create mode 100644 externals/miXed/test/cyclone/Histo-test.pd create mode 100644 externals/miXed/test/cyclone/MouseState-test.pd create mode 100644 externals/miXed/test/cyclone/Table-test.pd create mode 100644 externals/miXed/test/cyclone/TogEdge-test.pd create mode 100644 externals/miXed/test/cyclone/Uzi-test.pd create mode 100644 externals/miXed/test/cyclone/a-mix2.pd create mode 100644 externals/miXed/test/cyclone/active-test.pd create mode 100644 externals/miXed/test/cyclone/anal-test.pd create mode 100644 externals/miXed/test/cyclone/append-test.pd create mode 100644 externals/miXed/test/cyclone/bad.coll create mode 100644 externals/miXed/test/cyclone/bondo-test.pd create mode 100644 externals/miXed/test/cyclone/buddy-test.pd create mode 100644 externals/miXed/test/cyclone/buffir-test.pd create mode 100644 externals/miXed/test/cyclone/capture-test.pd create mode 100644 externals/miXed/test/cyclone/click-test.pd create mode 100644 externals/miXed/test/cyclone/clip-test.pd create mode 100644 externals/miXed/test/cyclone/coll-print.pd create mode 100644 externals/miXed/test/cyclone/coll-test.pd create mode 100644 externals/miXed/test/cyclone/comb-test.pd create mode 100644 externals/miXed/test/cyclone/comment-dotest.pd create mode 100644 externals/miXed/test/cyclone/comment-ogonki.pd create mode 100644 externals/miXed/test/cyclone/comment-test.pd create mode 100644 externals/miXed/test/cyclone/count-test.pd create mode 100644 externals/miXed/test/cyclone/counter-test.pd create mode 100644 externals/miXed/test/cyclone/curve-test.pd create mode 100644 externals/miXed/test/cyclone/cycle-test.pd create mode 100644 externals/miXed/test/cyclone/cyclone-test.pd create mode 100644 externals/miXed/test/cyclone/decide-test.pd create mode 100644 externals/miXed/test/cyclone/drunk-test.pd create mode 100644 externals/miXed/test/cyclone/forward-test.pd create mode 100644 externals/miXed/test/cyclone/frameaccum-test.pd create mode 100644 externals/miXed/test/cyclone/fromsymbol-test.pd create mode 100644 externals/miXed/test/cyclone/funbuff-etest.pd create mode 100644 externals/miXed/test/cyclone/funbuff-test.pd create mode 100644 externals/miXed/test/cyclone/funnel-test.pd create mode 100644 externals/miXed/test/cyclone/gate-test.pd create mode 100644 externals/miXed/test/cyclone/good.coll create mode 100644 externals/miXed/test/cyclone/grab-test.pd create mode 100644 externals/miXed/test/cyclone/index-test.pd create mode 100644 externals/miXed/test/cyclone/kanon.mid create mode 100644 externals/miXed/test/cyclone/kink-test.pd create mode 100644 externals/miXed/test/cyclone/line-test.pd create mode 100644 externals/miXed/test/cyclone/linedrive-test.pd create mode 100644 externals/miXed/test/cyclone/lores-test.pd create mode 100644 externals/miXed/test/cyclone/match-reentrant.pd create mode 100644 externals/miXed/test/cyclone/match-test.pd create mode 100644 externals/miXed/test/cyclone/matrix-test.pd create mode 100644 externals/miXed/test/cyclone/maxmin-test.pd create mode 100644 externals/miXed/test/cyclone/maxmode-test.pd create mode 100644 externals/miXed/test/cyclone/mean-test.pd create mode 100644 externals/miXed/test/cyclone/midi-test.pd create mode 100644 externals/miXed/test/cyclone/midiparse-test.pd create mode 100644 externals/miXed/test/cyclone/mousefilter-test.pd create mode 100644 externals/miXed/test/cyclone/mstosamps-test.pd create mode 100644 externals/miXed/test/cyclone/mtr-test.pd create mode 100644 externals/miXed/test/cyclone/next-test.pd create mode 100644 externals/miXed/test/cyclone/offer-test.pd create mode 100644 externals/miXed/test/cyclone/onebang-test.pd create mode 100644 externals/miXed/test/cyclone/onepole-test.pd create mode 100644 externals/miXed/test/cyclone/past-test.pd create mode 100644 externals/miXed/test/cyclone/peakamp-test.pd create mode 100644 externals/miXed/test/cyclone/peek-test.pd create mode 100644 externals/miXed/test/cyclone/pink-test.pd create mode 100644 externals/miXed/test/cyclone/poke-test.pd create mode 100644 externals/miXed/test/cyclone/pong-test.pd create mode 100644 externals/miXed/test/cyclone/prepend-test.pd create mode 100644 externals/miXed/test/cyclone/prob-test.pd create mode 100644 externals/miXed/test/cyclone/pv-test.pd create mode 100644 externals/miXed/test/cyclone/rand-test.pd create mode 100644 externals/miXed/test/cyclone/record-sync-test.pd create mode 100644 externals/miXed/test/cyclone/record-test.pd create mode 100644 externals/miXed/test/cyclone/reson-test.pd create mode 100644 externals/miXed/test/cyclone/scope-gop.pd create mode 100644 externals/miXed/test/cyclone/scope-test.pd create mode 100644 externals/miXed/test/cyclone/scope-test1.pd create mode 100644 externals/miXed/test/cyclone/scope-test2.pd create mode 100644 externals/miXed/test/cyclone/seq-test.pd create mode 100644 externals/miXed/test/cyclone/sigbits-test.pd create mode 100644 externals/miXed/test/cyclone/sigcapture-test.pd create mode 100644 externals/miXed/test/cyclone/sigcycle-test.pd create mode 100644 externals/miXed/test/cyclone/sigmeters-test.pd create mode 100644 externals/miXed/test/cyclone/sigops-test.pd create mode 100644 externals/miXed/test/cyclone/sigsmoothers-test.pd create mode 100644 externals/miXed/test/cyclone/sigtrig-test.pd create mode 100644 externals/miXed/test/cyclone/sigwrappers-speed.pd create mode 100644 externals/miXed/test/cyclone/sigwrappers-speed20.pd create mode 100644 externals/miXed/test/cyclone/sigwrappers-test.pd create mode 100644 externals/miXed/test/cyclone/spectrum-pm.pd create mode 100644 externals/miXed/test/cyclone/speedlim-rescheduling.pd create mode 100644 externals/miXed/test/cyclone/speedlim-test.pd create mode 100644 externals/miXed/test/cyclone/spell-test.pd create mode 100644 externals/miXed/test/cyclone/spike-test.pd create mode 100644 externals/miXed/test/cyclone/split-test.pd create mode 100644 externals/miXed/test/cyclone/spray-test.pd create mode 100644 externals/miXed/test/cyclone/substitute-test.pd create mode 100644 externals/miXed/test/cyclone/svf-test.pd create mode 100644 externals/miXed/test/cyclone/switch-test.pd create mode 100644 externals/miXed/test/cyclone/test.capture create mode 100644 externals/miXed/test/cyclone/test.funbuff create mode 100644 externals/miXed/test/cyclone/test.mid create mode 100644 externals/miXed/test/cyclone/test.pool create mode 100644 externals/miXed/test/cyclone/test.seq create mode 100644 externals/miXed/test/cyclone/test1.seq create mode 100644 externals/miXed/test/cyclone/testmess-reentrant.pd create mode 100644 externals/miXed/test/cyclone/testmess-test.pd create mode 100644 externals/miXed/test/cyclone/thresh-test.pd create mode 100644 externals/miXed/test/cyclone/tosymbol-test.pd create mode 100644 externals/miXed/test/cyclone/train-test.pd create mode 100644 externals/miXed/test/cyclone/trig-test.pd create mode 100644 externals/miXed/test/cyclone/universal-test.pd create mode 100644 externals/miXed/test/cyclone/urn-test.pd create mode 100644 externals/miXed/test/cyclone/vectral-test.pd create mode 100644 externals/miXed/test/cyclone/xbend-test.pd create mode 100644 externals/miXed/test/cyclone/xnote-test.pd create mode 100644 externals/miXed/test/cyclone/zerox-test.pd create mode 100644 externals/miXed/test/cyclone/zl-test.pd create mode 100644 externals/miXed/test/pddp/pddp.css create mode 100644 externals/miXed/test/pddp/pddplink-test-01.html create mode 100644 externals/miXed/test/pddp/pddplink-test-01.pd create mode 100644 externals/miXed/test/pddp/pddplink-test-01.xml create mode 100644 externals/miXed/test/pddp/pddplink-test-02.html create mode 100644 externals/miXed/test/pddp/pddplink-test-02.pd create mode 100644 externals/miXed/test/pddp/pddplink-test-02.xml create mode 100644 externals/miXed/test/pddp/test.bg.jpg create mode 100755 externals/miXed/test/pddp/toonepage create mode 100755 externals/miXed/test/pddp/topdf create mode 100644 externals/miXed/test/toxy/button-test.pd create mode 100644 externals/miXed/test/toxy/defaults-test.pd create mode 100644 externals/miXed/test/toxy/editors/bpf-test.pd create mode 100644 externals/miXed/test/toxy/editors/bpf.wid create mode 100644 externals/miXed/test/toxy/kb-test.pd create mode 100644 externals/miXed/test/toxy/kb.wid create mode 100644 externals/miXed/test/toxy/lbpict-test.pd create mode 100644 externals/miXed/test/toxy/lbpict.wid create mode 100644 externals/miXed/test/toxy/listbox-test.pd create mode 100644 externals/miXed/test/toxy/multiscale-test.pd create mode 100644 externals/miXed/test/toxy/multiscale.wid create mode 100644 externals/miXed/test/toxy/pop1.wid create mode 100644 externals/miXed/test/toxy/pop2.wid create mode 100644 externals/miXed/test/toxy/popcustom-test.pd create mode 100644 externals/miXed/test/toxy/popup-test.pd create mode 100644 externals/miXed/test/toxy/radio-test.pd create mode 100644 externals/miXed/test/toxy/scale-test.pd create mode 100644 externals/miXed/test/toxy/setup.wid create mode 100644 externals/miXed/test/toxy/stress/bulk.pd create mode 100644 externals/miXed/test/toxy/stress/bulkyhurd.pd create mode 100644 externals/miXed/test/toxy/stress/catchme.pd create mode 100644 externals/miXed/test/toxy/stress/mstots.pd create mode 100644 externals/miXed/test/toxy/stress/nbulkyhurds.pd create mode 100644 externals/miXed/test/toxy/stress/pophurd.pd create mode 100644 externals/miXed/test/toxy/tclversion.pd create mode 100644 externals/miXed/test/toxy/test.wid create mode 100644 externals/miXed/test/toxy/test1.tot create mode 100644 externals/miXed/test/toxy/testmess-test.pd create mode 100644 externals/miXed/test/toxy/testmess.wid create mode 100644 externals/miXed/test/toxy/tot-color.pd create mode 100644 externals/miXed/test/toxy/tot-cover.pd create mode 100644 externals/miXed/test/toxy/tot-files.pd create mode 100644 externals/miXed/test/toxy/tot-head.pd create mode 100644 externals/miXed/test/toxy/tot-monkey.pd create mode 100644 externals/miXed/test/toxy/tot-nomenu.pd create mode 100644 externals/miXed/test/toxy/tot-qlist.pd create mode 100644 externals/miXed/test/toxy/tot-query.pd create mode 100644 externals/miXed/test/toxy/tot-rstring.pd create mode 100644 externals/miXed/test/toxy/tot.ql create mode 100644 externals/miXed/test/toxy/tow-test.pd create mode 100644 externals/miXed/test/toxy/txt-test.pd create mode 100644 externals/miXed/test/toxy/txt.wid create mode 100644 externals/miXed/toxy/Makefile create mode 100644 externals/miXed/toxy/Makefile.objects create mode 100644 externals/miXed/toxy/Makefile.sources create mode 100644 externals/miXed/toxy/build_counter create mode 100644 externals/miXed/toxy/notes.txt create mode 100644 externals/miXed/toxy/plustot.ar.c create mode 100644 externals/miXed/toxy/plustot.c create mode 100644 externals/miXed/toxy/plustot.env.c create mode 100644 externals/miXed/toxy/plustot.h create mode 100644 externals/miXed/toxy/plustot.in.c create mode 100644 externals/miXed/toxy/plustot.out.c create mode 100644 externals/miXed/toxy/plustot.print.c create mode 100644 externals/miXed/toxy/plustot.qlist.c create mode 100644 externals/miXed/toxy/plustot.var.c create mode 100644 externals/miXed/toxy/pluswidget.c create mode 100644 externals/miXed/toxy/setup.wiq create mode 100644 externals/miXed/toxy/tot.c create mode 100644 externals/miXed/toxy/tow.c create mode 100644 externals/miXed/toxy/toxy-all.exclude create mode 100644 externals/miXed/toxy/toxy-help.include create mode 100644 externals/miXed/toxy/toxy-shared.include create mode 100644 externals/miXed/toxy/toxy-test.exclude create mode 100644 externals/miXed/toxy/toxy-vicious.exclude create mode 100644 externals/miXed/toxy/widget.c create mode 100644 externals/miXed/toxy/widget.h create mode 100644 externals/miXed/toxy/widgethandlers.c create mode 100644 externals/miXed/toxy/widgettype.c diff --git a/externals/miXed/LICENSE.txt b/externals/miXed/LICENSE.txt new file mode 100644 index 000000000..a56a51eb5 --- /dev/null +++ b/externals/miXed/LICENSE.txt @@ -0,0 +1,30 @@ +This software is copyrighted by Miller Puckette and others. The following +terms (the "Standard Improved BSD License") apply to all files associated with +the software unless explicitly disclaimed in individual files: + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. +3. The name of the author may not be used to endorse or promote + products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. diff --git a/externals/miXed/Makefile b/externals/miXed/Makefile new file mode 100644 index 000000000..9cd39ec82 --- /dev/null +++ b/externals/miXed/Makefile @@ -0,0 +1,46 @@ +include Makefile.dirs + +all: + @for i in $(MIXED_DIRS) ; \ + do ( if [ -d $$i ] ; then cd $$i; $(MAKE) ; fi ) ; done + @if [ -d doc/src ] ; then cd doc/src ; $(MAKE) ; fi + +clean cleanall: + @for i in $(MIXED_DIRS) ; \ + do ( if [ -d $$i ] ; then cd $$i; $(MAKE) $@ ; fi ) ; done + rm -f *.gz + +diff depend emptydeps: + @for i in $(MIXED_DIRS) ; \ + do ( if [ -d $$i ] ; then cd $$i; $(MAKE) $@ ; fi ) ; done + +ALLSRC_TAR = release/miXed-`date +%F`-src.tar +ALLSRC_ROOTFILES = LICENSE.txt Makefile.common Makefile Makefile.dirs \ + dumpsetups + +snap release: + @for i in $(RELEASE_DIRS) ; \ + do ( if [ -d $$i ] ; then cd $$i; $(MAKE) $@ ; fi ) ; done + +rootsnap: + tar -cf $(ALLSRC_TAR) $(ALLSRC_ROOTFILES) + @for i in $(RELEASE_DIRS) ; \ + do ( if [ -d $$i ] ; then tar -X $$i/$$i-all.exclude -rf \ + $(ALLSRC_TAR) $$i/* ; fi ) ; done + tar -X shared/shared-all.exclude -rf $(ALLSRC_TAR) shared/* + @for i in $(RELEASE_DIRS) ; \ + do ( if [ -d $$i ] ; then tar -X $$i/$$i-test.exclude -rf \ + $(ALLSRC_TAR) test/$$i/* ; fi ) ; done + @for i in $(RELEASE_DIRS) ; \ + do ( if [ -d $$i ] ; then tar -T $$i/$$i-help.include -rf \ + $(ALLSRC_TAR) ; fi ) ; done + @for i in $(RELEASE_DIRS) ; \ + do ( if [ -d $$i ] ; then tar -X $$i/$$i-vicious.exclude -rf \ + $(ALLSRC_TAR) ViCious/$$i/* ; fi ) ; done + tar -rf $(ALLSRC_TAR) bin/notes.txt + gzip -f $(ALLSRC_TAR) + +fullsnap: snap rootsnap + +backup: + tar -X miXed-bak-exclude.files -zcf miXed-bak.tar.gz * diff --git a/externals/miXed/Makefile.common b/externals/miXed/Makefile.common new file mode 100644 index 000000000..c8dcdc241 --- /dev/null +++ b/externals/miXed/Makefile.common @@ -0,0 +1,432 @@ +# next line has to be edited manually +PD_DIR ?= $(ROOT_DIR)/../../pd/src + +OS_NAME = $(shell uname -s) +ifneq ($(OS_NAME),Linux) +ifneq ($(OS_NAME),Darwin) +ifeq (,$(findstring MinGW,$(OS_NAME))) +ifeq (,$(findstring MINGW,$(OS_NAME))) +$(error Fatal error: unknown environment "$(OS_NAME)". Aborting...) +else +OS_NAME = MinGW +endif +else +OS_NAME = MinGW +endif +endif +endif + +MY_NAME = $(shell id -un) + +# remove this restriction LATER, when TCL_LIB is ./configured +ifeq ($(MY_NAME),krzYszcz) +# TCL_LIB should be set (or not) before "include Makefile.sources" +TCL_LIB = -l$(shell grep -osm1 'tcl8\.[345]' $(PD_DIR)/makefile) +endif + +TILDE = ~ + +-include Makefile.dirs +include Makefile.sources +include Makefile.objects + +default: define_build all + +ifeq ($(OS_NAME),Linux) +X_SUFFIX = pd_linux +CC = gcc +LFLAGS = -Wl,--export-dynamic -shared +# FIXME strict-aliasing +OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing -fPIC +ifeq ($(MY_NAME),krzYszcz) +DEFINES = -DUNIX -DKRZYSZCZ +else +DEFINES = -DUNIX +endif +endif + +# FIXME test if it actually works +ifeq ($(OS_NAME),MinGW) +CC = gcc +X_SUFFIX = dll +# OPT_CFLAGS gets overridden in Pd-extended builds for optimization +# flags, so stick -mms-bitfieds here so that it doesn't get overridden +DEFINES = -mms-bitfields -DNT -DMSW +OPT_CFLAGS = -funroll-loops +LFLAGS = -shared -L$(PD_DIR) -L$(PD_DIR)/../bin/ -lpd +endif + +ifeq ($(OS_NAME),Darwin) +CC = gcc +X_SUFFIX = pd_darwin +DEFINES = -DUNIX -DMACOSX +OPT_CFLAGS = -O2 -funroll-loops -fomit-frame-pointer +# perhaps "-undefined suppress" would be a better choice, when we go dynamic +# with our own common code? (not likely to happen soon...) +LFLAGS = -bundle -bundle_loader $(PD_DIR)/../bin/pd -flat_namespace +endif + +SHARED_DIR = $(ROOT_DIR)/shared +OBJ_DIR = . +BIN_DIR = $(ROOT_DIR)/bin +OUT_DIR = $(if $($1_SUBDIR),$(BIN_DIR)/$($1_SUBDIR),$(BIN_DIR)) + +# for current versions, $(BASE_DIR) equals $(BASE_NAME), for prior versions, +# $(BASE_DIR) equals $(BASE_NAME)-$(VERSION) +BASE_DIR = $(shell basename `pwd`) +BASE_NAME = $(shell basename `pwd` | awk -F - '{print $$1}') + +INCLUDES = -I . -I $(PD_DIR) -I $(SHARED_DIR) + +ifdef CAML_TYPES +include $(ROOT_DIR)/Makefile.caml +endif + +# CX: control external's main file +# AX: audio (tilde) external's main file +# LX: alias external's main file +# (if alias external is tilde-only, use OTHER_SOURCES and AX_CLASSES) + +CX_NAMES = $(notdir $(CX_SOURCES)) +AX_NAMES = $(notdir $(AX_SOURCES)) +TYPES_NAMES = $(notdir $($1_SOURCES)) + +ifdef LX_SOURCES +LX_NAMES = $(subst _,.,$(notdir $(LX_SOURCES))) +LX_CLASSES = $(LX_NAMES:.c=) +endif + +CX_DIR = $(dir $(firstword $(CX_SOURCES))) +AX_DIR = $(dir $(firstword $(AX_SOURCES))) +TYPES_DIR = $(dir $(firstword $($1_SOURCES))) + +TYPES_EXTERNS = \ + $(patsubst %.c,%$($1_TILDE).$(X_SUFFIX),$(call TYPES_NAMES,$1)) + +SOURCES = $(CX_SOURCES) $(AX_SOURCES) $(LX_SOURCES) $(OTHER_SOURCES) \ + $(foreach type,$(TYPES),$($(type)_SOURCES)) \ + $(foreach type,$(TYPES),$($(type)_PRIVATEOBJECTS:.o=.c)) + +ifeq ($(MY_NAME),krzYszcz) +WARN_CFLAGS = -Wall -W -Wstrict-prototypes -Werror \ + -Wno-unused -Wno-parentheses -Wno-switch +else +WARN_CFLAGS = -Wall -W -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch +endif + +DBG_CFLAGS = +CFLAGS = $(WARN_CFLAGS) $(OPT_CFLAGS) $(DEFINES) $(INCLUDES) + +EXTERNS = $(foreach fn,$(CX_NAMES:.c=.$(X_SUFFIX)),$(BIN_DIR)/$(fn)) \ + $(foreach fn,$(AX_NAMES:.c=~.$(X_SUFFIX)),$(BIN_DIR)/$(fn)) \ + $(foreach fn,$(CX_CLASSES:=.$(X_SUFFIX)),$(BIN_DIR)/$(fn)) \ + $(foreach fn,$(AX_CLASSES:=~.$(X_SUFFIX)),$(BIN_DIR)/$(fn)) \ + $(foreach fn,$(LX_CLASSES:=.$(X_SUFFIX)),$(BIN_DIR)/$(fn)) \ + $(if $(LX_STUBCLASS),$(BIN_DIR)/$(LX_STUBCLASS:=.$(X_SUFFIX))) \ + $(foreach type,$(TYPES),\ + $(foreach fn,$(call TYPES_EXTERNS,$(type)), \ + $(call OUT_DIR,$(type))/$(fn))) + +TYPES_RULE = $(foreach fn,$(call TYPES_EXTERNS,$1),$(call OUT_DIR,$1)/$(fn)): \ + $(call OUT_DIR,$1)/%$($1_TILDE).$(X_SUFFIX) \ + : $(call TYPES_DIR,$1)%.o \ + $($1_PRIVATEOBJECTS) $($1_FOREIGNOBJECTS) \ + $(foreach obj,$($1_OBJECTS),$(SHARED_DIR)/$(obj)) \ + ; $(CC) -o $$@ $(CFLAGS) $(LFLAGS) $$+ $($1_LIBS) + +# LATER find a better way... +$(if $(word 1,$(TYPES)),$(call TYPES_RULE,$(word 1,$(TYPES)))) +$(if $(word 2,$(TYPES)),$(call TYPES_RULE,$(word 2,$(TYPES)))) +$(if $(word 3,$(TYPES)),$(call TYPES_RULE,$(word 3,$(TYPES)))) +$(if $(word 4,$(TYPES)),$(call TYPES_RULE,$(word 4,$(TYPES)))) +$(if $(word 5,$(TYPES)),$(call TYPES_RULE,$(word 5,$(TYPES)))) +$(if $(word 6,$(TYPES)),$(call TYPES_RULE,$(word 6,$(TYPES)))) +$(if $(word 7,$(TYPES)),$(call TYPES_RULE,$(word 7,$(TYPES)))) +$(if $(word 8,$(TYPES)),$(call TYPES_RULE,$(word 8,$(TYPES)))) +$(if $(word 9,$(TYPES)),$(call TYPES_RULE,$(word 9,$(TYPES)))) +$(if $(word 10,$(TYPES)),$(call TYPES_RULE,$(word 10,$(TYPES)))) +$(if $(word 11,$(TYPES)),$(call TYPES_RULE,$(word 11,$(TYPES)))) +$(if $(word 12,$(TYPES)),$(call TYPES_RULE,$(word 12,$(TYPES)))) +$(if $(word 13,$(TYPES)),$(call TYPES_RULE,$(word 13,$(TYPES)))) +$(if $(word 14,$(TYPES)),$(call TYPES_RULE,$(word 14,$(TYPES)))) +$(if $(word 15,$(TYPES)),$(call TYPES_RULE,$(word 15,$(TYPES)))) +$(if $(word 16,$(TYPES)),$(call TYPES_RULE,$(word 16,$(TYPES)))) +$(if $(word 17,$(TYPES)),$(call TYPES_RULE,$(word 17,$(TYPES)))) +$(if $(word 18,$(TYPES)),$(call TYPES_RULE,$(word 18,$(TYPES)))) +$(if $(word 19,$(TYPES)),$(call TYPES_RULE,$(word 19,$(TYPES)))) +$(if $(word 20,$(TYPES)),$(call TYPES_RULE,$(word 20,$(TYPES)))) +$(if $(word 21,$(TYPES)),$(call TYPES_RULE,$(word 21,$(TYPES)))) +$(if $(word 22,$(TYPES)),$(call TYPES_RULE,$(word 22,$(TYPES)))) +$(if $(word 23,$(TYPES)),$(call TYPES_RULE,$(word 23,$(TYPES)))) +$(if $(word 24,$(TYPES)),$(call TYPES_RULE,$(word 24,$(TYPES)))) +$(if $(word 25,$(TYPES)),$(call TYPES_RULE,$(word 25,$(TYPES)))) +$(if $(word 26,$(TYPES)),$(call TYPES_RULE,$(word 26,$(TYPES)))) +$(if $(word 27,$(TYPES)),$(call TYPES_RULE,$(word 27,$(TYPES)))) +$(if $(word 28,$(TYPES)),$(call TYPES_RULE,$(word 28,$(TYPES)))) +$(if $(word 29,$(TYPES)),$(call TYPES_RULE,$(word 29,$(TYPES)))) +$(if $(word 30,$(TYPES)),$(call TYPES_RULE,$(word 30,$(TYPES)))) +$(if $(word 31,$(TYPES)),$(call TYPES_RULE,$(word 31,$(TYPES)))) +$(if $(word 32,$(TYPES)),$(call TYPES_RULE,$(word 32,$(TYPES)))) + +SHOBJECTS = $(foreach fn,$(SHARED_OBJECTS),$(SHARED_DIR)/$(fn)) +LXSHOBJECTS = $(foreach fn,$(LXSHARED_OBJECTS),$(SHARED_DIR)/$(fn)) + +OBJECTS = $(foreach fn,$(OTHER_SOURCES:.c=.o),$(OBJ_DIR)/$(fn)) \ + $(foreach fn,$(LX_SOURCES:.c=.o),$(OBJ_DIR)/$(fn)) \ + $(SHOBJECTS) + +# lame... +.PRECIOUS: %.o + +# library stub equals $(BASE_NAME) by default, otherwise +# it has to be declared explicitly in $(BASE_DIR)/Makefile.sources +ifdef LX_STUBCLASS +$(BIN_DIR)/$(LX_STUBCLASS).$(X_SUFFIX): $(BASE_NAME)_loader.c $(LXSHOBJECTS) + $(CC) -o $@ -Xlinker -defsym \ + -Xlinker $(LX_STUBCLASS)_setup=$(BASE_NAME)_loader_setup \ + $(CFLAGS) $(LFLAGS) $(LXSHOBJECTS) $< +ifndef LX_STUB +LX_STUB = $(LX_STUBCLASS) +endif +else +ifndef LX_STUB +LX_STUB = $(BASE_NAME) +endif +endif + +# rules for aliases must precede generic extern rules + +$(BIN_DIR)/$(LX_STUB).%~.$(X_SUFFIX): $(BASE_NAME)_loader.c $(LXSHOBJECTS) + $(CC) -o $@ -Xlinker -defsym \ + -Xlinker $(LX_STUB).$(*F)_tilde_setup=$(BASE_NAME)_loader_setup \ + $(CFLAGS) $(LFLAGS) $(LXSHOBJECTS) $< + +$(BIN_DIR)/$(LX_STUB).%.$(X_SUFFIX): $(BASE_NAME)_loader.c $(LXSHOBJECTS) + $(CC) -o $@ -Xlinker -defsym \ + -Xlinker $(LX_STUB).$(*F)_setup=$(BASE_NAME)_loader_setup \ + $(CFLAGS) $(LFLAGS) $(LXSHOBJECTS) $< + +# generic rule for audio externals +$(BIN_DIR)/%~.$(X_SUFFIX): $(AX_DIR)%.c $(OBJECTS) + $(CC) -o $@ $(CFLAGS) $(LFLAGS) $(OBJECTS) $< + +# generic rule for control externals +$(BIN_DIR)/%.$(X_SUFFIX): $(CX_DIR)%.c $(OBJECTS) + $(CC) -o $@ $(CFLAGS) $(LFLAGS) $(OBJECTS) $< + +SUBDIRS = @for i in $(MIXED_DIRS) and_in_case_it_is_null ; \ + do ( if [ -d $$i ] ; then \ + cd $$i; $(MAKE) $@ ; fi ) ; done + +SUBDIRS_DEFAULT = @for i in $(MIXED_DIRS) and_in_case_it_is_null ; \ + do ( if [ -d $$i ] ; then \ + cd $$i; $(MAKE) ; fi ) ; done + +define_build: + @if [ -f build_counter ] && [ `id -un` = krzYszcz ] && \ + [ `date -r build_counter +%j` != `date +%j` ] ; then \ + mv build_counter build_counter~ ; \ + echo -n 'increment build counter (y/n)? [n]' ; read doit ; \ + if [ $$doit ] && [ $$doit == 'y' ] ; then \ + head -3 build_counter~ | \ + awk '{if (index($$2,"BUILD")) print $$1, $$2, $$3+1; else print}' \ + > build_temporary ; \ + cat build_temporary | \ + awk 'BEGIN {printf "\n#if 0\n"; \ + printf toupper("$(BASE_NAME)_SNAPSHOT = ")} \ + {gsub("\"","",$$3); printf $$3; if (NR==1) printf "-"} \ + END {printf "\n#endif\n" }' | \ + cat build_temporary - > build_counter ; \ + rm -f build_temporary ; \ + else cat build_counter~ > build_counter ; fi \ + fi + +all$(BASE_NAME)s.c: Makefile.sources + $(ROOT_DIR)/dumpsetups > $@ + +all: $(EXTERNS) + $(SUBDIRS_DEFAULT) + +clean:: emptydeps +# remove all objects and externs that are contained in current directory + -rm -f *.o *.$(X_SUFFIX) + $(SUBDIRS) + +cleanall: clean +# remove default target externs + -rm -f $(EXTERNS) + $(SUBDIRS) +# added by Hans-Christoph Steiner <hans@eds.org> to remove +# files created when making MacOS X packages + -rm -Rf ../installroot + +OLDROOT_DIR = $(shell ls -d -1 ../../Mixed-* | tail -1) + +diff: + @echo -n > diff.out ; \ + for f in {*.h,*.c} ; do \ + if [ -f $$f ] ; then \ + diff -u $(OLDROOT_DIR)/$(BASE_DIR)/$$f $$f >> diff.out ; \ + fi \ + done + +VERSION = $(shell awk \ + '{if (index($$2,"VERSION")) print substr($$3,2,length($$3)-2)}' \ + build_counter) +RELEASE = $(shell awk \ + '{if (index($$2,"RELEASE")) print substr($$3,2,length($$3)-2)}' \ + build_counter) +BUILD = $(shell awk '{if (index($$2,"BUILD")) print $$3}' build_counter) + +RELEASE_STUB = release/$(BASE_NAME)-$(VERSION)-$(RELEASE)$(BUILD) +SRC_TAR = $(RELEASE_STUB)-src.tar +BIN_TAR = $(RELEASE_STUB)-bin.tar +LIB_TAR = $(RELEASE_STUB)-lib.tar +DOC_TAR = $(RELEASE_STUB)-doc.tar +ALL_TAR = $(RELEASE_STUB)-all.tar +REL_BINDIR = bin + +REL_LIBNAMES = $(foreach fn,$(RELEASE_LIBS:=.$(X_SUFFIX)),$(REL_BINDIR)/$(fn)) + +REL_EXTERNS = $(foreach fn,$(CX_NAMES:.c=.$(X_SUFFIX)),$(REL_BINDIR)/$(fn)) \ + $(foreach fn,$(AX_NAMES:.c=~.$(X_SUFFIX)),$(REL_BINDIR)/$(fn)) \ + $(foreach fn,$(CX_CLASSES:=.$(X_SUFFIX)),$(REL_BINDIR)/$(fn)) \ + $(foreach fn,$(AX_CLASSES:=~.$(X_SUFFIX)),$(REL_BINDIR)/$(fn)) \ + $(foreach fn,$(LX_CLASSES:=.$(X_SUFFIX)),$(REL_BINDIR)/$(fn)) \ + $(if $(LX_STUBCLASS),$(REL_BINDIR)/$(LX_STUBCLASS:=.$(X_SUFFIX))) \ + $(REL_LIBNAMES) $(foreach fn,$(RELEASE_APPS),$(REL_BINDIR)/$(fn)) \ + $(foreach type,$(TYPES),\ + $(foreach fn,$(call TYPES_EXTERNS,$(type)),$(REL_BINDIR)/$(fn))) + +REL_ROOTSRC = LICENSE.txt Makefile.common dumpsetups + +srelease: emptydeps define_build + cd $(ROOT_DIR)/shared; $(MAKE) emptydeps + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-all.exclude -cf \ + $(SRC_TAR) $(BASE_DIR)/* $(REL_ROOTSRC) + cd $(ROOT_DIR); tar -T $(BASE_DIR)/$(BASE_NAME)-shared.include -rf \ + $(SRC_TAR) + cd $(ROOT_DIR); gzip -f $(SRC_TAR) + +stestrelease: emptydeps define_build + cd $(ROOT_DIR)/shared; $(MAKE) emptydeps + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-all.exclude -cf \ + $(SRC_TAR) $(BASE_DIR)/* $(REL_ROOTSRC) + cd $(ROOT_DIR); tar -T $(BASE_DIR)/$(BASE_NAME)-shared.include -rf \ + $(SRC_TAR) + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-test.exclude -rf \ + $(SRC_TAR) test/$(BASE_NAME)/* + cd $(ROOT_DIR); tar -T $(BASE_DIR)/$(BASE_NAME)-help.include -rf \ + $(SRC_TAR) + cd $(ROOT_DIR); tar -rf $(SRC_TAR) bin/notes.txt + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-vicious.exclude -rf \ + $(SRC_TAR) ViCious/$(BASE_DIR)/* + cd $(ROOT_DIR); gzip -f $(SRC_TAR) + +brelease: define_build + cd $(ROOT_DIR); tar zcf \ + $(BIN_TAR).gz $(REL_EXTERNS) + +btestrelease: define_build + cd $(ROOT_DIR); tar -cf $(BIN_TAR) $(REL_EXTERNS) + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-test.exclude -rf \ + $(BIN_TAR) test/$(BASE_NAME)/* + cd $(ROOT_DIR); tar -T $(BASE_DIR)/$(BASE_NAME)-help.include -rf \ + $(BIN_TAR) + cd $(ROOT_DIR); gzip -f $(BIN_TAR) + +rellibs: + cd $(ROOT_DIR); tar zcf \ + $(LIB_TAR).gz $(REL_LIBNAMES) + +drelease: define_build + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-doc.exclude -zcf \ + $(DOC_TAR).gz doc/examples/$(BASE_NAME)/* + +release: srelease brelease drelease + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-all.exclude -cf \ + $(ALL_TAR) $(BASE_DIR)/* $(REL_ROOTSRC) $(REL_EXTERNS) + cd $(ROOT_DIR); tar -T $(BASE_DIR)/$(BASE_NAME)-shared.include -rf \ + $(ALL_TAR) + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-doc.exclude -rf \ + $(ALL_TAR) doc/examples/$(BASE_NAME)/* + cd $(ROOT_DIR); gzip -f $(ALL_TAR) + +testrelease: stestrelease btestrelease + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-all.exclude -cf \ + $(ALL_TAR) $(BASE_DIR)/* $(REL_ROOTSRC) $(REL_EXTERNS) + cd $(ROOT_DIR); tar -T $(BASE_DIR)/$(BASE_NAME)-shared.include -rf \ + $(ALL_TAR) + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-test.exclude -rf \ + $(ALL_TAR) test/$(BASE_NAME)/* + cd $(ROOT_DIR); tar -T $(BASE_DIR)/$(BASE_NAME)-help.include -rf \ + $(ALL_TAR) + cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-vicious.exclude -rf \ + $(ALL_TAR) ViCious/$(BASE_DIR)/* + cd $(ROOT_DIR); gzip -f $(ALL_TAR) + +snap: emptyalldeps stestrelease btestrelease + +depend: + $(CC) $(CFLAGS) -M $(SOURCES) > Makefile.deps + $(SUBDIRS) + +emptydeps: + -rm -f Makefile.deps + touch Makefile.deps + chmod 666 Makefile.deps + +emptyalldeps: emptydeps + $(SUBDIRS) + +Makefile.deps: + touch Makefile.deps + chmod 666 Makefile.deps + +-include Makefile.deps + +# added by Hans-Christoph Steiner <hans@eds.org> +# to generate MacOS X packages + +# krzYszcz: +# LATER try making cyclone-specifics abstracted out ala linux release +# keep cyclone libs, because they offer the max->pd import facility + +PACKAGE_PREFIX = pd-mixed +PACKAGE_NAME = $(PACKAGE_PREFIX)-$(VERSION)-$(RELEASE)$(BUILD) + +darwin_pkg_license: + # generate HTML version of License + echo "<HTML><BODY><FONT SIZE="-1">" > License.html + cat $(ROOT_DIR)/LICENSE.txt | sed -e 's/^$$/\<P\>/g' >> License.html + echo "</FONT></BODY></HTML>" >> License.html + +darwin_pkg_clean: + -sudo rm -Rf installroot/ pd-*.pkg/ + -rm -f $(PACKAGE_PREFIX)-*.info *~ 1 License.html + +# install into MSP's default: /usr/local/lib + +darwin_pkg: darwin_pkg_clean darwin_pkg_license +# compile externals +# cd $(ROOT_DIR)/toxy && make + cd $(ROOT_DIR)/cyclone && make +# set up installroot dir + test -d installroot/lib/pd/doc/5.reference || mkdir -p installroot/lib/pd/doc/5.reference + cp $(ROOT_DIR)/test/cyclone/*.* $(ROOT_DIR)/test/toxy/*.* \ + installroot/lib/pd/doc/5.reference + test -d installroot/lib/pd/extra || mkdir -p installroot/lib/pd/extra + install -m444 $(ROOT_DIR)/bin/*.pd_darwin installroot/lib/pd/extra + test -d installroot/bin || mkdir -p installroot/bin + install -m555 $(ROOT_DIR)/bin/cyclist installroot/bin + cp -f pd-cyclone.info $(PACKAGE_NAME).info +# delete cruft + -find installroot -name .DS_Store -delete + -rm -f 1 +# set proper permissions + sudo chown -R root:staff installroot + package installroot $(PACKAGE_NAME).info -d . -ignoreDSStore +# install pkg docs + install -m 644 License.html Welcome.html $(PACKAGE_NAME).pkg/Contents/Resources + sudo chown -R root:staff $(PACKAGE_NAME).pkg/Contents/Resources diff --git a/externals/miXed/Makefile.dirs b/externals/miXed/Makefile.dirs new file mode 100644 index 000000000..e1a5d3139 --- /dev/null +++ b/externals/miXed/Makefile.dirs @@ -0,0 +1,10 @@ +MIXED_DIRS = \ + shared \ + cyclone \ + toxy \ + pddp + +RELEASE_DIRS = \ + cyclone \ + toxy \ + pddp diff --git a/externals/miXed/SConscript b/externals/miXed/SConscript new file mode 100644 index 000000000..9aef4b9ee --- /dev/null +++ b/externals/miXed/SConscript @@ -0,0 +1,52 @@ +import glob +import os +import re +Import('env prefix') + +#voodoo escaping, anyone got it? !!... +os.system("cd toxy && make checkwiq && make setup.wiq") + +env.Append(CPPPATH = 'shared') + +miXed_shared = glob.glob('shared/common/*.c') +miXed_shared.extend(Split('shared/unstable/fringe.c shared/unstable/forky.c shared/unstable/fragile.c shared/unstable/loader.c')) +hammer_shared = glob.glob('shared/hammer/*.c') +sickle_shared = glob.glob('shared/sickle/*.c') + +hammer_source = glob.glob('cyclone/hammer/*.c') +hammer_src = [miXed_shared, hammer_shared, hammer_source] +hammer = env.SharedLibrary(target = 'hammer', source = hammer_src) +env.Alias('install', env.Install(os.path.join(prefix, 'extra'), hammer)) +Default(hammer) + +sickle_source = glob.glob('cyclone/sickle/*.c') +sickle_src = [hammer_shared, miXed_shared, sickle_shared, sickle_source] +sickle = env.SharedLibrary(target = 'sickle', source = sickle_src) +env.Alias('install', env.Install(os.path.join(prefix, 'extra'), sickle)) +Default(sickle) + +for hammer_extra in hammer_source: + if (hammer_extra != 'cyclone/hammer/hammer.c'): + src = [hammer_extra,miXed_shared,hammer_shared] + external = env.SharedLibrary(target = re.sub("\.c$","",os.path.basename(hammer_extra)), source = src) + env.Alias('install', env.Install(os.path.join(prefix, 'extra'), external)) + Default(external) + +for sickle_extra in sickle_source: + if (sickle_extra != 'cyclone/sickle/sickle.c'): + target = re.sub("\.c$","",os.path.basename(sickle_extra)) + "~" + src = [sickle_extra,sickle_shared,miXed_shared,hammer_shared] + external = env.SharedLibrary(target = target, source = src) + env.Alias('install', env.Install(os.path.join(prefix, 'extra'), external)) + Default(external) + +toxy_src = glob.glob('shared/toxy/*.c') +for toxy_extra in Split('tot plustot tow widget'): + toxy_source = "toxy/" + toxy_extra + ".c" + src = [toxy_src,toxy_source,'toxy/widgettype.c','toxy/widgethandlers.c',miXed_shared,hammer_shared] + external = env.SharedLibrary(toxy_extra, src) + env.Alias('install', env.Install(os.path.join(prefix, 'extra'), external)) + Default(external) + +env.Alias('install', env.Install(os.path.join(prefix, 'extra'), glob.glob('test/toxy/*.wid'))) +env.Alias('install', env.Install(os.path.join(prefix, 'doc/miXed/'), glob.glob('doc/help/*/*.pd'))) diff --git a/externals/miXed/ViCious/cyclone/makefile b/externals/miXed/ViCious/cyclone/makefile new file mode 100644 index 000000000..fad65b073 --- /dev/null +++ b/externals/miXed/ViCious/cyclone/makefile @@ -0,0 +1,87 @@ +current: cyclone + +.SUFFIXES: .dll .obj + +ROOTDIR = ..\..\.. +SRCDIR = $(ROOTDIR)\miXed\cyclone +BINDIR = $(ROOTDIR)\miXed\bin +SHAREDDIR = $(ROOTDIR)\miXed\shared +EXTDIR = e:\PureData\externals +PDDIR = e:\PureData\pd +VCLIBDIR = "e:\Program Files\Microsoft Visual Studio\Vc98\lib" +ZIPCOMMAND = d:\dosowe\arc\info-zip\zip + +INCLUDES = /I. /I$(SHAREDDIR) /I$(PDDIR)\src +CFLAGS = /O2 /W3 /WX /DNT /DMSW /DPD /nologo + +LIBS = $(VCLIBDIR)\libc.lib \ + $(VCLIBDIR)\oldnames.lib \ + $(VCLIBDIR)\wsock32.lib \ + $(VCLIBDIR)\kernel32.lib \ + $(VCLIBDIR)\uuid.lib \ + $(PDDIR)\bin\pd.lib + +!INCLUDE objects +!INCLUDE snapfiles +!INCLUDE $(SRCDIR)\build_counter + +cyclone: cyclone.dll hammer.dll sickle.dll dummies.dll maxmode.dll cyclist.exe + @cd $(ROOTDIR) + @$(ZIPCOMMAND) cyclone-$(CYCLONE_SNAPSHOT)-dll.zip $(SNAPFILES) + +cyclone.dll: $(CYCLONE_OBJECTS) + -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) + -@copy $@ $(EXTDIR) + -@move $@ $(BINDIR) + -del $(@:.dll=.exp) + -del $(@:.dll=.lib) + +hammer.dll: $(HAMMER_OBJECTS) + -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) + -@copy $@ $(EXTDIR) + -@move $@ $(BINDIR) + -del $(@:.dll=.exp) + -del $(@:.dll=.lib) + +sickle.dll: $(SICKLE_OBJECTS) + -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) + -@copy $@ $(EXTDIR) + -@move $@ $(BINDIR) + -del $(@:.dll=.exp) + -del $(@:.dll=.lib) + +dummies.dll: $(DUMMIES_OBJECTS) + -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) + -@copy $@ $(EXTDIR) + -@move $@ $(BINDIR) + -del $(@:.dll=.exp) + -del $(@:.dll=.lib) + +maxmode.dll: $(MAXMODE_OBJECTS) + -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) + -@copy $@ $(EXTDIR) + -@move $@ $(BINDIR) + -del $(@:.dll=.exp) + -del $(@:.dll=.lib) + +cyclist.exe: $(SHAREDDIR)\common\binport.c \ + $(SHAREDDIR)\common\lex.c $(SHAREDDIR)\unstable\standalone.c + -del /S $(SHAREDDIR)\common\binport.obj \ + $(SHAREDDIR)\common\lex.obj $(SHAREDDIR)\unstable\standalone.obj + -cl $(CFLAGS) $(INCLUDES) /DMIXED_STANDALONE /o $@ \ + $(VCLIBDIR)\libc.lib $(SHAREDDIR)\common\binport.c \ + $(SHAREDDIR)\common\lex.c $(SHAREDDIR)\unstable\standalone.c + -@move $@ $(BINDIR) + -del /S binport.obj lex.obj standalone.obj + +.c.obj: ; cl /c $(CFLAGS) $(INCLUDES) /Fo$*.obj $*.c + +clean: + for %1 in (hammer shadow sickle) \ + do del %1\*.obj + for %1 in (hammer shadow sickle) \ + do del %1\*.exp + for %1 in (hammer shadow sickle) \ + do del %1\*.lib + for %1 in (hammer shadow sickle) \ + do del %1\*.dll diff --git a/externals/miXed/ViCious/cyclone/objects b/externals/miXed/ViCious/cyclone/objects new file mode 100644 index 000000000..66c21dbfc --- /dev/null +++ b/externals/miXed/ViCious/cyclone/objects @@ -0,0 +1,239 @@ +CYCLONE_OBJECTS = \ + $(SRCDIR)\shadow\cyclone.obj \ + $(SRCDIR)\shadow\nettles.obj \ + $(SHAREDDIR)\common\loud.obj \ + $(SHAREDDIR)\common\grow.obj \ + $(SHAREDDIR)\common\os.obj \ + $(SHAREDDIR)\common\lex.obj \ + $(SHAREDDIR)\common\binport.obj \ + $(SHAREDDIR)\common\port.obj \ + $(SHAREDDIR)\hammer\file.obj \ + $(SHAREDDIR)\sickle\sic.obj \ + $(SHAREDDIR)\unstable\forky.obj \ + $(SHAREDDIR)\unstable\fragile.obj \ + $(SHAREDDIR)\unstable\fringe.obj \ + $(SHAREDDIR)\unstable\loader.obj + +ALL_HAMMERS = \ + $(SRCDIR)\hammer\testmess.obj \ + $(SRCDIR)\hammer\accum.obj \ + $(SRCDIR)\hammer\acos.obj \ + $(SRCDIR)\hammer\active.obj \ + $(SRCDIR)\hammer\anal.obj \ + $(SRCDIR)\hammer\Append.obj \ + $(SRCDIR)\hammer\asin.obj \ + $(SRCDIR)\hammer\bangbang.obj \ + $(SRCDIR)\hammer\bondo.obj \ + $(SRCDIR)\hammer\Borax.obj \ + $(SRCDIR)\hammer\Bucket.obj \ + $(SRCDIR)\hammer\buddy.obj \ + $(SRCDIR)\hammer\capture.obj \ + $(SRCDIR)\hammer\cartopol.obj \ + $(SRCDIR)\hammer\Clip.obj \ + $(SRCDIR)\hammer\coll.obj \ + $(SRCDIR)\hammer\comment.obj \ + $(SRCDIR)\hammer\cosh.obj \ + $(SRCDIR)\hammer\counter.obj \ + $(SRCDIR)\hammer\cycle.obj \ + $(SRCDIR)\hammer\decide.obj \ + $(SRCDIR)\hammer\Decode.obj \ + $(SRCDIR)\hammer\drunk.obj \ + $(SRCDIR)\hammer\flush.obj \ + $(SRCDIR)\hammer\forward.obj \ + $(SRCDIR)\hammer\fromsymbol.obj \ + $(SRCDIR)\hammer\funbuff.obj \ + $(SRCDIR)\hammer\funnel.obj \ + $(SRCDIR)\hammer\gate.obj \ + $(SRCDIR)\hammer\grab.obj \ + $(SRCDIR)\hammer\Histo.obj \ + $(SRCDIR)\hammer\iter.obj \ + $(SRCDIR)\hammer\match.obj \ + $(SRCDIR)\hammer\maximum.obj \ + $(SRCDIR)\hammer\mean.obj \ + $(SRCDIR)\hammer\midiflush.obj \ + $(SRCDIR)\hammer\midiformat.obj \ + $(SRCDIR)\hammer\midiparse.obj \ + $(SRCDIR)\hammer\minimum.obj \ + $(SRCDIR)\hammer\mousefilter.obj \ + $(SRCDIR)\hammer\MouseState.obj \ + $(SRCDIR)\hammer\mtr.obj \ + $(SRCDIR)\hammer\next.obj \ + $(SRCDIR)\hammer\offer.obj \ + $(SRCDIR)\hammer\onebang.obj \ + $(SRCDIR)\hammer\past.obj \ + $(SRCDIR)\hammer\Peak.obj \ + $(SRCDIR)\hammer\poltocar.obj \ + $(SRCDIR)\hammer\prepend.obj \ + $(SRCDIR)\hammer\prob.obj \ + $(SRCDIR)\hammer\pv.obj \ + $(SRCDIR)\hammer\seq.obj \ + $(SRCDIR)\hammer\sinh.obj \ + $(SRCDIR)\hammer\speedlim.obj \ + $(SRCDIR)\hammer\spell.obj \ + $(SRCDIR)\hammer\split.obj \ + $(SRCDIR)\hammer\spray.obj \ + $(SRCDIR)\hammer\sprintf.obj \ + $(SRCDIR)\hammer\substitute.obj \ + $(SRCDIR)\hammer\sustain.obj \ + $(SRCDIR)\hammer\switch.obj \ + $(SRCDIR)\hammer\Table.obj \ + $(SRCDIR)\hammer\tanh.obj \ + $(SRCDIR)\hammer\thresh.obj \ + $(SRCDIR)\hammer\TogEdge.obj \ + $(SRCDIR)\hammer\tosymbol.obj \ + $(SRCDIR)\hammer\Trough.obj \ + $(SRCDIR)\hammer\universal.obj \ + $(SRCDIR)\hammer\urn.obj \ + $(SRCDIR)\hammer\Uzi.obj \ + $(SRCDIR)\hammer\xbendin.obj \ + $(SRCDIR)\hammer\xbendin2.obj \ + $(SRCDIR)\hammer\xbendout.obj \ + $(SRCDIR)\hammer\xbendout2.obj \ + $(SRCDIR)\hammer\xnotein.obj \ + $(SRCDIR)\hammer\xnoteout.obj \ + $(SRCDIR)\hammer\zl.obj + +HAMMER_OBJECTS = $(ALL_HAMMERS) \ + $(SRCDIR)\hammer\hammer.obj \ + $(SRCDIR)\hammer\allhammers.obj \ + $(SHAREDDIR)\common\loud.obj \ + $(SHAREDDIR)\common\grow.obj \ + $(SHAREDDIR)\common\os.obj \ + $(SHAREDDIR)\common\fitter.obj \ + $(SHAREDDIR)\common\rand.obj \ + $(SHAREDDIR)\common\vefl.obj \ + $(SHAREDDIR)\common\mifi.obj \ + $(SHAREDDIR)\common\lex.obj \ + $(SHAREDDIR)\common\binport.obj \ + $(SHAREDDIR)\common\port.obj \ + $(SHAREDDIR)\hammer\file.obj \ + $(SHAREDDIR)\hammer\gui.obj \ + $(SHAREDDIR)\hammer\tree.obj \ + $(SHAREDDIR)\unstable\forky.obj \ + $(SHAREDDIR)\unstable\fragile.obj \ + $(SHAREDDIR)\unstable\fringe.obj + +ALL_SICKLES = \ + $(SRCDIR)\sickle\abs.obj \ + $(SRCDIR)\sickle\acos.obj \ + $(SRCDIR)\sickle\acosh.obj \ + $(SRCDIR)\sickle\allpass.obj \ + $(SRCDIR)\sickle\asin.obj \ + $(SRCDIR)\sickle\asinh.obj \ + $(SRCDIR)\sickle\atan.obj \ + $(SRCDIR)\sickle\atan2.obj \ + $(SRCDIR)\sickle\atanh.obj \ + $(SRCDIR)\sickle\average.obj \ + $(SRCDIR)\sickle\avg.obj \ + $(SRCDIR)\sickle\bitand.obj \ + $(SRCDIR)\sickle\bitnot.obj \ + $(SRCDIR)\sickle\bitor.obj \ + $(SRCDIR)\sickle\bitshift.obj \ + $(SRCDIR)\sickle\bitxor.obj \ + $(SRCDIR)\sickle\buffir.obj \ + $(SRCDIR)\sickle\capture.obj \ + $(SRCDIR)\sickle\cartopol.obj \ + $(SRCDIR)\sickle\change.obj \ + $(SRCDIR)\sickle\click.obj \ + $(SRCDIR)\sickle\Clip.obj \ + $(SRCDIR)\sickle\comb.obj \ + $(SRCDIR)\sickle\cosh.obj \ + $(SRCDIR)\sickle\cosx.obj \ + $(SRCDIR)\sickle\count.obj \ + $(SRCDIR)\sickle\curve.obj \ + $(SRCDIR)\sickle\cycle.obj \ + $(SRCDIR)\sickle\delay.obj \ + $(SRCDIR)\sickle\delta.obj \ + $(SRCDIR)\sickle\deltaclip.obj \ + $(SRCDIR)\sickle\edge.obj \ + $(SRCDIR)\sickle\frameaccum.obj \ + $(SRCDIR)\sickle\framedelta.obj \ + $(SRCDIR)\sickle\index.obj \ + $(SRCDIR)\sickle\kink.obj \ + $(SRCDIR)\sickle\Line.obj \ + $(SRCDIR)\sickle\linedrive.obj \ + $(SRCDIR)\sickle\log.obj \ + $(SRCDIR)\sickle\lookup.obj \ + $(SRCDIR)\sickle\lores.obj \ + $(SRCDIR)\sickle\matrix.obj \ + $(SRCDIR)\sickle\maximum.obj \ + $(SRCDIR)\sickle\minimum.obj \ + $(SRCDIR)\sickle\minmax.obj \ + $(SRCDIR)\sickle\mstosamps.obj \ + $(SRCDIR)\sickle\onepole.obj \ + $(SRCDIR)\sickle\overdrive.obj \ + $(SRCDIR)\sickle\peakamp.obj \ + $(SRCDIR)\sickle\peek.obj \ + $(SRCDIR)\sickle\phasewrap.obj \ + $(SRCDIR)\sickle\pink.obj \ + $(SRCDIR)\sickle\play.obj \ + $(SRCDIR)\sickle\poke.obj \ + $(SRCDIR)\sickle\poltocar.obj \ + $(SRCDIR)\sickle\pong.obj \ + $(SRCDIR)\sickle\pow.obj \ + $(SRCDIR)\sickle\rand.obj \ + $(SRCDIR)\sickle\rampsmooth.obj \ + $(SRCDIR)\sickle\record.obj \ + $(SRCDIR)\sickle\reson.obj \ + $(SRCDIR)\sickle\sah.obj \ + $(SRCDIR)\sickle\sampstoms.obj \ + $(SRCDIR)\sickle\Scope.obj \ + $(SRCDIR)\sickle\sinh.obj \ + $(SRCDIR)\sickle\sinx.obj \ + $(SRCDIR)\sickle\slide.obj \ + $(SRCDIR)\sickle\Snapshot.obj \ + $(SRCDIR)\sickle\spike.obj \ + $(SRCDIR)\sickle\svf.obj \ + $(SRCDIR)\sickle\tanh.obj \ + $(SRCDIR)\sickle\tanx.obj \ + $(SRCDIR)\sickle\train.obj \ + $(SRCDIR)\sickle\trapezoid.obj \ + $(SRCDIR)\sickle\triangle.obj \ + $(SRCDIR)\sickle\vectral.obj \ + $(SRCDIR)\sickle\wave.obj \ + $(SRCDIR)\sickle\zerox.obj + +SICKLE_OBJECTS = $(ALL_SICKLES) \ + $(SRCDIR)\sickle\sickle.obj \ + $(SRCDIR)\sickle\allsickles.obj \ + $(SHAREDDIR)\common\loud.obj \ + $(SHAREDDIR)\common\grow.obj \ + $(SHAREDDIR)\common\os.obj \ + $(SHAREDDIR)\common\fitter.obj \ + $(SHAREDDIR)\common\vefl.obj \ + $(SHAREDDIR)\common\clc.obj \ + $(SHAREDDIR)\common\lex.obj \ + $(SHAREDDIR)\common\binport.obj \ + $(SHAREDDIR)\common\port.obj \ + $(SHAREDDIR)\hammer\file.obj \ + $(SHAREDDIR)\sickle\sic.obj \ + $(SHAREDDIR)\sickle\arsic.obj \ + $(SHAREDDIR)\unstable\forky.obj \ + $(SHAREDDIR)\unstable\fragile.obj \ + $(SHAREDDIR)\unstable\fringe.obj + +DUMMIES_OBJECTS = \ + $(SRCDIR)\shadow\dummies.obj \ + $(SHAREDDIR)\common\loud.obj \ + $(SHAREDDIR)\common\grow.obj \ + $(SHAREDDIR)\common\lex.obj \ + $(SHAREDDIR)\common\binport.obj \ + $(SHAREDDIR)\common\port.obj \ + $(SHAREDDIR)\unstable\forky.obj \ + $(SHAREDDIR)\unstable\fragile.obj \ + $(SHAREDDIR)\unstable\fringe.obj + +MAXMODE_OBJECTS = \ + $(SRCDIR)\shadow\maxmode.obj \ + $(SHAREDDIR)\common\loud.obj \ + $(SHAREDDIR)\common\grow.obj \ + $(SHAREDDIR)\common\os.obj \ + $(SHAREDDIR)\common\fitter.obj \ + $(SHAREDDIR)\common\lex.obj \ + $(SHAREDDIR)\common\binport.obj \ + $(SHAREDDIR)\common\port.obj \ + $(SHAREDDIR)\hammer\file.obj \ + $(SHAREDDIR)\unstable\forky.obj \ + $(SHAREDDIR)\unstable\fragile.obj \ + $(SHAREDDIR)\unstable\fringe.obj \ + $(SHAREDDIR)\unstable\loader.obj diff --git a/externals/miXed/ViCious/cyclone/snapfiles b/externals/miXed/ViCious/cyclone/snapfiles new file mode 100644 index 000000000..dcc83e836 --- /dev/null +++ b/externals/miXed/ViCious/cyclone/snapfiles @@ -0,0 +1,19 @@ +SNAPFILES = \ + miXed\bin\cyclone.dll \ + miXed\bin\hammer.dll \ + miXed\bin\sickle.dll \ + miXed\bin\dummies.dll \ + miXed\bin\maxmode.dll \ + miXed\bin\cyclist.exe \ + miXed\bin\Append-help.pd \ + miXed\bin\Clip-help.pd \ + miXed\bin\Clip~-help.pd \ + miXed\bin\Line~-help.pd \ + miXed\bin\Scope~-help.pd \ + miXed\bin\Snapshot~-help.pd \ + miXed\bin\Table-help.pd \ + miXed\ViCious\cyclone\makefile \ + miXed\ViCious\cyclone\objects \ + miXed\ViCious\cyclone\snapfiles \ + miXed\LICENSE.txt \ + miXed\test\cyclone\*.* diff --git a/externals/miXed/ViCious/notes.txt b/externals/miXed/ViCious/notes.txt new file mode 100644 index 000000000..c996319bb --- /dev/null +++ b/externals/miXed/ViCious/notes.txt @@ -0,0 +1,8 @@ +TODO for ViCious + * use a newer default compiler than 6.0 + * conditionally use posix features (float versions of math calls, dirent) + +DONE for ViCious + +with cyclone alpha55 + * /O2 added to all makefiles (why was it not there in the first place?) diff --git a/externals/miXed/ViCious/pddp/makefile b/externals/miXed/ViCious/pddp/makefile new file mode 100644 index 000000000..657b0a7cb --- /dev/null +++ b/externals/miXed/ViCious/pddp/makefile @@ -0,0 +1,53 @@ +current: pddp + +.SUFFIXES: .dll .obj + +ROOTDIR = ..\..\.. +SRCDIR = $(ROOTDIR)\miXed\pddp +BINDIR = $(ROOTDIR)\miXed\bin +SHAREDDIR = $(ROOTDIR)\miXed\shared +EXTDIR = e:\PureData\externals +PDDIR = e:\PureData\pd +VCLIBDIR = "e:\Program Files\Microsoft Visual Studio\Vc98\lib" +ZIPCOMMAND = d:\dosowe\arc\info-zip\zip + +INCLUDES = /I. /I$(SHAREDDIR) /I$(PDDIR)\src +CFLAGS = /O2 /W3 /WX /DNT /DMSW /DPD /nologo + +LIBS = $(VCLIBDIR)\libc.lib \ + $(VCLIBDIR)\oldnames.lib \ + $(VCLIBDIR)\wsock32.lib \ + $(VCLIBDIR)\kernel32.lib \ + $(VCLIBDIR)\uuid.lib \ + $(PDDIR)\bin\pd.lib + +!INCLUDE objects +!INCLUDE snapfiles +!INCLUDE $(SRCDIR)\build_counter + +pddp: pddpboot pddplink.dll + @cd $(ROOTDIR) + @$(ZIPCOMMAND) pddp-$(PDDP_SNAPSHOT)-dll.zip $(SNAPFILES) + +pddpboot: + -@copy $(SRCDIR)\pddpboot.tcl $(EXTDIR) + -@copy $(SRCDIR)\pddpclient.tcl $(EXTDIR) + -@copy $(SRCDIR)\pddpserver.tcl $(EXTDIR) + -@copy $(SRCDIR)\pddpboot.tcl $(BINDIR) + -@copy $(SRCDIR)\pddpclient.tcl $(BINDIR) + -@copy $(SRCDIR)\pddpserver.tcl $(BINDIR) + +pddplink.dll: $(PDDPLINK_OBJECTS) + -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) + -@copy $@ $(EXTDIR) + -@move $@ $(BINDIR) + -del $(@:.dll=.exp) + -del $(@:.dll=.lib) + +.c.obj: ; cl /c $(CFLAGS) $(INCLUDES) /Fo$*.obj $*.c + +clean: + del *.obj + del *.exp + del *.lib + del *.dll diff --git a/externals/miXed/ViCious/pddp/objects b/externals/miXed/ViCious/pddp/objects new file mode 100644 index 000000000..85d65b473 --- /dev/null +++ b/externals/miXed/ViCious/pddp/objects @@ -0,0 +1,3 @@ +PDDPLINK_OBJECTS = $(SRCDIR)\pddplink.obj \ + $(SHAREDDIR)\common\loud.obj \ + $(SHAREDDIR)\common\os.obj diff --git a/externals/miXed/ViCious/pddp/snapfiles b/externals/miXed/ViCious/pddp/snapfiles new file mode 100644 index 000000000..9dc4dbd59 --- /dev/null +++ b/externals/miXed/ViCious/pddp/snapfiles @@ -0,0 +1,10 @@ +SNAPFILES = \ + miXed\bin\pddplink.dll \ + miXed\bin\pddpboot.tcl \ + miXed\bin\pddpclient.tcl \ + miXed\bin\pddpserver.tcl \ + miXed\ViCious\pddp\makefile \ + miXed\ViCious\pddp\objects \ + miXed\ViCious\pddp\snapfiles \ + miXed\LICENSE.txt \ + miXed\test\pddp\*.* diff --git a/externals/miXed/ViCious/toxy/makefile b/externals/miXed/ViCious/toxy/makefile new file mode 100644 index 000000000..fa59913b2 --- /dev/null +++ b/externals/miXed/ViCious/toxy/makefile @@ -0,0 +1,59 @@ +current: toxy + +.SUFFIXES: .dll .obj + +ROOTDIR = ..\..\.. +SRCDIR = $(ROOTDIR)\miXed\toxy +BINDIR = $(ROOTDIR)\miXed\bin +SHAREDDIR = $(ROOTDIR)\miXed\shared +EXTDIR = e:\PureData\externals +PDDIR = e:\PureData\pd +VCLIBDIR = "e:\Program Files\Microsoft Visual Studio\Vc98\lib" +ZIPCOMMAND = d:\dosowe\arc\info-zip\zip + +INCLUDES = /I. /I$(SHAREDDIR) /I$(PDDIR)\src +CFLAGS = /O2 /W3 /WX /DNT /DMSW /DPD /nologo + +LIBS = $(VCLIBDIR)\libc.lib \ + $(VCLIBDIR)\oldnames.lib \ + $(VCLIBDIR)\wsock32.lib \ + $(VCLIBDIR)\kernel32.lib \ + $(VCLIBDIR)\uuid.lib \ + $(PDDIR)\bin\pd.lib + +!INCLUDE objects +!INCLUDE snapfiles +!INCLUDE $(SRCDIR)\build_counter + +toxy: tot.dll tow.dll widget.dll + @cd $(ROOTDIR) + @$(ZIPCOMMAND) toxy-$(TOXY_SNAPSHOT)-dll.zip $(SNAPFILES) + +tot.dll: $(TOT_OBJECTS) + -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) + -@copy $@ $(EXTDIR) + -@move $@ $(BINDIR) + -del $(@:.dll=.exp) + -del $(@:.dll=.lib) + +tow.dll: $(TOW_OBJECTS) + -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) + -@copy $@ $(EXTDIR) + -@move $@ $(BINDIR) + -del $(@:.dll=.exp) + -del $(@:.dll=.lib) + +widget.dll: $(WIDGET_OBJECTS) + -link /dll /out:$@ $(LIBS) $** /export:$(@:.dll=_setup) + -@copy $@ $(EXTDIR) + -@move $@ $(BINDIR) + -del $(@:.dll=.exp) + -del $(@:.dll=.lib) + +.c.obj: ; cl /c $(CFLAGS) $(INCLUDES) /Fo$*.obj $*.c + +clean: + del *.obj + del *.exp + del *.lib + del *.dll diff --git a/externals/miXed/ViCious/toxy/objects b/externals/miXed/ViCious/toxy/objects new file mode 100644 index 000000000..6b7480a8f --- /dev/null +++ b/externals/miXed/ViCious/toxy/objects @@ -0,0 +1,25 @@ +TOT_OBJECTS = $(SRCDIR)\tot.obj \ + $(SHAREDDIR)\unstable\forky.obj \ + $(SHAREDDIR)\common\loud.obj \ + $(SHAREDDIR)\common\grow.obj \ + $(SHAREDDIR)\common\os.obj \ + $(SHAREDDIR)\hammer\file.obj \ + $(SHAREDDIR)\hammer\gui.obj \ + $(SHAREDDIR)\common\props.obj \ + $(SHAREDDIR)\toxy\scriptlet.obj + +TOW_OBJECTS = $(SRCDIR)\tow.obj \ + $(SHAREDDIR)\common\loud.obj \ + $(SHAREDDIR)\unstable\loader.obj + +WIDGET_OBJECTS = $(SRCDIR)\widget.obj \ + $(SRCDIR)\widgettype.obj \ + $(SRCDIR)\widgethandlers.obj \ + $(SHAREDDIR)\unstable\forky.obj \ + $(SHAREDDIR)\common\loud.obj \ + $(SHAREDDIR)\common\grow.obj \ + $(SHAREDDIR)\common\dict.obj \ + $(SHAREDDIR)\common\os.obj \ + $(SHAREDDIR)\hammer\file.obj \ + $(SHAREDDIR)\common\props.obj \ + $(SHAREDDIR)\toxy\scriptlet.obj diff --git a/externals/miXed/ViCious/toxy/snapfiles b/externals/miXed/ViCious/toxy/snapfiles new file mode 100644 index 000000000..f2ef4c7b3 --- /dev/null +++ b/externals/miXed/ViCious/toxy/snapfiles @@ -0,0 +1,11 @@ +SNAPFILES = \ + miXed\bin\tot.dll \ + miXed\bin\tow.dll \ + miXed\bin\widget.dll \ + miXed\ViCious\toxy\makefile \ + miXed\ViCious\toxy\objects \ + miXed\ViCious\toxy\snapfiles \ + miXed\LICENSE.txt \ + miXed\test\toxy\*.* \ + miXed\test\toxy\editors\*.* \ + miXed\test\toxy\stress\*.* diff --git a/externals/miXed/bin/Clip-help.pd b/externals/miXed/bin/Clip-help.pd new file mode 100644 index 000000000..70578ac05 --- /dev/null +++ b/externals/miXed/bin/Clip-help.pd @@ -0,0 +1,3 @@ +#N canvas 50 50 600 400 12; +#X text 10 10 Clip clone \, unlike the clip built into Pd \, handles lists; +#X text 10 30 of floats.; diff --git a/externals/miXed/bin/Clip~-help.pd b/externals/miXed/bin/Clip~-help.pd new file mode 100644 index 000000000..04e55a759 --- /dev/null +++ b/externals/miXed/bin/Clip~-help.pd @@ -0,0 +1,3 @@ +#N canvas 50 50 600 400 12; +#X text 10 10 Clip~ clone \, unlike the clip~ built into Pd \, accepts; +#X text 10 30 signal input in range inlets for sample-accurate control.; diff --git a/externals/miXed/bin/Line~-help.pd b/externals/miXed/bin/Line~-help.pd new file mode 100644 index 000000000..5759c13ba --- /dev/null +++ b/externals/miXed/bin/Line~-help.pd @@ -0,0 +1,10 @@ +#N canvas 50 50 600 400 12; +#X text 10 10 Line~ clone \, unlike the line~ built into Pd; +#X text 10 30 .; +#X text 30 30 accepts lists of unlimited size: schedules as many; +#X text 30 50 segments as there are pairs of floats in the input \;; +#X text 10 70 .; +#X text 30 70 sample-accurately starts successive segments \;; +#X text 10 90 .; +#X text 30 90 when last target is reached \, sends a bang through; +#X text 30 110 the right outlet.; diff --git a/externals/miXed/bin/Scope~-help.pd b/externals/miXed/bin/Scope~-help.pd new file mode 100644 index 000000000..2a5b28c39 --- /dev/null +++ b/externals/miXed/bin/Scope~-help.pd @@ -0,0 +1,4 @@ +#N canvas 50 50 600 400 12; +#X text 10 10 Scope~ clone's main purpose is quick \, preliminary; +#X text 10 30 verification of other tilde clones. One can run MSP; +#X text 10 50 patches alongside their Pd imports and watch the scope~s.; diff --git a/externals/miXed/bin/Snapshot~-help.pd b/externals/miXed/bin/Snapshot~-help.pd new file mode 100644 index 000000000..f91d50ce3 --- /dev/null +++ b/externals/miXed/bin/Snapshot~-help.pd @@ -0,0 +1,8 @@ +#N canvas 50 50 600 400 12; +#X text 10 10 Snapshot~ clone \, unlike the snapshot~ built into Pd; +#X text 10 30 .; +#X text 30 30 optionally replaces external triggering source with an; +#X text 30 50 internal clock \;; +#X text 10 70 .; +#X text 30 70 reports value of an element at a settable offset in the; +#X text 30 90 signal vector.; diff --git a/externals/miXed/bin/Table-help.pd b/externals/miXed/bin/Table-help.pd new file mode 100644 index 000000000..a73ea93f0 --- /dev/null +++ b/externals/miXed/bin/Table-help.pd @@ -0,0 +1,11 @@ +#N canvas 50 50 600 400 12; +#X text 10 10 Table clone's main purpose is sucking data from tables; +#X text 10 30 embedded in Max patches.; +#X text 10 90 Nevertheless \, most table features are supported: changing; +#X text 10 110 size and contents \, traversal \, file i/o \, all queries; +#X text 10 130 (including 'quantile' and 'bang') and dumping.; +#X text 10 160 Tables with the same name share the same contents.; +#X text 10 220 Table elements are 32-bit integers \, although some operations; +#X text 10 240 (like embedding and editing) lose precision due to the; +#X text 10 260 unavoidable int-to-float conversion.; +#X text 10 290 Editing is textual \, not graphical.; diff --git a/externals/miXed/bin/notes.txt b/externals/miXed/bin/notes.txt new file mode 100644 index 000000000..a12f918a7 --- /dev/null +++ b/externals/miXed/bin/notes.txt @@ -0,0 +1,14 @@ +Keeping help files and binaries in the same directory ensures opening +proper patches for clashing clones on crippled file systems. + +TODO for help files + * simple guide into importing + * describe compatibility mode + * detailed notes for any clone with incompatibilities + +DONE for help files + +with cyclone alpha53 + * short notes about main differences between clashing clones (Append, + Clip, Clip~, Line~, Scope~, Snapshot~, Table) and the corresponding + internal Pd classes. diff --git a/externals/miXed/bin/pddp/pddpboot.tcl b/externals/miXed/bin/pddp/pddpboot.tcl new file mode 100755 index 000000000..429ff8ab9 --- /dev/null +++ b/externals/miXed/bin/pddp/pddpboot.tcl @@ -0,0 +1,32 @@ +#!/bin/sh +# \ +exec tclsh "$0" -- "$@" + +# Synopsis +# test run: +# ./pddpboot.tcl [root [port [path]]] +# from Pd: +# source pddpboot.tcl +# ::pddp::srvUse root (or ::pddp::srvStart root [port]) +# ::pddp::cliOpen path +# ... (more "::pddp::cliOpen" calls) ... +# ::pddp::srvStop + +if {[namespace exists ::pddp]} { ;# created by pddplink's setup + puts stderr "Booting pddp" + set ::pddp::testrun 0 +} else { + puts stderr "Booting pddp, test run..." + namespace eval ::pddp { variable testrun 1 } +} + +if {[info exists ::pddp::theDir]} { + source [file join $::pddp::theDir pddpclient.tcl] + source [file join $::pddp::theDir pddpserver.tcl] + if {[info exists ::pddp::theVersion]} { + package provide pddp $::pddp::theVersion + } +} else { + source pddpclient.tcl] + source pddpserver.tcl] +} diff --git a/externals/miXed/bin/pddp/pddpclient.tcl b/externals/miXed/bin/pddp/pddpclient.tcl new file mode 100644 index 000000000..e16c15ca3 --- /dev/null +++ b/externals/miXed/bin/pddp/pddpclient.tcl @@ -0,0 +1,82 @@ +# pddpclient.tcl + +# Synopsis +# not to be run by itself (see pddpboot.tcl) + +if {![namespace exists ::pddp]} { + puts stderr "Error: invalid invocation of pddpclient (boot pddp first)" + puts stderr "exiting..." + exit 1 +} + +if {$::pddp::testrun} { ;# true if sourced from standalone "pddpboot.tcl" + puts stderr "Loading pddpclient, test run..." + if {$argc > 3} { + set path [lindex $argv 3] + if {[string length $path]} { + puts stderr "Scheduling \"$path\" for opening" + after idle ::pddp::cliOpen $path + } + unset path + } +} else { + puts stderr "Loading pddpclient" +} + +namespace eval ::pddp { + variable theBrowserCommand + + switch -- $::tcl_platform(platform) { + unix { + switch -- $tcl_platform(os) { + Darwin { + set theBrowserCommand "sh -c \"open %s\"" + } + Linux { + foreach candidate \ + {gnome-open xdg-open sensible-browser firefox mozilla galeon konqueror netscape lynx} { + set browser [lindex [auto_execok $candidate] 0] + if {[string length $browser]} { + set theBrowserCommand "$browser %s &" + break + } + } + } + } + } + windows { + # should not this be just: [auto_execok start]? + set theBrowserCommand \ + "rundll32 url.dll,FileProtocolHandler file:%s &" + } + } +} + +proc ::pddp::cliError {err} { + puts stderr "Error in pddpclient: $err" +} + +proc ::pddp::cliOpen {path} { + if {[string first "://" $path] < 1} { + if {[info exists ::pddp::thePort]} { + set path "http://localhost:$::pddp::thePort/$path" + } else { + cliError "pddpserver not running" + return + } + } + variable theBrowserCommand + if {[string length $theBrowserCommand]} { + set command [format $theBrowserCommand $path] + puts stderr "pddpclient: exec $command" + if {[catch {eval [list exec] $command} err]} { + if {[lindex $::errorCode 0] eq "CHILDSTATUS"} { + cliError "$err (child status [lindex $::errorCode 2])" + } else { + cliError $err + } + } + } else { + cliError "browser unavailable" + } +} diff --git a/externals/miXed/bin/pddp/pddpserver.tcl b/externals/miXed/bin/pddp/pddpserver.tcl new file mode 100644 index 000000000..f4a94448a --- /dev/null +++ b/externals/miXed/bin/pddp/pddpserver.tcl @@ -0,0 +1,507 @@ +# pddpserver.tcl + +# Synopsis +# not to be run by itself (see pddpboot.tcl) + +# based on: + +# Simple Sample httpd/1.[01] server +# Stephen Uhler (c) 1996-1997 Sun Microsystems + +# http://cvs.sourceforge.net/viewcvs.py/tclhttpd/tclhttpd/bin/mini/mini1.1.tcl + +# modified by krzYszcz (2005): +# putting per-server data and all commands in a namespace "::pddp" +# supporting sourcing from within Pd, through the "pddpboot.tcl" wrapper +# inserting the .pd handler +# lots of other changes, too many to list here (run "diff" if curious...) + +if {![namespace exists ::pddp]} { + puts stderr "Error: invalid invocation of pddpserver (boot pddp first)" + puts stderr "exiting..." + exit 1 +} + +if {$::pddp::testrun} { ;# true if sourced from standalone "pddpboot.tcl" + puts stderr "Loading pddpserver, test run..." + proc bgerror {msg} { + global errorInfo + puts stderr "bgerror: $msg\n$errorInfo" + } +} else { + puts stderr "Loading pddpserver" +# catch {console show} +} + +namespace eval ::pddp { + variable thePort 0 + variable theState + variable theMimeTypes + variable theErrors + variable theErrorFormat + + # "theState" contains the server state: + # root: the root of the document directory + # default: default document name + # listen: the main listening socket id + # naccepts: a count of accepted connections so far + # maxtime: the max time (msec) allowed to complete an http request + # maxused: the max # of requests for a socket + array set theState { + root "" + default index.html + listen "" + naccepts 0 + nrequests 0 + nerrors 0 + maxtime 600000 + maxused 25 + bufsize 32768 + } + + set theState(root) $env(HOME) + + array set theMimeTypes { + {} text/plain + .txt text/plain + .html text/html + .gif image/gif + .jpg image/jpeg + .pd text/html + } + + # HTTP/1.[01] error codes (the ones we use) + array set theErrors { + 204 {No Content} + 400 {Bad Request} + 404 {Not Found} + 405 {Method Not Allowed} + 408 {Request Timeout} + 411 {Length Required} + 419 {Expectation Failed} + 500 {Internal Server Error} + 503 {Service Unavailable} + 504 {Service Temporarily Unavailable} + 505 {HTTP Version Not Supported} + } + + # Generic error response + set theErrorFormat { + <title>Error: %1$s</title> + Got the error: <b>%2$s</b><br> + while trying to obtain <b>%3$s</b> + } +} + +proc ::pddp::srvUse {{root {}} {port 0}} { + variable theState + if {[string length $theState(listen)]} { + if {[string length $root] && ![string equal $root $theState(root)]} { + srvLog $theState(listen) Warning "Redirection attempt for $root" + } + } else { + srvStart $root $port + } +} + +# Start the server by listening for connections on the desired port. + +proc ::pddp::srvStart {{root {}} {port 0}} { + variable thePort + variable theState + + puts stderr "Starting pddp server on [info hostname]" + if {[string length $root]} { + set theState(root) $root + } + # we do not handle multiple pddpservers, LATER rethink + srvStop + array set theState [list naccepts 0 nrequests 0 nerrors 0] + + for { set thePort $port } {$thePort < 65535 } {incr thePort } { + if {[catch {set theState(listen) \ + [socket -server ::pddp::srvAccept $thePort]} res]} { + if {$thePort == 0} { + # FIXME this is a critical error + set thePort 32768 + } + } else { break } + } + if {$thePort == 65535} { + srvLog none Error "Could not find port available for listening" + } else { + if {$thePort == 0} { + set thePort [lindex [fconfigure $theState(listen) -sockname] 2] + } + srvLog $theState(listen) Port $thePort + srvLog $theState(listen) Root directory \"$root\" + } + after 120 update ;# FIXME might be needed on windows they say, test there + return $thePort +} + +proc ::pddp::srvStop {} { + variable thePort + variable theState + if {[string length $theState(listen)]} { + if {[catch {close $theState(listen)} res]} { + srvLog $theState(listen) Warning [list $res while closing socket] + } else { + srvLog $theState(listen) Closed. + } + set theState(listen) "" + update + } +} + +# Accept a new connection from the server and set up a handler +# to read the request from the client. + +proc ::pddp::srvAccept {sock ipaddr port} { + variable theState + variable theSockData$sock + # reject remote requests, LATER revisit + if {[string equal $ipaddr "127.0.0.1"]} { + incr theState(naccepts) + srvReset $sock $theState(maxused) + srvLog $sock Connect $ipaddr $port + } else { + srvLog $sock Warning "rejecting remote connection request from $ipaddr" + srvSockDone $sock 1 + } +} + +# Initialize or reset the socket state + +proc ::pddp::srvReset {sock nlft} { + variable theState + upvar 0 ::pddp::theSockData$sock sockData + array set sockData [list state start linemode 1 version 0 nleft $nlft] + set sockData(cancel) \ + [after $theState(maxtime) [list srvTimeout $sock]] + fconfigure $sock -blocking 0 -buffersize $theState(bufsize) \ + -translation {auto crlf} + fileevent $sock readable [list ::pddp::srvRead $sock] +} + +# Read data from a client request +# 1) read the request line +# 2) read the mime headers +# 3) read the additional data (if post && content-length not satisfied) + +proc ::pddp::srvRead {sock} { + variable theState + upvar 0 ::pddp::theSockData$sock sockData + + # Use line mode to read the request and the mime headers + + if {$sockData(linemode)} { + set readCount [gets $sock line] + set state [string compare $readCount 0],$sockData(state) + switch -glob -- $state { + 1,start { + if {[regexp {(HEAD|POST|GET) ([^?]+)\??([^ ]*) HTTP/1.([01])} \ + $line x sockData(proto) sockData(url) \ + sockData(query) sockData(version)]} { + set sockData(state) mime + incr theState(nrequests) + srvLog $sock Request $sockData(nleft) $line + } else { + srvError $sock 400 $line + } + } + 0,start { + srvLog $sock Warning "Initial blank line fetching request" + } + 1,mime { + if {[regexp {([^:]+):[ ]*(.*)} $line {} key value]} { + set key [string tolower $key] + set sockData(key) $key + if {[info exists sockData(mime,$key)]} { + append sockData(mime,$key) ", $value" + } else { + set sockData(mime,$key) $value + } + } elseif {[regexp {^[ ]+(.+)} $line {} value] && \ + [info exists sockData(key)]} { + append sockData(mime,$sockData($key)) " " $value + } else { + srvError $sock 400 $line + } + } + 0,mime { + if {$sockData(proto) == "POST" && \ + [info exists sockData(mime,content-length)]} { + set sockData(linemode) 0 + set sockData(count) $sockData(mime,content-length) + if {$sockData(version) && \ + [info exists sockData(mime,expect)]} { + if {$sockData(mime,expect) == "100-continue"} { + puts $sock "100 Continue HTTP/1.1\n" + flush $sock + } else { + srvError $sock 419 $sockData(mime,expect) + } + } + fconfigure $sock -translation {binary crlf} + } elseif {$sockData(proto) != "POST"} { + srvRespond $sock + } else { + srvError $sock 411 "Confusing mime headers" + } + } + -1,* { + if {[eof $sock]} { + srvLog $sock Error "Broken connection fetching request" + srvSockDone $sock 1 + } else { + puts stderr "Partial read, retrying" + } + } + default { + srvError $sock 404 "Invalid http state: $state,[eof $sock]" + } + } + + # Use counted mode to get the post data + + } elseif {![eof $sock]} { + append sockData(postdata) [read $sock $sockData(count)] + set sockData(count) [expr {$sockData(mime,content-length) - \ + [string length $sockData(postdata)]}] + if {$sockData(count) == 0} { + srvRespond $sock + } + } else { + srvLog $sock Error "Broken connection reading POST data" + srvSockDone $sock 1 + } +} + +# Done with the socket, either close it, or set up for next fetch +# sock: The socket I'm done with +# doclose: If true, close the socket, otherwise set up for reuse + +proc ::pddp::srvSockDone {sock doclose} { + variable theState + upvar 0 ::pddp::theSockData$sock sockData + + after cancel $sockData(cancel) + set nleft [incr sockData(nleft) -1] + unset sockData + if {$doclose} { + close $sock + } else { + srvReset $sock $nleft + } + return "" +} + +# A timeout happened + +proc ::pddp::srvTimeout {sock} { + srvError $sock 408 +} + +proc ::pddp::srvPdOpen {path} { + global menu_windowlist + set name [file tail $path] + set dir [file dirname $path] + # FIXME white space in $name and $dir + # FIXME this is a fragile hack, there should be an "openx" message to pd... + foreach en $menu_windowlist { + set wd [lindex $en 1] + set nm [lindex $en 0] + set dr [lindex [wm title $wd] end] + if {[string equal $name $nm] && [string equal $dir $dr]} { + # FIXME test on windows + raise $wd + focus -force $wd + return + } + } + pd [concat pd open $name $dir \;] + # FIXME raise and focus on windows? +} + +proc ::pddp::srvPdHandler {sock path} { + if {[catch {::pddp::srvPdOpen $path}]} { + srvError $sock 504 + } else { + srvError $sock 204 + } +} + +# Handle file system queries. This is a place holder for a more +# generic dispatch mechanism. + +proc ::pddp::srvRespond {sock} { + variable theState + variable theUrlCache + upvar 0 ::pddp::theSockData$sock sockData + + regsub {(^http://[^/]+)?} $sockData(url) {} url + if {[info exists theUrlCache($url)]} { + set mypath $theUrlCache($url) + } else { + set mypath [srvUrl2File $theState(root) $url] + if {[file isdirectory $mypath]} { + append mypath / $theState(default) + } + set theUrlCache($url) $mypath + } + if {[string length $mypath] == 0} { + srvError $sock 400 + } elseif {![file readable $mypath]} { + if {[string equal [file tail $mypath] "favicon.ico"]} { + srvError $sock 204 ;# FIXME design something + } else { + srvError $sock 404 $mypath + } + } else { + set ext [file extension $mypath] + + if {[string equal $ext ".pd"]} { + srvPdHandler $sock $mypath + return + } + + puts $sock "HTTP/1.$sockData(version) 200 Data follows" + puts $sock "Date: [srvGetDate [clock seconds]]" + puts $sock "Last-Modified: [srvGetDate [file mtime $mypath]]" + puts $sock "Content-Type: [srvContentType $ext]" + puts $sock "Content-Length: [file size $mypath]" + + ## Should also close socket if recvd connection close header + set doclose [expr {$sockData(nleft) == 0}] + + if {$doclose} { + puts $sock "Connection close:" + } elseif {$sockData(version) == 0 && \ + [info exists sockData(mime,connection)]} { + if {$sockData(mime,connection) == "Keep-Alive"} { + set doclose 0 + puts $sock "Connection: Keep-Alive" + } + } + puts $sock "" + flush $sock + + if {$sockData(proto) != "HEAD"} { + set in [open $mypath] + fconfigure $sock -translation binary + fconfigure $in -translation binary + fcopy $in $sock -command \ + [list ::pddp::srvCopyDone $in $sock $doclose] + } else { + srvSockDone $sock $doclose + } + } +} + +# Callback when file is done being output to client +# in: The fd for the file being copied +# sock: The client socket +# doclose: close the socket if true +# bytes: The # of bytes copied +# error: The error message (if any) + +proc ::pddp::srvCopyDone {in sock doclose bytes {error {}}} { + close $in + srvLog $sock Done $bytes bytes + srvSockDone $sock $doclose +} + +# Convert the file suffix into a mime type. + +proc ::pddp::srvContentType {ext} { + variable theMimeTypes + set type text/plain + catch {set type $theMimeTypes($ext)} + return $type +} + +# Respond with an error reply +# sock: The socket handle to the client +# code: The httpd error code +# args: Additional information for error logging + +proc ::pddp::srvError {sock code args} { + variable theState + variable theErrors + variable theErrorFormat + upvar 0 ::pddp::theSockData$sock sockData + + append sockData(url) "" + incr theState(nerrors) + set message [format $theErrorFormat $code $theErrors($code) $sockData(url)] + append head "HTTP/1.$sockData(version) $code $theErrors($code)" \n + append head "Date: [srvGetDate [clock seconds]]" \n + append head "Connection: close" \n + append head "Content-Length: [string length $message]" \n + + # Because there is an error condition, the socket may be "dead" + + catch { + fconfigure $sock -translation crlf + puts -nonewline $sock $head\n$message + flush $sock + } reason + srvSockDone $sock 1 + if {$code < 300} {set status Status} else {set status Error} + srvLog $sock $status $code $theErrors($code) $args $reason +} + +# Generate a date string in HTTP format. + +proc ::pddp::srvGetDate {seconds} { + return [clock format $seconds -format {%a, %d %b %Y %T %Z}] +} + +# Log an Httpd transaction. +# This should be replaced as needed. + +proc ::pddp::srvLog {sock args} { + puts stderr "pddp log ($sock): $args" +} + +# Convert a url into a pathname. (UNIX version only) +# This is probably not right, and belongs somewhere else. +# - Remove leading http://... if any +# - Collapse all /./ and /../ constructs +# - expand %xx sequences -> disallow "/"'s and "."'s due to expansions + +proc ::pddp::srvUrl2File {root url} { + regsub -all {//+} $url / url ;# collapse multiple /'s + while {[regsub -all {/\./} $url / url]} {} ;# collapse /./ + while {[regsub -all {/\.\.(/|$)} $url /\x81\\1 url]} {} ;# mark /../ + while {[regsub "/\[^/\x81]+/\x81/" $url / url]} {} ;# collapse /../ + if {![regexp "\x81|%2\[eEfF]" $url]} { ;# invalid /../, / or . ? + return $root[srvCgiMap $url] + } else { + return "" + } +} + +# Decode url-encoded strings. + +proc ::pddp::srvCgiMap {data} { + regsub -all {([][$\\])} $data {\\\1} data + regsub -all {%([0-9a-fA-F][0-9a-fA-F])} $data {[format %c 0x\1]} data + return [subst $data] +} + +if {$::pddp::testrun} { ;# true if tested as a standalone script + if {$argc > 1} { + set root [lindex $argv 1] + set port [lindex $argv 2] + if {![string is integer -strict $port]} { + set port 32768 + } + } else { + set root $env(HOME) + set port 32768 + } + ::pddp::srvStart $root $port + vwait forever +} diff --git a/externals/miXed/bin/pddp/pkgIndex.tcl b/externals/miXed/bin/pddp/pkgIndex.tcl new file mode 100644 index 000000000..10b89a62e --- /dev/null +++ b/externals/miXed/bin/pddp/pkgIndex.tcl @@ -0,0 +1,10 @@ +proc LoadPddp { version dir } { + namespace eval ::pddp {} + set ::pddp::theVersion $version + set ::pddp::theDir $dir + source [file join $dir pddpboot.tcl] +} + +set version "0.1.0.3" + +package ifneeded pddp $version [list LoadPddp $version $dir] diff --git a/externals/miXed/cyclone/Makefile b/externals/miXed/cyclone/Makefile new file mode 100644 index 000000000..fc022be6c --- /dev/null +++ b/externals/miXed/cyclone/Makefile @@ -0,0 +1,2 @@ +ROOT_DIR = .. +include $(ROOT_DIR)/Makefile.common diff --git a/externals/miXed/cyclone/Makefile.dirs b/externals/miXed/cyclone/Makefile.dirs new file mode 100644 index 000000000..0dde72f72 --- /dev/null +++ b/externals/miXed/cyclone/Makefile.dirs @@ -0,0 +1,2 @@ +MIXED_DIRS = shadow hammer sickle +RELEASE_DIRS = shadow hammer sickle diff --git a/externals/miXed/cyclone/Makefile.libdir b/externals/miXed/cyclone/Makefile.libdir new file mode 100644 index 000000000..bd83ada62 --- /dev/null +++ b/externals/miXed/cyclone/Makefile.libdir @@ -0,0 +1,128 @@ +# this Makefile builds a libdir for cyclone + +# where to install the library, overridden below depending on platform +prefix = /usr/local +libdir = $(prefix)/lib +bindir = $(prefix)/bin +pkglibdir = $(libdir)/pd-externals +objectsdir = $(pkglibdir) + +INSTALL = install +INSTALL_PROGRAM = $(INSTALL) -p -m 755 +INSTALL_DATA = $(INSTALL) -p -m 644 +INSTALL_DIR = $(INSTALL) -p -m 755 -d + +UNAME := $(shell uname -s) +ifeq ($(UNAME),Darwin) + CPU := $(shell uname -p) + ifeq ($(CPU),arm) # iPhone/iPod Touch + EXTENSION = pd_darwin + OS = iphoneos + PD_PATH = /Applications/Pd-extended.app/Contents/Resources + IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin + CC=$(IPHONE_BASE)/gcc + CPP=$(IPHONE_BASE)/cpp + CXX=$(IPHONE_BASE)/g++ + ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk + IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6 + OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer + CFLAGS := $(IPHONE_CFLAGS) $(OPT_CFLAGS) $(CFLAGS) + LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT) + LIBS += -lc + STRIP = strip -x + else # Mac OS X + EXTENSION = pd_darwin + OS = macosx + PD_PATH = /Applications/Pd-extended.app/Contents/Resources + OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast +# build universal 32-bit on 10.4 and 32/64 on newer + ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8) + FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4 + else + FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 + endif + CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include + LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib + # if the 'pd' binary exists, check the linking against it to aid with stripping + LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd) + LIBS += -lc + STRIP = strip -x +# install into ~/Library/Pd on Mac OS X since /usr/local isn't used much + pkglibdir=$(HOME)/Library/Pd + endif +endif +ifeq ($(UNAME),Linux) + CPU := $(shell uname -m) + EXTENSION = pd_linux + OS = linux + PD_PATH = /usr + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + CFLAGS += -fPIC + LDFLAGS += -Wl,--export-dynamic -shared -fPIC + LIBS += -lc + STRIP = strip --strip-unneeded -R .note -R .comment +endif +ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME))) + CPU := $(shell uname -m) + EXTENSION = dll + OS = cygwin + PD_PATH = $(cygpath $(PROGRAMFILES))/pd + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + CFLAGS += + LDFLAGS += -Wl,--export-dynamic -shared -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" + LIBS += -lc -lpd + STRIP = strip --strip-unneeded -R .note -R .comment +endif +ifeq (MINGW,$(findstring MINGW,$(UNAME))) + CPU := $(shell uname -m) + EXTENSION = dll + OS = windows + PD_PATH = $(shell cd "$(PROGRAMFILES)"/pd && pwd) + OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer + CFLAGS += -mms-bitfields + LDFLAGS += -s -shared -Wl,--enable-auto-import + LIBS += -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" -L"$(PD_PATH)/obj" -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 + STRIP = strip --strip-unneeded -R .note -R .comment +endif + +cyclone: + $(MAKE) -f Makefile \ + OPT_CFLAGS="-O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing -fPIC" + +install: cyclone + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/cyclone + $(INSTALL_DATA) cyclone-meta.pd $(DESTDIR)$(objectsdir)/cyclone + $(INSTALL_DATA) ../LICENSE.txt $(DESTDIR)$(objectsdir)/cyclone + $(INSTALL_DATA) README.txt $(DESTDIR)$(objectsdir)/cyclone +# cyclone is compiled straight into $(OUT_DIR), yes a kludge, but the code of +# this build system is impenetrable + $(MAKE) OUT_DIR=$(DESTDIR)$(objectsdir)/cyclone + $(STRIP) $(DESTDIR)$(objectsdir)/cyclone/*.$(EXTENSION) + chmod a-x $(DESTDIR)$(objectsdir)/cyclone/*.$(EXTENSION) +# install "maxmode" libraries into subdir, so they don't override the libdir + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/cyclone/maxmode + $(INSTALL_DATA) ../bin/cyclone.$(EXTENSION) \ + ../bin/hammer.$(EXTENSION) \ + ../bin/sickle.$(EXTENSION) \ + ../bin/maxmode.$(EXTENSION) \ + $(DESTDIR)$(objectsdir)/cyclone/maxmode + $(STRIP) $(DESTDIR)$(objectsdir)/cyclone/maxmode/*.$(EXTENSION) + $(INSTALL_DATA) ../doc/help/cyclone/*.* \ + $(DESTDIR)$(objectsdir)/cyclone + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/cyclone/examples + $(INSTALL_DATA) ../test/cyclone/*.* \ + $(DESTDIR)$(objectsdir)/cyclone/examples +# install "cyclist" command line app with pd + $(INSTALL_DIR) $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) ../bin/cyclist $(DESTDIR)$(bindir) + $(STRIP) $(DESTDIR)$(bindir)/cyclist + +clean: + -$(MAKE) -f Makefile $(DEST_PATHS) clean + -rm -f ../bin/*.pd_linux + -rm -f ../bin/cyclist + -rm -f Makefile.deps + -rm -f shadow/Makefile.deps + -rm -f hammer/Makefile.deps + -rm -f sickle/Makefile.deps + -rm -f ../build-stamp diff --git a/externals/miXed/cyclone/Makefile.objects b/externals/miXed/cyclone/Makefile.objects new file mode 100644 index 000000000..2641eeef8 --- /dev/null +++ b/externals/miXed/cyclone/Makefile.objects @@ -0,0 +1,40 @@ +HLOUD_OBJECTS = common/loud.o +HFITTER_OBJECTS = common/loud.o common/fitter.o +HFORKY_OBJECTS = common/loud.o unstable/forky.o +HFRAGILE_OBJECTS = common/loud.o unstable/fragile.o +HGROW_OBJECTS = common/grow.o common/loud.o +HGROWFITTER_OBJECTS = common/grow.o common/loud.o common/fitter.o +HFILE_OBJECTS = hammer/file.o common/loud.o common/os.o \ + common/fitter.o unstable/forky.o +HRAND_OBJECTS = common/rand.o common/loud.o +HRANDFILE_OBJECTS = common/rand.o hammer/file.o common/loud.o common/os.o \ + common/fitter.o \ + unstable/forky.o +HRANDGROW_OBJECTS = common/rand.o common/grow.o common/loud.o common/fitter.o +HRANDGROWFILE_OBJECTS = common/rand.o common/grow.o hammer/file.o \ + common/loud.o common/os.o unstable/forky.o +HTREE_OBJECTS = hammer/tree.o common/loud.o +HTREEFILEVEFL_OBJECTS = hammer/tree.o hammer/file.o common/vefl.o \ + common/loud.o common/os.o unstable/forky.o unstable/fragile.o +HGUI_OBJECTS = hammer/gui.o common/loud.o +HSEQ_OBJECTS = common/mifi.o hammer/file.o \ + common/grow.o common/loud.o common/os.o common/fitter.o unstable/forky.o +SPLAINNOTILDE_OBJECTS = common/loud.o common/fitter.o +SSIC_OBJECTS = sickle/sic.o common/loud.o +SFORKY_OBJECTS = sickle/sic.o common/loud.o unstable/forky.o +SFRAGILE_OBJECTS = sickle/sic.o common/loud.o unstable/fragile.o +SFRAGILEFITTER_OBJECTS = sickle/sic.o common/loud.o common/fitter.o \ + unstable/fragile.o +SGROW_OBJECTS = common/grow.o sickle/sic.o common/loud.o +SGROWCLC_OBJECTS = common/grow.o common/clc.o sickle/sic.o common/loud.o +SGROWFORKY_OBJECTS = common/grow.o sickle/sic.o \ + common/loud.o common/fitter.o unstable/forky.o +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 +SARSICFITTER_OBJECTS = sickle/sic.o sickle/arsic.o common/vefl.o \ + common/loud.o common/fitter.o unstable/fragile.o +SFILE_OBJECTS = hammer/file.o sickle/sic.o common/loud.o common/os.o \ + unstable/forky.o +RELEASE_LIBS = cyclone hammer sickle dummies maxmode +RELEASE_APPS = cyclist diff --git a/externals/miXed/cyclone/Makefile.sources b/externals/miXed/cyclone/Makefile.sources new file mode 100644 index 000000000..ea36fa7e9 --- /dev/null +++ b/externals/miXed/cyclone/Makefile.sources @@ -0,0 +1,228 @@ +TYPES = HPLAIN HLOUD HFITTER HFORKY HFRAGILE HGROW HGROWFITTER \ + HFILE HRAND HRANDFILE HRANDGROW HRANDGROWFILE \ + HTREE HTREEFILEVEFL HGUI HSEQ \ + SPLAINNOTILDE SPLAIN SSIC SFORKY SFRAGILE SFRAGILEFITTER \ + SGROW SGROWCLC SGROWFORKY SVEFL SARSIC SARSICFITTER SFILE + +HPLAIN_SOURCES = \ +hammer/accum.c \ +hammer/acos.c \ +hammer/asin.c \ +hammer/Bucket.c \ +hammer/cartopol.c \ +hammer/cosh.c \ +hammer/flush.c \ +hammer/forward.c \ +hammer/fromsymbol.c \ +hammer/mean.c \ +hammer/midiflush.c \ +hammer/midiformat.c \ +hammer/midiparse.c \ +hammer/next.c \ +hammer/onebang.c \ +hammer/Peak.c \ +hammer/poltocar.c \ +hammer/sinh.c \ +hammer/split.c \ +hammer/sustain.c \ +hammer/tanh.c \ +hammer/Trough.c \ +hammer/Uzi.c \ +hammer/xbendin.c \ +hammer/xbendin2.c \ +hammer/xbendout.c \ +hammer/xbendout2.c \ +hammer/xnotein.c \ +hammer/xnoteout.c + +HLOUD_SOURCES = \ +hammer/anal.c \ +hammer/Borax.c \ +hammer/decide.c \ +hammer/Histo.c \ +hammer/spell.c \ +hammer/spray.c \ +hammer/sprintf.c \ +hammer/TogEdge.c + +HFITTER_SOURCES = \ +hammer/bangbang.c \ +hammer/counter.c \ +hammer/cycle.c \ +hammer/Decode.c \ +hammer/gate.c \ +hammer/maximum.c \ +hammer/minimum.c \ +hammer/switch.c + +#HFORKY_SOURCES = \ +#hammer/comment.c + +HFRAGILE_SOURCES = \ +hammer/grab.c \ +hammer/testmess.c \ +hammer/universal.c + +HGROW_SOURCES = \ +hammer/bondo.c \ +hammer/buddy.c \ +hammer/Clip.c \ +hammer/funnel.c \ +hammer/iter.c \ +hammer/match.c \ +hammer/pv.c \ +hammer/speedlim.c \ +hammer/substitute.c \ +hammer/thresh.c \ +hammer/tosymbol.c \ +hammer/zl.c + +HGROWFITTER_SOURCES = \ +hammer/past.c \ +#hammer/Append.c \ +#hammer/prepend.c + +HFILE_SOURCES = \ +hammer/capture.c \ +hammer/coll.c \ +hammer/mtr.c + +HRAND_SOURCES = \ +hammer/drunk.c + +HRANDFILE_SOURCES = \ +hammer/prob.c + +HRANDGROW_SOURCES = \ +hammer/urn.c + +HRANDGROWFILE_SOURCES = \ +hammer/Table.c + +HTREE_SOURCES = \ +hammer/offer.c + +HTREEFILEVEFL_SOURCES = \ +hammer/funbuff.c + +HGUI_SOURCES = \ +hammer/active.c \ +hammer/mousefilter.c \ +hammer/MouseState.c + +HSEQ_SOURCES = \ +hammer/seq.c + +SPLAINNOTILDE_SOURCES = \ +sickle/linedrive.c + +SSIC_TILDE = $(TILDE) +SSIC_SOURCES = \ +sickle/acos.c \ +sickle/acosh.c \ +sickle/allpass.c \ +sickle/asin.c \ +sickle/asinh.c \ +sickle/atan.c \ +sickle/atan2.c \ +sickle/atanh.c \ +sickle/average.c \ +sickle/avg.c \ +sickle/bitnot.c \ +sickle/bitshift.c \ +sickle/change.c \ +sickle/Clip.c \ +sickle/comb.c \ +sickle/cosh.c \ +sickle/cosx.c \ +sickle/count.c \ +sickle/delay.c \ +sickle/delta.c \ +sickle/deltaclip.c \ +sickle/edge.c \ +sickle/kink.c \ +sickle/lores.c \ +sickle/maximum.c \ +sickle/minimum.c \ +sickle/minmax.c \ +sickle/mstosamps.c \ +sickle/onepole.c \ +sickle/overdrive.c \ +sickle/peakamp.c \ +sickle/phasewrap.c \ +sickle/pink.c \ +sickle/pow.c \ +sickle/rampsmooth.c \ +sickle/rand.c \ +sickle/reson.c \ +sickle/sah.c \ +sickle/sampstoms.c \ +sickle/sinh.c \ +sickle/sinx.c \ +sickle/slide.c \ +sickle/Snapshot.c \ +sickle/spike.c \ +sickle/svf.c \ +sickle/tanh.c \ +sickle/tanx.c \ +sickle/train.c \ +sickle/trapezoid.c \ +sickle/triangle.c \ +sickle/vectral.c \ +sickle/zerox.c + +#sickle/log.c \ +#sickle/abs.c \ + +SFORKY_TILDE = $(TILDE) +SFORKY_SOURCES = \ +sickle/bitand.c \ +sickle/bitor.c \ +sickle/bitxor.c \ +sickle/pong.c + +SFRAGILE_TILDE = $(TILDE) +SFRAGILE_SOURCES = \ +sickle/cartopol.c \ +sickle/poltocar.c + +SFRAGILEFITTER_TILDE = $(TILDE) +SFRAGILEFITTER_SOURCES = \ +sickle/matrix.c + +SGROW_TILDE = $(TILDE) +SGROW_SOURCES = \ +sickle/click.c \ +sickle/frameaccum.c \ +sickle/framedelta.c \ +sickle/Line.c + +SGROWCLC_TILDE = $(TILDE) +SGROWCLC_SOURCES = \ +sickle/curve.c + +SGROWFORKY_TILDE = $(TILDE) +SGROWFORKY_SOURCES = \ +sickle/Scope.c + +SVEFL_TILDE = $(TILDE) +SVEFL_SOURCES = \ +sickle/cycle.c + +SARSIC_TILDE = $(TILDE) +SARSIC_SOURCES = \ +sickle/index.c \ +sickle/lookup.c \ +sickle/peek.c \ +sickle/play.c \ +sickle/poke.c \ +sickle/record.c \ +sickle/wave.c + +SARSICFITTER_TILDE = $(TILDE) +SARSICFITTER_SOURCES = \ +sickle/buffir.c + +SFILE_TILDE = $(TILDE) +SFILE_SOURCES = \ +sickle/capture.c diff --git a/externals/miXed/cyclone/README.txt b/externals/miXed/cyclone/README.txt new file mode 100644 index 000000000..8b9f56ba1 --- /dev/null +++ b/externals/miXed/cyclone/README.txt @@ -0,0 +1,78 @@ +http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html + +------- +cyclone +------- + +Cyclone is a library of PureData classes, bringing some level of compatibility +between Max/MSP and Pd environments. Although being itself in the early stage +of development, it is meant to eventually become part of a much larger +project, aiming at unification and standardization of computer musician's +tools. + +In its current form, cyclone is mainly for people using both Max and Pd, and +thus wanting to develop cross-platform patches. In this respect, cyclone has +much in common with Thomas Grill's flext, and flext-based externals. See +Thomas' page. While flext enables developing new cross-platform classes, +cyclone makes existing classes cross-platform. + +Cyclone also comes handy, somewhat, in the task of importing Max/MSP patches +into Pd. Do not expect miracles, though, it is usually not an easy task. + +The entire cyclone library, which might be preloaded with either -lib cyclone +or -lib maxmode option, consists of: + + * the main hammer and sickle sub-libraries, containing Pd versions of, + respectively, Max and MSP classes; + + * cyclone sub-library, taking care of loading hammer and sickle, and which + itself contains: a small set of operators (!-, !/, ==~, !=~, <~, <=~, >~, + >=~, !-~, !/~, %~, +=~); an importing mechanism provided by the cyclone + class. + + * optional dummies sub-library, which contains a large set of dummy classes, + serving as substitutions for Max/MSP classes not (yet) implemented in + cyclone; + + * maxmode sub-library, which imposes strict compatibility mode, and loads all + the other components, including dummies. + +The two main sub-libraries might be loaded separately, by using -lib hammer +and/or -lib sickle options. There is also a possibility of loading any single +class from hammer or sickle library dynamically (this feature is only +available in the linux snapshot). + +Currently, the hammer part contains: accum, acos, active, anal, Append (more +info), asin, bangbang, bondo, Borax, Bucket, buddy, capture, cartopol, Clip, +coll, comment, cosh, counter, cycle, decide, Decode, drunk, flush, forward, +fromsymbol, funbuff, funnel, gate, grab, Histo, iter, match, maximum, mean, +midiflush, midiformat, midiparse, minimum, mousefilter, MouseState, mtr (more +info), next, offer, onebang, past, Peak, poltocar, prepend (more info), prob, +pv, seq (more info), sinh, speedlim, spell, split, spray, sprintf, substitute, +sustain, switch, Table (more info), tanh, thresh, TogEdge, tosymbol, Trough, +universal, urn, Uzi, xbendin, xbendout, xnotein, xnoteout, and zl. + +The sickle part contains: abs~, acos~, acosh~, allpass~, asin~, asinh~, atan~, +atan2~, atanh~, average~, avg~, bitand~, bitnot~, bitor~, bitshift~, bitxor~, +buffir~, capture~, cartopol~, change~, click~, Clip~, comb~, cosh~, cosx~, +count~, curve~, cycle~, delay~, delta~, deltaclip~, edge~, frameaccum~, +framedelta~, index~, kink~, Line~, linedrive, log~, lookup~, lores~, matrix~ +(more info), maximum~, minimum~, minmax~, mstosamps~, onepole~, peakamp~, +peek~, phasewrap~, pink~, play~, poke~, poltocar~, pong~, pow~, rampsmooth~, +rand~, record~, reson~, sah~, sampstoms~, Scope~, sinh~, sinx~, slide~, +Snapshot~, spike~, svf~, tanh~, tanx~, train~, trapezoid~, triangle~, +vectral~, wave~, and zerox~. + +Cyclone comes without any documentation. All the included patches were +created merely for testing. + +Caveats: + +* The binaries provided in this snapshot release are not expected to run + inside of a pre-0.36 version of Pd, without prior recompiling. + +* If a single -lib cyclone startup option is used, cyclone in turn loads its + two main components: hammer and sickle. If a single -lib maxmode startup + option is used, all the remaining library components are going to be loaded: + cyclone, hammer, sickle, and dummies. In these cases, all the required + libraries should be accessible by Pd. diff --git a/externals/miXed/cyclone/build_counter b/externals/miXed/cyclone/build_counter new file mode 100644 index 000000000..7f3374008 --- /dev/null +++ b/externals/miXed/cyclone/build_counter @@ -0,0 +1,7 @@ +#define CYCLONE_VERSION "0.1" +#define CYCLONE_RELEASE "alpha" +#define CYCLONE_BUILD 56 + +#if 0 +CYCLONE_SNAPSHOT = 0.1.56 +#endif diff --git a/externals/miXed/cyclone/cyclone-all.exclude b/externals/miXed/cyclone/cyclone-all.exclude new file mode 100644 index 000000000..8b8d91f3d --- /dev/null +++ b/externals/miXed/cyclone/cyclone-all.exclude @@ -0,0 +1,9 @@ +*~ +*.o +*.gz +*.html +*.out +*/*/old +*/*/old/* +*/*/ref +*/*/ref/* diff --git a/externals/miXed/cyclone/cyclone-help.include b/externals/miXed/cyclone/cyclone-help.include new file mode 100644 index 000000000..549df469c --- /dev/null +++ b/externals/miXed/cyclone/cyclone-help.include @@ -0,0 +1,7 @@ +bin/Append-help.pd +bin/Clip-help.pd +bin/Clip~-help.pd +bin/Line~-help.pd +bin/Scope~-help.pd +bin/Snapshot~-help.pd +bin/Table-help.pd diff --git a/externals/miXed/cyclone/cyclone-meta.pd b/externals/miXed/cyclone/cyclone-meta.pd new file mode 100644 index 000000000..420305390 --- /dev/null +++ b/externals/miXed/cyclone/cyclone-meta.pd @@ -0,0 +1,9 @@ +#N canvas 10 10 200 200 10; +#N canvas 20 20 420 300 META 0; +#X text 10 10 META this is a prototype of a libdir meta file; +#X text 10 30 NAME cyclone; +#X text 10 50 AUTHOR Kzrysztof Czaja; +#X text 10 70 LICENSE BSD; +#X text 10 90 VERSION 0.1-alpha56; +#X text 10 110 DESCRIPTION a library for porting and running Max/MSP patches in Pd; +#X restore 10 10 pd META; diff --git a/externals/miXed/cyclone/cyclone-shared.include b/externals/miXed/cyclone/cyclone-shared.include new file mode 100644 index 000000000..218062448 --- /dev/null +++ b/externals/miXed/cyclone/cyclone-shared.include @@ -0,0 +1,45 @@ +shared/shared.c +shared/shared.h +shared/unstable/forky.c +shared/unstable/forky.h +shared/unstable/fragile.c +shared/unstable/fragile.h +shared/unstable/fringe.c +shared/unstable/fringe.h +shared/unstable/loader.c +shared/unstable/loader.h +shared/unstable/pd_imp.h +shared/unstable/standalone.c +shared/unstable/standalone.h +shared/common/loud.c +shared/common/loud.h +shared/common/grow.c +shared/common/grow.h +shared/common/os.c +shared/common/os.h +shared/common/fitter.c +shared/common/fitter.h +shared/common/lex.c +shared/common/lex.h +shared/common/binport.c +shared/common/binport.h +shared/common/port.c +shared/common/port.h +shared/common/rand.c +shared/common/rand.h +shared/common/vefl.c +shared/common/vefl.h +shared/common/clc.c +shared/common/clc.h +shared/common/mifi.c +shared/common/mifi.h +shared/hammer/file.c +shared/hammer/file.h +shared/hammer/gui.c +shared/hammer/gui.h +shared/hammer/tree.c +shared/hammer/tree.h +shared/sickle/sic.c +shared/sickle/sic.h +shared/sickle/arsic.c +shared/sickle/arsic.h diff --git a/externals/miXed/cyclone/cyclone-test.exclude b/externals/miXed/cyclone/cyclone-test.exclude new file mode 100644 index 000000000..282b4226a --- /dev/null +++ b/externals/miXed/cyclone/cyclone-test.exclude @@ -0,0 +1,6 @@ +*~ +*.pict +import-result.pd +import-debug.pd +temporary +temporary/* diff --git a/externals/miXed/cyclone/cyclone-vicious.exclude b/externals/miXed/cyclone/cyclone-vicious.exclude new file mode 100644 index 000000000..5e5a82ec6 --- /dev/null +++ b/externals/miXed/cyclone/cyclone-vicious.exclude @@ -0,0 +1,3 @@ +*~ +old +old/* diff --git a/externals/miXed/cyclone/hammer/Append.c b/externals/miXed/cyclone/hammer/Append.c new file mode 100644 index 000000000..e98e614e7 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Append.c @@ -0,0 +1,361 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/fitter.h" + +#define APPEND_INISIZE 32 /* LATER rethink */ +#define APPEND_MAXSIZE 256 + +typedef struct _append +{ + t_object x_ob; + int x_size; /* as allocated */ + int x_natoms; /* as used */ + t_atom *x_message; + t_atom *x_messbuf; + t_atom x_messini[APPEND_INISIZE]; + int x_entered; + int x_auxsize; + t_atom *x_auxbuf; + t_pd *x_proxy; +} t_append; + +typedef struct _appendxy +{ + t_pd xy_pd; + t_append *xy_owner; +} t_appendxy; + +static t_class *append_class; +static t_class *appendxy_class; + +static int append_iscompatible = 0; /* FIXME per-object */ + +/* Usually a preallocation method is used, except in special cases of: + 1) reentrant output request, or 2) an output request which would cause + resizing to more than MAXSIZE (no such limit for a 'set' message). + In both special cases, a temporary output buffer is allocated. + A separately preallocated output buffer is not used, thus avoiding + memcpying of the stored message (a small performance gain when the + preallocation method is chosen). Instead, self-invoked 'set' + messages are postponed, using an auxiliary buffer. */ + +/* Any Append's output, except bangout, goes through + outlet_anything() -> typedmess(), LATER rethink */ + +static void append_setnatoms(t_append *x, int natoms) +{ + x->x_message = x->x_messbuf + x->x_size - natoms; + x->x_natoms = natoms; +} + +static void append_bangout(t_outlet *outp, int ac, t_atom *av) +{ + if (ac) + { + if (av->a_type == A_SYMBOL) + outlet_anything(outp, av->a_w.w_symbol, ac-1, av+1); + else if (av->a_type == A_POINTER) + { + if (ac == 1) + outlet_pointer(outp, av->a_w.w_gpointer); + else + outlet_list(outp, &s_list, ac, av); + } + else if (av->a_type == A_FLOAT) + { + if (ac == 1) + outlet_float(outp, av->a_w.w_float); + else + outlet_list(outp, &s_list, ac, av); + } + else loudbug_bug("append_bangout"); + } + else outlet_bang(outp); +} + +static void append_anything(t_append *x, t_symbol *s, int ac, t_atom *av) +{ + int reentered = x->x_entered; + int prealloc = !reentered; + int ntotal = x->x_natoms + ac; + t_atom *buf; + x->x_entered = 1; + if (prealloc && ntotal > x->x_size) + { + if (ntotal > APPEND_MAXSIZE) + prealloc = 0; + else + { + int nrequested = ntotal; + x->x_messbuf = grow_withtail(&nrequested, &x->x_natoms, + (char **)&x->x_message, + &x->x_size, x->x_messbuf, + APPEND_INISIZE, x->x_messini, + sizeof(*x->x_message)); + prealloc = (nrequested == ntotal); + } + } + if (prealloc) + { + buf = x->x_message - ac; + if (ac) + memcpy(buf, av, ac * sizeof(*buf)); + if (s) + outlet_anything(((t_object *)x)->ob_outlet, s, ntotal, buf); + else + append_bangout(((t_object *)x)->ob_outlet, ntotal, buf); + } + else + { + /* LATER consider using the stack if ntotal <= MAXSTACK */ + if (buf = getbytes(ntotal * sizeof(*buf))) + { + if (ac) + memcpy(buf, av, ac * sizeof(*buf)); + if (x->x_natoms) + memcpy(buf + ac, x->x_message, x->x_natoms * sizeof(*buf)); + if (s) + outlet_anything(((t_object *)x)->ob_outlet, s, ntotal, buf); + else + append_bangout(((t_object *)x)->ob_outlet, ntotal, buf); + freebytes(buf, ntotal * sizeof(*buf)); + } + } + if (!reentered) + { + x->x_entered = 0; + if (x->x_auxbuf) + { + if (x->x_auxsize <= x->x_size) + { + append_setnatoms(x, x->x_auxsize / 2); + memcpy(x->x_message, x->x_auxbuf + x->x_natoms, + x->x_natoms * sizeof(*x->x_message)); + freebytes(x->x_auxbuf, x->x_auxsize * sizeof(*x->x_auxbuf)); + } + else + { + if (x->x_messbuf != x->x_messini) + freebytes(x->x_messbuf, x->x_size * sizeof(*x->x_messbuf)); + x->x_size = x->x_auxsize; + x->x_messbuf = x->x_auxbuf; + append_setnatoms(x, x->x_auxsize / 2); + } + x->x_auxbuf = 0; + } + } +} + +static void append_bang(t_append *x) +{ + if (append_iscompatible) + { + /* CHECKED: a nop */ + } + else append_anything(x, 0, 0, 0); +} + +static void append_float(t_append *x, t_float f) +{ + t_atom at; + SETFLOAT(&at, f); + append_anything(x, &s_list, 1, &at); /* CHECKED: converted to list */ +} + +/* CHECKED: incompatible -- LATER consider converting to anything */ +static void append_symbol(t_append *x, t_symbol *s) +{ + t_atom at; + SETSYMBOL(&at, s); + append_anything(x, &s_symbol, 1, &at); +} + +/* LATER gpointer */ + +static void append_doset(t_append *x, t_symbol *s, int ac, t_atom *av) +{ + int newsize = ac * 2; + if (s) + newsize += 2; + if (newsize > 0) + { + if (x->x_entered) + { + if (x->x_auxbuf) + { + loud_warning((t_pd *)x, 0, "\'set\' message overridden"); + freebytes(x->x_auxbuf, x->x_auxsize * sizeof(*x->x_auxbuf)); + x->x_auxsize = 0; + } + if (x->x_auxbuf = getbytes(newsize * sizeof(*x->x_auxbuf))) + { + t_atom *ap = x->x_auxbuf + ac; + if (s) + { + ap++; + SETSYMBOL(ap, s); + ap++; + } + if (ac) + memcpy(ap, av, ac * sizeof(*x->x_auxbuf)); + x->x_auxsize = newsize; + } + } + else + { + t_atom *ap; + if (newsize > x->x_size) + { + int sz = newsize; + x->x_messbuf = grow_nodata(&sz, &x->x_size, x->x_messbuf, + APPEND_INISIZE, x->x_messini, + sizeof(*x->x_messbuf)); + if (sz != newsize) + { + ac = sz / 2; /* LATER rethink */ + if (s) + ac--; + } + } + if (s) + { + append_setnatoms(x, ac + 1); + ap = x->x_message; + SETSYMBOL(ap, s); + ap++; + } + else + { + append_setnatoms(x, ac); + ap = x->x_message; + } + while (ac--) *ap++ = *av++; + } + } +} + +static void append_set(t_append *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_proxy) + append_anything(x, s, ac, av); + else + /* LATER (when?) controlled by maxmode */ + append_doset(x, 0, ac, av); +} + +static void appendxy_bang(t_appendxy *xy) +{ + append_doset(xy->xy_owner, 0, 0, 0); /* LATER rethink */ +} + +static void appendxy_float(t_appendxy *xy, t_float f) +{ + t_atom at; + SETFLOAT(&at, f); + append_doset(xy->xy_owner, 0, 1, &at); +} + +static void appendxy_symbol(t_appendxy *xy, t_symbol *s) +{ + t_atom at; + if (!s || s == &s_) + s = &s_symbol; /* LATER rethink */ + SETSYMBOL(&at, s); + append_doset(xy->xy_owner, 0, 1, &at); +} + +static void appendxy_list(t_appendxy *xy, t_symbol *s, int ac, t_atom *av) +{ + if (ac) + append_doset(xy->xy_owner, 0, ac, av); + else + { /* LATER rethink */ + t_atom at; + SETSYMBOL(&at, &s_list); + append_doset(xy->xy_owner, 0, 1, &at); + } +} + +static void appendxy_anything(t_appendxy *xy, t_symbol *s, int ac, t_atom *av) +{ + append_doset(xy->xy_owner, s, ac, av); +} + +static void append_free(t_append *x) +{ + if (x->x_messbuf != x->x_messini) + freebytes(x->x_messbuf, x->x_size * sizeof(*x->x_messbuf)); + if (x->x_auxbuf) + { + loudbug_bug("append_free"); /* LATER rethink */ + freebytes(x->x_auxbuf, x->x_auxsize * sizeof(*x->x_auxbuf)); + } + if (x->x_proxy) + pd_free(x->x_proxy); +} + +static void *append_new(t_symbol *s, int ac, t_atom *av) +{ + t_append *x = (t_append *)pd_new(append_class); + x->x_size = APPEND_INISIZE; + x->x_natoms = 0; + x->x_messbuf = x->x_messini; + x->x_auxbuf = 0; + x->x_entered = 0; + append_setnatoms(x, 0); + if (ac) + { + x->x_proxy = 0; + append_doset(x, 0, ac, av); + } + else + { + x->x_proxy = pd_new(appendxy_class); + ((t_appendxy *)x->x_proxy)->xy_owner = x; + inlet_new((t_object *)x, x->x_proxy, 0, 0); + } + outlet_new((t_object *)x, &s_anything); + return (x); +} + +static void append_fitter(void) +{ + append_iscompatible = fittermax_get(); +} + +void Append_setup(void) +{ + append_class = class_new(gensym("Append"), + (t_newmethod)append_new, + (t_method)append_free, + sizeof(t_append), 0, + A_GIMME, 0); + class_addbang(append_class, append_bang); + class_addfloat(append_class, append_float); + class_addsymbol(append_class, append_symbol); + class_addlist(append_class, append_anything); /* LATER rethink */ + class_addanything(append_class, append_anything); + class_addmethod(append_class, (t_method)append_set, + gensym("set"), A_GIMME, 0); + + appendxy_class = class_new(gensym("append"), 0, 0, sizeof(t_appendxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(appendxy_class, appendxy_bang); + class_addfloat(appendxy_class, appendxy_float); + class_addsymbol(appendxy_class, appendxy_symbol); + class_addlist(appendxy_class, appendxy_list); + class_addanything(appendxy_class, appendxy_anything); + + fitter_setup(append_class, append_fitter); +} + +void append_setup(void) +{ + Append_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Borax.c b/externals/miXed/cyclone/hammer/Borax.c new file mode 100644 index 000000000..a773958bc --- /dev/null +++ b/externals/miXed/cyclone/hammer/Borax.c @@ -0,0 +1,184 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* The first version of this code was written by Olaf Matthes. + It was entirely reimplemented in the hope of adapting it to the + cyclone's guidelines. */ + +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" + +#define BORAX_MAXVOICES 128 /* CHECKME */ + +typedef struct _Borax_voice +{ + int v_index; /* free iff zero */ + double v_onset; + int v_nonsets; +} t_Borax_voice; + +typedef struct _Borax +{ + t_object x_ob; + int x_vel; /* CHECKME t_float controlled with floatinlet + (CHECKME the same in flush) */ + double x_onset; + int x_nonsets; + int x_ndurs; + int x_ndtimes; + int x_minindex; + int x_indices[BORAX_MAXVOICES]; /* 0 (free) or 1 (used) */ + int x_nvoices; + t_Borax_voice x_voices[BORAX_MAXVOICES]; + t_outlet *x_voiceout; + t_outlet *x_nvoicesout; + t_outlet *x_pitchout; + t_outlet *x_velout; + t_outlet *x_ndursout; + t_outlet *x_durout; + t_outlet *x_ndtimesout; + t_outlet *x_dtimeout; +} t_Borax; + +static t_class *Borax_class; + +static void Borax_delta(t_Borax *x) +{ + /* CHECKME first note */ + float dtime = clock_gettimesince(x->x_onset); /* CHECKME */ + outlet_float(x->x_dtimeout, dtime); + outlet_float(x->x_ndtimesout, ++x->x_ndtimes); /* CHECKME */ +} + +static void Borax_durout(t_Borax *x, int pitch) +{ + float dur = clock_gettimesince(x->x_voices[pitch].v_onset); /* CHECKME */ + outlet_float(x->x_durout, dur); + outlet_float(x->x_ndursout, ++x->x_ndurs); /* CHECKME */ +} + +static void Borax_float(t_Borax *x, t_float f) +{ + int pitch; + if (loud_checkint((t_pd *)x, f, &pitch, &s_float)) /* CHECKME */ + { + int index; + if (pitch < 0 || pitch >= BORAX_MAXVOICES) + { + /* CHECKME pitch range, complaints */ + return; + } + index = x->x_voices[pitch].v_index; + if (x->x_vel) + { + if (index) + return; /* CHECKME */ + x->x_indices[index = x->x_minindex] = 1; + while (x->x_indices[++x->x_minindex]); + index++; /* CHECKME one-based? */ + Borax_delta(x); + x->x_onset = clock_getlogicaltime(); /* CHECKME (in delta?) */ + x->x_voices[pitch].v_index = index; + x->x_voices[pitch].v_onset = x->x_onset; + x->x_voices[pitch].v_nonsets = ++x->x_nonsets; + x->x_nvoices++; + } + else + { + if (!index) + return; /* CHECKME */ + index--; + x->x_indices[index] = 0; + if (index < x->x_minindex) x->x_minindex = index; + index++; + Borax_durout(x, pitch); + x->x_voices[pitch].v_index = 0; + x->x_nvoices--; + } + outlet_float(x->x_velout, x->x_vel); + outlet_float(x->x_pitchout, pitch); + outlet_float(x->x_nvoicesout, x->x_nvoices); + outlet_float(x->x_voiceout, index); + outlet_float(((t_object *)x)->ob_outlet, x->x_voices[pitch].v_nonsets); + } +} + +static void Borax_ft1(t_Borax *x, t_floatarg f) +{ + x->x_vel = (int)f; /* CHECKME */ +} + +static void Borax_reset(t_Borax *x) +{ + x->x_vel = 0; + x->x_onset = clock_getlogicaltime(); + x->x_nonsets = x->x_ndurs = x->x_ndtimes = 0; + x->x_minindex = 0; + memset(x->x_indices, 0, sizeof(x->x_indices)); + x->x_nvoices = 0; + memset(x->x_voices, 0, sizeof(x->x_voices)); +} + +static void Borax_bang2(t_Borax *x) +{ + int pitch; + for (pitch = 0; pitch < BORAX_MAXVOICES; pitch++) + { + if (x->x_voices[pitch].v_index) + { + /* CHECKME counters, etc. */ + Borax_durout(x, pitch); + outlet_float(x->x_velout, 0); + outlet_float(x->x_pitchout, pitch); + outlet_float(x->x_nvoicesout, --x->x_nvoices); + outlet_float(x->x_voiceout, x->x_voices[pitch].v_index); + outlet_float(((t_object *)x)->ob_outlet, + x->x_voices[pitch].v_nonsets); + } + } + Borax_reset(x); +} + +/* CHECKME flush in a destructor */ + +static void *Borax_new(void) +{ + t_Borax *x = (t_Borax *)pd_new(Borax_class); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + inlet_new((t_object *)x, (t_pd *)x, &s_bang, gensym("bang2")); + outlet_new((t_object *)x, &s_float); + x->x_voiceout = outlet_new((t_object *)x, &s_float); + x->x_nvoicesout = outlet_new((t_object *)x, &s_float); + x->x_pitchout = outlet_new((t_object *)x, &s_float); + x->x_velout = outlet_new((t_object *)x, &s_float); + x->x_ndursout = outlet_new((t_object *)x, &s_float); + x->x_durout = outlet_new((t_object *)x, &s_float); + x->x_ndtimesout = outlet_new((t_object *)x, &s_float); + x->x_dtimeout = outlet_new((t_object *)x, &s_float); + Borax_reset(x); + return (x); +} + +void Borax_setup(void) +{ + Borax_class = class_new(gensym("Borax"), + (t_newmethod)Borax_new, 0, + sizeof(t_Borax), 0, 0); + class_addcreator((t_newmethod)Borax_new, gensym("borax"), 0, 0); + class_addcreator((t_newmethod)Borax_new, gensym("cyclone/borax"), 0, 0); + class_addfloat(Borax_class, Borax_float); + /* CHECKME list unfolding */ + class_addmethod(Borax_class, (t_method)Borax_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(Borax_class, (t_method)Borax_bang2, + gensym("bang2"), 0); + class_addmethod(Borax_class, (t_method)Borax_delta, + gensym("delta"), 0); +} + +void borax_setup(void) +{ + Borax_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Bucket.c b/externals/miXed/cyclone/hammer/Bucket.c new file mode 100644 index 000000000..fcfa2bb84 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Bucket.c @@ -0,0 +1,152 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is a modified version of Joseph A. Sarlo's code. + The most important changes are listed in "pd-lib-notes.txt" file. */ + +#include "m_pd.h" +#include "shared.h" + +typedef struct _Bucket +{ + t_object x_ob; + int x_numbucks; + t_float *x_bucks; /* CHECKED: no limit */ + t_outlet **x_outs; + short int x_frozen; /* 0 for thawed, 1 for frozen */ + short int x_dir; /* 0 for L2R, 1 for R2L */ + short int x_max5mode; /* 0 for classic Max 4.6 mode, + 1 for Max 5 mode (with 2nd !0 argument) */ +} t_Bucket; + +static t_class *Bucket_class; + +static void Bucket_bang(t_Bucket *x) +{ + int i = x->x_numbucks; + /* CHECKED: outlets output in right-to-left order */ + while (i--) outlet_float(x->x_outs[i], x->x_bucks[i]); +} + +static void Bucket_float(t_Bucket *x, t_float val) +{ + int i; + + if (!x->x_frozen) + Bucket_bang(x); + if (!x->x_dir) + { + for (i = x->x_numbucks - 1; i > 0; i--) + x->x_bucks[i] = x->x_bucks[i - 1]; + x->x_bucks[0] = val; + } + else + { + for (i = 0; i < x->x_numbucks - 1; i++) + x->x_bucks[i] = x->x_bucks[i + 1]; + x->x_bucks[x->x_numbucks - 1] = val; + } + if (x->x_max5mode && !x->x_frozen) + Bucket_bang(x); +} + +static void Bucket_freeze(t_Bucket *x) +{ + x->x_frozen = 1; +} + +static void Bucket_thaw(t_Bucket *x) +{ + x->x_frozen = 0; +} + +static void Bucket_roll(t_Bucket *x) +{ + if (x->x_dir) + Bucket_float(x, x->x_bucks[0]); + else + Bucket_float(x, x->x_bucks[x->x_numbucks - 1]); +} + +static void Bucket_rtol(t_Bucket *x) +{ + x->x_dir = 1; +} + +static void Bucket_ltor(t_Bucket *x) +{ + x->x_dir = 0; +} + +static void Bucket_set(t_Bucket *x, t_floatarg f) +{ + int i = x->x_numbucks; + while (i--) x->x_bucks[i] = f; + if (!x->x_frozen) /* CHECKED */ + Bucket_bang(x); +} + +static void Bucket_free(t_Bucket *x) +{ + if (x->x_bucks) + freebytes(x->x_bucks, x->x_numbucks * sizeof(*x->x_bucks)); + if (x->x_outs) + freebytes(x->x_outs, x->x_numbucks * sizeof(*x->x_outs)); +} + +static void *Bucket_new(t_floatarg val, t_floatarg max5mode) +{ + t_Bucket *x; + int nbucks = (int)val; + t_float *bucks; + t_outlet **outs; + if (nbucks < 1) + nbucks = 1; + if (!(bucks = (t_float *)getbytes(nbucks * sizeof(*bucks)))) + return (0); + if (!(outs = (t_outlet **)getbytes(nbucks * sizeof(*outs)))) + { + freebytes(bucks, nbucks * sizeof(*bucks)); + return (0); + } + x = (t_Bucket *)pd_new(Bucket_class); + x->x_numbucks = nbucks; + x->x_bucks = bucks; + x->x_outs = outs; + x->x_frozen = 0; + x->x_dir = 0; + x->x_max5mode = ((int)max5mode != 0); + while (nbucks--) *outs++ = outlet_new((t_object *)x, &s_float); + return (x); +} + +void Bucket_setup(void) +{ + Bucket_class = class_new(gensym("Bucket"), + (t_newmethod)Bucket_new, + (t_method)Bucket_free, + sizeof(t_Bucket), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addcreator((t_newmethod)Bucket_new, gensym("bucket"), A_DEFFLOAT, 0); + class_addcreator((t_newmethod)Bucket_new, gensym("cyclone/bucket"), A_DEFFLOAT, 0); + class_addbang(Bucket_class, Bucket_bang); + class_addfloat(Bucket_class, Bucket_float); + class_addmethod(Bucket_class, (t_method)Bucket_freeze, gensym("freeze"), 0); + class_addmethod(Bucket_class, (t_method)Bucket_thaw, gensym("thaw"), 0); + class_addmethod(Bucket_class, (t_method)Bucket_ltor, gensym("L2R"), 0); + class_addmethod(Bucket_class, (t_method)Bucket_rtol, gensym("R2L"), 0); + /* CHECKED (refman error) roll has no argument */ + class_addmethod(Bucket_class, (t_method)Bucket_roll, gensym("roll"), 0); + /* 3.5 additions */ + class_addmethod(Bucket_class, (t_method)Bucket_set, + gensym("set"), A_FLOAT, 0); + class_addmethod(Bucket_class, (t_method)Bucket_ltor, gensym("l2r"), 0); + class_addmethod(Bucket_class, (t_method)Bucket_rtol, gensym("r2l"), 0); +// logpost(NULL, 4, "this is cyclone/Bucket %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} + +void bucket_setup(void) +{ + Bucket_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Clip.c b/externals/miXed/cyclone/hammer/Clip.c new file mode 100644 index 000000000..d0c54ebf5 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Clip.c @@ -0,0 +1,156 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" + +#define CLIP_INISIZE 32 /* LATER rethink */ +#define CLIP_MAXSIZE 256 + +typedef struct _clip +{ + t_object x_ob; + float x_f1; + float x_f2; + int x_size; /* as allocated */ + t_atom *x_message; + t_atom x_messini[CLIP_INISIZE]; + int x_entered; +} t_clip; + +static t_class *clip_class; + +/* CHECKED case of f1 > f2: x <= f2 => f1, x > f2 => f2 + (Pd implementation of clip has it the other way around) */ +static void clip_float(t_clip *x, t_float f) +{ + outlet_float(((t_object *)x)->ob_outlet, + (f > x->x_f2 ? x->x_f2 : (f < x->x_f1 ? x->x_f1 : f))); +} + +static void clip_list(t_clip *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac) + { + int docopy = 0; + int i; + t_atom *ap; + t_float f1 = x->x_f1; + t_float f2 = x->x_f2; + for (i = 0, ap = av; i < ac; i++, ap++) + { + t_float f; + if (ap->a_type == A_FLOAT) + f = ap->a_w.w_float; + else + { + docopy = 1; + /* CHECKED: symbols inside lists are converted to zeros */ + f = 0; + } + if (f < f1 || f > f2) docopy = 1; + } + if (docopy) + { + t_atom *buf; + t_atom *bp; + int reentered = x->x_entered; + int prealloc = !reentered; + x->x_entered = 1; + if (prealloc && ac > x->x_size) + { + if (ac > CLIP_MAXSIZE) + prealloc = 0; + else + x->x_message = grow_nodata(&ac, &x->x_size, x->x_message, + CLIP_INISIZE, x->x_messini, + sizeof(*x->x_message)); + } + if (prealloc) buf = x->x_message; + else + /* LATER consider using the stack if ntotal <= MAXSTACK */ + buf = getbytes(ac * sizeof(*buf)); + if (buf) + { + for (i = 0, ap = av, bp = buf; i < ac; i++, ap++, bp++) + { + t_float f = (ap->a_type == A_FLOAT ? ap->a_w.w_float : 0); + if (f < f1) + f = f1; + else if (f > f2) + f = f2; + SETFLOAT(bp, f); + } + outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, buf); + if (buf != x->x_message) + freebytes(buf, ac * sizeof(*buf)); + } + if (!reentered) + { + x->x_entered = 0; + } + } + else outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, av); + } +} + +static void clip_set(t_clip *x, t_symbol *s, int ac, t_atom *av) +{ + x->x_f1 = 0; + x->x_f2 = 0; + if (ac) /* CHECKED: 'set' without arguments sets both values to 0 */ + { + if (av->a_type == A_FLOAT) /* CHECKED: symbol is converted to 0 */ + x->x_f1 = av->a_w.w_float; + av++; + if (--ac) + { + if (av->a_type == A_FLOAT) + x->x_f2 = av->a_w.w_float; + } + else x->x_f2 = x->x_f1; /* CHECKED */ + } +} + +static void clip_free(t_clip *x) +{ + if (x->x_message != x->x_messini) + freebytes(x->x_message, x->x_size * sizeof(*x->x_message)); +} + +static void *clip_new(t_symbol *s, int ac, t_atom *av) +{ + t_clip *x = (t_clip *)pd_new(clip_class); + x->x_f1 = 0; + x->x_f2 = 0; + x->x_size = CLIP_INISIZE; + x->x_message = x->x_messini; + x->x_entered = 0; + floatinlet_new((t_object *)x, &x->x_f1); + floatinlet_new((t_object *)x, &x->x_f2); + outlet_new(&x->x_ob, &s_anything); + clip_set(x, 0, ac, av); + return (x); +} + +void Clip_setup(void) +{ + clip_class = class_new(gensym("Clip"), + (t_newmethod)clip_new, + (t_method)clip_free, + sizeof(t_clip), 0, + A_GIMME, 0); + class_addcreator((t_newmethod)clip_new, gensym("clip"), A_GIMME, 0); + class_addcreator((t_newmethod)clip_new, gensym("cyclone/clip"), A_GIMME, 0); + class_addfloat(clip_class, clip_float); + class_addlist(clip_class, clip_list); + class_addmethod(clip_class, (t_method)clip_set, + gensym("set"), A_GIMME, 0); +} + +void clip_setup(void) +{ + Clip_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Decode.c b/externals/miXed/cyclone/hammer/Decode.c new file mode 100644 index 000000000..b01a82fdb --- /dev/null +++ b/externals/miXed/cyclone/hammer/Decode.c @@ -0,0 +1,119 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is an entirely rewritten version of Joseph A. Sarlo's code. + The most important changes are listed in "pd-lib-notes.txt" file. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" + +#define DECODE_C74MAXOUTS 8 /* CHECKED (does it make any sense?) */ +#define DECODE_DEFOUTS 1 + +typedef struct _Decode +{ + t_object x_ob; + int x_numouts; + int x_onout; + int x_allon; /* submaster switch */ + int x_alloff; /* master switch */ + t_outlet **x_outs; + t_outlet *x_outbuf[DECODE_C74MAXOUTS]; +} t_Decode; + +static t_class *Decode_class; + +/* CHECKED: all outlets deliver after any action */ +/* CHECKED: outlets output in right-to-left order */ + +static void Decode_deliver(t_Decode *x) +{ + int i = x->x_numouts; + if (x->x_alloff) + while (i--) outlet_float(x->x_outs[i], 0); + else if (x->x_allon) + while (i--) outlet_float(x->x_outs[i], 1); + else + while (i--) outlet_float(x->x_outs[i], (i == x->x_onout ? 1 : 0)); +} + +static void Decode_float(t_Decode *x, t_floatarg f) +{ + int val = (int)f; + /* CHECKED: out-of-range input is clipped, not ignored */ + if (val < 0) + val = 0; + else if (val >= x->x_numouts) + val = x->x_numouts - 1; + /* CHECKED: while in all-off mode, input is stored, not ignored */ + x->x_onout = val; + Decode_deliver(x); +} + +static void Decode_allon(t_Decode *x, t_floatarg f) +{ + x->x_allon = (f != 0); + Decode_deliver(x); +} + +static void Decode_alloff(t_Decode *x, t_floatarg f) +{ + x->x_alloff = (f != 0); + Decode_deliver(x); +} + +static void Decode_free(t_Decode *x) +{ + if (x->x_outs != x->x_outbuf) + freebytes(x->x_outs, x->x_numouts * sizeof(*x->x_outs)); +} + +static void *Decode_new(t_floatarg val) +{ + t_Decode *x; + int i, nouts = (int)val; + t_outlet **outs; + if (nouts < 1) + nouts = DECODE_DEFOUTS; + if (nouts > DECODE_C74MAXOUTS) + { + fittermax_rangewarning(Decode_class, DECODE_C74MAXOUTS, "outlets"); + if (!(outs = (t_outlet **)getbytes(nouts * sizeof(*outs)))) + return (0); + } + else outs = 0; + x = (t_Decode *)pd_new(Decode_class); + x->x_numouts = nouts; + x->x_outs = (outs ? outs : x->x_outbuf); + x->x_onout = 0; + x->x_allon = 0; + x->x_alloff = 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")); + for (i = 0; i < nouts; i++) + x->x_outs[i] = outlet_new((t_object *)x, &s_float); + return (x); +} + +void Decode_setup(void) +{ + Decode_class = class_new(gensym("Decode"), + (t_newmethod)Decode_new, + (t_method)Decode_free, + sizeof(t_Decode), 0, A_DEFFLOAT, 0); + class_addcreator((t_newmethod)Decode_new, gensym("decode"), A_DEFFLOAT, 0); + class_addcreator((t_newmethod)Decode_new, gensym("cyclone/decode"), A_DEFFLOAT, 0); + class_addfloat(Decode_class, Decode_float); + class_addmethod(Decode_class, (t_method)Decode_allon, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(Decode_class, (t_method)Decode_alloff, + gensym("ft2"), A_FLOAT, 0); + fitter_setup(Decode_class, 0); +} + +void decode_setup(void) +{ + Decode_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Histo.c b/externals/miXed/cyclone/hammer/Histo.c new file mode 100644 index 000000000..c6f61eb47 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Histo.c @@ -0,0 +1,110 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is an entirely rewritten version of Joseph A. Sarlo's code. + The most important changes are listed in "pd-lib-notes.txt" file. */ + +#include "m_pd.h" +#include "common/loud.h" + +#define HISTO_DEFSIZE 128 + +typedef struct _Histo +{ + t_object x_ob; + int x_size; + unsigned *x_hist; /* LATER consider using 64 bits */ + int x_lastinput; + t_outlet *x_countout; +} t_Histo; + +static t_class *Histo_class; + +static void Histo_clear(t_Histo *x) +{ + int i = x->x_size; + while (i--) x->x_hist[i] = 0; + /* CHECKED: last input is kept */ +} + +static void Histo_doit(t_Histo *x, int val, int doincr) +{ + if (val >= 0 && val < x->x_size) + { + if (doincr) + { + /* CHECKED: only in-range numbers are stored */ + x->x_lastinput = val; + x->x_hist[val]++; + } + outlet_float(x->x_countout, x->x_hist[val]); + /* CHECKED: out-of-range numbers are never passed thru */ + outlet_float(((t_object *)x)->ob_outlet, val); + } +} + +static void Histo_bang(t_Histo *x) +{ + Histo_doit(x, x->x_lastinput, 0); +} + +static void Histo_float(t_Histo *x, t_floatarg f) +{ + int i; + if (loud_checkint((t_pd *)x, f, &i, &s_float)) /* CHECKED */ + Histo_doit(x, i, 1); +} + +static void Histo_ft1(t_Histo *x, t_floatarg f) +{ + /* CHECKED: floats are accepted in second inlet (truncated) */ + Histo_doit(x, (int)f, 0); +} + +static void Histo_free(t_Histo *x) +{ + if (x->x_hist) + freebytes(x->x_hist, x->x_size * sizeof(*x->x_hist)); +} + +static void *Histo_new(t_floatarg f) +{ + t_Histo *x; + int size = (int)f; + unsigned *hist; + if (size < 1) /* CHECKED: 1 is allowed */ + size = HISTO_DEFSIZE; + if (!(hist = (unsigned *)getbytes(size * sizeof(*hist)))) + return (0); + x = (t_Histo *)pd_new(Histo_class); + x->x_size = size; + x->x_hist = hist; + x->x_lastinput = 0; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + x->x_countout = outlet_new((t_object *)x, &s_float); + Histo_clear(x); + return (x); +} + +void Histo_setup(void) +{ + Histo_class = class_new(gensym("Histo"), + (t_newmethod)Histo_new, + (t_method)Histo_free, + sizeof(t_Histo), 0, A_DEFFLOAT, 0); + class_addcreator((t_newmethod)Histo_new, gensym("histo"), A_DEFFLOAT, 0); + class_addcreator((t_newmethod)Histo_new, gensym("cyclone/histo"), A_DEFFLOAT, 0); + class_addbang(Histo_class, Histo_bang); + class_addfloat(Histo_class, Histo_float); + class_addmethod(Histo_class, (t_method)Histo_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(Histo_class, (t_method)Histo_clear, + gensym("clear"), 0); +} + +void histo_setup(void) +{ + Histo_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Makefile b/externals/miXed/cyclone/hammer/Makefile new file mode 100644 index 000000000..54383c381 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Makefile @@ -0,0 +1,3 @@ +ROOT_DIR = ../.. +redefault: allhammers.c default +include $(ROOT_DIR)/Makefile.common diff --git a/externals/miXed/cyclone/hammer/Makefile.objects b/externals/miXed/cyclone/hammer/Makefile.objects new file mode 100644 index 000000000..a7099d8f0 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Makefile.objects @@ -0,0 +1,17 @@ +SHARED_OBJECTS = \ +unstable/forky.o \ +unstable/fragile.o \ +unstable/fringe.o \ +common/loud.o \ +common/grow.o \ +common/os.o \ +common/fitter.o \ +common/rand.o \ +common/vefl.o \ +common/mifi.o \ +common/lex.o \ +common/binport.o \ +common/port.o \ +hammer/file.o \ +hammer/gui.o \ +hammer/tree.o diff --git a/externals/miXed/cyclone/hammer/Makefile.sources b/externals/miXed/cyclone/hammer/Makefile.sources new file mode 100644 index 000000000..89d9b2d33 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Makefile.sources @@ -0,0 +1,82 @@ +CX_SOURCES = \ +hammer.c + +OTHER_SOURCES = \ +allhammers.c \ +testmess.c \ +accum.c \ +acos.c \ +active.c \ +anal.c \ +Append.c \ +asin.c \ +bangbang.c \ +bondo.c \ +Borax.c \ +Bucket.c \ +buddy.c \ +capture.c \ +cartopol.c \ +Clip.c \ +coll.c \ +comment.c \ +cosh.c \ +counter.c \ +cycle.c \ +decide.c \ +Decode.c \ +drunk.c \ +flush.c \ +forward.c \ +fromsymbol.c \ +funbuff.c \ +funnel.c \ +gate.c \ +grab.c \ +Histo.c \ +iter.c \ +match.c \ +maximum.c \ +mean.c \ +midiflush.c \ +midiformat.c \ +midiparse.c \ +minimum.c \ +mousefilter.c \ +MouseState.c \ +mtr.c \ +next.c \ +offer.c \ +onebang.c \ +past.c \ +Peak.c \ +poltocar.c \ +prepend.c \ +prob.c \ +pv.c \ +seq.c \ +sinh.c \ +speedlim.c \ +spell.c \ +split.c \ +spray.c \ +sprintf.c \ +substitute.c \ +sustain.c \ +switch.c \ +Table.c \ +tanh.c \ +thresh.c \ +TogEdge.c \ +tosymbol.c \ +Trough.c \ +universal.c \ +urn.c \ +Uzi.c \ +xbendin.c \ +xbendin2.c \ +xbendout.c \ +xbendout2.c \ +xnotein.c \ +xnoteout.c \ +zl.c diff --git a/externals/miXed/cyclone/hammer/MouseState.c b/externals/miXed/cyclone/hammer/MouseState.c new file mode 100644 index 000000000..085fdae43 --- /dev/null +++ b/externals/miXed/cyclone/hammer/MouseState.c @@ -0,0 +1,160 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "hammer/gui.h" + +typedef struct _MouseState +{ + t_object x_ob; + int x_ispolling; + int x_wasbanged; + int x_waszeroed; + int x_hlast; + int x_vlast; + int x_hzero; + int x_vzero; + t_outlet *x_hposout; + t_outlet *x_vposout; + t_outlet *x_hdiffout; + t_outlet *x_vdiffout; +} t_MouseState; + +static t_class *MouseState_class; + +static void MouseState_anything(t_MouseState *x, + t_symbol *s, int ac, t_atom *av) +{ + /* dummy method, filtering out those messages from gui, + which are not handled explicitly */ +} + +static void MouseState_doup(t_MouseState *x, t_floatarg f) +{ + outlet_float(((t_object *)x)->ob_outlet, ((int)f ? 0 : 1)); +} + +static void MouseState_dobang(t_MouseState *x, t_floatarg f1, t_floatarg f2) +{ + if (x->x_wasbanged) + { + int h = (int)f1, v = (int)f2; + outlet_float(x->x_vdiffout, v - x->x_vlast); + outlet_float(x->x_hdiffout, h - x->x_hlast); + outlet_float(x->x_vposout, v - x->x_vzero); + outlet_float(x->x_hposout, h - x->x_hzero); + x->x_hlast = h; + x->x_vlast = v; + x->x_wasbanged = 0; + } +} + +static void MouseState_dozero(t_MouseState *x, t_floatarg f1, t_floatarg f2) +{ + if (x->x_waszeroed) + { + int h = (int)f1, v = (int)f2; + x->x_hzero = h; + x->x_vzero = v; + x->x_waszeroed = 0; + } +} + +static void MouseState_dopoll(t_MouseState *x, t_floatarg f1, t_floatarg f2) +{ + if (x->x_ispolling) + { + x->x_wasbanged = 1; + MouseState_dobang(x, f1, f2); + } +} + +static void MouseState_bang(t_MouseState *x) +{ + hammergui_mousexy(gensym("_bang")); + x->x_wasbanged = 1; +} + +static void MouseState_poll(t_MouseState *x) +{ + if (!x->x_ispolling) + { + x->x_ispolling = 1; + hammergui_startpolling((t_pd *)x); + } +} + +static void MouseState_nopoll(t_MouseState *x) +{ + if (x->x_ispolling) + { + x->x_ispolling = 0; + hammergui_stoppolling((t_pd *)x); + } +} + +static void MouseState_zero(t_MouseState *x) +{ + hammergui_mousexy(gensym("_zero")); + x->x_waszeroed = 1; +} + +static void MouseState_reset(t_MouseState *x) +{ + x->x_hzero = x->x_vzero = 0; +} + +static void MouseState_free(t_MouseState *x) +{ + MouseState_nopoll(x); + hammergui_unbindmouse((t_pd *)x); +} + +static void *MouseState_new(void) +{ + t_MouseState *x = (t_MouseState *)pd_new(MouseState_class); + x->x_ispolling = x->x_wasbanged = x->x_waszeroed = 0; + outlet_new((t_object *)x, &s_float); + x->x_hposout = outlet_new((t_object *)x, &s_float); + x->x_vposout = outlet_new((t_object *)x, &s_float); + x->x_hdiffout = outlet_new((t_object *)x, &s_float); + x->x_vdiffout = outlet_new((t_object *)x, &s_float); + hammergui_bindmouse((t_pd *)x); + hammergui_willpoll(); + MouseState_reset(x); + return (x); +} + +void MouseState_setup(void) +{ + MouseState_class = class_new(gensym("MouseState"), + (t_newmethod)MouseState_new, + (t_method)MouseState_free, + sizeof(t_MouseState), 0, 0); + class_addcreator((t_newmethod)MouseState_new, gensym("mousestate"), 0, 0); + class_addcreator((t_newmethod)MouseState_new, gensym("cyclone/mousestate"), 0, 0); + class_addanything(MouseState_class, MouseState_anything); + class_addmethod(MouseState_class, (t_method)MouseState_doup, + gensym("_up"), A_FLOAT, 0); + class_addmethod(MouseState_class, (t_method)MouseState_dobang, + gensym("_bang"), A_FLOAT, A_FLOAT, 0); + class_addmethod(MouseState_class, (t_method)MouseState_dozero, + gensym("_zero"), A_FLOAT, A_FLOAT, 0); + class_addmethod(MouseState_class, (t_method)MouseState_dopoll, + gensym("_poll"), A_FLOAT, A_FLOAT, 0); + class_addbang(MouseState_class, MouseState_bang); + class_addmethod(MouseState_class, (t_method)MouseState_poll, + gensym("poll"), 0); + class_addmethod(MouseState_class, (t_method)MouseState_nopoll, + gensym("nopoll"), 0); + class_addmethod(MouseState_class, (t_method)MouseState_zero, + gensym("zero"), 0); + class_addmethod(MouseState_class, (t_method)MouseState_reset, + gensym("reset"), 0); +} + +void mousestate_setup(void) +{ + MouseState_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Peak.c b/externals/miXed/cyclone/hammer/Peak.c new file mode 100644 index 000000000..a17da3997 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Peak.c @@ -0,0 +1,70 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +#define PEAK_INITIAL 0 + +typedef struct _Peak +{ + t_object x_ob; + t_float x_value; + t_outlet *x_out2; + t_outlet *x_out3; +} t_Peak; + +static t_class *Peak_class; + +static void Peak_bang(t_Peak *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void Peak_ft1(t_Peak *x, t_floatarg f) +{ + /* CHECKME loud_checkint */ + outlet_float(x->x_out3, 0); /* CHECKME */ + outlet_float(x->x_out2, 1); + outlet_float(((t_object *)x)->ob_outlet, x->x_value = f); +} + +static void Peak_float(t_Peak *x, t_float f) +{ + /* CHECKME loud_checkint */ + if (f > x->x_value) Peak_ft1(x, f); + else + { + outlet_float(x->x_out3, 1); + outlet_float(x->x_out2, 0); + } +} + +static void *Peak_new(t_floatarg f) +{ + t_Peak *x = (t_Peak *)pd_new(Peak_class); + x->x_value = PEAK_INITIAL; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + x->x_out2 = outlet_new((t_object *)x, &s_float); + x->x_out3 = outlet_new((t_object *)x, &s_float); + return (x); +} + +void Peak_setup(void) +{ + Peak_class = class_new(gensym("Peak"), + (t_newmethod)Peak_new, 0, + sizeof(t_Peak), 0, 0); + class_addcreator((t_newmethod)Peak_new, gensym("peak"), 0, 0); + class_addcreator((t_newmethod)Peak_new, gensym("cyclone/peak"), 0, 0); + class_addbang(Peak_class, Peak_bang); + class_addfloat(Peak_class, Peak_float); + class_addmethod(Peak_class, (t_method)Peak_ft1, + gensym("ft1"), A_FLOAT, 0); +} + +void peak_setup(void) +{ + Peak_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Table.c b/externals/miXed/cyclone/hammer/Table.c new file mode 100644 index 000000000..0d2894156 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Table.c @@ -0,0 +1,951 @@ +/* Copyright (c) 2004-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Write access is totally encapsulated in tablecommon calls, in order + to simplify proper handling of the distribution cache. Direct read + access from table calls is allowed (for speed). */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/rand.h" +#include "hammer/file.h" + +#ifdef KRZYSZCZ +#define TABLE_DEBUG +#endif + +#define TABLE_INISIZE 256 /* LATER rethink */ +#define TABLE_DEFLENGTH 128 /* CHECKED */ +#define TABLE_MINLENGTH 2 /* CHECKED */ +#define TABLE_MAXLENGTH 16383 /* CHECKED, LATER rethink */ +#define TABLE_MINRANGE 2 /* CHECKED */ +#define TABLE_MAXQ 32768 /* CHECKME */ + +typedef struct _tablecommon +{ + t_pd c_pd; + struct _table *c_refs; + int c_increation; + int c_volatile; + int c_selfmodified; + int c_entered; /* a counter, LATER rethink */ + /* CHECKED flags, etc. are common fields */ + int c_visflag; + int c_embedflag; + int c_dontsaveflag; + int c_notenamesflag; + int c_signedflag; + int c_range; + int c_left; + int c_top; + int c_right; + int c_bottom; + int c_size; /* as allocated */ + int c_length; /* as used */ + int *c_table; + int c_tableini[TABLE_INISIZE]; + int c_cacheisfresh; + int c_cachesum; + int c_cachemin; + int c_cachemax; + int *c_cache; + int c_cacheini[TABLE_INISIZE]; + t_symbol *c_filename; + t_canvas *c_lastcanvas; + t_hammerfile *c_filehandle; +} t_tablecommon; + +typedef struct _table +{ + t_object x_ob; + t_canvas *x_glist; + t_symbol *x_name; + t_tablecommon *x_common; + t_float x_value; + int x_valueset; + int x_head; + int x_intraversal; /* ``set-with-next/prev'' flag */ + int x_loadflag; + int x_loadndx; + unsigned int x_seed; + t_hammerfile *x_filehandle; + t_outlet *x_bangout; + struct _table *x_next; +} t_table; + +static t_class *table_class; +static t_class *tablecommon_class; + +static void tablecommon_modified(t_tablecommon *cc, int relocated) +{ + cc->c_cacheisfresh = 0; + if (cc->c_increation) + return; + if (relocated) + { + cc->c_volatile = 1; + } + if (cc->c_embedflag) + { + t_table *x; + for (x = cc->c_refs; x; x = x->x_next) + if (x->x_glist && glist_isvisible(x->x_glist)) + canvas_dirty(x->x_glist, 1); + } +} + +static int tablecommon_getindex(t_tablecommon *cc, int ndx) +{ + int nmx = cc->c_length - 1; + /* CHECKED ndx silently clipped */ + return (ndx < 0 ? 0 : (ndx > nmx ? nmx : ndx)); +} + +static int tablecommon_getvalue(t_tablecommon *cc, int ndx) +{ + int nmx = cc->c_length - 1; + /* CHECKED ndx silently clipped */ + return (cc->c_table[ndx < 0 ? 0 : (ndx > nmx ? nmx : ndx)]); +} + +static void tablecommon_setvalue(t_tablecommon *cc, int ndx, int v) +{ + int nmx = cc->c_length - 1; + /* CHECKED ndx silently clipped, value not clipped */ + cc->c_table[ndx < 0 ? 0 : (ndx > nmx ? nmx : ndx)] = v; + tablecommon_modified(cc, 0); +} + +static int tablecommon_loadvalue(t_tablecommon *cc, int ndx, int v) +{ + /* CHECKME */ + if (ndx < cc->c_length) + { + cc->c_table[ndx] = v; + tablecommon_modified(cc, 0); + return (1); + } + else return (0); +} + +static void tablecommon_setall(t_tablecommon *cc, int v) +{ + int ndx = cc->c_length; + int *ptr = cc->c_table; + while (ndx--) *ptr++ = v; + tablecommon_modified(cc, 0); +} + +static void tablecommon_setatoms(t_tablecommon *cc, int ndx, int ac, t_atom *av) +{ + if (ac > 1 && av->a_type == A_FLOAT) + { + /* CHECKED no resizing */ + int last = tablecommon_getindex(cc, ndx + ac - 1); + int *ptr = cc->c_table + ndx; + for (; ndx <= last; ndx++, av++) + *ptr++ = (av->a_type == A_FLOAT ? (int)av->a_w.w_float : 0); + tablecommon_modified(cc, 0); + } +} + +static void tablecommon_setlength(t_tablecommon *cc, int length) +{ + int relocate; + if (length < TABLE_MINLENGTH) + length = TABLE_MINLENGTH; + else if (length > TABLE_MAXLENGTH) + length = TABLE_MAXLENGTH; + if (relocate = (length > cc->c_size)) + { + int l = length; + /* CHECKED existing values are preserved */ + cc->c_table = grow_withdata(&length, &cc->c_length, + &cc->c_size, cc->c_table, + TABLE_INISIZE, cc->c_tableini, + sizeof(*cc->c_table)); + if (length == l) + cc->c_table = grow_nodata(&length, &cc->c_size, cc->c_cache, + TABLE_INISIZE, cc->c_cacheini, + sizeof(*cc->c_cache)); + if (length != l) + { + if (cc->c_table != cc->c_tableini) + freebytes(cc->c_table, cc->c_size * sizeof(*cc->c_table)); + if (cc->c_cache != cc->c_cacheini) + freebytes(cc->c_cache, cc->c_size * sizeof(*cc->c_cache)); + cc->c_size = length = TABLE_INISIZE; + cc->c_table = cc->c_tableini; + cc->c_cache = cc->c_cacheini; + } + } + cc->c_length = length; + /* CHECKED values at common indices are preserved */ + /* CHECKED rewinding neither head, nor loadndx -- both are preserved, + although there is a bug in handling of 'prev' after the head + overflows due to shrinking. */ + tablecommon_modified(cc, relocate); +} + +static void tablecommon_cacheupdate(t_tablecommon *cc) +{ + int ndx = cc->c_length, sum = 0, mn, mx; + int *tptr = cc->c_table, *cptr = cc->c_cache; + mn = mx = *tptr; + while (ndx--) + { + int v = *tptr++; + *cptr++ = (sum += v); + if (mn > v) + mn = v; + else if (mx < v) + mx = v; + } + cc->c_cachesum = sum; + cc->c_cachemin = mn; + cc->c_cachemax = mx; + cc->c_cacheisfresh = 1; +} + +static int tablecommon_quantile(t_tablecommon *cc, float f) +{ + /* CHECKME */ + float fv; + int ndx, *ptr, nmx = cc->c_length - 1; + if (!cc->c_cacheisfresh) tablecommon_cacheupdate(cc); + fv = f * cc->c_cachesum; + for (ndx = 0, ptr = cc->c_cache; ndx < nmx; ndx++, ptr++) + if (*ptr >= fv) + break; + return (ndx); +} + +static void tablecommon_fromatoms(t_tablecommon *cc, int ac, t_atom *av) +{ + int i, size = 0, nsyms = 0; + t_atom *ap; + int *ptr; + cc->c_increation = 1; + for (i = 0, ap = av; i < ac; i++, ap++) + { + if (ap->a_type == A_FLOAT) + size++; + else if (ap->a_type == A_SYMBOL) + nsyms++, size++; + } + if (size < ac) + loud_warning(0, "Table", "%d invalid atom%s ignored", + ac - size, (ac - size > 1 ? "s" : "")); + if (nsyms) + loud_warning(0, "Table", "%d symbol%s bashed to zero", + nsyms, (nsyms > 1 ? "s" : "")); + tablecommon_setlength(cc, size); + size = cc->c_length; + ptr = cc->c_table; + for (i = 0; i < ac; i++, av++) + { + if (av->a_type == A_FLOAT) + *ptr++ = (int)av->a_w.w_float; + else if (av->a_type == A_SYMBOL) + *ptr++ = 0; + else + continue; + if (size-- == 1) + break; + } + while (size--) + *ptr++ = 0; + cc->c_increation = 0; +} + +/* FIXME keep int precision: save/load directly, not through a bb */ +/* LATER binary files */ +static void tablecommon_doread(t_tablecommon *cc, t_symbol *fn, t_canvas *cv) +{ + t_binbuf *bb = binbuf_new(); + int ac; + t_atom *av; + char buf[MAXPDSTRING]; + if (!fn) + return; /* CHECKME complaint */ + /* FIXME use open_via_path() */ + if (cv || (cv = cc->c_lastcanvas)) /* !cv: 'read' w/o arg */ + canvas_makefilename(cv, fn->s_name, buf, MAXPDSTRING); + else + { + strncpy(buf, fn->s_name, MAXPDSTRING); + buf[MAXPDSTRING-1] = 0; + } + binbuf_read(bb, buf, "", 0); + if ((ac = binbuf_getnatom(bb)) && + (av = binbuf_getvec(bb)) && + av->a_type == A_SYMBOL && + av->a_w.w_symbol == gensym("table")) + { + tablecommon_fromatoms(cc, ac - 1, av + 1); + post("Table: %s read successful", fn->s_name); /* CHECKME */ + } +#if 0 /* FIXME */ + else /* CHECKME complaint */ + loud_error((t_pd *)cc, "invalid file %s", fn->s_name); +#endif + binbuf_free(bb); +} + +static void tablecommon_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + tablecommon_doread((t_tablecommon *)z, fn, 0); +} + +static void tablecommon_dowrite(t_tablecommon *cc, t_symbol *fn, t_canvas *cv) +{ + t_binbuf *bb = binbuf_new(); + char buf[MAXPDSTRING]; + int ndx, *ptr; + if (!fn) + return; /* CHECKME complaint */ + if (cv || (cv = cc->c_lastcanvas)) /* !cv: 'write' w/o arg */ + canvas_makefilename(cv, fn->s_name, buf, MAXPDSTRING); + else + { + strncpy(buf, fn->s_name, MAXPDSTRING); + buf[MAXPDSTRING-1] = 0; + } + binbuf_addv(bb, "s", atom_getsymbol(binbuf_getvec(cc->c_refs->x_ob.te_binbuf))); + for (ndx = 0, ptr = cc->c_table; ndx < cc->c_length; ndx++, ptr++) + binbuf_addv(bb, "i", *ptr); + binbuf_write(bb, buf, "", 0); + binbuf_free(bb); +} + +static void tablecommon_writehook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + tablecommon_dowrite((t_tablecommon *)z, fn, 0); +} + +static void table_embedhook(t_pd *z, t_binbuf *bb, t_symbol *bindsym) +{ + t_table *x = (t_table *)z; + t_tablecommon *cc = x->x_common; + if (cc->c_embedflag) + { + int ndx = 0, left = cc->c_length; + int *ptr = cc->c_table; + binbuf_addv(bb, "ssi;", bindsym, gensym("size"), cc->c_length); + binbuf_addv(bb, "ssiiii;", bindsym, gensym("flags"), 1, + cc->c_dontsaveflag, cc->c_notenamesflag, cc->c_signedflag); + binbuf_addv(bb, "ssi;", bindsym, gensym("tabrange"), cc->c_range); + binbuf_addv(bb, "ssiiiii;", bindsym, gensym("_coords"), + cc->c_left, cc->c_top, cc->c_right, cc->c_bottom, + cc->c_visflag); + while (left > 0) + { + int cnt = (left > 128 ? 128 : left); + left -= cnt; + ndx += cnt; + binbuf_addv(bb, "ssi", bindsym, gensym("set"), ndx); + while (cnt--) + { + t_atom at; + SETFLOAT(&at, (float)*ptr); + binbuf_add(bb, 1, &at); + ptr++; + } + binbuf_addsemi(bb); + } + } +} + +static void tablecommon_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av) +{ + tablecommon_fromatoms((t_tablecommon *)z, ac, av); +} + +static void tablecommon_free(t_tablecommon *cc) +{ + if (cc->c_table != cc->c_tableini) + freebytes(cc->c_table, cc->c_size * sizeof(*cc->c_table)); + if (cc->c_cache != cc->c_cacheini) + freebytes(cc->c_cache, cc->c_size * sizeof(*cc->c_cache)); +} + +static void *tablecommon_new(void) +{ + t_tablecommon *cc = (t_tablecommon *)pd_new(tablecommon_class); + cc->c_visflag = 0; + cc->c_embedflag = 0; + cc->c_dontsaveflag = 0; + cc->c_notenamesflag = 0; + cc->c_signedflag = 0; + cc->c_size = TABLE_INISIZE; + cc->c_length = TABLE_DEFLENGTH; + cc->c_table = cc->c_tableini; + cc->c_cache = cc->c_cacheini; + cc->c_cacheisfresh = 0; + return (cc); +} + +static t_tablecommon *table_checkcommon(t_table *x) +{ + if (x->x_name && + x->x_common != (t_tablecommon *)pd_findbyclass(x->x_name, + tablecommon_class)) + { + loudbug_bug("table_checkcommon"); + return (0); + } + return (x->x_common); +} + +static void table_unbind(t_table *x) +{ + /* LATER consider calling table_checkcommon(x) */ + t_tablecommon *cc = x->x_common; + t_table *prev, *next; + if ((prev = cc->c_refs) == x) + { + if (!(cc->c_refs = x->x_next)) + { + hammerfile_free(cc->c_filehandle); + tablecommon_free(cc); + if (x->x_name) pd_unbind(&cc->c_pd, x->x_name); + pd_free(&cc->c_pd); + } + } + else if (prev) + { + while (next = prev->x_next) + { + if (next == x) + { + prev->x_next = next->x_next; + break; + } + prev = next; + } + } + x->x_common = 0; + x->x_name = 0; + x->x_next = 0; +} + +static void table_bind(t_table *x, t_symbol *name) +{ + t_tablecommon *cc = 0; + if (name == &s_) + name = 0; + else if (name) + cc = (t_tablecommon *)pd_findbyclass(name, tablecommon_class); + if (!cc) + { + cc = (t_tablecommon *)tablecommon_new(); + cc->c_refs = 0; + cc->c_increation = 0; + if (name) + { + pd_bind(&cc->c_pd, name); + /* LATER rethink canvas unpredictability */ + tablecommon_doread(cc, name, x->x_glist); + } + else + { + cc->c_filename = 0; + cc->c_lastcanvas = 0; + } + cc->c_filehandle = hammerfile_new((t_pd *)cc, 0, tablecommon_readhook, + tablecommon_writehook, + tablecommon_editorhook); + } + x->x_common = cc; + x->x_name = name; + x->x_next = cc->c_refs; + cc->c_refs = x; +} + +static int table_rebind(t_table *x, t_symbol *name) +{ + t_tablecommon *cc; + if (name && name != &s_ && + (cc = (t_tablecommon *)pd_findbyclass(name, tablecommon_class))) + { + table_unbind(x); + x->x_common = cc; + x->x_name = name; + x->x_next = cc->c_refs; + cc->c_refs = x; + return (1); + } + else return (0); +} + +static void table_dooutput(t_table *x, int ndx) +{ + outlet_float(((t_object *)x)->ob_outlet, + (t_float)tablecommon_getvalue(x->x_common, ndx)); +} + +static void table_bang(t_table *x) +{ + /* CHECKME */ + outlet_float(((t_object *)x)->ob_outlet, + (t_float)tablecommon_quantile(x->x_common, + rand_unipolar(&x->x_seed))); +} + +static void table_float(t_table *x, t_float f) +{ + if (x->x_loadflag) + { + /* CHECKME */ + if (tablecommon_loadvalue(x->x_common, x->x_loadndx, (int)f)) + x->x_loadndx++; + } + else + { + int ndx = (int)f; /* CHECKED floats are truncated */ + if (x->x_valueset) + { + tablecommon_setvalue(x->x_common, ndx, x->x_value); + x->x_valueset = 0; + } + else table_dooutput(x, ndx); + /* CHECKED head is not updated */ + } +} + +static void table_ft1(t_table *x, t_floatarg f) +{ + x->x_value = (int)f; /* CHECKED floats are truncated */ + x->x_valueset = 1; +} + +static void table_size(t_table *x, t_floatarg f) +{ + tablecommon_setlength(x->x_common, (int)f); +} + +static void table_set(t_table *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac > 1 && av->a_type == A_FLOAT) + { + int ndx = tablecommon_getindex(x->x_common, (int)av->a_w.w_float); + tablecommon_setatoms(x->x_common, ndx, ac - 1, av + 1); + } +} + +static void table_flags(t_table *x, t_symbol *s, int ac, t_atom *av) +{ + t_tablecommon *cc = x->x_common; + int i = 0, v; + while (ac && av->a_type == A_FLOAT + && loud_checkint((t_pd *)x, av->a_w.w_float, &v, gensym("flags"))) + { + /* CHECKED order, modifying only explicitly specified flags */ + if (i == 0) + cc->c_embedflag = (v != 0); + else if (i == 1) + cc->c_dontsaveflag = (v != 0); + else if (i == 2) + cc->c_notenamesflag = (v != 0); + else if (i == 3) + cc->c_signedflag = (v != 0); + else + break; + i++; ac--; av++; + } +} + +static void table_tabrange(t_table *x, t_floatarg f) +{ + int i = (int)f; + x->x_common->c_range = (i > TABLE_MINRANGE ? i : TABLE_MINRANGE); +} + +static void table__coords(t_table *x, t_floatarg fl, t_floatarg ft, + t_floatarg fr, t_floatarg fb, t_floatarg fv) +{ + t_tablecommon *cc = x->x_common; + /* FIXME constraints */ + cc->c_left = (int)fl; + cc->c_top = (int)ft; + cc->c_right = (int)fr; + cc->c_bottom = (int)fb; + cc->c_visflag = ((int)fv != 0); +} + +static void table_cancel(t_table *x) +{ + x->x_valueset = 0; +} + +static void table_clear(t_table *x) +{ + tablecommon_setall(x->x_common, 0); + /* CHECKED head preserved */ +} + +static void table_const(t_table *x, t_floatarg f) +{ + tablecommon_setall(x->x_common, (int)f); + /* CHECKED head preserved */ +} + +static void table_load(t_table *x) +{ + x->x_loadflag = 1; + x->x_loadndx = 0; /* CHECKED rewind, head not affected */ +} + +static void table_normal(t_table *x) +{ + x->x_loadflag = 0; +} + +static void table_next(t_table *x) +{ + if (!x->x_intraversal) + x->x_intraversal = 1; + else if (++x->x_head >= x->x_common->c_length) + x->x_head = 0; + table_dooutput(x, x->x_head); +} + +static void table_prev(t_table *x) +{ + if (!x->x_intraversal) + x->x_intraversal = 1; + else if (--x->x_head < 0) + x->x_head = x->x_common->c_length - 1; + table_dooutput(x, x->x_head); +} + +static void table_goto(t_table *x, t_floatarg f) +{ + /* CHECKED floats are truncated */ + x->x_head = tablecommon_getindex(x->x_common, (int)f); + /* CHECKED the head should be pre-updated during traversal, in order + to maintain the logical way of direction change. Therefore, we + need the flag below, which locks head in place that has just been + set by goto. The flag is then set by next or prev. */ + x->x_intraversal = 0; +} + +static void table_send(t_table *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac > 1 && av->a_type == A_SYMBOL) + { + t_symbol *target = av->a_w.w_symbol; + if (!target->s_thing) + return; /* CHECKED no complaint */ + ac--; av++; + if (av->a_type == A_FLOAT) + { + if (ac == 1) + { + int ndx = (int)av->a_w.w_float; + pd_float(target->s_thing, + (t_float)tablecommon_getvalue(x->x_common, ndx)); + } + /* CHECKED incompatible: 'send <target> <ndx> <value>' + stores <value> at <ndx> (a bug?) */ + } + else if (av->a_type == A_SYMBOL) + { + /* CHECKED 'send <target> length' works, but not max, min, sum... */ + if (av->a_w.w_symbol == gensym("length")) + pd_float(target->s_thing, (t_float)x->x_common->c_length); + } + } +} + +static void table_length(t_table *x) +{ + outlet_float(((t_object *)x)->ob_outlet, (t_float)x->x_common->c_length); +} + +static void table_sum(t_table *x) +{ + t_tablecommon *cc = x->x_common; + if (!cc->c_cacheisfresh) tablecommon_cacheupdate(cc); + outlet_float(((t_object *)x)->ob_outlet, (t_float)cc->c_cachesum); +} + +static void table_min(t_table *x) +{ + t_tablecommon *cc = x->x_common; + if (!cc->c_cacheisfresh) tablecommon_cacheupdate(cc); + outlet_float(((t_object *)x)->ob_outlet, (t_float)cc->c_cachemin); +} + +static void table_max(t_table *x) +{ + t_tablecommon *cc = x->x_common; + if (!cc->c_cacheisfresh) tablecommon_cacheupdate(cc); + outlet_float(((t_object *)x)->ob_outlet, (t_float)cc->c_cachemax); +} + +static void table_getbits(t_table *x, t_floatarg f1, + t_floatarg f2, t_floatarg f3) +{ + /* FIXME */ +} + +static void table_setbits(t_table *x, t_floatarg f1, + t_floatarg f2, t_floatarg f3, t_floatarg f4) +{ + /* FIXME */ +} + +static void table_inv(t_table *x, t_floatarg f) +{ + /* CHECKME none found, float */ + int v = (int)f, ndx, *ptr, nmx = x->x_common->c_length - 1; + for (ndx = 0, ptr = x->x_common->c_table; ndx < nmx; ndx++, ptr++) + if (*ptr >= v) + break; + outlet_float(((t_object *)x)->ob_outlet, (t_float)ndx); +} + +static void table_quantile(t_table *x, t_floatarg f) +{ + /* CHECKME */ + outlet_float(((t_object *)x)->ob_outlet, + (t_float)tablecommon_quantile(x->x_common, + f / ((float)TABLE_MAXQ))); +} + +static void table_fquantile(t_table *x, t_floatarg f) +{ + /* CHECKME constraints */ + outlet_float(((t_object *)x)->ob_outlet, + (t_float)tablecommon_quantile(x->x_common, f)); +} + +static void table_dump(t_table *x, t_symbol *s, int ac, t_atom *av) +{ + t_tablecommon *cc = x->x_common; + int thelength = cc->c_length; + int *thetable = cc->c_table; + t_outlet *out = ((t_object *)x)->ob_outlet; + int ndx, nmx, *ptr; + /* CHECKED optional arguments: from, to, Negative 'from' causes + invalid output, symbols are bashed to zero for both arguments, + inconsistent warnings, etc. -- no strict emulation attempted below. */ + if (ac && av->a_type == A_FLOAT) + ndx = tablecommon_getindex(cc, (int)av->a_w.w_float); + else + ndx = 0; + if (ac > 1 && av[1].a_type == A_FLOAT) + nmx = tablecommon_getindex(cc, (int)av[1].a_w.w_float); + else + nmx = thelength - 1; + for (ptr = thetable + ndx; ndx <= nmx; ndx++, ptr++) + { + /* Plain traversing by incrementing a pointer is not robust, + because calling outlet_float() may invalidate the pointer. + Continous storage does not require generic selfmod detection + (ala coll), so we can get away with the simpler test below. */ + if (cc->c_length != thelength || cc->c_table != thetable) + break; + /* CHECKED no remote dumping */ + outlet_float(out, (t_float)*ptr); + } +} + +static void table_refer(t_table *x, t_symbol *s) +{ + if (!table_rebind(x, s)) + { + /* LATER consider complaining */ + } +} + +static void table_read(t_table *x, t_symbol *s) +{ + t_tablecommon *cc = x->x_common; + if (s && s != &s_) + tablecommon_doread(cc, s, x->x_glist); + else + hammerpanel_open(cc->c_filehandle, 0); +} + +static void table_write(t_table *x, t_symbol *s) +{ + t_tablecommon *cc = x->x_common; + if (s && s != &s_) + tablecommon_dowrite(cc, s, x->x_glist); + else + hammerpanel_save(cc->c_filehandle, 0, 0); +} + +static int tablecommon_editorappend(t_tablecommon *cc, + int v, char *buf, int col) +{ + char *bp = buf; + int cnt = 0; + if (col > 0) + *bp++ = ' ', cnt++; + cnt += sprintf(bp, "%d", v); + if (col + cnt > 80) + buf[0] = '\n', col = cnt - 1; /* assuming col > 0 */ + else + col += cnt; + hammereditor_append(cc->c_filehandle, buf); + return (col); +} + +static void table_open(t_table *x) +{ + t_tablecommon *cc = x->x_common; + char buf[MAXPDSTRING]; + int *bp = cc->c_table; + int count = cc->c_length, col = 0; + hammereditor_open(cc->c_filehandle, (x->x_name ? x->x_name->s_name : 0), 0); + while (count--) + col = tablecommon_editorappend(cc, *bp++, buf, col); + hammereditor_setdirty(cc->c_filehandle, 0); +} + +static void table_wclose(t_table *x) +{ + hammereditor_close(x->x_common->c_filehandle, 1); +} + +static void table_click(t_table *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + table_open(x); +} + +#ifdef TABLE_DEBUG +static void table_debug(t_table *x, t_floatarg f) +{ + t_tablecommon *cc = table_checkcommon(x); + if (cc) + { + t_table *x1 = cc->c_refs; + int i = 0; + while (x1) i++, x1 = x1->x_next; + loudbug_post("refcount %d", i); + } +} +#endif + +static void table_free(t_table *x) +{ + hammerfile_free(x->x_filehandle); + table_unbind(x); +} + +static void *table_new(t_symbol *s) +{ + t_table *x = (t_table *)pd_new(table_class); + static int warned = 0; + if (!warned) + { + loud_warning((t_pd *)x, 0, "Table is not ready yet"); + warned = 1; + } + x->x_glist = canvas_getcurrent(); + x->x_valueset = 0; + x->x_head = 0; + x->x_intraversal = 0; /* CHECKED */ + x->x_loadflag = 0; + rand_seed(&x->x_seed, 0); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + x->x_bangout = outlet_new((t_object *)x, &s_bang); + x->x_filehandle = hammerfile_new((t_pd *)x, table_embedhook, 0, 0, 0); + table_bind(x, s); + return (x); +} + +void Table_setup(void) +{ + table_class = class_new(gensym("Table"), + (t_newmethod)table_new, + (t_method)table_free, + sizeof(t_table), 0, A_DEFSYM, 0); + class_addbang(table_class, table_bang); + class_addfloat(table_class, table_float); + class_addmethod(table_class, (t_method)table_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_size, + gensym("size"), A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_set, + gensym("set"), A_GIMME, 0); + class_addmethod(table_class, (t_method)table_flags, + gensym("flags"), A_GIMME, 0); + class_addmethod(table_class, (t_method)table_tabrange, + gensym("tabrange"), A_FLOAT, 0); + class_addmethod(table_class, (t_method)table__coords, + gensym("_coords"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_cancel, + gensym("cancel"), 0); + class_addmethod(table_class, (t_method)table_clear, + gensym("clear"), 0); + class_addmethod(table_class, (t_method)table_const, + gensym("const"), A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_load, + gensym("load"), 0); + class_addmethod(table_class, (t_method)table_normal, + gensym("normal"), 0); + class_addmethod(table_class, (t_method)table_next, + gensym("next"), 0); + class_addmethod(table_class, (t_method)table_prev, + gensym("prev"), 0); + class_addmethod(table_class, (t_method)table_goto, + gensym("goto"), A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_send, + gensym("send"), A_GIMME, 0); + class_addmethod(table_class, (t_method)table_length, + gensym("length"), 0); + class_addmethod(table_class, (t_method)table_sum, + gensym("sum"), 0); + class_addmethod(table_class, (t_method)table_min, + gensym("min"), 0); + class_addmethod(table_class, (t_method)table_max, + gensym("max"), 0); + class_addmethod(table_class, (t_method)table_getbits, + gensym("getbits"), A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_setbits, + gensym("setbits"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_inv, + gensym("inv"), A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_quantile, + gensym("quantile"), A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_fquantile, + gensym("fquantile"), A_FLOAT, 0); + class_addmethod(table_class, (t_method)table_dump, + gensym("dump"), A_GIMME, 0); + class_addmethod(table_class, (t_method)table_refer, + gensym("refer"), A_SYMBOL, 0); + class_addmethod(table_class, (t_method)table_read, + gensym("read"), A_DEFSYM, 0); + class_addmethod(table_class, (t_method)table_write, + gensym("write"), A_DEFSYM, 0); + class_addmethod(table_class, (t_method)table_open, + gensym("open"), 0); + class_addmethod(table_class, (t_method)table_wclose, + gensym("wclose"), 0); + class_addmethod(table_class, (t_method)table_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); +#ifdef TABLE_DEBUG + class_addmethod(table_class, (t_method)table_debug, + gensym("debug"), A_DEFFLOAT, 0); +#endif + hammerfile_setup(table_class, 1); + tablecommon_class = class_new(gensym("Table"), 0, 0, + sizeof(t_tablecommon), CLASS_PD, 0); + /* this call is a nop (tablecommon does not embed, and the hammerfile + class itself has been already set up above), but it is better to + have it around, just in case... */ + hammerfile_setup(tablecommon_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/TogEdge.c b/externals/miXed/cyclone/hammer/TogEdge.c new file mode 100644 index 000000000..f3ab00c1b --- /dev/null +++ b/externals/miXed/cyclone/hammer/TogEdge.c @@ -0,0 +1,78 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" + +typedef struct _TogEdge +{ + t_object x_ob; + int x_wason; + t_outlet *x_out1; +} t_TogEdge; + +static t_class *TogEdge_class; + +static void TogEdge_bang(t_TogEdge *x) +{ + if (x->x_wason) + { + x->x_wason = 0; + outlet_bang(x->x_out1); + } + else + { + x->x_wason = 1; + outlet_bang(((t_object *)x)->ob_outlet); + } +} + +static void TogEdge_float(t_TogEdge *x, t_float f) +{ + int i; + if (loud_checkint((t_pd *)x, f, &i, &s_float)) /* CHECKED */ + { + if (x->x_wason) + { + if (!i) + { + x->x_wason = 0; + outlet_bang(x->x_out1); + } + } + else + { + if (i) + { + x->x_wason = 1; + outlet_bang(((t_object *)x)->ob_outlet); + } + } + } +} + +static void *TogEdge_new(void) +{ + t_TogEdge *x = (t_TogEdge *)pd_new(TogEdge_class); + x->x_wason = 0; /* CHECKED */ + outlet_new((t_object *)x, &s_bang); + x->x_out1 = outlet_new((t_object *)x, &s_bang); + return (x); +} + +void TogEdge_setup(void) +{ + TogEdge_class = class_new(gensym("TogEdge"), + (t_newmethod)TogEdge_new, 0, + sizeof(t_TogEdge), 0, 0); + class_addcreator((t_newmethod)TogEdge_new, gensym("togedge"), 0, 0); + class_addcreator((t_newmethod)TogEdge_new, gensym("cyclone/togedge"), 0, 0); + class_addbang(TogEdge_class, TogEdge_bang); + class_addfloat(TogEdge_class, TogEdge_float); +} + +void togedge_setup(void) +{ + TogEdge_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Trough.c b/externals/miXed/cyclone/hammer/Trough.c new file mode 100644 index 000000000..75c4ebb28 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Trough.c @@ -0,0 +1,70 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +#define TROUGH_INITIAL 128 /* CHECKME */ + +typedef struct _Trough +{ + t_object x_ob; + t_float x_value; + t_outlet *x_out2; + t_outlet *x_out3; +} t_Trough; + +static t_class *Trough_class; + +static void Trough_bang(t_Trough *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void Trough_ft1(t_Trough *x, t_floatarg f) +{ + /* CHECKME loud_checkint */ + outlet_float(x->x_out3, 0); /* CHECKME */ + outlet_float(x->x_out2, 1); + outlet_float(((t_object *)x)->ob_outlet, x->x_value = f); +} + +static void Trough_float(t_Trough *x, t_float f) +{ + /* CHECKME loud_checkint */ + if (f < x->x_value) Trough_ft1(x, f); + else + { + outlet_float(x->x_out3, 1); + outlet_float(x->x_out2, 0); + } +} + +static void *Trough_new(t_floatarg f) +{ + t_Trough *x = (t_Trough *)pd_new(Trough_class); + x->x_value = TROUGH_INITIAL; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + x->x_out2 = outlet_new((t_object *)x, &s_float); + x->x_out3 = outlet_new((t_object *)x, &s_float); + return (x); +} + +void Trough_setup(void) +{ + Trough_class = class_new(gensym("Trough"), + (t_newmethod)Trough_new, 0, + sizeof(t_Trough), 0, 0); + class_addcreator((t_newmethod)Trough_new, gensym("trough"), 0, 0); + class_addcreator((t_newmethod)Trough_new, gensym("cyclone/trough"), 0, 0); + class_addbang(Trough_class, Trough_bang); + class_addfloat(Trough_class, Trough_float); + class_addmethod(Trough_class, (t_method)Trough_ft1, + gensym("ft1"), A_FLOAT, 0); +} + +void trough_setup(void) +{ + Trough_setup(); +} diff --git a/externals/miXed/cyclone/hammer/Uzi.c b/externals/miXed/cyclone/hammer/Uzi.c new file mode 100644 index 000000000..10b5b13f9 --- /dev/null +++ b/externals/miXed/cyclone/hammer/Uzi.c @@ -0,0 +1,115 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* CHECKME negative 'nbangs' value set during run-time */ + +#include "m_pd.h" + +typedef struct _Uzi +{ + t_object x_obj; + t_float x_nbangs; + int x_count; + int x_running; + t_outlet *x_out2; + t_outlet *x_out3; +} t_Uzi; + +static t_class *Uzi_class; + +#define UZI_RUNNING 1 +#define UZI_PAUSED 2 + +static void Uzi_dobang(t_Uzi *x) +{ + /* CHECKME reentrancy */ + if (!x->x_running) + { + int count, nbangs = (int)x->x_nbangs; + x->x_running = UZI_RUNNING; + for (count = x->x_count + 1; count <= nbangs; count++) + { + outlet_float(x->x_out3, count); + outlet_bang(((t_object *)x)->ob_outlet); + if (x->x_running == UZI_PAUSED) + { + /* CHECKED: carry bang not sent, even if this is last bang */ + x->x_count = count; + return; + } + } + /* CHECKED: carry bang sent also when there are no left-outlet bangs */ + /* CHECKED: sent after left outlet, not before */ + outlet_bang(x->x_out2); + x->x_count = 0; + x->x_running = 0; + } +} + +static void Uzi_bang(t_Uzi *x) +{ + /* CHECKED: always restarts (when paused too) */ + x->x_count = 0; + x->x_running = 0; + Uzi_dobang(x); +} + +static void Uzi_float(t_Uzi *x, t_float f) +{ + /* CHECKED: always sets a new value and restarts (when paused too) */ + x->x_nbangs = f; + Uzi_bang(x); +} + +/* CHECKED: 'pause, resume' (but not just 'resume') + sends a carry bang when not running (a bug?) */ +static void Uzi_pause(t_Uzi *x) +{ + if (!x->x_running) + x->x_count = (int)x->x_nbangs; /* bug emulation? */ + x->x_running = UZI_PAUSED; +} + +static void Uzi_resume(t_Uzi *x) +{ + if (x->x_running == UZI_PAUSED) + { + x->x_running = 0; + Uzi_dobang(x); + } +} + +static void *Uzi_new(t_floatarg f) +{ + t_Uzi *x = (t_Uzi *)pd_new(Uzi_class); + x->x_nbangs = (f > 1. ? f : 1.); + x->x_count = 0; + x->x_running = 0; + /* CHECKED: set when paused, but then 'resume' is blocked (a bug?) */ + floatinlet_new((t_object *)x, &x->x_nbangs); + outlet_new((t_object *)x, &s_bang); + x->x_out2 = outlet_new((t_object *)x, &s_bang); + x->x_out3 = outlet_new((t_object *)x, &s_float); + return (x); +} + +void Uzi_setup(void) +{ + Uzi_class = class_new(gensym("Uzi"), + (t_newmethod)Uzi_new, 0, + sizeof(t_Uzi), 0, A_DEFFLOAT, 0); + class_addcreator((t_newmethod)Uzi_new, gensym("uzi"), A_DEFFLOAT, 0); + class_addcreator((t_newmethod)Uzi_new, gensym("cyclone/uzi"), A_DEFFLOAT, 0); + class_addbang(Uzi_class, Uzi_bang); + class_addfloat(Uzi_class, Uzi_float); + class_addmethod(Uzi_class, (t_method)Uzi_pause, gensym("pause"), 0); + class_addmethod(Uzi_class, (t_method)Uzi_pause, gensym("break"), 0); + class_addmethod(Uzi_class, (t_method)Uzi_resume, gensym("resume"), 0); + class_addmethod(Uzi_class, (t_method)Uzi_resume, gensym("continue"), 0); +} + +void uzi_setup(void) +{ + Uzi_setup(); +} diff --git a/externals/miXed/cyclone/hammer/accum.c b/externals/miXed/cyclone/hammer/accum.c new file mode 100644 index 000000000..d266fb3ae --- /dev/null +++ b/externals/miXed/cyclone/hammer/accum.c @@ -0,0 +1,68 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is a slightly edited version of Joseph A. Sarlo's code. + The most important changes are listed in "pd-lib-notes.txt" file. */ + +#include "m_pd.h" + +typedef struct _accum +{ + t_object x_ob; + t_float x_total; +} t_accum; + +static t_class *accum_class; + +static void accum_set(t_accum *x, t_floatarg val) +{ + x->x_total = val; +} + +static void accum_bang(t_accum *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_total); +} + +static void accum_float(t_accum *x, t_floatarg val) +{ + /* LATER reconsider int/float dilemma */ + accum_set(x, val); + accum_bang(x); +} + +static void accum_add(t_accum *x, t_floatarg val) +{ + /* LATER reconsider int/float dilemma */ + x->x_total += val; +} + +static void accum_mult(t_accum *x, t_floatarg val) +{ + x->x_total *= val; +} + +static void *accum_new(t_floatarg val) +{ + t_accum *x = (t_accum *)pd_new(accum_class); + x->x_total = val; + 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); + return (x); +} + +void accum_setup(void) +{ + accum_class = class_new(gensym("accum"), (t_newmethod)accum_new, 0, + sizeof(t_accum), 0, A_DEFFLOAT, 0); + class_addbang(accum_class, accum_bang); + class_addfloat(accum_class, accum_float); + class_addmethod(accum_class, (t_method)accum_add, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(accum_class, (t_method)accum_mult, + gensym("ft2"), A_FLOAT, 0); + class_addmethod(accum_class, (t_method)accum_set, + gensym("set"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/hammer/acos.c b/externals/miXed/cyclone/hammer/acos.c new file mode 100644 index 000000000..9aa52b321 --- /dev/null +++ b/externals/miXed/cyclone/hammer/acos.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define acosf acos +#endif + +typedef struct _acos +{ + t_object x_ob; + float x_value; +} t_acos; + +static t_class *acos_class; + +static void acos_bang(t_acos *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void acos_float(t_acos *x, t_float f) +{ + if (f < -1.0) f = -1.0; else if (f > 1.0) f = 1.0; /* CHECKME */ + outlet_float(((t_object *)x)->ob_outlet, x->x_value = acosf(f)); +} + +static void *acos_new(t_floatarg f) +{ + t_acos *x = (t_acos *)pd_new(acos_class); + if (f < -1.0) f = -1.0; else if (f > 1.0) f = 1.0; /* CHECKME */ + x->x_value = acosf(f); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void acos_setup(void) +{ + acos_class = class_new(gensym("acos"), + (t_newmethod)acos_new, 0, + sizeof(t_acos), 0, A_DEFFLOAT, 0); + class_addbang(acos_class, acos_bang); + class_addfloat(acos_class, acos_float); +} diff --git a/externals/miXed/cyclone/hammer/active.c b/externals/miXed/cyclone/hammer/active.c new file mode 100644 index 000000000..ccaf2d961 --- /dev/null +++ b/externals/miXed/cyclone/hammer/active.c @@ -0,0 +1,55 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include "m_pd.h" +#include "hammer/gui.h" + +typedef struct _active +{ + t_object x_ob; + t_symbol *x_cvname; + int x_on; +} t_active; + +static t_class *active_class; + +static void active_dofocus(t_active *x, t_symbol *s, t_floatarg f) +{ + if ((int)f) + { + int on = (s == x->x_cvname); + if (on != x->x_on) + outlet_float(((t_object *)x)->ob_outlet, x->x_on = on); + } + else if (x->x_on && s == x->x_cvname) + outlet_float(((t_object *)x)->ob_outlet, x->x_on = 0); +} + +static void active_free(t_active *x) +{ + hammergui_unbindfocus((t_pd *)x); +} + +static void *active_new(void) +{ + t_active *x = (t_active *)pd_new(active_class); + char buf[32]; + sprintf(buf, ".x%lx.c", (unsigned long)canvas_getcurrent()); + x->x_cvname = gensym(buf); + x->x_on = 0; + outlet_new((t_object *)x, &s_float); + hammergui_bindfocus((t_pd *)x); + return (x); +} + +void active_setup(void) +{ + active_class = class_new(gensym("active"), + (t_newmethod)active_new, + (t_method)active_free, + sizeof(t_active), CLASS_NOINLET, 0); + class_addmethod(active_class, (t_method)active_dofocus, + gensym("_focus"), A_SYMBOL, A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/hammer/allhammers.c b/externals/miXed/cyclone/hammer/allhammers.c new file mode 100644 index 000000000..7cdf1e29d --- /dev/null +++ b/externals/miXed/cyclone/hammer/allhammers.c @@ -0,0 +1,164 @@ +// Do not edit this file, run "make" instead. + +/* Copyright (c) 2002-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +void Append_setup(void); +void Borax_setup(void); +void Bucket_setup(void); +void Clip_setup(void); +void Decode_setup(void); +void Histo_setup(void); +void MouseState_setup(void); +void Peak_setup(void); +void Table_setup(void); +void TogEdge_setup(void); +void Trough_setup(void); +void Uzi_setup(void); +void accum_setup(void); +void acos_setup(void); +void active_setup(void); +void anal_setup(void); +void asin_setup(void); +void bangbang_setup(void); +void bondo_setup(void); +void buddy_setup(void); +void capture_setup(void); +void cartopol_setup(void); +void coll_setup(void); +void comment_setup(void); +void cosh_setup(void); +void counter_setup(void); +void cycle_setup(void); +void decide_setup(void); +void drunk_setup(void); +void flush_setup(void); +void forward_setup(void); +void fromsymbol_setup(void); +void funbuff_setup(void); +void funnel_setup(void); +void gate_setup(void); +void grab_setup(void); +void iter_setup(void); +void match_setup(void); +void maximum_setup(void); +void mean_setup(void); +void midiflush_setup(void); +void midiformat_setup(void); +void midiparse_setup(void); +void minimum_setup(void); +void mousefilter_setup(void); +void mtr_setup(void); +void next_setup(void); +void offer_setup(void); +void onebang_setup(void); +void past_setup(void); +void poltocar_setup(void); +void prepend_setup(void); +void prob_setup(void); +void pv_setup(void); +void seq_setup(void); +void sinh_setup(void); +void speedlim_setup(void); +void spell_setup(void); +void split_setup(void); +void spray_setup(void); +void sprintf_setup(void); +void substitute_setup(void); +void sustain_setup(void); +void switch_setup(void); +void tanh_setup(void); +void testmess_setup(void); +void thresh_setup(void); +void tosymbol_setup(void); +void universal_setup(void); +void urn_setup(void); +void xbendin_setup(void); +void xbendin2_setup(void); +void xbendout_setup(void); +void xbendout2_setup(void); +void xnotein_setup(void); +void xnoteout_setup(void); +void zl_setup(void); + +void allhammers_setup(void) +{ + Append_setup(); + Borax_setup(); + Bucket_setup(); + Clip_setup(); + Decode_setup(); + Histo_setup(); + MouseState_setup(); + Peak_setup(); + Table_setup(); + TogEdge_setup(); + Trough_setup(); + Uzi_setup(); + accum_setup(); + acos_setup(); + active_setup(); + anal_setup(); + asin_setup(); + bangbang_setup(); + bondo_setup(); + buddy_setup(); + capture_setup(); + cartopol_setup(); + coll_setup(); + comment_setup(); + cosh_setup(); + counter_setup(); + cycle_setup(); + decide_setup(); + drunk_setup(); + flush_setup(); + forward_setup(); + fromsymbol_setup(); + funbuff_setup(); + funnel_setup(); + gate_setup(); + grab_setup(); + iter_setup(); + match_setup(); + maximum_setup(); + mean_setup(); + midiflush_setup(); + midiformat_setup(); + midiparse_setup(); + minimum_setup(); + mousefilter_setup(); + mtr_setup(); + next_setup(); + offer_setup(); + onebang_setup(); + past_setup(); + poltocar_setup(); + prepend_setup(); + prob_setup(); + pv_setup(); + seq_setup(); + sinh_setup(); + speedlim_setup(); + spell_setup(); + split_setup(); + spray_setup(); + sprintf_setup(); + substitute_setup(); + sustain_setup(); + switch_setup(); + tanh_setup(); + testmess_setup(); + thresh_setup(); + tosymbol_setup(); + universal_setup(); + urn_setup(); + xbendin_setup(); + xbendin2_setup(); + xbendout_setup(); + xbendout2_setup(); + xnotein_setup(); + xnoteout_setup(); + zl_setup(); +} diff --git a/externals/miXed/cyclone/hammer/anal.c b/externals/miXed/cyclone/hammer/anal.c new file mode 100644 index 000000000..374fa17fc --- /dev/null +++ b/externals/miXed/cyclone/hammer/anal.c @@ -0,0 +1,108 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" + +#define ANAL_DEFSIZE 128 +#define ANAL_MAXSIZE 1024 + +typedef struct _anal +{ + t_object x_ob; + int x_value; /* negative, if initialized or reset */ + int x_size; + int x_bytesize; + int *x_table; + /* CHECKED: the 'weight' count is a signed short (2 bytes), + wrapping into negative domain without any warning. + LATER consider complaining at == SHRT_MAX. */ +} t_anal; + +static t_class *anal_class; + +static void anal_reset(t_anal *x) +{ + x->x_value = -1; +} + +static void anal_clear(t_anal *x) +{ + memset(x->x_table, 0, x->x_bytesize); +} + +static void anal_float(t_anal *x, t_float f) +{ + int value; + if (loud_checkint((t_pd *)x, f, &value, &s_float)) /* CHECKED */ + { + /* CHECKED: any input negative or >= size is ignored with an error + -- there is no output, and a previous state is kept. */ + if (value >= 0 && value < x->x_size) + { + if (x->x_value >= 0) + { + t_atom at[3]; + int ndx = x->x_value * x->x_size + value; + x->x_table[ndx]++; + SETFLOAT(at, x->x_value); + SETFLOAT(&at[1], value); + SETFLOAT(&at[2], x->x_table[ndx]); + outlet_list(((t_object *)x)->ob_outlet, &s_list, 3, at); + } + x->x_value = value; + } + else loud_error((t_pd *)x, "%d outside of table bounds", value); + } +} + +static void anal_free(t_anal *x) +{ + if (x->x_table) + freebytes(x->x_table, x->x_bytesize); +} + +static void *anal_new(t_floatarg f) +{ + t_anal *x; + int size = (int)f; + int bytesize; + int *table; + if (size < 1) + /* CHECKED: 1 is allowed (such an object rejects any nonzero input) */ + size = ANAL_DEFSIZE; + else if (size > ANAL_MAXSIZE) + { + /* CHECKED: */ + loud_warning(&anal_class, 0, "size too large, using %d", ANAL_MAXSIZE); + size = ANAL_MAXSIZE; /* LATER switch into a 'sparse' mode */ + } + /* CHECKED: actually the bytesize is size * size * sizeof(short), + and it shows up in */ + bytesize = size * size * sizeof(*table); + if (!(table = (int *)getbytes(bytesize))) + return (0); + x = (t_anal *)pd_new(anal_class); + x->x_size = size; + x->x_bytesize = bytesize; + x->x_table = table; + outlet_new((t_object *)x, &s_list); + anal_reset(x); + anal_clear(x); + return (x); +} + +void anal_setup(void) +{ + anal_class = class_new(gensym("anal"), + (t_newmethod)anal_new, + (t_method)anal_free, + sizeof(t_anal), 0, A_DEFFLOAT, 0); + class_addfloat(anal_class, anal_float); + class_addmethod(anal_class, (t_method)anal_reset, + gensym("reset"), 0); + class_addmethod(anal_class, (t_method)anal_clear, + gensym("clear"), 0); +} diff --git a/externals/miXed/cyclone/hammer/asin.c b/externals/miXed/cyclone/hammer/asin.c new file mode 100644 index 000000000..89c91a0d7 --- /dev/null +++ b/externals/miXed/cyclone/hammer/asin.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define asinf asin +#endif + +typedef struct _asin +{ + t_object x_ob; + float x_value; +} t_asin; + +static t_class *asin_class; + +static void asin_bang(t_asin *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void asin_float(t_asin *x, t_float f) +{ + if (f < -1.0) f = -1.0; else if (f > 1.0) f = 1.0; /* CHECKME */ + outlet_float(((t_object *)x)->ob_outlet, x->x_value = asinf(f)); +} + +static void *asin_new(t_floatarg f) +{ + t_asin *x = (t_asin *)pd_new(asin_class); + if (f < -1.0) f = -1.0; else if (f > 1.0) f = 1.0; /* CHECKME */ + x->x_value = asinf(f); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void asin_setup(void) +{ + asin_class = class_new(gensym("asin"), + (t_newmethod)asin_new, 0, + sizeof(t_asin), 0, A_DEFFLOAT, 0); + class_addbang(asin_class, asin_bang); + class_addfloat(asin_class, asin_float); +} diff --git a/externals/miXed/cyclone/hammer/atodb.c b/externals/miXed/cyclone/hammer/atodb.c new file mode 100644 index 000000000..d71f9fff4 --- /dev/null +++ b/externals/miXed/cyclone/hammer/atodb.c @@ -0,0 +1,96 @@ +/* + Copyright (c) 2016 Marco Matteo Markidis + mm.markidis@gmail.com + + For information on usage and redistribution, and for a DISCLAIMER OF ALL + WARRANTIES, see the file, "LICENSE.txt," in this distribution. + + Made while listening: + Disclosure -- Caracal + */ +#include "m_pd.h" +#include <math.h> + +static t_class *atodb_class; + +typedef struct _atodb +{ + t_object x_obj; + t_outlet *float_outlet; + t_int bytes; + t_atom *output_list; + t_float f; +} t_atodb; + + +void *atodb_new(void); +void atodb_free(t_atodb *x); +void atodb_float(t_atodb *x, t_floatarg f); +void atodb_bang(t_atodb *x); +void atodb_set(t_atodb *x, t_floatarg f); + +t_float convert(t_float f); + +void atodb_float(t_atodb *x, t_floatarg f) +{ + x->f = f; + outlet_float(x->float_outlet, convert(f)); +} + +t_float convert(t_float f) +{ + if(f<0.f) + f = 0.f; + return 20*log10(f); +} + +void atodb_list(t_atodb *x, t_symbol *s, int argc, t_atom *argv) +{ + int old_bytes = x->bytes, i = 0; + x->bytes = argc*sizeof(t_atom); + x->output_list = (t_atom *)t_resizebytes(x->output_list,old_bytes,x->bytes); + for(i=0;i<argc;i++) + SETFLOAT(x->output_list+i,convert(atom_getfloatarg(i,argc,argv))); + outlet_list(x->float_outlet,0,argc,x->output_list); +} + +void atodb_set(t_atodb *x, t_float f) +{ + x->f = f; +} + +void atodb_bang(t_atodb *x) +{ + outlet_float(x->float_outlet,convert(x->f)); +} + + +void *atodb_new(void) +{ + t_atodb *x = (t_atodb *) pd_new(atodb_class); + + x->float_outlet = outlet_new(&x->x_obj, 0); + x->bytes = sizeof(t_atom); + x->output_list = (t_atom *)getbytes(x->bytes); + if(x->output_list==NULL) { + pd_error(x,"atodb: memory allocation failure"); + return NULL; + } + return (x); +} + +void atodb_free(t_atodb *x) +{ + t_freebytes(x->output_list,x->bytes); +} + +void atodb_setup(void) +{ + atodb_class = class_new(gensym("atodb"), (t_newmethod)atodb_new, + (t_method)atodb_free,sizeof(t_atodb),0,0); + + class_addfloat(atodb_class,(t_method)atodb_float); + class_addlist(atodb_class,(t_method)atodb_list); + class_addmethod(atodb_class,(t_method)atodb_set,gensym("set"),A_DEFFLOAT,0); + class_addbang(atodb_class,(t_method)atodb_bang); +} diff --git a/externals/miXed/cyclone/hammer/bangbang.c b/externals/miXed/cyclone/hammer/bangbang.c new file mode 100644 index 000000000..aa8363d35 --- /dev/null +++ b/externals/miXed/cyclone/hammer/bangbang.c @@ -0,0 +1,75 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is a modified version of Joseph A. Sarlo's code. + The most important changes are listed in "pd-lib-notes.txt" file. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" + +#define BANGBANG_MINOUTS 1 +#define BANGBANG_C74MAXOUTS 40 /* CHECKED (just clipped without warning) */ +#define BANGBANG_DEFOUTS 2 + +typedef struct _bangbang +{ + t_object x_ob; + int x_nouts; + t_outlet **x_outs; + t_outlet *x_outbuf[BANGBANG_DEFOUTS]; +} t_bangbang; + +static t_class *bangbang_class; + +static void bangbang_bang(t_bangbang *x) +{ + int i = x->x_nouts; + while (i--) outlet_bang(x->x_outs[i]); +} + +static void bangbang_anything(t_bangbang *x, t_symbol *s, int ac, t_atom *av) +{ + bangbang_bang(x); +} + +static void bangbang_free(t_bangbang *x) +{ + if (x->x_outs != x->x_outbuf) + freebytes(x->x_outs, x->x_nouts * sizeof(*x->x_outs)); +} + +static void *bangbang_new(t_floatarg val) +{ + t_bangbang *x; + int i, nouts = (int)val; + t_outlet **outs; + if (nouts < BANGBANG_MINOUTS) + nouts = BANGBANG_DEFOUTS; + if (nouts > BANGBANG_C74MAXOUTS) + fittermax_rangewarning(bangbang_class, BANGBANG_C74MAXOUTS, "outlets"); + if (nouts > BANGBANG_DEFOUTS) + { + if (!(outs = (t_outlet **)getbytes(nouts * sizeof(*outs)))) + return (0); + } + else outs = 0; + x = (t_bangbang *)pd_new(bangbang_class); + x->x_nouts = nouts; + x->x_outs = (outs ? outs : x->x_outbuf); + for (i = 0; i < nouts; i++) + x->x_outs[i] = outlet_new((t_object *)x, &s_bang); + return (x); +} + +void bangbang_setup(void) +{ + bangbang_class = class_new(gensym("bangbang"), + (t_newmethod)bangbang_new, + (t_method)bangbang_free, + sizeof(t_bangbang), 0, A_DEFFLOAT, 0); + class_addbang(bangbang_class, bangbang_bang); + class_addanything(bangbang_class, bangbang_anything); + fitter_setup(bangbang_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/bondo.c b/externals/miXed/cyclone/hammer/bondo.c new file mode 100644 index 000000000..2fcdce35f --- /dev/null +++ b/externals/miXed/cyclone/hammer/bondo.c @@ -0,0 +1,394 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER revisit buffer handling (maxsize, reentrancy) */ +/* LATER rethink handling of symbols */ + +/* CHECKED: if 'n' argument is given, then store whole messages, instead of + distributing atoms across successive slots. This is a new, buddy-like + behaviour. */ +/* CHECKED: without 'n' argument, 'symbol test' is parsed as two symbol atoms, + but 'float 1' (or 'list 1') as a single float. */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" + +#define BONDO_MINSLOTS 2 +#define BONDO_INISIZE 4 /* LATER rethink (useful only in multiatom mode) */ + +typedef struct _bondo +{ + t_object x_ob; + t_float x_delay; + int x_multiatom; + int x_nslots; + int x_nproxies; /* as requested (and allocated) */ + t_pd **x_proxies; + t_outlet **x_outs; + t_clock *x_clock; +} t_bondo; + +typedef struct _bondo_proxy +{ + t_object p_ob; + t_bondo *p_master; + int p_id; + t_symbol *p_selector; + t_float p_float; + t_symbol *p_symbol; + t_gpointer *p_pointer; + int p_size; /* as allocated */ + int p_natoms; /* as used */ + t_atom *p_message; + t_atom p_messini[BONDO_INISIZE]; +} t_bondo_proxy; + +static t_class *bondo_class; +static t_class *bondo_proxy_class; + +static void bondo_doit(t_bondo *x) +{ + t_bondo_proxy **p = (t_bondo_proxy **)x->x_proxies; + int i = x->x_nslots; + p = (t_bondo_proxy **)x->x_proxies; + i = x->x_nslots; + while (i--) + { + t_symbol *s = p[i]->p_selector; + /* LATER consider complaining about extra arguments (CHECKED) */ + if (s == &s_bang) + outlet_bang(x->x_outs[i]); + else if (s == &s_float) + outlet_float(x->x_outs[i], p[i]->p_float); + else if (s == &s_symbol && p[i]->p_symbol) + { + /* LATER rethink */ + if (x->x_multiatom) + outlet_symbol(x->x_outs[i], p[i]->p_symbol); + else + outlet_anything(x->x_outs[i], p[i]->p_symbol, 0, 0); + } + else if (s == &s_pointer) + { + /* LATER */ + } + else if (s == &s_list) + outlet_list(x->x_outs[i], s, p[i]->p_natoms, p[i]->p_message); + else if (s) /* CHECKED: a slot may be inactive (in multiatom mode) */ + outlet_anything(x->x_outs[i], s, p[i]->p_natoms, p[i]->p_message); + } +} + +static void bondo_arm(t_bondo *x) +{ + if (x->x_delay <= 0) bondo_doit(x); + else clock_delay(x->x_clock, x->x_delay); +} + +static void bondo_proxy_bang(t_bondo_proxy *x) +{ + bondo_arm(x->p_master); /* CHECKED: bang in any inlet works in this way */ +} + +static void bondo_proxy_dofloat(t_bondo_proxy *x, t_float f, int doit) +{ + x->p_selector = &s_float; + x->p_float = f; + x->p_natoms = 0; /* defensive */ + if (doit) bondo_arm(x->p_master); +} + +static void bondo_proxy_float(t_bondo_proxy *x, t_float f) +{ + bondo_proxy_dofloat(x, f, 1); +} + +static void bondo_proxy_dosymbol(t_bondo_proxy *x, t_symbol *s, int doit) +{ + x->p_selector = &s_symbol; + x->p_symbol = s; + x->p_natoms = 0; /* defensive */ + if (doit) bondo_arm(x->p_master); +} + +static void bondo_proxy_symbol(t_bondo_proxy *x, t_symbol *s) +{ + bondo_proxy_dosymbol(x, s, 1); +} + +static void bondo_proxy_dopointer(t_bondo_proxy *x, t_gpointer *gp, int doit) +{ + x->p_selector = &s_pointer; + x->p_pointer = gp; + x->p_natoms = 0; /* defensive */ + if (doit) bondo_arm(x->p_master); +} + +static void bondo_proxy_pointer(t_bondo_proxy *x, t_gpointer *gp) +{ + bondo_proxy_dopointer(x, gp, 1); +} + +/* CHECKED: the slots fire in right-to-left order, + but they trigger only once (refman error) */ +static void bondo_distribute(t_bondo *x, int startid, + t_symbol *s, int ac, t_atom *av, int doit) +{ + t_atom *ap = av; + t_bondo_proxy **pp; + int id = startid + ac; + if (s) id++; + if (id > x->x_nslots) + id = x->x_nslots; + ap += id - startid; + pp = (t_bondo_proxy **)(x->x_proxies + id); + if (s) ap--; + while (ap-- > av) + { + pp--; + if (ap->a_type == A_FLOAT) + bondo_proxy_dofloat(*pp, ap->a_w.w_float, 0); + else if (ap->a_type == A_SYMBOL) + bondo_proxy_dosymbol(*pp, ap->a_w.w_symbol, 0); + else if (ap->a_type == A_POINTER) + bondo_proxy_dopointer(*pp, ap->a_w.w_gpointer, 0); + } + if (s) + bondo_proxy_dosymbol((t_bondo_proxy *)x->x_proxies[startid], s, 0); + if (doit) bondo_arm(x); +} + +static void bondo_proxy_domultiatom(t_bondo_proxy *x, + int ac, t_atom *av, int doit) +{ + if (ac > x->p_size) + { + /* LATER consider using BONDO_MAXSIZE (and warning if exceeded) */ + x->p_message = grow_nodata(&ac, &x->p_size, x->p_message, + BONDO_INISIZE, x->p_messini, + sizeof(*x->p_message)); + } + x->p_natoms = ac; + memcpy(x->p_message, av, ac * sizeof(*x->p_message)); + if (doit) bondo_arm(x->p_master); +} + +static void bondo_proxy_dolist(t_bondo_proxy *x, int ac, t_atom *av, int doit) +{ + if (x->p_master->x_multiatom) + { + x->p_selector = &s_list; + bondo_proxy_domultiatom(x, ac, av, doit); + } + else bondo_distribute(x->p_master, x->p_id, 0, ac, av, doit); +} + +static void bondo_proxy_list(t_bondo_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + bondo_proxy_dolist(x, ac, av, 1); +} + +static void bondo_proxy_doanything(t_bondo_proxy *x, + t_symbol *s, int ac, t_atom *av, int doit) +{ + if (x->p_master->x_multiatom) + { + /* LATER rethink and CHECKME */ + if (s == &s_symbol) + { + if (ac && av->a_type == A_SYMBOL) + bondo_proxy_dosymbol(x, av->a_w.w_symbol, doit); + else + bondo_proxy_dosymbol(x, &s_symbol, doit); + } + else + { + x->p_selector = s; + bondo_proxy_domultiatom(x, ac, av, doit); + } + } + else bondo_distribute(x->p_master, x->p_id, s, ac, av, doit); +} + +static void bondo_proxy_anything(t_bondo_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + bondo_proxy_doanything(x, s, ac, av, 1); +} + +static void bondo_proxy_set(t_bondo_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + if (ac) + { + if (av->a_type == A_FLOAT) + { + if (ac > 1) + bondo_proxy_dolist(x, ac, av, 0); + else + bondo_proxy_dofloat(x, av->a_w.w_float, 0); + } + else if (av->a_type == A_SYMBOL) + /* CHECKED: no tests for 'set float ...' and 'set list...' -- + the parsing is made in an output routine */ + bondo_proxy_doanything(x, av->a_w.w_symbol, ac-1, av+1, 0); + else if (av->a_type == A_POINTER) + bondo_proxy_dopointer(x, av->a_w.w_gpointer, 0); + } + /* CHECKED: 'set' without arguments makes a slot inactive, + if multiatom, but is ignored, if !multiatom */ + else if (x->p_master->x_multiatom) x->p_selector = 0; +} + +static void bondo_bang(t_bondo *x) +{ + bondo_proxy_bang((t_bondo_proxy *)x->x_proxies[0]); +} + +static void bondo_float(t_bondo *x, t_float f) +{ + bondo_proxy_dofloat((t_bondo_proxy *)x->x_proxies[0], f, 1); +} + +static void bondo_symbol(t_bondo *x, t_symbol *s) +{ + bondo_proxy_dosymbol((t_bondo_proxy *)x->x_proxies[0], s, 1); +} + +static void bondo_pointer(t_bondo *x, t_gpointer *gp) +{ + bondo_proxy_dopointer((t_bondo_proxy *)x->x_proxies[0], gp, 1); +} + +static void bondo_list(t_bondo *x, t_symbol *s, int ac, t_atom *av) +{ + bondo_proxy_dolist((t_bondo_proxy *)x->x_proxies[0], ac, av, 1); +} + +static void bondo_anything(t_bondo *x, t_symbol *s, int ac, t_atom *av) +{ + bondo_proxy_doanything((t_bondo_proxy *)x->x_proxies[0], s, ac, av, 1); +} + +static void bondo_set(t_bondo *x, t_symbol *s, int ac, t_atom *av) +{ + bondo_proxy_set((t_bondo_proxy *)x->x_proxies[0], s, ac, av); +} + +static void bondo_free(t_bondo *x) +{ + if (x->x_clock) clock_free(x->x_clock); + if (x->x_proxies) + { + int i = x->x_nslots; + while (i--) + { + t_bondo_proxy *y = (t_bondo_proxy *)x->x_proxies[i]; + if (y->p_message != y->p_messini) + freebytes(y->p_message, y->p_size * sizeof(*y->p_message)); + pd_free((t_pd *)y); + } + freebytes(x->x_proxies, x->x_nproxies * sizeof(*x->x_proxies)); + } + if (x->x_outs) + freebytes(x->x_outs, x->x_nslots * sizeof(*x->x_outs)); +} + +static void *bondo_new(t_symbol *s, int ac, t_atom *av) +{ + t_bondo *x; + int i, nslots, nproxies = BONDO_MINSLOTS; + int multiatom = 0; + t_float delay = 0; + t_pd **proxies; + t_outlet **outs; + i = 0; + while (ac--) + { + /* CHECKED: no warnings */ + if (av->a_type == A_FLOAT) + { + if (i == 0) + nproxies = (int)av->a_w.w_float; + else if (i == 1) + delay = av->a_w.w_float; + i++; + } + else if (av->a_type == A_SYMBOL) + { + if (av->a_w.w_symbol == gensym("n")) multiatom = 1; + /* CHECKED: 'n' has to be the last argument given; + the arguments after any symbol are silently ignored -- + LATER decide if we should comply and break here */ + } + av++; + } + if (nproxies < BONDO_MINSLOTS) + nproxies = BONDO_MINSLOTS; + if (!(proxies = (t_pd **)getbytes(nproxies * sizeof(*proxies)))) + return (0); + for (nslots = 0; nslots < nproxies; nslots++) + if (!(proxies[nslots] = pd_new(bondo_proxy_class))) break; + if (nslots < BONDO_MINSLOTS + || !(outs = (t_outlet **)getbytes(nslots * sizeof(*outs)))) + { + i = nslots; + while (i--) pd_free(proxies[i]); + freebytes(proxies, nproxies * sizeof(*proxies)); + return (0); + } + x = (t_bondo *)pd_new(bondo_class); + x->x_delay = delay; + x->x_multiatom = multiatom; + x->x_nslots = nslots; + x->x_nproxies = nproxies; + x->x_proxies = proxies; + x->x_outs = outs; + for (i = 0; i < nslots; i++) + { + t_bondo_proxy *y = (t_bondo_proxy *)proxies[i]; + y->p_master = x; + y->p_id = i; + y->p_selector = &s_float; /* CHECKED: it is so in multiatom mode too */ + y->p_float = 0; + y->p_symbol = 0; + y->p_pointer = 0; + y->p_size = BONDO_INISIZE; + y->p_natoms = 0; + y->p_message = y->p_messini; + if (i) inlet_new((t_object *)x, (t_pd *)y, 0, 0); + x->x_outs[i] = outlet_new((t_object *)x, &s_anything); + } + x->x_clock = clock_new(x, (t_method)bondo_doit); + return (x); +} + +void bondo_setup(void) +{ + bondo_class = class_new(gensym("bondo"), + (t_newmethod)bondo_new, + (t_method)bondo_free, + sizeof(t_bondo), 0, A_GIMME, 0); + class_addbang(bondo_class, bondo_bang); + class_addfloat(bondo_class, bondo_float); + class_addsymbol(bondo_class, bondo_symbol); + class_addpointer(bondo_class, bondo_pointer); + class_addlist(bondo_class, bondo_list); + class_addanything(bondo_class, bondo_anything); + class_addmethod(bondo_class, (t_method)bondo_set, + gensym("set"), A_GIMME, 0); + bondo_proxy_class = class_new(gensym("_bondo_proxy"), 0, 0, + sizeof(t_bondo_proxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(bondo_proxy_class, bondo_proxy_bang); + class_addfloat(bondo_proxy_class, bondo_proxy_float); + class_addsymbol(bondo_proxy_class, bondo_proxy_symbol); + class_addpointer(bondo_proxy_class, bondo_proxy_pointer); + class_addlist(bondo_proxy_class, bondo_proxy_list); + class_addanything(bondo_proxy_class, bondo_proxy_anything); + class_addmethod(bondo_proxy_class, (t_method)bondo_proxy_set, + gensym("set"), A_GIMME, 0); +} diff --git a/externals/miXed/cyclone/hammer/buddy.c b/externals/miXed/cyclone/hammer/buddy.c new file mode 100644 index 000000000..f2727394e --- /dev/null +++ b/externals/miXed/cyclone/hammer/buddy.c @@ -0,0 +1,253 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER compare with buddy.c from max sdk */ +/* LATER revisit buffer handling (maxsize, reentrancy) */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" + +#define BUDDY_MINSLOTS 2 +#define BUDDY_INISIZE 4 /* LATER rethink */ + +typedef struct _buddy +{ + t_object x_ob; + int x_nslots; + int x_nproxies; /* as requested (and allocated) */ + t_pd **x_proxies; + t_outlet **x_outs; +} t_buddy; + +typedef struct _buddy_proxy +{ + t_object p_ob; + t_buddy *p_master; + t_symbol *p_selector; + t_float p_float; + t_symbol *p_symbol; + t_gpointer *p_pointer; + int p_size; /* as allocated */ + int p_natoms; /* as used */ + t_atom *p_message; + t_atom p_messini[BUDDY_INISIZE]; +} t_buddy_proxy; + +static t_class *buddy_class; +static t_class *buddy_proxy_class; + +static void buddy_clear(t_buddy *x) +{ + t_buddy_proxy **p = (t_buddy_proxy **)x->x_proxies; + int i = x->x_nslots; + while (i--) + { + (*p)->p_selector = 0; + (*p++)->p_natoms = 0; /* defensive */ + } +} + +static void buddy_check(t_buddy *x) +{ + t_buddy_proxy **p = (t_buddy_proxy **)x->x_proxies; + int i = x->x_nslots; + while (i--) + if (!(*p++)->p_selector) + return; + p = (t_buddy_proxy **)x->x_proxies; + i = x->x_nslots; + while (i--) + { + t_symbol *s = p[i]->p_selector; + if (s == &s_bang) + outlet_bang(x->x_outs[i]); + else if (s == &s_float) + outlet_float(x->x_outs[i], p[i]->p_float); + else if (s == &s_symbol && p[i]->p_symbol) + outlet_symbol(x->x_outs[i], p[i]->p_symbol); + else if (s == &s_pointer) + { + /* LATER */ + } + else if (s == &s_list) + outlet_list(x->x_outs[i], s, p[i]->p_natoms, p[i]->p_message); + else if (s) + outlet_anything(x->x_outs[i], s, p[i]->p_natoms, p[i]->p_message); + } + buddy_clear(x); +} + +static void buddy_proxy_bang(t_buddy_proxy *x) +{ + x->p_selector = &s_bang; + x->p_natoms = 0; /* defensive */ + buddy_check(x->p_master); +} + +static void buddy_proxy_float(t_buddy_proxy *x, t_float f) +{ + x->p_selector = &s_float; + x->p_float = f; + x->p_natoms = 0; /* defensive */ + buddy_check(x->p_master); +} + +static void buddy_proxy_symbol(t_buddy_proxy *x, t_symbol *s) +{ + x->p_selector = &s_symbol; + x->p_symbol = s; + x->p_natoms = 0; /* defensive */ + buddy_check(x->p_master); +} + +static void buddy_proxy_pointer(t_buddy_proxy *x, t_gpointer *gp) +{ + x->p_selector = &s_pointer; + x->p_pointer = gp; + x->p_natoms = 0; /* defensive */ + buddy_check(x->p_master); +} + +static void buddy_proxy_domessage(t_buddy_proxy *x, int ac, t_atom *av) +{ + if (ac > x->p_size) + { + /* LATER consider using BUDDY_MAXSIZE (and warning if exceeded) */ + x->p_message = grow_nodata(&ac, &x->p_size, x->p_message, + BUDDY_INISIZE, x->p_messini, + sizeof(*x->p_message)); + } + x->p_natoms = ac; + memcpy(x->p_message, av, ac * sizeof(*x->p_message)); + buddy_check(x->p_master); +} + +static void buddy_proxy_list(t_buddy_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + x->p_selector = &s_list; /* LATER rethink */ + buddy_proxy_domessage(x, ac, av); +} + +static void buddy_proxy_anything(t_buddy_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + x->p_selector = s; /* LATER rethink */ + buddy_proxy_domessage(x, ac, av); +} + +static void buddy_bang(t_buddy *x) +{ + buddy_proxy_bang((t_buddy_proxy *)x->x_proxies[0]); +} + +static void buddy_float(t_buddy *x, t_float f) +{ + buddy_proxy_float((t_buddy_proxy *)x->x_proxies[0], f); +} + +static void buddy_symbol(t_buddy *x, t_symbol *s) +{ + buddy_proxy_symbol((t_buddy_proxy *)x->x_proxies[0], s); +} + +static void buddy_pointer(t_buddy *x, t_gpointer *gp) +{ + buddy_proxy_pointer((t_buddy_proxy *)x->x_proxies[0], gp); +} + +static void buddy_list(t_buddy *x, t_symbol *s, int ac, t_atom *av) +{ + buddy_proxy_list((t_buddy_proxy *)x->x_proxies[0], s, ac, av); +} + +static void buddy_anything(t_buddy *x, t_symbol *s, int ac, t_atom *av) +{ + buddy_proxy_anything((t_buddy_proxy *)x->x_proxies[0], s, ac, av); +} + +static void buddy_free(t_buddy *x) +{ + if (x->x_proxies) + { + int i = x->x_nslots; + while (i--) + { + t_buddy_proxy *y = (t_buddy_proxy *)x->x_proxies[i]; + if (y->p_message != y->p_messini) + freebytes(y->p_message, y->p_size * sizeof(*y->p_message)); + pd_free((t_pd *)y); + } + freebytes(x->x_proxies, x->x_nproxies * sizeof(*x->x_proxies)); + } + if (x->x_outs) + freebytes(x->x_outs, x->x_nslots * sizeof(*x->x_outs)); +} + +static void *buddy_new(t_floatarg f) +{ + t_buddy *x; + int i, nslots, nproxies = (int)f; + t_pd **proxies; + t_outlet **outs; + if (nproxies < BUDDY_MINSLOTS) + nproxies = BUDDY_MINSLOTS; + if (!(proxies = (t_pd **)getbytes(nproxies * sizeof(*proxies)))) + return (0); + for (nslots = 0; nslots < nproxies; nslots++) + if (!(proxies[nslots] = pd_new(buddy_proxy_class))) break; + if (nslots < BUDDY_MINSLOTS + || !(outs = (t_outlet **)getbytes(nslots * sizeof(*outs)))) + { + int i = nslots; + while (i--) pd_free(proxies[i]); + freebytes(proxies, nproxies * sizeof(*proxies)); + return (0); + } + x = (t_buddy *)pd_new(buddy_class); + x->x_nslots = nslots; + x->x_nproxies = nproxies; + x->x_proxies = proxies; + x->x_outs = outs; + for (i = 0; i < nslots; i++) + { + t_buddy_proxy *y = (t_buddy_proxy *)proxies[i]; + y->p_master = x; + y->p_selector = 0; + y->p_float = 0; + y->p_symbol = 0; + y->p_pointer = 0; + y->p_size = BUDDY_INISIZE; + y->p_natoms = 0; + y->p_message = y->p_messini; + if (i) inlet_new((t_object *)x, (t_pd *)y, 0, 0); + x->x_outs[i] = outlet_new((t_object *)x, &s_anything); + } + return (x); +} + +void buddy_setup(void) +{ + buddy_class = class_new(gensym("buddy"), + (t_newmethod)buddy_new, + (t_method)buddy_free, + sizeof(t_buddy), 0, A_DEFFLOAT, 0); + class_addbang(buddy_class, buddy_bang); + class_addfloat(buddy_class, buddy_float); + class_addsymbol(buddy_class, buddy_symbol); + class_addpointer(buddy_class, buddy_pointer); + class_addlist(buddy_class, buddy_list); + class_addanything(buddy_class, buddy_anything); + class_addmethod(buddy_class, (t_method)buddy_clear, gensym("clear"), 0); + buddy_proxy_class = class_new(gensym("_buddy_proxy"), 0, 0, + sizeof(t_buddy_proxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(buddy_proxy_class, buddy_proxy_bang); + class_addfloat(buddy_proxy_class, buddy_proxy_float); + class_addsymbol(buddy_proxy_class, buddy_proxy_symbol); + class_addpointer(buddy_proxy_class, buddy_proxy_pointer); + class_addlist(buddy_proxy_class, buddy_proxy_list); + class_addanything(buddy_proxy_class, buddy_proxy_anything); +} diff --git a/externals/miXed/cyclone/hammer/capture.c b/externals/miXed/cyclone/hammer/capture.c new file mode 100644 index 000000000..69e44f079 --- /dev/null +++ b/externals/miXed/cyclone/hammer/capture.c @@ -0,0 +1,291 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include "m_pd.h" +#include "common/loud.h" +#include "hammer/file.h" + +#define CAPTURE_DEFSIZE 512 + +typedef struct _capture +{ + t_object x_ob; + t_canvas *x_canvas; + char x_intmode; /* if nonzero ('x' or 'm') floats are ignored */ + float *x_buffer; + int x_bufsize; + int x_count; + int x_head; + t_hammerfile *x_filehandle; +} t_capture; + +static t_class *capture_class; + +static void capture_float(t_capture *x, t_float f) +{ + if (x->x_intmode && f != (int)f) /* CHECKME float */ + return; + x->x_buffer[x->x_head++] = f; + if (x->x_head >= x->x_bufsize) + x->x_head = 0; + if (x->x_count < x->x_bufsize) + x->x_count++; +} + +static void capture_list(t_capture *x, t_symbol *s, int ac, t_atom *av) +{ + while (ac--) + { + if (av->a_type == A_FLOAT) /* CHECKME */ + capture_float(x, av->a_w.w_float); + av++; + } +} + +static void capture_clear(t_capture *x) +{ + x->x_count = 0; + x->x_head = 0; +} + +static void capture_count(t_capture *x) +{ + post("capture: %d items received", /* CHECKED */ + x->x_count); /* CHECKED incompatible (4.07 seems buggy here) */ +} + +static void capture_dump(t_capture *x) +{ + int count = x->x_count; + if (count < x->x_bufsize) + { + float *bp = x->x_buffer; + while (count--) + outlet_float(((t_object *)x)->ob_outlet, *bp++); + } + else + { + float *bp = x->x_buffer + x->x_head; + count = x->x_bufsize - x->x_head; + while (count--) + outlet_float(((t_object *)x)->ob_outlet, *bp++); + bp = x->x_buffer; + count = x->x_head; + while (count--) + outlet_float(((t_object *)x)->ob_outlet, *bp++); + } +} + +static int capture_formatint(int i, char *buf, int col, + int maxcol, char *fmt) +{ + char *bp = buf; + int cnt = 0; + if (col > 0) + *bp++ = ' ', cnt++; + cnt += sprintf(bp, fmt, i); + if (col + cnt > maxcol) + buf[0] = '\n', col = cnt - 1; /* assuming col > 0 */ + else + col += cnt; + return (col); +} + +static int capture_formatfloat(float f, char *buf, int col, + int maxcol, char *fmt) +{ + char *bp = buf; + int cnt = 0; + if (col > 0) + *bp++ = ' ', cnt++; + cnt += sprintf(bp, fmt, f); + if (col + cnt > maxcol) + buf[0] = '\n', col = cnt - 1; /* assuming col > 0 */ + else + col += cnt; + return (col); +} + +static int capture_formatnumber(t_capture *x, float f, char *buf, + int col, int maxcol) +{ + char intmode = x->x_intmode; + if (intmode == 'm') + intmode = (f < 128 && f > -128 ? 'd' : 'x'); /* CHECKME */ + if (intmode == 'x') + col = capture_formatint((int)f, buf, col, maxcol, "%x"); + else if (intmode) + col = capture_formatint((int)f, buf, col, maxcol, "%d"); + else + col = capture_formatfloat(f, buf, col, maxcol, "%g"); + return (col); +} + +static int capture_writefloat(t_capture *x, float f, char *buf, int col, + FILE *fp) +{ + /* CHECKED no linebreaks (FIXME) */ + col = capture_formatnumber(x, f, buf, col, 80); + return (fputs(buf, fp) < 0 ? -1 : col); +} + +static void capture_dowrite(t_capture *x, t_symbol *fn) +{ + FILE *fp = 0; + int count = x->x_count; + char buf[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, fn->s_name, buf, MAXPDSTRING); + if (fp = sys_fopen(buf, "w")) /* LATER ask if overwriting, CHECKED */ + { + int col = 0; + if (count < x->x_bufsize) + { + float *bp = x->x_buffer; + while (count--) + if ((col = capture_writefloat(x, *bp++, buf, col, fp)) < 0) + goto fail; + } + else + { + float *bp = x->x_buffer + x->x_head; + count = x->x_bufsize - x->x_head; + while (count--) + if ((col = capture_writefloat(x, *bp++, buf, col, fp)) < 0) + goto fail; + bp = x->x_buffer; + count = x->x_head; + while (count--) + if ((col = capture_writefloat(x, *bp++, buf, col, fp)) < 0) + goto fail; + } + if (col) fputc('\n', fp); + fclose(fp); + return; + } +fail: + if (fp) fclose(fp); + loud_syserror((t_pd *)x, 0); +} + +static void capture_writehook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + capture_dowrite((t_capture *)z, fn); +} + +static void capture_write(t_capture *x, t_symbol *s) +{ + if (s && s != &s_) + capture_dowrite(x, s); + else + hammerpanel_save(x->x_filehandle, 0, 0); +} + +static int capture_appendfloat(t_capture *x, float f, char *buf, int col) +{ + /* CHECKED 80 columns */ + col = capture_formatnumber(x, f, buf, col, 80); + hammereditor_append(x->x_filehandle, buf); + return (col); +} + +static void capture_open(t_capture *x) +{ + int count = x->x_count; + char buf[MAXPDSTRING]; + hammereditor_open(x->x_filehandle, "Capture", ""); /* CHECKED */ + if (count < x->x_bufsize) + { + float *bp = x->x_buffer; + int col = 0; + while (count--) + col = capture_appendfloat(x, *bp++, buf, col); + } + else + { + float *bp = x->x_buffer + x->x_head; + int col = 0; + count = x->x_bufsize - x->x_head; + while (count--) + col = capture_appendfloat(x, *bp++, buf, col); + bp = x->x_buffer; + count = x->x_head; + while (count--) + col = capture_appendfloat(x, *bp++, buf, col); + } +} + +/* CHECKED without asking and storing the changes */ +static void capture_wclose(t_capture *x) +{ + hammereditor_close(x->x_filehandle, 0); +} + +static void capture_click(t_capture *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + capture_open(x); +} + +static void capture_free(t_capture *x) +{ + hammerfile_free(x->x_filehandle); + if (x->x_buffer) + freebytes(x->x_buffer, x->x_bufsize * sizeof(*x->x_buffer)); +} + +static void *capture_new(t_symbol *s, t_floatarg f) +{ + t_capture *x = 0; + float *buffer; + int bufsize = (int)f; /* CHECKME */ + if (bufsize <= 0) /* CHECKME */ + bufsize = CAPTURE_DEFSIZE; + if (buffer = getbytes(bufsize * sizeof(*buffer))) + { + x = (t_capture *)pd_new(capture_class); + x->x_canvas = canvas_getcurrent(); + if (s && s != &s_) + { + if (s == gensym("x")) + x->x_intmode = 'x'; + else if (s == gensym("m")) + x->x_intmode = 'm'; + else + x->x_intmode = 'd'; /* ignore floats */ + } + x->x_buffer = buffer; + x->x_bufsize = bufsize; + outlet_new((t_object *)x, &s_float); + x->x_filehandle = hammerfile_new((t_pd *)x, 0, 0, capture_writehook, 0); + capture_clear(x); + } + return (x); +} + +void capture_setup(void) +{ + capture_class = class_new(gensym("capture"), + (t_newmethod)capture_new, + (t_method)capture_free, + sizeof(t_capture), 0, A_DEFFLOAT, A_DEFSYM, 0); + class_addfloat(capture_class, capture_float); + class_addlist(capture_class, capture_list); + class_addmethod(capture_class, (t_method)capture_clear, + gensym("clear"), 0); + class_addmethod(capture_class, (t_method)capture_count, + gensym("count"), 0); + class_addmethod(capture_class, (t_method)capture_dump, + gensym("dump"), 0); + class_addmethod(capture_class, (t_method)capture_write, + gensym("write"), A_DEFSYM, 0); + class_addmethod(capture_class, (t_method)capture_open, + gensym("open"), 0); + class_addmethod(capture_class, (t_method)capture_wclose, + gensym("wclose"), 0); + class_addmethod(capture_class, (t_method)capture_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + hammerfile_setup(capture_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/cartopol.c b/externals/miXed/cyclone/hammer/cartopol.c new file mode 100644 index 000000000..962a05e9f --- /dev/null +++ b/externals/miXed/cyclone/hammer/cartopol.c @@ -0,0 +1,44 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define atan2f atan2 +#define hypotf hypot +#endif + +typedef struct _cartopol +{ + t_object x_ob; + t_float x_imag; + t_outlet *x_out2; +} t_cartopol; + +static t_class *cartopol_class; + +static void cartopol_float(t_cartopol *x, t_float f) +{ + outlet_float(x->x_out2, atan2f(x->x_imag, f)); + outlet_float(((t_object *)x)->ob_outlet, hypotf(f, x->x_imag)); +} + +static void *cartopol_new(void) +{ + t_cartopol *x = (t_cartopol *)pd_new(cartopol_class); + floatinlet_new((t_object *)x, &x->x_imag); + outlet_new((t_object *)x, &s_float); + x->x_out2 = outlet_new((t_object *)x, &s_float); + return (x); +} + +void cartopol_setup(void) +{ + cartopol_class = class_new(gensym("cartopol"), + (t_newmethod)cartopol_new, 0, + sizeof(t_cartopol), 0, 0); + class_addfloat(cartopol_class, cartopol_float); +} diff --git a/externals/miXed/cyclone/hammer/coll.c b/externals/miXed/cyclone/hammer/coll.c new file mode 100644 index 000000000..6f0c41552 --- /dev/null +++ b/externals/miXed/cyclone/hammer/coll.c @@ -0,0 +1,2059 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "hammer/file.h" + +#include <pthread.h> +#include <unistd.h> + +/* LATER profile for the bottlenecks of insertion and sorting */ +/* LATER make sure that ``reentrancy protection hack'' is really working... */ + +#ifdef KRZYSZCZ +//#define COLL_DEBUG +#endif + +enum { COLL_HEADRESET, + COLL_HEADNEXT, COLL_HEADPREV, /* distinction not used, currently */ + COLL_HEADDELETED }; + +typedef struct _collelem +{ + int e_hasnumkey; + int e_numkey; + t_symbol *e_symkey; + struct _collelem *e_prev; + struct _collelem *e_next; + int e_size; + t_atom *e_data; +} t_collelem; + +typedef struct _collcommon +{ + t_pd c_pd; + struct _coll *c_refs; /* used in read-banging and dirty flag handling */ + int c_increation; + int c_volatile; + int c_selfmodified; + int c_entered; /* a counter, LATER rethink */ + int c_embedflag; /* common field (CHECKED in 'TEXT' files) */ + t_symbol *c_filename; /* CHECKED common for all, read and write */ + t_canvas *c_lastcanvas; + t_hammerfile *c_filehandle; + t_collelem *c_first; + t_collelem *c_last; + t_collelem *c_head; + int c_headstate; +} t_collcommon; + +typedef struct _coll_q /* element in a linked list of stored messages waiting to be sent out */ +{ + struct _coll_q *q_next; /* next in list */ + char *q_s; /* the string */ +} t_coll_q; + +typedef struct _coll +{ + t_object x_ob; + t_canvas *x_canvas; + t_symbol *x_name; + t_collcommon *x_common; + t_hammerfile *x_filehandle; + t_outlet *x_keyout; + t_outlet *x_filebangout; + t_outlet *x_dumpbangout; + struct _coll *x_next; + + //for thread-unsafe file i/o operations + //added by Ivica Ico Bukvic <ico@vt.edu> 9-24-2010 + //http://disis.music.vt.edu http://l2ork.music.vt.edu + t_clock *x_clock; + + pthread_t unsafe_t; + pthread_mutex_t unsafe_mutex; + pthread_cond_t unsafe_cond; + + t_symbol *x_s; + t_int unsafe; + t_int init; //used to make sure that the secondary thread is ready to go + + t_int threaded; //used to decide whether this should be a threaded instance + + t_coll_q *x_q; //a list of error messages to be processed +} t_coll; + +typedef struct _msg +{ + int m_flag; + int m_line; +} t_msg; + +typedef struct _threadedFunctionParams +{ + t_coll *x; +} t_threadedFunctionParams; + +static t_class *coll_class; +static t_class *collcommon_class; + +static void coll_q_free(t_coll *x) +{ + //fprintf(stderr,"coll_q_free\n"); + t_coll_q *q2; + while (x->x_q) + { + q2 = x->x_q->q_next; + t_freebytes(x->x_q->q_s, strlen(x->x_q->q_s) + 1); + t_freebytes(x->x_q, sizeof(*x->x_q)); + x->x_q = q2; + } + x->x_q = NULL; +} + +static void coll_q_post(t_coll_q *q) +{ + t_coll_q *qtmp; + for (qtmp = q; qtmp; qtmp = qtmp->q_next) + { + //fprintf(stderr,"posting...%s\n", qtmp->q_s); + post("%s", qtmp->q_s); + } +} + +static void coll_q_enqueue(t_coll *x, const char *s) +{ + //fprintf(stderr,"enqueuing %s\n", s); + t_coll_q *q, *q2 = NULL; + q = (t_coll_q *)(getbytes(sizeof(*q))); + q->q_next = NULL; + q->q_s = (char *)getbytes(strlen(s) + 1); + strcpy(q->q_s, s); + if (!x->x_q) { + //fprintf(stderr,"first\n"); + x->x_q = q; + } + else { + //fprintf(stderr,"not first\n"); + q2 = x->x_q; + while (q2->q_next) + q2 = q2->q_next; + q2->q_next = q; + } +} + +static void coll_enqueue_threaded_msgs(t_coll *x, t_msg *m) +{ + //fprintf(stderr,"msgs = %d\n", m->m_flag); + char s[MAXPDSTRING]; + if (m->m_flag & 1) { + //fprintf(stderr,"0x01\n"); + sprintf(s, "coll: no coll file '%s'", x->x_s->s_name); + coll_q_enqueue(x, s); + } + if (m->m_flag & 2) { + //fprintf(stderr,"0x02\n"); + sprintf(s, "coll: error reading text file '%s'", x->x_s->s_name); + coll_q_enqueue(x, s); + } + if (m->m_flag & 4) { + //fprintf(stderr,"0x04\n"); + sprintf(s, "coll: finished reading %d lines from text file '%s'", m->m_line, x->x_s->s_name); + coll_q_enqueue(x, s); + } + if (m->m_flag & 8) { + //fprintf(stderr,"0x08\n"); + sprintf(s, "coll: error in line %d of text file '%s'", m->m_line, x->x_s->s_name); + coll_q_enqueue(x, s); + } + if (m->m_flag & 16) { + //fprintf(stderr,"0x16\n"); + sprintf(s, "coll: error reading text file '%s'", x->x_s->s_name); + coll_q_enqueue(x, s); + } + if (m->m_flag & 32) { + //fprintf(stderr,"0x32\n"); + sprintf(s, "coll: error writing text file '%s'", x->x_s->s_name); + coll_q_enqueue(x, s); + } +} + +static void coll_tick(t_coll *x) +{ + //x->busy = 0; + if (x->x_q) + { + coll_q_post(x->x_q); + coll_q_free(x); + } + outlet_bang(x->x_filebangout); +} + +static t_collelem *collelem_new(int ac, t_atom *av, int *np, t_symbol *s) +{ + t_collelem *ep = (t_collelem *)getbytes(sizeof(*ep)); + if (ep->e_hasnumkey = (np != 0)) + ep->e_numkey = *np; + ep->e_symkey = s; + ep->e_prev = ep->e_next = 0; + if (ep->e_size = ac) + { + t_atom *ap = getbytes(ac * sizeof(*ap)); + ep->e_data = ap; + if (av) while (ac--) + *ap++ = *av++; + else while (ac--) + { + SETFLOAT(ap, 0); + ap++; + } + } + else ep->e_data = 0; + return (ep); +} + +static void collelem_free(t_collelem *ep) +{ + if (ep->e_data) + freebytes(ep->e_data, ep->e_size * sizeof(*ep->e_data)); + freebytes(ep, sizeof(*ep)); +} + +/* CHECKME again... apparently c74 is not able to fix this for good */ +/* result: 1 for ep1 < ep2, 0 for ep1 >= ep2, all symbols are < any float */ +static int collelem_less(t_collelem *ep1, t_collelem *ep2, int ndx, int swap) +{ + int isless; + if (swap) + { + t_collelem *ep = ep1; + ep1 = ep2; + ep2 = ep; + } + if (ndx < 0) + { + if (ep1->e_symkey) + isless = + (ep2->e_symkey ? strcmp(ep1->e_symkey->s_name, + ep2->e_symkey->s_name) < 0 + : 1); /* CHECKED incompatible with 4.07, but consistent */ + else if (ep2->e_symkey) + isless = 0; /* CHECKED incompatible with 4.07, but consistent */ + else + isless = (ep1->e_numkey < ep2->e_numkey); /* CHECKED in 4.07 */ + } + else + { + t_atom *ap1 = (ndx < ep1->e_size ? + ep1->e_data + ndx : ep1->e_data + ep1->e_size - 1); + t_atom *ap2 = (ndx < ep2->e_size ? + ep2->e_data + ndx : ep2->e_data + ep2->e_size - 1); + if (ap1->a_type == A_FLOAT) + { + if (ap2->a_type == A_FLOAT) + isless = (ap1->a_w.w_float < ap2->a_w.w_float); + else if (ap2->a_type == A_SYMBOL) + isless = 0; + else + isless = 1; + } + else if (ap1->a_type == A_SYMBOL) + { + if (ap2->a_type == A_FLOAT) + isless = 1; + else if (ap2->a_type == A_SYMBOL) + isless = (strcmp(ap1->a_w.w_symbol->s_name, + ap2->a_w.w_symbol->s_name) < 0); + else + isless = 1; + } + else isless = 0; + } + return (isless); +} + +static t_collelem *collcommon_numkey(t_collcommon *cc, int numkey) +{ + t_collelem *ep; + for (ep = cc->c_first; ep; ep = ep->e_next) + if (ep->e_hasnumkey && ep->e_numkey == numkey) + return (ep); + return (0); +} + +static t_collelem *collcommon_symkey(t_collcommon *cc, t_symbol *symkey) +{ + t_collelem *ep; + for (ep = cc->c_first; ep; ep = ep->e_next) + if (ep->e_symkey == symkey) + return (ep); + return (0); +} + +static void collcommon_takeout(t_collcommon *cc, t_collelem *ep) +{ + if (ep->e_prev) + ep->e_prev->e_next = ep->e_next; + else + cc->c_first = ep->e_next; + if (ep->e_next) + ep->e_next->e_prev = ep->e_prev; + else + cc->c_last = ep->e_prev; + if (cc->c_head == ep) + { + cc->c_head = ep->e_next; /* asymmetric, LATER rethink */ + cc->c_headstate = COLL_HEADDELETED; + } + +} + +static void collcommon_modified(t_collcommon *cc, int relinked) +{ + if (cc->c_increation) + return; + if (relinked) + { + cc->c_volatile = 1; + } + if (cc->c_embedflag) + { + t_coll *x; + for (x = cc->c_refs; x; x = x->x_next) + if (x->x_canvas && glist_isvisible(x->x_canvas)) + canvas_dirty(x->x_canvas, 1); + } +} + + + +/* atomic collcommon modifiers: clearall, remove, replace, + putbefore, putafter, swaplinks, swapkeys, changesymkey, renumber, sort */ + +static void collcommon_clearall(t_collcommon *cc) +{ + if (cc->c_first) + { + t_collelem *ep1 = cc->c_first, *ep2; + do + { + ep2 = ep1->e_next; + collelem_free(ep1); + } + while (ep1 = ep2); + cc->c_first = cc->c_last = 0; + cc->c_head = 0; + cc->c_headstate = COLL_HEADRESET; + collcommon_modified(cc, 1); + } +} + +static void collcommon_remove(t_collcommon *cc, t_collelem *ep) +{ + collcommon_takeout(cc, ep); + collelem_free(ep); + collcommon_modified(cc, 1); +} + +static void collcommon_replace(t_collcommon *cc, t_collelem *ep, + int ac, t_atom *av, int *np, t_symbol *s) +{ + if (ep->e_hasnumkey = (np != 0)) + ep->e_numkey = *np; + ep->e_symkey = s; + if (ac) + { + int i = ac; + t_atom *ap; + if (ep->e_data) + { + if (ep->e_size != ac) + ap = resizebytes(ep->e_data, + ep->e_size * sizeof(*ap), ac * sizeof(*ap)); + else ap = ep->e_data; + } + else + ap = getbytes(ac * sizeof(*ap)); + ep->e_data = ap; + if (av) while (i --) + *ap++ = *av++; + else while (i --) + { + SETFLOAT(ap, 0); + ap++; + } + } + else + { + if (ep->e_data) + freebytes(ep->e_data, ep->e_size * sizeof(*ep->e_data)); + ep->e_data = 0; + } + ep->e_size = ac; + collcommon_modified(cc, 0); +} + +static void collcommon_putbefore(t_collcommon *cc, + t_collelem *ep, t_collelem *next) +{ + if (next) + { + ep->e_next = next; + if (ep->e_prev = next->e_prev) + ep->e_prev->e_next = ep; + else + cc->c_first = ep; + next->e_prev = ep; + } + else if (cc->c_first || cc->c_last) + loudbug_bug("collcommon_putbefore"); + else + cc->c_first = cc->c_last = ep; + collcommon_modified(cc, 1); +} + +static void collcommon_putafter(t_collcommon *cc, + t_collelem *ep, t_collelem *prev) +{ + if (prev) + { + ep->e_prev = prev; + if (ep->e_next = prev->e_next) + ep->e_next->e_prev = ep; + else + cc->c_last = ep; + prev->e_next = ep; + } + else if (cc->c_first || cc->c_last) + loudbug_bug("collcommon_putafter"); + else + cc->c_first = cc->c_last = ep; + collcommon_modified(cc, 1); +} + +/* LATER consider making it faster, if there is a real need. + Now called only in the sort routine, once per sort. */ +static void collcommon_swaplinks(t_collcommon *cc, + t_collelem *ep1, t_collelem *ep2) +{ + if (ep1 != ep2) + { + t_collelem *prev1 = ep1->e_prev, *prev2 = ep2->e_prev; + if (prev1 == ep2) + { + collcommon_takeout(cc, ep2); + collcommon_putafter(cc, ep2, ep1); + } + else if (prev2 == ep1) + { + collcommon_takeout(cc, ep1); + collcommon_putafter(cc, ep1, ep2); + } + else if (prev1) + { + if (prev2) + { + collcommon_takeout(cc, ep1); + collcommon_takeout(cc, ep2); + collcommon_putafter(cc, ep1, prev2); + collcommon_putafter(cc, ep2, prev1); + } + else + { + t_collelem *next2 = ep2->e_next; + collcommon_takeout(cc, ep1); + collcommon_takeout(cc, ep2); + collcommon_putbefore(cc, ep1, next2); + collcommon_putafter(cc, ep2, prev1); + } + } + else if (prev2) + { + t_collelem *next1 = ep1->e_next; + collcommon_takeout(cc, ep1); + collcommon_takeout(cc, ep2); + collcommon_putafter(cc, ep1, prev2); + collcommon_putbefore(cc, ep2, next1); + } + else loudbug_bug("collcommon_swaplinks"); + } +} + +static void collcommon_swapkeys(t_collcommon *cc, + t_collelem *ep1, t_collelem *ep2) +{ + int hasnumkey = ep2->e_hasnumkey, numkey = ep2->e_numkey; + t_symbol *symkey = ep2->e_symkey; + ep2->e_hasnumkey = ep1->e_hasnumkey; + ep2->e_numkey = ep1->e_numkey; + ep2->e_symkey = ep1->e_symkey; + ep1->e_hasnumkey = hasnumkey; + ep1->e_numkey = numkey; + ep1->e_symkey = symkey; + collcommon_modified(cc, 0); +} + +static void collcommon_changesymkey(t_collcommon *cc, + t_collelem *ep, t_symbol *s) +{ + ep->e_symkey = s; + collcommon_modified(cc, 0); +} + +static void collcommon_renumber(t_collcommon *cc, int startkey) +{ + t_collelem *ep; + for (ep = cc->c_first; ep; ep = ep->e_next) + if (ep->e_hasnumkey) + ep->e_numkey = startkey++; + collcommon_modified(cc, 0); +} + +/* LATER choose a better algo, after coll's storage structures stabilize. + Note, that even the simple insertion sort below (n-square) might prove better + for bi-directional lists, than theoretically efficient algo (nlogn) requiring + random access emulation. Avoiding recursion is not a bad idea, too. */ +static void collcommon_sort(t_collcommon *cc, int descending, int ndx) +{ + t_collelem *min = cc->c_first; + t_collelem *ep; + if (min && (ep = min->e_next)) + { + cc->c_increation = 1; + /* search for a sentinel element */ + do + if (collelem_less(ep, min, ndx, descending)) + min = ep; + while (ep = ep->e_next); + /* prepend it */ + collcommon_swaplinks(cc, cc->c_first, min); + /* sort */ + ep = min->e_next->e_next; + while (ep) + { + t_collelem *next = ep->e_next; + for (min = ep->e_prev; + min && /* LATER remove */ + collelem_less(ep, min, ndx, descending); + min = min->e_prev); + if (!min) /* LATER remove */ + loudbug_bug("collcommon_sort"); + else if (ep != min->e_next) + { + collcommon_takeout(cc, ep); + collcommon_putafter(cc, ep, min); + } + ep = next; + } + cc->c_increation = 0; + collcommon_modified(cc, 1); + } +} + +static void collcommon_adddata(t_collcommon *cc, t_collelem *ep, + int ac, t_atom *av) +{ + if (ac) + { + t_atom *ap; + int newsize = ep->e_size + ac; + if (ep->e_data) + ap = resizebytes(ep->e_data, + ep->e_size * sizeof(*ap), newsize * sizeof(*ap)); + else + { + ep->e_size = 0; /* redundant, hopefully */ + ap = getbytes(newsize * sizeof(*ap)); + } + ep->e_data = ap; + ap += ep->e_size; + if (av) while (ac--) + *ap++ = *av++; + else while (ac--) + { + SETFLOAT(ap, 0); + ap++; + } + ep->e_size = newsize; + collcommon_modified(cc, 0); + } +} + +static t_collelem *collcommon_tonumkey(t_collcommon *cc, int numkey, + int ac, t_atom *av, int replace) +{ + t_collelem *old = collcommon_numkey(cc, numkey), *new; + if (old && replace) + collcommon_replace(cc, new = old, ac, av, &numkey, 0); + else + { + new = collelem_new(ac, av, &numkey, 0); + if (old) + { + collcommon_putbefore(cc, new, old); + do + if (old->e_hasnumkey) + /* CHECKED incremented up to the last one; incompatible: + elements with numkey == 0 not incremented (a bug?) */ + old->e_numkey++; + while (old = old->e_next); + } + else + { + /* CHECKED negative numkey always put before the last element, + zero numkey always becomes the new head */ + int closestkey = 0; + t_collelem *closest = 0, *ep; + for (ep = cc->c_first; ep; ep = ep->e_next) + { + if (ep->e_hasnumkey) + { + if (numkey >= closestkey && numkey <= ep->e_numkey) + { + collcommon_putbefore(cc, new, ep); + break; + } + closestkey = ep->e_numkey; + } + closest = ep; + } + if (!ep) + { + if (numkey <= closestkey) + collcommon_putbefore(cc, new, closest); + else + collcommon_putafter(cc, new, closest); + } + } + } + return (new); +} + +static t_collelem *collcommon_tosymkey(t_collcommon *cc, t_symbol *symkey, + int ac, t_atom *av, int replace) +{ + t_collelem *old = collcommon_symkey(cc, symkey), *new; + if (old && replace) + collcommon_replace(cc, new = old, ac, av, 0, symkey); + else + collcommon_putafter(cc, new = collelem_new(ac, av, 0, symkey), + cc->c_last); + return (new); +} + +static int collcommon_fromatoms(t_collcommon *cc, int ac, t_atom *av) +{ + int hasnumkey = 0, numkey; + t_symbol *symkey = 0; + int size = 0; + t_atom *data = 0; + int nlines = 0; + cc->c_increation = 1; + collcommon_clearall(cc); + while (ac--) + { + if (data) + { + if (av->a_type == A_SEMI) + { + t_collelem *ep = collelem_new(size, data, + hasnumkey ? &numkey : 0, symkey); + collcommon_putafter(cc, ep, cc->c_last); + hasnumkey = 0; + symkey = 0; + data = 0; + nlines++; + } + if (av->a_type == A_COMMA) + { + /* CHECKED rejecting a comma */ + collcommon_clearall(cc); /* LATER rethink */ + cc->c_increation = 0; + return (-nlines); + } + else size++; + } + else if (av->a_type == A_COMMA) + { + size = 0; + data = av + 1; + } + else if (av->a_type == A_SYMBOL) + symkey = av->a_w.w_symbol; + else if (av->a_type == A_FLOAT && + loud_checkint(0, av->a_w.w_float, &numkey, 0)) + hasnumkey = 1; + else + { + loud_error(0, "coll: bad atom"); + collcommon_clearall(cc); /* LATER rethink */ + cc->c_increation = 0; + return (-nlines); + } + av++; + } + if (data) + { + loud_error(0, "coll: incomplete"); + collcommon_clearall(cc); /* LATER rethink */ + cc->c_increation = 0; + return (-nlines); + } + cc->c_increation = 0; + return (nlines); +} + +static int collcommon_frombinbuf(t_collcommon *cc, t_binbuf *bb) +{ + return (collcommon_fromatoms(cc, binbuf_getnatom(bb), binbuf_getvec(bb))); +} + +static t_msg *collcommon_doread(t_collcommon *cc, t_symbol *fn, t_canvas *cv, int threaded) +{ + t_binbuf *bb; + t_msg *m = (t_msg *)(getbytes(sizeof(*m))); + m->m_flag = 0; + m->m_line = 0; + char buf[MAXPDSTRING]; + + if (!fn && !(fn = cc->c_filename)) /* !fn: 'readagain' */ + return(m); + + /* FIXME use open_via_path() */ + if (cv || (cv = cc->c_lastcanvas)) /* !cv: 'read' w/o arg, 'readagain' */ + canvas_makefilename(cv, fn->s_name, buf, MAXPDSTRING); + else + { + strncpy(buf, fn->s_name, MAXPDSTRING); + buf[MAXPDSTRING-1] = 0; + } + + if (!cc->c_refs) + { + /* loading during object creation -- + avoid binbuf_read()'s complaints, LATER rethink */ + FILE *fp; + char fname[MAXPDSTRING]; + sys_bashfilename(buf, fname); + if (!(fp = fopen(fname, "r"))) + { + m->m_flag |= 0x01; + if (!threaded) + loud_warning(&coll_class, 0, "no coll file '%s'", fname); + return(m); + } + fclose(fp); + } + + bb = binbuf_new(); + if (binbuf_read(bb, buf, "", 0)) + { + m->m_flag |= 0x02; + if (!threaded) + loud_error(0, "coll: error reading text file '%s'", fn->s_name); + } + else if (!binbuf_read(bb, buf, "", 0)) + { + int nlines = collcommon_frombinbuf(cc, bb); + if (nlines > 0) + { + t_coll *x; + /* LATER consider making this more robust */ + for (x = cc->c_refs; x; x = x->x_next) + //outlet_bang(x->x_filebangout); + cc->c_lastcanvas = cv; + cc->c_filename = fn; + m->m_flag |= 0x04; + m->m_line = nlines; + if (!threaded) + post("coll: finished reading %d lines from text file '%s'", + nlines, fn->s_name); + } + else if (nlines < 0) { + m->m_flag |= 0x08; + m->m_line = 1 - nlines; + if (!threaded) + loud_error(0, "coll: error in line %d of text file '%s'", + 1 - nlines, fn->s_name); + } + else { + m->m_flag |= 0x16; + if (!threaded) + loud_error(0, "coll: error reading text file '%s'", fn->s_name); + } + if (cc->c_refs) + collcommon_modified(cc, 1); + } + binbuf_free(bb); + return(m); +} + +static void collcommon_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + collcommon_doread((t_collcommon *)z, fn, 0, 0); +} + +static void collcommon_tobinbuf(t_collcommon *cc, t_binbuf *bb) +{ + t_collelem *ep; + t_atom at[3]; + for (ep = cc->c_first; ep; ep = ep->e_next) + { + t_atom *ap = at; + int cnt = 1; + if (ep->e_hasnumkey) + { + SETFLOAT(ap, ep->e_numkey); + ap++; cnt++; + } + if (ep->e_symkey) + { + SETSYMBOL(ap, ep->e_symkey); + ap++; cnt++; + } + SETCOMMA(ap); + binbuf_add(bb, cnt, at); + binbuf_add(bb, ep->e_size, ep->e_data); + binbuf_addsemi(bb); + } +} + +static t_msg *collcommon_dowrite(t_collcommon *cc, t_symbol *fn, t_canvas *cv, int threaded) +{ + t_binbuf *bb; + int ac; + t_atom *av; + t_msg *m = (t_msg *)(getbytes(sizeof(*m))); + m->m_flag = 0; + m->m_line = 0; + char buf[MAXPDSTRING]; + if (!fn && !(fn = cc->c_filename)) /* !fn: 'writeagain' */ + return(0); + if (cv || (cv = cc->c_lastcanvas)) /* !cv: 'write' w/o arg, 'writeagain' */ + canvas_makefilename(cv, fn->s_name, buf, MAXPDSTRING); + else + { + strncpy(buf, fn->s_name, MAXPDSTRING); + buf[MAXPDSTRING-1] = 0; + } + bb = binbuf_new(); + collcommon_tobinbuf(cc, bb); + if (binbuf_write(bb, buf, "", 0)) { + m->m_flag |= 0x32; + if (!threaded) + loud_error(0, "coll: error writing text file '%s'", fn->s_name); + } + else + if (!binbuf_write(bb, buf, "", 0)) + { + cc->c_lastcanvas = cv; + cc->c_filename = fn; + } + binbuf_free(bb); + return(m); +} + +static void collcommon_writehook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + collcommon_dowrite((t_collcommon *)z, fn, 0, 0); +} + +static void coll_embedhook(t_pd *z, t_binbuf *bb, t_symbol *bindsym) +{ + t_coll *x = (t_coll *)z; + t_collcommon *cc = x->x_common; + if (cc->c_embedflag) + { + t_collelem *ep; + t_atom at[6]; + binbuf_addv(bb, "ssii;", bindsym, gensym("flags"), 1, 0); + SETSYMBOL(at, bindsym); + for (ep = cc->c_first; ep; ep = ep->e_next) + { + t_atom *ap = at + 1; + int cnt; + if (ep->e_hasnumkey && ep->e_symkey) + { + SETSYMBOL(ap, gensym("nstore")); + ap++; + SETSYMBOL(ap, ep->e_symkey); + ap++; + SETFLOAT(ap, ep->e_numkey); + cnt = 4; + } + else if (ep->e_symkey) + { + SETSYMBOL(ap, gensym("store")); + ap++; + SETSYMBOL(ap, ep->e_symkey); + cnt = 3; + } + else + { + SETFLOAT(ap, ep->e_numkey); + cnt = 2; + } + binbuf_add(bb, cnt, at); + binbuf_add(bb, ep->e_size, ep->e_data); + binbuf_addsemi(bb); + } + } +} + +static void collcommon_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av) +{ + int nlines = collcommon_fromatoms((t_collcommon *)z, ac, av); + if (nlines < 0) + loud_error(0, "coll: editing error in line %d", 1 - nlines); +} + +static void collcommon_free(t_collcommon *cc) +{ + t_collelem *ep1, *ep2 = cc->c_first; + while (ep1 = ep2) + { + ep2 = ep1->e_next; + collelem_free(ep1); + } +} + +static void *collcommon_new(void) +{ + t_collcommon *cc = (t_collcommon *)pd_new(collcommon_class); + cc->c_embedflag = 0; + cc->c_first = cc->c_last = 0; + cc->c_head = 0; + cc->c_headstate = COLL_HEADRESET; + return (cc); +} + +static t_collcommon *coll_checkcommon(t_coll *x) +{ + if (x->x_name && + x->x_common != (t_collcommon *)pd_findbyclass(x->x_name, + collcommon_class)) + { + loudbug_bug("coll_checkcommon"); + return (0); + } + return (x->x_common); +} + +static void coll_unbind(t_coll *x) +{ + /* LATER consider calling coll_checkcommon(x) */ + t_collcommon *cc = x->x_common; + t_coll *prev, *next; + if ((prev = cc->c_refs) == x) + { + if (!(cc->c_refs = x->x_next)) + { + hammerfile_free(cc->c_filehandle); + collcommon_free(cc); + if (x->x_name) pd_unbind(&cc->c_pd, x->x_name); + pd_free(&cc->c_pd); + } + } + else if (prev) + { + while (next = prev->x_next) + { + if (next == x) + { + prev->x_next = next->x_next; + break; + } + prev = next; + } + } + x->x_common = 0; + x->x_name = 0; + x->x_next = 0; +} + +static void coll_bind(t_coll *x, t_symbol *name) +{ + t_collcommon *cc = 0; + if (name == &s_) + name = 0; + else if (name) + cc = (t_collcommon *)pd_findbyclass(name, collcommon_class); + if (!cc) + { + cc = (t_collcommon *)collcommon_new(); + cc->c_refs = 0; + cc->c_increation = 0; + //x->x_common = cc; + //x->x_s = name; + if (name) + { + pd_bind(&cc->c_pd, name); + /* LATER rethink canvas unpredictability */ + //x->unsafe = 1; + //pthread_mutex_lock(&x->unsafe_mutex); + //pthread_cond_signal(&x->unsafe_cond); + //pthread_mutex_unlock(&x->unsafe_mutex); + collcommon_doread(cc, name, x->x_canvas, 0); + } + else + { + cc->c_filename = 0; + cc->c_lastcanvas = 0; + } + cc->c_filehandle = hammerfile_new((t_pd *)cc, 0, collcommon_readhook, + collcommon_writehook, + collcommon_editorhook); + } + x->x_common = cc; + x->x_name = name; + x->x_next = cc->c_refs; + cc->c_refs = x; +} + +static int coll_rebind(t_coll *x, t_symbol *name) +{ + t_collcommon *cc; + if (name && name != &s_ && + (cc = (t_collcommon *)pd_findbyclass(name, collcommon_class))) + { + coll_unbind(x); + x->x_common = cc; + x->x_name = name; + x->x_next = cc->c_refs; + cc->c_refs = x; + return (1); + } + else return (0); +} + +static void coll_dooutput(t_coll *x, int ac, t_atom *av) +{ + if (ac > 1) + { + if (av->a_type == A_FLOAT) + outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, av); + else if (av->a_type == A_SYMBOL) + outlet_anything(((t_object *)x)->ob_outlet, + av->a_w.w_symbol, ac-1, av+1); + } + else if (ac) + { + if (av->a_type == A_FLOAT) + outlet_float(((t_object *)x)->ob_outlet, av->a_w.w_float); + else if (av->a_type == A_SYMBOL) + outlet_symbol(((t_object *)x)->ob_outlet, av->a_w.w_symbol); + } +} + +static void coll_keyoutput(t_coll *x, t_collelem *ep) +{ + t_collcommon *cc = x->x_common; + if (!cc->c_entered++) cc->c_selfmodified = 0; + cc->c_volatile = 0; + if (ep->e_hasnumkey) + outlet_float(x->x_keyout, ep->e_numkey); + else if (ep->e_symkey) + outlet_symbol(x->x_keyout, ep->e_symkey); + else + outlet_float(x->x_keyout, 0); + if (cc->c_volatile) cc->c_selfmodified = 1; + cc->c_entered--; +} + +static t_collelem *coll_findkey(t_coll *x, t_atom *key, t_symbol *mess) +{ + t_collcommon *cc = x->x_common; + t_collelem *ep = 0; + if (key->a_type == A_FLOAT) + { + int numkey; + if (loud_checkint((t_pd *)x, key->a_w.w_float, &numkey, mess)) + ep = collcommon_numkey(cc, numkey); + else + mess = 0; + } + else if (key->a_type == A_SYMBOL) + ep = collcommon_symkey(cc, key->a_w.w_symbol); + else if (mess) + { + loud_messarg((t_pd *)x, mess); + mess = 0; + } + if (!ep && mess) + loud_error((t_pd *)x, "no such key"); + return (ep); +} + +static t_collelem *coll_tokey(t_coll *x, t_atom *key, int ac, t_atom *av, + int replace, t_symbol *mess) +{ + t_collcommon *cc = x->x_common; + t_collelem *ep = 0; + if (key->a_type == A_FLOAT) + { + int numkey; + if (loud_checkint((t_pd *)x, key->a_w.w_float, &numkey, mess)) + ep = collcommon_tonumkey(cc, numkey, ac, av, replace); + } + else if (key->a_type == A_SYMBOL) + ep = collcommon_tosymkey(cc, key->a_w.w_symbol, ac, av, replace); + else if (mess) + loud_messarg((t_pd *)x, mess); + return (ep); +} + +static t_collelem *coll_firsttyped(t_coll *x, int ndx, t_atomtype type) +{ + t_collcommon *cc = x->x_common; + t_collelem *ep; + for (ep = cc->c_first; ep; ep = ep->e_next) + if (ep->e_size > ndx && ep->e_data[ndx].a_type == type) + return (ep); + return (0); +} + +/* the methods */ + +static void coll_float(t_coll *x, t_float f) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + t_collelem *ep; + int numkey; + if (loud_checkint((t_pd *)x, f, &numkey, &s_float) && + (ep = collcommon_numkey(cc, numkey))) + { + coll_keyoutput(x, ep); + if (!cc->c_selfmodified || (ep = collcommon_numkey(cc, numkey))) + coll_dooutput(x, ep->e_size, ep->e_data); + } + //} +} + +static void coll_symbol(t_coll *x, t_symbol *s) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + t_collelem *ep; + if (ep = collcommon_symkey(cc, s)) + { + coll_keyoutput(x, ep); + if (!cc->c_selfmodified || (ep = collcommon_symkey(cc, s))) + coll_dooutput(x, ep->e_size, ep->e_data); + } + //} +} + +static void coll_list(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac >= 2 && av->a_type == A_FLOAT) + coll_tokey(x, av, ac-1, av+1, 1, &s_list); + else + loud_messarg((t_pd *)x, &s_list); + //} +} + +static void coll_anything(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) + coll_symbol(x, s); +} + +static void coll_store(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac >= 2) + coll_tokey(x, av, ac-1, av+1, 1, s); + else + loud_messarg((t_pd *)x, s); + //} +} + +static void coll_nstore(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac >= 3) + { + t_collcommon *cc = x->x_common; + t_collelem *ep; + int numkey; + if (av->a_type == A_FLOAT && av[1].a_type == A_SYMBOL) + { + if (loud_checkint((t_pd *)x, av->a_w.w_float, &numkey, s)) + { + if (ep = collcommon_symkey(cc, av[1].a_w.w_symbol)) + collcommon_remove(cc, ep); + ep = collcommon_tonumkey(cc, numkey, ac-2, av+2, 1); + ep->e_symkey = av[1].a_w.w_symbol; + } + } + else if (av->a_type == A_SYMBOL && av[1].a_type == A_FLOAT) + { + if (loud_checkint((t_pd *)x, av[1].a_w.w_float, &numkey, s)) + { + if (ep = collcommon_numkey(cc, numkey)) + collcommon_remove(cc, ep); + ep = collcommon_tosymkey(cc, av->a_w.w_symbol, ac-2, av+2, 1); + ep->e_hasnumkey = 1; + ep->e_numkey = numkey; + } + } + else loud_messarg((t_pd *)x, s); + } + else loud_messarg((t_pd *)x, s); + //} +} + +static void coll_insert(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac >= 2 && av->a_type == A_FLOAT) + coll_tokey(x, av, ac-1, av+1, 0, s); + else + loud_messarg((t_pd *)x, s); + //} +} + +static void coll_remove(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac) + { + t_collelem *ep; + if (ep = coll_findkey(x, av, s)) + collcommon_remove(x->x_common, ep); + } + else loud_messarg((t_pd *)x, s); + //} +} + +static void coll_delete(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac) + { + t_collelem *ep; + if (ep = coll_findkey(x, av, s)) + { + if (av->a_type == A_FLOAT) + { + int numkey = ep->e_numkey; + t_collelem *next; + for (next = ep->e_next; next; next = next->e_next) + if (next->e_hasnumkey && next->e_numkey > numkey) + next->e_numkey--; + } + collcommon_remove(x->x_common, ep); + } + } + else loud_messarg((t_pd *)x, s); + //} +} + +static void coll_assoc(t_coll *x, t_symbol *s, t_floatarg f) +{ + //if (!x->busy) { + int numkey; + if (loud_checkint((t_pd *)x, f, &numkey, gensym("assoc"))) + { + t_collcommon *cc = x->x_common; + t_collelem *ep1, *ep2; + if ((ep1 = collcommon_numkey(cc, numkey)) && + ep1->e_symkey != s) /* LATER rethink */ + { + if (ep2 = collcommon_symkey(cc, s)) + collcommon_remove(cc, ep2); + collcommon_changesymkey(cc, ep1, s); + } + } + //} +} + +static void coll_deassoc(t_coll *x, t_symbol *s, t_floatarg f) +{ + //if (!x->busy) { + int numkey; + if (loud_checkint((t_pd *)x, f, &numkey, gensym("deassoc"))) + { + t_collcommon *cc = x->x_common; + t_collelem *ep; + if (ep = collcommon_numkey(cc, numkey)) + collcommon_changesymkey(cc, ep, 0); + } + //} +} + +static void coll_subsym(t_coll *x, t_symbol *s1, t_symbol *s2) +{ + //if (!x->busy) { + t_collelem *ep; + if (s1 != s2 && (ep = collcommon_symkey(x->x_common, s2))) + collcommon_changesymkey(x->x_common, ep, s1); + //} +} + +static void coll_renumber(t_coll *x, t_floatarg f) +{ + //if (!x->busy) { + int startkey; + if (loud_checkint((t_pd *)x, f, &startkey, gensym("renumber"))) + collcommon_renumber(x->x_common, startkey); + //} +} + +static void coll_merge(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac >= 2) + { + t_collcommon *cc = x->x_common; + t_collelem *ep; + if (av->a_type == A_FLOAT) + { + int numkey; + if (loud_checkint((t_pd *)x, av->a_w.w_float, &numkey, s)) + { + if (ep = collcommon_numkey(cc, numkey)) + collcommon_adddata(cc, ep, ac-1, av+1); + else /* LATER consider defining collcommon_toclosest() */ + collcommon_tonumkey(cc, numkey, ac-1, av+1, 1); + } + } + else if (av->a_type == A_SYMBOL) + { + if (ep = collcommon_symkey(cc, av->a_w.w_symbol)) + collcommon_adddata(cc, ep, ac-1, av+1); + else + { + ep = collelem_new(ac-1, av+1, 0, av->a_w.w_symbol); + collcommon_putafter(cc, ep, cc->c_last); + } + } + else loud_messarg((t_pd *)x, s); + } + else loud_messarg((t_pd *)x, s); + //} +} + +static void coll_sub(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac) + { + t_collelem *ep; + if (ep = coll_findkey(x, av, s)) + { + t_collcommon *cc = x->x_common; + t_atom *key = av++; + ac--; + while (ac >= 2) + { + if (av->a_type == A_FLOAT) + { + int ndx; + if (loud_checkint((t_pd *)x, av->a_w.w_float, &ndx, 0) + && ndx >= 1 && ndx <= ep->e_size) + ep->e_data[ndx-1] = av[1]; + } + ac -= 2; + av += 2; + } + if (s == gensym("sub")) + { + coll_keyoutput(x, ep); + if (!cc->c_selfmodified || (ep = coll_findkey(x, key, 0))) + coll_dooutput(x, ep->e_size, ep->e_data); + } + } + } + else loud_messarg((t_pd *)x, s); + //} +} + +static void coll_sort(t_coll *x, t_floatarg f1, t_floatarg f2) +{ + + int dir, ndx; + if (loud_checkint((t_pd *)x, f1, &dir, gensym("sort")) && + loud_checkint((t_pd *)x, f2, &ndx, gensym("sort"))) + collcommon_sort(x->x_common, (dir < 0 ? 0 : 1), + (ndx < 0 ? -1 : (ndx ? ndx - 1 : 0))); +} + +static void coll_clear(t_coll *x) +{ + collcommon_clearall(x->x_common); +} + +/* According to the refman, the data should be swapped, rather than the keys + -- easy here, but apparently c74 people have chosen to avoid some effort + needed in case of their implementation... */ +static void coll_swap(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac == 2) + { + t_collelem *ep1, *ep2; + if ((ep1 = coll_findkey(x, av, s)) && + (ep2 = coll_findkey(x, av + 1, s))) + collcommon_swapkeys(x->x_common, ep1, ep2); + } + else loud_messarg((t_pd *)x, s); + //} +} + +/* CHECKED traversal direction change is consistent with the general rule: + 'next' always outputs e_next of a previous output, and 'prev' always + outputs e_prev, whether preceded by 'prev', or by 'next'. This is + currently implemented by pre-updating of the head (which is inhibited + if there was no previous output, i.e. after 'goto', 'end', or collection + initialization). CHECKME again. */ + +static void coll_next(t_coll *x) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + if (cc->c_headstate != COLL_HEADRESET && + cc->c_headstate != COLL_HEADDELETED) /* asymmetric, LATER rethink */ + { + if (cc->c_head) + cc->c_head = cc->c_head->e_next; + if (!cc->c_head && !(cc->c_head = cc->c_first)) /* CHECKED wrapping */ + return; + } + else if (!cc->c_head && !(cc->c_head = cc->c_first)) + return; + cc->c_headstate = COLL_HEADNEXT; + coll_keyoutput(x, cc->c_head); + if (cc->c_head) + coll_dooutput(x, cc->c_head->e_size, cc->c_head->e_data); + else if (!cc->c_selfmodified) + loudbug_bug("coll_next"); /* LATER rethink */ + //} +} + +static void coll_prev(t_coll *x) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + if (cc->c_headstate != COLL_HEADRESET) + { + if (cc->c_head) + cc->c_head = cc->c_head->e_prev; + if (!cc->c_head && !(cc->c_head = cc->c_last)) /* CHECKED wrapping */ + return; + } + else if (!cc->c_head && !(cc->c_head = cc->c_first)) + return; + cc->c_headstate = COLL_HEADPREV; + coll_keyoutput(x, cc->c_head); + if (cc->c_head) + coll_dooutput(x, cc->c_head->e_size, cc->c_head->e_data); + else if (!cc->c_selfmodified) + loudbug_bug("coll_prev"); /* LATER rethink */ + //} +} + +static void coll_start(t_coll *x) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + cc->c_head = cc->c_first; + cc->c_headstate = COLL_HEADRESET; + //} +} + +static void coll_end(t_coll *x) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + cc->c_head = cc->c_last; + cc->c_headstate = COLL_HEADRESET; + //} +} + +static void coll_goto(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac) + { + t_collelem *ep = coll_findkey(x, av, s); + if (ep) + { + t_collcommon *cc = x->x_common; + cc->c_head = ep; + cc->c_headstate = COLL_HEADRESET; + } + } + //else loud_messarg((t_pd *)x, s); + else coll_start(x); + //} +} + +static void coll_nth(t_coll *x, t_symbol *s, int ac, t_atom *av) +{ + //if (!x->busy) { + if (ac >= 2 && av[1].a_type == A_FLOAT) + { + int ndx; + t_collelem *ep; + if (loud_checkint((t_pd *)x, av[1].a_w.w_float, &ndx, s) && + (ep = coll_findkey(x, av, s)) && + ep->e_size >= ndx) + { + t_atom *ap = ep->e_data + --ndx; + if (ap->a_type == A_FLOAT) + outlet_float(((t_object *)x)->ob_outlet, ap->a_w.w_float); + else if (ap->a_type == A_SYMBOL) + outlet_symbol(((t_object *)x)->ob_outlet, ap->a_w.w_symbol); + } + } + else loud_messarg((t_pd *)x, s); + //} +} + +static void coll_length(t_coll *x) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + t_collelem *ep = cc->c_first; + int result = 0; + while (ep) result++, ep = ep->e_next; + outlet_float(((t_object *)x)->ob_outlet, result); + //} +} + +static void coll_min(t_coll *x, t_floatarg f) +{ + //if (!x->busy) { + int ndx; + if (loud_checkint((t_pd *)x, f, &ndx, gensym("min"))) + { + t_collelem *found; + if (ndx > 0) + ndx--; + /* LATER consider complaining: */ + else if (ndx < 0) + return; /* CHECKED silently rejected */ + /* else CHECKED silently defaults to 1 */ + if (found = coll_firsttyped(x, ndx, A_FLOAT)) + { + t_float result = found->e_data[ndx].a_w.w_float; + t_collelem *ep; + for (ep = found->e_next; ep; ep = ep->e_next) + { + if (ep->e_size > ndx && + ep->e_data[ndx].a_type == A_FLOAT && + ep->e_data[ndx].a_w.w_float < result) + { + found = ep; + result = ep->e_data[ndx].a_w.w_float; + } + } + coll_keyoutput(x, found); + outlet_float(((t_object *)x)->ob_outlet, result); + } + } + //} +} + +static void coll_max(t_coll *x, t_floatarg f) +{ + //if (!x->busy) { + int ndx; + if (loud_checkint((t_pd *)x, f, &ndx, gensym("max"))) + { + t_collelem *found; + if (ndx > 0) + ndx--; + /* LATER consider complaining: */ + else if (ndx < 0) + return; /* CHECKED silently rejected */ + /* else CHECKED silently defaults to 1 */ + if (found = coll_firsttyped(x, ndx, A_FLOAT)) + { + t_float result = found->e_data[ndx].a_w.w_float; + t_collelem *ep; + for (ep = found->e_next; ep; ep = ep->e_next) + { + if (ep->e_size > ndx && + ep->e_data[ndx].a_type == A_FLOAT && + ep->e_data[ndx].a_w.w_float > result) + { + found = ep; + result = ep->e_data[ndx].a_w.w_float; + } + } + coll_keyoutput(x, found); + outlet_float(((t_object *)x)->ob_outlet, result); + } + } + //} +} + +static void coll_refer(t_coll *x, t_symbol *s) +{ + //if (!x->busy) { + if (!coll_rebind(x, s)) + { + /* LATER consider complaining */ + } + //} +} + +static void coll_flags(t_coll *x, t_float f1, t_float f2) +{ + //if (!x->busy) { + int i1; + if (loud_checkint((t_pd *)x, f1, &i1, gensym("flags"))) + { + t_collcommon *cc = x->x_common; + cc->c_embedflag = (i1 != 0); + } + //} +} + +static void coll_read(t_coll *x, t_symbol *s) +{ + if (!x->unsafe) { + t_collcommon *cc = x->x_common; + if (s && s != &s_) { + x->x_s = s; + if (x->threaded == 1) { + x->unsafe = 1; + + pthread_mutex_lock(&x->unsafe_mutex); + pthread_cond_signal(&x->unsafe_cond); + pthread_mutex_unlock(&x->unsafe_mutex); + //collcommon_doread(cc, s, x->x_canvas, 0); + } + else { + collcommon_doread(cc, s, x->x_canvas, 0); + } + } + else + hammerpanel_open(cc->c_filehandle, 0); + } +} + +static void coll_write(t_coll *x, t_symbol *s) +{ + if (!x->unsafe) { + t_collcommon *cc = x->x_common; + if (s && s != &s_) { + x->x_s = s; + if (x->threaded == 1) { + x->unsafe = 10; + + pthread_mutex_lock(&x->unsafe_mutex); + pthread_cond_signal(&x->unsafe_cond); + pthread_mutex_unlock(&x->unsafe_mutex); + //collcommon_dowrite(cc, s, x->x_canvas, 0); + } + else { + collcommon_dowrite(cc, s, x->x_canvas, 0); + } + } + else + hammerpanel_save(cc->c_filehandle, 0, 0); /* CHECKED no default name */ + } +} + +static void coll_readagain(t_coll *x) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + if (cc->c_filename) { + if (x->threaded == 1) { + x->unsafe = 2; + + pthread_mutex_lock(&x->unsafe_mutex); + pthread_cond_signal(&x->unsafe_cond); + pthread_mutex_unlock(&x->unsafe_mutex); + //collcommon_doread(cc, 0, 0, 0); + } + else { + collcommon_doread(cc, 0, 0, 0); + } + } + else + hammerpanel_open(cc->c_filehandle, 0); + //} +} + +static void coll_writeagain(t_coll *x) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + if (cc->c_filename) { + if (x->threaded == 1) { + x->unsafe = 11; + + pthread_mutex_lock(&x->unsafe_mutex); + pthread_cond_signal(&x->unsafe_cond); + pthread_mutex_unlock(&x->unsafe_mutex); + //collcommon_dowrite(cc, 0, 0, 0); + } + else { + collcommon_dowrite(cc, 0, 0, 0); + } + } + else + hammerpanel_save(cc->c_filehandle, 0, 0); /* CHECKED no default name */ + //} +} + +static void coll_filetype(t_coll *x, t_symbol *s) +{ + /* dummy */ +} + +static void coll_dump(t_coll *x) +{ + //if (!x->busy) { + t_collcommon *cc = x->x_common; + t_collelem *ep; + for (ep = cc->c_first; ep; ep = ep->e_next) + { + coll_keyoutput(x, ep); + if (cc->c_selfmodified) + break; + coll_dooutput(x, ep->e_size, ep->e_data); + /* FIXME dooutput() may invalidate ep as well as keyoutput()... */ + } + outlet_bang(x->x_dumpbangout); + //} +} + +static void coll_open(t_coll *x) +{ + t_collcommon *cc = x->x_common; + t_binbuf *bb = binbuf_new(); + int i, natoms, newline; + t_atom *ap; + char buf[MAXPDSTRING]; + hammereditor_open(cc->c_filehandle, + (x->x_name ? x->x_name->s_name : "Untitled"), "coll"); + collcommon_tobinbuf(cc, bb); + natoms = binbuf_getnatom(bb); + ap = binbuf_getvec(bb); + newline = 1; + while (natoms--) + { + char *ptr = buf; + if (ap->a_type != A_SEMI && ap->a_type != A_COMMA && !newline) + *ptr++ = ' '; + atom_string(ap, ptr, MAXPDSTRING); + if (ap->a_type == A_SEMI) + { + strcat(buf, "\n"); + newline = 1; + } + else newline = 0; + hammereditor_append(cc->c_filehandle, buf); + ap++; + } + hammereditor_setdirty(cc->c_filehandle, 0); + binbuf_free(bb); +} + +/* CHECKED if there was any editing, both close window and 'wclose' + ask and replace the contents. LATER debug. */ +static void coll_wclose(t_coll *x) +{ + hammereditor_close(x->x_common->c_filehandle, 1); +} + +static void coll_click(t_coll *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + coll_open(x); +} + +#ifdef COLL_DEBUG +static void collelem_post(t_collelem *ep) +{ + //if (!x->busy) { + if (ep->e_hasnumkey && ep->e_symkey) + loudbug_startpost("%d %s:", ep->e_numkey, ep->e_symkey->s_name); + else if (ep->e_hasnumkey) + loudbug_startpost("%d:", ep->e_numkey); + else if (ep->e_symkey) + loudbug_startpost("%s:", ep->e_symkey->s_name); + else loudbug_bug("collcommon_post"); + loudbug_postatom(ep->e_size, ep->e_data); + loudbug_endpost(); + //} +} + +static void collcommon_post(t_collcommon *cc) +{ + t_collelem *ep; + for (ep = cc->c_first; ep; ep = ep->e_next) collelem_post(ep); +} + +static void coll_debug(t_coll *x, t_floatarg f) +{ + //if (!x->busy) { + t_collcommon *cc = coll_checkcommon(x); + if (cc) + { + t_coll *x1 = cc->c_refs; + t_collelem *ep, *last; + int i = 0; + while (x1) i++, x1 = x1->x_next; + loudbug_post("refcount %d", i); + for (ep = cc->c_first, last = 0; ep; ep = ep->e_next) last = ep; + if (last != cc->c_last) loudbug_bug("coll_debug: last element"); + collcommon_post(cc); + } + //} +} +#endif + +static void *coll_threaded_fileio(void *ptr) +{ + t_threadedFunctionParams *rPars = (t_threadedFunctionParams*)ptr; + t_coll *x = rPars->x; + t_msg *m = NULL; + + while(x->unsafe > -1) { + pthread_mutex_lock(&x->unsafe_mutex); + if (x->unsafe == 0) + if (!x->init) x->init = 1; + pthread_cond_wait(&x->unsafe_cond, &x->unsafe_mutex); + + if (x->unsafe == 1) { //read + m = collcommon_doread(x->x_common, x->x_s, x->x_canvas, 1); + if (m->m_flag) + coll_enqueue_threaded_msgs(x, m); + clock_delay(x->x_clock, 0); + } + else if (x->unsafe == 2) { //read + m = collcommon_doread(x->x_common, 0, 0, 1); + if (m->m_flag) + coll_enqueue_threaded_msgs(x, m); + clock_delay(x->x_clock, 0); + } + else if (x->unsafe == 10) { //write + m = collcommon_dowrite(x->x_common, x->x_s, x->x_canvas, 1); + if (m->m_flag) + coll_enqueue_threaded_msgs(x, m); + } + else if (x->unsafe == 11) { //write + m = collcommon_dowrite(x->x_common, 0, 0, 1); + if (m->m_flag) + coll_enqueue_threaded_msgs(x, m); + } + + if (m != NULL) + { + t_freebytes(m, sizeof(*m)); + m = NULL; + } + + if (x->unsafe != -1) x->unsafe = 0; + pthread_mutex_unlock(&x->unsafe_mutex); + } + pthread_exit(0); +} + +static void coll_separate(t_coll *x, t_floatarg f) +{ + int indx; + t_collcommon *cc = x->x_common; + if (loud_checkint((t_pd *)x, f, &indx, gensym("separate"))) + { + t_collelem *ep; + for (ep = cc->c_first; ep; ep = ep->e_next) + if (ep->e_hasnumkey && ep->e_numkey >= indx) + ep->e_numkey += 1; + collcommon_modified(cc, 0); + } +} + +static void coll_free(t_coll *x) +{ + if (x->threaded == 1) + { + x->unsafe = -1; + + pthread_mutex_lock(&x->unsafe_mutex); + pthread_cond_signal(&x->unsafe_cond); + pthread_mutex_unlock(&x->unsafe_mutex); + + pthread_join(x->unsafe_t, NULL); + pthread_mutex_destroy(&x->unsafe_mutex); + + clock_free(x->x_clock); + if (x->x_q) + coll_q_free(x); + } + + hammerfile_free(x->x_filehandle); + coll_unbind(x); +} + +static void *coll_new(t_symbol *s, int argc, t_atom *argv) +{ + int ret; + int count = 0; + t_symbol *file = NULL; + t_coll *x = (t_coll *)pd_new(coll_class); + x->x_canvas = canvas_getcurrent(); + outlet_new((t_object *)x, &s_); + x->x_keyout = outlet_new((t_object *)x, &s_); + x->x_filebangout = outlet_new((t_object *)x, &s_bang); + x->x_dumpbangout = outlet_new((t_object *)x, &s_bang); + x->x_filehandle = hammerfile_new((t_pd *)x, coll_embedhook, 0, 0, 0); + + // check arguments for filename and threaded version + if (argc > 0) + { + while(count < argc) + { + if (argv[count].a_type == A_SYMBOL) + { + // we got a file name + file = gensym(atom_getsymbol(&argv[count])->s_name); + } + else if (argv[count].a_type == A_FLOAT) + { + // we got a flag for threaded (1) vs non-threaded (0) + x->threaded = (int)atom_getfloat(&argv[count]); + if (x->threaded < 0) x->threaded = 0; + if (x->threaded > 1) x->threaded = 1; + } + count++; + } + } + // if no file name provided, associate with empty symbol + if (file == NULL) + file = &s_; + + // prep threading stuff + x->unsafe = 0; + x->init = 0; + if (x->threaded == 1) + { + x->x_clock = clock_new(x, (t_method)coll_tick); + t_threadedFunctionParams rPars; + rPars.x = x; + pthread_mutex_init(&x->unsafe_mutex, NULL); + pthread_cond_init(&x->unsafe_cond, NULL); + ret = pthread_create( &x->unsafe_t, NULL, (void *) &coll_threaded_fileio, (void *) &rPars); + + while (!x->init) { + sched_yield(); + } + } + + coll_bind(x, file); + + return (x); +} + +void coll_setup(void) +{ + coll_class = class_new(gensym("coll"), + (t_newmethod)coll_new, + (t_method)coll_free, + sizeof(t_coll), 0, A_GIMME, 0); + class_addbang(coll_class, coll_next); + class_addfloat(coll_class, coll_float); + class_addsymbol(coll_class, coll_symbol); + class_addlist(coll_class, coll_list); + class_addanything(coll_class, coll_anything); + class_addmethod(coll_class, (t_method)coll_store, + gensym("store"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_nstore, + gensym("nstore"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_insert, + gensym("insert"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_remove, + gensym("remove"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_delete, + gensym("delete"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_assoc, + gensym("assoc"), A_SYMBOL, A_FLOAT, 0); + class_addmethod(coll_class, (t_method)coll_deassoc, + gensym("deassoc"), A_SYMBOL, A_FLOAT, 0); + class_addmethod(coll_class, (t_method)coll_subsym, + gensym("subsym"), A_SYMBOL, A_SYMBOL, 0); + class_addmethod(coll_class, (t_method)coll_renumber, + gensym("renumber"), A_DEFFLOAT, 0); + class_addmethod(coll_class, (t_method)coll_merge, + gensym("merge"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_sub, + gensym("sub"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_sub, + gensym("nsub"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_clear, + gensym("clear"), 0); + class_addmethod(coll_class, (t_method)coll_sort, + gensym("sort"), A_FLOAT, A_DEFFLOAT, 0); + class_addmethod(coll_class, (t_method)coll_swap, + gensym("swap"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_next, + gensym("next"), 0); + class_addmethod(coll_class, (t_method)coll_prev, + gensym("prev"), 0); + class_addmethod(coll_class, (t_method)coll_end, + gensym("end"), 0); + class_addmethod(coll_class, (t_method)coll_goto, + gensym("goto"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_nth, + gensym("nth"), A_GIMME, 0); + class_addmethod(coll_class, (t_method)coll_length, + gensym("length"), 0); + class_addmethod(coll_class, (t_method)coll_min, + gensym("min"), A_DEFFLOAT, 0); + class_addmethod(coll_class, (t_method)coll_max, + gensym("max"), A_DEFFLOAT, 0); + class_addmethod(coll_class, (t_method)coll_refer, + gensym("refer"), A_SYMBOL, 0); + class_addmethod(coll_class, (t_method)coll_flags, + gensym("flags"), A_FLOAT, A_FLOAT, 0); + class_addmethod(coll_class, (t_method)coll_read, + gensym("read"), A_DEFSYM, 0); + class_addmethod(coll_class, (t_method)coll_start, + gensym("start"), 0); + class_addmethod(coll_class, (t_method)coll_write, + gensym("write"), A_DEFSYM, 0); + class_addmethod(coll_class, (t_method)coll_readagain, + gensym("readagain"), 0); + class_addmethod(coll_class, (t_method)coll_writeagain, + gensym("writeagain"), 0); + class_addmethod(coll_class, (t_method)coll_filetype, + gensym("filetype"), A_SYMBOL, 0); + class_addmethod(coll_class, (t_method)coll_dump, + gensym("dump"), 0); + class_addmethod(coll_class, (t_method)coll_open, + gensym("open"), 0); + class_addmethod(coll_class, (t_method)coll_wclose, + gensym("wclose"), 0); + class_addmethod(coll_class, (t_method)coll_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(coll_class, (t_method)coll_separate, + gensym("separate"), A_FLOAT, 0); +#ifdef COLL_DEBUG + class_addmethod(coll_class, (t_method)coll_debug, + gensym("debug"), A_DEFFLOAT, 0); +#endif + hammerfile_setup(coll_class, 1); + collcommon_class = class_new(gensym("coll"), 0, 0, + sizeof(t_collcommon), CLASS_PD, 0); + /* this call is a nop (collcommon does not embed, and the hammerfile + class itself has been already set up above), but it is better to + have it around, just in case... */ + hammerfile_setup(collcommon_class, 0); + //logpost(NULL, 4, "this is cyclone/coll %s, %dth %s build", + //CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/hammer/comment.c b/externals/miXed/cyclone/hammer/comment.c new file mode 100644 index 000000000..634bc9695 --- /dev/null +++ b/externals/miXed/cyclone/hammer/comment.c @@ -0,0 +1,904 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* FIXME creation lag (X-specific) */ +/* LATER think about pushing text to the text editor (ctrl-t) + -- not easy, because we are not 'textedfor' */ +/* LATER think about making the <Button> binding for the entire bbox, + instead of the text item, to ease the pain of resizing, somewhat. */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <ctype.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "unstable/forky.h" + +/* our proxy of the text_class (not in the API), LATER do not cheat */ +static t_class *makeshift_class; + +#ifdef KRZYSZCZ +//#define COMMENT_DEBUG +#endif + +#define COMMENT_LMARGIN 1 +#define COMMENT_RMARGIN 1 +#define COMMENT_TMARGIN 2 +#define COMMENT_BMARGIN 2 +#define COMMENT_MINWIDTH 8 +#define COMMENT_HANDLEWIDTH 8 +#define COMMENT_OUTBUFSIZE 1000 + +extern void canvas_setcursor(t_canvas *x, unsigned int cursornum); + +typedef struct _comment +{ + t_object x_ob; + t_glist *x_glist; + t_canvas *x_canvas; /* also an 'isvised' flag */ + t_symbol *x_bindsym; + char x_tag[32]; + char x_texttag[32]; + char x_outlinetag[32]; + t_clock *x_transclock; + t_binbuf *x_binbuf; + char *x_textbuf; + int x_textbufsize; + int x_pixwidth; + int x_bbset; + int x_bbpending; + int x_x1; + int x_y1; + int x_x2; + int x_y2; + int x_newx2; + int x_dragon; + int x_fontsize; /* requested size */ + t_symbol *x_fontfamily; /* requested family */ + int x_fontprops; /* LATER pack weight and slant */ + t_symbol *x_encoding; /* requested encoding */ + unsigned char x_red; + unsigned char x_green; + unsigned char x_blue; + char x_color[8]; + int x_selstart; + int x_selend; + int x_active; + int x_ready; +} t_comment; + +static t_class *comment_class; +static t_class *commentsink_class; + +static t_pd *commentsink = 0; + +static void comment_draw(t_comment *x) +{ + char buf[COMMENT_OUTBUFSIZE], *outbuf, *outp; + int cvid = (t_int)x->x_canvas; + int reqsize = x->x_textbufsize + 250; /* FIXME estimation */ + if (reqsize > COMMENT_OUTBUFSIZE) + { +#ifdef COMMENT_DEBUG + loudbug_post("allocating %d outbuf bytes", reqsize); +#endif + if (!(outbuf = getbytes(reqsize))) + return; + } + else outbuf = buf; + outp = outbuf; + sprintf(outp, "comment_draw %s .x%x.c %s %s %f %f %s %d %s %s {%.*s} %d\n", + x->x_bindsym->s_name, cvid, x->x_texttag, x->x_tag, + (float)(text_xpix((t_text *)x, x->x_glist) + COMMENT_LMARGIN), + (float)(text_ypix((t_text *)x, x->x_glist) + COMMENT_TMARGIN), + x->x_fontfamily->s_name, -x->x_fontsize, + (glist_isselected(x->x_glist, &x->x_glist->gl_gobj) ? + "$select_color" : x->x_color), + (x->x_encoding ? x->x_encoding->s_name : "\"\""), + x->x_textbufsize, x->x_textbuf, x->x_pixwidth); + x->x_bbpending = 1; + sys_gui(outbuf); + if (outbuf != buf) freebytes(outbuf, reqsize); +} + +static void comment_update(t_comment *x) +{ + char buf[COMMENT_OUTBUFSIZE], *outbuf, *outp; + int cvid = (t_int)x->x_canvas; + int reqsize = x->x_textbufsize + 250; /* FIXME estimation */ + if (reqsize > COMMENT_OUTBUFSIZE) + { +#ifdef COMMENT_DEBUG + loudbug_post("allocating %d outbuf bytes", reqsize); +#endif + if (!(outbuf = getbytes(reqsize))) + return; + } + else outbuf = buf; + outp = outbuf; + sprintf(outp, "comment_update .x%x.c %s %s {%.*s} %d\n", cvid, + x->x_texttag, (x->x_encoding ? x->x_encoding->s_name : "\"\""), + x->x_textbufsize, x->x_textbuf, x->x_pixwidth); + outp += strlen(outp); + if (x->x_active) + { + if (x->x_selend > x->x_selstart) + { + sprintf(outp, ".x%x.c select from %s %d\n", + cvid, x->x_texttag, x->x_selstart); + outp += strlen(outp); + sprintf(outp, ".x%x.c select to %s %d\n", + cvid, x->x_texttag, x->x_selend); + outp += strlen(outp); + sprintf(outp, ".x%x.c focus {}\n", cvid); + } + else + { + sprintf(outp, ".x%x.c select clear\n", cvid); + outp += strlen(outp); + sprintf(outp, ".x%x.c icursor %s %d\n", + cvid, x->x_texttag, x->x_selstart); + outp += strlen(outp); + sprintf(outp, ".x%x.c focus %s\n", cvid, x->x_texttag); + } + outp += strlen(outp); + } + sprintf(outp, "comment_bbox %s .x%x.c %s\n", + x->x_bindsym->s_name, cvid, x->x_texttag); + x->x_bbpending = 1; + sys_gui(outbuf); + if (outbuf != buf) freebytes(outbuf, reqsize); + sys_vgui("catch {.x%x.c coords %s %d %d %d %d}\n", + cvid, x->x_outlinetag, + x->x_x1, x->x_y1, x->x_newx2, x->x_y2); +} + +static void comment_validate(t_comment *x, t_glist *glist) +{ + if (!x->x_ready) + { + t_text *t = (t_text *)x; + binbuf_free(t->te_binbuf); + t->te_binbuf = x->x_binbuf; + if (x->x_textbuf) freebytes(x->x_textbuf, x->x_textbufsize); + binbuf_gettext(x->x_binbuf, &x->x_textbuf, &x->x_textbufsize); + x->x_ready = 1; +#ifdef COMMENT_DEBUG + loudbug_post("validation done"); +#endif + } + if (glist) + { + if (glist != x->x_glist) + { + loudbug_bug("comment_getcanvas"); + x->x_glist = glist; + } + x->x_canvas = glist_getcanvas(glist); + } +} + +static void comment_grabbedkey(void *z, t_floatarg f) +{ + /* LATER think about replacing #key binding/comment_float() with grabbing */ +#ifdef COMMENT_DEBUG + loudbug_post("comment_grabbedkey %g", f); +#endif +} + +static void comment_dograb(t_comment *x) +{ + /* LATER investigate the grabbing feature. + Here we use it just to prevent backspace from erasing entire text. + This has to be done also when we are already active, because + after being clicked at we have lost our previous grab. */ + glist_grab(x->x_glist, (t_gobj *)x, 0, comment_grabbedkey, 0, 0); +} + +static void comment__bboxhook(t_comment *x, t_symbol *bindsym, + t_floatarg x1, t_floatarg y1, + t_floatarg x2, t_floatarg y2) +{ +#ifdef COMMENT_DEBUG + loudbug_post("bbox %g %g %g %g", x1, y1, x2, y2); +#endif + x->x_x1 = x1; + x->x_y1 = y1; + x->x_x2 = x2; + x->x_y2 = y2; + x->x_bbset = 1; + x->x_bbpending = 0; +} + +static void comment__clickhook(t_comment *x, t_symbol *s, int ac, t_atom *av) +{ + //fprintf(stderr,"clickhook\n"); + int xx, yy, ndx; + if (ac == 8 && av->a_type == A_SYMBOL + && av[1].a_type == A_FLOAT && av[2].a_type == A_FLOAT + && av[3].a_type == A_FLOAT + && av[4].a_type == A_FLOAT && av[5].a_type == A_FLOAT + && av[6].a_type == A_FLOAT && av[7].a_type == A_FLOAT) + { + xx = (int)av[1].a_w.w_float; + yy = (int)av[2].a_w.w_float; + ndx = (int)av[3].a_w.w_float; + comment__bboxhook(x, av->a_w.w_symbol, + av[4].a_w.w_float, av[5].a_w.w_float, + av[6].a_w.w_float, av[7].a_w.w_float); + } + else + { + loudbug_bug("comment__clickhook"); + return; + } + if (x->x_glist->gl_edit) + { + if (x->x_active) + { + if (ndx >= 0 && ndx < x->x_textbufsize) + { + /* set selection, LATER shift-click and drag */ + x->x_selstart = x->x_selend = ndx; + comment_dograb(x); + comment_update(x); + } + } + else if (xx > x->x_x2 - COMMENT_HANDLEWIDTH) + { + /* start resizing */ + fprintf(stderr,"start resizing\n"); + char buf[COMMENT_OUTBUFSIZE], *outp = buf; + int cvid = (t_int)x->x_canvas; + sprintf(outp, ".x%x.c bind %s <ButtonRelease> \ + {pd [concat %s _release %s \\;]}\n", cvid, x->x_texttag, + x->x_bindsym->s_name, x->x_bindsym->s_name); + outp += strlen(outp); + sprintf(outp, ".x%x.c bind %s <Motion> \ + {pd [concat %s _motion %s %%x %%y \\;]}\n", cvid, x->x_texttag, + x->x_bindsym->s_name, x->x_bindsym->s_name); + outp += strlen(outp); + sprintf(outp, ".x%x.c create rectangle %d %d %d %d -outline $select_color \ + -tags {%s %s}\n", + cvid, x->x_x1, x->x_y1, x->x_x2, x->x_y2, + x->x_outlinetag, x->x_tag); + canvas_setcursor(glist_getcanvas(x->x_canvas), CURSOR_EDITMODE_RESIZE); + sys_gui(buf); + x->x_newx2 = x->x_x2; + x->x_dragon = 1; + } + } +} + +static void comment__releasehook(t_comment *x, t_symbol *bindsym) +{ + fprintf(stderr,"releasehook\n"); + int cvid = (t_int)x->x_canvas; + sys_vgui(".x%x.c bind %s <ButtonRelease> {}\n", cvid, x->x_texttag); + sys_vgui(".x%x.c bind %s <Motion> {}\n", cvid, x->x_texttag); + sys_vgui(".x%x.c delete %s\n", cvid, x->x_outlinetag); + x->x_dragon = 0; + if (x->x_newx2 != x->x_x2) + { + x->x_pixwidth = x->x_newx2 - x->x_x1; + x->x_x2 = x->x_newx2; + comment_update(x); + } +} + +static void comment__motionhook(t_comment *x, t_symbol *bindsym, + t_floatarg xx, t_floatarg yy) +{ + fprintf(stderr,"motionhook\n"); + if (x->x_dragon) + { + //if (glist_isselected(x->x_canvas, (t_gobj *)x)) + // glist_deselect(x->x_canvas, (t_gobj *)x); + int cvid = (t_int)x->x_canvas; + if (xx > x->x_x1 + COMMENT_MINWIDTH) + { + x->x_newx2 = xx; + if (x->x_newx2 != x->x_x2) + { + x->x_pixwidth = x->x_newx2 - x->x_x1; + x->x_x2 = x->x_newx2; + comment_update(x); + } + } + } + else + { + if (xx > x->x_x2 - COMMENT_HANDLEWIDTH && xx < x->x_x2 && yy > x->x_y1 && yy < x->x_y2) + canvas_setcursor(glist_getcanvas(x->x_canvas), CURSOR_EDITMODE_RESIZE); + else + canvas_setcursor(glist_getcanvas(x->x_canvas), CURSOR_EDITMODE_NOTHING); + } +} + +static void commentsink__bboxhook(t_pd *x, t_symbol *bindsym, + t_floatarg x1, t_floatarg y1, + t_floatarg x2, t_floatarg y2) +{ + if (bindsym->s_thing == x) /* is the comment gone? */ + { + pd_unbind(x, bindsym); /* if so, no need for this binding anymore */ +#ifdef COMMENT_DEBUG + loudbug_post("sink: %s unbound", bindsym->s_name); +#endif + } +} + +static void commentsink_anything(t_pd *x, t_symbol *s, int ac, t_atom *av) +{ + /* nop */ +} + +static void comment_getrect(t_gobj *z, t_glist *glist, + int *xp1, int *yp1, int *xp2, int *yp2) +{ + t_comment *x = (t_comment *)z; + if (!glist->gl_havewindow) + { + /* LATER revisit gop behaviour. Currently text_shouldvis() returns + true if we are on parent. Here we return a null rectangle, + so that any true ui object is accessible, even if it happens + to be covered by a comment. */ + *xp1 = *yp1 = *xp2 = *yp2 = 0; + return; + } + if (x->x_bbset) + { + /* LATER think about margins */ + *xp1 = x->x_x1; + *yp1 = x->x_y1; + *xp2 = x->x_x2; + *yp2 = x->x_y2; + } + else + { + int width, height; + float x1, y1, x2, y2; + comment_validate(x, glist); + if ((width = x->x_pixwidth) < 1) + /* FIXME estimation */ + width = x->x_fontsize * x->x_textbufsize; + width += COMMENT_LMARGIN + COMMENT_RMARGIN; + /* FIXME estimation */ + height = x->x_fontsize + COMMENT_TMARGIN + COMMENT_BMARGIN; + x1 = text_xpix((t_text *)x, glist); + y1 = text_ypix((t_text *)x, glist) + 1; /* LATER revisit */ + x2 = x1 + width; + y2 = y1 + height - 2; /* LATER revisit */ +#ifdef COMMENT_DEBUG + loudbug_post("estimated rectangle: %g %g %g %g", x1, y1, x2, y2); +#endif + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; + } +} + +static void comment_displace(t_gobj *z, t_glist *glist, int dx, int dy) +{ + t_comment *x = (t_comment *)z; + if (!x->x_active && !x->x_dragon) /* LATER rethink */ + { + t_text *t = (t_text *)z; + comment_validate(x, glist); + t->te_xpix += dx; + t->te_ypix += dy; + if (x->x_bbset) + { + x->x_x1 += dx; + x->x_y1 += dy; + x->x_x2 += dx; + x->x_y2 += dy; + } + if (glist_isvisible(glist)) + sys_vgui(".x%x.c move %s %d %d\n", x->x_canvas, x->x_tag, dx, dy); + } +} + +static void comment_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy) +{ + t_comment *x = (t_comment *)z; + if (!x->x_active && !x->x_dragon) /* LATER rethink */ + { + t_text *t = (t_text *)z; + comment_validate(x, glist); + t->te_xpix += dx; + t->te_ypix += dy; + if (x->x_bbset) + { + x->x_x1 += dx; + x->x_y1 += dy; + x->x_x2 += dx; + x->x_y2 += dy; + } + /*if (glist_isvisible(glist)) + sys_vgui(".x%x.c move %s %d %d\n", x->x_canvas, x->x_tag, dx, dy);*/ + } +} + +static void comment_activate(t_gobj *z, t_glist *glist, int state) +{ + ///fprintf(stderr,"activate\n"); + t_comment *x = (t_comment *)z; + comment_validate(x, glist); + if (state) + { + comment_dograb(x); + if (x->x_active) + return; + sys_vgui(".x%x.c focus %s\n", x->x_canvas, x->x_texttag); + x->x_selstart = 0; + x->x_selend = x->x_textbufsize; + x->x_active = 1; + pd_bind((t_pd *)x, gensym("#key")); + pd_bind((t_pd *)x, gensym("#keyname")); + } + else + { + if (!x->x_active) + return; + pd_unbind((t_pd *)x, gensym("#key")); + pd_unbind((t_pd *)x, gensym("#keyname")); + sys_vgui("selection clear .x%x.c\n", x->x_canvas); + sys_vgui(".x%x.c focus {}\n", x->x_canvas); + x->x_active = 0; + } + comment_update(x); +} + +static void comment_select(t_gobj *z, t_glist *glist, int state) +{ + fprintf(stderr,"select\n"); + t_comment *x = (t_comment *)z; + comment_validate(x, glist); + if (!state && x->x_active) comment_activate(z, glist, 0); + sys_vgui(".x%x.c itemconfigure %s -fill %s\n", x->x_canvas, + x->x_texttag, (state ? "$select_color" : x->x_color)); + if (state && !x->x_dragon) + sys_vgui(".x%lx.c addtag selected withtag %s\n", + glist_getcanvas(glist), x->x_texttag); + else if (!x->x_dragon) + sys_vgui(".x%lx.c dtag %s selected\n", + glist_getcanvas(glist), x->x_texttag); + /* A regular rtext should now set 'canvas_editing' variable to its canvas, + but we do not do that, because we get the keys through a global binding + to "#key" (and because 'canvas_editing' is not exported). */ +} + +static void comment_vis(t_gobj *z, t_glist *glist, int vis) +{ + t_comment *x = (t_comment *)z; + t_text *t = (t_text *)z; + comment_validate(x, glist); + if (vis) + { + /* We do not need no rtext -- we are never 'textedfor' (thus + avoiding rtext calls). Creating an rtext has no other purpose + than complying to a Pd's assumption about every visible object + having an rtext (thus preventing canvas_doclick() from sending + garbage warnings). LATER revisit. */ +#if FORKY_VERSION < 37 + rtext_new(glist, t, glist->gl_editor->e_rtext, 0); +#endif + if (glist->gl_havewindow) + comment_draw(x); + } + else + { +#if FORKY_VERSION < 37 + t_rtext *rt = glist_findrtext(glist, t); + if (rt) rtext_free(rt); +#endif + /* FIXME should we test for having a window? */ +#ifdef COMMENT_DEBUG + loudbug_post("deleting..."); +#endif + sys_vgui(".x%x.c delete %s\n", x->x_canvas, x->x_tag); + } +} + +static void comment_save(t_gobj *z, t_binbuf *b) +{ + t_comment *x = (t_comment *)z; + t_text *t = (t_text *)x; + comment_validate(x, 0); + binbuf_addv(b, "ssiisiissiiii", gensym("#X"), gensym("obj"), + (int)t->te_xpix, (int)t->te_ypix, + gensym("comment"), + x->x_pixwidth, x->x_fontsize, x->x_fontfamily, + (x->x_encoding ? x->x_encoding : gensym("?")), + x->x_fontprops, + (int)x->x_red, (int)x->x_green, (int)x->x_blue); + binbuf_addbinbuf(b, t->te_binbuf); + binbuf_addv(b, ";"); +} + +static t_widgetbehavior comment_widgetbehavior = +{ + comment_getrect, + comment_displace, + comment_select, + comment_activate, + 0, + comment_vis, + 0, + comment_displace_withtag, + //FORKY_WIDGETPADDING +}; + +/* this fires if a transform request was sent to a symbol we are bound to */ +static void comment_transtick(t_comment *x) +{ + glist_delete(x->x_glist, (t_gobj *)x); +} + +/* what follows is basically the original code of rtext_key() */ + +static void comment_float(t_comment *x, t_float f) +{ + if (x->x_active) + { + int keynum = (int)f; + if (keynum) + { + int i, newsize, ndel; + char *s1, *s2; + int n = keynum; + if (n == '\r') n = '\n'; + if (n == '\b') + { + if ((!x->x_selstart) && (x->x_selend == x->x_textbufsize)) + { + /* LATER delete the box... this causes reentrancy + problems now. */ + /* glist_delete(x->x_glist, &x->x_text->te_g); */ + goto donefloat; + } + else if (x->x_selstart && (x->x_selstart == x->x_selend)) + x->x_selstart--; + } + ndel = x->x_selend - x->x_selstart; + for (i = x->x_selend; i < x->x_textbufsize; i++) + x->x_textbuf[i- ndel] = x->x_textbuf[i]; + newsize = x->x_textbufsize - ndel; + x->x_textbuf = resizebytes(x->x_textbuf, x->x_textbufsize, newsize); + x->x_textbufsize = newsize; + + if (n == '\n' || !iscntrl(n)) + { +#ifdef COMMENT_DEBUG + loudbug_post("%d accepted", n); +#endif + newsize = x->x_textbufsize+1; + x->x_textbuf = resizebytes(x->x_textbuf, + x->x_textbufsize, newsize); + for (i = x->x_textbufsize; i > x->x_selstart; i--) + x->x_textbuf[i] = x->x_textbuf[i-1]; + x->x_textbuf[x->x_selstart] = n; + x->x_textbufsize = newsize; + x->x_selstart = x->x_selstart + 1; + } +#ifdef COMMENT_DEBUG + else loudbug_post("%d rejected", n); +#endif + x->x_selend = x->x_selstart; + x->x_glist->gl_editor->e_textdirty = 1; + binbuf_text(x->x_binbuf, x->x_textbuf, x->x_textbufsize); + comment_update(x); + } + } + else loudbug_bug("comment_float"); + donefloat:; +#ifdef COMMENT_DEBUG + loudbug_post("donefloat"); +#endif +} + +static void comment_list(t_comment *x, t_symbol *s, int ac, t_atom *av) +{ + if (!x->x_active) + loudbug_bug("comment_list"); + else if (ac > 1 && av->a_type == A_FLOAT && (int)av->a_w.w_float + && av[1].a_type == A_SYMBOL) + { + t_symbol *keysym = av[1].a_w.w_symbol; + if (!strcmp(keysym->s_name, "Right")) + { + if (x->x_selend == x->x_selstart && + x->x_selstart < x->x_textbufsize) + x->x_selend = x->x_selstart = x->x_selstart + 1; + else + x->x_selstart = x->x_selend; + } + else if (!strcmp(keysym->s_name, "Left")) + { + if (x->x_selend == x->x_selstart && x->x_selstart > 0) + x->x_selend = x->x_selstart = x->x_selstart - 1; + else + x->x_selend = x->x_selstart; + } + /* this should be improved... life's too short */ + else if (!strcmp(keysym->s_name, "Up")) + { + if (x->x_selstart) + x->x_selstart--; + while (x->x_selstart > 0 && x->x_textbuf[x->x_selstart] != '\n') + x->x_selstart--; + x->x_selend = x->x_selstart; + } + else if (!strcmp(keysym->s_name, "Down")) + { + while (x->x_selend < x->x_textbufsize && + x->x_textbuf[x->x_selend] != '\n') + x->x_selend++; + if (x->x_selend < x->x_textbufsize) + x->x_selend++; + x->x_selstart = x->x_selend; + } + /*else if (!strcmp(keysym->s_name, "F5")) + { + t_text *newt, *oldt = (t_text *)x; + t_binbuf *bb = binbuf_new(); + int ac = binbuf_getnatom(x->x_binbuf); + binbuf_addv(bb, "siissiiii", gensym("comment"), x->x_pixwidth, + x->x_fontsize, x->x_fontfamily, + (x->x_encoding ? x->x_encoding : gensym("?")), + x->x_fontprops, + (int)x->x_red, (int)x->x_green, (int)x->x_blue); + binbuf_add(bb, ac, binbuf_getvec(x->x_binbuf)); + canvas_setcurrent(x->x_glist); + newt = (t_text *)pd_new(makeshift_class); + newt->te_width = 0; + newt->te_type = T_OBJECT; + newt->te_binbuf = bb; + newt->te_xpix = oldt->te_xpix; + newt->te_ypix = oldt->te_ypix; + glist_add(x->x_glist, &newt->te_g); + glist_noselect(x->x_glist); + glist_select(x->x_glist, &newt->te_g); + gobj_activate(&newt->te_g, x->x_glist, 1); + x->x_glist->gl_editor->e_textdirty = 1; // force evaluation + canvas_unsetcurrent(x->x_glist); + canvas_dirty(x->x_glist, 1); + clock_delay(x->x_transclock, 0); // LATER rethink + goto donelist; + } + else if (!strcmp(keysym->s_name, "F5")) + { + t_text *t = (t_text *)x; + t_binbuf *bb = binbuf_new(); + int ac = binbuf_getnatom(x->x_binbuf); + binbuf_addv(bb, "ii", (int)t->te_xpix + 5, (int)t->te_ypix + 5); + binbuf_add(bb, ac, binbuf_getvec(x->x_binbuf)); + canvas_setcurrent(x->x_glist); + typedmess((t_pd *)x->x_glist, gensym("text"), + ac + 2, binbuf_getvec(bb)); + canvas_unsetcurrent(x->x_glist); + canvas_dirty(x->x_glist, 1); + binbuf_free(bb); + goto donelist; + }*/ + else goto donelist; + comment_update(x); + } + donelist:; +#ifdef COMMENT_DEBUG + loudbug_post("donelist"); +#endif +} + +static void comment_free(t_comment *x) +{ + if (x->x_active) + { + loudbug_bug("comment_free"); + pd_unbind((t_pd *)x, gensym("#key")); + pd_unbind((t_pd *)x, gensym("#keyname")); + } + if (x->x_transclock) clock_free(x->x_transclock); + if (x->x_bindsym) + { + pd_unbind((t_pd *)x, x->x_bindsym); + if (!x->x_bbpending) + pd_unbind(commentsink, x->x_bindsym); + } + if (x->x_binbuf && !x->x_ready) binbuf_free(x->x_binbuf); + if (x->x_textbuf) freebytes(x->x_textbuf, x->x_textbufsize); +} + +/* the arguments in the full form of a creation message are: + + width fontsize fontfamily encoding fontprops red green blue text... + + For comments typed into an object box, the text part begins with + the first atom satisfying one of the following conditions (skipped + arguments get default values): + + . having a different type than the corresponding argument of the + full form + + . being preceded with a dot atom ('.') put in place of a symbol + argument (fontfamily or encoding) + + . being the 10th atom in a box + + The question mark atom ('?') may be used to supply a default fontfamily + or an empty encoding value. +*/ + +static void *comment_new(t_symbol *s, int ac, t_atom *av) +{ + t_comment *x = (t_comment *)pd_new(comment_class); + t_text *t = (t_text *)x; + t_atom at; + char buf[32]; + t->te_type = T_TEXT; + x->x_glist = canvas_getcurrent(); + x->x_canvas = 0; + sprintf(x->x_tag, "all%lx", (t_int)x); + sprintf(x->x_texttag, "t%lx", (t_int)x); + sprintf(x->x_outlinetag, "h%lx", (t_int)x); + x->x_pixwidth = 0; + x->x_fontsize = 0; + x->x_fontfamily = 0; + x->x_encoding = 0; + x->x_fontprops = 0; + x->x_red = 0; + x->x_green = 0; + x->x_blue = 0; + + if (ac && av->a_type == A_FLOAT) + { + x->x_pixwidth = (int)av->a_w.w_float; + ac--; av++; + if (ac && av->a_type == A_FLOAT) + { + x->x_fontsize = (int)av->a_w.w_float; + ac--; av++; + if (ac && av->a_type == A_SYMBOL) + { + if (av->a_w.w_symbol == gensym(".")) + { + ac--; av++; + goto textpart; + } + else if (av->a_w.w_symbol != gensym("?")) + x->x_fontfamily = av->a_w.w_symbol; + ac--; av++; + if (ac && av->a_type == A_SYMBOL) + { + if (av->a_w.w_symbol == gensym(".")) + { + ac--; av++; + goto textpart; + } + else if (av->a_w.w_symbol != gensym("?")) + x->x_encoding = av->a_w.w_symbol; + ac--; av++; + if (ac && av->a_type == A_FLOAT) + { + x->x_fontprops = (int)av->a_w.w_float; + ac--; av++; + if (ac && av->a_type == A_FLOAT) + { + x->x_red = (unsigned char)av->a_w.w_float; + ac--; av++; + if (ac && av->a_type == A_FLOAT) + { + x->x_green = (unsigned char)av->a_w.w_float; + ac--; av++; + if (ac && av->a_type == A_FLOAT) + { + x->x_blue = (unsigned char)av->a_w.w_float; + ac--; av++; + } + } + } + } + } + } + } + } +textpart: + if (x->x_fontsize < 1) + x->x_fontsize = glist_getfont(x->x_glist); + if (!x->x_fontfamily) + x->x_fontfamily = gensym("{DejaVu Sans Mono}"); + sprintf(x->x_color, "#%2.2x%2.2x%2.2x", x->x_red, x->x_green, x->x_blue); + + x->x_binbuf = binbuf_new(); + if (ac) binbuf_restore(x->x_binbuf, ac, av); + else + { + SETSYMBOL(&at, gensym("comment")); + binbuf_restore(x->x_binbuf, 1, &at); + } + x->x_textbuf = 0; + x->x_textbufsize = 0; + x->x_transclock = clock_new(x, (t_method)comment_transtick); + x->x_bbset = 0; + x->x_bbpending = 0; + sprintf(buf, "miXed%lx", (t_int)x); + x->x_bindsym = gensym(buf); + pd_bind((t_pd *)x, x->x_bindsym); + if (!commentsink) + commentsink = pd_new(commentsink_class); + pd_bind(commentsink, x->x_bindsym); + x->x_ready = 0; + x->x_dragon = 0; + return (x); +} + +void comment_setup(void) +{ + comment_class = class_new(gensym("comment"), + (t_newmethod)comment_new, + (t_method)comment_free, + sizeof(t_comment), + CLASS_NOINLET | CLASS_PATCHABLE, + A_GIMME, 0); + class_addfloat(comment_class, comment_float); + class_addlist(comment_class, comment_list); + class_addmethod(comment_class, (t_method)comment__bboxhook, + gensym("_bbox"), + A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(comment_class, (t_method)comment__clickhook, + gensym("_click"), A_GIMME, 0); + class_addmethod(comment_class, (t_method)comment__releasehook, + gensym("_release"), A_SYMBOL, 0); + class_addmethod(comment_class, (t_method)comment__motionhook, + gensym("_motion"), A_SYMBOL, A_FLOAT, A_FLOAT, 0); + class_setwidget(comment_class, &comment_widgetbehavior); + forky_setsavefn(comment_class, comment_save); + + makeshift_class = class_new(gensym("text"), 0, 0, + sizeof(t_text), + CLASS_NOINLET | CLASS_PATCHABLE, 0); + + commentsink_class = class_new(gensym("_commentsink"), 0, 0, + sizeof(t_pd), CLASS_PD, 0); + class_addanything(commentsink_class, commentsink_anything); + class_addmethod(commentsink_class, (t_method)commentsink__bboxhook, + gensym("_bbox"), + A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + + sys_gui("proc comment_bbox {target cvname tag} {\n\ + pd $target _bbox $target [$cvname bbox $tag]\\;}\n"); + + /* LATER think about window vs canvas coords */ + sys_gui("proc comment_click {target cvname x y tag} {\n\ + pd $target _click $target [$cvname canvasx $x] [$cvname canvasy $y]\ + [$cvname index $tag @$x,$y] [$cvname bbox $tag]\\;}\n"); + + /* LATER think how to conditionally (FORKY_VERSION >= 38) + replace puts with pdtk_post */ + sys_gui("proc comment_entext {enc tt} {\n\ + if {$enc == \"\"} {concat $tt} else {\n\ + set rr [catch {encoding convertfrom $enc $tt} tt1]\n\ + if {$rr == 0} {concat $tt1} else {\n\ + puts stderr [concat tcl/tk error: $tt1]\n\ + concat $tt}}}\n"); + + sys_gui("proc comment_draw {tgt cv tag1 tag2 x y fnm fsz clr enc tt wd} {\n\ + set tt1 [comment_entext $enc $tt]\n\ + if {$wd > 0} {\n\ + $cv create text $x $y -text $tt1 -tags [list $tag1 $tag2] \ + -font [list $fnm $fsz] -fill $clr -width $wd -anchor nw} else {\n\ + $cv create text $x $y -text $tt1 -tags [list $tag1 $tag2] \ + -font [list $fnm $fsz] -fill $clr -anchor nw}\n\ + comment_bbox $tgt $cv $tag1\n\ + $cv bind $tag1 <Button> [list comment_click $tgt %W %x %y $tag1]}\n"); + + sys_gui("proc comment_update {cv tag enc tt wd} {\n\ + set tt1 [comment_entext $enc $tt]\n\ + if {$wd > 0} {$cv itemconfig $tag -text $tt1 -width $wd} else {\n\ + $cv itemconfig $tag -text $tt1}}\n"); +} diff --git a/externals/miXed/cyclone/hammer/cosh.c b/externals/miXed/cyclone/hammer/cosh.c new file mode 100644 index 000000000..97a375e7d --- /dev/null +++ b/externals/miXed/cyclone/hammer/cosh.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define coshf cosh +#endif + +typedef struct _cosh +{ + t_object x_ob; + float x_value; +} t_cosh; + +static t_class *cosh_class; + +static void cosh_bang(t_cosh *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void cosh_float(t_cosh *x, t_float f) +{ + /* CHECKME large values */ + outlet_float(((t_object *)x)->ob_outlet, x->x_value = coshf(f)); +} + +static void *cosh_new(t_floatarg f) +{ + t_cosh *x = (t_cosh *)pd_new(cosh_class); + /* CHECKME large values */ + x->x_value = coshf(f); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void cosh_setup(void) +{ + cosh_class = class_new(gensym("cosh"), + (t_newmethod)cosh_new, 0, + sizeof(t_cosh), 0, A_DEFFLOAT, 0); + class_addbang(cosh_class, cosh_bang); + class_addfloat(cosh_class, cosh_float); +} diff --git a/externals/miXed/cyclone/hammer/counter.c b/externals/miXed/cyclone/hammer/counter.c new file mode 100644 index 000000000..dd987d4d1 --- /dev/null +++ b/externals/miXed/cyclone/hammer/counter.c @@ -0,0 +1,402 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is an entirely rewritten version of Joseph A. Sarlo's code. + The most important changes are listed in "pd-lib-notes.txt" file. */ + +/* Beware -- the max reference manual page for the counter object + reflects mostly opcode max features. Apparently counter works + differently in cycling max (e.g. inlets 3 and 4). But I am sick + of checking -- I will not bother, until there is some feedback. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" + +#define COUNTER_UP 0 +#define COUNTER_DOWN 1 +#define COUNTER_UPDOWN 2 +#define COUNTER_DEFMAX 0x7fffffff /* CHECKED (man says otherwise) */ + +typedef struct _counter +{ + t_object x_ob; + int x_count; + int x_maxcount; + int x_dir; + int x_inc; + int x_min; + int x_max; + int x_carrybang; + int x_minhitflag; + int x_maxhitflag; + t_pd *x_proxies[4]; + t_outlet *x_out2; + t_outlet *x_out3; + t_outlet *x_out4; +} t_counter; + +typedef struct _counter_proxy +{ + t_object p_ob; + t_counter *p_master; + void (*p_bangmethod)(t_counter *x); + void (*p_floatmethod)(t_counter *x, t_float f); +} t_counter_proxy; + +static t_class *counter_class; +static t_class *counter_proxy_class; + +static void counter_up(t_counter *x) +{ + x->x_dir = COUNTER_UP; + x->x_inc = 1; +} + +static void counter_down(t_counter *x) +{ + /* CHECKED: no explicit minimum needed */ + x->x_dir = COUNTER_DOWN; + x->x_inc = -1; +} + +static void counter_updown(t_counter *x) +{ + /* CHECKED: neither explicit maximum, nor minimum needed */ + x->x_dir = COUNTER_UPDOWN; + /* CHECKED: x->x_inc unchanged (continuation) */ +} + +static void counter_dir(t_counter *x, t_floatarg f) +{ + switch ((int)f) + { + case COUNTER_UP: + counter_up(x); + break; + case COUNTER_DOWN: + counter_down(x); + break; + case COUNTER_UPDOWN: + counter_updown(x); + break; + default: + counter_up(x); /* CHECKED: invalid == default */ + /* CHECKED: no warning */ + } +} + +static void counter_dobang(t_counter *x, int notjam) +{ + int offmin = 0, offmax = 0, onmin = 0, onmax = 0; + /* CHECKED: carry-off is not sent if min >= max */ + /* LATER rethink (this is a hack) */ + if (x->x_min < x->x_max) + offmin = x->x_minhitflag, offmax = x->x_maxhitflag; + x->x_minhitflag = x->x_maxhitflag = 0; + + if (x->x_count < x->x_min) + { + if (x->x_inc == 1) + { + /* min has changed, which should imply x->x_count == x->x_min */ + loudbug_bug("counter_dobang (count < min)"); + } + else if (x->x_dir == COUNTER_UPDOWN) + { + x->x_inc = 1; + if ((x->x_count = x->x_min + 1) > x->x_max) x->x_count = x->x_min; + } + else if ((x->x_count = x->x_max) < x->x_min) x->x_count = x->x_min; + } + else if (x->x_count > x->x_max) + { + if (x->x_inc == -1) + { + /* CHECKED: ignored */ + } + else if (x->x_dir == COUNTER_UPDOWN) + { + x->x_inc = -1; + if ((x->x_count = x->x_max - 1) < x->x_min) x->x_count = x->x_min; + } + else x->x_count = x->x_min; + } + + if (x->x_count == x->x_min && x->x_inc == -1) + { + /* CHECKED: 'jam' inhibits middle outlets (unless carry-off) + carry-on is never sent if max < min, but sent if max == min */ + if (notjam + && x->x_min <= x->x_max) /* LATER rethink (this is a hack) */ + onmin = 1; + } + else if (x->x_count == x->x_max && x->x_inc == 1) + { + /* CHECKED: this counter is never reset (and goes up to INT_MAX) + -- neither after dir change, nor after max change */ + x->x_maxcount++; /* CHECKED: 'jam' does the increment */ + outlet_float(x->x_out4, x->x_maxcount); + /* CHECKED: 'jam' inhibits middle outlets (unless carry-off) + carry-on is never sent if max < min, but sent if max == min */ + if (notjam + && x->x_min <= x->x_max) /* LATER rethink (this is a hack) */ + onmax = 1; + } + + /* CHECKED: outlets deliver in right-to-left order */ + if (onmax) + { + if (x->x_carrybang) outlet_bang(x->x_out3); + else + { + outlet_float(x->x_out3, 1); + x->x_maxhitflag = 1; + } + } + else if (offmax) outlet_float(x->x_out3, 0); + else if (onmin) + { + if (x->x_carrybang) outlet_bang(x->x_out2); + else + { + outlet_float(x->x_out2, 1); + x->x_minhitflag = 1; + } + } + else if (offmin) outlet_float(x->x_out2, 0); + + outlet_float(((t_object *)x)->ob_outlet, x->x_count); +} + +static void counter_bang(t_counter *x) +{ + x->x_count += x->x_inc; + counter_dobang(x, 1); +} + +static void counter_float(t_counter *x, t_float dummy) +{ + counter_bang(x); +} + +/* CHECKED: out-of-range values are ignored */ +/* CHECKED: 'down, set 3, up, bang' gives 5 */ +static void counter_set(t_counter *x, t_floatarg f) +{ + int i = (int)f; + if (i >= x->x_min && i <= x->x_max) + x->x_count = i - x->x_inc; +} + +/* CHECKED: out-of-range values are ignored */ +static void counter_jam(t_counter *x, t_floatarg f) +{ + int i = (int)f; + if (i >= x->x_min && i <= x->x_max) + { + x->x_count = i; + counter_dobang(x, 0); + } +} + +/* CHECKED: sends max carry on/off in any mode */ +static void counter_inc(t_counter *x) +{ + int tempdir = x->x_dir; + int tempinc = x->x_inc; + counter_up(x); + counter_bang(x); + x->x_dir = tempdir; + x->x_inc = tempinc; +} + +/* CHECKED: sends min carry on/off in any mode */ +static void counter_dec(t_counter *x) +{ + int tempdir = x->x_dir; + int tempinc = x->x_inc; + counter_down(x); + counter_bang(x); + x->x_dir = tempdir; + x->x_inc = tempinc; +} + +/* CHECKED: min can be set over max */ +static void counter_min(t_counter *x, t_floatarg f) +{ + /* CHECKED: min change always sets count to min and bangs */ + /* do not use counter_jam() here -- avoid range checking */ + x->x_count = x->x_min = (int)f; + counter_dobang(x, 0); +} + +/* CHECKED: max can be set below min */ +static void counter_max(t_counter *x, t_floatarg f) +{ + x->x_max = (int)f; +} + +static void counter_carrybang(t_counter *x) +{ + x->x_carrybang = 1; +} + +static void counter_carryint(t_counter *x) +{ + x->x_carrybang = 0; +} + +/* CHECKED: up/down switch */ +static void counter_bang1(t_counter *x) +{ + if (x->x_dir == COUNTER_UP) + counter_down(x); + else if (x->x_dir == COUNTER_DOWN) + counter_up(x); + else + x->x_inc = -x->x_inc; /* CHECKED */ +} + +/* CHECKED */ +static void counter_bang2(t_counter *x) +{ + counter_set(x, x->x_min); +} + +/* CHECKED: out-of-range values are accepted (LATER rethink) */ +/* CHECKED: no resetting of min, nor of max (contrary to the man) */ +/* CHECKED: 'down, float2 3, up, bang' gives 3 (LATER rethink) */ +static void counter_float2(t_counter *x, t_floatarg f) +{ + counter_set(x, f); /* FIXME */ +} + +/* CHECKED */ +static void counter_bang3(t_counter *x) +{ + counter_jam(x, x->x_min); +} + +/* CHECKED: out-of-range values are accepted (LATER rethink) */ +/* CHECKED: no resetting of min, nor of max (contrary to the man) */ +static void counter_float3(t_counter *x, t_floatarg f) +{ + counter_jam(x, f); /* FIXME */ +} + +/* CHECKED */ +static void counter_bang4(t_counter *x) +{ + counter_set(x, x->x_max); +} + +static void counter_proxy_bang(t_counter_proxy *x) +{ + x->p_bangmethod(x->p_master); +} + +static void counter_proxy_float(t_counter_proxy *x, t_float f) +{ + x->p_floatmethod(x->p_master, f); +} + +static void counter_free(t_counter *x) +{ + int i; + for (i = 0; i < 4; i++) + if (x->x_proxies[i]) pd_free(x->x_proxies[i]); +} + +static void *counter_new(t_floatarg f1, t_floatarg f2, t_floatarg f3) +{ + t_counter *x = (t_counter *)pd_new(counter_class); + t_counter_proxy **pp = (t_counter_proxy **)x->x_proxies; + int i1 = (int)f1; + int i2 = (int)f2; + int i3 = (int)f3; + int i; + static int warned = 0; + if (fittermax_get() && !warned) + { + post("warning: counter is not fully compatible,\ + please report differences"); + warned = 1; + } + x->x_dir = COUNTER_UP; + x->x_inc = 1; /* previous value required by counter_dir() */ + x->x_min = 0; + x->x_max = COUNTER_DEFMAX; + if (i3) x->x_dir = i1, x->x_min = i2, x->x_max = i3; + else if (i2) x->x_min = i1, x->x_max = i2; + else if (i1) x->x_max = i1; + x->x_carrybang = 0; /* CHECKED */ + x->x_minhitflag = x->x_maxhitflag = 0; + x->x_maxcount = 0; + counter_dir(x, x->x_dir); + /* CHECKED: [counter 1 <min> <max>] starts from <max> */ + x->x_count = (x->x_dir == COUNTER_DOWN ? x->x_max : x->x_min); + for (i = 0; i < 4; i++) + { + x->x_proxies[i] = pd_new(counter_proxy_class); + ((t_counter_proxy *)x->x_proxies[i])->p_master = x; + inlet_new((t_object *)x, x->x_proxies[i], 0, 0); + } + (*pp)->p_bangmethod = counter_bang1; + (*pp++)->p_floatmethod = counter_dir; /* CHECKED: same as dir */ + (*pp)->p_bangmethod = counter_bang2; + (*pp++)->p_floatmethod = counter_float2; + (*pp)->p_bangmethod = counter_bang3; + (*pp++)->p_floatmethod = counter_float3; + (*pp)->p_bangmethod = counter_bang4; + (*pp++)->p_floatmethod = counter_max; /* CHECKED: same as max */ + outlet_new((t_object *)x, &s_float); + x->x_out2 = outlet_new((t_object *)x, &s_anything); /* float/bang */ + x->x_out3 = outlet_new((t_object *)x, &s_anything); /* float/bang */ + x->x_out4 = outlet_new((t_object *)x, &s_float); + return (x); +} + +void counter_setup(void) +{ + counter_class = class_new(gensym("counter"), + (t_newmethod)counter_new, + (t_method)counter_free, + sizeof(t_counter), 0, + A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(counter_class, counter_bang); + class_addfloat(counter_class, counter_float); + class_addmethod(counter_class, (t_method)counter_bang, + gensym("next"), 0); + class_addmethod(counter_class, (t_method)counter_set, + gensym("set"), A_FLOAT, 0); + class_addmethod(counter_class, (t_method)counter_set, + gensym("goto"), A_FLOAT, 0); + class_addmethod(counter_class, (t_method)counter_jam, + gensym("jam"), A_FLOAT, 0); + class_addmethod(counter_class, (t_method)counter_up, + gensym("up"), 0); + class_addmethod(counter_class, (t_method)counter_down, + gensym("down"), 0); + class_addmethod(counter_class, (t_method)counter_updown, + gensym("updown"), 0); + class_addmethod(counter_class, (t_method)counter_inc, + gensym("inc"), 0); + class_addmethod(counter_class, (t_method)counter_dec, + gensym("dec"), 0); + class_addmethod(counter_class, (t_method)counter_min, + gensym("min"), A_FLOAT, 0); + class_addmethod(counter_class, (t_method)counter_max, + gensym("max"), A_FLOAT, 0); + class_addmethod(counter_class, (t_method)counter_carrybang, + gensym("carrybang"), 0); + class_addmethod(counter_class, (t_method)counter_carryint, + gensym("carryint"), 0); + counter_proxy_class = class_new(gensym("_counter_proxy"), 0, 0, + sizeof(t_counter_proxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(counter_proxy_class, counter_proxy_bang); + class_addfloat(counter_proxy_class, counter_proxy_float); + fitter_setup(counter_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/cycle.c b/externals/miXed/cyclone/hammer/cycle.c new file mode 100644 index 000000000..5063629fe --- /dev/null +++ b/externals/miXed/cyclone/hammer/cycle.c @@ -0,0 +1,155 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is a modified version of Joseph A. Sarlo's code. + The most important changes are listed in "pd-lib-notes.txt" file. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" + +//#define CYCLE_USEEVENTNO + +#define CYCLE_MINOUTS 1 +#define CYCLE_C74MAXOUTS 100 /* CHECKED */ +#define CYCLE_DEFOUTS 1 + +typedef struct _cycle +{ + t_object x_ob; + int x_eventmode; +#ifdef CYCLE_USEEVENTNO + int x_lastevent; +#else + double x_lastevent; +#endif + int x_index; + int x_nouts; + t_outlet **x_outs; +} t_cycle; + +static t_class *cycle_class; + +static int cycle_isnextevent(t_cycle *x) +{ +#ifdef CYCLE_USEEVENTNO + int nextevent = sys_geteventno(); +#else + double nextevent = clock_getlogicaltime(); +#endif + if (x->x_lastevent == nextevent) + return (0); + else + { + x->x_lastevent = nextevent; + return (1); + } +} + +static void cycle_bang(t_cycle *x) +{ + /* CHECKED: bangs ignored (but message 'bang' is an error -- why?) */ +} + +static void cycle_float(t_cycle *x, t_float f) +{ + if ((x->x_eventmode && cycle_isnextevent(x)) || x->x_index >= x->x_nouts) + x->x_index = 0; + outlet_float(x->x_outs[x->x_index++], f); +} + +static void cycle_symbol(t_cycle *x, t_symbol *s) +{ + if ((x->x_eventmode && cycle_isnextevent(x)) || x->x_index >= x->x_nouts) + x->x_index = 0; + outlet_symbol(x->x_outs[x->x_index++], s); +} + +/* LATER gpointer */ + +static void cycle_list(t_cycle *x, t_symbol *s, int ac, t_atom *av) +{ + if ((x->x_eventmode && cycle_isnextevent(x)) || x->x_index >= x->x_nouts) + x->x_index = 0; + while (ac--) + { + if (av->a_type == A_FLOAT) + outlet_float(x->x_outs[x->x_index], av->a_w.w_float); + else if (av->a_type == A_SYMBOL) + outlet_symbol(x->x_outs[x->x_index], av->a_w.w_symbol); + av++; + if (++(x->x_index) >= x->x_nouts) x->x_index = 0; + } +} + +static void cycle_anything(t_cycle *x, t_symbol *s, int ac, t_atom *av) +{ + if (s && s != &s_) cycle_symbol(x, s); /* CHECKED */ + cycle_list(x, 0, ac, av); +} + +static void cycle_set(t_cycle *x, t_floatarg f) +{ + int i = (int)f; + if (i >= 0 && i < x->x_nouts) x->x_index = i; +} + +static void cycle_thresh(t_cycle *x, t_floatarg f) +{ + if (x->x_eventmode = (f != 0)) +#ifdef CYCLE_USEEVENTNO + x->x_lastevent = sys_geteventno(); +#else + x->x_lastevent = clock_getlogicaltime(); +#endif +} + +static void cycle_free(t_cycle *x) +{ + if (x->x_outs) + freebytes(x->x_outs, x->x_nouts * sizeof(*x->x_outs)); +} + +static void *cycle_new(t_floatarg f1, t_floatarg f2) +{ + t_cycle *x; + int i, nouts = (int)f1; + t_outlet **outs; + if (nouts < CYCLE_MINOUTS) + nouts = CYCLE_DEFOUTS; + if (nouts > CYCLE_C74MAXOUTS) + { + fittermax_rangewarning(cycle_class, CYCLE_C74MAXOUTS, "outlets"); + /* CHECKED: max clips with an error: + ``perhaps you were trying to make an oscillator?'' */ + } + if (!(outs = (t_outlet **)getbytes(nouts * sizeof(*outs)))) + return (0); + x = (t_cycle *)pd_new(cycle_class); + x->x_nouts = nouts; + x->x_outs = outs; + x->x_index = 0; + for (i = 0; i < nouts; i++) + x->x_outs[i] = outlet_new((t_object *)x, &s_anything); + cycle_thresh(x, f2); + return (x); +} + +void cycle_setup(void) +{ + cycle_class = class_new(gensym("cycle"), + (t_newmethod)cycle_new, + (t_method)cycle_free, + sizeof(t_cycle), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(cycle_class, cycle_bang); + class_addfloat(cycle_class, cycle_float); + class_addsymbol(cycle_class, cycle_symbol); + class_addlist(cycle_class, cycle_list); + class_addanything(cycle_class, cycle_anything); + class_addmethod(cycle_class, (t_method)cycle_set, + gensym("set"), A_FLOAT, 0); /* CHECKED: arg required */ + class_addmethod(cycle_class, (t_method)cycle_thresh, + gensym("thresh"), A_FLOAT, 0); + fitter_setup(cycle_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/dbtoa.c b/externals/miXed/cyclone/hammer/dbtoa.c new file mode 100644 index 000000000..bf703c8f1 --- /dev/null +++ b/externals/miXed/cyclone/hammer/dbtoa.c @@ -0,0 +1,91 @@ +/* + Copyright (c) 2016 Marco Matteo Markidis + mm.markidis@gmail.com + + Made while listening: + Disclosure -- Caracal + */ +#include "m_pd.h" +#include <math.h> + +static t_class *dbtoa_class; + +typedef struct _dbtoa +{ + t_object x_obj; + t_outlet *float_outlet; + t_int bytes; + t_atom *output_list; + t_float f; +} t_dbtoa; + + +void *dbtoa_new(void); +void dbtoa_free(t_dbtoa *x); +void dbtoa_float(t_dbtoa *x, t_floatarg f); +void dbtoa_bang(t_dbtoa *x); +void dbtoa_set(t_dbtoa *x, t_floatarg f); + +t_float convert(t_float f); + +void dbtoa_float(t_dbtoa *x, t_floatarg f) +{ + x->f = f; + outlet_float(x->float_outlet, convert(f)); +} + +t_float convert(t_float f) +{ + return pow(10, f / 20); +} + +void dbtoa_list(t_dbtoa *x, t_symbol *s, int argc, t_atom *argv) +{ + int old_bytes = x->bytes, i = 0; + x->bytes = argc*sizeof(t_atom); + x->output_list = (t_atom *)t_resizebytes(x->output_list,old_bytes,x->bytes); + for(i=0;i<argc;i++) + SETFLOAT(x->output_list+i,convert(atom_getfloatarg(i,argc,argv))); + outlet_list(x->float_outlet,0,argc,x->output_list); +} + +void dbtoa_set(t_dbtoa *x, t_float f) +{ + x->f = f; +} + +void dbtoa_bang(t_dbtoa *x) +{ + outlet_float(x->float_outlet,convert(x->f)); +} + + +void *dbtoa_new(void) +{ + t_dbtoa *x = (t_dbtoa *) pd_new(dbtoa_class); + + x->float_outlet = outlet_new(&x->x_obj, 0); + x->bytes = sizeof(t_atom); + x->output_list = (t_atom *)getbytes(x->bytes); + if(x->output_list==NULL) { + pd_error(x,"dbtoa: memory allocation failure"); + return NULL; + } + return (x); +} + +void dbtoa_free(t_dbtoa *x) +{ + t_freebytes(x->output_list,x->bytes); +} + +void dbtoa_setup(void) +{ + dbtoa_class = class_new(gensym("dbtoa"), (t_newmethod)dbtoa_new, + (t_method)dbtoa_free,sizeof(t_dbtoa),0,0); + + class_addfloat(dbtoa_class,(t_method)dbtoa_float); + class_addlist(dbtoa_class,(t_method)dbtoa_list); + class_addmethod(dbtoa_class,(t_method)dbtoa_set,gensym("set"),A_DEFFLOAT,0); + class_addbang(dbtoa_class,(t_method)dbtoa_bang); +} diff --git a/externals/miXed/cyclone/hammer/decide.c b/externals/miXed/cyclone/hammer/decide.c new file mode 100644 index 000000000..dd5910e8e --- /dev/null +++ b/externals/miXed/cyclone/hammer/decide.c @@ -0,0 +1,83 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "shared.h" +#include <stdlib.h> + +typedef struct _decide +{ + t_object x_ob; + unsigned int x_seed; +} t_decide; + +static t_class *decide_class; + +/* the random bit algo is taken from NR (method II in 7.4) -- CHECKED */ +#define RBIT1 1 +#define RBIT2 2 +#define RBIT5 16 +#define RBIT18 131072 +#define RBIT_MASK (RBIT1 + RBIT2 + RBIT5) + +static void decide_bang(t_decide *x) +{ + if (x->x_seed & RBIT18) + { + x->x_seed = ((x->x_seed ^ RBIT_MASK) << 1) | RBIT1; + outlet_float(((t_object *)x)->ob_outlet, 1); + } + else + { + x->x_seed <<= 1; + outlet_float(((t_object *)x)->ob_outlet, 0); + } +} + +static void decide_float(t_decide *x, t_float f) +{ + /* CHECKED: float loudly rejected, int (any value) same as bang */ + int i; + if (loud_checkint((t_pd *)x, f, &i, &s_float)) + decide_bang(x); +} + +static void decide_ft1(t_decide *x, t_floatarg f) +{ + int i = (int)f; /* CHECKED */ + if (i) /* CHECKED: negative numbers are accepted */ + x->x_seed = i; + else + x->x_seed = rand(); /* FIXED */ +} + +static void *decide_new(t_floatarg f) +{ + t_decide *x = (t_decide *)pd_new(decide_class); + int i = (int)f; + if (i) + x->x_seed = i; + else + x->x_seed = rand(); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void decide_setup(void) +{ + decide_class = class_new(gensym("decide"), + (t_newmethod)decide_new, 0, + sizeof(t_decide), 0, + A_DEFFLOAT, 0); + class_addbang(decide_class, decide_bang); + class_addfloat(decide_class, decide_float); + class_addmethod(decide_class, (t_method)decide_ft1, + gensym("ft1"), A_FLOAT, 0); + /* CHECKED list is auto-unfolded */ + /* CHECKED doesn't understand "seed" */ +// logpost(NULL, 4, "this is cyclone/decide %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/hammer/drunk.c b/externals/miXed/cyclone/hammer/drunk.c new file mode 100644 index 000000000..e08800dd9 --- /dev/null +++ b/externals/miXed/cyclone/hammer/drunk.c @@ -0,0 +1,140 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* The first version of this code was written by Nicola Bernardini. + It was entirely reimplemented in the hope of adapting it to the + cyclone's guidelines. */ + +#include "m_pd.h" +#include "common/rand.h" + +#define DRUNK_DEFMAXVALUE 128 +#define DRUNK_DEFMAXSTEP 2 + +typedef struct _drunk +{ + t_object x_ob; + int x_value; + int x_maxvalue; + int x_maxstep; + int x_minstep; + unsigned int x_seed; + unsigned int x_bitseed; +} t_drunk; + +static t_class *drunk_class; + +static void drunk_set(t_drunk *x, t_floatarg f) +{ + int i = (int)f; /* CHECKED float silently truncated */ + if (i > x->x_maxvalue) + x->x_value = x->x_maxvalue; /* CHECKED */ + else if (i < 0) + x->x_value = 0; /* CHECKED */ + else x->x_value = i; +} + +/* CHECKED: this is a superposition of two rngs -- the random bit generator, + and the random integer generator, which is the same (CHECKED) as the one + used in the 'random' class (quite lame: period 35730773, nonuniform for + large ranges, so I would rather not RE it...) */ +#define RBIT1 1 +#define RBIT2 2 +#define RBIT5 16 +#define RBIT18 131072 +#define RBIT_MASK (RBIT1 + RBIT2 + RBIT5) + +static void drunk_bang(t_drunk *x) +{ + int rnd = rand_int(&x->x_seed, x->x_maxstep) + x->x_minstep; + int val; + if (x->x_bitseed & RBIT18) + { + x->x_bitseed = ((x->x_bitseed ^ RBIT_MASK) << 1) | RBIT1; + if ((val = x->x_value + rnd) > x->x_maxvalue) + val = x->x_value - rnd; /* CHECKED */ + if (val < 0) + val = 0; /* CHECKED (needed for maxstep > maxvalue) */ + } + else + { + x->x_bitseed <<= 1; + if ((val = x->x_value - rnd) < 0) + val = x->x_value + rnd; /* CHECKED */ + if (val > x->x_maxvalue) + val = x->x_maxvalue; /* CHECKED (needed for maxstep > maxvalue) */ + } + outlet_float(((t_object *)x)->ob_outlet, x->x_value = val); +} + +static void drunk_float(t_drunk *x, t_float f) +{ + drunk_set(x, f); + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void drunk_ft1(t_drunk *x, t_floatarg f) +{ + int i = (int)f; /* CHECKED float silently truncated */ + x->x_maxvalue = (i < 0 ? 1 : i); /* CHECKED zero allowed */ + /* CHECKED maxstep not updated */ +} + +static void drunk_ft2(t_drunk *x, t_floatarg f) +{ + int i = (int)f; /* CHECKED float silently truncated */ + if (i < 0) + { + x->x_minstep = 1; + i = -i; + } + else x->x_minstep = 0; + /* CHECKED maxstep not clipped to the maxvalue */ + x->x_maxstep = (x->x_minstep ? i - 1 : i); /* CHECKED zero allowed */ +} + +/* apparently, bitseed cannot be controlled, but LATER recheck */ +static void drunk_seed(t_drunk *x, t_floatarg f) +{ + int i = (int)f; /* CHECKED */ + if (i < 0) + i = 1; /* CHECKED */ + rand_seed(&x->x_seed, (unsigned int)i); +} + +static void *drunk_new(t_floatarg f1, t_floatarg f2) +{ + t_drunk *x = (t_drunk *)pd_new(drunk_class); + x->x_maxvalue = ((int)f1 > 0 ? (int)f1 : 128); /* CHECKED */ + x->x_maxstep = 2; + x->x_minstep = 0; + if ((int)f2) /* CHECKED */ + drunk_ft2(x, f2); + x->x_value = x->x_maxvalue / 2; /* CHECKED */ + rand_seed(&x->x_seed, 0); /* CHECKED third arg silently ignored */ + x->x_bitseed = 123456789; /* FIXME */ + 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); + return (x); +} + +void drunk_setup(void) +{ + drunk_class = class_new(gensym("drunk"), + (t_newmethod)drunk_new, 0, + sizeof(t_drunk), 0, + A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(drunk_class, drunk_bang); + class_addfloat(drunk_class, drunk_float); + class_addmethod(drunk_class, (t_method)drunk_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(drunk_class, (t_method)drunk_ft2, + gensym("ft2"), A_FLOAT, 0); + /* CHECKED list is auto-unfolded */ + class_addmethod(drunk_class, (t_method)drunk_seed, + gensym("seed"), A_FLOAT, 0); /* CHECKED arg obligatory */ + class_addmethod(drunk_class, (t_method)drunk_set, + gensym("set"), A_FLOAT, 0); /* CHECKED arg obligatory */ +} diff --git a/externals/miXed/cyclone/hammer/flush.c b/externals/miXed/cyclone/hammer/flush.c new file mode 100644 index 000000000..751fc2472 --- /dev/null +++ b/externals/miXed/cyclone/hammer/flush.c @@ -0,0 +1,79 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" + +#define FLUSH_NPITCHES 128 + +typedef struct _flush +{ + t_object x_ob; + t_float x_velocity; + unsigned char x_pitches[FLUSH_NPITCHES]; /* CHECKED */ + t_outlet *x_voutlet; +} t_flush; + +static t_class *flush_class; + +static void flush_float(t_flush *x, t_float f) +{ + int pitch = (int)f; + if (pitch >= 0 && pitch < FLUSH_NPITCHES) + { + outlet_float(x->x_voutlet, x->x_velocity); + outlet_float(((t_object *)x)->ob_outlet, pitch); + if (x->x_velocity != 0) + { + x->x_pitches[pitch]++; /* CHECKED (lame) */ + } + else if (x->x_pitches[pitch]) + { + x->x_pitches[pitch]--; /* CHECKED (lame) */ + } + } +} + +static void flush_bang(t_flush *x) +{ + int i; + unsigned char *pp; + for (i = 0, pp = x->x_pitches; i < FLUSH_NPITCHES; i++, pp++) + { + while (*pp) + { + outlet_float(x->x_voutlet, 0); + outlet_float(((t_object *)x)->ob_outlet, i); + (*pp)--; + } + } +} + +static void flush_clear(t_flush *x) +{ + memset(x->x_pitches, 0, sizeof(x->x_pitches)); +} + +static void *flush_new(void) +{ + t_flush *x = (t_flush *)pd_new(flush_class); + x->x_velocity = 0; + flush_clear(x); + floatinlet_new((t_object *)x, &x->x_velocity); + outlet_new((t_object *)x, &s_float); + x->x_voutlet = outlet_new((t_object *)x, &s_float); + return (x); +} + +void flush_setup(void) +{ + flush_class = class_new(gensym("flush"), + (t_newmethod)flush_new, + 0, /* CHECKED: no flushout */ + sizeof(t_flush), 0, 0); + class_addfloat(flush_class, flush_float); + class_addbang(flush_class, flush_bang); + class_addmethod(flush_class, (t_method)flush_clear, + gensym("clear"), 0); +} diff --git a/externals/miXed/cyclone/hammer/forward.c b/externals/miXed/cyclone/hammer/forward.c new file mode 100644 index 000000000..995e765fc --- /dev/null +++ b/externals/miXed/cyclone/hammer/forward.c @@ -0,0 +1,71 @@ +/* Copyright (c) 1997-2002 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _forward +{ + t_object x_ob; + t_symbol *x_sym; +} t_forward; + +static t_class *forward_class; + +static void forward_bang(t_forward *x) +{ + if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); +} + +static void forward_float(t_forward *x, t_float f) +{ + if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f); +} + +static void forward_symbol(t_forward *x, t_symbol *s) +{ + if (x->x_sym->s_thing) pd_symbol(x->x_sym->s_thing, s); +} + +static void forward_pointer(t_forward *x, t_gpointer *gp) +{ + if (x->x_sym->s_thing) pd_pointer(x->x_sym->s_thing, gp); +} + +static void forward_list(t_forward *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_sym->s_thing) pd_list(x->x_sym->s_thing, s, ac, av); +} + +static void forward_anything(t_forward *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, s, ac, av); +} + +static void forward_send(t_forward *x, t_symbol *s) +{ + /* CHECKED: 'send' without arguments erases destination */ + if (s) x->x_sym = s; +} + +static void *forward_new(t_symbol *s) +{ + t_forward *x = (t_forward *)pd_new(forward_class); + x->x_sym = s; + return (x); +} + +void forward_setup(void) +{ + forward_class = class_new(gensym("forward"), + (t_newmethod)forward_new, 0, + sizeof(t_forward), 0, A_DEFSYM, 0); + class_addbang(forward_class, forward_bang); + class_addfloat(forward_class, forward_float); + class_addsymbol(forward_class, forward_symbol); + class_addpointer(forward_class, forward_pointer); + class_addlist(forward_class, forward_list); + class_addanything(forward_class, forward_anything); + class_addmethod(forward_class, (t_method)forward_send, + gensym("send"), A_DEFSYM, 0); +} diff --git a/externals/miXed/cyclone/hammer/fromsymbol.c b/externals/miXed/cyclone/hammer/fromsymbol.c new file mode 100644 index 000000000..3d508e965 --- /dev/null +++ b/externals/miXed/cyclone/hammer/fromsymbol.c @@ -0,0 +1,88 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" + +typedef struct _fromsymbol +{ + t_object x_ob; +} t_fromsymbol; + +static t_class *fromsymbol_class; + +static void fromsymbol_bang(t_fromsymbol *x) +{ + outlet_bang(((t_object *)x)->ob_outlet); /* CHECKED */ +} + +static void fromsymbol_float(t_fromsymbol *x, t_float f) +{ + /* CHECKED: fromsymbol: doesn't understand "int", "float" */ +} + +static void fromsymbol_symbol(t_fromsymbol *x, t_symbol *s) +{ + static char zero = 0; + char *sname = &zero; + if (s) + { + sname = s->s_name; + while (*sname == ' ' || *sname == '\t' + || *sname == '\n' || *sname == '\r') sname++; + } + if (*sname) + { + t_binbuf *bb = binbuf_new(); + int ac; + t_atom *av; + binbuf_text(bb, sname, strlen(sname)); + ac = binbuf_getnatom(bb); + av = binbuf_getvec(bb); + if (ac) + { + if (av->a_type == A_SYMBOL) + outlet_anything(((t_object *)x)->ob_outlet, + av->a_w.w_symbol, ac - 1, av + 1); + else if (av->a_type == A_FLOAT) + { + if (ac > 1) + outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, av); + else + outlet_float(((t_object *)x)->ob_outlet, av->a_w.w_float); + } + } + binbuf_free(bb); + } +} + +static void fromsymbol_list(t_fromsymbol *x, t_symbol *s, int ac, t_atom *av) +{ + /* CHECKED: fromsymbol: doesn't understand "int", "float", + 'list <symbol>' ignored without complaining. */ +} + +static void fromsymbol_anything(t_fromsymbol *x, t_symbol *s, int ac, t_atom *av) +{ + fromsymbol_symbol(x, s); /* CHECKED */ +} + +static void *fromsymbol_new(void) +{ + t_fromsymbol *x = (t_fromsymbol *)pd_new(fromsymbol_class); + outlet_new((t_object *)x, &s_anything); + return (x); +} + +void fromsymbol_setup(void) +{ + fromsymbol_class = class_new(gensym("fromsymbol"), + (t_newmethod)fromsymbol_new, 0, + sizeof(t_fromsymbol), 0, 0); + class_addbang(fromsymbol_class, fromsymbol_bang); + class_addfloat(fromsymbol_class, fromsymbol_float); + class_addsymbol(fromsymbol_class, fromsymbol_symbol); + class_addlist(fromsymbol_class, fromsymbol_list); + class_addanything(fromsymbol_class, fromsymbol_anything); +} diff --git a/externals/miXed/cyclone/hammer/funbuff.c b/externals/miXed/cyclone/hammer/funbuff.c new file mode 100644 index 000000000..18928b35d --- /dev/null +++ b/externals/miXed/cyclone/hammer/funbuff.c @@ -0,0 +1,535 @@ +/* Copyright (c) 2002-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <libgen.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/vefl.h" +#include "hammer/tree.h" +#include "hammer/file.h" + +typedef struct _funbuff +{ + t_object x_ob; + t_canvas *x_canvas; + t_symbol *x_defname; + t_float x_value; + int x_valueset; + /* CHECKED filling with a large set, then sending 'goto', 'read', 'next'... + outputs the previous, replaced contents (same with deletion) + -- apparently a node pointer is stored, corrupt in these cases */ + t_hammernode *x_pointer; + int x_pointerset; /* set-with-goto flag */ + int x_lastdelta; + int x_embedflag; + t_hammerfile *x_filehandle; + t_hammertree x_tree; + t_outlet *x_deltaout; + t_outlet *x_bangout; +} t_funbuff; + +static t_class *funbuff_class; + +static void funbuff_dooutput(t_funbuff *x, float value, float delta) +{ + /* CHECKED lastdelta sent for 'next', 'float', 'min', 'max', + 'interp', 'find' */ + outlet_float(x->x_deltaout, delta); + outlet_float(((t_object *)x)->ob_outlet, value); +} + +static void funbuff_bang(t_funbuff *x) +{ + t_hammernode *np; + int count = 0; + int xmin = 0, xmax = 0; + t_float ymin = 0, ymax = 0; + if (np = x->x_tree.t_first) + { + /* LATER consider using extra fields, updated on the fly */ + count = 1; + xmin = np->n_key; + xmax = x->x_tree.t_last->n_key; + ymin = ymax = HAMMERNODE_GETFLOAT(np); + while (np = np->n_next) + { + t_float f = HAMMERNODE_GETFLOAT(np); + if (f < ymin) + ymin = f; + else if (f > ymax) + ymax = f; + count++; + } + } + /* format CHECKED */ + post("funbuff info: %d elements long", count); /* CHECKED 0 and 1 */ + if (count) + { + post(" -> minX= %d maxX= %d", xmin, xmax); + post(" -> minY= %g maxY= %g", ymin, ymax); + post(" -> domain= %d range= %g", xmax - xmin, ymax - ymin); + } +} + +static void funbuff_float(t_funbuff *x, t_float f) +{ + int ndx = (int)f; /* CHECKED float is silently truncated */ + t_hammernode *np; + if (x->x_valueset) + { + np = hammertree_insertfloat(&x->x_tree, ndx, x->x_value, 1); + x->x_valueset = 0; + } + else if (np = hammertree_closest(&x->x_tree, ndx, 0)) + funbuff_dooutput(x, HAMMERNODE_GETFLOAT(np), x->x_lastdelta); + /* CHECKED pointer is updated -- + 'next' outputs np also in a !valueset case (it is sent twice) */ + x->x_pointer = np; /* FIXME */ + x->x_pointerset = 0; +} + +static void funbuff_ft1(t_funbuff *x, t_floatarg f) +{ + /* this is incompatible -- CHECKED float is silently truncated */ + x->x_value = f; + x->x_valueset = 1; +} + +static void funbuff_clear(t_funbuff *x) +{ + hammertree_clear(&x->x_tree, 0); + /* CHECKED valueset is not cleared */ + x->x_pointer = 0; +} + +/* LATER dirty flag handling */ +static void funbuff_embed(t_funbuff *x, t_floatarg f) +{ + x->x_embedflag = (f != 0); +} + +static void funbuff_goto(t_funbuff *x, t_floatarg f) +{ + /* CHECKED truncation */ + x->x_pointer = hammertree_closest(&x->x_tree, (int)f, 1); + x->x_pointerset = 1; /* CHECKED delta output by 'next' will be zero */ +} + +/* LATER consider using an extra field, updated on the fly */ +static void funbuff_min(t_funbuff *x) +{ + t_hammernode *np; + if (np = x->x_tree.t_first) /* CHECKED nop if empty */ + { + t_float result = HAMMERNODE_GETFLOAT(np); + while (np = np->n_next) + if (HAMMERNODE_GETFLOAT(np) < result) + result = HAMMERNODE_GETFLOAT(np); + funbuff_dooutput(x, result, x->x_lastdelta); + /* CHECKED pointer not updated */ + } +} + +/* LATER consider using an extra field, updated on the fly */ +static void funbuff_max(t_funbuff *x) +{ + t_hammernode *np; + if (np = x->x_tree.t_first) /* CHECKED nop if empty */ + { + t_float result = HAMMERNODE_GETFLOAT(np); + while (np = np->n_next) + if (HAMMERNODE_GETFLOAT(np) > result) + result = HAMMERNODE_GETFLOAT(np); + funbuff_dooutput(x, result, x->x_lastdelta); + /* CHECKED pointer not updated */ + } +} + +static void funbuff_next(t_funbuff *x) +{ + t_hammernode *np; + if (!x->x_tree.t_root) + return; + if (!(np = x->x_pointer)) + { + outlet_bang(x->x_bangout); + /* CHECKED banging until reset */ + return; + } + if (x->x_pointerset) + x->x_lastdelta = 0; + else if (np->n_prev) + x->x_lastdelta = np->n_key - np->n_prev->n_key; + else + x->x_lastdelta = 0; /* CHECKED corrupt delta sent here... */ + funbuff_dooutput(x, HAMMERNODE_GETFLOAT(np), x->x_lastdelta); + x->x_pointer = np->n_next; + x->x_pointerset = 0; +} + +static void funbuff_set(t_funbuff *x, t_symbol *s, int ac, t_atom *av) +{ + /* CHECKED symbols somehow bashed to zeros, + decreasing x coords corrupt the funbuff -- not emulated here... */ + int i = ac; + t_atom *ap = av; + while (i--) if (ap++->a_type != A_FLOAT) + { + loud_error((t_pd *)x, "bad input (not a number) -- no data to set"); + return; + } + if (!ac || (ac % 2)) + { + /* CHECKED odd/null ac loudly rejected, current contents preserved */ + loud_error((t_pd *)x, "bad input (%s) -- no data to set", + (ac ? "odd arg count" : "no input")); + return; + } + funbuff_clear(x); /* CHECKED the contents is replaced */ + while (ac--) + { + int ndx = (int)av++->a_w.w_float; + if (!hammertree_insertfloat(&x->x_tree, ndx, av++->a_w.w_float, 1)) + return; + ac--; + } +} + +static void funbuff_doread(t_funbuff *x, t_symbol *fn) +{ + t_binbuf *bb = binbuf_new(); + int ac; + t_atom *av; + char buf[MAXPDSTRING]; + /* FIXME use open_via_path() */ + canvas_makefilename(x->x_canvas, fn->s_name, buf, MAXPDSTRING); + binbuf_read(bb, buf, "", 0); + if ((ac = binbuf_getnatom(bb)) && + (av = binbuf_getvec(bb)) && + av->a_type == A_SYMBOL && + av->a_w.w_symbol == gensym("funbuff")) + { + post("funbuff_read: %s read successful", fn->s_name); /* CHECKED */ + funbuff_set(x, 0, ac-1, av+1); + } + else /* CHECKED no complaints... */ + loud_error((t_pd *)x, "invalid file %s", fn->s_name); + binbuf_free(bb); +} + +static void funbuff_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + funbuff_doread((t_funbuff *)z, fn); +} + +static void funbuff_dowrite(t_funbuff *x, t_symbol *fn) +{ + t_binbuf *bb = binbuf_new(); + char buf[MAXPDSTRING]; + t_hammernode *np; + /* specifying the object as cyclone/funbuff breaks the file writing/ + * reading as the it doesn't start with 'funbuff'. A call to + * libgen/basename fixes this. fjk, 2015-01-24 */ + t_symbol *objName = atom_getsymbol(binbuf_getvec(x->x_ob.te_binbuf)); + objName->s_name = basename(objName->s_name); + binbuf_addv(bb, "s", objName); + for (np = x->x_tree.t_first; np; np = np->n_next) + binbuf_addv(bb, "if", np->n_key, HAMMERNODE_GETFLOAT(np)); + canvas_makefilename(x->x_canvas, fn->s_name, buf, MAXPDSTRING); + + binbuf_write(bb, buf, "", 0); + binbuf_free(bb); +} + +static void funbuff_writehook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + funbuff_dowrite((t_funbuff *)z, fn); +} + +static void funbuff_embedhook(t_pd *z, t_binbuf *bb, t_symbol *bindsym) +{ + t_funbuff *x = (t_funbuff *)z; + if (x->x_embedflag) + { + t_hammernode *np; + binbuf_addv(bb, "ssi;", bindsym, gensym("embed"), 1); + if (np = x->x_tree.t_first) + { + binbuf_addv(bb, "ss", bindsym, gensym("set")); + for (; np; np = np->n_next) + binbuf_addv(bb, "if", np->n_key, HAMMERNODE_GETFLOAT(np)); + binbuf_addsemi(bb); + } + } +} + +/* CHECKED symbol arg ok */ +static void funbuff_read(t_funbuff *x, t_symbol *s) +{ + if (s && s != &s_) + funbuff_doread(x, s); + else + hammerpanel_open(x->x_filehandle, 0); +} + +/* CHECKED symbol arg not allowed -- + a bug? but CHECKME other classes (cf seq's filetype dilemma) */ +static void funbuff_write(t_funbuff *x, t_symbol *s) +{ + if (s && s != &s_) + funbuff_dowrite(x, s); + else /* CHECKME default name */ + hammerpanel_save(x->x_filehandle, + canvas_getdir(x->x_canvas), x->x_defname); +} + +static void funbuff_delete(t_funbuff *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac && av->a_type == A_FLOAT && + (ac == 1 || (ac == 2 && av[1].a_type == A_FLOAT))) + { + /* CHECKED float is silently truncated */ + int ndx = (int)av->a_w.w_float; + t_hammernode *np; + if ((np = hammertree_search(&x->x_tree, ndx)) && + (ac == 1 || HAMMERNODE_GETFLOAT(np) == av[1].a_w.w_float)) + { + if (np == x->x_pointer) + x->x_pointer = 0; /* CHECKED corrupt pointer left here... */ + hammertree_delete(&x->x_tree, np); /* FIXME */ + } + /* CHECKED mismatch silently ignored */ + } + else loud_messarg((t_pd *)x, s); /* CHECKED */ +} + +static void funbuff_find(t_funbuff *x, t_floatarg f) +{ + t_hammernode *np; + if (np = x->x_tree.t_first) + { + do + { + /* CHECKED lastdelta preserved */ + if (HAMMERNODE_GETFLOAT(np) == f) + funbuff_dooutput(x, np->n_key, x->x_lastdelta); + } + while (np = np->n_next); + /* CHECKED no bangout, no complaint if nothing found */ + } + else loud_error((t_pd *)x, "nothing to find"); /* CHECKED */ +} + +static void funbuff_dump(t_funbuff *x) +{ + t_hammernode *np; + if (np = x->x_tree.t_first) + { + do + { + x->x_lastdelta = HAMMERNODE_GETFLOAT(np); /* CHECKED */ + /* float value preserved (this is incompatible) */ + funbuff_dooutput(x, np->n_key, x->x_lastdelta); + } + while (np = np->n_next); + /* CHECKED no bangout */ + } + else loud_error((t_pd *)x, "nothing to dump"); /* CHECKED */ +} + +/* CHECKME if pointer is updated */ +static void funbuff_dointerp(t_funbuff *x, t_floatarg f, int vsz, t_word *vec) +{ + t_hammernode *np1; + int trunc = (int)f; + if (trunc > f) trunc--; /* CHECKME negative floats */ + if (np1 = hammertree_closest(&x->x_tree, trunc, 0)) + { + float value = HAMMERNODE_GETFLOAT(np1); + t_hammernode *np2 = np1->n_next; + if (np2) + { + float delta = (float)(np2->n_key - np1->n_key); + /* this is incompatible -- CHECKED float argument is silently + truncated (which does not make much sense here), CHECKME again */ + float frac = f - np1->n_key; + if (frac < 0 || frac >= delta) + { + loudbug_bug("funbuff_dointerp"); + return; + } + frac /= delta; + if (vec) + { + /* CHECKME */ + float vpos = (vsz - 1) * frac; + int vndx = (int)vpos; + float vfrac = vpos - vndx; + if (vndx < 0 || vndx >= vsz - 1) + { + loudbug_bug("funbuff_dointerp redundant test..."); + return; + } + vec += vndx; + frac = vec[0].w_float + (vec[1].w_float - vec[0].w_float) * vfrac; + } + value += + (HAMMERNODE_GETFLOAT(np2) - HAMMERNODE_GETFLOAT(np1)) * frac; + } + funbuff_dooutput(x, value, x->x_lastdelta); /* CHECKME !np2 */ + } + else if (np1 = hammertree_closest(&x->x_tree, trunc, 1)) + /* CHECKME */ + funbuff_dooutput(x, HAMMERNODE_GETFLOAT(np1), x->x_lastdelta); +} + +static void funbuff_interp(t_funbuff *x, t_floatarg f) +{ + funbuff_dointerp(x, f, 0, 0); +} + +static void funbuff_interptab(t_funbuff *x, t_symbol *s, t_floatarg f) +{ + int vsz; + t_word *vec; + if (vec = vefl_get(s, &vsz, 0, (t_pd *)x)) + { + if (vsz > 2) + funbuff_dointerp(x, f, vsz, vec); + else + funbuff_dointerp(x, f, 0, 0); + } +} + +static void funbuff_reduce(t_funbuff *x, t_floatarg f) +{ + loud_notimplemented((t_pd *)x, "reduce"); +} + +static void funbuff_select(t_funbuff *x, t_floatarg f1, t_floatarg f2) +{ + loud_notimplemented((t_pd *)x, "select"); +} + +/* CHECKED (sub)buffer's copy is stored, as expected -- + 'delete' does not modify the clipboard */ +/* CHECKED cut entire contents if no selection */ +static void funbuff_cut(t_funbuff *x) +{ + loud_notimplemented((t_pd *)x, "cut"); +} + +/* CHECKED copy entire contents if no selection */ +static void funbuff_copy(t_funbuff *x) +{ + loud_notimplemented((t_pd *)x, "copy"); +} + +static void funbuff_paste(t_funbuff *x) +{ + loud_notimplemented((t_pd *)x, "paste"); +} + +static void funbuff_undo(t_funbuff *x) +{ + /* CHECKED apparently not working in 4.07 */ + loud_notimplemented((t_pd *)x, "undo"); +} + +#ifdef HAMMERTREE_DEBUG +static void funbuff_debug(t_funbuff *x, t_floatarg f) +{ + hammertree_debug(&x->x_tree, (int)f, 0); +} +#endif + +static void funbuff_free(t_funbuff *x) +{ + hammerfile_free(x->x_filehandle); + hammertree_clear(&x->x_tree, 0); +} + +static void *funbuff_new(t_symbol *s) +{ + t_funbuff *x = (t_funbuff *)pd_new(funbuff_class); + x->x_canvas = canvas_getcurrent(); + x->x_valueset = 0; + x->x_pointer = 0; + x->x_pointerset = 0; /* CHECKME, rename to intraversal? */ + x->x_lastdelta = 0; + x->x_embedflag = 0; + hammertree_inittyped(&x->x_tree, HAMMERTYPE_FLOAT, 0); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + x->x_deltaout = outlet_new((t_object *)x, &s_float); + x->x_bangout = outlet_new((t_object *)x, &s_bang); + if (s && s != &s_) + { + x->x_defname = s; /* CHECKME if 'read' changes this */ + funbuff_doread(x, s); + } + else x->x_defname = &s_; + x->x_filehandle = hammerfile_new((t_pd *)x, funbuff_embedhook, + funbuff_readhook, funbuff_writehook, 0); + return (x); +} + +void funbuff_setup(void) +{ + funbuff_class = class_new(gensym("funbuff"), + (t_newmethod)funbuff_new, + (t_method)funbuff_free, + sizeof(t_funbuff), 0, A_DEFSYM, 0); + class_addbang(funbuff_class, funbuff_bang); + class_addfloat(funbuff_class, funbuff_float); + class_addmethod(funbuff_class, (t_method)funbuff_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(funbuff_class, (t_method)funbuff_clear, + gensym("clear"), 0); + class_addmethod(funbuff_class, (t_method)funbuff_goto, + gensym("goto"), A_FLOAT, 0); + class_addmethod(funbuff_class, (t_method)funbuff_min, + gensym("min"), 0); + class_addmethod(funbuff_class, (t_method)funbuff_max, + gensym("max"), 0); + class_addmethod(funbuff_class, (t_method)funbuff_next, + gensym("next"), 0); + class_addmethod(funbuff_class, (t_method)funbuff_embed, + gensym("embed"), A_FLOAT, 0); + class_addmethod(funbuff_class, (t_method)funbuff_read, + gensym("read"), A_DEFSYM, 0); + class_addmethod(funbuff_class, (t_method)funbuff_write, + gensym("write"), A_DEFSYM, 0); + class_addmethod(funbuff_class, (t_method)funbuff_set, + gensym("set"), A_GIMME, 0); + class_addmethod(funbuff_class, (t_method)funbuff_delete, + gensym("delete"), A_GIMME, 0); + class_addmethod(funbuff_class, (t_method)funbuff_find, + gensym("find"), A_FLOAT, 0); + class_addmethod(funbuff_class, (t_method)funbuff_dump, + gensym("dump"), 0); + class_addmethod(funbuff_class, (t_method)funbuff_interp, + gensym("interp"), A_FLOAT, 0); + class_addmethod(funbuff_class, (t_method)funbuff_interptab, + gensym("interptab"), A_FLOAT, A_SYMBOL, 0); + class_addmethod(funbuff_class, (t_method)funbuff_reduce, + gensym("reduce"), A_FLOAT, 0); + class_addmethod(funbuff_class, (t_method)funbuff_select, + gensym("select"), A_FLOAT, A_FLOAT, 0); + class_addmethod(funbuff_class, (t_method)funbuff_cut, + gensym("cut"), 0); + class_addmethod(funbuff_class, (t_method)funbuff_copy, + gensym("copy"), 0); + class_addmethod(funbuff_class, (t_method)funbuff_paste, + gensym("paste"), 0); + class_addmethod(funbuff_class, (t_method)funbuff_undo, + gensym("undo"), 0); +#ifdef HAMMERTREE_DEBUG + class_addmethod(funbuff_class, (t_method)funbuff_debug, + gensym("debug"), A_DEFFLOAT, 0); +#endif + hammerfile_setup(funbuff_class, 1); +// logpost(NULL, 4, "this is cyclone/funbuff %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/hammer/funnel.c b/externals/miXed/cyclone/hammer/funnel.c new file mode 100644 index 000000000..d289d8d17 --- /dev/null +++ b/externals/miXed/cyclone/hammer/funnel.c @@ -0,0 +1,179 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" + +#define FUNNEL_MINSLOTS 2 +#define FUNNEL_INISIZE 32 /* LATER rethink */ +#define FUNNEL_MAXSIZE 256 + +typedef struct _funnel +{ + t_object x_ob; + int x_nslots; + int x_nproxies; /* as requested (and allocated) */ + t_pd **x_proxies; +} t_funnel; + +typedef struct _funnel_proxy +{ + t_object p_ob; + t_outlet *p_out; /* master outlet (the same value for each slot) */ + int p_id; /* adjusted according to an offset argument */ + t_float p_value; + int p_size; /* as allocated */ + t_atom *p_message; + t_atom p_messini[FUNNEL_INISIZE]; + int p_entered; +} t_funnel_proxy; + +static t_class *funnel_class; +static t_class *funnel_proxy_class; + +static void funnel_proxy_bang(t_funnel_proxy *x) +{ + t_atom at[2]; + SETFLOAT(&at[0], x->p_id); + SETFLOAT(&at[1], x->p_value); + outlet_list(x->p_out, &s_list, 2, at); +} + +static void funnel_proxy_float(t_funnel_proxy *x, t_float f) +{ + x->p_value = f; + funnel_proxy_bang(x); +} + +static void funnel_proxy_list(t_funnel_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + int reentered = x->p_entered; + int prealloc = !reentered; + int ntotal = ac + 1; + x->p_entered = 1; + if (prealloc && ntotal > x->p_size) + { + if (ntotal > FUNNEL_MAXSIZE) + prealloc = 0; + else + { + x->p_message = grow_nodata(&ntotal, &x->p_size, x->p_message, + FUNNEL_INISIZE, x->p_messini, + sizeof(*x->p_message)); + ac = ntotal - 1; + } + } + /* LATER consider a compatibility warning if av->a_type != A_FLOAT */ + x->p_value = ((ac && av->a_type == A_FLOAT) ? av->a_w.w_float : 0); + if (prealloc) + { + SETFLOAT(x->p_message, x->p_id); + if (ac) + memcpy(x->p_message + 1, av, ac * sizeof(*x->p_message)); + outlet_list(x->p_out, &s_list, ntotal, x->p_message); + } + else + { + /* LATER consider using the stack if ntotal <= MAXSTACK */ + t_atom *buf = getbytes(ntotal * sizeof(*buf)); + if (buf) + { + SETFLOAT(buf, x->p_id); + if (ac) + memcpy(buf + 1, av, ac * sizeof(*buf)); + outlet_list(x->p_out, &s_list, ntotal, buf); + freebytes(buf, ntotal * sizeof(*buf)); + } + } + if (!reentered) x->p_entered = 0; +} + +static void funnel_bang(t_funnel *x) +{ + funnel_proxy_bang((t_funnel_proxy *)x->x_proxies[0]); +} + +static void funnel_float(t_funnel *x, t_float f) +{ + funnel_proxy_float((t_funnel_proxy *)x->x_proxies[0], f); +} + +static void funnel_list(t_funnel *x, t_symbol *s, int ac, t_atom *av) +{ + funnel_proxy_list((t_funnel_proxy *)x->x_proxies[0], s, ac, av); +} + +static void funnel_free(t_funnel *x) +{ + if (x->x_proxies) + { + int i = x->x_nslots; + while (i--) + { + t_funnel_proxy *y = (t_funnel_proxy *)x->x_proxies[i]; + if (y->p_message != y->p_messini) + freebytes(y->p_message, y->p_size * sizeof(*y->p_message)); + pd_free((t_pd *)y); + } + freebytes(x->x_proxies, x->x_nproxies * sizeof(*x->x_proxies)); + } +} + +static void *funnel_new(t_floatarg f1, t_floatarg f2) +{ + t_funnel *x; + int i, nslots, nproxies = (int)f1; + int offset = (int)f2; + t_outlet *out; + t_pd **proxies; + if (nproxies < 1) /* CHECKED: one-slot funnel may be created */ + nproxies = FUNNEL_MINSLOTS; + if (!(proxies = (t_pd **)getbytes(nproxies * sizeof(*proxies)))) + return (0); + for (nslots = 0; nslots < nproxies; nslots++) + if (!(proxies[nslots] = pd_new(funnel_proxy_class))) break; + if (!nslots) + { + freebytes(proxies, nproxies * sizeof(*proxies)); + return (0); + } + x = (t_funnel *)pd_new(funnel_class); + x->x_nslots = nslots; + x->x_nproxies = nproxies; + x->x_proxies = proxies; + out = outlet_new((t_object *)x, &s_list); + for (i = 0; i < nslots; i++) + { + t_funnel_proxy *y = (t_funnel_proxy *)proxies[i]; + y->p_out = out; + y->p_id = offset++; + y->p_value = 0; + y->p_size = FUNNEL_INISIZE; + y->p_message = y->p_messini; + y->p_entered = 0; + if (i) inlet_new((t_object *)x, (t_pd *)y, 0, 0); + } + return (x); +} + +void funnel_setup(void) +{ + funnel_class = class_new(gensym("funnel"), + (t_newmethod)funnel_new, + (t_method)funnel_free, + sizeof(t_funnel), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(funnel_class, funnel_bang); + class_addfloat(funnel_class, funnel_float); + class_addlist(funnel_class, funnel_list); + /* CHECKED: funnel doesn't understand symbol, anything */ + funnel_proxy_class = class_new(gensym("_funnel_proxy"), 0, 0, + sizeof(t_funnel_proxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(funnel_proxy_class, funnel_proxy_bang); + class_addfloat(funnel_proxy_class, funnel_proxy_float); + class_addlist(funnel_proxy_class, funnel_proxy_list); + /* CHECKED: funnel doesn't understand symbol, anything */ +} diff --git a/externals/miXed/cyclone/hammer/gate.c b/externals/miXed/cyclone/hammer/gate.c new file mode 100644 index 000000000..d626906bb --- /dev/null +++ b/externals/miXed/cyclone/hammer/gate.c @@ -0,0 +1,149 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" + +#define GATE_MINOUTS 1 +#define GATE_C74MAXOUTS 100 +#define GATE_DEFOUTS 1 + +typedef struct _gate +{ + t_object x_ob; + int x_open; + t_pd *x_proxy; + int x_nouts; /* requested + 1 (as allocated) */ + t_outlet **x_outs; +} t_gate; + +typedef struct _gate_proxy +{ + t_object p_ob; + t_gate *p_master; +} t_gate_proxy; + +static t_class *gate_class; +static t_class *gate_proxy_class; + +static void gate_proxy_bang(t_gate_proxy *x) +{ + t_gate *master = x->p_master; + if (master->x_open) + outlet_bang(master->x_outs[master->x_open]); +} + +static void gate_proxy_float(t_gate_proxy *x, t_float f) +{ + t_gate *master = x->p_master; + if (master->x_open) + outlet_float(master->x_outs[master->x_open], f); +} + +static void gate_proxy_symbol(t_gate_proxy *x, t_symbol *s) +{ + t_gate *master = x->p_master; + if (master->x_open) + outlet_symbol(master->x_outs[master->x_open], s); +} + +static void gate_proxy_pointer(t_gate_proxy *x, t_gpointer *gp) +{ + t_gate *master = x->p_master; + if (master->x_open) + outlet_pointer(master->x_outs[master->x_open], gp); +} + +static void gate_proxy_list(t_gate_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + t_gate *master = x->p_master; + if (master->x_open) + outlet_list(master->x_outs[master->x_open], s, ac, av); +} + +static void gate_proxy_anything(t_gate_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + t_gate *master = x->p_master; + if (master->x_open) + outlet_anything(master->x_outs[master->x_open], s, ac, av); +} + +static void gate_float(t_gate *x, t_float f) +{ + int i = (int)f; + if (i < 0) i = 1; + if (i >= x->x_nouts) i = x->x_nouts - 1; + x->x_open = i; +} + +static void gate_bang(t_gate *x) +{ + outlet_float(x->x_outs[1], x->x_open); +} + +static void gate_free(t_gate *x) +{ + if (x->x_proxy) pd_free(x->x_proxy); + if (x->x_outs) + freebytes(x->x_outs, x->x_nouts * sizeof(*x->x_outs)); +} + +static void *gate_new(t_floatarg f1, t_floatarg f2) +{ + t_gate *x; + int i, nouts = (int)f1; + t_outlet **outs; + t_pd *proxy; + if (nouts < GATE_MINOUTS) + nouts = GATE_DEFOUTS; + if (nouts > GATE_C74MAXOUTS) + fittermax_rangewarning(gate_class, GATE_C74MAXOUTS, "outlets"); + nouts++; /* for convenience (the cost is one pointer) */ + if (!(outs = (t_outlet **)getbytes(nouts * sizeof(*outs)))) + return (0); + if (!(proxy = pd_new(gate_proxy_class))) + { + freebytes(outs, nouts * sizeof(*outs)); + return (0); + } + x = (t_gate *)pd_new(gate_class); + x->x_nouts = nouts; + x->x_outs = outs; + x->x_proxy = proxy; + ((t_gate_proxy *)proxy)->p_master = x; + /* from max sdk manual: ``The dst parameter can be changed (or set to 0) + dynamically with the inlet_to function... The gate object uses this + technique to assign its inlet to one of several outlets, or no outlet + at all.'' We have to use a proxy, because Pd's outlet is not a t_pd + (besides, Pd does not handle inlets with null destination). */ + inlet_new((t_object *)x, proxy, 0, 0); + for (i = 1; i < nouts; i++) + x->x_outs[i] = outlet_new((t_object *)x, &s_anything); + gate_float(x, (f2 > 0 ? f2 : 0)); /* CHECKED */ + return (x); +} + +void gate_setup(void) +{ + gate_class = class_new(gensym("gate"), + (t_newmethod)gate_new, + (t_method)gate_free, + sizeof(t_gate), 0, + A_DEFFLOAT, A_DEFFLOAT, 0); + class_addfloat(gate_class, gate_float); + class_addbang(gate_class, gate_bang); + gate_proxy_class = class_new(gensym("_gate_proxy"), 0, 0, + sizeof(t_gate_proxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addfloat(gate_proxy_class, gate_proxy_float); + class_addbang(gate_proxy_class, gate_proxy_bang); + class_addsymbol(gate_proxy_class, gate_proxy_symbol); + class_addpointer(gate_proxy_class, gate_proxy_pointer); + class_addlist(gate_proxy_class, gate_proxy_list); + class_addanything(gate_proxy_class, gate_proxy_anything); + fitter_setup(gate_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/grab.c b/externals/miXed/cyclone/hammer/grab.c new file mode 100644 index 000000000..2ffc15259 --- /dev/null +++ b/externals/miXed/cyclone/hammer/grab.c @@ -0,0 +1,278 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "unstable/pd_imp.h" +#include "unstable/fragile.h" +#include "common/loud.h" + +/* LATER handle canvas grabbing (bypass) */ +/* LATER check self-grabbing */ +/* LATER fragilize */ + +/* It would be nice to have write access to o_connections field... */ + +struct _outlet +{ + t_object *o_owner; + struct _outlet *o_next; + t_outconnect *o_connections; + t_symbol *o_sym; +}; + +/* ...and to have bindlist traversal routines in Pd API. */ + +static t_class *bindlist_class = 0; + +typedef struct _bindelem +{ + t_pd *e_who; + struct _bindelem *e_next; +} t_bindelem; + +typedef struct _bindlist +{ + t_pd b_pd; + t_bindelem *b_list; +} t_bindlist; + +typedef struct _grab +{ + t_object x_ob; + t_symbol *x_target; + int x_noutlets; /* not counting right one */ + t_outconnect **x_grabcons; /* grabbed connections */ + t_outlet *x_rightout; /* right outlet */ + /* traversal helpers: */ + t_object *x_grabbed; /* currently grabbed object */ + t_outconnect *x_tograbbed; /* a connection to grabbed object */ + int x_ngrabout; /* number of grabbed object's outlets */ + t_bindelem *x_bindelem; +} t_grab; + +static t_class *grab_class; + +static void grab_start(t_grab *x) +{ + x->x_tograbbed = 0; + x->x_bindelem = 0; + if (x->x_target) + { + t_pd *proxy = x->x_target->s_thing; + t_object *ob; + if (proxy && bindlist_class) + { + if (*proxy == bindlist_class) + { + x->x_bindelem = ((t_bindlist *)proxy)->b_list; + while (x->x_bindelem) + { + if (ob = pd_checkobject(x->x_bindelem->e_who)) + { + x->x_tograbbed = + fragile_outlet_connections(ob->ob_outlet); + return; + } + x->x_bindelem = x->x_bindelem->e_next; + } + } + else if (ob = pd_checkobject(proxy)) + x->x_tograbbed = fragile_outlet_connections(ob->ob_outlet); + } + } + else x->x_tograbbed = fragile_outlet_connections(x->x_rightout); +} + +static t_pd *grab_next(t_grab *x) +{ +nextremote: + if (x->x_tograbbed) + { + int inno; + x->x_tograbbed = + fragile_outlet_nextconnection(x->x_tograbbed, &x->x_grabbed, &inno); + if (x->x_grabbed) + { + if (inno) + { + if (x->x_target) + loud_error((t_pd *)x, + "right outlet must feed leftmost inlet"); + else + loud_error((t_pd *)x, + "remote proxy must feed leftmost inlet"); + } + else + { + t_outlet *op; + t_outlet *goutp; + int goutno = x->x_noutlets; + x->x_ngrabout = obj_noutlets(x->x_grabbed); + if (goutno > x->x_ngrabout) goutno = x->x_ngrabout; + while (goutno--) + { + x->x_grabcons[goutno] = + obj_starttraverseoutlet(x->x_grabbed, &goutp, goutno); + goutp->o_connections = + obj_starttraverseoutlet((t_object *)x, &op, goutno); + } + return ((t_pd *)x->x_grabbed); + } + } + } + if (x->x_bindelem) while (x->x_bindelem = x->x_bindelem->e_next) + { + t_object *ob; + if (ob = pd_checkobject(x->x_bindelem->e_who)) + { + x->x_tograbbed = fragile_outlet_connections(ob->ob_outlet); + goto nextremote; + } + } + return (0); +} + +static void grab_restore(t_grab *x) +{ + t_outlet *goutp; + int goutno = x->x_noutlets; + if (goutno > x->x_ngrabout) goutno = x->x_ngrabout; + while (goutno--) + { + obj_starttraverseoutlet(x->x_grabbed, &goutp, goutno); + goutp->o_connections = x->x_grabcons[goutno]; + } +} + +static void grab_bang(t_grab *x) +{ + t_pd *grabbed; + grab_start(x); + while (grabbed = grab_next(x)) + { + pd_bang(grabbed); + grab_restore(x); + } +} + +static void grab_float(t_grab *x, t_float f) +{ + t_pd *grabbed; + grab_start(x); + while (grabbed = grab_next(x)) + { + pd_float(grabbed, f); + grab_restore(x); + } +} + +static void grab_symbol(t_grab *x, t_symbol *s) +{ + t_pd *grabbed; + grab_start(x); + while (grabbed = grab_next(x)) + { + pd_symbol(grabbed, s); + grab_restore(x); + } +} + +static void grab_pointer(t_grab *x, t_gpointer *gp) +{ + t_pd *grabbed; + grab_start(x); + while (grabbed = grab_next(x)) + { + pd_pointer(grabbed, gp); + grab_restore(x); + } +} + +static void grab_list(t_grab *x, t_symbol *s, int ac, t_atom *av) +{ + t_pd *grabbed; + grab_start(x); + while (grabbed = grab_next(x)) + { + pd_list(grabbed, s, ac, av); + grab_restore(x); + } +} + +static void grab_anything(t_grab *x, t_symbol *s, int ac, t_atom *av) +{ + t_pd *grabbed; + grab_start(x); + while (grabbed = grab_next(x)) + { + typedmess(grabbed, s, ac, av); + grab_restore(x); + } +} + +static void grab_set(t_grab *x, t_symbol *s) +{ + if (x->x_target && s && s != &s_) x->x_target = s; +} + +/* LATER use A_GIMME */ +static void *grab_new(t_symbol *s, t_floatarg f) +{ + t_grab *x; + t_outconnect **grabcons; + int i, noutlets = (int)f; + if (noutlets < 1) noutlets = 1; + if (!(grabcons = getbytes(noutlets * sizeof(*grabcons)))) + return (0); + x = (t_grab *)pd_new(grab_class); + x->x_noutlets = noutlets; + x->x_grabcons = grabcons; + while (noutlets--) outlet_new((t_object *)x, &s_anything); + if (s && s != &s_) + { + x->x_target = s; + x->x_rightout = 0; + } + else + { + x->x_target = 0; + x->x_rightout = outlet_new((t_object *)x, &s_anything); + } + return (x); +} + +static void grab_free(t_grab *x) +{ + if (x->x_grabcons) + freebytes(x->x_grabcons, x->x_noutlets * sizeof(*x->x_grabcons)); +} + +void grab_setup(void) +{ + t_symbol *s = gensym("grab"); + grab_class = class_new(s, (t_newmethod)grab_new, + (t_method)grab_free, + sizeof(t_grab), 0, + A_DEFFLOAT, A_DEFSYMBOL, 0); + class_addfloat(grab_class, grab_float); + class_addbang(grab_class, grab_bang); + class_addsymbol(grab_class, grab_symbol); + class_addpointer(grab_class, grab_pointer); + class_addlist(grab_class, grab_list); + class_addanything(grab_class, grab_anything); + class_addmethod(grab_class, (t_method)grab_set, + gensym("set"), A_SYMBOL, 0); + if (!bindlist_class) + { + t_class *c = grab_class; + pd_bind(&grab_class, s); + pd_bind(&c, s); + if (!s->s_thing + || !(bindlist_class = *s->s_thing) + || bindlist_class->c_name != gensym("bindlist")) + error("grab: failure to initialize remote grabbing feature"); + pd_unbind(&c, s); + pd_unbind(&grab_class, s); + } +} diff --git a/externals/miXed/cyclone/hammer/hammer.c b/externals/miXed/cyclone/hammer/hammer.c new file mode 100644 index 000000000..7e0d6e429 --- /dev/null +++ b/externals/miXed/cyclone/hammer/hammer.c @@ -0,0 +1,119 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "unstable/fragile.h" +#include "common/loud.h" +#include "common/port.h" +#include "hammer/file.h" +#include "../build_counter" +void allhammers_setup(void); + +typedef struct _hammer +{ + t_object x_ob; + t_hammerfile *x_filehandle; +} t_hammer; + +static t_class *hammer_class; +static int hammer_firstndx; +static int hammer_lastndx; + +static void hammer_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + int result = import_max(fn->s_name, ""); + outlet_float(((t_object *)z)->ob_outlet, (t_float)result); +} + +static void hammer_doimport(t_hammer *x, t_symbol *fn) +{ + if (fn && fn != &s_) + { + t_symbol *dir = hammerpanel_getopendir(x->x_filehandle); + int result = + import_max(fn->s_name, (dir && dir != &s_ ? dir->s_name : "")); + outlet_float(((t_object *)x)->ob_outlet, (t_float)result); + } + else hammerpanel_open(x->x_filehandle, 0); +} + +static void hammer_click(t_hammer *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + hammer_doimport(x, 0); +} + +static void hammer_import(t_hammer *x, t_symbol *fn) +{ + hammer_doimport(x, fn); +} + +static void hammer_cd(t_hammer *x, t_symbol *dir) +{ + hammerpanel_setopendir(x->x_filehandle, dir); +} + +static void hammer_pwd(t_hammer *x, t_symbol *s) +{ + t_symbol *dir; + if (s && s->s_thing && (dir = hammerpanel_getopendir(x->x_filehandle))) + pd_symbol(s->s_thing, dir); +} + +static void hammer_bang(t_hammer *x) +{ + fragile_class_printnames("hammer classes are: ", + hammer_firstndx, hammer_lastndx); +} + +static void hammer_free(t_hammer *x) +{ + hammerfile_free(x->x_filehandle); +} + +static void *hammer_new(void) +{ + t_hammer *x = (t_hammer *)pd_new(hammer_class); + x->x_filehandle = hammerfile_new((t_pd *)x, 0, hammer_readhook, 0, 0); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void hammer_setup(void) +{ + if (canvas_getcurrent()) + { + /* Loading the library by object creation is banned, because of a danger + of having some of the classes already loaded. LATER rethink. */ + loud_error(0, "apparently an attempt to create a 'hammer' object"); + loud_errand(0, "without having hammer library preloaded"); + return; + } + if (zgetfn(&pd_objectmaker, gensym("hammer"))) + { + loud_error(0, "hammer is already loaded"); + return; + } + if (!zgetfn(&pd_objectmaker, gensym("cyclone"))) + post("this is hammer %s, %s %s build", + CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE); + hammer_class = class_new(gensym("hammer"), + (t_newmethod)hammer_new, + (t_method)hammer_free, + sizeof(t_hammer), 0, 0); + class_addbang(hammer_class, hammer_bang); + class_addmethod(hammer_class, (t_method)hammer_cd, + gensym("cd"), A_DEFSYM, 0); + class_addmethod(hammer_class, (t_method)hammer_pwd, + gensym("pwd"), A_SYMBOL, 0); + class_addmethod(hammer_class, (t_method)hammer_import, + 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); + hammerfile_setup(hammer_class, 0); + hammer_firstndx = fragile_class_count(); + allhammers_setup(); + hammer_lastndx = fragile_class_count() - 1; +} diff --git a/externals/miXed/cyclone/hammer/iter.c b/externals/miXed/cyclone/hammer/iter.c new file mode 100644 index 000000000..0aa5ef80a --- /dev/null +++ b/externals/miXed/cyclone/hammer/iter.c @@ -0,0 +1,112 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is a modified version of Joseph A. Sarlo's code. + The most important changes are listed in "pd-lib-notes.txt" file. */ + +/* LATER compare with iter.c from max sdk */ +/* LATER clean up buffer handling */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" + +#define ITER_INISIZE 8 /* LATER rethink */ + +typedef struct _iter +{ + t_object x_ob; + int x_size; /* as allocated */ + int x_natoms; /* as used */ + t_symbol *x_selector; + t_atom *x_message; + t_atom x_messini[ITER_INISIZE]; +} t_iter; + +static t_class *iter_class; + +/* CHECKED: both floats and symbols */ +static void iter_dobang(t_iter *x, t_symbol *s, int ac, t_atom *av) +{ + if (s && s != &s_) + outlet_symbol(((t_object *)x)->ob_outlet, s); + while (ac--) + { + if (av->a_type == A_FLOAT) + outlet_float(((t_object *)x)->ob_outlet, av->a_w.w_float); + else if (av->a_type == A_SYMBOL) + outlet_symbol(((t_object *)x)->ob_outlet, av->a_w.w_symbol); + av++; + } +} + +static void iter_bang(t_iter *x) +{ + iter_dobang(x, x->x_selector, x->x_natoms, x->x_message); +} + +static void iter_float(t_iter *x, t_float f) +{ + outlet_float(((t_object *)x)->ob_outlet, f); + x->x_selector = 0; + x->x_natoms = 1; + SETFLOAT(x->x_message, f); +} + +/* CHECKME */ +static void iter_symbol(t_iter *x, t_symbol *s) +{ + outlet_symbol(((t_object *)x)->ob_outlet, s); + x->x_selector = 0; + x->x_natoms = 1; + SETSYMBOL(x->x_message, s); +} + +/* LATER gpointer */ + +static void iter_anything(t_iter *x, t_symbol *s, int ac, t_atom *av) +{ + iter_dobang(x, s, ac, av); + x->x_selector = s; + if (ac > x->x_size) + x->x_message = grow_nodata(&ac, &x->x_size, x->x_message, + ITER_INISIZE, x->x_messini, + sizeof(*x->x_message)); + x->x_natoms = ac; + memcpy(x->x_message, av, ac * sizeof(*x->x_message)); +} + +static void iter_list(t_iter *x, t_symbol *s, int ac, t_atom *av) +{ + iter_anything(x, 0, ac, av); +} + +static void iter_free(t_iter *x) +{ + if (x->x_message != x->x_messini) + freebytes(x->x_message, x->x_natoms * sizeof(*x->x_message)); +} + +static void *iter_new(void) +{ + t_iter *x = (t_iter *)pd_new(iter_class); + x->x_size = ITER_INISIZE; + x->x_natoms = 0; + x->x_message = x->x_messini; + outlet_new((t_object *)x, &s_anything); + return (x); +} + +void iter_setup(void) +{ + iter_class = class_new(gensym("iter"), + (t_newmethod)iter_new, + (t_method)iter_free, + sizeof(t_iter), 0, 0); + class_addbang(iter_class, iter_bang); + class_addfloat(iter_class, iter_float); + class_addsymbol(iter_class, iter_symbol); + class_addlist(iter_class, iter_list); + class_addanything(iter_class, iter_anything); +} diff --git a/externals/miXed/cyclone/hammer/loadmess.c b/externals/miXed/cyclone/hammer/loadmess.c new file mode 100644 index 000000000..87bbf30bb --- /dev/null +++ b/externals/miXed/cyclone/hammer/loadmess.c @@ -0,0 +1,247 @@ +/* Copyright (c) 2000-2006 Thomas Musil @ IEM KUG Graz Austria + Copyright (c) 2010 Joel Matthys + Copyright (c) 2016 Marco Matteo Markidis + */ + +#include <string.h> + +#include "m_pd.h" +#include "hammer/file.h" + +#define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER) +#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT) +#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL) +#define IS_A_DOLLAR(atom,index) ((atom+index)->a_type == A_DOLLAR) +#define IS_A_DOLLSYM(atom,index) ((atom+index)->a_type == A_DOLLSYM) +#define IS_A_SEMI(atom,index) ((atom+index)->a_type == A_SEMI) +#define IS_A_COMMA(atom,index) ((atom+index)->a_type == A_COMMA) + +#ifdef MSW +int sys_noloadbang; +#else +extern int sys_noloadbang; +#endif + +static t_class *loadmess_class; + +typedef struct _loadmess +{ + t_object x_obj; + t_int x_n; + t_int x_ac; + t_atom *x_at; + t_symbol *x_sym; + t_atomtype x_type; + t_canvas *x_canvas; + t_hammerfile *x_filehandle; + t_int defer; + t_clock *x_clock; + t_int tempo; +} t_loadmess; + +static void loadmess_bang(t_loadmess *x) +{ + if(x->x_type == A_FLOAT) + outlet_float(x->x_obj.ob_outlet, atom_getfloat(x->x_at)); + else if(x->x_type == A_SYMBOL) + outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(x->x_at)); + else if(x->x_type == A_NULL) + outlet_bang(x->x_obj.ob_outlet); + else if(x->x_type == A_COMMA) + outlet_anything(x->x_obj.ob_outlet, x->x_sym, x->x_ac, x->x_at); + else if(x->x_type == A_GIMME) + outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac, x->x_at); + else if(x->x_type == A_POINTER) + outlet_pointer(x->x_obj.ob_outlet, (t_gpointer *)x->x_at->a_w.w_gpointer); +} + +static void loadmess_loadbang(t_loadmess *x) +{ + if(!sys_noloadbang) { + if(!x->defer) + loadmess_bang(x); + else clock_delay(x->x_clock, x->defer); + } + else clock_unset(x->x_clock); +} + +static void loadmess_defer(t_loadmess *x) +{ + loadmess_bang(x); +} + +static void loadmess_set(t_loadmess *x, t_symbol *s, int ac, t_atom *av) +{ + /* t_atom *at; */ + t_int i; + + /* x->x_type = A_GIMME; */ + /* x->x_sym = &s_list; */ + /* while(ac--) */ + /* *at++ = *av++; */ + x->x_type = A_NULL; + if(ac==0) + { + x->x_type = A_NULL; + x->x_sym = &s_bang; + x->x_n = 1; + x->x_ac = 0; + x->x_at = (t_atom *)getbytes(x->x_n * sizeof(t_atom)); + } + else if(ac == 1) + { + if(IS_A_SYMBOL(av,0)) + { + x->x_type = A_COMMA; + x->x_sym = atom_getsymbol(av); + x->x_n = 1; + x->x_ac = 0; + x->x_at = (t_atom *)getbytes(x->x_n * sizeof(t_atom)); + } + else + { + if(IS_A_FLOAT(av,0)) + { + x->x_type = A_FLOAT; + x->x_sym = &s_float; + } + else if(IS_A_POINTER(av,0)) + { + x->x_type = A_POINTER; + x->x_sym = &s_pointer; + } + x->x_n = x->x_ac = 1; + x->x_at = (t_atom *)getbytes(x->x_n * sizeof(t_atom)); + x->x_at[0] = *av; + } + } + else + { + x->x_type = A_COMMA;/*outlet_anything*/ + if(IS_A_SYMBOL(av,0)) { + x->x_sym = atom_getsymbol(av++); + ac--; + } + else + { + x->x_sym = &s_list; + } + x->x_n = x->x_ac = ac; + x->x_at = (t_atom *)getbytes(x->x_n * sizeof(t_atom)); + for(i=0;i<ac;i++) + x->x_at[i] = av[i]; + } + +} + +static void loadmess_click(t_loadmess *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + loadmess_bang(x); +} + +static void loadmess_free(t_loadmess *x) +{ + if(x->x_at) + freebytes(x->x_at, x->x_n * sizeof(t_atom)); + hammerfile_free(x->x_filehandle); + clock_free(x->x_clock); +} + +static void *loadmess_new(t_symbol *s, int ac, t_atom *av) +{ + t_loadmess *x = (t_loadmess *)pd_new(loadmess_class); + int i; + x->defer = 0; + + x->x_type = A_NULL; + if(ac==0) + { + x->x_type = A_NULL; + x->x_sym = &s_bang; + x->x_n = 1; + x->x_ac = 0; + x->x_at = (t_atom *)getbytes(x->x_n * sizeof(t_atom)); + } + else if(ac == 1) + { + if(IS_A_SYMBOL(av,0)) + { + x->x_type = A_COMMA; + x->x_sym = atom_getsymbol(av); + x->x_n = 1; + x->x_ac = 0; + x->x_at = (t_atom *)getbytes(x->x_n * sizeof(t_atom)); + } + else + { + if(IS_A_FLOAT(av,0)) + { + x->x_type = A_FLOAT; + x->x_sym = &s_float; + } + else if(IS_A_POINTER(av,0)) + { + x->x_type = A_POINTER; + x->x_sym = &s_pointer; + } + x->x_n = x->x_ac = 1; + x->x_at = (t_atom *)getbytes(x->x_n * sizeof(t_atom)); + x->x_at[0] = *av; + } + } + else + { + x->x_type = A_COMMA;/*outlet_anything*/ + if(IS_A_SYMBOL(av,0)) { + x->x_sym = atom_getsymbol(av++); + ac--; + } + else + { + x->x_sym = &s_list; + } + x->x_n = x->x_ac = ac; + x->x_at = (t_atom *)getbytes(x->x_n * sizeof(t_atom)); + for(i=0;i<ac;i++) { + t_symbol *firstarg = atom_getsymbolarg(i,ac,av); + if(strcmp(firstarg->s_name,"@defer")!=0) { + x->x_at[i] = av[i]; + } + else { + t_int defer = atom_getintarg(i+1,ac,av); + switch (defer) { + case 0: + break; + case 1: + x->defer = 10; + break; + default: + pd_error(x,"Defer attribute must be 0 or 1"); + x->defer = 0; + break; + } + x->x_n = x->x_ac = ac-2; + x->x_at = (t_atom *)t_resizebytes(x->x_at,sizeof(t_atom)*(x->x_n+2),sizeof(t_atom)*x->x_n); + i = ac; + } + } + } + outlet_new(&x->x_obj, &s_list); + x->x_canvas = canvas_getcurrent(); + x->x_filehandle = hammerfile_new((t_pd *)x,0,0,0,0); + x->x_clock = clock_new(x,(t_method)loadmess_defer); + return (x); +} + +void loadmess_setup(void) +{ + loadmess_class = class_new(gensym("loadmess"), (t_newmethod)loadmess_new, + (t_method)loadmess_free, sizeof(t_loadmess), 0, A_GIMME, 0); + class_addmethod(loadmess_class, (t_method)loadmess_loadbang, gensym("loadbang"), 0); + class_addmethod(loadmess_class, (t_method)loadmess_set, gensym("set"),A_GIMME,0); + class_addbang(loadmess_class, (t_method)loadmess_bang); + class_addmethod(loadmess_class, (t_method)loadmess_click, gensym("click"), + A_FLOAT,A_FLOAT,A_FLOAT,A_FLOAT,A_FLOAT,0); + hammerfile_setup(loadmess_class,0); +} diff --git a/externals/miXed/cyclone/hammer/match.c b/externals/miXed/cyclone/hammer/match.c new file mode 100644 index 000000000..d5b03c7dd --- /dev/null +++ b/externals/miXed/cyclone/hammer/match.c @@ -0,0 +1,216 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER compare with match.c from max sdk */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" + +#define MATCH_INISIZE 8 /* LATER rethink */ + +typedef struct _match +{ + t_object x_ob; + int x_size; /* as allocated */ + int x_patlen; /* as used */ + t_atom *x_pattern; + t_atom x_patini[MATCH_INISIZE]; + int x_quelen; + t_atom *x_queue; + t_atom x_queini[MATCH_INISIZE]; + t_atom *x_queend; + t_atom *x_queptr; /* writing head, post-incremented (oldest-pointing) */ +} t_match; + +static t_class *match_class; + +static void match_clear(t_match *x) +{ + x->x_quelen = 0; + x->x_queptr = x->x_queue; +} + +/* x->x_patlen > 0 is assumed */ +/* LATER use a lock to disable reentrant calls. I do not see any + purpose of reentering match, but lets CHECKME first... */ +static void match_checkin(t_match *x) +{ + int i, patlen = x->x_patlen; + t_atom *queptr, *pp, *qp; + if (x->x_queptr >= x->x_queend) + x->x_queptr = x->x_queue; + else x->x_queptr++; + if (x->x_quelen < patlen && ++(x->x_quelen) < patlen) + return; + + qp = queptr = x->x_queptr; + for (i = 0, pp = x->x_pattern; i < patlen; i++, pp++) + { + if (pp->a_type == A_FLOAT) + { + if (qp->a_type != A_FLOAT || qp->a_w.w_float != pp->a_w.w_float) + break; + } + else if (pp->a_type == A_SYMBOL) + { + if (qp->a_type != A_SYMBOL || qp->a_w.w_symbol != pp->a_w.w_symbol) + break; + } + else if (pp->a_type == A_NULL) + { + if (qp->a_type == A_FLOAT || qp->a_type == A_SYMBOL) + { + /* instantiating a pattern */ + *pp = *qp; + qp->a_type = A_NULL; + } + else break; /* LATER rethink */ + } + else break; /* LATER rethink */ + if (qp >= x->x_queend) + qp = x->x_queue; + else qp++; + } + if (i == patlen) + { + pp = x->x_pattern; + if (pp->a_type == A_FLOAT) + { + if (patlen == 1) + outlet_float(((t_object *)x)->ob_outlet, pp->a_w.w_float); + else + outlet_list(((t_object *)x)->ob_outlet, &s_list, patlen, pp); + } + else /* assuming A_SYMBOL (see above) */ + { + if (pp->a_w.w_symbol == &s_symbol /* bypassing typedmess() */ + && patlen == 2 && pp[1].a_type == A_SYMBOL) + outlet_symbol(((t_object *)x)->ob_outlet, pp[1].a_w.w_symbol); + else + outlet_anything(((t_object *)x)->ob_outlet, pp->a_w.w_symbol, + patlen - 1, pp + 1); + } + /* CHECKED: no implicit clear (resolving overlapping patterns) */ + } + /* restoring a pattern */ + for (i = 0, pp = x->x_pattern; i < patlen; i++, pp++) + { + if (queptr->a_type == A_NULL) + { + queptr->a_type = pp->a_type; + pp->a_type = A_NULL; + } + if (queptr >= x->x_queend) + queptr = x->x_queue; + else queptr++; + } +} + +static void match_float(t_match *x, t_float f) +{ + if (x->x_patlen) + { + SETFLOAT(x->x_queptr, f); + match_checkin(x); + } +} + +static void match_symbol(t_match *x, t_symbol *s) +{ + if (s && s != &s_ && x->x_patlen) + { + SETSYMBOL(x->x_queptr, s); + match_checkin(x); + } +} + +/* LATER gpointer */ + +static void match_list(t_match *x, t_symbol *s, int ac, t_atom *av) +{ + while (ac--) + { + if (av->a_type == A_FLOAT) match_float(x, av->a_w.w_float); + else if (av->a_type == A_SYMBOL) match_symbol(x, av->a_w.w_symbol); + av++; + } +} + +static void match_anything(t_match *x, t_symbol *s, int ac, t_atom *av) +{ + match_symbol(x, s); + match_list(x, 0, ac, av); +} + +static void match_set(t_match *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac) /* CHECKED */ + { + t_atom *pp; + t_symbol *ps_nn; + int newlen = ac * 2; + if (newlen > x->x_size) + { + x->x_pattern = grow_nodata(&newlen, &x->x_size, x->x_pattern, + MATCH_INISIZE * 2, x->x_patini, + sizeof(*x->x_pattern)); + if (newlen == MATCH_INISIZE * 2) + { + x->x_queue = x->x_queini; + ac = MATCH_INISIZE; + } + else x->x_queue = x->x_pattern + x->x_size / 2; + } + x->x_patlen = ac; + x->x_queend = x->x_queue + ac - 1; + match_clear(x); /* CHECKED */ + memcpy(x->x_pattern, av, ac * sizeof(*x->x_pattern)); + pp = x->x_pattern; + ps_nn = gensym("nn"); + while (ac--) + { + if (pp->a_type == A_SYMBOL && pp->a_w.w_symbol == ps_nn) + pp->a_type = A_NULL; + pp++; + } + } +} + +static void match_free(t_match *x) +{ + if (x->x_pattern != x->x_patini) + freebytes(x->x_pattern, 2 * x->x_size * sizeof(*x->x_pattern)); +} + +static void *match_new(t_symbol *s, int ac, t_atom *av) +{ + t_match *x = (t_match *)pd_new(match_class); + x->x_size = MATCH_INISIZE * 2; + x->x_patlen = 0; + x->x_pattern = x->x_patini; + x->x_queue = x->x_queini; + /* x->x_queend is not used unless x->x_patlen > 0, + LATER consider chosing a more defensive way... */ + outlet_new((t_object *)x, &s_anything); + match_clear(x); + match_set(x, 0, ac, av); + return (x); +} + +void match_setup(void) +{ + match_class = class_new(gensym("match"), + (t_newmethod)match_new, + (t_method)match_free, + sizeof(t_match), 0, A_GIMME, 0); + class_addfloat(match_class, match_float); + class_addsymbol(match_class, match_symbol); + class_addlist(match_class, match_list); + class_addanything(match_class, match_anything); + class_addmethod(match_class, (t_method)match_set, + gensym("set"), A_GIMME, 0); + class_addmethod(match_class, (t_method)match_clear, + gensym("clear"), 0); +} diff --git a/externals/miXed/cyclone/hammer/maximum.c b/externals/miXed/cyclone/hammer/maximum.c new file mode 100644 index 000000000..42ab22d70 --- /dev/null +++ b/externals/miXed/cyclone/hammer/maximum.c @@ -0,0 +1,93 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" + +#define MAXIMUM_C74MAXITEMS 256 + +typedef struct _maximum +{ + t_object x_ob; + t_float x_last; + t_float x_test; +} t_maximum; + +static t_class *maximum_class; + +static void maximum_bang(t_maximum *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_last); +} + +static void maximum_float(t_maximum *x, t_float f) +{ + outlet_float(((t_object *)x)->ob_outlet, + x->x_last = (f > x->x_test ? f : x->x_test)); +} + +static void maximum_list(t_maximum *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac > MAXIMUM_C74MAXITEMS) + fittermax_rangewarning(*(t_pd *)x, MAXIMUM_C74MAXITEMS, "items"); + while (ac && av->a_type != A_FLOAT) ac--, av++; /* CHECKME (a warning?) */ + if (ac) + { + t_float fpick = av->a_w.w_float; + ac--; av++; + while (ac && av->a_type != A_FLOAT) ac--, av++; /* CHECKME */ + if (ac) + { + t_float fnext, f = av->a_w.w_float; + if (f > fpick) + { + fnext = fpick; + fpick = f; + } + else fnext = f; + ac--; av++; + while (ac--) + { + if (av->a_type == A_FLOAT) + { + f = av->a_w.w_float; + if (f > fpick) + { + fnext = fpick; + fpick = f; + } + else if (f > fnext) fnext = f; + } + /* CHECKME else */ + av++; + } + x->x_test = fnext; + outlet_float(((t_object *)x)->ob_outlet, x->x_last = fpick); + } + else maximum_float(x, fpick); /* CHECKME */ + } + /* CHECKME else */ +} + +static void *maximum_new(t_floatarg f) +{ + t_maximum *x = (t_maximum *)pd_new(maximum_class); + x->x_last = 0; /* CHECKME */ + x->x_test = f; + floatinlet_new((t_object *)x, &x->x_test); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void maximum_setup(void) +{ + maximum_class = class_new(gensym("maximum"), + (t_newmethod)maximum_new, 0, + sizeof(t_maximum), 0, A_DEFFLOAT, 0); + class_addbang(maximum_class, maximum_bang); + class_addfloat(maximum_class, maximum_float); + class_addlist(maximum_class, maximum_list); + fitter_setup(maximum_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/mean.c b/externals/miXed/cyclone/hammer/mean.c new file mode 100644 index 000000000..13d69ffcd --- /dev/null +++ b/externals/miXed/cyclone/hammer/mean.c @@ -0,0 +1,79 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _mean +{ + t_object x_ob; + double x_accum; + unsigned x_count; + t_float x_mean; + t_outlet *x_countout; +} t_mean; + +static t_class *mean_class; + +static void mean_clear(t_mean *x) +{ + x->x_accum = 0; + x->x_count = 0; + x->x_mean = 0; +} + +static void mean_bang(t_mean *x) +{ + /* CHECKED: count is always sent (first) */ + outlet_float(x->x_countout, x->x_count); + outlet_float(((t_object *)x)->ob_outlet, x->x_mean); +} + +static void mean_float(t_mean *x, t_float f) +{ + x->x_accum += f; + if (++x->x_count) + x->x_mean = (t_float)(x->x_accum / (double)x->x_count); + else mean_clear(x); + mean_bang(x); +} + +static void mean_list(t_mean *x, t_symbol *s, int ac, t_atom *av) +{ + mean_clear(x); + while (ac--) + { + if (av->a_type == A_FLOAT) + { + x->x_accum += av->a_w.w_float; + x->x_count++; + } + av++; + } + if (x->x_count) + x->x_mean = (t_float)(x->x_accum / (double)x->x_count); + else mean_clear(x); + mean_bang(x); + /* CHECKED: no clear after list -- subsequent floats are added */ +} + +static void *mean_new(void) +{ + t_mean *x = (t_mean *)pd_new(mean_class); + mean_clear(x); + outlet_new((t_object *)x, &s_float); + x->x_countout = outlet_new((t_object *)x, &s_float); + return (x); +} + +void mean_setup(void) +{ + mean_class = class_new(gensym("mean"), + (t_newmethod)mean_new, 0, + sizeof(t_mean), 0, 0); + class_addbang(mean_class, mean_bang); + class_addfloat(mean_class, mean_float); + class_addlist(mean_class, mean_list); + class_addmethod(mean_class, (t_method)mean_clear, + gensym("clear"), 0); +} diff --git a/externals/miXed/cyclone/hammer/midiflush.c b/externals/miXed/cyclone/hammer/midiflush.c new file mode 100644 index 000000000..592d9e081 --- /dev/null +++ b/externals/miXed/cyclone/hammer/midiflush.c @@ -0,0 +1,102 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" + +#define MIDIFLUSH_NCHANNELS 16 +#define MIDIFLUSH_NPITCHES 128 +#define MIDIFLUSH_VOIDPITCH 0xFF + +typedef struct _midiflush +{ + t_object x_ob; + unsigned char x_status; + unsigned char x_channel; + unsigned char x_pitch; + unsigned char x_notes[MIDIFLUSH_NCHANNELS][MIDIFLUSH_NPITCHES]; +} t_midiflush; + +static t_class *midiflush_class; + +static void midiflush_float(t_midiflush *x, t_float f) +{ + int ival = (int)f; + if (ival >= 0 && ival < 256) + { + unsigned char bval = ival; + outlet_float(((t_object *)x)->ob_outlet, bval); + if (bval & 0x80) + { + x->x_status = bval & 0xF0; + if (x->x_status == 0x80 || x->x_status == 0x90) + x->x_channel = bval & 0x0F; + else + x->x_status = 0; + } + else if (x->x_status) + { + if (x->x_pitch == MIDIFLUSH_VOIDPITCH) + { + x->x_pitch = bval; + return; + } + else if (x->x_status == 0x90 && bval) + { + x->x_notes[x->x_channel][x->x_pitch]++; + } + else + { + x->x_notes[x->x_channel][x->x_pitch]--; + } + } + } + x->x_pitch = MIDIFLUSH_VOIDPITCH; +} + +static void midiflush_bang(t_midiflush *x) +{ + int chn, pch; + for (chn = 0; chn < MIDIFLUSH_NCHANNELS; chn++) + { + for (pch = 0; pch < MIDIFLUSH_NPITCHES; pch++) + { + int status = 0x090 | chn; + while (x->x_notes[chn][pch]) + { + outlet_float(((t_object *)x)->ob_outlet, status); + outlet_float(((t_object *)x)->ob_outlet, pch); + outlet_float(((t_object *)x)->ob_outlet, 0); + x->x_notes[chn][pch]--; + } + } + } +} + +static void midiflush_clear(t_midiflush *x) +{ + memset(x->x_notes, 0, sizeof(x->x_notes)); +} + +static void *midiflush_new(void) +{ + t_midiflush *x = (t_midiflush *)pd_new(midiflush_class); + x->x_status = 0; /* `not a note' */ + x->x_pitch = MIDIFLUSH_VOIDPITCH; + midiflush_clear(x); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void midiflush_setup(void) +{ + midiflush_class = class_new(gensym("midiflush"), + (t_newmethod)midiflush_new, + 0, /* CHECKED: no flushout */ + sizeof(t_midiflush), 0, 0); + class_addfloat(midiflush_class, midiflush_float); + class_addbang(midiflush_class, midiflush_bang); + class_addmethod(midiflush_class, (t_method)midiflush_clear, + gensym("clear"), 0); +} diff --git a/externals/miXed/cyclone/hammer/midiformat.c b/externals/miXed/cyclone/hammer/midiformat.c new file mode 100644 index 000000000..fa0612ba8 --- /dev/null +++ b/externals/miXed/cyclone/hammer/midiformat.c @@ -0,0 +1,112 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _midiformat +{ + t_object x_ob; + t_float x_channel; +} t_midiformat; + +static t_class *midiformat_class; + +static int midiformat_channel(t_midiformat *x) +{ + int ch = (int)x->x_channel; + return (ch > 0 ? (ch - 1) & 0x0F : 0); +} + +static void midiformat_note(t_midiformat *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac >= 2 && av[0].a_type == A_FLOAT && av[1].a_type == A_FLOAT) + { + int pitch = (int)av[0].a_w.w_float; /* CHECKED: anything goes */ + int velocity = (int)av[1].a_w.w_float; + outlet_float(((t_object *)x)->ob_outlet, 0x90 | midiformat_channel(x)); + outlet_float(((t_object *)x)->ob_outlet, pitch); + outlet_float(((t_object *)x)->ob_outlet, velocity); + } +} + +static void midiformat_polytouch(t_midiformat *x, + t_symbol *s, int ac, t_atom *av) +{ + if (ac >= 2 && av[0].a_type == A_FLOAT && av[1].a_type == A_FLOAT) + { + int touch = (int)av[0].a_w.w_float; + int key = (int)av[1].a_w.w_float; + outlet_float(((t_object *)x)->ob_outlet, 0xA0 | midiformat_channel(x)); + outlet_float(((t_object *)x)->ob_outlet, key); + outlet_float(((t_object *)x)->ob_outlet, touch); + } +} + +static void midiformat_controller(t_midiformat *x, + t_symbol *s, int ac, t_atom *av) +{ + if (ac >= 2 && av[0].a_type == A_FLOAT && av[1].a_type == A_FLOAT) + { + int val = (int)av[0].a_w.w_float; + int ctl = (int)av[1].a_w.w_float; + outlet_float(((t_object *)x)->ob_outlet, 0xB0 | midiformat_channel(x)); + outlet_float(((t_object *)x)->ob_outlet, ctl); + outlet_float(((t_object *)x)->ob_outlet, val); + } +} + +static void midiformat_program(t_midiformat *x, t_floatarg f) +{ + int pgm = (int)f; + outlet_float(((t_object *)x)->ob_outlet, 0xC0 | midiformat_channel(x)); + outlet_float(((t_object *)x)->ob_outlet, pgm); +} + +static void midiformat_touch(t_midiformat *x, t_floatarg f) +{ + int touch = (int)f; + outlet_float(((t_object *)x)->ob_outlet, 0xD0 | midiformat_channel(x)); + outlet_float(((t_object *)x)->ob_outlet, touch); +} + +static void midiformat_bend(t_midiformat *x, t_floatarg f) +{ + int val = (int)f; + outlet_float(((t_object *)x)->ob_outlet, 0xE0 | midiformat_channel(x)); + outlet_float(((t_object *)x)->ob_outlet, 0); + outlet_float(((t_object *)x)->ob_outlet, val); +} + +static void *midiformat_new(t_floatarg f) +{ + t_midiformat *x = (t_midiformat *)pd_new(midiformat_class); + x->x_channel = f; + inlet_new((t_object *)x, (t_pd *)x, &s_list, gensym("lst1")); + inlet_new((t_object *)x, (t_pd *)x, &s_list, gensym("lst2")); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft3")); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft4")); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft5")); + floatinlet_new((t_object *)x, &x->x_channel); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void midiformat_setup(void) +{ + midiformat_class = class_new(gensym("midiformat"), + (t_newmethod)midiformat_new, 0, + sizeof(t_midiformat), 0, + A_DEFFLOAT, 0); + class_addlist(midiformat_class, midiformat_note); + class_addmethod(midiformat_class, (t_method)midiformat_polytouch, + gensym("lst1"), A_GIMME, 0); + class_addmethod(midiformat_class, (t_method)midiformat_controller, + gensym("lst2"), A_GIMME, 0); + class_addmethod(midiformat_class, (t_method)midiformat_program, + gensym("ft3"), A_FLOAT, 0); + class_addmethod(midiformat_class, (t_method)midiformat_touch, + gensym("ft4"), A_FLOAT, 0); + class_addmethod(midiformat_class, (t_method)midiformat_bend, + gensym("ft5"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/hammer/midiparse.c b/externals/miXed/cyclone/hammer/midiparse.c new file mode 100644 index 000000000..9a79a3922 --- /dev/null +++ b/externals/miXed/cyclone/hammer/midiparse.c @@ -0,0 +1,132 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _midiparse +{ + t_object x_ob; + unsigned char x_ready; + unsigned char x_status; + unsigned char x_channel; + unsigned char x_data1; + t_outlet *x_polyout; + t_outlet *x_ctlout; + t_outlet *x_pgmout; + t_outlet *x_touchout; + t_outlet *x_bendout; + t_outlet *x_chanout; +} t_midiparse; + +static t_class *midiparse_class; + +static void midiparse_clear(t_midiparse *x) +{ + x->x_status = 0; + x->x_ready = 0; +} + +static void midiparse_float(t_midiparse *x, t_float f) +{ + int ival = (int)f; /* CHECKED */ + if (ival < 0) + { + /* CHECKME */ + return; + } + if (ival < 256) /* CHECKED clear if input over 255 */ + { + unsigned char bval = ival; + if (bval & 0x80) + { + unsigned char status = bval & 0xF0; + if (status == 0xF0) + { + /* CHECKED no such test in max -- this is incompatible, + but real-time messages are out-of-band, and they + should be ignored here. LATER rethink the 0xFE case. */ + if (bval < 0xF8) + midiparse_clear(x); + } + else + { + x->x_status = status; + x->x_channel = bval & 0x0F; + x->x_ready = (status == 0xC0 || status == 0xD0); + } + } + else if (x->x_ready) + { + t_atom at[2]; + x->x_ready = 0; + outlet_float(x->x_chanout, x->x_channel + 1); + switch (x->x_status) + { + case 0x80: + SETFLOAT(&at[0], x->x_data1); + SETFLOAT(&at[1], 0); + outlet_list(((t_object *)x)->ob_outlet, 0, 2, at); + break; + case 0x90: + SETFLOAT(&at[0], x->x_data1); + SETFLOAT(&at[1], bval); + outlet_list(((t_object *)x)->ob_outlet, 0, 2, at); + break; + case 0xA0: + SETFLOAT(&at[0], bval); + SETFLOAT(&at[1], x->x_data1); + outlet_list(x->x_polyout, 0, 2, at); + break; + case 0xB0: + SETFLOAT(&at[0], bval); + SETFLOAT(&at[1], x->x_data1); + outlet_list(x->x_ctlout, 0, 2, at); + break; + case 0xC0: + outlet_float(x->x_pgmout, bval); + x->x_ready = 1; + break; + case 0xD0: + outlet_float(x->x_touchout, bval); + x->x_ready = 1; + break; + case 0xE0: + /* CHECKED: ignores data1 */ + outlet_float(x->x_bendout, bval); + break; + default:; + } + } + else if (x->x_status) + { + x->x_data1 = bval; /* CHECKED key #0 accepted */ + x->x_ready = 1; + } + } + else midiparse_clear(x); +} + +static void *midiparse_new(void) +{ + t_midiparse *x = (t_midiparse *)pd_new(midiparse_class); + outlet_new((t_object *)x, &s_list); + x->x_polyout = outlet_new((t_object *)x, &s_list); + x->x_ctlout = outlet_new((t_object *)x, &s_list); + x->x_pgmout = outlet_new((t_object *)x, &s_float); + x->x_touchout = outlet_new((t_object *)x, &s_float); + x->x_bendout = outlet_new((t_object *)x, &s_float); + x->x_chanout = outlet_new((t_object *)x, &s_float); + midiparse_clear(x); + return (x); +} + +void midiparse_setup(void) +{ + midiparse_class = class_new(gensym("midiparse"), + (t_newmethod)midiparse_new, 0, + sizeof(t_midiparse), 0, 0); + class_addbang(midiparse_class, midiparse_clear); + class_addfloat(midiparse_class, midiparse_float); + /* CHECKED autocasting lists to floats */ +} diff --git a/externals/miXed/cyclone/hammer/minimum.c b/externals/miXed/cyclone/hammer/minimum.c new file mode 100644 index 000000000..c6797999b --- /dev/null +++ b/externals/miXed/cyclone/hammer/minimum.c @@ -0,0 +1,93 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" + +#define MINIMUM_C74MAXITEMS 256 + +typedef struct _minimum +{ + t_object x_ob; + t_float x_last; + t_float x_test; +} t_minimum; + +static t_class *minimum_class; + +static void minimum_bang(t_minimum *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_last); +} + +static void minimum_float(t_minimum *x, t_float f) +{ + outlet_float(((t_object *)x)->ob_outlet, + x->x_last = (f < x->x_test ? f : x->x_test)); +} + +static void minimum_list(t_minimum *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac > MINIMUM_C74MAXITEMS) + fittermax_rangewarning(*(t_pd *)x, MINIMUM_C74MAXITEMS, "items"); + while (ac && av->a_type != A_FLOAT) ac--, av++; /* CHECKME (a warning?) */ + if (ac) + { + t_float fpick = av->a_w.w_float; + ac--; av++; + while (ac && av->a_type != A_FLOAT) ac--, av++; /* CHECKME */ + if (ac) + { + t_float fnext, f = av->a_w.w_float; + if (f < fpick) + { + fnext = fpick; + fpick = f; + } + else fnext = f; + ac--; av++; + while (ac--) + { + if (av->a_type == A_FLOAT) + { + f = av->a_w.w_float; + if (f < fpick) + { + fnext = fpick; + fpick = f; + } + else if (f < fnext) fnext = f; + } + /* CHECKME else */ + av++; + } + x->x_test = fnext; + outlet_float(((t_object *)x)->ob_outlet, x->x_last = fpick); + } + else minimum_float(x, fpick); /* CHECKME */ + } + /* CHECKME else */ +} + +static void *minimum_new(t_floatarg f) +{ + t_minimum *x = (t_minimum *)pd_new(minimum_class); + x->x_last = 0; /* CHECKME */ + x->x_test = f; + floatinlet_new((t_object *)x, &x->x_test); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void minimum_setup(void) +{ + minimum_class = class_new(gensym("minimum"), + (t_newmethod)minimum_new, 0, + sizeof(t_minimum), 0, A_DEFFLOAT, 0); + class_addbang(minimum_class, minimum_bang); + class_addfloat(minimum_class, minimum_float); + class_addlist(minimum_class, minimum_list); + fitter_setup(minimum_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/mousefilter.c b/externals/miXed/cyclone/hammer/mousefilter.c new file mode 100644 index 000000000..e2e3cc559 --- /dev/null +++ b/externals/miXed/cyclone/hammer/mousefilter.c @@ -0,0 +1,70 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "hammer/gui.h" + +typedef struct _mousefilter +{ + t_object x_ob; + int x_isup; + int x_ispending; + t_float x_value; +} t_mousefilter; + +static t_class *mousefilter_class; + +static void mousefilter_float(t_mousefilter *x, t_float f) +{ + if (x->x_isup) + outlet_float(((t_object *)x)->ob_outlet, f); + else + { + x->x_ispending = 1; + x->x_value = f; + } +} + +static void mousefilter_anything(t_mousefilter *x, + t_symbol *s, int ac, t_atom *av) +{ + /* dummy method, filtering out those messages from gui, + which are not handled explicitly */ +} + +static void mousefilter_doup(t_mousefilter *x, t_floatarg f) +{ + if ((x->x_isup = (int)f) && x->x_ispending) + { + x->x_ispending = 0; + outlet_float(((t_object *)x)->ob_outlet, x->x_value); + } +} + +static void mousefilter_free(t_mousefilter *x) +{ + hammergui_unbindmouse((t_pd *)x); +} + +static void *mousefilter_new(void) +{ + t_mousefilter *x = (t_mousefilter *)pd_new(mousefilter_class); + x->x_isup = 0; /* LATER rethink */ + x->x_ispending = 0; + outlet_new((t_object *)x, &s_float); + hammergui_bindmouse((t_pd *)x); + return (x); +} + +void mousefilter_setup(void) +{ + mousefilter_class = class_new(gensym("mousefilter"), + (t_newmethod)mousefilter_new, + (t_method)mousefilter_free, + sizeof(t_mousefilter), 0, 0); + class_addfloat(mousefilter_class, mousefilter_float); + class_addanything(mousefilter_class, mousefilter_anything); + class_addmethod(mousefilter_class, (t_method)mousefilter_doup, + gensym("_up"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/hammer/mtr.c b/externals/miXed/cyclone/hammer/mtr.c new file mode 100644 index 000000000..0d04efa4c --- /dev/null +++ b/externals/miXed/cyclone/hammer/mtr.c @@ -0,0 +1,862 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* CHECKME undocumented: readbinbuf, writebinbuf (a clipboard-like thing?) */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "shared.h" +#include "common/loud.h" +#include "common/fitter.h" +#include "hammer/file.h" + +#ifdef KRZYSZCZ +//#define MTR_DEBUG +#endif + +#define MTR_C74MAXTRACKS 32 +#define MTR_FILEBUFSIZE 4096 +#define MTR_FILEMAXCOLUMNS 78 + +enum { MTR_STEPMODE, MTR_RECMODE, MTR_PLAYMODE }; + +typedef struct _mtrack +{ + t_pd tr_pd; + struct _mtr *tr_owner; + int tr_id; + int tr_listed; + int tr_mode; + int tr_muted; + int tr_restarted; + t_atom *tr_atdelta; + int tr_ixnext; + t_binbuf *tr_binbuf; + float tr_tempo; + double tr_clockdelay; + double tr_prevtime; + t_clock *tr_clock; + t_outlet *tr_trackout; + t_outlet *tr_mainout; + t_hammerfile *tr_filehandle; +} t_mtrack; + +typedef void (*t_mtrackfn)(t_mtrack *tp); + +typedef struct _mtr +{ + t_object x_ob; + t_glist *x_glist; + int x_ntracks; + t_mtrack **x_tracks; + t_hammerfile *x_filehandle; +} t_mtr; + +static t_class *mtrack_class; +static t_class *mtr_class; + +static void mtrack_donext(t_mtrack *tp) +{ + if (tp->tr_ixnext < 0) + goto endoftrack; + while (1) + { + int natoms = binbuf_getnatom(tp->tr_binbuf); + int ixmess = tp->tr_ixnext; + t_atom *atmess; + if (ixmess >= natoms) + goto endoftrack; + atmess = binbuf_getvec(tp->tr_binbuf) + ixmess; + + while (atmess->a_type == A_SEMI) + { + if (++ixmess >= natoms) + goto endoftrack; + atmess++; + } + if (!tp->tr_atdelta && atmess->a_type == A_FLOAT) + { /* delta atom */ + float delta = atmess->a_w.w_float; + if (delta < 0.) + delta = 0.; + tp->tr_atdelta = atmess; + tp->tr_ixnext = ixmess + 1; + if (tp->tr_mode == MTR_PLAYMODE) + { + clock_delay(tp->tr_clock, + tp->tr_clockdelay = delta * tp->tr_tempo); + tp->tr_prevtime = clock_getlogicaltime(); + } + else if (ixmess < 2) /* LATER rethink */ + continue; /* CHECKED first delta skipped */ + else + { /* CHECKED this is not blocked with the muted flag */ + t_atom at[2]; + SETFLOAT(&at[0], tp->tr_id); + SETFLOAT(&at[1], delta); + outlet_list(tp->tr_mainout, 0, 2, at); + } + return; + } + else + { /* message beginning */ + int wasrestarted = tp->tr_restarted; /* LATER rethink */ + int ixnext = ixmess + 1; + t_atom *atnext = atmess + 1; + while (ixnext < natoms && atnext->a_type != A_SEMI) + ixnext++, atnext++; + tp->tr_restarted = 0; + if (!tp->tr_muted) + { + int ac = ixnext - ixmess; + if (ac > 1) + { + if (atmess->a_type == A_FLOAT) + outlet_list(tp->tr_trackout, &s_list, ac, atmess); + else if (atmess->a_type == A_SYMBOL) + outlet_anything(tp->tr_trackout, + atmess->a_w.w_symbol, ac-1, atmess+1); + } + else if (atmess->a_type == A_FLOAT) + outlet_float(tp->tr_trackout, atmess->a_w.w_float); + else if (atmess->a_type == A_SYMBOL) + outlet_symbol(tp->tr_trackout, atmess->a_w.w_symbol); + } + tp->tr_atdelta = 0; + tp->tr_ixnext = ixnext; + if (tp->tr_restarted) + return; + tp->tr_restarted = wasrestarted; + } + } +endoftrack: + if (tp->tr_mode == MTR_PLAYMODE) + tp->tr_ixnext = 0; /* CHECKED ready to go in step mode after play */ + else + { + if (tp->tr_ixnext > 0) + { + t_atom at[2]; + SETFLOAT(&at[0], tp->tr_id); + SETFLOAT(&at[1], -1.); /* CHECKED eot marker */ + outlet_list(tp->tr_mainout, 0, 2, at); + } + tp->tr_ixnext = -1; /* CHECKED no loop-over */ + } + tp->tr_atdelta = 0; + tp->tr_prevtime = 0.; + tp->tr_mode = MTR_STEPMODE; +} + +static void mtrack_tick(t_mtrack *tp) +{ + if (tp->tr_mode == MTR_PLAYMODE) + { + tp->tr_prevtime = 0.; + mtrack_donext(tp); + } +} + +static void mtrack_setmode(t_mtrack *tp, int newmode) +{ + if (tp->tr_mode == MTR_PLAYMODE) + { + clock_unset(tp->tr_clock); + tp->tr_ixnext = 0; + } + switch (tp->tr_mode = newmode) + { + case MTR_STEPMODE: + break; + case MTR_RECMODE: + binbuf_clear(tp->tr_binbuf); + tp->tr_prevtime = clock_getlogicaltime(); + break; + case MTR_PLAYMODE: + tp->tr_atdelta = 0; + tp->tr_ixnext = 0; + tp->tr_prevtime = 0.; + mtrack_donext(tp); + break; + default: + loudbug_bug("mtrack_setmode"); + } +} + +static void mtrack_doadd(t_mtrack *tp, int ac, t_atom *av) +{ + if (tp->tr_prevtime > 0.) + { + t_binbuf *bb = tp->tr_binbuf; + t_atom at; + float elapsed = clock_gettimesince(tp->tr_prevtime); + SETFLOAT(&at, elapsed); + binbuf_add(bb, 1, &at); + binbuf_add(bb, ac, av); + SETSEMI(&at); + binbuf_add(bb, 1, &at); + tp->tr_prevtime = clock_getlogicaltime(); + } +} + +static void mtrack_float(t_mtrack *tp, t_float f) +{ + if (tp->tr_mode == MTR_RECMODE) + { + t_atom at; + SETFLOAT(&at, f); + mtrack_doadd(tp, 1, &at); + } +} + +static void mtrack_symbol(t_mtrack *tp, t_symbol *s) +{ + if (tp->tr_mode == MTR_RECMODE) + { + t_atom at; + SETSYMBOL(&at, s); + mtrack_doadd(tp, 1, &at); + } +} + +static void mtrack_list(t_mtrack *tp, t_symbol *s, int ac, t_atom *av) +{ + if (tp->tr_mode == MTR_RECMODE) + mtrack_doadd(tp, ac, av); +} + +static void mtrack_record(t_mtrack *tp) +{ + mtrack_setmode(tp, MTR_RECMODE); +} + +static void mtrack_play(t_mtrack *tp) +{ + mtrack_setmode(tp, MTR_PLAYMODE); +} + +static void mtrack_stop(t_mtrack *tp) +{ + mtrack_setmode(tp, MTR_STEPMODE); +} + +static void mtrack_next(t_mtrack *tp) +{ + if (tp->tr_mode == MTR_STEPMODE) + mtrack_donext(tp); +} + +static void mtrack_rewind(t_mtrack *tp) +{ + if (tp->tr_mode == MTR_STEPMODE) + { + tp->tr_atdelta = 0; + tp->tr_ixnext = 0; + } +} + +/* CHECKED step and play mode */ +static void mtrack_mute(t_mtrack *tp) +{ + tp->tr_muted = 1; +} + +/* CHECKED step and play mode */ +static void mtrack_unmute(t_mtrack *tp) +{ + tp->tr_muted = 0; +} + +static void mtrack_clear(t_mtrack *tp) +{ + binbuf_clear(tp->tr_binbuf); +} + +static t_atom *mtrack_getdelay(t_mtrack *tp) +{ + int natoms = binbuf_getnatom(tp->tr_binbuf); + if (natoms) + { + t_atom *ap = binbuf_getvec(tp->tr_binbuf); + while (natoms--) + { + if (ap->a_type == A_FLOAT) + return (ap); + ap++; + } + loudbug_bug("mtrack_getdelay"); + } + return (0); +} + +static void mtrack_delay(t_mtrack *tp, t_floatarg f) +{ + t_atom *ap = mtrack_getdelay(tp); + if (ap) + ap->a_w.w_float = f; +} + +static void mtrack_first(t_mtrack *tp, t_floatarg f) +{ + mtrack_delay(tp, f); /* CHECKED */ +} + +static void mtr_doread(t_mtr *x, t_mtrack *target, t_symbol *fname); +static void mtr_dowrite(t_mtr *x, t_mtrack *source, t_symbol *fname); + +static void mtrack_readhook(t_pd *z, t_symbol *fname, int ac, t_atom *av) +{ + t_mtrack *tp = (t_mtrack *)z; + mtr_doread(tp->tr_owner, tp, fname); +} + +static void mtrack_writehook(t_pd *z, t_symbol *fname, int ac, t_atom *av) +{ + t_mtrack *tp = (t_mtrack *)z; + mtr_dowrite(tp->tr_owner, tp, fname); +} + +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, 0); +} + +static void mtrack_write(t_mtrack *tp, t_symbol *s) +{ + if (s && s != &s_) + mtr_dowrite(tp->tr_owner, tp, s); + else /* CHECKED no default */ + hammerpanel_save(tp->tr_filehandle, + canvas_getdir(tp->tr_owner->x_glist), 0); +} + +static void mtrack_tempo(t_mtrack *tp, t_floatarg f) +{ + float newtempo; + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(mtr_class, "no 'tempo' control in Max"); + warned = 1; + } + if (f < 1e-20) + f = 1e-20; + else if (f > 1e20) + f = 1e20; + newtempo = 1. / f; + if (tp->tr_prevtime > 0.) + { + tp->tr_clockdelay -= clock_gettimesince(tp->tr_prevtime); + tp->tr_clockdelay *= newtempo / tp->tr_tempo; + if (tp->tr_clockdelay < 0.) + tp->tr_clockdelay = 0.; + clock_delay(tp->tr_clock, tp->tr_clockdelay); + tp->tr_prevtime = clock_getlogicaltime(); + } + tp->tr_tempo = newtempo; +} + +static void mtr_calltracks(t_mtr *x, t_mtrackfn fn, + t_symbol *s, int ac, t_atom *av) +{ + int ntracks = x->x_ntracks; + t_mtrack **tpp = x->x_tracks; + if (ac) + { + /* FIXME: CHECKED tracks called in the order of being mentioned + (without duplicates) */ + while (ntracks--) (*tpp++)->tr_listed = 0; + while (ac--) + { + /* CHECKED silently ignoring out-of-bounds and non-ints */ + if (av->a_type == A_FLOAT) + { + int id = (int)av->a_w.w_float - 1; /* CHECKED 1-based */ + if (id >= 0 && id < x->x_ntracks) + x->x_tracks[id]->tr_listed = 1; + } + av++; + } + ntracks = x->x_ntracks; + tpp = x->x_tracks; + while (ntracks--) + { + if ((*tpp)->tr_listed) fn(*tpp); + tpp++; + } + } + else while (ntracks--) fn(*tpp++); +} + +static void mtr_record(t_mtr *x, t_symbol *s, int ac, t_atom *av) +{ + mtr_calltracks(x, mtrack_record, s, ac, av); +} + +static void mtr_play(t_mtr *x, t_symbol *s, int ac, t_atom *av) +{ + mtr_calltracks(x, mtrack_play, s, ac, av); +} + +static void mtr_stop(t_mtr *x, t_symbol *s, int ac, t_atom *av) +{ + mtr_calltracks(x, mtrack_stop, s, ac, av); +} + +static void mtr_next(t_mtr *x, t_symbol *s, int ac, t_atom *av) +{ + mtr_calltracks(x, mtrack_next, s, ac, av); +} + +static void mtr_rewind(t_mtr *x, t_symbol *s, int ac, t_atom *av) +{ + mtr_calltracks(x, mtrack_rewind, s, ac, av); +} + +static void mtr_mute(t_mtr *x, t_symbol *s, int ac, t_atom *av) +{ + mtr_calltracks(x, mtrack_mute, s, ac, av); +} + +static void mtr_unmute(t_mtr *x, t_symbol *s, int ac, t_atom *av) +{ + mtr_calltracks(x, mtrack_unmute, s, ac, av); +} + +static void mtr_clear(t_mtr *x, t_symbol *s, int ac, t_atom *av) +{ + mtr_calltracks(x, mtrack_clear, s, ac, av); +} + +static void mtr_delay(t_mtr *x, t_floatarg f) +{ + int ntracks = x->x_ntracks; + t_mtrack **tpp = x->x_tracks; + while (ntracks--) mtrack_delay(*tpp++, f); +} + +static void mtr_first(t_mtr *x, t_floatarg f) +{ + int ntracks = x->x_ntracks; + t_mtrack **tpp = x->x_tracks; + float delta = SHARED_FLT_MAX; + if (f < 0.) + f = 0.; + while (ntracks--) + { + t_atom *ap = mtrack_getdelay(*tpp); + if (ap) + { + if (delta > ap->a_w.w_float) + delta = ap->a_w.w_float; + (*tpp)->tr_listed = 1; + } + else (*tpp)->tr_listed = 0; + tpp++; + } + ntracks = x->x_ntracks; + tpp = x->x_tracks; + delta -= f; + while (ntracks--) + { + if ((*tpp)->tr_listed) + { + t_atom *ap = mtrack_getdelay(*tpp); + if (ap) + ap->a_w.w_float -= delta; + } + tpp++; + } +} + +static void mtr_doread(t_mtr *x, t_mtrack *target, t_symbol *fname) +{ + char path[MAXPDSTRING]; + FILE *fp; + /* FIXME use open_via_path() */ + if (x->x_glist) + canvas_makefilename(x->x_glist, fname->s_name, path, MAXPDSTRING); + else + { + strncpy(path, fname->s_name, MAXPDSTRING); + path[MAXPDSTRING-1] = 0; + } + /* CHECKED no global message */ + if (fp = sys_fopen(path, "r")) + { + t_mtrack *tp = 0; + char linebuf[MTR_FILEBUFSIZE]; + t_binbuf *bb = binbuf_new(); + while (fgets(linebuf, MTR_FILEBUFSIZE, fp)) + { + char *line = linebuf; + int linelen; + while (*line && (*line == ' ' || *line == '\t')) line++; + if (linelen = strlen(line)) + { + if (tp) + { + if (!strncmp(line, "end;", 4)) + { + post("ok"); + tp = 0; + } + else + { + int ac; + binbuf_text(bb, line, linelen); + if (ac = binbuf_getnatom(bb)) + { + t_atom *ap = binbuf_getvec(bb); + if (!binbuf_getnatom(tp->tr_binbuf)) + { + if (ap->a_type != A_FLOAT) + { + t_atom at; + SETFLOAT(&at, 0.); + binbuf_add(tp->tr_binbuf, 1, &at); + } + else if (ap->a_w.w_float < 0.) + ap->a_w.w_float = 0.; + } + binbuf_add(tp->tr_binbuf, ac, ap); + } + } + } + else if (!strncmp(line, "track ", 6)) + { + int id = strtol(line + 6, 0, 10); + startpost("Track %d... ", id); + if (id < 1 || id > x->x_ntracks) + post("no such track"); /* LATER rethink */ + else if (target) + { + if (id == target->tr_id) + tp = target; + post("skipped"); /* LATER rethink */ + } + else tp = x->x_tracks[id - 1]; + if (tp) + { + binbuf_clear(tp->tr_binbuf); + } + } + } + } + fclose(fp); + binbuf_free(bb); + } + else + { + /* CHECKED no complaint, open dialog not presented... */ + /* LATER rethink */ + hammerpanel_open(target ? target->tr_filehandle : x->x_filehandle, 0); + } +} + +static int mtr_writetrack(t_mtr *x, t_mtrack *tp, FILE *fp) +{ + int natoms = binbuf_getnatom(tp->tr_binbuf); + if (natoms) /* CHECKED empty tracks not stored */ + { + char sbuf[MTR_FILEBUFSIZE], *bp = sbuf, *ep = sbuf + MTR_FILEBUFSIZE; + int ncolumn = 0; + t_atom *ap = binbuf_getvec(tp->tr_binbuf); + fprintf(fp, "track %d;\n", tp->tr_id); + for (; natoms--; ap++) + { + int length; + /* from binbuf_write(): + ``estimate how many characters will be needed. Printing out + symbols may need extra characters for inserting backslashes.'' */ + if (ap->a_type == A_SYMBOL || ap->a_type == A_DOLLSYM) + length = 80 + strlen(ap->a_w.w_symbol->s_name); + else + length = 40; + if (bp > sbuf && ep - bp < length) + { + if (fwrite(sbuf, bp - sbuf, 1, fp) < 1) + return (1); + bp = sbuf; + } + if (ap->a_type == A_SEMI) + { + *bp++ = ';'; + *bp++ = '\n'; + ncolumn = 0; + } + else if (ap->a_type == A_COMMA) + { + *bp++ = ','; + ncolumn++; + } + else + { + if (ncolumn) + { + *bp++ = ' '; + ncolumn++; + } + atom_string(ap, bp, (ep - bp) - 2); + length = strlen(bp); + if (ncolumn && ncolumn + length > MTR_FILEMAXCOLUMNS) + { + bp[-1] = '\n'; + ncolumn = length; + } + else ncolumn += length; + bp += length; + } + } + if (bp > sbuf && fwrite(sbuf, bp - sbuf, 1, fp) < 1) + return (1); + fputs("end;\n", fp); + post("Track %d done", tp->tr_id); /* CHECKED (0-based: not emulated) */ + } + return (0); +} + +/* CHECKED empty sequence stored as an empty file */ +static void mtr_dowrite(t_mtr *x, t_mtrack *source, t_symbol *fname) +{ + int failed = 0; + char path[MAXPDSTRING]; + FILE *fp; + if (x->x_glist) + canvas_makefilename(x->x_glist, fname->s_name, path, MAXPDSTRING); + else + { + strncpy(path, fname->s_name, MAXPDSTRING); + path[MAXPDSTRING-1] = 0; + } + /* CHECKED no global message */ + if (fp = sys_fopen(path, "w")) + { + /* CHECKED single-track writing does not seem to work (a bug?) */ + if (source) failed = mtr_writetrack(x, source, fp); + else + { + int id; + t_mtrack **tpp; + for (id = 0, tpp = x->x_tracks; id < x->x_ntracks; id++, tpp++) + if (failed = mtr_writetrack(x, *tpp, fp)) + break; + } + if (failed) sys_unixerror(path); /* LATER rethink */ + fclose(fp); + } + else + { + sys_unixerror(path); /* LATER rethink */ + failed = 1; + } + if (failed) loud_error((t_pd *)x, "writing text file \"%s\" failed", path); +} + +static void mtr_readhook(t_pd *z, t_symbol *fname, int ac, t_atom *av) +{ + mtr_doread((t_mtr *)z, 0, fname); +} + +static void mtr_writehook(t_pd *z, t_symbol *fname, int ac, t_atom *av) +{ + mtr_dowrite((t_mtr *)z, 0, fname); +} + +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, 0); +} + +static void mtr_write(t_mtr *x, t_symbol *s) +{ + if (s && s != &s_) + mtr_dowrite(x, 0, s); + else /* CHECKED no default */ + hammerpanel_save(x->x_filehandle, canvas_getdir(x->x_glist), 0); +} + +static void mtr_tempo(t_mtr *x, t_floatarg f) +{ + int ntracks = x->x_ntracks; + t_mtrack **tpp = x->x_tracks; + while (ntracks--) mtrack_tempo(*tpp++, f); +} + +#ifdef MTR_DEBUG +static void mtr_debug(t_mtr *x) +{ + int ntracks = x->x_ntracks; + t_mtrack **tpp = x->x_tracks; + while (ntracks--) + { + loudbug_post("------- Track %d -------", (*tpp)->tr_id); + loudbug_postbinbuf((*tpp++)->tr_binbuf); + } +} +#endif + +static void mtr_free(t_mtr *x) +{ + if (x->x_tracks) + { + int ntracks = x->x_ntracks; + t_mtrack **tpp = x->x_tracks; + while (ntracks--) + { + t_mtrack *tp = *tpp++; + if (tp->tr_binbuf) binbuf_free(tp->tr_binbuf); + if (tp->tr_clock) clock_free(tp->tr_clock); + pd_free((t_pd *)tp); + } + freebytes(x->x_tracks, x->x_ntracks * sizeof(*x->x_tracks)); + } +} + +static void *mtr_new(t_floatarg f) +{ + t_mtr *x = 0; + int ntracks = (int)f; + t_mtrack **tracks; + if (ntracks < 1) + ntracks = 1; + if (tracks = getbytes(ntracks * sizeof(*tracks))) + { + int i; + t_mtrack **tpp; + for (i = 0, tpp = tracks; i < ntracks; i++, tpp++) + { + if (!(*tpp = (t_mtrack *)pd_new(mtrack_class)) || + !((*tpp)->tr_binbuf = binbuf_new()) || + !((*tpp)->tr_clock = clock_new(*tpp, (t_method)mtrack_tick))) + { + if (*tpp) pd_free((t_pd *)*tpp); + if ((*tpp)->tr_binbuf) binbuf_free((*tpp)->tr_binbuf); + while (i--) + { + tpp--; + binbuf_free((*tpp)->tr_binbuf); + clock_free((*tpp)->tr_clock); + pd_free((t_pd *)*tpp); + } + return (0); + } + } + if (x = (t_mtr *)pd_new(mtr_class)) + { + int id; + t_outlet *mainout = outlet_new((t_object *)x, &s_list); + x->x_glist = canvas_getcurrent(); + x->x_filehandle = hammerfile_new((t_pd *)x, 0, + mtr_readhook, mtr_writehook, 0); + if (ntracks > MTR_C74MAXTRACKS) + fittermax_rangewarning(mtr_class, MTR_C74MAXTRACKS, "tracks"); + x->x_ntracks = ntracks; + x->x_tracks = tracks; + for (id = 1; id <= ntracks; id++, tracks++) /* CHECKED 1-based */ + { + t_mtrack *tp = *tracks; + inlet_new((t_object *)x, (t_pd *)tp, 0, 0); + tp->tr_trackout = outlet_new((t_object *)x, &s_); + tp->tr_mainout = mainout; + tp->tr_owner = x; + tp->tr_id = id; + tp->tr_listed = 0; + tp->tr_filehandle = /* LATER rethink */ + hammerfile_new((t_pd *)tp, 0, + mtrack_readhook, mtrack_writehook, 0); + tp->tr_mode = MTR_STEPMODE; + tp->tr_muted = 0; + tp->tr_restarted = 0; + tp->tr_atdelta = 0; + tp->tr_ixnext = 0; + tp->tr_tempo = 1.; + tp->tr_clockdelay = 0.; + tp->tr_prevtime = 0.; + } + } + } + return (x); +} + +void mtr_setup(void) +{ + mtrack_class = class_new(gensym("_mtrack"), 0, 0, + sizeof(t_mtrack), CLASS_PD | CLASS_NOINLET, 0); + class_addfloat(mtrack_class, mtrack_float); + class_addsymbol(mtrack_class, mtrack_symbol); + class_addlist(mtrack_class, mtrack_list); + class_addmethod(mtrack_class, (t_method)mtrack_record, + gensym("record"), 0); + class_addmethod(mtrack_class, (t_method)mtrack_play, + gensym("play"), 0); + class_addmethod(mtrack_class, (t_method)mtrack_stop, + gensym("stop"), 0); + class_addmethod(mtrack_class, (t_method)mtrack_next, + gensym("next"), 0); + class_addmethod(mtrack_class, (t_method)mtrack_rewind, + gensym("rewind"), 0); + class_addmethod(mtrack_class, (t_method)mtrack_mute, + gensym("mute"), 0); + class_addmethod(mtrack_class, (t_method)mtrack_unmute, + gensym("unmute"), 0); + class_addmethod(mtrack_class, (t_method)mtrack_clear, + gensym("clear"), 0); + class_addmethod(mtrack_class, (t_method)mtrack_delay, + gensym("delay"), A_FLOAT, 0); + class_addmethod(mtrack_class, (t_method)mtrack_first, + gensym("first"), A_FLOAT, 0); + class_addmethod(mtrack_class, (t_method)mtrack_read, + gensym("read"), A_DEFSYM, 0); + class_addmethod(mtrack_class, (t_method)mtrack_write, + gensym("write"), A_DEFSYM, 0); + class_addmethod(mtrack_class, (t_method)mtrack_tempo, + gensym("tempo"), A_FLOAT, 0); + + mtr_class = class_new(gensym("mtr"), + (t_newmethod)mtr_new, + (t_method)mtr_free, + sizeof(t_mtr), 0, + A_DEFFLOAT, 0); + class_addmethod(mtr_class, (t_method)mtr_record, + gensym("record"), A_GIMME, 0); + class_addmethod(mtr_class, (t_method)mtr_play, + gensym("play"), A_GIMME, 0); + class_addmethod(mtr_class, (t_method)mtr_stop, + gensym("stop"), A_GIMME, 0); + class_addmethod(mtr_class, (t_method)mtr_next, + gensym("next"), A_GIMME, 0); + class_addmethod(mtr_class, (t_method)mtr_rewind, + gensym("rewind"), A_GIMME, 0); + class_addmethod(mtr_class, (t_method)mtr_mute, + gensym("mute"), A_GIMME, 0); + class_addmethod(mtr_class, (t_method)mtr_unmute, + gensym("unmute"), A_GIMME, 0); + class_addmethod(mtr_class, (t_method)mtr_clear, + gensym("clear"), A_GIMME, 0); + class_addmethod(mtr_class, (t_method)mtr_delay, + gensym("delay"), A_FLOAT, 0); + class_addmethod(mtr_class, (t_method)mtr_first, + gensym("first"), A_FLOAT, 0); + class_addmethod(mtr_class, (t_method)mtr_read, + gensym("read"), A_DEFSYM, 0); + class_addmethod(mtr_class, (t_method)mtr_write, + gensym("write"), A_DEFSYM, 0); + class_addmethod(mtr_class, (t_method)mtr_tempo, + gensym("tempo"), A_FLOAT, 0); +#ifdef MTR_DEBUG + class_addmethod(mtr_class, (t_method)mtr_debug, + gensym("debug"), 0); +#endif + hammerfile_setup(mtr_class, 0); + fitter_setup(mtr_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/next.c b/externals/miXed/cyclone/hammer/next.c new file mode 100644 index 000000000..3fe7d6eb7 --- /dev/null +++ b/externals/miXed/cyclone/hammer/next.c @@ -0,0 +1,58 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +//#define NEXT_USEEVENTNO + +typedef struct _next +{ + t_object x_ob; +#ifdef NEXT_USEEVENTNO + int x_lastevent; +#else + double x_lastevent; +#endif + t_outlet *x_out2; +} t_next; + +static t_class *next_class; + +/* CHECKME first call, CHECKME if the outlets are not swapped */ +static void next_anything(t_next *x, t_symbol *s, int ac, t_atom *av) +{ +#ifdef NEXT_USEEVENTNO + int nextevent = sys_geteventno(); +#else + double nextevent = clock_getlogicaltime(); +#endif + if (x->x_lastevent == nextevent) + outlet_bang(x->x_out2); + else + { + x->x_lastevent = nextevent; + outlet_bang(((t_object *)x)->ob_outlet); + } +} + +static void *next_new(void) +{ + t_next *x = (t_next *)pd_new(next_class); + outlet_new((t_object *)x, &s_bang); + x->x_out2 = outlet_new((t_object *)x, &s_bang); +#ifdef NEXT_USEEVENTNO + x->x_lastevent = sys_geteventno(); +#else + x->x_lastevent = clock_getlogicaltime(); +#endif + return (x); +} + +void next_setup(void) +{ + next_class = class_new(gensym("next"), + (t_newmethod)next_new, 0, + sizeof(t_next), 0, 0); + class_addanything(next_class, next_anything); +} diff --git a/externals/miXed/cyclone/hammer/offer.c b/externals/miXed/cyclone/hammer/offer.c new file mode 100644 index 000000000..1e247e711 --- /dev/null +++ b/externals/miXed/cyclone/hammer/offer.c @@ -0,0 +1,93 @@ +/* Copyright (c) 2002-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "hammer/tree.h" + +/* As a class `derived' from the common hammertree code (also in funbuff), + offer maintains the auxiliary list, the main purpose of which is faster + traversal (not needed here). As a side-effect, there is a bonus of a small + speedup of deletion, and a penalty of a small slowdown of insertion. */ + +typedef struct _offer +{ + t_object x_ob; + t_float x_value; + int x_valueset; + t_hammertree x_tree; +} t_offer; + +static t_class *offer_class; + +static void offer_float(t_offer *x, t_float f) +{ + int ndx; + if (loud_checkint((t_pd *)x, f, &ndx, &s_float)) /* CHECKED */ + { + t_hammernode *np; + if (x->x_valueset) + { + hammertree_insertfloat(&x->x_tree, ndx, x->x_value, 1); + x->x_valueset = 0; + } + else if (np = hammertree_search(&x->x_tree, ndx)) + { + outlet_float(((t_object *)x)->ob_outlet, HAMMERNODE_GETFLOAT(np)); + hammertree_delete(&x->x_tree, np); + } + } +} + +static void offer_ft1(t_offer *x, t_floatarg f) +{ + /* this is incompatible -- CHECKED float is silently truncated */ + x->x_value = f; + x->x_valueset = 1; +} + +static void offer_clear(t_offer *x) +{ + hammertree_clear(&x->x_tree, 0); + /* CHECKED valueset is not cleared */ +} + +#ifdef HAMMERTREE_DEBUG +static void offer_debug(t_offer *x, t_floatarg f) +{ + hammertree_debug(&x->x_tree, (int)f, 0); +} +#endif + +static void offer_free(t_offer *x) +{ + hammertree_clear(&x->x_tree, 0); +} + +static void *offer_new(void) +{ + t_offer *x = (t_offer *)pd_new(offer_class); + x->x_valueset = 0; + hammertree_inittyped(&x->x_tree, HAMMERTYPE_FLOAT, 0); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void offer_setup(void) +{ + offer_class = class_new(gensym("offer"), + (t_newmethod)offer_new, + (t_method)offer_free, + sizeof(t_offer), 0, 0); + class_addfloat(offer_class, offer_float); + class_addmethod(offer_class, (t_method)offer_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(offer_class, (t_method)offer_clear, + gensym("clear"), 0); +#ifdef HAMMERTREE_DEBUG + class_addmethod(offer_class, (t_method)offer_debug, + gensym("debug"), A_DEFFLOAT, 0); +#endif +} diff --git a/externals/miXed/cyclone/hammer/onebang.c b/externals/miXed/cyclone/hammer/onebang.c new file mode 100644 index 000000000..a4132dc83 --- /dev/null +++ b/externals/miXed/cyclone/hammer/onebang.c @@ -0,0 +1,46 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _onebang +{ + t_object x_ob; + int x_isopen; +} t_onebang; + +static t_class *onebang_class; + +static void onebang_bang(t_onebang *x) +{ + if (x->x_isopen) + { + outlet_bang(((t_object *)x)->ob_outlet); + x->x_isopen = 0; + } +} + +static void onebang_bang1(t_onebang *x) +{ + x->x_isopen = 1; +} + +static void *onebang_new(t_floatarg f) +{ + t_onebang *x = (t_onebang *)pd_new(onebang_class); + x->x_isopen = ((int)f != 0); /* CHECKED */ + inlet_new((t_object *)x, (t_pd *)x, &s_bang, gensym("bang1")); + outlet_new((t_object *)x, &s_bang); + return (x); +} + +void onebang_setup(void) +{ + onebang_class = class_new(gensym("onebang"), + (t_newmethod)onebang_new, 0, + sizeof(t_onebang), 0, A_DEFFLOAT, 0); + class_addbang(onebang_class, onebang_bang); + class_addmethod(onebang_class, (t_method)onebang_bang1, + gensym("bang1"), 0); +} diff --git a/externals/miXed/cyclone/hammer/past.c b/externals/miXed/cyclone/hammer/past.c new file mode 100644 index 000000000..2ed219313 --- /dev/null +++ b/externals/miXed/cyclone/hammer/past.c @@ -0,0 +1,156 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* CHECKED: + bang for a float at > (refman error: >=) + bang for a list if all >= (refman page says the same) + bang for a list if any is >, even if the rest (but not previous) is < + well... +*/ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/fitter.h" + +#define PAST_C74MAXSIZE 8 /* CHECKED */ + +typedef struct past +{ + t_object x_ob; + int x_low; + int x_size; /* as allocated */ + int x_nthresh; /* as used */ + t_atom *x_thresh; + t_atom x_thrini[PAST_C74MAXSIZE]; +} t_past; + +static t_class *past_class; + +static int past_compare(t_past *x, t_float f, t_atom *ap) +{ + if (ap->a_type == A_FLOAT) + { + if (f > ap->a_w.w_float) + return (1); + else if (f == ap->a_w.w_float) + return (0); + else + return (-1); + } + else /* CHECKED */ + { + if (f > 0.) + return (1); + else if (f == 0.) + return (0); + else + return (-1); + } +} + +static void past_float(t_past *x, t_float f) +{ + if (x->x_nthresh == 1) + { + if (past_compare(x, f, x->x_thresh) > 0) /* CHECKED: equal is low */ + { + if (x->x_low) + { + x->x_low = 0; + outlet_bang(((t_object *)x)->ob_outlet); + } + } + else x->x_low = 1; + } + else if (past_compare(x, f, x->x_thresh) < 0) x->x_low = 1; +} + +/* CHECKME: x_low handling */ +static void past_list(t_past *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac && ac <= x->x_nthresh) + { + int result; + t_atom *vp = x->x_thresh; + if (av->a_type == A_FLOAT + && (result = past_compare(x, av->a_w.w_float, vp)) >= 0) + { + if (!result) + { + for (ac--, av++, vp++; ac; ac--, av++, vp++) + { + if (av->a_type != A_FLOAT + || (result = + past_compare(x, av->a_w.w_float, vp++)) < 0) + { + x->x_low = 1; + return; + } + if (result) break; + } + } + if (x->x_low) + { + x->x_low = 0; + outlet_bang(((t_object *)x)->ob_outlet); + } + } + else x->x_low = 1; + } +} + +static void past_clear(t_past *x) +{ + x->x_low = 1; +} + +static void past_set(t_past *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac) + { + t_atom *vp = x->x_thresh; + if (ac > x->x_size) + { + fittermax_rangewarning(past_class, PAST_C74MAXSIZE, "guard points"); + x->x_thresh = grow_nodata(&ac, &x->x_size, x->x_thresh, + PAST_C74MAXSIZE, x->x_thrini, + sizeof(*x->x_thresh)); + } + x->x_nthresh = ac; + while (ac--) *vp++ = *av++; + /* CHECKED: x_low is not set here */ + } +} + +static void past_free(t_past *x) +{ + if (x->x_thresh != x->x_thrini) + freebytes(x->x_thresh, x->x_size * sizeof(*x->x_thresh)); +} + +static void *past_new(t_symbol *s, int ac, t_atom *av) +{ + t_past *x = (t_past *)pd_new(past_class); + x->x_low = 1; + x->x_nthresh = 0; + x->x_size = PAST_C74MAXSIZE; + x->x_thresh = x->x_thrini; + outlet_new((t_object *)x, &s_bang); + past_set(x, 0, ac, av); + return (x); +} + +void past_setup(void) +{ + past_class = class_new(gensym("past"), + (t_newmethod)past_new, + (t_method)past_free, + sizeof(t_past), 0, A_GIMME, 0); + class_addfloat(past_class, past_float); + class_addlist(past_class, past_list); + class_addmethod(past_class, (t_method)past_clear, gensym("clear"), 0); + class_addmethod(past_class, (t_method)past_set, gensym("set"), A_GIMME, 0); + fitter_setup(past_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/pd-lib-notes.txt b/externals/miXed/cyclone/hammer/pd-lib-notes.txt new file mode 100644 index 000000000..8b45005cf --- /dev/null +++ b/externals/miXed/cyclone/hammer/pd-lib-notes.txt @@ -0,0 +1,61 @@ +modifications to Joseph A. Sarlo's code (formerly part of `pd-lib') +------------------------------------------------------------------- + +LATER: more testing, max-checking, resolving reentrancy, gc, etc. + +accum: only cosmetics + +bangbang: +- if argument > 2 the array is dynamically allocated +- if argument > 40 (max in max), a warning is printed +- accepts any message + +Bucket: +- arrays are dynamically allocated, no upper limit (max has no limit too) +- outlets output in right-to-left order +- added: 'set' method, 'l2r' and 'r2l' aliases + +buddy: coded from scratch +- using array of proxy objects (accepting any message) +- no upper limit for number of slots + +capture: coded from scratch +- text editor, savepanel +- any size +- circular buffering + +counter (rewritten entirely): +- using proxies to handle bangs and floats in other inlets than first +- new `engine', counter_dobang(), coded from scratch +- various adjustments of things that turned out to work differently in max, + too many to list here (and probably more are required -- please let me know!) + +cycle: +- the array of outlets is dynamically allocated +- fixing cycle_list()'s bugs +- accepting (and sending) both floats and symbols, accepting anything +- 'thresh' and 'set' methods +- event-sensitive mode emulation (a temporary hack) + +Decode (rewritten entirely): +- if argument > 8 the array is dynamically allocated (with a warning) +- all outlets deliver after any action +- outlets output in right-to-left order +- while in all-off mode, input is stored, not ignored +- out-of-range input is clipped, not ignored + +Histo (rewritten entirely): +- creation argument added (size) +- the array is dynamically allocated, no upper limit (max has no limit too) +- check if input is in range, to prevent crashes :) +- 'bang' method + +iter: +- different method of memory allocation +- dripping both floats and symbols (max4 feature) +- 'anything' method + +match: coded from scratch +- matching stream of both floats and symbols (max4 feature) +- scanning all kinds of messages, not only separate floats +- recognizing overlapping patterns diff --git a/externals/miXed/cyclone/hammer/poltocar.c b/externals/miXed/cyclone/hammer/poltocar.c new file mode 100644 index 000000000..4ff51526f --- /dev/null +++ b/externals/miXed/cyclone/hammer/poltocar.c @@ -0,0 +1,44 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define sinf sin +#define cosf cos +#endif + +typedef struct _poltocar +{ + t_object x_ob; + t_float x_phase; + t_outlet *x_out2; +} t_poltocar; + +static t_class *poltocar_class; + +static void poltocar_float(t_poltocar *x, t_float f) +{ + outlet_float(x->x_out2, f * sinf(x->x_phase)); + outlet_float(((t_object *)x)->ob_outlet, f * cosf(x->x_phase)); +} + +static void *poltocar_new(void) +{ + t_poltocar *x = (t_poltocar *)pd_new(poltocar_class); + floatinlet_new((t_object *)x, &x->x_phase); + outlet_new((t_object *)x, &s_float); + x->x_out2 = outlet_new((t_object *)x, &s_float); + return (x); +} + +void poltocar_setup(void) +{ + poltocar_class = class_new(gensym("poltocar"), + (t_newmethod)poltocar_new, 0, + sizeof(t_poltocar), 0, 0); + class_addfloat(poltocar_class, poltocar_float); +} diff --git a/externals/miXed/cyclone/hammer/pong.c b/externals/miXed/cyclone/hammer/pong.c new file mode 100644 index 000000000..685cde1f8 --- /dev/null +++ b/externals/miXed/cyclone/hammer/pong.c @@ -0,0 +1,283 @@ +#include "m_pd.h" +#include <math.h> +#include <string.h> +#include <ctype.h> +#include <stdlib.h> + +#ifndef HAVE_ALLOCA /* can work without alloca() but we never need it */ +#define HAVE_ALLOCA 1 +#endif +#define TEXT_NGETBYTE 100 /* bigger that this we use alloc, not alloca */ +#if HAVE_ALLOCA +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)((n) < TEXT_NGETBYTE ? \ + alloca((n) * sizeof(t_atom)) : getbytes((n) * sizeof(t_atom)))) +#define ATOMS_FREEA(x, n) ( \ + ((n) < TEXT_NGETBYTE || (freebytes((x), (n) * sizeof(t_atom)), 0))) +#else +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)getbytes((n) * sizeof(t_atom))) +#define ATOMS_FREEA(x, n) (freebytes((x), (n) * sizeof(t_atom))) +#endif + +#ifndef CYPONGMODE_DEF +#define CYPONGMODE_DEF 3 +#endif + +#ifndef CYPONGLO_DEF +#define CYPONGLO_DEF 0.f +#endif + +#ifndef CYPONGHI_DEF +#define CYPONGHI_DEF 0.f +#endif + +static t_class *pong_class; + +typedef struct _pong {//pong (control rate) + t_object x_obj; + int mode; //0=fold, 1 = wrap, 2 = clip, 3 = none + t_float minval; + t_float maxval; +} t_pong; + + + + +static int pong_setmode_help(char const * mode){ +//helper function for setting mode + int retmode; //int val for mode (see struct) + if(strcmp(mode, "clip") == 0){ + retmode = 2; + } + else if(strcmp(mode, "wrap") == 0){ + retmode = 1; + } + else if(strcmp(mode, "fold") == 0){ + retmode = 0; + } + else{//default to none o/wise + retmode = 3; + }; + + return retmode; + +}; + + + +static void *pong_new(t_symbol *s, int argc, t_atom *argv){ + //two optional args (lo, hi), then attributes for mode (str) and range (2 fl) + t_pong *x = (t_pong *)pd_new(pong_class); + int numargs = 0;//number of args read + int pastargs = 0; //if any attrs have been declared yet + x->minval = CYPONGLO_DEF; + x->maxval = CYPONGHI_DEF; + x->mode = CYPONGMODE_DEF; + while(argc > 0 ){ + t_symbol *curarg = atom_getsymbolarg(0, argc, argv); //returns nullpointer if not symbol + if(curarg == &s_){ //if nullpointer, should be float or int + if(!pastargs){//if we aren't past the args yet + switch(numargs){ + case 0: x->minval = atom_getfloatarg(0, argc, argv); + numargs++; + argc--; + argv++; + break; + + case 1: x->maxval = atom_getfloatarg(0, argc, argv); + numargs++; + argc--; + argv++; + break; + + default: argc--; + argv++; + break; + }; + } + else{ + argc--; + argv++; + }; + } + else{ + pastargs = 1; + int isrange = strcmp(curarg->s_name, "@range") == 0; + int ismode = strcmp(curarg->s_name, "@mode") == 0; + if(isrange && argc >= 3){ + t_symbol *arg1 = atom_getsymbolarg(1, argc, argv); + t_symbol *arg2 = atom_getsymbolarg(2, argc, argv); + if(arg1 == &s_ && arg2 == &s_){ + x->minval = atom_getfloatarg(1, argc, argv); + x->maxval = atom_getfloatarg(2, argc, argv); + argc -= 3; + argv += 3; + } + else{ + goto errstate; + };} + + else if(ismode && argc >= 2){ + t_symbol *arg3 = atom_getsymbolarg(1, argc, argv); + if(arg3 != &s_){ + x->mode = pong_setmode_help(arg3->s_name); + argc -= 2; + argv += 2; + } + else{ + goto errstate; + };} + else{ + goto errstate; + }; }; + }; + + floatinlet_new(&x->x_obj, &x->minval); + floatinlet_new(&x->x_obj, &x->maxval); + outlet_new(&x->x_obj, gensym("list")); + return (x); + errstate: + pd_error(x, "pong: improper args"); + return NULL; +} + + +static float pong_ponger(float input, float minval, float maxval, int mode){ + //pong helper function + float returnval; + float range = maxval - minval; + if(input < maxval && input >= minval){//if input in range, return input + returnval = input; + } + else if(minval == maxval && mode != 3){ + returnval = minval; + } + else if(mode == 0){//folding + if(input < minval){ + float diff = minval - input; //diff between input and minimum (positive) + int mag = (int)(diff/range); //case where input is more than a range away from minval + if(mag % 2 == 0){// even number of ranges away = counting up from min + diff = diff - ((float)mag)*range; + returnval = diff + minval; + } + else{// odd number of ranges away = counting down from max + diff = diff - ((float)mag)*range; + returnval = maxval - diff; + }; + } + else{ //input > maxval + float diff = input - maxval; //diff between input and max (positive) + int mag = (int)(diff/range); //case where input is more than a range away from maxval + if(mag % 2 == 0){//even number of ranges away = counting down from max + diff = diff - (float)mag*range; + returnval = maxval - diff; + } + else{//odd number of ranges away = counting up from min + diff = diff - (float)mag*range; + returnval = diff + minval; + }; + }; + } + else if (mode == 1){// wrapping + if(input < minval){ + returnval = input; + while(returnval < minval){ + returnval += range; + }; + } + else{ + returnval = fmod(input-minval,maxval-minval) + minval; + }; + } + else if(mode == 2){//clipping + if(input < minval){ + returnval = minval; + } + else{//input > maxval + returnval = maxval; + }; + } + else{//mode = 3, no effect + returnval = input; + }; + + return returnval; + +} + +static void pong_float(t_pong *x, t_float f){ + float returnval, minv, maxv, ipt; + int mode; + t_atom *outatom; //since outlet is of type list, need to use list of len 1 instead of float for output + mode = x->mode; + minv = x->minval; + maxv = x->maxval; + ipt = f; + + ATOMS_ALLOCA(outatom, 1); //allocate memory for outatom of len 1 + + if(minv > maxv){//checking ranges + float temp; + temp = maxv; + maxv = minv; + minv = temp; + }; + + returnval = pong_ponger(ipt, minv, maxv, mode); + SETFLOAT(outatom, (t_float)returnval); + outlet_list(x->x_obj.ob_outlet, &s_list, 1, outatom); + ATOMS_FREEA(outatom, 1); //free allocated memory for outatom + +} + + +static void pong_list(t_pong *x, t_symbol *s, int argc, t_atom *argv){ + + float minv, maxv; + int mode, i; + t_atom *outatom; + mode = x->mode; + minv = x->minval; + maxv = x->maxval; + + ATOMS_ALLOCA(outatom, argc); //allocate memory for outatom + + if(minv > maxv){//checking ranges + float temp; + temp = maxv; + maxv = minv; + minv = temp; + }; + for(i=0; i<argc; i++){//use helper function to set outatom one by one + float returnval, curterm; + curterm = atom_getfloatarg(i, argc, argv); + returnval = pong_ponger(curterm, minv, maxv, mode); + SETFLOAT((outatom+i), (t_float)returnval); + }; + outlet_list(x->x_obj.ob_outlet, &s_list, argc, outatom); + ATOMS_FREEA(outatom, argc); //free allocated memory for outatom + +} + +static void pong_setrange(t_pong *x, t_float lo, t_float hi){ + + x->minval = lo; + x->maxval = hi; + +} + +static void pong_setmode(t_pong *x, t_symbol *s){ + int setmode; + + setmode = pong_setmode_help(s->s_name); + x->mode = setmode; + +} + + void pong_setup(void){ + pong_class = class_new(gensym("pong"), (t_newmethod)pong_new, 0, + sizeof(t_pong), 0, A_GIMME, 0); + class_addfloat(pong_class, pong_float); + class_addlist(pong_class, pong_list); + class_addmethod(pong_class, (t_method)pong_setrange, gensym("range"), A_FLOAT, A_FLOAT, 0); + class_addmethod(pong_class, (t_method)pong_setmode, gensym("mode"), A_SYMBOL, 0); +} diff --git a/externals/miXed/cyclone/hammer/prepend.c b/externals/miXed/cyclone/hammer/prepend.c new file mode 100644 index 000000000..b305f2f01 --- /dev/null +++ b/externals/miXed/cyclone/hammer/prepend.c @@ -0,0 +1,368 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/fitter.h" + +#define PREPEND_INISIZE 32 /* LATER rethink */ +#define PREPEND_MAXSIZE 256 + +typedef struct _prepend +{ + t_object x_ob; + t_symbol *x_selector; + int x_size; /* as allocated */ + int x_natoms; /* as used */ + t_atom *x_message; + t_atom x_messini[PREPEND_INISIZE]; + int x_entered; + int x_auxsize; + t_atom *x_auxbuf; + t_pd *x_proxy; +} t_prepend; + +typedef struct _prependxy +{ + t_pd xy_pd; + t_prepend *xy_owner; +} t_prependxy; + +static t_class *prepend_class; +static t_class *prependxy_class; + +static int prepend_iscompatible = 0; /* FIXME per-object */ + +/* Usually a preallocation method is used, except in special cases of: + 1) reentrant output request, or 2) an output request which would cause + resizing to more than MAXSIZE (no such limit for a 'set' message). + In both special cases, a temporary output buffer is allocated. + A separately preallocated output buffer is not used, thus avoiding + memcpying of the stored message (a small performance gain when the + preallocation method is chosen). Instead, self-invoked 'set' + messages are postponed, using an auxiliary buffer. */ + +/* called only from prepend_doanything() */ +static void prepend_dooutput(t_prepend *x, int ac, t_atom *av) +{ + if (x->x_selector == &s_float) + { + if (ac > 1) + outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, av); + else + outlet_float(((t_object *)x)->ob_outlet, av->a_w.w_float); + } + else if (x->x_selector == &s_list) + outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, av); + else /* x->x_selector guaranteed non-empty */ + /* CHECKED: 'bang' is prepended -- we cannot do so... + ('symbol' cannot be compatible too) */ + outlet_anything(((t_object *)x)->ob_outlet, x->x_selector, ac, av); +} + +static void prepend_doanything(t_prepend *x, t_symbol *s, int ac, t_atom *av) +{ + int reentered = x->x_entered; + x->x_entered = 1; + if (s == &s_) + s = 0; + if (s || x->x_natoms) + { + int prealloc = !reentered; + int ntotal = x->x_natoms + ac; + t_atom *buf; + if (s) + ntotal++; + if (prealloc && ntotal > x->x_size) + { + if (ntotal > PREPEND_MAXSIZE) + prealloc = 0; + else + { + int nrequested = ntotal; + x->x_message = grow_withdata(&nrequested, &x->x_natoms, + &x->x_size, x->x_message, + PREPEND_INISIZE, x->x_messini, + sizeof(*x->x_message)); + prealloc = (nrequested == ntotal); + } + } + if (prealloc) + { + buf = x->x_message + x->x_natoms; + if (s) + { + SETSYMBOL(buf, s); + buf++; + } + if (ac) + memcpy(buf, av, ac * sizeof(*buf)); + prepend_dooutput(x, ntotal, x->x_message); + } + else + { + /* LATER consider using the stack if ntotal <= MAXSTACK */ + if (buf = getbytes(ntotal * sizeof(*buf))) + { + t_atom *bp = buf + x->x_natoms; + if (x->x_natoms) + memcpy(buf, x->x_message, x->x_natoms * sizeof(*buf)); + if (s) + { + SETSYMBOL(bp, s); + bp++; + } + if (ac) + memcpy(bp, av, ac * sizeof(*bp)); + prepend_dooutput(x, ntotal, buf); + freebytes(buf, ntotal * sizeof(*buf)); + } + } + } + else prepend_dooutput(x, ac, av); + if (!reentered) + { + x->x_entered = 0; + if (x->x_auxbuf) + { + if (x->x_auxsize <= x->x_size) + { + x->x_natoms = x->x_auxsize / 2; + memcpy(x->x_message, x->x_auxbuf, + x->x_natoms * sizeof(*x->x_message)); + freebytes(x->x_auxbuf, x->x_auxsize * sizeof(*x->x_auxbuf)); + } + else + { + if (x->x_message != x->x_messini) + freebytes(x->x_message, x->x_size * sizeof(*x->x_message)); + x->x_size = x->x_auxsize; + x->x_message = x->x_auxbuf; + x->x_natoms = x->x_auxsize / 2; + } + x->x_auxbuf = 0; + } + } +} + +static void prepend_bang(t_prepend *x) +{ + if (x->x_selector) + { + if (prepend_iscompatible) + { + t_atom at; + SETSYMBOL(&at, &s_bang); /* CHECKED */ + prepend_doanything(x, 0, 1, &at); + } + else prepend_doanything(x, 0, 0, 0); + } + else outlet_bang(((t_object *)x)->ob_outlet); +} + +static void prepend_float(t_prepend *x, t_float f) +{ + if (x->x_selector) + { + t_atom at; + SETFLOAT(&at, f); + prepend_doanything(x, 0, 1, &at); + } + else outlet_float(((t_object *)x)->ob_outlet, f); +} + +static void prepend_symbol(t_prepend *x, t_symbol *s) +{ + if (x->x_selector) + { + t_atom at; + SETSYMBOL(&at, s); + prepend_doanything(x, 0, 1, &at); + } + else outlet_symbol(((t_object *)x)->ob_outlet, s); +} + +/* LATER gpointer */ + +static void prepend_list(t_prepend *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_selector) + prepend_doanything(x, 0, ac, av); + else + outlet_list(((t_object *)x)->ob_outlet, s, ac, av); +} + +static void prepend_anything(t_prepend *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_selector) + prepend_doanything(x, s, ac, av); + else + outlet_anything(((t_object *)x)->ob_outlet, s, ac, av); +} + +static void prepend_doset(t_prepend *x, t_symbol *s, int ac, t_atom *av) +{ + if (s) + x->x_selector = s; + else if (ac) + { + if (av->a_type == A_SYMBOL) + { + x->x_selector = av->a_w.w_symbol; + ac--; av++; + } + else if (av->a_type == A_FLOAT) + x->x_selector = (ac > 1 ? &s_list : &s_float); + else + return; /* LATER rethink */ + } + else x->x_selector = 0; + if (ac) + { + int newsize = ac * 2; + if (x->x_entered) + { + if (x->x_auxbuf) + { + loud_warning((t_pd *)x, 0, "'set' message overridden"); + freebytes(x->x_auxbuf, x->x_auxsize * sizeof(*x->x_auxbuf)); + x->x_auxsize = 0; + } + if (x->x_auxbuf = getbytes(newsize * sizeof(*x->x_auxbuf))) + { + memcpy(x->x_auxbuf, av, ac * sizeof(*x->x_auxbuf)); + x->x_auxsize = newsize; + } + } + else + { + t_atom *ap; + if (newsize > x->x_size) + { + int sz = newsize; + x->x_message = grow_nodata(&sz, &x->x_size, x->x_message, + PREPEND_INISIZE, x->x_messini, + sizeof(*x->x_message)); + if (sz != newsize) + ac = sz / 2; /* LATER rethink */ + } + x->x_natoms = ac; + ap = x->x_message; + while (ac--) *ap++ = *av++; + } + } + else x->x_natoms = 0; +} + +static void prepend_set(t_prepend *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_proxy) + prepend_anything(x, s, ac, av); + else + /* LATER (when?) controlled by maxmode */ + prepend_doset(x, 0, ac, av); +} + +static void prependxy_bang(t_prependxy *xy) +{ + prepend_doset(xy->xy_owner, 0, 0, 0); /* LATER rethink */ +} + +static void prependxy_float(t_prependxy *xy, t_float f) +{ + t_atom at; + SETFLOAT(&at, f); + prepend_doset(xy->xy_owner, &s_float, 1, &at); +} + +static void prependxy_symbol(t_prependxy *xy, t_symbol *s) +{ + prepend_doset(xy->xy_owner, + (s && s != &s_ ? s : &s_symbol), 0, 0); /* LATER rethink */ +} + +static void prependxy_list(t_prependxy *xy, t_symbol *s, int ac, t_atom *av) +{ + prepend_doset(xy->xy_owner, &s_list, ac, av); /* LATER rethink */ +} + +static void prependxy_anything(t_prependxy *xy, t_symbol *s, int ac, t_atom *av) +{ + prepend_doset(xy->xy_owner, s, ac, av); +} + +static void prepend_free(t_prepend *x) +{ + if (x->x_message != x->x_messini) + freebytes(x->x_message, x->x_size * sizeof(*x->x_message)); + if (x->x_auxbuf) + { + loudbug_bug("prepend_free"); /* LATER rethink */ + freebytes(x->x_auxbuf, x->x_auxsize * sizeof(*x->x_auxbuf)); + } + if (x->x_proxy) + pd_free(x->x_proxy); +} + +static void *prepend_new(t_symbol *s, int ac, t_atom *av) +{ + t_prepend *x = (t_prepend *)pd_new(prepend_class); + x->x_selector = 0; + x->x_size = PREPEND_INISIZE; + x->x_natoms = 0; + x->x_message = x->x_messini; + x->x_auxbuf = 0; + x->x_entered = 0; + if (ac) + { + x->x_proxy = 0; + prepend_doset(x, 0, ac, av); + } + else + { + if (prepend_iscompatible) + /* CHECKED in max an object without an outlet is created, + and there is no warning when loading from a file. */ + fittermax_warning(prepend_class, + "creating an object without an argument"); + x->x_proxy = pd_new(prependxy_class); + ((t_prependxy *)x->x_proxy)->xy_owner = x; + inlet_new((t_object *)x, x->x_proxy, 0, 0); + } + outlet_new((t_object *)x, &s_anything); + return (x); +} + +static void prepend_fitter(void) +{ + prepend_iscompatible = fittermax_get(); +} + +void prepend_setup(void) +{ + prepend_class = class_new(gensym("prepend"), + (t_newmethod)prepend_new, + (t_method)prepend_free, + sizeof(t_prepend), 0, + A_GIMME, 0); + class_addbang(prepend_class, prepend_bang); + class_addfloat(prepend_class, prepend_float); + class_addsymbol(prepend_class, prepend_symbol); + class_addlist(prepend_class, prepend_list); + class_addanything(prepend_class, prepend_anything); + class_addmethod(prepend_class, (t_method)prepend_set, + gensym("set"), A_GIMME, 0); + + prependxy_class = class_new(gensym("prepend"), 0, 0, sizeof(t_prependxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(prependxy_class, prependxy_bang); + class_addfloat(prependxy_class, prependxy_float); + class_addsymbol(prependxy_class, prependxy_symbol); + class_addlist(prependxy_class, prependxy_list); + class_addanything(prependxy_class, prependxy_anything); + + fitter_setup(prepend_class, prepend_fitter); +} diff --git a/externals/miXed/cyclone/hammer/prob.c b/externals/miXed/cyclone/hammer/prob.c new file mode 100644 index 000000000..83960eba7 --- /dev/null +++ b/externals/miXed/cyclone/hammer/prob.c @@ -0,0 +1,312 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" +#include "common/rand.h" +#include "hammer/file.h" + +/* CHECKED: no preallocation. It looks like if new state-entries + were added to the list's head, and new transition-entries + were added to the sublist's head. No sorting of any kind. */ + +#ifdef KRZYSZCZ +//#define PROB_DEBUG +#endif + +typedef struct _probtrans +{ + int tr_value; /* state (if a header trans), or suffix value (otherwise) */ + int tr_count; /* (a total in case of a header trans) */ + struct _probtrans *tr_suffix; /* header trans of a suffix state */ + struct _probtrans *tr_nexttrans; /* next trans of this state */ + struct _probtrans *tr_nextstate; /* header trans of a next state */ +} t_probtrans; + +typedef struct _prob +{ + t_object x_ob; + t_probtrans *x_translist; + t_probtrans *x_state; + t_probtrans *x_default; + int x_embedmode; + int x_silent; + unsigned int x_seed; + t_outlet *x_bangout; + t_hammerfile *x_filehandle; +} t_prob; + +static t_class *prob_class; + +static t_probtrans *prob_findstate(t_prob *x, int value, int complain) +{ + t_probtrans *state; + for (state = x->x_translist; state; state = state->tr_nextstate) + if (state->tr_value == value) + break; + if (!state && complain && !x->x_silent) + loud_error((t_pd *)x, "no state %d", value); /* CHECKED */ + return (state); +} + +static void prob_reset(t_prob *x, t_floatarg f) +{ + int value = (int)f; /* CHECKED: float converted to int */ + t_probtrans *state = prob_findstate(x, value, 1); + if (state) /* CHECKED */ + { + x->x_default = state; + /* CHECKED (sort of): */ + if (!x->x_state->tr_nexttrans) + x->x_state = state; + } +} + +static void prob_embedhook(t_pd *z, t_binbuf *bb, t_symbol *bindsym) +{ + t_prob *x = (t_prob *)z; + if (x->x_embedmode) + { + t_probtrans *pfx, *sfx; + for (pfx = x->x_translist; pfx; pfx = pfx->tr_nextstate) + for (sfx = pfx->tr_nexttrans; sfx; sfx = sfx->tr_nexttrans) + binbuf_addv(bb, "siii;", bindsym, + pfx->tr_value, sfx->tr_value, sfx->tr_count); + binbuf_addv(bb, "ssi;", bindsym, gensym("embed"), 1); + if (x->x_default) + binbuf_addv(bb, "ssi;", bindsym, gensym("reset"), + x->x_default->tr_value); + } +} + +static void prob_embed(t_prob *x, t_floatarg f) +{ + x->x_embedmode = ((int)f != 0); +} + +static void prob_clear(t_prob *x) +{ + t_probtrans *state, *nextstate; + for (state = x->x_translist; state; state = nextstate) + { + t_probtrans *trans, *nexttrans; + for (trans = state->tr_nexttrans; trans; trans = nexttrans) + { + nexttrans = trans->tr_nexttrans; + freebytes(trans, sizeof(*trans)); + } + nextstate = state->tr_nextstate; + freebytes(state, sizeof(*state)); + } + x->x_translist = 0; + x->x_state = 0; + x->x_default = 0; /* CHECKED: default number is not kept */ + /* CHECKED embedmode is kept */ +} + +/* CHECKED */ +static void prob_dump(t_prob *x) +{ + t_probtrans *state; + post("transition probabilities:"); + for (state = x->x_translist; state; state = state->tr_nextstate) + { + t_probtrans *trans; + for (trans = state->tr_nexttrans; trans; trans = trans->tr_nexttrans) + post(" from %3d to %3d: %d", + state->tr_value, trans->tr_value, trans->tr_count); + /* CHECKED: dead-ends are reported */ + post("total weights for state %d: %d", + state->tr_value, state->tr_count); + } +} + +static void prob_bang(t_prob *x) +{ + if (x->x_state) /* CHECKED: no output after clear */ + { + int rnd = rand_int(&x->x_seed, x->x_state->tr_count); + t_probtrans *trans = x->x_state->tr_nexttrans; + if (trans) + { + for (trans = x->x_state->tr_nexttrans; trans; + trans = trans->tr_nexttrans) + if ((rnd -= trans->tr_count) < 0) + break; + if (trans) + { + t_probtrans *nextstate = trans->tr_suffix; + if (nextstate) + { + outlet_float(((t_object *)x)->ob_outlet, + nextstate->tr_value); + x->x_state = nextstate; + } + else loudbug_bug("prob_bang: void suffix"); + } + else loudbug_bug("prob_bang: search overflow"); + } + else + { + outlet_bang(x->x_bangout); + if (x->x_default) /* CHECKED: stays at dead-end if no default */ + x->x_state = x->x_default; + } + } +} + +static void prob_float(t_prob *x, t_float f) +{ + int value; + if (loud_checkint((t_pd *)x, f, &value, &s_float)) /* CHECKED */ + { + t_probtrans *state = prob_findstate(x, value, 1); + if (state) /* CHECKED */ + x->x_state = state; + } +} + +static void prob_list(t_prob *x, t_symbol *s, int ac, t_atom *av) +{ + int prefval, suffval, count; + if (ac == 3 && av->a_type == A_FLOAT + && av[1].a_type == A_FLOAT && av[2].a_type == A_FLOAT + && (prefval = (int)av->a_w.w_float) == av->a_w.w_float + && (suffval = (int)av[1].a_w.w_float) == av[1].a_w.w_float + && (count = (int)av[2].a_w.w_float) == av[2].a_w.w_float) + { + t_probtrans *prefix = prob_findstate(x, prefval, 0); + t_probtrans *suffix = prob_findstate(x, suffval, 0); + t_probtrans *trans; + if (prefix && suffix) + { + for (trans = prefix->tr_nexttrans; trans; + trans = trans->tr_nexttrans) + if (trans->tr_suffix == suffix) + break; + if (trans) + { + /* the transition already exists... */ + prefix->tr_count += (count - trans->tr_count); + trans->tr_count = count; + return; + } + } + if (!prefix) + { + if (!(prefix = getbytes(sizeof(*prefix)))) + return; + prefix->tr_value = prefval; + prefix->tr_count = 0; + prefix->tr_suffix = 0; + prefix->tr_nexttrans = 0; + prefix->tr_nextstate = x->x_translist; + x->x_translist = prefix; + if (suffval == prefval) + suffix = prefix; + } + if (!suffix) + { + if (!(suffix = getbytes(sizeof(*suffix)))) + return; + suffix->tr_value = suffval; + suffix->tr_count = 0; + suffix->tr_suffix = 0; + suffix->tr_nexttrans = 0; + suffix->tr_nextstate = x->x_translist; + x->x_translist = suffix; + } + if (trans = getbytes(sizeof(*trans))) + { + trans->tr_value = suffval; + trans->tr_count = count; + trans->tr_suffix = suffix; + trans->tr_nexttrans = prefix->tr_nexttrans; + trans->tr_nextstate = prefix->tr_nextstate; + prefix->tr_count += count; + prefix->tr_nexttrans = trans; + } + if (!x->x_state) /* CHECKED */ + x->x_state = prefix; /* CHECKED */ + } + else loud_error((t_pd *)x, "bad list message format"); /* CHECKED */ +} + +static void prob__silent(t_prob *x) +{ + if (!x->x_silent) + { + fittermax_warning(prob_class, "no '_silent' message in max"); + x->x_silent = 1; + } +} + +/* CHECKED not available, LATER full editing */ +static void prob_click(t_prob *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + t_probtrans *state; + char buf[64]; + hammereditor_open(x->x_filehandle, 0, 0); + for (state = x->x_translist; state; state = state->tr_nextstate) + { + t_probtrans *trans; + for (trans = state->tr_nexttrans; trans; trans = trans->tr_nexttrans) + { + sprintf(buf, "%d %d %d\n", + state->tr_value, trans->tr_value, trans->tr_count); + hammereditor_append(x->x_filehandle, buf); + } + } +} + +static void prob_free(t_prob *x) +{ + prob_clear(x); + hammerfile_free(x->x_filehandle); +} + +static void *prob_new(void) +{ + t_prob *x = (t_prob *)pd_new(prob_class); + x->x_translist = 0; + x->x_state = 0; + x->x_default = 0; + x->x_embedmode = 0; /* CHECKED */ + x->x_silent = 0; + rand_seed(&x->x_seed, 0); + outlet_new((t_object *)x, &s_float); + x->x_bangout = outlet_new((t_object *)x, &s_bang); + x->x_filehandle = hammerfile_new((t_pd *)x, prob_embedhook, 0, 0, 0); + return (x); +} + +void prob_setup(void) +{ + prob_class = class_new(gensym("prob"), + (t_newmethod)prob_new, + (t_method)prob_free, + sizeof(t_prob), 0, 0); + class_addbang(prob_class, prob_bang); + class_addfloat(prob_class, prob_float); + class_addlist(prob_class, prob_list); + class_addmethod(prob_class, (t_method)prob_embed, + gensym("embed"), A_FLOAT, 0); + class_addmethod(prob_class, (t_method)prob_reset, + gensym("reset"), A_FLOAT, 0); + class_addmethod(prob_class, (t_method)prob_clear, + gensym("clear"), 0); + class_addmethod(prob_class, (t_method)prob_dump, + gensym("dump"), 0); + /* CHECKED: doesn't understand "seed" */ + class_addmethod(prob_class, (t_method)prob__silent, + gensym("_silent"), 0); + class_addmethod(prob_class, (t_method)prob_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + hammerfile_setup(prob_class, 1); + fitter_setup(prob_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/pv.c b/externals/miXed/cyclone/hammer/pv.c new file mode 100644 index 000000000..85f4ddcc6 --- /dev/null +++ b/externals/miXed/cyclone/hammer/pv.c @@ -0,0 +1,457 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* CHECKED (it cannot be emulated): creating [s/r <pv-symbol>] prints + "error:send/receive:<pv-symbol>:already exists" +*/ + +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "common/grow.h" + +#define PV_INISIZE 32 /* LATER rethink */ +#define PV_MAXSIZE 256 + +typedef struct _pvfamily +{ + t_symbol *f_selector; + t_float f_float; + t_symbol *f_symbol; + t_gpointer *f_pointer; + int f_size; /* as allocated */ + int f_natoms; /* as used */ + t_atom *f_message; + t_atom f_messini[PV_INISIZE]; + t_glist *f_glist; /* root glist of a family */ + t_symbol *f_name; + struct _pvfamily *f_next; +} t_pvfamily; + +typedef struct _pvlist +{ + t_pd l_pd; + int l_refcount; + t_symbol *l_name; + t_pvfamily *l_pvlist; +} t_pvlist; + +typedef struct _pv +{ + t_object x_ob; + t_glist *x_glist; + t_symbol *x_name; + t_pvfamily *x_family; +} t_pv; + +static t_class *pv_class; +static t_class *pvlist_class; + +static void pvlist_decrement(t_pvlist *pl) +{ + if (!--pl->l_refcount) + { + pd_unbind(&pl->l_pd, pl->l_name); + pd_free(&pl->l_pd); + } +} + +static t_pvlist *pv_getlist(t_symbol *s, int create) +{ + t_pvlist *pl = (t_pvlist *)pd_findbyclass(s, pvlist_class); + if (pl) + { + if (create) pl->l_refcount++; + } + else + { + if (create) + { + pl = (t_pvlist *)pd_new(pvlist_class); + pl->l_refcount = 1; + pl->l_name = s; + pl->l_pvlist = 0; + pd_bind(&pl->l_pd, s); + } + else loudbug_bug("pv_getlist"); + } + return (pl); +} + +static t_pvfamily *pv_newfamily(t_pvlist *pvlist) +{ + t_pvfamily *pf = (t_pvfamily *)getbytes(sizeof(*pf)); + pf->f_name = pvlist->l_name; + pf->f_next = pvlist->l_pvlist; + pvlist->l_pvlist = pf; + pf->f_selector = 0; + pf->f_float = 0; + pf->f_symbol = 0; + pf->f_pointer = 0; + pf->f_size = PV_INISIZE; + pf->f_natoms = 0; + pf->f_message = pf->f_messini; + return (pf); +} + +static void pvfamily_free(t_pvfamily *pf) +{ + if (pf->f_message != pf->f_messini) + freebytes(pf->f_message, pf->f_size * sizeof(*pf->f_message)); + freebytes(pf, sizeof(*pf)); +} + +static void pv_update(t_glist *glist, t_pvfamily *pf) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd) == canvas_class) /* LATER rethink */ + pv_update((t_glist *)g, pf); + else if (pd_class(&g->g_pd) == pv_class + && ((t_pv *)g)->x_name == pf->f_name) + ((t_pv *)g)->x_family = pf; +} + +static t_pvfamily *pvfamily_reusable; + +static void pv_breakup(t_pvlist *pvlist, t_glist *glist) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + { + if (pd_class(&g->g_pd) == pv_class + && ((t_pv *)g)->x_name == pvlist->l_name) + { + t_pvfamily *pf; + if (!(pf = pvfamily_reusable)) + pf = pv_newfamily(pvlist); + else pvfamily_reusable = 0; + pf->f_glist = glist; + pv_update(glist, pf); + /* LATER keep current value */ + return; + } + } + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd) == canvas_class) /* LATER rethink */ + pv_breakup(pvlist, (t_glist *)g); +} + +/* join all families of a 'pvlist' rooted in any subglist of a 'glist' */ +static t_pvfamily *pv_joinup(t_pvlist *pvlist, t_glist *glist) +{ + t_pvfamily *result = 0; + t_pvfamily *pf, *pfprev, *pfnext; + for (pfprev = 0, pf = pvlist->l_pvlist; pf; pfprev = pf, pf = pfnext) + { + t_glist *gl; + pfnext = pf->f_next; + for (gl = pf->f_glist; gl; gl = gl->gl_owner) + { + if (gl == glist) + { + if (result) + { + pvfamily_free(pf); + if (pfprev) + pfprev->f_next = pfnext; + else + pvlist->l_pvlist = pfnext; + pf = pfprev; + } + else result = pf; + break; + } + } + } + return (result); +} + +/* Called normally with either 'create' or 'destroy' set to 1, + but it might be called with both set to 0 for testing. */ +static t_pvfamily *pv_getfamily(t_glist *glist, t_symbol *s, + int create, int destroy) +{ + t_pvlist *pl = pv_getlist(s, create); + if (pl) + { + if (destroy) + { + t_pvfamily *pf, *mypf; + t_glist *gl; + for (mypf = pl->l_pvlist; mypf; mypf = mypf->f_next) + if (mypf->f_glist == glist) + break; + /* mypf is not null iff we are invoked via a [pv] in root */ + /* now check if there is a family rooted in a super-branch */ + for (gl = glist->gl_owner; gl; gl = gl->gl_owner) + { + for (pf = pl->l_pvlist; pf; pf = pf->f_next) + { + if (pf->f_glist == gl) + { + if (mypf) + loudbug_bug("pv_getfamily 1: %s in %s", + mypf->f_name->s_name, + mypf->f_glist->gl_name->s_name); + else + return (0); + } + } + } + if (mypf) + { + pvfamily_reusable = mypf; + pv_breakup(pl, glist); + if (pvfamily_reusable == mypf) + { + pvfamily_reusable = 0; + if (pl->l_pvlist == mypf) + pl->l_pvlist = mypf->f_next; + else + { + for (pf = pl->l_pvlist; pf; pf = pf->f_next) + { + if (pf->f_next == mypf) + { + pf->f_next = mypf->f_next; + break; + } + } + if (!pf) loudbug_bug("pv_getfamily 2"); + } + pvfamily_free(mypf); + } + } + else loudbug_bug("pv_getfamily 3"); + pvlist_decrement(pl); + } + else + { + t_pvfamily *pf; + t_glist *gl; + for (gl = glist; gl; gl = gl->gl_owner) + for (pf = pl->l_pvlist; pf; pf = pf->f_next) + if (pf->f_glist == gl) + return (pf); + if (create) + { + if (!(pf = pv_joinup(pl, glist))) + pf = pv_newfamily(pl); + pf->f_glist = glist; + pv_update(glist, pf); + return (pf); + } + else loudbug_bug("pv_getfamily 4"); + } + } + else loudbug_bug("pv_getfamily 5"); + return (0); +} + +static t_pvfamily *pv_checkfamily(t_pv *x) +{ + if (!x->x_family) + { + loudbug_bug("pv_checkfamily"); + x->x_family = pv_getfamily(x->x_glist, x->x_name, 0, 0); + } + return (x->x_family); +} + +static void pv_bang(t_pv *x) +{ + t_pvfamily *pf = pv_checkfamily(x); + if (pf) + { + t_symbol *s = pf->f_selector; + if (s == &s_bang) + outlet_bang(((t_object *)x)->ob_outlet); + else if (s == &s_float) + outlet_float(((t_object *)x)->ob_outlet, pf->f_float); + else if (s == &s_symbol && pf->f_symbol) + outlet_symbol(((t_object *)x)->ob_outlet, pf->f_symbol); + else if (s == &s_pointer) + { + /* LATER */ + } + else if (s == &s_list) + outlet_list(((t_object *)x)->ob_outlet, + s, pf->f_natoms, pf->f_message); + else if (s) + outlet_anything(((t_object *)x)->ob_outlet, + s, pf->f_natoms, pf->f_message); + } +} + +static void pv_float(t_pv *x, t_float f) +{ + t_pvfamily *pf = pv_checkfamily(x); + if (pf) + { + pf->f_selector = &s_float; + pf->f_float = f; + pf->f_natoms = 0; /* defensive */ + } +} + +static void pv_symbol(t_pv *x, t_symbol *s) +{ + t_pvfamily *pf = pv_checkfamily(x); + if (pf) + { + pf->f_selector = &s_symbol; + pf->f_symbol = s; + pf->f_natoms = 0; /* defensive */ + } +} + +static void pv_pointer(t_pv *x, t_gpointer *gp) +{ + t_pvfamily *pf = pv_checkfamily(x); + if (pf) + { + pf->f_selector = &s_pointer; + pf->f_pointer = gp; + pf->f_natoms = 0; /* defensive */ + } +} + +static void pvfamily_domessage(t_pvfamily *pf, int ac, t_atom *av) +{ + if (ac > pf->f_size) + { + /* LATER consider using PV_MAXSIZE (and warning if exceeded) */ + pf->f_message = grow_nodata(&ac, &pf->f_size, pf->f_message, + PV_INISIZE, pf->f_messini, + sizeof(*pf->f_message)); + } + pf->f_natoms = ac; + memcpy(pf->f_message, av, ac * sizeof(*pf->f_message)); +} + +static void pv_list(t_pv *x, t_symbol *s, int ac, t_atom *av) +{ + t_pvfamily *pf = pv_checkfamily(x); + if (pf) + { + pf->f_selector = &s_list; /* LATER rethink */ + pvfamily_domessage(pf, ac, av); + } +} + +static void pv_anything(t_pv *x, t_symbol *s, int ac, t_atom *av) +{ + t_pvfamily *pf = pv_checkfamily(x); + if (pf) + { + pf->f_selector = s; /* LATER rethink */ + pvfamily_domessage(pf, ac, av); + } +} + +static void pv_objstatus(t_pv *x, t_glist *glist) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + { + if (g == (t_gobj *)x) + post("%lx (this object) owning patcher [%s]", + (unsigned long)g, glist->gl_name->s_name); + else if (pd_class(&g->g_pd) == pv_class + && ((t_pv *)g)->x_name == x->x_name) + post("%lx owning patcher [%s]", (unsigned long)g, glist->gl_name->s_name); + } +} + +static void pv_status(t_pv *x) +{ + t_pvlist *pl = pv_getlist(x->x_name, 0); + post("pv status: Tied to %s", x->x_name->s_name); + if (pl) + { + t_pvfamily *pf; + int fcount; + for (pf = pl->l_pvlist, fcount = 1; pf; pf = pf->f_next, fcount++) + { + t_glist *glist = pf->f_glist; + t_gobj *g; + post("Family %d:", fcount); + pv_objstatus(x, glist); + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd) == canvas_class) /* LATER rethink */ + pv_objstatus(x, (t_glist *)g); + } + } +} + +static void pv_free(t_pv *x) +{ + pv_getfamily(x->x_glist, x->x_name, 0, 1); +} + +static void *pv_new(t_symbol *s, int ac, t_atom *av) +{ + t_pv *x = 0; + if (ac && av->a_type == A_SYMBOL) + s = av->a_w.w_symbol; + else s = 0; + if (s && s != &s_) + { + t_glist *gl = canvas_getcurrent(); + t_pvfamily *pf = pv_getfamily(gl, s, 1, 0); + x = (t_pv *)pd_new(pv_class); + x->x_glist = gl; + x->x_name = s; + x->x_family = pf; + outlet_new((t_object *)x, &s_float); + if (--ac) + { + av++; + if (av->a_type == A_SYMBOL) + { + if (av->a_w.w_symbol == &s_symbol) + { + if (ac > 1 && av[1].a_type == A_SYMBOL) + pv_symbol(x, av[1].a_w.w_symbol); + } + /* LATER rethink 'pv <name> bang' (now it is accepted) */ + else pv_anything(x, av->a_w.w_symbol, ac - 1, av + 1); + } + else if (av->a_type == A_FLOAT) + { + if (ac > 1) + pv_list(x, &s_list, ac, av); + else pv_float(x, av->a_w.w_float); + } + } + + } + else + /* CHECKED: "error: missing or bad arguments", + a box is created without inlets and outlets */ + loud_classarg(pv_class); + return (x); +} + +void pv_setup(void) +{ + pv_class = class_new(gensym("pv"), + (t_newmethod)pv_new, + (t_method)pv_free, + sizeof(t_pv), 0, A_GIMME, 0); + class_addbang(pv_class, pv_bang); + class_addfloat(pv_class, pv_float); + class_addsymbol(pv_class, pv_symbol); + class_addpointer(pv_class, pv_pointer); + class_addlist(pv_class, pv_list); + class_addanything(pv_class, pv_anything); + class_addmethod(pv_class, (t_method)pv_status, + gensym("status"), 0); + /* CHECKED: sending bang (or int, list, status, etc.) with '; <pv-symbol>' + "error::doesn't understand bang" (class name is an empty string) */ + pvlist_class = class_new(&s_, 0, 0, + sizeof(t_pvlist), CLASS_PD, 0); +} diff --git a/externals/miXed/cyclone/hammer/round.c b/externals/miXed/cyclone/hammer/round.c new file mode 100644 index 000000000..967141971 --- /dev/null +++ b/externals/miXed/cyclone/hammer/round.c @@ -0,0 +1,182 @@ +#include "m_pd.h" +#include <math.h> +#include <string.h> +#include <ctype.h> +#include <stdlib.h> + + +#ifndef HAVE_ALLOCA /* can work without alloca() but we never need it */ +#define HAVE_ALLOCA 1 +#endif +#define TEXT_NGETBYTE 100 /* bigger that this we use alloc, not alloca */ +#if HAVE_ALLOCA +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)((n) < TEXT_NGETBYTE ? \ + alloca((n) * sizeof(t_atom)) : getbytes((n) * sizeof(t_atom)))) +#define ATOMS_FREEA(x, n) ( \ + ((n) < TEXT_NGETBYTE || (freebytes((x), (n) * sizeof(t_atom)), 0))) +#else +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)getbytes((n) * sizeof(t_atom))) +#define ATOMS_FREEA(x, n) (freebytes((x), (n) * sizeof(t_atom))) +#endif + + +#ifndef CYROUNDNEAR_DEF +#define CYROUNDNEAR_DEF 1 +#endif + +#ifndef CYROUNDNUM_DEF +#define CYROUNDNUM_DEF 0. +#endif + +static t_class *round_class; + +typedef struct _round +{ + t_object x_obj; + t_float x_round; + float x_nearest; //nearest attribute (1 = rounding, 0 = truncation) +} t_round; + + +static void *round_new(t_symbol *s, int argc, t_atom *argv) +{ + t_round *x = (t_round *)pd_new(round_class); + + int numargs = 0; + int pastargs = 0; //if we are past the args and entered an attribute + x->x_nearest = CYROUNDNEAR_DEF; + x->x_round = CYROUNDNUM_DEF; + while(argc > 0 ){ + t_symbol *curarg = atom_getsymbolarg(0, argc, argv); //returns nullpointer if not symbol + if(curarg == &s_){ //if nullpointer, should be float or int + if(!pastargs){//if we haven't declared any attrs yet + switch(numargs){ + case 0: x->x_round = atom_getfloatarg(0, argc, argv); + numargs++; + argc--; + argv++; + break; + + default: argc--; + argv++; + break; + }; + } + else{ + argc--; + argv++; + }; + } + else{ + pastargs = 1; + int isnear = strcmp(curarg->s_name, "@nearest") == 0; + if(isnear && argc >= 2){ + t_symbol *arg1 = atom_getsymbolarg(1, argc, argv); + if(arg1 == &s_){// is a number + x->x_nearest = atom_getfloatarg(1, argc, argv); + argc -= 2; + argv += 2; + } + else{ + goto errstate; + };} + else{ + goto errstate; + }; }; + }; + + + + floatinlet_new(&x->x_obj, &x->x_round); + + outlet_new(&x->x_obj, gensym("list")); + return (x); + errstate: + pd_error(x, "round: improper args"); + return NULL; + +} + +static float rounding_algo(float val, float roundto, int mode){ +//rounding util function, val = val to round, roundto = val to round to, mode = nearest + float div, rounded; + if(roundto > 0.){ + div = val/roundto; //get the result of dividing the two + if(mode == 1){//rounding + rounded = roundto*round(div); //round quotient to nearest int and multiply roundto by result + } + else{//truncation + rounded = roundto*(float)((int)div); //else lop off the decimal and multiply roundto by result + }; + } + else{//round is 0, do nothing + rounded = val; + + }; + return rounded; + +} + +static void round_list(t_round *x, t_symbol *s, + int argc, t_atom *argv){ + int i, nearest; + float curterm, nearfloat, roundto; + t_atom *outatom; + nearfloat = x->x_nearest; + roundto = x->x_round; + if(nearfloat <= 0.){ + nearest = 0; + } + else{ + nearest = 1; + }; + ATOMS_ALLOCA(outatom, argc); //allocate memory for outatom + for(i = 0; i<argc; i++){ //get terms one by one and round/truncate them then stick them in outatom + float rounded; + curterm = atom_getfloatarg(i, argc, argv); + rounded = rounding_algo(curterm, roundto, nearest); + SETFLOAT((outatom+i), (t_float)rounded); + }; + outlet_list(x->x_obj.ob_outlet, &s_list, argc, outatom); + ATOMS_FREEA(outatom, argc); //free allocated memory for outatom + +} + +static void round_float(t_round *x, t_float f){ + //since outlet is of type list, make a 1 element list + float rounded, nearfloat, roundto; + int nearest; + t_atom *outatom; + nearfloat = x->x_nearest; + roundto = x->x_round; + if(nearfloat <= 0.){ + nearest = 0; + } + else{ + nearest = 1; + }; + ATOMS_ALLOCA(outatom, 1); //allocate memory of outatom + rounded = rounding_algo((float)f, roundto, nearest); + SETFLOAT(outatom, (t_float)rounded); + outlet_list(x->x_obj.ob_outlet, &s_list, 1, outatom); + ATOMS_FREEA(outatom, 1); //deallocate memory of outatom +} + + +static void round_nearest(t_round *x, t_float f, t_float glob){ + if(f <= 0.){ + x->x_nearest = 0; + } + else{ + x->x_nearest = 1; + }; +} + +void round_setup(void) +{ + round_class = class_new(gensym("round"), (t_newmethod)round_new, 0, + sizeof(t_round), 0, A_GIMME, 0); + class_addfloat(round_class, (t_method)round_float); + class_addlist(round_class, (t_method)round_list); + class_addmethod(round_class, (t_method)round_nearest, gensym("nearest"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/hammer/seq.c b/externals/miXed/cyclone/hammer/seq.c new file mode 100644 index 000000000..fd5688d35 --- /dev/null +++ b/externals/miXed/cyclone/hammer/seq.c @@ -0,0 +1,1246 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* CHECKED no sharing of data among seq objects having the same creation arg */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "shared.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/fitter.h" +#include "common/mifi.h" +#include "unstable/forky.h" +#include "hammer/file.h" + +#ifdef KRZYSZCZ +#define SEQ_DEBUG +#endif + +#define SEQ_INISEQSIZE 256 /* LATER rethink */ +#define SEQ_INITEMPOMAPSIZE 128 /* LATER rethink */ +#define SEQ_EOM 255 /* end of message marker, LATER rethink */ +#define SEQ_TICKSPERSEC 48 +#define SEQ_MINTICKDELAY 1. /* LATER rethink */ +#define SEQ_TICKEPSILON ((double).0001) +#define SEQ_STARTEPSILON .0001 /* if inside: play unmodified */ +#define SEQ_TEMPOEPSILON .0001 /* if inside: pause */ + +#define SEQ_ISRUNNING(x) ((x)->x_prevtime > (double).0001) +#define SEQ_ISPAUSED(x) ((x)->x_prevtime <= (double).0001) + +enum { SEQ_IDLEMODE, SEQ_RECMODE, SEQ_PLAYMODE, SEQ_SLAVEMODE }; + +typedef struct _seqevent +{ + double e_delta; + unsigned char e_bytes[4]; +} t_seqevent; + +typedef struct _seqtempo +{ + double t_scoretime; /* score ticks from start */ + double t_sr; /* score ticks per second */ +} t_seqtempo; + +typedef struct _seq +{ + t_object x_ob; + t_canvas *x_canvas; + t_symbol *x_defname; + t_hammerfile *x_filehandle; + int x_mode; + int x_playhead; + double x_nextscoretime; + float x_timescale; + float x_newtimescale; + double x_prevtime; + double x_slaveprevtime; + double x_clockdelay; + unsigned char x_status; + int x_evelength; + int x_expectedlength; + int x_eventreadhead; + int x_seqsize; /* as allocated */ + int x_nevents; /* as used */ + t_seqevent *x_sequence; + t_seqevent x_seqini[SEQ_INISEQSIZE]; + int x_temporeadhead; + int x_tempomapsize; /* as allocated */ + int x_ntempi; /* as used */ + t_seqtempo *x_tempomap; + t_seqtempo x_tempomapini[SEQ_INITEMPOMAPSIZE]; + t_clock *x_clock; + t_clock *x_slaveclock; + t_outlet *x_bangout; +} t_seq; + +static t_class *seq_class; + +static void seq_doclear(t_seq *x, int dofree) +{ + if (dofree) + { + if (x->x_sequence != x->x_seqini) + { + freebytes(x->x_sequence, x->x_seqsize * sizeof(*x->x_sequence)); + x->x_sequence = x->x_seqini; + x->x_seqsize = SEQ_INISEQSIZE; + } + if (x->x_tempomap != x->x_tempomapini) + { + freebytes(x->x_tempomap, + x->x_tempomapsize * sizeof(*x->x_tempomap)); + x->x_tempomap = x->x_tempomapini; + x->x_tempomapsize = SEQ_INITEMPOMAPSIZE; + } + } + x->x_nevents = 0; + x->x_ntempi = 0; +} + +static int seq_dogrowing(t_seq *x, int nevents, int ntempi) +{ + if (nevents > x->x_seqsize) + { + int nrequested = nevents; +#ifdef SEQ_DEBUG + loudbug_post("growing for %d events...", nevents); +#endif + x->x_sequence = + grow_nodata(&nrequested, &x->x_seqsize, x->x_sequence, + SEQ_INISEQSIZE, x->x_seqini, sizeof(*x->x_sequence)); + if (nrequested < nevents) + { + x->x_nevents = 0; + x->x_ntempi = 0; + return (0); + } + } + if (ntempi > x->x_tempomapsize) + { + int nrequested = ntempi; +#ifdef SEQ_DEBUG + loudbug_post("growing for %d tempi...", ntempi); +#endif + x->x_tempomap = + grow_nodata(&nrequested, &x->x_tempomapsize, x->x_tempomap, + SEQ_INITEMPOMAPSIZE, x->x_tempomapini, + sizeof(*x->x_tempomap)); + if (nrequested < ntempi) + { + x->x_ntempi = 0; + return (0); + } + } + x->x_nevents = nevents; + x->x_ntempi = ntempi; + return (1); +} + +static void seq_complete(t_seq *x) +{ + if (x->x_evelength < x->x_expectedlength) + { + /* CHECKED no warning if no data after status byte requiring data */ + if (x->x_evelength > 1) + post("seq: truncated midi message"); /* CHECKED */ + /* CHECKED nothing stored */ + } + else + { + t_seqevent *ep = &x->x_sequence[x->x_nevents]; + ep->e_delta = clock_gettimesince(x->x_prevtime); + x->x_prevtime = clock_getlogicaltime(); + if (x->x_evelength < 4) + ep->e_bytes[x->x_evelength] = SEQ_EOM; + x->x_nevents++; + if (x->x_nevents >= x->x_seqsize) + { + int nexisting = x->x_seqsize; + /* store-ahead scheme, LATER consider using x_currevent */ + int nrequested = x->x_nevents + 1; +#ifdef SEQ_DEBUG + loudbug_post("growing..."); +#endif + x->x_sequence = + grow_withdata(&nrequested, &nexisting, + &x->x_seqsize, x->x_sequence, + SEQ_INISEQSIZE, x->x_seqini, + sizeof(*x->x_sequence)); + if (nrequested <= x->x_nevents) + x->x_nevents = 0; + } + } + x->x_evelength = 0; +} + +static void seq_checkstatus(t_seq *x, unsigned char c) +{ + if (x->x_status && x->x_evelength > 1) /* LATER rethink */ + seq_complete(x); + if (c < 192) + x->x_expectedlength = 3; + else if (c < 224) + x->x_expectedlength = 2; + else if (c < 240) + x->x_expectedlength = 3; + else if (c < 248) + { + /* FIXME */ + x->x_expectedlength = -1; + } + else + { + x->x_sequence[x->x_nevents].e_bytes[0] = c; + x->x_evelength = x->x_expectedlength = 1; + seq_complete(x); + return; + } + x->x_status = x->x_sequence[x->x_nevents].e_bytes[0] = c; + x->x_evelength = 1; +} + +static void seq_addbyte(t_seq *x, unsigned char c, int docomplete) +{ + x->x_sequence[x->x_nevents].e_bytes[x->x_evelength++] = c; + if (x->x_evelength == x->x_expectedlength) + { + seq_complete(x); + if (x->x_status) + { + x->x_sequence[x->x_nevents].e_bytes[0] = x->x_status; + x->x_evelength = 1; + } + } + else if (x->x_evelength == 4) + { + if (x->x_status != 240) + loudbug_bug("seq_addbyte"); + /* CHECKED sysex is broken into 4-byte packets marked with + the actual delta time of last byte received in a packet */ + seq_complete(x); + } + else if (docomplete) seq_complete(x); +} + +static void seq_endofsysex(t_seq *x) +{ + seq_addbyte(x, 247, 1); + x->x_status = 0; +} + +static void seq_stoprecording(t_seq *x) +{ + if (x->x_status == 240) + { + post("seq: incomplete sysex"); /* CHECKED */ + seq_endofsysex(x); /* CHECKED 247 added implicitly */ + } + else if (x->x_status) + seq_complete(x); + /* CHECKED running status used in recording, but not across recordings */ + x->x_status = 0; +} + +static void seq_stopplayback(t_seq *x) +{ + /* FIXME */ + /* CHECKED "seq: incomplete sysex" at playback stop, 247 added implicitly */ + /* CHECKME resetting controllers, etc. */ + /* CHECKED bang not sent if playback stopped early */ + clock_unset(x->x_clock); + x->x_playhead = 0; + x->x_nextscoretime = 0.; +} + +static void seq_stopslavery(t_seq *x) +{ + /* FIXME */ + clock_unset(x->x_clock); + clock_unset(x->x_slaveclock); + x->x_playhead = 0; + x->x_nextscoretime = 0.; +} + +static void seq_startrecording(t_seq *x, int modechanged) +{ + x->x_prevtime = clock_getlogicaltime(); + x->x_status = 0; + x->x_evelength = 0; + x->x_expectedlength = -1; /* LATER rethink */ +} + +/* CHECKED running status not used in playback */ +static void seq_startplayback(t_seq *x, int modechanged) +{ + /* CHECKED bang not sent if sequence is empty */ + if (x->x_nevents) + { + if (modechanged) + { + x->x_playhead = 0; + x->x_nextscoretime = x->x_sequence->e_delta; + /* playback data never sent within the scheduler event of + a start message (even for the first delta <= 0), LATER rethink */ + x->x_clockdelay = x->x_sequence->e_delta * x->x_newtimescale; + } + else + { /* CHECKED timescale change */ + if (SEQ_ISRUNNING(x)) + x->x_clockdelay -= clock_gettimesince(x->x_prevtime); + x->x_clockdelay *= x->x_newtimescale / x->x_timescale; + } + if (x->x_clockdelay < 0.) + x->x_clockdelay = 0.; + x->x_timescale = x->x_newtimescale; + clock_delay(x->x_clock, x->x_clockdelay); + x->x_prevtime = clock_getlogicaltime(); + } + else x->x_mode = SEQ_IDLEMODE; +} + +static void seq_startslavery(t_seq *x, int modechanged) +{ + if (x->x_nevents) + { + x->x_playhead = 0; + x->x_nextscoretime = 0.; + x->x_prevtime = 0.; + x->x_slaveprevtime = 0.; + } + else x->x_mode = SEQ_IDLEMODE; +} + +static void seq_setmode(t_seq *x, int newmode) +{ + int changed = (x->x_mode != newmode); + if (changed) + { + switch (x->x_mode) + { + case SEQ_IDLEMODE: + break; + case SEQ_RECMODE: + seq_stoprecording(x); + break; + case SEQ_PLAYMODE: + seq_stopplayback(x); + break; + case SEQ_SLAVEMODE: + seq_stopslavery(x); + break; + default: + loudbug_bug("seq_setmode (old)"); + return; + } + x->x_mode = newmode; + } + switch (newmode) + { + case SEQ_IDLEMODE: + break; + case SEQ_RECMODE: + seq_startrecording(x, changed); + break; + case SEQ_PLAYMODE: + seq_startplayback(x, changed); + break; + case SEQ_SLAVEMODE: + seq_startslavery(x, changed); + break; + default: + loudbug_bug("seq_setmode (new)"); + } +} + +static void seq_settimescale(t_seq *x, float newtimescale) +{ + if (newtimescale < 1e-20) + x->x_newtimescale = 1e-20; + else if (newtimescale > 1e20) + x->x_newtimescale = 1e20; + else + x->x_newtimescale = newtimescale; +} + +static void seq_clocktick(t_seq *x) +{ + if (x->x_mode == SEQ_PLAYMODE || x->x_mode == SEQ_SLAVEMODE) + { + t_seqevent *ep = &x->x_sequence[x->x_playhead++]; + unsigned char *bp = ep->e_bytes; +nextevent: + outlet_float(((t_object *)x)->ob_outlet, *bp++); + if (*bp != SEQ_EOM) + { + outlet_float(((t_object *)x)->ob_outlet, *bp++); + if (*bp != SEQ_EOM) + { + outlet_float(((t_object *)x)->ob_outlet, *bp++); + if (*bp != SEQ_EOM) + outlet_float(((t_object *)x)->ob_outlet, *bp++); + } + } + if (x->x_mode != SEQ_PLAYMODE && x->x_mode != SEQ_SLAVEMODE) + return; /* protecting against outlet -> 'stop' etc. */ + if (x->x_playhead < x->x_nevents) + { + ep++; + x->x_nextscoretime += ep->e_delta; + if (ep->e_delta < SEQ_TICKEPSILON) + /* continue output in the same scheduler event, LATER rethink */ + { + x->x_playhead++; + bp = ep->e_bytes; + goto nextevent; + } + else + { + x->x_clockdelay = ep->e_delta * x->x_timescale; + if (x->x_clockdelay < 0.) + x->x_clockdelay = 0.; + clock_delay(x->x_clock, x->x_clockdelay); + x->x_prevtime = clock_getlogicaltime(); + } + } + else + { + seq_setmode(x, SEQ_IDLEMODE); + /* CHECKED bang sent immediately _after_ last byte */ + outlet_bang(x->x_bangout); /* LATER think about reentrancy */ + } + } +} + +/* timeout handler ('tick' is late) */ +static void seq_slaveclocktick(t_seq *x) +{ + if (x->x_mode == SEQ_SLAVEMODE) clock_unset(x->x_clock); +} + +/* LATER dealing with self-invokation (outlet -> 'tick') */ +static void seq_tick(t_seq *x) +{ + if (x->x_mode == SEQ_SLAVEMODE) + { + if (x->x_slaveprevtime > 0) + { + double elapsed = clock_gettimesince(x->x_slaveprevtime); + if (elapsed < SEQ_MINTICKDELAY) + return; + clock_delay(x->x_slaveclock, elapsed); + seq_settimescale(x, (float)(elapsed * (SEQ_TICKSPERSEC / 1000.))); + if (SEQ_ISRUNNING(x)) + { + x->x_clockdelay -= clock_gettimesince(x->x_prevtime); + x->x_clockdelay *= x->x_newtimescale / x->x_timescale; + } + else x->x_clockdelay = + x->x_sequence[x->x_playhead].e_delta * x->x_newtimescale; + if (x->x_clockdelay < 0.) + x->x_clockdelay = 0.; + clock_delay(x->x_clock, x->x_clockdelay); + x->x_prevtime = clock_getlogicaltime(); + x->x_slaveprevtime = x->x_prevtime; + x->x_timescale = x->x_newtimescale; + } + else + { + x->x_clockdelay = 0.; /* redundant */ + x->x_prevtime = 0.; /* redundant */ + x->x_slaveprevtime = clock_getlogicaltime(); + x->x_timescale = 1.; /* redundant */ + } + } +} + +/* CHECKED bang does the same as 'start 1024', not 'start <current-timescale>' + (also if already in SEQ_PLAYMODE) */ +static void seq_bang(t_seq *x) +{ + seq_settimescale(x, 1.); + seq_setmode(x, SEQ_PLAYMODE); /* CHECKED 'bang' stops recording */ +} + +static void seq_float(t_seq *x, t_float f) +{ + if (x->x_mode == SEQ_RECMODE) + { + /* CHECKED noninteger and out of range silently truncated */ + unsigned char c = (unsigned char)f; + if (c < 128) + { + if (x->x_status) seq_addbyte(x, c, 0); + } + else if (c != 254) /* CHECKED active sensing ignored */ + { + if (x->x_status == 240) + { + if (c == 247) seq_endofsysex(x); + else + { + /* CHECKED rt bytes alike */ + post("seq: unterminated sysex"); /* CHECKED */ + seq_endofsysex(x); /* CHECKED 247 added implicitly */ + seq_checkstatus(x, c); + } + } + else if (c != 247) seq_checkstatus(x, c); + } + } +} + +static void seq_symbol(t_seq *x, t_symbol *s) +{ + loud_nomethod((t_pd *)x, &s_symbol); /* CHECKED */ +} + +static void seq_list(t_seq *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac && av->a_type == A_FLOAT) seq_float(x, av->a_w.w_float); + /* CHECKED anything else/more silently ignored */ +} + +static void seq_record(t_seq *x) +{ + /* CHECKED 'record' stops playback, resets recording */ + seq_doclear(x, 0); + seq_setmode(x, SEQ_RECMODE); +} + +static void seq_append(t_seq *x) +{ + /* CHECKED 'append' stops playback */ + /* CHECKED if in SEQ_RECMODE, 'append' resets the timer */ + seq_setmode(x, SEQ_RECMODE); +} + +static void seq_start(t_seq *x, t_floatarg f) +{ + if (f < -SEQ_STARTEPSILON) + { + /* FIXME */ + seq_setmode(x, SEQ_SLAVEMODE); + } + else + { + seq_settimescale(x, (f > SEQ_STARTEPSILON ? 1024. / f : 1.)); + seq_setmode(x, SEQ_PLAYMODE); /* CHECKED 'start' stops recording */ + } +} + +static void seq_stop(t_seq *x) +{ + seq_setmode(x, SEQ_IDLEMODE); +} + +/* CHECKED first delta time is set permanently (it is stored in a file) */ +static void seq_delay(t_seq *x, t_floatarg f) +{ + if (x->x_nevents) + /* CHECKED signed/unsigned bug (not emulated) */ + x->x_sequence->e_delta = (f > SEQ_TICKEPSILON ? f : 0.); +} + +/* CHECKED all delta times are set permanently (they are stored in a file) */ +static void seq_hook(t_seq *x, t_floatarg f) +{ + int nevents; + if (nevents = x->x_nevents) + { + t_seqevent *ev = x->x_sequence; + if (f < 0) + f = 0; /* CHECKED signed/unsigned bug (not emulated) */ + while (nevents--) ev++->e_delta *= f; + } +} + +static void seq_pause(t_seq *x) +{ + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(*(t_pd *)x, "'pause' not supported in Max"); + warned = 1; + } + if (x->x_mode == SEQ_PLAYMODE && SEQ_ISRUNNING(x)) + { + x->x_clockdelay -= clock_gettimesince(x->x_prevtime); + if (x->x_clockdelay < 0.) + x->x_clockdelay = 0.; + clock_unset(x->x_clock); + x->x_prevtime = 0.; + } +} + +static void seq_continue(t_seq *x) +{ + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(*(t_pd *)x, "'continue' not supported in Max"); + warned = 1; + } + if (x->x_mode == SEQ_PLAYMODE && SEQ_ISPAUSED(x)) + { + if (x->x_clockdelay < 0.) + x->x_clockdelay = 0.; + clock_delay(x->x_clock, x->x_clockdelay); + x->x_prevtime = clock_getlogicaltime(); + } +} + +static void seq_goto(t_seq *x, t_floatarg f1, t_floatarg f2) +{ + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(*(t_pd *)x, "'goto' not supported in Max"); + warned = 1; + } + if (x->x_nevents) + { + t_seqevent *ev; + int ndx, nevents = x->x_nevents; + double ms = (double)f1 * 1000. + f2, sum; + if (ms <= SEQ_TICKEPSILON) + ms = 0.; + if (x->x_mode != SEQ_PLAYMODE) + { + seq_settimescale(x, x->x_timescale); + seq_setmode(x, SEQ_PLAYMODE); + /* clock_delay() has been called in setmode, LATER avoid */ + clock_unset(x->x_clock); + x->x_prevtime = 0.; + } + for (ndx = 0, ev = x->x_sequence, sum = SEQ_TICKEPSILON; ndx < nevents; + ndx++, ev++) + { + if ((sum += ev->e_delta) >= ms) + { + x->x_playhead = ndx; + x->x_nextscoretime = sum; + x->x_clockdelay = sum - SEQ_TICKEPSILON - ms; + if (x->x_clockdelay < 0.) + x->x_clockdelay = 0.; + if (SEQ_ISRUNNING(x)) + { + clock_delay(x->x_clock, x->x_clockdelay); + x->x_prevtime = clock_getlogicaltime(); + } + break; + } + } + } +} + +static void seq_scoretime(t_seq *x, t_symbol *s) +{ + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(*(t_pd *)x, "'scoretime' not supported in Max"); + warned = 1; + } + if (s && s->s_thing && + x->x_mode == SEQ_PLAYMODE) /* LATER other modes */ + { + t_atom aout[2]; + double ms, clockdelay = x->x_clockdelay; + t_float f1, f2; + if (SEQ_ISRUNNING(x)) + clockdelay -= clock_gettimesince(x->x_prevtime); + ms = x->x_nextscoretime - clockdelay / x->x_timescale; + /* Send ms as a pair of floats (f1, f2) = (coarse in sec, fine in msec). + Any ms may then be exactly reconstructed as (double)f1 * 1000. + f2. + Currently, f2 may be negative. LATER consider truncating f1 so that + only significant digits are on (when using 1 ms resolution, a float + stores only up to 8.7 minutes without distortion, 100 ms resolution + gives 14.5 hours of non-distorted floats, etc.) */ + f1 = ms * .001; + f2 = ms - (double)f1 * 1000.; + if (f2 < .001 && f2 > -.001) + f2 = 0.; + SETFLOAT(&aout[0], f1); + SETFLOAT(&aout[1], f2); + pd_list(s->s_thing, &s_list, 2, aout); + } +} + +static void seq_tempo(t_seq *x, t_floatarg f) +{ + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(*(t_pd *)x, "'tempo' not supported in Max"); + warned = 1; + } + if (f > SEQ_TEMPOEPSILON) + { + seq_settimescale(x, 1. / f); + if (x->x_mode == SEQ_PLAYMODE) + seq_startplayback(x, 0); + } + /* FIXME else pause, LATER reverse playback if (f < -SEQ_TEMPOEPSILON) */ +} + +static void seq_cd(t_seq *x, t_symbol *s) +{ + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(*(t_pd *)x, "'cd' not supported in Max"); + warned = 1; + } + hammerpanel_setopendir(x->x_filehandle, s); +} + +static void seq_pwd(t_seq *x, t_symbol *s) +{ + t_symbol *dir; + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(*(t_pd *)x, "'pwd' not supported in Max"); + warned = 1; + } + if (s && s->s_thing && (dir = hammerpanel_getopendir(x->x_filehandle))) + pd_symbol(s->s_thing, dir); +} + +static int seq_eventcomparehook(const void *e1, const void *e2) +{ + return (((t_seqevent *)e1)->e_delta > ((t_seqevent *)e2)->e_delta ? 1 : -1); +} + +static int seq_tempocomparehook(const void *t1, const void *t2) +{ + return (((t_seqtempo *)t1)->t_scoretime > + ((t_seqtempo *)t2)->t_scoretime ? 1 : -1); +} + +static int seq_mrhook(t_mifiread *mr, void *hookdata, int evtype) +{ + t_seq *x = (t_seq *)hookdata; + double scoretime = mifiread_getscoretime(mr); + if (evtype >= 0xf0) + { + } + else if (evtype >= 0x80) + { + if (x->x_eventreadhead < x->x_nevents) + { + t_seqevent *sev = &x->x_sequence[x->x_eventreadhead++]; + int status = mifiread_getstatus(mr); + sev->e_delta = scoretime; + sev->e_bytes[0] = status | mifiread_getchannel(mr); + sev->e_bytes[1] = mifiread_getdata1(mr); + if (MIFI_ONEDATABYTE(status)) + sev->e_bytes[2] = SEQ_EOM; + else + { + sev->e_bytes[2] = mifiread_getdata2(mr); + sev->e_bytes[3] = SEQ_EOM; + } + } + else if (x->x_eventreadhead == x->x_nevents) + { + loudbug_bug("seq_mrhook 1"); + x->x_eventreadhead++; + } + } + else if (evtype == MIFIMETA_TEMPO) + { + if (x->x_temporeadhead < x->x_ntempi) + { + t_seqtempo *stm = &x->x_tempomap[x->x_temporeadhead++]; + stm->t_scoretime = scoretime; + stm->t_sr = mifiread_gettempo(mr); +#ifdef SEQ_DEBUG + loudbug_post("tempo %g at %g", stm->t_sr, scoretime); +#endif + } + else if (x->x_temporeadhead == x->x_ntempi) + { + loudbug_bug("seq_mrhook 2"); + x->x_temporeadhead++; + } + } + return (1); +} + +/* apply tempo and fold */ +static void seq_foldtime(t_seq *x, double deftempo) +{ + t_seqevent *sev; + t_seqtempo *stm = x->x_tempomap; + double coef = 1000. / deftempo; + int ex, tx = 0; + double prevscoretime = 0.; + while (tx < x->x_ntempi && stm->t_scoretime < SEQ_TICKEPSILON) + tx++, coef = 1000. / stm++->t_sr; + for (ex = 0, sev = x->x_sequence; ex < x->x_nevents; ex++, sev++) + { + double clockdelta = 0.; + while (tx < x->x_ntempi && stm->t_scoretime <= sev->e_delta) + { + clockdelta += (stm->t_scoretime - prevscoretime) * coef; + prevscoretime = stm->t_scoretime; + tx++; + coef = 1000. / stm++->t_sr; + } + clockdelta += (sev->e_delta - prevscoretime) * coef; + prevscoretime = sev->e_delta; + sev->e_delta = clockdelta; + } +} + +static int seq_mfread(t_seq *x, char *path) +{ + int result = 0; + t_mifiread *mr = mifiread_new((t_pd *)x); + if (!mifiread_open(mr, path, "", 0)) + goto mfreadfailed; +#ifdef SEQ_DEBUG + loudbug_startpost("midifile (format %d): %d tracks, %d ticks", + mifiread_getformat(mr), mifiread_gethdtracks(mr), + mifiread_getbeatticks(mr)); + if (mifiread_getnframes(mr)) + loudbug_post(" (%d smpte frames)", mifiread_getnframes(mr)); + else + loudbug_post(" per beat"); +#endif + if (!seq_dogrowing(x, mifiread_getnevents(mr), mifiread_getntempi(mr))) + goto mfreadfailed; + x->x_eventreadhead = 0; + x->x_temporeadhead = 0; + if (mifiread_doit(mr, seq_mrhook, x) != MIFIREAD_EOF) + goto mfreadfailed; + if (x->x_eventreadhead < x->x_nevents) + { + loudbug_bug("seq_mfread 1"); + loudbug_post("declared %d events, got %d", + x->x_nevents, x->x_eventreadhead); + x->x_nevents = x->x_eventreadhead; + } + if (x->x_nevents) + qsort(x->x_sequence, x->x_nevents, sizeof(*x->x_sequence), + seq_eventcomparehook); + if (x->x_temporeadhead < x->x_ntempi) + { + loudbug_bug("seq_mfread 2"); + loudbug_post("declared %d tempi, got %d", + x->x_ntempi, x->x_temporeadhead); + x->x_ntempi = x->x_temporeadhead; + } + if (x->x_ntempi) + qsort(x->x_tempomap, x->x_ntempi, sizeof(*x->x_tempomap), + seq_tempocomparehook); + seq_foldtime(x, mifiread_getdeftempo(mr)); +#ifdef SEQ_DEBUG + loudbug_post("seq: got %d events from midi file", x->x_nevents); +#endif + result = 1; +mfreadfailed: + mifiread_free(mr); + return (result); +} + +static int seq_mfwrite(t_seq *x, char *path) +{ + int result = 0; + t_seqevent *sev = x->x_sequence; + int nevents = x->x_nevents; + t_mifiwrite *mw = mifiwrite_new((t_pd *)x); + if (!mifiwrite_open(mw, path, "", 1, 1)) + goto mfwritefailed; + if (!mifiwrite_opentrack(mw, "seq-track", 1)) + goto mfwritefailed; + while (nevents--) + { + unsigned char *bp = sev->e_bytes; + unsigned status = *bp & 0xf0; + if (status > 127 && status < 240) + { + if (!mifiwrite_channelevent(mw, sev->e_delta, status, *bp & 0x0f, + bp[1], bp[2])) /* SEQ_EOM ignored */ + { + loud_error((t_pd *)x, "cannot write channel event %d", status); + goto mfwritefailed; + } + } + /* FIXME system, sysex (first, and continuation) */ + sev++; + } + if (!mifiwrite_closetrack(mw, 0., 1)) + goto mfwritefailed; + mifiwrite_close(mw); + result = 1; +mfwritefailed: + if (!result) + loud_errand((t_pd *)x, + "while saving sequence into midi file \"%s\"", path); + mifiwrite_free(mw); + return (result); +} + +/* CHECKED text file input: absolute timestamps, semi-terminated, verified */ +/* FIXME prevent loading .pd files... */ +static int seq_fromatoms(t_seq *x, int ac, t_atom *av, int abstime) +{ + int i, nevents = 0; + t_atom *ap; + for (i = 0, ap = av; i < ac; i++, ap++) + if (ap->a_type == A_SEMI) /* FIXME parsing */ + nevents++; + if (nevents) + { + t_seqevent *ep; + float prevtime = 0; + if (!seq_dogrowing(x, nevents, 0)) + return (0); + i = -1; + nevents = 0; + ep = x->x_sequence; + while (ac--) + { + if (av->a_type == A_FLOAT) + { + if (i < 0) + { + if (abstime) + { + ep->e_delta = av->a_w.w_float - prevtime; + prevtime = av->a_w.w_float; + } + else ep->e_delta = av->a_w.w_float; + i = 0; + } + else if (i < 4) + ep->e_bytes[i++] = av->a_w.w_float; + /* CHECKME else */ + } + else if (av->a_type == A_SEMI && i > 0) + { + if (i < 4) + ep->e_bytes[i] = SEQ_EOM; + nevents++; + ep++; + i = -1; + } + /* CHECKME else */ + av++; + } + x->x_nevents = nevents; + } + return (nevents); +} + +static void seq_tobinbuf(t_seq *x, t_binbuf *bb) +{ + int nevents = x->x_nevents; + t_seqevent *ep = x->x_sequence; + t_atom at[5]; + float timestamp = 0; + while (nevents--) + { + unsigned char *bp = ep->e_bytes; + int i; + t_atom *ap = at; + timestamp += ep->e_delta; + SETFLOAT(ap, timestamp); /* CHECKED same for sysex continuation */ + ap++; + SETFLOAT(ap, *bp); + for (i = 0, ap++, bp++; i < 3 && *bp != SEQ_EOM; i++, ap++, bp++) + SETFLOAT(ap, *bp); + binbuf_add(bb, i + 2, at); + binbuf_addsemi(bb); + ep++; + } +} + +static void seq_textread(t_seq *x, char *path) +{ + t_binbuf *bb; + bb = binbuf_new(); + if (binbuf_read(bb, path, "", 0)) + { + /* CHECKED no complaint, open dialog presented */ + hammerpanel_open(x->x_filehandle, 0); /* LATER rethink */ + } + else + { + int nlines = /* CHECKED absolute timestamps */ + seq_fromatoms(x, binbuf_getnatom(bb), binbuf_getvec(bb), 1); + if (nlines < 0) + /* CHECKED "bad MIDI file (truncated)" alert, even if a text file */ + loud_error((t_pd *)x, "bad text file (truncated)"); + else if (nlines == 0) + { + /* CHECKED no complaint, sequence erased, LATER rethink */ + } + } + binbuf_free(bb); +} + +static void seq_textwrite(t_seq *x, char *path) +{ + t_binbuf *bb; + bb = binbuf_new(); + seq_tobinbuf(x, bb); + /* CHECKED empty sequence stored as an empty file */ + if (binbuf_write(bb, path, "", 0)) + { + /* CHECKME complaint and FIXME */ + loud_error((t_pd *)x, "error writing text file"); + } + binbuf_free(bb); +} + +static void seq_doread(t_seq *x, t_symbol *fn, int creation) +{ + char buf[MAXPDSTRING]; + /* FIXME use open_via_path() */ + if (x->x_canvas) + canvas_makefilename(x->x_canvas, fn->s_name, buf, MAXPDSTRING); + else + { + strncpy(buf, fn->s_name, MAXPDSTRING); + buf[MAXPDSTRING-1] = 0; + } + if (creation) + { + /* loading during object creation -- CHECKED no warning if a file + specified with an arg does not exist, LATER rethink */ + FILE *fp; + if (!(fp = sys_fopen(buf, "r"))) + return; + fclose(fp); + } + /* CHECKED all cases: arg or not, message and creation */ + post("seq: reading %s", fn->s_name); + if (!seq_mfread(x, buf)) + seq_textread(x, buf); +} + +static void seq_dowrite(t_seq *x, t_symbol *fn) +{ + char buf[MAXPDSTRING], *dotp; + if (x->x_canvas) + canvas_makefilename(x->x_canvas, fn->s_name, buf, MAXPDSTRING); + else + { + strncpy(buf, fn->s_name, MAXPDSTRING); + buf[MAXPDSTRING-1] = 0; + } + post("seq: writing %s", fn->s_name); /* CHECKED arg or not */ + /* save as text for any extension other then ".mid" */ + if ((dotp = strrchr(fn->s_name, '.')) && strcmp(dotp + 1, "mid")) + seq_textwrite(x, buf); + else /* save as mf for ".mid" (FIXME ignore case?) or no extension at all, + LATER rethink */ + seq_mfwrite(x, buf); +} + +static void seq_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + seq_doread((t_seq *)z, fn, 0); +} + +static void seq_writehook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + seq_dowrite((t_seq *)z, fn); +} + +static void seq_read(t_seq *x, t_symbol *s) +{ + if (s && s != &s_) + seq_doread(x, s, 0); + else /* CHECKED no default file name */ + /* start in a dir last read from, if any, otherwise in a canvas dir */ + hammerpanel_open(x->x_filehandle, 0); +} + +static void seq_write(t_seq *x, t_symbol *s) +{ + if (s && s != &s_) + seq_dowrite(x, s); + else /* CHECKED creation arg is a default file name */ + hammerpanel_save(x->x_filehandle, + /* always start in canvas dir */ + canvas_getdir(x->x_canvas), x->x_defname); +} + +static void seq_eventstring(t_seq *x, char *buf, t_seqevent *ep, int editable) +{ + unsigned char *bp = ep->e_bytes; + int i; + if (editable) + sprintf(buf, "%g", ep->e_delta); + else if (*bp < 128 || *bp == 247) + sprintf(buf, "(%g)->", ep->e_delta); + else + sprintf(buf, "(%g)", ep->e_delta); + buf += strlen(buf); + sprintf(buf, " %g", (float)*bp); + for (i = 0, bp++; i < 3 && *bp != SEQ_EOM; i++, bp++) + { + buf += strlen(buf); + sprintf(buf, " %g", (float)*bp); + } +} + +static void seq_print(t_seq *x) +{ + int nevents = x->x_nevents; + startpost("midiseq:"); /* CHECKED */ + if (nevents) + { + t_seqevent *ep = x->x_sequence; + char buf[MAXPDSTRING+2]; + int truncated; + if (nevents > 16) + nevents = 16, truncated = 1; + else + truncated = 0; + endpost(); + while (nevents--) + { /* CHECKED bytes are space-separated, no semi */ + seq_eventstring(x, buf, ep, 0); + post(buf); + ep++; + } + if (truncated) post("..."); /* CHECKED */ + } + else post(" no sequence"); /* CHECKED */ +} + +static void seq_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av) +{ + seq_fromatoms((t_seq *)z, ac, av, 0); +} + +static void seq_click(t_seq *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + t_seqevent *ep = x->x_sequence; + int nevents = x->x_nevents; + char buf[MAXPDSTRING+2]; + hammereditor_open(x->x_filehandle, + (x->x_defname && x->x_defname != &s_ ? + x->x_defname->s_name : "<anonymous>"), 0); + while (nevents--) + { /* LATER rethink sysex continuation */ + seq_eventstring(x, buf, ep, 1); + strcat(buf, ";\n"); + hammereditor_append(x->x_filehandle, buf); + ep++; + } + hammereditor_setdirty(x->x_filehandle, 0); +} + +static void seq_free(t_seq *x) +{ + if (x->x_clock) clock_free(x->x_clock); + if (x->x_slaveclock) clock_free(x->x_slaveclock); + if (x->x_filehandle) hammerfile_free(x->x_filehandle); + if (x->x_sequence != x->x_seqini) + freebytes(x->x_sequence, x->x_seqsize * sizeof(*x->x_sequence)); + if (x->x_tempomap != x->x_tempomapini) + freebytes(x->x_tempomap, x->x_tempomapsize * sizeof(*x->x_tempomap)); +} + +static void *seq_new(t_symbol *s) +{ + t_seq *x = (t_seq *)pd_new(seq_class); + static int warned = 0; + if (fittermax_get() && !warned) + { + loud_warning((t_pd *)x, 0, "seq is not ready yet"); + warned = 1; + } + x->x_canvas = canvas_getcurrent(); + x->x_filehandle = hammerfile_new((t_pd *)x, 0, seq_readhook, seq_writehook, + seq_editorhook); + x->x_timescale = 1.; + x->x_newtimescale = 1.; + x->x_prevtime = 0.; + x->x_slaveprevtime = 0.; + x->x_seqsize = SEQ_INISEQSIZE; + x->x_nevents = 0; + x->x_sequence = x->x_seqini; + x->x_tempomapsize = SEQ_INITEMPOMAPSIZE; + x->x_ntempi = 0; + x->x_tempomap = x->x_tempomapini; + outlet_new((t_object *)x, &s_anything); + x->x_bangout = outlet_new((t_object *)x, &s_bang); + if (s && s != &s_) + { + x->x_defname = s; /* CHECKME if 'read' changes this */ + seq_doread(x, s, 1); + } + else x->x_defname = &s_; + x->x_clock = clock_new(x, (t_method)seq_clocktick); + x->x_slaveclock = clock_new(x, (t_method)seq_slaveclocktick); + return (x); +} + +void seq_setup(void) +{ + seq_class = class_new(gensym("seq"), + (t_newmethod)seq_new, + (t_method)seq_free, + sizeof(t_seq), 0, + A_DEFSYM, 0); + class_addbang(seq_class, seq_bang); + class_addfloat(seq_class, seq_float); + /* CHECKED symbol rejected */ + class_addsymbol(seq_class, seq_symbol); + /* CHECKED 1st atom of a list accepted if a float, ignored if a symbol */ + class_addlist(seq_class, seq_list); + class_addmethod(seq_class, (t_method)seq_record, + gensym("record"), 0); + class_addmethod(seq_class, (t_method)seq_append, + gensym("append"), 0); + class_addmethod(seq_class, (t_method)seq_start, + gensym("start"), A_DEFFLOAT, 0); + class_addmethod(seq_class, (t_method)seq_stop, + gensym("stop"), 0); + class_addmethod(seq_class, (t_method)seq_tick, + gensym("tick"), 0); + class_addmethod(seq_class, (t_method)seq_delay, + gensym("delay"), A_FLOAT, 0); /* CHECKED arg obligatory */ + class_addmethod(seq_class, (t_method)seq_hook, + gensym("hook"), A_FLOAT, 0); /* CHECKED arg obligatory */ + class_addmethod(seq_class, (t_method)seq_read, + gensym("read"), A_DEFSYM, 0); + class_addmethod(seq_class, (t_method)seq_write, + gensym("write"), A_DEFSYM, 0); + class_addmethod(seq_class, (t_method)seq_print, + gensym("print"), 0); + + /* incompatible extensions */ + class_addmethod(seq_class, (t_method)seq_pause, + gensym("pause"), 0); + class_addmethod(seq_class, (t_method)seq_continue, + gensym("continue"), 0); + class_addmethod(seq_class, (t_method)seq_goto, + gensym("goto"), A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod(seq_class, (t_method)seq_scoretime, + gensym("scoretime"), A_SYMBOL, 0); + class_addmethod(seq_class, (t_method)seq_tempo, + gensym("tempo"), A_FLOAT, 0); + class_addmethod(seq_class, (t_method)seq_cd, + gensym("cd"), A_DEFSYM, 0); + class_addmethod(seq_class, (t_method)seq_pwd, + gensym("pwd"), A_SYMBOL, 0); + class_addmethod(seq_class, (t_method)seq_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + hammerfile_setup(seq_class, 0); + fitter_setup(seq_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/sinh.c b/externals/miXed/cyclone/hammer/sinh.c new file mode 100644 index 000000000..a2f215756 --- /dev/null +++ b/externals/miXed/cyclone/hammer/sinh.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define sinhf sinh +#endif + +typedef struct _sinh +{ + t_object x_ob; + float x_value; +} t_sinh; + +static t_class *sinh_class; + +static void sinh_bang(t_sinh *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void sinh_float(t_sinh *x, t_float f) +{ + /* CHECKME large values */ + outlet_float(((t_object *)x)->ob_outlet, x->x_value = sinhf(f)); +} + +static void *sinh_new(t_floatarg f) +{ + t_sinh *x = (t_sinh *)pd_new(sinh_class); + /* CHECKME large values */ + x->x_value = sinhf(f); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void sinh_setup(void) +{ + sinh_class = class_new(gensym("sinh"), + (t_newmethod)sinh_new, 0, + sizeof(t_sinh), 0, A_DEFFLOAT, 0); + class_addbang(sinh_class, sinh_bang); + class_addfloat(sinh_class, sinh_float); +} diff --git a/externals/miXed/cyclone/hammer/speedlim.c b/externals/miXed/cyclone/hammer/speedlim.c new file mode 100644 index 000000000..3cad0f71d --- /dev/null +++ b/externals/miXed/cyclone/hammer/speedlim.c @@ -0,0 +1,173 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER 'clock' method */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" + +#define SPEEDLIM_INISIZE 32 /* LATER rethink */ +#define SPEEDLIM_MAXSIZE 256 /* not used */ + +typedef struct _speedlim +{ + t_object x_ob; + int x_open; + t_float x_delta; + t_symbol *x_selector; + t_float x_float; + t_symbol *x_symbol; + t_gpointer *x_pointer; + int x_size; /* as allocated */ + int x_natoms; /* as used */ + t_atom *x_message; + t_atom x_messini[SPEEDLIM_INISIZE]; + int x_entered; + t_clock *x_clock; +} t_speedlim; + +static t_class *speedlim_class; + +static void speedlim_dooutput(t_speedlim *x, t_symbol *s, int ac, t_atom *av) +{ + x->x_open = 0; /* so there will be no reentrant calls of dooutput */ + x->x_entered = 1; /* this prevents a message from being overridden */ + clock_unset(x->x_clock); + if (s == &s_bang) + outlet_bang(((t_object *)x)->ob_outlet); + else if (s == &s_float) + outlet_float(((t_object *)x)->ob_outlet, x->x_float); + else if (s == &s_symbol && x->x_symbol) + { + /* if x_symbol is null, then symbol &s_ is passed + by outlet_anything() -> typedmess() */ + outlet_symbol(((t_object *)x)->ob_outlet, x->x_symbol); + x->x_symbol = 0; + } + else if (s == &s_pointer && x->x_pointer) + { + /* LATER */ + x->x_pointer = 0; + } + else if (s == &s_list) + outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, av); + else if (s) + outlet_anything(((t_object *)x)->ob_outlet, s, ac, av); + x->x_selector = 0; + x->x_natoms = 0; + if (x->x_delta > 0) + clock_delay(x->x_clock, x->x_delta); + else + x->x_open = 1; + x->x_entered = 0; +} + +static void speedlim_tick(t_speedlim *x) +{ + if (x->x_selector) + speedlim_dooutput(x, x->x_selector, x->x_natoms, x->x_message); + else + x->x_open = 1; +} + +static void speedlim_anything(t_speedlim *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_open) + speedlim_dooutput(x, s, ac, av); + else if (s && s != &s_ && !x->x_entered) + { + if (ac > x->x_size) + /* MAXSIZE not used, not even a warning... + LATER consider clipping */ + x->x_message = grow_nodata(&ac, &x->x_size, x->x_message, + SPEEDLIM_INISIZE, x->x_messini, + sizeof(*x->x_message)); + x->x_selector = s; + x->x_natoms = ac; + if (ac) + memcpy(x->x_message, av, ac * sizeof(*x->x_message)); + } +} + +static void speedlim_bang(t_speedlim *x) +{ + x->x_selector = &s_bang; + speedlim_anything(x, x->x_selector, 0, 0); +} + +static void speedlim_float(t_speedlim *x, t_float f) +{ + x->x_selector = &s_float; + x->x_float = f; + speedlim_anything(x, x->x_selector, 0, 0); +} + +static void speedlim_symbol(t_speedlim *x, t_symbol *s) +{ + x->x_selector = &s_symbol; + x->x_symbol = s; + speedlim_anything(x, x->x_selector, 0, 0); +} + +/* LATER gpointer */ + +static void speedlim_list(t_speedlim *x, t_symbol *s, int ac, t_atom *av) +{ + x->x_selector = &s_list; + speedlim_anything(x, x->x_selector, ac, av); +} + +static void speedlim_ft1(t_speedlim *x, t_floatarg f) +{ + if (f < 0) + f = 0; /* redundant (and CHECKED) */ + x->x_delta = f; + /* CHECKED: no rearming -- + if clock is set, then new delta value is not used until next tick */ +} + +static void speedlim_free(t_speedlim *x) +{ + if (x->x_message != x->x_messini) + freebytes(x->x_message, x->x_size * sizeof(*x->x_message)); + if (x->x_clock) + clock_free(x->x_clock); +} + +static void *speedlim_new(t_floatarg f) +{ + t_speedlim *x = (t_speedlim *)pd_new(speedlim_class); + x->x_open = 1; /* CHECKED */ + x->x_delta = 0; + x->x_selector = 0; + x->x_float = 0; + x->x_symbol = 0; + x->x_pointer = 0; + x->x_size = SPEEDLIM_INISIZE; + x->x_natoms = 0; + x->x_message = x->x_messini; + x->x_entered = 0; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_anything); + x->x_clock = clock_new(x, (t_method)speedlim_tick); + speedlim_ft1(x, f); + return (x); +} + +void speedlim_setup(void) +{ + speedlim_class = class_new(gensym("speedlim"), + (t_newmethod)speedlim_new, + (t_method)speedlim_free, + sizeof(t_speedlim), 0, + A_DEFFLOAT, 0); + class_addbang(speedlim_class, speedlim_bang); + class_addfloat(speedlim_class, speedlim_float); + class_addsymbol(speedlim_class, speedlim_symbol); + class_addlist(speedlim_class, speedlim_list); + class_addanything(speedlim_class, speedlim_anything); + class_addmethod(speedlim_class, (t_method)speedlim_ft1, + gensym("ft1"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/hammer/spell.c b/externals/miXed/cyclone/hammer/spell.c new file mode 100644 index 000000000..f9a32d6ae --- /dev/null +++ b/externals/miXed/cyclone/hammer/spell.c @@ -0,0 +1,149 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include "m_pd.h" +#include "common/loud.h" + +typedef struct _spell +{ + t_object x_ob; + int x_minsize; + int x_padchar; /* actually, any nonnegative integer (CHECKED) */ +} t_spell; + +static t_class *spell_class; + +static void spell_fill(t_spell *x, int cnt) +{ + for (; cnt < x->x_minsize; cnt++) + outlet_float(((t_object *)x)->ob_outlet, x->x_padchar); +} + +/* CHECKED: chars are spelled as signed */ +static int spell_out(t_spell *x, char *ptr, int flush) +{ + int cnt = 0; + while (*ptr) + outlet_float(((t_object *)x)->ob_outlet, *ptr++), cnt++; + if (flush) + { + spell_fill(x, cnt); + return (0); + } + return (cnt); +} + +static void spell_bang(t_spell *x) +{ + /* need to somehow override a default bang-to-empty-list conversion... */ + loud_nomethod((t_pd *)x, &s_bang); /* CHECKED */ +} + +static void spell_float(t_spell *x, t_float f) +{ + int i; + if (loud_checkint((t_pd *)x, f, &i, &s_float)) /* CHECKED */ + { + char buf[16]; + sprintf(buf, "%d", i); /* CHECKED (negative numbers) */ + spell_out(x, buf, 1); + } +} + +/* CHECKED: 'symbol' selector is not spelled! */ +static void spell_symbol(t_spell *x, t_symbol *s) +{ + spell_out(x, s->s_name, 1); +} + +static void spell_list(t_spell *x, t_symbol *s, int ac, t_atom *av) +{ + int cnt = 0; + int addsep = 0; + while (ac--) + { + if (addsep) + { + outlet_float(((t_object *)x)->ob_outlet, x->x_padchar); + cnt++; + } + else addsep = 1; + if (av->a_type == A_FLOAT) + { + int i; + /* CHECKME */ + if (loud_checkint((t_pd *)x, av->a_w.w_float, &i, &s_list)) + { + char buf[16]; + sprintf(buf, "%d", i); /* CHECKED (negative numbers) */ + cnt += spell_out(x, buf, 0); + } + /* CHECKED: floats as empty strings (separator is added) */ + } + /* CHECKED: symbols as empty strings (separator is added) */ + av++; + } + if (cnt) /* CHECKED: empty list is silently ignored */ + spell_fill(x, cnt); +} + +static void spell_anything(t_spell *x, t_symbol *s, int ac, t_atom *av) +{ + int cnt = 0; + int addsep = 0; + if (s) + { + cnt += spell_out(x, s->s_name, 0); + addsep = 1; + } + while (ac--) + { + if (addsep) + { + outlet_float(((t_object *)x)->ob_outlet, x->x_padchar); + cnt++; + } + else addsep = 1; + if (av->a_type == A_FLOAT) + { + int i; + /* CHECKME */ + if (loud_checkint((t_pd *)x, av->a_w.w_float, &i, &s_list)) + { + char buf[16]; + sprintf(buf, "%d", i); /* CHECKED (negative numbers) */ + cnt += spell_out(x, buf, 0); + } + /* CHECKED: floats as empty strings (separator is added) */ + } + else if (av->a_type == A_SYMBOL && av->a_w.w_symbol) + cnt += spell_out(x, av->a_w.w_symbol->s_name, 0); + av++; + } + if (cnt) /* CHECKED: empty list is silently ignored */ + spell_fill(x, cnt); +} + +static void *spell_new(t_floatarg f1, t_floatarg f2) +{ + t_spell *x = (t_spell *)pd_new(spell_class); + int i2 = (int)f2; /* CHECKED */ + x->x_minsize = (f1 > 0 ? (int)f1 : 0); + x->x_padchar = (i2 < 0 ? 0 : (i2 > 0 ? i2 : ' ')); /* CHECKED */ + outlet_new((t_object *)x, &s_float); + return (x); +} + +void spell_setup(void) +{ + spell_class = class_new(gensym("spell"), + (t_newmethod)spell_new, 0, + sizeof(t_spell), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(spell_class, spell_bang); + class_addfloat(spell_class, spell_float); + class_addsymbol(spell_class, spell_symbol); + class_addlist(spell_class, spell_list); + class_addanything(spell_class, spell_anything); +} diff --git a/externals/miXed/cyclone/hammer/split.c b/externals/miXed/cyclone/hammer/split.c new file mode 100644 index 000000000..2865f6667 --- /dev/null +++ b/externals/miXed/cyclone/hammer/split.c @@ -0,0 +1,64 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +/* CHECKED: + 'list <symbol>' silently ignored (LATER remove a warning) + '<number> <symbol>' as '<number>' (LATER remove a warning) + LATER more compatibility checks are needed... + LATER sort out float/int dilemmas +*/ + +typedef struct _split +{ + t_object x_ob; + int x_floatmode; + t_float x_min; + t_float x_max; + t_outlet *x_out2; +} t_split; + +static t_class *split_class; + +static void split_float(t_split *x, t_float f) +{ + if (x->x_floatmode) + { + if (f >= x->x_min && f <= x->x_max) + outlet_float(((t_object *)x)->ob_outlet, f); + else outlet_float(x->x_out2, f); + } + else + { + /* CHECKED: no pre-truncation */ + if (f >= x->x_min && f <= x->x_max) + outlet_float(((t_object *)x)->ob_outlet, (int)f); + else outlet_float(x->x_out2, (int)f); + } +} + +static void *split_new(t_floatarg f1, t_floatarg f2) +{ + t_split *x = (t_split *)pd_new(split_class); + x->x_floatmode = (f1 != (int)f1); + /* CHECKED: defaults are [0..0] and [0..f1] (for positive f1) or [f1..0] */ + if (f1 < f2) /* CHECKED */ + x->x_min = f1, x->x_max = f2; + else + x->x_min = f2, x->x_max = f1; + floatinlet_new((t_object *)x, &x->x_min); + floatinlet_new((t_object *)x, &x->x_max); + outlet_new((t_object *)x, &s_float); + x->x_out2 = outlet_new((t_object *)x, &s_float); + return (x); +} + +void split_setup(void) +{ + split_class = class_new(gensym("split"), + (t_newmethod)split_new, 0, + sizeof(t_split), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addfloat(split_class, split_float); +} diff --git a/externals/miXed/cyclone/hammer/spray.c b/externals/miXed/cyclone/hammer/spray.c new file mode 100644 index 000000000..8aa05566f --- /dev/null +++ b/externals/miXed/cyclone/hammer/spray.c @@ -0,0 +1,93 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" + +#define SPRAY_MINOUTS 1 +/* CHECKED: no upper limit */ +#define SPRAY_DEFOUTS 2 + +typedef struct _spray +{ + t_object x_ob; + int x_offset; + int x_nouts; + t_outlet **x_outs; +} t_spray; + +static t_class *spray_class; + +static void spray_float(t_spray *x, t_float f) +{ + /* CHECKED: floats ignored (LATER rethink), ints loudly rejected */ + if (f == (int)f) loud_error((t_pd *)x, "requires list"); +} + +/* LATER decide, whether float in first atom is to be truncated, + or causing a list to be ignored as in max (CHECKED) */ +static void spray_list(t_spray *x, t_symbol *s, int ac, t_atom *av) +{ + int ndx; + if (ac >= 2 && av->a_type == A_FLOAT + /* CHECKED: lists with negative effective ndx are ignored */ + && (ndx = (int)av->a_w.w_float - x->x_offset) >= 0 + && ndx < x->x_nouts) + { + /* CHECKED: ignored atoms (symbols and floats) are counted */ + /* CHECKED: we must spray in right-to-left order */ + t_atom *argp; + t_outlet **outp; + int last = ac - 1 + ndx; /* ndx of last outlet filled (first is 1) */ + if (last > x->x_nouts) + { + argp = av + 1 + x->x_nouts - ndx; + outp = x->x_outs + x->x_nouts; + } + else + { + argp = av + ac; + outp = x->x_outs + last; + } + /* argp/outp now point to one after the first atom/outlet to deliver */ + for (argp--, outp--; argp > av; argp--, outp--) + if (argp->a_type == A_FLOAT) + outlet_float(*outp, argp->a_w.w_float); + } +} + +static void spray_free(t_spray *x) +{ + if (x->x_outs) + freebytes(x->x_outs, x->x_nouts * sizeof(*x->x_outs)); +} + +static void *spray_new(t_floatarg f1, t_floatarg f2) +{ + t_spray *x; + int i, nouts = (int)f1; + t_outlet **outs; + if (nouts < SPRAY_MINOUTS) + nouts = SPRAY_DEFOUTS; + if (!(outs = (t_outlet **)getbytes(nouts * sizeof(*outs)))) + return (0); + x = (t_spray *)pd_new(spray_class); + x->x_nouts = nouts; + x->x_outs = outs; + x->x_offset = (int)f2; + for (i = 0; i < nouts; i++) + x->x_outs[i] = outlet_new((t_object *)x, &s_float); + return (x); +} + +void spray_setup(void) +{ + spray_class = class_new(gensym("spray"), + (t_newmethod)spray_new, + (t_method)spray_free, + sizeof(t_spray), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + /* CHECKED: bang, symbol, anything -- ``doesn't understand'' */ + class_addfloat(spray_class, spray_float); + class_addlist(spray_class, spray_list); +} diff --git a/externals/miXed/cyclone/hammer/sprintf.c b/externals/miXed/cyclone/hammer/sprintf.c new file mode 100644 index 000000000..8c9aefd0e --- /dev/null +++ b/externals/miXed/cyclone/hammer/sprintf.c @@ -0,0 +1,643 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" + +#ifdef KRZYSZCZ +//#define SPRINTF_DEBUG +#endif + +/* Pattern types. These are the parsing routine's return values. + If returned value is >= SPRINTF_MINSLOTTYPE, then another slot + is created (i.e. an inlet, and a proxy handling it). */ +#define SPRINTF_UNSUPPORTED 0 +#define SPRINTF_LITERAL 1 +#define SPRINTF_MINSLOTTYPE 2 +#define SPRINTF_INT 2 +#define SPRINTF_FLOAT 3 +#define SPRINTF_CHAR 4 +#define SPRINTF_STRING 5 + +/* Numbers: assuming max 62 digits preceding a decimal point in any + fixed-point representation of a t_float (39 in my system) + -- need to be sure, that using max precision would never produce + a representation longer than max width. If this is so, then no number + representation would exceed max width (presumably...). + Strings: for the time being, any string longer than max width would + be truncated (somehow compatible with Str256, but LATER warn-and-allow). */ +/* LATER rethink it all */ +#define SPRINTF_MAXPRECISION 192 +#define SPRINTF_MAXWIDTH 256 + +typedef struct _sprintf +{ + t_object x_ob; + int x_nslots; + int x_nproxies; /* as requested (and allocated) */ + t_pd **x_proxies; + int x_fsize; /* as allocated (i.e. including a terminating 0) */ + char *x_fstring; +} t_sprintf; + +typedef struct _sprintf_proxy +{ + t_object p_ob; + t_sprintf *p_master; + int p_id; + int p_type; /* a value #defined above */ + char *p_pattern; + char *p_pattend; + t_atom p_atom; /* current input */ + int p_size; + int p_valid; +} t_sprintf_proxy; + +static t_class *sprintf_class; +static t_class *sprintf_proxy_class; + +/* CHECKED: 'symout' argument has no special meaning in max4.07, + LATER investigate */ + +/* LATER use snprintf, if it is available on other systems (should be...) */ +static void sprintf_proxy_checkit(t_sprintf_proxy *x, char *buf, int checkin) +{ + int result = 0, valid = 0; + char *pattend = x->p_pattend; + if (pattend) + { + char tmp = *pattend; + *pattend = 0; + if (x->p_atom.a_type == A_FLOAT) + { + t_float f = x->p_atom.a_w.w_float; + if (x->p_type == SPRINTF_INT) + /* CHECKME large/negative values */ + result = sprintf(buf, x->p_pattern, (int)f); + else if (x->p_type == SPRINTF_FLOAT) + result = sprintf(buf, x->p_pattern, f); + else if (x->p_type == SPRINTF_CHAR) + /* CHECKED: if 0 is input into a %c-slot, the whole output + string is null-terminated */ + /* CHECKED: float into a %c-slot is truncated, + but CHECKME large/negative values */ + result = sprintf(buf, x->p_pattern, (unsigned char)f); + else if (x->p_type == SPRINTF_STRING) + { + /* CHECKED: any number input into a %s-slot is ok */ + char tmp[64]; /* LATER rethink */ + sprintf(tmp, "%g", f); + result = sprintf(buf, x->p_pattern, tmp); + } + else /* LATER consider calling it a bug(), rather than error? */ + loud_error((t_pd *)x->p_master, + "can't convert float to type of argument %d", + x->p_id + 1); + if (result > 0) + valid = 1; + } + else if (x->p_atom.a_type == A_SYMBOL) + { + t_symbol *s = x->p_atom.a_w.w_symbol; + if (x->p_type == SPRINTF_STRING) + { + if (strlen(s->s_name) > SPRINTF_MAXWIDTH) + { + strncpy(buf, s->s_name, SPRINTF_MAXWIDTH); + buf[SPRINTF_MAXWIDTH] = 0; + result = SPRINTF_MAXWIDTH; + } + else result = sprintf(buf, x->p_pattern, s->s_name); + if (result >= 0) + valid = 1; + } + else /* CHECKED */ + loud_error((t_pd *)x->p_master, + "can't convert symbol to type of argument %d", + x->p_id + 1); + } + *pattend = tmp; + } + else loudbug_bug("sprintf_proxy_checkit"); + if (x->p_valid = valid) + { +#ifdef SPRINTF_DEBUG + if (checkin) loudbug_post("[%d in \"%s\"]", result, buf); +#endif + x->p_size = result; + } + else + { +#ifdef SPRINTF_DEBUG + if (checkin) loudbug_post("checkit failed"); +#endif + x->p_size = 0; + } +} + +static void sprintf_dooutput(t_sprintf *x) +{ + int i, outsize; + char *outstring; + outsize = x->x_fsize; /* this is strlen() + 1 */ + /* LATER consider subtracting format pattern sizes */ + for (i = 0; i < x->x_nslots; i++) + { + t_sprintf_proxy *y = (t_sprintf_proxy *)x->x_proxies[i]; + if (y->p_valid) + outsize += y->p_size; + else + { + /* slot i has received an invalid input -- CHECKME if this + condition blocks all subsequent output requests? */ + return; + } + } + if (outsize > 0 && (outstring = getbytes(outsize))) + { + char *inp = x->x_fstring; + char *outp = outstring; + for (i = 0; i < x->x_nslots; i++) + { + t_sprintf_proxy *y = (t_sprintf_proxy *)x->x_proxies[i]; + int len = y->p_pattern - inp; + if (len > 0) + { + strncpy(outp, inp, len); + outp += len; + } + sprintf_proxy_checkit(y, outp, 0); + outp += y->p_size; /* p_size is never negative */ + inp = y->p_pattend; + } + strcpy(outp, inp); + + outp = outstring; + while (*outp == ' ' || *outp == '\t' + || *outp == '\n' || *outp == '\r') outp++; + if (*outp) + { + t_binbuf *bb = binbuf_new(); + int ac; + t_atom *av; + binbuf_text(bb, outp, strlen(outp)); + ac = binbuf_getnatom(bb); + av = binbuf_getvec(bb); + if (ac) + { + if (av->a_type == A_SYMBOL) + outlet_anything(((t_object *)x)->ob_outlet, + av->a_w.w_symbol, ac - 1, av + 1); + else if (av->a_type == A_FLOAT) + { + if (ac > 1) + outlet_list(((t_object *)x)->ob_outlet, + &s_list, ac, av); + else + outlet_float(((t_object *)x)->ob_outlet, + av->a_w.w_float); + } + } + binbuf_free(bb); + } + freebytes(outstring, outsize); + } +} + +static void sprintf_proxy_bang(t_sprintf_proxy *x) +{ + sprintf_dooutput(x->p_master); /* CHECKED (in any inlet) */ +} + +static void sprintf_proxy_float(t_sprintf_proxy *x, t_float f) +{ + char buf[SPRINTF_MAXWIDTH + 1]; /* LATER rethink */ + SETFLOAT(&x->p_atom, f); + sprintf_proxy_checkit(x, buf, 1); + if (x->p_id == 0 && x->p_valid) + sprintf_dooutput(x->p_master); /* CHECKED: only first inlet */ +} + +static void sprintf_proxy_symbol(t_sprintf_proxy *x, t_symbol *s) +{ + char buf[SPRINTF_MAXWIDTH + 1]; /* LATER rethink */ + if (s && *s->s_name) + SETSYMBOL(&x->p_atom, s); + else + SETFLOAT(&x->p_atom, 0); + sprintf_proxy_checkit(x, buf, 1); + if (x->p_id == 0 && x->p_valid) + sprintf_dooutput(x->p_master); /* CHECKED: only first inlet */ +} + +static void sprintf_dolist(t_sprintf *x, + t_symbol *s, int ac, t_atom *av, int startid) +{ + int cnt = x->x_nslots - startid; + if (ac > cnt) + ac = cnt; + if (ac-- > 0) + { + int id; + for (id = startid + ac, av += ac; id >= startid; id--, av--) + { + if (av->a_type == A_FLOAT) + sprintf_proxy_float((t_sprintf_proxy *)x->x_proxies[id], + av->a_w.w_float); + else if (av->a_type == A_SYMBOL) + sprintf_proxy_symbol((t_sprintf_proxy *)x->x_proxies[id], + av->a_w.w_symbol); + } + } +} + +static void sprintf_doanything(t_sprintf *x, + t_symbol *s, int ac, t_atom *av, int startid) +{ + if (s && s != &s_) + { + sprintf_dolist(x, 0, ac, av, startid + 1); + sprintf_proxy_symbol((t_sprintf_proxy *)x->x_proxies[startid], s); + } + else sprintf_dolist(x, 0, ac, av, startid); +} + +static void sprintf_proxy_list(t_sprintf_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + sprintf_dolist(x->p_master, s, ac, av, x->p_id); +} + +static void sprintf_proxy_anything(t_sprintf_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + sprintf_doanything(x->p_master, s, ac, av, x->p_id); +} + +static void sprintf_bang(t_sprintf *x) +{ + if (x->x_nslots) + sprintf_proxy_bang((t_sprintf_proxy *)x->x_proxies[0]); +} + +static void sprintf_float(t_sprintf *x, t_float f) +{ + if (x->x_nslots) + sprintf_proxy_float((t_sprintf_proxy *)x->x_proxies[0], f); +} + +static void sprintf_symbol(t_sprintf *x, t_symbol *s) +{ + if (x->x_nslots) + sprintf_proxy_symbol((t_sprintf_proxy *)x->x_proxies[0], s); +} + +static void sprintf_list(t_sprintf *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_nslots) + sprintf_dolist(x, s, ac, av, 0); +} + +static void sprintf_anything(t_sprintf *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_nslots) + sprintf_doanything(x, s, ac, av, 0); +} + +/* adjusted binbuf_gettext(), LATER do it right */ +static char *hammer_gettext(int ac, t_atom *av, int *sizep) +{ + char *buf = getbytes(1); + int size = 1; + char atomtext[MAXPDSTRING]; + while (ac--) + { + char *newbuf; + int newsize; + if (buf[size-1] == 0 || av->a_type == A_SEMI || av->a_type == A_COMMA) + size--; + atom_string(av, atomtext, MAXPDSTRING); + newsize = size + strlen(atomtext) + 1; + if (!(newbuf = resizebytes(buf, size, newsize))) + { + *sizep = 1; + return (getbytes(1)); + } + buf = newbuf; + strcpy(buf + size, atomtext); + size = newsize; + buf[size-1] = ' '; + av++; + } + buf[size-1] = 0; + *sizep = size; + return (buf); +} + +/* Called twice: 1st pass (with x == 0) is used for counting valid patterns; + 2nd pass (after object allocation) -- for initializing the proxies. + If there is a "%%" pattern, then the buffer is shrinked in the second pass + (LATER rethink). */ +static int sprintf_parsepattern(t_sprintf *x, char **patternp) +{ + int type = SPRINTF_UNSUPPORTED; + char errstring[MAXPDSTRING]; + char *ptr; + char modifier = 0; + int width = 0; + int precision = 0; + int *numfield = &width; + int dotseen = 0; + *errstring = 0; + for (ptr = *patternp; *ptr; ptr++) + { + if (*ptr >= '0' && *ptr <= '9') + { + if (!numfield) + { + if (x) sprintf(errstring, "extra number field"); + break; + } + *numfield = 10 * *numfield + *ptr - '0'; + if (dotseen) + { + if (precision > SPRINTF_MAXPRECISION) + { + if (x) sprintf(errstring, "precision field too large"); + break; + } + } + else + { + if (width > SPRINTF_MAXWIDTH) + { + if (x) sprintf(errstring, "width field too large"); + break; + } + } + continue; + } + if (*numfield) + numfield = 0; + + if (strchr("diouxX", *ptr)) + { + type = SPRINTF_INT; + break; + } + else if (strchr("aAeEfgG", *ptr)) + { + if (modifier) + { + if (x) sprintf(errstring, + "\'%c\' modifier not supported", modifier); + break; + } + type = SPRINTF_FLOAT; + break; + } + else if (strchr("c", *ptr)) + { + if (modifier) + { + if (x) sprintf(errstring, + "\'%c\' modifier not supported", modifier); + break; + } + type = SPRINTF_CHAR; + break; + } + else if (strchr("s", *ptr)) + { + if (modifier) + { + if (x) sprintf(errstring, + "\'%c\' modifier not supported", modifier); + break; + } + type = SPRINTF_STRING; + break; + } + else if (*ptr == '%') + { + type = SPRINTF_LITERAL; + if (x) + { /* buffer-shrinking hack, LATER rethink */ + char *p1 = ptr, *p2 = ptr + 1; + do + *p1++ = *p2; + while (*p2++); + ptr--; + } + break; + } + else if (strchr("CSnm", *ptr)) + { + if (x) sprintf(errstring, "\'%c\' type not supported", *ptr); + break; + } + else if (strchr("l", *ptr)) + { + if (modifier) + { + if (x) sprintf(errstring, "only single modifier is supported"); + break; + } + modifier = *ptr; + } + else if (strchr("hjLqtzZ", *ptr)) + { + if (x) sprintf(errstring, "\'%c\' modifier not supported", *ptr); + break; + } + else if (*ptr == '.') + { + if (dotseen) + { + if (x) sprintf(errstring, "multiple dots"); + break; + } + numfield = &precision; + dotseen = 1; + } + else if (*ptr == '$') + { + if (x) sprintf(errstring, "parameter number field not supported"); + break; + } + else if (*ptr == '*') + { + if (x) sprintf(errstring, "%s parameter not supported", + (dotseen ? "precision" : "width")); + break; + } + else if (!strchr("-+ #\'", *ptr)) + { + if (x) sprintf(errstring, + "\'%c\' format character not supported", *ptr); + break; + } + } + if (*ptr) + ptr++; /* LATER rethink */ + else + if (x) sprintf(errstring, "type not specified"); + if (x && type == SPRINTF_UNSUPPORTED) + { + if (*errstring) + loud_error((t_pd *)x, "slot skipped (%s %s)", + errstring, "in a format pattern"); + else + loud_error((t_pd *)x, "slot skipped"); + } + *patternp = ptr; + return (type); +} + +static void sprintf_free(t_sprintf *x) +{ + if (x->x_proxies) + { + int i = x->x_nslots; + while (i--) + { + t_sprintf_proxy *y = (t_sprintf_proxy *)x->x_proxies[i]; + pd_free((t_pd *)y); + } + freebytes(x->x_proxies, x->x_nproxies * sizeof(*x->x_proxies)); + } + if (x->x_fstring) + freebytes(x->x_fstring, x->x_fsize); +} + +static void *sprintf_new(t_symbol *s, int ac, t_atom *av) +{ + t_sprintf *x; + int fsize; + char *fstring; + char *p1, *p2; + int i, nslots, nproxies = 0; + t_pd **proxies; + fstring = hammer_gettext(ac, av, &fsize); + p1 = fstring; + while (p2 = strchr(p1, '%')) + { + int type; + p1 = p2 + 1; + type = sprintf_parsepattern(0, &p1); + if (type >= SPRINTF_MINSLOTTYPE) + nproxies++; + } + if (!nproxies) + { + /* CHECKED: an object without arguments, if created in the editor, + has no inlets/outlets, but it would have one inlet (no outlets) + upon loading. Error message is printed in either case. */ + x = (t_sprintf *)pd_new(sprintf_class); + x->x_nslots = 0; + x->x_nproxies = 0; + x->x_proxies = 0; + x->x_fsize = fsize; + x->x_fstring = fstring; + p1 = fstring; + while (p2 = strchr(p1, '%')) + { + p1 = p2 + 1; + sprintf_parsepattern(x, &p1); + } + loud_error((t_pd *)x, + "an object created without valid format patterns..."); + return (x); + } +#ifdef SPRINTF_DEBUG + loudbug_post("%d slots:", nproxies); +#endif + /* CHECKED: max creates as many inlets, as there are %-signs, no matter + if they are valid, or not -- if not, it prints ``can't convert'' errors + for any input... */ + if (!(proxies = (t_pd **)getbytes(nproxies * sizeof(*proxies)))) + { + freebytes(fstring, fsize); + return (0); + } + for (nslots = 0; nslots < nproxies; nslots++) + if (!(proxies[nslots] = pd_new(sprintf_proxy_class))) break; + if (!nslots) + { + freebytes(fstring, fsize); + freebytes(proxies, nproxies * sizeof(*proxies)); + return (0); + } + x = (t_sprintf *)pd_new(sprintf_class); + x->x_nslots = nslots; + x->x_nproxies = nproxies; + x->x_proxies = proxies; + x->x_fsize = fsize; + x->x_fstring = fstring; + p1 = fstring; + i = 0; + while (p2 = strchr(p1, '%')) + { + int type; + p1 = p2 + 1; + type = sprintf_parsepattern(x, &p1); + if (type >= SPRINTF_MINSLOTTYPE) + { +#ifdef SPRINTF_DEBUG + char tmp = *p1; + *p1 = 0; + loudbug_poststring(p2); + loudbug_endpost(); + *p1 = tmp; +#endif + if (i < nslots) + { + char buf[SPRINTF_MAXWIDTH + 1]; /* LATER rethink */ + t_sprintf_proxy *y = (t_sprintf_proxy *)proxies[i]; + y->p_master = x; + y->p_id = i; + y->p_type = type; + y->p_pattern = p2; + y->p_pattend = p1; + if (type == SPRINTF_STRING) + SETSYMBOL(&y->p_atom, &s_); + else + SETFLOAT(&y->p_atom, 0); + y->p_size = 0; + y->p_valid = 0; + if (i) inlet_new((t_object *)x, (t_pd *)y, 0, 0); + sprintf_proxy_checkit(y, buf, 1); + i++; + } + } + } +#ifdef SPRINTF_DEBUG + loudbug_post("printf(\"%s\", ...)", fstring); +#endif + outlet_new((t_object *)x, &s_anything); + return (x); +} + +void sprintf_setup(void) +{ + sprintf_class = class_new(gensym("sprintf"), + (t_newmethod)sprintf_new, + (t_method)sprintf_free, + sizeof(t_sprintf), 0, A_GIMME, 0); + class_addbang(sprintf_class, sprintf_bang); + class_addfloat(sprintf_class, sprintf_float); + class_addsymbol(sprintf_class, sprintf_symbol); + class_addlist(sprintf_class, sprintf_list); + class_addanything(sprintf_class, sprintf_anything); + sprintf_proxy_class = class_new(gensym("_sprintf_proxy"), 0, 0, + sizeof(t_sprintf_proxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(sprintf_proxy_class, sprintf_proxy_bang); + class_addfloat(sprintf_proxy_class, sprintf_proxy_float); + class_addsymbol(sprintf_proxy_class, sprintf_proxy_symbol); + class_addlist(sprintf_proxy_class, sprintf_proxy_list); + class_addanything(sprintf_proxy_class, sprintf_proxy_anything); +} diff --git a/externals/miXed/cyclone/hammer/substitute.c b/externals/miXed/cyclone/hammer/substitute.c new file mode 100644 index 000000000..c68419d68 --- /dev/null +++ b/externals/miXed/cyclone/hammer/substitute.c @@ -0,0 +1,344 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* CHECKED refman's rubbish: 1st outlet used only if there is a match, + unchanged messages go through the 2nd outlet (no bang there), + 3rd argument ignored (no single-replacement mode). */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" + +#define SUBSTITUTE_INISIZE 32 /* LATER rethink */ +#define SUBSTITUTE_MAXSIZE 256 + +typedef struct _substitute +{ + t_object x_ob; + t_pd *x_proxy; + t_atom x_match; + t_atom x_repl; + int x_size; /* as allocated */ + t_atom *x_message; + t_atom x_messini[SUBSTITUTE_INISIZE]; + int x_entered; + t_atom x_auxmatch; + t_atom x_auxrepl; + t_outlet *x_passout; +} t_substitute; + +typedef struct _substitute_proxy +{ + t_object p_ob; + t_atom *p_match; /* pointing to parent's (aux)match */ + t_atom *p_repl; +} t_substitute_proxy; + +static t_class *substitute_class; +static t_class *substitute_proxy_class; + +/* LATER rethink */ +static void substitute_dooutput(t_substitute *x, + t_symbol *s, int ac, t_atom *av, int pass) +{ + t_outlet *out = (pass ? x->x_passout : ((t_object *)x)->ob_outlet); + if (s == &s_float) + { + if (ac > 1) + outlet_list(out, &s_list, ac, av); + else + outlet_float(out, av->a_w.w_float); + } + else if (s == &s_bang && !ac) /* CHECKED */ + outlet_bang(out); + else if (s == &s_symbol && ac == 1 && av->a_type == A_SYMBOL) + outlet_symbol(out, av->a_w.w_symbol); + else if (s) + outlet_anything(out, s, ac, av); + else if (ac) + outlet_list(out, &s_list, ac, av); +} + +static int substitute_check(t_substitute *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_repl.a_type == A_NULL) + return (-2); + /* see substitute_proxy_validate() for possible types and values */ + if (x->x_match.a_type == A_FLOAT) + { + t_float f = x->x_match.a_w.w_float; + int i; + for (i = 0; i < ac; i++, av++) + if (av->a_type == A_FLOAT && av->a_w.w_float == f) + return (i); + } + else if (x->x_match.a_type == A_SYMBOL) + { + /* match symbol is validated -- never null */ + t_symbol *match = x->x_match.a_w.w_symbol; + int i; + if (s == match) + return (-1); + for (i = 0; i < ac; i++, av++) + if (av->a_type == A_SYMBOL && av->a_w.w_symbol == match) + return (i); + } + return (-2); +} + +static void substitute_doit(t_substitute *x, + t_symbol *s, int ac, t_atom *av, int startndx) +{ + int cnt = ac - startndx; + if (cnt > 0) + { + t_atom *ap = av + startndx; + if (x->x_match.a_type == A_FLOAT) + { + t_float f = x->x_match.a_w.w_float; + while (cnt--) + { + if (ap->a_type == A_FLOAT && ap->a_w.w_float == f) + *ap = x->x_repl; + ap++; + } + } + else if (x->x_match.a_type == A_SYMBOL) + { + t_symbol *match = x->x_match.a_w.w_symbol; + while (cnt--) + { + if (ap->a_type == A_SYMBOL && ap->a_w.w_symbol == match) + *ap = x->x_repl; + ap++; + } + } + } + substitute_dooutput(x, s, ac, av, 0); +} + +static void substitute_anything(t_substitute *x, + t_symbol *s, int ac, t_atom *av) +{ + int matchndx = substitute_check(x, s, ac, av); + if (matchndx < -1) + substitute_dooutput(x, s, ac, av, 1); + else + { + int reentered = x->x_entered; + int prealloc = !reentered; + int ntotal = ac; + t_atom *buf; + t_substitute_proxy *proxy = (t_substitute_proxy *)x->x_proxy; + x->x_entered = 1; + proxy->p_match = &x->x_auxmatch; + proxy->p_repl = &x->x_auxrepl; + if (s == &s_) s = 0; + if (matchndx == -1) + { + if (x->x_repl.a_type == A_FLOAT) + { + ntotal++; + if (ac) s = &s_list; + else s = &s_float; + } + else if (x->x_repl.a_type == A_SYMBOL) + { + s = x->x_repl.a_w.w_symbol; + matchndx = 0; + } + } + else if (matchndx == 0 + && (!s || s == &s_list || s == &s_float) + && av->a_type == A_FLOAT + && x->x_repl.a_type == A_SYMBOL) + { + s = x->x_repl.a_w.w_symbol; + ac--; + av++; + ntotal = ac; + } + if (prealloc && ac > x->x_size) + { + if (ntotal > SUBSTITUTE_MAXSIZE) + prealloc = 0; + else + x->x_message = grow_nodata(&ntotal, &x->x_size, x->x_message, + SUBSTITUTE_INISIZE, x->x_messini, + sizeof(*x->x_message)); + } + if (prealloc) buf = x->x_message; + else + /* LATER consider using the stack if ntotal <= MAXSTACK */ + buf = getbytes(ntotal * sizeof(*buf)); + if (buf) + { + int ncopy = ntotal; + t_atom *bp = buf; + if (matchndx == -1) + { + SETFLOAT(bp++, x->x_repl.a_w.w_float); + ncopy--; + } + if (ncopy) + memcpy(bp, av, ncopy * sizeof(*buf)); + substitute_doit(x, s, ntotal, buf, matchndx); + if (buf != x->x_message) + freebytes(buf, ntotal * sizeof(*buf)); + } + if (!reentered) + { + x->x_entered = 0; + if (x->x_auxmatch.a_type != A_NULL) + { + x->x_match = x->x_auxmatch; + x->x_auxmatch.a_type = A_NULL; + } + if (x->x_auxrepl.a_type != A_NULL) + { + x->x_repl = x->x_auxrepl; + x->x_auxrepl.a_type = A_NULL; + } + proxy->p_match = &x->x_match; + proxy->p_repl = &x->x_repl; + } + } +} + +static void substitute_bang(t_substitute *x) +{ + substitute_anything(x, &s_bang, 0, 0); +} + +static void substitute_float(t_substitute *x, t_float f) +{ + t_atom at; + SETFLOAT(&at, f); + substitute_anything(x, 0, 1, &at); +} + +/* CHECKED (but LATER rethink) */ +static void substitute_symbol(t_substitute *x, t_symbol *s) +{ + t_atom at; + SETSYMBOL(&at, s); + substitute_anything(x, &s_symbol, 1, &at); +} + +/* LATER gpointer */ + +static void substitute_list(t_substitute *x, t_symbol *s, int ac, t_atom *av) +{ + substitute_anything(x, 0, ac, av); +} + +static int substitute_atomvalidate(t_atom *ap) +{ + return (ap->a_type == A_FLOAT + || (ap->a_type == A_SYMBOL + && ap->a_w.w_symbol && ap->a_w.w_symbol != &s_)); +} + +/* CHECKED: 'set' is ignored, single '<atom>' does not modify a replacement */ +static void substitute_proxy_anything(t_substitute_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + if (s == &s_) s = 0; + if (s) + { + SETSYMBOL(x->p_match, s); + if (ac && substitute_atomvalidate(av)) + *x->p_repl = *av; + } + else if (ac && substitute_atomvalidate(av)) + { + *x->p_match = *av++; + if (ac > 1 && substitute_atomvalidate(av)) + *x->p_repl = *av; + } +} + +static void substitute_proxy_bang(t_substitute_proxy *x) +{ + SETSYMBOL(x->p_match, &s_bang); +} + +static void substitute_proxy_float(t_substitute_proxy *x, t_float f) +{ + SETFLOAT(x->p_match, f); +} + +/* CHECKED (but LATER rethink) */ +static void substitute_proxy_symbol(t_substitute_proxy *x, t_symbol *s) +{ + SETSYMBOL(x->p_match, &s_symbol); + SETSYMBOL(x->p_repl, s); +} + +/* LATER gpointer */ + +static void substitute_proxy_list(t_substitute_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + substitute_proxy_anything(x, 0, ac, av); +} + +static void substitute_free(t_substitute *x) +{ + if (x->x_proxy) pd_free(x->x_proxy); + if (x->x_message != x->x_messini) + freebytes(x->x_message, x->x_size * sizeof(*x->x_message)); +} + +static void *substitute_new(t_symbol *s, int ac, t_atom *av) +{ + t_substitute *x = 0; + t_substitute_proxy *proxy = + (t_substitute_proxy *)pd_new(substitute_proxy_class); + if (proxy) + { + x = (t_substitute *)pd_new(substitute_class); + proxy->p_match = &x->x_match; + proxy->p_repl = &x->x_repl; + x->x_proxy = (t_pd *)proxy; + x->x_size = SUBSTITUTE_INISIZE; + x->x_message = x->x_messini; + x->x_entered = 0; + /* CHECKED: everything is to be passed unchanged, until both are set */ + /* CHECKED: max crashes if a match has been set, but not a replacement, + and there is a match */ + x->x_match.a_type = x->x_repl.a_type = A_NULL; + x->x_auxmatch.a_type = x->x_auxrepl.a_type = A_NULL; + inlet_new((t_object *)x, (t_pd *)proxy, 0, 0); + outlet_new((t_object *)x, &s_anything); + /* CHECKED (refman error: 'a bang is sent') */ + x->x_passout = outlet_new((t_object *)x, &s_anything); + substitute_proxy_anything(proxy, 0, ac, av); + } + return (x); +} + +void substitute_setup(void) +{ + substitute_class = class_new(gensym("substitute"), + (t_newmethod)substitute_new, + (t_method)substitute_free, + sizeof(t_substitute), 0, + A_GIMME, 0); + class_addbang(substitute_class, substitute_bang); + class_addfloat(substitute_class, substitute_float); + class_addsymbol(substitute_class, substitute_symbol); + class_addlist(substitute_class, substitute_list); + class_addanything(substitute_class, substitute_anything); + substitute_proxy_class = class_new(gensym("_substitute_proxy"), 0, 0, + sizeof(t_substitute_proxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(substitute_proxy_class, substitute_proxy_bang); + class_addfloat(substitute_proxy_class, substitute_proxy_float); + class_addsymbol(substitute_proxy_class, substitute_proxy_symbol); + class_addlist(substitute_proxy_class, substitute_proxy_list); + class_addanything(substitute_proxy_class, substitute_proxy_anything); + class_addmethod(substitute_proxy_class, (t_method)substitute_proxy_list, + gensym("set"), A_GIMME, 0); +} diff --git a/externals/miXed/cyclone/hammer/sustain.c b/externals/miXed/cyclone/hammer/sustain.c new file mode 100644 index 000000000..8764f5d8b --- /dev/null +++ b/externals/miXed/cyclone/hammer/sustain.c @@ -0,0 +1,86 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" + +#define SUSTAIN_NPITCHES 128 + +typedef struct _sustain +{ + t_object x_ob; + t_float x_velocity; + int x_switch; + unsigned char x_pitches[SUSTAIN_NPITCHES]; + t_outlet *x_voutlet; +} t_sustain; + +static t_class *sustain_class; + +static void sustain_float(t_sustain *x, t_float f) +{ + int pitch = (int)f; + if (pitch >= 0 && pitch < SUSTAIN_NPITCHES) + { + /* CHECKED a plain note-off accumulator */ + if (x->x_velocity || !x->x_switch) + { + outlet_float(x->x_voutlet, x->x_velocity); + outlet_float(((t_object *)x)->ob_outlet, pitch); + } + else x->x_pitches[pitch]++; + } +} + +static void sustain_bang(t_sustain *x) +{ + int i; + unsigned char *pp; + for (i = 0, pp = x->x_pitches; i < SUSTAIN_NPITCHES; i++, pp++) + { + while (*pp) + { + outlet_float(x->x_voutlet, 0); + outlet_float(((t_object *)x)->ob_outlet, i); + (*pp)--; + } + } +} + +static void sustain_clear(t_sustain *x) +{ + memset(x->x_pitches, 0, sizeof(x->x_pitches)); +} + +static void sustain_ft2(t_sustain *x, t_floatarg f) +{ + int newstate = ((int)f != 0); + if (x->x_switch && !newstate) sustain_bang(x); + x->x_switch = newstate; +} + +static void *sustain_new(void) +{ + t_sustain *x = (t_sustain *)pd_new(sustain_class); + x->x_velocity = 0; + x->x_switch = 0; + sustain_clear(x); + floatinlet_new((t_object *)x, &x->x_velocity); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft2")); + outlet_new((t_object *)x, &s_float); + x->x_voutlet = outlet_new((t_object *)x, &s_float); + return (x); +} + +void sustain_setup(void) +{ + sustain_class = class_new(gensym("sustain"), + (t_newmethod)sustain_new, + 0, /* CHECKED: no flushout */ + sizeof(t_sustain), 0, 0); + class_addfloat(sustain_class, sustain_float); + class_addbang(sustain_class, sustain_bang); + class_addmethod(sustain_class, (t_method)sustain_ft2, + gensym("ft2"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/hammer/switch.c b/externals/miXed/cyclone/hammer/switch.c new file mode 100644 index 000000000..2a6846ec7 --- /dev/null +++ b/externals/miXed/cyclone/hammer/switch.c @@ -0,0 +1,154 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" + +#define SWITCH_MININLETS 2 /* LATER consider using 1 (with a warning) */ +#define SWITCH_C74MAXINLETS 100 +#define SWITCH_DEFINLETS 2 + +typedef struct _switch +{ + t_object x_ob; + int x_open; + int x_ninlets; /* not counting left one */ + int x_nproxies; /* as requested (and allocated) */ + t_pd **x_proxies; +} t_switch; + +typedef struct _switch_proxy +{ + t_object p_ob; + t_switch *p_master; + int p_id; +} t_switch_proxy; + +static t_class *switch_class; +static t_class *switch_proxy_class; + +static void switch_proxy_bang(t_switch_proxy *x) +{ + t_switch *master = x->p_master; + if (master->x_open == x->p_id) + outlet_bang(((t_object *)master)->ob_outlet); +} + +static void switch_proxy_float(t_switch_proxy *x, t_float f) +{ + t_switch *master = x->p_master; + if (master->x_open == x->p_id) + outlet_float(((t_object *)master)->ob_outlet, f); +} + +static void switch_proxy_symbol(t_switch_proxy *x, t_symbol *s) +{ + t_switch *master = x->p_master; + if (master->x_open == x->p_id) + outlet_symbol(((t_object *)master)->ob_outlet, s); +} + +static void switch_proxy_pointer(t_switch_proxy *x, t_gpointer *gp) +{ + t_switch *master = x->p_master; + if (master->x_open == x->p_id) + outlet_pointer(((t_object *)master)->ob_outlet, gp); +} + +static void switch_proxy_list(t_switch_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + t_switch *master = x->p_master; + if (master->x_open == x->p_id) + outlet_list(((t_object *)master)->ob_outlet, s, ac, av); +} + +static void switch_proxy_anything(t_switch_proxy *x, + t_symbol *s, int ac, t_atom *av) +{ + t_switch *master = x->p_master; + if (master->x_open == x->p_id) + outlet_anything(((t_object *)master)->ob_outlet, s, ac, av); +} + +static void switch_float(t_switch *x, t_float f) +{ + int i = (int)f; + if (i < 0) i = -i; + if (i > x->x_ninlets) i = x->x_ninlets; + x->x_open = i; +} + +static void switch_bang(t_switch *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_open); +} + +static void switch_free(t_switch *x) +{ + if (x->x_proxies) + { + int i = x->x_ninlets; + while (i--) pd_free(x->x_proxies[i]); + freebytes(x->x_proxies, x->x_nproxies * sizeof(*x->x_proxies)); + } +} + +static void *switch_new(t_floatarg f1, t_floatarg f2) +{ + t_switch *x; + int i, ninlets, nproxies = (int)f1; + t_pd **proxies; + if (nproxies < SWITCH_MININLETS) + nproxies = SWITCH_DEFINLETS; + if (nproxies > SWITCH_C74MAXINLETS) + fittermax_rangewarning(switch_class, SWITCH_C74MAXINLETS, "inlets"); + if (!(proxies = (t_pd **)getbytes(nproxies * sizeof(*proxies)))) + return (0); + for (ninlets = 0; ninlets < nproxies; ninlets++) + if (!(proxies[ninlets] = pd_new(switch_proxy_class))) break; + if (ninlets < SWITCH_MININLETS) + { + int i = ninlets; + while (i--) pd_free(proxies[i]); + freebytes(proxies, nproxies * sizeof(*proxies)); + return (0); + } + x = (t_switch *)pd_new(switch_class); + x->x_ninlets = ninlets; + x->x_nproxies = nproxies; + x->x_proxies = proxies; + for (i = 0; i < ninlets; i++) + { + t_switch_proxy *y = (t_switch_proxy *)proxies[i]; + y->p_master = x; + y->p_id = i + 1; + inlet_new((t_object *)x, (t_pd *)y, 0, 0); + } + outlet_new((t_object *)x, &s_anything); + switch_float(x, (f2 > 0 ? f2 : 0)); /* CHECKED */ + return (x); +} + +void switch_setup(void) +{ + switch_class = class_new(gensym("switch"), + (t_newmethod)switch_new, + (t_method)switch_free, + sizeof(t_switch), 0, + A_DEFFLOAT, A_DEFFLOAT, 0); + class_addfloat(switch_class, switch_float); + class_addbang(switch_class, switch_bang); + switch_proxy_class = class_new(gensym("_switch_proxy"), 0, 0, + sizeof(t_switch_proxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addfloat(switch_proxy_class, switch_proxy_float); + class_addbang(switch_proxy_class, switch_proxy_bang); + class_addsymbol(switch_proxy_class, switch_proxy_symbol); + class_addpointer(switch_proxy_class, switch_proxy_pointer); + class_addlist(switch_proxy_class, switch_proxy_list); + class_addanything(switch_proxy_class, switch_proxy_anything); + fitter_setup(switch_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/tanh.c b/externals/miXed/cyclone/hammer/tanh.c new file mode 100644 index 000000000..4ccf150d6 --- /dev/null +++ b/externals/miXed/cyclone/hammer/tanh.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define tanhf tanh +#endif + +typedef struct _tanh +{ + t_object x_ob; + float x_value; +} t_tanh; + +static t_class *tanh_class; + +static void tanh_bang(t_tanh *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void tanh_float(t_tanh *x, t_float f) +{ + /* CHECKME large values */ + outlet_float(((t_object *)x)->ob_outlet, x->x_value = tanhf(f)); +} + +static void *tanh_new(t_floatarg f) +{ + t_tanh *x = (t_tanh *)pd_new(tanh_class); + /* CHECKME large values */ + x->x_value = tanhf(f); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void tanh_setup(void) +{ + tanh_class = class_new(gensym("tanh"), + (t_newmethod)tanh_new, 0, + sizeof(t_tanh), 0, A_DEFFLOAT, 0); + class_addbang(tanh_class, tanh_bang); + class_addfloat(tanh_class, tanh_float); +} diff --git a/externals/miXed/cyclone/hammer/testmess.c b/externals/miXed/cyclone/hammer/testmess.c new file mode 100644 index 000000000..cc7aa2bb4 --- /dev/null +++ b/externals/miXed/cyclone/hammer/testmess.c @@ -0,0 +1,359 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "unstable/fragile.h" + +#ifdef _WIN32 +#define snprintf _snprintf +#endif + +#define TESTMESS_INISIZE 4 /* LATER rethink */ +#define TESTMESS_STACKSIZE 256 + +typedef struct _testmess +{ + t_object x_ob; + t_symbol *x_method; + void (*x_messfun)(struct _testmess *, t_symbol *s, int, t_atom *); + int x_appendmode; + int x_size; /* as allocated */ + int x_natoms; /* as used */ + int x_tailwise; /* data is moved to the end of a buffer */ + t_atom *x_message; + t_atom *x_messbuf; + t_atom x_messini[TESTMESS_INISIZE]; +} t_testmess; + +static t_class *testmess_class; + +static void testmess_setnatoms(t_testmess *x, int natoms) +{ + if (x->x_tailwise) + x->x_message = x->x_messbuf + x->x_size - natoms; + else + x->x_message = x->x_messbuf; + x->x_natoms = natoms; +} + +static int testmess_makeroom(t_testmess *x, int natoms, int preserve) +{ + if (x->x_size < natoms) + { + int newsize = x->x_size * 2; + while (newsize < natoms) newsize *= 2; +/* post("makeroom %s %d %d %d", x->x_method->s_name, + preserve, natoms, newsize);*/ + if (x->x_messbuf == x->x_messini) + { + if (!(x->x_messbuf = + (t_atom *)getbytes(newsize * sizeof(*x->x_messbuf)))) + { + x->x_messbuf = x->x_messini; + testmess_setnatoms(x, preserve ? x->x_natoms : 0); + return (0); + } + x->x_size = newsize; + testmess_setnatoms(x, preserve ? x->x_natoms : 0); + if (x->x_natoms) + { + if (x->x_tailwise) + memcpy(x->x_message, + x->x_messini + TESTMESS_INISIZE - x->x_natoms, + x->x_natoms * sizeof(*x->x_message)); + else + memcpy(x->x_message, + x->x_messini, x->x_natoms * sizeof(*x->x_message)); + } + } + else + { + int oldsize = x->x_size; + if (!(x->x_messbuf = + (t_atom *)resizebytes(x->x_messbuf, + x->x_size * sizeof(*x->x_messbuf), + newsize * sizeof(*x->x_messbuf)))) + { + x->x_messbuf = x->x_messini; + x->x_size = TESTMESS_INISIZE; + testmess_setnatoms(x, 0); + return (0); + } + x->x_size = newsize; + testmess_setnatoms(x, preserve ? x->x_natoms : 0); + if (x->x_natoms && x->x_tailwise) + memmove(x->x_message, x->x_messbuf + oldsize - x->x_natoms, + x->x_natoms * sizeof(*x->x_message)); + } + } + return (1); +} + +static void testmess_stackmess(t_testmess *x, t_symbol *s, int ac, t_atom *av) +{ + t_atom buf[TESTMESS_STACKSIZE]; + int natoms = x->x_natoms; + if (x->x_appendmode) + { + int left = TESTMESS_STACKSIZE - ac; + if (left < 0) ac = TESTMESS_STACKSIZE, natoms = 0; + else if (natoms > left) natoms = left; + if (ac) + memcpy(buf, av, ac * sizeof(*buf)); + if (natoms) + memcpy(buf + ac, x->x_message, natoms * sizeof(*buf)); + } + else + { + int left = TESTMESS_STACKSIZE - natoms; + if (left < 0) natoms = TESTMESS_STACKSIZE, ac = 0; + else if (ac > left) ac = left; + if (natoms) + memcpy(buf, x->x_message, natoms * sizeof(*buf)); + if (ac) + memcpy(buf + natoms, av, ac * sizeof(*buf)); + } + outlet_anything(((t_object *)x)->ob_outlet, s, natoms + ac, buf); +} + +static void testmess_heapmess(t_testmess *x, t_symbol *s, int ac, t_atom *av) +{ + int ntotal = x->x_natoms + ac; + t_atom *buf = getbytes(ntotal * sizeof(*buf)); + if (buf) + { + if (x->x_appendmode) + { + if (ac) + memcpy(buf, av, ac * sizeof(*buf)); + if (x->x_natoms) + memcpy(buf + ac, x->x_message, x->x_natoms * sizeof(*buf)); + } + else + { + if (x->x_natoms) + memcpy(buf, x->x_message, x->x_natoms * sizeof(*buf)); + if (ac) + memcpy(buf + x->x_natoms, av, ac * sizeof(*buf)); + } + outlet_anything(((t_object *)x)->ob_outlet, s, ntotal, buf); + freebytes(buf, ntotal * sizeof(*buf)); + } +} + +static void testmess_premess(t_testmess *x, t_symbol *s, int ac, t_atom *av) +{ + int ntotal = x->x_natoms + ac; + if (testmess_makeroom(x, ntotal, 1)) + { + t_atom *buf; + if (x->x_appendmode) + { + buf = x->x_messbuf + x->x_size - ntotal; + if (ac) + memcpy(buf, av, ac * sizeof(*buf)); + } + else + { + buf = x->x_messbuf; + if (ac) + memcpy(buf + x->x_natoms, av, ac * sizeof(*buf)); + } + outlet_anything(((t_object *)x)->ob_outlet, s, ntotal, buf); + } +} + +static void testmess_bang(t_testmess *x) +{ + if (x->x_natoms) + x->x_messfun(x, &s_list, 0, 0); +} + +static void testmess_float(t_testmess *x, t_float f) +{ + t_atom at; + SETFLOAT(&at, f); + x->x_messfun(x, (x->x_natoms ? &s_list : &s_float), 1, &at); +} + +static void testmess_symbol(t_testmess *x, t_symbol *s) +{ + x->x_messfun(x, s, 0, 0); +} + +static void testmess_anything(t_testmess *x, t_symbol *s, int ac, t_atom *av) +{ + x->x_messfun(x, s, ac, av); +} + +static void testmess_setnumbers(t_testmess *x, int natoms, int start) +{ + if (natoms <= 0) + natoms = 100; + if (testmess_makeroom(x, natoms * 2, 0)) + { + t_atom *ap; + testmess_setnatoms(x, natoms); + ap = x->x_message; + while (natoms--) + { + SETFLOAT(ap, (t_float)start); + start++; ap++; + } + } +} + +#define FRAGILE_HASHSIZE 1024 + +static int fragile_hash(t_symbol *s) +{ + unsigned int hash1 = 0, hash2 = 0; + char *ptr = s->s_name; + while (*ptr) + { + hash1 += *ptr++; + hash2 += hash1; + } + return (hash2 & (FRAGILE_HASHSIZE-1)); +} + +int fragile_symbol_count(void) +{ + return (100); +} + +void fragile_getsymbols(t_atom *av) +{ + t_symbol *s = gensym("#N"); + int i; + for (i = 0, s -= fragile_hash(s); i < FRAGILE_HASHSIZE; i++, s++) + { + if (s->s_name) + { + t_symbol *s1; + for (s1 = s; s1; s1 = s1->s_next) + printf("%s\n", s1->s_name); + } + } +} + +static void testmess_setnames(t_testmess *x, t_symbol *s, + int natoms, int nchars) +{ + if (!s) + s = &s_; + if (*s->s_name == 'c') + { + natoms = fragile_class_count(); + if (natoms > 0 && testmess_makeroom(x, natoms * 2, 0)) + { + testmess_setnatoms(x, natoms); + fragile_class_getnames(x->x_message, natoms); + } + } + else + { + if (natoms <= 0) + natoms = 100; + if (nchars <= 0) + nchars = 10; + if (testmess_makeroom(x, natoms * 2, 0)) + { + char buf[MAXPDSTRING], fmt[16]; + int i = 0; + t_atom *ap; + testmess_setnatoms(x, natoms); + ap = x->x_message; + sprintf(fmt, "%%.%dx", nchars); + while (natoms--) + { + snprintf(buf, MAXPDSTRING-1, fmt, i); + SETSYMBOL(ap, gensym(buf)); + i++; ap++; + } + } + } +} + +static void testmess_set(t_testmess *x, t_symbol *s, int ac, t_atom *av) +{ + t_symbol *csym = 0, *msym = 0; + t_float f1 = 0., f2 = 0.; + if (ac) + { + if (av->a_type == A_SYMBOL) + csym = av->a_w.w_symbol; + else if (av->a_type == A_FLOAT) + f1 = av->a_w.w_float; + if (ac > 1) + { + if (av[1].a_type == A_SYMBOL) + msym = av[1].a_w.w_symbol; + else if (av[1].a_type == A_FLOAT) + { + if (csym) + f1 = av[1].a_w.w_float; + else + f2 = av[1].a_w.w_float; + if (ac > 2) + { + if (av[2].a_type == A_SYMBOL) + msym = av[2].a_w.w_symbol; + else if (csym && av[2].a_type == A_FLOAT) + f2 = av[2].a_w.w_float; + } + } + } + } + if (msym == gensym("stack")) + x->x_method = msym, x->x_messfun = testmess_stackmess; + else if (msym == gensym("heap")) + x->x_method = msym, x->x_messfun = testmess_heapmess; + else + { + x->x_method = gensym("prealloc"); + x->x_messfun = testmess_premess; + x->x_tailwise = x->x_appendmode; + } + testmess_setnatoms(x, 0); + if (csym) + testmess_setnames(x, csym, (int)f1, (int)f2); + else + testmess_setnumbers(x, (int)f1, (int)f2); +} + +static void testmess_free(t_testmess *x) +{ + if (x->x_messbuf != x->x_messini) + freebytes(x->x_messbuf, x->x_size * sizeof(*x->x_messbuf)); +} + +static void *testmess_new(t_symbol *s, int ac, t_atom *av) +{ + t_testmess *x = (t_testmess *)pd_new(testmess_class); + x->x_appendmode = 1; + x->x_tailwise = 0; + x->x_size = TESTMESS_INISIZE; + x->x_messbuf = x->x_messini; + outlet_new((t_object *)x, &s_anything); + testmess_set(x, s, ac, av); + return (x); +} + +void testmess_setup(void) +{ + testmess_class = class_new(gensym("testmess"), + (t_newmethod)testmess_new, + (t_method)testmess_free, + sizeof(t_testmess), 0, + A_GIMME, 0); + class_addbang(testmess_class, testmess_bang); + class_addfloat(testmess_class, testmess_float); + class_addsymbol(testmess_class, testmess_symbol); + class_addanything(testmess_class, testmess_anything); + class_addmethod(testmess_class, (t_method)testmess_set, + gensym("set"), A_GIMME, 0); +} diff --git a/externals/miXed/cyclone/hammer/thresh.c b/externals/miXed/cyclone/hammer/thresh.c new file mode 100644 index 000000000..6890dcc65 --- /dev/null +++ b/externals/miXed/cyclone/hammer/thresh.c @@ -0,0 +1,134 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" + +#define THRESH_INISIZE 32 /* LATER rethink */ +#define THRESH_MAXSIZE 256 +#define THRESH_DEFTHRESH 10 + +typedef struct _thresh +{ + t_object x_ob; + t_float x_thresh; + int x_size; /* as allocated */ + int x_natoms; /* as used */ + t_atom *x_message; + t_atom x_messini[THRESH_INISIZE]; + t_clock *x_clock; +} t_thresh; + +static t_class *thresh_class; + +static void thresh_tick(t_thresh *x) +{ + int ac = x->x_natoms; + if (ac) + { + t_atom *av = x->x_message; + if (av->a_type == A_FLOAT) /* redundant, but we might need it LATER */ + { + if (ac > 1) + outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, av); + else + outlet_float(((t_object *)x)->ob_outlet, av->a_w.w_float); + } + x->x_natoms = 0; + } +} + +static void thresh_anything(t_thresh *x, t_symbol *s, int ac, t_atom *av) +{ + int ntotal = x->x_natoms + ac; + t_atom *buf; + clock_unset(x->x_clock); + if (s == &s_) s = 0; + if (s) + ntotal++; + if (ntotal > x->x_size) + { + /* LATER if (ntotal > THRESH_MAXSIZE)... (cf prepend) */ + int nrequested = ntotal; + x->x_message = grow_withdata(&nrequested, &x->x_natoms, + &x->x_size, x->x_message, + THRESH_INISIZE, x->x_messini, + sizeof(*x->x_message)); + if (nrequested != ntotal) + { + x->x_natoms = 0; + if (ac >= x->x_size) + ac = (s ? x->x_size - 1 : x->x_size); + } + } + buf = x->x_message + x->x_natoms; + if (s) + { + SETSYMBOL(buf, s); + buf++; + x->x_natoms++; + } + if (ac) + { + memcpy(buf, av, ac * sizeof(*buf)); + x->x_natoms += ac; + } + clock_delay(x->x_clock, x->x_thresh); +} + +static void thresh_float(t_thresh *x, t_float f) +{ + t_atom at; + SETFLOAT(&at, f); + thresh_anything(x, 0, 1, &at); +} + +static void thresh_list(t_thresh *x, t_symbol *s, int ac, t_atom *av) +{ + thresh_anything(x, 0, ac, av); +} + +static void thresh_ft1(t_thresh *x, t_floatarg f) +{ + if (f < 0) + f = 0; /* CHECKED */ + x->x_thresh = f; + /* CHECKED: no rearming */ +} + +static void thresh_free(t_thresh *x) +{ + if (x->x_message != x->x_messini) + freebytes(x->x_message, x->x_size * sizeof(*x->x_message)); + if (x->x_clock) + clock_free(x->x_clock); +} + +static void *thresh_new(t_floatarg f) +{ + t_thresh *x = (t_thresh *)pd_new(thresh_class); + x->x_thresh = (f > 0 ? f : THRESH_DEFTHRESH); + x->x_size = THRESH_INISIZE; + x->x_natoms = 0; + x->x_message = x->x_messini; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_list); /* LATER rethink: list or float */ + x->x_clock = clock_new(x, (t_method)thresh_tick); + return (x); +} + +void thresh_setup(void) +{ + thresh_class = class_new(gensym("thresh"), + (t_newmethod)thresh_new, + (t_method)thresh_free, + sizeof(t_thresh), 0, + A_DEFFLOAT, 0); + class_addfloat(thresh_class, thresh_float); + class_addlist(thresh_class, thresh_list); + class_addmethod(thresh_class, (t_method)thresh_ft1, + gensym("ft1"), A_FLOAT, 0); + /* CHECKED: thresh: doesn't understand bang, symbol, anything */ +} diff --git a/externals/miXed/cyclone/hammer/tosymbol.c b/externals/miXed/cyclone/hammer/tosymbol.c new file mode 100644 index 000000000..3b5fefff9 --- /dev/null +++ b/externals/miXed/cyclone/hammer/tosymbol.c @@ -0,0 +1,185 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" + +#define TOSYMBOL_INISTRING 128 /* LATER rethink */ +#define TOSYMBOL_MAXSTRING 2048 /* the refman says so, later CHECKME */ +static char tosymbol_defseparator[] = " "; + +typedef struct _tosymbol +{ + t_object x_ob; + t_symbol *x_separator; + int x_bufsize; + char *x_buffer; + char x_bufini[TOSYMBOL_INISTRING]; + int x_entered; +} t_tosymbol; + +static t_class *tosymbol_class; +static char tosymbol_buffer[TOSYMBOL_MAXSTRING]; +static int tosymbol_bufferlocked = 0; +/* The idea is to prevent two different tosymbol objects from using the static + buffer at the same time. In the current scenario this buffer is never used + for output, so this lock is unnecessary... but it does no harm either... */ + +static void tosymbol_flushbuffer(t_tosymbol *x) +{ + if (*x->x_buffer) + { + x->x_entered = 1; + outlet_symbol(((t_object *)x)->ob_outlet, gensym(x->x_buffer)); + x->x_entered = 0; + } +} + +static void tosymbol_bang(t_tosymbol *x) +{ + outlet_bang(((t_object *)x)->ob_outlet); /* CHECKED */ +} + +static void tosymbol_float(t_tosymbol *x, t_float f) +{ + if (!x->x_entered) + { + sprintf(x->x_buffer, "%g", f); + tosymbol_flushbuffer(x); + } +} + +static void tosymbol_symbol(t_tosymbol *x, t_symbol *s) +{ + outlet_symbol(((t_object *)x)->ob_outlet, s); +} + +static void tosymbol_pointer(t_tosymbol *x, t_gpointer *gp) +{ + /* nop: otherwise gpointer would be converted to 'list <gp>' */ +} + +static int tosymbol_parse(t_symbol *s, int ac, t_atom *av, t_symbol *separator, + int bufsize, char *buffer) +{ + int nleft = bufsize - 1; + int len; + char *bp = buffer; + bp[0] = bp[nleft] = 0; + if (s) + strncpy(bp, s->s_name, nleft); + len = strlen(bp); + nleft -= len; + bp += len; + if (ac && nleft > 0) + { + char *sepstring = (separator ? + separator->s_name : tosymbol_defseparator); + while (ac--) + { + if (*sepstring && bp > buffer) + { + strncpy(bp, sepstring, nleft); + len = strlen(bp); + nleft -= len; + if (nleft <= 0) break; + bp += len; + } + /* LATER rethink: type-checking */ + atom_string(av, bp, nleft); + len = strlen(bp); + nleft -= len; + bp += len; + if (nleft <= 0) break; + av++; + } + } + if (nleft < 0) + { + loudbug_bug("tosymbol_parse"); + return (bufsize); + } + return (bufsize - nleft); +} + +static void tosymbol_anything(t_tosymbol *x, t_symbol *s, int ac, t_atom *av) +{ + if (!x->x_entered) + { + if (tosymbol_bufferlocked) + { + loudbug_bug("tosymbol_anything"); + tosymbol_parse(s, ac, av, x->x_separator, + x->x_bufsize, x->x_buffer); + } + else + { + int ntotal; + tosymbol_bufferlocked = 1; + ntotal = tosymbol_parse(s, ac, av, x->x_separator, + TOSYMBOL_MAXSTRING, tosymbol_buffer); + if (ntotal > x->x_bufsize) + { + int newtotal = ntotal; + x->x_buffer = grow_nodata(&newtotal, &x->x_bufsize, x->x_buffer, + TOSYMBOL_INISTRING, x->x_bufini, + sizeof(*x->x_buffer)); + if (newtotal < ntotal) + { + ntotal = newtotal - 1; + x->x_buffer[ntotal] = 0; + } + } + memcpy(x->x_buffer, tosymbol_buffer, ntotal); + tosymbol_bufferlocked = 0; + } + tosymbol_flushbuffer(x); + } +} + +static void tosymbol_list(t_tosymbol *x, t_symbol *s, int ac, t_atom *av) +{ + tosymbol_anything(x, 0, ac, av); +} + +static void tosymbol_separator(t_tosymbol *x, t_symbol *s) +{ + x->x_separator = (s ? s : &s_); /* default: empty string */ +} + +static void tosymbol_free(t_tosymbol *x) +{ + if (x->x_buffer != x->x_bufini) + freebytes(x->x_buffer, x->x_bufsize); +} + +static void *tosymbol_new(void) +{ + t_tosymbol *x = (t_tosymbol *)pd_new(tosymbol_class); + x->x_separator = 0; /* default: a space */ + x->x_bufsize = TOSYMBOL_INISTRING; + x->x_buffer = x->x_bufini; + x->x_entered = 0; + outlet_new((t_object *)x, &s_symbol); + return (x); +} + +void tosymbol_setup(void) +{ + tosymbol_class = class_new(gensym("tosymbol"), + (t_newmethod)tosymbol_new, + (t_method)tosymbol_free, + sizeof(t_tosymbol), 0, 0); + class_addbang(tosymbol_class, tosymbol_bang); + class_addfloat(tosymbol_class, tosymbol_float); + class_addsymbol(tosymbol_class, tosymbol_symbol); + class_addpointer(tosymbol_class, tosymbol_pointer); + class_addlist(tosymbol_class, tosymbol_list); + class_addanything(tosymbol_class, tosymbol_anything); + class_addmethod(tosymbol_class, (t_method)tosymbol_separator, + gensym("separator"), A_DEFSYM, 0); +} diff --git a/externals/miXed/cyclone/hammer/universal.c b/externals/miXed/cyclone/hammer/universal.c new file mode 100644 index 000000000..b1731d8ff --- /dev/null +++ b/externals/miXed/cyclone/hammer/universal.c @@ -0,0 +1,167 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "g_canvas.h" +#include "unstable/pd_imp.h" +#include "common/loud.h" + +/* LATER fragilize */ + +typedef struct _universal +{ + t_object x_ob; + t_glist *x_glist; + t_int x_descend; +} t_universal; + +static t_class *universal_class; + +static void universal_dobang(t_glist *glist, int descend, t_symbol *cname) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd)->c_name == cname) /* LATER rethink */ + pd_bang(&g->g_pd); + if (descend) + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd) == canvas_class) /* LATER rethink */ + universal_dobang((t_glist *)g, descend, cname); +} + +static void universal_dofloat(t_glist *glist, int descend, t_symbol *cname, + t_float f) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd)->c_name == cname) /* LATER rethink */ + pd_float(&g->g_pd, f); + if (descend) + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd) == canvas_class) /* LATER rethink */ + universal_dofloat((t_glist *)g, descend, cname, f); +} + +static void universal_dosymbol(t_glist *glist, int descend, t_symbol *cname, + t_symbol *s) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd)->c_name == cname) /* LATER rethink */ + pd_symbol(&g->g_pd, s); + if (descend) + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd) == canvas_class) /* LATER rethink */ + universal_dosymbol((t_glist *)g, descend, cname, s); +} + +static void universal_dopointer(t_glist *glist, int descend, t_symbol *cname, + t_gpointer *gp) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd)->c_name == cname) /* LATER rethink */ + pd_pointer(&g->g_pd, gp); + if (descend) + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd) == canvas_class) /* LATER rethink */ + universal_dopointer((t_glist *)g, descend, cname, gp); +} + +static void universal_dolist(t_glist *glist, int descend, t_symbol *cname, + int ac, t_atom *av) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd)->c_name == cname) /* LATER rethink */ + pd_list(&g->g_pd, &s_list, ac, av); + if (descend) + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd) == canvas_class) /* LATER rethink */ + universal_dolist((t_glist *)g, descend, cname, ac, av); +} + +static void universal_doanything(t_glist *glist, int descend, t_symbol *cname, + t_symbol *s, int ac, t_atom *av) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd)->c_name == cname) /* LATER rethink */ + typedmess(&g->g_pd, s, ac, av); + if (descend) + for (g = glist->gl_list; g; g = g->g_next) + if (pd_class(&g->g_pd) == canvas_class) /* LATER rethink */ + universal_doanything((t_glist *)g, descend, cname, s, ac, av); +} + +/* LATER rethink type-checking -- it is borrowed from typedmess(). + Anyway, do it once, before traversal, bypassing the generic mechanism + performed for every object. */ +static void universal_anything(t_universal *x, t_symbol *s, int ac, t_atom *av) +{ + /* CHECKED selector without arguments ignored with no complaints */ + if (x->x_glist && s && ac) + { + if (av->a_type == A_FLOAT) + { + if (ac > 1) + universal_dolist(x->x_glist, x->x_descend, s, ac, av); + else + universal_dofloat(x->x_glist, x->x_descend, s, av->a_w.w_float); + } + else if (av->a_type == A_SYMBOL) + { + if (av->a_w.w_symbol == &s_bang) + universal_dobang(x->x_glist, x->x_descend, s); + else if (av->a_w.w_symbol == &s_float) + { + if (ac == 1) + universal_dofloat(x->x_glist, x->x_descend, s, 0.); + else if (av[1].a_type == A_FLOAT) + universal_dofloat(x->x_glist, x->x_descend, s, + av[1].a_w.w_float); + else + loud_error((t_pd *)x, "Bad argument for message 'float'"); + } + else if (av->a_w.w_symbol == &s_symbol) + universal_dosymbol(x->x_glist, x->x_descend, s, + (ac > 1 && av[1].a_type == A_SYMBOL ? + av[1].a_w.w_symbol : &s_)); + else if (av->a_w.w_symbol == &s_list) + universal_dolist(x->x_glist, x->x_descend, s, ac - 1, av + 1); + else + universal_doanything(x->x_glist, x->x_descend, s, + av->a_w.w_symbol, ac - 1, av + 1); + } + if (av->a_type == A_POINTER) + universal_dopointer(x->x_glist, x->x_descend, s, + av->a_w.w_gpointer); + } +} + +static void universal_send(t_universal *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac && av->a_type == A_SYMBOL) + universal_anything(x, av->a_w.w_symbol, ac - 1, av + 1); + /* CHECKED: else ignored without complaints */ +} + +static void *universal_new(t_floatarg f) +{ + t_universal *x = (t_universal *)pd_new(universal_class); + x->x_glist = canvas_getcurrent(); + x->x_descend = ((int)f != 0); /* CHECKED */ + return (x); +} + +void universal_setup(void) +{ + universal_class = class_new(gensym("universal"), + (t_newmethod)universal_new, 0, + sizeof(t_universal), 0, A_DEFFLOAT, 0); + class_addanything(universal_class, universal_anything); + /* CHECKED: 'send', not 'sendmessage' */ + class_addmethod(universal_class, (t_method)universal_send, + gensym("send"), A_GIMME, 0); +} diff --git a/externals/miXed/cyclone/hammer/urn.c b/externals/miXed/cyclone/hammer/urn.c new file mode 100644 index 000000000..a3ee8aef7 --- /dev/null +++ b/externals/miXed/cyclone/hammer/urn.c @@ -0,0 +1,150 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER think again about avoiding memory allocation overhead in run-time. + One would need to use a creation argument greater than any future right + inlet value. But this is incompatible (max uses a `static', max-size + array), and should be put somewhere in the docs... */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/fitter.h" +#include "common/rand.h" + +#define URN_INISIZE 128 /* LATER rethink */ +#define URN_C74MAXSIZE 4096 /* CHECKED */ +#define URN_MAXSIZE 65536 /* LATER use USHRT_MAX */ + +typedef struct _urn +{ + t_object x_ob; + int x_count; + int x_size; /* as allocated (in bytes) */ + int x_range; /* as used */ + unsigned short *x_urn; + unsigned short x_urnini[URN_INISIZE]; + unsigned int x_seed; + t_outlet *x_bangout; +} t_urn; + +static t_class *urn_class; + +static int urn_resize(t_urn *x, t_float f, int init) +{ + int maxmax = URN_C74MAXSIZE; + int range = (int)f; /* CHECKED silent truncation */ + if (init) + { + maxmax--; /* CHECKED: max 4095 here (a bug, sort of) */ + /* CHECKED in the constructor this is silent + (also > maxmax clipped without complaining) */ + if (range < 1) + range = 1; + } + else if (range < 1) + { + /* CHECKED (the same for > maxmax) */ + loud_error((t_pd *)x, "illegal size %d", f); + return (0); + } + if (range > URN_MAXSIZE) + { + loud_warning((t_pd *)x, 0, + "requested size (%d) clipped -- effective size is %d", + range, URN_MAXSIZE); + range = URN_MAXSIZE; + } + if (range > maxmax) + fittermax_rangewarning(urn_class, maxmax, "elements"); + x->x_range = range; + if (range > x->x_size) + x->x_urn = grow_nodata(&x->x_range, &x->x_size, x->x_urn, + URN_INISIZE, x->x_urnini, + sizeof(*x->x_urn)); + return (1); +} + +static void urn_bang(t_urn *x) +{ + if (x->x_count) + { + int ndx = rand_int(&x->x_seed, x->x_count); + unsigned short pick = x->x_urn[ndx]; + x->x_urn[ndx] = x->x_urn[--x->x_count]; + outlet_float(((t_object *)x)->ob_outlet, pick); + } + /* CHECKED: start banging when the first bang is input + into an empty urn (and not when the last value is output). + CHECKED: keep banging until cleared. */ + else outlet_bang(x->x_bangout); +} + +static void urn_clear(t_urn *x) +{ + int i; + x->x_count = x->x_range; + for (i = 0; i < x->x_count; i++) x->x_urn[i] = i; +} + +static void urn_float(t_urn *x, t_float f) +{ + /* CHECKED: float loudly rejected, int (any value) same as bang */ + int i; + if (loud_checkint((t_pd *)x, f, &i, &s_float)) + urn_bang(x); +} + +static void urn_ft1(t_urn *x, t_floatarg f) +{ + if (urn_resize(x, f, 0)) /* CHECKED cleared only if a legal resize */ + urn_clear(x); +} + +static void urn_seed(t_urn *x, t_floatarg f) +{ + int i = (int)f; /* CHECKED */ + if (i < 0) + i = 1; /* CHECKED */ + rand_seed(&x->x_seed, (unsigned int)i); +} + +static void urn_free(t_urn *x) +{ + if (x->x_urn != x->x_urnini) + freebytes(x->x_urn, x->x_size * sizeof(*x->x_urn)); +} + +static void *urn_new(t_floatarg f1, t_floatarg f2) +{ + t_urn *x = (t_urn *)pd_new(urn_class); + x->x_size = URN_INISIZE; + x->x_urn = x->x_urnini; + urn_resize(x, f1, 1); + urn_seed(x, f2); /* CHECKME */ + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + x->x_bangout = outlet_new((t_object *)x, &s_bang); + urn_clear(x); + return (x); +} + +void urn_setup(void) +{ + urn_class = class_new(gensym("urn"), + (t_newmethod)urn_new, + (t_method)urn_free, + sizeof(t_urn), 0, + A_DEFFLOAT, A_DEFFLOAT, 0); + class_addbang(urn_class, urn_bang); + class_addfloat(urn_class, urn_float); + class_addmethod(urn_class, (t_method)urn_ft1, + gensym("ft1"), A_FLOAT, 0); + /* CHECKED list is auto-unfolded */ + class_addmethod(urn_class, (t_method)urn_seed, + gensym("seed"), A_FLOAT, 0); /* CHECKED arg obligatory */ + class_addmethod(urn_class, (t_method)urn_clear, + gensym("clear"), 0); + fitter_setup(urn_class, 0); +} diff --git a/externals/miXed/cyclone/hammer/xbendin.c b/externals/miXed/cyclone/hammer/xbendin.c new file mode 100644 index 000000000..54082b311 --- /dev/null +++ b/externals/miXed/cyclone/hammer/xbendin.c @@ -0,0 +1,93 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _xbendin +{ + t_object x_ob; + int x_omni; + unsigned char x_ready; + unsigned char x_status; + unsigned char x_channel; + unsigned char x_lsb; + t_outlet *x_chanout; +} t_xbendin; + +static t_class *xbendin_class; + +static void xbendin_clear(t_xbendin *x) +{ + x->x_status = 0; + x->x_ready = 0; +} + +static void xbendin_float(t_xbendin *x, t_float f) +{ + int ival = (int)f; /* CHECKME */ + if (ival < 0) + { + /* CHECKME */ + return; + } + if (ival < 256) /* CHECKME */ + { + unsigned char bval = ival; + if (bval & 0x80) + { + unsigned char status = bval & 0xF0; + if (status == 0xF0) + { + /* CHECKME */ + if (bval < 0xF8) + xbendin_clear(x); + } + else if (status == 0xE0) + { + unsigned char channel = bval & 0x0F; + if (x->x_omni) + x->x_channel = channel; + x->x_status = (x->x_channel == channel); + x->x_ready = 0; + } + else xbendin_clear(x); + } + else if (x->x_ready) + { + if (x->x_omni) + outlet_float(x->x_chanout, x->x_channel + 1); + outlet_float(((t_object *)x)->ob_outlet, (bval << 7) + x->x_lsb); + x->x_ready = 0; + } + else if (x->x_status) + { + x->x_lsb = bval; + x->x_ready = 1; + } + } + else xbendin_clear(x); +} + +static void *xbendin_new(t_floatarg f) +{ + int channel = (int)f; /* CHECKME */ + t_xbendin *x = (t_xbendin *)pd_new(xbendin_class); + outlet_new((t_object *)x, &s_float); + if (x->x_omni = (channel == 0)) /* CHECKME */ + x->x_chanout = outlet_new((t_object *)x, &s_float); + else + x->x_channel = (unsigned char)--channel; /* CHECKME */ + xbendin_clear(x); + return (x); +} + +void xbendin_setup(void) +{ + xbendin_class = class_new(gensym("xbendin"), + (t_newmethod)xbendin_new, 0, + sizeof(t_xbendin), 0, + A_DEFFLOAT, 0); + class_addfloat(xbendin_class, xbendin_float); + /* CHECKME autocasting lists to floats */ +} diff --git a/externals/miXed/cyclone/hammer/xbendin2.c b/externals/miXed/cyclone/hammer/xbendin2.c new file mode 100644 index 000000000..1336800e7 --- /dev/null +++ b/externals/miXed/cyclone/hammer/xbendin2.c @@ -0,0 +1,99 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +/* LATER find a better way to synchronize with xbendin, + while avoiding the c74's bug... */ + +typedef struct _xbendin2 +{ + t_object x_ob; + int x_omni; + unsigned char x_ready; + unsigned char x_status; + unsigned char x_channel; + unsigned char x_lsb; + t_outlet *x_lsbout; + t_outlet *x_chanout; +} t_xbendin2; + +static t_class *xbendin2_class; + +static void xbendin2_clear(t_xbendin2 *x) +{ + x->x_status = 0; + x->x_ready = 0; +} + +static void xbendin2_float(t_xbendin2 *x, t_float f) +{ + int ival = (int)f; /* CHECKME */ + if (ival < 0) + { + /* CHECKME */ + return; + } + if (ival < 256) /* CHECKME */ + { + unsigned char bval = ival; + if (bval & 0x80) + { + unsigned char status = bval & 0xF0; + if (status == 0xF0) + { + /* CHECKME */ + if (bval < 0xF8) + xbendin2_clear(x); + } + else if (status == 0xE0) + { + unsigned char channel = bval & 0x0F; + if (x->x_omni) + x->x_channel = channel; + x->x_status = (x->x_channel == channel); + x->x_ready = 0; + } + else xbendin2_clear(x); + } + else if (x->x_ready) + { + if (x->x_omni) + outlet_float(x->x_chanout, x->x_channel + 1); + outlet_float(x->x_lsbout, x->x_lsb); + outlet_float(((t_object *)x)->ob_outlet, bval); + x->x_ready = 0; + } + else if (x->x_status) + { + x->x_lsb = bval; + x->x_ready = 1; + } + } + else xbendin2_clear(x); +} + +static void *xbendin2_new(t_floatarg f) +{ + int channel = (int)f; /* CHECKME */ + t_xbendin2 *x = (t_xbendin2 *)pd_new(xbendin2_class); + outlet_new((t_object *)x, &s_float); + x->x_lsbout = outlet_new((t_object *)x, &s_float); + if (x->x_omni = (channel == 0)) /* CHECKME */ + x->x_chanout = outlet_new((t_object *)x, &s_float); + else + x->x_channel = (unsigned char)--channel; /* CHECKME */ + xbendin2_clear(x); + return (x); +} + +void xbendin2_setup(void) +{ + xbendin2_class = class_new(gensym("xbendin2"), + (t_newmethod)xbendin2_new, 0, + sizeof(t_xbendin2), 0, + A_DEFFLOAT, 0); + class_addfloat(xbendin2_class, xbendin2_float); + /* CHECKME autocasting lists to floats */ +} diff --git a/externals/miXed/cyclone/hammer/xbendout.c b/externals/miXed/cyclone/hammer/xbendout.c new file mode 100644 index 000000000..faa401ef9 --- /dev/null +++ b/externals/miXed/cyclone/hammer/xbendout.c @@ -0,0 +1,54 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _xbendout +{ + t_object x_ob; + t_float x_channel; + int x_value; +} t_xbendout; + +static t_class *xbendout_class; + +static void xbendout_dooutput(t_xbendout *x) +{ + int value = x->x_value; + int channel = (int)x->x_channel; /* CHECKME */ + if (value >= 0 && /* CHECKME */ + value <= 16383 && /* CHECKME */ + channel > 0) /* CHECKME */ + { + outlet_float(((t_object *)x)->ob_outlet, 224 + ((channel-1) & 0x0F)); + outlet_float(((t_object *)x)->ob_outlet, value & 0x7F); + outlet_float(((t_object *)x)->ob_outlet, value >> 7); + } +} + +static void xbendout_float(t_xbendout *x, t_float f) +{ + x->x_value = (int)f; /* CHECKME */ + xbendout_dooutput(x); +} + +static void *xbendout_new(t_floatarg f) +{ + t_xbendout *x = (t_xbendout *)pd_new(xbendout_class); + floatinlet_new((t_object *)x, &x->x_channel); + outlet_new((t_object *)x, &s_float); + x->x_channel = ((int)f > 0 ? f : 1); /* CHECKME */ + x->x_value = 8192; /* CHECKME if not -1 */ + return (x); +} + +void xbendout_setup(void) +{ + xbendout_class = class_new(gensym("xbendout"), + (t_newmethod)xbendout_new, 0, + sizeof(t_xbendout), 0, + A_DEFFLOAT, 0); + class_addbang(xbendout_class, xbendout_dooutput); + class_addfloat(xbendout_class, xbendout_float); +} diff --git a/externals/miXed/cyclone/hammer/xbendout2.c b/externals/miXed/cyclone/hammer/xbendout2.c new file mode 100644 index 000000000..a2f8817c7 --- /dev/null +++ b/externals/miXed/cyclone/hammer/xbendout2.c @@ -0,0 +1,60 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _xbendout2 +{ + t_object x_ob; + t_float x_channel; + t_float x_lsb; + int x_msb; +} t_xbendout2; + +static t_class *xbendout2_class; + +static void xbendout2_dooutput(t_xbendout2 *x) +{ + int msb = x->x_msb; + int lsb = (int)x->x_lsb; /* CHECKME */ + int channel = (int)x->x_channel; /* CHECKME */ + if (msb >= 0 && /* CHECKME */ + msb <= 127 && /* CHECKME */ + lsb >= 0 && /* CHECKME */ + lsb <= 127 && /* CHECKME */ + channel > 0) /* CHECKME */ + { + outlet_float(((t_object *)x)->ob_outlet, 224 + ((channel-1) & 0x0F)); + outlet_float(((t_object *)x)->ob_outlet, lsb); + outlet_float(((t_object *)x)->ob_outlet, msb); + } +} + +static void xbendout2_float(t_xbendout2 *x, t_float f) +{ + x->x_msb = (int)f; /* CHECKME */ + xbendout2_dooutput(x); +} + +static void *xbendout2_new(t_floatarg f) +{ + t_xbendout2 *x = (t_xbendout2 *)pd_new(xbendout2_class); + floatinlet_new((t_object *)x, &x->x_lsb); + floatinlet_new((t_object *)x, &x->x_channel); + outlet_new((t_object *)x, &s_float); + x->x_channel = ((int)f > 0 ? f : 1); /* CHECKME */ + x->x_lsb = 0; + x->x_msb = 64; /* CHECKME if not -1 */ + return (x); +} + +void xbendout2_setup(void) +{ + xbendout2_class = class_new(gensym("xbendout2"), + (t_newmethod)xbendout2_new, 0, + sizeof(t_xbendout2), 0, + A_DEFFLOAT, 0); + class_addbang(xbendout2_class, xbendout2_dooutput); + class_addfloat(xbendout2_class, xbendout2_float); +} diff --git a/externals/miXed/cyclone/hammer/xnotein.c b/externals/miXed/cyclone/hammer/xnotein.c new file mode 100644 index 000000000..73b271bc4 --- /dev/null +++ b/externals/miXed/cyclone/hammer/xnotein.c @@ -0,0 +1,100 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _xnotein +{ + t_object x_ob; + int x_omni; + unsigned char x_ready; + unsigned char x_status; + unsigned char x_channel; + unsigned char x_pitch; + t_outlet *x_velout; + t_outlet *x_flagout; + t_outlet *x_chanout; +} t_xnotein; + +static t_class *xnotein_class; + +static void xnotein_clear(t_xnotein *x) +{ + x->x_status = 0; + x->x_ready = 0; +} + +static void xnotein_float(t_xnotein *x, t_float f) +{ + int ival = (int)f; /* CHECKME */ + if (ival < 0) + { + /* CHECKME */ + return; + } + if (ival < 256) /* CHECKME */ + { + unsigned char bval = ival; + if (bval & 0x80) + { + unsigned char status = bval & 0xF0; + if (status == 0xF0) + { + /* CHECKME */ + if (bval < 0xF8) + xnotein_clear(x); + } + else if (status == 0x80 || status == 0x90) + { + unsigned char channel = bval & 0x0F; + if (x->x_omni) + x->x_channel = channel; + x->x_status = (x->x_channel == channel ? status : 0); + x->x_ready = 0; + } + else xnotein_clear(x); + } + else if (x->x_ready) + { + int flag = (x->x_status == 0x90 && bval); + if (x->x_omni) + outlet_float(x->x_chanout, x->x_channel + 1); + outlet_float(x->x_flagout, flag); + outlet_float(x->x_velout, bval); + outlet_float(((t_object *)x)->ob_outlet, x->x_pitch); + x->x_ready = 0; + } + else if (x->x_status) + { + x->x_pitch = bval; + x->x_ready = 1; + } + } + else xnotein_clear(x); +} + +static void *xnotein_new(t_floatarg f) +{ + int channel = (int)f; /* CHECKME */ + t_xnotein *x = (t_xnotein *)pd_new(xnotein_class); + outlet_new((t_object *)x, &s_float); + x->x_velout = outlet_new((t_object *)x, &s_float); + x->x_flagout = outlet_new((t_object *)x, &s_float); + if (x->x_omni = (channel == 0)) /* CHECKME */ + x->x_chanout = outlet_new((t_object *)x, &s_float); + else + x->x_channel = (unsigned char)--channel; /* CHECKME */ + xnotein_clear(x); + return (x); +} + +void xnotein_setup(void) +{ + xnotein_class = class_new(gensym("xnotein"), + (t_newmethod)xnotein_new, 0, + sizeof(t_xnotein), 0, + A_DEFFLOAT, 0); + class_addfloat(xnotein_class, xnotein_float); + /* CHECKME autocasting lists to floats */ +} diff --git a/externals/miXed/cyclone/hammer/xnoteout.c b/externals/miXed/cyclone/hammer/xnoteout.c new file mode 100644 index 000000000..058c7f931 --- /dev/null +++ b/externals/miXed/cyclone/hammer/xnoteout.c @@ -0,0 +1,62 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _xnoteout +{ + t_object x_ob; + t_float x_channel; + t_float x_flag; + t_float x_velocity; + int x_pitch; +} t_xnoteout; + +static t_class *xnoteout_class; + +static void xnoteout_dooutput(t_xnoteout *x) +{ + int status = ((int)x->x_flag ? 0x90 : 0x80); /* CHECKME */ + int channel = (int)x->x_channel; /* CHECKME */ + int pitch = x->x_pitch; + int velocity = (int)x->x_velocity & 0x7F; /* CHECKME */ + if (pitch >= 0 && /* CHECKME */ + pitch <= 127 && /* CHECKME */ + channel > 0) /* CHECKME */ + { + outlet_float(((t_object *)x)->ob_outlet, status + ((channel-1) & 0x0F)); + outlet_float(((t_object *)x)->ob_outlet, pitch); + outlet_float(((t_object *)x)->ob_outlet, velocity); + } +} + +static void xnoteout_float(t_xnoteout *x, t_float f) +{ + x->x_pitch = (int)f; /* CHECKME */ + xnoteout_dooutput(x); +} + +static void *xnoteout_new(t_floatarg f) +{ + t_xnoteout *x = (t_xnoteout *)pd_new(xnoteout_class); + floatinlet_new((t_object *)x, &x->x_velocity); + floatinlet_new((t_object *)x, &x->x_flag); + floatinlet_new((t_object *)x, &x->x_channel); + outlet_new((t_object *)x, &s_float); + x->x_channel = ((int)f > 0 ? f : 1); /* CHECKME */ + x->x_flag = 0; /* CHECKME */ + x->x_velocity = 0; /* CHECKME */ + x->x_pitch = -1; /* CHECKME */ + return (x); +} + +void xnoteout_setup(void) +{ + xnoteout_class = class_new(gensym("xnoteout"), + (t_newmethod)xnoteout_new, 0, + sizeof(t_xnoteout), 0, + A_DEFFLOAT, 0); + class_addbang(xnoteout_class, xnoteout_dooutput); + class_addfloat(xnoteout_class, xnoteout_float); +} diff --git a/externals/miXed/cyclone/hammer/zl.c b/externals/miXed/cyclone/hammer/zl.c new file mode 100644 index 000000000..b263bc8c3 --- /dev/null +++ b/externals/miXed/cyclone/hammer/zl.c @@ -0,0 +1,994 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* FIXME zl sub */ + +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" + +/* CHECKME bang behaviour (every mode) */ +/* LATER test reentrancy, tune speedwise */ + +#ifdef KRZYSZCZ +//#define ZL_DEBUG +#endif + +#define ZL_INISIZE 32 /* LATER rethink */ +#define ZL_MAXSIZE 256 +#define ZL_MAXMODES 16 +#define ZL_DEFMODE 0 + +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 *, int); + +static int zl_nmodes = 0; +static t_symbol *zl_modesym[ZL_MAXMODES]; +static int zl_modeflags[ZL_MAXMODES]; +static t_zlintargfn zl_intargfn[ZL_MAXMODES]; +static t_zlanyargfn zl_anyargfn[ZL_MAXMODES]; +static t_zlnatomsfn zl_natomsfn[ZL_MAXMODES]; +static t_zldoitfn zl_doitfn[ZL_MAXMODES]; + +typedef struct _zldata +{ + int d_size; /* as allocated */ + int d_natoms; /* as used */ + t_atom *d_buf; + t_atom d_bufini[ZL_INISIZE]; +} t_zldata; + +typedef struct _zl +{ + t_object x_ob; + struct _zlproxy *x_proxy; + int x_entered; + int x_locked; /* locking inbuf1 in modes: iter, reg, slice */ + t_zldata x_inbuf1; + t_zldata x_inbuf2; + t_zldata x_outbuf; + int x_mode; + int x_modearg; + t_outlet *x_out2; +} t_zl; + +typedef struct _zlproxy +{ + t_object p_ob; + t_zl *p_master; +} t_zlproxy; + +static t_class *zl_class; +static t_class *zlproxy_class; + +static void zldata_init(t_zldata *d) +{ + d->d_size = ZL_INISIZE; + d->d_natoms = 0; + d->d_buf = d->d_bufini; +} + +static void zldata_free(t_zldata *d) +{ + if (d->d_buf != d->d_bufini) + freebytes(d->d_buf, d->d_size * sizeof(*d->d_buf)); +} + +static void zldata_setfloat(t_zldata *d, t_float f) +{ + SETFLOAT(d->d_buf, f); + d->d_natoms = 1; +} + +static void zldata_addfloat(t_zldata *d, t_float f) +{ + int natoms = d->d_natoms; + int nrequested = natoms + 1; + if (nrequested > d->d_size) + { + d->d_buf = grow_withdata(&nrequested, &natoms, &d->d_size, + d->d_buf, ZL_INISIZE, d->d_bufini, + sizeof(*d->d_buf)); + if (natoms >= nrequested) + natoms = nrequested - 1; + } + SETFLOAT(d->d_buf + natoms, f); + d->d_natoms = natoms + 1; +} + +static void zldata_setsymbol(t_zldata *d, t_symbol *s) +{ + SETSYMBOL(d->d_buf, s); + d->d_natoms = 1; +} + +static void zldata_addsymbol(t_zldata *d, t_symbol *s) +{ + int natoms = d->d_natoms; + int nrequested = natoms + 1; + if (nrequested > d->d_size) + { + d->d_buf = grow_withdata(&nrequested, &natoms, &d->d_size, + d->d_buf, ZL_INISIZE, d->d_bufini, + sizeof(*d->d_buf)); + if (natoms >= nrequested) + natoms = nrequested - 1; + } + SETSYMBOL(d->d_buf + natoms, s); + d->d_natoms = natoms + 1; +} + +static void zldata_setlist(t_zldata *d, int ac, t_atom *av) +{ + int nrequested = ac; + if (nrequested > d->d_size) + d->d_buf = grow_nodata(&nrequested, &d->d_size, d->d_buf, + ZL_INISIZE, d->d_bufini, sizeof(*d->d_buf)); + if (d->d_natoms = nrequested) + memcpy(d->d_buf, av, nrequested * sizeof(*d->d_buf)); +} + +static void zldata_addlist(t_zldata *d, int ac, t_atom *av) +{ + int natoms = d->d_natoms; + int nrequested = natoms + ac; + if (nrequested > d->d_size) + { + d->d_buf = grow_withdata(&nrequested, &natoms, &d->d_size, + d->d_buf, ZL_INISIZE, d->d_bufini, + sizeof(*d->d_buf)); + if (natoms + ac > nrequested) + { + natoms = nrequested - ac; + if (natoms < 0) + natoms = 0, ac = nrequested; + } + } + if (d->d_natoms = natoms + ac) + memcpy(d->d_buf + natoms, av, ac * sizeof(*d->d_buf)); +} + +static void zldata_set(t_zldata *d, t_symbol *s, int ac, t_atom *av) +{ + if (s && s != &s_) + { + int nrequested = ac + 1; + if (nrequested > d->d_size) + d->d_buf = grow_nodata(&nrequested, &d->d_size, d->d_buf, + ZL_INISIZE, d->d_bufini, sizeof(*d->d_buf)); + if (d->d_natoms = nrequested) + { + SETSYMBOL(d->d_buf, s); + if (--nrequested) + memcpy(d->d_buf + 1, av, nrequested * sizeof(*d->d_buf)); + } + } + else zldata_setlist(d, ac, av); +} + +static void zldata_add(t_zldata *d, t_symbol *s, int ac, t_atom *av) +{ + if (s && s != &s_) + { + int natoms = d->d_natoms; + int nrequested = natoms + 1 + ac; + if (nrequested > d->d_size) + { + d->d_buf = grow_withdata(&nrequested, &natoms, &d->d_size, + d->d_buf, ZL_INISIZE, d->d_bufini, + sizeof(*d->d_buf)); + if (natoms + 1 + ac > nrequested) + { + natoms = nrequested - 1 - ac; + if (natoms < 0) + natoms = 0, ac = nrequested - 1; + } + } + if (d->d_natoms = natoms + 1 + ac) + { + SETSYMBOL(d->d_buf + natoms, s); + if (ac > 0) + memcpy(d->d_buf + natoms + 1, av, ac * sizeof(*d->d_buf)); + } + } + else zldata_addlist(d, ac, av); +} + +/* LATER rethink */ +static void zl_dooutput(t_outlet *o, int ac, t_atom *av) +{ + if (ac > 1) + { + if (av->a_type == A_FLOAT) + outlet_list(o, &s_list, ac, av); + else if (av->a_type == A_SYMBOL) + outlet_anything(o, av->a_w.w_symbol, ac - 1, av + 1); + } + else if (ac) + { + if (av->a_type == A_FLOAT) + outlet_float(o, av->a_w.w_float); + else if (av->a_type == A_SYMBOL) +#if 1 + outlet_anything(o, av->a_w.w_symbol, 0, 0); /* CHECKED */ +#else + outlet_symbol(o, av->a_w.w_symbol); /* LATER rethink */ +#endif + } +} + +static void zl_output(t_zl *x, int ac, t_atom *av) +{ + zl_dooutput(((t_object *)x)->ob_outlet, ac, av); +} + +static void zl_output2(t_zl *x, int ac, t_atom *av) +{ + zl_dooutput(x->x_out2, ac, av); +} + +static int zl_equal(t_atom *ap1, t_atom *ap2) +{ + return (ap1->a_type == ap2->a_type + && + ((ap1->a_type == A_FLOAT + && ap1->a_w.w_float == ap2->a_w.w_float) + || + (ap1->a_type == A_SYMBOL + && ap1->a_w.w_symbol == ap2->a_w.w_symbol))); +} + +/* Mode handlers: + If zl_<mode>_count's return value is positve, then the main routine + uses an output buffer 'buf' (outbuf, or a separately allocated one). + If zl_<mode>_count's return value is zero, then the main routine is + passed a null 'buf' (see below); if it is negative, then the main + routine is not being called. + zl_<mode> (main routine) arguments: if 'buf' is null, 'natoms' + is always zero -- in modes other than len (no buffer used), group, + iter, reg, slice/ecils (inbuf1 used), there should be no output. + If 'buf' is not null, then 'natoms' is guaranteed to be positive. +*/ + +static int zl_nop_count(t_zl *x) +{ + return (0); +} + +static void zl_nop(t_zl *x, int natoms, t_atom *buf, int banged) +{ + loud_warning((t_pd *)x, 0, "unknown mode"); +} + +static int zl_ecils_intarg(t_zl *x, int i) +{ + return (i > 0 ? i : 0); /* CHECKED */ +} + +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, int banged) +{ + int cnt1, cnt2 = x->x_modearg; + natoms = x->x_inbuf1.d_natoms; + buf = x->x_inbuf1.d_buf; + if (cnt2 > natoms) + cnt2 = natoms, cnt1 = 0; /* CHECKED */ + else + cnt1 = natoms - cnt2; + x->x_locked = 1; + if (cnt2) + zl_output2(x, cnt2, buf + cnt1); + if (cnt1) + zl_output(x, cnt1, buf); +} + +static int zl_group_intarg(t_zl *x, int i) +{ + return (i > 0 ? i : 0); /* CHECKED */ +} + +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, int banged) +{ + int cnt = x->x_modearg; + if (cnt > 0) + { + natoms = x->x_inbuf1.d_natoms; + buf = x->x_inbuf1.d_buf; + if (natoms >= cnt) + { + t_atom *from; + x->x_locked = 1; + for (from = buf; natoms >= cnt; natoms -= cnt, from += cnt) + zl_output(x, cnt, from); + 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 */ +} + +static int zl_iter_intarg(t_zl *x, int i) +{ + return (i > 0 ? i : 0); /* CHECKED */ +} + +static int zl_iter_count(t_zl *x) +{ + return (x->x_entered ? + (x->x_modearg < x->x_inbuf1.d_natoms ? + x->x_modearg : x->x_inbuf1.d_natoms) + : 0); +} + +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; + if (!buf) + { + if (natoms = (x->x_modearg < nremaining ? + x->x_modearg : nremaining)) + x->x_locked = 1; + else + return; + } + while (nremaining) + { + if (natoms > nremaining) + natoms = nremaining; + if (buf) + { + memcpy(buf, ptr, natoms * sizeof(*buf)); + zl_output(x, natoms, buf); + } + else zl_output(x, natoms, ptr); + nremaining -= natoms; + ptr += natoms; + } +} + +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, int banged) +{ + if (buf) + { + int ac1 = x->x_inbuf1.d_natoms, ac2 = x->x_inbuf2.d_natoms; + if (ac1) + memcpy(buf, x->x_inbuf1.d_buf, ac1 * sizeof(*buf)); + if (ac2) + memcpy(buf + ac1, x->x_inbuf2.d_buf, ac2 * sizeof(*buf)); + zl_output(x, natoms, buf); + } +} + +static int zl_len_count(t_zl *x) +{ + return (0); +} + +static void zl_len(t_zl *x, int natoms, t_atom *buf, int banged) +{ +/* 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) +{ + return (i > 0 ? i : 0); /* CHECKED */ +} + +static void zl_nth_anyarg(t_zl *x, t_symbol *s, int ac, t_atom *av) +{ + if (!s && ac && av->a_type == A_FLOAT) + zldata_setlist(&x->x_inbuf2, ac - 1, av + 1); +} + +static int zl_nth_count(t_zl *x) +{ + int ac1 = x->x_inbuf1.d_natoms; + if (ac1) + { + if (x->x_modearg > 0) + return (ac1 - 1 + x->x_inbuf2.d_natoms); + else + return (x->x_entered ? ac1 : 0); + } + else return (-1); +} + +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 */ + if (ac1 && ndx < ac1) /* CHECKED */ + { + t_atom *av1 = x->x_inbuf1.d_buf; + if (ndx < 0) + { + if (buf) memcpy(buf, av1, ac1 * sizeof(*buf)); + else + { + buf = av1; + x->x_locked = 1; + } + zl_output2(x, ac1, buf); + } + else + { + t_atom at = av1[ndx]; + if (buf) + { + int ac2 = x->x_inbuf2.d_natoms, ntail = ac1 - ndx - 1; + t_atom *ptr = buf; + if (ndx) + { + memcpy(ptr, av1, ndx * sizeof(*buf)); + ptr += ndx; + } + if (ac2) /* replacement */ + { + memcpy(ptr, x->x_inbuf2.d_buf, ac2 * sizeof(*buf)); + ptr += ac2; + } + if (ntail) + memcpy(ptr, av1 + ndx + 1, ntail * sizeof(*buf)); + zl_output2(x, natoms, buf); + } + zl_output(x, 1, &at); + } + } +} + +static void zl_reg_anyarg(t_zl *x, t_symbol *s, int ac, t_atom *av) +{ + if (!x->x_locked) + zldata_set(&x->x_inbuf1, s, ac, av); +} + +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, int banged) +{ + if (buf) memcpy(buf, x->x_inbuf1.d_buf, natoms * sizeof(*buf)); + else + { + natoms = x->x_inbuf1.d_natoms; + buf = x->x_inbuf1.d_buf; + x->x_locked = 1; + } + if (natoms) + zl_output(x, natoms, buf); +} + +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, int banged) +{ + if (buf) + { + t_atom *from = x->x_inbuf1.d_buf, *to = buf + natoms; + while (to-- > buf) + *to = *from++; + zl_output(x, natoms, buf); + } +} + +static int zl_rot_intarg(t_zl *x, int i) +{ + return (i); /* CHECKED anything goes (modulo) */ +} + +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, int banged) +{ + if (buf) + { + int cnt1 = x->x_modearg, cnt2; + if (cnt1) + { + if (cnt1 > 0) + { + cnt1 %= natoms; + cnt2 = natoms - cnt1; + } + else + { + cnt2 = -cnt1 % natoms; + cnt1 = natoms - cnt2; + } + /* CHECKED right rotation for positive args */ + memcpy(buf, x->x_inbuf1.d_buf + cnt2, cnt1 * sizeof(*buf)); + memcpy(buf + cnt1, x->x_inbuf1.d_buf, cnt2 * sizeof(*buf)); + } + else memcpy(buf, x->x_inbuf1.d_buf, natoms * sizeof(*buf)); + zl_output(x, natoms, buf); + } +} + +/* LATER rethink */ +static int zl_sect_count(t_zl *x) +{ + int result = 0; + int ac1 = x->x_inbuf1.d_natoms, ac2 = x->x_inbuf2.d_natoms, i1; + t_atom *av1 = x->x_inbuf1.d_buf, *av2 = x->x_inbuf2.d_buf, *ap1; + for (i1 = 0, ap1 = av1; i1 < ac1; i1++, ap1++) + { + int i2; + t_atom *testp; + for (i2 = 0, testp = av1; i2 < i1; i2++, testp++) + if (zl_equal(ap1, testp)) + goto skip; + for (i2 = 0, testp = av2; i2 < ac2; i2++, testp++) + { + if (zl_equal(ap1, testp)) + { + result++; + break; + } + } + skip:; + } + return (result); +} + +/* CHECKED in-buffer duplicates are skipped */ +static void zl_sect(t_zl *x, int natoms, t_atom *buf, int banged) +{ + if (buf) + { + int ac1 = x->x_inbuf1.d_natoms, ac2 = x->x_inbuf2.d_natoms, i1; + t_atom *ap1 = x->x_inbuf1.d_buf, *av2 = x->x_inbuf2.d_buf, *to = buf; + for (i1 = 0; i1 < ac1; i1++, ap1++) + { + int i2; + t_atom *testp; + for (testp = buf; testp < to; testp++) + if (zl_equal(ap1, testp)) + goto skip; + for (i2 = 0, testp = av2; i2 < ac2; i2++, testp++) + { + if (zl_equal(ap1, testp)) + { + *to++ = *ap1; + break; + } + } + skip:; + } + zl_output(x, natoms, buf); + } +} + +static int zl_slice_intarg(t_zl *x, int i) +{ + return (i > 0 ? i : 0); /* CHECKED */ +} + +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, int banged) +{ + int cnt1 = x->x_modearg, cnt2; + natoms = x->x_inbuf1.d_natoms; + buf = x->x_inbuf1.d_buf; + if (cnt1 > natoms) + cnt1 = natoms, cnt2 = 0; /* CHECKED */ + else + cnt2 = natoms - cnt1; + x->x_locked = 1; + if (cnt2) + zl_output2(x, cnt2, buf + cnt1); + if (cnt1) + zl_output(x, cnt1, buf); +} + +static int zl_sub_count(t_zl *x) +{ + return (0); +} + +static void zl_sub(t_zl *x, int natoms, t_atom *buf, int banged) +{ + int natoms2 = x->x_inbuf2.d_natoms; + if (natoms2) + { + int ndx1, natoms1 = x->x_inbuf1.d_natoms; + t_atom *av1 = x->x_inbuf1.d_buf, *av2 = x->x_inbuf2.d_buf; + for (ndx1 = 0; ndx1 < natoms1; ndx1++, av1++) + { + int ndx2; + t_atom *ap1 = av1, *ap2 = av2; + for (ndx2 = 0; ndx2 < natoms2; ndx2++, ap1++, ap2++) + if (!zl_equal(ap1, ap2)) + break; + if (ndx2 == natoms2) + /* CHECKED output position is zero-based */ + outlet_float(((t_object *)x)->ob_outlet, ndx1); + } + } +} + +/* LATER rethink */ +static int zl_union_count(t_zl *x) +{ + int result, ac1 = x->x_inbuf1.d_natoms, ac2 = x->x_inbuf2.d_natoms, i2; + t_atom *av1 = x->x_inbuf1.d_buf, *ap2 = x->x_inbuf2.d_buf; + result = ac1 + ac2; + for (i2 = 0; i2 < ac2; i2++, ap2++) + { + int i1; + t_atom *ap1; + for (i1 = 0, ap1 = av1; i1 < ac1; i1++, ap1++) + { + if (zl_equal(ap1, ap2)) + { + result--; + break; + } + } + } + return (result); +} + +/* CHECKED in-buffer duplicates not skipped */ +static void zl_union(t_zl *x, int natoms, t_atom *buf, int banged) +{ + if (buf) + { + int ac1 = x->x_inbuf1.d_natoms, ac2 = x->x_inbuf2.d_natoms, i2; + t_atom *av1 = x->x_inbuf1.d_buf, *ap2 = x->x_inbuf2.d_buf; + if (ac1) + { + t_atom *to = buf + ac1; + memcpy(buf, av1, ac1 * sizeof(*buf)); + for (i2 = 0; i2 < ac2; i2++, ap2++) + { + int i1; + t_atom *ap1; + for (i1 = 0, ap1 = av1; i1 < ac1; i1++, ap1++) + if (zl_equal(ap1, ap2)) + break; + if (i1 == ac1) + *to++ = *ap2; + } + } + else memcpy(buf, ap2, ac2 * sizeof(*buf)); + zl_output(x, natoms, buf); + } +} + +static void zl_doit(t_zl *x, int banged) +{ + int reentered = x->x_entered; + int prealloc = !reentered; + int natoms = (*zl_natomsfn[x->x_mode])(x); + if (natoms < 0) + return; + x->x_entered = 1; + if (natoms) + { + t_zldata *d = &x->x_outbuf; + t_atom *buf; + if (prealloc && natoms > d->d_size) + { + if (natoms > ZL_MAXSIZE) + prealloc = 0; + else + { + int nrequested = natoms; + d->d_buf = grow_nodata(&nrequested, &d->d_size, d->d_buf, + ZL_INISIZE, d->d_bufini, + sizeof(*d->d_buf)); + if (nrequested != natoms) + prealloc = 0; + } + } + /* 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, banged); + if (buf != d->d_buf) + freebytes(buf, natoms * sizeof(*buf)); + } + } + 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) +{ + zl_doit(x, 1); +} + +static void zl_float(t_zl *x, t_float f) +{ + if (!x->x_locked) + { + if (zl_modeflags[x->x_mode]) + zldata_addfloat(&x->x_inbuf1, f); + else + zldata_setfloat(&x->x_inbuf1, f); + } + zl_doit(x, 0); +} + +static void zl_symbol(t_zl *x, t_symbol *s) +{ + if (!x->x_locked) + { + if (zl_modeflags[x->x_mode]) + zldata_addsymbol(&x->x_inbuf1, s); + else + zldata_setsymbol(&x->x_inbuf1, s); + } + zl_doit(x, 0); +} + +/* LATER gpointer */ + +static void zl_list(t_zl *x, t_symbol *s, int ac, t_atom *av) +{ + if (!x->x_locked) + { + if (zl_modeflags[x->x_mode]) + zldata_addlist(&x->x_inbuf1, ac, av); + else + zldata_setlist(&x->x_inbuf1, ac, av); + } + zl_doit(x, 0); +} + +static void zl_anything(t_zl *x, t_symbol *s, int ac, t_atom *av) +{ + if (!x->x_locked) + { + if (zl_modeflags[x->x_mode]) + zldata_add(&x->x_inbuf1, s, ac, av); + else + zldata_set(&x->x_inbuf1, s, ac, av); + } + zl_doit(x, 0); +} + +static int zl_modeargfn(t_zl *x) +{ + return (zl_intargfn[x->x_mode] || zl_anyargfn[x->x_mode]); +} + +static void zl_setmodearg(t_zl *x, t_symbol *s, int ac, t_atom *av) +{ + if (zl_intargfn[x->x_mode]) + { + int i = (!s && ac && av->a_type == A_FLOAT ? + (int)av->a_w.w_float : /* CHECKED silent truncation */ + 0); /* CHECKED current x->x_modearg not kept */ + x->x_modearg = (*zl_intargfn[x->x_mode])(x, i); + } + if (zl_anyargfn[x->x_mode]) + (*zl_anyargfn[x->x_mode])(x, s, ac, av); +} + +static void zl_mode(t_zl *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac && av->a_type == A_SYMBOL) + { + t_symbol *modesym = av->a_w.w_symbol; + int i; + for (i = 0; i < zl_nmodes; i++) + if (modesym == zl_modesym[i]) + break; + /* LATER consider making this compatible: + CHECKED setting unknown mode makes a zl nop */ + if (i && i < zl_nmodes) + { + x->x_mode = i; + /* CHECKED incompatible (LATER warn): + c74 rejects creation args, if not a single int */ + zl_setmodearg(x, 0, ac - 1, av + 1); + } + } +} + +static void zlproxy_bang(t_zlproxy *d) +{ + /* CHECKED a nop */ +} + +static void zlproxy_float(t_zlproxy *p, t_float f) +{ + t_zl *x = p->p_master; + if (zl_modeargfn(x)) + { + t_atom at; + SETFLOAT(&at, f); + zl_setmodearg(x, 0, 1, &at); + } + else /* CHECKED inbuf2 filled only when used */ + zldata_setfloat(&x->x_inbuf2, f); +} + +static void zlproxy_symbol(t_zlproxy *p, t_symbol *s) +{ + t_zl *x = p->p_master; + if (zl_modeargfn(x)) + { + t_atom at; + SETSYMBOL(&at, s); + zl_setmodearg(x, 0, 1, &at); + } + else /* CHECKED inbuf2 filled only when used */ + zldata_setsymbol(&x->x_inbuf2, s); +} + +/* LATER gpointer */ + +static void zlproxy_list(t_zlproxy *p, t_symbol *s, int ac, t_atom *av) +{ + if (ac) + { + t_zl *x = p->p_master; + if (zl_modeargfn(x)) + zl_setmodearg(x, 0, ac, av); + else /* CHECKED inbuf2 filled only when used */ + zldata_setlist(&x->x_inbuf2, ac, av); + } +} + +static void zlproxy_anything(t_zlproxy *p, t_symbol *s, int ac, t_atom *av) +{ + t_zl *x = p->p_master; + if (zl_modeargfn(x)) + zl_setmodearg(x, s, ac, av); + else /* CHECKED inbuf2 filled only when used */ + zldata_set(&x->x_inbuf2, s, ac, av); +} + +#ifdef ZL_DEBUG +static void zl_debug(t_zl *x, t_floatarg f) +{ + loudbug_startpost("mode %s", zl_modesym[x->x_mode]->s_name); + if (zl_intargfn[x->x_mode]) + loudbug_post(" %d", x->x_modearg); + else + loudbug_endpost(); + if ((int)f) + { + loudbug_startpost("first:"); + loudbug_postatom(x->x_inbuf1.d_natoms, x->x_inbuf1.d_buf); + loudbug_endpost(); + loudbug_startpost("second:"); + loudbug_postatom(x->x_inbuf2.d_natoms, x->x_inbuf2.d_buf); + loudbug_endpost(); + } +} +#endif + +static void zl_free(t_zl *x) +{ + zldata_free(&x->x_inbuf1); + zldata_free(&x->x_inbuf2); + zldata_free(&x->x_outbuf); + if (x->x_proxy) pd_free((t_pd *)x->x_proxy); +} + +static void *zl_new(t_symbol *s, int ac, t_atom *av) +{ + t_zl *x = (t_zl *)pd_new(zl_class); + t_zlproxy *y = (t_zlproxy *)pd_new(zlproxy_class); + x->x_proxy = y; + y->p_master = x; + x->x_entered = 0; + x->x_locked = 0; + zldata_init(&x->x_inbuf1); + zldata_init(&x->x_inbuf2); + zldata_init(&x->x_outbuf); + x->x_mode = ZL_DEFMODE; + zl_mode(x, s, ac, av); + inlet_new((t_object *)x, (t_pd *)y, 0, 0); + outlet_new((t_object *)x, &s_anything); + x->x_out2 = outlet_new((t_object *)x, &s_anything); + return (x); +} + +static void zl_setupmode(char *id, int flags, + t_zlintargfn ifn, t_zlanyargfn afn, + t_zlnatomsfn nfn, t_zldoitfn dfn) +{ + if (zl_nmodes < ZL_MAXMODES) + { + zl_modesym[zl_nmodes] = gensym(id); + zl_modeflags[zl_nmodes] = flags; + zl_intargfn[zl_nmodes] = ifn; + zl_anyargfn[zl_nmodes] = afn; + zl_natomsfn[zl_nmodes] = nfn; + zl_doitfn[zl_nmodes] = dfn; + zl_nmodes++; + } + else loudbug_bug("zl_setupmode"); +} + +static void zl_setupallmodes(void) +{ + zl_setupmode("unknown", 0, 0, 0, zl_nop_count, zl_nop); + zl_setupmode("ecils", 0, zl_ecils_intarg, 0, zl_ecils_count, zl_ecils); + zl_setupmode("group", 1, zl_group_intarg, 0, zl_group_count, zl_group); + zl_setupmode("iter", 0, zl_iter_intarg, 0, zl_iter_count, zl_iter); + zl_setupmode("join", 0, 0, 0, zl_join_count, zl_join); + zl_setupmode("len", 0, 0, 0, zl_len_count, zl_len); + 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'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); + zl_setupmode("sub", 0, 0, 0, zl_sub_count, zl_sub); + zl_setupmode("union", 0, 0, 0, zl_union_count, zl_union); +} + +void zl_setup(void) +{ + zl_class = class_new(gensym("zl"), + (t_newmethod)zl_new, + (t_method)zl_free, + sizeof(t_zl), 0, + A_GIMME, 0); + class_addbang(zl_class, zl_bang); + class_addfloat(zl_class, zl_float); + class_addsymbol(zl_class, zl_symbol); + class_addlist(zl_class, zl_list); + class_addanything(zl_class, zl_anything); + class_addmethod(zl_class, (t_method)zl_mode, + gensym("mode"), A_GIMME, 0); +#ifdef ZL_DEBUG + class_addmethod(zl_class, (t_method)zl_debug, + gensym("debug"), A_DEFFLOAT, 0); +#endif + zlproxy_class = class_new(gensym("_zlproxy"), 0, 0, + sizeof(t_zlproxy), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(zlproxy_class, zlproxy_bang); + class_addfloat(zlproxy_class, zlproxy_float); + class_addsymbol(zlproxy_class, zlproxy_symbol); + class_addlist(zlproxy_class, zlproxy_list); + class_addanything(zlproxy_class, zlproxy_anything); + zl_setupallmodes(); +} diff --git a/externals/miXed/cyclone/notes.txt b/externals/miXed/cyclone/notes.txt new file mode 100644 index 000000000..23152f7f8 --- /dev/null +++ b/externals/miXed/cyclone/notes.txt @@ -0,0 +1,62 @@ +TODO for cyclone + * add folder class, so people forget about using tot for that purpose + * plug import into file/open + +DONE for cyclone + +alpha55 + * new class: overdrive~ + * seq: + . new incompatible message 'tempo': 1-based coef, does not start playback + . fix for double-to-float-pair calc in 'scoretime' and 'goto' + * abs~: performance fix + * slide~, rampsmooth~: bashing denormals + +alpha54 + * comment: fixing namespace bug, reducing traffic + * testmess: optionally filling message with symbols (numbers in hex form + or names of all registered classes) + +alpha53 + * matrix~: incompatible message 'set' + * coll: + . fixed descending order of 'sort' (a leaking sentinel bug) + . ignoring negative indices in 'min' and 'max' + . editor fixes (close by wm, dirty flag, title) + * Table: reading from file, reading from editor, editor fixes + * seq: editor fixes, editor bound to click (should bind to "open" too...) + * prob, capture, capture~: viewer fixes + +alpha52 + * compatibility mode interface in maxmode object: + messages 'set', 'get' (reply through the second outlet) + * better handling of initial directory in open panels + * relative path handling in 'cd' (library objects, seq, more to come) + * remote reply to 'pwd' message of library objects (target argument required) + * instead, left outlet of library objects sends return code from import + (negative value indicates an error) + * new class: matrix~ + * linedrive: more compatible in maxmode, bipolar otherwise + * seq: + . paused state fixes (state preserved in 'goto', proper delay in 'start') + . 'goto' fix (works in idlemode) + . more incompatible messages: 'scoretime', 'cd', 'pwd' + +alpha51 + * dummies loaded by maxmode, not cyclone + * setting directory in creation argument replaced with 'cd' message + to library objects (cyclone, maxmode, hammer and sickle) + * 'pwd' message to library objects sends directory symbol to an outlet + * creating cyclone and maxmode library objects possible without + loading component libraries + * prepend and Append: + . bang handling, controlled by maxmode + . restored max-like 'set' handling as default for objects with arguments + * fix for parsing creation arguments in svf~ + * incompatible additions to seq: 'pause', 'continue', 'goto' + +alpha50 + * max-compatibility mode switch for cyclone + . turned on by loading cyclone libs through "-lib maxmode" + . affects max-compatibility of prepend and Append, controls + compatibility warnings diff --git a/externals/miXed/cyclone/shadow/Makefile b/externals/miXed/cyclone/shadow/Makefile new file mode 100644 index 000000000..dc397722f --- /dev/null +++ b/externals/miXed/cyclone/shadow/Makefile @@ -0,0 +1,7 @@ +ROOT_DIR = ../.. +redefault: default $(ROOT_DIR)/bin/cyclist +include $(ROOT_DIR)/Makefile.common + +$(ROOT_DIR)/bin/cyclist: $(SHARED_DIR)/common/binport.c \ + $(SHARED_DIR)/common/lex.c $(SHARED_DIR)/unstable/standalone.c + $(CC) $(CFLAGS) -DMIXED_STANDALONE -o $@ $^ diff --git a/externals/miXed/cyclone/shadow/Makefile.objects b/externals/miXed/cyclone/shadow/Makefile.objects new file mode 100644 index 000000000..1ddea9c7e --- /dev/null +++ b/externals/miXed/cyclone/shadow/Makefile.objects @@ -0,0 +1,14 @@ +SHARED_OBJECTS = \ +common/loud.o \ +common/grow.o \ +common/os.o \ +common/fitter.o \ +common/lex.o \ +common/binport.o \ +common/port.o \ +hammer/file.o \ +sickle/sic.o \ +unstable/forky.o \ +unstable/fragile.o \ +unstable/fringe.o \ +unstable/loader.o diff --git a/externals/miXed/cyclone/shadow/Makefile.sources b/externals/miXed/cyclone/shadow/Makefile.sources new file mode 100644 index 000000000..be9a840c2 --- /dev/null +++ b/externals/miXed/cyclone/shadow/Makefile.sources @@ -0,0 +1,7 @@ +CX_SOURCES = \ +cyclone.c \ +maxmode.c \ +dummies.c + +OTHER_SOURCES = \ +nettles.c diff --git a/externals/miXed/cyclone/shadow/cyclone.c b/externals/miXed/cyclone/shadow/cyclone.c new file mode 100644 index 000000000..cb051b6d8 --- /dev/null +++ b/externals/miXed/cyclone/shadow/cyclone.c @@ -0,0 +1,163 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Never use forked calls in shadow code... */ + +/* LATER support multi-atom dir ('cd' message), and fn ('import' message) + (same in maxmode, hammer and sickle) */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/port.h" +#include "hammer/file.h" +#include "unstable/fragile.h" +#include "unstable/loader.h" +#include "shadow.h" +#include "../build_counter" + +typedef struct _cyclone +{ + t_object x_ob; + t_hammerfile *x_filehandle; +} t_cyclone; + +static t_class *cyclone_class; +static int cyclone_hammerndx; +static int cyclone_sicklendx; +static int cyclone_nettlesndx; +static int cyclone_lastndx; + +static void cyclone_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + int result = import_max(fn->s_name, ""); + outlet_float(((t_object *)z)->ob_outlet, (t_float)result); +} + +static void cyclone_doimport(t_cyclone *x, t_symbol *fn) +{ + if (fn && fn != &s_) + { + t_symbol *dir = hammerpanel_getopendir(x->x_filehandle); + int result = + import_max(fn->s_name, (dir && dir != &s_ ? dir->s_name : "")); + outlet_float(((t_object *)x)->ob_outlet, (t_float)result); + } + else hammerpanel_open(x->x_filehandle, 0); +} + +static void cyclone_click(t_cyclone *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + cyclone_doimport(x, 0); +} + +static void cyclone_import(t_cyclone *x, t_symbol *fn) +{ + cyclone_doimport(x, fn); +} + +static void cyclone_cd(t_cyclone *x, t_symbol *dir) +{ + hammerpanel_setopendir(x->x_filehandle, dir); +} + +static void cyclone_pwd(t_cyclone *x, t_symbol *s) +{ + t_symbol *dir; + if (s && s->s_thing && (dir = hammerpanel_getopendir(x->x_filehandle))) + pd_symbol(s->s_thing, dir); +} + +static void cyclone_bang(t_cyclone *x) +{ + if (cyclone_hammerndx && cyclone_sicklendx) + { + fragile_class_printnames("hammer classes are: ", + cyclone_hammerndx, cyclone_sicklendx - 1); + fragile_class_printnames("sickle classes are: ", + cyclone_sicklendx, cyclone_nettlesndx - 1); + } + fragile_class_printnames("nettles are: ", + cyclone_nettlesndx, cyclone_lastndx - 1); +} + +static void cyclone_free(t_cyclone *x) +{ + hammerfile_free(x->x_filehandle); +} + +static void *cyclone_new(void) +{ + t_cyclone *x = (t_cyclone *)pd_new(cyclone_class); + x->x_filehandle = hammerfile_new((t_pd *)x, 0, cyclone_readhook, 0, 0); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void cyclone_setup(void) +{ + int hresult, sresult; + hresult = sresult = LOADER_OK; + if (zgetfn(&pd_objectmaker, gensym("cyclone"))) + { + loud_error(0, "cyclone is already loaded"); + return; + } + post("this is cyclone %s, %s %s build", + CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE); + cyclone_class = class_new(gensym("cyclone"), + (t_newmethod)cyclone_new, + (t_method)cyclone_free, + sizeof(t_cyclone), 0, 0); + class_addbang(cyclone_class, cyclone_bang); + class_addmethod(cyclone_class, (t_method)cyclone_cd, + gensym("cd"), A_DEFSYM, 0); + class_addmethod(cyclone_class, (t_method)cyclone_pwd, + gensym("pwd"), A_SYMBOL, 0); + class_addmethod(cyclone_class, (t_method)cyclone_import, + 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); + hammerfile_setup(cyclone_class, 0); + + if (canvas_getcurrent()) + { + /* Loading hammer and sickle by cyclone object creation is banned, + because of a danger of having some of the classes already loaded. */ + loud_warning(0, "cyclone", + "creating cyclone object without loading cyclone components"); + cyclone_hammerndx = cyclone_sicklendx = 0; + } + else + { + cyclone_hammerndx = fragile_class_count(); + if (zgetfn(&pd_objectmaker, gensym("hammer"))) + loud_warning(0, "cyclone", "hammer is already loaded"); + else + hresult = unstable_load_lib("", "hammer"); + + cyclone_sicklendx = fragile_class_count(); + if (zgetfn(&pd_objectmaker, gensym("sickle"))) + loud_warning(0, "cyclone", "sickle is already loaded"); + else + sresult = unstable_load_lib("", "sickle"); + } + cyclone_nettlesndx = fragile_class_count(); + allnettles_setup(); + cyclone_lastndx = fragile_class_count() - 1; + + if (hresult == LOADER_NOFILE) + loud_error(0, "hammer library is missing"); + else if (sresult == LOADER_NOFILE) + loud_error(0, "sickle library is missing"); + else if (cyclone_hammerndx && + (!zgetfn(&pd_objectmaker, gensym("hammer")) || + !zgetfn(&pd_objectmaker, gensym("sickle")))) + { + loud_error(0, "version mismatch"); + loud_errand(0, + "use a more recent Pd release (or recompile the cyclone)."); + } +} diff --git a/externals/miXed/cyclone/shadow/dummies.c b/externals/miXed/cyclone/shadow/dummies.c new file mode 100644 index 000000000..f55c68394 --- /dev/null +++ b/externals/miXed/cyclone/shadow/dummies.c @@ -0,0 +1,643 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#ifdef UNIX +#include <unistd.h> +#endif +#ifdef NT +#include <io.h> +#endif +#include "m_pd.h" +#include "common/loud.h" +#include "common/port.h" + +#ifdef KRZYSZCZ +//#define DUMMIES_DEBUG +#endif + +static t_class *ccdummies_class; +static int dummy_nclasses = 0; +static int pending_nclasses = 0; +static t_class **dummy_classes; +static int dummy_nreps = 0; + +typedef struct _dummy_slot +{ + char *s_name; /* do not use after setup: invalid for mapped names */ + int s_nins; + int s_nouts; + int s_warned; + t_newmethod s_method; /* a specialized constructor */ +} t_dummy_slot; + +static t_object *dummy_newobject(t_symbol *s, t_dummy_slot **slotp); +static void dummy_io(t_object *x, int nins, int nouts); + +static void *dummy_2dwave_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nouts = 0; + if (ac && av->a_type == A_SYMBOL) + { + if (ac > 3 && av[3].a_type == A_FLOAT) + nouts = (int)av[3].a_w.w_float; + } + else loud_classarg(*(t_pd *)x); + if (nouts < 1) + nouts = 1; + dummy_io(x, sl->s_nins, nouts); + return (x); +} + +static void *dummy_adoutput_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nouts = 0; + while (ac--) + { + if (av++->a_type == A_FLOAT) nouts++; + else + { + loud_classarg(*(t_pd *)x); + break; + } + } + if (nouts < 1) + nouts = 2; + dummy_io(x, sl->s_nins, nouts); + return (x); +} + +static void *dummy_fffb_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nouts = 0; + if (ac && av->a_type == A_FLOAT) + nouts = (int)av->a_w.w_float; + if (nouts < 1) + { + loud_classarg(*(t_pd *)x); + nouts = 1; + } + dummy_io(x, sl->s_nins, nouts); + return (x); +} + +static void *dummy_gate_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nouts = 0; + if (ac && av->a_type == A_FLOAT) + nouts = (int)av->a_w.w_float; + if (nouts < 1) + nouts = 1; + dummy_io(x, sl->s_nins, nouts); + return (x); +} + +static void *dummy_groove_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nouts = 0; + if (ac && av->a_type == A_SYMBOL) + { + if (ac > 1 && av[1].a_type == A_FLOAT) + nouts = (int)av[1].a_w.w_float; + } + else loud_classarg(*(t_pd *)x); + if (nouts < 1) + nouts = 1; + dummy_io(x, sl->s_nins, nouts + 1); + return (x); +} + +/* FIXME */ +static void *dummy_if_new(t_symbol *s, int ac, t_atom *av) +{ + t_object *x = dummy_newobject(s, 0); + int nins = 0; + int nouts = 1; + t_symbol *ps_out2 = gensym("out2"); + while (ac--) + { + if (av->a_type == A_SYMBOL) + { + if (av->a_w.w_symbol == ps_out2) + nouts = 2; + else + { + char *name = av->a_w.w_symbol->s_name; + if (strlen(name) >= 3 && *name == '$') + { + char c = name[2]; + if (c > '1' && c <= '9' && c > '0' + nins) + nins = c - '0'; + } + } + } + av++; + } + dummy_io(x, nins, nouts); + return (x); +} + +#if 0 +static void *dummy_matrix_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nins = 0, nouts = 0; + if (ac && av->a_type == A_FLOAT) + { + nins = (int)av->a_w.w_float; + if (ac > 1 && av[1].a_type == A_FLOAT) + nouts = (int)av[1].a_w.w_float; + } + if (nins < 1 || nouts < 1) + { + loud_classarg(*(t_pd *)x); + if (nins < 1) nins = 1; + if (nouts < 1) nouts = 1; + } + dummy_io(x, nins, nouts + 1); /* CHECKME */ + return (x); +} +#endif + +static void *dummy_rewire_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nouts = 0; + if (ac && av->a_type == A_FLOAT) + nouts = (int)av->a_w.w_float; + else if (ac > 1 && av[1].a_type == A_FLOAT) + nouts = (int)av[1].a_w.w_float; + if (nouts < 1) + nouts = 1; /* CHECKME */ + dummy_io(x, sl->s_nins, nouts + 4); + return (x); +} + +static void *dummy_selector_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nins = 0; + if (ac && av->a_type == A_FLOAT) + nins = (int)av->a_w.w_float; + if (nins < 1) + nins = 1; + dummy_io(x, nins + 1, sl->s_nouts); + return (x); +} + +static void *dummy_sfplay_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nouts = 0; + if (ac) + { + if (av->a_type == A_FLOAT) + nouts = (int)av->a_w.w_float; + else if (ac > 1 && av[1].a_type == A_FLOAT) + nouts = (int)av[1].a_w.w_float; + } + if (nouts < 1) + nouts = 1; + dummy_io(x, sl->s_nins, nouts + 1); + return (x); +} + +static void *dummy_sfrecord_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nins = 0; + if (ac && av->a_type == A_FLOAT) + nins = (int)av->a_w.w_float; + if (nins < 1) + nins = 1; + dummy_io(x, nins, sl->s_nouts); + return (x); +} + +static void *dummy_stutter_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nios = 0; + if (ac > 4 && av[4].a_type == A_FLOAT) + nios = (int)av[4].a_w.w_float; + if (nios < 1) + nios = 1; + dummy_io(x, nios + 2, nios); + return (x); +} + +static void *dummy_sxformat_new(t_symbol *s, int ac, t_atom *av) +{ + return (dummy_if_new(s, ac, av)); /* FIXME */ +} + +static void *dummy_tapout_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int warned = 0, nios = 0; + while (ac--) + if (av++->a_type == A_FLOAT) + nios++; + else if (!warned++) + loud_classarg(*(t_pd *)x); + if (nios < 1) + nios = 1; + dummy_io(x, nios, nios); + return (x); +} + +/* CHECKME */ +static void *dummy_tiCmd_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nouts = 0; + if (ac > 1) + { + ac--; av++; + while (ac--) + { + char c = 0; + if (av->a_type == A_SYMBOL) + { + c = *av->a_w.w_symbol->s_name; + if (c == 'i' || c == 'f' || c == 'l' + || c == 'b' || c == 's' || c == 'a') + nouts++; + else + c = 0; + } + if (c == 0) + { + loud_classarg(*(t_pd *)x); + break; + } + av++; + } + } + if (nouts < 1) + nouts = 0; + dummy_io(x, sl->s_nins, nouts + 2); + return (x); +} + +/* CHECKME */ +static void *dummy_timeline_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nouts = 0; + if (ac) + { + if (av->a_type == A_FLOAT) + nouts = (int)av->a_w.w_float; + else if (ac > 1 && av[1].a_type == A_FLOAT) + nouts = (int)av[1].a_w.w_float; + } + if (nouts < 1) + nouts = 0; + dummy_io(x, sl->s_nins, nouts); + return (x); +} + +static void *dummy_vexpr_new(t_symbol *s, int ac, t_atom *av) +{ + return (dummy_if_new(s, ac, av)); /* FIXME */ +} + +static void *dummy_vst_tilde_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + int nins = 0, nouts = 0; + if (ac > 1 && av[1].a_type == A_FLOAT) + { + if (av->a_type == A_FLOAT) + { + nins = (int)av->a_w.w_float; + nouts = (int)av[1].a_w.w_float; + } + } + else if (ac && av->a_type == A_FLOAT) + nouts = (int)av->a_w.w_float; + if (nins < 1) + nins = 2; /* CHECKME */ + if (nouts < 1) + nouts = 2; /* CHECKME */ + dummy_io(x, nins, nouts + 4); /* CHECKME */ + return (x); +} + +static t_dummy_slot dummy_slots[] = +{ + { "2d.wave~", 4, -1, 0, (t_newmethod)dummy_2dwave_tilde_new }, + { "absolutepath", 1, 1, 0, 0 }, + { "acosh", 1, 1, 0, 0 }, + { "adoutput~", 1, -1, 0, (t_newmethod)dummy_adoutput_tilde_new }, + { "adstatus", 2, 2, 0, 0 }, + { "asinh", 1, 1, 0, 0 }, + { "atanh", 1, 1, 0, 0 }, + { "begin~", 0, 1, 0, 0 }, + /* LATER try mapping bpatcher to a gop abstraction/subpatch */ + { "buffer~", 1, 2, 0, 0 }, + { "cd", 1, 2, 0, 0 }, /* CHECKED (refman error?) */ + { "cd~", 1, 6, 0, 0 }, /* CHECKED (refman error?) */ + { "clocker", 2, 1, 0, 0 }, + { "closebang", 0, 1, 0, 0 }, + { "colorpicker", 1, 1, 0, 0 }, + { "date", 1, 3, 0, 0 }, + { "defer", 1, 1, 0, 0 }, /* LATER pass anything through */ + { "degrade~", 3, 1, 0, 0 }, + { "detonate", 8, 8, 0, 0 }, + { "dial", 1, 1, 0, 0 }, + { "dialog", 2, 1, 0, 0 }, + { "downsamp~", 2, 1, 0, 0 }, + { "dropfile", 1, 2, 0, 0 }, + { "dspstate~", 1, 3, 0, 0 }, + { "dsptime~", 1, 1, 0, 0 }, + { "env", 1, 1, 0, 0 }, + { "envi", 1, 1, 0, 0 }, + { "error", 1, 1, 0, 0 }, + { "ezadc~", 1, 2, 0, 0 }, + { "ezdac~", 2, 0, 0, 0 }, + { "fffb~", 1, -1, 0, (t_newmethod)dummy_fffb_tilde_new }, + /* LATER Fft~ */ + /* LATER pfft~-specific classes: fftin~, fftinfo~, fftout~ */ + { "filedate", 1, 1, 0, 0 }, + { "filein", 3, 3, 0, 0 }, + { "filepath", 1, 1, 0, 0 }, + { "filtergraph~", 8, 6, 0, 0 }, + { "folder", 1, 2, 0, 0 }, + { "follow", 1, 2, 0, 0 }, + { "fpic", 1, 0, 0, 0 }, + { "frame", 6, 0, 0, 0 }, + { "function", 1, 4, 0, 0 }, + { "gain~", 2, 2, 0, 0 }, + { "gate~", 2, -1, 0, (t_newmethod)dummy_gate_tilde_new }, + { "gestalt", 1, 2, 0, 0 }, + { "Ggate", 2, 2, 0, 0 }, + { "graphic", 1, 0, 0, 0 }, + { "groove~", 3, -1, 0, (t_newmethod)dummy_groove_tilde_new }, + { "Gswitch", 3, 1, 0, 0 }, + { "hint", 1, 1, 0, 0 }, + { "if", -1, -1, 0, (t_newmethod)dummy_if_new }, + /* LATER Ifft~ */ + { "imovie", 1, 3, 0, 0 }, + { "IncDec", 1, 1, 0, 0 }, + { "info~", 1, 8, 0, 0 }, /* CHECKME nouts */ + { "ioscbank~", 4, 1, 0, 0 }, + { "kslider", 2, 2, 0, 0 }, + { "lcd", 1, 4, 0, 0 }, /* CHECKME nouts */ + { "led", 1, 1, 0, 0 }, + { "matrixctrl", 1, 1, 0, 0 }, /* CHECKME nins, nouts */ +#if 0 + { "matrix~", -1, -1, 0, (t_newmethod)dummy_matrix_tilde_new }, +#endif + { "menubar", 1, 4, 0, 0 }, /* LATER parse #Xs (additional outs) */ + { "meter~", 1, 1, 0, 0 }, /* LATER consider mapping to the vu */ + { "movie", 1, 3, 0, 0 }, + /* CHECKME msd */ + { "multiSlider", 1, 1, 0, 0 }, + { "mute~", 1, 1, 0, 0 }, + { "normalize~", 2, 1, 0, 0 }, + { "number~", 2, 2, 0, 0 }, + { "numkey", 1, 2, 0, 0 }, + { "omscontrollers", 4, 2, 0, 0 }, /* CHECKME osx */ + { "omsinfo", 2, 1, 0, 0 }, /* LATER midiinfo? */ + { "omsnotes", 4, 2, 0, 0 }, /* CHECKME osx */ + { "omspatches", 3, 2, 0, 0 }, /* CHECKME osx */ + { "onecopy", 0, 0, 0, 0 }, /* CHECKME */ + { "opendialog", 1, 2, 0, 0 }, + { "oscbank~", 4, 1, 0, 0 }, + { "oval", 6, 0, 0, 0 }, + { "overdrive~", 2, 1, 0, 0 }, + { "panel", 1, 0, 0, 0 }, + { "pass~", 1, 1, 0, 0 }, + { "pcontrol", 1, 1, 0, 0 }, + /* LATER pfft~ */ + { "phaseshift~", 3, 1, 0, 0 }, + { "pics", 3, 0, 0, 0 }, /* CHECKME */ + { "pics2", 3, 0, 0, 0 }, /* CHECKME */ + { "pict", 3, 0, 0, 0 }, + { "pictctrl", 1, 1, 0, 0 }, + { "pictslider", 2, 2, 0, 0 }, /* CHECKME one-dimensional mode */ + { "playbar", 1, 2, 0, 0 }, /* CHECKME */ + { "polyin", 1, 3, 0, 0 }, /* LATER parse args for nouts */ + { "polyout", 3, 0, 0, 0 }, /* CHECKME nins */ + /* LATER poly~ */ + { "preset", 1, 3, 0, 0 }, + { "radiogroup", 1, 1, 0, 0 }, + { "rate~", 2, 1, 0, 0 }, /* CHECKME */ + /* LATER settable Receive? */ + { "rect", 6, 0, 0, 0 }, + { "relativepath", 1, 1, 0, 0 }, + { "ring", 6, 0, 0, 0 }, + { "round~", 2, 1, 0, 0 }, + { "rslider", 2, 2, 0, 0 }, + { "rtin", 1, 1, 0, 0 }, + { "savedialog", 1, 3, 0, 0 }, + { "screensize", 1, 2, 0, 0 }, + { "selector~", -1, 1, 0, (t_newmethod)dummy_selector_tilde_new }, + { "seq~", 1, 2, 0, 0 }, + { "serial", 1, 2, 0, 0 }, + { "setclock", 2, 1, 0, 0 }, + { "sfinfo~", 1, 6, 0, 0 }, /* CHECKME nouts */ + { "sflist~", 1, 0, 0, 0 }, + { "sfplay~", 1, -1, 0, (t_newmethod)dummy_sfplay_tilde_new }, + { "sfrecord~", -1, 0, 0, (t_newmethod)dummy_sfrecord_tilde_new }, + { "strippath", 1, 2, 0, 0 }, + { "stutter~", -1, -1, 0, (t_newmethod)dummy_stutter_tilde_new }, + { "suspend", 0, 1, 0, 0 }, + { "swatch", 3, 2, 0, 0 }, + { "sxformat", -1, 1, 0, (t_newmethod)dummy_sxformat_new }, + { "sysexin", 1, 1, 0, 0 }, + { "tapin~", 1, 1, 0, 0 }, + { "tapout~", -1, -1, 0, (t_newmethod)dummy_tapout_tilde_new }, + { "teeth~", 6, 1, 0, 0 }, + { "tempo", 4, 1, 0, 0 }, + { "Text", 1, 1, 0, 0 }, + { "textedit", 1, 3, 0, 0 }, + { "thisobject", 1, 3, 0, 0 }, /* CHECKME */ + { "thispatcher", 1, 2, 0, 0 }, + { "thisTimeline", 1, 1, 0, 0 }, + { "thisTrack", 1, 0, 0, 0 }, + { "thispoly~", 1, 1, 0, 0 }, + { "thresh~", 3, 1, 0, 0 }, + { "tiCmd", 0, -1, 0, (t_newmethod)dummy_tiCmd_new }, + { "timeline", 1, -1, 0, (t_newmethod)dummy_timeline_new }, + { "tiOut", 1, 0, 0, 0 }, + { "timein", 3, 4, 0, 0 }, + { "timeout", 4, 0, 0, 0 }, + /* LATER touchin's inlet (Touchin?) */ + { "trunc~", 1, 1, 0, 0 }, /* CHECKME */ + { "ubutton", 1, 4, 0, 0 }, + { "umenu", 1, 2, 0, 0 }, + { "vexpr", -1, 1, 0, (t_newmethod)dummy_vexpr_new }, + { "vpicture", 0, 0, 0, 0 }, + { "waveform~", 5, 6, 0, 0 }, /* CHECKME */ + { "zigzag~", 2, 4, 0, 0 }, + + /* mapped names (cf the structure `importmapping_default' in port.c) */ + /* clashing dummies go first */ + { "biquad~", 6, 1, 0, 0 }, + { "change", 1, 3, 0, 0 }, + { "key", 0, 3, 0, 0 }, + { "keyup", 0, 3, 0, 0 }, + { "line", 3, 2, 0, 0 }, + { "poly", 2, 4, 0, 0 }, + + /* remaining slots define `doomed' kind of dummies */ + { "appledvd", 1, 2, 0, 0 }, + /* LATER glove? */ + { "plugconfig", 1, 0, 0, 0 }, + { "plugin~", 2, 2, 0, 0 }, + { "plugmidiin", 0, 1, 0, 0 }, + { "plugmidiout", 1, 0, 0, 0 }, + { "plugmod", 5, 3, 0, 0 }, + { "plugmorph", 2, 3, 0, 0 }, + { "plugmultiparam", 1, 2, 0, 0 }, + { "plugout~", 2, 2, 0, 0 }, /* CHECKME nouts */ + { "plugphasor~", 0, 1, 0, 0 }, /* CHECKME nouts */ + { "plugreceive~", 1, 1, 0, 0 }, + { "plugsend~", 1, 0, 0, 0 }, + { "plugstore", 1, 1, 0, 0 }, /* CHECKME nouts */ + { "plugsync~", 0, 9, 0, 0 }, /* CHECKME nouts */ + { "pp", 2, 2, 0, 0 }, /* CHECKME nins */ + { "pptempo", 2, 2, 0, 0 }, + { "pptime", 4, 4, 0, 0 }, + { "rewire~", 1, -1, 0, (t_newmethod)dummy_rewire_tilde_new }, + { "sndmgrin~", 0, 2, 0, 0 }, /* CHECKME */ + { "vdp", 3, 4, 0, 0 }, + { "vst~", -1, -1, 0, (t_newmethod)dummy_vst_tilde_new }, + { "_dummy", 0, 0, 0, 0 } +}; + +static void *dummy_new(t_symbol *s, int ac, t_atom *av) +{ + t_dummy_slot *sl; + t_object *x = dummy_newobject(s, &sl); + dummy_io(x, sl->s_nins, sl->s_nouts); + return (x); +} + +static void dummy_io(t_object *x, int nins, int nouts) +{ + nins = (nins > 0 ? nins - 1 : 0); + while (nins--) inlet_new(x, (t_pd *)x, 0, 0); + while (nouts--) outlet_new(x, &s_anything); +} + +static t_object *dummy_newobject(t_symbol *s, t_dummy_slot **slotp) +{ + t_object *x; + t_dummy_slot *sl; + int fnd; + for (fnd = 0; fnd < dummy_nclasses; fnd++) + /* LATER compare symbols, rather than strings */ + if (dummy_classes[fnd] /* empty slot: abstraction replacement */ + && !strcmp(class_getname(dummy_classes[fnd]), s->s_name)) + break; + x = (t_object *)pd_new(dummy_classes[fnd]); + sl = &dummy_slots[fnd]; + if (fnd == dummy_nclasses) + loudbug_bug("dummy_newobject"); /* create a "_dummy" in this case */ + else if (!sl->s_warned) + { + loud_warning((t_pd *)x, 0, "dummy substitution"); + sl->s_warned = 1; + } + if (slotp) *slotp = sl; + return (x); +} + +static void ccdummies_bang(t_pd *x) +{ + if (dummy_nreps) + { + char *msg = "replacement abstractions are: "; + int i, len = strlen(msg); + t_dummy_slot *sl; + startpost(msg); + for (i = 0, sl = dummy_slots; i < dummy_nclasses; i++, sl++) + { + if (!dummy_classes[i]) + { + /* name field is valid here (reps are never mapped) */ + int l = 1 + strlen(sl->s_name); + if ((len += l) > 66) + { + endpost(); + startpost(" "); + len = 3 + l; + } + poststring(sl->s_name); + } + } + endpost(); + } + else post("no replacement abstractions"); +} + +void dummies_setup(void) +{ + t_dummy_slot *sl; + int i, mapsize; + char **mapping = import_getmapping(&mapsize); + int ndoomed = 0; + dummy_nclasses = sizeof(dummy_slots)/sizeof(*dummy_slots); + /* never freed: */ + dummy_classes = getbytes(dummy_nclasses * sizeof(*dummy_classes)); + for (i = 0, sl = dummy_slots; i < dummy_nclasses; i++, sl++) + { + int fd; + char dirbuf[MAXPDSTRING], *nameptr; + char *name = port_usemapping(sl->s_name, mapsize, mapping); + if (name) + ndoomed++; + else if (ndoomed && i < dummy_nclasses - 1) + { + loudbug_bug("dummies_setup"); + loudbug_post + ("(\"%s\": clashing or doomed dummy not registered for import)", + sl->s_name); + } + if ((fd = open_via_path("", sl->s_name, ".pd", + dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0) + { + close(fd); + dummy_nreps++; + } + else + { + dummy_classes[i] = + class_new((name ? gensym(name) : gensym(sl->s_name)), + sl->s_method ? sl->s_method : (t_newmethod)dummy_new, + 0, sizeof(t_object), + (sl->s_nins ? 0 : CLASS_NOINLET), A_GIMME, 0); + } + } + dummy_nclasses--; /* use "_dummy" as a sentinel */ + + ccdummies_class = class_new(gensym("_cc.dummies"), 0, 0, + sizeof(t_pd), CLASS_PD | CLASS_NOINLET, 0); + class_addbang(ccdummies_class, ccdummies_bang); + pd_bind(pd_new(ccdummies_class), gensym("_cc.dummies")); /* never freed */ +} diff --git a/externals/miXed/cyclone/shadow/maxmode.c b/externals/miXed/cyclone/shadow/maxmode.c new file mode 100644 index 000000000..189c83ee1 --- /dev/null +++ b/externals/miXed/cyclone/shadow/maxmode.c @@ -0,0 +1,202 @@ +/* Copyright (c) 2004-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" +#include "common/port.h" +#include "hammer/file.h" +#include "unstable/fragile.h" +#include "unstable/loader.h" +#include "../build_counter" + +typedef struct _maxmode +{ + t_object x_ob; + t_hammerfile *x_filehandle; + t_outlet *x_modeout; +} t_maxmode; + +static t_class *maxmode_class; +static int maxmode_dummiesndx; +static int maxmode_lastndx; +static t_pd *maxmode_dproxy = 0; +static int maxmode_withbanner = 0; + +static void maxmode_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + int result = import_max(fn->s_name, ""); + outlet_float(((t_object *)z)->ob_outlet, (t_float)result); +} + +static void maxmode_doimport(t_maxmode *x, t_symbol *fn) +{ + if (fn && fn != &s_) + { + t_symbol *dir = hammerpanel_getopendir(x->x_filehandle); + int result = + import_max(fn->s_name, (dir && dir != &s_ ? dir->s_name : "")); + outlet_float(((t_object *)x)->ob_outlet, (t_float)result); + } + else hammerpanel_open(x->x_filehandle, 0); + +} + +static void maxmode_click(t_maxmode *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + maxmode_doimport(x, 0); +} + +static void maxmode_import(t_maxmode *x, t_symbol *fn) +{ + maxmode_doimport(x, fn); +} + +static void maxmode_cd(t_maxmode *x, t_symbol *dir) +{ + hammerpanel_setopendir(x->x_filehandle, dir); +} + +static void maxmode_pwd(t_maxmode *x, t_symbol *s) +{ + t_symbol *dir; + if (s && s->s_thing && (dir = hammerpanel_getopendir(x->x_filehandle))) + pd_symbol(s->s_thing, dir); +} + +static void maxmode_set(t_maxmode *x, t_symbol *s) +{ + if (!s || s == &s_) + s = gensym("none"); + if (s != fitter_getmode()) + fitter_setmode(s); +} + +static void maxmode_get(t_maxmode *x) +{ + t_symbol *mode; + if (mode = fitter_getmode()) + outlet_symbol(x->x_modeout, mode); +} + +static void maxmode_bang(t_maxmode *x) +{ + if (maxmode_dproxy) + pd_bang(maxmode_dproxy); + else + post("no replacement abstractions"); + if (maxmode_lastndx > maxmode_dummiesndx) + fragile_class_printnames("dummies are: ", + maxmode_dummiesndx, maxmode_lastndx); + else + post("no dummies"); +} + +static void maxmode_free(t_maxmode *x) +{ + /* FIXME cancel registration */ + hammerfile_free(x->x_filehandle); +} + +static void *maxmode_new(t_symbol *s, int ac, t_atom *av) +{ + t_maxmode *x = (t_maxmode *)pd_new(maxmode_class); + int selective = ac; + if (maxmode_withbanner && !ac) + { + post("this is maxmode %s, %s %s build", + CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE); + loud_warning(0, "maxmode", + "creating maxmode object without loading cyclone components"); + maxmode_withbanner = 0; + } + if (selective) + { + /* a numeric argument is valid -- transparent object is created + (global mode is not set, nothing is registered) */ + while (ac--) if (av->a_type == A_SYMBOL) + { + /* FIXME register into fitter for per-patch-file, selective + compatibility control */ + av++; + } + } + else if (!fittermax_get()) + fittermax_set(); + x->x_filehandle = hammerfile_new((t_pd *)x, 0, maxmode_readhook, 0, 0); + outlet_new((t_object *)x, &s_float); + x->x_modeout = outlet_new((t_object *)x, &s_symbol); + return (x); +} + +void maxmode_setup(void) +{ + int dresult = LOADER_OK; + if (zgetfn(&pd_objectmaker, gensym("maxmode"))) + { + loud_error(0, "maxmode is already loaded"); + return; + } + maxmode_class = class_new(gensym("maxmode"), + (t_newmethod)maxmode_new, + (t_method)maxmode_free, + sizeof(t_maxmode), 0, A_GIMME, 0); + class_addbang(maxmode_class, maxmode_bang); + class_addmethod(maxmode_class, (t_method)maxmode_set, + gensym("set"), A_DEFSYM, 0); + class_addmethod(maxmode_class, (t_method)maxmode_get, + gensym("get"), 0); + class_addmethod(maxmode_class, (t_method)maxmode_cd, + gensym("cd"), A_DEFSYM, 0); + class_addmethod(maxmode_class, (t_method)maxmode_pwd, + gensym("pwd"), A_SYMBOL, 0); + class_addmethod(maxmode_class, (t_method)maxmode_import, + gensym("import"), A_DEFSYM, 0); + class_addmethod(maxmode_class, (t_method)maxmode_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + hammerfile_setup(maxmode_class, 0); + + if (canvas_getcurrent()) + { + fitter_setup(0, 0); + if (!zgetfn(&pd_objectmaker, gensym("cyclone"))) + /* cycloneless maxmode -- banner is posted by the oldest + maxmode object with no creation arguments */ + maxmode_withbanner = 1; + } + else + { + fittermax_set(); + if (zgetfn(&pd_objectmaker, gensym("cyclone"))) + loud_warning(0, "maxmode", "cyclone is already loaded"); + else + { + if (unstable_load_lib("", "cyclone") == LOADER_NOFILE) + loud_error(0, "cyclone library is missing"); + else if (!zgetfn(&pd_objectmaker, gensym("cyclone"))) + loud_error(0, "miXed/Pd version mismatch"); + } + } + maxmode_dummiesndx = fragile_class_count(); + if (zgetfn(&pd_objectmaker, gensym("dummies"))) + loud_warning(0, "maxmode", "dummies are already loaded"); + else + dresult = unstable_load_lib("", "dummies"); + maxmode_lastndx = fragile_class_count() - 1; + if (dresult == LOADER_NOFILE) + loud_warning(0, "maxmode", "dummies not found"); + else + { + t_symbol *s = gensym("_cc.dummies"); + if (s->s_thing && !s->s_next + && !strcmp(class_getname(*s->s_thing), "_cc.dummies")) + maxmode_dproxy = s->s_thing; + else + loudbug_bug("maxmode_setup"); /* FIXME */ + } +} diff --git a/externals/miXed/cyclone/shadow/nettles.c b/externals/miXed/cyclone/shadow/nettles.c new file mode 100644 index 000000000..d7ccb878b --- /dev/null +++ b/externals/miXed/cyclone/shadow/nettles.c @@ -0,0 +1,549 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" +#include "shadow.h" + +#if defined(NT) || defined(MACOSX) +/* cf pd/src/x_arithmetic.c */ +#define fmodf fmod +#endif + +/* Two remaining control binops have their inputs reversed. + LATER think about float-to-int conversion -- there is no point in making + the two below compatible, while all the others are not compatible... */ + +/* CHECKED left inlet causes output (refman's error -- a total rubbish) */ + +typedef struct _rbinop +{ + t_object x_ob; + t_float x_f1; /* left inlet value */ + t_float x_f2; +} t_rbinop; + +static t_class *rminus_class; + +static void rminus_bang(t_rbinop *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_f2 - x->x_f1); +} + +static void rminus_float(t_rbinop *x, t_float f) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_f2 - (x->x_f1 = f)); +} + +static void *rminus_new(t_floatarg f) +{ + t_rbinop *x = (t_rbinop *)pd_new(rminus_class); + floatinlet_new((t_object *)x, &x->x_f2); /* CHECKED */ + outlet_new((t_object *)x, &s_float); + x->x_f1 = 0; + x->x_f2 = f; /* CHECKED */ + return (x); +} + +static t_class *rdiv_class; + +static void rdiv_bang(t_rbinop *x) +{ + if (x->x_f1 != 0.) + outlet_float(((t_object *)x)->ob_outlet, x->x_f2 / x->x_f1); + else + /* CHECKED int mode: nonnegative/0 == 0, negative/0 == -1, + float mode: positive/0 == INT_MAX, nonpositive/0 == INT_MIN + LATER rethink -- why is it INT_MAX, not FLT_MAX? */ + outlet_float(((t_object *)x)->ob_outlet, + (x->x_f2 > 0 ? SHARED_INT_MAX : SHARED_INT_MIN)); +} + +static void rdiv_float(t_rbinop *x, t_float f) +{ + x->x_f1 = f; + rdiv_bang(x); +} + +static void *rdiv_new(t_floatarg f) +{ + t_rbinop *x = (t_rbinop *)pd_new(rdiv_class); + floatinlet_new((t_object *)x, &x->x_f2); + outlet_new((t_object *)x, &s_float); + x->x_f1 = 0; + x->x_f2 = f; /* CHECKED (refman's error) */ + return (x); +} + +/* The implementation of signal relational operators below has been tuned + somewhat, mostly in order to get rid of costly int->float conversions. + Loops are not hand-unrolled, because these have proven to be slower + in all the tests performed so far. LATER find a good soul willing to + make a serious profiling research... */ + +typedef struct _sigeq +{ + t_sic x_sic; + int x_algo; +} t_sigeq; + +static t_class *sigeq_class; + +static t_int *sigeq_perform0(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_shared_floatint fi; +#ifdef NETTLES_SAFE + int32 truebits; + fi.fi_f = 1.; + truebits = fi.fi_i; +#endif + while (nblock--) + { +#ifdef NETTLES_SAFE + fi.fi_i = ~((*in1++ == *in2++) - 1) & truebits; +#else + fi.fi_i = ~((*in1++ == *in2++) - 1) & SHARED_TRUEBITS; +#endif + *out++ = fi.fi_f; + } + return (w + 5); +} + +static t_int *sigeq_perform1(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) *out++ = (*in1++ == *in2++); + return (w + 5); +} + +static t_int *sigeq_perform2(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + for (; nblock; nblock -= 8, in1 += 8, in2 += 8, out += 8) + { + float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; + float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; + float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; + float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; + out[0] = f0 == g0; out[1] = f1 == g1; + out[2] = f2 == g2; out[3] = f3 == g3; + out[4] = f4 == g4; out[5] = f5 == g5; + out[6] = f6 == g6; out[7] = f7 == g7; + } + return (w + 5); +} + +static void sigeq_dsp(t_sigeq *x, t_signal **sp) +{ + switch (x->x_algo) + { + case 1: + dsp_add(sigeq_perform1, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); + break; + case 2: + dsp_add(sigeq_perform2, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); + break; + default: + dsp_add(sigeq_perform0, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); + } +} + +static void sigeq__algo(t_sigeq *x, t_floatarg f) +{ + x->x_algo = f; +} + +static void *sigeq_new(t_symbol *s, int ac, t_atom *av) +{ + t_sigeq *x = (t_sigeq *)pd_new(sigeq_class); + if (s == gensym("_==1~")) + x->x_algo = 1; + else if (s == gensym("_==2~")) + x->x_algo = 2; + else + x->x_algo = 0; + sic_inlet((t_sic *)x, 1, 0, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +typedef t_sic t_signeq; +static t_class *signeq_class; + +static t_int *signeq_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_shared_floatint fi; + while (nblock--) + { + fi.fi_i = ~((*in1++ != *in2++) - 1) & SHARED_TRUEBITS; + *out++ = fi.fi_f; + } + return (w + 5); +} + +static void signeq_dsp(t_signeq *x, t_signal **sp) +{ + dsp_add(signeq_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *signeq_new(t_symbol *s, int ac, t_atom *av) +{ + t_signeq *x = (t_signeq *)pd_new(signeq_class); + sic_inlet((t_sic *)x, 1, 0, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +typedef t_sic t_siglt; +static t_class *siglt_class; + +static t_int *siglt_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_shared_floatint fi; + while (nblock--) + { + fi.fi_i = ~((*in1++ < *in2++) - 1) & SHARED_TRUEBITS; + *out++ = fi.fi_f; + } + return (w + 5); +} + +static void siglt_dsp(t_siglt *x, t_signal **sp) +{ + dsp_add(siglt_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *siglt_new(t_symbol *s, int ac, t_atom *av) +{ + t_siglt *x = (t_siglt *)pd_new(siglt_class); + sic_inlet((t_sic *)x, 1, 0, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +typedef t_sic t_siggt; +static t_class *siggt_class; + +static t_int *siggt_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_shared_floatint fi; + while (nblock--) + { + fi.fi_i = ~((*in1++ > *in2++) - 1) & SHARED_TRUEBITS; + *out++ = fi.fi_f; + } + return (w + 5); +} + +static void siggt_dsp(t_siggt *x, t_signal **sp) +{ + dsp_add(siggt_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *siggt_new(t_symbol *s, int ac, t_atom *av) +{ + t_siggt *x = (t_siggt *)pd_new(siggt_class); + sic_inlet((t_sic *)x, 1, 0, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +typedef t_sic t_sigleq; +static t_class *sigleq_class; + +static t_int *sigleq_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_shared_floatint fi; + while (nblock--) + { + fi.fi_i = ~((*in1++ <= *in2++) - 1) & SHARED_TRUEBITS; + *out++ = fi.fi_f; + } + return (w + 5); +} + +static void sigleq_dsp(t_sigleq *x, t_signal **sp) +{ + dsp_add(sigleq_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *sigleq_new(t_symbol *s, int ac, t_atom *av) +{ + t_sigleq *x = (t_sigleq *)pd_new(sigleq_class); + sic_inlet((t_sic *)x, 1, 0, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +typedef t_sic t_siggeq; +static t_class *siggeq_class; + +static t_int *siggeq_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_shared_floatint fi; + while (nblock--) + { + fi.fi_i = ~((*in1++ >= *in2++) - 1) & SHARED_TRUEBITS; + *out++ = fi.fi_f; + } + return (w + 5); +} + +static void siggeq_dsp(t_siggeq *x, t_signal **sp) +{ + dsp_add(siggeq_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *siggeq_new(t_symbol *s, int ac, t_atom *av) +{ + t_siggeq *x = (t_siggeq *)pd_new(siggeq_class); + sic_inlet((t_sic *)x, 1, 0, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +typedef t_sic t_sigrminus; +static t_class *sigrminus_class; + +static t_int *sigrminus_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) *out++ = *in2++ - *in1++; + return (w + 5); +} + +static void sigrminus_dsp(t_sigrminus *x, t_signal **sp) +{ + dsp_add(sigrminus_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *sigrminus_new(t_symbol *s, int ac, t_atom *av) +{ + t_sigrminus *x = (t_sigrminus *)pd_new(sigrminus_class); + sic_inlet((t_sic *)x, 1, 0, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +typedef t_sic t_sigrover; +static t_class *sigrover_class; + +static t_int *sigrover_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) + { + t_float f1 = *in1++; + /* CHECKED incompatible: c74 outputs NaNs. + The line below is consistent with Pd's /~, LATER rethink. */ + /* LATER multiply by reciprocal if in1 has no signal feeders */ + *out++ = (f1 == 0. ? 0. : *in2++ / f1); + } + return (w + 5); +} + +static void sigrover_dsp(t_sigrover *x, t_signal **sp) +{ + dsp_add(sigrover_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *sigrover_new(t_symbol *s, int ac, t_atom *av) +{ + t_sigrover *x = (t_sigrover *)pd_new(sigrover_class); + /* CHECKED default 0 (refman's error), LATER rethink */ + sic_inlet((t_sic *)x, 1, 0, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +typedef t_sic t_sigmod; +static t_class *sigmod_class; + +static t_int *sigmod_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) + { + t_float f1 = *in1++; + t_float f2 = *in2++; + /* LATER think about using ieee-754 normalization tricks */ + *out++ = (f2 == 0. ? 0. /* CHECKED */ + : fmod(f1, f2)); + } + return (w + 5); +} + +static void sigmod_dsp(t_sigmod *x, t_signal **sp) +{ + dsp_add(sigmod_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *sigmod_new(t_symbol *s, int ac, t_atom *av) +{ + t_sigmod *x = (t_sigmod *)pd_new(sigmod_class); + /* CHECKED default 0 (refman's error), LATER rethink */ + sic_inlet((t_sic *)x, 1, 0, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +typedef struct _sigaccum +{ + t_sic x_sic; + t_float x_sum; +} t_sigaccum; + +static t_class *sigaccum_class; + +static t_int *sigaccum_perform(t_int *w) +{ + t_sigaccum *x = (t_sigaccum *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_float sum = x->x_sum; + while (nblock--) *out++ = (sum += *in++); + x->x_sum = sum; + return (w + 5); +} + +static void sigaccum_dsp(t_sigaccum *x, t_signal **sp) +{ + dsp_add(sigaccum_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void sigaccum_bang(t_sigaccum *x) +{ + x->x_sum = 0; +} + +static void sigaccum_set(t_sigaccum *x, t_floatarg f) +{ + x->x_sum = f; +} + +static void *sigaccum_new(t_floatarg f) +{ + t_sigaccum *x = (t_sigaccum *)pd_new(sigaccum_class); + x->x_sum = f; + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void allnettles_setup(void) +{ + rminus_class = class_new(gensym("!-"), + (t_newmethod)rminus_new, 0, + sizeof(t_rbinop), 0, A_DEFFLOAT, 0); + class_addbang(rminus_class, rminus_bang); + class_addfloat(rminus_class, rminus_float); + rdiv_class = class_new(gensym("!/"), + (t_newmethod)rdiv_new, 0, + sizeof(t_rbinop), 0, A_DEFFLOAT, 0); + class_addbang(rdiv_class, rdiv_bang); + class_addfloat(rdiv_class, rdiv_float); + + sigeq_class = class_new(gensym("==~"), + (t_newmethod)sigeq_new, 0, + sizeof(t_sigeq), 0, A_GIMME, 0); + class_addcreator((t_newmethod)sigeq_new, + gensym("_==1~"), A_GIMME, 0); + class_addcreator((t_newmethod)sigeq_new, + gensym("_==2~"), A_GIMME, 0); + sic_setup(sigeq_class, sigeq_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(sigeq_class, (t_method)sigeq__algo, + gensym("_algo"), A_FLOAT, 0); + + signeq_class = class_new(gensym("!=~"), + (t_newmethod)signeq_new, 0, + sizeof(t_signeq), 0, A_GIMME, 0); + sic_setup(signeq_class, signeq_dsp, SIC_FLOATTOSIGNAL); + siglt_class = class_new(gensym("<~"), + (t_newmethod)siglt_new, 0, + sizeof(t_siglt), 0, A_GIMME, 0); + sic_setup(siglt_class, siglt_dsp, SIC_FLOATTOSIGNAL); + siggt_class = class_new(gensym(">~"), + (t_newmethod)siggt_new, 0, + sizeof(t_siggt), 0, A_GIMME, 0); + sic_setup(siggt_class, siggt_dsp, SIC_FLOATTOSIGNAL); + sigleq_class = class_new(gensym("<=~"), + (t_newmethod)sigleq_new, 0, + sizeof(t_sigleq), 0, A_GIMME, 0); + sic_setup(sigleq_class, sigleq_dsp, SIC_FLOATTOSIGNAL); + siggeq_class = class_new(gensym(">=~"), + (t_newmethod)siggeq_new, 0, + sizeof(t_siggeq), 0, A_GIMME, 0); + sic_setup(siggeq_class, siggeq_dsp, SIC_FLOATTOSIGNAL); + sigrminus_class = class_new(gensym("!-~"), + (t_newmethod)sigrminus_new, 0, + sizeof(t_sigrminus), 0, A_GIMME, 0); + sic_setup(sigrminus_class, sigrminus_dsp, SIC_FLOATTOSIGNAL); + sigrover_class = class_new(gensym("!/~"), + (t_newmethod)sigrover_new, 0, + sizeof(t_sigrover), 0, A_GIMME, 0); + sic_setup(sigrover_class, sigrover_dsp, SIC_FLOATTOSIGNAL); + sigmod_class = class_new(gensym("%~"), + (t_newmethod)sigmod_new, 0, + sizeof(t_sigmod), 0, A_GIMME, 0); + sic_setup(sigmod_class, sigmod_dsp, SIC_FLOATTOSIGNAL); + sigaccum_class = class_new(gensym("+=~"), + (t_newmethod)sigaccum_new, 0, + sizeof(t_sigaccum), 0, A_DEFFLOAT, 0); + sic_setup(sigaccum_class, sigaccum_dsp, SIC_FLOATTOSIGNAL); + class_addbang(sigaccum_class, sigaccum_bang); + class_addmethod(sigaccum_class, (t_method)sigaccum_set, + gensym("set"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/shadow/shadow.h b/externals/miXed/cyclone/shadow/shadow.h new file mode 100644 index 000000000..878a95b7f --- /dev/null +++ b/externals/miXed/cyclone/shadow/shadow.h @@ -0,0 +1,10 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __SHADOW_H__ +#define __SHADOW_H__ + +void allnettles_setup(void); + +#endif diff --git a/externals/miXed/cyclone/sickle/Clip.c b/externals/miXed/cyclone/sickle/Clip.c new file mode 100644 index 000000000..d38ff4412 --- /dev/null +++ b/externals/miXed/cyclone/sickle/Clip.c @@ -0,0 +1,66 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Clip~ substitution is needed to handle signal input for lo and hi */ + +#include "m_pd.h" +#include "sickle/sic.h" + +#define CLIP_DEFLO 0. +#define CLIP_DEFHI 0. + +typedef t_sic t_clip; +static t_class *clip_class; + +static t_int *Clip_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *in3 = (t_float *)(w[4]); + t_float *out = (t_float *)(w[5]); + while (nblock--) + { + float f = *in1++; + float lo = *in2++; + float hi = *in3++; + if (f < lo) + *out++ = lo; + else if (f > hi) + *out++ = hi; + else + *out++ = f; + } + return (w + 6); +} + +static void clip_dsp(t_clip *x, t_signal **sp) +{ + dsp_add(Clip_perform, 5, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); +} + +static void *clip_new(t_symbol *s, int ac, t_atom *av) +{ + t_clip *x = (t_clip *)pd_new(clip_class); + sic_inlet((t_sic *)x, 1, CLIP_DEFLO, 0, ac, av); + sic_inlet((t_sic *)x, 2, CLIP_DEFHI, 1, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void Clip_tilde_setup(void) +{ + clip_class = class_new(gensym("Clip~"), + (t_newmethod)clip_new, 0, + sizeof(t_clip), 0, A_GIMME, 0); + class_addcreator((t_newmethod)clip_new, gensym("clip~"), A_GIMME, 0); + class_addcreator((t_newmethod)clip_new, gensym("cyclone/clip~"), A_GIMME, 0); + sic_setup(clip_class, clip_dsp, SIC_FLOATTOSIGNAL); +} + +void clip_tilde_setup(void) +{ + Clip_tilde_setup(); +} diff --git a/externals/miXed/cyclone/sickle/Line.c b/externals/miXed/cyclone/sickle/Line.c new file mode 100644 index 000000000..2ef31c053 --- /dev/null +++ b/externals/miXed/cyclone/sickle/Line.c @@ -0,0 +1,347 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +/* Added code for the stop, pause and resume messages, fjkraan, 20141202. */ + +#include "m_pd.h" +#include "shared.h" +#include "common/grow.h" +#include "common/loud.h" +#include "sickle/sic.h" + +#ifdef KRZYSZCZ +//#define LINE_DEBUG +#endif + +#define LINE_INISIZE 64 /* LATER rethink */ +#define LINE_MAXSIZE 64 + +typedef struct _lineseg +{ + float s_target; + float s_delta; +} t_lineseg; + +typedef struct _line +{ + t_sic x_sic; + float x_value; + float x_target; + float x_delta; + int x_deltaset; + float x_inc; + float x_biginc; + float x_ksr; + int x_nleft; + int x_retarget; + int x_size; /* as allocated */ + int x_nsegs; /* as used */ + int x_pause; + t_lineseg *x_curseg; + t_lineseg *x_segs; + t_lineseg x_segini[LINE_INISIZE]; + t_clock *x_clock; + t_outlet *x_bangout; +#ifdef LINE_DEBUG + int dbg_nretargets; + int dbg_exitpoint; + int dbg_npoints; +#endif +} t_line; + +static t_class *line_class; + +static void line_tick(t_line *x) +{ + outlet_bang(x->x_bangout); +#ifdef LINE_DEBUG + loudbug_post("exit point %d, after %d retarget calls", + x->dbg_exitpoint, x->dbg_nretargets); + loudbug_post("at value %g, after last %d npoints, with inc %g, biginc %g", + x->x_value, x->dbg_npoints, x->x_inc, x->x_biginc); + x->dbg_nretargets = x->dbg_exitpoint = x->dbg_npoints = 0; +#endif +} + +static t_int *line_perform(t_int *w) +{ + t_line *x = (t_line *)(w[1]); + t_float *out = (t_float *)(w[2]); + int nblock = (int)(w[3]); + int nxfer = x->x_nleft; + float curval = x->x_value; + float inc = x->x_inc; + float biginc = x->x_biginc; + + if (x->x_pause) + { + while (nblock--) *out++ = curval; + return (w + 4); + } + if (PD_BIGORSMALL(curval)) /* LATER rethink */ + curval = x->x_value = 0; +retarget: + if (x->x_retarget) + { + float target = x->x_curseg->s_target; + float delta = x->x_curseg->s_delta; + int npoints = delta * x->x_ksr + 0.5; /* LATER rethink */ +#ifdef LINE_DEBUG + x->dbg_nretargets++; +#endif + x->x_nsegs--; + x->x_curseg++; + while (npoints <= 0) + { + curval = x->x_value = target; + if (x->x_nsegs) + { + target = x->x_curseg->s_target; + delta = x->x_curseg->s_delta; + npoints = delta * x->x_ksr + 0.5; /* LATER rethink */ + x->x_nsegs--; + x->x_curseg++; + } + else + { + while (nblock--) *out++ = curval; + x->x_nleft = 0; +#ifdef LINE_DEBUG + x->dbg_exitpoint = 1; +#endif + clock_delay(x->x_clock, 0); + x->x_retarget = 0; + return (w + 4); + } + } + nxfer = x->x_nleft = npoints; + inc = x->x_inc = (target - x->x_value) / (float)npoints; + x->x_biginc = (int)(w[3]) * inc; + biginc = nblock * inc; + x->x_target = target; + x->x_retarget = 0; +#ifdef LINE_DEBUG + x->dbg_npoints = npoints; +#endif + } + if (nxfer >= nblock) + { + if ((x->x_nleft -= nblock) == 0) + { + if (x->x_nsegs) x->x_retarget = 1; + else + { +#ifdef LINE_DEBUG + x->dbg_exitpoint = 2; +#endif + clock_delay(x->x_clock, 0); + } + x->x_value = x->x_target; + } + else x->x_value += biginc; + while (nblock--) + *out++ = curval, curval += inc; + } + else if (nxfer > 0) + { + nblock -= nxfer; + do + *out++ = curval, curval += inc; + while (--nxfer); + curval = x->x_value = x->x_target; + if (x->x_nsegs) + { + x->x_retarget = 1; + goto retarget; + } + else + { + while (nblock--) *out++ = curval; + x->x_nleft = 0; +#ifdef LINE_DEBUG + x->dbg_exitpoint = 3; +#endif + clock_delay(x->x_clock, 0); + } + } + else while (nblock--) *out++ = curval; + return (w + 4); +} + +static void line_float(t_line *x, t_float f) +{ + if (x->x_deltaset) + { + x->x_deltaset = 0; + x->x_target = f; + x->x_nsegs = 1; + x->x_curseg = x->x_segs; + x->x_curseg->s_target = f; + x->x_curseg->s_delta = x->x_delta; + x->x_retarget = 1; + } + else + { + x->x_value = x->x_target = f; + x->x_nsegs = 0; + x->x_curseg = 0; + x->x_nleft = 0; + x->x_retarget = 0; + } + x->x_pause = 0; +} + +static void line_ft1(t_line *x, t_floatarg f) +{ + x->x_delta = f; + x->x_deltaset = (f > 0); +} + +static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av) +{ + int natoms, nsegs, odd; + t_atom *ap; + t_lineseg *segp; + for (natoms = 0, ap = av; natoms < ac; natoms++, ap++) + { + if (ap->a_type != A_FLOAT) + { + loud_messarg((t_pd *)x, &s_list); /* CHECKED */ + return; /* CHECKED */ + } + } + if (!natoms) + return; /* CHECKED */ + odd = natoms % 2; + nsegs = natoms / 2; + if (odd) nsegs++; + if (nsegs > x->x_size) + { + int ns = nsegs; + x->x_segs = grow_nodata(&ns, &x->x_size, x->x_segs, + LINE_INISIZE, x->x_segini, + sizeof(*x->x_segs)); + if (ns < nsegs) + { + natoms = ns * 2; + nsegs = ns; + odd = 0; + } + } + x->x_nsegs = nsegs; +#ifdef LINE_DEBUG + loudbug_post("%d segments:", x->x_nsegs); +#endif + segp = x->x_segs; + if (odd) nsegs--; + while (nsegs--) + { + segp->s_target = av++->a_w.w_float; + segp->s_delta = av++->a_w.w_float; +#ifdef LINE_DEBUG + loudbug_post("%g %g", segp->s_target, segp->s_delta); +#endif + segp++; + } + if (odd) + { + segp->s_target = av->a_w.w_float; + segp->s_delta = 0; +#ifdef LINE_DEBUG + loudbug_post("%g %g", segp->s_target, segp->s_delta); +#endif + } + x->x_deltaset = 0; + x->x_target = x->x_segs->s_target; + x->x_curseg = x->x_segs; + x->x_retarget = 1; + x->x_pause = 0; +} + +#if 0 +static void line_stop(t_line *x) +{ + x->x_target = x->x_value; + x->x_nleft = 0; + x->x_retarget = 0; + x->x_nsegs = 0; + x->x_curseg = 0; +} +#endif + +static void line_dsp(t_line *x, t_signal **sp) +{ + dsp_add(line_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); + x->x_ksr = sp[0]->s_sr * 0.001; +} + +static void line_free(t_line *x) +{ + if (x->x_segs != x->x_segini) + freebytes(x->x_segs, x->x_size * sizeof(*x->x_segs)); + if (x->x_clock) clock_free(x->x_clock); +} + +static void line_stop(t_line *x) +{ + x->x_nsegs = 0; + x->x_nleft = 0; +} + +static void line_pause(t_line *x) +{ + x->x_pause = 1; +} + +static void line_resume(t_line *x) +{ + x->x_pause = 0; +} + +static void *line_new(t_floatarg f) +{ + t_line *x = (t_line *)pd_new(line_class); + x->x_value = x->x_target = f; + x->x_deltaset = 0; + x->x_nleft = 0; + x->x_retarget = 0; + x->x_size = LINE_INISIZE; + x->x_nsegs = 0; + x->x_pause = 0; + x->x_segs = x->x_segini; + x->x_curseg = 0; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_signal); + x->x_bangout = outlet_new((t_object *)x, &s_bang); + x->x_clock = clock_new(x, (t_method)line_tick); + return (x); +} + +void Line_tilde_setup(void) +{ + line_class = class_new(gensym("Line~"), + (t_newmethod)line_new, + (t_method)line_free, + sizeof(t_line), 0, A_DEFFLOAT, 0); + class_addcreator((t_newmethod)line_new, gensym("line~"), A_DEFFLOAT, 0); + class_addcreator((t_newmethod)line_new, gensym("cyclone/line~"), A_DEFFLOAT, 0); + sic_setup(line_class, line_dsp, SIC_NOMAINSIGNALIN); + class_addfloat(line_class, line_float); + class_addlist(line_class, line_list); + class_addmethod(line_class, (t_method)line_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(line_class, (t_method)line_stop, + gensym("stop"), 0); + class_addmethod(line_class, (t_method)line_pause, + gensym("pause"), 0); + class_addmethod(line_class, (t_method)line_resume, + gensym("resume"), 0); +// logpost(NULL, 4, "this is cyclone/Line~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} + +void line_tilde_setup(void) +{ + Line_tilde_setup(); +} + diff --git a/externals/miXed/cyclone/sickle/Makefile b/externals/miXed/cyclone/sickle/Makefile new file mode 100644 index 000000000..61aa44404 --- /dev/null +++ b/externals/miXed/cyclone/sickle/Makefile @@ -0,0 +1,3 @@ +ROOT_DIR = ../.. +redefault: allsickles.c default +include $(ROOT_DIR)/Makefile.common diff --git a/externals/miXed/cyclone/sickle/Makefile.objects b/externals/miXed/cyclone/sickle/Makefile.objects new file mode 100644 index 000000000..e85d2c9fd --- /dev/null +++ b/externals/miXed/cyclone/sickle/Makefile.objects @@ -0,0 +1,16 @@ +SHARED_OBJECTS = \ +unstable/forky.o \ +unstable/fragile.o \ +unstable/fringe.o \ +common/loud.o \ +common/grow.o \ +common/os.o \ +common/fitter.o \ +common/vefl.o \ +common/clc.o \ +common/lex.o \ +common/binport.o \ +common/port.o \ +hammer/file.o \ +sickle/sic.o \ +sickle/arsic.o diff --git a/externals/miXed/cyclone/sickle/Makefile.sources b/externals/miXed/cyclone/sickle/Makefile.sources new file mode 100644 index 000000000..ce8b493f9 --- /dev/null +++ b/externals/miXed/cyclone/sickle/Makefile.sources @@ -0,0 +1,83 @@ +CX_SOURCES = \ +sickle.c + +OTHER_SOURCES = \ +allsickles.c \ +abs.c \ +acos.c \ +acosh.c \ +allpass.c \ +asin.c \ +asinh.c \ +atan.c \ +atan2.c \ +atanh.c \ +average.c \ +avg.c \ +bitand.c \ +bitnot.c \ +bitor.c \ +bitshift.c \ +bitxor.c \ +buffir.c \ +capture.c \ +cartopol.c \ +change.c \ +click.c \ +Clip.c \ +comb.c \ +cosh.c \ +cosx.c \ +count.c \ +curve.c \ +cycle.c \ +delay.c \ +delta.c \ +deltaclip.c \ +edge.c \ +frameaccum.c \ +framedelta.c \ +index.c \ +kink.c \ +Line.c \ +linedrive.c \ +log.c \ +lookup.c \ +lores.c \ +matrix.c \ +maximum.c \ +minimum.c \ +minmax.c \ +mstosamps.c \ +onepole.c \ +overdrive.c \ +peakamp.c \ +peek.c \ +phasewrap.c \ +pink.c \ +play.c \ +poke.c \ +poltocar.c \ +pong.c \ +pow.c \ +rand.c \ +rampsmooth.c \ +record.c \ +reson.c \ +sah.c \ +sampstoms.c \ +Scope.c \ +sinh.c \ +sinx.c \ +slide.c \ +Snapshot.c \ +spike.c \ +svf.c \ +tanh.c \ +tanx.c \ +train.c \ +trapezoid.c \ +triangle.c \ +vectral.c \ +wave.c \ +zerox.c diff --git a/externals/miXed/cyclone/sickle/Scope.c b/externals/miXed/cyclone/sickle/Scope.c new file mode 100644 index 000000000..ba86180ea --- /dev/null +++ b/externals/miXed/cyclone/sickle/Scope.c @@ -0,0 +1,1073 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER cache gui commands */ +/* LATER think about resizing scheme. Currently mouse events are not bound + to any part of Scope~'s 'widget' as such, but to a special item, which is + created only for a selected Scope~. For the other scheme see the 'comment' + class (no indicator there, though -- neither a handle, nor a pointer change). + One way or the other, the traffic from the gui layer should be kept possibly + low, at least in run-mode. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/fitter.h" +#include "unstable/forky.h" +#include "sickle/sic.h" + +#ifdef KRZYSZCZ +//#define SCOPE_DEBUG +#endif + +/* these are powers of 2 + margins */ +#define SCOPE_DEFWIDTH 130 /* CHECKED */ +#define SCOPE_MINWIDTH 66 +#define SCOPE_DEFHEIGHT 66 /* CHECKED */ +#define SCOPE_MINHEIGHT 34 +#define SCOPE_DEFPERIOD 256 +#define SCOPE_MINPERIOD 2 +#define SCOPE_MAXPERIOD 8092 +#define SCOPE_DEFBUFSIZE 128 +#define SCOPE_MINBUFSIZE 8 +#define SCOPE_MAXBUFSIZE 800 /* LATER rethink */ +#define SCOPE_WARNBUFSIZE 256 +#define SCOPE_DEFMINVAL -1. +#define SCOPE_DEFMAXVAL 1. +#define SCOPE_DEFDELAY 0 +#define SCOPE_MINDELAY 0 +#define SCOPE_TRIGLINEMODE 0 +#define SCOPE_TRIGUPMODE 1 +#define SCOPE_TRIGDOWNMODE 2 +#define SCOPE_DEFTRIGMODE SCOPE_TRIGLINEMODE +#define SCOPE_MINTRIGMODE SCOPE_TRIGLINEMODE +#define SCOPE_MAXTRIGMODE SCOPE_TRIGDOWNMODE +#define SCOPE_DEFTRIGLEVEL 0. +#define SCOPE_MINCOLOR 0 +#define SCOPE_MAXCOLOR 255 +#define SCOPE_DEFFGRED 102 +#define SCOPE_DEFFGGREEN 255 +#define SCOPE_DEFFGBLUE 51 +#define SCOPE_DEFBGRED 135 +#define SCOPE_DEFBGGREEN 135 +#define SCOPE_DEFBGBLUE 135 +#define SCOPE_SELCOLOR "#8080ff" /* a bit lighter shade of blue */ +#define SCOPE_FGWIDTH 0.7 /* line width is float */ +#define SCOPE_GRIDWIDTH 0.9 +#define SCOPE_SELBDWIDTH 1.0 +#define SCOPEHANDLE_WIDTH 10 /* item size is int */ +#define SCOPEHANDLE_HEIGHT 10 +/* these are performance-related hacks, LATER investigate */ +#define SCOPE_GUICHUNKMONO 16 +#define SCOPE_GUICHUNKXY 32 + +typedef struct _scope +{ + t_sic x_sic; + t_glist *x_glist; + t_canvas *x_canvas; /* also an 'isvised' flag */ + char x_tag[64]; + char x_fgtag[64]; + char x_bgtag[64]; + char x_gridtag[64]; + int x_width; + int x_height; + float x_minval; + float x_maxval; + int x_delay; + int x_trigmode; + float x_triglevel; + unsigned char x_fgred; + unsigned char x_fggreen; + unsigned char x_fgblue; + unsigned char x_bgred; + unsigned char x_bggreen; + unsigned char x_bgblue; + int x_xymode; + float *x_xbuffer; + float *x_ybuffer; + float x_xbufini[SCOPE_DEFBUFSIZE]; + float x_ybufini[SCOPE_DEFBUFSIZE]; + int x_allocsize; + int x_bufsize; + int x_bufphase; + int x_period; + int x_phase; + int x_precount; + int x_retrigger; + float x_ksr; + float x_currx; + float x_curry; + float x_trigx; + int x_frozen; + t_clock *x_clock; + t_pd *x_handle; + + int scale_offset_x; + int scale_offset_y; +} t_scope; + +typedef struct _scopehandle +{ + t_pd h_pd; + t_scope *h_master; + t_symbol *h_bindsym; + char h_pathname[64]; + char h_outlinetag[64]; + int h_dragon; + int h_dragx; + int h_dragy; +} t_scopehandle; + +static t_class *scope_class; +static t_class *scopehandle_class; + +static void scope_clear(t_scope *x, int withdelay) +{ + x->x_bufphase = 0; + x->x_phase = 0; + x->x_precount = (withdelay ? (int)(x->x_delay * x->x_ksr) : 0); + /* CHECKED delay does not matter (refman is wrong) */ + x->x_retrigger = (x->x_trigmode != SCOPE_TRIGLINEMODE); + x->x_trigx = x->x_triglevel; +} + +static t_int *scope_monoperform(t_int *w) +{ + t_scope *x = (t_scope *)(w[1]); + int bufphase = x->x_bufphase; + int bufsize = x->x_bufsize; + if (bufphase < bufsize) + { + int nblock = (int)(w[2]); + if (x->x_precount >= nblock) + x->x_precount -= nblock; + else + { + t_float *in = (t_float *)(w[3]); + int phase = x->x_phase; + int period = x->x_period; + float *bp1 = x->x_xbuffer + bufphase; + float *bp2 = x->x_ybuffer + bufphase; + float currx = x->x_currx; + if (x->x_precount > 0) + { + nblock -= x->x_precount; + in += x->x_precount; + x->x_precount = 0; + } + while (x->x_retrigger) + { + float triglevel = x->x_triglevel; + if (x->x_trigmode == SCOPE_TRIGUPMODE) + { + if (x->x_trigx < triglevel) + { + while (nblock--) if (*in++ >= triglevel) + { + x->x_retrigger = 0; + break; + } + } + else while (nblock--) if (*in++ < triglevel) + { + x->x_trigx = triglevel - 1.; + break; + } + } + else + { + if (x->x_trigx > triglevel) + { + while (nblock--) if (*in++ <= triglevel) + { + x->x_retrigger = 0; + break; + } + } + else while (nblock--) if (*in++ > triglevel) + { + x->x_trigx = triglevel + 1.; + break; + } + } + if (nblock <= 0) + return (w + 4); + } + while (nblock--) + { + if (phase) + { + float f = *in++; + /* CHECKED */ + if ((currx < 0 && (f < currx || f > -currx)) || + (currx > 0 && (f > currx || f < -currx))) + currx = f; + } + else currx = *in++; + if (currx != currx) + currx = 0.; /* CHECKED NaNs bashed to zeros */ + if (++phase == period) + { + phase = 0; + if (++bufphase == bufsize) + { + *bp1 = *bp2 = currx; + clock_delay(x->x_clock, 0); + break; + } + else *bp1++ = *bp2++ = currx; + } + } + x->x_currx = currx; + x->x_bufphase = bufphase; + x->x_phase = phase; + } + } + return (w + 4); +} + +static t_int *scope_xyperform(t_int *w) +{ + t_scope *x = (t_scope *)(w[1]); + int bufphase = x->x_bufphase; + int bufsize = x->x_bufsize; + if (bufphase < bufsize) + { + int nblock = (int)(w[2]); + if (x->x_precount >= nblock) + x->x_precount -= nblock; + else + { + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + int phase = x->x_phase; + int period = x->x_period; + float freq = 1. / period; + float *bp1 = x->x_xbuffer + bufphase; + float *bp2 = x->x_ybuffer + bufphase; + float currx = x->x_currx; + float curry = x->x_curry; + if (x->x_precount > 0) + { + nblock -= x->x_precount; + in1 += x->x_precount; + in2 += x->x_precount; + x->x_precount = 0; + } + if (x->x_retrigger) + { + /* CHECKME and FIXME */ + x->x_retrigger = 0; + } + while (nblock--) + { + if (phase) + { + /* CHECKME */ + currx += *in1++; + curry += *in2++; + } + else + { + currx = *in1++; + curry = *in2++; + } + if (currx != currx) + currx = 0.; /* CHECKME NaNs bashed to zeros */ + if (curry != curry) + curry = 0.; /* CHECKME NaNs bashed to zeros */ + if (++phase == period) + { + phase = 0; + if (++bufphase == bufsize) + { + *bp1 = currx * freq; + *bp2 = curry * freq; + clock_delay(x->x_clock, 0); + break; + } + else + { + *bp1++ = currx * freq; + *bp2++ = curry * freq; + } + } + } + x->x_currx = currx; + x->x_curry = curry; + x->x_bufphase = bufphase; + x->x_phase = phase; + } + } + return (w + 5); +} + +static void scope_setxymode(t_scope *x, int xymode); + +static void scope_dsp(t_scope *x, t_signal **sp) +{ + x->x_ksr = sp[0]->s_sr * 0.001; + scope_setxymode(x, + forky_hasfeeders((t_object *)x, x->x_glist, 1, &s_signal)); + if (x->x_xymode) + dsp_add(scope_xyperform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + else + dsp_add(scope_monoperform, 3, x, sp[0]->s_n, sp[0]->s_vec); +} + +static t_canvas *scope_getcanvas(t_scope *x, t_glist *glist) +{ + if (glist != x->x_glist) + { + loudbug_bug("scope_getcanvas"); + x->x_glist = glist; + } + return (x->x_canvas = glist_getcanvas(glist)); +} + +/* answers the question: ``can we draw and where to?'' */ +static t_canvas *scope_isvisible(t_scope *x) +{ + return (glist_isvisible(x->x_glist) ? x->x_canvas : 0); +} + +static void scope_period(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float period = (s ? x->x_period : SCOPE_DEFPERIOD); + int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 2), ac, av, &period, + SCOPE_MINPERIOD, SCOPE_MAXPERIOD, + /* LATER rethink warning rules */ + (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), 0, + "samples per element"); + if (!s && result == LOUD_ARGOVER) + fittermax_warning(*(t_pd *)x, + "more than %g samples per element requested", + SCOPE_MAXPERIOD); + if (!s || result == LOUD_ARGOK || result == LOUD_ARGOVER) + { + x->x_period = (int)period; + scope_clear(x, 0); + } +} + +static void scope_float(t_scope *x, t_float f) +{ + t_atom at; + SETFLOAT(&at, f); + scope_period(x, &s_float, 1, &at); +} + +static void scope_bufsize(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float bufsize = (s ? x->x_bufsize : SCOPE_DEFBUFSIZE); + int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize, + SCOPE_MINBUFSIZE, SCOPE_WARNBUFSIZE, + /* LATER rethink warning rules */ + (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), 0, + "display elements"); + if (result == LOUD_ARGOVER) + { + bufsize = (s ? x->x_bufsize : SCOPE_DEFBUFSIZE); + result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize, + 0, SCOPE_MAXBUFSIZE, 0, LOUD_CLIP | LOUD_WARN, + "display elements"); + if (!s && result == LOUD_ARGOK) + fittermax_warning(*(t_pd *)x, + "more than %g display elements requested", + SCOPE_WARNBUFSIZE); + } + if (!s) + { + x->x_allocsize = SCOPE_DEFBUFSIZE; + x->x_bufsize = 0; + x->x_xbuffer = x->x_xbufini; + x->x_ybuffer = x->x_ybufini; + } + if (!s || result == LOUD_ARGOK) + { + int newsize = (int)bufsize; + if (newsize > x->x_allocsize) + { + int nrequested = newsize; + int allocsize = x->x_allocsize; + int oldsize = x->x_bufsize; + x->x_xbuffer = grow_withdata(&nrequested, &oldsize, + &allocsize, x->x_xbuffer, + SCOPE_DEFBUFSIZE, x->x_xbufini, + sizeof(*x->x_xbuffer)); + if (nrequested == newsize) + { + allocsize = x->x_allocsize; + oldsize = x->x_bufsize; + x->x_ybuffer = grow_withdata(&nrequested, &oldsize, + &allocsize, x->x_ybuffer, + SCOPE_DEFBUFSIZE, x->x_ybufini, + sizeof(*x->x_ybuffer)); + } + if (nrequested == newsize) + { + x->x_allocsize = allocsize; + x->x_bufsize = newsize; + } + else + { + if (x->x_xbuffer != x->x_xbufini) + freebytes(x->x_xbuffer, + x->x_allocsize * sizeof(*x->x_xbuffer)); + if (x->x_ybuffer != x->x_ybufini) + freebytes(x->x_ybuffer, + x->x_allocsize * sizeof(*x->x_ybuffer)); + x->x_allocsize = SCOPE_DEFBUFSIZE; + x->x_bufsize = SCOPE_DEFBUFSIZE; + x->x_xbuffer = x->x_xbufini; + x->x_ybuffer = x->x_ybufini; + } + } + else x->x_bufsize = newsize; + scope_clear(x, 0); + } +} + +static void scope_range(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float minval = (s ? x->x_minval : SCOPE_DEFMINVAL); + t_float maxval = (s ? x->x_maxval : SCOPE_DEFMAXVAL); + loud_floatarg(*(t_pd *)x, (s ? 0 : 5), ac, av, &minval, 0, 0, 0, 0, 0); + loud_floatarg(*(t_pd *)x, (s ? 1 : 6), ac, av, &maxval, 0, 0, 0, 0, 0); + /* CHECKME swapping, ignoring if equal */ + if (minval < maxval) + { + x->x_minval = minval; + x->x_maxval = maxval; + } + else if (minval > maxval) + { + x->x_minval = maxval; + x->x_maxval = minval; + } + else if (!s) + { + x->x_minval = SCOPE_DEFMINVAL; + x->x_maxval = SCOPE_DEFMAXVAL; + } +} + +static void scope_delay(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float delay = (s ? x->x_delay : SCOPE_DEFDELAY); + int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 7), ac, av, &delay, + SCOPE_MINDELAY, 0, + LOUD_CLIP | LOUD_WARN, 0, "delay"); + if (!s || result == LOUD_ARGOK) + x->x_delay = delay; +} + +static void scope_trigger(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float trigmode = (s ? x->x_trigmode : SCOPE_DEFTRIGMODE); + loud_floatarg(*(t_pd *)x, (s ? 0 : 9), ac, av, &trigmode, + SCOPE_MINTRIGMODE, SCOPE_MAXTRIGMODE, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, + "trigger mode"); + x->x_trigmode = (int)trigmode; + if (x->x_trigmode == SCOPE_TRIGLINEMODE) + x->x_retrigger = 0; +} + +static void scope_triglevel(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float triglevel = (s ? x->x_triglevel : SCOPE_DEFTRIGLEVEL); + loud_floatarg(*(t_pd *)x, (s ? 0 : 10), ac, av, &triglevel, 0, 0, 0, 0, 0); + x->x_triglevel = triglevel; +} + +static void scope_frgb(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float fgred = (s ? x->x_fgred : SCOPE_DEFFGRED); + t_float fggreen = (s ? x->x_fggreen : SCOPE_DEFFGGREEN); + t_float fgblue = (s ? x->x_fgblue : SCOPE_DEFFGBLUE); + t_canvas *cv; + loud_floatarg(*(t_pd *)x, (s ? 0 : 11), ac, av, &fgred, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + loud_floatarg(*(t_pd *)x, (s ? 1 : 12), ac, av, &fggreen, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + loud_floatarg(*(t_pd *)x, (s ? 2 : 13), ac, av, &fgblue, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + x->x_fgred = (int)fgred; + x->x_fggreen = (int)fggreen; + x->x_fgblue = (int)fgblue; + if (cv = scope_isvisible(x)) + sys_vgui(".x%x.c itemconfigure %s -fill #%2.2x%2.2x%2.2x\n", + cv, x->x_fgtag, x->x_fgred, x->x_fggreen, x->x_fgblue); +} + +static void scope_brgb(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float bgred = (s ? x->x_bgred : SCOPE_DEFBGRED); + t_float bggreen = (s ? x->x_bggreen : SCOPE_DEFBGGREEN); + t_float bgblue = (s ? x->x_bgblue : SCOPE_DEFBGBLUE); + t_canvas *cv; + loud_floatarg(*(t_pd *)x, (s ? 0 : 14), ac, av, &bgred, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + loud_floatarg(*(t_pd *)x, (s ? 1 : 15), ac, av, &bggreen, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + loud_floatarg(*(t_pd *)x, (s ? 2 : 16), ac, av, &bgblue, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + x->x_bgred = (int)bgred; + x->x_bggreen = (int)bggreen; + x->x_bgblue = (int)bgblue; + if (cv = scope_isvisible(x)) + sys_vgui(".x%x.c itemconfigure %s -fill #%2.2x%2.2x%2.2x\n", + cv, x->x_bgtag, x->x_bgred, x->x_bggreen, x->x_bgblue); +} + +static void scope_getrect(t_gobj *z, t_glist *glist, + int *xp1, int *yp1, int *xp2, int *yp2) +{ + t_scope *x = (t_scope *)z; + float x1, y1, x2, y2; + x1 = text_xpix((t_text *)x, glist); + y1 = text_ypix((t_text *)x, glist); + x2 = x1 + x->x_width; + y2 = y1 + x->x_height; + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; +} + +static void scope_displace(t_gobj *z, t_glist *glist, int dx, int dy) +{ + t_scope *x = (t_scope *)z; + t_text *t = (t_text *)z; + t->te_xpix += dx; + t->te_ypix += dy; + if (glist_isvisible(glist)) + { + t_canvas *cv = scope_getcanvas(x, glist); + sys_vgui(".x%x.c move %s %d %d\n", cv, x->x_tag, dx, dy); + canvas_fixlinesfor(cv, t); + } +} + +static void scope_select(t_gobj *z, t_glist *glist, int state) +{ + t_scope *x = (t_scope *)z; + t_canvas *cv = scope_getcanvas(x, glist); + t_scopehandle *sh = (t_scopehandle *)x->x_handle; + if (state) + { + int x1, y1, x2, y2; + scope_getrect(z, glist, &x1, &y1, &x2, &y2); + + sys_vgui(".x%x.c itemconfigure %s -outline blue -width %f -fill %s\n", + cv, x->x_bgtag, SCOPE_SELBDWIDTH, SCOPE_SELCOLOR); + + sys_vgui("canvas %s -width %d -height %d -bg #fedc00 -bd 0 -cursor bottom_right_corner\n", + sh->h_pathname, SCOPEHANDLE_WIDTH, SCOPEHANDLE_HEIGHT); + sys_vgui(".x%x.c create window %f %f -anchor nw\ + -width %d -height %d -window %s -tags %s\n", + cv, x2 - (SCOPEHANDLE_WIDTH - SCOPE_SELBDWIDTH), + y2 - (SCOPEHANDLE_HEIGHT - SCOPE_SELBDWIDTH), + SCOPEHANDLE_WIDTH, SCOPEHANDLE_HEIGHT, + sh->h_pathname, x->x_tag); + sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n", + sh->h_pathname, sh->h_bindsym->s_name); + sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n", + sh->h_pathname, sh->h_bindsym->s_name); + sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n", + sh->h_pathname, sh->h_bindsym->s_name); + } + else + { + sys_vgui(".x%x.c itemconfigure %s -outline black -width %f\ + -fill #%2.2x%2.2x%2.2x\n", cv, x->x_bgtag, SCOPE_GRIDWIDTH, + x->x_bgred, x->x_bggreen, x->x_bgblue); + sys_vgui("destroy %s\n", sh->h_pathname); + } +} + +static void scope_delete(t_gobj *z, t_glist *glist) +{ + canvas_deletelinesfor(glist, (t_text *)z); +} + +static void scope_drawfgmono(t_scope *x, t_canvas *cv, + int x1, int y1, int x2, int y2) +{ + int i; + float dx, dy, xx, yy, sc; + float *bp; + dx = (float)(x2 - x1) / (float)x->x_bufsize; + sc = ((float)x->x_height - 2.) / (float)(x->x_maxval - x->x_minval); + sys_vgui(".x%x.c create line \\\n", cv); + for (i = 0, xx = x1, bp = x->x_xbuffer; + i < x->x_bufsize; i++, xx += dx, bp++) + { + yy = (y2 - 1) - sc * (*bp - x->x_minval); +#ifndef SCOPE_DEBUG + if (yy > y2) yy = y2; else if (yy < y1) yy = y1; +#endif + sys_vgui("%d %d \\\n", (int)xx, (int)yy); + } + sys_vgui("-fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n", + x->x_fgred, x->x_fggreen, x->x_fgblue, + SCOPE_FGWIDTH, x->x_fgtag, x->x_tag); + + /* margin lines: masking overflows, so that they appear as gaps, + rather than clipped signal values, LATER rethink */ + sys_vgui(".x%x.c create line %d %d %d %d\ + -fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n", + cv, x1, y1, x2, y1, x->x_bgred, x->x_bggreen, x->x_bgblue, + 1., x->x_fgtag, x->x_tag); + sys_vgui(".x%x.c create line %d %d %d %d\ + -fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n", + cv, x1, y2, x2, y2, x->x_bgred, x->x_bggreen, x->x_bgblue, + 1., x->x_fgtag, x->x_tag); +} + +static void scope_drawfgxy(t_scope *x, t_canvas *cv, + int x1, int y1, int x2, int y2) +{ + int nleft = x->x_bufsize; + float *xbp = x->x_xbuffer, *ybp = x->x_ybuffer; + char chunk[200 * SCOPE_GUICHUNKXY]; /* LATER estimate */ + char *chunkp = chunk; + char cmd1[64], cmd2[64]; + float xx, yy, xsc, ysc; + xx = yy = 0; + /* subtract 1-pixel margins, see below */ + xsc = ((float)x->x_width - 2.) / (float)(x->x_maxval - x->x_minval); + ysc = ((float)x->x_height - 2.) / (float)(x->x_maxval - x->x_minval); + sprintf(cmd1, ".x%x.c create line", (int)cv); + sprintf(cmd2, "-fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n ", + x->x_fgred, x->x_fggreen, x->x_fgblue, + SCOPE_FGWIDTH, x->x_fgtag, x->x_tag); + while (nleft > SCOPE_GUICHUNKXY) + { + int i = SCOPE_GUICHUNKXY; + while (i--) + { + float oldx = xx, oldy = yy, dx, dy; + xx = x1 + xsc * (*xbp++ - x->x_minval); + yy = y2 - ysc * (*ybp++ - x->x_minval); + /* using 1-pixel margins */ + dx = (xx > oldx ? 1. : -1.); + dy = (yy > oldy ? 1. : -1.); +#ifndef SCOPE_DEBUG + if (xx < x1 || xx > x2 || yy < y1 || yy > y2) + continue; +#endif + sprintf(chunkp, "%s %d %d %d %d %s", cmd1, + (int)(xx - dx), (int)(yy - dy), + (int)(xx + dx), (int)(yy + dy), cmd2); + chunkp += strlen(chunkp); + } + if (chunkp > chunk) + sys_gui(chunk); + chunkp = chunk; + nleft -= SCOPE_GUICHUNKXY; + } + while (nleft--) + { + float oldx = xx, oldy = yy, dx, dy; + xx = x1 + xsc * (*xbp++ - x->x_minval); + yy = y2 - ysc * (*ybp++ - x->x_minval); + /* using 1-pixel margins */ + dx = (xx > oldx ? 1. : -1.); + dy = (yy > oldy ? 1. : -1.); +#ifndef SCOPE_DEBUG + if (xx < x1 || xx > x2 || yy < y1 || yy > y2) + continue; +#endif + sprintf(chunkp, "%s %d %d %d %d %s", cmd1, + (int)(xx - dx), (int)(yy - dy), + (int)(xx + dx), (int)(yy + dy), cmd2); + chunkp += strlen(chunkp); + } + if (chunkp > chunk) + sys_gui(chunk); +} + +static void scope_drawbg(t_scope *x, t_canvas *cv, + int x1, int y1, int x2, int y2) +{ + int i; + float dx, dy, xx, yy; + dx = (x2 - x1) * 0.125; + dy = (y2 - y1) * 0.25; + sys_vgui(".x%x.c create rectangle %d %d %d %d\ + -fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n", + cv, x1, y1, x2, y2, + x->x_bgred, x->x_bggreen, x->x_bgblue, + SCOPE_GRIDWIDTH, x->x_bgtag, x->x_tag); + for (i = 0, xx = x1 + dx; i < 7; i++, xx += dx) + sys_vgui(".x%x.c create line %f %d %f %d\ + -width %f -tags {%s %s}\n", cv, xx, y1, xx, y2, + SCOPE_GRIDWIDTH, x->x_gridtag, x->x_tag); + for (i = 0, yy = y1 + dy; i < 3; i++, yy += dy) + sys_vgui(".x%x.c create line %d %f %d %f\ + -width %f -tags {%s %s}\n", cv, x1, yy, x2, yy, + SCOPE_GRIDWIDTH, x->x_gridtag, x->x_tag); +} + +static void scope_drawmono(t_scope *x, t_canvas *cv) +{ + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + scope_drawbg(x, cv, x1, y1, x2, y2); + scope_drawfgmono(x, cv, x1, y1, x2, y2); +} + +static void scope_redrawmono(t_scope *x, t_canvas *cv) +{ + int nleft = x->x_bufsize; + float *bp = x->x_xbuffer; + char chunk[32 * SCOPE_GUICHUNKMONO]; /* LATER estimate */ + char *chunkp = chunk; + int x1, y1, x2, y2; + float dx, dy, xx, yy, sc; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + dx = (float)(x2 - x1) / (float)x->x_bufsize; + sc = ((float)x->x_height - 2.) / (float)(x->x_maxval - x->x_minval); + xx = x1; + sys_vgui(".x%x.c coords %s \\\n", cv, x->x_fgtag); + while (nleft > SCOPE_GUICHUNKMONO) + { + int i = SCOPE_GUICHUNKMONO; + while (i--) + { + yy = (y2 - 1) - sc * (*bp++ - x->x_minval); +#ifndef SCOPE_DEBUG + if (yy > y2) yy = y2; else if (yy < y1) yy = y1; +#endif + sprintf(chunkp, "%d %d ", (int)xx, (int)yy); + chunkp += strlen(chunkp); + xx += dx; + } + strcpy(chunkp, "\\\n"); + sys_gui(chunk); + chunkp = chunk; + nleft -= SCOPE_GUICHUNKMONO; + } + while (nleft--) + { + yy = (y2 - 1) - sc * (*bp++ - x->x_minval); +#ifndef SCOPE_DEBUG + if (yy > y2) yy = y2; else if (yy < y1) yy = y1; +#endif + sprintf(chunkp, "%d %d ", (int)xx, (int)yy); + chunkp += strlen(chunkp); + xx += dx; + } + strcpy(chunkp, "\n"); + sys_gui(chunk); +} + +static void scope_drawxy(t_scope *x, t_canvas *cv) +{ + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + scope_drawbg(x, cv, x1, y1, x2, y2); + scope_drawfgxy(x, cv, x1, y1, x2, y2); +} + +static void scope_redrawxy(t_scope *x, t_canvas *cv) +{ + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + sys_vgui(".x%x.c delete %s\n", cv, x->x_fgtag); + scope_drawfgxy(x, cv, x1, y1, x2, y2); +} + +static void scope_revis(t_scope *x, t_canvas *cv) +{ + sys_vgui(".x%x.c delete %s\n", cv, x->x_tag); + if (x->x_xymode) + scope_drawxy(x, cv); + else + scope_drawmono(x, cv); +} + +static void scope_vis(t_gobj *z, t_glist *glist, int vis) +{ + t_scope *x = (t_scope *)z; + t_text *t = (t_text *)z; + t_canvas *cv = scope_getcanvas(x, glist); + if (vis) + { + t_scopehandle *sh = (t_scopehandle *)x->x_handle; +#if FORKY_VERSION < 37 + rtext_new(glist, t, glist->gl_editor->e_rtext, 0); +#endif + sprintf(sh->h_pathname, ".x%x.h%x", (int)cv, (int)sh); + if (x->x_xymode) + scope_drawxy(x, cv); + else + scope_drawmono(x, cv); + } + else + { +#if FORKY_VERSION < 37 + t_rtext *rt = glist_findrtext(glist, t); + if (rt) rtext_free(rt); +#endif + sys_vgui(".x%x.c delete %s\n", cv, x->x_tag); + x->x_canvas = 0; + } +} + +static int scope_click(t_gobj *z, t_glist *glist, + int xpix, int ypix, int shift, int alt, int dbl, + int doit) +{ + t_scope *x = (t_scope *)z; + x->x_frozen = doit; + return (CURSOR_RUNMODE_CLICKME); +} + +/* CHECKED there is only one copy of state variables, + the same, whether modified with messages, or in the inspector */ +static void scope_save(t_gobj *z, t_binbuf *b) +{ + t_scope *x = (t_scope *)z; + t_text *t = (t_text *)x; + binbuf_addv(b, "ssiisiiiiiffififiiiiiii;", gensym("#X"), gensym("obj"), + (int)t->te_xpix, (int)t->te_ypix, + atom_getsymbol(binbuf_getvec(t->te_binbuf)), + x->x_width, x->x_height, x->x_period, 3, x->x_bufsize, + x->x_minval, x->x_maxval, x->x_delay, 0., + x->x_trigmode, x->x_triglevel, + x->x_fgred, x->x_fggreen, x->x_fgblue, + x->x_bgred, x->x_bggreen, x->x_bgblue, 0); +} + +static t_widgetbehavior scope_widgetbehavior = +{ + scope_getrect, + scope_displace, + scope_select, + 0, + scope_delete, + scope_vis, + scope_click, + FORKY_WIDGETPADDING +}; + +static void scope_setxymode(t_scope *x, int xymode) +{ + if (xymode != x->x_xymode) + { + t_canvas *cv; + if (cv = scope_isvisible(x)) + { + sys_vgui(".x%x.c delete %s\n", cv, x->x_fgtag); + if (!xymode) + { + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + scope_drawfgmono(x, cv, x1, y1, x2, y2); + } + } + x->x_xymode = xymode; + scope_clear(x, 0); + } +} + +static void scope_tick(t_scope *x) +{ + t_canvas *cv; + if (!x->x_frozen && (cv = scope_isvisible(x))) + { + if (x->x_xymode) + scope_redrawxy(x, cv); + else + scope_redrawmono(x, cv); + } + scope_clear(x, 1); +} + +static void scopehandle__clickhook(t_scopehandle *sh, t_floatarg f, t_floatarg xxx, t_floatarg yyy) +{ + + t_scope *x = sh->h_master; + + if (xxx) x->scale_offset_x = xxx; + if (yyy) x->scale_offset_y = yyy; + + int newstate = (int)f; + if (sh->h_dragon && newstate == 0) + { + /* done dragging */ + t_canvas *cv; + if (sh->h_dragx || sh->h_dragy) { + x->x_width = x->x_width + sh->h_dragx - x->scale_offset_x; + x->x_height = x->x_height + sh->h_dragy - x->scale_offset_y; + } + if (cv = scope_isvisible(x)) + { + sys_vgui(".x%x.c delete %s\n", cv, sh->h_outlinetag); + scope_revis(x, cv); + sys_vgui("destroy %s\n", sh->h_pathname); + scope_select((t_gobj *)x, x->x_glist, 1); + canvas_fixlinesfor(x->x_glist, (t_text *)x); /* 2nd inlet */ + } + } + else if (!sh->h_dragon && newstate) + { + /* dragging */ + t_canvas *cv; + if (cv = scope_isvisible(x)) + { + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + sys_vgui("lower %s\n", sh->h_pathname); + sys_vgui(".x%x.c create rectangle %d %d %d %d\ + -outline $select_color -width %f -tags %s\n", + cv, x1, y1, x2, y2, SCOPE_SELBDWIDTH, sh->h_outlinetag); + } + sh->h_dragx = 0; + sh->h_dragy = 0; + } + sh->h_dragon = newstate; +} + +static void scopehandle__motionhook(t_scopehandle *sh, + t_floatarg f1, t_floatarg f2) +{ + if (sh->h_dragon) + { + t_scope *x = sh->h_master; + int dx = (int)f1, dy = (int)f2; + int x1, y1, x2, y2, newx, newy; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + newx = x2 - x->scale_offset_x + dx; + newy = y2 - x->scale_offset_y + dy; + + if (newx > x1 + SCOPE_MINWIDTH && newy > y1 + SCOPE_MINHEIGHT) + { + t_canvas *cv; + if (cv = scope_isvisible(x)) + sys_vgui(".x%x.c coords %s %d %d %d %d\n", + cv, sh->h_outlinetag, x1, y1, newx, newy); + sh->h_dragx = dx; + sh->h_dragy = dy; + } + } +} + +static void scope_free(t_scope *x) +{ + if (x->x_clock) clock_free(x->x_clock); + if (x->x_xbuffer != x->x_xbufini) + freebytes(x->x_xbuffer, x->x_allocsize * sizeof(*x->x_xbuffer)); + if (x->x_ybuffer != x->x_ybufini) + freebytes(x->x_ybuffer, x->x_allocsize * sizeof(*x->x_ybuffer)); + if (x->x_handle) + { + pd_unbind(x->x_handle, ((t_scopehandle *)x->x_handle)->h_bindsym); + pd_free(x->x_handle); + } +} + +static void *scope_new(t_symbol *s, int ac, t_atom *av) +{ + t_scope *x = (t_scope *)pd_new(scope_class); + t_scopehandle *sh; + t_float width = SCOPE_DEFWIDTH; + t_float height = SCOPE_DEFHEIGHT; + char buf[64]; + x->x_glist = canvas_getcurrent(); + x->x_canvas = 0; + loud_floatarg(*(t_pd *)x, 0, ac, av, &width, + SCOPE_MINWIDTH, 0, + LOUD_CLIP | LOUD_WARN, 0, "width"); + x->x_width = (int)width; + loud_floatarg(*(t_pd *)x, 1, ac, av, &height, + SCOPE_MINHEIGHT, 0, + LOUD_CLIP | LOUD_WARN, 0, "height"); + x->x_height = (int)height; + scope_period(x, 0, ac, av); + /* CHECKME 6th argument (default 3 for mono, 1 for xy */ + scope_bufsize(x, 0, ac, av); + scope_range(x, 0, ac, av); + scope_delay(x, 0, ac, av); + /* CHECKME 11th argument (default 0.) */ + scope_trigger(x, 0, ac, av); + scope_triglevel(x, 0, ac, av); + scope_frgb(x, 0, ac, av); + scope_brgb(x, 0, ac, av); + /* CHECKME last argument (default 0) */ + + sprintf(x->x_tag, "all%x", (int)x); + sprintf(x->x_bgtag, "bg%x", (int)x); + sprintf(x->x_gridtag, "gr%x", (int)x); + sprintf(x->x_fgtag, "fg%x", (int)x); + x->x_xymode = 0; + x->x_ksr = sys_getsr() * 0.001; /* redundant */ + x->x_frozen = 0; + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + x->x_clock = clock_new(x, (t_method)scope_tick); + scope_clear(x, 0); + + x->x_handle = pd_new(scopehandle_class); + sh = (t_scopehandle *)x->x_handle; + sh->h_master = x; + sprintf(buf, "_h%x", (int)sh); + pd_bind(x->x_handle, sh->h_bindsym = gensym(buf)); + sprintf(sh->h_outlinetag, "h%x", (int)sh); + sh->h_dragon = 0; + + x->scale_offset_x = 0; + x->scale_offset_y = 0; + + return (x); +} + +void Scope_tilde_setup(void) +{ + scope_class = class_new(gensym("Scope~"), + (t_newmethod)scope_new, + (t_method)scope_free, + sizeof(t_scope), 0, A_GIMME, 0); + class_addcreator((t_newmethod)scope_new, gensym("scope~"), A_GIMME, 0); + class_addcreator((t_newmethod)scope_new, gensym("cyclone/scope~"), A_GIMME, 0); + sic_setup(scope_class, scope_dsp, scope_float); + class_addmethod(scope_class, (t_method)scope_bufsize, + gensym("bufsize"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_range, + gensym("range"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_delay, + gensym("delay"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_trigger, + gensym("trigger"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_triglevel, + gensym("triglevel"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_frgb, + gensym("frgb"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_brgb, + gensym("brgb"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_setwidget(scope_class, &scope_widgetbehavior); + forky_setsavefn(scope_class, scope_save); + scopehandle_class = class_new(gensym("_scopehandle"), 0, 0, + sizeof(t_scopehandle), CLASS_PD, 0); + class_addmethod(scopehandle_class, (t_method)scopehandle__clickhook, + gensym("_click"), A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(scopehandle_class, (t_method)scopehandle__motionhook, + gensym("_motion"), A_FLOAT, A_FLOAT, 0); + fitter_setup(scope_class, 0); +} diff --git a/externals/miXed/cyclone/sickle/Scope.c.old b/externals/miXed/cyclone/sickle/Scope.c.old new file mode 100644 index 000000000..9436e3f70 --- /dev/null +++ b/externals/miXed/cyclone/sickle/Scope.c.old @@ -0,0 +1,1055 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER cache gui commands */ +/* LATER think about resizing scheme. Currently mouse events are not bound + to any part of Scope~'s 'widget' as such, but to a special item, which is + created only for a selected Scope~. For the other scheme see the 'comment' + class (no indicator there, though -- neither a handle, nor a pointer change). + One way or the other, the traffic from the gui layer should be kept possibly + low, at least in run-mode. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/fitter.h" +#include "unstable/forky.h" +#include "sickle/sic.h" + +#ifdef KRZYSZCZ +//#define SCOPE_DEBUG +#endif + +/* these are powers of 2 + margins */ +#define SCOPE_DEFWIDTH 130 /* CHECKED */ +#define SCOPE_MINWIDTH 66 +#define SCOPE_DEFHEIGHT 130 /* CHECKED */ +#define SCOPE_MINHEIGHT 34 +#define SCOPE_DEFPERIOD 256 +#define SCOPE_MINPERIOD 2 +#define SCOPE_MAXPERIOD 8092 +#define SCOPE_DEFBUFSIZE 128 +#define SCOPE_MINBUFSIZE 8 +#define SCOPE_MAXBUFSIZE 800 /* LATER rethink */ +#define SCOPE_WARNBUFSIZE 256 +#define SCOPE_DEFMINVAL -1. +#define SCOPE_DEFMAXVAL 1. +#define SCOPE_DEFDELAY 0 +#define SCOPE_MINDELAY 0 +#define SCOPE_TRIGLINEMODE 0 +#define SCOPE_TRIGUPMODE 1 +#define SCOPE_TRIGDOWNMODE 2 +#define SCOPE_DEFTRIGMODE SCOPE_TRIGLINEMODE +#define SCOPE_MINTRIGMODE SCOPE_TRIGLINEMODE +#define SCOPE_MAXTRIGMODE SCOPE_TRIGDOWNMODE +#define SCOPE_DEFTRIGLEVEL 0. +#define SCOPE_MINCOLOR 0 +#define SCOPE_MAXCOLOR 255 +#define SCOPE_DEFFGRED 102 +#define SCOPE_DEFFGGREEN 255 +#define SCOPE_DEFFGBLUE 51 +#define SCOPE_DEFBGRED 135 +#define SCOPE_DEFBGGREEN 135 +#define SCOPE_DEFBGBLUE 135 +#define SCOPE_SELCOLOR "#8080ff" /* a bit lighter shade of blue */ +#define SCOPE_FGWIDTH 0.7 /* line width is float */ +#define SCOPE_GRIDWIDTH 0.9 +#define SCOPE_SELBDWIDTH 3.0 +#define SCOPEHANDLE_WIDTH 10 /* item size is int */ +#define SCOPEHANDLE_HEIGHT 10 +/* these are performance-related hacks, LATER investigate */ +#define SCOPE_GUICHUNKMONO 16 +#define SCOPE_GUICHUNKXY 32 + +typedef struct _scope +{ + t_sic x_sic; + t_glist *x_glist; + t_canvas *x_canvas; /* also an 'isvised' flag */ + char x_tag[64]; + char x_fgtag[64]; + char x_bgtag[64]; + char x_gridtag[64]; + int x_width; + int x_height; + float x_minval; + float x_maxval; + int x_delay; + int x_trigmode; + float x_triglevel; + unsigned char x_fgred; + unsigned char x_fggreen; + unsigned char x_fgblue; + unsigned char x_bgred; + unsigned char x_bggreen; + unsigned char x_bgblue; + int x_xymode; + float *x_xbuffer; + float *x_ybuffer; + float x_xbufini[SCOPE_DEFBUFSIZE]; + float x_ybufini[SCOPE_DEFBUFSIZE]; + int x_allocsize; + int x_bufsize; + int x_bufphase; + int x_period; + int x_phase; + int x_precount; + int x_retrigger; + float x_ksr; + float x_currx; + float x_curry; + float x_trigx; + int x_frozen; + t_clock *x_clock; + t_pd *x_handle; +} t_scope; + +typedef struct _scopehandle +{ + t_pd h_pd; + t_scope *h_master; + t_symbol *h_bindsym; + char h_pathname[64]; + char h_outlinetag[64]; + int h_dragon; + int h_dragx; + int h_dragy; +} t_scopehandle; + +static t_class *scope_class; +static t_class *scopehandle_class; + +static void scope_clear(t_scope *x, int withdelay) +{ + x->x_bufphase = 0; + x->x_phase = 0; + x->x_precount = (withdelay ? (int)(x->x_delay * x->x_ksr) : 0); + /* CHECKED delay does not matter (refman is wrong) */ + x->x_retrigger = (x->x_trigmode != SCOPE_TRIGLINEMODE); + x->x_trigx = x->x_triglevel; +} + +static t_int *scope_monoperform(t_int *w) +{ + t_scope *x = (t_scope *)(w[1]); + int bufphase = x->x_bufphase; + int bufsize = x->x_bufsize; + if (bufphase < bufsize) + { + int nblock = (int)(w[2]); + if (x->x_precount >= nblock) + x->x_precount -= nblock; + else + { + t_float *in = (t_float *)(w[3]); + int phase = x->x_phase; + int period = x->x_period; + float *bp1 = x->x_xbuffer + bufphase; + float *bp2 = x->x_ybuffer + bufphase; + float currx = x->x_currx; + if (x->x_precount > 0) + { + nblock -= x->x_precount; + in += x->x_precount; + x->x_precount = 0; + } + while (x->x_retrigger) + { + float triglevel = x->x_triglevel; + if (x->x_trigmode == SCOPE_TRIGUPMODE) + { + if (x->x_trigx < triglevel) + { + while (nblock--) if (*in++ >= triglevel) + { + x->x_retrigger = 0; + break; + } + } + else while (nblock--) if (*in++ < triglevel) + { + x->x_trigx = triglevel - 1.; + break; + } + } + else + { + if (x->x_trigx > triglevel) + { + while (nblock--) if (*in++ <= triglevel) + { + x->x_retrigger = 0; + break; + } + } + else while (nblock--) if (*in++ > triglevel) + { + x->x_trigx = triglevel + 1.; + break; + } + } + if (nblock <= 0) + return (w + 4); + } + while (nblock--) + { + if (phase) + { + float f = *in++; + /* CHECKED */ + if ((currx < 0 && (f < currx || f > -currx)) || + (currx > 0 && (f > currx || f < -currx))) + currx = f; + } + else currx = *in++; + if (currx != currx) + currx = 0.; /* CHECKED NaNs bashed to zeros */ + if (++phase == period) + { + phase = 0; + if (++bufphase == bufsize) + { + *bp1 = *bp2 = currx; + clock_delay(x->x_clock, 0); + break; + } + else *bp1++ = *bp2++ = currx; + } + } + x->x_currx = currx; + x->x_bufphase = bufphase; + x->x_phase = phase; + } + } + return (w + 4); +} + +static t_int *scope_xyperform(t_int *w) +{ + t_scope *x = (t_scope *)(w[1]); + int bufphase = x->x_bufphase; + int bufsize = x->x_bufsize; + if (bufphase < bufsize) + { + int nblock = (int)(w[2]); + if (x->x_precount >= nblock) + x->x_precount -= nblock; + else + { + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + int phase = x->x_phase; + int period = x->x_period; + float freq = 1. / period; + float *bp1 = x->x_xbuffer + bufphase; + float *bp2 = x->x_ybuffer + bufphase; + float currx = x->x_currx; + float curry = x->x_curry; + if (x->x_precount > 0) + { + nblock -= x->x_precount; + in1 += x->x_precount; + in2 += x->x_precount; + x->x_precount = 0; + } + if (x->x_retrigger) + { + /* CHECKME and FIXME */ + x->x_retrigger = 0; + } + while (nblock--) + { + if (phase) + { + /* CHECKME */ + currx += *in1++; + curry += *in2++; + } + else + { + currx = *in1++; + curry = *in2++; + } + if (currx != currx) + currx = 0.; /* CHECKME NaNs bashed to zeros */ + if (curry != curry) + curry = 0.; /* CHECKME NaNs bashed to zeros */ + if (++phase == period) + { + phase = 0; + if (++bufphase == bufsize) + { + *bp1 = currx * freq; + *bp2 = curry * freq; + clock_delay(x->x_clock, 0); + break; + } + else + { + *bp1++ = currx * freq; + *bp2++ = curry * freq; + } + } + } + x->x_currx = currx; + x->x_curry = curry; + x->x_bufphase = bufphase; + x->x_phase = phase; + } + } + return (w + 5); +} + +static void scope_setxymode(t_scope *x, int xymode); + +static void scope_dsp(t_scope *x, t_signal **sp) +{ + x->x_ksr = sp[0]->s_sr * 0.001; + scope_setxymode(x, + forky_hasfeeders((t_object *)x, x->x_glist, 1, &s_signal)); + if (x->x_xymode) + dsp_add(scope_xyperform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + else + dsp_add(scope_monoperform, 3, x, sp[0]->s_n, sp[0]->s_vec); +} + +static t_canvas *scope_getcanvas(t_scope *x, t_glist *glist) +{ + if (glist != x->x_glist) + { + loudbug_bug("scope_getcanvas"); + x->x_glist = glist; + } + return (x->x_canvas = glist_getcanvas(glist)); +} + +/* answers the question: ``can we draw and where to?'' */ +static t_canvas *scope_isvisible(t_scope *x) +{ + return (glist_isvisible(x->x_glist) ? x->x_canvas : 0); +} + +static void scope_period(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float period = (s ? x->x_period : SCOPE_DEFPERIOD); + int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 2), ac, av, &period, + SCOPE_MINPERIOD, SCOPE_MAXPERIOD, + /* LATER rethink warning rules */ + (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), 0, + "samples per element"); + if (!s && result == LOUD_ARGOVER) + fittermax_warning(*(t_pd *)x, + "more than %g samples per element requested", + SCOPE_MAXPERIOD); + if (!s || result == LOUD_ARGOK || result == LOUD_ARGOVER) + { + x->x_period = (int)period; + scope_clear(x, 0); + } +} + +static void scope_float(t_scope *x, t_float f) +{ + t_atom at; + SETFLOAT(&at, f); + scope_period(x, &s_float, 1, &at); +} + +static void scope_bufsize(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float bufsize = (s ? x->x_bufsize : SCOPE_DEFBUFSIZE); + int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize, + SCOPE_MINBUFSIZE, SCOPE_WARNBUFSIZE, + /* LATER rethink warning rules */ + (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), 0, + "display elements"); + if (result == LOUD_ARGOVER) + { + bufsize = (s ? x->x_bufsize : SCOPE_DEFBUFSIZE); + result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize, + 0, SCOPE_MAXBUFSIZE, 0, LOUD_CLIP | LOUD_WARN, + "display elements"); + if (!s && result == LOUD_ARGOK) + fittermax_warning(*(t_pd *)x, + "more than %g display elements requested", + SCOPE_WARNBUFSIZE); + } + if (!s) + { + x->x_allocsize = SCOPE_DEFBUFSIZE; + x->x_bufsize = 0; + x->x_xbuffer = x->x_xbufini; + x->x_ybuffer = x->x_ybufini; + } + if (!s || result == LOUD_ARGOK) + { + int newsize = (int)bufsize; + if (newsize > x->x_allocsize) + { + int nrequested = newsize; + int allocsize = x->x_allocsize; + int oldsize = x->x_bufsize; + x->x_xbuffer = grow_withdata(&nrequested, &oldsize, + &allocsize, x->x_xbuffer, + SCOPE_DEFBUFSIZE, x->x_xbufini, + sizeof(*x->x_xbuffer)); + if (nrequested == newsize) + { + allocsize = x->x_allocsize; + oldsize = x->x_bufsize; + x->x_ybuffer = grow_withdata(&nrequested, &oldsize, + &allocsize, x->x_ybuffer, + SCOPE_DEFBUFSIZE, x->x_ybufini, + sizeof(*x->x_ybuffer)); + } + if (nrequested == newsize) + { + x->x_allocsize = allocsize; + x->x_bufsize = newsize; + } + else + { + if (x->x_xbuffer != x->x_xbufini) + freebytes(x->x_xbuffer, + x->x_allocsize * sizeof(*x->x_xbuffer)); + if (x->x_ybuffer != x->x_ybufini) + freebytes(x->x_ybuffer, + x->x_allocsize * sizeof(*x->x_ybuffer)); + x->x_allocsize = SCOPE_DEFBUFSIZE; + x->x_bufsize = SCOPE_DEFBUFSIZE; + x->x_xbuffer = x->x_xbufini; + x->x_ybuffer = x->x_ybufini; + } + } + else x->x_bufsize = newsize; + scope_clear(x, 0); + } +} + +static void scope_range(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float minval = (s ? x->x_minval : SCOPE_DEFMINVAL); + t_float maxval = (s ? x->x_maxval : SCOPE_DEFMAXVAL); + loud_floatarg(*(t_pd *)x, (s ? 0 : 5), ac, av, &minval, 0, 0, 0, 0, 0); + loud_floatarg(*(t_pd *)x, (s ? 1 : 6), ac, av, &maxval, 0, 0, 0, 0, 0); + /* CHECKME swapping, ignoring if equal */ + if (minval < maxval) + { + x->x_minval = minval; + x->x_maxval = maxval; + } + else if (minval > maxval) + { + x->x_minval = maxval; + x->x_maxval = minval; + } + else if (!s) + { + x->x_minval = SCOPE_DEFMINVAL; + x->x_maxval = SCOPE_DEFMAXVAL; + } +} + +static void scope_delay(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float delay = (s ? x->x_delay : SCOPE_DEFDELAY); + int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 7), ac, av, &delay, + SCOPE_MINDELAY, 0, + LOUD_CLIP | LOUD_WARN, 0, "delay"); + if (!s || result == LOUD_ARGOK) + x->x_delay = delay; +} + +static void scope_trigger(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float trigmode = (s ? x->x_trigmode : SCOPE_DEFTRIGMODE); + loud_floatarg(*(t_pd *)x, (s ? 0 : 9), ac, av, &trigmode, + SCOPE_MINTRIGMODE, SCOPE_MAXTRIGMODE, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, + "trigger mode"); + x->x_trigmode = (int)trigmode; + if (x->x_trigmode == SCOPE_TRIGLINEMODE) + x->x_retrigger = 0; +} + +static void scope_triglevel(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float triglevel = (s ? x->x_triglevel : SCOPE_DEFTRIGLEVEL); + loud_floatarg(*(t_pd *)x, (s ? 0 : 10), ac, av, &triglevel, 0, 0, 0, 0, 0); + x->x_triglevel = triglevel; +} + +static void scope_frgb(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float fgred = (s ? x->x_fgred : SCOPE_DEFFGRED); + t_float fggreen = (s ? x->x_fggreen : SCOPE_DEFFGGREEN); + t_float fgblue = (s ? x->x_fgblue : SCOPE_DEFFGBLUE); + t_canvas *cv; + loud_floatarg(*(t_pd *)x, (s ? 0 : 11), ac, av, &fgred, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + loud_floatarg(*(t_pd *)x, (s ? 1 : 12), ac, av, &fggreen, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + loud_floatarg(*(t_pd *)x, (s ? 2 : 13), ac, av, &fgblue, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + x->x_fgred = (int)fgred; + x->x_fggreen = (int)fggreen; + x->x_fgblue = (int)fgblue; + if (cv = scope_isvisible(x)) + sys_vgui(".x%x.c itemconfigure %s -fill #%2.2x%2.2x%2.2x\n", + cv, x->x_fgtag, x->x_fgred, x->x_fggreen, x->x_fgblue); +} + +static void scope_brgb(t_scope *x, t_symbol *s, int ac, t_atom *av) +{ + t_float bgred = (s ? x->x_bgred : SCOPE_DEFBGRED); + t_float bggreen = (s ? x->x_bggreen : SCOPE_DEFBGGREEN); + t_float bgblue = (s ? x->x_bgblue : SCOPE_DEFBGBLUE); + t_canvas *cv; + loud_floatarg(*(t_pd *)x, (s ? 0 : 14), ac, av, &bgred, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + loud_floatarg(*(t_pd *)x, (s ? 1 : 15), ac, av, &bggreen, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + loud_floatarg(*(t_pd *)x, (s ? 2 : 16), ac, av, &bgblue, + SCOPE_MINCOLOR, SCOPE_MAXCOLOR, + LOUD_CLIP | LOUD_WARN, LOUD_CLIP | LOUD_WARN, "color"); + x->x_bgred = (int)bgred; + x->x_bggreen = (int)bggreen; + x->x_bgblue = (int)bgblue; + if (cv = scope_isvisible(x)) + sys_vgui(".x%x.c itemconfigure %s -fill #%2.2x%2.2x%2.2x\n", + cv, x->x_bgtag, x->x_bgred, x->x_bggreen, x->x_bgblue); +} + +static void scope_getrect(t_gobj *z, t_glist *glist, + int *xp1, int *yp1, int *xp2, int *yp2) +{ + t_scope *x = (t_scope *)z; + float x1, y1, x2, y2; + x1 = text_xpix((t_text *)x, glist); + y1 = text_ypix((t_text *)x, glist); + x2 = x1 + x->x_width; + y2 = y1 + x->x_height; + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; +} + +static void scope_displace(t_gobj *z, t_glist *glist, int dx, int dy) +{ + t_scope *x = (t_scope *)z; + t_text *t = (t_text *)z; + t->te_xpix += dx; + t->te_ypix += dy; + if (glist_isvisible(glist)) + { + t_canvas *cv = scope_getcanvas(x, glist); + sys_vgui(".x%x.c move %s %d %d\n", cv, x->x_tag, dx, dy); + canvas_fixlinesfor(cv, t); + } +} + +static void scope_select(t_gobj *z, t_glist *glist, int state) +{ + t_scope *x = (t_scope *)z; + t_canvas *cv = scope_getcanvas(x, glist); + t_scopehandle *sh = (t_scopehandle *)x->x_handle; + if (state) + { + int x1, y1, x2, y2; + scope_getrect(z, glist, &x1, &y1, &x2, &y2); + + sys_vgui(".x%x.c itemconfigure %s -outline blue -width %f -fill %s\n", + cv, x->x_bgtag, SCOPE_SELBDWIDTH, SCOPE_SELCOLOR); + + sys_vgui("canvas %s -width %d -height %d -bg #fedc00 -bd 0\n", + sh->h_pathname, SCOPEHANDLE_WIDTH, SCOPEHANDLE_HEIGHT); + sys_vgui(".x%x.c create window %f %f -anchor nw\ + -width %d -height %d -window %s -tags %s\n", + cv, x2 - (SCOPEHANDLE_WIDTH - SCOPE_SELBDWIDTH), + y2 - (SCOPEHANDLE_HEIGHT - SCOPE_SELBDWIDTH), + SCOPEHANDLE_WIDTH, SCOPEHANDLE_HEIGHT, + sh->h_pathname, x->x_tag); + sys_vgui("bind %s <Button> {pd [concat %s _click 1 \\;]}\n", + sh->h_pathname, sh->h_bindsym->s_name); + sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 \\;]}\n", + sh->h_pathname, sh->h_bindsym->s_name); + sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n", + sh->h_pathname, sh->h_bindsym->s_name); + } + else + { + sys_vgui(".x%x.c itemconfigure %s -outline black -width %f\ + -fill #%2.2x%2.2x%2.2x\n", cv, x->x_bgtag, SCOPE_GRIDWIDTH, + x->x_bgred, x->x_bggreen, x->x_bgblue); + sys_vgui("destroy %s\n", sh->h_pathname); + } +} + +static void scope_delete(t_gobj *z, t_glist *glist) +{ + canvas_deletelinesfor(glist, (t_text *)z); +} + +static void scope_drawfgmono(t_scope *x, t_canvas *cv, + int x1, int y1, int x2, int y2) +{ + int i; + float dx, dy, xx, yy, sc; + float *bp; + dx = (float)(x2 - x1) / (float)x->x_bufsize; + sc = ((float)x->x_height - 2.) / (float)(x->x_maxval - x->x_minval); + sys_vgui(".x%x.c create line \\\n", cv); + for (i = 0, xx = x1, bp = x->x_xbuffer; + i < x->x_bufsize; i++, xx += dx, bp++) + { + yy = (y2 - 1) - sc * (*bp - x->x_minval); +#ifndef SCOPE_DEBUG + if (yy > y2) yy = y2; else if (yy < y1) yy = y1; +#endif + sys_vgui("%d %d \\\n", (int)xx, (int)yy); + } + sys_vgui("-fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n", + x->x_fgred, x->x_fggreen, x->x_fgblue, + SCOPE_FGWIDTH, x->x_fgtag, x->x_tag); + + /* margin lines: masking overflows, so that they appear as gaps, + rather than clipped signal values, LATER rethink */ + sys_vgui(".x%x.c create line %d %d %d %d\ + -fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n", + cv, x1, y1, x2, y1, x->x_bgred, x->x_bggreen, x->x_bgblue, + 1., x->x_fgtag, x->x_tag); + sys_vgui(".x%x.c create line %d %d %d %d\ + -fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n", + cv, x1, y2, x2, y2, x->x_bgred, x->x_bggreen, x->x_bgblue, + 1., x->x_fgtag, x->x_tag); +} + +static void scope_drawfgxy(t_scope *x, t_canvas *cv, + int x1, int y1, int x2, int y2) +{ + int nleft = x->x_bufsize; + float *xbp = x->x_xbuffer, *ybp = x->x_ybuffer; + char chunk[200 * SCOPE_GUICHUNKXY]; /* LATER estimate */ + char *chunkp = chunk; + char cmd1[64], cmd2[64]; + float xx, yy, xsc, ysc; + xx = yy = 0; + /* subtract 1-pixel margins, see below */ + xsc = ((float)x->x_width - 2.) / (float)(x->x_maxval - x->x_minval); + ysc = ((float)x->x_height - 2.) / (float)(x->x_maxval - x->x_minval); + sprintf(cmd1, ".x%x.c create line", (int)cv); + sprintf(cmd2, "-fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n ", + x->x_fgred, x->x_fggreen, x->x_fgblue, + SCOPE_FGWIDTH, x->x_fgtag, x->x_tag); + while (nleft > SCOPE_GUICHUNKXY) + { + int i = SCOPE_GUICHUNKXY; + while (i--) + { + float oldx = xx, oldy = yy, dx, dy; + xx = x1 + xsc * (*xbp++ - x->x_minval); + yy = y2 - ysc * (*ybp++ - x->x_minval); + /* using 1-pixel margins */ + dx = (xx > oldx ? 1. : -1.); + dy = (yy > oldy ? 1. : -1.); +#ifndef SCOPE_DEBUG + if (xx < x1 || xx > x2 || yy < y1 || yy > y2) + continue; +#endif + sprintf(chunkp, "%s %d %d %d %d %s", cmd1, + (int)(xx - dx), (int)(yy - dy), + (int)(xx + dx), (int)(yy + dy), cmd2); + chunkp += strlen(chunkp); + } + if (chunkp > chunk) + sys_gui(chunk); + chunkp = chunk; + nleft -= SCOPE_GUICHUNKXY; + } + while (nleft--) + { + float oldx = xx, oldy = yy, dx, dy; + xx = x1 + xsc * (*xbp++ - x->x_minval); + yy = y2 - ysc * (*ybp++ - x->x_minval); + /* using 1-pixel margins */ + dx = (xx > oldx ? 1. : -1.); + dy = (yy > oldy ? 1. : -1.); +#ifndef SCOPE_DEBUG + if (xx < x1 || xx > x2 || yy < y1 || yy > y2) + continue; +#endif + sprintf(chunkp, "%s %d %d %d %d %s", cmd1, + (int)(xx - dx), (int)(yy - dy), + (int)(xx + dx), (int)(yy + dy), cmd2); + chunkp += strlen(chunkp); + } + if (chunkp > chunk) + sys_gui(chunk); +} + +static void scope_drawbg(t_scope *x, t_canvas *cv, + int x1, int y1, int x2, int y2) +{ + int i; + float dx, dy, xx, yy; + dx = (x2 - x1) * 0.125; + dy = (y2 - y1) * 0.25; + sys_vgui(".x%x.c create rectangle %d %d %d %d\ + -fill #%2.2x%2.2x%2.2x -width %f -tags {%s %s}\n", + cv, x1, y1, x2, y2, + x->x_bgred, x->x_bggreen, x->x_bgblue, + SCOPE_GRIDWIDTH, x->x_bgtag, x->x_tag); + for (i = 0, xx = x1 + dx; i < 7; i++, xx += dx) + sys_vgui(".x%x.c create line %f %d %f %d\ + -width %f -tags {%s %s}\n", cv, xx, y1, xx, y2, + SCOPE_GRIDWIDTH, x->x_gridtag, x->x_tag); + for (i = 0, yy = y1 + dy; i < 3; i++, yy += dy) + sys_vgui(".x%x.c create line %d %f %d %f\ + -width %f -tags {%s %s}\n", cv, x1, yy, x2, yy, + SCOPE_GRIDWIDTH, x->x_gridtag, x->x_tag); +} + +static void scope_drawmono(t_scope *x, t_canvas *cv) +{ + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + scope_drawbg(x, cv, x1, y1, x2, y2); + scope_drawfgmono(x, cv, x1, y1, x2, y2); +} + +static void scope_redrawmono(t_scope *x, t_canvas *cv) +{ + int nleft = x->x_bufsize; + float *bp = x->x_xbuffer; + char chunk[32 * SCOPE_GUICHUNKMONO]; /* LATER estimate */ + char *chunkp = chunk; + int x1, y1, x2, y2; + float dx, dy, xx, yy, sc; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + dx = (float)(x2 - x1) / (float)x->x_bufsize; + sc = ((float)x->x_height - 2.) / (float)(x->x_maxval - x->x_minval); + xx = x1; + sys_vgui(".x%x.c coords %s \\\n", cv, x->x_fgtag); + while (nleft > SCOPE_GUICHUNKMONO) + { + int i = SCOPE_GUICHUNKMONO; + while (i--) + { + yy = (y2 - 1) - sc * (*bp++ - x->x_minval); +#ifndef SCOPE_DEBUG + if (yy > y2) yy = y2; else if (yy < y1) yy = y1; +#endif + sprintf(chunkp, "%d %d ", (int)xx, (int)yy); + chunkp += strlen(chunkp); + xx += dx; + } + strcpy(chunkp, "\\\n"); + sys_gui(chunk); + chunkp = chunk; + nleft -= SCOPE_GUICHUNKMONO; + } + while (nleft--) + { + yy = (y2 - 1) - sc * (*bp++ - x->x_minval); +#ifndef SCOPE_DEBUG + if (yy > y2) yy = y2; else if (yy < y1) yy = y1; +#endif + sprintf(chunkp, "%d %d ", (int)xx, (int)yy); + chunkp += strlen(chunkp); + xx += dx; + } + strcpy(chunkp, "\n"); + sys_gui(chunk); +} + +static void scope_drawxy(t_scope *x, t_canvas *cv) +{ + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + scope_drawbg(x, cv, x1, y1, x2, y2); + scope_drawfgxy(x, cv, x1, y1, x2, y2); +} + +static void scope_redrawxy(t_scope *x, t_canvas *cv) +{ + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + sys_vgui(".x%x.c delete %s\n", cv, x->x_fgtag); + scope_drawfgxy(x, cv, x1, y1, x2, y2); +} + +static void scope_revis(t_scope *x, t_canvas *cv) +{ + sys_vgui(".x%x.c delete %s\n", cv, x->x_tag); + if (x->x_xymode) + scope_drawxy(x, cv); + else + scope_drawmono(x, cv); +} + +static void scope_vis(t_gobj *z, t_glist *glist, int vis) +{ + t_scope *x = (t_scope *)z; + t_text *t = (t_text *)z; + t_canvas *cv = scope_getcanvas(x, glist); + if (vis) + { + t_scopehandle *sh = (t_scopehandle *)x->x_handle; +#if FORKY_VERSION < 37 + rtext_new(glist, t, glist->gl_editor->e_rtext, 0); +#endif + sprintf(sh->h_pathname, ".x%x.h%x", (int)cv, (int)sh); + if (x->x_xymode) + scope_drawxy(x, cv); + else + scope_drawmono(x, cv); + } + else + { +#if FORKY_VERSION < 37 + t_rtext *rt = glist_findrtext(glist, t); + if (rt) rtext_free(rt); +#endif + sys_vgui(".x%x.c delete %s\n", cv, x->x_tag); + x->x_canvas = 0; + } +} + +static int scope_click(t_gobj *z, t_glist *glist, + int xpix, int ypix, int shift, int alt, int dbl, + int doit) +{ + t_scope *x = (t_scope *)z; + x->x_frozen = doit; + return (CURSOR_RUNMODE_CLICKME); +} + +/* CHECKED there is only one copy of state variables, + the same, whether modified with messages, or in the inspector */ +static void scope_save(t_gobj *z, t_binbuf *b) +{ + t_scope *x = (t_scope *)z; + t_text *t = (t_text *)x; + binbuf_addv(b, "ssiisiiiiiffififiiiiiii;", gensym("#X"), gensym("obj"), + (int)t->te_xpix, (int)t->te_ypix, + atom_getsymbol(binbuf_getvec(t->te_binbuf)), + x->x_width, x->x_height, x->x_period, 3, x->x_bufsize, + x->x_minval, x->x_maxval, x->x_delay, 0., + x->x_trigmode, x->x_triglevel, + x->x_fgred, x->x_fggreen, x->x_fgblue, + x->x_bgred, x->x_bggreen, x->x_bgblue, 0); +} + +static t_widgetbehavior scope_widgetbehavior = +{ + scope_getrect, + scope_displace, + scope_select, + 0, + scope_delete, + scope_vis, + scope_click, + FORKY_WIDGETPADDING +}; + +static void scope_setxymode(t_scope *x, int xymode) +{ + if (xymode != x->x_xymode) + { + t_canvas *cv; + if (cv = scope_isvisible(x)) + { + sys_vgui(".x%x.c delete %s\n", cv, x->x_fgtag); + if (!xymode) + { + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + scope_drawfgmono(x, cv, x1, y1, x2, y2); + } + } + x->x_xymode = xymode; + scope_clear(x, 0); + } +} + +static void scope_tick(t_scope *x) +{ + t_canvas *cv; + if (!x->x_frozen && (cv = scope_isvisible(x))) + { + if (x->x_xymode) + scope_redrawxy(x, cv); + else + scope_redrawmono(x, cv); + } + scope_clear(x, 1); +} + +static void scopehandle__clickhook(t_scopehandle *sh, t_floatarg f) +{ + int newstate = (int)f; + if (sh->h_dragon && newstate == 0) + { + t_scope *x = sh->h_master; + t_canvas *cv; + x->x_width += sh->h_dragx; + x->x_height += sh->h_dragy; + if (cv = scope_isvisible(x)) + { + sys_vgui(".x%x.c delete %s\n", cv, sh->h_outlinetag); + scope_revis(x, cv); + sys_vgui("destroy %s\n", sh->h_pathname); + scope_select((t_gobj *)x, x->x_glist, 1); + canvas_fixlinesfor(x->x_glist, (t_text *)x); /* 2nd inlet */ + } + } + else if (!sh->h_dragon && newstate) + { + t_scope *x = sh->h_master; + t_canvas *cv; + if (cv = scope_isvisible(x)) + { + int x1, y1, x2, y2; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + sys_vgui("lower %s\n", sh->h_pathname); + sys_vgui(".x%x.c create rectangle %d %d %d %d\ + -outline blue -width %f -tags %s\n", + cv, x1, y1, x2, y2, SCOPE_SELBDWIDTH, sh->h_outlinetag); + } + sh->h_dragx = 0; + sh->h_dragy = 0; + } + sh->h_dragon = newstate; +} + +static void scopehandle__motionhook(t_scopehandle *sh, + t_floatarg f1, t_floatarg f2) +{ + if (sh->h_dragon) + { + t_scope *x = sh->h_master; + int dx = (int)f1, dy = (int)f2; + int x1, y1, x2, y2, newx, newy; + scope_getrect((t_gobj *)x, x->x_glist, &x1, &y1, &x2, &y2); + newx = x2 + dx; + newy = y2 + dy; + if (newx > x1 + SCOPE_MINWIDTH && newy > y1 + SCOPE_MINHEIGHT) + { + t_canvas *cv; + if (cv = scope_isvisible(x)) + sys_vgui(".x%x.c coords %s %d %d %d %d\n", + cv, sh->h_outlinetag, x1, y1, newx, newy); + sh->h_dragx = dx; + sh->h_dragy = dy; + } + } +} + +static void scope_free(t_scope *x) +{ + if (x->x_clock) clock_free(x->x_clock); + if (x->x_xbuffer != x->x_xbufini) + freebytes(x->x_xbuffer, x->x_allocsize * sizeof(*x->x_xbuffer)); + if (x->x_ybuffer != x->x_ybufini) + freebytes(x->x_ybuffer, x->x_allocsize * sizeof(*x->x_ybuffer)); + if (x->x_handle) + { + pd_unbind(x->x_handle, ((t_scopehandle *)x->x_handle)->h_bindsym); + pd_free(x->x_handle); + } +} + +static void *scope_new(t_symbol *s, int ac, t_atom *av) +{ + t_scope *x = (t_scope *)pd_new(scope_class); + t_scopehandle *sh; + t_float width = SCOPE_DEFWIDTH; + t_float height = SCOPE_DEFHEIGHT; + char buf[64]; + x->x_glist = canvas_getcurrent(); + x->x_canvas = 0; + loud_floatarg(*(t_pd *)x, 0, ac, av, &width, + SCOPE_MINWIDTH, 0, + LOUD_CLIP | LOUD_WARN, 0, "width"); + x->x_width = (int)width; + loud_floatarg(*(t_pd *)x, 1, ac, av, &height, + SCOPE_MINHEIGHT, 0, + LOUD_CLIP | LOUD_WARN, 0, "height"); + x->x_height = (int)height; + scope_period(x, 0, ac, av); + /* CHECKME 6th argument (default 3 for mono, 1 for xy */ + scope_bufsize(x, 0, ac, av); + scope_range(x, 0, ac, av); + scope_delay(x, 0, ac, av); + /* CHECKME 11th argument (default 0.) */ + scope_trigger(x, 0, ac, av); + scope_triglevel(x, 0, ac, av); + scope_frgb(x, 0, ac, av); + scope_brgb(x, 0, ac, av); + /* CHECKME last argument (default 0) */ + + sprintf(x->x_tag, "all%x", (int)x); + sprintf(x->x_bgtag, "bg%x", (int)x); + sprintf(x->x_gridtag, "gr%x", (int)x); + sprintf(x->x_fgtag, "fg%x", (int)x); + x->x_xymode = 0; + x->x_ksr = sys_getsr() * 0.001; /* redundant */ + x->x_frozen = 0; + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + x->x_clock = clock_new(x, (t_method)scope_tick); + scope_clear(x, 0); + + x->x_handle = pd_new(scopehandle_class); + sh = (t_scopehandle *)x->x_handle; + sh->h_master = x; + sprintf(buf, "_h%x", (int)sh); + pd_bind(x->x_handle, sh->h_bindsym = gensym(buf)); + sprintf(sh->h_outlinetag, "h%x", (int)sh); + sh->h_dragon = 0; + return (x); +} + +void Scope_tilde_setup(void) +{ + scope_class = class_new(gensym("Scope~"), + (t_newmethod)scope_new, + (t_method)scope_free, + sizeof(t_scope), 0, A_GIMME, 0); + sic_setup(scope_class, scope_dsp, scope_float); + class_addmethod(scope_class, (t_method)scope_bufsize, + gensym("bufsize"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_range, + gensym("range"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_delay, + gensym("delay"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_trigger, + gensym("trigger"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_triglevel, + gensym("triglevel"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_frgb, + gensym("frgb"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_brgb, + gensym("brgb"), A_GIMME, 0); + class_addmethod(scope_class, (t_method)scope_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_setwidget(scope_class, &scope_widgetbehavior); + forky_setsavefn(scope_class, scope_save); + scopehandle_class = class_new(gensym("_scopehandle"), 0, 0, + sizeof(t_scopehandle), CLASS_PD, 0); + class_addmethod(scopehandle_class, (t_method)scopehandle__clickhook, + gensym("_click"), A_FLOAT, 0); + class_addmethod(scopehandle_class, (t_method)scopehandle__motionhook, + gensym("_motion"), A_FLOAT, A_FLOAT, 0); + fitter_setup(scope_class, 0); +} diff --git a/externals/miXed/cyclone/sickle/Snapshot.c b/externals/miXed/cyclone/sickle/Snapshot.c new file mode 100644 index 000000000..13ef0ce8c --- /dev/null +++ b/externals/miXed/cyclone/sickle/Snapshot.c @@ -0,0 +1,168 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +/* CHECKME for a fixed minimum deltime, if any (5ms for c74's metro) */ + +typedef struct _snapshot +{ + t_sic x_sic; + t_float x_value; + int x_rqoffset; /* requested */ + int x_offset; /* effective (truncated) */ + int x_stopped; + int x_on; /* !stopped && deltime > 0 */ + float x_deltime; + int x_npoints; + int x_nleft; + int x_nblock; + float x_ksr; + t_clock *x_clock; +} t_snapshot; + +static t_class *snapshot_class; + +static void snapshot_tick(t_snapshot *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void snapshot_bang(t_snapshot *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); +} + +static void snapshot_correct(t_snapshot *x) +{ + int wason = x->x_on; + x->x_offset = + (x->x_rqoffset < x->x_nblock ? x->x_rqoffset : x->x_nblock - 1); + x->x_npoints = x->x_deltime * x->x_ksr - x->x_nblock + x->x_offset; + if (x->x_on = (!x->x_stopped && x->x_deltime > 0.)) + { + if (!wason) x->x_nleft = x->x_offset; /* CHECKME */ + } + else if (wason) clock_unset(x->x_clock); +} + +static void snapshot_start(t_snapshot *x) +{ + x->x_stopped = 0; + if (!x->x_on && x->x_deltime > 0.) /* CHECKED no default */ + { + x->x_nleft = x->x_offset; /* CHECKME */ + x->x_on = 1; + } +} + +static void snapshot_stop(t_snapshot *x) +{ + x->x_stopped = 1; + if (x->x_on) + { + clock_unset(x->x_clock); + x->x_on = 0; + } +} + +static void snapshot_float(t_snapshot *x, t_float f) +{ + /* CHECKED nonzero/zero, CHECKED incompatible: int only (float ignored) */ + if (f != 0.) + snapshot_start(x); + else + snapshot_stop(x); +} + +static void snapshot_ft1(t_snapshot *x, t_floatarg f) +{ + x->x_deltime = (f > 0. ? f : 0.); /* CHECKED */ + /* CHECKED setting deltime to a positive value starts the clock + only if it was stopped by setting deltime to zero */ + snapshot_correct(x); +} + +static void snapshot_offset(t_snapshot *x, t_floatarg f) +{ + int i = (int)f; /* CHECKME */ + x->x_rqoffset = (i >= 0 ? i : 0); /* CHECKME */ + /* CHECKME if the change has an effect prior to next dsp_add call */ + snapshot_correct(x); +} + +static t_int *snapshot_perform(t_int *w) +{ + t_snapshot *x = (t_snapshot *)(w[1]); + t_float *in = (t_float *)(w[2]); + x->x_value = in[x->x_offset]; + if (x->x_on) + { + /* CHECKME nleft vs offset */ + if (x->x_nleft < x->x_nblock) + { + clock_delay(x->x_clock, 0); + x->x_nleft = x->x_npoints; + } + else x->x_nleft -= x->x_nblock; + } + return (w + 3); +} + +static void snapshot_dsp(t_snapshot *x, t_signal **sp) +{ + x->x_nblock = sp[0]->s_n; + x->x_ksr = sp[0]->s_sr * 0.001; + snapshot_correct(x); + x->x_nleft = x->x_offset; /* CHECKME */ + dsp_add(snapshot_perform, 2, x, sp[0]->s_vec); +} + +static void snapshot_free(t_snapshot *x) +{ + if (x->x_clock) clock_free(x->x_clock); +} + +static void *snapshot_new(t_floatarg f1, t_floatarg f2) +{ + t_snapshot *x = (t_snapshot *)pd_new(snapshot_class); + x->x_stopped = 0; /* CHECKED */ + x->x_on = 0; + x->x_value = 0; + x->x_nblock = 64; /* redundant */ + x->x_ksr = 44.1; /* redundant */ + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + x->x_clock = clock_new(x, (t_method)snapshot_tick); + snapshot_offset(x, f2); /* CHECKME (this is fixed at nblock-1 in Pd) */ + snapshot_ft1(x, f1); + return (x); +} + +void Snapshot_tilde_setup(void) +{ + snapshot_class = class_new(gensym("Snapshot~"), + (t_newmethod)snapshot_new, + (t_method)snapshot_free, + sizeof(t_snapshot), 0, + A_DEFFLOAT, A_DEFFLOAT, 0); + class_addcreator((t_newmethod)snapshot_new, gensym("snapshot~"), A_DEFFLOAT, A_DEFFLOAT, 0); + class_addcreator((t_newmethod)snapshot_new, gensym("cyclone/snapshot~"), A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(snapshot_class, snapshot_dsp, snapshot_float); + class_addbang(snapshot_class, snapshot_bang); + class_addmethod(snapshot_class, (t_method)snapshot_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(snapshot_class, (t_method)snapshot_offset, + gensym("offset"), A_FLOAT, 0); + class_addmethod(snapshot_class, (t_method)snapshot_start, + gensym("start"), 0); + class_addmethod(snapshot_class, (t_method)snapshot_stop, + gensym("stop"), 0); +} + +void snapshot_tilde_setup(void) +{ + Snapshot_tilde_setup(); +} diff --git a/externals/miXed/cyclone/sickle/abs.c b/externals/miXed/cyclone/sickle/abs.c new file mode 100644 index 000000000..777b89100 --- /dev/null +++ b/externals/miXed/cyclone/sickle/abs.c @@ -0,0 +1,97 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +/* some random tests (average percentage in load meter and top): + gcc 3.3.5 -O6, p4 2.66GHz, 4500 copies: perform 56, perf8 57, perf0 94 + gcc 3.3.5 -O6, p4 2.66GHz, 9000 copies: perform 118, perf8 123, perf0 194 + vc 6.0 /O2, p3 800Mhz, 750 copies: perform 61, perf8 56, perf0 82 */ +#ifdef KRZYSZCZ +//#define ABS_TEST +#endif + +#ifdef ABS_TEST +#include "common/fitter.h" +#endif + +typedef t_sic t_abs; +static t_class *abs_class; + +static t_int *abs_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + *out++ = fabsf(*in++); + return (w + 4); +} + +#ifdef ABS_TEST +static t_int *abs_perf0(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = (f >= 0 ? f : -f); + } + return (w + 4); +} + +static t_int *abs_perf8(t_int *w) +{ + int nblock = (int)(w[1])>>3; + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + *out++ = fabsf(*in++); + *out++ = fabsf(*in++); + *out++ = fabsf(*in++); + *out++ = fabsf(*in++); + *out++ = fabsf(*in++); + *out++ = fabsf(*in++); + *out++ = fabsf(*in++); + *out++ = fabsf(*in++); + } + return (w + 4); +} +#endif + +static void abs_dsp(t_abs *x, t_signal **sp) +{ +#ifdef ABS_TEST + t_symbol *tst = fitter_getsymbol(gensym("test")); + if (tst == gensym("unroll")) + dsp_add(abs_perf8, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + else if (tst == gensym("branch")) + dsp_add(abs_perf0, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + else +#endif + dsp_add(abs_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *abs_new(void) +{ + t_abs *x = (t_abs *)pd_new(abs_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void abs_tilde_setup(void) +{ + abs_class = class_new(gensym("abs~"), + (t_newmethod)abs_new, 0, + sizeof(t_abs), 0, 0); + sic_setup(abs_class, abs_dsp, SIC_FLOATTOSIGNAL); +#ifdef ABS_TEST + fitter_setup(abs_class, 0); +#endif +} diff --git a/externals/miXed/cyclone/sickle/acos.c b/externals/miXed/cyclone/sickle/acos.c new file mode 100644 index 000000000..3b706b1bc --- /dev/null +++ b/externals/miXed/cyclone/sickle/acos.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define acosf acos +#endif + +typedef t_sic t_acos; +static t_class *acos_class; + +static t_int *acos_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = acosf(f); /* CHECKED no protection against NaNs */ + } + return (w + 4); +} + +static void acos_dsp(t_acos *x, t_signal **sp) +{ + dsp_add(acos_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *acos_new(void) +{ + t_acos *x = (t_acos *)pd_new(acos_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void acos_tilde_setup(void) +{ + acos_class = class_new(gensym("acos~"), + (t_newmethod)acos_new, 0, + sizeof(t_acos), 0, 0); + sic_setup(acos_class, acos_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/acosh.c b/externals/miXed/cyclone/sickle/acosh.c new file mode 100644 index 000000000..eabecb517 --- /dev/null +++ b/externals/miXed/cyclone/sickle/acosh.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +/* LATER ask about osx */ +#if defined(_WIN32) || defined(__APPLE__) +#define acoshf(x) (log(x + sqrt(x * x - 1))) +#endif + +typedef t_sic t_acosh; +static t_class *acosh_class; + +static t_int *acosh_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = acoshf(f); /* CHECKME no protection against NaNs */ + } + return (w + 4); +} + +static void acosh_dsp(t_acosh *x, t_signal **sp) +{ + dsp_add(acosh_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *acosh_new(void) +{ + t_acosh *x = (t_acosh *)pd_new(acosh_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void acosh_tilde_setup(void) +{ + acosh_class = class_new(gensym("acosh~"), + (t_newmethod)acosh_new, 0, + sizeof(t_acosh), 0, 0); + sic_setup(acosh_class, acosh_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/allpass.c b/externals/miXed/cyclone/sickle/allpass.c new file mode 100644 index 000000000..761d0ccda --- /dev/null +++ b/externals/miXed/cyclone/sickle/allpass.c @@ -0,0 +1,153 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _allpass +{ + t_sic x_sic; + float x_sr; + float x_ksr; + t_float *x_buf; + int x_bufsize; /* as allocated */ + int x_maxsize; /* as used */ + float x_maxdelay; /* same in ms */ + int x_phase; /* writing head */ +} t_allpass; + +static t_class *allpass_class; + +/* maximum delay defaults to 50 ms (cycling has 10 ms here) */ +#define ALLPASS_DEFMAXDELAY 50.0 + +/* LATER choose the best way (compare with comb~) */ +#define ALLPASS_MAXFEEDBACK 0.999 + +static void allpass_clear(t_allpass *x) +{ + memset(x->x_buf, 0, x->x_maxsize * sizeof(*x->x_buf)); + x->x_phase = 0; +} + +static void allpass_resize(t_allpass *x, int newsize) +{ + if (newsize > 0 && newsize != x->x_maxsize) + { + if (newsize > x->x_bufsize) + { + x->x_buf = resizebytes(x->x_buf, + x->x_bufsize * sizeof(*x->x_buf), + newsize * sizeof(*x->x_buf)); + /* LATER test for failure */ + x->x_bufsize = newsize; + } + x->x_maxsize = newsize; + } + allpass_clear(x); +} + +static t_int *allpass_perform(t_int *w) +{ + t_allpass *x = (t_allpass *)(w[1]); + int nblock = (int)(w[2]); + t_float *xin = (t_float *)(w[3]); + t_float *din = (t_float *)(w[4]); + t_float *gin = (t_float *)(w[5]); + t_float *out = (t_float *)(w[6]); + t_float *buf = x->x_buf; + int maxsize = x->x_maxsize; + int guardpoint = maxsize - 1; + float ksr = x->x_ksr; + int wph = x->x_phase; + while (nblock--) + { /* TDFII scheme */ + float xn = *xin++; + float delsize = ksr * *din++; + float gain = *gin++; + float yn; + float rph; /* reading head */ + if (gain < -ALLPASS_MAXFEEDBACK) gain = -ALLPASS_MAXFEEDBACK; + else if (gain > ALLPASS_MAXFEEDBACK) gain = ALLPASS_MAXFEEDBACK; + yn = -gain * xn; + if (delsize > 0) + { + int ndx; + float val; + rph = wph - (delsize > guardpoint ? guardpoint : delsize); + if (rph < 0) rph += guardpoint; + ndx = (int)rph; + val = buf[ndx]; + /* ``a cheezy linear interpolation'' ala msp, + (vd~ uses 4-point interpolation...) */ + yn += val + (buf[ndx+1] - val) * (rph - ndx); + } + *out++ = yn; + if (wph == guardpoint) + { + buf[wph] = *buf = xn + gain * yn; + wph = 1; + } + else buf[wph++] = xn + gain * yn; + } + x->x_phase = wph; + return (w + 7); +} + +static void allpass_dsp(t_allpass *x, t_signal **sp) +{ + float sr = sp[0]->s_sr; + if (sr != x->x_sr) + { + x->x_sr = sr; + x->x_ksr = sr * 0.001; + allpass_resize(x, x->x_ksr * x->x_maxdelay); + } + else allpass_clear(x); + dsp_add(allpass_perform, 6, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); +} + +static void *allpass_new(t_floatarg f1, t_floatarg f2, t_floatarg f3) +{ + t_allpass *x; + float maxdelay = (f1 > 0 ? f1 : ALLPASS_DEFMAXDELAY); + float sr = sys_getsr(); + float ksr = sr * 0.001; + int bufsize = ksr * maxdelay; + t_float *buf = (t_float *)getbytes(bufsize * sizeof(*buf)); + if (!buf) + return (0); + x = (t_allpass *)pd_new(allpass_class); + x->x_maxdelay = maxdelay; + x->x_sr = sr; + x->x_ksr = ksr; + x->x_bufsize = x->x_maxsize = bufsize; + x->x_buf = buf; + if (f2 < 0) f2 = 0; + if (f3 < -ALLPASS_MAXFEEDBACK) f3 = -ALLPASS_MAXFEEDBACK; + else if (f3 > ALLPASS_MAXFEEDBACK) f3 = ALLPASS_MAXFEEDBACK; + sic_newinlet((t_sic *)x, f2); + sic_newinlet((t_sic *)x, f3); + outlet_new((t_object *)x, &s_signal); + allpass_clear(x); + return (x); +} + +static void allpass_free(t_allpass *x) +{ + if (x->x_buf) freebytes(x->x_buf, x->x_bufsize * sizeof(*x->x_buf)); +} + +void allpass_tilde_setup(void) +{ + allpass_class = class_new(gensym("allpass~"), + (t_newmethod)allpass_new, + (t_method)allpass_free, + sizeof(t_allpass), 0, + A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(allpass_class, allpass_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(allpass_class, (t_method)allpass_clear, gensym("clear"), 0); +} diff --git a/externals/miXed/cyclone/sickle/allsickles.c b/externals/miXed/cyclone/sickle/allsickles.c new file mode 100644 index 000000000..6c1141e63 --- /dev/null +++ b/externals/miXed/cyclone/sickle/allsickles.c @@ -0,0 +1,166 @@ +// Do not edit this file, run "make" instead. + +/* Copyright (c) 2002-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +void abs_tilde_setup(void); +void acos_tilde_setup(void); +void acosh_tilde_setup(void); +void allpass_tilde_setup(void); +void asin_tilde_setup(void); +void asinh_tilde_setup(void); +void atan2_tilde_setup(void); +void atan_tilde_setup(void); +void atanh_tilde_setup(void); +void average_tilde_setup(void); +void avg_tilde_setup(void); +void bitand_tilde_setup(void); +void bitnot_tilde_setup(void); +void bitor_tilde_setup(void); +void bitshift_tilde_setup(void); +void bitxor_tilde_setup(void); +void buffir_tilde_setup(void); +void capture_tilde_setup(void); +void cartopol_tilde_setup(void); +void change_tilde_setup(void); +void click_tilde_setup(void); +void Clip_tilde_setup(void); +void comb_tilde_setup(void); +void cosh_tilde_setup(void); +void cosx_tilde_setup(void); +void count_tilde_setup(void); +void curve_tilde_setup(void); +void cycle_tilde_setup(void); +void delay_tilde_setup(void); +void delta_tilde_setup(void); +void deltaclip_tilde_setup(void); +void edge_tilde_setup(void); +void frameaccum_tilde_setup(void); +void framedelta_tilde_setup(void); +void index_tilde_setup(void); +void kink_tilde_setup(void); +void Line_tilde_setup(void); +void linedrive_setup(void); +void log_tilde_setup(void); +void lookup_tilde_setup(void); +void lores_tilde_setup(void); +void matrix_tilde_setup(void); +void maximum_tilde_setup(void); +void minimum_tilde_setup(void); +void minmax_tilde_setup(void); +void mstosamps_tilde_setup(void); +void onepole_tilde_setup(void); +void overdrive_tilde_setup(void); +void peakamp_tilde_setup(void); +void peek_tilde_setup(void); +void phasewrap_tilde_setup(void); +void pink_tilde_setup(void); +void play_tilde_setup(void); +void poke_tilde_setup(void); +void poltocar_tilde_setup(void); +void pong_tilde_setup(void); +void pow_tilde_setup(void); +void rampsmooth_tilde_setup(void); +void rand_tilde_setup(void); +void record_tilde_setup(void); +void reson_tilde_setup(void); +void sah_tilde_setup(void); +void sampstoms_tilde_setup(void); +void Scope_tilde_setup(void); +void sinh_tilde_setup(void); +void sinx_tilde_setup(void); +void slide_tilde_setup(void); +void Snapshot_tilde_setup(void); +void spike_tilde_setup(void); +void svf_tilde_setup(void); +void tanh_tilde_setup(void); +void tanx_tilde_setup(void); +void train_tilde_setup(void); +void trapezoid_tilde_setup(void); +void triangle_tilde_setup(void); +void vectral_tilde_setup(void); +void wave_tilde_setup(void); +void zerox_tilde_setup(void); + +void allsickles_setup(void) +{ + abs_tilde_setup(); + acos_tilde_setup(); + acosh_tilde_setup(); + allpass_tilde_setup(); + asin_tilde_setup(); + asinh_tilde_setup(); + atan2_tilde_setup(); + atan_tilde_setup(); + atanh_tilde_setup(); + average_tilde_setup(); + avg_tilde_setup(); + bitand_tilde_setup(); + bitnot_tilde_setup(); + bitor_tilde_setup(); + bitshift_tilde_setup(); + bitxor_tilde_setup(); + buffir_tilde_setup(); + capture_tilde_setup(); + cartopol_tilde_setup(); + change_tilde_setup(); + click_tilde_setup(); + Clip_tilde_setup(); + comb_tilde_setup(); + cosh_tilde_setup(); + cosx_tilde_setup(); + count_tilde_setup(); + curve_tilde_setup(); + cycle_tilde_setup(); + delay_tilde_setup(); + delta_tilde_setup(); + deltaclip_tilde_setup(); + edge_tilde_setup(); + frameaccum_tilde_setup(); + framedelta_tilde_setup(); + index_tilde_setup(); + kink_tilde_setup(); + Line_tilde_setup(); + linedrive_setup(); + log_tilde_setup(); + lookup_tilde_setup(); + lores_tilde_setup(); + matrix_tilde_setup(); + maximum_tilde_setup(); + minimum_tilde_setup(); + minmax_tilde_setup(); + mstosamps_tilde_setup(); + onepole_tilde_setup(); + overdrive_tilde_setup(); + peakamp_tilde_setup(); + peek_tilde_setup(); + phasewrap_tilde_setup(); + pink_tilde_setup(); + play_tilde_setup(); + poke_tilde_setup(); + poltocar_tilde_setup(); + pong_tilde_setup(); + pow_tilde_setup(); + rampsmooth_tilde_setup(); + rand_tilde_setup(); + record_tilde_setup(); + reson_tilde_setup(); + sah_tilde_setup(); + sampstoms_tilde_setup(); + Scope_tilde_setup(); + sinh_tilde_setup(); + sinx_tilde_setup(); + slide_tilde_setup(); + Snapshot_tilde_setup(); + spike_tilde_setup(); + svf_tilde_setup(); + tanh_tilde_setup(); + tanx_tilde_setup(); + train_tilde_setup(); + trapezoid_tilde_setup(); + triangle_tilde_setup(); + vectral_tilde_setup(); + wave_tilde_setup(); + zerox_tilde_setup(); +} diff --git a/externals/miXed/cyclone/sickle/asin.c b/externals/miXed/cyclone/sickle/asin.c new file mode 100644 index 000000000..282c830e2 --- /dev/null +++ b/externals/miXed/cyclone/sickle/asin.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define asinf asin +#endif + +typedef t_sic t_asin; +static t_class *asin_class; + +static t_int *asin_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = asinf(f); /* CHECKME no protection against NaNs */ + } + return (w + 4); +} + +static void asin_dsp(t_asin *x, t_signal **sp) +{ + dsp_add(asin_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *asin_new(void) +{ + t_asin *x = (t_asin *)pd_new(asin_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void asin_tilde_setup(void) +{ + asin_class = class_new(gensym("asin~"), + (t_newmethod)asin_new, 0, + sizeof(t_asin), 0, 0); + sic_setup(asin_class, asin_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/asinh.c b/externals/miXed/cyclone/sickle/asinh.c new file mode 100644 index 000000000..367ce0cc5 --- /dev/null +++ b/externals/miXed/cyclone/sickle/asinh.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +/* LATER ask about osx */ +#if defined(_WIN32) || defined(__APPLE__) +#define asinhf(x) (log(x + sqrt(x * x + 1))) +#endif + +typedef t_sic t_asinh; +static t_class *asinh_class; + +static t_int *asinh_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = asinhf(f); /* CHECKME no protection against NaNs */ + } + return (w + 4); +} + +static void asinh_dsp(t_asinh *x, t_signal **sp) +{ + dsp_add(asinh_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *asinh_new(void) +{ + t_asinh *x = (t_asinh *)pd_new(asinh_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void asinh_tilde_setup(void) +{ + asinh_class = class_new(gensym("asinh~"), + (t_newmethod)asinh_new, 0, + sizeof(t_asinh), 0, 0); + sic_setup(asinh_class, asinh_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/atan.c b/externals/miXed/cyclone/sickle/atan.c new file mode 100644 index 000000000..89d8e8818 --- /dev/null +++ b/externals/miXed/cyclone/sickle/atan.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define atanf atan +#endif + +typedef t_sic t_atan; +static t_class *atan_class; + +static t_int *atan_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = atanf(f); /* CHECKME no protection against NaNs */ + } + return (w + 4); +} + +static void atan_dsp(t_atan *x, t_signal **sp) +{ + dsp_add(atan_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *atan_new(void) +{ + t_atan *x = (t_atan *)pd_new(atan_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void atan_tilde_setup(void) +{ + atan_class = class_new(gensym("atan~"), + (t_newmethod)atan_new, 0, + sizeof(t_atan), 0, 0); + sic_setup(atan_class, atan_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/atan2.c b/externals/miXed/cyclone/sickle/atan2.c new file mode 100644 index 000000000..327efd171 --- /dev/null +++ b/externals/miXed/cyclone/sickle/atan2.c @@ -0,0 +1,53 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define atan2f atan2 +#endif + +typedef t_sic t_atan2; +static t_class *atan2_class; + +static t_int *atan2_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) + { + float f1 = *in1++; + float f2 = *in2++; + /* CHECKED arg order, range (radians) */ + *out++ = atan2f(f1, f2); + } + return (w + 5); +} + +static void atan2_dsp(t_atan2 *x, t_signal **sp) +{ + dsp_add(atan2_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *atan2_new(t_floatarg f) +{ + t_atan2 *x = (t_atan2 *)pd_new(atan2_class); + sic_newinlet((t_sic *)x, f); /* CHECKED x-value argument */ + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void atan2_tilde_setup(void) +{ + atan2_class = class_new(gensym("atan2~"), + (t_newmethod)atan2_new, 0, + sizeof(t_atan2), 0, A_DEFFLOAT, 0); + sic_setup(atan2_class, atan2_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/atanh.c b/externals/miXed/cyclone/sickle/atanh.c new file mode 100644 index 000000000..4152236b1 --- /dev/null +++ b/externals/miXed/cyclone/sickle/atanh.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +/* LATER ask about osx */ +#if defined(_WIN32) || defined(__APPLE__) +#define atanhf(x) (log((1 + x) / (1 - x)) * 0.5) +#endif + +typedef t_sic t_atanh; +static t_class *atanh_class; + +static t_int *atanh_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = atanhf(f); /* CHECKME no protection against NaNs */ + } + return (w + 4); +} + +static void atanh_dsp(t_atanh *x, t_signal **sp) +{ + dsp_add(atanh_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *atanh_new(void) +{ + t_atanh *x = (t_atanh *)pd_new(atanh_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void atanh_tilde_setup(void) +{ + atanh_class = class_new(gensym("atanh~"), + (t_newmethod)atanh_new, 0, + sizeof(t_atanh), 0, 0); + sic_setup(atanh_class, atanh_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/atodb.c b/externals/miXed/cyclone/sickle/atodb.c new file mode 100644 index 000000000..981f227c4 --- /dev/null +++ b/externals/miXed/cyclone/sickle/atodb.c @@ -0,0 +1,72 @@ +/* + Copyright (c) 2016 Marco Matteo Markidis + mm.markidis@gmail.com + + For information on usage and redistribution, and for a DISCLAIMER OF ALL + WARRANTIES, see the file, "LICENSE.txt," in this distribution. + + Made while listening: + Evan Parker Electro-Acoustic Ensemble -- Hasselt +*/ +#include "m_pd.h" +#include <math.h> + +#define BAD -999 + +inline t_float badout(t_float f) +{ + return ((f) > (BAD) ? (f) : (BAD)); +} + +static t_class *atodb_class; + +typedef struct _atodb { + t_object x_obj; + t_inlet *x_inlet; + t_outlet *x_outlet; +} t_atodb; + + +void *atodb_new(void); +static t_int * atodb_perform(t_int *w); +static void atodb_dsp(t_atodb *x, t_signal **sp); + +static t_int * atodb_perform(t_int *w) +{ + /* t_atodb *x = (t_atodb *)(w[1]); */ + int n = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + + + while(n--) + *out++ = badout(20*log10(*in++)); + return (w + 5); +} + + +static void atodb_dsp(t_atodb *x, t_signal **sp) +{ + dsp_add(atodb_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +void *atodb_new(void) +{ + t_atodb *x = (t_atodb *)pd_new(atodb_class); + x->x_inlet = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + x->x_outlet = outlet_new(&x->x_obj, &s_signal); + return (void *)x; +} + + +void atodb_tilde_setup(void) { + atodb_class = class_new(gensym("atodb~"), + (t_newmethod) atodb_new, + 0, + sizeof (t_atodb), + CLASS_NOINLET, + 0); + + class_addmethod(atodb_class, (t_method) atodb_dsp, gensym("dsp"), 0); +} + diff --git a/externals/miXed/cyclone/sickle/average.c b/externals/miXed/cyclone/sickle/average.c new file mode 100644 index 000000000..870ca0dde --- /dev/null +++ b/externals/miXed/cyclone/sickle/average.c @@ -0,0 +1,195 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* CHECKME no reset after changing of a window size? */ +/* CHECKME overlap */ + +#include <math.h> +#include "m_pd.h" +#include "common/loud.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define sqrtf sqrt +#endif + +#define AVERAGE_DEFNPOINTS 100 /* CHECKME */ +#define AVERAGE_DEFMODE AVERAGE_BIPOLAR +enum { AVERAGE_BIPOLAR, AVERAGE_ABSOLUTE, AVERAGE_RMS }; + +typedef struct _average +{ + t_sic x_sic; + int x_mode; + float (*x_sumfn)(t_float*, int, float); + int x_phase; + int x_npoints; + float x_result; + float x_accum; + t_clock *x_clock; +} t_average; + +static t_class *average_class; + +static void average_tick(t_average *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_result); +} + +static float average_bipolarsum(t_float *in, int nxfer, float accum) +{ + while (nxfer--) + accum += *in++; + return (accum); +} + +static float average_absolutesum(t_float *in, int nxfer, float accum) +{ + while (nxfer--) + { + float f = *in++; + accum += (f >= 0 ? f : -f); + } + return (accum); +} + +static float average_rmssum(t_float *in, int nxfer, float accum) +{ + while (nxfer--) + { + float f = *in++; + accum += f * f; + } + return (accum); +} + +static void average_setmode(t_average *x, int mode) +{ + if (mode == AVERAGE_BIPOLAR) + x->x_sumfn = average_bipolarsum; + else if (mode == AVERAGE_ABSOLUTE) + x->x_sumfn = average_absolutesum; + else if (mode == AVERAGE_RMS) + x->x_sumfn = average_rmssum; + else + { + loudbug_bug("average_setmode"); + return; + } + x->x_mode = mode; + x->x_phase = x->x_npoints; + x->x_accum = 0; +} + +static void average_float(t_average *x, t_float f) +{ + int i = (int)f; /* CHECKME noninteger */ + if (i > 0) /* CHECKME */ + { + x->x_npoints = i; + x->x_phase = x->x_npoints; + x->x_accum = 0; + } +} + +static void average_bipolar(t_average *x) +{ + average_setmode(x, AVERAGE_BIPOLAR); +} + +static void average_absolute(t_average *x) +{ + average_setmode(x, AVERAGE_ABSOLUTE); +} + +static void average_rms(t_average *x) +{ + average_setmode(x, AVERAGE_RMS); +} + +static t_int *average_perform(t_int *w) +{ + t_average *x = (t_average *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + float (*sumfn)(t_float*, int, float) = x->x_sumfn; + int phase = x->x_phase; + if (phase <= nblock) + { + float accum = (*sumfn)(in, phase, x->x_accum); + nblock -= phase; + if (x->x_mode == AVERAGE_RMS) + /* CHECKME scaling and FIXME */ + x->x_result = sqrtf(accum / x->x_npoints); + else + x->x_result = accum / x->x_npoints; + clock_delay(x->x_clock, 0); + x->x_accum = 0; + if (nblock < x->x_npoints) + x->x_phase = x->x_npoints - nblock; + else + { + x->x_phase = x->x_npoints; + return (w + 4); + } + } + else x->x_phase -= nblock; + x->x_accum = (*sumfn)(in, nblock, x->x_accum); + return (w + 4); +} + +static void average_dsp(t_average *x, t_signal **sp) +{ + dsp_add(average_perform, 3, x, sp[0]->s_n, sp[0]->s_vec); +} + +static void average_free(t_average *x) +{ + if (x->x_clock) clock_free(x->x_clock); +} + +static void *average_new(t_symbol *s, t_floatarg f) +{ + t_average *x = (t_average *)pd_new(average_class); + int i = (int)f; /* CHECKME noninteger */ + int mode; + /* CHECKED it looks like memory is allocated for the entire window, + in tune with the refman's note about ``maximum averaging interval'' -- + needed for dynamic control over window size, or what? LATER rethink */ + x->x_npoints = (i > 0 ? /* CHECKME */ + i : AVERAGE_DEFNPOINTS); + if (s == gensym("bipolar")) + mode = AVERAGE_BIPOLAR; + else if (s == gensym("absolute")) + mode = AVERAGE_ABSOLUTE; + else if (s == gensym("rms")) + mode = AVERAGE_RMS; + else + { + mode = AVERAGE_DEFMODE; + /* CHECKME a warning if (s && s != &s_) */ + } + average_setmode(x, mode); + /* CHECKME if not x->x_phase = 0 */ + outlet_new((t_object *)x, &s_float); + x->x_clock = clock_new(x, (t_method)average_tick); + return (x); +} + +void average_tilde_setup(void) +{ + average_class = class_new(gensym("average~"), + (t_newmethod)average_new, + (t_method)average_free, + sizeof(t_average), 0, + A_DEFFLOAT, A_DEFSYM, 0); + sic_setup(average_class, average_dsp, average_float); + class_addmethod(average_class, (t_method)average_bipolar, + gensym("bipolar"), 0); + class_addmethod(average_class, (t_method)average_absolute, + gensym("absolute"), 0); + class_addmethod(average_class, (t_method)average_rms, + gensym("rms"), 0); +} diff --git a/externals/miXed/cyclone/sickle/avg.c b/externals/miXed/cyclone/sickle/avg.c new file mode 100644 index 000000000..2ad214a37 --- /dev/null +++ b/externals/miXed/cyclone/sickle/avg.c @@ -0,0 +1,62 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _avg +{ + t_sic x_sic; + float x_count; + float x_accum; +} t_avg; + +static t_class *avg_class; + +static void avg_bang(t_avg *x) +{ + outlet_float(((t_object *)x)->ob_outlet, + (x->x_count ? x->x_accum / x->x_count : 0)); + x->x_count = 0; + x->x_accum = 0; +} + +static t_int *avg_perform(t_int *w) +{ + t_avg *x = (t_avg *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + float accum = 0; + x->x_count += nblock; /* LATER consider blockcount++ */ + while (nblock--) + { + float f = *in++; + accum += (f >= 0 ? f : -f); + } + x->x_accum += accum; + return (w + 4); +} + +static void avg_dsp(t_avg *x, t_signal **sp) +{ + dsp_add(avg_perform, 3, x, sp[0]->s_n, sp[0]->s_vec); +} + +static void *avg_new(void) +{ + t_avg *x = (t_avg *)pd_new(avg_class); + outlet_new((t_object *)x, &s_float); + x->x_count = 0; + x->x_accum = 0; + return (x); +} + +void avg_tilde_setup(void) +{ + avg_class = class_new(gensym("avg~"), + (t_newmethod)avg_new, 0, + sizeof(t_avg), 0, 0); + sic_setup(avg_class, avg_dsp, SIC_FLOATTOSIGNAL); + class_addbang(avg_class, avg_bang); +} diff --git a/externals/miXed/cyclone/sickle/bitand.c b/externals/miXed/cyclone/sickle/bitand.c new file mode 100644 index 000000000..a7cfeb737 --- /dev/null +++ b/externals/miXed/cyclone/sickle/bitand.c @@ -0,0 +1,144 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* FIXME find a way of setting a 32-bit mask in an argument */ + +#include "m_pd.h" +#include "unstable/forky.h" +#include "sickle/sic.h" + +typedef struct _bitand +{ + t_sic x_sic; + t_glist *x_glist; + t_int x_mask; /* set by a 'bits' message or a creation argument */ + int x_mode; + int x_convert1; +} t_bitand; + +static t_class *bitand_class; + +static t_int *bitand_perform(t_int *w) +{ + t_bitand *x = (t_bitand *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *out = (t_float *)(w[5]); + t_int mask = x->x_mask; + switch (x->x_mode) + { + /* LATER think about performance */ + case 0: + /* CHECKED */ + while (nblock--) + { + t_int i = ((*(t_int *)(t_float *)in1++) & + (*(t_int *)(t_float *)in2++)); + *out++ = *(t_float *)&i; + } + break; + case 1: + /* CHECKED */ + while (nblock--) + { + t_int i = (((t_int)*in1++) & + ((t_int)*in2++)); + *out++ = (t_float)i; + } + break; + case 2: + /* CHECKED */ + while (nblock--) + { + t_int i = (*(t_int *)(t_float *)in1++) & ((t_int)*in2++); + *out++ = *(t_float *)&i; + } + break; + case 3: + /* CHECKED */ + while (nblock--) + { + t_int i = ((t_int)*in1++) & (*(t_int *)(t_float *)in2++); + *out++ = (t_float)i; + } + break; + } + return (w + 6); +} + +static t_int *bitand_perform_noin2(t_int *w) +{ + t_bitand *x = (t_bitand *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_int mask = x->x_mask; + /* LATER think about performance */ + if (x->x_convert1) while (nblock--) + { + /* CHECKED */ + t_int i = ((t_int)*in++) & mask; + *out++ = (t_float)i; + } + else while (nblock--) + { + /* CHECKED */ + t_int i = (*(t_int *)(t_float *)in++) & mask; + *out++ = *(t_float *)&i; + } + return (w + 5); +} + +static void bitand_dsp(t_bitand *x, t_signal **sp) +{ + if (forky_hasfeeders((t_object *)x, x->x_glist, 1, 0)) + /* use the mask set by a second inlet's signal or float, + CHECKED (incompatible) second inlet's int is persistent */ + dsp_add(bitand_perform, 5, x, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec, sp[2]->s_vec); + else /* use the mask set by a 'bits' message or a creation argument */ + dsp_add(bitand_perform_noin2, 4, x, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec); +} + +static void bitand_bits(t_bitand *x, t_symbol *s, int ac, t_atom *av) +{ + x->x_mask = forky_getbitmask(ac, av); +} + +static void bitand_mode(t_bitand *x, t_floatarg f) +{ + int i = (int)f; + if (i < 0) + i = 0; /* CHECKED */ + else if (i > 3) + i = 3; /* CHECKED */ + x->x_mode = i; + x->x_convert1 = (x->x_mode == 1 || x->x_mode == 3); +} + +static void *bitand_new(t_floatarg f1, t_floatarg f2) +{ + t_bitand *x = (t_bitand *)pd_new(bitand_class); + x->x_glist = canvas_getcurrent(); + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + outlet_new((t_object *)x, &s_signal); + x->x_mask = (t_int)f1; /* FIXME (how?) */ + bitand_mode(x, f2); + return (x); +} + +void bitand_tilde_setup(void) +{ + bitand_class = class_new(gensym("bitand~"), + (t_newmethod)bitand_new, 0, + sizeof(t_bitand), 0, + A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(bitand_class, bitand_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(bitand_class, (t_method)bitand_bits, + gensym("bits"), A_GIMME, 0); + class_addmethod(bitand_class, (t_method)bitand_mode, + gensym("mode"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/bitnot.c b/externals/miXed/cyclone/sickle/bitnot.c new file mode 100644 index 000000000..c2929e8d1 --- /dev/null +++ b/externals/miXed/cyclone/sickle/bitnot.c @@ -0,0 +1,66 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _bitnot +{ + t_sic x_sic; + int x_convert1; +} t_bitnot; + +static t_class *bitnot_class; + +static t_int *bitnot_perform(t_int *w) +{ + t_bitnot *x = (t_bitnot *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + /* LATER think about performance */ + if (x->x_convert1) while (nblock--) + { + /* CHECKME */ + t_int i = ~((t_int)*in++); + *out++ = (t_float)i; + } + else while (nblock--) + { + /* CHECKME */ + t_int i = ~(*(t_int *)(t_float *)in++); + *out++ = *(t_float *)&i; + } + return (w + 5); +} + +static void bitnot_dsp(t_bitnot *x, t_signal **sp) +{ + dsp_add(bitnot_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void bitnot_mode(t_bitnot *x, t_floatarg f) +{ + int i = (int)f; + x->x_convert1 = (i > 0); /* CHECKME */ +} + +static void *bitnot_new(t_floatarg f) +{ + t_bitnot *x = (t_bitnot *)pd_new(bitnot_class); + outlet_new((t_object *)x, &s_signal); + bitnot_mode(x, f); + return (x); +} + +void bitnot_tilde_setup(void) +{ + bitnot_class = class_new(gensym("bitnot~"), + (t_newmethod)bitnot_new, 0, + sizeof(t_bitnot), 0, + A_DEFFLOAT, 0); + sic_setup(bitnot_class, bitnot_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(bitnot_class, (t_method)bitnot_mode, + gensym("mode"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/bitor.c b/externals/miXed/cyclone/sickle/bitor.c new file mode 100644 index 000000000..e5c887b16 --- /dev/null +++ b/externals/miXed/cyclone/sickle/bitor.c @@ -0,0 +1,144 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* FIXME find a way of setting a 32-bit mask in an argument */ + +#include "m_pd.h" +#include "unstable/forky.h" +#include "sickle/sic.h" + +typedef struct _bitor +{ + t_sic x_sic; + t_glist *x_glist; + t_int x_mask; /* set by a 'bits' message or a creation argument */ + int x_mode; + int x_convert1; +} t_bitor; + +static t_class *bitor_class; + +static t_int *bitor_perform(t_int *w) +{ + t_bitor *x = (t_bitor *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *out = (t_float *)(w[5]); + t_int mask = x->x_mask; + switch (x->x_mode) + { + /* LATER think about performance */ + case 0: + /* CHECKED */ + while (nblock--) + { + t_int i = ((*(t_int *)(t_float *)in1++) | + (*(t_int *)(t_float *)in2++)); + *out++ = *(t_float *)&i; + } + break; + case 1: + /* CHECKED */ + while (nblock--) + { + t_int i = (((t_int)*in1++) | + ((t_int)*in2++)); + *out++ = (t_float)i; + } + break; + case 2: + /* CHECKED */ + while (nblock--) + { + t_int i = (*(t_int *)(t_float *)in1++) | ((t_int)*in2++); + *out++ = *(t_float *)&i; + } + break; + case 3: + /* CHECKED */ + while (nblock--) + { + t_int i = ((t_int)*in1++) | (*(t_int *)(t_float *)in2++); + *out++ = (t_float)i; + } + break; + } + return (w + 6); +} + +static t_int *bitor_perform_noin2(t_int *w) +{ + t_bitor *x = (t_bitor *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_int mask = x->x_mask; + /* LATER think about performance */ + if (x->x_convert1) while (nblock--) + { + /* CHECKED */ + t_int i = ((t_int)*in++) | mask; + *out++ = (t_float)i; + } + else while (nblock--) + { + /* CHECKED */ + t_int i = (*(t_int *)(t_float *)in++) | mask; + *out++ = *(t_float *)&i; + } + return (w + 5); +} + +static void bitor_dsp(t_bitor *x, t_signal **sp) +{ + if (forky_hasfeeders((t_object *)x, x->x_glist, 1, 0)) + /* use the mask set by a second inlet's signal or float, + CHECKED (incompatible) second inlet's int is persistent */ + dsp_add(bitor_perform, 5, x, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec, sp[2]->s_vec); + else /* use the mask set by a 'bits' message or a creation argument */ + dsp_add(bitor_perform_noin2, 4, x, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec); +} + +static void bitor_bits(t_bitor *x, t_symbol *s, int ac, t_atom *av) +{ + x->x_mask = forky_getbitmask(ac, av); +} + +static void bitor_mode(t_bitor *x, t_floatarg f) +{ + int i = (int)f; + if (i < 0) + i = 0; /* CHECKED */ + else if (i > 3) + i = 3; /* CHECKED */ + x->x_mode = i; + x->x_convert1 = (x->x_mode == 1 || x->x_mode == 3); +} + +static void *bitor_new(t_floatarg f1, t_floatarg f2) +{ + t_bitor *x = (t_bitor *)pd_new(bitor_class); + x->x_glist = canvas_getcurrent(); + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + outlet_new((t_object *)x, &s_signal); + x->x_mask = (t_int)f1; /* FIXME (how?) */ + bitor_mode(x, f2); + return (x); +} + +void bitor_tilde_setup(void) +{ + bitor_class = class_new(gensym("bitor~"), + (t_newmethod)bitor_new, 0, + sizeof(t_bitor), 0, + A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(bitor_class, bitor_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(bitor_class, (t_method)bitor_bits, + gensym("bits"), A_GIMME, 0); + class_addmethod(bitor_class, (t_method)bitor_mode, + gensym("mode"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/bitshift.c b/externals/miXed/cyclone/sickle/bitshift.c new file mode 100644 index 000000000..707048c00 --- /dev/null +++ b/externals/miXed/cyclone/sickle/bitshift.c @@ -0,0 +1,133 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* When bit-shifting 32-bit values, gcc (intel?) bashes the second operand + modulo 32. In msp x << 32 gives 0, x >> 32 gives a propagated sign bit + (as expected). Mimicking that is clumsy. LATER consider making the calcs + more generic (use long long values?) */ + +#include "m_pd.h" +#include "common/loud.h" +#include "sickle/sic.h" + +#ifdef KRZYSZCZ +//#define BITSHIFT_DEBUG +#endif + +typedef struct _bitshift +{ + t_sic x_sic; + int x_convert1; + int x_lshift; + int x_rshift; + int x_lover; +} t_bitshift; + +static t_class *bitshift_class; + +static t_int *bitshift_perform(t_int *w) +{ + t_bitshift *x = (t_bitshift *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + /* LATER think about performance */ + if (x->x_lshift) + { + unsigned int shift = x->x_lshift; + if (x->x_convert1) while (nblock--) + { + /* CHECKED */ + t_int i = ((t_int)*in++ << shift); + *out++ = (t_float)i; + } + else while (nblock--) + { + /* CHECKED */ + t_int i = (*(t_int *)(t_float *)in++ << shift); + *out++ = *(t_float *)&i; + } + } + else if (x->x_rshift) + { + unsigned int shift = x->x_rshift; + if (x->x_convert1) while (nblock--) + { + /* CHECKME */ + t_int i = ((t_int)*in++ >> shift); + *out++ = (t_float)i; + } + else while (nblock--) + { + /* CHECKME */ + t_int i = (*(t_int *)(t_float *)in++ >> shift); + *out++ = *(t_float *)&i; + } + } + else if (x->x_lover) + while (nblock--) *out++ = 0; /* CHECKED both modes */ + else + while (nblock--) *out++ = *in++; /* CHECKED both modes */ + return (w + 5); +} + +static void bitshift_dsp(t_bitshift *x, t_signal **sp) +{ + dsp_add(bitshift_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void bitshift_mode(t_bitshift *x, t_floatarg f) +{ + int i = (int)f; + x->x_convert1 = (i > 0); /* CHECKED */ +} + +static void bitshift_shift(t_bitshift *x, t_floatarg f) +{ + int i = (int)f; + int nbits = sizeof(t_int) * 8; + x->x_lshift = x->x_rshift = 0; + x->x_lover = 0; + if (i > 0) + { +#ifdef BITSHIFT_DEBUG + loudbug_post("%.8x << %d == %.8x, %.8x << %d == %.8x", + 1, i, 1 << i, -1, i, -1 << i); +#endif + if (i < nbits) + x->x_lshift = i; + else + x->x_lover = 1; + } + else if (i < 0) + { +#ifdef BITSHIFT_DEBUG + loudbug_post("%.8x >> %d == %.8x, %.8x >> %d == %.8x", + 0x7fffffff, -i, 0x7fffffff >> -i, -1, -i, -1 >> -i); +#endif + x->x_rshift = (i <= -nbits ? nbits - 1 : -i); + } +} + +static void *bitshift_new(t_floatarg f1, t_floatarg f2) +{ + t_bitshift *x = (t_bitshift *)pd_new(bitshift_class); + outlet_new((t_object *)x, &s_signal); + bitshift_shift(x, f1); + bitshift_mode(x, f2); + return (x); +} + +void bitshift_tilde_setup(void) +{ + bitshift_class = class_new(gensym("bitshift~"), + (t_newmethod)bitshift_new, 0, + sizeof(t_bitshift), 0, + A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(bitshift_class, bitshift_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(bitshift_class, (t_method)bitshift_mode, + gensym("mode"), A_FLOAT, 0); + class_addmethod(bitshift_class, (t_method)bitshift_shift, + gensym("shift"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/bitxor.c b/externals/miXed/cyclone/sickle/bitxor.c new file mode 100644 index 000000000..5eeb4fddd --- /dev/null +++ b/externals/miXed/cyclone/sickle/bitxor.c @@ -0,0 +1,190 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* FIXME find a way of setting a 32-bit mask in an argument */ + +#include <string.h> +#include "m_pd.h" +#include "unstable/forky.h" +#include "sickle/sic.h" + +#define PDCYBITMASK 0 +#define PDCYOPMODE 0 +typedef struct _bitxor +{ + t_sic x_sic; + t_glist *x_glist; + t_int x_mask; /* set by a 'bits' message or a creation argument */ + int x_mode; + int x_convert1; +} t_bitxor; + +static t_class *bitxor_class; + +static t_int *bitxor_perform(t_int *w) +{ + t_bitxor *x = (t_bitxor *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *out = (t_float *)(w[5]); + t_int mask = x->x_mask; + switch (x->x_mode) + { + /* LATER think about performance */ + case 0: + /* CHECKED */ + while (nblock--) + { + t_int i = ((*(t_int *)(t_float *)in1++) ^ + (*(t_int *)(t_float *)in2++)); + *out++ = *(t_float *)&i; + } + break; + case 1: + /* CHECKED */ + while (nblock--) + { + t_int i = (((t_int)*in1++) ^ + ((t_int)*in2++)); + *out++ = (t_float)i; + } + break; + case 2: + /* CHECKED */ + while (nblock--) + { + t_int i = (*(t_int *)(t_float *)in1++) ^ ((t_int)*in2++); + *out++ = *(t_float *)&i; + } + break; + case 3: + /* CHECKED */ + while (nblock--) + { + t_int i = ((t_int)*in1++) ^ (*(t_int *)(t_float *)in2++); + *out++ = (t_float)i; + } + break; + } + return (w + 6); +} + +static t_int *bitxor_perform_noin2(t_int *w) +{ + t_bitxor *x = (t_bitxor *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_int mask = x->x_mask; + /* LATER think about performance */ + if (x->x_convert1) while (nblock--) + { + /* CHECKED */ + t_int i = ((t_int)*in++) ^ mask; + *out++ = (t_float)i; + } + else while (nblock--) + { + /* CHECKED */ + t_int i = (*(t_int *)(t_float *)in++) ^ mask; + *out++ = *(t_float *)&i; + } + return (w + 5); +} + +static void bitxor_dsp(t_bitxor *x, t_signal **sp) +{ + if (forky_hasfeeders((t_object *)x, x->x_glist, 1, 0)) + /* use the mask set by a second inlet's signal or float, + CHECKED (incompatible) second inlet's int is persistent */ + dsp_add(bitxor_perform, 5, x, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec, sp[2]->s_vec); + else /* use the mask set by a 'bits' message or a creation argument */ + dsp_add(bitxor_perform_noin2, 4, x, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec); +} + +static void bitxor_bits(t_bitxor *x, t_symbol *s, int ac, t_atom *av) +{ + x->x_mask = forky_getbitmask(ac, av); +} + +static void bitxor_mode(t_bitxor *x, t_floatarg f) +{ + int i = (int)f; + if (i < 0) + i = 0; /* CHECKED */ + else if (i > 3) + i = 3; /* CHECKED */ + x->x_mode = i; + x->x_convert1 = (x->x_mode == 1 || x->x_mode == 3); +} + +static void *bitxor_new(t_symbol *s, int argc, t_atom *argv) +{ + t_bitxor *x = (t_bitxor *)pd_new(bitxor_class); + x->x_glist = canvas_getcurrent(); + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + outlet_new((t_object *)x, &s_signal); + + //setting defaults + t_float xmode = (t_float)PDCYOPMODE; + t_float xbitmask = (t_float)PDCYBITMASK; + int argnum = 0; + while(argc > 0){ + t_symbol *curarg = atom_getsymbolarg(0, argc, argv); + if(curarg == &s_){//if curarg is a number + t_float argval = atom_getfloatarg(0, argc, argv); + switch(argnum){ + case 0: + xbitmask = argval; + break; + case 1: + xmode = argval; + break; + default: + break; + }; + argc--; + argv++; + argnum++; + } + else{//curarg is a string + if(strcmp(curarg->s_name, "@mode")==0){ + if(argc >= 2){ + xmode = atom_getfloatarg(1, argc, argv); + argc--; + argv++; + } + else{ + goto errstate; + } + } + else{ + goto errstate; + }; + }; + }; + x->x_mask = (t_int)xbitmask; /* FIXME (how?) */ + bitxor_mode(x, xmode); + return (x); + errstate: + pd_error(x, "bitxor~: improper args"); + return NULL; + +} + +void bitxor_tilde_setup(void) +{ + bitxor_class = class_new(gensym("bitxor~"), + (t_newmethod)bitxor_new, 0, + sizeof(t_bitxor), 0, + A_GIMME, 0); + sic_setup(bitxor_class, bitxor_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(bitxor_class, (t_method)bitxor_bits, + gensym("bits"), A_GIMME, 0); + class_addmethod(bitxor_class, (t_method)bitxor_mode, + gensym("mode"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/buffir.c b/externals/miXed/cyclone/sickle/buffir.c new file mode 100644 index 000000000..95eb119f9 --- /dev/null +++ b/externals/miXed/cyclone/sickle/buffir.c @@ -0,0 +1,219 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "shared.h" +#include "common/loud.h" +#include "common/fitter.h" +#include "sickle/sic.h" +#include "sickle/arsic.h" + +#define BUFFIR_DEFSIZE 0 /* CHECKED */ +#define BUFFIR_MAXSIZE 128 + +typedef struct _buffir +{ + t_arsic x_arsic; + t_pd *x_offinlet; + t_pd *x_sizinlet; + t_float *x_lohead; + t_float *x_hihead; + int x_histsize; + t_float *x_histlo; + t_float *x_histhi; + t_float x_histini[2 * BUFFIR_MAXSIZE]; +} t_buffir; + +static t_class *buffir_class; + +static void buffir_setrange(t_buffir *x, t_floatarg f1, t_floatarg f2) +{ + int off = (int)f1; + int siz = (int)f2; + if (off < 0) + off = 0; + if (siz <= 0) + siz = BUFFIR_DEFSIZE; + if (siz > x->x_histsize) + { + int newsize, pos = x->x_lohead - x->x_histlo; + int oldbytes = x->x_histsize * sizeof(*x->x_histlo); + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(buffir_class, "stretching history buffer"); + warned = 1; + } + newsize = x->x_histsize * 2; + while (newsize < siz) newsize *= 2; + if (x->x_histlo == x->x_histini) + { + if (!(x->x_histlo = getbytes(2 * newsize * sizeof(*x->x_histlo)))) + x->x_histlo = x->x_histini; + else + { + x->x_histhi = x->x_histlo + newsize; + memcpy(x->x_histhi + pos - x->x_histsize, + x->x_lohead, oldbytes); + x->x_lohead = x->x_histlo + pos; + x->x_hihead = x->x_histhi + pos; + x->x_histsize = newsize; + } + } + else + { + if (!(x->x_histlo = + resizebytes(x->x_histlo, 2 * oldbytes, + 2 * newsize * sizeof(*x->x_histlo)))) + { + x->x_histsize = BUFFIR_MAXSIZE; + x->x_histlo = x->x_histini; + memset(x->x_histlo, 0, + 2 * x->x_histsize * sizeof(*x->x_histlo)); + x->x_lohead = x->x_histlo; + x->x_hihead = x->x_histhi = x->x_histlo + x->x_histsize; + } + else + { + x->x_histhi = x->x_histlo + newsize; + memcpy(x->x_histhi + pos - x->x_histsize, + x->x_lohead, oldbytes); + x->x_lohead = x->x_histlo + pos; + x->x_hihead = x->x_histhi + pos; + x->x_histsize = newsize; + } + } + } + pd_float(x->x_offinlet, off); + pd_float(x->x_sizinlet, siz); +} + +static void buffir_clear(t_buffir *x) +{ + memset(x->x_histlo, 0, 2 * x->x_histsize * sizeof(*x->x_histlo)); + x->x_lohead = x->x_histlo; + x->x_hihead = x->x_histhi = x->x_histlo + x->x_histsize; +} + +static void buffir_set(t_buffir *x, t_symbol *s, t_floatarg f1, t_floatarg f2) +{ + arsic_setarray((t_arsic *)x, s, 1); + buffir_setrange(x, f1, f2); +} + +static t_int *buffir_perform(t_int *w) +{ + t_arsic *sic = (t_arsic *)(w[1]); + t_buffir *x = (t_buffir *)sic; + int nblock = (int)(w[2]); + t_float *xin = (t_float *)(w[3]); + t_float *out = (t_float *)(w[6]); + t_float *lohead = x->x_lohead; + t_float *hihead = x->x_hihead; + if (sic->s_playable) + { + t_float *oin = (t_float *)(w[4]); + t_float *sin = (t_float *)(w[5]); + int vecsize = sic->s_vecsize; + t_word *vec = sic->s_vectors[0]; /* playable implies nonzero (mono) */ + int histsize = x->x_histsize; + while (nblock--) + { + /* CHECKME every sample or once per block. + If once per block, then LATER think about performance. */ + /* CHECKME rounding */ + int off = (int)*oin++; + int npoints = (int)*sin++; + if (off < 0) + off = 0; + if (npoints > histsize) + npoints = histsize; + if (npoints > vecsize - off) + npoints = vecsize - off; + if (npoints > 0) + { +// t_float *coefp = vec + off; + t_float *coefp = &vec[0].w_float + off; + t_float *hp = hihead; + t_float sum = 0.; + *lohead++ = *hihead++ = *xin++; + while (npoints--) + sum += *coefp++ * *hp--; + *out++ = sum; + } + else + { + *lohead++ = *hihead++ = *xin++; + *out++ = 0.; + } + if (lohead >= x->x_histhi) + { + lohead = x->x_histlo; + hihead = x->x_histhi; + } + } + } + else while (nblock--) + { + *lohead++ = *hihead++ = *xin++; + *out++ = 0.; + if (lohead >= x->x_histhi) + { + lohead = x->x_histlo; + hihead = x->x_histhi; + } + } + x->x_lohead = lohead; + x->x_hihead = hihead; + return (w + 7); +} + +static void buffir_dsp(t_buffir *x, t_signal **sp) +{ + arsic_dsp((t_arsic *)x, sp, buffir_perform, 1); +} + +static void buffir_free(t_buffir *x) +{ + if (x->x_histlo != x->x_histini) + freebytes(x->x_histlo, 2 * x->x_histsize * sizeof(*x->x_histlo)); + arsic_free((t_arsic *)x); +} + +static void *buffir_new(t_symbol *s, t_floatarg f1, t_floatarg f2) +{ + /* CHECKME always the first channel used. */ + /* three auxiliary signals: main, offset and size inputs */ + t_buffir *x = (t_buffir *)arsic_new(buffir_class, s, 0, 0, 3); + if (x) + { + arsic_setminsize((t_arsic *)x, 1); + x->x_offinlet = (t_pd *)sic_newinlet((t_sic *)x, f1); + x->x_sizinlet = (t_pd *)sic_newinlet((t_sic *)x, f2); + outlet_new((t_object *)x, &s_signal); + x->x_histsize = BUFFIR_MAXSIZE; + x->x_histlo = x->x_histini; + buffir_clear(x); + buffir_setrange(x, f1, f2); + } + return (x); +} + +void buffir_tilde_setup(void) +{ + buffir_class = class_new(gensym("buffir~"), + (t_newmethod)buffir_new, + (t_method)buffir_free, + sizeof(t_buffir), 0, + A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, 0); + arsic_setup(buffir_class, buffir_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(buffir_class, (t_method)buffir_clear, + gensym("clear"), 0); + class_addmethod(buffir_class, (t_method)buffir_set, + gensym("set"), A_SYMBOL, A_DEFFLOAT, A_DEFFLOAT, 0); + fitter_setup(buffir_class, 0); +// logpost(NULL, 4, "this is cyclone/buffir~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/sickle/capture.c b/externals/miXed/cyclone/sickle/capture.c new file mode 100644 index 000000000..a61369493 --- /dev/null +++ b/externals/miXed/cyclone/sickle/capture.c @@ -0,0 +1,409 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* CHECKME list of indices */ + +#include <stdio.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "hammer/file.h" +#include "sickle/sic.h" + +#define CAPTURE_DEFSIZE 4096 +#define CAPTURE_DEFPRECISION 4 +#define CAPTURE_MAXPRECISION 99 /* format array protection */ +#define CAPTURE_MAXINDICES 4096 /* FIXME */ + +typedef struct _capture +{ + t_sic x_sic; + t_glist *x_glist; + char x_mode; /* 'f' for first or 0 for last */ + int x_precision; + char x_format[8]; + char *x_indices; + int x_szindices; /* size of x_indices array */ + int x_nindices; /* number of reported indices */ + int x_nblock; + float *x_buffer; + int x_bufsize; + int x_count; + int x_head; + t_hammerfile *x_filehandle; +} t_capture; + +static t_class *capture_class; + +static void capture_clear(t_capture *x) +{ + x->x_count = 0; + x->x_head = 0; +} + +static int capture_formatfloat(t_capture *x, float f, char *buf, int col, + int maxcol) +{ + char *bp = buf; + int cnt = 0; + if (col > 0) + *bp++ = ' ', cnt++; + if (x->x_precision) + cnt += sprintf(bp, x->x_format, f); + else + cnt += sprintf(bp, "%d", (int)f); + if (col + cnt > maxcol) + buf[0] = '\n', col = cnt - 1; /* assuming col > 0 */ + else + col += cnt; + return (col); +} + +static int capture_writefloat(t_capture *x, float f, char *buf, int col, + FILE *fp) +{ + /* CHECKME linebreaks */ + col = capture_formatfloat(x, f, buf, col, 80); + return (fputs(buf, fp) < 0 ? -1 : col); +} + +static void capture_dowrite(t_capture *x, t_symbol *fn) +{ + FILE *fp = 0; + int count = x->x_count; + char buf[MAXPDSTRING]; + canvas_makefilename(glist_getcanvas(x->x_glist), + fn->s_name, buf, MAXPDSTRING); + if (fp = sys_fopen(buf, "w")) /* LATER ask if overwriting, CHECKME */ + { + int col = 0; + if (x->x_mode == 'f' || count < x->x_bufsize) + { + float *bp = x->x_buffer; + while (count--) + if ((col = capture_writefloat(x, *bp++, buf, col, fp)) < 0) + goto fail; + } + else + { + float *bp = x->x_buffer + x->x_head; + count = x->x_bufsize - x->x_head; + while (count--) + if ((col = capture_writefloat(x, *bp++, buf, col, fp)) < 0) + goto fail; + bp = x->x_buffer; + count = x->x_head; + while (count--) + if ((col = capture_writefloat(x, *bp++, buf, col, fp)) < 0) + goto fail; + } + if (col) fputc('\n', fp); + fclose(fp); + return; + } +fail: + if (fp) fclose(fp); + loud_syserror((t_pd *)x, 0); +} + +static void capture_writehook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + capture_dowrite((t_capture *)z, fn); +} + +static void capture_write(t_capture *x, t_symbol *s) +{ + if (s && s != &s_) + capture_dowrite(x, s); + else + hammerpanel_save(x->x_filehandle, 0, 0); +} + +static int capture_appendfloat(t_capture *x, float f, char *buf, + int col, int linebreak) +{ + /* CHECKME 80 columns */ + col = capture_formatfloat(x, f, buf, col, 80); + hammereditor_append(x->x_filehandle, buf); + if (linebreak) + { + if (col) + { + hammereditor_append(x->x_filehandle, "\n\n"); + col = 0; + } + else hammereditor_append(x->x_filehandle, "\n"); + } + return (col); +} + +/* CHECKED blank line between blocks */ +static void capture_open(t_capture *x) +{ + int count = x->x_count; + char buf[MAXPDSTRING]; + int nindices = (x->x_nindices > 0 ? x->x_nindices : x->x_nblock); + hammereditor_open(x->x_filehandle, "Signal Capture", ""); /* CHECKED */ + if (x->x_mode == 'f' || count < x->x_bufsize) + { + float *bp = x->x_buffer; + int col = 0, i; + for (i = 1; i <= count; i++) + col = capture_appendfloat(x, *bp++, buf, col, + ((i % nindices) == 0)); + } + else + { + float *bp = x->x_buffer + x->x_head; + int col = 0, i = x->x_bufsize; + count = x->x_bufsize - x->x_head; + while (count--) + col = capture_appendfloat(x, *bp++, buf, col, + ((--i % nindices) == 0)); + bp = x->x_buffer; + count = x->x_head; + while (count--) + col = capture_appendfloat(x, *bp++, buf, col, + ((count % nindices) == 0)); + } +} + +/* CHECKED without asking and storing the changes */ +static void capture_wclose(t_capture *x) +{ + hammereditor_close(x->x_filehandle, 0); +} + +static void capture_click(t_capture *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + capture_open(x); +} + +static t_int *capture_perform_first(t_int *w) +{ + t_capture *x = (t_capture *)(w[1]); + int count = x->x_count; + int bufsize = x->x_bufsize; + if (count < bufsize) + { + t_float *in = (t_float *)(w[2]); + int nblock = (int)(w[3]); + float *bp = x->x_buffer + count; + char *ndxp = x->x_indices; + if (nblock > x->x_szindices) + nblock = x->x_szindices; + while (nblock--) + { + if (*ndxp++) + { + *bp++ = *in++; + if (++count == bufsize) + break; + } + else in++; + } + x->x_count = count; + } + return (w + 4); +} + +static t_int *capture_perform_allfirst(t_int *w) +{ + t_capture *x = (t_capture *)(w[1]); + int count = x->x_count; + int bufsize = x->x_bufsize; + if (count < bufsize) + { + t_float *in = (t_float *)(w[2]); + int nblock = (int)(w[3]); + float *bp = x->x_buffer + count; + while (nblock--) + { + *bp++ = *in++; + if (++count == bufsize) + break; + } + x->x_count = count; + } + return (w + 4); +} + +static t_int *capture_perform_last(t_int *w) +{ + t_capture *x = (t_capture *)(w[1]); + t_float *in = (t_float *)(w[2]); + int nblock = (int)(w[3]); + float *buffer = x->x_buffer; + int bufsize = x->x_bufsize; + int count = x->x_count; + int head = x->x_head; + char *ndxp = x->x_indices; + if (nblock > x->x_szindices) + nblock = x->x_szindices; + while (nblock--) + { + if (*ndxp++) + { + buffer[head++] = *in++; + if (head >= bufsize) + head = 0; + if (count < bufsize) + count++; + } + else in++; + } + x->x_count = count; + x->x_head = head; + return (w + 4); +} + +static t_int *capture_perform_alllast(t_int *w) +{ + t_capture *x = (t_capture *)(w[1]); + t_float *in = (t_float *)(w[2]); + int nblock = (int)(w[3]); + float *buffer = x->x_buffer; + int bufsize = x->x_bufsize; + int count = x->x_count; + int head = x->x_head; + while (nblock--) + { + buffer[head++] = *in++; + if (head >= bufsize) + head = 0; + if (count < bufsize) + count++; + } + x->x_count = count; + x->x_head = head; + return (w + 4); +} + +static void capture_dsp(t_capture *x, t_signal **sp) +{ + x->x_nblock = sp[0]->s_n; + if (x->x_indices) + dsp_add((x->x_mode == 'f' ? + capture_perform_first : capture_perform_last), + 3, x, sp[0]->s_vec, sp[0]->s_n); + else + dsp_add((x->x_mode == 'f' ? + capture_perform_allfirst : capture_perform_alllast), + 3, x, sp[0]->s_vec, sp[0]->s_n); +} + +static void capture_free(t_capture *x) +{ + hammerfile_free(x->x_filehandle); + if (x->x_indices) + freebytes(x->x_indices, x->x_szindices * sizeof(*x->x_indices)); + if (x->x_buffer) + freebytes(x->x_buffer, x->x_bufsize * sizeof(*x->x_buffer)); +} + +static void *capture_new(t_symbol *s, int ac, t_atom *av) +{ + t_capture *x = 0; + char mode = 0; + int precision = -1; + float *buffer; + int bufsize = 0; + char *indices = 0; + int szindices = 0, nindices = -1; + if (ac && av->a_type == A_SYMBOL) + { + t_symbol *s = av->a_w.w_symbol; + if (s && *s->s_name == 'f') /* CHECKME */ + mode = 'f'; + ac--; av++; + } + if (ac && av->a_type == A_FLOAT) + { + bufsize = (int)av->a_w.w_float; /* CHECKME */ + ac--; av++; + if (ac && av->a_type == A_FLOAT) + { + int i; + t_atom *ap; + precision = (int)av->a_w.w_float; /* CHECKME */ + ac--; av++; + for (i = 0, ap = av; i < ac; i++, ap++) + { + if (ap->a_type == A_FLOAT) + { + int ndx = (int)ap->a_w.w_float; + /* CHECKME noninteger, negative */ + ndx++; + if (ndx >= CAPTURE_MAXINDICES) + { + /* CHECKME complaint */ + szindices = CAPTURE_MAXINDICES; + break; + } + else if (ndx > szindices) + szindices = ndx; + } + else break; /* CHECKME */ + } + if (szindices && (indices = getbytes(szindices * sizeof(*indices)))) + { + nindices = 0; + while (i--) + { + int ndx = (int)av++->a_w.w_float; + /* CHECKME noninteger */ + if (ndx >= 0 && ndx < szindices) + indices[ndx] = 1, nindices++; + } + } + } + } + if (bufsize <= 0) /* CHECKME */ + bufsize = CAPTURE_DEFSIZE; + if (buffer = getbytes(bufsize * sizeof(*buffer))) + { + x = (t_capture *)pd_new(capture_class); + x->x_glist = canvas_getcurrent(); + x->x_mode = mode; + if (precision < 0) /* CHECKME */ + precision = CAPTURE_DEFPRECISION; + else if (precision > CAPTURE_MAXPRECISION) /* CHECKME */ + precision = CAPTURE_MAXPRECISION; + if (x->x_precision = precision) + sprintf(x->x_format, "%%.%dg", precision); + x->x_indices = indices; + x->x_szindices = szindices; + x->x_nindices = nindices; + x->x_nblock = 64; /* redundant */ + x->x_buffer = buffer; + x->x_bufsize = bufsize; + x->x_filehandle = hammerfile_new((t_pd *)x, 0, 0, capture_writehook, 0); + capture_clear(x); + } + else if (indices) + freebytes(indices, szindices * sizeof(*indices)); + return (x); +} + +void capture_tilde_setup(void) +{ + capture_class = class_new(gensym("capture~"), + (t_newmethod)capture_new, + (t_method)capture_free, + sizeof(t_capture), 0, A_GIMME, 0); + sic_setup(capture_class, capture_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(capture_class, (t_method)capture_clear, + gensym("clear"), 0); + class_addmethod(capture_class, (t_method)capture_write, + gensym("write"), A_DEFSYM, 0); + class_addmethod(capture_class, (t_method)capture_open, + gensym("open"), 0); + class_addmethod(capture_class, (t_method)capture_wclose, + gensym("wclose"), 0); + class_addmethod(capture_class, (t_method)capture_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + hammerfile_setup(capture_class, 0); +} diff --git a/externals/miXed/cyclone/sickle/cartopol.c b/externals/miXed/cyclone/sickle/cartopol.c new file mode 100644 index 000000000..8513af673 --- /dev/null +++ b/externals/miXed/cyclone/sickle/cartopol.c @@ -0,0 +1,79 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "unstable/fragile.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define atan2f atan2 +#define hypotf hypot +#endif + +typedef struct _cartopol +{ + t_sic x_sic; + t_outlet *x_out2; +} t_cartopol; + +static t_class *cartopol_class; + +static t_int *cartopol_perform(t_int *w) +{ + int nblock = (int)(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]); + while (nblock--) + { + float rl = *in1++, im = *in2++; /* checked against Max5 */ + *out1++ = hypotf(rl, im); + *out2++ = atan2f(im, rl); + } + return (w + 6); +} + +static t_int *cartopol_perform_nophase(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out1 = (t_float *)(w[4]); + while (nblock--) + { + float rl = *in1++, im = *in2++; /* checked against Max5 */ + *out1++ = hypotf(rl, im); + } + return (w + 5); +} + +static void cartopol_dsp(t_cartopol *x, t_signal **sp) +{ + if (fragile_outlet_connections(x->x_out2)) + dsp_add(cartopol_perform, 5, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); + else + dsp_add(cartopol_perform_nophase, 4, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec, sp[2]->s_vec); +} + +static void *cartopol_new(void) +{ + t_cartopol *x = (t_cartopol *)pd_new(cartopol_class); + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + outlet_new((t_object *)x, &s_signal); + x->x_out2 = outlet_new((t_object *)x, &s_signal); + return (x); +} + +void cartopol_tilde_setup(void) +{ + cartopol_class = class_new(gensym("cartopol~"), + (t_newmethod)cartopol_new, 0, + sizeof(t_cartopol), 0, 0); + sic_setup(cartopol_class, cartopol_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/change.c b/externals/miXed/cyclone/sickle/change.c new file mode 100644 index 000000000..fffc43a34 --- /dev/null +++ b/externals/miXed/cyclone/sickle/change.c @@ -0,0 +1,52 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _change +{ + t_sic x_sic; + t_float x_last; +} t_change; + +static t_class *change_class; + +static t_int *change_perform(t_int *w) +{ + t_change *x = (t_change *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_float last = x->x_last; + while (nblock--) + { + t_float f = *in++; + *out++ = (f > last ? 1. : (f < last ? -1. : 0.)); + last = f; + } + x->x_last = last; + return (w + 5); +} + +static void change_dsp(t_change *x, t_signal **sp) +{ + dsp_add(change_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *change_new(void) +{ + t_change *x = (t_change *)pd_new(change_class); + outlet_new((t_object *)x, &s_signal); + x->x_last = 0; /* CHECKME startup conditions */ + return (x); +} + +void change_tilde_setup(void) +{ + change_class = class_new(gensym("change~"), + (t_newmethod)change_new, 0, + sizeof(t_change), 0, 0); + sic_setup(change_class, change_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/click.c b/externals/miXed/cyclone/sickle/click.c new file mode 100644 index 000000000..5734cfdd7 --- /dev/null +++ b/externals/miXed/cyclone/sickle/click.c @@ -0,0 +1,119 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/grow.h" +#include "sickle/sic.h" + +#define CLICK_INISIZE 16 /* LATER rethink */ + +typedef struct _click +{ + t_sic x_sic; + int x_nsamples; /* as used */ + int x_bufsize; /* as allocated */ + t_float *x_buffer; + t_float x_bufini[CLICK_INISIZE]; + int x_nleft; + t_float *x_head; +} t_click; + +static t_class *click_class; + +static void click_bang(t_click *x) +{ + x->x_nleft = x->x_nsamples; + x->x_head = x->x_buffer; +} + +static void click_set(t_click *x, t_symbol *s, int ac, t_atom *av) +{ + int i, nsamples = 0; + t_atom *ap; + t_float *bp; + for (i = 0, ap = av; i < ac; i++, ap++) + { + if (ap->a_type == A_FLOAT) nsamples++; + /* CHECKED no restrictions (refman's error about 0.0-1.0 range) + CHECKED nonnumeric atoms silently ignored */ + } + if (nsamples > x->x_bufsize) + x->x_buffer = grow_nodata(&nsamples, &x->x_bufsize, x->x_buffer, + CLICK_INISIZE, x->x_bufini, + sizeof(*x->x_buffer)); + if (nsamples) + { + x->x_nsamples = nsamples; + bp = x->x_buffer; + while (nsamples--) *bp++ = av++->a_w.w_float; + } + else x->x_nsamples = 0; /* CHECKED, need to 'set 1' explicitly */ + x->x_nleft = 0; + x->x_head = x->x_buffer; +} + +static t_int *click_perform(t_int *w) +{ + t_click *x = (t_click *)(w[1]); + int nblock = (int)(w[2]); + t_float *out = (t_float *)(w[3]); + if (x->x_nleft) + { + int nleft = x->x_nleft; + t_float *head = x->x_head; + if (nleft >= nblock) + { + x->x_nleft -= nblock; + while (nblock--) *out++ = *head++; + x->x_head = head; + } + else + { + nblock -= nleft; + while (nleft--) *out++ = *head++; + while (nblock--) *out++ = 0.; + x->x_nleft = 0; + x->x_head = x->x_buffer; + } + } + else while (nblock--) *out++ = 0.; + return (w + 4); +} + +static void click_dsp(t_click *x, t_signal **sp) +{ + dsp_add(click_perform, 3, x, sp[0]->s_n, sp[0]->s_vec); +} + +static void click_free(t_click *x) +{ + if (x->x_buffer != x->x_bufini) + freebytes(x->x_buffer, x->x_bufsize * sizeof(*x->x_buffer)); +} + +static void *click_new(t_symbol *s, int ac, t_atom *av) +{ + t_click *x = (t_click *)pd_new(click_class); + x->x_nsamples = 1; /* CHECKED */ + x->x_bufsize = CLICK_INISIZE; + x->x_buffer = x->x_bufini; + x->x_buffer[0] = 1.; /* CHECKED */ + x->x_nleft = 0; + x->x_head = x->x_buffer; + outlet_new((t_object *)x, &s_signal); + if (ac) click_set(x, 0, ac, av); + return (x); +} + +void click_tilde_setup(void) +{ + click_class = class_new(gensym("click~"), + (t_newmethod)click_new, + (t_method)click_free, + sizeof(t_click), 0, A_GIMME, 0); + sic_setup(click_class, click_dsp, SIC_NOMAINSIGNALIN); + class_addbang(click_class, click_bang); + class_addmethod(click_class, (t_method)click_set, + gensym("set"), A_GIMME, 0); +} diff --git a/externals/miXed/cyclone/sickle/comb.c b/externals/miXed/cyclone/sickle/comb.c new file mode 100644 index 000000000..8d4c8b37a --- /dev/null +++ b/externals/miXed/cyclone/sickle/comb.c @@ -0,0 +1,162 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _comb +{ + t_sic x_sic; + float x_sr; + float x_ksr; + t_float *x_buf; + int x_bufsize; /* as allocated */ + int x_maxsize; /* as used */ + float x_maxdelay; /* same in ms */ + int x_phase; /* writing head */ +} t_comb; + +static t_class *comb_class; + +/* maximum delay defaults to 50 ms (cycling has 10 ms here) */ +#define COMB_DEFMAXDELAY 50.0 + +/* LATER choose the best way. From msp help patch: + no clipping is done on a, b, or c coefficient input */ +#define COMB_MAXFEEDBACK 0.999 + +static void comb_clear(t_comb *x) +{ + memset(x->x_buf, 0, x->x_maxsize * sizeof(*x->x_buf)); + x->x_phase = 0; +} + +static void comb_resize(t_comb *x, int newsize) +{ + if (newsize > 0 && newsize != x->x_maxsize) + { + if (newsize > x->x_bufsize) + { + x->x_buf = resizebytes(x->x_buf, + x->x_bufsize * sizeof(*x->x_buf), + newsize * sizeof(*x->x_buf)); + /* LATER test for failure */ + x->x_bufsize = newsize; + } + x->x_maxsize = newsize; + } + comb_clear(x); +} + +static t_int *comb_perform(t_int *w) +{ + t_comb *x = (t_comb *)(w[1]); + int nblock = (int)(w[2]); + t_float *xin = (t_float *)(w[3]); + t_float *din = (t_float *)(w[4]); + t_float *ain = (t_float *)(w[5]); + t_float *bin = (t_float *)(w[6]); + t_float *cin = (t_float *)(w[7]); + t_float *out = (t_float *)(w[8]); + t_float *buf = x->x_buf; + int maxsize = x->x_maxsize; + int guardpoint = maxsize - 1; + float ksr = x->x_ksr; + int wph = x->x_phase; + while (nblock--) + { /* TDFII scheme is used. Do not forget, that any signal value + read after writing to out has to be saved beforehand. */ + float xn = *xin++; + float delsize = ksr * *din++; + float bgain = *bin++; + float cgain = *cin++; + float yn = *ain++ * xn; + float rph; /* reading head */ + if (cgain < -COMB_MAXFEEDBACK) cgain = -COMB_MAXFEEDBACK; + else if (cgain > COMB_MAXFEEDBACK) cgain = COMB_MAXFEEDBACK; + if (delsize > 1.0) + { + int ndx; + float val; + rph = wph - (delsize > guardpoint ? guardpoint : delsize); + if (rph < 0) rph += guardpoint; + ndx = (int)rph; + val = buf[ndx]; + /* ``a cheezy linear interpolation'' ala msp, + (vd~ uses 4-point interpolation...) */ + yn += val + (buf[ndx+1] - val) * (rph - ndx); + } + *out++ = yn; + if (wph == guardpoint) + { + buf[wph] = *buf = bgain * xn + cgain * yn; + wph = 1; + } + else buf[wph++] = bgain * xn + cgain * yn; + } + x->x_phase = wph; + return (w + 9); +} + +static void comb_dsp(t_comb *x, t_signal **sp) +{ + float sr = sp[0]->s_sr; + if (sr != x->x_sr) + { + x->x_sr = sr; + x->x_ksr = sr * 0.001; + comb_resize(x, x->x_ksr * x->x_maxdelay); + } + else comb_clear(x); + dsp_add(comb_perform, 8, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, + sp[3]->s_vec, sp[4]->s_vec, sp[5]->s_vec); +} + +static void *comb_new(t_floatarg f1, t_floatarg f2, + t_floatarg f3, t_floatarg f4, t_floatarg f5) +{ + t_comb *x; + float maxdelay = (f1 > 0 ? f1 : COMB_DEFMAXDELAY); + float sr = sys_getsr(); + float ksr = sr * 0.001; + int bufsize = ksr * maxdelay; + t_float *buf = (t_float *)getbytes(bufsize * sizeof(*buf)); + if (!buf) + return (0); + x = (t_comb *)pd_new(comb_class); + x->x_maxdelay = maxdelay; + x->x_sr = sr; + x->x_ksr = ksr; + x->x_bufsize = x->x_maxsize = bufsize; + x->x_buf = buf; + if (f2 < 0) f2 = 0; + if (f5 < -COMB_MAXFEEDBACK) f5 = -COMB_MAXFEEDBACK; + else if (f5 > COMB_MAXFEEDBACK) f5 = COMB_MAXFEEDBACK; + sic_newinlet((t_sic *)x, f2); + sic_newinlet((t_sic *)x, f3); + sic_newinlet((t_sic *)x, f4); + sic_newinlet((t_sic *)x, f5); + outlet_new((t_object *)x, &s_signal); + comb_clear(x); + return (x); +} + +static void comb_free(t_comb *x) +{ + if (x->x_buf) freebytes(x->x_buf, x->x_bufsize * sizeof(*x->x_buf)); +} + +void comb_tilde_setup(void) +{ + comb_class = class_new(gensym("comb~"), + (t_newmethod)comb_new, + (t_method)comb_free, + sizeof(t_comb), 0, + A_DEFFLOAT, A_DEFFLOAT, + A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(comb_class, comb_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(comb_class, (t_method)comb_clear, gensym("clear"), 0); +} diff --git a/externals/miXed/cyclone/sickle/cosh.c b/externals/miXed/cyclone/sickle/cosh.c new file mode 100644 index 000000000..87f195f93 --- /dev/null +++ b/externals/miXed/cyclone/sickle/cosh.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define coshf cosh +#endif + +typedef t_sic t_cosh; +static t_class *cosh_class; + +static t_int *cosh_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = coshf(f); /* CHECKME no protection against overflow */ + } + return (w + 4); +} + +static void cosh_dsp(t_cosh *x, t_signal **sp) +{ + dsp_add(cosh_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *cosh_new(void) +{ + t_cosh *x = (t_cosh *)pd_new(cosh_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void cosh_tilde_setup(void) +{ + cosh_class = class_new(gensym("cosh~"), + (t_newmethod)cosh_new, 0, + sizeof(t_cosh), 0, 0); + sic_setup(cosh_class, cosh_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/cosx.c b/externals/miXed/cyclone/sickle/cosx.c new file mode 100644 index 000000000..d86fdaebd --- /dev/null +++ b/externals/miXed/cyclone/sickle/cosx.c @@ -0,0 +1,51 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +/* by definition, this is just an interface to the -lm call + (do not use costable) */ + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define cosf cos +#endif + +typedef t_sic t_cosx; +static t_class *cosx_class; + +static t_int *cosx_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = cosf(f); + } + return (w + 4); +} + +static void cosx_dsp(t_cosx *x, t_signal **sp) +{ + dsp_add(cosx_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *cosx_new(void) +{ + t_cosx *x = (t_cosx *)pd_new(cosx_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void cosx_tilde_setup(void) +{ + cosx_class = class_new(gensym("cosx~"), + (t_newmethod)cosx_new, 0, + sizeof(t_cosx), 0, 0); + sic_setup(cosx_class, cosx_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/count.c b/externals/miXed/cyclone/sickle/count.c new file mode 100644 index 000000000..2a36f4411 --- /dev/null +++ b/externals/miXed/cyclone/sickle/count.c @@ -0,0 +1,163 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +#define COUNTMAXINT 0x7fffffff + +typedef struct _count +{ + t_sic x_sic; + int x_min; + int x_max; + int x_limit; + int x_on; + int x_autoreset; + int x_count; /* MAYBE use 64 bits (if 13.5 hours is not enough...) */ +} t_count; + +static t_class *count_class; + +static void count_bang(t_count *x) +{ + x->x_count = x->x_min; + x->x_on = 1; +} + +static void count_min(t_count *x, t_floatarg f) +{ + x->x_min = (int)f; + count_bang(x); +} + +static void count_max(t_count *x, t_floatarg f) +{ + x->x_max = (int)f; + /* MAYBE use 64 bits */ + x->x_limit = (x->x_max == 0 ? COUNTMAXINT + : x->x_max - 1); /* CHECKED */ + count_bang(x); +} + +static void count_autoreset(t_count *x, t_floatarg f) +{ + x->x_autoreset = (f != 0); +} + +static void count_float(t_count *x, t_floatarg f) +{ + x->x_count = x->x_min = (int)f; + x->x_on = 1; +} + +static void count_list(t_count *x, t_symbol *s, int ac, t_atom *av) +{ + int i; + if (ac > 4) ac = 4; + for (i = 0; i < ac; i++) + if (av[i].a_type != A_FLOAT) break; + switch (i) + { + case 4: + count_autoreset(x, av[3].a_w.w_float); + case 3: + x->x_on = (av[2].a_w.w_float != 0); + case 2: + count_max(x, av[1].a_w.w_float); + case 1: + count_min(x, av[0].a_w.w_float); + default: + x->x_count = x->x_min; + } +} + +/* changes minimum (and optional the maximum) without changing current value */ +static void count_set(t_count *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac > 0) + { + if (av[0].a_type == A_FLOAT) { + x->x_min = (int)av[0].a_w.w_float; + } + } + if (ac > 1) + { + if (av[1].a_type == A_FLOAT) + { + x->x_max = (int)av[1].a_w.w_float; + x->x_limit = (x->x_max == 0 ? COUNTMAXINT + : x->x_max - 1); /* CHECKED */ + } + } +} + +static void count_stop(t_count *x) +{ + x->x_count = x->x_min; + x->x_on = 0; +} + +static t_int *count_perform(t_int *w) +{ + t_count *x = (t_count *)(w[1]); + int nblock = (int)(w[2]); + t_float *out = (t_float *)(w[3]); + int count = x->x_count; + int limit = x->x_limit; + if (x->x_on) + { + while (nblock--) + { + if (count > limit) count = x->x_min; + *out++ = (t_float)count++; + } + } + else + while (nblock--) *out++ = count; + x->x_count = count; + return (w + 4); +} + +static void count_dsp(t_count *x, t_signal **sp) +{ + if (x->x_autoreset) count_bang(x); + dsp_add(count_perform, 3, x, sp[0]->s_n, sp[0]->s_vec); +} + +static void *count_new(t_floatarg minval, t_floatarg maxval, + t_floatarg onflag, t_floatarg autoflag) +{ + t_count *x = (t_count *)pd_new(count_class); + count_min(x, minval); + count_max(x, maxval); + x->x_on = (onflag != 0); + count_autoreset(x, autoflag); + x->x_count = x->x_min; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void count_tilde_setup(void) +{ + count_class = class_new(gensym("count~"), + (t_newmethod)count_new, 0, + sizeof(t_count), 0, + A_DEFFLOAT, A_DEFFLOAT, + A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(count_class, count_dsp, SIC_NOMAINSIGNALIN); + class_addbang(count_class, count_bang); + class_addfloat(count_class, count_float); + class_addlist(count_class, count_list); + class_addmethod(count_class, (t_method)count_max, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(count_class, (t_method)count_autoreset, + gensym("autoreset"), A_FLOAT, 0); + class_addmethod(count_class, (t_method)count_min, + gensym("min"), A_FLOAT, 0); + class_addmethod(count_class, (t_method)count_set, + gensym("set"), A_GIMME, 0); + class_addmethod(count_class, (t_method)count_stop, gensym("stop"), 0); +} diff --git a/externals/miXed/cyclone/sickle/curve.c b/externals/miXed/cyclone/sickle/curve.c new file mode 100644 index 000000000..11ada15de --- /dev/null +++ b/externals/miXed/cyclone/sickle/curve.c @@ -0,0 +1,425 @@ +/* Copyright (c) 2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "shared.h" +#include "common/grow.h" +#include "common/loud.h" +#include "common/clc.h" +#include "sickle/sic.h" + +#ifdef KRZYSZCZ +//#define CURVE_DEBUG +#endif + +/* CHECKED apparently c74's formula has not been carefully tuned (yet?). + It has 5% deviation from the straight line for ccinput = 0 at half-domain, + range 1, and generates nans for ccinput > .995 (cf comment in clc.h). */ + + +#define PDCYCURVEINITVAL 0.f +#define PDCYCURVEPARAM 0.f +#define CURVE_INISIZE 64 /* LATER rethink */ +#define CURVE_MAXSIZE 64 + +typedef struct _curveseg +{ + float s_target; + float s_delta; + int s_nhops; + float s_ccinput; + double s_bb; + double s_mm; +} t_curveseg; + +typedef struct _curve +{ + t_sic x_sic; + float x_value; + float x_ccinput; + float x_target; + float x_delta; + int x_deltaset; + double x_vv; + double x_bb; + double x_mm; + float x_y0; + float x_dy; + float x_ksr; + int x_nleft; + int x_retarget; + int x_size; /* as allocated */ + int x_nsegs; /* as used */ + t_curveseg *x_curseg; + t_curveseg *x_segs; + t_curveseg x_segini[CURVE_INISIZE]; + t_clock *x_clock; + t_outlet *x_bangout; +#ifdef CURVE_DEBUG + int dbg_nretargets; + int dbg_exitpoint; + int dbg_nhops; +#endif +} t_curve; + +static t_class *curve_class; +static double curve_coef; + +static void curve_cc(t_curve *x, t_curveseg *segp, float f) +{ + int nhops = segp->s_delta * x->x_ksr + 0.5; /* LATER rethink */ + segp->s_ccinput = f; + segp->s_nhops = (nhops > 0 ? nhops : 0); + clccurve_coefs(segp->s_nhops, (double)f, &segp->s_bb, &segp->s_mm); +#ifdef CURVE_DEBUG + loudbug_post("%g %g %g %g", + segp->s_target, segp->s_delta, segp->s_bb, segp->s_mm); +#endif +} + +static void curve_tick(t_curve *x) +{ + outlet_bang(x->x_bangout); +#ifdef CURVE_DEBUG + loudbug_post("exit point %d, after %d retarget calls", + x->dbg_exitpoint, x->dbg_nretargets); + loudbug_post("at value %g, after last %d nhops, with bb %g, mm %g", + x->x_value, x->dbg_nhops, x->x_bb, x->x_mm); + x->dbg_nretargets = x->dbg_exitpoint = x->dbg_nhops = 0; +#endif +} + +static t_int *curve_perform(t_int *w) +{ + t_curve *x = (t_curve *)(w[1]); + t_float *out = (t_float *)(w[2]); + int nblock = (int)(w[3]); + int nxfer = x->x_nleft; + float curval = x->x_value; + double vv = x->x_vv; + double bb = x->x_bb; + double mm = x->x_mm; + float dy = x->x_dy; + float y0 = x->x_y0; + if (PD_BIGORSMALL(curval)) /* LATER rethink */ + curval = x->x_value = 0; +retarget: + if (x->x_retarget) + { + float target = x->x_curseg->s_target; + float delta = x->x_curseg->s_delta; + int nhops = x->x_curseg->s_nhops; + bb = x->x_curseg->s_bb; + mm = x->x_curseg->s_mm; + if (x->x_curseg->s_ccinput < 0) + dy = x->x_value - target; + else + dy = target - x->x_value; +#ifdef CURVE_DEBUG + x->dbg_nretargets++; +#endif + x->x_nsegs--; + x->x_curseg++; + while (nhops <= 0) + { + curval = x->x_value = target; + if (x->x_nsegs) + { + target = x->x_curseg->s_target; + delta = x->x_curseg->s_delta; + nhops = x->x_curseg->s_nhops; + bb = x->x_curseg->s_bb; + mm = x->x_curseg->s_mm; + if (x->x_curseg->s_ccinput < 0) + dy = x->x_value - target; + else + dy = target - x->x_value; + x->x_nsegs--; + x->x_curseg++; + } + else + { + while (nblock--) *out++ = curval; + x->x_nleft = 0; +#ifdef CURVE_DEBUG + x->dbg_exitpoint = 1; +#endif + clock_delay(x->x_clock, 0); + x->x_retarget = 0; + return (w + 4); + } + } + nxfer = x->x_nleft = nhops; + x->x_vv = vv = bb; + x->x_bb = bb; + x->x_mm = mm; + x->x_dy = dy; + x->x_y0 = y0 = x->x_value; + x->x_target = target; + x->x_retarget = 0; +#ifdef CURVE_DEBUG + x->dbg_nhops = nhops; +#endif + } + if (nxfer >= nblock) + { + int silly = ((x->x_nleft -= nblock) == 0); /* LATER rethink */ + while (nblock--) + { + *out++ = curval = (vv - bb) * dy + y0; + vv *= mm; + } + if (silly) + { + if (x->x_nsegs) x->x_retarget = 1; + else + { +#ifdef CURVE_DEBUG + x->dbg_exitpoint = 2; +#endif + clock_delay(x->x_clock, 0); + } + x->x_value = x->x_target; + } + else + { + x->x_value = curval; + x->x_vv = vv; + } + } + else if (nxfer > 0) + { + nblock -= nxfer; + do + *out++ = (vv - bb) * dy + y0, vv *= mm; + while (--nxfer); + curval = x->x_value = x->x_target; + if (x->x_nsegs) + { + x->x_retarget = 1; + goto retarget; + } + else + { + while (nblock--) *out++ = curval; + x->x_nleft = 0; +#ifdef CURVE_DEBUG + x->dbg_exitpoint = 3; +#endif + clock_delay(x->x_clock, 0); + } + } + else while (nblock--) *out++ = curval; + return (w + 4); +} + +static void curve_float(t_curve *x, t_float f) +{ + if (x->x_deltaset) + { + x->x_deltaset = 0; + x->x_target = f; + x->x_nsegs = 1; + x->x_curseg = x->x_segs; + x->x_curseg->s_target = f; + x->x_curseg->s_delta = x->x_delta; +#ifdef CURVE_DEBUG + loudbug_startpost("single segment: "); +#endif + curve_cc(x, x->x_curseg, x->x_ccinput); + x->x_retarget = 1; + } + else + { + x->x_value = x->x_target = f; + x->x_nsegs = 0; + x->x_curseg = 0; + x->x_nleft = 0; + x->x_retarget = 0; + } +} + +/* CHECKED delta is not persistent, but ccinput is */ +static void curve_ft1(t_curve *x, t_floatarg f) +{ + x->x_delta = f; + x->x_deltaset = (f > 0); +} + +static void curve_list(t_curve *x, t_symbol *s, int ac, t_atom *av) +{ + int natoms, nsegs, odd; + t_atom *ap; + t_curveseg *segp; + for (natoms = 0, ap = av; natoms < ac; natoms++, ap++) + { + if (ap->a_type != A_FLOAT) + { + loud_messarg((t_pd *)x, &s_list); /* CHECKED */ + return; /* CHECKED */ + } + } + if (!natoms) + return; /* CHECKED */ + odd = natoms % 3; + nsegs = natoms / 3; + if (odd) nsegs++; + if (nsegs > x->x_size) + { + int ns = nsegs; + x->x_segs = grow_nodata(&ns, &x->x_size, x->x_segs, + CURVE_INISIZE, x->x_segini, + sizeof(*x->x_segs)); + if (ns < nsegs) + { + natoms = ns * 3; + nsegs = ns; + odd = 0; + } + } + x->x_nsegs = nsegs; +#ifdef CURVE_DEBUG + loudbug_post("%d segments:", x->x_nsegs); +#endif + segp = x->x_segs; + if (odd) nsegs--; + while (nsegs--) + { + segp->s_target = av++->a_w.w_float; + segp->s_delta = av++->a_w.w_float; + curve_cc(x, segp, av++->a_w.w_float); + segp++; + } + if (odd) + { + segp->s_target = av->a_w.w_float; + if (odd > 1) + segp->s_delta = av[1].a_w.w_float; + else + segp->s_delta = 0; + curve_cc(x, segp, 0.); + } + x->x_deltaset = 0; + x->x_target = x->x_segs->s_target; + x->x_curseg = x->x_segs; + x->x_retarget = 1; +} + +/* CHECKED no stop, pity... */ +#if 0 +static void curve_stop(t_curve *x) +{ + x->x_target = x->x_value; + x->x_nleft = 0; + x->x_retarget = 0; + x->x_nsegs = 0; + x->x_curseg = 0; +} +#endif + +static void curve_dsp(t_curve *x, t_signal **sp) +{ + float ksr = sp[0]->s_sr * 0.001; + if (ksr != x->x_ksr) + { + int nsegs = x->x_nsegs; + t_curveseg *segp = x->x_segs; + x->x_ksr = ksr; + while (nsegs--) + { + curve_cc(x, segp, segp->s_ccinput); + segp++; + } + } + dsp_add(curve_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); +} + +static void curve_free(t_curve *x) +{ + if (x->x_segs != x->x_segini) + freebytes(x->x_segs, x->x_size * sizeof(*x->x_segs)); + if (x->x_clock) clock_free(x->x_clock); +} + +static void curve_factor(t_curve *x, t_float f){ + if(f < -1.){ + x->x_ccinput = -1.; + } + else if(f > 1.){ + x->x_ccinput = 1.; + } + else{ + x->x_ccinput = f; + }; + + +}; + + +static void *curve_new(t_symbol *s, int argc, t_atom *argv) +{ + t_curve *x = (t_curve *)pd_new(curve_class); + t_float initval, param; + initval = PDCYCURVEINITVAL; + param = PDCYCURVEPARAM; + int argnum = 0; + while(argc > 0){ + t_symbol *curarg = atom_getsymbolarg(0, argc, argv); + if(curarg == &s_){//if curarg is a number + t_float argval = atom_getfloatarg(0, argc, argv); + switch(argnum){ + case 0: + initval = argval; + break; + case 1: + param = argval; + break; + default: + break; + }; + argnum++; + argc--; + argv++; + } + else{//curarg is a symbol + goto errstate; + }; + }; + x->x_value = x->x_target = initval; + curve_factor(x, param); + x->x_deltaset = 0; + x->x_ksr = sys_getsr() * 0.001; + x->x_nleft = 0; + x->x_retarget = 0; + x->x_size = CURVE_INISIZE; + x->x_nsegs = 0; + x->x_segs = x->x_segini; + x->x_curseg = 0; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + floatinlet_new((t_object *)x, &x->x_ccinput); + outlet_new((t_object *)x, &s_signal); + x->x_bangout = outlet_new((t_object *)x, &s_bang); + x->x_clock = clock_new(x, (t_method)curve_tick); + return (x); + errstate: + pd_error(x, "curve~: improper args"); + return NULL; +} + +void curve_tilde_setup(void) +{ + curve_class = class_new(gensym("curve~"), + (t_newmethod)curve_new, + (t_method)curve_free, + sizeof(t_curve), 0, + A_GIMME, 0); + sic_setup(curve_class, curve_dsp, SIC_NOMAINSIGNALIN); + class_addfloat(curve_class, curve_float); + class_addlist(curve_class, curve_list); + class_addmethod(curve_class, (t_method)curve_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(curve_class, (t_method)curve_factor, + gensym("factor"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/curve.gp b/externals/miXed/cyclone/sickle/curve.gp new file mode 100644 index 000000000..be5dacbe8 --- /dev/null +++ b/externals/miXed/cyclone/sickle/curve.gp @@ -0,0 +1,9 @@ +h(p) = (((p + 1e-20) * 1.2) ** .41) * .91 +f(p) = h(p) / (1 - h(p)) +g(x, p) = (exp(f(p) * x) - 1) / (exp(f(p)) - 1) +splot [0:1] [0:1] g(x, y) +pause -1 +plot [0:1] g(.25, x), g(.5, x), g(.75, x) +pause -1 +plot [0:1] g(x, 0), g(x, .25), g(x, .5), g(x, .75), g(x, 1) +print g(.5, 0) diff --git a/externals/miXed/cyclone/sickle/cycle.c b/externals/miXed/cyclone/sickle/cycle.c new file mode 100644 index 000000000..8acb36477 --- /dev/null +++ b/externals/miXed/cyclone/sickle/cycle.c @@ -0,0 +1,186 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "shared.h" +#include "common/loud.h" +#include "common/vefl.h" +#include "sickle/sic.h" + +#define CYCLE_TABSIZE 512 + +typedef struct _cycle +{ + t_sic x_sic; + double x_phase; + double x_conv; + t_symbol *x_name; + int x_offset; + t_float *x_table; + t_float *x_costable; + t_float x_usertable[CYCLE_TABSIZE + 1]; +} t_cycle; + +static t_class *cycle_class; + +static void cycle_gettable(t_cycle *x) +{ + x->x_table = 0; + if (x->x_name) + { + int tabsize = 0; + t_word *table = vefl_get(x->x_name, &tabsize, 1, (t_pd *)x); + /* CHECKED buffer is copied */ + if (table) + { + int tablePtr; + int samplesFromTable = tabsize - x->x_offset; + int samplesToCopy = samplesFromTable < CYCLE_TABSIZE ? + samplesFromTable : CYCLE_TABSIZE; + +// post("samplesFromTable: %d, samplesToCopy: %d, tabsize: %d", +// samplesFromTable, samplesToCopy, tabsize); + // copy the internal table from the external one as far as + // its size permits and fill the rest with zeroes. + for (tablePtr = 0; tablePtr < CYCLE_TABSIZE; tablePtr++) + { + if (samplesToCopy > 0) + { + x->x_usertable[tablePtr] = + table[tablePtr + x->x_offset].w_float; + samplesToCopy--; + } + else + { + x->x_usertable[tablePtr] = 0; + } + } + // the 513th sample + x->x_usertable[tablePtr] = (samplesFromTable > 0) ? + table[x->x_offset + CYCLE_TABSIZE].w_float : 0; + + x->x_table = x->x_usertable; + /* CHECKED else no complaint */ + } + } + else x->x_table = x->x_costable; + if (!x->x_table) + { + /* CHECKED (incompatible) cycle~ is disabled -- garbage is output */ + x->x_table = x->x_usertable; + memset(x->x_table, 0, (CYCLE_TABSIZE + 1) * sizeof(*x->x_table)); + } +} + +static void cycle_set(t_cycle *x, t_symbol *s, t_floatarg f) +{ + if (s && s != &s_) + { + x->x_name = s; + if ((x->x_offset = (int)f) < 0) + x->x_offset = 0; + } + else x->x_name = 0; + cycle_gettable(x); +} + +static t_int *cycle_perform(t_int *w) +{ + t_cycle *x = (t_cycle *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *out = (t_float *)(w[5]); + t_float *tab = x->x_table; + t_float *addr, f1, f2, frac; + double dphase = x->x_phase + SHARED_UNITBIT32; + double conv = x->x_conv; + int32_t normhipart; + t_shared_wrappy wrappy; + + wrappy.w_d = SHARED_UNITBIT32; + normhipart = wrappy.w_i[SHARED_HIOFFSET]; + + wrappy.w_d = dphase + CYCLE_TABSIZE * *in2++; /* CHECKED */ + dphase += *in1++ * conv; + addr = tab + (wrappy.w_i[SHARED_HIOFFSET] & (CYCLE_TABSIZE-1)); + wrappy.w_i[SHARED_HIOFFSET] = normhipart; + frac = wrappy.w_d - SHARED_UNITBIT32; + + while (--nblock) + { + wrappy.w_d = dphase + CYCLE_TABSIZE * *in2++; /* CHECKED */ + dphase += *in1++ * conv; + f1 = addr[0]; + f2 = addr[1]; + addr = tab + (wrappy.w_i[SHARED_HIOFFSET] & (CYCLE_TABSIZE-1)); + wrappy.w_i[SHARED_HIOFFSET] = normhipart; + *out++ = f1 + frac * (f2 - f1); + frac = wrappy.w_d - SHARED_UNITBIT32; + } + f1 = addr[0]; + f2 = addr[1]; + *out++ = f1 + frac * (f2 - f1); + + wrappy.w_d = SHARED_UNITBIT32 * CYCLE_TABSIZE; + normhipart = wrappy.w_i[SHARED_HIOFFSET]; + wrappy.w_d = dphase + (SHARED_UNITBIT32 * CYCLE_TABSIZE - SHARED_UNITBIT32); + wrappy.w_i[SHARED_HIOFFSET] = normhipart; + x->x_phase = wrappy.w_d - (SHARED_UNITBIT32 * CYCLE_TABSIZE); + return (w + 6); +} + +static void cycle_dsp(t_cycle *x, t_signal **sp) +{ + cycle_gettable(x); + x->x_conv = CYCLE_TABSIZE / sp[0]->s_sr; + dsp_add(cycle_perform, 5, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *cycle_new(t_symbol *s, int ac, t_atom *av) +{ + t_cycle *x = (t_cycle *)pd_new(cycle_class); + int i = (ac && av->a_type == A_FLOAT ? 1 : 0); + int tabsize = CYCLE_TABSIZE; + x->x_costable = sic_makecostable(&tabsize); + if (tabsize != CYCLE_TABSIZE) + { + loudbug_bug("cycle_new"); + pd_free((t_pd *)x); + return (0); + } + if (ac && av->a_type == A_FLOAT) + { + sic_inlet((t_sic *)x, 0, 0, 0, ac, av); + ac--, av++; + } + sic_newinlet((t_sic *)x, 0); + outlet_new((t_object *)x, &s_signal); + x->x_offset = 0; + if (ac && av->a_type == A_SYMBOL) + { + x->x_name = av->a_w.w_symbol; + ac--, av++; + if (ac && av->a_type == A_FLOAT) + if ((x->x_offset = (int)av->a_w.w_float) < 0) + x->x_offset = 0; + } + else x->x_name = 0; + x->x_table = 0; + x->x_phase = 0.; + x->x_conv = 0.; + return (x); +} + +void cycle_tilde_setup(void) +{ + cycle_class = class_new(gensym("cycle~"), + (t_newmethod)cycle_new, 0, + sizeof(t_cycle), 0, A_GIMME, 0); + sic_setup(cycle_class, cycle_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(cycle_class, (t_method)cycle_set, + gensym("set"), A_DEFSYMBOL, A_DEFFLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/dbtoa.c b/externals/miXed/cyclone/sickle/dbtoa.c new file mode 100644 index 000000000..a435a60bf --- /dev/null +++ b/externals/miXed/cyclone/sickle/dbtoa.c @@ -0,0 +1,64 @@ +/* + Copyright (c) 2016 Marco Matteo Markidis + mm.markidis@gmail.com + + For information on usage and redistribution, and for a DISCLAIMER OF ALL + WARRANTIES, see the file, "LICENSE.txt," in this distribution. + + Made while listening: + Evan Parker Electro-Acoustic Ensemble -- Hasselt +*/ +#include "m_pd.h" +#include <math.h> + +static t_class *dbtoa_class; + +typedef struct _dbtoa { + t_object x_obj; + t_inlet *x_inlet; + t_outlet *x_outlet; +} t_dbtoa; + + +void *dbtoa_new(void); +static t_int * dbtoa_perform(t_int *w); +static void dbtoa_dsp(t_dbtoa *x, t_signal **sp); + +static t_int * dbtoa_perform(t_int *w) +{ + int n = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + + + while(n--) + *out++ = pow(10.,*in++/20); + return (w + 5); +} + + +static void dbtoa_dsp(t_dbtoa *x, t_signal **sp) +{ + dsp_add(dbtoa_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +void *dbtoa_new(void) +{ + t_dbtoa *x = (t_dbtoa *)pd_new(dbtoa_class); + x->x_inlet = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + x->x_outlet = outlet_new(&x->x_obj, &s_signal); + return (void *)x; +} + + +void dbtoa_tilde_setup(void) { + dbtoa_class = class_new(gensym("dbtoa~"), + (t_newmethod) dbtoa_new, + 0, + sizeof (t_dbtoa), + CLASS_NOINLET, + 0); + + class_addmethod(dbtoa_class, (t_method) dbtoa_dsp, gensym("dsp"), 0); +} + diff --git a/externals/miXed/cyclone/sickle/delay.c b/externals/miXed/cyclone/sickle/delay.c new file mode 100644 index 000000000..b0ddd9d73 --- /dev/null +++ b/externals/miXed/cyclone/sickle/delay.c @@ -0,0 +1,101 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _delay +{ + t_sic x_sic; + t_float *x_buf; + t_float *x_bufend; + t_float *x_whead; + int x_maxsize; + int x_delsize; +} t_delay; + +static t_class *delay_class; + +#define DELAY_DEFMAXSIZE 512 + +static void delay_ft1(t_delay *x, t_floatarg f) +{ + x->x_delsize = (f > 0 ? (int)f : 0); + if (x->x_delsize > x->x_maxsize) + x->x_delsize = x->x_maxsize; /* CHECKED */ + /* CHECKED: all buffered values should be available */ +} + +static t_int *delay_perform(t_int *w) +{ + t_delay *x = (t_delay *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_float *buf = x->x_buf; + t_float *ep = x->x_bufend; + t_float *wp = x->x_whead; + if (x->x_delsize) + { + t_float *rp = wp - x->x_delsize; + if (rp < buf) rp += x->x_maxsize; + while (nblock--) + { + float f = *in++; + *out++ = *rp; + if (rp++ == ep) rp = buf; + *wp = f; + if (wp++ == ep) wp = buf; + } + } + else while (nblock--) + { + *out++ = *wp = *in++; + if (wp++ == ep) wp = buf; + } + x->x_whead = wp; + return (w + 5); +} + +static void delay_dsp(t_delay *x, t_signal **sp) +{ + memset(x->x_buf, 0, x->x_maxsize * sizeof(*x->x_buf)); /* CHECKED */ + x->x_whead = x->x_buf; + dsp_add(delay_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *delay_new(t_floatarg f1, t_floatarg f2) +{ + t_delay *x; + int maxsize = (f1 > 0 ? (int)f1 : DELAY_DEFMAXSIZE); + t_float *buf = (t_float *)getbytes(maxsize * sizeof(*buf)); + if (!buf) + return (0); + x = (t_delay *)pd_new(delay_class); + x->x_maxsize = maxsize; + x->x_buf = x->x_whead = buf; + x->x_bufend = buf + maxsize - 1; + x->x_delsize = (f2 > 0 ? (int)f2 : 0); + if (x->x_delsize > maxsize) + x->x_delsize = maxsize; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +static void delay_free(t_delay *x) +{ + if (x->x_buf) freebytes(x->x_buf, x->x_maxsize * sizeof(*x->x_buf)); +} + +void delay_tilde_setup(void) +{ + delay_class = class_new(gensym("delay~"), + (t_newmethod)delay_new, (t_method)delay_free, + sizeof(t_delay), 0, A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(delay_class, delay_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(delay_class, (t_method)delay_ft1, + gensym("ft1"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/delta.c b/externals/miXed/cyclone/sickle/delta.c new file mode 100644 index 000000000..145d6b7e4 --- /dev/null +++ b/externals/miXed/cyclone/sickle/delta.c @@ -0,0 +1,52 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _delta +{ + t_sic x_sic; + t_float x_last; +} t_delta; + +static t_class *delta_class; + +static t_int *delta_perform(t_int *w) +{ + t_delta *x = (t_delta *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_float last = x->x_last; + while (nblock--) + { + t_float f = *in++; + *out++ = f - last; + last = f; + } + x->x_last = last; + return (w + 5); +} + +static void delta_dsp(t_delta *x, t_signal **sp) +{ + dsp_add(delta_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *delta_new(void) +{ + t_delta *x = (t_delta *)pd_new(delta_class); + outlet_new((t_object *)x, &s_signal); + x->x_last = 0; + return (x); +} + +void delta_tilde_setup(void) +{ + delta_class = class_new(gensym("delta~"), + (t_newmethod)delta_new, 0, + sizeof(t_delta), 0, 0); + sic_setup(delta_class, delta_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/deltaclip.c b/externals/miXed/cyclone/sickle/deltaclip.c new file mode 100644 index 000000000..763a10067 --- /dev/null +++ b/externals/miXed/cyclone/sickle/deltaclip.c @@ -0,0 +1,86 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +#define DELTACLIP_DEFLO 0. +#define DELTACLIP_DEFHI 0. + +typedef struct _deltaclip +{ + t_sic x_sic; + t_float x_last; + t_inlet *x_lolet; + t_inlet *x_hilet; +} t_deltaclip; + +static t_class *deltaclip_class; + +static t_int *deltaclip_perform(t_int *w) +{ + t_deltaclip *x = (t_deltaclip *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *in3 = (t_float *)(w[5]); + t_float *out = (t_float *)(w[6]); + t_float last = x->x_last; + while (nblock--) + { + float f = *in1++; + float delta = f - last; + float lo = *in2++; + float hi = *in3++; + if (delta < lo) + f = last + lo; + else if (delta > hi) + f = last + hi; + *out++ = last = f; + } + x->x_last = last; + return (w + 7); +} + +static void deltaclip_dsp(t_deltaclip *x, t_signal **sp) +{ + dsp_add(deltaclip_perform, 6, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); +} + +static void deltaclip_reset(t_deltaclip *x){ + + pd_float((t_pd *)x->x_lolet, DELTACLIP_DEFLO); + pd_float((t_pd *)x->x_hilet, DELTACLIP_DEFHI); +} + +static void *deltaclip_free(t_deltaclip *x) +{ + inlet_free(x->x_lolet); + inlet_free(x->x_hilet); + return (void *)x; +} + + + +static void *deltaclip_new(t_symbol *s, int ac, t_atom *av) +{ + t_deltaclip *x = (t_deltaclip *)pd_new(deltaclip_class); + x->x_lolet = sic_inlet((t_sic *)x, 1, DELTACLIP_DEFLO, 0, ac, av); + x->x_hilet = sic_inlet((t_sic *)x, 2, DELTACLIP_DEFHI, 1, ac, av); + outlet_new((t_object *)x, &s_signal); + x->x_last = 0; + return (x); +} + +void deltaclip_tilde_setup(void) +{ + deltaclip_class = class_new(gensym("deltaclip~"), + (t_newmethod)deltaclip_new, (t_method)deltaclip_free, + sizeof(t_deltaclip), 0, A_GIMME, 0); + sic_setup(deltaclip_class, deltaclip_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(deltaclip_class, (t_method)deltaclip_reset, + gensym("reset"), 0); +} diff --git a/externals/miXed/cyclone/sickle/edge.c b/externals/miXed/cyclone/sickle/edge.c new file mode 100644 index 000000000..b206f6ba6 --- /dev/null +++ b/externals/miXed/cyclone/sickle/edge.c @@ -0,0 +1,106 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _edge +{ + t_sic x_sic; + t_float x_last; + int x_zeroleft; + int x_zerohit; + t_outlet *x_out2; + t_clock *x_clock; +} t_edge; + +static t_class *edge_class; + +static void edge_tick(t_edge *x) +{ + /* CHECKED both may fire simultaneously */ + if (x->x_zeroleft) + { + outlet_bang(((t_object *)x)->ob_outlet); + x->x_zeroleft = 0; + } + if (x->x_zerohit) + { + outlet_bang(x->x_out2); + x->x_zerohit = 0; + } +} + +static t_int *edge_perform(t_int *w) +{ + t_edge *x = (t_edge *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float last = x->x_last; + while (nblock--) + { + float f = *in++; + if (last == 0.) + { + if (f != 0.) + { + x->x_zeroleft = 1; + if (x->x_zerohit) + { + clock_delay(x->x_clock, 0); + x->x_last = in[nblock - 1]; + return (w + 4); + } + } + } + else + { + if (f == 0.) + { + x->x_zerohit = 1; + if (x->x_zeroleft) + { + clock_delay(x->x_clock, 0); + x->x_last = in[nblock - 1]; + return (w + 4); + } + } + } + last = f; + } + if (x->x_zeroleft || x->x_zerohit) clock_delay(x->x_clock, 0); + x->x_last = last; + return (w + 4); +} + +static void edge_dsp(t_edge *x, t_signal **sp) +{ + dsp_add(edge_perform, 3, x, sp[0]->s_n, sp[0]->s_vec); +} + +static void edge_free(t_edge *x) +{ + if (x->x_clock) clock_free(x->x_clock); +} + +static void *edge_new(t_floatarg f) +{ + t_edge *x = (t_edge *)pd_new(edge_class); + x->x_last = 0.; /* CHECKED fires at startup */ + x->x_zeroleft = x->x_zerohit = 0; + outlet_new((t_object *)x, &s_bang); + x->x_out2 = outlet_new((t_object *)x, &s_bang); + x->x_clock = clock_new(x, (t_method)edge_tick); + return (x); +} + +void edge_tilde_setup(void) +{ + edge_class = class_new(gensym("edge~"), + (t_newmethod)edge_new, + (t_method)edge_free, + sizeof(t_edge), 0, + A_DEFFLOAT, 0); + sic_setup(edge_class, edge_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/frameaccum.c b/externals/miXed/cyclone/sickle/frameaccum.c new file mode 100644 index 000000000..6038ae539 --- /dev/null +++ b/externals/miXed/cyclone/sickle/frameaccum.c @@ -0,0 +1,71 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" +#include "sickle/sic.h" + +#define FRAMEACCUM_INISIZE 512 + +typedef struct _frameaccum +{ + t_sic x_sic; + int x_size; + t_float *x_frame; + t_float x_frameini[FRAMEACCUM_INISIZE]; +} t_frameaccum; + +static t_class *frameaccum_class; + +static t_int *frameaccum_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *frame = (t_float *)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) *out++ = (*frame++ += *in++); + return (w + 5); +} + +static void frameaccum_dsp(t_frameaccum *x, t_signal **sp) +{ + int nblock = sp[0]->s_n; + if (nblock > x->x_size) + x->x_frame = grow_nodata(&nblock, &x->x_size, x->x_frame, + FRAMEACCUM_INISIZE, x->x_frameini, + sizeof(*x->x_frame)); + memset(x->x_frame, 0, nblock * sizeof(*x->x_frame)); /* CHECKED */ + dsp_add(frameaccum_perform, 4, nblock, x->x_frame, + sp[0]->s_vec, sp[1]->s_vec); +} + +static void frameaccum_free(t_frameaccum *x) +{ + if (x->x_frame != x->x_frameini) + freebytes(x->x_frame, x->x_size * sizeof(*x->x_frame)); +} + +static void *frameaccum_new(t_symbol *s, int ac, t_atom *av) +{ + t_frameaccum *x = (t_frameaccum *)pd_new(frameaccum_class); + int size; + x->x_size = FRAMEACCUM_INISIZE; + x->x_frame = x->x_frameini; + if ((size = sys_getblksize()) > FRAMEACCUM_INISIZE) + x->x_frame = grow_nodata(&size, &x->x_size, x->x_frame, + FRAMEACCUM_INISIZE, x->x_frameini, + sizeof(*x->x_frame)); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void frameaccum_tilde_setup(void) +{ + frameaccum_class = class_new(gensym("frameaccum~"), + (t_newmethod)frameaccum_new, + (t_method)frameaccum_free, + sizeof(t_frameaccum), 0, 0); + sic_setup(frameaccum_class, frameaccum_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/framedelta.c b/externals/miXed/cyclone/sickle/framedelta.c new file mode 100644 index 000000000..b898444ca --- /dev/null +++ b/externals/miXed/cyclone/sickle/framedelta.c @@ -0,0 +1,76 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/grow.h" +#include "sickle/sic.h" + +#define FRAMEDELTA_INISIZE 512 + +typedef struct _framedelta +{ + t_sic x_sic; + int x_size; + t_float *x_frame; + t_float x_frameini[FRAMEDELTA_INISIZE]; +} t_framedelta; + +static t_class *framedelta_class; + +static t_int *framedelta_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *frame = (t_float *)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) + { + float f = *in++; + *out++ = f - *frame; /* CHECKME */ + *frame++ = f; + } + return (w + 5); +} + +static void framedelta_dsp(t_framedelta *x, t_signal **sp) +{ + int nblock = sp[0]->s_n; + if (nblock > x->x_size) + x->x_frame = grow_nodata(&nblock, &x->x_size, x->x_frame, + FRAMEDELTA_INISIZE, x->x_frameini, + sizeof(*x->x_frame)); + memset(x->x_frame, 0, nblock * sizeof(*x->x_frame)); /* CHECKME */ + dsp_add(framedelta_perform, 4, nblock, x->x_frame, + sp[0]->s_vec, sp[1]->s_vec); +} + +static void framedelta_free(t_framedelta *x) +{ + if (x->x_frame != x->x_frameini) + freebytes(x->x_frame, x->x_size * sizeof(*x->x_frame)); +} + +static void *framedelta_new(t_symbol *s, int ac, t_atom *av) +{ + t_framedelta *x = (t_framedelta *)pd_new(framedelta_class); + int size; + x->x_size = FRAMEDELTA_INISIZE; + x->x_frame = x->x_frameini; + if ((size = sys_getblksize()) > FRAMEDELTA_INISIZE) + x->x_frame = grow_nodata(&size, &x->x_size, x->x_frame, + FRAMEDELTA_INISIZE, x->x_frameini, + sizeof(*x->x_frame)); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void framedelta_tilde_setup(void) +{ + framedelta_class = class_new(gensym("framedelta~"), + (t_newmethod)framedelta_new, + (t_method)framedelta_free, + sizeof(t_framedelta), 0, 0); + sic_setup(framedelta_class, framedelta_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/index.c b/externals/miXed/cyclone/sickle/index.c new file mode 100644 index 000000000..99ac011f3 --- /dev/null +++ b/externals/miXed/cyclone/sickle/index.c @@ -0,0 +1,110 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER: 'click' method */ + +#include <string.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" +#include "sickle/arsic.h" + +#define INDEX_MAXCHANNELS 4 /* LATER implement arsic resizing feature */ + +typedef struct _index +{ + t_arsic x_arsic; + int x_maxchannels; + int x_effchannel; /* effective channel (clipped reqchannel) */ + int x_reqchannel; /* requested channel */ +} t_index; + +static t_class *index_class; + +static void index_set(t_index *x, t_symbol *s) +{ + arsic_setarray((t_arsic *)x, s, 1); +} + +static t_int *index_perform(t_int *w) +{ + t_arsic *sic = (t_arsic *)(w[1]); + int nblock = (int)(w[2]); + t_float *out = (t_float *)(w[4]); + if (sic->s_playable) + { + t_index *x = (t_index *)sic; + t_float *xin = (t_float *)(w[3]); + int index, maxindex = sic->s_vecsize - 1; + t_word *vp = sic->s_vectors[x->x_effchannel]; + if (vp) /* handle array swapping on the fly via ft1 */ + { + while (nblock--) + { + index = (int)(*xin++ + 0.5); + if (index < 0) + index = 0; + else if (index > maxindex) + index = maxindex; + *out++ = vp[index].w_float; + } + } + else while (nblock--) *out++ = 0; + } + else while (nblock--) *out++ = 0; + return (w + 5); +} + +static void index_ft1(t_index *x, t_floatarg f) +{ + if ((x->x_reqchannel = (f > 1 ? (int)f - 1 : 0)) > x->x_maxchannels) + x->x_effchannel = x->x_maxchannels - 1; + else + x->x_effchannel = x->x_reqchannel; +} + +static void index_dsp(t_index *x, t_signal **sp) +{ + t_arsic *sic = (t_arsic *)x; + arsic_dsp(sic, sp, index_perform, sic->s_mononame != 0); +} + +static void index_free(t_index *x) +{ + arsic_free((t_arsic *)x); +} + +static void *index_new(t_symbol *s, t_floatarg f) +{ + int ch = (f > 0 ? (int)f : 0); + /* two signals: index input, value output */ + t_index *x = (t_index *)arsic_new(index_class, s, + (ch ? INDEX_MAXCHANNELS : 0), 2, 0); + if (x) + { + if (ch > INDEX_MAXCHANNELS) + ch = INDEX_MAXCHANNELS; + x->x_maxchannels = (ch ? INDEX_MAXCHANNELS : 1); + x->x_effchannel = x->x_reqchannel = (ch ? ch - 1 : 0); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_signal); + } + return (x); +} + +void index_tilde_setup(void) +{ + index_class = class_new(gensym("index~"), + (t_newmethod)index_new, + (t_method)index_free, + sizeof(t_index), 0, + A_DEFSYM, A_DEFFLOAT, 0); + arsic_setup(index_class, index_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(index_class, (t_method)index_set, + gensym("set"), A_SYMBOL, 0); + class_addmethod(index_class, (t_method)index_ft1, + gensym("ft1"), A_FLOAT, 0); +// logpost(NULL, 4, "this is cyclone/index~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/sickle/kink.c b/externals/miXed/cyclone/sickle/kink.c new file mode 100644 index 000000000..86bc81d93 --- /dev/null +++ b/externals/miXed/cyclone/sickle/kink.c @@ -0,0 +1,62 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* CHECKED negative float in 2nd inlet: "illegal slope value %f", + but no complaints for signal input -- this is impossible in Pd. + The only thing we could do (and a bit stupid one) would be to + clock this exception out from the perf routine. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +#define KINK_DEFSLOPE 1.0 + +typedef t_sic t_kink; +static t_class *kink_class; + +static t_int *kink_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) + { + float iph = *in1++; + float slope = *in2++; + float oph = iph * slope; + if (oph > .5) + { + slope = 1. / (slope + slope); /* x(y=.5) */ + if (slope == 1.) + *out++ = 0; /* CHECKED */ + else + *out++ = (iph - slope) / (2. - (slope + slope)) + .5; + } + else *out++ = oph; + } + return (w + 5); +} + +static void kink_dsp(t_kink *x, t_signal **sp) +{ + dsp_add(kink_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *kink_new(t_symbol *s, int ac, t_atom *av) +{ + t_kink *x = (t_kink *)pd_new(kink_class); + sic_inlet((t_sic *)x, 1, KINK_DEFSLOPE, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void kink_tilde_setup(void) +{ + kink_class = class_new(gensym("kink~"), + (t_newmethod)kink_new, 0, + sizeof(t_kink), 0, A_GIMME, 0); + sic_setup(kink_class, kink_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/linedrive.c b/externals/miXed/cyclone/sickle/linedrive.c new file mode 100644 index 000000000..d9243dbd0 --- /dev/null +++ b/externals/miXed/cyclone/sickle/linedrive.c @@ -0,0 +1,141 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "common/fitter.h" + +#if defined(_WIN32) || defined(__APPLE__) +#define logf log +#define expf exp +#endif + +#define LINEDRIVE_MININPUT .5 /* CHECKED */ +#define LINEDRIVE_MINCURVE 1. /* CHECKED */ + +#define LINEDRIVE_INPUTEPSILON 1e-19f +#define LINEDRIVE_CURVEEPSILON 1e-19f + +typedef struct _linedrive +{ + t_object x_ob; + t_float x_usermaxin; + t_float x_usermaxout; + t_float x_usercurve; + t_float x_maxin; + t_float x_maxout; + t_float x_expcoef; + t_float x_lincoef; + int x_islinear; + int x_iscompatible; + t_atom x_outvec[2]; +} t_linedrive; + +static t_class *linedrive_class; + +static void linedrive_float(t_linedrive *x, t_floatarg f) +{ + t_float outval; + if (x->x_iscompatible) + { + if (f < LINEDRIVE_MININPUT) /* CHECKED */ + outval = 0.; + else if (f >= x->x_maxin) /* CHECKED */ + outval = x->x_maxin; + else + outval = expf((f - x->x_maxin) * x->x_expcoef) * x->x_maxout; + } + else + { + if (x->x_islinear) + outval = x->x_maxout + (f - x->x_maxin) * x->x_lincoef; + else if (f < -LINEDRIVE_INPUTEPSILON) + outval = -expf((-f - x->x_maxin) * x->x_expcoef) * x->x_maxout; + else if (f > LINEDRIVE_INPUTEPSILON) + outval = expf((f - x->x_maxin) * x->x_expcoef) * x->x_maxout; + else + outval = 0.; + } + SETFLOAT(x->x_outvec, outval); + outlet_list(((t_object *)x)->ob_outlet, 0, 2, x->x_outvec); +} + +static void linedrive_calculate(t_linedrive *x) +{ + t_float maxin = x->x_usermaxin; + t_float maxout = x->x_usermaxout; + t_float curve = x->x_usercurve; + if (x->x_iscompatible = fittermax_get()) + { + /* CHECKED */ + x->x_maxin = (maxin > LINEDRIVE_MININPUT ? maxin : LINEDRIVE_MININPUT); + /* CHECKED */ + x->x_expcoef = (curve > LINEDRIVE_MINCURVE ? logf(curve) : 0.); + x->x_lincoef = 0.; + x->x_islinear = 0; + } + else + { + if (maxin >= -LINEDRIVE_INPUTEPSILON && maxin <= LINEDRIVE_INPUTEPSILON) + { + x->x_maxin = 0.; + x->x_expcoef = 0.; + x->x_lincoef = 0.; + x->x_islinear = 1; + } + else if (curve >= (1. - LINEDRIVE_CURVEEPSILON) && + curve <= (1. + LINEDRIVE_CURVEEPSILON)) + { + x->x_maxin = maxin; + x->x_expcoef = 0.; + x->x_lincoef = maxout / maxin; + x->x_islinear = 1; + } + else + { + if (maxin < 0.) + { + x->x_maxin = -maxin; + maxout = -maxout; + } + else x->x_maxin = maxin; + if (curve < LINEDRIVE_CURVEEPSILON) + curve = LINEDRIVE_CURVEEPSILON; + x->x_expcoef = logf(curve); + x->x_lincoef = 0.; + x->x_islinear = 0; + } + } + x->x_maxout = maxout; /* CHECKED negative value accepted and used */ +} + +static void *linedrive_new(t_floatarg maxin, t_floatarg maxout, + t_floatarg curve, t_floatarg deltime) +{ + t_linedrive *x = (t_linedrive *)pd_new(linedrive_class); + x->x_usermaxin = maxin; + x->x_usermaxout = maxout; + x->x_usercurve = curve; + linedrive_calculate(x); + SETFLOAT(&x->x_outvec[1], deltime); /* CHECKED any value accepted */ + floatinlet_new((t_object *)x, &x->x_outvec[1].a_w.w_float); + outlet_new((t_object *)x, &s_list); + return (x); +} + +static void linedrive_fitter(void) +{ + /* FIXME for all objects in scope do recalculate */ +} + +void linedrive_setup(void) +{ + linedrive_class = class_new(gensym("linedrive"), + (t_newmethod)linedrive_new, 0, + sizeof(t_linedrive), 0, + A_DEFFLOAT, A_DEFFLOAT, + A_DEFFLOAT, A_DEFFLOAT, 0); + class_addfloat(linedrive_class, linedrive_float); + fitter_setup(linedrive_class, linedrive_fitter); +} diff --git a/externals/miXed/cyclone/sickle/log.c b/externals/miXed/cyclone/sickle/log.c new file mode 100644 index 000000000..0a1407075 --- /dev/null +++ b/externals/miXed/cyclone/sickle/log.c @@ -0,0 +1,74 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define logf log +#endif + +#define LOG_MININPUT 1e-10 /* CHECKED */ + +typedef struct _log +{ + t_sic x_sic; + t_float x_rcplogbase; /* LATER consider using double (and log()) */ +} t_log; + +static t_class *log_class; + +static void log_ft1(t_log *x, t_floatarg f) +{ + x->x_rcplogbase = (f == 0. ? 1. : /* CHECKED no protection against NaNs */ + (f == 1. ? 0. : /* CHECKED */ + 1. / logf(f))); +} + +static t_int *log_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + t_float rcplogbase = *(t_float *)(w[4]); + if (rcplogbase != 0.) + { + while (nblock--) + { + float f = *in++; + if (f < LOG_MININPUT) + f = LOG_MININPUT; /* CHECKED */ + *out++ = logf(f) * rcplogbase; + } + } + else while (nblock--) *out++ = 0.; + return (w + 5); +} + +static void log_dsp(t_log *x, t_signal **sp) +{ + dsp_add(log_perform, 4, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec, + &x->x_rcplogbase); +} + +static void *log_new(t_floatarg f) +{ + t_log *x = (t_log *)pd_new(log_class); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_signal); + log_ft1(x, f); + return (x); +} + +void log_tilde_setup(void) +{ + log_class = class_new(gensym("log~"), + (t_newmethod)log_new, 0, + sizeof(t_log), 0, A_DEFFLOAT, 0); + sic_setup(log_class, log_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(log_class, (t_method)log_ft1, + gensym("ft1"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/lookup.c b/externals/miXed/cyclone/sickle/lookup.c new file mode 100644 index 000000000..e6fd1427e --- /dev/null +++ b/externals/miXed/cyclone/sickle/lookup.c @@ -0,0 +1,99 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER reconsider making float/int conversions + more compatible (and less useful). */ + +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" +#include "sickle/arsic.h" + +typedef t_arsic t_lookup; +static t_class *lookup_class; + +#define LOOKUP_DEFSIZE 512 + +static void lookup_set(t_lookup *x, t_symbol *s) +{ + arsic_setarray((t_arsic *)x, s, 1); +} + +static t_int *lookup_perform(t_int *w) +{ + t_arsic *sic = (t_arsic *)(w[1]); + int nblock = (int)(w[2]); + t_float *out = (t_float *)(w[6]); + if (sic->s_playable) + { + t_float *xin = (t_float *)(w[3]); + t_float *oin = (t_float *)(w[4]); + t_float *sin = (t_float *)(w[5]); + int vecsize = sic->s_vecsize; + t_word *vec = sic->s_vectors[0]; /* playable implies nonzero (mono) */ + while (nblock--) + { + float off = *oin++; /* msp: converted to int (if not a signal) */ + int siz = (int)*sin++ - 1; /* msp: converted to int (signal too) */ + float pos; +// pos = (siz > 0 ? off + siz * (*xin++ + 1.0) * 0.5 : off); // range: off - (off + siz) + pos = (siz > 0 ? off + (siz - off) * (*xin++ + 1.0) * 0.5 : off); // range: off - siz + int ndx = (int)pos; + int ndx1 = ndx + 1; + if (ndx1 > 0 && ndx1 < vecsize) + { + float val = vec[ndx].w_float; + *out++ = val + (vec[ndx1].w_float - val) * (pos - ndx); + } + /* CHECKED: */ + else if (ndx1 == 0) *out++ = vec[0].w_float * (pos + 1.0); + else if (ndx1 == vecsize) *out++ = vec[ndx].w_float * (ndx1 - pos); + else *out++ = 0; + } + } + else while (nblock--) *out++ = 0; + return (w + 7); +} + +static void lookup_dsp(t_lookup *x, t_signal **sp) +{ + arsic_dsp((t_arsic *)x, sp, lookup_perform, 1); +} + +static void lookup_free(t_lookup *x) +{ + arsic_free((t_arsic *)x); +} + +static void *lookup_new(t_symbol *s, t_floatarg f1, t_floatarg f2) +{ + /* CHECKED: lookup~ always uses the first channel in a multi-channel buffer~ + (as the refman says). */ + /* three auxiliary signals: amplitude, offset and size inputs */ + t_lookup *x = (t_lookup *)arsic_new(lookup_class, s, 0, 0, 3); + if (x) + { + arsic_setminsize((t_arsic *)x, 2); + if (f1 < 0) f1 = 0; + if (f2 <= 0) f2 = LOOKUP_DEFSIZE; + sic_newinlet((t_sic *)x, f1); + sic_newinlet((t_sic *)x, f2); + outlet_new((t_object *)x, &s_signal); + } + return (x); +} + +void lookup_tilde_setup(void) +{ + lookup_class = class_new(gensym("lookup~"), + (t_newmethod)lookup_new, + (t_method)lookup_free, + sizeof(t_lookup), 0, + A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, 0); + arsic_setup(lookup_class, lookup_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(lookup_class, (t_method)lookup_set, + gensym("set"), A_SYMBOL, 0); +// logpost(NULL, 4, "this is cyclone/lookup~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/sickle/lores.c b/externals/miXed/cyclone/sickle/lores.c new file mode 100644 index 000000000..2fe71ee3f --- /dev/null +++ b/externals/miXed/cyclone/sickle/lores.c @@ -0,0 +1,109 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* The general two-pole resonator (csound's lp2). For a nice analysis + see section 9.1.3 of ``Introduction to Digital Filters'' by Smith. */ + +/* CHECKME if creation args (or defaults) restored after signal disconnection */ + +#include <math.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define expf exp +#define cosf cos +#endif + +/* CHECKME negative resonance */ +/* CHECKME max resonance, esp. at low freqs (watch out, gain not normalized) */ +#define LORES_MAXRESONANCE (1. - 1e-20) +#define LORES_MINOMEGA .0001 /* CHECKME */ +#define LORES_MAXOMEGA SHARED_PI /* CHECKME */ + +typedef struct _lores +{ + t_sic x_sic; + float x_srcoef; + float x_ynm1; + float x_ynm2; +} t_lores; + +static t_class *lores_class; + +static void lores_clear(t_lores *x) +{ + x->x_ynm1 = x->x_ynm2 = 0.; +} + +/* LATER make ready for optional audio-rate modulation + (separate scalar case routines, use sic_makecostable(), etc.) */ +static t_int *lores_perform(t_int *w) +{ + t_lores *x = (t_lores *)(w[1]); + int nblock = (int)(w[2]); + t_float *xin = (t_float *)(w[3]); + t_float fin0 = *(t_float *)(w[4]); + t_float rin0 = *(t_float *)(w[5]); + t_float *out = (t_float *)(w[6]); + float ynm1 = x->x_ynm1; + float ynm2 = x->x_ynm2; + /* CHECKME sampled once per block */ + float omega = fin0 * x->x_srcoef; + float radius, c1, c2, b0; + if (omega < LORES_MINOMEGA) + omega = LORES_MINOMEGA; + else if (omega > LORES_MAXOMEGA) + omega = LORES_MAXOMEGA; + if (rin0 > LORES_MAXRESONANCE) + rin0 = LORES_MAXRESONANCE; + /* radius = pow(base, rin0 - 1), which maps rin0 of 0..1 to radius + of 1/base..1, where base=exp(.125), and 1/base=.882496902585 */ + radius = expf(rin0 * .125) * .882496902585; + c1 = 2. * radius * cos(omega); + c2 = radius * radius; + b0 = 1. - c1 + c2; + while (nblock--) + { + float yn; + *out++ = yn = b0 * *xin++ + c1 * ynm1 - c2 * ynm2; + ynm2 = ynm1; + ynm1 = yn; + } + /* LATER rethink */ + x->x_ynm1 = (PD_BIGORSMALL(ynm1) ? 0. : ynm1); + x->x_ynm2 = (PD_BIGORSMALL(ynm2) ? 0. : ynm2); + return (w + 7); +} + +static void lores_dsp(t_lores *x, t_signal **sp) +{ + x->x_srcoef = SHARED_2PI / sp[0]->s_sr; + lores_clear(x); + dsp_add(lores_perform, 6, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); +} + +static void *lores_new(t_floatarg f1, t_floatarg f2) +{ + t_lores *x = (t_lores *)pd_new(lores_class); + x->x_srcoef = SHARED_2PI / sys_getsr(); + sic_newinlet((t_sic *)x, f1); + sic_newinlet((t_sic *)x, f2); + outlet_new((t_object *)x, &s_signal); + lores_clear(x); + return (x); +} + +void lores_tilde_setup(void) +{ + lores_class = class_new(gensym("lores~"), + (t_newmethod)lores_new, 0, + sizeof(t_lores), 0, + A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(lores_class, lores_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(lores_class, (t_method)lores_clear, gensym("clear"), 0); +} diff --git a/externals/miXed/cyclone/sickle/matrix.c b/externals/miXed/cyclone/sickle/matrix.c new file mode 100644 index 000000000..a1c1ef460 --- /dev/null +++ b/externals/miXed/cyclone/sickle/matrix.c @@ -0,0 +1,591 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "common/fitter.h" +#include "unstable/fragile.h" +#include "sickle/sic.h" + +#ifdef KRZYSZCZ +//#define MATRIX_DEBUG +#endif + +#define MATRIX_DEFGAIN 0. /* CHECKED */ +#define MATRIX_DEFRAMP 0. /* CHECKED */ + +#define MATRIX_GAINEPSILON 1e-20f +#define MATRIX_MINRAMP .001 /* LATER rethink */ + +typedef struct _matrix +{ + t_sic x_sic; + int x_ninlets; + int x_noutlets; + int x_nblock; + int x_maxblock; + t_float **x_ivecs; + t_float **x_ovecs; + t_float **x_osums; + int x_ncells; + int *x_cells; + t_outlet *x_dumpout; + /* The following fields are specific to nonbinary mode, i.e. we keep them + unallocated in binary mode. This is CHECKED to be incompatible: c74 + always accepts (and reports) gains and ramps, although they are actually + meaningless in binary mode, and switching modes is not supported. */ + float x_defgain; + float *x_gains; /* target gains */ + float x_deframp; + float *x_ramps; + float x_ksr; + float *x_coefs; /* current coefs */ + float *x_incrs; + float *x_bigincrs; + int *x_remains; +} t_matrix; + +typedef void (*t_matrix_cellfn)(t_matrix *x, int indx, int ondx, + int onoff, float gain); + +static t_class *matrix_class; +static t_symbol *matrixps_matrixtilde; + +/* called only in nonbinary mode; LATER deal with changing nblock/ksr */ +static void matrix_retarget(t_matrix *x, int cellndx) +{ + float target = (x->x_cells[cellndx] ? x->x_gains[cellndx] : 0.); + if (x->x_ramps[cellndx] < MATRIX_MINRAMP) + { + x->x_coefs[cellndx] = target; + x->x_remains[cellndx] = 0; + } + else + { + x->x_remains[cellndx] = + x->x_ramps[cellndx] * x->x_ksr + 0.5; /* LATER rethink */ + x->x_incrs[cellndx] = + (target - x->x_coefs[cellndx]) / (float)x->x_remains[cellndx]; + x->x_bigincrs[cellndx] = x->x_nblock * x->x_incrs[cellndx]; + } +} + +static void matrix_float(t_matrix *x, t_float f) +{ + loud_nomethod((t_pd *)x, &s_float); /* CHECKED */ +} + +static void matrix_list(t_matrix *x, t_symbol *s, int ac, t_atom *av) +{ + int indx, ondx, cellndx, onoff; + float gain; + if (ac < 3) + return; /* CHECKED list silently ignored if ac < 3 */ + /* CHECKED floats silently clipped, symbols converted to 0 */ + indx = (av->a_type == A_FLOAT ? (int)av->a_w.w_float : 0); + if (indx < 0 || indx >= x->x_ninlets) + { /* CHECKED */ + loud_error((t_pd *)x, "invalid inlet number %d", indx); + return; + } + ac--; av++; + /* CHECKED floats silently clipped, symbols converted to 0 */ + ondx = (av->a_type == A_FLOAT ? (int)av->a_w.w_float : 0); + if (ondx < 0 || ondx >= x->x_noutlets) + { /* CHECKED */ + loud_error((t_pd *)x, "invalid outlet number %d", ondx); + return; + } + cellndx = indx * x->x_noutlets + ondx; + ac--; av++; + /* CHECKED negative gain used in nonbinary mode, accepted as 1 in binary */ + gain = (av->a_type == A_FLOAT ? av->a_w.w_float : 0.); + onoff = (gain < -MATRIX_GAINEPSILON || gain > MATRIX_GAINEPSILON); + x->x_cells[cellndx] = onoff; + if (x->x_gains) + { + if (onoff) /* CHECKME */ + x->x_gains[cellndx] = gain; + ac--; av++; + if (ac) + { + float ramp = (av->a_type == A_FLOAT ? av->a_w.w_float : 0.); + x->x_ramps[cellndx] = (ramp < MATRIX_MINRAMP ? 0. : ramp); + } + matrix_retarget(x, cellndx); + } +} + +static void matrix_clear(t_matrix *x) +{ + int i; + for (i = 0; i < x->x_ncells; i++) + x->x_cells[i] = 0; +} + +static void matrix_set(t_matrix *x, t_floatarg f1, t_floatarg f2) +{ + int i, onoff; + float gain = f1; + static int warned = 0; + if (fittermax_get() && !warned) + { + fittermax_warning(*(t_pd *)x, "'set' not supported in Max"); + warned = 1; + } + onoff = (gain < -MATRIX_GAINEPSILON || gain > MATRIX_GAINEPSILON); + for (i = 0; i < x->x_ncells; i++) + x->x_cells[i] = onoff; + if (x->x_gains) + { + float ramp = (f2 < MATRIX_MINRAMP ? 0. : f2); + for (i = 0; i < x->x_ncells; i++) + { + if (onoff) /* LATER rethink */ + x->x_gains[i] = gain; + x->x_ramps[i] = ramp; + matrix_retarget(x, i); + } + } +} + +/* CHECKED c74's refman and help patch are wrong about int pairs -- + the actual syntax is "[dis]connect indx ondx1 [ondx2 [ondx3..." */ +static void matrix_connect(t_matrix *x, t_symbol *s, int ac, t_atom *av) +{ + int onoff = (s == gensym("connect")), indx, celloffset; + if (ac < 2) + return; /* CHECKED */ + /* CHECKED floats silently clipped, symbols converted to 0 */ + indx = (av->a_type == A_FLOAT ? (int)av->a_w.w_float : 0); + if (indx < 0 || indx >= x->x_ninlets) + { /* CHECKED */ + loud_error((t_pd *)x, "invalid inlet number %d", indx); + return; + } + celloffset = indx * x->x_noutlets; + ac--; av++; + while (ac) + { + /* CHECKED floats silently clipped, symbols converted to 0 */ + int cellndx, ondx = (av->a_type == A_FLOAT ? (int)av->a_w.w_float : 0); + if (ondx < 0 || ondx >= x->x_noutlets) + { /* CHECKED */ + loud_error((t_pd *)x, "invalid outlet number %d", ondx); + return; + } + cellndx = celloffset + ondx; + x->x_cells[cellndx] = onoff; + if (x->x_gains) + matrix_retarget(x, cellndx); + ac--; av++; + } +} + +/* CHECKED active ramps are not retargeted */ +static void matrix_ramp(t_matrix *x, t_floatarg f) +{ + if (x->x_ramps) + { + int i; + x->x_deframp = (f < MATRIX_MINRAMP ? 0. : f); + /* CHECKED cell-specific ramps are lost */ + for (i = 0; i < x->x_ncells; i++) + x->x_ramps[i] = x->x_deframp; + } +} + +static t_int *matrix01_perform(t_int *w) +{ + t_matrix *x = (t_matrix *)(w[1]); + int nblock = (int)(w[2]); + t_float **ivecs = x->x_ivecs; + t_float **ovecs = x->x_ovecs; + t_float **osums = x->x_osums; + int *cellp = x->x_cells; + int indx = x->x_ninlets; + while (indx--) + { + t_float *ivec = *ivecs++; + t_float **ovecp = osums; + int ondx = x->x_noutlets; + while (ondx--) + { + if (*cellp++) + { + t_float *in = ivec; + t_float *out = *ovecp; + int sndx = nblock; + while (sndx--) + *out++ += *in++; + } + ovecp++; + } + } + osums = x->x_osums; + indx = x->x_noutlets; + while (indx--) + { + t_float *in = *osums++; + t_float *out = *ovecs++; + int sndx = nblock; + while (sndx--) + { + *out++ = *in; + *in++ = 0.; + } + } + return (w + 3); +} + +static t_int *matrixnb_perform(t_int *w) +{ + t_matrix *x = (t_matrix *)(w[1]); + int nblock = (int)(w[2]); + t_float **ivecs = x->x_ivecs; + t_float **ovecs = x->x_ovecs; + t_float **osums = x->x_osums; + int *cellp = x->x_cells; + float *gainp = x->x_gains; + float *coefp = x->x_coefs; + float *incrp = x->x_incrs; + float *bigincrp = x->x_bigincrs; + int *nleftp = x->x_remains; + int indx = x->x_ninlets; + while (indx--) + { + t_float *ivec = *ivecs++; + t_float **ovecp = osums; + int ondx = x->x_noutlets; + while (ondx--) + { + t_float *in = ivec; + t_float *out = *ovecp; + float nleft = *nleftp; + int sndx = nblock; + if (nleft >= nblock) + { + float coef = *coefp; + float incr = *incrp; + if ((*nleftp -= nblock) == 0) + *coefp = (*cellp ? *gainp : 0.); + else + *coefp += *bigincrp; + while (sndx--) + *out++ += *in++ * coef, coef += incr; + } + else if (nleft > 0) + { + float coef = *coefp; + float incr = *incrp; + sndx -= nleft; + do + *out++ += *in++ * coef, coef += incr; + while (--nleft); + if (*cellp) + { + coef = *coefp = *gainp; + while (sndx--) + *out++ += *in++ * coef; + } + else *coefp = 0.; + *nleftp = 0; + } + else if (*cellp) + { + float coef = *coefp; + while (sndx--) + *out++ += *in++ * coef; + } + cellp++; + ovecp++; + gainp++; + coefp++; + incrp++; + bigincrp++; + nleftp++; + } + } + osums = x->x_osums; + indx = x->x_noutlets; + while (indx--) + { + t_float *in = *osums++; + t_float *out = *ovecs++; + int sndx = nblock; + while (sndx--) + { + *out++ = *in; + *in++ = 0.; + } + } + return (w + 3); +} + +static void matrix_dsp(t_matrix *x, t_signal **sp) +{ + int i, nblock = sp[0]->s_n; + t_float **vecp = x->x_ivecs; + t_signal **sigp = sp; + for (i = 0; i < x->x_ninlets; i++) + *vecp++ = (*sigp++)->s_vec; + vecp = x->x_ovecs; + for (i = 0; i < x->x_noutlets; i++) + *vecp++ = (*sigp++)->s_vec; + if (nblock != x->x_nblock) + { + if (nblock > x->x_maxblock) + { + size_t oldsize = x->x_maxblock * sizeof(*x->x_osums[i]), + newsize = nblock * sizeof(*x->x_osums[i]); + for (i = 0; i < x->x_noutlets; i++) + x->x_osums[i] = resizebytes(x->x_osums[i], oldsize, newsize); + x->x_maxblock = nblock; + } + x->x_nblock = nblock; + } + if (x->x_gains) + { + x->x_ksr = sp[0]->s_sr * .001; + dsp_add(matrixnb_perform, 2, x, nblock); + } + else dsp_add(matrix01_perform, 2, x, nblock); +} + +static void matrix_cellout(t_matrix *x, int indx, int ondx, + int onoff, float gain) +{ + t_atom atout[3]; + SETFLOAT(&atout[0], (t_float)indx); + SETFLOAT(&atout[1], (t_float)ondx); + if (onoff) + SETFLOAT(&atout[2], gain); + else + SETFLOAT(&atout[2], 0.); + outlet_list(x->x_dumpout, &s_list, 3, atout); +} + +static void matrix_cellprint(t_matrix *x, int indx, int ondx, + int onoff, float gain) +{ + post("%d %d %g", indx, ondx, (onoff ? gain : 0.)); +} + +#ifdef MATRIX_DEBUG +static void matrix_celldebug(t_matrix *x, int indx, int ondx, + int onoff, float gain) +{ + loudbug_post("%d %d %g", indx, ondx, gain); +} +#endif + +static void matrix_report(t_matrix *x, float *gains, float defgain, + t_matrix_cellfn cellfn) +{ + if (gains) + { + int *cellp = x->x_cells; + float *gp = gains; + int indx, ondx; + for (indx = 0; indx < x->x_ninlets; indx++) + for (ondx = 0; ondx < x->x_noutlets; ondx++, cellp++, gp++) + /* CHECKED all cells are printed */ + (*cellfn)(x, indx, ondx, *cellp, *gp); + } + else /* CHECKED incompatible: gains confusingly printed in binary mode */ + { + int *cellp = x->x_cells; + int indx, ondx; + for (indx = 0; indx < x->x_ninlets; indx++) + for (ondx = 0; ondx < x->x_noutlets; ondx++, cellp++) + /* CHECKED all cells are printed */ + (*cellfn)(x, indx, ondx, *cellp, defgain); + } +} + +static void matrix_dump(t_matrix *x) +{ + matrix_report(x, x->x_coefs, 1., matrix_cellout); +} + +static void matrix_dumptarget(t_matrix *x) +{ + matrix_report(x, x->x_gains, 1., matrix_cellout); +} + +static void matrix_print(t_matrix *x) +{ + /* CHECKED same output as 'dump' -> [matrix~] -> [print] */ + matrix_report(x, x->x_coefs, 1., matrix_cellprint); +} + +#ifdef MATRIX_DEBUG +static void matrix_debugramps(t_matrix *x) +{ + matrix_report(x, x->x_ramps, 0., matrix_celldebug); +} + +static void matrix_debugsums(t_matrix *x) +{ + int i; + loudbug_startpost("nblock %d (max %d), vectors:", + x->x_nblock, x->x_maxblock); + for (i = 0; i < x->x_noutlets; i++) + loudbug_startpost(" %x", (int)x->x_osums[i]); + loudbug_endpost(); +} + +static void matrix_debug(t_matrix *x, t_symbol *s) +{ + if (s == gensym("ramps")) + matrix_debugramps(x); + else if (s == gensym("sums")) + matrix_debugsums(x); + else + { + matrix_debugramps(x); + matrix_debugsums(x); + } +} +#endif + +static void matrix_free(t_matrix *x) +{ + if (x->x_ivecs) + freebytes(x->x_ivecs, x->x_ninlets * sizeof(*x->x_ivecs)); + if (x->x_ovecs) + freebytes(x->x_ovecs, x->x_noutlets * sizeof(*x->x_ovecs)); + if (x->x_osums) + { + int i; + for (i = 0; i < x->x_noutlets; i++) + freebytes(x->x_osums[i], x->x_maxblock * sizeof(*x->x_osums[i])); + freebytes(x->x_osums, x->x_noutlets * sizeof(*x->x_osums)); + } + if (x->x_cells) + freebytes(x->x_cells, x->x_ncells * sizeof(*x->x_cells)); + if (x->x_gains) + freebytes(x->x_gains, x->x_ncells * sizeof(*x->x_gains)); + if (x->x_ramps) + freebytes(x->x_ramps, x->x_ncells * sizeof(*x->x_ramps)); + if (x->x_coefs) + freebytes(x->x_coefs, x->x_ncells * sizeof(*x->x_coefs)); + if (x->x_incrs) + freebytes(x->x_incrs, x->x_ncells * sizeof(*x->x_incrs)); + if (x->x_bigincrs) + freebytes(x->x_bigincrs, x->x_ncells * sizeof(*x->x_bigincrs)); + if (x->x_remains) + freebytes(x->x_remains, x->x_ncells * sizeof(*x->x_remains)); +} + +static void *matrix_new(t_symbol *s, int ac, t_atom *av) +{ + t_pd *z; + if (!fittermax_get() && + (z = fragile_class_mutate(matrixps_matrixtilde, + (t_newmethod)matrix_new, ac, av))) + return (z); + else if (ac < 2) + { + loud_error(0, "bad creation arguments for class '%s'", + matrixps_matrixtilde->s_name); + loud_errand(0, "missing number of %s", (ac ? "outlets" : "inlets")); + return (0); /* CHECKED */ + } + else + { + t_matrix *x = (t_matrix *)pd_new(matrix_class); + int i; + if (av[0].a_type == A_FLOAT) + { + if ((x->x_ninlets = (int)av[0].a_w.w_float) < 1) + x->x_ninlets = 1; + } + else x->x_ninlets = 1; /* CHECKED */ + if (av[1].a_type == A_FLOAT) + { + if ((x->x_noutlets = (int)av[1].a_w.w_float) < 1) + x->x_noutlets = 1; + } + else x->x_noutlets = 1; /* CHECKED */ + x->x_ncells = x->x_ninlets * x->x_noutlets; + x->x_ivecs = getbytes(x->x_ninlets * sizeof(*x->x_ivecs)); + x->x_ovecs = getbytes(x->x_noutlets * sizeof(*x->x_ovecs)); + x->x_nblock = x->x_maxblock = sys_getblksize(); + x->x_osums = getbytes(x->x_noutlets * sizeof(*x->x_osums)); + for (i = 0; i < x->x_noutlets; i++) + x->x_osums[i] = getbytes(x->x_maxblock * sizeof(*x->x_osums[i])); + x->x_cells = getbytes(x->x_ncells * sizeof(*x->x_cells)); + matrix_clear(x); + if (ac >= 3) + { + if (av[2].a_type == A_FLOAT) + x->x_defgain = av[2].a_w.w_float; + else + x->x_defgain = MATRIX_DEFGAIN; + x->x_gains = getbytes(x->x_ncells * sizeof(*x->x_gains)); + for (i = 0; i < x->x_ncells; i++) + x->x_gains[i] = x->x_defgain; + x->x_ramps = getbytes(x->x_ncells * sizeof(*x->x_ramps)); + matrix_ramp(x, MATRIX_DEFRAMP); + x->x_coefs = getbytes(x->x_ncells * sizeof(*x->x_coefs)); + for (i = 0; i < x->x_ncells; i++) + x->x_coefs[i] = 0.; + x->x_ksr = sys_getsr() * .001; + x->x_incrs = getbytes(x->x_ncells * sizeof(*x->x_incrs)); + x->x_bigincrs = getbytes(x->x_ncells * sizeof(*x->x_bigincrs)); + x->x_remains = getbytes(x->x_ncells * sizeof(*x->x_remains)); + for (i = 0; i < x->x_ncells; i++) + x->x_remains[i] = 0; + } + else + { + x->x_gains = 0; + x->x_ramps = 0; + x->x_coefs = 0; + x->x_incrs = 0; + x->x_bigincrs = 0; + x->x_remains = 0; + } + for (i = 1; i < x->x_ninlets; i++) + sic_newinlet((t_sic *)x, 0.); + for (i = 0; i < x->x_noutlets; i++) + outlet_new((t_object *)x, &s_signal); + x->x_dumpout = outlet_new((t_object *)x, &s_list); + return (x); + } +} + +void matrix_tilde_setup(void) +{ + matrixps_matrixtilde = gensym("matrix~"); + matrix_class = class_new(matrixps_matrixtilde, + (t_newmethod)matrix_new, + (t_method)matrix_free, + sizeof(t_matrix), 0, A_GIMME, 0); + fragile_class_raise(matrixps_matrixtilde, (t_newmethod)matrix_new); + sic_setup(matrix_class, matrix_dsp, matrix_float); + class_addlist(matrix_class, matrix_list); + class_addmethod(matrix_class, (t_method)matrix_clear, + gensym("clear"), 0); + class_addmethod(matrix_class, (t_method)matrix_set, + gensym("set"), A_FLOAT, A_DEFFLOAT, 0); + class_addmethod(matrix_class, (t_method)matrix_connect, + gensym("connect"), A_GIMME, 0); + class_addmethod(matrix_class, (t_method)matrix_connect, + gensym("disconnect"), A_GIMME, 0); + class_addmethod(matrix_class, (t_method)matrix_ramp, + gensym("ramp"), A_FLOAT, 0); + class_addmethod(matrix_class, (t_method)matrix_dump, + gensym("dump"), 0); + class_addmethod(matrix_class, (t_method)matrix_dumptarget, + gensym("dumptarget"), 0); + class_addmethod(matrix_class, (t_method)matrix_print, + gensym("print"), 0); +#ifdef MATRIX_DEBUG + class_addmethod(matrix_class, (t_method)matrix_debug, + gensym("debug"), A_DEFSYM, 0); +#endif + fitter_setup(matrix_class, 0); +} diff --git a/externals/miXed/cyclone/sickle/maximum.c b/externals/miXed/cyclone/sickle/maximum.c new file mode 100644 index 000000000..8d947ec71 --- /dev/null +++ b/externals/miXed/cyclone/sickle/maximum.c @@ -0,0 +1,50 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER use hasfeeders */ + +#include "m_pd.h" +#include "sickle/sic.h" + +#define MAXIMUM_DEFRHS 0. /* CHECKED */ + +typedef t_sic t_maximum; +static t_class *maximum_class; + +static t_int *maximum_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) + { + t_float f1 = *in1++; + t_float f2 = *in2++; + *out++ = (f1 > f2 ? f1 : f2); + } + return (w + 5); +} + +static void maximum_dsp(t_maximum *x, t_signal **sp) +{ + dsp_add(maximum_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *maximum_new(t_symbol *s, int ac, t_atom *av) +{ + t_maximum *x = (t_maximum *)pd_new(maximum_class); + sic_inlet((t_sic *)x, 1, MAXIMUM_DEFRHS, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void maximum_tilde_setup(void) +{ + maximum_class = class_new(gensym("maximum~"), + (t_newmethod)maximum_new, 0, + sizeof(t_maximum), 0, A_GIMME, 0); + sic_setup(maximum_class, maximum_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/minimum.c b/externals/miXed/cyclone/sickle/minimum.c new file mode 100644 index 000000000..cb31f498c --- /dev/null +++ b/externals/miXed/cyclone/sickle/minimum.c @@ -0,0 +1,50 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER use hasfeeders */ + +#include "m_pd.h" +#include "sickle/sic.h" + +#define MINIMUM_DEFRHS 0. /* CHECKED */ + +typedef t_sic t_minimum; +static t_class *minimum_class; + +static t_int *minimum_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) + { + t_float f1 = *in1++; + t_float f2 = *in2++; + *out++ = (f1 < f2 ? f1 : f2); + } + return (w + 5); +} + +static void minimum_dsp(t_minimum *x, t_signal **sp) +{ + dsp_add(minimum_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *minimum_new(t_symbol *s, int ac, t_atom *av) +{ + t_minimum *x = (t_minimum *)pd_new(minimum_class); + sic_inlet((t_sic *)x, 1, MINIMUM_DEFRHS, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void minimum_tilde_setup(void) +{ + minimum_class = class_new(gensym("minimum~"), + (t_newmethod)minimum_new, 0, + sizeof(t_minimum), 0, A_GIMME, 0); + sic_setup(minimum_class, minimum_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/minmax.c b/externals/miXed/cyclone/sickle/minmax.c new file mode 100644 index 000000000..5bd0e3914 --- /dev/null +++ b/externals/miXed/cyclone/sickle/minmax.c @@ -0,0 +1,78 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _minmax +{ + t_sic x_sic; + t_float x_min; + t_float x_max; + t_outlet *x_minout; + t_outlet *x_maxout; +} t_minmax; + +static t_class *minmax_class; + +static void minmax_bang(t_minmax *x) +{ + outlet_float(x->x_maxout, x->x_max); + outlet_float(x->x_minout, x->x_min); +} + +static void minmax_reset(t_minmax *x) +{ + x->x_min = x->x_max = 0; /* CHECKME */ +} + +static t_int *minmax_perform(t_int *w) +{ + t_minmax *x = (t_minmax *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *outmin = (t_float *)(w[4]); + t_float *outmax = (t_float *)(w[5]); + t_float fmin = x->x_min; + t_float fmax = x->x_max; + while (nblock--) + { + t_float f = *in++; + if (f < fmin) fmin = f; + else if (f > fmax) fmax = f; + *outmin++ = fmin; + *outmax++ = fmax; + } + x->x_min = fmin; + x->x_max = fmax; + return (w + 6); +} + +static void minmax_dsp(t_minmax *x, t_signal **sp) +{ + dsp_add(minmax_perform, 5, x, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec, sp[2]->s_vec); +} + +static void *minmax_new(void) +{ + t_minmax *x = (t_minmax *)pd_new(minmax_class); + outlet_new((t_object *)x, &s_signal); + outlet_new((t_object *)x, &s_signal); + x->x_minout = outlet_new((t_object *)x, &s_float); + x->x_maxout = outlet_new((t_object *)x, &s_float); + minmax_reset(x); + return (x); +} + +void minmax_tilde_setup(void) +{ + minmax_class = class_new(gensym("minmax~"), + (t_newmethod)minmax_new, 0, + sizeof(t_minmax), 0, 0); + sic_setup(minmax_class, minmax_dsp, SIC_FLOATTOSIGNAL); + class_addbang(minmax_class, minmax_bang); + class_addmethod(minmax_class, (t_method)minmax_reset, + gensym("reset"), 0); +} diff --git a/externals/miXed/cyclone/sickle/mstosamps.c b/externals/miXed/cyclone/sickle/mstosamps.c new file mode 100644 index 000000000..37b2cc5dd --- /dev/null +++ b/externals/miXed/cyclone/sickle/mstosamps.c @@ -0,0 +1,55 @@ +/* Copyright (c) 2003 krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _mstosamps +{ + t_sic x_sic; + float x_ksr; + t_outlet *x_floatout; +} t_mstosamps; + +static t_class *mstosamps_class; + +static void mstosamps_float(t_mstosamps *x, t_float f) +{ + outlet_float(x->x_floatout, f * x->x_ksr); +} + +static t_int *mstosamps_perform(t_int *w) +{ + t_mstosamps *x = (t_mstosamps *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + float ksr = x->x_ksr; + while (nblock--) *out++ = *in++ * ksr; + return (w + 5); +} + +static void mstosamps_dsp(t_mstosamps *x, t_signal **sp) +{ + x->x_ksr = sp[0]->s_sr * .001; + dsp_add(mstosamps_perform, 4, x, + sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *mstosamps_new(void) +{ + t_mstosamps *x = (t_mstosamps *)pd_new(mstosamps_class); + x->x_ksr = sys_getsr() * .001; /* LATER rethink */ + outlet_new((t_object *)x, &s_signal); + x->x_floatout = outlet_new((t_object *)x, &s_float); + return (x); +} + +void mstosamps_tilde_setup(void) +{ + mstosamps_class = class_new(gensym("mstosamps~"), + (t_newmethod)mstosamps_new, 0, + sizeof(t_mstosamps), 0, 0); + sic_setup(mstosamps_class, mstosamps_dsp, mstosamps_float); +} diff --git a/externals/miXed/cyclone/sickle/onepole.c b/externals/miXed/cyclone/sickle/onepole.c new file mode 100644 index 000000000..dec0ee187 --- /dev/null +++ b/externals/miXed/cyclone/sickle/onepole.c @@ -0,0 +1,151 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is Pd's lop~ with signal-controlled cutoff. */ + +/* CHECKED scalar case: input preserved (not coefs) after changing mode */ +/* CHECKME if creation arg (or a default) restored after signal disconnection */ + +#include <math.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define sinf sin +#endif + +#define ONEPOLE_HZ 0 +#define ONEPOLE_LINEAR 1 +#define ONEPOLE_RADIANS 2 +#define ONEPOLE_MINB0 .0001 /* CHECKED 1st term of ir for b0=0 */ +#define ONEPOLE_MAXB0 .99 /* CHECKED 1st term of ir for b0=1 */ +#define ONEPOLE_MINOMEGA 0. /* CHECKME */ +#define ONEPOLE_MAXOMEGA (SHARED_PI * .5) /* CHECKME */ + +typedef struct _onepole +{ + t_sic x_sic; + int x_mode; + float x_srcoef; + float x_ynm1; +} t_onepole; + +static t_class *onepole_class; + +static t_symbol *ps_hz; +static t_symbol *ps_linear; +static t_symbol *ps_radians; + +static void onepole_clear(t_onepole *x) +{ + x->x_ynm1 = 0.; +} + +static void onepole_hz(t_onepole *x) +{ + x->x_mode = ONEPOLE_HZ; +} + +static void onepole_linear(t_onepole *x) +{ + x->x_mode = ONEPOLE_LINEAR; +} + +static void onepole_radians(t_onepole *x) +{ + x->x_mode = ONEPOLE_RADIANS; +} + +/* LATER make ready for optional audio-rate modulation + (separate scalar case routine, use sic_makecostable(), etc.) */ +static t_int *onepole_perform(t_int *w) +{ + t_onepole *x = (t_onepole *)(w[1]); + int nblock = (int)(w[2]); + t_float *xin = (t_float *)(w[3]); + t_float fin0 = *(t_float *)(w[4]); + t_float *out = (t_float *)(w[5]); + int mode = x->x_mode; + float ynm1 = x->x_ynm1; + /* CHECKME sampled once per block */ + float b0; + if (mode == ONEPOLE_HZ) + { + float omega = fin0 * x->x_srcoef; + if (omega < ONEPOLE_MINOMEGA) + omega = ONEPOLE_MINOMEGA; + else if (omega > ONEPOLE_MAXOMEGA) + omega = ONEPOLE_MAXOMEGA; + /* The actual solution for a half-power cutoff is: + b0 = sqrt(sqr(2-cos(omega))-1) + cos(omega) - 1. + The sin(omega) below is only slightly better approximation than + Miller's b0=omega, except for the two highest octaves (or so), + where it is much better (but far from good). */ + b0 = sinf(omega); + } + else if (mode == ONEPOLE_LINEAR) + b0 = sinf(fin0 * (SHARED_PI * .5)); /* CHECKME actual range of fin0 */ + else + b0 = fin0; + if (b0 < ONEPOLE_MINB0) + b0 = ONEPOLE_MINB0; + else if (b0 > ONEPOLE_MAXB0) + b0 = ONEPOLE_MAXB0; + /* b0 is the standard 1-|a1| (where |a1| is pole's radius), + specifically: a1=b0-1 => a1 in [-.9999 .. -.01] => lowpass (stable) */ + while (nblock--) + *out++ = ynm1 = b0 * (*xin++ - ynm1) + ynm1; + x->x_ynm1 = (PD_BIGORSMALL(ynm1) ? 0. : ynm1); + return (w + 6); +} + +static void onepole_dsp(t_onepole *x, t_signal **sp) +{ + x->x_srcoef = SHARED_2PI / sp[0]->s_sr; + onepole_clear(x); + dsp_add(onepole_perform, 5, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *onepole_new(t_symbol *s, t_floatarg f) +{ + t_onepole *x = (t_onepole *)pd_new(onepole_class); + x->x_srcoef = SHARED_2PI / sys_getsr(); + /* CHECKED no int-to-float conversion (any int bashed to 0.) */ + sic_newinlet((t_sic *)x, f); + outlet_new((t_object *)x, &s_signal); + onepole_clear(x); + if (s == ps_linear) + x->x_mode = ONEPOLE_LINEAR; + else if (s == ps_radians) + x->x_mode = ONEPOLE_RADIANS; + else + { + x->x_mode = ONEPOLE_HZ; + if (s && s != &s_ && s != ps_hz && s != gensym("Hz")) + { + /* CHECKED no warning */ + } + } + return (x); +} + +void onepole_tilde_setup(void) +{ + ps_hz = gensym("hz"); + ps_linear = gensym("linear"); + ps_radians = gensym("radians"); + onepole_class = class_new(gensym("onepole~"), + (t_newmethod)onepole_new, 0, + sizeof(t_onepole), 0, + A_DEFFLOAT, A_DEFSYM, 0); + sic_setup(onepole_class, onepole_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(onepole_class, (t_method)onepole_clear, gensym("clear"), 0); + class_addmethod(onepole_class, (t_method)onepole_hz, ps_hz, 0); + class_addmethod(onepole_class, (t_method)onepole_hz, gensym("Hz"), 0); + class_addmethod(onepole_class, (t_method)onepole_linear, ps_linear, 0); + class_addmethod(onepole_class, (t_method)onepole_radians, ps_radians, 0); +} diff --git a/externals/miXed/cyclone/sickle/overdrive.c b/externals/miXed/cyclone/sickle/overdrive.c new file mode 100644 index 000000000..7bee8f770 --- /dev/null +++ b/externals/miXed/cyclone/sickle/overdrive.c @@ -0,0 +1,80 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +/* FIXME this is unnecessary in vc > 6.0 and darwin? */ +#if defined(_WIN32) || defined(__APPLE__) +#define powf pow +#endif + +typedef struct _overdrive +{ + t_sic x_sic; + float x_drivefactor; +} t_overdrive; + +static t_class *overdrive_class; + +/* CHECKED this is redundant (a design flaw), LATER fitter-optionally use + float-to-signal conversion. */ +static void overdrive_float(t_overdrive *x, t_float f) +{ + x->x_drivefactor = f; +} + +static void overdrive_ft1(t_overdrive *x, t_floatarg f) +{ + x->x_drivefactor = f; +} + +/* CHECKED negative parameter values may cause output to go out of bounds */ +static t_int *overdrive_perform(t_int *w) +{ + float df = *(t_float *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) + { + float f = *in++; + if (f >= 1.) /* CHECKED incompatible (garbage for sig~ 1.) */ + *out++ = 1.; /* CHECKED constant for > 1. */ + else if (f > 0.) + *out++ = 1. - powf(1. - f, df); /* CHECKED */ + else if (f > -1.) /* CHECKED incompatible (garbage for sig~ -1.) */ + *out++ = powf(1. + f, df) - 1.; /* CHECKED */ + else + *out++ = -1.; /* CHECKED constant for < -1. */ + } + return (w + 5); +} + +static void overdrive_dsp(t_overdrive *x, t_signal **sp) +{ + dsp_add(overdrive_perform, 4, &x->x_drivefactor, + sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *overdrive_new(t_floatarg f) +{ + t_overdrive *x = (t_overdrive *)pd_new(overdrive_class); + x->x_drivefactor = f; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void overdrive_tilde_setup(void) +{ + overdrive_class = class_new(gensym("overdrive~"), + (t_newmethod)overdrive_new, 0, + sizeof(t_overdrive), 0, A_DEFFLOAT, 0); + /* CHECKED no float-to-signal conversion */ + sic_setup(overdrive_class, overdrive_dsp, overdrive_float); + class_addmethod(overdrive_class, (t_method)overdrive_ft1, + gensym("ft1"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/peakamp.c b/externals/miXed/cyclone/sickle/peakamp.c new file mode 100644 index 000000000..67d10932d --- /dev/null +++ b/externals/miXed/cyclone/sickle/peakamp.c @@ -0,0 +1,107 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _peakamp +{ + t_sic x_sic; + t_float x_value; + int x_nwait; + int x_nleft; + int x_precount; + float x_waittime; + float x_ksr; + t_clock *x_clock; +} t_peakamp; + +static t_class *peakamp_class; + +static void peakamp_tick(t_peakamp *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_value); + x->x_value = 0; + if ((x->x_nleft = x->x_nwait - x->x_precount) < 0) /* CHECKME */ + x->x_nleft = 0; +} + +static void peakamp_bang(t_peakamp *x) +{ + peakamp_tick(x); /* CHECKME */ +} + +static void peakamp_ft1(t_peakamp *x, t_floatarg f) +{ + if ((x->x_waittime = f) < 0.) + x->x_waittime = 0.; + if ((x->x_nwait = (int)(x->x_waittime * x->x_ksr)) < 0) + x->x_nwait = 0; +} + +static t_int *peakamp_perform(t_int *w) +{ + t_peakamp *x = (t_peakamp *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float value = x->x_value; + if (x->x_nwait) + { + if (x->x_nleft < nblock) + { + clock_delay(x->x_clock, 0); + x->x_precount = nblock - x->x_nleft; + x->x_nleft = 0; /* LATER rethink */ + } + else x->x_nleft -= nblock; + } + while (nblock--) + { + t_float f = *in++; + if (f > value) + value = f; + else if (f < -value) + value = -f; + } + x->x_value = value; + return (w + 4); +} + +static void peakamp_dsp(t_peakamp *x, t_signal **sp) +{ + x->x_ksr = sp[0]->s_sr * 0.001; + x->x_nwait = (int)(x->x_waittime * x->x_ksr); + dsp_add(peakamp_perform, 3, x, sp[0]->s_n, sp[0]->s_vec); +} + +static void peakamp_free(t_peakamp *x) +{ + if (x->x_clock) clock_free(x->x_clock); +} + +static void *peakamp_new(t_floatarg f) +{ + t_peakamp *x = (t_peakamp *)pd_new(peakamp_class); + x->x_value = 0.; + x->x_nleft = 0; + x->x_ksr = sys_getsr() * 0.001; + peakamp_ft1(x, f); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + x->x_clock = clock_new(x, (t_method)peakamp_tick); + return (x); +} + +void peakamp_tilde_setup(void) +{ + peakamp_class = class_new(gensym("peakamp~"), + (t_newmethod)peakamp_new, + (t_method)peakamp_free, + sizeof(t_peakamp), 0, + A_DEFFLOAT, 0); + sic_setup(peakamp_class, peakamp_dsp, SIC_FLOATTOSIGNAL); + class_addbang(peakamp_class, peakamp_bang); + class_addmethod(peakamp_class, (t_method)peakamp_ft1, + gensym("ft1"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/peek.c b/externals/miXed/cyclone/sickle/peek.c new file mode 100644 index 000000000..00132ab39 --- /dev/null +++ b/externals/miXed/cyclone/sickle/peek.c @@ -0,0 +1,150 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER: 'click' method */ + +#include <string.h> +#include "m_pd.h" +#include "shared.c" +#include "sickle/sic.h" +#include "sickle/arsic.h" + +#define PEEK_MAXCHANNELS 4 /* LATER implement arsic resizing feature */ + +typedef struct _peek +{ + t_arsic x_arsic; + int x_maxchannels; + int x_effchannel; /* effective channel (clipped reqchannel) */ + int x_reqchannel; /* requested channel */ + int x_clipmode; + int x_pokemode; + t_float x_value; + t_clock *x_clock; + double x_clocklasttick; + int x_clockset; +} t_peek; + +static t_class *peek_class; + +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_getlogicaltime(); +} + +static void peek_set(t_peek *x, t_symbol *s) +{ + arsic_setarray((t_arsic *)x, s, 1); +} + +#define peek_doclip(f) (f < -1. ? -1. : (f > 1. ? 1. : f)) + +/* 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 + in tabread/tabwrite). As a kind of an experiment, lets make this + the refman's way... */ +static void peek_float(t_peek *x, t_float f) +{ + t_arsic *sic = (t_arsic *)x; + t_word *vp; + arsic_validate(sic, 0); /* LATER rethink (efficiency, and complaining) */ + if (vp = sic->s_vectors[x->x_effchannel]) + { + int ndx = (int)f; + if (ndx >= 0 && ndx < sic->s_vecsize) + { + if (x->x_pokemode) + { + double timesince; + t_float f = x->x_value; + vp[ndx].w_float = (x->x_clipmode ? peek_doclip(f) : f); + x->x_pokemode = 0; + timesince = clock_gettimesince(x->x_clocklasttick); + if (timesince > 1000) peek_tick(x); + else if (!x->x_clockset) + { + clock_delay(x->x_clock, 1000 - timesince); + x->x_clockset = 1; + } + } + /* CHECKED: output not clipped */ + else outlet_float(((t_object *)x)->ob_outlet, vp[ndx].w_float); + } + } +} + +static void peek_ft1(t_peek *x, t_floatarg f) +{ + x->x_value = f; + x->x_pokemode = 1; + /* CHECKED: poke-mode is reset only after receiving left inlet input + -- it is kept across 'ft2', 'clip', and 'set' inputs. */ +} + +static void peek_ft2(t_peek *x, t_floatarg f) +{ + if ((x->x_reqchannel = (f > 1 ? (int)f - 1 : 0)) > x->x_maxchannels) + x->x_effchannel = x->x_maxchannels - 1; + else + x->x_effchannel = x->x_reqchannel; +} + +static void peek_clip(t_peek *x, t_floatarg f) +{ + x->x_clipmode = ((int)f != 0); +} + +static void peek_free(t_peek *x) +{ + if (x->x_clock) clock_free(x->x_clock); + arsic_free((t_arsic *)x); +} + +static void *peek_new(t_symbol *s, t_floatarg f1, t_floatarg f2) +{ + int ch = (f1 > 0 ? (int)f1 : 0); + t_peek *x = (t_peek *)arsic_new(peek_class, s, + (ch ? PEEK_MAXCHANNELS : 0), 0, 0); + if (x) + { + if (ch > PEEK_MAXCHANNELS) + ch = PEEK_MAXCHANNELS; + x->x_maxchannels = (ch ? PEEK_MAXCHANNELS : 1); + x->x_effchannel = x->x_reqchannel = (ch ? ch - 1 : 0); + /* 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_getlogicaltime(); + x->x_clockset = 0; + } + return (x); +} + +void peek_tilde_setup(void) +{ + peek_class = class_new(gensym("peek~"), + (t_newmethod)peek_new, + (t_method)peek_free, + sizeof(t_peek), 0, + A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addfloat(peek_class, peek_float); + class_addmethod(peek_class, (t_method)peek_set, + gensym("set"), A_SYMBOL, 0); + class_addmethod(peek_class, (t_method)peek_ft1, + gensym("ft1"), A_FLOAT, 0); + class_addmethod(peek_class, (t_method)peek_ft2, + gensym("ft2"), A_FLOAT, 0); + class_addmethod(peek_class, (t_method)peek_clip, + gensym("clip"), A_FLOAT, 0); +// logpost(NULL, 4, "this is cyclone/peek~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/sickle/phasewrap.c b/externals/miXed/cyclone/sickle/phasewrap.c new file mode 100644 index 000000000..535d5e803 --- /dev/null +++ b/externals/miXed/cyclone/sickle/phasewrap.c @@ -0,0 +1,131 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +typedef struct _phasewrap +{ + t_sic x_sic; + int x_algo; +} t_phasewrap; + +static t_class *phasewrap_class; + +static t_int *phasewrap_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + t_shared_wrappy wrappy; + while (nblock--) + { + /* FIXME here we have pi -> pi, 3pi -> -pi, -pi -> -pi, -3pi -> pi, + while in msp it is pi -> -pi, 3pi -> -pi, -pi -> pi, -3pi -> pi */ + + double dnorm = *in++ * (1. / SHARED_2PI); + wrappy.w_d = dnorm + SHARED_UNITBIT0; + /* Speeding up the int-to-double conversion below would be nice, + but all attempts failed. Even this is slower (which works only + for nonnegative input): + + wrappy.w_i[SHARED_HIOFFSET] = SHARED_UNITBIT0_HIPART; + *out++ = (dnorm - (wrappy.w_d - SHARED_UNITBIT0)) * SHARED_2PI; + */ + dnorm -= wrappy.w_i[SHARED_LOWOFFSET]; + *out++ = dnorm * SHARED_2PI; + } + return (w + 4); +} + +/* This is the slowest algo. It is slower than fmod in all cases, + except for input being zero. */ +static t_int *phasewrap_perform1(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + double dnorm; + if (f < -SHARED_PI) + { + dnorm = (double)f * (1. / SHARED_2PI) + .5; + *out++ = (dnorm - (int)dnorm) * SHARED_2PI + SHARED_PI; + } + else if (f > SHARED_PI) + { + dnorm = (double)f * (1. / SHARED_2PI) + .5; + *out++ = (dnorm - (int)dnorm) * SHARED_2PI - SHARED_PI; + } + else *out++ = f; + } + return (w + 4); +} + +static t_int *phasewrap_perform2(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + double dnorm = *in++ + SHARED_PI; + if (dnorm < 0) + *out++ = SHARED_PI - fmod(-dnorm, SHARED_2PI); + else + *out++ = fmod(dnorm, SHARED_2PI) - SHARED_PI; + } + return (w + 4); +} + +static void phasewrap_dsp(t_phasewrap *x, t_signal **sp) +{ + switch (x->x_algo) + { + case 1: + dsp_add(phasewrap_perform1, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + break; + case 2: + dsp_add(phasewrap_perform2, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + break; + default: + dsp_add(phasewrap_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + } +} + +static void phasewrap__algo(t_phasewrap *x, t_floatarg f) +{ + x->x_algo = f; +} + +static void *phasewrap_new(t_symbol *s, int ac, t_atom *av) +{ + t_phasewrap *x = (t_phasewrap *)pd_new(phasewrap_class); + if (s == gensym("_phasewrap1~")) + x->x_algo = 1; + else if (s == gensym("_phasewrap2~")) + x->x_algo = 2; + else + x->x_algo = 0; + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void phasewrap_tilde_setup(void) +{ + phasewrap_class = class_new(gensym("phasewrap~"), + (t_newmethod)phasewrap_new, 0, + sizeof(t_phasewrap), 0, A_GIMME, 0); + class_addcreator((t_newmethod)phasewrap_new, + gensym("_phasewrap1~"), A_GIMME, 0); + class_addcreator((t_newmethod)phasewrap_new, + gensym("_phasewrap2~"), A_GIMME, 0); + sic_setup(phasewrap_class, phasewrap_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(phasewrap_class, (t_method)phasewrap__algo, + gensym("_algo"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/pink.c b/externals/miXed/cyclone/sickle/pink.c new file mode 100644 index 000000000..0ba71b2c9 --- /dev/null +++ b/externals/miXed/cyclone/sickle/pink.c @@ -0,0 +1,100 @@ +/* Copyright (c) 2003 krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Filter: Paul Kellet's from music-dsp. This is the most popular one, + used in jMax, Csound, etc. LATER compare to McCartney's (sc). + Rng: noise~ code from d_osc.c. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "sickle/sic.h" + +/* more like 0.085 in c74's */ +#define PINK_GAIN .105 + +typedef struct _pink +{ + t_sic x_sic; + int x_state; + float x_b0; + float x_b1; + float x_b2; + float x_b3; + float x_b4; + float x_b5; + float x_b6; +} t_pink; + +static t_class *pink_class; + +static void pink_float(t_pink *x, t_float f) +{ + loud_nomethod((t_pd *)x, &s_float); /* LATER rethink */ +} + +static t_int *pink_perform(t_int *w) +{ + t_pink *x = (t_pink *)(w[1]); + int nblock = (int)(w[2]); + t_float *out = (t_float *)(w[3]); + int state = x->x_state; + float b0 = x->x_b0; + float b1 = x->x_b1; + float b2 = x->x_b2; + float b3 = x->x_b3; + float b4 = x->x_b4; + float b5 = x->x_b5; + float b6 = x->x_b6; + while (nblock--) + { + float white = ((float)((state & 0x7fffffff) - 0x40000000)) * + (float)(1.0 / 0x40000000); + state = state * 435898247 + 382842987; + b0 = 0.99886 * b0 + white * 0.0555179; + b1 = 0.99332 * b1 + white * 0.0750759; + b2 = 0.96900 * b2 + white * 0.1538520; + b3 = 0.86650 * b3 + white * 0.3104856; + b4 = 0.55000 * b4 + white * 0.5329522; + b5 = -0.7616 * b5 - white * 0.0168980; + *out++ = (b0 + b1 + b2 + b3 + b4 + b5 + b6 + white * 0.5362) + * PINK_GAIN; + b6 = white * 0.115926; + } + x->x_state = state; + x->x_b0 = b0; + x->x_b1 = b1; + x->x_b2 = b2; + x->x_b3 = b3; + x->x_b4 = b4; + x->x_b5 = b5; + x->x_b6 = b6; + return (w + 4); +} + +static void pink_dsp(t_pink *x, t_signal **sp) +{ + dsp_add(pink_perform, 3, x, sp[1]->s_n, sp[1]->s_vec); +} + +static void *pink_new(void) +{ + t_pink *x = (t_pink *)pd_new(pink_class); + /* borrowed from d_osc.c, LATER rethink */ + static int init = 307; + x->x_state = (init *= 1319); + /* all coefs set to zero */ + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void pink_tilde_setup(void) +{ + pink_class = class_new(gensym("pink~"), + (t_newmethod)pink_new, 0, + sizeof(t_pink), 0, 0); + /* dummy float method: we need signal in (for begin~), but neither + float-to-signal conversion, nor a float method (the only control + input is 'enable'). LATER rethink. */ + sic_setup(pink_class, pink_dsp, pink_float); +} diff --git a/externals/miXed/cyclone/sickle/play.c b/externals/miXed/cyclone/sickle/play.c new file mode 100644 index 000000000..9593dcf42 --- /dev/null +++ b/externals/miXed/cyclone/sickle/play.c @@ -0,0 +1,125 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" +#include "sickle/arsic.h" + +/* CHECKME (the refman): if the buffer~ has more channels, channels are mixed */ + +typedef t_arsic t_play; +static t_class *play_class; + +static void play_set(t_play *x, t_symbol *s) +{ + arsic_setarray((t_arsic *)x, s, 1); +} + +/* LATER optimize */ +static t_int *play_perform(t_int *w) +{ + t_arsic *sic = (t_arsic *)(w[1]); + int nblock = (int)(w[2]); + int nch = sic->s_nchannels; + t_int *outp = w + 4; + if (sic->s_playable) + { + t_play *x = (t_play *)sic; + t_float *xin = (t_float *)(w[3]); + int vecsize = sic->s_vecsize; + t_word **vectable = sic->s_vectors; + float ksr = sic->s_ksr; + int nointerp = 0; + int maxindex = (nointerp ? vecsize - 1 : vecsize - 3); + int iblock; + + for (iblock = 0; iblock < nblock; iblock++) + { + float phase = *xin++ * ksr; + int ndx; + int ch = nch; + float frac, a, b, c, d, cminusb; + if (phase < 0 || phase > maxindex) + phase = 0; /* CHECKED: a value 0, not ndx 0 */ + ndx = (int)phase; + /* CHECKME: what kind of interpolation? (CHECKED: multi-point) */ + if (ndx < 1) + ndx = 1, frac = 0; + else if (ndx > maxindex) + ndx = maxindex, frac = 1; + else frac = phase - ndx; + while (ch--) + { + t_word *vp = vectable[ch]; + t_float *out = (t_float *)(outp[ch]); + if (vp) + { + vp += ndx; + a = vp[-1].w_float; + b = vp[0].w_float; + c = vp[1].w_float; + d = vp[2].w_float; + cminusb = c-b; + out[iblock] = b + frac * ( + cminusb - 0.1666667f * (1. - frac) * ( + (d - a - 3.0f * cminusb) * frac + + (d + 2.0f * a - 3.0f * b) + ) + ); + } + else out[iblock] = 0; + } + } + } + else + { + int ch = nch; + while (ch--) + { + t_float *out = (t_float *)outp[ch]; + int n = nblock; + while (n--) *out++ = 0; + } + } + return (w + sic->s_nperfargs + 1); +} + +static void play_dsp(t_play *x, t_signal **sp) +{ + arsic_dsp((t_arsic *)x, sp, play_perform, 1); +} + +static void play_free(t_play *x) +{ + arsic_free((t_arsic *)x); +} + +static void *play_new(t_symbol *s, t_floatarg f) +{ + /* one auxiliary signal: position input */ + t_play *x = (t_play *)arsic_new(play_class, s, (int)f, 0, 1); + if (x) + { + int nch = arsic_getnchannels((t_arsic *)x); + while (nch--) + outlet_new((t_object *)x, &s_signal); + } + return (x); +} + +void play_tilde_setup(void) +{ + play_class = class_new(gensym("play~"), + (t_newmethod)play_new, + (t_method)play_free, + sizeof(t_play), 0, + A_DEFSYM, A_DEFFLOAT, 0); + arsic_setup(play_class, play_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(play_class, (t_method)play_set, + gensym("set"), A_SYMBOL, 0); +// logpost(NULL, 4, "this is cyclone/play~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/sickle/poke.c b/externals/miXed/cyclone/sickle/poke.c new file mode 100644 index 000000000..8516bef5a --- /dev/null +++ b/externals/miXed/cyclone/sickle/poke.c @@ -0,0 +1,158 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER: 'click' method */ + +#include "m_pd.h" +#include "shared.h" +#include "unstable/fragile.h" +#include "sickle/sic.h" +#include "sickle/arsic.h" + +#define POKE_MAXCHANNELS 4 /* LATER implement arsic resizing feature */ + +typedef struct _poke +{ + t_arsic x_arsic; + int x_maxchannels; + int x_effchannel; /* effective channel (clipped reqchannel) */ + int x_reqchannel; /* requested channel */ + t_sample *x_indexptr; + t_clock *x_clock; + double x_clocklasttick; + int x_clockset; +} t_poke; + +static t_class *poke_class; + +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_getlogicaltime(); +} + +static void poke_set(t_poke *x, t_symbol *s) +{ + arsic_setarray((t_arsic *)x, s, 1); +} + +static void poke_bang(t_poke *x) +{ + arsic_redraw((t_arsic *)x); +} + +/* CHECKED: index 0-based, negative values block input, overflowed are clipped. + LATER revisit: incompatibly, the code below is nop for any out-of-range index + (see also peek.c) */ +/* CHECKED: value never clipped, 'clip' not understood */ +/* CHECKED: no float-to-signal conversion. 'Float' message is ignored + when dsp is on -- whether a signal is connected to the left inlet, or not + (if not, current index is set to zero). Incompatible (revisit LATER) */ +static void poke_float(t_poke *x, t_float f) +{ + t_arsic *sic = (t_arsic *)x; + t_word *vp; + arsic_validate(sic, 0); /* LATER rethink (efficiency, and complaining) */ + if (vp = sic->s_vectors[x->x_effchannel]) + { + int ndx = (int)*x->x_indexptr; + if (ndx >= 0 && ndx < sic->s_vecsize) + { + double timesince; + vp[ndx].w_float = f; + timesince = clock_gettimesince(x->x_clocklasttick); + if (timesince > 1000) poke_tick(x); + else if (!x->x_clockset) + { + clock_delay(x->x_clock, 1000 - timesince); + x->x_clockset = 1; + } + } + } +} + +static void poke_ft2(t_poke *x, t_floatarg f) +{ + if ((x->x_reqchannel = (f > 1 ? (int)f - 1 : 0)) > x->x_maxchannels) + x->x_effchannel = x->x_maxchannels - 1; + else + x->x_effchannel = x->x_reqchannel; +} + +static t_int *poke_perform(t_int *w) +{ + t_arsic *sic = (t_arsic *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_poke *x = (t_poke *)sic; + t_word *vp = sic->s_vectors[x->x_effchannel]; + if (vp && sic->s_playable) + { + int vecsize = sic->s_vecsize; + while (nblock--) + { + t_float f = *in1++; + int ndx = (int)*in2++; + if (ndx >= 0 && ndx < vecsize) + vp[ndx].w_float = f; + } + } + return (w + sic->s_nperfargs + 1); +} + +static void poke_dsp(t_poke *x, t_signal **sp) +{ + arsic_dsp((t_arsic *)x, sp, poke_perform, 0); +} + +static void poke_free(t_poke *x) +{ + if (x->x_clock) clock_free(x->x_clock); + arsic_free((t_arsic *)x); +} + +static void *poke_new(t_symbol *s, t_floatarg f) +{ + int ch = (f > 0 ? (int)f : 0); + t_poke *x = (t_poke *)arsic_new(poke_class, s, + (ch ? POKE_MAXCHANNELS : 0), 2, 0); + if (x) + { + t_inlet *in2; + if (ch > POKE_MAXCHANNELS) + ch = POKE_MAXCHANNELS; + x->x_maxchannels = (ch ? POKE_MAXCHANNELS : 1); + x->x_effchannel = x->x_reqchannel = (ch ? ch - 1 : 0); + /* CHECKED: no float-to-signal conversion. + Floats in 2nd inlet are ignored when dsp is on, but only if a signal + is connected to this inlet. Incompatible (revisit LATER). */ + in2 = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + 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_getlogicaltime(); + x->x_clockset = 0; + } + return (x); +} + +void poke_tilde_setup(void) +{ + poke_class = class_new(gensym("poke~"), + (t_newmethod)poke_new, + (t_method)poke_free, + sizeof(t_poke), 0, + A_DEFSYM, A_DEFFLOAT, 0); + arsic_setup(poke_class, poke_dsp, poke_float); + class_addbang(poke_class, poke_bang); /* LATER rethink */ + class_addfloat(poke_class, poke_float); + class_addmethod(poke_class, (t_method)poke_set, + gensym("set"), A_SYMBOL, 0); + class_addmethod(poke_class, (t_method)poke_ft2, + gensym("ft2"), A_FLOAT, 0); +// logpost(NULL, 4, "this is cyclone/poke~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/sickle/poltocar.c b/externals/miXed/cyclone/sickle/poltocar.c new file mode 100644 index 000000000..5c703b8a1 --- /dev/null +++ b/externals/miXed/cyclone/sickle/poltocar.c @@ -0,0 +1,79 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "unstable/fragile.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define sinf sin +#define cosf cos +#endif + +typedef struct _poltocar +{ + t_sic x_sic; + t_outlet *x_out2; +} t_poltocar; + +static t_class *poltocar_class; + +static t_int *poltocar_perform(t_int *w) +{ + int nblock = (int)(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]); + while (nblock--) + { + float am = *in1++, ph = *in2++; + *out1++ = am * cosf(ph); + *out2++ = am * sinf(ph); /* CHECKED */ + } + return (w + 6); +} + +static t_int *poltocar_perform_noimag(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out1 = (t_float *)(w[4]); + while (nblock--) + { + float am = *in1++, ph = *in2++; + *out1++ = am * cosf(ph); + } + return (w + 5); +} + +static void poltocar_dsp(t_poltocar *x, t_signal **sp) +{ + if (fragile_outlet_connections(x->x_out2)) + dsp_add(poltocar_perform, 5, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); + else + dsp_add(poltocar_perform_noimag, 4, sp[0]->s_n, sp[0]->s_vec, + sp[1]->s_vec, sp[2]->s_vec); +} + +static void *poltocar_new(void) +{ + t_poltocar *x = (t_poltocar *)pd_new(poltocar_class); + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + outlet_new((t_object *)x, &s_signal); + x->x_out2 = outlet_new((t_object *)x, &s_signal); + return (x); +} + +void poltocar_tilde_setup(void) +{ + poltocar_class = class_new(gensym("poltocar~"), + (t_newmethod)poltocar_new, 0, + sizeof(t_poltocar), 0, 0); + sic_setup(poltocar_class, poltocar_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/pong.c b/externals/miXed/cyclone/sickle/pong.c new file mode 100644 index 000000000..70f6f938b --- /dev/null +++ b/externals/miXed/cyclone/sickle/pong.c @@ -0,0 +1,359 @@ +#include "m_pd.h" +#include <math.h> +#include <string.h> +#include <ctype.h> +#include <stdlib.h> + +#ifndef HAVE_ALLOCA /* can work without alloca() but we never need it */ +#define HAVE_ALLOCA 1 +#endif +#define TEXT_NGETBYTE 100 /* bigger that this we use alloc, not alloca */ +#if HAVE_ALLOCA +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)((n) < TEXT_NGETBYTE ? \ + alloca((n) * sizeof(t_atom)) : getbytes((n) * sizeof(t_atom)))) +#define ATOMS_FREEA(x, n) ( \ + ((n) < TEXT_NGETBYTE || (freebytes((x), (n) * sizeof(t_atom)), 0))) +#else +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)getbytes((n) * sizeof(t_atom))) +#define ATOMS_FREEA(x, n) (freebytes((x), (n) * sizeof(t_atom))) +#endif + +#ifndef CYPONGTMODE_DEF +#define CYPONGTMODE_DEF 0 +#endif + +#ifndef CYPONGTLO_DEF +#define CYPONGTLO_DEF 0.f +#endif + +#ifndef CYPONGTHI_DEF +#define CYPONGTHI_DEF 1.f +#endif + +static t_class *pong_tilde_class; + +typedef struct _pong_tilde {//pong_tilde (control rate) + t_object x_obj; + int mode; //0=fold, 1 = wrap, 2 = clip, 3 = none + t_float minval; + t_float maxval; + t_float x_input; //dummy var + t_inlet *x_minlet; + t_inlet *x_maxlet; + t_outlet *x_outlet; + int x_numargs;//num of args given +} t_pong_tilde; + + + +static int pong_tilde_setmode_help(char const * mode){ +//helper function for setting mode +int retmode; //int val for mode (see struct) + if(strcmp(mode, "clip") == 0){ + retmode = 2; + } + else if(strcmp(mode, "wrap") == 0){ + retmode = 1; + } + else if(strcmp(mode, "fold") == 0){ + retmode = 0; + } + else{//default to none o/wise + retmode = 3; + }; + + return retmode; + +}; + +static void *pong_tilde_new(t_symbol *s, int argc, t_atom *argv){ + //two optional args (lo, hi), then attributes for mode (str) and range (2 fl) + t_pong_tilde *x = (t_pong_tilde *)pd_new(pong_tilde_class); + int numargs = 0;//number of args read + int pastargs = 0; //if any attrs have been declared yet + x->minval = CYPONGTLO_DEF; + x-> maxval = CYPONGTHI_DEF; + x->mode = CYPONGTMODE_DEF; + + while(argc > 0 ){ + t_symbol *curarg = atom_getsymbolarg(0, argc, argv); //returns nullpointer if not symbol + if(curarg == &s_){ //if nullpointer, should be float or int + if(!pastargs){//if we aren't past the args yet + switch(numargs){ + float mode; + int setmode; + case 0: mode =atom_getfloatarg(0, argc, argv); + setmode = (int)mode; + if(mode < 0){ + setmode = 0; + } + else if(mode > 3){ + setmode = 3; + } + x->mode = setmode; + numargs++; + argc--; + argv++; + break; + + case 1: x->minval = atom_getfloatarg(0, argc, argv); + numargs++; + argc--; + argv++; + break; + + case 2: x->maxval = atom_getfloatarg(0, argc, argv); + numargs++; + argc--; + argv++; + break; + + + default: argc--; + argv++; + break; + }; + } + else{ + argc--; + argv++; + }; + } + else{ + pastargs = 1; + int isrange = strcmp(curarg->s_name, "@range") == 0; + int ismode = strcmp(curarg->s_name, "@mode") == 0; + if(isrange && argc >= 3){ + t_symbol *arg1 = atom_getsymbolarg(1, argc, argv); + t_symbol *arg2 = atom_getsymbolarg(2, argc, argv); + if(arg1 == &s_ && arg2 == &s_){ + x->minval = atom_getfloatarg(1, argc, argv); + x->maxval = atom_getfloatarg(2, argc, argv); + argc -= 3; + argv += 3; + } + else{ + goto errstate; + };} + + else if(ismode && argc >= 2){ + t_symbol *arg3 = atom_getsymbolarg(1, argc, argv); + if(arg3 != &s_){ + x->mode = pong_tilde_setmode_help(arg3->s_name); + argc -= 2; + argv += 2; + } + else{ + goto errstate; + };} + else{ + goto errstate; + }; }; + }; + /* + if(numargs <= 1){ + + pd_float( (t_pd *)inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal), maxval); + } + else{ + */ + x->x_minlet = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + x->x_maxlet = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + pd_float( (t_pd *) x->x_minlet, x->minval); + pd_float( (t_pd *) x->x_maxlet, x->maxval); + //}; + x->x_numargs = numargs; + x->x_outlet = outlet_new(&x->x_obj, gensym("signal")); + return (x); + errstate: + pd_error(x, "pong~: improper args"); + return NULL; +} + + +static float pong_tilde_ponger(float input, float minval, float maxval, int mode){ + //pong_tilde helper function + float returnval; + float range = maxval - minval; + if(input < maxval && input >= minval){//if input in range, return input + returnval = input; + } + else if(minval == maxval){ + returnval = minval; + } + else if(mode == 0){//folding + if(input < minval){ + float diff = minval - input; //diff between input and minimum (positive) + int mag = (int)(diff/range); //case where input is more than a range away from minval + if(mag % 2 == 0){// even number of ranges away = counting up from min + diff = diff - ((float)mag)*range; + returnval = diff + minval; + } + else{// odd number of ranges away = counting down from max + diff = diff - ((float)mag)*range; + returnval = maxval - diff; + }; + } + else{ //input > maxval + float diff = input - maxval; //diff between input and max (positive) + int mag = (int)(diff/range); //case where input is more than a range away from maxval + if(mag % 2 == 0){//even number of ranges away = counting down from max + diff = diff - (float)mag*range; + returnval = maxval - diff; + } + else{//odd number of ranges away = counting up from min + diff = diff - (float)mag*range; + returnval = diff + minval; + }; + }; + } + else if (mode == 1){// wrapping + if(input < minval){ + returnval = input; + while(returnval < minval){ + returnval += range; + }; + } + else{ + returnval = fmod(input-minval,maxval-minval) + minval; + }; + } + else if(mode == 2){//clipping + if(input < minval){ + returnval = minval; + } + else{//input > maxval + returnval = maxval; + }; + } + else{//mode = 3, no effect + returnval = input; + }; + + return returnval; + +} + + +static void pong_tilde_setrange(t_pong_tilde *x, t_float lo, t_float hi){ + + x->minval = lo; + x->maxval = hi; + + pd_float( (t_pd *) x->x_minlet, x->minval); + pd_float( (t_pd *) x->x_maxlet, x->maxval); +} + + +static void pong_tilde_setmode(t_pong_tilde *x, t_symbol *s, int argc, t_atom *argv){ + int setmode; + if(argc > 0){ + t_symbol *arg1 = atom_getsymbolarg(0, argc, argv); + if(arg1 == &s_){ // if arg is a number + float mode = atom_getfloatarg(0, argc, argv); + setmode = (int) mode; + if( setmode < 0){ + setmode = 0; + } + else if( setmode > 3){ + setmode = 3; + }; + } + else{//if arg is a symbol + setmode = pong_tilde_setmode_help(arg1->s_name); + }; + + x->mode = setmode; + }; + +} + +static t_int *pong_tilde_perform(t_int *w) +{ + t_pong_tilde *x = (t_pong_tilde *)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *in3 = (t_float *)(w[4]); + t_float *out = (t_float *)(w[5]); + int n = (int)(w[6]); + + int mode = x->mode; + while (n--){ + float input = *in1++; + float minv = *in2++; + float maxv = *in3++; + if(minv > maxv){//checking ranges + float temp; + temp = maxv; + maxv = minv; + minv = temp; + }; + + float returnval = pong_tilde_ponger(input, minv, maxv, mode); + + *out++ = returnval; + }; + return (w+7); +} + +/* +static t_int *pong_tilde_perform_maxonly(t_int *w) +{ + t_pong_tilde *x = (t_pong_tilde *)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + int n = (int)(w[5]); + + int mode = x->mode; + float minv = 0.f; + while (n--){ + float input = *in1++; + float maxv = *in2++; + if(minv > maxv){//checking ranges + float temp; + temp = maxv; + maxv = minv; + minv = temp; + }; + + float returnval = pong_tilde_ponger(input, minv, maxv, mode); + + *out++ = returnval; + }; + return (w+6); +} + +*/ +static void *pong_tilde_free(t_pong_tilde *x){ + inlet_free(x->x_minlet); + inlet_free(x->x_maxlet); + outlet_free(x->x_outlet); + return (void *)x; + +} + +static void pong_tilde_dsp(t_pong_tilde *x, t_signal **sp) +{ + /* + if(x->x_numargs <= 1){ + dsp_add(pong_tilde_perform_maxonly, 5, x, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); + } + + else{ + */ + dsp_add(pong_tilde_perform, 6, x, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, sp[0]->s_n); + // }; +} + + + + void pong_tilde_setup(void){ + pong_tilde_class = class_new(gensym("pong~"), (t_newmethod)pong_tilde_new, 0, + sizeof(t_pong_tilde), CLASS_DEFAULT, A_GIMME, 0); + class_addmethod(pong_tilde_class, (t_method)pong_tilde_setrange, gensym("range"), A_FLOAT, A_FLOAT, 0); + class_addmethod(pong_tilde_class, (t_method)pong_tilde_setmode, gensym("mode"), A_GIMME, 0); + + class_addmethod(pong_tilde_class, (t_method)pong_tilde_dsp, gensym("dsp"), 0); + CLASS_MAINSIGNALIN(pong_tilde_class, t_pong_tilde, x_input); +} diff --git a/externals/miXed/cyclone/sickle/pow.c b/externals/miXed/cyclone/sickle/pow.c new file mode 100644 index 000000000..2f95e8ffe --- /dev/null +++ b/externals/miXed/cyclone/sickle/pow.c @@ -0,0 +1,54 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define powf pow +#endif + +typedef t_sic t_pow; +static t_class *pow_class; + +static t_int *pow_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + while (nblock--) + { + float f1 = *in1++; + float f2 = *in2++; + /* CHECKED arg order, no protection against NaNs (negative base), + under-, and overflows */ + *out++ = powf(f2, f1); + } + return (w + 5); +} + +static void pow_dsp(t_pow *x, t_signal **sp) +{ + dsp_add(pow_perform, 4, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *pow_new(t_floatarg f) +{ + t_pow *x = (t_pow *)pd_new(pow_class); + sic_newinlet((t_sic *)x, f); /* CHECKED default 0 */ + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void pow_tilde_setup(void) +{ + pow_class = class_new(gensym("pow~"), + (t_newmethod)pow_new, 0, + sizeof(t_pow), 0, A_DEFFLOAT, 0); + sic_setup(pow_class, pow_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/rampsmooth.c b/externals/miXed/cyclone/sickle/rampsmooth.c new file mode 100644 index 000000000..00819da67 --- /dev/null +++ b/externals/miXed/cyclone/sickle/rampsmooth.c @@ -0,0 +1,210 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +/* LATER select the mode fitter-optionally */ +/* #define RAMPSMOOTH_GEOMETRIC /* geometric series (same as slide~) CHECKED */ +#ifndef RAMPSMOOTH_GEOMETRIC +#define RAMPSMOOTH_LINEAR +#endif +#define RAMPSMOOTH_DEFNUP 0. +#define RAMPSMOOTH_DEFNDOWN 0. + +typedef struct _rampsmooth +{ + t_sic x_sic; + int x_nup; + int x_ndown; + double x_upcoef; + double x_downcoef; + t_float x_last; +#ifdef RAMPSMOOTH_LINEAR + t_float x_target; + double x_incr; + int x_nleft; +#endif +} t_rampsmooth; + +static t_class *rampsmooth_class; + +#ifdef RAMPSMOOTH_LINEAR +/* this is a true linear ramper */ +static t_int *rampsmooth_perform(t_int *w) +{ + t_rampsmooth *x = (t_rampsmooth *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_float last = x->x_last; + t_float target = x->x_target; + double incr = x->x_incr; + int nleft = x->x_nleft; + while (nblock--) + { + t_float f = *in++; + if (f != target) + { + target = f; + if (f > last) + { + if (x->x_nup > 1) + { + incr = (f - last) * x->x_upcoef; + nleft = x->x_nup; + *out++ = (last += incr); + continue; + } + } + else if (f < last) + { + if (x->x_ndown > 1) + { + incr = (f - last) * x->x_downcoef; + nleft = x->x_ndown; + *out++ = (last += incr); + continue; + } + } + incr = 0.; + nleft = 0; + *out++ = last = f; + } + else if (nleft > 0) + { + *out++ = (last += incr); + if (--nleft == 0) + { + incr = 0.; + last = target; + } + } + else *out++ = target; + } + x->x_last = (PD_BIGORSMALL(last) ? 0. : last); + x->x_target = (PD_BIGORSMALL(target) ? 0. : target); + x->x_incr = incr; + x->x_nleft = nleft; + return (w + 5); +} + +#else + +/* this ramper generates a geometric series output for a single step input */ +static t_int *rampsmooth_perform(t_int *w) +{ + t_rampsmooth *x = (t_rampsmooth *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + t_float last = x->x_last; + while (nblock--) + { + t_float f = *in++; + if (f > last) + { + if (x->x_nup > 1) + { + *out++ = (last += (f - last) * x->x_upcoef); + continue; + } + } + else if (f < last) + { + if (x->x_ndown > 1) + { + *out++ = (last += (f - last) * x->x_downcoef); + continue; + } + } + *out++ = last = f; + } + x->x_last = (PD_BIGORSMALL(last) ? 0. : last); + return (w + 5); +} +#endif + +static void rampsmooth_dsp(t_rampsmooth *x, t_signal **sp) +{ + dsp_add(rampsmooth_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void rampsmooth_rampup(t_rampsmooth *x, t_floatarg f) +{ + int i = (int)f; + if (i > 1) /* CHECKME if 1 and 0 differ in any way */ + { + x->x_nup = i; + x->x_upcoef = 1. / (float)i; + } + else + { + x->x_nup = 0; + x->x_upcoef = 0.; + } +} + +static void rampsmooth_rampdown(t_rampsmooth *x, t_floatarg f) +{ + int i = (int)f; + if (i > 1) /* CHECKME if 1 and 0 differ in any way */ + { + x->x_ndown = i; + x->x_downcoef = 1. / (float)i; + } + else + { + x->x_ndown = 0; + x->x_downcoef = 0.; + } +} + +/* CHECKED */ +static void rampsmooth_ramp(t_rampsmooth *x, t_floatarg f) +{ + rampsmooth_rampup(x, f); + rampsmooth_rampdown(x, f); +} + +static void *rampsmooth_new(t_symbol *s, int ac, t_atom *av) +{ + t_rampsmooth *x = (t_rampsmooth *)pd_new(rampsmooth_class); + float f1 = RAMPSMOOTH_DEFNUP; + float f2 = RAMPSMOOTH_DEFNDOWN; + if (ac && av->a_type == A_FLOAT) + { + f1 = av->a_w.w_float; + ac--; av++; + if (ac && av->a_type == A_FLOAT) + f2 = av->a_w.w_float; + } + rampsmooth_rampup(x, f1); + rampsmooth_rampdown(x, f2); + x->x_last = 0.; +#ifdef RAMPSMOOTH_LINEAR + x->x_target = 0.; + x->x_incr = 0.; + x->x_nleft = 0; + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("rampup")); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("rampdown")); +#endif + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void rampsmooth_tilde_setup(void) +{ + rampsmooth_class = class_new(gensym("rampsmooth~"), + (t_newmethod)rampsmooth_new, 0, + sizeof(t_rampsmooth), 0, A_GIMME, 0); + sic_setup(rampsmooth_class, rampsmooth_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(rampsmooth_class, (t_method)rampsmooth_rampup, + gensym("rampup"), A_FLOAT, 0); + class_addmethod(rampsmooth_class, (t_method)rampsmooth_rampdown, + gensym("rampdown"), A_FLOAT, 0); + class_addmethod(rampsmooth_class, (t_method)rampsmooth_ramp, + gensym("ramp"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/rand.c b/externals/miXed/cyclone/sickle/rand.c new file mode 100644 index 000000000..93609c542 --- /dev/null +++ b/externals/miXed/cyclone/sickle/rand.c @@ -0,0 +1,96 @@ +/* Copyright (c) 1997-2003 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is a compilation of phasor~ and noise~ code from d_osc.c. */ + +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +typedef struct _rand +{ + t_sic x_sic; + double x_lastphase; + double x_nextphase; + float x_rcpsr; + int x_state; + float x_target; + float x_scaling; /* LATER use phase increment */ +} t_rand; + +static t_class *rand_class; + +static t_int *rand_perform(t_int *w) +{ + t_rand *x = (t_rand *)(w[1]); + int nblock = (int)(w[2]); + t_float *rin = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + double lastph = x->x_lastphase; + double ph = x->x_nextphase; + double tfph = ph + SHARED_UNITBIT32; + t_shared_wrappy wrappy; + int32_t normhipart; + float rcpsr = x->x_rcpsr; + float target = x->x_target; + float scaling = x->x_scaling; + + wrappy.w_d = SHARED_UNITBIT32; + normhipart = wrappy.w_i[SHARED_HIOFFSET]; + + while (nblock--) + { + float rate = *rin++; + if (ph > lastph) + { + int state = x->x_state; + float newtarget = ((float)((state & 0x7fffffff) - 0x40000000)) + * (float)(1.0 / 0x40000000); + x->x_state = state * 435898247 + 382842987; + x->x_scaling = scaling = target - newtarget; + x->x_target = target = newtarget; + } + *out++ = ph * scaling + target; + lastph = ph; + if (rate > 0) rate = -rate; + tfph += rate * rcpsr; + wrappy.w_d = tfph; + wrappy.w_i[SHARED_HIOFFSET] = normhipart; + ph = wrappy.w_d - SHARED_UNITBIT32; + } + x->x_lastphase = lastph; + x->x_nextphase = ph; + return (w + 5); +} + +static void rand_dsp(t_rand *x, t_signal **sp) +{ + x->x_rcpsr = 1. / sp[0]->s_sr; + dsp_add(rand_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *rand_new(t_floatarg f) +{ + t_rand *x = (t_rand *)pd_new(rand_class); + /* borrowed from d_osc.c, LATER rethink */ + static int init = 307; + x->x_state = (init *= 1319); + x->x_lastphase = 0.; + x->x_nextphase = 1.; /* start from 0, force retargetting */ + x->x_target = x->x_scaling = 0; + x->x_sic.s_f = (f > 0. ? f : 0.); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void rand_tilde_setup(void) +{ + rand_class = class_new(gensym("rand~"), + (t_newmethod)rand_new, 0, + sizeof(t_rand), 0, + A_DEFFLOAT, 0); + sic_setup(rand_class, rand_dsp, SIC_FLOATTOSIGNAL); +// logpost(NULL, 4, "this is cyclone/rand~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/sickle/record.c b/externals/miXed/cyclone/sickle/record.c new file mode 100644 index 000000000..20dfee7c6 --- /dev/null +++ b/externals/miXed/cyclone/sickle/record.c @@ -0,0 +1,274 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" +#include "sickle/arsic.h" + +#define RECORD_REDRAWPAUSE 1000. /* refractory period */ + +typedef struct _record +{ + t_arsic x_arsic; + float x_startpoint; /* the inputs */ + float x_endpoint; + int x_appendmode; + int x_loopmode; + int x_startindex; + int x_endindex; /* (one past last record position) */ + int x_pauseindex; + int x_phase; /* writing head */ + float x_sync; + 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) +{ + 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) +{ + /* 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.) + { + 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. / range; + } +} + +static void record_mstoindex(t_record *x) +{ + t_arsic *sic = (t_arsic *)x; + x->x_startindex = (int)(x->x_startpoint * sic->s_ksr); + if (x->x_startindex < 0) + x->x_startindex = 0; /* CHECKED */ + x->x_endindex = (int)(x->x_endpoint * sic->s_ksr); + if (x->x_endindex > sic->s_vecsize + || x->x_endindex <= 0) + x->x_endindex = sic->s_vecsize; /* CHECKED (both ways) */ + record_setsync(x); +} + +static void record_set(t_record *x, t_symbol *s) +{ + arsic_setarray((t_arsic *)x, s, 1); + 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; + record_mstoindex(x); +} + +static void record_endpoint(t_record *x, t_floatarg f) +{ + x->x_endpoint = f; + record_mstoindex(x); +} + +static void record_float(t_record *x, t_float f) +{ + if (x->x_isrunning = (f != 0)) + { + /* CHECKED: no (re)start in append mode */ + /* LATER consider restart if x->x_pauseindex == SHARED_INT_MAX */ + x->x_phase = x->x_appendmode ? x->x_pauseindex : x->x_startindex; + if (x->x_phase >= x->x_endindex) x->x_phase = SHARED_INT_MAX; + } + else if (x->x_phase != SHARED_INT_MAX) /* CHECKED: no rewind */ + { + clock_delay(x->x_clock, 10.); + x->x_pauseindex = x->x_phase; + x->x_phase = SHARED_INT_MAX; + } + record_setsync(x); +} + +static void record_append(t_record *x, t_floatarg f) +{ + if (f != 0) + { + x->x_appendmode = 1; /* CHECKED: always allow appending */ + } + else x->x_appendmode = 0; +} + +static void record_loop(t_record *x, t_floatarg f) +{ + x->x_loopmode = (f != 0); +} + +static t_int *record_perform(t_int *w) +{ + t_arsic *sic = (t_arsic *)(w[1]); + int nblock = (int)(w[2]); + int nch = sic->s_nchannels; + t_float *out = (t_float *)(w[3 + nch]); + t_record *x = (t_record *)sic; + int phase = x->x_phase; + int endphase = x->x_endindex; + float sync = x->x_sync; + if (sic->s_playable && endphase > phase) + { + int vecsize = sic->s_vecsize; + float syncincr = x->x_syncincr; + int ch, over, i, nxfer, ndone = 0; +loopover: + if ((nxfer = endphase - phase) > nblock) + { + nxfer = nblock; + over = 0; + } + else over = 1; + ch = nch; + while (ch--) + { + t_word *vp = sic->s_vectors[ch]; + if (vp) + { + t_float *ip = (t_float *)(w[3 + ch]) + ndone; + vp += phase; + i = nxfer; + /* LATER consider handling under and overflows */ +// while (i--) *vp++ = *ip++; + int j = 0; + while (i--) + { + vp[j].w_float = ip[j]; + j++; + } + } + } + i = nxfer; + + sync = phase; + syncincr = 1.; + + while (i--) + { + *out++ = sync; + sync += syncincr; + } + 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) + { + ndone += nxfer; + goto loopover; + } + goto alldone; + } + /* CHECKED: no restart in append mode */ + x->x_pauseindex = SHARED_INT_MAX; + x->x_phase = SHARED_INT_MAX; + x->x_sync = 1.; + x->x_syncincr = 0.; + } + else + { + x->x_phase += nxfer; + x->x_sync = sync; + goto alldone; + } + } + while (nblock--) *out++ = -1; //sync; +alldone: + return (w + sic->s_nperfargs + 1); +} + +static void record_dsp(t_record *x, t_signal **sp) +{ + arsic_dsp((t_arsic *)x, sp, record_perform, 1); + record_mstoindex(x); +} + +static void record_free(t_record *x) +{ + arsic_free((t_arsic *)x); + if (x->x_clock) clock_free(x->x_clock); +} + +static void *record_new(t_symbol *s, t_floatarg f) +{ + /* one auxiliary signal: sync output */ + t_record *x = (t_record *)arsic_new(record_class, s, (int)f, 0, 1); + if (x) + { + int nch = arsic_getnchannels((t_arsic *)x); + arsic_setminsize((t_arsic *)x, 2); + x->x_appendmode = 0; + x->x_loopmode = 0; + 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")); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft-1")); + outlet_new((t_object *)x, &s_signal); + } + return (x); +} + +void record_tilde_setup(void) +{ + record_class = class_new(gensym("record~"), + (t_newmethod)record_new, + (t_method)record_free, + sizeof(t_record), 0, + A_DEFSYM, A_DEFFLOAT, 0); + arsic_setup(record_class, record_dsp, record_float); + class_addmethod(record_class, (t_method)record_startpoint, + gensym("ft-2"), A_FLOAT, 0); + class_addmethod(record_class, (t_method)record_endpoint, + gensym("ft-1"), A_FLOAT, 0); + class_addmethod(record_class, (t_method)record_append, + gensym("append"), A_FLOAT, 0); + class_addmethod(record_class, (t_method)record_loop, + 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); +// logpost(NULL, 4, "this is cyclone/record~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/sickle/reson.c b/externals/miXed/cyclone/sickle/reson.c new file mode 100644 index 000000000..a9d9cf44b --- /dev/null +++ b/externals/miXed/cyclone/sickle/reson.c @@ -0,0 +1,123 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This filter (cmusic's nres and csound's resonr) originates from + CMJv6n4 article by Smith & Angell. See also section 9.6 of + ``Introduction to Digital Filters'' by Smith. */ + +/* CHECKME if creation args (or defaults) restored after signal disconnection */ + +#include <math.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define expf exp +#define cosf cos +#endif + +#define RESON_DEFQ .01 +#define RESON_MINQ 1e-20 /* CHECKME */ +#define RESON_MINOMEGA .0001 /* CHECKME */ +#define RESON_MAXOMEGA SHARED_PI /* CHECKME */ + +typedef struct _reson +{ + t_sic x_sic; + float x_srcoef; + float x_xnm1; + float x_xnm2; + float x_ynm1; + float x_ynm2; +} t_reson; + +static t_class *reson_class; + +static void reson_clear(t_reson *x) +{ + x->x_xnm1 = x->x_xnm2 = x->x_ynm1 = x->x_ynm2 = 0.; +} + +/* LATER make ready for optional audio-rate modulation + (separate scalar case routines, use sic_makecostable(), etc.) */ +static t_int *reson_perform(t_int *w) +{ + t_reson *x = (t_reson *)(w[1]); + int nblock = (int)(w[2]); + t_float *xin = (t_float *)(w[3]); + t_float *gin = (t_float *)(w[4]); + t_float fin0 = *(t_float *)(w[5]); + t_float qin0 = *(t_float *)(w[6]); + t_float *out = (t_float *)(w[7]); + float xnm1 = x->x_xnm1; + float xnm2 = x->x_xnm2; + float ynm1 = x->x_ynm1; + float ynm2 = x->x_ynm2; + /* CHECKME sampled once per block */ + float qinv = (qin0 > RESON_MINQ ? -1. / qin0 : (-1. / RESON_MINQ)); + float omega = fin0 * x->x_srcoef; + float radius, c1, c2, scale; + if (omega < RESON_MINOMEGA) + omega = RESON_MINOMEGA; + else if (omega > RESON_MAXOMEGA) + omega = RESON_MAXOMEGA; + radius = expf(omega * qinv); /* radius < 1 (because omega * qinv < 0) */ + c1 = 2. * radius * cosf(omega); + c2 = radius * radius; + scale = 1. - radius; + while (nblock--) + { + float yn, xn = *xin++; + /* CHECKED gain control */ + *out++ = yn = + *gin++ * scale * (xn - radius * xnm2) + c1 * ynm1 - c2 * ynm2; + xnm2 = xnm1; + xnm1 = xn; + ynm2 = ynm1; + ynm1 = yn; + } + x->x_xnm1 = xnm1; + x->x_xnm2 = xnm2; + /* LATER rethink */ + x->x_ynm1 = (PD_BIGORSMALL(ynm1) ? 0. : ynm1); + x->x_ynm2 = (PD_BIGORSMALL(ynm2) ? 0. : ynm2); + return (w + 8); +} + +static void reson_dsp(t_reson *x, t_signal **sp) +{ + x->x_srcoef = SHARED_2PI / sp[0]->s_sr; + reson_clear(x); + dsp_add(reson_perform, 7, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, + sp[4]->s_vec); +} + +static void *reson_new(t_floatarg f1, t_floatarg f2, t_floatarg f3) +{ + t_reson *x = (t_reson *)pd_new(reson_class); + x->x_srcoef = SHARED_2PI / sys_getsr(); + if (f1 < 0.) f1 = 0.; + if (f2 < 0.) f2 = 0.; + if (f3 <= 0.) + f3 = RESON_DEFQ; /* CHECKED */ + sic_newinlet((t_sic *)x, f1); + sic_newinlet((t_sic *)x, f2); + sic_newinlet((t_sic *)x, f3); + outlet_new((t_object *)x, &s_signal); + reson_clear(x); + return (x); +} + +void reson_tilde_setup(void) +{ + reson_class = class_new(gensym("reson~"), + (t_newmethod)reson_new, 0, + sizeof(t_reson), 0, + A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + sic_setup(reson_class, reson_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(reson_class, (t_method)reson_clear, gensym("clear"), 0); +} diff --git a/externals/miXed/cyclone/sickle/round.c b/externals/miXed/cyclone/sickle/round.c new file mode 100644 index 000000000..221de1414 --- /dev/null +++ b/externals/miXed/cyclone/sickle/round.c @@ -0,0 +1,150 @@ +#include "m_pd.h" +#include <math.h> +#include <string.h> +#include <ctype.h> + +#ifndef CYROUNDNEAR_DEF +#define CYROUNDNEAR_DEF 1 +#endif + +#ifndef CYROUNDNUM_DEF +#define CYROUNDNUM_DEF 0. +#endif + + +static t_class *round_tilde_class; + +typedef struct _round_tilde +{ + t_object x_obj; + //float x_f; //dummy var needed for CLASS_MAINSIGNALIN + float x_nearest; //nearest attribute (1 = rounding, 0 = truncation) +} t_round_tilde; + + +static void *round_tilde_new(t_symbol *s, int argc, t_atom *argv) +{ float f; + t_round_tilde *x = (t_round_tilde *)pd_new(round_tilde_class); + + int numargs = 0; + int pastargs = 0;//if we haven't declared any attrs yet + x->x_nearest = CYROUNDNEAR_DEF; + f = CYROUNDNUM_DEF; + while(argc > 0 ){ + t_symbol *curarg = atom_getsymbolarg(0, argc, argv); //returns nullpointer if not symbol + if(curarg == &s_){ //if nullpointer, should be float or int + if(!pastargs){ + switch(numargs){//we haven't declared attrs yet + case 0: f = atom_getfloatarg(0, argc, argv); + numargs++; + argc--; + argv++; + break; + + default: argc--; + argv++; + break; + }; + } + else{ + argc--; + argv++; + }; + } + else{ + pastargs = 1; + int isnear = strcmp(curarg->s_name, "@nearest") == 0; + if(isnear && argc >= 2){ + t_symbol *arg1 = atom_getsymbolarg(1, argc, argv); + if(arg1 == &s_){// is a number + x->x_nearest = atom_getfloatarg(1, argc, argv); + argc -= 2; + argv += 2; + } + else{ + goto errstate; + };} + else{ + goto errstate; + }; }; + }; + + + + + + + + + pd_float( (t_pd *)inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal), f); + outlet_new(&x->x_obj, gensym("signal")); + return (x); + + errstate: + pd_error(x, "round~: improper args"); + return NULL; +} +static t_int *round_tilde_perform(t_int *w) +{ + t_round_tilde *x = (t_round_tilde *)(w[1]); + t_float *in1 = (t_float *)(w[2]); + t_float *in2 = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + int n = (int)(w[5]); + float nearfloat; + int nearest; + + nearfloat = x->x_nearest; + if(nearfloat <= 0.){ + nearest = 0; + } + else{ + nearest = 1; + }; + + while (n--){ + float rounded,div; + float val = *(in1++); + float roundto = *(in2++); + if(roundto > 0.){ + div = val/roundto; //get the result of dividing the two + if(nearest == 1){//rounding + rounded = roundto*round(div); //round quotient to nearest int and multiply roundto by result + } + else{//truncation + rounded = roundto*(float)((int)div); //else lop off the decimal and multiply roundto by result + }; + } + else{//round is 0, do nothing + rounded = val; + + }; + *out++ = rounded; + }; + return (w+6); +} + + +static void round_tilde_nearest(t_round_tilde *x, t_float f, t_float glob){ + if(f <= 0.){ + x->x_nearest = 0; + } + else{ + x->x_nearest = 1; + }; +} +static void round_tilde_dsp(t_round_tilde *x, t_signal **sp) +{ + dsp_add(round_tilde_perform, 5, x, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); +} + + +void round_tilde_setup(void) +{ + round_tilde_class = class_new(gensym("round~"), (t_newmethod)round_tilde_new, 0, + sizeof(t_round_tilde), 0, A_GIMME, 0); + //CLASS_MAINSIGNALIN(round_tilde_class, t_round_tilde, 0); + class_addmethod(round_tilde_class, nullfn, gensym("signal"), 0); + class_addmethod(round_tilde_class, (t_method)round_tilde_dsp, gensym("dsp"), 0); + class_addmethod(round_tilde_class, (t_method)round_tilde_nearest, gensym("nearest"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/sah.c b/externals/miXed/cyclone/sickle/sah.c new file mode 100644 index 000000000..afac1e09a --- /dev/null +++ b/externals/miXed/cyclone/sickle/sah.c @@ -0,0 +1,70 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _sah +{ + t_sic x_sic; + t_float x_threshold; + t_float x_lastin; + t_float x_lastout; +} t_sah; + +static t_class *sah_class; + +static t_int *sah_perform(t_int *w) +{ + t_sah *x = (t_sah *)(w[1]); + int nblock = (t_int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *out = (t_float *)(w[5]); + t_float threshold = x->x_threshold; + t_float lastin = x->x_lastin; + t_float lastout = x->x_lastout; + while (nblock--) + { + float f = *in2++; + if (lastin <= threshold && f > threshold) /* CHECKME <=, > */ + lastout = *in1; + in1++; + lastin = f; + *out++ = lastout; + } + x->x_lastin = lastin; + x->x_lastout = lastout; + return (w + 6); +} + +static void sah_dsp(t_sah *x, t_signal **sp) +{ + dsp_add(sah_perform, 5, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void sah_float(t_sah *x, t_float f) +{ + x->x_threshold = f; +} + +static void *sah_new(t_floatarg f) +{ + t_sah *x = (t_sah *)pd_new(sah_class); + x->x_threshold = f; + x->x_lastin = 0; + x->x_lastout = 0; + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void sah_tilde_setup(void) +{ + sah_class = class_new(gensym("sah~"), + (t_newmethod)sah_new, 0, + sizeof(t_sah), 0, A_DEFFLOAT, 0); + sic_setup(sah_class, sah_dsp, sah_float); +} diff --git a/externals/miXed/cyclone/sickle/sampstoms.c b/externals/miXed/cyclone/sickle/sampstoms.c new file mode 100644 index 000000000..36b686c28 --- /dev/null +++ b/externals/miXed/cyclone/sickle/sampstoms.c @@ -0,0 +1,55 @@ +/* Copyright (c) 2003 krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _sampstoms +{ + t_sic x_sic; + float x_rcpksr; + t_outlet *x_floatout; +} t_sampstoms; + +static t_class *sampstoms_class; + +static void sampstoms_float(t_sampstoms *x, t_float f) +{ + outlet_float(x->x_floatout, f * x->x_rcpksr); +} + +static t_int *sampstoms_perform(t_int *w) +{ + t_sampstoms *x = (t_sampstoms *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out = (t_float *)(w[4]); + float rcpksr = x->x_rcpksr; + while (nblock--) *out++ = *in++ * rcpksr; + return (w + 5); +} + +static void sampstoms_dsp(t_sampstoms *x, t_signal **sp) +{ + x->x_rcpksr = 1000. / sp[0]->s_sr; + dsp_add(sampstoms_perform, 4, x, + sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *sampstoms_new(void) +{ + t_sampstoms *x = (t_sampstoms *)pd_new(sampstoms_class); + x->x_rcpksr = 1000. / sys_getsr(); /* LATER rethink */ + outlet_new((t_object *)x, &s_signal); + x->x_floatout = outlet_new((t_object *)x, &s_float); + return (x); +} + +void sampstoms_tilde_setup(void) +{ + sampstoms_class = class_new(gensym("sampstoms~"), + (t_newmethod)sampstoms_new, 0, + sizeof(t_sampstoms), 0, 0); + sic_setup(sampstoms_class, sampstoms_dsp, sampstoms_float); +} diff --git a/externals/miXed/cyclone/sickle/sickle.c b/externals/miXed/cyclone/sickle/sickle.c new file mode 100644 index 000000000..c83f54372 --- /dev/null +++ b/externals/miXed/cyclone/sickle/sickle.c @@ -0,0 +1,119 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "unstable/fragile.h" +#include "common/loud.h" +#include "common/port.h" +#include "hammer/file.h" +#include "../build_counter" +void allsickles_setup(void); + +typedef struct _sickle +{ + t_object x_ob; + t_hammerfile *x_filehandle; +} t_sickle; + +static t_class *sickle_class; +static int sickle_firstndx; +static int sickle_lastndx; + +static void sickle_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + int result = import_max(fn->s_name, ""); + outlet_float(((t_object *)z)->ob_outlet, (t_float)result); +} + +static void sickle_doimport(t_sickle *x, t_symbol *fn) +{ + if (fn && fn != &s_) + { + t_symbol *dir = hammerpanel_getopendir(x->x_filehandle); + int result = + import_max(fn->s_name, (dir && dir != &s_ ? dir->s_name : "")); + outlet_float(((t_object *)x)->ob_outlet, (t_float)result); + } + else hammerpanel_open(x->x_filehandle, 0); +} + +static void sickle_click(t_sickle *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + sickle_doimport(x, 0); +} + +static void sickle_import(t_sickle *x, t_symbol *fn) +{ + sickle_doimport(x, fn); +} + +static void sickle_cd(t_sickle *x, t_symbol *dir) +{ + hammerpanel_setopendir(x->x_filehandle, dir); +} + +static void sickle_pwd(t_sickle *x, t_symbol *s) +{ + t_symbol *dir; + if (s && s->s_thing && (dir = hammerpanel_getopendir(x->x_filehandle))) + pd_symbol(s->s_thing, dir); +} + +static void sickle_bang(t_sickle *x) +{ + fragile_class_printnames("sickle classes are: ", + sickle_firstndx, sickle_lastndx); +} + +static void sickle_free(t_sickle *x) +{ + hammerfile_free(x->x_filehandle); +} + +static void *sickle_new(void) +{ + t_sickle *x = (t_sickle *)pd_new(sickle_class); + x->x_filehandle = hammerfile_new((t_pd *)x, 0, sickle_readhook, 0, 0); + outlet_new((t_object *)x, &s_float); + return (x); +} + +void sickle_setup(void) +{ + if (canvas_getcurrent()) + { + /* Loading the library by object creation is banned, because of a danger + of having some of the classes already loaded. LATER rethink. */ + loud_error(0, "apparently an attempt to create a 'sickle' object"); + loud_errand(0, "without having sickle library preloaded"); + return; + } + if (zgetfn(&pd_objectmaker, gensym("sickle"))) + { + loud_error(0, "sickle is already loaded"); + return; + } + if (!zgetfn(&pd_objectmaker, gensym("cyclone"))) + post("this is sickle %s, %s %s build", + CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE); + sickle_class = class_new(gensym("sickle"), + (t_newmethod)sickle_new, + (t_method)sickle_free, + sizeof(t_sickle), 0, 0); + class_addbang(sickle_class, sickle_bang); + class_addmethod(sickle_class, (t_method)sickle_cd, + gensym("cd"), A_DEFSYM, 0); + class_addmethod(sickle_class, (t_method)sickle_pwd, + gensym("pwd"), A_SYMBOL, 0); + class_addmethod(sickle_class, (t_method)sickle_import, + 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); + hammerfile_setup(sickle_class, 0); + sickle_firstndx = fragile_class_count(); + allsickles_setup(); + sickle_lastndx = fragile_class_count() - 1; +} diff --git a/externals/miXed/cyclone/sickle/sinh.c b/externals/miXed/cyclone/sickle/sinh.c new file mode 100644 index 000000000..ff33b651a --- /dev/null +++ b/externals/miXed/cyclone/sickle/sinh.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define sinhf sinh +#endif + +typedef t_sic t_sinh; +static t_class *sinh_class; + +static t_int *sinh_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = sinhf(f); /* CHECKME no protection against overflow */ + } + return (w + 4); +} + +static void sinh_dsp(t_sinh *x, t_signal **sp) +{ + dsp_add(sinh_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *sinh_new(void) +{ + t_sinh *x = (t_sinh *)pd_new(sinh_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void sinh_tilde_setup(void) +{ + sinh_class = class_new(gensym("sinh~"), + (t_newmethod)sinh_new, 0, + sizeof(t_sinh), 0, 0); + sic_setup(sinh_class, sinh_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/sinx.c b/externals/miXed/cyclone/sickle/sinx.c new file mode 100644 index 000000000..29c7c4e51 --- /dev/null +++ b/externals/miXed/cyclone/sickle/sinx.c @@ -0,0 +1,51 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +/* by definition, this is just an interface to the -lm call + (do not use costable) */ + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define sinf sin +#endif + +typedef t_sic t_sinx; +static t_class *sinx_class; + +static t_int *sinx_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = sinf(f); + } + return (w + 4); +} + +static void sinx_dsp(t_sinx *x, t_signal **sp) +{ + dsp_add(sinx_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *sinx_new(void) +{ + t_sinx *x = (t_sinx *)pd_new(sinx_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void sinx_tilde_setup(void) +{ + sinx_class = class_new(gensym("sinx~"), + (t_newmethod)sinx_new, 0, + sizeof(t_sinx), 0, 0); + sic_setup(sinx_class, sinx_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/slide.c b/externals/miXed/cyclone/sickle/slide.c new file mode 100644 index 000000000..f672fe0b8 --- /dev/null +++ b/externals/miXed/cyclone/sickle/slide.c @@ -0,0 +1,78 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +#define SLIDE_DEFUP 1. +#define SLIDE_DEFDN 1. + +typedef struct _slide +{ + t_sic x_sic; + t_float x_last; +} t_slide; + +static t_class *slide_class; + +static t_int *slide_perform(t_int *w) +{ + t_slide *x = (t_slide *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *in3 = (t_float *)(w[5]); + t_float *out = (t_float *)(w[6]); + t_float last = x->x_last; + while (nblock--) + { + float f = *in1++; + if (f >= last) + { + float up = *in2++; + if (up > 1.) /* CHECKED */ + last += (f - last) / up; + else + last = f; + in3++; + } + else if (f < last) + { + float dn = *in3++; + if (dn > 1.) /* CHECKED */ + last += (f - last) / dn; + else + last = f; + in2++; + } + *out++ = last; + } + x->x_last = (PD_BIGORSMALL(last) ? 0. : last); + return (w + 7); +} + +static void slide_dsp(t_slide *x, t_signal **sp) +{ + dsp_add(slide_perform, 6, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); +} + +static void *slide_new(t_symbol *s, int ac, t_atom *av) +{ + t_slide *x = (t_slide *)pd_new(slide_class); + sic_inlet((t_sic *)x, 1, SLIDE_DEFUP, 0, ac, av); + sic_inlet((t_sic *)x, 2, SLIDE_DEFDN, 1, ac, av); + outlet_new((t_object *)x, &s_signal); + x->x_last = 0; + return (x); +} + +void slide_tilde_setup(void) +{ + slide_class = class_new(gensym("slide~"), + (t_newmethod)slide_new, 0, + sizeof(t_slide), 0, A_GIMME, 0); + sic_setup(slide_class, slide_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/spike.c b/externals/miXed/cyclone/sickle/spike.c new file mode 100644 index 000000000..13f9361bc --- /dev/null +++ b/externals/miXed/cyclone/sickle/spike.c @@ -0,0 +1,109 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +typedef struct _spike +{ + t_sic x_sic; + t_float x_last; + int x_count; + int x_precount; + int x_nwait; + float x_waittime; + float x_ksr; + float x_rcpksr; + t_clock *x_clock; +} t_spike; + +static t_class *spike_class; + +static void spike_tick(t_spike *x) +{ + outlet_float(((t_object *)x)->ob_outlet, x->x_count * x->x_rcpksr); + x->x_count = x->x_precount; +} + +static void spike_ft1(t_spike *x, t_floatarg f) +{ + if ((x->x_waittime = f) < 0.) + x->x_waittime = 0.; + x->x_nwait = (int)(x->x_waittime * x->x_ksr); +} + +static t_int *spike_perform(t_int *w) +{ + t_spike *x = (t_spike *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float last = x->x_last; + int count = x->x_count; + int nwait = x->x_nwait; + if (count + nblock > nwait) + { + /* LATER efficiency tricks */ + while (nblock--) + { + float f = *in++; + if (last == 0. && f != 0. /* CHECKED zero-to-nonzero */ + && count /* CHECKED no firing at startup */ + && count >= nwait) + { + clock_delay(x->x_clock, 0); + x->x_last = in[nblock - 1]; + x->x_count = count; + x->x_precount = nblock; + return (w + 4); + } + count++; + last = f; + } + x->x_last = last; + x->x_count = count; + } + else + { + x->x_last = in[nblock - 1]; + x->x_count += nblock; + } + return (w + 4); +} + +static void spike_dsp(t_spike *x, t_signal **sp) +{ + x->x_ksr = sp[0]->s_sr * 0.001; + x->x_rcpksr = 1000.0 / sp[0]->s_sr; + x->x_nwait = (int)(x->x_waittime * x->x_ksr); + dsp_add(spike_perform, 3, x, sp[0]->s_n, sp[0]->s_vec); +} + +static void spike_free(t_spike *x) +{ + if (x->x_clock) clock_free(x->x_clock); +} + +static void *spike_new(t_floatarg f) +{ + t_spike *x = (t_spike *)pd_new(spike_class); + x->x_last = 0.; + x->x_ksr = sys_getsr() * 0.001; + spike_ft1(x, f); + inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1")); + outlet_new((t_object *)x, &s_float); + x->x_clock = clock_new(x, (t_method)spike_tick); + return (x); +} + +void spike_tilde_setup(void) +{ + spike_class = class_new(gensym("spike~"), + (t_newmethod)spike_new, + (t_method)spike_free, + sizeof(t_spike), 0, + A_DEFFLOAT, 0); + sic_setup(spike_class, spike_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(spike_class, (t_method)spike_ft1, + gensym("ft1"), A_FLOAT, 0); +} diff --git a/externals/miXed/cyclone/sickle/svf.c b/externals/miXed/cyclone/sickle/svf.c new file mode 100644 index 000000000..bb8437bbe --- /dev/null +++ b/externals/miXed/cyclone/sickle/svf.c @@ -0,0 +1,188 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Based on Chamberlin's prototype from "Musical Applications of + Microprocessors" (csound's svfilter). Slightly distorted, + no upsampling. */ + +/* CHECKED scalar case: input preserved (not coefs) after changing mode */ +/* CHECKME if creation args (or defaults) restored after signal disconnection */ + +#include <math.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define sinf sin +#endif + +#define SVF_HZ 0 +#define SVF_LINEAR 1 +#define SVF_RADIANS 2 +#define SVF_DRIVE .0001 +#define SVF_QSTRETCH 1.2 /* CHECKED */ +#define SVF_MINR 0. /* CHECKME */ +#define SVF_MAXR 1.2 /* CHECKME */ +#define SVF_MINOMEGA 0. /* CHECKME */ +#define SVF_MAXOMEGA (SHARED_PI * .5) /* CHECKME */ +#define SVF_DEFFREQ 0. +#define SVF_DEFQ .01 /* CHECKME */ + +typedef struct _svf +{ + t_sic x_sic; + int x_mode; + float x_srcoef; + float x_band; + float x_low; +} t_svf; + +static t_class *svf_class; + +static t_symbol *ps_hz; +static t_symbol *ps_linear; +static t_symbol *ps_radians; + +static void svf_clear(t_svf *x) +{ + x->x_band = x->x_low = 0.; +} + +static void svf_hz(t_svf *x) +{ + x->x_mode = SVF_HZ; +} + +static void svf_linear(t_svf *x) +{ + x->x_mode = SVF_LINEAR; +} + +static void svf_radians(t_svf *x) +{ + x->x_mode = SVF_RADIANS; +} + +/* LATER make ready for optional audio-rate modulation + (separate scalar case routines, use sic_makecostable(), etc.) */ +static t_int *svf_perform(t_int *w) +{ + t_svf *x = (t_svf *)(w[1]); + int nblock = (int)(w[2]); + t_float *xin = (t_float *)(w[3]); + t_float fin0 = *(t_float *)(w[4]); + t_float rin0 = *(t_float *)(w[5]); + t_float *lout = (t_float *)(w[6]); + t_float *hout = (t_float *)(w[7]); + t_float *bout = (t_float *)(w[8]); + t_float *nout = (t_float *)(w[9]); + float band = x->x_band; + float low = x->x_low; + /* CHECKME sampled once per block */ + float c1, c2; + float r = (1. - rin0) * SVF_QSTRETCH; /* CHECKED */ + if (r < SVF_MINR) + r = SVF_MINR; + else if (r > SVF_MAXR) + r = SVF_MAXR; + c2 = r * r; + if (x->x_mode == SVF_HZ) + { + float omega = fin0 * x->x_srcoef; + if (omega < SVF_MINOMEGA) + omega = SVF_MINOMEGA; + else if (omega > SVF_MAXOMEGA) + omega = SVF_MAXOMEGA; + c1 = sinf(omega); + /* CHECKED irs slightly drift apart at high omega, LATER investigate */ + } + else if (x->x_mode == SVF_LINEAR) + c1 = sinf(fin0 * (SHARED_PI * .5)); /* CHECKME actual range of fin0 */ + else + c1 = fin0; /* CHECKME range */ + while (nblock--) + { + float high, xn = *xin++; + *lout++ = low = low + c1 * band; + *hout++ = high = xn - low - c2 * band; + *bout++ = band = c1 * high + band; + *nout++ = low + high; + band -= band * band * band * SVF_DRIVE; + } + /* LATER rethink */ + x->x_band = (PD_BIGORSMALL(band) ? 0. : band); + x->x_low = (PD_BIGORSMALL(low) ? 0. : low); + return (w + 10); +} + +static void svf_dsp(t_svf *x, t_signal **sp) +{ + x->x_srcoef = SHARED_2PI / sp[0]->s_sr; + svf_clear(x); + dsp_add(svf_perform, 9, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, + sp[4]->s_vec, sp[5]->s_vec, sp[6]->s_vec); +} + +static void *svf_new(t_symbol *s, int ac, t_atom *av) +{ + t_svf *x = (t_svf *)pd_new(svf_class); + t_float freq = SVF_DEFFREQ, qcoef = SVF_DEFQ; + t_symbol *modesym = 0; + int i; + for (i = 0; i < ac; i++) if (av[i].a_type == A_SYMBOL) + { + modesym = av[i].a_w.w_symbol; + break; + } + while (ac && av->a_type != A_FLOAT) ac--, av++; + if (ac) + { + freq = av->a_w.w_float; + ac--; av++; + while (ac && av->a_type != A_FLOAT) ac--, av++; + if (ac) + qcoef = av->a_w.w_float; + } + x->x_srcoef = SHARED_PI / sys_getsr(); + sic_newinlet((t_sic *)x, freq); + sic_newinlet((t_sic *)x, qcoef); + outlet_new((t_object *)x, &s_signal); + outlet_new((t_object *)x, &s_signal); + outlet_new((t_object *)x, &s_signal); + outlet_new((t_object *)x, &s_signal); + svf_clear(x); + if (modesym == ps_linear) + x->x_mode = SVF_LINEAR; + else if (modesym == ps_radians) + x->x_mode = SVF_RADIANS; + else + { + x->x_mode = SVF_HZ; + if (modesym && modesym != &s_ && + modesym != ps_hz && modesym != gensym("Hz")) + { + /* CHECKED no warning */ + } + } + return (x); +} + +void svf_tilde_setup(void) +{ + ps_hz = gensym("hz"); + ps_linear = gensym("linear"); + ps_radians = gensym("radians"); + svf_class = class_new(gensym("svf~"), + (t_newmethod)svf_new, 0, + sizeof(t_svf), 0, A_GIMME, 0); + sic_setup(svf_class, svf_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(svf_class, (t_method)svf_clear, gensym("clear"), 0); + class_addmethod(svf_class, (t_method)svf_hz, ps_hz, 0); + class_addmethod(svf_class, (t_method)svf_hz, gensym("Hz"), 0); + class_addmethod(svf_class, (t_method)svf_linear, ps_linear, 0); + class_addmethod(svf_class, (t_method)svf_radians, ps_radians, 0); +} diff --git a/externals/miXed/cyclone/sickle/tanh.c b/externals/miXed/cyclone/sickle/tanh.c new file mode 100644 index 000000000..0278e84dd --- /dev/null +++ b/externals/miXed/cyclone/sickle/tanh.c @@ -0,0 +1,48 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define tanhf tanh +#endif + +typedef t_sic t_tanh; +static t_class *tanh_class; + +static t_int *tanh_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = tanhf(f); /* CHECKME no protection against overflow */ + } + return (w + 4); +} + +static void tanh_dsp(t_tanh *x, t_signal **sp) +{ + dsp_add(tanh_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *tanh_new(void) +{ + t_tanh *x = (t_tanh *)pd_new(tanh_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void tanh_tilde_setup(void) +{ + tanh_class = class_new(gensym("tanh~"), + (t_newmethod)tanh_new, 0, + sizeof(t_tanh), 0, 0); + sic_setup(tanh_class, tanh_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/tanx.c b/externals/miXed/cyclone/sickle/tanx.c new file mode 100644 index 000000000..b55e748da --- /dev/null +++ b/externals/miXed/cyclone/sickle/tanx.c @@ -0,0 +1,51 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "m_pd.h" +#include "sickle/sic.h" + +/* by definition, this is just an interface to the -lm call + (do not use costable) */ + +#if defined(_WIN32) || defined(__APPLE__) +/* cf pd/src/x_arithmetic.c */ +#define tanf tan +#endif + +typedef t_sic t_tanx; +static t_class *tanx_class; + +static t_int *tanx_perform(t_int *w) +{ + int nblock = (int)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + while (nblock--) + { + float f = *in++; + *out++ = tanf(f); + } + return (w + 4); +} + +static void tanx_dsp(t_tanx *x, t_signal **sp) +{ + dsp_add(tanx_perform, 3, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +static void *tanx_new(void) +{ + t_tanx *x = (t_tanx *)pd_new(tanx_class); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void tanx_tilde_setup(void) +{ + tanx_class = class_new(gensym("tanx~"), + (t_newmethod)tanx_new, 0, + sizeof(t_tanx), 0, 0); + sic_setup(tanx_class, tanx_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/train.c b/externals/miXed/cyclone/sickle/train.c new file mode 100644 index 000000000..6454b0acb --- /dev/null +++ b/externals/miXed/cyclone/sickle/train.c @@ -0,0 +1,117 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" + +#define TRAIN_DEFPERIOD 1000 +#define TRAIN_DEFWIDTH 0.5 +#define TRAIN_DEFOFFSET 0 + +typedef struct _train +{ + t_sic x_sic; + int x_on; + double x_phase; + float x_rcpksr; + t_outlet *x_bangout; + t_clock *x_clock; +} t_train; + +static t_class *train_class; + +static void train_tick(t_train *x) +{ + outlet_bang(x->x_bangout); +} + +static t_int *train_perform(t_int *w) +{ + t_train *x = (t_train *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *in3 = (t_float *)(w[5]); + t_float *out = (t_float *)(w[6]); + float rcpksr = x->x_rcpksr; + double ph = x->x_phase; + double tfph = ph + SHARED_UNITBIT32; + t_shared_wrappy wrappy; + int32_t normhipart; + int on = x->x_on; + int edge = 0; + + wrappy.w_d = SHARED_UNITBIT32; + normhipart = wrappy.w_i[SHARED_HIOFFSET]; + + while (nblock--) + { + double onph, offph; + float period = *in1++; + + wrappy.w_d = *in3++ + SHARED_UNITBIT32; + wrappy.w_i[SHARED_HIOFFSET] = normhipart; + onph = wrappy.w_d - SHARED_UNITBIT32; + + wrappy.w_d = onph + *in2++ + SHARED_UNITBIT32; + wrappy.w_i[SHARED_HIOFFSET] = normhipart; + offph = wrappy.w_d - SHARED_UNITBIT32; + + if (offph > onph ? ph < offph && ph >= onph : ph < offph || ph >= onph) + { + if (!on) on = edge = 1; + *out++ = 1.; + } + else + { + on = 0; + *out++ = 0.; + } + if (period > rcpksr) /* LATER rethink */ + tfph += rcpksr / period; /* LATER revisit (profiling?) */ + wrappy.w_d = tfph; + wrappy.w_i[SHARED_HIOFFSET] = normhipart; + ph = wrappy.w_d - SHARED_UNITBIT32; + } + x->x_phase = ph; + x->x_on = on; + if (edge) clock_delay(x->x_clock, 0); + return (w + 7); +} + +static void train_dsp(t_train *x, t_signal **sp) +{ + x->x_rcpksr = 1000. / sp[0]->s_sr; + dsp_add(train_perform, 6, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); +} + +static void train_free(t_train *x) +{ + if (x->x_clock) clock_free(x->x_clock); +} + +static void *train_new(t_symbol *s, int ac, t_atom *av) +{ + t_train *x = (t_train *)pd_new(train_class); + x->x_on = 0; + x->x_phase = 0; + sic_inlet((t_sic *)x, 0, TRAIN_DEFPERIOD, 0, ac, av); + sic_inlet((t_sic *)x, 1, TRAIN_DEFWIDTH, 1, ac, av); + sic_inlet((t_sic *)x, 2, TRAIN_DEFOFFSET, 2, ac, av); + outlet_new((t_object *)x, &s_signal); + x->x_bangout = outlet_new((t_object *)x, &s_bang); + x->x_clock = clock_new(x, (t_method)train_tick); + return (x); +} + +void train_tilde_setup(void) +{ + train_class = class_new(gensym("train~"), + (t_newmethod)train_new, + (t_method)train_free, + sizeof(t_train), 0, A_GIMME, 0); + sic_setup(train_class, train_dsp, SIC_FLOATTOSIGNAL); +} diff --git a/externals/miXed/cyclone/sickle/trapezoid.c b/externals/miXed/cyclone/sickle/trapezoid.c new file mode 100644 index 000000000..b33cb022f --- /dev/null +++ b/externals/miXed/cyclone/sickle/trapezoid.c @@ -0,0 +1,105 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +#define TRAPEZOID_DEFUP 0.1 /* a bug? */ +#define TRAPEZOID_DEFDN 0.9 /* a bug? */ +#define TRAPEZOID_DEFLO 0.0 +#define TRAPEZOID_DEFHI 1.0 + +typedef struct _trapezoid +{ + t_sic x_sic; + float x_low; + float x_range; +} t_trapezoid; + +static t_class *trapezoid_class; + +static void trapezoid_lo(t_trapezoid *x, t_floatarg f) +{ + float high = x->x_low + x->x_range; + x->x_low = f; + x->x_range = high - x->x_low; +} + +static void trapezoid_hi(t_trapezoid *x, t_floatarg f) +{ + x->x_range = f - x->x_low; +} + +/* LATER optimize */ +static t_int *trapezoid_perform(t_int *w) +{ + t_trapezoid *x = (t_trapezoid *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *in3 = (t_float *)(w[5]); + t_float *out = (t_float *)(w[6]); + float low = x->x_low; + float range = x->x_range; + while (nblock--) + { + float ph = *in1++; + float upph = *in2++; + float dnph = *in3++; + /* CHECKED ph wrapped */ + if (ph < 0.) + ph -= (int)ph - 1.; + else if (ph > 1.) + ph -= (int)ph; + /* CHECKED upph, dnph clipped */ + if (upph < 0.) + upph = 0.; + else if (upph > 1.) /* CHECKME */ + upph = 1.; + if (dnph < upph) + dnph = upph; + else if (dnph > 1.) + dnph = 1.; + + if (ph < upph) + ph /= upph; + else if (ph < dnph) + ph = 1.; + else if (dnph < 1.) + ph = (1. - ph) / (1. - dnph); + else + ph = 0.; + *out++ = low + ph * range; + } + return (w + 7); +} + +static void trapezoid_dsp(t_trapezoid *x, t_signal **sp) +{ + dsp_add(trapezoid_perform, 6, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); +} + +static void *trapezoid_new(t_symbol *s, int ac, t_atom *av) +{ + t_trapezoid *x = (t_trapezoid *)pd_new(trapezoid_class); + sic_inlet((t_sic *)x, 1, TRAPEZOID_DEFUP, 0, ac, av); + sic_inlet((t_sic *)x, 2, TRAPEZOID_DEFDN, 1, ac, av); + outlet_new((t_object *)x, &s_signal); + x->x_low = TRAPEZOID_DEFLO; + x->x_range = (TRAPEZOID_DEFHI - TRAPEZOID_DEFLO); + return (x); +} + +void trapezoid_tilde_setup(void) +{ + trapezoid_class = class_new(gensym("trapezoid~"), + (t_newmethod)trapezoid_new, 0, + sizeof(t_trapezoid), 0, A_GIMME, 0); + sic_setup(trapezoid_class, trapezoid_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(trapezoid_class, (t_method)trapezoid_lo, + gensym("lo"), A_DEFFLOAT, 0); /* CHECKME */ + class_addmethod(trapezoid_class, (t_method)trapezoid_hi, + gensym("hi"), A_DEFFLOAT, 0); /* CHECKME */ +} diff --git a/externals/miXed/cyclone/sickle/triangle.c b/externals/miXed/cyclone/sickle/triangle.c new file mode 100644 index 000000000..703e5bab6 --- /dev/null +++ b/externals/miXed/cyclone/sickle/triangle.c @@ -0,0 +1,95 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +#define TRIANGLE_DEFPHASE 0.5 +#define TRIANGLE_DEFLO -1.0 +#define TRIANGLE_DEFHI 1.0 + +typedef struct _triangle +{ + t_sic x_sic; + float x_low; + float x_range; +} t_triangle; + +static t_class *triangle_class; + +static void triangle_lo(t_triangle *x, t_floatarg f) +{ + float high = x->x_low + x->x_range; + x->x_low = f; + x->x_range = high - x->x_low; +} + +static void triangle_hi(t_triangle *x, t_floatarg f) +{ + x->x_range = f - x->x_low; +} + +/* LATER optimize */ +static t_int *triangle_perform(t_int *w) +{ + t_triangle *x = (t_triangle *)(w[1]); + int nblock = (int)(w[2]); + t_float *in1 = (t_float *)(w[3]); + t_float *in2 = (t_float *)(w[4]); + t_float *out = (t_float *)(w[5]); + float low = x->x_low; + float range = x->x_range; + while (nblock--) + { + float ph = *in1++; + float peakph = *in2++; + /* CHECKED ph wrapped */ + if (ph < 0.) + ph -= (int)ph - 1.; + else if (ph > 1.) + ph -= (int)ph; + /* CHECKED peakph clipped */ + if (peakph < 0.) + peakph = 0.; + else if (peakph > 1.) + peakph = 1.; + + if (ph < peakph) + ph /= peakph; + else if (peakph < 1.) + ph = (1. - ph) / (1. - peakph); + else + ph = 0.; + *out++ = low + ph * range; + } + return (w + 6); +} + +static void triangle_dsp(t_triangle *x, t_signal **sp) +{ + dsp_add(triangle_perform, 5, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *triangle_new(t_symbol *s, int ac, t_atom *av) +{ + t_triangle *x = (t_triangle *)pd_new(triangle_class); + sic_inlet((t_sic *)x, 1, TRIANGLE_DEFPHASE, 0, ac, av); + outlet_new((t_object *)x, &s_signal); + x->x_low = TRIANGLE_DEFLO; + x->x_range = (TRIANGLE_DEFHI - TRIANGLE_DEFLO); + return (x); +} + +void triangle_tilde_setup(void) +{ + triangle_class = class_new(gensym("triangle~"), + (t_newmethod)triangle_new, 0, + sizeof(t_triangle), 0, A_GIMME, 0); + sic_setup(triangle_class, triangle_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(triangle_class, (t_method)triangle_lo, + gensym("lo"), A_DEFFLOAT, 0); /* CHECKED */ + class_addmethod(triangle_class, (t_method)triangle_hi, + gensym("hi"), A_DEFFLOAT, 0); /* CHECKED */ +} diff --git a/externals/miXed/cyclone/sickle/trunc.c b/externals/miXed/cyclone/sickle/trunc.c new file mode 100644 index 000000000..25d034dae --- /dev/null +++ b/externals/miXed/cyclone/sickle/trunc.c @@ -0,0 +1,89 @@ +/* code generated thanks to Schiavoni's Pure Data external Generator */ +#include "m_pd.h" +#include "math.h" + +// --------------------------------------------------- +// Class definition +// --------------------------------------------------- +static t_class *trunc_class; + +// --------------------------------------------------- +// Data structure definition +// --------------------------------------------------- +typedef struct _trunc { + t_object x_obj; + t_inlet * x_inlet_dsp_0; + + t_outlet * x_outlet_dsp_0; + +} t_trunc; + +// --------------------------------------------------- +// Functions signature +// --------------------------------------------------- +void * trunc_new(void);// Constructor +void trunc_destroy(t_trunc *x); //Destructor +static t_int * trunc_perform(t_int *w); //Perform function +static void trunc_dsp(t_trunc *x, t_signal **sp); //DSP function + +// --------------------------------------------------- +// Perform +// --------------------------------------------------- +static t_int * trunc_perform(t_int *w){ + // t_trunc *x = (t_trunc *)(w[1]); // Seu objeto + int n = (int)(w[2]); // Numero de samples no bloco + t_float *in1 = (t_float *)(w[3]); // bloco de entrada + t_float *out1 = (t_float *)(w[4]); // bloco de saida + + //interagir com todas as amostras do bloco (de 0 a n) + int i = 0; + for (i = 0 ; i < n ; i++){ + out1[i] = trunc(in1[i]); // trunc~ + } + return (w + 5); // proximo bloco +} + +// --------------------------------------------------- +// DSP Function +// --------------------------------------------------- +static void trunc_dsp(t_trunc *x, t_signal **sp){ + dsp_add(trunc_perform, 4, x, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); +} + +// --------------------------------------------------- +// Constructor of the class +// --------------------------------------------------- +void * trunc_new(void){ + t_trunc *x = (t_trunc *) pd_new(trunc_class); + + x->x_inlet_dsp_0 = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + + x->x_outlet_dsp_0 = outlet_new(&x->x_obj, &s_signal); + + return (void *) x; +} + +// --------------------------------------------------- +// Destroy the class +// --------------------------------------------------- +void trunc_destroy(t_trunc *x) { + inlet_free(x->x_inlet_dsp_0); + + outlet_free(x->x_outlet_dsp_0); + +} + +// --------------------------------------------------- +// Setup +// --------------------------------------------------- +void trunc_tilde_setup(void) { + trunc_class = class_new(gensym("trunc~"), + (t_newmethod) trunc_new, // Constructor + (t_method) trunc_destroy, // Destructor + sizeof (t_trunc), + CLASS_NOINLET, + 0);//Must always ends with a zero + + class_addmethod(trunc_class, (t_method) trunc_dsp, gensym("dsp"), 0); +} +// EOF--------------------------------------------------- \ No newline at end of file diff --git a/externals/miXed/cyclone/sickle/vectral.c b/externals/miXed/cyclone/sickle/vectral.c new file mode 100644 index 000000000..b9cdf69f6 --- /dev/null +++ b/externals/miXed/cyclone/sickle/vectral.c @@ -0,0 +1,235 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +#define VECTRAL_DEFSIZE 512 + +struct _vectral; +typedef void (*t_vectral_perform)(struct _vectral *, int, + t_float *, t_float *, t_float *, t_float *); + +typedef struct _vectral +{ + t_sic x_sic; + t_vectral_perform x_perform; + int x_bufsize; + t_float *x_buffer; + t_float *x_lastframe; + /* rampsmooth and slide state */ + double x_upcoef; + double x_downcoef; + /* deltaclip state */ + float x_lo; + float x_hi; +} t_vectral; + +static t_class *vectral_class; + +/* LATER after any modification make sure about syncing other variants + of perform routine to the bypassing version */ +/* this is: for i in [0..nblock) buf[in2[i]] = in3[i], out[i] = buf[in1[i]] */ +static void vectral_perform_bypass(t_vectral *x, int nblock, + t_float *in1, t_float *in2, t_float *in3, + t_float *out) +{ + t_float *buf = x->x_buffer; + int bufsize = x->x_bufsize; + t_float *last = x->x_lastframe; + int blocksize = nblock; + while (nblock--) + { + int indx = (int)*in2++; + /* CHECKED buffer not zeroed out (the buffer's garbage remains) */ + if (indx >= 0 && indx < bufsize) + buf[indx] = *in3; + in3++; + } + while (blocksize--) + { + int ondx = (int)*in1++; + if (ondx >= 0 && ondx < bufsize) + *out++ = *last++ = buf[ondx]; + else + /* CHECKED garbage in the output vector is cleared */ + *out++ = *last++ = 0.; + } +} + +/* this one is used for rampsmooth mode as well (see rampsmooth.c) + LATER recheck */ +static void vectral_perform_slide(t_vectral *x, int nblock, + t_float *in1, t_float *in2, t_float *in3, + t_float *out) +{ + t_float *buf = x->x_buffer; + int bufsize = x->x_bufsize; + double upcoef = x->x_upcoef; + double downcoef = x->x_downcoef; + t_float *last = x->x_lastframe; + int blocksize = nblock; + while (nblock--) + { + int indx = (int)*in2++; + if (indx >= 0 && indx < bufsize) + buf[indx] = *in3; + in3++; + } + while (blocksize--) + { + int ondx = (int)*in1++; + if (ondx >= 0 && ondx < bufsize) + { + /* CHECKME what is smoothed, and FIXME */ + float delta = buf[ondx] - *last; + *out++ = + (*last++ += (delta > 0 ? delta * upcoef : delta * downcoef)); + } + else *out++ = *last++ = 0.; + } +} + +static void vectral_perform_clip(t_vectral *x, int nblock, + t_float *in1, t_float *in2, t_float *in3, + t_float *out) +{ + t_float *buf = x->x_buffer; + int bufsize = x->x_bufsize; + float lo = x->x_lo; + float hi = x->x_hi; + t_float *last = x->x_lastframe; + int blocksize = nblock; + while (nblock--) + { + int indx = (int)*in2++; + if (indx >= 0 && indx < bufsize) + buf[indx] = *in3; + in3++; + } + while (blocksize--) + { + int ondx = (int)*in1++; + if (ondx >= 0 && ondx < bufsize) + { + /* CHECKME what is smoothed, and FIXME */ + float delta = buf[ondx] - *last; + if (delta < lo) + *out++ = (*last++ += lo); + else if (delta > hi) + *out++ = (*last++ += hi); + else + *out++ = *last++ = buf[ondx]; + } + else *out++ = *last++ = 0.; + } +} + +static t_int *vectral_perform(t_int *w) +{ + t_vectral *x = (t_vectral *)(w[1]); + (*x->x_perform)(x, (int)(w[2]), (t_float *)(w[3]), (t_float *)(w[4]), + (t_float *)(w[5]), (t_float *)(w[6])); + return (w + 7); +} + +static void vectral_dsp(t_vectral *x, t_signal **sp) +{ + int nblock = sp[0]->s_n; + if (nblock > x->x_bufsize) + nblock = x->x_bufsize; /* CHECKME */ + dsp_add(vectral_perform, 6, x, nblock, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec); +} + +static void vectral_rampsmooth(t_vectral *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac && av->a_type == A_FLOAT) + { + int i; + x->x_upcoef = ((i = (int)av->a_w.w_float) > 1 ? 1. / (double)i : 1.); + ac--; av++; + if (ac && av->a_type == A_FLOAT) + x->x_downcoef = + ((i = (int)av->a_w.w_float) > 1 ? 1. / (double)i : 1.); + else + x->x_downcoef = 1.; /* CHECKED */ + x->x_perform = vectral_perform_slide; /* see above */ + } + else x->x_perform = vectral_perform_bypass; /* CHECKED */ +} + +static void vectral_slide(t_vectral *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac && av->a_type == A_FLOAT) + { + double d; + x->x_upcoef = ((d = av->a_w.w_float) > 1. ? 1. / d : 1.); + ac--; av++; + if (ac && av->a_type == A_FLOAT) + x->x_downcoef = ((d = av->a_w.w_float) > 1. ? 1. / d : 1.); + else + x->x_downcoef = 1.; /* CHECKED */ + x->x_perform = vectral_perform_slide; + } + else x->x_perform = vectral_perform_bypass; /* CHECKED */ +} + +/* CHECKED 'deltaclip <hi> <lo>' (deltaclip~'s args are swapped) */ +static void vectral_deltaclip(t_vectral *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac && av->a_type == A_FLOAT) + { + x->x_hi = av->a_w.w_float; + ac--; av++; + if (ac && av->a_type == A_FLOAT) + x->x_lo = av->a_w.w_float; + else + x->x_lo = 0.; /* CHECKED */ + } + else x->x_lo = x->x_hi = 0.; /* CHECKED */ + x->x_perform = vectral_perform_clip; +} + +static void vectral_free(t_vectral *x) +{ + if (x->x_buffer) + freebytes(x->x_buffer, x->x_bufsize * sizeof(*x->x_buffer)); + if (x->x_lastframe) + freebytes(x->x_lastframe, x->x_bufsize * sizeof(*x->x_lastframe)); +} + +static void *vectral_new(t_floatarg f) +{ + t_vectral *x = (t_vectral *)pd_new(vectral_class); + int i = (int)f; + x->x_bufsize = (i > 0 ? i : VECTRAL_DEFSIZE); + if (!(x->x_buffer = getbytes(x->x_bufsize * sizeof(*x->x_buffer)))) + goto failure; + if (!(x->x_lastframe = getbytes(x->x_bufsize * sizeof(*x->x_lastframe)))) + goto failure; + x->x_perform = vectral_perform_bypass; + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + outlet_new((t_object *)x, &s_signal); + return (x); +failure: + pd_free((t_pd *)x); + return (0); +} + +void vectral_tilde_setup(void) +{ + vectral_class = class_new(gensym("vectral~"), + (t_newmethod)vectral_new, + (t_method)vectral_free, + sizeof(t_vectral), 0, A_DEFFLOAT, 0); + sic_setup(vectral_class, vectral_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(vectral_class, (t_method)vectral_rampsmooth, + gensym("rampsmooth"), A_GIMME, 0); + class_addmethod(vectral_class, (t_method)vectral_slide, + gensym("slide"), A_GIMME, 0); + class_addmethod(vectral_class, (t_method)vectral_deltaclip, + gensym("deltaclip"), A_GIMME, 0); +} diff --git a/externals/miXed/cyclone/sickle/wave.c b/externals/miXed/cyclone/sickle/wave.c new file mode 100644 index 000000000..1269842e3 --- /dev/null +++ b/externals/miXed/cyclone/sickle/wave.c @@ -0,0 +1,164 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "shared.h" +#include "sickle/sic.h" +#include "sickle/arsic.h" + +/* CHECKME (the refman): the extra channels are not played */ + +typedef struct _wave +{ + t_arsic x_arsic; + int x_nointerp; +} t_wave; + +static t_class *wave_class; + +static void wave_interp(t_wave *x, t_floatarg f) +{ + x->x_nointerp = (f == 0); + arsic_setminsize((t_arsic *)x, (x->x_nointerp ? 1 : 4)); + arsic_check((t_arsic *)x); +} + +static void wave_set(t_wave *x, t_symbol *s) +{ + arsic_setarray((t_arsic *)x, s, 1); +} + +static t_int *wave_perform(t_int *w) +{ + t_arsic *sic = (t_arsic *)(w[1]); + int nblock = (int)(w[2]); + int nch = sic->s_nchannels; + t_int *outp = w + 6; + if (sic->s_playable) + { + t_wave *x = (t_wave *)sic; + t_float *xin = (t_float *)(w[3]); + t_float *sin = (t_float *)(w[4]); + t_float *ein = (t_float *)(w[5]); + int vecsize = sic->s_vecsize; + t_word **vectable = sic->s_vectors; + float ksr = sic->s_ksr; + int nointerp = x->x_nointerp; + int maxindex = (nointerp ? vecsize - 1 : vecsize - 3); + int iblock; + + for (iblock = 0; iblock < nblock; iblock++) + { + float spos = *sin++ * ksr; + float xpos = *ein++ * ksr; + /* msp seems to be buggy here, but CHECKME again */ + int siz = (int)((xpos > 0 ? xpos : maxindex) - spos); + float phase = *xin++; + int ndx; + int ch = nch; + /* CHECKED: phase is clipped, not wrapped */ + if (phase < 0) phase = 0; + else if (phase > 1.0) phase = 1.0; + xpos = (siz > 0 ? spos + siz * phase : spos); + ndx = (int)xpos; + if (nointerp) + { + if (ndx < 0) ndx = 0; + else if (ndx > maxindex) ndx = maxindex; + while (ch--) + { + t_word *vp = vectable[ch]; + t_float *out = (t_float *)(outp[ch]); + out[iblock] = (vp ? vp[ndx].w_float : 0); + } + } + else + { + float frac, a, b, c, d, cminusb; + if (ndx < 1) + ndx = 1, frac = 0; + else if (ndx > maxindex) + ndx = maxindex, frac = 1; + else frac = xpos - ndx; + while (ch--) + { + t_word *vp = vectable[ch]; + t_float *out = (t_float *)(outp[ch]); + if (vp) + { + vp += ndx; + a = vp[-1].w_float; + b = vp[0].w_float; + c = vp[1].w_float; + d = vp[2].w_float; + cminusb = c-b; + out[iblock] = b + frac * ( + cminusb - 0.1666667f * (1. - frac) * ( + (d - a - 3.0f * cminusb) * frac + + (d + 2.0f * a - 3.0f * b) + ) + ); + } + else out[iblock] = 0; + } + } + } + } + else + { + int ch = nch; + while (ch--) + { + t_float *out = (t_float *)outp[ch]; + int n = nblock; + while (n--) *out++ = 0; + } + } + return (w + sic->s_nperfargs + 1); +} + +static void wave_dsp(t_wave *x, t_signal **sp) +{ + arsic_dsp((t_arsic *)x, sp, wave_perform, 1); +} + +static void wave_free(t_wave *x) +{ + arsic_free((t_arsic *)x); +} + +static void *wave_new(t_symbol *s, t_floatarg f1, t_floatarg f2, t_floatarg f3) +{ + /* three auxiliary signals: phase, clipstart, and clipend inputs */ + t_wave *x = (t_wave *)arsic_new(wave_class, s, (int)f3, 0, 3); + if (x) + { + int nch = arsic_getnchannels((t_arsic *)x); + if (f1 < 0) f1 = 0; + if (f2 < 0) f2 = 0; + sic_newinlet((t_sic *)x, f1); + sic_newinlet((t_sic *)x, f2); + while (nch--) + outlet_new((t_object *)x, &s_signal); + wave_interp(x, 1); + } + return (x); +} + +void wave_tilde_setup(void) +{ + wave_class = class_new(gensym("wave~"), + (t_newmethod)wave_new, + (t_method)wave_free, + sizeof(t_wave), 0, + A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + arsic_setup(wave_class, wave_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(wave_class, (t_method)wave_set, + gensym("set"), A_SYMBOL, 0); + class_addmethod(wave_class, (t_method)wave_interp, + gensym("interp"), A_FLOAT, 0); +// logpost(NULL, 4, "this is cyclone/wave~ %s, %dth %s build", +// CYCLONE_VERSION, CYCLONE_BUILD, CYCLONE_RELEASE); +} diff --git a/externals/miXed/cyclone/sickle/zerox.c b/externals/miXed/cyclone/sickle/zerox.c new file mode 100644 index 000000000..95b35d6c5 --- /dev/null +++ b/externals/miXed/cyclone/sickle/zerox.c @@ -0,0 +1,78 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "sickle/sic.h" + +#define ZEROX_DEFVOLUME 1. + +typedef struct _zerox +{ + t_sic x_sic; + t_float x_volume; + int x_lastsign; +} t_zerox; + +static t_class *zerox_class; + +static void zerox_set(t_zerox *x, t_floatarg f) +{ + x->x_volume = f; /* CHECKED anything goes (including 0.) */ +} + +static t_int *zerox_perform(t_int *w) +{ + t_zerox *x = (t_zerox *)(w[1]); + int nblock = (int)(w[2]); + t_float *in = (t_float *)(w[3]); + t_float *out1 = (t_float *)(w[4]); + t_float *out2 = (t_float *)(w[5]); + t_float volume = x->x_volume; + int lastsign = x->x_lastsign; + int i = nblock; + int count = 0; + t_float fcount; + while (i--) + { + /* CHECKED -1 -> 0 and 0 -> -1 are hits, 1 -> 0, 0 -> 1 are not */ + int sign = (*in++ < 0 ? 1. : 0.); /* LATER read the sign bit */ + if (sign != lastsign) + { + count++; + *out2++ = volume; + lastsign = sign; + } + else *out2++ = 0.; + } + fcount = (t_float)count; + while (nblock--) *out1++ = fcount; + x->x_lastsign = lastsign; + return (w + 6); +} + +static void zerox_dsp(t_zerox *x, t_signal **sp) +{ + dsp_add(zerox_perform, 5, x, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); +} + +static void *zerox_new(t_floatarg f) +{ + t_zerox *x = (t_zerox *)pd_new(zerox_class); + x->x_volume = (f == 0. ? ZEROX_DEFVOLUME : f); + x->x_lastsign = 0; /* CHECKED the very first sample hits if negative */ + outlet_new((t_object *)x, &s_signal); + outlet_new((t_object *)x, &s_signal); + return (x); +} + +void zerox_tilde_setup(void) +{ + zerox_class = class_new(gensym("zerox~"), + (t_newmethod)zerox_new, 0, + sizeof(t_zerox), 0, A_DEFFLOAT, 0); + sic_setup(zerox_class, zerox_dsp, SIC_FLOATTOSIGNAL); + class_addmethod(zerox_class, (t_method)zerox_set, + gensym("set"), A_FLOAT, 0); /* CHECKED arg obligatory */ +} diff --git a/externals/miXed/doc/help/cyclone/Borax-help.pd b/externals/miXed/doc/help/cyclone/Borax-help.pd new file mode 100644 index 000000000..33a7c9a23 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Borax-help.pd @@ -0,0 +1,126 @@ +#N canvas 272 43 553 637 10; +#X obj -1 770 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 389 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 397 244 424 414 META 0; +#X text 57 314 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 57 26 LICENSE SIBSD; +#X text 57 296 AUTHOR Miller Puckette; +#X text 57 332 RELEASE_DATE 1997; +#X text 57 278 LIBRARY cyclone; +#X text 57 8 KEYWORDS midi note music pitch velocity; +#X text 57 44 DESCRIPTION reports current info on note on/off; +#X text 57 80 INLET_1 float; +#X text 57 62 INLET_0 float; +#X text 57 98 INLET_2 bang; +#X text 57 116 OUTLET_0 float; +#X text 57 134 OUTLET_1 float; +#X text 57 152 OUTLET_2 float; +#X text 57 170 OUTLET_3 float; +#X text 57 188 OUTLET_4 float; +#X text 57 206 OUTLET_5 float; +#X text 57 224 OUTLET_6 float; +#X text 57 242 OUTLET_7 float; +#X text 57 260 OUTLET_8 float; +#X text 57 350 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 501 772 pd META; +#X obj -1 466 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 697 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 164 546 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 9 30 notein; +#X obj 65 30 midiin; +#X obj 121 30 midiparse; +#X obj 9 53 noteout; +#X obj 121 54 midiformat; +#X obj 65 54 midiout; +#X restore 207 772 pd Related_objects; +#X obj 79 444 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Borax 3 12 0 18 +-204280 -1 0; +#X text 11 23 reports current info on note on/off; +#X obj 87 78 notein 1; +#X floatatom 87 347 5 0 0 0 - - -; +#X floatatom 101 320 5 0 0 0 - - -; +#X floatatom 115 295 5 0 0 0 - - -; +#X floatatom 129 269 5 0 0 0 - - -; +#X floatatom 143 243 5 0 0 0 - - -; +#X floatatom 157 217 5 0 0 0 - - -; +#X floatatom 171 191 5 0 0 0 - - -; +#X floatatom 185 165 5 0 0 0 - - -; +#X floatatom 199 139 5 0 0 0 - - -; +#X text 413 523 offs); +#X text 427 592 offs received); +#X msg 199 78 bang; +#X text 231 76 reset all values; +#X text 377 477 on or off; +#X text 108 397 float; +#X text 157 396 - midi note number; +#X obj 79 500 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 108 420 float; +#X text 157 419 - velocity; +#X obj 79 421 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 108 442 bang; +#X text 157 441 - reset all values; +#X obj 79 523 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj 79 477 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 546 cnv 17 3 17 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X obj 79 569 cnv 17 3 17 empty \$0-pddp.cnv.let.0 4 5 9 0 16 -228856 +-162280 0; +#X obj 79 592 cnv 17 3 17 empty \$0-pddp.cnv.let.0 5 5 9 0 16 -228856 +-162280 0; +#X obj 79 615 cnv 17 3 17 empty \$0-pddp.cnv.let.0 6 5 9 0 16 -228856 +-162280 0; +#X obj 79 642 cnv 17 3 17 empty \$0-pddp.cnv.let.0 7 5 9 0 16 -228856 +-162280 0; +#X obj 79 665 cnv 17 3 17 empty \$0-pddp.cnv.let.0 8 5 9 0 16 -228856 +-162280 0; +#X text 108 523 float; +#X text 108 499 float; +#X text 108 546 float; +#X text 108 569 float; +#X text 108 592 float; +#X text 108 614 float; +#X text 108 641 float; +#X text 108 665 float; +#X text 108 477 float; +#X text 157 477 - nr of incoming note that is turned; +#X text 157 499 - voice nr of incoming note on / off; +#X text 157 523 - nr of notes being held (i.e. ons without; +#X text 157 545 - pitch of current on/off received; +#X text 157 569 - velocity of current note; +#X text 157 592 - nr of all completed notes (i.e. nr of note; +#X text 157 613 - duration of last note completed; +#X text 157 640 - total count of delta times (see below); +#X text 157 665 - delta time of last two note ons; +#X text 97 711 (none); +#X obj 424 4 Borax; +#X obj 79 397 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 87 113 Borax; +#X obj 7 770 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 9 0 61 0; +#X connect 9 1 61 1; +#X connect 21 0 61 2; +#X connect 61 0 10 0; +#X connect 61 1 11 0; +#X connect 61 2 12 0; +#X connect 61 3 13 0; +#X connect 61 4 14 0; +#X connect 61 5 15 0; +#X connect 61 6 16 0; +#X connect 61 7 17 0; +#X connect 61 8 18 0; diff --git a/externals/miXed/doc/help/cyclone/Bucket-help.pd b/externals/miXed/doc/help/cyclone/Bucket-help.pd new file mode 100644 index 000000000..c0f7fcca5 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Bucket-help.pd @@ -0,0 +1,95 @@ +#N canvas 273 108 552 473 10; +#X obj -1 451 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 309 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 403 368 416 190 META 0; +#X text 44 -126 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 44 -216 LICENSE SIBSD; +#X text 44 -144 AUTHOR Miller Puckette; +#X text 44 -108 RELEASE_DATE 1997; +#X text 44 -180 INLET_0 float; +#X text 44 -234 KEYWORDS pass float numbers; +#X text 44 -162 OUTLET_N float; +#X text 44 -198 DESCRIPTION pass numbers from outlet to outlet; +#X text 44 -90 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 499 453 pd META; +#X obj -1 349 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 386 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 78 483 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 8 28 buddy; +#X restore 202 453 pd Related_objects; +#X obj 76 358 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Bucket 3 12 0 18 +-204280 -1 0; +#X obj 150 195 Bucket 3; +#X floatatom 150 266 5 0 0 0 - - -; +#X floatatom 172 243 5 0 0 0 - - -; +#X floatatom 195 219 5 0 0 0 - - -; +#X msg 150 104 1 2 3 4; +#X obj 150 129 unpack f f f f; +#X floatatom 97 130 5 0 0 0 - - -; +#X obj 257 129 r to-bucket; +#X text 105 319 float; +#X text 149 319 - number to put in bucket; +#X text 105 360 float; +#X text 88 404 1) float; +#X text 149 404 - set number of outlets; +#X text 149 360 - numbers stored in bucket \, based on arg; +#X obj 504 3 Bucket; +#X text 206 194 creation arg sets number of outlets; +#X obj 76 320 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#N canvas 733 306 495 256 more... 0; +#X msg 58 22 bang; +#X text 103 20 sends out all values without shifting; +#X msg 58 42 freeze; +#X text 111 41 suspend output but continue shifting; +#X msg 58 63 thaw; +#X text 96 63 resume output; +#X msg 88 94 set 4; +#X obj 58 249 s to-bucket; +#X msg 146 129 L2R; +#X text 174 130 shift from left to right (default); +#X msg 156 153 R2L; +#X text 187 153 shift from right to left; +#X msg 100 129 l2r; +#X msg 109 154 r2l; +#X msg 145 221 roll \$1; +#X floatatom 145 199 5 0 0 0 - - -; +#X text 195 220 shifts (rolls) output values; +#X text 129 86 send the arg out each outlet and set it to the next +number to output; +#X connect 0 0 7 0; +#X connect 2 0 7 0; +#X connect 4 0 7 0; +#X connect 6 0 7 0; +#X connect 8 0 7 0; +#X connect 10 0 7 0; +#X connect 12 0 7 0; +#X connect 13 0 7 0; +#X connect 14 0 7 0; +#X connect 15 0 14 0; +#X restore 416 266 pd more...; +#X text 11 23 pass numbers from outlet to outlet; +#X text 69 51 As floats are input \, output floats shift from outlet +to outlet in a rotational pattern.; +#X obj 6 451 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 8 0 9 0; +#X connect 8 1 10 0; +#X connect 8 2 11 0; +#X connect 12 0 13 0; +#X connect 13 0 8 0; +#X connect 13 1 8 0; +#X connect 13 2 8 0; +#X connect 13 3 8 0; +#X connect 14 0 8 0; +#X connect 15 0 8 0; diff --git a/externals/miXed/doc/help/cyclone/Clip-help.pd b/externals/miXed/doc/help/cyclone/Clip-help.pd new file mode 100644 index 000000000..caf2f4966 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Clip-help.pd @@ -0,0 +1,71 @@ +#N canvas 409 100 553 550 10; +#X obj -1 527 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 353 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 517 372 430 247 META 0; +#X text 44 91 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 44 -42 LICENSE SIBSD; +#X text 44 71 AUTHOR Miller Puckette; +#X text 44 111 RELEASE_DATE 1997; +#X text 44 51 LIBRARY cyclone; +#X text 44 -62 KEYWORDS range constrain filter pass; +#X text 44 -22 DESCRIPTION constrains an int \, float \, or list within +a certain range; +#X text 44 11 INLET_0 float list; +#X text 44 31 OUTLET_0 float; +#X text 44 131 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 498 529 pd META; +#X obj -1 414 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 458 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 78 483 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 8 30 maxlib/limit; +#X obj 92 30 clip~; +#X restore 200 529 pd Related_objects; +#X obj 79 362 cnv 17 3 42 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 426 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Clip 3 12 0 18 +-204280 -1 0; +#X text 11 23 Constrains an int \, float or list within a certain range +; +#X text 110 361 float; +#X text 170 361 - float to pass through range filter; +#X text 110 386 list; +#X text 170 384 - list of floats to filter; +#X floatatom 238 221 0 0 0 0 - - -; +#X floatatom 209 194 0 0 0 0 - - -; +#X text 268 219 set max (int or float); +#X floatatom 129 137 0 0 0 0 - - -; +#X msg 107 105 0 20 40 60 80 100 120; +#X msg 165 164 set 100 200; +#X obj 107 286 print; +#X text 179 256 Optional arguments set the range. Default is 0 \, 0 +; +#X text 237 163 changes the clipping range; +#X text 242 194 set min (int or float); +#X obj 107 256 Clip 10 50; +#X text 110 425 float; +#X text 170 425 - outputs number if inside range; +#X text 91 467 1) float; +#X text 170 467 - sets minimun number of range; +#X text 92 488 2) float; +#X text 170 489 - sets maximum number of range; +#X obj 507 3 Clip; +#X text 249 106 input a list or number to pass through range filter +; +#X obj 6 528 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 14 0 24 2; +#X connect 15 0 24 1; +#X connect 17 0 24 0; +#X connect 18 0 24 0; +#X connect 19 0 24 0; +#X connect 24 0 20 0; diff --git a/externals/miXed/doc/help/cyclone/Clip~-help.pd b/externals/miXed/doc/help/cyclone/Clip~-help.pd new file mode 100644 index 000000000..7865b599d --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Clip~-help.pd @@ -0,0 +1,90 @@ +#N canvas 334 144 554 502 10; +#X obj -1 480 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 258 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 1124 197 440 260 META 0; +#X text 73 120 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 73 0 LICENSE SIBSD; +#X text 73 100 AUTHOR Miller Puckette; +#X text 73 140 RELEASE_DATE 1997; +#X text 73 80 LIBRARY cyclone; +#X text 73 -20 KEYWORDS signal constrain clip pass filter range; +#X text 73 20 DESCRIPTION constrains a signal within a certain range +; +#X text 73 40 INLET_0 signal; +#X text 73 60 OUTLET_0 signal; +#X text 73 160 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 482 pd META; +#X obj -1 301 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 343 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 228 453 427 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 8 29 clip~; +#X obj 50 29 clip; +#X restore 209 482 pd Related_objects; +#X obj 77 313 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Clip~ 3 12 0 18 +-204280 -1 0; +#X text 11 23 Constrains a signal within a certain range; +#X obj 67 223 tabwrite~ \$0-a; +#N canvas 0 0 450 300 (subpatch) 0; +#X array \$0-a 100 float 3; +#A 0 0.169761 0.183715 0.197062 0.209759 0.221755 0.233017 0.243509 +0.253192 0.262032 0.270007 0.277088 0.283244 0.288464 0.292732 0.296021 +0.298331 0.299656 0.299982 0.299313 0.297655 0.295009 0.291381 0.286791 +0.281251 0.274772 0.267385 0.259116 0.24998 0.240017 0.229262 0.217743 +0.205501 0.192581 0.179021 0.164865 0.150165 0.134968 0.11932 0.103277 +0.086894 0.0702202 0.0533143 0.0362322 0.0190294 0.00176354 -0.0155081 +-0.0327286 -0.0498398 -0.0667862 -0.0835123 -0.099959 -0.116075 -0.131808 +-0.147102 -0.161907 -0.176178 -0.189864 -0.202918 -0.215301 -0.226972 +-0.237885 -0.248012 -0.257321 -0.265768 -0.273337 -0.280004 -0.285736 +-0.290522 -0.294348 -0.297196 -0.299055 -0.299926 -0.299804 -0.298682 +-0.296573 -0.293485 -0.289414 -0.284388 -0.278422 -0.271528 -0.263733 +-0.255068 -0.245555 -0.235225 -0.224118 -0.21227 -0.199712 -0.186495 +-0.172661 -0.158251 -0.143317 -0.12791 -0.112077 -0.0958714 -0.0793497 +-0.0625643 -0.0455707 -0.0284267 -0.0111884 0.00608727; +#X coords 0 1 99 -1 100 75 1; +#X restore 378 114 graph; +#X obj 83 200 metro 150; +#X obj 83 180 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 1 +1; +#X obj 67 75 osc~ 440; +#X floatatom 136 76 5 0 0 0 - - -; +#X obj 67 130 *~ 0; +#X obj 136 106 / 10; +#X text 105 271 signal; +#X text 179 271 - singal to pass through range filter; +#X text 105 312 signal; +#X text 179 312 - outputs part of signal inside range; +#X text 179 352 - sets minimun number of range \, (default is 0); +#X text 179 374 - sets maximum number of range \, (default is 0); +#X obj 510 5 Clip~; +#X obj 483 49 pddp/dsp; +#X obj 77 271 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 168 67 click and drag tochange signal; +#X text 134 149 Optional arguments set the range. Default is 0 \, +0; +#X obj 7 482 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X obj 67 156 Clip~ -1 1; +#X text 86 353 1) signal/float; +#X text 86 374 2) signal/float; +#X obj -1 405 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#X text 86 426 Unlike internal [clip~] \, this object allows for either +signal or float to be used for its parameters (2nd and 3rd inlet); +#X connect 11 0 9 0; +#X connect 12 0 11 0; +#X connect 13 0 15 0; +#X connect 14 0 16 0; +#X connect 15 0 29 0; +#X connect 16 0 15 1; +#X connect 29 0 9 0; diff --git a/externals/miXed/doc/help/cyclone/Decode-help.pd b/externals/miXed/doc/help/cyclone/Decode-help.pd new file mode 100644 index 000000000..571ff2f9d --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Decode-help.pd @@ -0,0 +1,79 @@ +#N canvas 378 100 555 512 10; +#X obj 1 490 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 262 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 528 309 398 281 META 0; +#X text 33 71 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 33 -89 LICENSE SIBSD; +#X text 33 51 AUTHOR Miller Puckette; +#X text 33 91 RELEASE_DATE 1997; +#X text 33 31 LIBRARY cyclone; +#X text 33 -109 KEYWORDS send 1/0 binary specific; +#X text 33 -69 DESCRIPTION send out 1/0 to a specific outlet; +#X text 33 11 OUTLET_N float; +#X text 33 -29 INLET_1 toggle; +#X text 33 -9 INLET_2 toggle; +#X text 33 -49 INLET_0 float; +#X text 33 111 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 501 492 pd META; +#X obj 2 351 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 2 388 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 1 432 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 262 480 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 12 31 select; +#X obj 63 31 gate; +#X obj 102 31 route; +#X restore 200 492 pd Related_objects; +#X obj 79 271 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 295 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Decode 3 12 0 18 +-204280 -1 0; +#X obj 500 4 Decode; +#X text 11 23 send out 1/0 to a specific outlet; +#X obj 112 138 Decode 3; +#X floatatom 112 220 5 0 0 0 - - -, f 5; +#X floatatom 134 189 5 0 0 0 - - -, f 5; +#X floatatom 157 166 5 0 0 0 - - -, f 5; +#X floatatom 112 68 5 0 0 0 - - -, f 5; +#X text 146 67 send out 1 to which outlet (0...); +#X obj 134 94 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 157 114 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X text 151 90 enable all disabled outlets; +#X text 173 113 disable all outlets (overrides the above); +#X text 166 137 creation arg sets nr. of outlets; +#X text 110 270 float; +#X text 179 270 - outlet number to receive 1; +#X text 110 359 float; +#X text 179 359 - 1 or 0 based on which outlets selected; +#X text 92 401 1) float; +#X text 179 401 - number of outlets; +#X obj 79 360 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X text 110 297 toggle; +#X text 179 295 - enable all disabled outlets; +#X obj 79 323 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 110 322 toggle; +#X text 179 321 - disable all outlets (overrides outlet 1); +#X text 110 446 If the input number is higher than the number of outlets +\, then the highest numbered outlet is sent a 1; +#X obj 6 492 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 13 0; +#X connect 12 1 14 0; +#X connect 12 2 15 0; +#X connect 16 0 12 0; +#X connect 18 0 12 1; +#X connect 19 0 12 2; diff --git a/externals/miXed/doc/help/cyclone/Histo-help.pd b/externals/miXed/doc/help/cyclone/Histo-help.pd new file mode 100644 index 000000000..64e48ab87 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Histo-help.pd @@ -0,0 +1,72 @@ +#N canvas 421 38 558 475 10; +#X obj -1 448 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 263 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 579 230 385 258 META 0; +#X text 6 -101 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 6 -234 LICENSE SIBSD; +#X text 6 -120 AUTHOR Miller Puckette; +#X text 6 -82 RELEASE_DATE 1997; +#X text 6 -139 LIBRARY cyclone; +#X text 6 -63 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 6 -253 KEYWORDS histogram count generate; +#X text 6 -215 DESCRIPTION generates a histogram of the received numbers +; +#X text 6 -196 INLET_0 float list message; +#X text 6 -177 OUTLET_0 float; +#X text 6 -158 OUTLET_1 float; +#X restore 500 450 pd META; +#X obj -1 350 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 410 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 300 379 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 198 450 pd Related_objects; +#X obj 84 272 cnv 17 3 47 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 84 383 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Histo 3 12 0 18 +-204280 -1 0; +#X obj 510 2 Histo; +#X text 11 23 generates a histogram of the received numbers; +#X obj 117 165 Histo; +#X msg 85 65 clear; +#X text 123 65 erases received numbers; +#X floatatom 117 114 5 0 0 0 - - -, f 5; +#X floatatom 117 220 5 0 0 0 - - -, f 5; +#X floatatom 144 193 5 0 0 0 - - -, f 5; +#X text 157 221 current input; +#X text 181 193 number of times the current input was received; +#X floatatom 144 139 5 0 0 0 - - -, f 5; +#X text 179 138 same as left inlet but number is not counted; +#X msg 98 86 bang; +#X text 131 86 same as repeating the last number in right inlet; +#X text 114 271 float; +#X text 171 271 - number to go into histogram; +#X text 114 304 message; +#X obj 84 359 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 114 359 float; +#X text 171 359 - the current input; +#X text 171 383 - number of times the current input was received; +#X text 114 383 float; +#X text 114 288 list; +#X text 171 288 - list of numbers to go into histogram; +#X text 171 320 - bang: same as repeating the last number in right +inlet; +#X text 171 304 - clear: erase received numbers; +#X text 112 423 (none); +#X obj 9 447 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 15 0; +#X connect 11 1 16 0; +#X connect 12 0 11 0; +#X connect 14 0 11 0; +#X connect 19 0 11 1; +#X connect 21 0 11 0; diff --git a/externals/miXed/doc/help/cyclone/Line~-help.pd b/externals/miXed/doc/help/cyclone/Line~-help.pd new file mode 100644 index 000000000..39055a689 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Line~-help.pd @@ -0,0 +1,99 @@ +#N canvas 420 35 558 585 10; +#X obj -1 467 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 293 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 619 351 347 244 META 0; +#X text 5 160 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 5 20 LICENSE SIBSD; +#X text 5 140 AUTHOR Miller Puckette; +#X text 5 180 RELEASE_DATE 1997; +#X text 5 120 LIBRARY cyclone; +#X text 5 100 OUTLET_0 signal; +#X text 5 200 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 5 0 KEYWORDS signal generate ramp envelope; +#X text 5 40 DESCRIPTION generate signal ramp or envelope; +#X text 5 60 INLET_0 float message; +#X text 5 80 INLET_1 float; +#X restore 502 469 pd META; +#X obj -1 385 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 422 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 305 484 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 205 469 pd Related_objects; +#X obj 83 302 cnv 17 3 33 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 83 352 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 -91 cnv 15 552 40 empty \$0-pddp.cnv.header Line~ 3 12 0 +18 -204280 -1 0; +#X obj 510 -81 Line~; +#X text 11 -67 Generate signal ramp or envelope; +#X msg 346 136 resume; +#X msg 303 136 pause; +#X msg 296 100 stop; +#X obj 44 142 loadbang; +#X obj 44 164 metro 250; +#X floatatom 8 211 5 0 0 0 - - -, f 5; +#X obj 8 188 snapshot~; +#X obj 308 188 loadbang; +#X floatatom 272 257 5 0 0 0 - - -, f 5; +#X obj 272 234 snapshot~; +#X msg 8 33 1; +#X msg 36 33 0; +#X msg 59 72 5000; +#X msg 145 145 bang; +#X text 93 81 sent to the left inlet; +#X msg 272 41 0 \, 1 1000; +#X obj 272 167 Line~ 0.5; +#X obj 8 112 Line~ 0.5; +#X msg 288 64 0 \, 10 1000 0 1000 0.1 5000; +#X obj 308 210 metro 100; +#X text 110 301 float; +#X obj 83 394 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 110 352 float; +#X text 172 352 - sets the te nex float send to the left inlet; +#X text 172 301 - immediately sets value; +#X text 110 394 signal; +#X text 172 394 - ramps to value set amount of time; +#X text 110 320 message; +#X text 172 320 - can stop \, pause \, resume; +#X text 91 437 1) float; +#X text 172 437 - set the intial value; +#X msg 399 172 bang; +#X obj 479 -38 pddp/dsp; +#X text 327 91 stop the line generation and cancel all pending actions +; +#X text 389 128 pause and resume the line generation; +#X text 348 6 You can generate a ramp using a list of values \, set +and initial value \, then send a list of value and target time pairs. +; +#X text 69 103 argument sets the initial value; +#X text 93 57 sets the time for the next float; +#X text 67 8 a float on the left inlet sets immediately; +#X obj 10 467 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 27 0; +#X connect 12 0 27 0; +#X connect 13 0 27 0; +#X connect 14 0 15 0; +#X connect 15 0 17 0; +#X connect 17 0 16 0; +#X connect 18 0 30 0; +#X connect 20 0 19 0; +#X connect 21 0 28 0; +#X connect 22 0 28 0; +#X connect 23 0 28 1; +#X connect 24 0 15 0; +#X connect 26 0 27 0; +#X connect 27 0 20 0; +#X connect 28 0 17 0; +#X connect 29 0 27 0; +#X connect 30 0 20 0; +#X connect 42 0 30 0; diff --git a/externals/miXed/doc/help/cyclone/MouseState-help.pd b/externals/miXed/doc/help/cyclone/MouseState-help.pd new file mode 100644 index 000000000..66678ec03 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/MouseState-help.pd @@ -0,0 +1,106 @@ +#N canvas 425 38 558 590 10; +#X obj -1 669 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 397 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 618 311 351 289 META 0; +#X text 8 189 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 8 -4 LICENSE SIBSD; +#X text 8 171 AUTHOR Miller Puckette; +#X text 8 207 RELEASE_DATE 1997; +#X text 8 153 LIBRARY cyclone; +#X text 8 225 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 8 -22 KEYWORDS signal max maximum; +#X text 8 14 DESCRIPTION report mouse x/y \, delta x/delta y \, and +buttonpress; +#X text 8 45 INLET_0 bang message; +#X text 8 74 comment; +#X text 8 63 OUTLET_0 toggle; +#X text 8 87 OUTLET_1 float; +#X text 8 99 OUTLET_2 float; +#X text 8 117 OUTLET_3 float; +#X text 8 135 OUTLET_4 float; +#X restore 497 671 pd META; +#X obj -1 496 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 628 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 305 493 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 200 671 pd Related_objects; +#X obj 62 407 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 62 505 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header MouseState 3 12 +0 18 -204280 -1 0; +#X obj 478 8 MouseState; +#X obj 72 220 MouseState; +#X obj 72 353 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 86 326 5 0 0 0 - - -, f 5; +#X floatatom 100 301 5 0 0 0 - - -, f 5; +#X text 121 329 x; +#X msg 116 108 poll; +#X text 139 302 y; +#X floatatom 114 277 5 0 0 0 - - -, f 5; +#X text 152 278 delta x; +#X floatatom 129 251 5 0 0 0 - - -, f 5; +#X text 167 252 delta y; +#X text 91 352 button pressed ? (one button of course \, mac you know) +; +#X text 151 108 poll the mouse device; +#X msg 72 75 bang; +#X text 103 73 update current state; +#X msg 116 133 nopoll; +#X msg 116 158 zero; +#X text 149 160 set current pos to 0 \, 0 of our coordinate system +; +#X msg 116 183 reset; +#X text 157 183 reset 0 \, 0 to upper left corner; +#X text 85 405 bang; +#X text 179 405 - update current state; +#X text 85 425 other messages; +#X text 179 426 - poll: poll mouse device; +#X obj 62 527 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 62 550 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj 62 574 cnv 17 3 17 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X obj 62 597 cnv 17 3 17 empty \$0-pddp.cnv.let.0 4 5 9 0 16 -228856 +-162280 0; +#X text 179 505 - is button pressed?; +#X text 85 505 toggle; +#X text 85 527 float; +#X text 85 550 float; +#X text 85 574 float; +#X text 85 597 float; +#X text 179 527 - x position; +#X text 179 550 - y position; +#X text 179 574 - delta x from last poll; +#X text 179 597 - delta y from last poll; +#X text 105 641 (none); +#X text 179 441 - nopoll: do not poll mouse device; +#X text 179 454 - zero: set current position to 0 \, 0 of pd coordinate +system; +#X text 179 467 - reset: set 0 \, 0 (upper left corner); +#X text 161 133 don't poll the mouse divice; +#X text 43 50 shows the state of the mouse:; +#X text 11 23 report mouse x/y \, delta x/delta y \, and buttonpress +; +#X obj 12 670 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 11 0; +#X connect 10 1 12 0; +#X connect 10 2 13 0; +#X connect 10 3 17 0; +#X connect 10 4 19 0; +#X connect 15 0 10 0; +#X connect 23 0 10 0; +#X connect 25 0 10 0; +#X connect 26 0 10 0; +#X connect 28 0 10 0; diff --git a/externals/miXed/doc/help/cyclone/Peak-help.pd b/externals/miXed/doc/help/cyclone/Peak-help.pd new file mode 100644 index 000000000..d6a2c82c6 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Peak-help.pd @@ -0,0 +1,96 @@ +#N canvas 426 36 558 569 10; +#X obj -1 678 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 413 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 618 297 360 282 META 0; +#X text 5 195 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 5 24 LICENSE SIBSD; +#X text 5 176 AUTHOR Miller Puckette; +#X text 5 214 RELEASE_DATE 1997; +#X text 5 157 LIBRARY cyclone; +#X text 5 233 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 5 5 KEYWORDS output peak max maximum; +#X text 5 43 DESCRIPTION output only numbers greater than previous +; +#X text 5 62 INLET_0 float bang list; +#X text 5 81 INLET_1 float; +#X text 5 100 OUTLET_0 float; +#X text 5 119 OUTLET_1 bang; +#X text 5 138 OUTLET_2 bang; +#X restore 496 680 pd META; +#X obj -1 537 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 633 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 311 470 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 197 680 pd Related_objects; +#X obj 80 422 cnv 17 3 59 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 509 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Peak 3 12 0 18 +-204280 -1 0; +#X obj 506 9 Peak; +#X text 11 23 output only numbers greater than the previous; +#X text 107 421 float; +#X text 180 421 - number to check if above peak; +#X text 107 443 bang; +#X text 180 443 - sends current peak value out the left outlet; +#X text 107 465 list; +#X text 180 465 - x \, y pair \, first number resets peak value \, +second one is treated like normal input; +#X obj 80 546 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 107 509 float; +#X text 180 509 - set new peak value; +#X text 107 546 float; +#X text 180 546 - peak value; +#X text 89 646 1) float; +#X text 180 646 - intial peak value; +#X obj 80 571 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 80 596 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 107 571 bang; +#X text 107 596 bang; +#X text 180 571 - if new peak value; +#X text 180 596 - if not new peak value; +#X obj 69 291 Peak; +#X floatatom 69 64 5 0 0 0 - - -, f 5; +#X floatatom 69 372 5 0 0 0 - - -, f 5; +#X msg 85 152 4 4; +#X text 128 154 is treated like normal input.; +#X msg 79 129 6 7; +#X msg 92 174 3 2; +#X msg 99 214 bang; +#X text 132 213 sends current peak value out the left outlet; +#X floatatom 97 257 5 0 0 0 - - -, f 5; +#X text 137 256 set new peak value; +#X obj 83 348 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 97 322 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X text 127 141 first number resets peaks value \, then second one +; +#X text 108 347 bang if new peak value; +#X text 121 315 bang if peak value is exceeded for list input; +#X text 121 326 bang if not new peak value for float input; +#X text 111 59 float input checked against peak.if not above peak +\, outlet 2 is banged.if above peak \, outlet 1 is banged and newpeak +value is set; +#X obj 12 677 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 30 0 32 0; +#X connect 30 1 41 0; +#X connect 30 2 42 0; +#X connect 31 0 30 0; +#X connect 33 0 30 0; +#X connect 35 0 30 0; +#X connect 36 0 30 0; +#X connect 37 0 30 0; +#X connect 39 0 30 1; diff --git a/externals/miXed/doc/help/cyclone/README b/externals/miXed/doc/help/cyclone/README new file mode 100644 index 000000000..a554fc0f3 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/README @@ -0,0 +1,6 @@ + +these are help patches for the cyclone objects. +please read TODO if you want to lend a hand + +chris[youknowwhat]deathtospambots.lo-res.org + diff --git a/externals/miXed/doc/help/cyclone/Scope~-help.pd b/externals/miXed/doc/help/cyclone/Scope~-help.pd new file mode 100644 index 000000000..594a27f41 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Scope~-help.pd @@ -0,0 +1,69 @@ +#N canvas 429 35 559 519 10; +#X obj -1 611 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 404 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 633 310 345 214 META 0; +#X text -137 120 WEBSITE http://crca.ucsd.edu/~msp/; +#X text -137 25 LICENSE SIBSD; +#X text -137 101 AUTHOR Miller Puckette; +#X text -137 139 RELEASE_DATE 1997; +#X text -137 82 LIBRARY cyclone; +#X text -137 158 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text -137 6 KEYWORDS signal graphic display graph; +#X text -137 44 DESCRIPTION graphic signal display; +#X text -137 63 INLET_0 signal buffsize range frgb brgb; +#X restore 502 613 pd META; +#X obj -1 529 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 566 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 332 419 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 211 613 pd Related_objects; +#X obj 71 413 cnv 17 3 104 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Scope~ 3 12 0 18 +-204280 -1 0; +#X text 11 23 Graphic Signal Display; +#X text 98 412 signal; +#X text 264 413 - signal to display; +#X text 98 436 buffsize <int>; +#X text 264 436 - change buffer size; +#X text 98 459 range <int> <int>; +#X text 264 459 - change range of display; +#X text 98 480 frgb <int> <int> <int>; +#X text 98 540 (none); +#X obj 480 47 pddp/dsp; +#X obj 493 9 Scope~_; +#X text 98 579 (none); +#X text 264 501 - set color of graph in RGB values; +#X text 98 501 brgb <int> <int> <int>; +#X text 264 480 - set color of line in RGB values; +#X obj 84 251 Scope~ 245 119 256 3 100 -1 1 0 0 0 0 0 255 0 0 0 255 +0; +#X msg 248 109 bufsize 100; +#X msg 248 136 range 1 2; +#X msg 248 218 brgb 0 0 255; +#X msg 248 193 frgb 0 255 0; +#X obj 84 99 osc~ 500; +#X obj 84 70 hsl 100 18 20 500 1 1 empty empty frequency 5 8 1 10 -262131 +-1 -1 4200 0; +#X obj 84 208 *~; +#X obj 99 128 vsl 15 60 0.01 1 1 1 empty empty empty 0 -8 0 8 -225271 +-1 -1 3200 0; +#X text 232 173 colors:; +#X text 336 302 <--this is the Scope~ object; +#X obj 18 612 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 24 0 23 0; +#X connect 25 0 23 0; +#X connect 26 0 23 0; +#X connect 27 0 23 0; +#X connect 28 0 30 0; +#X connect 29 0 28 0; +#X connect 30 0 23 0; +#X connect 31 0 30 1; diff --git a/externals/miXed/doc/help/cyclone/Snapshot~-help.pd b/externals/miXed/doc/help/cyclone/Snapshot~-help.pd new file mode 100644 index 000000000..7ae8e076b --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Snapshot~-help.pd @@ -0,0 +1,102 @@ +#N canvas 421 24 568 620 10; +#X obj -1 764 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 439 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 617 373 354 242 META 0; +#X text 7 162 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 29 LICENSE SIBSD; +#X text 7 143 AUTHOR Miller Puckette; +#X text 7 181 RELEASE_DATE 1997; +#X text 7 124 LIBRARY cyclone; +#X text 7 200 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 7 10 KEYWORDS signal sample report values clocking snapshot +; +#X text 7 48 DESCRIPTION report sample values from a signal; +#X text 7 67 INLET_0 signal bang float offset other; +#X text 7 86 INLET_1 float; +#X text 7 105 OUTLET_0 float; +#X restore 502 766 pd META; +#X obj -1 615 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 652 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 710 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 302 510 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 198 766 pd Related_objects; +#X obj 72 449 cnv 17 3 125 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 72 624 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Snapshot~ 3 12 +0 18 -204280 -1 0; +#X obj 481 8 Snapshot~; +#X text 11 24 Report sample values from a signal; +#X text 103 447 signal; +#X text 200 447 - signal to sample; +#X text 103 467 bang; +#X text 200 467 - output a value from most recent signal vector; +#X text 103 489 float; +#X text 200 489 - change self clocking interval to float; +#X text 103 510 offset <int>; +#X text 200 510 - change offset within vector of sample output. range +is from 0 (least recent \, default) to the signal vector size - 1 (most +recent); +#X text 103 624 float; +#X text 200 624 - sample from signal; +#X text 86 663 1) float; +#X text 200 663 - self clocking interval (default 0); +#X text 86 683 2) float; +#X text 200 683 - sample offset within a vector (default 0); +#X text 113 729 Snapshot~'s internal clock runs only when the audio +is on.; +#X floatatom 106 216 0 0 0 0 - - -; +#X msg 106 237 offset \$1; +#X msg 160 303 100; +#X msg 129 303 20; +#X obj 69 102 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X msg 97 172 stop; +#X msg 93 152 start; +#X floatatom 54 402 0 0 0 0 - - -; +#X floatatom 129 331 0 0 0 0 - - -; +#X obj 56 73 cycle~ 440; +#X text 144 360 Optional arguments set self-clocking interval (default +0--clock off) and sample offset within a vector (default 0).; +#X text 178 215 change offset within vector of sample output. range +is from 0 (least recent \, default) to the signal vector size - 1 (most +recent); +#X obj 54 366 Snapshot~ 100; +#X text 86 97 trigger an output; +#X text 103 558 other messages; +#X text 200 558 - start \, stop to turn clock on/off; +#X obj 479 51 pddp/dsp; +#X obj 72 585 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 103 585 float; +#X text 200 585 - interval for self-clocking; +#X obj 89 135 tgl 14 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X text 140 135 turn clock on/off (by default \, the clock will be +on if a non-zero interval is supplied); +#X text 125 278 interval (for self-clocking):; +#X text 191 294 change to a value above 0 for self-clocking reports +of signal values; +#X obj 10 767 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 27 0 28 0; +#X connect 28 0 39 0; +#X connect 29 0 35 0; +#X connect 30 0 35 0; +#X connect 31 0 39 0; +#X connect 32 0 39 0; +#X connect 33 0 39 0; +#X connect 35 0 39 1; +#X connect 36 0 39 0; +#X connect 39 0 34 0; +#X connect 47 0 39 0; diff --git a/externals/miXed/doc/help/cyclone/TODO b/externals/miXed/doc/help/cyclone/TODO new file mode 100644 index 000000000..be52045bd --- /dev/null +++ b/externals/miXed/doc/help/cyclone/TODO @@ -0,0 +1,10 @@ +TODO: + +!!!! make sure no object slipped through !!!! + +not sure if correct: +grab - please review .... should maybe add krzysztofs test patch +next - please review someone .... is this ok ? +index~ - my example is a bit boring I guess +linedrive - used an old fts help patch, not ideal I guess ... +coll - see coll.txt diff --git a/externals/miXed/doc/help/cyclone/Table-help.pd b/externals/miXed/doc/help/cyclone/Table-help.pd new file mode 100644 index 000000000..e130bdfab --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Table-help.pd @@ -0,0 +1,116 @@ +#N canvas 427 36 565 456 10; +#X obj -1 767 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 389 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 605 223 372 242 META 0; +#X text 7 154 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 10 LICENSE SIBSD; +#X text 7 136 AUTHOR Miller Puckette; +#X text 7 172 RELEASE_DATE 1997; +#X text 7 118 LIBRARY cyclone; +#X text 7 190 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 7 -8 KEYWORDS table graph store array; +#X text 7 28 DESCRIPTION store and graphically edit an array of numbers +; +#X text 7 46 INLET_0 int <int1>_<int2> inv_<int> other; +#X text 7 64 INLET_1 ??????; +#X text 7 82 OUTLET_0 float; +#X text 7 100 OUTLET_1 bang; +#X restore 500 769 pd META; +#X obj -1 517 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 584 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 640 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 310 356 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 195 769 pd Related_objects; +#X obj 77 398 cnv 17 3 78 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 77 528 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Table 3 12 0 18 +-204280 -1 0; +#X obj 506 10 Table; +#C restore; +#X text 11 23 Store and graphically edit an array of numbers; +#X text 197 397 - outputs number at position of float; +#X text 101 397 int; +#X text 101 417 <int1> <int2>; +#X text 197 417 - store int 2 at postion int1; +#X text 101 437 inv <int>; +#X text 197 438 - get position of <int> in array; +#X text 101 460 other messages; +#X text 101 527 float; +#X text 197 529 - could mean various things depending on input; +#X text 197 598 - option arg to name the table \, or to read in from +the table name specified; +#X obj 77 553 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 101 552 bang; +#X text 197 554 - when table has been changed by editing it with the +mouse; +#X obj 135 121 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X text 201 149 store; +#X text 152 118 random; +#X msg 317 284 quantile \$1; +#X msg 110 61 open; +#X msg 207 266 \$1 \$1; +#X msg 260 266 inv \$1; +#X text 154 149 read; +#X obj 260 171 vsl 16 66 0 79 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X text 249 149 inv read; +#X floatatom 110 345 0 0 0 0 - - -; +#X obj 142 347 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X floatatom 317 265 0 0 0 0 - - -; +#X obj 317 246 << 9; +#X text 310 149 read quantile; +#X text 163 340 The right outlet sends a bang when the table has been +changed by editing with the mouse; +#X text 108 702 You may name the table with an argument. Many boxes +may share the same table by using the same name. If there is a file +by that name it will be read into the table if possible.; +#X msg 118 81 sum; +#X msg 124 101 length; +#X text 108 657 You can close the table window by clicking its close +box \, and reopen it by double-clicking the "table" box or sending +it the open message.; +#X obj 110 317 Table; +#C restore; +#X obj 317 171 vsl 16 66 0 79 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 207 171 vsl 16 66 0 79 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 162 171 vsl 16 66 0 79 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X text 197 460 - open \, sum \, length; +#X obj 77 487 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 197 488 - ?????; +#X text 101 486 ??????; +#X text 84 598 1) table name; +#X obj 10 767 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 25 0 45 0; +#X connect 28 0 45 0; +#X connect 29 0 45 0; +#X connect 30 0 45 0; +#X connect 31 0 45 0; +#X connect 33 0 31 0; +#X connect 37 0 28 0; +#X connect 38 0 37 0; +#X connect 42 0 45 0; +#X connect 43 0 45 0; +#X connect 45 0 35 0; +#X connect 45 1 36 0; +#X connect 46 0 38 0; +#X connect 47 0 30 0; +#X connect 48 0 45 0; diff --git a/externals/miXed/doc/help/cyclone/TogEdge-help.pd b/externals/miXed/doc/help/cyclone/TogEdge-help.pd new file mode 100644 index 000000000..67a4c4e4f --- /dev/null +++ b/externals/miXed/doc/help/cyclone/TogEdge-help.pd @@ -0,0 +1,73 @@ +#N canvas 427 33 559 531 10; +#X obj -1 503 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 313 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 618 304 358 235 META 0; +#X text 6 63 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 6 -77 LICENSE SIBSD; +#X text 6 43 AUTHOR Miller Puckette; +#X text 6 83 RELEASE_DATE 1997; +#X text 6 23 LIBRARY cyclone; +#X text 6 103 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 6 -97 KEYWORDS toggle edge transition zero non-zero nz; +#X text 6 -57 DESCRIPTION report zero / non-zero transitions; +#X text 6 -37 INLET_0 float bang list; +#X text 6 -17 OUTLET_0 bang; +#X text 6 3 OUTLET_1 bang; +#X restore 498 505 pd META; +#X obj -1 396 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 460 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 308 426 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 193 505 pd Related_objects; +#X obj 78 324 cnv 17 3 55 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 405 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header TogEdge 3 12 0 +18 -204280 -1 0; +#X obj 493 10 TogEdge; +#X obj 198 190 TogEdge; +#X floatatom 198 67 5 0 0 0 - - -, f 5; +#X obj 203 220 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 245 220 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 222 153 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 241 151 switches 0/nz; +#X msg 218 121 1; +#X obj 237 240 print zero; +#X obj 198 268 print nonzero; +#X text 108 323 float; +#X text 159 323 - number to input \, check for transitions; +#X text 108 343 bang; +#X text 159 343 - switch 0/nz transition; +#X text 108 364 list; +#X text 159 364 - list of number to check for transition; +#X text 105 472 (none); +#X obj 78 431 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 108 405 bang; +#X text 108 431 bang; +#X text 159 405 - for nonzero input; +#X text 159 431 - for zero input; +#X msg 217 96 0; +#X text 240 67 float inputs; +#X text 11 23 report zero / non-zero transitions; +#X obj 6 505 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 12 0; +#X connect 10 0 18 0; +#X connect 10 1 13 0; +#X connect 10 1 17 0; +#X connect 11 0 10 0; +#X connect 14 0 10 0; +#X connect 16 0 10 0; +#X connect 31 0 10 0; diff --git a/externals/miXed/doc/help/cyclone/Trough-help.pd b/externals/miXed/doc/help/cyclone/Trough-help.pd new file mode 100644 index 000000000..a80a2f334 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Trough-help.pd @@ -0,0 +1,94 @@ +#N canvas 344 173 558 450 10; +#X obj -1 669 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 422 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 591 176 387 283 META 0; +#X text 11 204 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 24 LICENSE SIBSD; +#X text 11 184 AUTHOR Miller Puckette; +#X text 11 224 RELEASE_DATE 1997; +#X text 11 164 LIBRARY cyclone; +#X text 11 4 KEYWORDS smaller min minimum compare; +#X text 11 44 DESCRIPTION output only numbers smaller than the previous +; +#X text 11 64 INLET_0 float bang list; +#X text 11 84 INLET_1 float; +#X text 11 124 OUTLET_1 bang; +#X text 11 144 OUTLET_2 bang; +#X text 11 104 OUTLET_0 float; +#X text 11 244 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 499 671 pd META; +#X obj -1 539 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 627 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 325 350 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 40 35 Peak; +#X restore 209 671 pd Related_objects; +#X obj 83 432 cnv 17 3 60 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 83 511 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Trough 3 12 0 18 +-204280 -1 0; +#X text 112 430 float; +#X text 112 452 bang; +#X text 112 474 list; +#X obj 83 548 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 112 511 float; +#X text 112 548 float; +#X text 94 640 1) float; +#X obj 83 573 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 83 598 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 11 23 output only numbers smaller than the previous; +#X floatatom 106 81 5 0 0 0 - - -, f 5; +#X floatatom 106 372 5 0 0 0 - - -, f 5; +#X msg 127 134 4 4; +#X msg 119 114 6 7; +#X msg 135 154 3 2; +#X msg 145 190 bang; +#X floatatom 139 256 5 0 0 0 - - -, f 5; +#X obj 122 346 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 139 323 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +1; +#X obj 106 291 Trough; +#X text 180 190 sends current min value out the left outlet; +#X text 180 430 - number to check if below min; +#X text 180 452 - sends current min value out the left outlet; +#X text 180 474 - x \, y pair \, first number resets min value \, second +one is treated like normal input; +#X text 180 511 - set new min value; +#X text 180 548 - min value; +#X obj 500 11 Trough; +#X text 144 372 min value; +#X text 146 78 number to check if below min; +#X text 165 120 if input is list \, first number resets minimum value +\, then second one is treated like normal input.; +#X text 180 640 - intial min value; +#X obj 6 671 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X text 112 573 float; +#X text 112 598 float; +#X text 180 573 - 1 if new min value \, otherwise 0; +#X text 180 598 - 1 if not new min value \, otherwise 0; +#X text 161 322 above last known minimum value; +#X text 145 345 new minimum value; +#X text 179 254 set new minimum value AND immediately output it; +#X connect 19 0 28 0; +#X connect 21 0 28 0; +#X connect 22 0 28 0; +#X connect 23 0 28 0; +#X connect 24 0 28 0; +#X connect 25 0 28 1; +#X connect 28 0 20 0; +#X connect 28 1 26 0; +#X connect 28 2 27 0; diff --git a/externals/miXed/doc/help/cyclone/Uzi-help.pd b/externals/miXed/doc/help/cyclone/Uzi-help.pd new file mode 100644 index 000000000..92323b1fc --- /dev/null +++ b/externals/miXed/doc/help/cyclone/Uzi-help.pd @@ -0,0 +1,88 @@ +#N canvas 426 35 557 631 10; +#X obj -1 604 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 369 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 592 375 383 264 META 0; +#X text 9 73 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 9 -102 LICENSE SIBSD; +#X text 9 55 AUTHOR Miller Puckette; +#X text 9 91 RELEASE_DATE 1997; +#X text 9 37 LIBRARY cyclone; +#X text 9 109 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 9 -120 KEYWORDS bang set send fast; +#X text 9 -84 DESCRIPTION send a specified number of bangs as fast +as possible; +#X text 9 -53 INLET_0 bang messages; +#X text 9 -17 OUTLET_0 bang; +#X text 9 -35 INLET_1 float; +#X text 9 1 OUTLET_1 bang; +#X text 9 19 OUTLET_2 float; +#X restore 500 606 pd META; +#X obj -1 465 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 554 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 315 531 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 201 606 pd Related_objects; +#X obj 81 378 cnv 17 3 42 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 474 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header Uzi 3 12 0 18 -204280 +-1 0; +#X obj 505 11 Uzi; +#X text 11 23 send a specified nr of bangs as fast as possible; +#X text 108 378 bang; +#X text 181 377 - send x number of bangs; +#X text 108 398 messages; +#X text 181 398 - pause \, break \, continue \, resume (all in reference +to sending bangs); +#X obj 81 437 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 108 437 float; +#X text 181 436 - set number of bangs to output; +#X text 93 570 1) float; +#X text 181 569 - set number of bangs; +#X obj 134 320 print uzi; +#X obj 134 72 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 162 209 5 0 0 0 - - -, f 5; +#X text 208 209 set number of bangs; +#X msg 144 103 pause; +#X text 241 103 pause sending bangs; +#X msg 187 103 break; +#X msg 215 128 resume; +#X msg 151 128 continue; +#X text 272 129 resume sending; +#X floatatom 162 259 5 0 0 0 - - -, f 5; +#X obj 148 290 print lastbang; +#X text 108 473 bang; +#X text 181 473 - bang (based on number of bangs stored); +#X text 108 526 float; +#X obj 134 234 Uzi 2; +#X obj 81 500 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 108 499 bang; +#X obj 81 526 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 181 499 - bangs when the last bang has fired; +#X text 176 234 optional arg sets initial number of bangs; +#X text 181 526 - number of bangs sent; +#X text 200 259 number of bangs sent; +#X text 156 70 start Uzi full of bangs; +#X obj 15 606 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 21 0 35 0; +#X connect 22 0 35 1; +#X connect 24 0 35 0; +#X connect 26 0 35 0; +#X connect 27 0 35 0; +#X connect 28 0 35 0; +#X connect 35 0 20 0; +#X connect 35 1 31 0; +#X connect 35 2 30 0; diff --git a/externals/miXed/doc/help/cyclone/accum-help.pd b/externals/miXed/doc/help/cyclone/accum-help.pd new file mode 100644 index 000000000..14d8ab8c0 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/accum-help.pd @@ -0,0 +1,82 @@ +#N canvas 421 39 558 505 10; +#X obj 0 476 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 273 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 379 298 424 269 META 0; +#X text 25 131 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 25 -29 LICENSE SIBSD; +#X text 25 111 AUTHOR Miller Puckette; +#X text 25 151 RELEASE_DATE 1997; +#X text 25 91 LIBRARY cyclone; +#X text 25 -49 KEYWORDS accumulate store add multiply; +#X text 25 -9 DESCRIPTION store \, add to \, and multiply a number +; +#X text 25 11 INLET_0 float bang; +#X text 25 71 OUTLET_0 float current value of number being accumulated +; +#X text 25 31 INLET_1 float add to current value; +#X text 25 51 INLET_2 float multiply with current value; +#X text 25 171 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 478 pd META; +#X obj 0 378 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 415 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 134 485 428 85 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 9 29 +; +#X obj 38 29 *; +#X restore 196 479 pd Related_objects; +#X obj 79 325 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 0 -2 cnv 15 552 40 empty \$0-pddp.cnv.header accum 3 12 0 18 +-204280 -1 0; +#X text 11 19 store \, add to \, and multiply a number; +#X obj 78 223 accum 4; +#X text 143 224 arg sets initial value; +#X floatatom 78 149 5 0 0 0 - - -, f 5; +#X floatatom 78 248 5 0 0 0 - - -, f 5; +#X text 116 150 set new value and output; +#X floatatom 97 175 5 0 0 0 - - -, f 5; +#X text 135 173 add to current value / no output; +#X msg 50 122 bang; +#X text 89 123 output current value; +#X floatatom 117 200 5 0 0 0 - - -, f 5; +#X text 156 198 multiply with current val / no output; +#X msg 29 100 set \$1; +#X floatatom 29 77 5 0 0 0 - - -, f 5; +#X text 76 97 reset current value / no output; +#X text 99 281 float; +#X text 99 298 bang; +#X text 174 299 - output the current value; +#X text 174 283 - to set new value and output; +#X text 99 389 float; +#X text 82 440 1) float; +#X text 174 389 - the current value of number being accumulated; +#X obj 509 4 accum; +#X text 174 440 - set initial value; +#X obj 79 387 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 347 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 99 324 float; +#X text 174 321 - add to current value; +#X text 99 346 float; +#X text 174 345 - multiply with current value; +#X obj 79 283 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 89 50 accum is a multi-function float value changer. It can +add and multiply by values on inlets 1 and 2 \, respectively.; +#X obj 9 477 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 9 0 12 0; +#X connect 11 0 9 0; +#X connect 14 0 9 1; +#X connect 16 0 9 0; +#X connect 18 0 9 2; +#X connect 20 0 9 0; +#X connect 21 0 20 0; diff --git a/externals/miXed/doc/help/cyclone/acos-help.pd b/externals/miXed/doc/help/cyclone/acos-help.pd new file mode 100644 index 000000000..5ae527b7c --- /dev/null +++ b/externals/miXed/doc/help/cyclone/acos-help.pd @@ -0,0 +1,71 @@ +#N canvas 269 136 552 402 10; +#X obj 0 381 cnv 15 550 18 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 210 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 407 277 402 237 META 0; +#X text 15 -28 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 15 -148 LICENSE SIBSD; +#X text 15 -48 AUTHOR Miller Puckette; +#X text 15 -8 RELEASE_DATE 1997; +#X text 15 -68 LIBRARY cyclone; +#X text 15 -108 INLET_0 float bang; +#X text 15 -128 DESCRIPTION takes the arccosine value of a float; +#X text 15 -88 OUTLET_0 float arccosine of input; +#X text 15 -168 KEYWORDS cos cosine arccosine arc acos; +#X text 15 12 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 502 382 pd META; +#X obj 0 281 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 318 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 150 397 427 119 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 17 33 acosh~; +#X obj 17 58 asin; +#X obj 17 83 asinh~; +#X obj 71 33 asin~; +#X obj 71 58 atan~; +#X obj 71 83 atanh~; +#X obj 122 33 cosh~; +#X obj 122 58 cosh; +#X obj 122 83 cosx~; +#X obj 167 33 acos~; +#X restore 203 382 pd Related_objects; +#X obj 79 291 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header acos 3 12 0 18 +-204280 -1 0; +#X obj 274 98 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X floatatom 274 168 0 0 0 0 - - -; +#X floatatom 169 168 0 0 0 0 - - -; +#X floatatom 169 98 0 0 0 0 - - -; +#X obj 169 132 acos; +#X obj 274 132 acos 0.5; +#X text 105 231 float; +#X text 105 250 bang; +#X text 105 292 float; +#X text 87 341 1) float; +#X text 154 341 - optional initial value to compute; +#X text 11 20 arccosine(x) function; +#X text 154 231 - the number to take acos of; +#X text 154 292 - acos of input; +#X text 154 252 - output acos of stored value; +#X obj 517 1 acos; +#X text 71 56 acos outputs the arccosine value of the input float value. +; +#X text 347 102 with bang button and argument inside acos object +; +#X text 55 103 with input as float value to take acos of; +#X obj 79 233 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 8 380 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 8 0 13 0; +#X connect 11 0 12 0; +#X connect 12 0 10 0; +#X connect 13 0 9 0; diff --git a/externals/miXed/doc/help/cyclone/acosh~-help.pd b/externals/miXed/doc/help/cyclone/acosh~-help.pd new file mode 100644 index 000000000..3ec07436b --- /dev/null +++ b/externals/miXed/doc/help/cyclone/acosh~-help.pd @@ -0,0 +1,82 @@ +#N canvas 228 80 554 485 10; +#X obj 0 461 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 323 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 387 291 391 247 META 0; +#X text 18 57 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 18 -76 LICENSE SIBSD; +#X text 18 37 AUTHOR Miller Puckette; +#X text 18 77 RELEASE_DATE 1997; +#X text 18 17 LIBRARY cyclone; +#X text 18 -23 INLET_0 signal; +#X text 18 -3 OUTLET_0 signal; +#X text 18 -56 DESCRIPTION takes the arc hyperbolic cosine function +for signals; +#X text 18 -96 KEYWORDS hyperbolic cosine cosh signal acos acosh; +#X text 18 97 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 503 463 pd META; +#X obj 0 369 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 406 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 110 412 427 126 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 20 59 asin; +#X obj 20 84 asinh~; +#X obj 71 34 asin~; +#X obj 71 59 atan~; +#X obj 71 84 atanh~; +#X obj 122 34 cosh~; +#X obj 122 59 cosh; +#X obj 122 84 cosx~; +#X obj 20 34 acos; +#X obj 166 34 acos~; +#X restore 197 463 pd Related_objects; +#X obj 79 381 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header acosh~ 3 12 0 18 +-204280 -1 0; +#X text 16 23 Arc Hyperbolic cosine function (acosh(x)) for signals +; +#X msg 243 164 range 0 2; +#X obj 164 138 +~ 1; +#X obj 164 115 *~ 2; +#X obj 164 93 phasor~ 2; +#X obj 12 121 +~ 2; +#X obj 13 210 Scope~ 133 78 256 3 128 0 2 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 243 210 Scope~ 130 80 256 3 128 0 2 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 163 162 acosh~; +#X obj 12 152 acosh~; +#X obj 243 142 loadbang; +#X text 47 130 be greater than 1; +#X text 46 118 input values must; +#X obj 12 92 osc~ 2; +#X text 113 337 signal; +#X text 169 338 - input to acosh function; +#X text 113 381 signal; +#X text 99 420 (none); +#X text 169 382 - output of acosh function; +#X obj 505 1 acosh~; +#X obj 484 48 pddp/dsp; +#X text 256 107 this is probably only useful for mathematical calculations +; +#X obj 79 339 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 6 461 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 9 0 14 0; +#X connect 9 0 15 0; +#X connect 10 0 16 0; +#X connect 11 0 10 0; +#X connect 12 0 11 0; +#X connect 13 0 17 0; +#X connect 16 0 15 0; +#X connect 17 0 14 0; +#X connect 18 0 9 0; +#X connect 21 0 13 0; diff --git a/externals/miXed/doc/help/cyclone/acos~-help.pd b/externals/miXed/doc/help/cyclone/acos~-help.pd new file mode 100644 index 000000000..c729f02b6 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/acos~-help.pd @@ -0,0 +1,111 @@ +#N canvas 331 75 553 599 10; +#X obj 0 577 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 371 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 446 388 427 261 META 0; +#X text 25 141 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 25 21 LICENSE SIBSD; +#X text 25 121 AUTHOR Miller Puckette; +#X text 25 161 RELEASE_DATE 1997; +#X text 25 101 LIBRARY cyclone; +#X text 25 61 INLET_0 signal; +#X text 25 81 OUTLET_0 signal; +#X text 25 -1 KEYWORDS arc cosine arccosine arccos acos; +#X text 25 41 DESCRIPTION takes the arc cosine function for signals +; +#X text 25 181 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 579 pd META; +#X obj 0 418 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 455 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 0 500 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 219 533 427 117 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 16 34 acosh~; +#X obj 16 59 asin; +#X obj 16 84 asinh~; +#X obj 70 34 asin~; +#X obj 70 59 atan~; +#X obj 70 84 atanh~; +#X obj 125 34 cosh~; +#X obj 125 59 cosh; +#X obj 125 84 cosx~; +#X obj 175 34 acos; +#X restore 210 579 pd Related_objects; +#X obj 83 427 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header acos~ 3 12 0 18 +-204280 -1 0; +#X obj 345 246 -~ 1.5708; +#X text 302 67 select waveform:; +#X text 290 125 sawtooth; +#X text 289 157 triangle; +#X msg 364 157 2; +#X msg 355 126 1; +#X msg 345 93 0; +#X obj 345 289 *~ 0.2; +#X obj 345 267 /~ 1.5708; +#X obj 468 144 cycle~ 130; +#X obj 406 146 -~ 1; +#X obj 406 124 *~ 2; +#X obj 406 102 phasor~ 130; +#X obj 16 132 cycle~ 2; +#X msg 167 188 range 0 3.14159; +#X obj 106 140 -~ 1; +#X obj 106 117 *~ 2; +#X obj 106 95 phasor~ 2; +#X obj 345 326 dac~; +#X text 21 67 turn a sine wave into a triangle wave:; +#X text 321 98 off; +#X obj 16 250 Scope~ 119 65 256 3 128 0 3.14159 0 0 0 0 102 255 51 +135 135 135 0; +#X obj 167 249 Scope~ 113 66 256 3 128 0 3.14159 0 0 0 0 102 255 51 +135 135 135 0; +#X obj 16 163 acos~; +#X obj 106 170 acos~; +#X obj 345 198 zexy/multiplex~ 0 1 2; +#X obj 345 220 acos~; +#X text 111 426 signal; +#X text 111 384 signal; +#X text 167 385 - signal to take arccosine of; +#X text 171 424 - arccosine of signal; +#X text 109 470 (none); +#X text 110 534 input signal values outside the -1 to 1 range cause +acos~ to output the value zero; +#X text 110 510 outputs signal from 0 to pi when input is -1 to 1; +#X obj 508 1 acos~; +#X obj 481 53 pddp/dsp; +#X text 407 243 outputs signal from 0 to pi; +#X text 142 113 or create a sawtooth wave using phasor; +#X obj 83 386 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 13 23 Arc-cosine function acos(x) for signals; +#X obj 8 577 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 9 0 17 0; +#X connect 13 0 34 0; +#X connect 14 0 34 0; +#X connect 15 0 34 0; +#X connect 16 0 27 0; +#X connect 16 0 27 1; +#X connect 17 0 16 0; +#X connect 18 0 34 2; +#X connect 19 0 34 1; +#X connect 20 0 19 0; +#X connect 21 0 20 0; +#X connect 22 0 32 0; +#X connect 23 0 30 0; +#X connect 23 0 31 0; +#X connect 24 0 33 0; +#X connect 25 0 24 0; +#X connect 26 0 25 0; +#X connect 32 0 30 0; +#X connect 33 0 31 0; +#X connect 34 0 35 0; +#X connect 35 0 9 0; diff --git a/externals/miXed/doc/help/cyclone/active-help.pd b/externals/miXed/doc/help/cyclone/active-help.pd new file mode 100644 index 000000000..40e0384e3 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/active-help.pd @@ -0,0 +1,24 @@ +#N canvas 0 31 431 256 10; +#X obj 4 4 cnv 15 400 40 empty empty empty 20 12 0 14 -262130 -66577 +0; +#X text 31 210 docs based on the MAX/MSP reference (c) cycling'74; +#X text 30 224 ___________________________________________________ +; +#X obj 41 22 active; +#X text 108 24 report if window is active / inactive; +#X obj 39 117 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 39 86 active; +#X text 64 118 focus / unfocus window and watch the toggle; +#N canvas 365 140 494 344 META 0; +#X text 12 105 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 12 5 KEYWORDS float max_compatible canvas_op; +#X text 12 45 DESCRIPTION report if window is active / inactive; +#X text 12 135 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 65 OUTLET_0 float; +#X text 12 85 AUTHOR Krzysztof Czaja; +#X text 12 25 LICENSE SIBSD; +#X restore 381 235 pd META; +#X connect 6 0 5 0; diff --git a/externals/miXed/doc/help/cyclone/all_about_cyclone.pd b/externals/miXed/doc/help/cyclone/all_about_cyclone.pd new file mode 100644 index 000000000..4f476f300 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/all_about_cyclone.pd @@ -0,0 +1,42 @@ +#N canvas 423 141 448 398 10; +#X obj 1 1 cnv 15 445 20 empty \$0-pddp.cnv.header all_about_cyclone +20 10 1 18 -261106 -33289 0; +#X obj 407 2 pddp/pddplink http://puredata.info/dev/pddp -text pddp +; +#X obj 1 376 cnv 15 445 20 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#N canvas 44 246 494 344 META 0; +#X text 12 5 GENRE all_about_pd; +#X text 12 45 DESCRIPTION outline of the cyclone library; +#X text 12 65 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 25 KEYWORDS cyclone needs_work; +#X restore 392 378 pd META; +#N canvas 8 287 428 105 Related_objects 0; +#X text 31 37 Hm...what to put here?; +#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -261106 -33289 0; +#X text 7 2 Atoms- Related Objects; +#X restore 103 378 pd Related_objects; +#X text 40 36 Cyclone is a library of Pure Data classes \, bringing +some level of compatibility between Max/MSP and Pd environments. Although +being itself in the early stage of development \, it is meant to eventually +become part of a much larger project \, aiming at unification and standardization +of computer musicians' tools. In its current form \, cyclone is mainly +for people using both Max and Pd \, and thus wanting to develop cross-platform +patches \, but it also provide many very useful objects for the Pd-only +user.; +#X text 39 154 - hammer contains Pd versions of Max objects; +#X text 39 174 - sickle contains Pd versions of MSP objects; +#X text 39 194 - optional dummies sub-library \, which contains a large +set of dummy classes \, serving as substitutions for Max/MSP classes +not (yet) implemented in the cyclone; +#X text 38 236 - cyclone sub-library \, taking care of loading the +other three components \, and which itself contains: a small set of +operators (!- \, !/ \, ==~ \, !=~ \, <~ \, <=~ \, >~ \, >=~ \, !-~ +\, !/~ \, %~ \, +=~) and an importing mechanism provided by the cyclone +class; +#X text 38 302 For more info:; +#X obj 38 342 pddp/pddplink http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X obj 38 322 pddp/pddplink maxmode-help.pd; diff --git a/externals/miXed/doc/help/cyclone/allpass~-help.pd b/externals/miXed/doc/help/cyclone/allpass~-help.pd new file mode 100644 index 000000000..bfe17d777 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/allpass~-help.pd @@ -0,0 +1,163 @@ +#N canvas 253 41 553 668 10; +#X obj -1 646 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 355 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 386 400 407 280 META 0; +#X text 62 183 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 62 31 LICENSE SIBSD; +#X text 62 164 AUTHOR Miller Puckette; +#X text 62 202 RELEASE_DATE 1997; +#X text 62 145 LIBRARY cyclone; +#X text 62 69 INLET_0 signal; +#X text 62 12 KEYWORDS filter pass; +#X text 62 88 INLET_1 float delay time; +#X text 62 107 INLET_2 float gain; +#X text 62 126 OUTLET_0 signal; +#X text 62 50 DESCRIPTION allpass filter for signal; +#X text 62 221 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 498 648 pd META; +#X obj -1 441 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 478 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 554 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 132 612 428 72 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 15 36 svf~; +#X restore 201 648 pd Related_objects; +#X obj 81 389 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header allpass~ 3 12 0 +18 -204280 -1 0; +#X text 11 23 allpass filter for signal; +#X floatatom 169 292 0 0 100 0 - - -; +#N canvas 159 26 532 285 output 0; +#X obj 338 160 t b; +#X obj 338 110 f; +#X obj 338 60 inlet; +#X text 344 29 mute; +#X obj 338 185 f; +#X msg 426 180 0; +#X msg 338 85 bang; +#X obj 338 135 moses 1; +#X obj 397 110 moses 1; +#X obj 83 148 dbtorms; +#X obj 397 85 r master-lvl; +#X obj 83 42 r master-lvl; +#X obj 338 210 s master-lvl; +#X obj 20 155 inlet~; +#X obj 199 41 inlet; +#X text 199 18 level; +#X obj 199 105 s master-lvl; +#X msg 96 65 set \$1; +#X obj 96 90 outlet; +#X msg 214 65 \; pd dsp 1; +#X obj 83 198 line~; +#X obj 20 207 *~; +#X obj 20 232 dac~; +#X obj 83 173 pack 0 50; +#X text 20 132 audio; +#X text 96 114 show level; +#X obj 426 155 t b; +#X obj 20 181 hip~ 1; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 12 0; +#X connect 5 0 12 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 26 0; +#X connect 8 1 4 1; +#X connect 9 0 23 0; +#X connect 10 0 1 1; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 17 0; +#X connect 13 0 27 0; +#X connect 14 0 16 0; +#X connect 14 0 19 0; +#X connect 17 0 18 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 21 0 22 1; +#X connect 23 0 20 0; +#X connect 26 0 5 0; +#X connect 27 0 21 0; +#X restore 144 314 pd output; +#X msg 195 292 MUTE; +#X floatatom 202 173 5 0 0 0 - - -; +#X obj 144 61 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 261 220 / 100; +#X floatatom 261 199 5 0 0 0 - - -; +#X text 164 58 generate short noisebursts; +#N canvas 0 22 290 283 burst 0; +#X obj 48 173 noise~; +#X obj 95 172 line~; +#X obj 79 203 *~; +#X obj 95 73 metro 300; +#X msg 43 132 0 20; +#X msg 95 112 1 10; +#X obj 44 112 del 20; +#X obj 95 43 inlet; +#X obj 79 236 outlet~; +#X connect 0 0 2 0; +#X connect 1 0 2 1; +#X connect 2 0 8 0; +#X connect 3 0 5 0; +#X connect 3 0 6 0; +#X connect 4 0 1 0; +#X connect 5 0 1 0; +#X connect 6 0 4 0; +#X connect 7 0 3 0; +#X restore 144 89 pd burst; +#X text 237 170 delay time; +#X text 300 195 gain; +#X text 198 110 del time / gain can also be; +#X text 198 121 specified using signals when; +#X text 197 133 using a signal to control gain; +#X text 197 145 the gain coeff is ignored \, see below; +#X msg 88 168 clear; +#X text 54 149 clear buffer; +#X obj 144 241 allpass~ 100 4 0.7 0; +#X text 163 363 - signal to pass; +#X text 115 451 signal; +#X text 113 364 signal; +#X text 96 490 1) float - max del time (default 10ms); +#X text 96 503 2) float - initial del time; +#X text 96 515 3) float - initial gain; +#X text 96 527 4) float - gain coefficient; +#X text 96 563 an all pass filter passes all frequencies equally \, +but changes the phase relationship between various frequencies. It +does this by varying its propogation delay with frequency.; +#X text 169 452 - output of allpass filter with del time; +#X obj 492 2 allpass~; +#X obj 81 412 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj 81 450 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 113 387 float; +#X text 163 387 - delay time; +#X text 113 410 float; +#X text 163 410 - gain; +#X obj 482 50 pddp/dsp; +#X obj 81 364 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 6 646 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 11 1; +#X connect 11 0 10 0; +#X connect 12 0 11 2; +#X connect 13 0 27 1; +#X connect 14 0 18 0; +#X connect 15 0 27 2; +#X connect 16 0 15 0; +#X connect 18 0 27 0; +#X connect 25 0 27 0; +#X connect 27 0 11 0; diff --git a/externals/miXed/doc/help/cyclone/anal-help.pd b/externals/miXed/doc/help/cyclone/anal-help.pd new file mode 100644 index 000000000..c9b2f14d4 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/anal-help.pd @@ -0,0 +1,48 @@ +#N canvas 0 31 496 386 10; +#X obj 4 4 cnv 15 400 40 empty empty empty 20 12 0 14 -262130 -66577 +0; +#X text 23 347 docs based on the MAX/MSP reference (c) cycling'74; +#X text 22 361 ___________________________________________________ +; +#X obj 41 22 anal 64; +#X text 102 22 generate a histogram of number pairs received; +#X text 108 184 arg sets the number of pairs to store; +#X obj 48 192 anal 32; +#X text 107 199 128 is the default 1024 is max; +#X msg 48 79 clear; +#X msg 59 101 reset; +#X text 99 79 erase all numbers; +#X text 107 102 erase last number received; +#X floatatom 68 151 5 0 0 0 - - -; +#X msg 125 138 1; +#X msg 154 138 2; +#X msg 181 138 3; +#X text 171 251 how often did the last two numbers occur ?; +#X floatatom 48 288 5 0 0 0 - - -; +#X floatatom 87 267 5 0 0 0 - - -; +#X obj 48 226 unpack f f f; +#X floatatom 127 251 5 0 0 0 - - -; +#X text 134 281 numbers in the pair; +#N canvas 430 169 494 399 META 0; +#X text 12 155 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 125 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 12 5 KEYWORDS control storage max_compatible; +#X text 12 45 DESCRIPTION generate a histogram of number pairs received +; +#X text 12 65 INLET_0 float clear reset; +#X text 12 85 OUTLET_0 list; +#X text 12 25 LICENSE SIBSD; +#X text 12 105 AUTHOR Krzysztof Czaja; +#X restore 445 365 pd META; +#X connect 6 0 19 0; +#X connect 8 0 6 0; +#X connect 9 0 6 0; +#X connect 12 0 6 0; +#X connect 13 0 6 0; +#X connect 14 0 6 0; +#X connect 15 0 6 0; +#X connect 19 0 17 0; +#X connect 19 1 18 0; +#X connect 19 2 20 0; diff --git a/externals/miXed/doc/help/cyclone/asin-help.pd b/externals/miXed/doc/help/cyclone/asin-help.pd new file mode 100644 index 000000000..e84b84228 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/asin-help.pd @@ -0,0 +1,70 @@ +#N canvas 125 125 552 414 10; +#X obj 0 391 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 198 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 419 287 429 228 META 0; +#X text 26 60 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 26 -60 LICENSE SIBSD; +#X text 26 40 AUTHOR Miller Puckette; +#X text 26 80 RELEASE_DATE 1997; +#X text 26 20 LIBRARY cyclone; +#X text 26 -20 INLET_0 float bang; +#X text 26 -80 KEYWORDS sin sine arcsine arcsin asin arc; +#X text 26 -40 DESCRIPTION takes the arcsine value of a float; +#X text 26 0 OUTLET_0 float arcsine of input; +#X text 26 100 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 499 393 pd META; +#X obj 0 263 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 300 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 176 401 427 114 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 76 34 acosh~; +#X obj 76 84 asinh~; +#X obj 160 34 asin~; +#X obj 160 59 atan~; +#X obj 160 84 atanh~; +#X obj 261 34 cosh~; +#X obj 261 59 cosh; +#X obj 261 84 cosx~; +#X obj 345 34 acos~; +#X obj 76 59 acos; +#X restore 189 393 pd Related_objects; +#X obj 79 272 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header asin 3 12 0 18 +-204280 -1 0; +#X text 106 212 float; +#X text 106 231 bang; +#X text 106 273 float; +#X text 88 322 1) float; +#X text 160 322 - optional initial value to compute; +#X obj 279 96 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X floatatom 279 155 0 0 0 0 - - -; +#X floatatom 174 155 0 0 0 0 - - -; +#X floatatom 174 96 0 0 0 0 - - -; +#X obj 174 127 asin; +#X obj 279 127 asin 0.5; +#X text 11 24 arcsine(x) function; +#X text 160 211 - the number to take arcsine of; +#X text 160 233 - output arcsine of argument; +#X text 160 273 - arcsine of input; +#X obj 516 3 asin; +#X text 50 58 acos outputs the arccosine value of the input float value. +; +#X text 342 91 with bang button and argument inside acos object; +#X text 74 91 with input as float value to take acos of; +#X obj 79 215 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 8 392 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 13 0 18 0; +#X connect 16 0 17 0; +#X connect 17 0 15 0; +#X connect 18 0 14 0; diff --git a/externals/miXed/doc/help/cyclone/asinh-help.pd b/externals/miXed/doc/help/cyclone/asinh-help.pd new file mode 100644 index 000000000..45548259e --- /dev/null +++ b/externals/miXed/doc/help/cyclone/asinh-help.pd @@ -0,0 +1,38 @@ +#N canvas 0 31 613 320 10; +#X text 254 93 this is probably only useful for mathematical calculations +; +#X obj 18 90 cycle~ 2; +#X obj 18 121 *~ 3.14159; +#X msg 223 149 range -2 2; +#X obj 150 123 -~ 3.14159; +#X text 15 35 Arc Hyperbolic sine function (asinh(x)) for signals; +#X obj 150 100 *~ 6.28319; +#X obj 150 78 phasor~ 2; +#X obj 18 175 Scope~ 130 130 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 165 180 Scope~ 130 130 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 18 147 asinh~; +#X obj 149 147 asinh~; +#N canvas 430 169 507 362 META 0; +#X text 12 175 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 25 LICENSE; +#X text 12 135 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 12 5 KEYWORDS signal max_compatible trigonometry; +#X text 12 45 DESCRIPTION arc hyperbolic sine function (asinh(x)) for +signals; +#X text 12 75 INLET_0 signal; +#X text 12 95 OUTLET_0 signal; +#X text 12 115 AUTHOR Krzysztof Czaja; +#X restore 557 294 pd META; +#X connect 1 0 2 0; +#X connect 2 0 10 0; +#X connect 3 0 8 0; +#X connect 3 0 9 0; +#X connect 4 0 11 0; +#X connect 6 0 4 0; +#X connect 7 0 6 0; +#X connect 10 0 8 0; +#X connect 11 0 9 0; diff --git a/externals/miXed/doc/help/cyclone/asin~-help.pd b/externals/miXed/doc/help/cyclone/asin~-help.pd new file mode 100644 index 000000000..18748a8bd --- /dev/null +++ b/externals/miXed/doc/help/cyclone/asin~-help.pd @@ -0,0 +1,106 @@ +#N canvas 426 69 552 567 10; +#X obj 0 544 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 324 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 575 349 385 259 META 0; +#X text 31 153 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 31 33 LICENSE SIBSD; +#X text 31 133 AUTHOR Miller Puckette; +#X text 31 173 RELEASE_DATE 1997; +#X text 31 113 LIBRARY cyclone; +#X text 31 73 INLET_0 signal; +#X text 31 93 OUTLET_0 signal; +#X text 31 53 DESCRIPTION takes the arc sine function for signals; +#X text 31 193 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 31 11 KEYWORDS arc sine arcsine arcsin asin signal; +#X restore 505 546 pd META; +#X obj 0 372 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 409 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 0 452 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 354 485 427 125 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 58 43 acosh~; +#X obj 58 70 asin; +#X obj 58 95 asinh~; +#X obj 142 70 atan~; +#X obj 142 95 atanh~; +#X obj 243 43 cosh~; +#X obj 243 70 cosh; +#X obj 243 95 cosx~; +#X obj 327 43 acos~; +#X obj 142 43 acos; +#X restore 206 546 pd Related_objects; +#X obj 84 381 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header asin~ 3 12 0 18 +-204280 -1 0; +#X text 116 380 signal; +#X text 116 338 signal; +#X text 177 380 - arccosine of signal; +#X text 116 425 (none); +#X text 289 75 select waveform:; +#X text 289 106 sawtooth; +#X text 290 128 triangle; +#X obj 382 245 *~ 0.2; +#X obj 382 223 /~ 1.5708; +#X obj 381 121 cycle~ 130; +#X obj 468 128 -~ 1; +#X obj 468 106 *~ 2; +#X obj 468 84 phasor~ 130; +#X obj 382 292 dac~; +#X obj 9 136 cycle~ 2; +#X msg 161 179 range -1.5708 1.5708; +#X obj 155 131 -~ 1; +#X obj 155 109 *~ 2; +#X obj 155 87 phasor~ 2; +#X text 10 54 turn a sine wave into a triangle wave:; +#X msg 343 108 0; +#X msg 343 130 1; +#X obj 382 154 zexy/multiplex~; +#X obj 381 187 asin~; +#X obj 8 204 Scope~ 129 76 256 3 128 -1.5708 1.5708 0 0 0 0 102 255 +51 135 135 135 0; +#X obj 156 204 Scope~ 129 76 256 3 128 -1.5708 1.5708 0 0 0 0 102 255 +51 135 135 135 0; +#X obj 9 158 asin~; +#X obj 155 153 asin~; +#X text 229 515 or create a sawtooth wave using phasor; +#X text 80 502 input signal values outside the -1 to 1 range cause +asin~ to output the value zero; +#X text 176 338 - signal to take arcsine of; +#X obj 510 2 asin~; +#X text 449 213 outputs signal from -pi/2 to pi/2; +#X obj 84 338 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 82 474 outputs signal from -pi/2 to pi/2 when input is -1 to +1; +#X obj 485 46 pddp/dsp; +#X text 11 22 Arc-sine function asin(x) for signals; +#X obj 10 545 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 16 0 22 0; +#X connect 16 0 22 1; +#X connect 17 0 16 0; +#X connect 18 0 31 0; +#X connect 19 0 31 1; +#X connect 20 0 19 0; +#X connect 21 0 20 0; +#X connect 23 0 35 0; +#X connect 24 0 33 0; +#X connect 24 0 34 0; +#X connect 25 0 36 0; +#X connect 26 0 25 0; +#X connect 27 0 26 0; +#X connect 29 0 31 0; +#X connect 30 0 31 0; +#X connect 31 0 32 0; +#X connect 32 0 17 0; +#X connect 35 0 33 0; +#X connect 36 0 34 0; diff --git a/externals/miXed/doc/help/cyclone/atan2~-help.pd b/externals/miXed/doc/help/cyclone/atan2~-help.pd new file mode 100644 index 000000000..4a9cfc1a3 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/atan2~-help.pd @@ -0,0 +1,17 @@ +#N canvas 0 31 359 137 10; +#X text 15 35 Standard C function for arctan(y/x); +#X obj 80 85 atan2~; +#N canvas 430 169 494 366 META 0; +#X text 12 175 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 145 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 12 45 DESCRIPTION standard C function for arctan - arctan(y/x) +; +#X text 12 5 KEYWORDS signal storage max_compatible trigonometry; +#X text 12 65 INLET_0 signal; +#X text 12 85 INLET_1 signal; +#X text 12 105 OUTLET_0 signal; +#X text 12 125 AUTHOR Krzysztof Czaja; +#X text 12 25 LICENSE SIBSD; +#X restore 309 116 pd META; diff --git a/externals/miXed/doc/help/cyclone/atanh~-help.pd b/externals/miXed/doc/help/cyclone/atanh~-help.pd new file mode 100644 index 000000000..c777f82db --- /dev/null +++ b/externals/miXed/doc/help/cyclone/atanh~-help.pd @@ -0,0 +1,78 @@ +#N canvas 339 135 554 504 10; +#X obj 0 479 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 355 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 503 392 385 253 META 0; +#X text 354 316 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 354 196 LICENSE SIBSD; +#X text 354 296 AUTHOR Miller Puckette; +#X text 354 336 RELEASE_DATE 1997; +#X text 354 276 LIBRARY cyclone; +#X text 354 236 INLET_0 signal; +#X text 354 256 OUTLET_0 signal; +#X text 354 216 DESCRIPTION takes the hyperbolic tan function for signals +; +#X text 354 174 KEYWORDS hyperbolic tangent tan atanh tanh signal; +#X text 354 356 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 504 481 pd META; +#X obj 0 396 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 433 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 209 515 434 129 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 66 39 acosh~; +#X obj 66 66 asin; +#X obj 66 91 asinh~; +#X obj 150 39 asin~; +#X obj 150 66 atan~; +#X obj 251 39 cosh~; +#X obj 251 66 cosh; +#X obj 251 91 cosx~; +#X obj 335 39 acos~; +#X obj 150 91 acos; +#X restore 193 481 pd Related_objects; +#X obj 79 405 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -2 cnv 15 552 40 empty \$0-pddp.cnv.header atanh~ 3 12 0 18 +-204280 -1 0; +#X text 113 369 signal; +#X text 113 405 signal; +#X text 111 444 (none); +#X text 16 23 Arc Hyperbolic tangent function (atanh(x)) for signals +; +#X obj 55 130 *~ 0.999; +#X obj 55 107 cycle~ 2; +#X msg 296 162 range -3.14159 3.14159; +#X obj 241 136 -~ 0.999; +#X obj 241 113 *~ 2; +#X obj 241 91 phasor~ 2; +#X obj 56 220 Scope~ 130 77 256 3 128 -3.14159 3.14159 0 0 0 0 102 +255 51 135 135 135 0; +#X obj 239 220 Scope~ 131 78 256 3 128 -3.14159 3.14159 0 0 0 0 102 +255 51 135 135 135 0; +#X obj 55 157 atanh~; +#X obj 240 160 atanh~; +#X text 169 370 - input to atanh function; +#X text 169 407 - output of atanh function; +#X obj 504 2 atanh~; +#X obj 483 47 pddp/dsp; +#X obj 79 370 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 319 107 this is probably only useful for mathematical calculations +; +#X obj 10 480 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 20 0; +#X connect 13 0 12 0; +#X connect 14 0 18 0; +#X connect 14 0 19 0; +#X connect 15 0 21 0; +#X connect 16 0 15 0; +#X connect 17 0 16 0; +#X connect 20 0 18 0; +#X connect 21 0 19 0; diff --git a/externals/miXed/doc/help/cyclone/atan~-help.pd b/externals/miXed/doc/help/cyclone/atan~-help.pd new file mode 100644 index 000000000..bbf5ef92a --- /dev/null +++ b/externals/miXed/doc/help/cyclone/atan~-help.pd @@ -0,0 +1,79 @@ +#N canvas 358 128 552 547 10; +#X obj 0 525 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 349 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#X obj 0 392 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 432 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 0 475 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#X obj 78 404 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header atan~ 3 12 0 18 +-204280 -1 0; +#X text 107 403 signal; +#X text 107 363 signal; +#X text 107 444 (none); +#X text 11 22 Arc Hyperbolic tangent function (atanh(x)) for signals +; +#X obj 87 112 cycle~ 2; +#X obj 87 137 *~ 3.14159; +#X msg 359 164 range -1.57 1.57; +#X obj 288 138 -~ 3.14195; +#X obj 288 115 *~ 6.28319; +#X obj 288 93 phasor~ 2; +#X text 107 492 see atan2~ for the 2-inlet version: atan(y/x); +#X obj 87 162 atan~; +#X obj 288 162 atan~; +#X obj 86 208 Scope~ 129 73 256 3 128 -1 1 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 288 208 Scope~ 131 72 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X text 159 364 - signal to take arctangent of; +#X text 161 402 - arctangent of signal; +#X obj 510 3 atan~; +#N canvas 504 392 401 260 META 0; +#X text 27 159 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 27 39 LICENSE SIBSD; +#X text 27 139 AUTHOR Miller Puckette; +#X text 27 179 RELEASE_DATE 1997; +#X text 27 119 LIBRARY cyclone; +#X text 27 79 INLET_0 signal; +#X text 27 99 OUTLET_0 signal; +#X text 27 59 DESCRIPTION takes the arc tangent function for signals +; +#X text 27 199 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 27 17 KEYWORDS arc tangent arctangent arctan atan signal; +#X restore 503 527 pd META; +#N canvas 234 525 428 126 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 58 41 acosh~; +#X obj 58 68 asin; +#X obj 58 93 asinh~; +#X obj 142 41 asin~; +#X obj 142 93 atanh~; +#X obj 243 41 cosh~; +#X obj 243 68 cosh; +#X obj 243 93 cosx~; +#X obj 327 41 acos~; +#X obj 142 68 acos; +#X restore 193 527 pd Related_objects; +#X obj 78 364 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 483 49 pddp/dsp; +#X obj 8 526 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 12 0; +#X connect 12 0 18 0; +#X connect 13 0 20 0; +#X connect 13 0 21 0; +#X connect 14 0 19 0; +#X connect 15 0 14 0; +#X connect 16 0 15 0; +#X connect 18 0 20 0; +#X connect 19 0 21 0; diff --git a/externals/miXed/doc/help/cyclone/atodb-help.pd b/externals/miXed/doc/help/cyclone/atodb-help.pd new file mode 100644 index 000000000..ffaeb73cf --- /dev/null +++ b/externals/miXed/doc/help/cyclone/atodb-help.pd @@ -0,0 +1,91 @@ +#N canvas 592 23 564 722 10; +#X obj 3 38 cnv 15 552 40 empty empty atodb 3 12 0 18 -204280 -1 0 +; +#X obj 3 527 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#X obj 3 605 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 3 642 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#X obj 82 614 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 83 535 cnv 17 3 60 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X text 110 651 (none); +#X obj 3 683 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#N canvas 244 346 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 50 49 cyclone/dbtoa~; +#X obj 255 49 cyclone/dbtoa; +#X obj 152 49 cyclone/atodb~; +#X restore 209 685 pd Related_objects; +#N canvas 571 307 379 261 META 0; +#X text 1 0 KEYWORDS signal max_compatible; +#X text 1 163 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 1 40 DESCRIPTION absolute value of a signal; +#X text 1 60 INLET_0 signal; +#X text 1 80 OUTLET_0 signal; +#X text 1 121 AUTHOR Krzysztof Czaja; +#X text 1 20 LICENSE SIBSD; +#X text 0 101 VERSION 0.2-beta1; +#X text 0 142 RELEASE_DATE 2002; +#X text 1 193 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X restore 505 685 pd META; +#X text 192 224 Linear Amplitude; +#X obj 133 224 nbx 5 14 1e-05 1 1 0 empty empty empty 0 -8 0 10 -228856 +-1 -1 0.569837 256; +#X obj 136 198 hsl 180 15 1e-05 1 0 0 empty empty empty -2 -8 0 10 +-228856 -1 -1 10200 1; +#X text 11 61 Convert linear amplitude to dBFS; +#X obj 508 45 atodb; +#X text 125 614 float/List; +#X obj 181 254 bng 15 250 50 0 empty empty empty 17 7 0 10 -261682 +-1 -1; +#X text 200 254 last output; +#X msg 197 283 set 0.5; +#X text 255 284 sets next value to be converted via bang; +#X obj 182 380 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0; +#X text 161 556 bang; +#X text 167 574 set; +#X text 206 574 - sets next float value to be converted via bang; +#X text 206 556 - outputs the last converted float value; +#X floatatom 181 347 0 0 0 0 - - -; +#X msg 106 261 0; +#X obj 181 318 cyclone/atodb; +#X text 125 537 float/list; +#X text 206 537 - linear amplitude value(s); +#X text 77 104 Use [atodb] to convert a linear amplitude value to a +deciBel Full Scale (dBFS) equivalent. Negative values convert to -inf +as if the input is "0". You shouldn't really convert negative values +anyway if you knew any better :); +#X text 79 163 Conversion expression: dbFS = log10(amp) * 20; +#X text 202 614 - converted dBFS amplitude value(s); +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 2 4 pd; +#X connect 11 0 27 0; +#X connect 12 0 11 0; +#X connect 16 0 27 0; +#X connect 18 0 27 0; +#X connect 25 0 20 0; +#X connect 26 0 27 0; +#X connect 27 0 25 0; diff --git a/externals/miXed/doc/help/cyclone/atodb~-help.pd b/externals/miXed/doc/help/cyclone/atodb~-help.pd new file mode 100644 index 000000000..1e7a7b8f8 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/atodb~-help.pd @@ -0,0 +1,187 @@ +#N canvas 672 327 560 583 10; +#X obj 4 39 cnv 15 552 40 empty empty atodb~ 3 12 0 18 -204280 -1 0 +; +#X obj 4 412 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#X obj 4 460 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 4 501 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#X obj 83 469 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 83 426 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X text 147 469 signal; +#X text 148 510 (none); +#X obj 4 542 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#N canvas 244 346 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 50 49 cyclone/dbtoa~; +#X obj 248 49 cyclone/dbtoa; +#X obj 152 49 cyclone/atodb; +#X restore 210 544 pd Related_objects; +#N canvas 571 307 379 261 META 0; +#X text 1 0 KEYWORDS signal max_compatible; +#X text 1 163 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 1 40 DESCRIPTION absolute value of a signal; +#X text 1 60 INLET_0 signal; +#X text 1 80 OUTLET_0 signal; +#X text 1 121 AUTHOR Krzysztof Czaja; +#X text 1 20 LICENSE SIBSD; +#X text 0 101 VERSION 0.2-beta1; +#X text 0 142 RELEASE_DATE 2002; +#X text 1 193 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X restore 506 544 pd META; +#X obj 151 354 nbx 5 20 -1e+37 1e+37 0 0 empty empty dBFS 88 11 0 16 +-228856 -1 -1 -100 256; +#X obj 151 311 cyclone/Snapshot~ 100; +#X obj 151 208 nbx 5 14 1e-05 1 1 0 empty empty empty 0 -8 0 10 -228856 +-1 -1 1e-05 256; +#X obj 154 182 hsl 180 15 1e-05 1 0 0 empty empty empty -2 -8 0 10 +-228856 -1 -1 0 1; +#X obj 509 46 atodb~; +#X obj 151 233 sig~ 1e-05; +#X text 111 426 signal/float; +#X text 204 426 - Signal/float representing linear amplitude value +; +#X text 12 62 Convert linear amplitude to dBFS at signal rate; +#X text 61 102 Use the atodb~ to convert a signal representing a linear +amplitude value to a deciBel Full Scale (dBFS) equivalent. Conversion +expression: dbFS = log10(amp) * 20; +#X obj 151 272 cyclone/atodb~; +#X text 205 470 - converted dBFS amplitude value (minimum value is +-999); +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 3 4 pd; +#N canvas 673 40 366 264 (subpatch) 0; +#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 -228856 -128992 +-262144 0 1; +#X obj 215 68 route dsp; +#X obj 215 37 receive pd; +#N canvas 939 367 324 271 set_color 0; +#X obj 47 30 inlet; +#X obj 96 146 s \$0-cnv; +#X msg 96 114 color -4.86997e+06 -1.34937e+07; +#N canvas 0 22 712 637 off 0; +#X obj 490 220 * -1; +#X obj 424 300 +; +#X obj 409 325 +; +#X obj 347 219 * -65536; +#X obj 424 220 * -256; +#X obj 409 356 - 1; +#X obj 390 189 unpack f f f; +#X obj 225 295 +; +#X obj 210 320 +; +#X obj 148 214 * -65536; +#X obj 225 215 * -256; +#X obj 291 215 * -1; +#X obj 210 351 - 1; +#X obj 191 184 unpack f f f; +#X obj 379 423 pack; +#X msg 378 447 color \$1 \$2; +#X msg 395 152 124 124 124; +#X msg 203 154 220 220 220; +#X obj 238 121 t b b; +#X obj 238 81 inlet; +#X obj 378 485 outlet; +#X connect 0 0 1 1; +#X connect 1 0 2 1; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 1 0; +#X connect 5 0 14 1; +#X connect 6 0 3 0; +#X connect 6 1 4 0; +#X connect 6 2 0 0; +#X connect 7 0 8 1; +#X connect 8 0 12 0; +#X connect 9 0 8 0; +#X connect 10 0 7 0; +#X connect 11 0 7 1; +#X connect 12 0 14 0; +#X connect 13 0 9 0; +#X connect 13 1 10 0; +#X connect 13 2 11 0; +#X connect 14 0 15 0; +#X connect 15 0 20 0; +#X connect 16 0 6 0; +#X connect 17 0 13 0; +#X connect 18 0 17 0; +#X connect 18 1 16 0; +#X connect 19 0 18 0; +#X restore 47 113 pd off; +#X obj 47 83 select 0 1; +#X obj 47 168 list append 0; +#X obj 47 195 list trim; +#X obj 47 220 s \$0-tgl-r; +#X connect 0 0 4 0; +#X connect 2 0 1 0; +#X connect 2 0 5 0; +#X connect 3 0 1 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 4 1 2 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X restore 215 165 pd set_color; +#X obj 135 122 r \$0-tgl-s; +#N canvas 0 22 450 300 (subpatch) 0; +#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 -228856 -128992 +0; +#X coords 0 -1 1 1 42 27 1 100 100; +#X restore 51 144 pd; +#X obj 226 139 s \$0-tgl-r; +#X msg 226 115 set \$1; +#X msg 135 177 \; pd dsp \$1; +#N canvas 256 32 278 194 load_check 0; +#X obj 136 53 sig~ 1; +#X obj 74 24 loadbang; +#X obj 136 86 snapshot~; +#X obj 91 52 del 5; +#X obj 136 151 outlet; +#X obj 74 103 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 74 126 switch~; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 0 5 0; +#X connect 5 0 6 0; +#X restore 51 72 pd load_check; +#X connect 1 0 3 0; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 4 0 8 0; +#X connect 4 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 0 0; +#X coords 0 -1 1 1 44 72 2 50 100; +#X restore 503 91 pd; +#X text 192 181 Linear Amplitude; +#X connect 12 0 11 0; +#X connect 13 0 16 0; +#X connect 14 0 13 0; +#X connect 16 0 21 0; +#X connect 21 0 12 0; diff --git a/externals/miXed/doc/help/cyclone/average~-help.pd b/externals/miXed/doc/help/cyclone/average~-help.pd new file mode 100644 index 000000000..d118d9cb4 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/average~-help.pd @@ -0,0 +1,86 @@ +#N canvas 277 51 553 637 10; +#X obj -1 613 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 294 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 424 424 399 237 META 0; +#X text 15 38 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 15 -82 LICENSE SIBSD; +#X text 15 18 AUTHOR Miller Puckette; +#X text 15 58 RELEASE_DATE 1997; +#X text 15 -2 LIBRARY cyclone; +#X text 15 -42 INLET_0 signal message float; +#X text 15 -22 OUTLET_0 float; +#X text 15 -62 DESCRIPTION reports various forms of average value of +signal; +#X text 15 78 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 15 -102 KEYWORDS average mean audio signal; +#X restore 499 616 pd META; +#X obj 0 417 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 478 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 0 532 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 157 570 428 92 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 11 30 average; +#X obj 72 30 avg~; +#X restore 198 616 pd Related_objects; +#X obj 76 432 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header average~ 3 12 0 +18 -204280 -1 0; +#X text 101 307 signal; +#X text 168 306 - the signal to have average taken; +#X text 101 431 float; +#X text 89 548 RMS values are often used to measure signal levels. +The RMS mode of the average~ object is considerably more CPU intensive +than the absolute mode. The absolute mode often works as well as the +RMS mode in many level-detection tasks.; +#X text 11 22 reports various forms of average value of signal; +#X obj 250 96 cycle~ 2; +#X obj 233 67 cycle~ 100; +#X floatatom 373 181 0 0 0 0 - - -; +#X msg 420 139 rms; +#X msg 304 139 bipolar; +#X msg 360 139 absolute; +#X obj 234 122 *~; +#X text 301 117 change modes with messages:; +#X obj 74 190 Scope~ 129 74 256 3 128 -1 1 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 234 208 average~ 1000; +#X floatatom 234 248 5 0 0 0 - - -; +#X text 101 328 message; +#X text 168 343 - absolute--averages the absolute values of the samples. +; +#X text 168 358 - rms--computes the square root of the average of the +sample values squared.; +#X text 168 327 - bipolar--averages the sample values.; +#X text 168 425 average~ reports the running mean amplitude of a signal +\, averaged over a specified number of samples. There are three methods +of averaging available:; +#X obj 494 1 average~; +#X text 88 490 1) float - sets maximum averaging interval. default +is 100 2) message - sets mode \, as shown above. default is bipolar. +; +#X obj 484 50 pddp/dsp; +#X obj 76 310 cnv 17 3 94 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 101 390 float; +#X text 168 390 - the interval between samples \, in; +#X text 401 173 interval between samples taken; +#X obj 7 615 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 14 0 20 1; +#X connect 15 0 20 0; +#X connect 16 0 23 0; +#X connect 17 0 23 0; +#X connect 18 0 23 0; +#X connect 19 0 23 0; +#X connect 20 0 22 0; +#X connect 20 0 23 0; +#X connect 23 0 24 0; diff --git a/externals/miXed/doc/help/cyclone/avg~-help.pd b/externals/miXed/doc/help/cyclone/avg~-help.pd new file mode 100644 index 000000000..e650663ca --- /dev/null +++ b/externals/miXed/doc/help/cyclone/avg~-help.pd @@ -0,0 +1,79 @@ +#N canvas 275 41 553 627 10; +#X obj 0 604 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 421 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 433 387 390 256 META 0; +#X text 13 152 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 13 32 LICENSE SIBSD; +#X text 13 132 AUTHOR Miller Puckette; +#X text 13 172 RELEASE_DATE 1997; +#X text 13 112 LIBRARY cyclone; +#X text 13 92 OUTLET_0 float; +#X text 13 52 DESCRIPTION computes the average value of signal; +#X text 13 72 INLET_0 signal bang; +#X text 13 192 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 13 12 KEYWORDS average mean signal; +#X restore 495 606 pd META; +#X obj 0 496 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 547 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 167 535 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 9 31 average; +#X obj 60 31 average~; +#X restore 208 606 pd Related_objects; +#X obj 77 511 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header avg~ 3 12 0 18 +-204280 -1 0; +#X text 110 434 signal; +#X text 177 433 - the signal to have average taken; +#X text 110 510 float; +#X floatatom 41 257 0 0 0 0 - - -; +#X floatatom 270 128 0 0 0 0 - - -; +#X obj 41 282 * 128; +#X obj 41 306 vsl 15 90 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 219 96 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X msg 285 96 200; +#X msg 255 96 50; +#X obj 219 150 metro 100; +#X obj 41 96 adc~; +#X obj 41 230 avg~; +#X text 156 72 start metro to see averages; +#X text 110 455 bang; +#X text 177 455 - When average receives a bang \, it computes the mean +amplitude of its input signal since it last received a bang.; +#X text 177 501 - the average of signal. The mean amplitude is the +sum of the absolute values of the input divided by the number of samples +received.; +#X text 108 565 (none); +#X obj 517 1 avg~; +#X text 11 22 Computes the average value of signal; +#X obj 482 49 pddp/dsp; +#X obj 77 437 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 70 249 float output (between 0 and 1 for audio signals); +#X text 316 89 try different intervals to see the change in avg~ behavior +; +#X obj 5 604 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X text 12 72 signal/trigger input; +#X obj 75 96 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X connect 11 0 13 0; +#X connect 12 0 18 1; +#X connect 13 0 14 0; +#X connect 15 0 18 0; +#X connect 16 0 12 0; +#X connect 17 0 12 0; +#X connect 18 0 20 0; +#X connect 19 0 20 0; +#X connect 20 0 11 0; +#X connect 34 0 20 0; diff --git a/externals/miXed/doc/help/cyclone/bangbang-help.pd b/externals/miXed/doc/help/cyclone/bangbang-help.pd new file mode 100644 index 000000000..c01f07601 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/bangbang-help.pd @@ -0,0 +1,71 @@ +#N canvas 263 69 553 553 10; +#X obj -1 530 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 343 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 465 352 347 242 META 0; +#X text 60 82 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 60 -38 LICENSE SIBSD; +#X text 60 62 AUTHOR Miller Puckette; +#X text 60 102 RELEASE_DATE 1997; +#X text 60 42 LIBRARY cyclone; +#X text 60 -58 KEYWORDS bang bangbang control; +#X text 60 -18 DESCRIPTION send a number of bangs in order; +#X text 60 2 INLET_0 float bang message symbol; +#X text 60 22 OUTLET_0 bang; +#X text 60 122 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 499 532 pd META; +#X obj 0 430 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 467 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 159 486 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 26 35 trigger b b b ...; +#X obj 137 35 bang; +#X obj 170 35 loadbang; +#X obj 227 35 initbang; +#X restore 209 532 pd Related_objects; +#X obj 78 352 cnv 17 3 72 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 441 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header bangbang 3 12 0 +18 -204280 -1 0; +#X text 106 351 bang; +#X text 106 369 float; +#X text 106 388 message; +#X text 106 408 symbol; +#X text 169 376 - anything will trigger a bangbang! just like a bang +; +#X obj 111 94 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 111 118 bangbang 7; +#X obj 195 146 print one; +#X obj 181 170 print two; +#X obj 167 194 print three; +#X obj 153 215 print t-; +#X obj 139 238 print t-; +#X obj 125 259 print testin'; +#X obj 111 283 print done; +#X text 203 119 arg sets number of outlets; +#X text 106 439 bang; +#X text 88 490 1) float; +#X text 169 491 - set the number of bang outlets.; +#X text 11 23 send a number of bangs in order; +#X obj 491 5 bangbang; +#X text 44 61 bangbang operates just like bang \, but it sends several +bangs; +#X obj 6 530 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 14 0 15 0; +#X connect 15 0 22 0; +#X connect 15 1 21 0; +#X connect 15 2 20 0; +#X connect 15 3 19 0; +#X connect 15 4 18 0; +#X connect 15 5 17 0; +#X connect 15 6 16 0; diff --git a/externals/miXed/doc/help/cyclone/bitand~-help.pd b/externals/miXed/doc/help/cyclone/bitand~-help.pd new file mode 100644 index 000000000..3ce9fcb1e --- /dev/null +++ b/externals/miXed/doc/help/cyclone/bitand~-help.pd @@ -0,0 +1,242 @@ +#N canvas 287 24 554 677 10; +#X obj -1 781 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 522 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 492 428 340 251 META 0; +#X text 88 164 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 88 31 LICENSE SIBSD; +#X text 88 144 AUTHOR Miller Puckette; +#X text 88 184 RELEASE_DATE 1997; +#X text 88 124 LIBRARY cyclone; +#X text 88 11 KEYWORDS bitwise bit boolean signal; +#X text 88 51 DESCRIPTION performs bitwise boolean operations on a +floating point signal as bits or as a float; +#X text 88 84 INLET_0 signal; +#X text 88 104 OUTLET_0 signal; +#X text 88 204 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 783 pd META; +#X obj -1 586 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 623 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 175 570 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 38 38 bitnot~; +#X obj 38 68 bitor~; +#X restore 202 783 pd Related_objects; +#X obj 79 595 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header bitand~ 3 12 0 +18 -204280 -1 0; +#X obj 14 402 clip~ -1 1; +#X floatatom 376 256 0 0 0 0 - - -; +#X msg 376 276 mode \$1; +#X floatatom 500 256 0 0 0 0 - - -; +#X floatatom 437 256 0 0 0 0 - - -; +#X obj 500 276 sig~ 1; +#X obj 437 276 sig~ 1; +#X text 123 392 modes \; mode 0: treat both floating point signal inputs +as raw 32 bit values \; mode 1: convert both floating point signal +inputs to integers \; mode 2: treat left input as raw 32 bit value +\, convert right input to integer \; mode 3: convert left input to +integer \, treat right input as raw 32 bit value \;; +#X text 46 93 send bitmask; +#X floatatom 47 424 0 0 0 0 - - -; +#X obj 14 447 *~ 0.2; +#X obj 245 94 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 463 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 449 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 435 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 421 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 407 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 393 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 379 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 365 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 351 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 337 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 323 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 309 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 295 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 281 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 267 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 253 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 239 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 225 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 211 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 197 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 183 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 169 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 155 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 141 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 127 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 113 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 99 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 85 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 71 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 57 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 43 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 29 136 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X floatatom 54 328 0 0 0 0 - - -; +#X obj 14 482 dac~; +#X obj 35 290 cycle~ 440; +#X text 123 366 args: <mask> <mode>. both default to 0; +#X text 78 329 use an integer as a bitmask; +#X obj 437 300 bitand~ 0 1; +#X obj 437 360 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 437 333 unsig~; +#X obj 15 360 bitand~; +#X obj 15 161 pack s 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0; +#X msg 15 96 bits; +#X obj 15 229 list trim; +#X text 117 595 signal; +#X text 115 534 signal; +#X text 170 595 - output signal of bitwise and for mask and mode; +#X text 99 637 1) float; +#X text 99 655 2) float; +#X text 170 655 -; +#X text 170 655 modes \; mode 0: treat both floating point signal inputs +as raw 32 bit values \; mode 1: convert both floating point signal +inputs to integers \; mode 2: treat left input as raw 32 bit value +\, convert right input to integer \; mode 3: convert left input to +integer \, treat right input as raw 32 bit value \;; +#X text 170 639 - mask: 1 or 0 \, bit to mask (and) with; +#X text 170 534 - signal to do bitwise and with \, can have operation +be treated as signal of bit or signal as int/float; +#X obj 498 4 bitand~; +#X floatatom 35 265 5 0 0 0 - - -; +#X text 377 222 bitwise boolean operationon signals as integers; +#X text 32 190 bitwise boolean operation on signal and some bitmask +as bits; +#X obj 484 50 pddp/dsp; +#X obj 80 536 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 17 22 Performs bitwise boolean operations on a float signal. +; +#X text 18 48 Works on floating point signal as bits or as an integer: +; +#X text 13 75 bitwise operation on a signal as bits; +#X text 481 133 set bitmask; +#X obj 5 781 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 8 0 18 0; +#X connect 9 0 10 0; +#X connect 10 0 57 0; +#X connect 11 0 13 0; +#X connect 12 0 14 0; +#X connect 13 0 57 1; +#X connect 14 0 57 0; +#X connect 17 0 18 1; +#X connect 18 0 53 0; +#X connect 18 0 53 1; +#X connect 19 0 51 0; +#X connect 19 0 50 0; +#X connect 19 0 49 0; +#X connect 19 0 48 0; +#X connect 19 0 47 0; +#X connect 19 0 46 0; +#X connect 19 0 45 0; +#X connect 19 0 44 0; +#X connect 19 0 43 0; +#X connect 19 0 42 0; +#X connect 19 0 41 0; +#X connect 19 0 40 0; +#X connect 19 0 39 0; +#X connect 19 0 38 0; +#X connect 19 0 37 0; +#X connect 19 0 36 0; +#X connect 19 0 35 0; +#X connect 19 0 34 0; +#X connect 19 0 33 0; +#X connect 19 0 32 0; +#X connect 19 0 31 0; +#X connect 19 0 30 0; +#X connect 19 0 29 0; +#X connect 19 0 28 0; +#X connect 19 0 27 0; +#X connect 19 0 26 0; +#X connect 19 0 25 0; +#X connect 19 0 24 0; +#X connect 19 0 23 0; +#X connect 19 0 22 0; +#X connect 19 0 21 0; +#X connect 19 0 20 0; +#X connect 20 0 61 32; +#X connect 21 0 61 31; +#X connect 22 0 61 30; +#X connect 23 0 61 29; +#X connect 24 0 61 28; +#X connect 25 0 61 27; +#X connect 26 0 61 26; +#X connect 27 0 61 25; +#X connect 28 0 61 24; +#X connect 29 0 61 23; +#X connect 30 0 61 22; +#X connect 31 0 61 21; +#X connect 32 0 61 20; +#X connect 33 0 61 19; +#X connect 34 0 61 18; +#X connect 35 0 61 17; +#X connect 36 0 61 16; +#X connect 37 0 61 15; +#X connect 38 0 61 14; +#X connect 39 0 61 13; +#X connect 40 0 61 12; +#X connect 41 0 61 11; +#X connect 42 0 61 10; +#X connect 43 0 61 9; +#X connect 44 0 61 8; +#X connect 45 0 61 7; +#X connect 46 0 61 6; +#X connect 47 0 61 5; +#X connect 48 0 61 4; +#X connect 49 0 61 3; +#X connect 50 0 61 2; +#X connect 51 0 61 1; +#X connect 52 0 60 1; +#X connect 54 0 60 0; +#X connect 57 0 59 0; +#X connect 59 0 58 0; +#X connect 60 0 8 0; +#X connect 61 0 63 0; +#X connect 62 0 61 0; +#X connect 63 0 60 0; +#X connect 74 0 54 0; diff --git a/externals/miXed/doc/help/cyclone/bitnot~-help.pd b/externals/miXed/doc/help/cyclone/bitnot~-help.pd new file mode 100644 index 000000000..ebb973970 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/bitnot~-help.pd @@ -0,0 +1,84 @@ +#N canvas 269 57 553 622 10; +#X obj -1 600 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 380 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 371 385 441 271 META 0; +#X text 50 179 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 50 46 LICENSE SIBSD; +#X text 50 159 AUTHOR Miller Puckette; +#X text 50 199 RELEASE_DATE 1997; +#X text 50 139 LIBRARY cyclone; +#X text 50 99 INLET_0 signal; +#X text 50 119 OUTLET_0 signal; +#X text 50 219 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 50 26 KEYWORDS boolean bitnot bitwise signal; +#X text 50 66 DESCRIPTION performs bitwise boolean operations on a +float signal; +#X restore 497 602 pd META; +#X obj -1 426 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 467 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 162 547 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 32 31 bitand~; +#X obj 32 60 bitor~; +#X restore 209 602 pd Related_objects; +#X obj 83 438 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 551 41 empty \$0-pddp.cnv.header bitnot~ 3 12 0 +18 -204280 -1 0; +#X text 119 437 signal; +#X text 119 392 signal; +#X obj 21 213 clip~ -1 1; +#X floatatom 305 121 0 0 0 0 - - -; +#X msg 305 142 mode \$1; +#X floatatom 254 122 0 0 0 0 - - -; +#X obj 254 142 sig~ 0; +#X text 181 285 modes \; mode 0: treat floating point signal input +as raw 32 bit value \; mode 1: convert floating point signal input +to integer \;; +#X floatatom 54 242 0 0 0 0 - - -; +#X obj 21 265 *~ 0.2; +#X obj 21 307 dac~; +#X obj 21 142 cycle~ 440; +#X text 181 259 args: <mode>. defaults to 0; +#X text 243 94 bitwise boolean operation on signals as integers; +#X obj 254 173 bitnot~ 1; +#X obj 254 225 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 21 178 bitnot~; +#X obj 254 200 Snapshot~ 100; +#X text 101 484 1) float; +#X text 174 483 - modes (defaults to 0) mode 0: treat floating point +signal input as raw 32 bit value \; mode 1: convert floating point +signal input to integer \;; +#X text 174 392 - signal to do bitwise not with; +#X text 174 437 - output signal of bitwise not for mask and mode; +#X obj 498 4 bitnot~; +#X text 18 93 bitwise boolean operation on a signal as bits; +#X obj 83 393 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 482 52 pddp/dsp; +#X text 19 24 Performs bitwise boolean operations on a float signal. +; +#X text 19 53 Works on floating point signal as bits or as an integer: +; +#X obj 8 601 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 17 0; +#X connect 11 0 12 0; +#X connect 12 0 22 0; +#X connect 13 0 14 0; +#X connect 14 0 22 0; +#X connect 16 0 17 1; +#X connect 17 0 18 0; +#X connect 17 0 18 1; +#X connect 19 0 24 0; +#X connect 22 0 25 0; +#X connect 24 0 10 0; +#X connect 25 0 23 0; diff --git a/externals/miXed/doc/help/cyclone/bitor~-help.pd b/externals/miXed/doc/help/cyclone/bitor~-help.pd new file mode 100644 index 000000000..f7bd5fbd8 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/bitor~-help.pd @@ -0,0 +1,240 @@ +#N canvas 333 39 555 640 10; +#X obj -1 821 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 522 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 538 421 343 234 META 0; +#X text 64 125 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 64 -8 LICENSE SIBSD; +#X text 64 105 AUTHOR Miller Puckette; +#X text 64 145 RELEASE_DATE 1997; +#X text 64 85 LIBRARY cyclone; +#X text 64 -28 KEYWORDS bitwise bit boolean signal; +#X text 64 45 INLET_0 signal; +#X text 64 65 OUTLET_0 signal; +#X text 64 12 DESCRIPTION performs bitwise boolean operations on a +floating point signal as bits or as a float.; +#X text 64 165 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 499 823 pd META; +#X obj 1 574 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 1 611 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 218 546 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 35 37 bitand~; +#X obj 35 68 bitnot~; +#X restore 198 823 pd Related_objects; +#X obj 81 583 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 41 empty \$0-pddp.cnv.header bitor~ 3 12 0 18 +-204280 -1 0; +#X text 107 578 signal; +#X text 107 534 signal; +#X text 91 625 1) float; +#X text 91 643 2) float; +#X text 162 643 -; +#X text 162 643 modes \; mode 0: treat both floating point signal inputs +as raw 32 bit values \; mode 1: convert both floating point signal +inputs to integers \; mode 2: treat left input as raw 32 bit value +\, convert right input to integer \; mode 3: convert left input to +integer \, treat right input as raw 32 bit value \;; +#X text 162 627 - mask: 1 or 0 \, bit to mask (and) with; +#X obj 11 398 clip~ -1 1; +#X floatatom 376 275 0 0 0 0 - - -; +#X msg 376 298 mode \$1; +#X floatatom 491 275 0 0 0 0 - - -; +#X floatatom 435 275 0 0 0 0 - - -; +#X obj 491 298 sig~ 1; +#X obj 435 298 sig~ 1; +#X text 140 397 modes \; mode 0: treat both floating point signal inputs +as raw 32 bit values \; mode 1: convert both floating point signal +inputs to integers \; mode 2: treat left input as raw 32 bit value +\, convert right input to integer \; mode 3: convert left input to +integer \, treat right input as raw 32 bit value \;; +#X floatatom 44 421 0 0 0 0 - - -; +#X obj 11 443 *~ 0.2; +#X floatatom 45 330 0 0 0 0 - - -; +#X obj 11 480 dac~; +#X obj 31 291 cycle~ 440; +#X text 140 374 args: <mask> <mode>. both default to 0; +#X text 42 312 use an integer as a bitmask; +#X obj 435 322 bitor~ 0 1; +#X floatatom 435 376 5 0 0 0 - - -; +#X obj 12 353 bitor~; +#X obj 435 349 Snapshot~ 100; +#X obj 12 251 list trim; +#X text 162 578 - output signal of bitwise or for certain mask and +mode; +#X text 162 534 - signal to do bitwise or with \, signal can be treat +as signal of bits or as ints; +#X obj 504 5 bitor~; +#X text 372 242 bitwise boolean operation on signals as integers; +#X obj 81 538 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 483 51 pddp/dsp; +#X text 13 20 Performs bitwise boolean operations on a float signal. +; +#X text 28 59 Works on floating point signal as bits or as an integer: +; +#X text 10 90 bitwise operation on a signal as bits; +#X text 23 214 bitwise boolean operation on signal and some bitmask +as bits; +#X text 43 110 send bitmask; +#X obj 242 111 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 460 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 446 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 432 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 418 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 404 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 390 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 376 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 362 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 348 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 334 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 320 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 306 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 292 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 278 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 264 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 250 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 236 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 222 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 208 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 194 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 180 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 166 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 152 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 138 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 124 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 110 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 96 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 82 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 68 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 54 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 40 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 26 153 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 12 178 pack s 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0; +#X msg 12 113 bits; +#X text 478 150 set bitmask; +#X obj 4 822 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 24 0; +#X connect 16 0 17 0; +#X connect 17 0 30 0; +#X connect 18 0 20 0; +#X connect 19 0 21 0; +#X connect 20 0 30 1; +#X connect 21 0 30 0; +#X connect 23 0 24 1; +#X connect 24 0 26 0; +#X connect 24 0 26 1; +#X connect 25 0 32 1; +#X connect 27 0 32 0; +#X connect 30 0 33 0; +#X connect 32 0 15 0; +#X connect 33 0 31 0; +#X connect 34 0 32 0; +#X connect 46 0 78 0; +#X connect 46 0 77 0; +#X connect 46 0 76 0; +#X connect 46 0 75 0; +#X connect 46 0 74 0; +#X connect 46 0 73 0; +#X connect 46 0 72 0; +#X connect 46 0 71 0; +#X connect 46 0 70 0; +#X connect 46 0 69 0; +#X connect 46 0 68 0; +#X connect 46 0 67 0; +#X connect 46 0 66 0; +#X connect 46 0 65 0; +#X connect 46 0 64 0; +#X connect 46 0 63 0; +#X connect 46 0 62 0; +#X connect 46 0 61 0; +#X connect 46 0 60 0; +#X connect 46 0 59 0; +#X connect 46 0 58 0; +#X connect 46 0 57 0; +#X connect 46 0 56 0; +#X connect 46 0 55 0; +#X connect 46 0 54 0; +#X connect 46 0 53 0; +#X connect 46 0 52 0; +#X connect 46 0 51 0; +#X connect 46 0 50 0; +#X connect 46 0 49 0; +#X connect 46 0 48 0; +#X connect 46 0 47 0; +#X connect 47 0 79 32; +#X connect 48 0 79 31; +#X connect 49 0 79 30; +#X connect 50 0 79 29; +#X connect 51 0 79 28; +#X connect 52 0 79 27; +#X connect 53 0 79 26; +#X connect 54 0 79 25; +#X connect 55 0 79 24; +#X connect 56 0 79 23; +#X connect 57 0 79 22; +#X connect 58 0 79 21; +#X connect 59 0 79 20; +#X connect 60 0 79 19; +#X connect 61 0 79 18; +#X connect 62 0 79 17; +#X connect 63 0 79 16; +#X connect 64 0 79 15; +#X connect 65 0 79 14; +#X connect 66 0 79 13; +#X connect 67 0 79 12; +#X connect 68 0 79 11; +#X connect 69 0 79 10; +#X connect 70 0 79 9; +#X connect 71 0 79 8; +#X connect 72 0 79 7; +#X connect 73 0 79 6; +#X connect 74 0 79 5; +#X connect 75 0 79 4; +#X connect 76 0 79 3; +#X connect 77 0 79 2; +#X connect 78 0 79 1; +#X connect 79 0 34 0; +#X connect 80 0 79 0; diff --git a/externals/miXed/doc/help/cyclone/bitshift~-help.pd b/externals/miXed/doc/help/cyclone/bitshift~-help.pd new file mode 100644 index 000000000..4887da70e --- /dev/null +++ b/externals/miXed/doc/help/cyclone/bitshift~-help.pd @@ -0,0 +1,93 @@ +#N canvas 217 53 552 593 10; +#X obj -1 572 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 354 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 332 333 433 291 META 0; +#X text 38 176 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 38 43 LICENSE SIBSD; +#X text 38 156 AUTHOR Miller Puckette; +#X text 38 196 RELEASE_DATE 1997; +#X text 38 136 LIBRARY cyclone; +#X text 38 96 INLET_0 signal; +#X text 38 116 OUTLET_0 signal; +#X text 38 63 DESCRIPTION performs bitwise boolean operations on a +floating point signal as bits or as a float.; +#X text 38 23 KEYWORDS bitwise bit boolean signal shift; +#X text 38 216 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 501 574 pd META; +#X obj -1 409 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 446 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 118 515 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 6 31 bitand~; +#X obj 60 31 bitor~; +#X obj 108 31 bitnot~; +#X restore 215 574 pd Related_objects; +#X obj 76 418 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 549 40 empty \$0-pddp.cnv.header bitshift~ 3 12 +0 18 -204280 -1 0; +#X text 112 418 signal; +#X text 112 366 signal; +#X floatatom 55 142 0 0 0 0 - - -; +#X msg 55 162 shift \$1; +#X floatatom 404 145 0 0 0 0 - - -; +#X msg 404 165 mode \$1; +#X obj 29 226 clip~ -1 1; +#X floatatom 342 145 0 0 0 0 - - -; +#X msg 342 165 shift \$1; +#X text 14 92 bitwise operation on a signal as bits; +#X floatatom 291 145 0 0 0 0 - - -; +#X obj 291 165 sig~ 1; +#X floatatom 62 246 0 0 0 0 - - -; +#X obj 29 270 *~ 0.2; +#X obj 29 312 dac~; +#X obj 29 118 cycle~ 440; +#X text 280 287 args: <shift> <mode>. both default to 0; +#X text 280 111 bitwise operation on signals as integers; +#X obj 291 199 bitshift~ 1 1; +#X obj 291 253 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 29 191 bitshift~ 8 0; +#X obj 291 228 Snapshot~ 100; +#X text 167 480 - modes \; mode 0: treat floating point signal input +as raw 32 bit value \; mode 1: convert floating point signal input +to integer \;; +#X text 93 481 2) float; +#X text 94 456 1) shift; +#X text 167 455 - number of bits to shift; +#X text 167 367 - signal to bitshift \, can be treated as signal of +bits or signal as float/int; +#X text 167 418 - output of signal bit shifted; +#X obj 485 3 bitshift~; +#X obj 480 51 pddp/dsp; +#X text 17 22 Performs bitwise boolean operations on a foat signal. +; +#X text 18 52 Works on floating point signal as bits or as an integer: +; +#X obj 76 368 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 5 572 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 11 0; +#X connect 11 0 28 0; +#X connect 12 0 13 0; +#X connect 13 0 26 0; +#X connect 14 0 21 0; +#X connect 15 0 16 0; +#X connect 16 0 26 0; +#X connect 18 0 19 0; +#X connect 19 0 26 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 21 0 22 1; +#X connect 23 0 28 0; +#X connect 26 0 29 0; +#X connect 28 0 14 0; +#X connect 29 0 27 0; diff --git a/externals/miXed/doc/help/cyclone/bitxor~-help.pd b/externals/miXed/doc/help/cyclone/bitxor~-help.pd new file mode 100644 index 000000000..9f5bfc9f6 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/bitxor~-help.pd @@ -0,0 +1,398 @@ +#N canvas 353 23 576 762 10; +#X obj 9 722 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#X obj 9 439 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#N canvas 670 414 340 251 META 0; +#X text 1 20 LICENSE SIBSD; +#X text 1 113 LIBRARY cyclone; +#X text 1 0 KEYWORDS bitwise bit boolean signal; +#X text 1 40 DESCRIPTION performs bitwise boolean operations on a floating +point signal as bits or as a float; +#X text 1 73 INLET_0 signal; +#X text 1 93 OUTLET_0 signal; +#X text 0 133 VERSION 0.2-beta1; +#X text 0 151 AUTHOR Krzysztof Czaja; +#X text 1 169 RELEASE_DATE 2002; +#X text 2 188 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 2 220 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X restore 510 722 pd META; +#X obj 9 545 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#N canvas 214 725 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 6 28 cyclone/bitnot~; +#X obj 6 55 cyclone/bitor~; +#X obj 6 78 cyclone/bitxor~; +#X obj 108 29 cyclone/bitshift~; +#X obj 258 50 &; +#X restore 212 725 pd Related_objects; +#X obj 89 554 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 8 40 cnv 15 552 40 empty empty bitxor~ 3 12 0 18 -204280 -1 +0; +#X obj 46 345 clip~ -1 1; +#X text 127 554 signal; +#X obj 22 378 output~; +#X text 122 447 signal; +#X obj 91 452 cnv 17 3 55 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 91 518 cnv 17 3 17 empty empty 1 5 9 0 16 -228856 -162280 0 +; +#X obj 72 290 cyclone/cycle~ 220; +#X text 126 484 mode; +#N canvas 151 31 872 422 x 0; +#X obj 201 101 cnv 15 468 65 empty empty empty 20 12 0 14 -249661 -66577 +0; +#X obj 411 103 tgl 15 0 empty empty empty 17 7 0 10 -228856 -1 -1 1 +1; +#X obj 644 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 629 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 615 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 601 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -228856 +-1 -1 1 1; +#X obj 587 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 573 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 559 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 545 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -228856 +-1 -1 1 1; +#X obj 531 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 516 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 502 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 488 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -228856 +-1 -1 1 1; +#X obj 474 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 460 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 446 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 432 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -228856 +-1 -1 1 1; +#X obj 418 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 404 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 390 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 376 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -228856 +-1 -1 1 1; +#X obj 362 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 348 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 334 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 320 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -228856 +-1 -1 1 1; +#X obj 306 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 292 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 278 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 264 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -228856 +-1 -1 1 1; +#X obj 250 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 236 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 222 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -262144 +-1 -1 1 1; +#X obj 208 124 tgl 15 0 \$0-bitchange asjgsjags empty 17 7 0 10 -228856 +-1 -1 1 1; +#X obj 50 164 pack s 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0; +#X msg 50 95 bits; +#X obj 50 201 list trim; +#X obj 60 71 r \$0-bitchange; +#X obj 66 226 cyclone/tosymbol; +#X obj 50 40 inlet; +#X obj 50 310 outlet; +#X symbolatom 220 145 70 0 0 0 - - -, f 70; +#X text 428 103 set All; +#X obj 411 76 loadbang; +#X connect 1 0 33 0; +#X connect 1 0 32 0; +#X connect 1 0 31 0; +#X connect 1 0 30 0; +#X connect 1 0 29 0; +#X connect 1 0 28 0; +#X connect 1 0 27 0; +#X connect 1 0 26 0; +#X connect 1 0 25 0; +#X connect 1 0 24 0; +#X connect 1 0 23 0; +#X connect 1 0 22 0; +#X connect 1 0 21 0; +#X connect 1 0 20 0; +#X connect 1 0 19 0; +#X connect 1 0 18 0; +#X connect 1 0 17 0; +#X connect 1 0 16 0; +#X connect 1 0 15 0; +#X connect 1 0 14 0; +#X connect 1 0 13 0; +#X connect 1 0 12 0; +#X connect 1 0 11 0; +#X connect 1 0 10 0; +#X connect 1 0 9 0; +#X connect 1 0 8 0; +#X connect 1 0 7 0; +#X connect 1 0 6 0; +#X connect 1 0 5 0; +#X connect 1 0 4 0; +#X connect 1 0 3 0; +#X connect 1 0 2 0; +#X connect 2 0 34 32; +#X connect 3 0 34 31; +#X connect 4 0 34 30; +#X connect 5 0 34 29; +#X connect 6 0 34 28; +#X connect 7 0 34 27; +#X connect 8 0 34 26; +#X connect 9 0 34 25; +#X connect 10 0 34 24; +#X connect 11 0 34 23; +#X connect 12 0 34 22; +#X connect 13 0 34 21; +#X connect 14 0 34 20; +#X connect 15 0 34 19; +#X connect 16 0 34 18; +#X connect 17 0 34 17; +#X connect 18 0 34 16; +#X connect 19 0 34 15; +#X connect 20 0 34 14; +#X connect 21 0 34 13; +#X connect 22 0 34 12; +#X connect 23 0 34 11; +#X connect 24 0 34 10; +#X connect 25 0 34 9; +#X connect 26 0 34 8; +#X connect 27 0 34 7; +#X connect 28 0 34 6; +#X connect 29 0 34 5; +#X connect 30 0 34 4; +#X connect 31 0 34 3; +#X connect 32 0 34 2; +#X connect 33 0 34 1; +#X connect 34 0 36 0; +#X connect 35 0 34 0; +#X connect 36 0 38 0; +#X connect 36 0 40 0; +#X connect 37 0 35 0; +#X connect 38 0 41 0; +#X connect 39 0 35 0; +#X connect 43 0 1 0; +#X coords 0 -1 1 1 470 67 2 200 100; +#X restore 46 211 pd x; +#X obj 46 172 bng 23 250 50 0 empty empty empty 17 7 0 10 -228856 -1 +-1; +#X obj 12 578 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#X text 122 518 float/signal; +#X text 102 591 1) float (bitmask); +#X text 215 589 - integer value to be used as bitmask (default is 0). +Bitmask is the binary representation of this integer; +#X text 123 464 bits; +#X text 209 481 - Interpretation of the values at the two inlets (0-3). +See argument description for details; +#X text 209 464 - "bits" plus a list of 32 bits (0 or 1) - used as +bitmask; +#X text 206 519 - bitwise-and mask either as int or floar (depends +on mode); +#X text 41 135 send; +#X text 24 150 bitmask; +#N canvas 201 23 431 513 integer 0; +#X obj 112 216 clip~ -1 1; +#X obj 113 53 cyclone/cycle~ 220; +#X obj 54 307 output~; +#X msg 240 65 -1; +#X msg 251 87 65535; +#X msg 264 108 255; +#X obj 1 1 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X obj 113 82 *~ 10000; +#X obj 112 176 /~ 10000; +#X text 53 408 When using integers as bitmask (in mode 1 or 3) \, make +sure the signal is larger than +/- 1; +#X text 5 2 bitxor~ mask with integers; +#X obj 165 261 cyclone/Scope~ 202 127 3 3 120 -1 1 250 0 0 0 205 229 +232 74 79 77 96 98 102 0; +#X obj 113 132 cyclone/bitxor~ -1 1; +#X connect 0 0 2 0; +#X connect 0 0 2 1; +#X connect 0 0 11 0; +#X connect 1 0 7 0; +#X connect 3 0 12 1; +#X connect 4 0 12 1; +#X connect 5 0 12 1; +#X connect 7 0 12 0; +#X connect 8 0 0 0; +#X connect 12 0 8 0; +#X restore 268 355 pd integer as bitmask; +#X obj 498 44 bitxor~; +#X text 25 62 Bitwise exclusive-or-operation of floating point signals +; +#X text 110 107 Use the [bitxor~] object for "bitwise exclusive or" +on two signals interpreted as either raw 32-bit data or integer values. +The bits of both signals are compared and will be set to 1 if the two +bit values are different or 0 if the two values are the same. The raw +32-bit data is expressed as: <1 sign bit> <8 exponent bits> <23 mantissa +bits>.; +#X text 209 447 - signal to execute bitwise-exclusive-or on; +#X text 196 554 - floating-point signal as result of "bitwise-exclusive-or" +; +#X text 210 635 1: Convert both float inputs to integer; +#X text 210 648 2: Treat left input float as raw 32-bit (right as int) +; +#X text 210 660 3: Convert left input float to integer (right as raw +32-bit); +#X text 210 622 0: Treat both float inputs as raw 32-bit (default) +; +#X text 102 621 2) float (mode) -; +#X obj 46 319 cyclone/bitxor~ -1 2; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 7 3 pd; +#N canvas 673 40 366 264 (subpatch) 0; +#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 -74965 -212593 +-262144 1 1; +#X obj 215 68 route dsp; +#X obj 215 37 receive pd; +#N canvas 939 367 324 271 set_color 0; +#X obj 47 30 inlet; +#X obj 96 146 s \$0-cnv; +#X msg 96 114 color -4.86997e+06 -1.34937e+07; +#N canvas 0 22 712 637 off 0; +#X obj 490 220 * -1; +#X obj 424 300 +; +#X obj 409 325 +; +#X obj 347 219 * -65536; +#X obj 424 220 * -256; +#X obj 409 356 - 1; +#X obj 390 189 unpack f f f; +#X obj 225 295 +; +#X obj 210 320 +; +#X obj 148 214 * -65536; +#X obj 225 215 * -256; +#X obj 291 215 * -1; +#X obj 210 351 - 1; +#X obj 191 184 unpack f f f; +#X obj 379 423 pack; +#X msg 378 447 color \$1 \$2; +#X msg 395 152 124 124 124; +#X msg 203 154 220 220 220; +#X obj 238 121 t b b; +#X obj 238 81 inlet; +#X obj 378 485 outlet; +#X connect 0 0 1 1; +#X connect 1 0 2 1; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 1 0; +#X connect 5 0 14 1; +#X connect 6 0 3 0; +#X connect 6 1 4 0; +#X connect 6 2 0 0; +#X connect 7 0 8 1; +#X connect 8 0 12 0; +#X connect 9 0 8 0; +#X connect 10 0 7 0; +#X connect 11 0 7 1; +#X connect 12 0 14 0; +#X connect 13 0 9 0; +#X connect 13 1 10 0; +#X connect 13 2 11 0; +#X connect 14 0 15 0; +#X connect 15 0 20 0; +#X connect 16 0 6 0; +#X connect 17 0 13 0; +#X connect 18 0 17 0; +#X connect 18 1 16 0; +#X connect 19 0 18 0; +#X restore 47 113 pd off; +#X obj 47 83 select 0 1; +#X obj 47 168 list append 0; +#X obj 47 195 list trim; +#X obj 47 220 s \$0-tgl-r; +#X connect 0 0 4 0; +#X connect 2 0 1 0; +#X connect 2 0 5 0; +#X connect 3 0 1 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 4 1 2 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X restore 215 165 pd set_color; +#X obj 135 122 r \$0-tgl-s; +#N canvas 0 22 450 300 (subpatch) 0; +#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 -74965 -212593 +0; +#X coords 0 -1 1 1 42 27 1 100 100; +#X restore 51 144 pd; +#X obj 226 139 s \$0-tgl-r; +#X msg 226 115 set \$1; +#X msg 135 177 \; pd dsp \$1; +#N canvas 256 32 278 194 load_check 0; +#X obj 136 53 sig~ 1; +#X obj 74 24 loadbang; +#X obj 136 86 snapshot~; +#X obj 91 52 del 5; +#X obj 136 151 outlet; +#X obj 74 103 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 74 126 switch~; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 0 5 0; +#X connect 5 0 6 0; +#X restore 51 72 pd load_check; +#X connect 1 0 3 0; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 4 0 8 0; +#X connect 4 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 0 0; +#X coords 0 -1 1 1 44 72 2 50 100; +#X restore 507 91 pd; +#X obj 6 689 cnv 3 550 3 empty empty attributes 8 12 0 13 -228856 -1 +0; +#X text 157 696 @mode <int> (default: 0) - sets mode argument; +#X connect 7 0 9 0; +#X connect 7 0 9 1; +#X connect 13 0 38 0; +#X connect 15 0 38 0; +#X connect 16 0 15 0; +#X connect 38 0 7 0; diff --git a/externals/miXed/doc/help/cyclone/bondo-help.pd b/externals/miXed/doc/help/cyclone/bondo-help.pd new file mode 100644 index 000000000..90fc740f0 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/bondo-help.pd @@ -0,0 +1,72 @@ +#N canvas 294 99 553 521 10; +#X obj -1 500 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 322 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 406 363 437 234 META 0; +#X text 60 14 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 60 -106 LICENSE SIBSD; +#X text 60 -6 AUTHOR Miller Puckette; +#X text 60 34 RELEASE_DATE 1997; +#X text 60 -26 LIBRARY cyclone; +#X text 60 -126 KEYWORDS message bond syncronize sync print; +#X text 60 -86 DESCRIPTION sync a group of messages; +#X text 60 -66 INLET_0 message bang; +#X text 60 -46 OUTLET_0 message; +#X text 60 54 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 502 502 pd META; +#X obj -1 379 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 416 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 189 488 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 9 31 pack; +#X obj 44 31 unpack; +#X restore 211 502 pd Related_objects; +#X obj 80 388 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj 81 337 cnv 17 3 30 empty \$0-pddp.cnv.let.n n 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header bondo 3 12 0 18 +-204280 -1 0; +#X text 11 23 sync a group of messages; +#X text 169 192 arg sets number of in/outlets; +#X obj 115 193 bondo 3; +#X msg 115 130 brown; +#X msg 84 161 fox; +#X obj 115 277 print three; +#X msg 98 110 quick; +#X msg 154 72 a; +#X msg 238 142 set newval; +#X text 323 141 set the value / no output; +#X msg 205 100 bang; +#X text 247 93 output all values; +#X text 246 104 works for all inlets; +#X text 104 431 1) float; +#X text 114 334 message; +#X text 114 352 bang; +#X text 180 353 - will output all values (can be from any inlet); +#X text 121 389 message; +#X text 180 387 - sends out all messages stored in syn; +#X text 180 335 - message to sync with other messages; +#X obj 508 5 bondo; +#X text 180 430 - sets the number of inlets/outlets; +#X obj 134 253 print two; +#X obj 154 229 print one; +#X obj 11 500 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 14 0; +#X connect 11 1 31 0; +#X connect 11 2 32 0; +#X connect 12 0 11 1; +#X connect 13 0 11 0; +#X connect 15 0 11 1; +#X connect 16 0 11 2; +#X connect 17 0 11 1; +#X connect 17 0 11 2; +#X connect 17 0 11 0; +#X connect 19 0 11 2; diff --git a/externals/miXed/doc/help/cyclone/buddy-help.pd b/externals/miXed/doc/help/cyclone/buddy-help.pd new file mode 100644 index 000000000..8317eeb19 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/buddy-help.pd @@ -0,0 +1,64 @@ +#N canvas 210 153 553 460 10; +#X obj -1 439 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 266 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 360 382 399 209 META 0; +#X text 31 121 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 31 31 LICENSE SIBSD; +#X text 31 103 AUTHOR Miller Puckette; +#X text 31 139 RELEASE_DATE 1997; +#X text 31 13 KEYWORDS pass float numbers; +#X text 31 49 DESCRIPTION pass numbers from inlet to outlet; +#X text 31 85 OUTLET_N float; +#X text 31 67 INLET_N float clear; +#X text 31 157 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 503 441 pd META; +#X obj -1 323 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 360 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 78 483 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 8 29 Bucket; +#X restore 214 441 pd Related_objects; +#X obj 80 332 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header buddy 3 12 0 18 +-204280 -1 0; +#X text 93 374 1) float; +#X text 239 166 arg sets number of in/outlets; +#X obj 188 168 buddy 3; +#X floatatom 188 233 5 0 0 0 - - -; +#X floatatom 207 213 5 0 0 0 - - -; +#X floatatom 227 193 5 0 0 0 - - -; +#X floatatom 188 105 5 0 0 0 - - -; +#X floatatom 207 126 5 0 0 0 - - -; +#X floatatom 227 146 5 0 0 0 - - -; +#X msg 141 104 clear; +#X text 111 278 float; +#X text 165 279 - number to sync with other numbers; +#X text 111 296 clear; +#X text 165 297 - clear all stored values; +#X text 111 333 flaot; +#X text 165 333 - distributed all synced floats to outlets; +#X text 165 374 - sets the number of inlets/outlets; +#X obj 509 3 buddy; +#X text 51 94 clear all stored values; +#X obj 80 278 cnv 17 3 34 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X text 33 55 Once buddy receives all input data \, it outputs that +data in parallel simultaneously.; +#X text 11 23 sync inputs when all inlets receive data; +#X obj 4 439 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 11 0; +#X connect 10 1 12 0; +#X connect 10 2 13 0; +#X connect 14 0 10 0; +#X connect 15 0 10 1; +#X connect 16 0 10 2; +#X connect 17 0 10 0; diff --git a/externals/miXed/doc/help/cyclone/buffir~-help.pd b/externals/miXed/doc/help/cyclone/buffir~-help.pd new file mode 100644 index 000000000..8a0429498 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/buffir~-help.pd @@ -0,0 +1,151 @@ +#N canvas 276 82 555 596 10; +#X declare -lib iemmatrix; +#X obj -1 690 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 432 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 392 384 433 268 META 0; +#X text 27 89 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 27 -55 LICENSE SIBSD; +#X text 27 71 AUTHOR Miller Puckette; +#X text 27 107 RELEASE_DATE 1997; +#X text 27 53 LIBRARY cyclone; +#X text 27 -37 DESCRIPTION converts all signal values to positive values +; +#X text 27 -86 KEYWORDS signal buffer buffir buff FIR finite impulse +response convolution filter; +#X text 27 -19 INLET_0 signal; +#X text 27 -1 INLET_1 float; +#X text 27 17 INLET_2 float; +#X text 27 35 OUTLET_0 signal; +#X text 27 125 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 502 693 pd META; +#X obj -1 515 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 552 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 628 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 162 548 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 11 28 fir; +#X restore 202 693 pd Related_objects; +#X obj 79 464 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 554 40 empty \$0-pddp.cnv.header buffir~ 3 12 0 +18 -204280 -1 0; +#X text 105 440 signal; +#X text 163 439 - signal to pass to FIR; +#X text 105 523 signal; +#X obj 79 485 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 105 465 float; +#X obj 79 524 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 105 487 float; +#X text 163 487 - Length (samples); +#X text 163 463 - Offset (samples); +#X text 163 522 - based on buffer \, offset \, length; +#X obj 39 132 sig~ 1; +#X text 169 136 Length (samps); +#X obj 350 114 loadbang; +#X msg 28 82 clear; +#X floatatom 145 136 0 0 0 0 - - -; +#X floatatom 86 105 0 0 0 0 - - -; +#X obj 350 141 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#N canvas 480 212 405 395 genRamp 0; +#X obj 39 197 sel 0 1; +#X obj 81 254 i; +#X obj 39 146 sel 1; +#X msg 111 100 clear; +#X obj 120 206 * 1; +#X obj 120 180 expr ((127. - $f1) / 127.); +#X obj 98 124 - 1; +#X obj 39 75 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 81 282 pack 0 0; +#X text 116 151 exponential ramp down from 1 to 0; +#X text 147 249 makes 50% zeros \, 25% exponential downward ramp \, +25% random; +#X obj 39 99 Uzi 128; +#X obj 39 123 decide; +#X obj 39 174 decide; +#X obj 39 219 urn 128; +#X obj 39 53 inlet; +#X obj 81 316 outlet; +#X connect 0 0 14 0; +#X connect 0 1 1 0; +#X connect 1 0 8 0; +#X connect 2 0 13 0; +#X connect 3 0 14 0; +#X connect 4 0 8 1; +#X connect 5 0 4 0; +#X connect 5 0 4 1; +#X connect 6 0 1 1; +#X connect 6 0 5 0; +#X connect 7 0 3 0; +#X connect 7 0 11 0; +#X connect 8 0 16 0; +#X connect 11 0 12 0; +#X connect 11 2 6 0; +#X connect 12 0 2 0; +#X connect 13 0 0 0; +#X connect 14 0 8 0; +#X connect 15 0 7 0; +#X restore 350 166 pd genRamp; +#X text 20 64 clears input history only; +#X text 112 104 Offset (samps); +#X text 121 207 256 point max len; +#X text 10 274 integral of buffer from offset to offset + length; +#X obj 28 176 buffir~ fir_buf 0 32; +#X obj 350 193 peek~ fir_buf; +#X obj 368 363 table fir_buf 128; +#X obj 28 205 Snapshot~ 100; +#X obj 28 229 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X floatatom 146 305 0 0 0 0 - - -; +#X obj 29 295 noise~; +#X obj 29 362 *~ 0.05; +#X obj 29 395 dac~; +#X obj 29 330 buffir~ fir_buf 0 10; +#X text 86 568 1) table; +#X text 163 567 - buffer (max size 256); +#X text 87 585 2) float; +#X text 163 585 - offset; +#X text 87 602 3) float; +#X text 163 602 - length; +#X text 102 638 buffir~ is a table based FIR (finite impulse response) +filter. an input signal is convolved with n samples of a buffer. Currently +the maximum number of points is 256; +#X obj 498 2 buffir~; +#X obj 483 49 pddp/dsp; +#X text 11 23 table based FIR (finite impulse response) convolution +filter; +#X obj 79 443 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 337 319 table is a 128-point downwards ramp with random values +here and there with amplitude from 1 to 0; +#X text 172 298 number of samples in impulse; +#X text 155 159 Initial args: buffer \, offset(samps) \, length(samps) +; +#X text 418 165 Generate new fir; +#X obj 7 692 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 19 0 31 0; +#X connect 21 0 25 0; +#X connect 22 0 31 0; +#X connect 23 0 31 2; +#X connect 24 0 31 1; +#X connect 25 0 26 0; +#X connect 26 0 32 0; +#X connect 31 0 34 0; +#X connect 34 0 35 0; +#X connect 36 0 40 2; +#X connect 37 0 40 0; +#X connect 38 0 39 0; +#X connect 38 0 39 1; +#X connect 40 0 38 0; diff --git a/externals/miXed/doc/help/cyclone/capture-help.pd b/externals/miXed/doc/help/cyclone/capture-help.pd new file mode 100644 index 000000000..49f587a78 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/capture-help.pd @@ -0,0 +1,102 @@ +#N canvas 334 53 553 637 10; +#X obj -1 642 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 351 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 469 405 409 263 META 0; +#X text 43 102 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 43 -42 LICENSE SIBSD; +#X text 43 84 AUTHOR Miller Puckette; +#X text 43 120 RELEASE_DATE 1997; +#X text 43 66 LIBRARY cyclone; +#X text 43 -60 KEYWORDS store float edit; +#X text 43 -24 DESCRIPTION store and edit numbers; +#X text 43 -6 INLET_0 float; +#X text 43 12 INLET_1 list; +#X text 43 30 INLET_2 messages; +#X text 43 48 OUTLET_0 list; +#X text 43 138 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 497 644 pd META; +#X obj -1 515 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 552 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 232 560 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 7 30 coll; +#C restore; +#X obj 63 30 funbuff; +#C restore; +#X obj 117 30 textfile; +#X restore 213 644 pd Related_objects; +#X obj 80 361 cnv 17 3 55 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 525 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header capture 3 12 0 +18 -204280 -1 0; +#X text 12 23 store and edit numbers; +#X obj 54 284 capture 64 x; +#X msg 113 148 open; +#X floatatom 54 79 5 0 0 0 - - -; +#X msg 27 56 10 20 30 40; +#X msg 113 127 dump; +#X obj 54 309 print dump; +#X msg 113 106 clear; +#X text 125 57 list is stored from first to last; +#X text 146 289 second arg is x - values are in hex; +#X text 230 302 m - values < 128 decimal \, larger numbers are hex +; +#X msg 113 167 wclose; +#X text 101 79 numbers are stored sequentially; +#X msg 112 190 count; +#X msg 112 211 write; +#X msg 112 235 write /tmp/test.txt; +#X text 145 277 first arg is number of values to store (default 512) +; +#X text 212 329 none - values are decimal \, supports float; +#X text 230 316 d - decimal \, default max behaviour \, only ints; +#X text 108 359 float; +#X text 180 359 - numbers are stored sequentially; +#X text 108 378 list; +#X text 180 375 - list is stored from first to last; +#X text 108 399 messages; +#X text 163 146 open editing window; +#X text 163 129 send out all stored values sequentially; +#X text 165 106 clear contents; +#X text 165 165 close editing window; +#X text 169 188 print number of items to the console; +#X text 166 210 save to textfile (dialog box asks for filename); +#X text 247 234 write to file (no dialog); +#X text 180 397 - clear: clear contents; +#X text 180 410 - dump: send out all stored values sequentially; +#X text 180 424 - open: open editing window; +#X text 180 438 - wclose: close editing window; +#X text 180 453 - count: print number of items to the console; +#X text 180 468 - write: save to textfile (dialog box asks for filename) +; +#X text 108 526 list; +#X text 180 523 - list of numbers stored; +#X text 180 483 - write /path/to/file: write to file (no dialog); +#X text 141 585 m - values < 128 decimal \, larger numbers are hex +; +#X text 123 610 none - values are decimal \, supports float; +#X text 141 599 d - decimal \, default max behaviour \, only ints; +#X text 98 559 1) float - number of values to store (default 512); +#X text 98 572 2) str x - values are in hex; +#X obj 498 3 capture; +#X obj 7 642 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 15 0; +#X connect 11 0 10 0; +#X connect 12 0 10 0; +#X connect 13 0 10 0; +#X connect 14 0 10 0; +#X connect 16 0 10 0; +#X connect 20 0 10 0; +#X connect 22 0 10 0; +#X connect 23 0 10 0; +#X connect 24 0 10 0; diff --git a/externals/miXed/doc/help/cyclone/capture~-help.pd b/externals/miXed/doc/help/cyclone/capture~-help.pd new file mode 100644 index 000000000..c116b6c52 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/capture~-help.pd @@ -0,0 +1,85 @@ +#N canvas 774 60 554 706 10; +#X obj -1 685 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 176 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 1104 101 422 247 META 0; +#X text 44 130 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 44 9 LICENSE SIBSD; +#X text 44 112 AUTHOR Miller Puckette; +#X text 44 148 RELEASE_DATE 1997; +#X text 44 94 LIBRARY cyclone; +#X text 44 76 OUTLET_0 list; +#X text 44 -9 KEYWORDS capture signal collect text; +#X text 44 27 DESCRIPTION Collect samples from a signal and examine +in text window; +#X text 44 58 INLET_0 signal message; +#X text 44 166 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 687 pd META; +#X obj -1 267 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 304 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 519 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 78 483 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 19 57 pddp/helplink pddp/pddplink; +#X obj 19 83 pddp/helplink pddp/helplink; +#X obj 21 33 pddp/pddplink @pd_help/all_about_externals.pd -text _________; +#X obj 21 33 pddp/pddplink @pd_help/all_about_externals.pd -text Externals; +#X restore 211 687 pd Related_objects; +#X obj 80 185 cnv 17 3 42 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 276 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 551 43 empty \$0-pddp.cnv.header capture~ 3 12 0 +18 -204280 -1 0; +#X obj 1 687 pddp/pddplink help.pd -text help; +#X text 107 206 messages; +#X text 180 206 - clear: clear contents; +#X text 180 222 - write: save to textfile (dialog box asks for filename) +; +#X text 107 276 list; +#X text 180 239 - write /path/to/file: write to file (no dialog); +#X msg 284 97 write; +#X msg 99 97 clear; +#X obj 27 84 cycle~ 440; +#X text 132 97 Clear capture buffer; +#X text 325 95 Write as text file; +#X text 22 56 (look at values from a sine wave...); +#X text 158 128 double-click to see text of captured values; +#X obj 27 137 capture~ f 1000 2 0; +#X text 107 184 signal; +#X text 180 184 - signal to collect samples from; +#X text 75 537 capture~ is similar to the capture object \, except +that it collects signal values rather than incoming integers. capture~ +is designed for signal debugging or investigation321for recording \, +use record~ or sfrecord~; +#X text 75 606 Note that capture~'s text window only holds a limited +amount of data \, so it's easy to capture more data than you can see. +If you want to see all the data \, write it to a text file and open +the file with another text editor.; +#X text 180 275 - list of values captured; +#X text 89 432 Default values: - "last" mode \, where capture~ continues +to collect data \, throwing away old values if it has received more +than its specified number \; - 4100 values \; - print precision of +4 decimal places \; - record the entire signal vector \;; +#X text 90 312 1) str - optional "f" or "first" to put capture~ into +"first" mode where it stops collecting data after it has received the +specified number of values \; 2) float - number of values to capture +\; 3) float - the print precision (number of decimal places shown) +\; 4) float - a list of up to 10 indices within a signal vector. If +no indices present \, capture~ records the entire vector.; +#X obj 490 4 capture~; +#X obj 438 26 pddp/pddplink http://wiki.puredata.info/en/help -text +pdpedia: capture~; +#X text 12 23 Collect samples from a signal and examine in a text window +; +#X obj 481 56 pddp/dsp; +#X connect 16 0 23 0; +#X connect 17 0 23 0; +#X connect 18 0 23 0; diff --git a/externals/miXed/doc/help/cyclone/cartopol-help.pd b/externals/miXed/doc/help/cyclone/cartopol-help.pd new file mode 100644 index 000000000..787fc5ffe --- /dev/null +++ b/externals/miXed/doc/help/cyclone/cartopol-help.pd @@ -0,0 +1,75 @@ +#N canvas 205 89 555 578 10; +#X obj -1 556 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 353 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 317 386 441 256 META 0; +#X text 52 165 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 52 21 LICENSE SIBSD; +#X text 52 147 AUTHOR Miller Puckette; +#X text 52 183 RELEASE_DATE 1997; +#X text 52 129 LIBRARY cyclone; +#X text 52 57 INLET_0 float; +#X text 52 3 KEYWORDS coordinate graph cartesian polar conversion; +#X text 52 39 DESCRIPTION cartesian to polar conversion; +#X text 52 75 INLET_1 float; +#X text 52 93 OUTLET_0 float; +#X text 52 111 OUTLET_0 float; +#X text 52 201 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 504 558 pd META; +#X obj -1 414 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 478 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 105 492 428 153 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 24 38 poltocar; +#X restore 216 559 pd Related_objects; +#X obj 81 362 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header cartopol 3 12 0 +18 -204280 -1 0; +#X obj 81 388 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X text 12 23 cartesian to polar conversion; +#X text 115 362 float; +#X text 169 362 - real part of argument; +#X text 115 388 float; +#X text 169 388 - imaginary part of argument; +#X obj 81 450 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X text 115 425 float; +#X text 115 452 float; +#X text 169 424 - amplitude; +#X text 169 452 - phase; +#X obj 154 283 cartopol; +#X floatatom 154 238 6 0 0 0 real-> - -; +#X floatatom 205 238 6 0 0 1 <-imaginary - -; +#X floatatom 154 319 6 0 0 0 amplitude-> - -; +#X floatatom 199 319 7 0 0 1 <-phase - -; +#X obj 205 143 hsl 128 15 -1 1 0 0 empty empty x-axis 136 7 1 10 -225280 +-1 -1 0 0; +#X obj 263 85 vsl 15 128 -1 1 0 0 empty empty y-axis -5 -8 1 10 -261681 +-1 -1 0 0; +#X obj 205 258 t b f; +#X msg 205 55 0; +#X text 109 492 (none); +#X obj 490 3 cartopol; +#X obj 81 425 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 116 50 resets to zero; +#X obj 4 557 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 19 0 22 0; +#X connect 19 1 23 0; +#X connect 20 0 19 0; +#X connect 21 0 26 0; +#X connect 24 0 21 0; +#X connect 25 0 20 0; +#X connect 26 0 20 0; +#X connect 26 1 19 1; +#X connect 27 0 25 0; +#X connect 27 0 24 0; diff --git a/externals/miXed/doc/help/cyclone/cartopol~-help.pd b/externals/miXed/doc/help/cyclone/cartopol~-help.pd new file mode 100644 index 000000000..4df3bea8a --- /dev/null +++ b/externals/miXed/doc/help/cyclone/cartopol~-help.pd @@ -0,0 +1,72 @@ +#N canvas 719 62 552 483 10; +#X obj -1 462 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 234 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 1090 158 431 306 META 0; +#X text 46 114 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 46 -46 LICENSE SIBSD; +#X text 46 94 AUTHOR Miller Puckette; +#X text 46 134 RELEASE_DATE 1997; +#X text 46 74 LIBRARY cyclone; +#X text 46 -66 KEYWORDS signal cartesian polar conversion; +#X text 46 -26 DESCRIPTION cartesian to polar conversion for signals +; +#X text 46 14 INLET_1 signal; +#X text 46 -6 INLET_0 signal; +#X text 46 34 OUTLET_0 signal; +#X text 46 54 OUTLET_1 signal; +#X text 46 154 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 503 464 pd META; +#X obj -1 306 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 377 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 422 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 1095 187 428 164 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 35 41 poltocar~; +#X restore 215 465 pd Related_objects; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header cartopol~ 3 12 +0 18 -204280 -1 0; +#X obj -1 464 pddp/pddplink help.pd -text help; +#X text 184 322 - amplitude; +#X text 184 349 - phase; +#X text 116 392 (none); +#X text 14 23 cartesian to polar conversion for signals; +#X text 16 55 Here's how to connect it to an fft~:; +#X text 143 119 phase (in 271 radians); +#X obj 87 201 ifft~ 256 256 0; +#X obj 87 177 poltocar~; +#X obj 87 102 cartopol~; +#X obj 87 79 fft~ 256 256 0; +#X text 62 118 amp.; +#X text 138 144 <- do some spectral processing here; +#X text 184 249 - real part of signal; +#X text 184 275 - imaginary part of signal; +#X text 117 249 signal; +#X text 117 275 signal; +#X text 117 322 signal; +#X text 117 349 signal; +#X obj 484 4 cartopol~; +#X obj 432 24 pddp/pddplink http://wiki.puredata.info/en/help -text +pdpedia: cartopol~; +#X obj 86 250 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 86 276 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X obj 86 324 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 86 350 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X obj 481 52 pddp/dsp; +#X connect 16 0 15 0; +#X connect 16 1 15 1; +#X connect 17 0 16 0; +#X connect 17 1 16 1; +#X connect 18 0 17 0; +#X connect 18 1 17 1; diff --git a/externals/miXed/doc/help/cyclone/change~-help.pd b/externals/miXed/doc/help/cyclone/change~-help.pd new file mode 100644 index 000000000..94fccc90d --- /dev/null +++ b/externals/miXed/doc/help/cyclone/change~-help.pd @@ -0,0 +1,95 @@ +#N canvas 276 58 554 584 10; +#X obj -1 562 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 396 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 388 368 437 250 META 0; +#X text 40 155 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 40 35 LICENSE SIBSD; +#X text 40 135 AUTHOR Miller Puckette; +#X text 40 175 RELEASE_DATE 1997; +#X text 40 115 LIBRARY cyclone; +#X text 40 75 INLET_0 signal; +#X text 40 95 OUTLET_0 signal; +#X text 40 15 KEYWORDS signal change direction detect; +#X text 40 55 DESCRIPTION detect signal change and direction; +#X text 40 195 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 564 pd META; +#X obj -1 441 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 481 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 166 510 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 13 33 change; +#X restore 206 564 pd Related_objects; +#X obj 79 450 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header change~ 3 12 0 +18 -204280 -1 0; +#X text 11 23 Detect signal change and direction; +#X obj 396 255 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X text 412 252 signal isn't the same; +#X msg 286 71 0 \, 0 5000; +#X obj 369 275 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X msg 192 71 500 \, 0 5000; +#X msg 99 71 0 \, 500 5000; +#X obj 284 299 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 191 311 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 99 109 line~; +#X text 385 273 signal is the same; +#X text 99 55 245 increasing; +#X text 192 55 245 decreasing; +#X text 287 55 245 the same; +#X obj 99 143 change~; +#X obj 191 232 edge~; +#X obj 284 229 edge~; +#X obj 369 229 edge~; +#X obj 369 197 expr~ $v1==0; +#X obj 283 197 expr~ $v1==1; +#X obj 191 197 expr~ $v1==-1; +#X obj 99 197 Snapshot~ 100; +#X obj 99 229 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 7 157 Snapshot~ 100; +#X obj 7 180 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X text 109 404 signal; +#X text 179 404 - signal to detect change and direction; +#X text 109 496 (none); +#X text 109 449 signal; +#X text 178 449 - -1 then signal is decreasing \, 1 then signal is +increasing \, 0 then signal is the same; +#X obj 496 4 change~; +#X obj 79 406 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 299 299 detect when signal is increasing; +#X text 188 326 detect when signal is decreasing; +#X obj 480 49 pddp/dsp; +#X obj 5 563 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 17 0; +#X connect 13 0 17 0; +#X connect 14 0 17 0; +#X connect 17 0 22 0; +#X connect 17 0 31 0; +#X connect 22 0 26 0; +#X connect 22 0 29 0; +#X connect 22 0 28 0; +#X connect 22 0 27 0; +#X connect 23 0 16 0; +#X connect 24 0 15 0; +#X connect 25 0 12 0; +#X connect 25 1 9 0; +#X connect 26 0 25 0; +#X connect 27 0 24 0; +#X connect 28 0 23 0; +#X connect 29 0 30 0; +#X connect 31 0 32 0; diff --git a/externals/miXed/doc/help/cyclone/click~-help.pd b/externals/miXed/doc/help/cyclone/click~-help.pd new file mode 100644 index 000000000..6782e6192 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/click~-help.pd @@ -0,0 +1,66 @@ +#N canvas 265 170 554 463 10; +#X obj -2 344 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 151 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 377 347 428 264 META 0; +#X text 58 156 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 58 36 LICENSE SIBSD; +#X text 58 136 AUTHOR Miller Puckette; +#X text 58 176 RELEASE_DATE 1997; +#X text 58 116 LIBRARY cyclone; +#X text 58 96 OUTLET_0 signal; +#X text 58 16 KEYWORDS signal impulse band; +#X text 58 56 DESCRIPTION generate an impulse; +#X text 58 76 INLET_0 bang set; +#X text 58 196 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 498 346 pd META; +#X obj 2 222 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 2 259 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 150 501 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 8 31 noise~; +#X obj 56 31 osc~; +#X restore 207 346 pd Related_objects; +#X obj 79 160 cnv 17 3 42 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 231 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -2 -97 cnv 15 552 40 empty \$0-pddp.cnv.header click~ 3 12 0 +18 -204280 -1 0; +#X text 10 -74 generate an impulse; +#X msg 156 29 set 1; +#X msg 120 8 set 0.25 0.5 0.75 1 0.67 0.3; +#X obj 84 88 *~ 0.5; +#X obj 84 119 dac~; +#X obj 84 -7 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X text 130 55 optional argument(s) to set impulse (default impulse: +1.0); +#X obj 84 57 click~; +#X text 99 159 bang; +#X text 162 159 - generate impulse based on arg or stored value; +#X text 99 185 set; +#X text 162 185 - create personalized band-limited impulse (max 256 +samples); +#X text 99 230 signal; +#X text 162 230 - signal based on impulse value stored; +#X text 82 277 1) float; +#X text 162 277 - set impulse \, default is 0; +#X obj 500 -93 click~; +#X obj 482 -50 pddp/dsp; +#X text 301 -8 use the set message to create a personalized band-limited +impulse (maximum 256 samples); +#X obj 4 345 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 16 0; +#X connect 11 0 16 0; +#X connect 12 0 13 0; +#X connect 12 0 13 1; +#X connect 14 0 16 0; +#X connect 16 0 12 0; diff --git a/externals/miXed/doc/help/cyclone/coll-help.pd b/externals/miXed/doc/help/cyclone/coll-help.pd new file mode 100644 index 000000000..ad1361e91 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/coll-help.pd @@ -0,0 +1,354 @@ +#N canvas 351 14 554 662 10; +#X obj -1 1118 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 +0 14 -233017 -33289 0; +#X obj -1 724 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 470 383 418 288 META 0; +#X text 44 193 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 44 31 LICENSE SIBSD; +#X text 44 175 AUTHOR Miller Puckette; +#X text 44 211 RELEASE_DATE 1997; +#X text 44 157 LIBRARY cyclone; +#X text 44 49 DESCRIPTION store and edit collections of messages; +#X text 44 67 INLET_0 message; +#X text 44 103 OUTLET_1 float; +#X text 44 121 OUTLET_2 bang; +#X text 44 139 OUTLET_3 bang; +#X text 44 85 OUTLET_0 message; +#X text 44 13 KEYWORDS store edit message index; +#X text 44 229 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 1120 pd META; +#X obj -1 786 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 902 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 230 571 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 10 30 funbuff; +#C restore; +#X obj 65 30 buddy; +#X obj 108 30 textfile; +#X restore 196 1120 pd Related_objects; +#X obj 81 817 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header coll 3 12 0 18 +-204280 -1 0; +#X text 11 23 store and edit collections of messages; +#X obj 32 601 coll /tmp/test.coll; +#C restore; +#X obj 32 71 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 39 124 next; +#X obj 32 690 print coll; +#X msg 131 488 clear; +#X floatatom 69 667 5 0 0 0 - - -, f 5; +#X obj 106 647 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 143 629 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 58 170 dump; +#X msg 61 194 read /tmp/foo; +#X msg 68 220 read; +#X msg 85 291 length; +#X text 124 645 bang when we finished a load or save operation; +#X text 161 627 bang when finished with a dump operation; +#X text 101 665 index of the message sent out; +#X text 156 599 optional arg loads a file into coll; +#N canvas 79 76 329 260 loadsomeitems 0; +#X obj -44 53 inlet; +#X obj -13 220 outlet; +#X obj -44 75 t b b; +#X text -70 21 messages prefixed with an index are stored:; +#X msg -59 110 4 this is a message; +#X msg 7 180 1 10; +#X msg -40 132 3 and another one with 12345 in it; +#X msg -13 155 2 some_symbol; +#X connect 0 0 2 0; +#X connect 2 1 4 0; +#X connect 2 1 6 0; +#X connect 2 1 7 0; +#X connect 2 1 5 0; +#X connect 4 0 1 0; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 7 0 1 0; +#X restore 32 95 pd loadsomeitems; +#X text 50 70 load stuff; +#X text 89 169 dump them all; +#X text 146 193 read a file; +#X text 98 219 opens a dialog; +#X msg 74 244 write /tmp/foo; +#X text 166 242 write a file; +#X text 118 266 open a dialog; +#X msg 81 267 write; +#X floatatom 122 467 5 0 0 0 - - -, f 5; +#X text 129 290 output nr. of messages stored; +#X text 72 123 output next =; +#X msg 159 123 bang; +#X msg 90 313 delete 2; +#X text 143 313 delete message \, and decrement larger indexes; +#X msg 100 357 goto 2; +#X text 143 355 goto item nr; +#X msg 105 379 end; +#X text 131 377 goto last item; +#X msg 109 401 filetype; +#X text 167 400 useless on unix it's a dummy function; +#X msg 114 423 flags 1 0; +#X text 176 422 save coll's contents with the patch; +#X msg 117 445 flags 0 0; +#X text 180 443 don't save (default); +#N canvas 98 103 409 253 more 0; +#X obj 129 205 outlet; +#X msg 50 37 store named_one this works too; +#X msg 95 67 named_one; +#X msg 129 112 nstore 5 foobar stored and associated; +#X msg 146 140 foobar; +#X text 198 141 =; +#X msg 214 141 5; +#X text 127 93 store and associate at once:; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 6 0 0 0; +#X restore 381 538 pd more ways to store; +#N canvas 137 108 841 409 complex 0; +#X obj 100 366 outlet; +#X msg 44 62 assoc bar 1; +#X msg 100 88 bar; +#X msg 118 119 subsym foo bar; +#X msg 131 149 foo; +#X msg 138 178 deassoc foo 1; +#X obj 161 234 r cout; +#X obj 588 366 s cout; +#X text 119 60 associate index 1 with 'bar'; +#X text 126 87 retrieve it using association; +#X text 210 118 change association; +#X text 156 148 retrieve; +#X text 225 178 remove association; +#X msg 149 205 nth 4 3; +#X text 201 205 retrieve 3rd element of message at index 4; +#X msg 511 70 merge 2 and this was appended; +#X msg 536 96 2; +#X text 507 37 merge appends a message to an; +#X text 507 50 already stored one:; +#X msg 588 130 insert 2 a new two; +#X text 584 99 inserts new message at index; +#X text 585 110 and increments all indexes >=; +#X floatatom 608 160 5 0 0 0 - - -, f 5; +#X text 644 159 check it out ...; +#X text 637 225 or send it out immediately:; +#X text 624 181 replace an item (silently):; +#X msg 625 202 nsub 2 3 one; +#X msg 640 243 sub 2 2 newer; +#X text 18 21 comment; +#X text 11 9 coll can associate indexes and symbols \, symbols can +be used just like ints to operate on or re-trieve data:; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 13 0 0 0; +#X connect 15 0 7 0; +#X connect 16 0 7 0; +#X connect 19 0 7 0; +#X connect 22 0 7 0; +#X connect 26 0 7 0; +#X connect 27 0 7 0; +#X restore 381 515 pd complex operations; +#X text 379 495 for more info:; +#X msg 137 511 open; +#X msg 225 194 readagain; +#X msg 96 335 remove 3; +#X text 151 334 delete message \, leave index alone; +#X msg 246 244 writeagain; +#N canvas 386 140 738 315 even 0; +#X obj 32 207 coll /tmp/new.coll; +#C restore; +#X text 133 76 load ...; +#X msg 49 99 dump; +#X msg 77 146 renumber; +#X msg 88 168 dump; +#X msg 67 122 swap 1 2; +#X msg 32 76 1 100 \, 2 200; +#X text 135 123 swap 1 & 2; +#X msg 32 281 renumber; +#X text 87 280 doesn't quite work as expected ...; +#X obj 301 207 coll /tmp/new1.coll; +#C restore; +#X msg 301 71 2 2 3 4 \, 1 1 2 3 \, 3 3 4 5; +#X msg 318 101 sort 1; +#X msg 325 127 dump; +#X msg 412 101 sort -1; +#X text 299 50 sort by index or element \, up or down:; +#X text 464 100 up; +#X text 362 101 down; +#X msg 394 148 sort 1 3; +#X msg 470 148 sort -1 3; +#X text 399 130 sort by 3rd element:; +#X msg 551 177 dump; +#X text 141 147 order by index*; +#X text 21 281 *; +#X text 12 10 this is not like in the reference \, renumber shouldn't +be needed:; +#X msg 551 148 separate 2; +#X text 551 87 puts a space in place ofa desired index numberand +increments all indicesabove desired index; +#X obj 338 263 print more_coll_B_indices; +#X obj 301 236 print more_coll_B; +#X obj 32 236 print more_coll_A; +#X connect 0 0 29 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 10 0 28 0; +#X connect 10 1 27 0; +#X connect 11 0 10 0; +#X connect 12 0 10 0; +#X connect 13 0 10 0; +#X connect 14 0 10 0; +#X connect 18 0 10 0; +#X connect 19 0 10 0; +#X connect 21 0 10 0; +#X connect 25 0 10 0; +#X restore 344 94 pd even more things; +#X msg 141 533 wclose; +#N canvas 423 174 345 227 problems 0; +#X obj 148 125 outlet; +#X msg 118 78 min; +#X msg 148 78 max; +#X text 62 28 please look at coll.txt if you think; +#X text 62 41 you can help...; +#N canvas 53 134 658 284 refer 0; +#X msg 45 98 1 1 \, 2 2 \, 3 3; +#X floatatom 408 135 5 0 0 0 - - -, f 5; +#X floatatom 475 204 5 0 0 0 - - -, f 5; +#X obj 45 132 coll /tmp/1.coll; +#C restore; +#X obj 475 167 coll /tmp/2.coll; +#C restore; +#X msg 475 99 refer /tmp/1.coll; +#X text 42 77 load data into 1.coll:; +#X text 402 79 tell 2.coll to refer to 1.coll:; +#X text 238 133 retrieve 1.coll's contents:; +#X text 40 31 I once crashed* pd using this so please use with caution +...; +#X text 50 236 * can't reproduce it :(; +#X connect 0 0 3 0; +#X connect 1 0 4 0; +#X connect 4 0 2 0; +#X connect 5 0 4 0; +#X restore 253 172 pd refer; +#X text 36 170 I don't consider this to be stable:; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X restore 381 561 pd problems; +#X text 111 732 message; +#X msg 50 147 prev; +#X text 82 145 previous; +#X obj 81 839 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 111 816 float; +#X obj 81 861 cnv 17 3 17 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X obj 81 795 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 111 838 bang; +#X text 216 816 - index of message sent out; +#X text 111 794 message; +#X text 111 861 bang; +#X obj 495 3 coll; +#C restore; +#X text 315 236 rewrite last file written; +#X text 288 186 reopens last file read; +#X obj 81 734 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 216 731 - can input message to store or many different commands +for coll object as specified above; +#X text 158 465 output by index; +#X text 170 486 clear contents; +#X text 170 510 open editor; +#X text 185 532 close & save; +#X text 135 94 look inside; +#X obj 5 1119 pddp/pddplink @pd_help/all_about_help_patches.pd -text +Usage Guide; +#X text 78 960 symbol /path/to/file; +#X text 78 980 float 0 or 1; +#X text 216 960 - optional arg loads a file into coll; +#X text 216 980 - optional arg makes coll instance threadedensuring +that file read/write operations areexecuted in a separate thread \, +which minimizeschances of dropped audio samples \, particularlywhen +handling large coll files; +#X text 6 926 Following creation arguments can be provided in any order: +; +#N canvas 408 171 450 391 threaded 0; +#X obj 56 233 coll 1; +#C restore; +#X obj 121 233 coll /tmp/test.coll 1; +#C restore; +#X obj 267 233 coll 1 /tmp/test.coll; +#C restore; +#X text 47 38 [coll] object by default complies with Max syntax and +behavior \, and is therefore running in a single thread (as if one +explicitly entered argument 0). This also means when reading/writing +large files \, one may experience drop in audio output due to blocking +nature of file reading and writing. Threaded option available in pd-l2ork +allows for these operations to run in a separate thread. Doing so will +make data available as soon as it is loaded in which case you should +rely on the third outlet which will signal a bang when the file I/O +operation has been completed. Any premature requests for data will +be ignored until a file I/O operation in particular has been completed. +Below are three examples of threaded instances. Notice how there is +no specific argument order.; +#X text 47 292 In contrast \, below is an explicitly non-threaded instance +(left) and its traditional default (implicit) example (right).; +#X obj 56 344 coll 0; +#C restore; +#X obj 121 344 coll; +#C restore; +#X obj 11 -7 cnv 15 443 30 empty \$0-pddp.cnv.header Threaded\ vs.\ Non-Threaded\ Implementation +17 16 0 16 -204280 -1 0; +#X restore 342 142 pd threaded instance; +#X text 330 124 threaded implementation:; +#X text 309 76 swap \, sort \, renumber \, separate:; +#X text 6 1061 Please note this also means one cannot use filename +that is a float number as they will be interpreted as the threaded +flag with all values less than 0.999... being truncated to 0 and all +values of 1 or greater being truncated to 1, f 87; +#X text 216 794 - outputs data at requested index; +#X text 216 839 - when finishing load or save operation; +#X text 216 862 - when finished with a dump operation; +#X connect 9 0 12 0; +#X connect 9 1 14 0; +#X connect 9 2 15 0; +#X connect 9 3 16 0; +#X connect 10 0 25 0; +#X connect 11 0 9 0; +#X connect 13 0 9 0; +#X connect 17 0 9 0; +#X connect 18 0 9 0; +#X connect 19 0 9 0; +#X connect 20 0 9 0; +#X connect 25 0 9 0; +#X connect 30 0 9 0; +#X connect 33 0 9 0; +#X connect 34 0 9 0; +#X connect 38 0 9 0; +#X connect 40 0 9 0; +#X connect 42 0 9 0; +#X connect 44 0 9 0; +#X connect 46 0 9 0; +#X connect 48 0 9 0; +#X connect 50 0 9 0; +#X connect 51 0 9 0; +#X connect 53 0 9 0; +#X connect 55 0 9 0; +#X connect 59 0 9 0; +#X connect 60 0 9 0; diff --git a/externals/miXed/doc/help/cyclone/coll.txt b/externals/miXed/doc/help/cyclone/coll.txt new file mode 100644 index 000000000..5c0c9e7de --- /dev/null +++ b/externals/miXed/doc/help/cyclone/coll.txt @@ -0,0 +1,14 @@ + + +max, min don't work ... I suppose [1 2 ( stores 2 as a symbol not number + +I don't understand refer ... is it like read ??? ahem and it segfaults ... +update: can't reproduce the crash - seems to work fine now ... + +renumber does really strange things, loses elements ... hmmmm + + + + + + diff --git a/externals/miXed/doc/help/cyclone/comb~-help.pd b/externals/miXed/doc/help/cyclone/comb~-help.pd new file mode 100644 index 000000000..494ae94b6 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/comb~-help.pd @@ -0,0 +1,182 @@ +#N canvas 422 47 553 573 10; +#X obj -2 729 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 379 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 554 277 413 321 META 0; +#X text 33 231 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 33 31 LICENSE SIBSD; +#X text 33 211 AUTHOR Miller Puckette; +#X text 33 251 RELEASE_DATE 1997; +#X text 33 191 LIBRARY cyclone; +#X text 33 171 OUTLET_0 signal; +#X text 33 11 KEYWORDS signal comb filter buffer delay; +#X text 33 51 DESCRIPTION comb filter; +#X text 33 71 INLET_0 signal list message; +#X text 33 91 INLET_0 float signal; +#X text 33 111 INLET_0 float signal; +#X text 33 131 INLET_0 float signal; +#X text 33 151 INLET_0 float signal; +#X text 33 271 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 498 731 pd META; +#X obj 0 574 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 611 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 312 488 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 9 30 buffir~; +#X restore 204 731 pd Related_objects; +#X obj 78 389 cnv 17 3 55 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 456 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header comb~ 3 12 0 18 +-204280 -1 0; +#X text 11 23 comb filter; +#X floatatom 154 314 0 0 100 0 - - -; +#N canvas 159 26 532 285 output 0; +#X obj 338 160 t b; +#X obj 338 110 f; +#X obj 338 60 inlet; +#X text 344 29 mute; +#X obj 338 185 f; +#X msg 426 180 0; +#X msg 338 85 bang; +#X obj 338 135 moses 1; +#X obj 397 110 moses 1; +#X obj 83 148 dbtorms; +#X obj 397 85 r master-lvl; +#X obj 83 42 r master-lvl; +#X obj 338 210 s master-lvl; +#X obj 20 155 inlet~; +#X obj 199 41 inlet; +#X text 199 18 level; +#X obj 199 105 s master-lvl; +#X msg 96 65 set \$1; +#X obj 96 90 outlet; +#X msg 214 65 \; pd dsp 1; +#X obj 83 198 line~; +#X obj 20 207 *~; +#X obj 20 232 dac~; +#X obj 83 173 pack 0 50; +#X text 20 132 audio; +#X text 96 114 show level; +#X obj 426 155 t b; +#X obj 20 181 hip~ 1; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 12 0; +#X connect 5 0 12 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 26 0; +#X connect 8 1 4 1; +#X connect 9 0 23 0; +#X connect 10 0 1 1; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 17 0; +#X connect 13 0 27 0; +#X connect 14 0 16 0; +#X connect 14 0 19 0; +#X connect 17 0 18 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 21 0 22 1; +#X connect 23 0 20 0; +#X connect 26 0 5 0; +#X connect 27 0 21 0; +#X restore 129 338 pd output; +#X msg 180 314 MUTE; +#X obj 129 67 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X text 158 66 generate short noisebursts; +#N canvas 0 0 290 283 burst 0; +#X obj 48 173 noise~; +#X obj 95 172 line~; +#X obj 79 203 *~; +#X obj 95 73 metro 300; +#X msg 43 132 0 20; +#X msg 95 112 1 10; +#X obj 44 112 del 20; +#X obj 95 43 inlet; +#X obj 79 236 outlet~; +#X connect 0 0 2 0; +#X connect 1 0 2 1; +#X connect 2 0 8 0; +#X connect 3 0 5 0; +#X connect 3 0 6 0; +#X connect 4 0 1 0; +#X connect 5 0 1 0; +#X connect 6 0 4 0; +#X connect 7 0 3 0; +#X restore 129 95 pd burst; +#X floatatom 165 156 5 0 0 0 - - -; +#X floatatom 202 181 5 0 0 0 - - -; +#X floatatom 239 204 5 0 0 0 - - -; +#X floatatom 276 229 5 0 0 0 - - -; +#X msg 10 204 clear; +#X text 8 183 clear buffer; +#X msg 58 137 10 0.4 0.7; +#X text 202 156 D = delay time; +#X text 63 118 D a b; +#X obj 129 254 comb~ 100 0.2 0.2 0.3 0.9; +#X text 111 387 signal; +#X text 223 387 - signal to pass through comb filter; +#X text 223 408 - can set arguments for filter (D \, a \, b \, c); +#X obj 78 485 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj 78 540 cnv 17 3 17 empty \$0-pddp.cnv.let.0 4 5 9 0 16 -228856 +-162280 0; +#X obj 78 582 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 111 456 float or signal; +#X text 223 456 - D = delay time; +#X text 237 180 a = input (pre delay) amplitude coefficient; +#X text 223 485 - a = input (pre delay) amplitude coefficient; +#X text 278 204 b = input (post delay) amplitude coefficient; +#X text 223 514 - b = input (post delay) amplitude coefficient; +#X text 312 229 c = outnput amplitude coefficient; +#X text 223 540 - c = outnput amplitude coefficient; +#X text 111 514 float or signal; +#X text 111 540 float or signal; +#X text 111 485 float or signal; +#X obj 78 514 cnv 17 3 17 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X obj 78 514 cnv 17 3 17 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X text 111 581 signal; +#X text 223 581 - output from comb filter; +#X text 111 619 1) float; +#X text 223 621 - D = delay time; +#X text 223 645 - a = input (pre delay) amplitude coefficient; +#X text 223 672 - b = input (post delay) amplitude coefficient; +#X text 223 696 - c = outnput amplitude coefficient; +#X text 111 645 2) float; +#X text 111 672 3) float; +#X text 111 696 4) float; +#X obj 480 4 comb~; +#X text 163 127 D \, a \, b \, c inlets support signals as well:; +#X obj 482 49 pddp/dsp; +#X text 111 408 list; +#X text 111 428 message; +#X text 223 428 - can clear buffer; +#X obj 5 730 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 11 1; +#X connect 11 0 10 0; +#X connect 12 0 11 2; +#X connect 13 0 15 0; +#X connect 15 0 25 0; +#X connect 16 0 25 1; +#X connect 17 0 25 2; +#X connect 18 0 25 3; +#X connect 19 0 25 4; +#X connect 20 0 25 0; +#X connect 22 0 25 0; +#X connect 25 0 11 0; diff --git a/externals/miXed/doc/help/cyclone/cosh-help.pd b/externals/miXed/doc/help/cyclone/cosh-help.pd new file mode 100644 index 000000000..a28de701f --- /dev/null +++ b/externals/miXed/doc/help/cyclone/cosh-help.pd @@ -0,0 +1,73 @@ +#N canvas 381 145 552 439 10; +#X obj 0 416 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 243 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 501 272 428 289 META 0; +#X text 42 178 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 42 58 LICENSE SIBSD; +#X text 42 158 AUTHOR Miller Puckette; +#X text 42 198 RELEASE_DATE 1997; +#X text 42 138 LIBRARY cyclone; +#X text 42 98 INLET_0 float bang; +#X text 42 38 KEYWORDS cos cosine cosh hyperbolic; +#X text 42 118 OUTLET_0 float; +#X text 42 78 DESCRIPTION takes the hyperbolic cosine value of a float +; +#X text 42 218 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 502 418 pd META; +#X obj 0 308 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 345 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 266 442 428 117 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 60 33 acosh~; +#X obj 60 60 asin; +#X obj 60 85 asinh~; +#X obj 144 33 asin~; +#X obj 144 60 atan~; +#X obj 144 85 atanh~; +#X obj 245 33 cosh~; +#X obj 245 85 cosx~; +#X obj 329 33 acos~; +#X obj 245 60 acos; +#X restore 201 418 pd Related_objects; +#X obj 80 258 cnv 17 3 36 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 318 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header cosh 3 12 0 18 +-204280 -1 0; +#X text 113 258 float; +#X text 113 278 bang; +#X text 113 319 float; +#X text 95 368 1) float; +#X text 178 368 - optional initial value to compute; +#X text 11 24 calculate hyperbolic cosine function; +#X text 178 257 - number to take cosh of; +#X text 178 280 - output cosh of stored value; +#X obj 516 3 cosh; +#X floatatom 322 180 8 0 0 0 - - -; +#X msg 322 114 bang; +#X obj 322 147 cosh 0.2; +#X floatatom 161 194 8 0 0 0 - - -; +#X obj 161 137 / 100; +#X floatatom 161 112 5 0 0 0 - - -; +#X obj 161 165 cosh; +#X text 48 118 with input as float value to take cosh of; +#X text 390 117 with bang button and argument inside cosh object +; +#X text 48 59 outputs the hyperbolic cosine value of input float value. +; +#X text 178 319 - cosh of input value; +#X obj 8 417 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 19 0 20 0; +#X connect 20 0 18 0; +#X connect 22 0 24 0; +#X connect 23 0 22 0; +#X connect 24 0 21 0; diff --git a/externals/miXed/doc/help/cyclone/cosh~-help.pd b/externals/miXed/doc/help/cyclone/cosh~-help.pd new file mode 100644 index 000000000..f59566689 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/cosh~-help.pd @@ -0,0 +1,86 @@ +#N canvas 334 96 552 478 10; +#X obj 0 455 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 327 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 444 273 434 278 META 0; +#X text 32 164 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 32 44 LICENSE SIBSD; +#X text 32 144 AUTHOR Miller Puckette; +#X text 32 184 RELEASE_DATE 1997; +#X text 32 124 LIBRARY cyclone; +#X text 32 64 DESCRIPTION takes the hyperbolic cosine function for +signals; +#X text 32 84 INLET_0 signal; +#X text 32 104 OUTLET_0 signal; +#X text 32 22 KEYWORDS hyperbolic cos cosine cosh signal; +#X text 32 206 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 497 457 pd META; +#X obj 0 371 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 412 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 224 437 429 115 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 328 60 sinh~; +#X obj 328 85 tanh~; +#X obj 58 33 acosh~; +#X obj 58 60 asin; +#X obj 58 85 asinh~; +#X obj 142 33 asin~; +#X obj 142 60 atan~; +#X obj 142 85 atanh~; +#X obj 243 33 cosh~; +#X obj 243 60 cosh; +#X obj 243 85 cosx~; +#X obj 327 33 acos~; +#X restore 207 457 pd Related_objects; +#X obj 83 382 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header cosh~ 3 12 0 18 +-204280 -1 0; +#X text 117 343 signal; +#X text 117 382 signal; +#X text 117 423 (none); +#X text 16 23 Hyperbolic cosine function (cosh(x)) for signals; +#X msg 340 173 range 0 3.14159; +#X obj 267 139 -~ 1.5708; +#X obj 267 116 *~ 3.14159; +#X obj 267 94 phasor~ 2; +#X obj 266 202 Scope~ 166 85 256 3 128 0 3.14159 0 0 0 0 102 255 51 +135 135 135 0; +#X obj 266 163 cosh~; +#X obj 340 149 loadbang; +#X text 173 343 - input to cosh function; +#X obj 510 2 cosh~; +#X obj 83 343 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 39 120 +~ 2; +#X obj 40 203 Scope~ 165 83 256 3 128 1 11 0 0 0 0 102 255 51 135 135 +135 0; +#X text 72 122 be greater than 1; +#X text 71 110 input values must; +#X obj 39 91 osc~ 2; +#X obj 39 151 cosh~; +#X obj 483 48 pddp/dsp; +#X obj 135 150 loadbang; +#X msg 135 174 range 1 11; +#X text 173 382 - output of cosh function; +#X text 339 89 this is probably only useful for mathematical calculations +; +#X obj 4 456 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 16 0; +#X connect 13 0 17 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 17 0 16 0; +#X connect 18 0 12 0; +#X connect 22 0 27 0; +#X connect 26 0 22 0; +#X connect 27 0 23 0; +#X connect 29 0 30 0; +#X connect 30 0 23 0; diff --git a/externals/miXed/doc/help/cyclone/cosx~-help.pd b/externals/miXed/doc/help/cyclone/cosx~-help.pd new file mode 100644 index 000000000..b81679348 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/cosx~-help.pd @@ -0,0 +1,72 @@ +#N canvas 319 98 554 514 10; +#X obj 0 491 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 290 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 487 355 381 235 META 0; +#X text 17 148 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 17 28 LICENSE SIBSD; +#X text 17 128 AUTHOR Miller Puckette; +#X text 17 168 RELEASE_DATE 1997; +#X text 17 108 LIBRARY cyclone; +#X text 17 68 INLET_0 signal; +#X text 17 88 OUTLET_0 signal; +#X text 17 48 DESCRIPTION takes the cosine function for signals; +#X text 17 6 KEYWORDS cosine cosx signal cos; +#X text 17 190 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 493 pd META; +#X obj 0 328 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 365 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 0 409 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 211 458 425 132 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 329 67 sinx~; +#X obj 245 92 cos~; +#X obj 329 92 tanx~; +#X obj 60 40 acosh~; +#X obj 60 67 asin; +#X obj 60 92 asinh~; +#X obj 144 40 asin~; +#X obj 144 67 atan~; +#X obj 144 92 atanh~; +#X obj 245 40 cosh~; +#X obj 245 67 cosh; +#X obj 329 40 acos~; +#X restore 205 493 pd Related_objects; +#X obj 78 339 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header cosx~ 3 12 0 18 +-204280 -1 0; +#X text 111 303 signal; +#X text 111 339 signal; +#X text 111 381 (none); +#X msg 265 143 range -1 1; +#X obj 177 100 *~ 6.28319; +#X obj 177 75 phasor~ 2; +#X text 103 431 this is a real cosine function whose input expects +values between 0 and 2pi (unlike cos~ which is designed to work with +phasor~'s output from 0 to 1); +#X obj 265 118 loadbang; +#X obj 177 132 cosx~; +#X obj 177 169 Scope~ 155 90 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X text 167 303 - input to cos function; +#X text 167 339 - output of cos function; +#X obj 507 3 cosx~; +#X text 17 24 cosine function (cos(x)) for signals; +#X obj 481 47 pddp/dsp; +#X obj 78 303 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 7 492 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 18 0; +#X connect 13 0 17 0; +#X connect 14 0 13 0; +#X connect 16 0 12 0; +#X connect 17 0 18 0; diff --git a/externals/miXed/doc/help/cyclone/counter-help.pd b/externals/miXed/doc/help/cyclone/counter-help.pd new file mode 100644 index 000000000..d95a983e8 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/counter-help.pd @@ -0,0 +1,238 @@ +#N canvas 420 34 553 662 10; +#X obj -370 1146 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 +0 14 -233017 -33289 0; +#X obj -370 572 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 +13 -228856 -1 0; +#N canvas 600 344 370 331 META 0; +#X text 12 253 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 12 19 LICENSE SIBSD; +#X text 12 235 AUTHOR Miller Puckette; +#X text 12 271 RELEASE_DATE 1997; +#X text 12 217 LIBRARY cyclone; +#X text 12 145 OUTLET_0 float; +#X text 12 55 INLET_0 bang message; +#X text 12 73 INLET_1 bang float; +#X text 12 91 INLET_2 bang float; +#X text 12 109 INLET_3 bang float; +#X text 12 127 INLET_4 bang float; +#X text 12 163 OUTLET_1 float; +#X text 12 181 OUTLET_2 float; +#X text 12 199 OUTLET_3 float; +#X text 12 37 DESCRIPTION count the number of bangs received; +#X text 12 1 KEYWORDS count bangs counter; +#X text 12 289 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 133 1148 pd META; +#X obj -370 858 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 +0 13 -228856 -1 0; +#X obj -370 983 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 +12 0 13 -228856 -1 0; +#N canvas 310 565 426 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 8 28 creb/count; +#X obj 78 28 count~; +#X restore -166 1148 pd Related_objects; +#X obj -293 581 cnv 17 3 33 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -293 642 cnv 17 3 33 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -370 1 cnv 15 552 40 empty \$0-pddp.cnv.header counter 3 12 +0 18 -204280 -1 0; +#X text -321 23 count the number of bangs received; +#X obj -303 80 metro 300; +#X obj -303 57 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom -226 200 10 0 0 0 - - -; +#X text -156 201 number of bangs; +#X text -194 81 change direction; +#X obj -212 83 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text -340 54 start; +#X obj -198 107 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 +-1 -1; +#X text -177 105 reset to minimum \, wait for next bang before output +; +#X obj -184 133 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 +-1 -1; +#X text -164 130 reset and output imediately; +#X floatatom -252 57 5 0 0 0 - - -; +#X obj -170 155 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 +-1 -1; +#X obj -226 174 counter; +#X floatatom -195 243 5 0 0 0 - - -; +#X floatatom -195 500 10 0 0 0 - - -; +#X msg -181 271 0; +#X msg -171 290 1; +#X msg -162 309 2; +#X text -148 269 counter direction; +#X text -125 281 0 = up; +#X text -125 293 1 = down; +#X text -125 305 2 = up and down; +#X floatatom -148 345 5 0 0 0 - - -; +#X floatatom -138 363 5 0 0 0 - - -; +#X floatatom -128 381 5 0 0 0 - - -; +#X text -93 379 set max; +#X text -102 361 set counter value; +#X msg -323 328 up; +#X msg -302 349 down; +#X msg -282 369 updown; +#X text -343 308 direction:; +#X msg -225 296 inc; +#X msg -256 296 dec; +#X text -328 268 inc/decrement doesn't; +#X text -324 279 care about direction; +#X msg -63 242 next; +#X text -159 242 number = bang =; +#X text -112 341 set min **; +#X obj -195 473 counter; +#X obj -293 715 cnv 17 3 33 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj -293 763 cnv 17 3 33 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X obj -293 809 cnv 17 3 33 empty \$0-pddp.cnv.let.0 4 5 9 0 16 -228856 +-162280 0; +#X text -273 580 bang; +#X text -193 580 - main bang input \, where counter is collected; +#X text -273 640 bang; +#X text -271 714 bang; +#X text -271 760 bang; +#X text -272 806 bang; +#X text -193 636 - change counter direction; +#X text -274 658 float; +#X text -166 670 0 = up; +#X text -166 682 1 = down; +#X text -166 694 2 = up and down; +#X text -193 658 - counter direction; +#X text -193 713 - reset to minimum \, wait for next bang before output +; +#X text -272 732 float; +#X text -193 731 - set min; +#X text -193 757 - reset and output immediately; +#X text -272 781 float; +#X text -193 777 - set counter value; +#X text -193 805 - reset to maximum \, wait for next bang before output +; +#X text -272 827 float; +#X text -193 827 - set maximum value; +#X text -272 598 message; +#X text -193 599 - "up" \, down" \, "updown" \, change direction. "inc" +and "dec" increment or decrement counter; +#X obj -293 874 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -293 898 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -293 922 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj -293 948 cnv 17 3 17 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X text -272 923 float; +#X text -272 949 float; +#X text -193 872 - current value of counter; +#X text -193 899 - reached min when counting down; +#X text -193 922 - reached max when counting up; +#X text -193 947 - count of overflows; +#X text -272 874 float; +#X text -272 899 float; +#X obj 114 5 counter; +#N canvas 805 142 733 288 outputs 0; +#X obj 49 82 metro 100; +#X obj 49 57 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 49 227 5 0 0 0 - - -; +#X text 88 228 count; +#X floatatom 80 198 5 0 0 0 - - -; +#X floatatom 111 169 5 0 0 0 - - -; +#X obj 49 108 counter 2 0 10; +#X text 155 171 we reached max when counting up; +#X text 129 200 we reached min when counting down; +#X floatatom 142 137 5 0 0 0 - - -; +#X text 187 139 count of overflows; +#X obj 468 156 metro 100; +#X obj 468 73 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 468 183 counter 2 0 10; +#X msg 412 104 carrybang; +#X obj 499 230 print down; +#X obj 530 207 print up; +#X msg 436 126 carryint; +#X text 506 127 default (0/1); +#X text 485 104 bang when up/down overflow; +#X text 144 17 ok \, wondering what so many outputs are for ? here +we go!; +#X text 145 30 please also test the carrybang vs carryint \, to the +right; +#X text 144 43 the subtile difference is 2 state changes (int) vs one +bang; +#X connect 0 0 6 0; +#X connect 1 0 0 0; +#X connect 6 0 2 0; +#X connect 6 1 4 0; +#X connect 6 2 5 0; +#X connect 6 3 9 0; +#X connect 11 0 13 0; +#X connect 12 0 11 0; +#X connect 13 1 15 0; +#X connect 13 2 16 0; +#X connect 14 0 13 0; +#X connect 17 0 13 0; +#X restore -2 478 pd outputs; +#X text -290 998 arguments are specified as follows:; +#X text -153 1028 one arg = initial maximum; +#X text -153 1049 two args = initial min/max; +#X text -153 1072 three = direction (0 \, 1 \, 2) min/max; +#X obj -286 1027 counter 100; +#X obj -286 1049 counter 50 100; +#X obj -287 1072 counter 0 50 100; +#N canvas 942 269 459 305 additional 0; +#X obj 268 230 counter; +#X msg 214 115 set \$1; +#X floatatom 214 96 5 0 0 0 - - -; +#X msg 268 116 jam \$1; +#X floatatom 268 97 5 0 0 0 - - -; +#X text 159 78 set counter to nr. and output; +#X text 308 95 immediately; +#X text 124 95 at next bang; +#X msg 129 114 goto \$1; +#X text 190 116 =; +#X msg 108 191 min \$1; +#X msg 156 190 max \$1; +#X floatatom 108 170 5 0 0 0 - - -; +#X floatatom 156 169 5 0 0 0 - - -; +#X text 105 152 set min/max; +#X text 108 35 additional ways to accomplish the same:; +#X connect 1 0 0 0; +#X connect 2 0 1 0; +#X connect 3 0 0 0; +#X connect 4 0 3 0; +#X connect 8 0 0 0; +#X connect 10 0 0 0; +#X connect 11 0 0 0; +#X connect 12 0 10 0; +#X connect 13 0 11 0; +#X restore -2 512 pd additional ways; +#X text -149 152 reset to max \, wait for next bang before output; +#X obj -368 1146 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage +Guide; +#X connect 10 0 23 0; +#X connect 11 0 10 0; +#X connect 15 0 23 1; +#X connect 17 0 23 2; +#X connect 19 0 23 3; +#X connect 21 0 10 1; +#X connect 22 0 23 4; +#X connect 23 0 12 0; +#X connect 24 0 49 0; +#X connect 26 0 49 1; +#X connect 27 0 49 1; +#X connect 28 0 49 1; +#X connect 33 0 49 2; +#X connect 34 0 49 3; +#X connect 35 0 49 4; +#X connect 38 0 49 0; +#X connect 39 0 49 0; +#X connect 40 0 49 0; +#X connect 42 0 49 0; +#X connect 43 0 49 0; +#X connect 49 0 25 0; diff --git a/externals/miXed/doc/help/cyclone/count~-help.pd b/externals/miXed/doc/help/cyclone/count~-help.pd new file mode 100644 index 000000000..0288c8590 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/count~-help.pd @@ -0,0 +1,110 @@ +#N canvas 421 35 553 668 10; +#X obj 2 767 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 4 498 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 557 431 410 251 META 0; +#X text 39 158 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 39 32 LICENSE SIBSD; +#X text 39 140 AUTHOR Miller Puckette; +#X text 39 176 RELEASE_DATE 1997; +#X text 39 122 LIBRARY cyclone; +#X text 39 14 KEYWORDS signal count dsp; +#X text 39 50 DESCRIPTION sample counter for dsp; +#X text 39 104 OUTLET_0 float; +#X text 39 68 INLET_0 bang stop float autoreset; +#X text 39 86 INLET_1 float; +#X text 39 194 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 502 769 pd META; +#X obj 2 627 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 2 664 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 308 573 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 9 31 count; +#X obj 50 31 counter; +#X obj 121 31 phasor~; +#X restore 204 769 pd Related_objects; +#X obj 82 507 cnv 17 3 73 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 82 596 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 2 0 cnv 15 552 40 empty \$0-pddp.cnv.header count~ 3 12 0 18 +-204280 -1 0; +#X text 14 23 sample counter for dsp; +#X obj 127 377 count~; +#X msg 103 93 stop; +#X msg 78 64 bang; +#X text 111 62 start counting; +#X text 136 91 stop \, you guessed it; +#X obj 177 444 snapshot~; +#X obj 177 415 metro 20; +#X obj 177 395 tgl 15 0 empty start empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 177 468 15 0 0 0 - - -; +#X text 272 467 samples counted; +#X floatatom 170 277 5 0 0 0 - - -; +#X floatatom 160 250 5 0 0 0 - - -; +#X text 206 276 set a max value \, counter restarts at min; +#X obj 127 128 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 127 166 autoreset \$1; +#X text 144 125 reset counter to min if dsp is turned off and on again +; +#X msg 145 218 set \$1; +#X floatatom 145 197 5 0 0 0 - - -; +#X text 197 244 set a min value (immediately); +#X msg 448 218 min \$1; +#X floatatom 448 197 5 0 0 0 - - -; +#X msg 187 347 10 100000 1 1; +#X msg 187 325 min max on/off? autoreset?; +#X obj 365 418 count~ 10 10000 0 1; +#X text 302 399 args mean : min max on/off? autoreset?; +#X text 112 506 bang; +#X text 180 506 - start counting; +#X text 112 526 stop; +#X text 180 526 - stop the counter; +#X text 112 545 float; +#X text 180 545 - set a minimum value; +#X obj 82 636 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 112 596 float; +#X text 180 596 - set a maximum value; +#X text 112 565 autoreset; +#X text 180 565 - reset counter to min if dsp is turned off and on +again; +#X text 112 636 float; +#X text 180 635 - the current count; +#X text 94 672 1) float; +#X text 94 689 2) float; +#X text 180 688 - te maximum value; +#X text 94 706 3) float; +#X text 180 705 - 0 or 1 for counter on/off; +#X text 180 673 - the minimum value; +#X text 94 721 4) float; +#X text 180 721 - 0 or 1 \, autoreset counter if dsp goes off and back +on; +#X obj 506 2 count~; +#X obj 481 51 pddp/dsp; +#X text 189 217 set a min value for the next loop. same as; +#X text 181 307 you can also use a list like:; +#X obj 6 767 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 15 0; +#X connect 11 0 10 0; +#X connect 12 0 10 0; +#X connect 15 0 18 0; +#X connect 16 0 15 0; +#X connect 17 0 16 0; +#X connect 20 0 10 1; +#X connect 21 0 10 0; +#X connect 23 0 24 0; +#X connect 24 0 10 0; +#X connect 26 0 10 0; +#X connect 27 0 26 0; +#X connect 30 0 29 0; +#X connect 31 0 10 0; diff --git a/externals/miXed/doc/help/cyclone/curve~-help.pd b/externals/miXed/doc/help/cyclone/curve~-help.pd new file mode 100644 index 000000000..cb9b33161 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/curve~-help.pd @@ -0,0 +1,836 @@ +#N canvas 584 23 573 754 10; +#X obj 8 714 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#X obj 8 387 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#N canvas 613 452 348 203 META 0; +#X text 0 18 LICENSE SIBSD; +#X text 0 90 LIBRARY cyclone; +#X text 0 0 KEYWORDS signal ramp generator exponential; +#X text 0 36 DESCRIPTION exponential ramp generator; +#X text 0 54 INLET_0 list; +#X text 0 72 OUTLET_0 signal; +#X text 0 110 VERSION 0.2-beta1; +#X text 0 128 AUTHOR Krzysztof Czaja; +#X text 1 146 RELEASE_DATE 2002; +#X text 2 165 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 2 197 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X restore 509 716 pd META; +#X obj 6 593 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 8 649 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#N canvas 305 549 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 34 36 line~; +#X obj 80 36 vline~; +#X restore 211 716 pd Related_objects; +#X obj 97 602 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 8 35 cnv 15 552 40 empty empty curve~ 3 12 0 18 -204280 -1 0 +; +#X text 127 601 signal; +#X text 123 658 1) float; +#X text 123 677 2) float; +#X obj 508 38 curve~; +#X obj 97 397 cnv 17 3 130 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 97 534 cnv 17 3 23 empty empty 1 5 9 0 16 -228856 -162280 0 +; +#X text 127 532 float; +#X obj 97 560 cnv 17 3 17 empty empty 2 5 9 0 16 -228856 -162280 0 +; +#X text 127 561 float; +#X obj 304 228 bng 35 250 50 0 empty empty empty 17 7 0 10 -228856 +-1 -1; +#X text 187 659 - set initial value (default 0); +#X obj 97 625 cnv 17 3 17 empty empty 1 5 9 0 16 -228856 -162280 0 +; +#X text 127 624 bang; +#X text 117 462 messages:; +#X obj 70 208 osc~ 440; +#X obj 70 261 *~; +#X obj 61 295 dac~; +#X text 132 400 list:; +#X text 130 430 float:; +#X text 187 624 - a bang is sent when final target is reached; +#X text 125 303 0; +#X text 127 252 1; +#X text 119 356 -1; +#X text 75 95 [curve~] produces a curved ramps signal that reaches +a target value over a specified time (in ms). It takes triples of values +(destination \, time \, curve factor). Below \, when receiving 2 triples +\, [curve~] generates a simple Attack-Release envelope.; +#X text 349 238 <= Bangs when finished; +#X text 187 601 - current value or a ramp towards the target; +#X text 21 58 Curved (non linear) ramp generator; +#X obj 143 222 cyclone/curve~; +#X text 187 461 - <factor "float">: adjusts curve's expenential factor +\; - <pause>: pauses the output \; - <resume>: restores the output +after being paused \; - <stop>: stops and clears pending target-time +parameter triples (but continues outputting its last value).; +#X text 187 679 - curve factor from -1 to 1 (defalut 0 - linear).; +#X msg 143 192 1 150 -0.5 0 550 -0.5; +#N canvas 69 50 783 578 curve_factor_examples 0; +#X floatatom 168 182 0 0 0 0 - - -; +#X obj 16 12 cnv 15 750 20 empty empty empty 3 12 0 14 -204280 -1 0 +; +#X obj 171 160 hsl 128 15 -1 1 0 0 empty empty empty -2 -8 0 10 -228856 +-1 -1 0 1; +#X obj 123 170 tgl 25 0 empty empty empty 17 7 0 10 -228856 -1 -1 0 +1; +#X msg 123 243 \$1 1000 \$2; +#X obj 123 281 curve~; +#X obj 123 328 cyclone/Scope~ 149 107 256 3 128 0 1 0 0 0 0 205 229 +232 74 79 77 96 98 102 0; +#X text 108 427 0; +#X text 110 322 1; +#X text 199 160 curve factor; +#X obj 123 212 pack f f; +#X text 40 64 Try different curve factor values (from -1 to 1). The +closer to 0 the curve parameter is \, the closer the curve is to a +straight line \, and the farther away the parameter is from 0 \, the +steeper the curve.; +#X text 28 14 Different exponential factor parameters for [curve~] +; +#X text 53 471 The object's approximation of the exponential becomes +better when the vector size is smaller \, but the object also becomes +more computationally expensive.; +#X obj 504 300 cyclone/curve~; +#X msg 537 203 1 \, 0.5 50 -0.5 0 50 0.5; +#X msg 519 148 1 \, 0.5 50 0.5 0 50 -0.5; +#X msg 509 128 0 \, 0.5 50 0.5 1 50 -0.5; +#X obj 504 242 route float; +#X obj 567 264 trigger l b; +#X msg 487 77 0 \, 0.5 50 -0.75 1 50 0.75; +#X msg 530 183 0 \, 0.5 50 -0.5 1 50 0.5; +#X msg 498 96 1 \, 0.5 50 -0.75 0 50 0.75; +#X obj 510 396 cnv 15 198 138 empty empty empty 20 12 0 14 -233017 +-66577 0; +#N canvas 1 52 450 300 (subpatch) 0; +#X array \$0-curve 4410 float 1; +#A 0 0 0.00153764 0.00307055 0.00459876 0.00612227 0.0076411 0.00915527 +0.0106648 0.0121697 0.0136699 0.0151656 0.0166566 0.0181431 0.019625 +0.0211024 0.0225752 0.0240435 0.0255072 0.0269665 0.0284213 0.0298717 +0.0313175 0.032759 0.034196 0.0356286 0.0370568 0.0384806 0.0399 0.0413151 +0.0427258 0.0441322 0.0455343 0.0469321 0.0483255 0.0497147 0.0510996 +0.0524803 0.0538567 0.0552289 0.0565969 0.0579607 0.0593203 0.0606757 +0.062027 0.0633741 0.0647171 0.0660559 0.0673906 0.0687213 0.0700478 +0.0713703 0.0726887 0.074003 0.0753133 0.0766196 0.0779219 0.0792202 +0.0805145 0.0818048 0.0830911 0.0843735 0.085652 0.0869265 0.0881971 +0.0894639 0.0907267 0.0919856 0.0932407 0.0944919 0.0957393 0.0969829 +0.0982226 0.0994585 0.100691 0.101919 0.103144 0.104364 0.105581 0.106795 +0.108004 0.10921 0.110412 0.111611 0.112806 0.113997 0.115184 0.116368 +0.117548 0.118725 0.119898 0.121067 0.122233 0.123395 0.124554 0.125709 +0.12686 0.128008 0.129152 0.130293 0.131431 0.132565 0.133695 0.134822 +0.135945 0.137066 0.138182 0.139295 0.140405 0.141511 0.142614 0.143714 +0.14481 0.145903 0.146992 0.148078 0.149161 0.150241 0.151317 0.15239 +0.153459 0.154525 0.155588 0.156648 0.157705 0.158758 0.159808 0.160854 +0.161898 0.162938 0.163975 0.165009 0.16604 0.167068 0.168092 0.169113 +0.170132 0.171147 0.172159 0.173167 0.174173 0.175176 0.176175 0.177172 +0.178165 0.179155 0.180143 0.181127 0.182108 0.183086 0.184062 0.185034 +0.186003 0.186969 0.187933 0.188893 0.189851 0.190805 0.191757 0.192705 +0.193651 0.194594 0.195533 0.19647 0.197405 0.198336 0.199264 0.20019 +0.201112 0.202032 0.202949 0.203864 0.204775 0.205684 0.206589 0.207492 +0.208393 0.20929 0.210185 0.211077 0.211966 0.212853 0.213737 0.214618 +0.215496 0.216372 0.217245 0.218115 0.218983 0.219848 0.22071 0.22157 +0.222427 0.223281 0.224133 0.224982 0.225828 0.226672 0.227514 0.228352 +0.229189 0.230022 0.230853 0.231682 0.232508 0.233331 0.234152 0.23497 +0.235786 0.2366 0.237411 0.238219 0.239025 0.239828 0.240629 0.241428 +0.242224 0.243017 0.243808 0.244597 0.245383 0.246167 0.246949 0.247728 +0.248504 0.249279 0.250051 0.25082 0.251587 0.252352 0.253115 0.253875 +0.254632 0.255388 0.256141 0.256892 0.25764 0.258387 0.259131 0.259872 +0.260612 0.261349 0.262084 0.262816 0.263546 0.264274 0.265 0.265724 +0.266445 0.267164 0.267881 0.268596 0.269309 0.270019 0.270727 0.271433 +0.272137 0.272839 0.273538 0.274236 0.274931 0.275624 0.276315 0.277004 +0.277691 0.278375 0.279058 0.279738 0.280417 0.281093 0.281767 0.282439 +0.283109 0.283777 0.284443 0.285107 0.285769 0.286429 0.287087 0.287742 +0.288396 0.289048 0.289698 0.290345 0.290991 0.291635 0.292277 0.292916 +0.293554 0.29419 0.294824 0.295456 0.296086 0.296714 0.29734 0.297965 +0.298587 0.299208 0.299826 0.300443 0.301057 0.30167 0.302281 0.30289 +0.303498 0.304103 0.304706 0.305308 0.305908 0.306506 0.307102 0.307696 +0.308289 0.308879 0.309468 0.310055 0.31064 0.311224 0.311805 0.312385 +0.312963 0.31354 0.314114 0.314687 0.315258 0.315827 0.316395 0.31696 +0.317524 0.318087 0.318647 0.319206 0.319763 0.320318 0.320872 0.321424 +0.321974 0.322523 0.32307 0.323615 0.324159 0.324701 0.325241 0.325779 +0.326316 0.326852 0.327385 0.327917 0.328447 0.328976 0.329503 0.330029 +0.330553 0.331075 0.331595 0.332115 0.332632 0.333148 0.333662 0.334175 +0.334686 0.335195 0.335703 0.33621 0.336715 0.337218 0.33772 0.33822 +0.338719 0.339216 0.339712 0.340206 0.340698 0.341189 0.341679 0.342167 +0.342654 0.343139 0.343622 0.344104 0.344585 0.345064 0.345542 0.346018 +0.346493 0.346966 0.347438 0.347908 0.348377 0.348845 0.349311 0.349775 +0.350239 0.3507 0.351161 0.35162 0.352077 0.352533 0.352988 0.353441 +0.353893 0.354344 0.354793 0.355241 0.355687 0.356132 0.356576 0.357018 +0.357459 0.357899 0.358337 0.358774 0.35921 0.359644 0.360077 0.360508 +0.360938 0.361367 0.361795 0.362221 0.362646 0.36307 0.363492 0.363913 +0.364333 0.364751 0.365169 0.365585 0.365999 0.366413 0.366825 0.367236 +0.367645 0.368053 0.36846 0.368866 0.369271 0.369674 0.370076 0.370477 +0.370877 0.371275 0.371672 0.372068 0.372463 0.372856 0.373249 0.37364 +0.37403 0.374418 0.374806 0.375192 0.375577 0.375961 0.376344 0.376726 +0.377106 0.377485 0.377863 0.37824 0.378616 0.378991 0.379364 0.379736 +0.380108 0.380478 0.380846 0.381214 0.381581 0.381946 0.382311 0.382674 +0.383036 0.383397 0.383757 0.384116 0.384474 0.38483 0.385186 0.38554 +0.385893 0.386246 0.386597 0.386947 0.387296 0.387644 0.387991 0.388337 +0.388681 0.389025 0.389368 0.389709 0.39005 0.390389 0.390728 0.391065 +0.391402 0.391737 0.392071 0.392404 0.392737 0.393068 0.393398 0.393727 +0.394056 0.394383 0.394709 0.395034 0.395358 0.395681 0.396004 0.396325 +0.396645 0.396964 0.397282 0.3976 0.397916 0.398231 0.398546 0.398859 +0.399172 0.399483 0.399793 0.400103 0.400412 0.400719 0.401026 0.401332 +0.401637 0.40194 0.402243 0.402545 0.402847 0.403147 0.403446 0.403744 +0.404042 0.404338 0.404634 0.404929 0.405222 0.405515 0.405807 0.406098 +0.406388 0.406678 0.406966 0.407254 0.40754 0.407826 0.408111 0.408395 +0.408678 0.40896 0.409242 0.409522 0.409802 0.410081 0.410359 0.410636 +0.410912 0.411187 0.411462 0.411736 0.412009 0.412281 0.412552 0.412822 +0.413092 0.41336 0.413628 0.413895 0.414162 0.414427 0.414692 0.414955 +0.415218 0.415481 0.415742 0.416003 0.416262 0.416521 0.416779 0.417037 +0.417293 0.417549 0.417804 0.418058 0.418312 0.418565 0.418816 0.419068 +0.419318 0.419567 0.419816 0.420064 0.420312 0.420558 0.420804 0.421049 +0.421293 0.421537 0.421779 0.422022 0.422263 0.422503 0.422743 0.422982 +0.42322 0.423458 0.423695 0.423931 0.424166 0.424401 0.424635 0.424868 +0.425101 0.425333 0.425564 0.425794 0.426024 0.426253 0.426481 0.426709 +0.426936 0.427162 0.427387 0.427612 0.427836 0.42806 0.428282 0.428504 +0.428726 0.428946 0.429166 0.429386 0.429604 0.429822 0.43004 0.430256 +0.430472 0.430688 0.430902 0.431116 0.43133 0.431542 0.431754 0.431966 +0.432176 0.432386 0.432596 0.432805 0.433013 0.43322 0.433427 0.433634 +0.433839 0.434044 0.434248 0.434452 0.434655 0.434858 0.43506 0.435261 +0.435461 0.435661 0.435861 0.43606 0.436258 0.436455 0.436652 0.436848 +0.437044 0.437239 0.437434 0.437628 0.437821 0.438014 0.438206 0.438398 +0.438589 0.438779 0.438969 0.439158 0.439347 0.439535 0.439722 0.439909 +0.440095 0.440281 0.440466 0.440651 0.440835 0.441018 0.441201 0.441384 +0.441565 0.441747 0.441927 0.442108 0.442287 0.442466 0.442645 0.442823 +0.443 0.443177 0.443353 0.443529 0.443704 0.443879 0.444053 0.444226 +0.444399 0.444572 0.444744 0.444915 0.445086 0.445257 0.445427 0.445596 +0.445765 0.445933 0.446101 0.446268 0.446435 0.446602 0.446767 0.446933 +0.447097 0.447262 0.447425 0.447589 0.447751 0.447914 0.448075 0.448236 +0.448397 0.448557 0.448717 0.448877 0.449035 0.449194 0.449351 0.449509 +0.449666 0.449822 0.449978 0.450133 0.450288 0.450443 0.450597 0.45075 +0.450903 0.451056 0.451208 0.451359 0.45151 0.451661 0.451811 0.451961 +0.45211 0.452259 0.452408 0.452556 0.452703 0.45285 0.452997 0.453143 +0.453289 0.453434 0.453579 0.453723 0.453867 0.45401 0.454153 0.454296 +0.454438 0.45458 0.454721 0.454862 0.455002 0.455142 0.455282 0.455421 +0.455559 0.455698 0.455836 0.455973 0.45611 0.456246 0.456383 0.456518 +0.456654 0.456789 0.456923 0.457057 0.457191 0.457324 0.457457 0.457589 +0.457721 0.457853 0.457984 0.458115 0.458245 0.458375 0.458505 0.458634 +0.458763 0.458891 0.459019 0.459147 0.459274 0.459401 0.459527 0.459654 +0.459779 0.459904 0.460029 0.460154 0.460278 0.460402 0.460525 0.460648 +0.460771 0.460893 0.461015 0.461136 0.461258 0.461378 0.461499 0.461619 +0.461738 0.461858 0.461977 0.462095 0.462213 0.462331 0.462449 0.462566 +0.462682 0.462799 0.462915 0.46303 0.463146 0.463261 0.463375 0.463489 +0.463603 0.463717 0.46383 0.463943 0.464055 0.464168 0.464279 0.464391 +0.464502 0.464613 0.464723 0.464833 0.464943 0.465053 0.465162 0.46527 +0.465379 0.465487 0.465595 0.465702 0.465809 0.465916 0.466022 0.466128 +0.466234 0.46634 0.466445 0.46655 0.466654 0.466758 0.466862 0.466966 +0.467069 0.467172 0.467274 0.467377 0.467479 0.46758 0.467682 0.467783 +0.467883 0.467984 0.468084 0.468184 0.468283 0.468382 0.468481 0.46858 +0.468678 0.468776 0.468874 0.468971 0.469068 0.469165 0.469261 0.469357 +0.469453 0.469549 0.469644 0.469739 0.469834 0.469928 0.470022 0.470116 +0.47021 0.470303 0.470396 0.470489 0.470581 0.470673 0.470765 0.470856 +0.470948 0.471039 0.471129 0.47122 0.47131 0.4714 0.471489 0.471579 +0.471668 0.471757 0.471845 0.471933 0.472021 0.472109 0.472196 0.472283 +0.47237 0.472457 0.472543 0.472629 0.472715 0.472801 0.472886 0.472971 +0.473056 0.47314 0.473225 0.473309 0.473392 0.473476 0.473559 0.473642 +0.473725 0.473807 0.473889 0.473971 0.474053 0.474134 0.474216 0.474297 +0.474377 0.474458 0.474538 0.474618 0.474698 0.474777 0.474856 0.474935 +0.475014 0.475092 0.475171 0.475249 0.475326 0.475404 0.475481 0.475558 +0.475635 0.475712 0.475788 0.475864 0.47594 0.476016 0.476091 0.476166 +0.476241 0.476316 0.476391 0.476465 0.476539 0.476613 0.476686 0.47676 +0.476833 0.476906 0.476978 0.477051 0.477123 0.477195 0.477267 0.477338 +0.47741; +#A 1000 0.477481 0.477552 0.477622 0.477693 0.477763 0.477833 0.477903 +0.477973 0.478042 0.478111 0.47818 0.478249 0.478318 0.478386 0.478454 +0.478522 0.47859 0.478657 0.478725 0.478792 0.478859 0.478925 0.478992 +0.479058 0.479124 0.47919 0.479256 0.479321 0.479386 0.479451 0.479516 +0.479581 0.479645 0.47971 0.479774 0.479838 0.479901 0.479965 0.480028 +0.480091 0.480154 0.480217 0.480279 0.480341 0.480404 0.480466 0.480527 +0.480589 0.48065 0.480711 0.480772 0.480833 0.480894 0.480954 0.481015 +0.481075 0.481134 0.481194 0.481254 0.481313 0.481372 0.481431 0.48149 +0.481548 0.481607 0.481665 0.481723 0.481781 0.481839 0.481896 0.481954 +0.482011 0.482068 0.482125 0.482181 0.482238 0.482294 0.48235 0.482406 +0.482462 0.482518 0.482573 0.482628 0.482683 0.482738 0.482793 0.482848 +0.482902 0.482956 0.48301 0.483064 0.483118 0.483172 0.483225 0.483278 +0.483332 0.483385 0.483437 0.48349 0.483542 0.483595 0.483647 0.483699 +0.483751 0.483802 0.483854 0.483905 0.483956 0.484007 0.484058 0.484109 +0.484159 0.48421 0.48426 0.48431 0.48436 0.48441 0.484459 0.484509 +0.484558 0.484607 0.484656 0.484705 0.484754 0.484803 0.484851 0.484899 +0.484948 0.484995 0.485043 0.485091 0.485139 0.485186 0.485233 0.48528 +0.485327 0.485374 0.485421 0.485467 0.485514 0.48556 0.485606 0.485652 +0.485698 0.485743 0.485789 0.485834 0.48588 0.485925 0.48597 0.486015 +0.486059 0.486104 0.486148 0.486192 0.486237 0.486281 0.486325 0.486368 +0.486412 0.486455 0.486499 0.486542 0.486585 0.486628 0.486671 0.486713 +0.486756 0.486798 0.486841 0.486883 0.486925 0.486967 0.487009 0.48705 +0.487092 0.487133 0.487174 0.487216 0.487257 0.487297 0.487338 0.487379 +0.487419 0.48746 0.4875 0.48754 0.48758 0.48762 0.48766 0.4877 0.487739 +0.487778 0.487818 0.487857 0.487896 0.487935 0.487974 0.488012 0.488051 +0.488089 0.488128 0.488166 0.488204 0.488242 0.48828 0.488318 0.488355 +0.488393 0.48843 0.488467 0.488505 0.488542 0.488579 0.488615 0.488652 +0.488689 0.488725 0.488762 0.488798 0.488834 0.48887 0.488906 0.488942 +0.488977 0.489013 0.489049 0.489084 0.489119 0.489154 0.489189 0.489224 +0.489259 0.489294 0.489329 0.489363 0.489397 0.489432 0.489466 0.4895 +0.489534 0.489568 0.489602 0.489635 0.489669 0.489702 0.489736 0.489769 +0.489802 0.489835 0.489868 0.489901 0.489934 0.489967 0.489999 0.490032 +0.490064 0.490096 0.490128 0.49016 0.490192 0.490224 0.490256 0.490288 +0.490319 0.490351 0.490382 0.490413 0.490445 0.490476 0.490507 0.490538 +0.490568 0.490599 0.49063 0.49066 0.490691 0.490721 0.490751 0.490781 +0.490812 0.490842 0.490871 0.490901 0.490931 0.49096 0.49099 0.491019 +0.491049 0.491078 0.491107 0.491136 0.491165 0.491194 0.491223 0.491251 +0.49128 0.491309 0.491337 0.491365 0.491394 0.491422 0.49145 0.491478 +0.491506 0.491534 0.491561 0.491589 0.491617 0.491644 0.491672 0.491699 +0.491726 0.491753 0.49178 0.491807 0.491834 0.491861 0.491888 0.491915 +0.491941 0.491968 0.491994 0.49202 0.492047 0.492073 0.492099 0.492125 +0.492151 0.492177 0.492202 0.492228 0.492254 0.492279 0.492305 0.49233 +0.492355 0.492381 0.492406 0.492431 0.492456 0.492481 0.492506 0.49253 +0.492555 0.49258 0.492604 0.492629 0.492653 0.492677 0.492702 0.492726 +0.49275 0.492774 0.492798 0.492822 0.492845 0.492869 0.492893 0.492916 +0.49294 0.492963 0.492987 0.49301 0.493033 0.493056 0.493079 0.493102 +0.493125 0.493148 0.493171 0.493194 0.493216 0.493239 0.493261 0.493284 +0.493306 0.493328 0.493351 0.493373 0.493395 0.493417 0.493439 0.493461 +0.493483 0.493504 0.493526 0.493548 0.493569 0.493591 0.493612 0.493634 +0.493655 0.493676 0.493697 0.493718 0.493739 0.49376 0.493781 0.493802 +0.493823 0.493844 0.493864 0.493885 0.493905 0.493926 0.493946 0.493967 +0.493987 0.494007 0.494027 0.494047 0.494067 0.494087 0.494107 0.494127 +0.494147 0.494167 0.494186 0.494206 0.494225 0.494245 0.494264 0.494284 +0.494303 0.494322 0.494341 0.494361 0.49438 0.494399 0.494418 0.494436 +0.494455 0.494474 0.494493 0.494511 0.49453 0.494549 0.494567 0.494585 +0.494604 0.494622 0.49464 0.494659 0.494677 0.494695 0.494713 0.494731 +0.494749 0.494767 0.494784 0.494802 0.49482 0.494838 0.494855 0.494873 +0.49489 0.494908 0.494925 0.494942 0.49496 0.494977 0.494994 0.495011 +0.495028 0.495045 0.495062 0.495079 0.495096 0.495113 0.49513 0.495146 +0.495163 0.495179 0.495196 0.495213 0.495229 0.495245 0.495262 0.495278 +0.495294 0.49531 0.495327 0.495343 0.495359 0.495375 0.495391 0.495407 +0.495422 0.495438 0.495454 0.49547 0.495485 0.495501 0.495517 0.495532 +0.495548 0.495563 0.495578 0.495594 0.495609 0.495624 0.495639 0.495654 +0.49567 0.495685 0.4957 0.495715 0.495729 0.495744 0.495759 0.495774 +0.495789 0.495803 0.495818 0.495832 0.495847 0.495862 0.495876 0.49589 +0.495905 0.495919 0.495933 0.495948 0.495962 0.495976 0.49599 0.496004 +0.496018 0.496032 0.496046 0.49606 0.496074 0.496088 0.496101 0.496115 +0.496129 0.496142 0.496156 0.496169 0.496183 0.496196 0.49621 0.496223 +0.496237 0.49625 0.496263 0.496276 0.49629 0.496303 0.496316 0.496329 +0.496342 0.496355 0.496368 0.496381 0.496394 0.496406 0.496419 0.496432 +0.496445 0.496457 0.49647 0.496482 0.496495 0.496507 0.49652 0.496532 +0.496545 0.496557 0.496569 0.496582 0.496594 0.496606 0.496618 0.49663 +0.496643 0.496655 0.496667 0.496679 0.496691 0.496702 0.496714 0.496726 +0.496738 0.49675 0.496761 0.496773 0.496785 0.496796 0.496808 0.49682 +0.496831 0.496843 0.496854 0.496865 0.496877 0.496888 0.496899 0.496911 +0.496922 0.496933 0.496944 0.496955 0.496966 0.496977 0.496989 0.497 +0.49701 0.497021 0.497032 0.497043 0.497054 0.497065 0.497075 0.497086 +0.497097 0.497108 0.497118 0.497129 0.497139 0.49715 0.49716 0.497171 +0.497181 0.497192 0.497202 0.497212 0.497223 0.497233 0.497243 0.497253 +0.497264 0.497274 0.497284 0.497294 0.497304 0.497314 0.497324 0.497334 +0.497344 0.497354 0.497364 0.497373 0.497383 0.497393 0.497403 0.497413 +0.497422 0.497432 0.497442 0.497451 0.497461 0.49747 0.49748 0.497489 +0.497499 0.497508 0.497517 0.497527 0.497536 0.497546 0.497555 0.497564 +0.497573 0.497582 0.497592 0.497601 0.49761 0.497619 0.497628 0.497637 +0.497646 0.497655 0.497664 0.497673 0.497682 0.497691 0.497699 0.497708 +0.497717 0.497726 0.497735 0.497743 0.497752 0.497761 0.497769 0.497778 +0.497786 0.497795 0.497803 0.497812 0.49782 0.497829 0.497837 0.497846 +0.497854 0.497862 0.497871 0.497879 0.497887 0.497895 0.497904 0.497912 +0.49792 0.497928 0.497936 0.497944 0.497952 0.49796 0.497968 0.497976 +0.497984 0.497992 0.498 0.498008 0.498016 0.498024 0.498031 0.498039 +0.498047 0.498055 0.498062 0.49807 0.498078 0.498085 0.498093 0.498101 +0.498108 0.498116 0.498123 0.498131 0.498138 0.498146 0.498153 0.498161 +0.498168 0.498175 0.498183 0.49819 0.498197 0.498205 0.498212 0.498219 +0.498226 0.498234 0.498241 0.498248 0.498255 0.498262 0.498269 0.498276 +0.498283 0.49829 0.498297 0.498304 0.498311 0.498318 0.498325 0.498332 +0.498339 0.498346 0.498352 0.498359 0.498366 0.498373 0.498379 0.498386 +0.498393 0.4984 0.498406 0.498413 0.49842 0.498426 0.498433 0.498439 +0.498446 0.498452 0.498459 0.498465 0.498472 0.498478 0.498485 0.498491 +0.498497 0.498504 0.49851 0.498516 0.498523 0.498529 0.498535 0.498541 +0.498548 0.498554 0.49856 0.498566 0.498572 0.498578 0.498585 0.498591 +0.498597 0.498603 0.498609 0.498615 0.498621 0.498627 0.498633 0.498639 +0.498645 0.498651 0.498656 0.498662 0.498668 0.498674 0.49868 0.498686 +0.498691 0.498697 0.498703 0.498709 0.498714 0.49872 0.498726 0.498731 +0.498737 0.498743 0.498748 0.498754 0.498759 0.498765 0.49877 0.498776 +0.498781 0.498787 0.498792 0.498798 0.498803 0.498809 0.498814 0.498819 +0.498825 0.49883 0.498836 0.498841 0.498846 0.498851 0.498857 0.498862 +0.498867 0.498872 0.498878 0.498883 0.498888 0.498893 0.498898 0.498903 +0.498908 0.498914 0.498919 0.498924 0.498929 0.498934 0.498939 0.498944 +0.498949 0.498954 0.498959 0.498964 0.498969 0.498973 0.498978 0.498983 +0.498988 0.498993 0.498998 0.499003 0.499007 0.499012 0.499017 0.499022 +0.499027 0.499031 0.499036 0.499041 0.499045 0.49905 0.499055 0.499059 +0.499064 0.499069 0.499073 0.499078 0.499082 0.499087 0.499091 0.499096 +0.499101 0.499105 0.499109 0.499114 0.499118 0.499123 0.499127 0.499132 +0.499136 0.499141 0.499145 0.499149 0.499154 0.499158 0.499162 0.499167 +0.499171 0.499175 0.499179 0.499184 0.499188 0.499192 0.499196 0.499201 +0.499205 0.499209 0.499213 0.499217 0.499222 0.499226 0.49923 0.499234 +0.499238 0.499242 0.499246 0.49925 0.499254 0.499258 0.499262 0.499266 +0.49927 0.499274 0.499278 0.499282 0.499286 0.49929 0.499294 0.499298 +0.499302 0.499306 0.49931 0.499313 0.499317 0.499321 0.499325 0.499329 +0.499333 0.499336 0.49934 0.499344 0.499348 0.499351 0.499355 0.499359 +0.499363 0.499366 0.49937 0.499374 0.499377 0.499381 0.499385 0.499388 +0.499392 0.499395 0.499399 0.499403 0.499406 0.49941 0.499413 0.499417 +0.49942 0.499424 0.499427 0.499431 0.499434 0.499438 0.499441 0.499445 +0.499448 0.499452 0.499455 0.499459 0.499462 0.499465 0.499469 0.499472 +0.499475 0.499479 0.499482 0.499485 0.499489 0.499492 0.499495 0.499499 +; +#A 2000 0.499502 0.499505 0.499509 0.499512 0.499515 0.499518 0.499521 +0.499525 0.499528 0.499531 0.499534 0.499537 0.499541 0.499544 0.499547 +0.49955 0.499553 0.499556 0.499559 0.499562 0.499566 0.499569 0.499572 +0.499575 0.499578 0.499581 0.499584 0.499587 0.49959 0.499593 0.499596 +0.499599 0.499602 0.499605 0.499608 0.499611 0.499614 0.499617 0.499619 +0.499622 0.499625 0.499628 0.499631 0.499634 0.499637 0.49964 0.499642 +0.499645 0.499648 0.499651 0.499654 0.499657 0.499659 0.499662 0.499665 +0.499668 0.49967 0.499673 0.499676 0.499679 0.499681 0.499684 0.499687 +0.49969 0.499692 0.499695 0.499698 0.4997 0.499703 0.499706 0.499708 +0.499711 0.499714 0.499716 0.499719 0.499721 0.499724 0.499727 0.499729 +0.499732 0.499734 0.499737 0.499739 0.499742 0.499744 0.499747 0.499749 +0.499752 0.499754 0.499757 0.499759 0.499762 0.499764 0.499767 0.499769 +0.499772 0.499774 0.499777 0.499779 0.499782 0.499784 0.499786 0.499789 +0.499791 0.499793 0.499796 0.499798 0.499801 0.499803 0.499805 0.499808 +0.49981 0.499812 0.499815 0.499817 0.499819 0.499822 0.499824 0.499826 +0.499828 0.499831 0.499833 0.499835 0.499837 0.49984 0.499842 0.499844 +0.499846 0.499849 0.499851 0.499853 0.499855 0.499857 0.499859 0.499862 +0.499864 0.499866 0.499868 0.49987 0.499872 0.499875 0.499877 0.499879 +0.499881 0.499883 0.499885 0.499887 0.499889 0.499891 0.499893 0.499896 +0.499898 0.4999 0.499902 0.499904 0.499906 0.499908 0.49991 0.499912 +0.499914 0.499916 0.499918 0.49992 0.499922 0.499924 0.499926 0.499928 +0.49993 0.499932 0.499934 0.499936 0.499938 0.499939 0.499941 0.499943 +0.499945 0.499947 0.499949 0.499951 0.499953 0.499955 0.499957 0.499958 +0.49996 0.499962 0.499964 0.499966 0.499968 0.49997 0.499971 0.499973 +0.499975 0.499977 0.499979 0.499981 0.499982 0.499984 0.499986 0.499988 +0.499989 0.499991 0.499993 0.499995 0.499997 0.499998 0.5 0.500002 +0.500004 0.500005 0.500007 0.500009 0.500011 0.500012 0.500014 0.500016 +0.500018 0.500019 0.500021 0.500023 0.500025 0.500027 0.500029 0.50003 +0.500032 0.500034 0.500036 0.500038 0.50004 0.500042 0.500043 0.500045 +0.500047 0.500049 0.500051 0.500053 0.500055 0.500057 0.500059 0.500061 +0.500062 0.500064 0.500066 0.500068 0.50007 0.500072 0.500074 0.500076 +0.500078 0.50008 0.500082 0.500084 0.500086 0.500088 0.50009 0.500092 +0.500094 0.500096 0.500098 0.5001 0.500102 0.500104 0.500107 0.500109 +0.500111 0.500113 0.500115 0.500117 0.500119 0.500121 0.500123 0.500125 +0.500128 0.50013 0.500132 0.500134 0.500136 0.500138 0.50014 0.500143 +0.500145 0.500147 0.500149 0.500151 0.500154 0.500156 0.500158 0.50016 +0.500163 0.500165 0.500167 0.500169 0.500172 0.500174 0.500176 0.500178 +0.500181 0.500183 0.500185 0.500188 0.50019 0.500192 0.500195 0.500197 +0.500199 0.500202 0.500204 0.500207 0.500209 0.500211 0.500214 0.500216 +0.500219 0.500221 0.500223 0.500226 0.500228 0.500231 0.500233 0.500236 +0.500238 0.500241 0.500243 0.500246 0.500248 0.500251 0.500253 0.500256 +0.500258 0.500261 0.500263 0.500266 0.500268 0.500271 0.500273 0.500276 +0.500279 0.500281 0.500284 0.500287 0.500289 0.500292 0.500294 0.500297 +0.5003 0.500302 0.500305 0.500308 0.50031 0.500313 0.500316 0.500319 +0.500321 0.500324 0.500327 0.50033 0.500332 0.500335 0.500338 0.500341 +0.500343 0.500346 0.500349 0.500352 0.500355 0.500358 0.50036 0.500363 +0.500366 0.500369 0.500372 0.500375 0.500378 0.500381 0.500383 0.500386 +0.500389 0.500392 0.500395 0.500398 0.500401 0.500404 0.500407 0.50041 +0.500413 0.500416 0.500419 0.500422 0.500425 0.500428 0.500431 0.500435 +0.500438 0.500441 0.500444 0.500447 0.50045 0.500453 0.500456 0.500459 +0.500463 0.500466 0.500469 0.500472 0.500475 0.500479 0.500482 0.500485 +0.500488 0.500491 0.500495 0.500498 0.500501 0.500505 0.500508 0.500511 +0.500515 0.500518 0.500521 0.500525 0.500528 0.500531 0.500535 0.500538 +0.500542 0.500545 0.500548 0.500552 0.500555 0.500559 0.500562 0.500566 +0.500569 0.500573 0.500576 0.50058 0.500583 0.500587 0.50059 0.500594 +0.500597 0.500601 0.500605 0.500608 0.500612 0.500615 0.500619 0.500623 +0.500626 0.50063 0.500634 0.500637 0.500641 0.500645 0.500649 0.500652 +0.500656 0.50066 0.500664 0.500667 0.500671 0.500675 0.500679 0.500683 +0.500687 0.50069 0.500694 0.500698 0.500702 0.500706 0.50071 0.500714 +0.500718 0.500722 0.500726 0.50073 0.500734 0.500738 0.500742 0.500746 +0.50075 0.500754 0.500758 0.500762 0.500766 0.50077 0.500774 0.500778 +0.500783 0.500787 0.500791 0.500795 0.500799 0.500804 0.500808 0.500812 +0.500816 0.500821 0.500825 0.500829 0.500833 0.500838 0.500842 0.500846 +0.500851 0.500855 0.500859 0.500864 0.500868 0.500873 0.500877 0.500882 +0.500886 0.50089 0.500895 0.500899 0.500904 0.500909 0.500913 0.500918 +0.500922 0.500927 0.500931 0.500936 0.500941 0.500945 0.50095 0.500955 +0.500959 0.500964 0.500969 0.500973 0.500978 0.500983 0.500988 0.500993 +0.500997 0.501002 0.501007 0.501012 0.501017 0.501022 0.501027 0.501031 +0.501036 0.501041 0.501046 0.501051 0.501056 0.501061 0.501066 0.501071 +0.501076 0.501081 0.501086 0.501091 0.501097 0.501102 0.501107 0.501112 +0.501117 0.501122 0.501128 0.501133 0.501138 0.501143 0.501149 0.501154 +0.501159 0.501164 0.50117 0.501175 0.501181 0.501186 0.501191 0.501197 +0.501202 0.501208 0.501213 0.501219 0.501224 0.50123 0.501235 0.501241 +0.501246 0.501252 0.501257 0.501263 0.501269 0.501274 0.50128 0.501286 +0.501291 0.501297 0.501303 0.501309 0.501314 0.50132 0.501326 0.501332 +0.501338 0.501344 0.501349 0.501355 0.501361 0.501367 0.501373 0.501379 +0.501385 0.501391 0.501397 0.501403 0.501409 0.501415 0.501422 0.501428 +0.501434 0.50144 0.501446 0.501452 0.501459 0.501465 0.501471 0.501477 +0.501484 0.50149 0.501496 0.501503 0.501509 0.501515 0.501522 0.501528 +0.501535 0.501541 0.501548 0.501554 0.501561 0.501567 0.501574 0.50158 +0.501587 0.501594 0.5016 0.501607 0.501614 0.50162 0.501627 0.501634 +0.501641 0.501648 0.501654 0.501661 0.501668 0.501675 0.501682 0.501689 +0.501696 0.501703 0.50171 0.501717 0.501724 0.501731 0.501738 0.501745 +0.501752 0.501759 0.501766 0.501774 0.501781 0.501788 0.501795 0.501803 +0.50181 0.501817 0.501825 0.501832 0.501839 0.501847 0.501854 0.501862 +0.501869 0.501877 0.501884 0.501892 0.501899 0.501907 0.501915 0.501922 +0.50193 0.501938 0.501945 0.501953 0.501961 0.501969 0.501976 0.501984 +0.501992 0.502 0.502008 0.502016 0.502024 0.502032 0.50204 0.502048 +0.502056 0.502064 0.502072 0.50208 0.502088 0.502096 0.502105 0.502113 +0.502121 0.502129 0.502138 0.502146 0.502154 0.502163 0.502171 0.50218 +0.502188 0.502197 0.502205 0.502214 0.502222 0.502231 0.502239 0.502248 +0.502257 0.502265 0.502274 0.502283 0.502292 0.502301 0.502309 0.502318 +0.502327 0.502336 0.502345 0.502354 0.502363 0.502372 0.502381 0.50239 +0.502399 0.502408 0.502418 0.502427 0.502436 0.502445 0.502454 0.502464 +0.502473 0.502482 0.502492 0.502501 0.502511 0.50252 0.50253 0.502539 +0.502549 0.502558 0.502568 0.502578 0.502587 0.502597 0.502607 0.502617 +0.502626 0.502636 0.502646 0.502656 0.502666 0.502676 0.502686 0.502696 +0.502706 0.502716 0.502726 0.502736 0.502747 0.502757 0.502767 0.502777 +0.502788 0.502798 0.502808 0.502819 0.502829 0.50284 0.50285 0.502861 +0.502871 0.502882 0.502892 0.502903 0.502914 0.502925 0.502935 0.502946 +0.502957 0.502968 0.502979 0.50299 0.503 0.503011 0.503022 0.503034 +0.503045 0.503056 0.503067 0.503078 0.503089 0.503101 0.503112 0.503123 +0.503135 0.503146 0.503157 0.503169 0.503181 0.503192 0.503204 0.503215 +0.503227 0.503239 0.50325 0.503262 0.503274 0.503286 0.503298 0.503309 +0.503321 0.503333 0.503345 0.503357 0.50337 0.503382 0.503394 0.503406 +0.503418 0.503431 0.503443 0.503455 0.503468 0.50348 0.503493 0.503505 +0.503518 0.50353 0.503543 0.503555 0.503568 0.503581 0.503594 0.503606 +0.503619 0.503632 0.503645 0.503658 0.503671 0.503684 0.503697 0.50371 +0.503724 0.503737 0.50375 0.503763 0.503777 0.50379 0.503804 0.503817 +0.503831 0.503844 0.503858 0.503871 0.503885 0.503899 0.503912 0.503926 +0.50394 0.503954 0.503968 0.503982 0.503996 0.50401 0.504024 0.504038 +0.504052 0.504067 0.504081 0.504095 0.50411 0.504124 0.504138 0.504153 +0.504167 0.504182 0.504197 0.504211 0.504226 0.504241 0.504256 0.504271 +0.504285 0.5043 0.504315 0.50433 0.504346 0.504361 0.504376 0.504391 +0.504406 0.504422 0.504437 0.504452 0.504468 0.504483 0.504499 0.504515 +0.50453 0.504546 0.504562 0.504578 0.504593 0.504609 0.504625 0.504641 +0.504657 0.504673 0.50469 0.504706 0.504722 0.504738 0.504755 0.504771 +0.504787 0.504804 0.504821 0.504837 0.504854 0.50487 0.504887 0.504904 +0.504921 0.504938 0.504955 0.504972 0.504989 0.505006 0.505023 0.50504 +0.505058 0.505075 0.505092 0.50511 0.505127 0.505145 0.505162 0.50518 +0.505198 0.505216 0.505233 0.505251 0.505269 0.505287 0.505305 0.505323 +0.505341 0.50536 0.505378 0.505396 0.505415 0.505433 0.505452 0.50547 +0.505489 0.505507 0.505526 0.505545 0.505564 0.505582 0.505601 0.50562 +0.505639 0.505659 0.505678 0.505697 0.505716 0.505736 0.505755 0.505775 +0.505794 0.505814 0.505833 0.505853 0.505873 0.505893 0.505913 0.505933 +0.505953; +#A 3000 0.505973 0.505993 0.506013 0.506033 0.506054 0.506074 0.506095 +0.506115 0.506136 0.506156 0.506177 0.506198 0.506219 0.50624 0.506261 +0.506282 0.506303 0.506324 0.506345 0.506366 0.506388 0.506409 0.506431 +0.506452 0.506474 0.506496 0.506517 0.506539 0.506561 0.506583 0.506605 +0.506627 0.506649 0.506671 0.506694 0.506716 0.506739 0.506761 0.506784 +0.506806 0.506829 0.506852 0.506875 0.506898 0.506921 0.506944 0.506967 +0.50699 0.507013 0.507037 0.50706 0.507084 0.507107 0.507131 0.507155 +0.507178 0.507202 0.507226 0.50725 0.507274 0.507298 0.507323 0.507347 +0.507371 0.507396 0.50742 0.507445 0.50747 0.507494 0.507519 0.507544 +0.507569 0.507594 0.507619 0.507645 0.50767 0.507695 0.507721 0.507746 +0.507772 0.507798 0.507823 0.507849 0.507875 0.507901 0.507927 0.507953 +0.50798 0.508006 0.508032 0.508059 0.508085 0.508112 0.508139 0.508166 +0.508193 0.50822 0.508247 0.508274 0.508301 0.508328 0.508356 0.508383 +0.508411 0.508439 0.508466 0.508494 0.508522 0.50855 0.508578 0.508606 +0.508635 0.508663 0.508691 0.50872 0.508748 0.508777 0.508806 0.508835 +0.508864 0.508893 0.508922 0.508951 0.508981 0.50901 0.50904 0.509069 +0.509099 0.509129 0.509158 0.509188 0.509219 0.509249 0.509279 0.509309 +0.50934 0.50937 0.509401 0.509432 0.509462 0.509493 0.509524 0.509555 +0.509587 0.509618 0.509649 0.509681 0.509712 0.509744 0.509776 0.509808 +0.509839 0.509872 0.509904 0.509936 0.509968 0.510001 0.510033 0.510066 +0.510099 0.510132 0.510165 0.510198 0.510231 0.510264 0.510297 0.510331 +0.510365 0.510398 0.510432 0.510466 0.5105 0.510534 0.510568 0.510603 +0.510637 0.510671 0.510706 0.510741 0.510776 0.510811 0.510846 0.510881 +0.510916 0.510951 0.510987 0.511023 0.511058 0.511094 0.51113 0.511166 +0.511202 0.511238 0.511275 0.511311 0.511348 0.511385 0.511422 0.511458 +0.511495 0.511533 0.51157 0.511607 0.511645 0.511682 0.51172 0.511758 +0.511796 0.511834 0.511872 0.511911 0.511949 0.511988 0.512026 0.512065 +0.512104 0.512143 0.512182 0.512222 0.512261 0.5123 0.51234 0.51238 +0.51242 0.51246 0.5125 0.51254 0.512581 0.512621 0.512662 0.512703 +0.512743 0.512784 0.512826 0.512867 0.512908 0.51295 0.512991 0.513033 +0.513075 0.513117 0.513159 0.513202 0.513244 0.513287 0.513329 0.513372 +0.513415 0.513458 0.513501 0.513545 0.513588 0.513632 0.513675 0.513719 +0.513763 0.513808 0.513852 0.513896 0.513941 0.513986 0.51403 0.514075 +0.51412 0.514166 0.514211 0.514257 0.514302 0.514348 0.514394 0.51444 +0.514486 0.514533 0.514579 0.514626 0.514673 0.51472 0.514767 0.514814 +0.514861 0.514909 0.514957 0.515005 0.515052 0.515101 0.515149 0.515197 +0.515246 0.515295 0.515343 0.515393 0.515442 0.515491 0.51554 0.51559 +0.51564 0.51569 0.51574 0.51579 0.515841 0.515891 0.515942 0.515993 +0.516044 0.516095 0.516146 0.516198 0.516249 0.516301 0.516353 0.516405 +0.516458 0.51651 0.516563 0.516616 0.516668 0.516722 0.516775 0.516828 +0.516882 0.516936 0.51699 0.517044 0.517098 0.517152 0.517207 0.517262 +0.517317 0.517372 0.517427 0.517482 0.517538 0.517594 0.51765 0.517706 +0.517762 0.517819 0.517875 0.517932 0.517989 0.518046 0.518104 0.518161 +0.518219 0.518277 0.518335 0.518393 0.518452 0.51851 0.518569 0.518628 +0.518687 0.518746 0.518806 0.518866 0.518925 0.518986 0.519046 0.519106 +0.519167 0.519228 0.519289 0.51935 0.519411 0.519473 0.519534 0.519596 +0.519659 0.519721 0.519783 0.519846 0.519909 0.519972 0.520035 0.520099 +0.520162 0.520226 0.52029 0.520355 0.520419 0.520484 0.520549 0.520614 +0.520679 0.520744 0.52081 0.520876 0.520942 0.521008 0.521075 0.521141 +0.521208 0.521275 0.521343 0.52141 0.521478 0.521546 0.521614 0.521682 +0.521751 0.52182 0.521889 0.521958 0.522027 0.522097 0.522167 0.522237 +0.522307 0.522378 0.522448 0.522519 0.52259 0.522662 0.522733 0.522805 +0.522877 0.522949 0.523022 0.523094 0.523167 0.52324 0.523314 0.523387 +0.523461 0.523535 0.523609 0.523684 0.523759 0.523834 0.523909 0.523984 +0.52406 0.524136 0.524212 0.524288 0.524365 0.524442 0.524519 0.524596 +0.524674 0.524751 0.524829 0.524908 0.524986 0.525065 0.525144 0.525223 +0.525302 0.525382 0.525462 0.525542 0.525623 0.525703 0.525784 0.525866 +0.525947 0.526029 0.526111 0.526193 0.526275 0.526358 0.526441 0.526524 +0.526608 0.526691 0.526775 0.52686 0.526944 0.527029 0.527114 0.527199 +0.527285 0.527371 0.527457 0.527543 0.52763 0.527717 0.527804 0.527891 +0.527979 0.528067 0.528155 0.528243 0.528332 0.528421 0.528511 0.5286 +0.52869 0.52878 0.528871 0.528961 0.529052 0.529144 0.529235 0.529327 +0.529419 0.529511 0.529604 0.529697 0.52979 0.529884 0.529978 0.530072 +0.530166 0.530261 0.530356 0.530451 0.530547 0.530643 0.530739 0.530835 +0.530932 0.531029 0.531126 0.531224 0.531322 0.53142 0.531519 0.531618 +0.531717 0.531816 0.531916 0.532016 0.532117 0.532217 0.532318 0.53242 +0.532521 0.532623 0.532726 0.532828 0.532931 0.533034 0.533138 0.533242 +0.533346 0.53345 0.533555 0.53366 0.533766 0.533872 0.533978 0.534084 +0.534191 0.534298 0.534405 0.534513 0.534621 0.53473 0.534838 0.534947 +0.535057 0.535167 0.535277 0.535387 0.535498 0.535609 0.535721 0.535832 +0.535945 0.536057 0.53617 0.536283 0.536397 0.536511 0.536625 0.536739 +0.536854 0.53697 0.537085 0.537201 0.537318 0.537434 0.537552 0.537669 +0.537787 0.537905 0.538023 0.538142 0.538262 0.538381 0.538501 0.538622 +0.538742 0.538864 0.538985 0.539107 0.539229 0.539352 0.539475 0.539598 +0.539722 0.539846 0.539971 0.540096 0.540221 0.540346 0.540473 0.540599 +0.540726 0.540853 0.540981 0.541109 0.541237 0.541366 0.541495 0.541625 +0.541755 0.541885 0.542016 0.542147 0.542279 0.542411 0.542543 0.542676 +0.542809 0.542943 0.543077 0.543211 0.543346 0.543482 0.543617 0.543754 +0.54389 0.544027 0.544164 0.544302 0.544441 0.544579 0.544718 0.544858 +0.544998 0.545138 0.545279 0.54542 0.545562 0.545704 0.545847 0.54599 +0.546133 0.546277 0.546421 0.546566 0.546711 0.546857 0.547003 0.54715 +0.547297 0.547444 0.547592 0.547741 0.54789 0.548039 0.548189 0.548339 +0.54849 0.548641 0.548792 0.548944 0.549097 0.54925 0.549403 0.549557 +0.549712 0.549867 0.550022 0.550178 0.550334 0.550491 0.550649 0.550806 +0.550965 0.551123 0.551283 0.551443 0.551603 0.551763 0.551925 0.552086 +0.552249 0.552411 0.552575 0.552738 0.552903 0.553067 0.553233 0.553398 +0.553565 0.553732 0.553899 0.554067 0.554235 0.554404 0.554573 0.554743 +0.554914 0.555085 0.555256 0.555428 0.555601 0.555774 0.555947 0.556121 +0.556296 0.556471 0.556647 0.556823 0.557 0.557177 0.557355 0.557534 +0.557713 0.557892 0.558073 0.558253 0.558434 0.558616 0.558799 0.558982 +0.559165 0.559349 0.559534 0.559719 0.559905 0.560091 0.560278 0.560465 +0.560653 0.560842 0.561031 0.561221 0.561411 0.561602 0.561794 0.561986 +0.562179 0.562372 0.562566 0.562761 0.562956 0.563152 0.563348 0.563545 +0.563742 0.563941 0.564139 0.564339 0.564539 0.564739 0.56494 0.565142 +0.565345 0.565548 0.565752 0.565956 0.566161 0.566366 0.566573 0.56678 +0.566987 0.567195 0.567404 0.567613 0.567824 0.568034 0.568246 0.568458 +0.56867 0.568884 0.569098 0.569312 0.569528 0.569744 0.56996 0.570178 +0.570396 0.570614 0.570834 0.571054 0.571274 0.571496 0.571718 0.57194 +0.572164 0.572388 0.572613 0.572838 0.573064 0.573291 0.573519 0.573747 +0.573976 0.574206 0.574436 0.574667 0.574899 0.575132 0.575365 0.575599 +0.575833 0.576069 0.576305 0.576542 0.57678 0.577018 0.577257 0.577497 +0.577737 0.577978 0.578221 0.578463 0.578707 0.578951 0.579196 0.579442 +0.579688 0.579936 0.580184 0.580433 0.580682 0.580932 0.581184 0.581435 +0.581688 0.581942 0.582196 0.582451 0.582707 0.582963 0.583221 0.583479 +0.583738 0.583997 0.584258 0.584519 0.584782 0.585045 0.585308 0.585573 +0.585838 0.586105 0.586372 0.58664 0.586908 0.587178 0.587448 0.587719 +0.587991 0.588264 0.588538 0.588813 0.589088 0.589364 0.589641 0.589919 +0.590198 0.590478 0.590758 0.59104 0.591322 0.591605 0.591889 0.592174 +0.59246 0.592746 0.593034 0.593322 0.593612 0.593902 0.594193 0.594485 +0.594778 0.595071 0.595366 0.595662 0.595958 0.596256 0.596554 0.596853 +0.597153 0.597454 0.597757 0.598059 0.598363 0.598668 0.598974 0.599281 +0.599588 0.599897 0.600206 0.600517 0.600828 0.601141 0.601454 0.601769 +0.602084 0.6024 0.602718 0.603036 0.603355 0.603675 0.603996 0.604319 +0.604642 0.604966 0.605291 0.605617 0.605944 0.606273 0.606602 0.606932 +0.607263 0.607596 0.607929 0.608263 0.608598 0.608935 0.609272 0.609611 +0.60995 0.610291 0.610632 0.610975 0.611319 0.611663 0.612009 0.612356 +0.612704 0.613053 0.613403 0.613754 0.614107 0.61446 0.614814 0.61517 +0.615526 0.615884 0.616243 0.616603 0.616964 0.617326 0.617689 0.618054 +0.618419 0.618786 0.619154 0.619522 0.619892 0.620264 0.620636 0.621009 +0.621384 0.62176 0.622137 0.622515 0.622894 0.623274 0.623656 0.624039 +0.624423 0.624808 0.625194 0.625582 0.62597 0.62636 0.626751 0.627144 +0.627537 0.627932 0.628328 0.628725 0.629123 0.629523 0.629924 0.630326 +0.630729 0.631134 0.63154 0.631947 0.632355 0.632764 0.633175 0.633587 +0.634001 0.634415 0.634831 0.635249 0.635667 0.636087 0.636508 0.63693 +0.637354 0.637779 0.638205 0.638633 0.639062 0.639492 0.639923 0.640356 +0.640791; +#A 4000 0.641226 0.641663 0.642101 0.642541 0.642982 0.643424 0.643868 +0.644313 0.644759 0.645207 0.645656 0.646107 0.646559 0.647012 0.647467 +0.647923 0.64838 0.648839 0.6493 0.649761 0.650225 0.650689 0.651155 +0.651623 0.652092 0.652562 0.653034 0.653507 0.653982 0.654458 0.654936 +0.655415 0.655896 0.656378 0.656861 0.657346 0.657833 0.658321 0.658811 +0.659302 0.659794 0.660288 0.660784 0.661281 0.66178 0.66228 0.662782 +0.663285 0.66379 0.664297 0.664805 0.665314 0.665825 0.666338 0.666852 +0.667368 0.667885 0.668405 0.668925 0.669447 0.669971 0.670497 0.671024 +0.671553 0.672083 0.672615 0.673148 0.673684 0.674221 0.674759 0.675299 +0.675841 0.676385 0.67693 0.677477 0.678026 0.678576 0.679128 0.679682 +0.680237 0.680794 0.681353 0.681913 0.682476 0.68304 0.683605 0.684173 +0.684742 0.685313 0.685886 0.68646 0.687037 0.687615 0.688195 0.688776 +0.68936 0.689945 0.690532 0.691121 0.691711 0.692304 0.692898 0.693494 +0.694092 0.694692 0.695294 0.695897 0.696502 0.69711 0.697719 0.69833 +0.698943 0.699557 0.700174 0.700792 0.701413 0.702035 0.702659 0.703286 +0.703914 0.704544 0.705176 0.70581 0.706446 0.707084 0.707723 0.708365 +0.709009 0.709655 0.710302 0.710952 0.711604 0.712258 0.712914 0.713571 +0.714231 0.714893 0.715557 0.716223 0.716891 0.717561 0.718233 0.718907 +0.719583 0.720262 0.720942 0.721625 0.722309 0.722996 0.723685 0.724376 +0.725069 0.725764 0.726462 0.727161 0.727863 0.728567 0.729273 0.729981 +0.730691 0.731404 0.732119 0.732836 0.733555 0.734276 0.735 0.735726 +0.736454 0.737184 0.737916 0.738651 0.739388 0.740128 0.740869 0.741613 +0.74236 0.743108 0.743859 0.744612 0.745368 0.746125 0.746885 0.747648 +0.748413 0.74918 0.749949 0.750721 0.751496 0.752272 0.753051 0.753833 +0.754617 0.755403 0.756192 0.756983 0.757776 0.758572 0.759371 0.760172 +0.760975 0.761781 0.762589 0.7634 0.764214 0.765029 0.765848 0.766669 +0.767492 0.768318 0.769147 0.769978 0.770811 0.771648 0.772486 0.773328 +0.774172 0.775018 0.775867 0.776719 0.777573 0.77843 0.77929 0.780152 +0.781017 0.781885 0.782755 0.783628 0.784504 0.785382 0.786263 0.787147 +0.788034 0.788923 0.789815 0.79071 0.791607 0.792508 0.793411 0.794316 +0.795225 0.796136 0.797051 0.797968 0.798887 0.79981 0.800736 0.801664 +0.802595 0.80353 0.804466 0.805406 0.806349 0.807295 0.808243 0.809195 +0.810149 0.811107 0.812067 0.81303 0.813997 0.814966 0.815938 0.816913 +0.817892 0.818873 0.819857 0.820845 0.821835 0.822828 0.823825 0.824824 +0.825827 0.826833 0.827841 0.828853 0.829868 0.830887 0.831908 0.832932 +0.83396 0.834991 0.836025 0.837062 0.838102 0.839146 0.840192 0.841242 +0.842295 0.843352 0.844412 0.845475 0.846541 0.84761 0.848683 0.849759 +0.850839 0.851922 0.853008 0.854097 0.85519 0.856286 0.857386 0.858489 +0.859595 0.860705 0.861818 0.862934 0.864055 0.865178 0.866305 0.867435 +0.868569 0.869707 0.870848 0.871992 0.87314 0.874291 0.875446 0.876605 +0.877767 0.878933 0.880102 0.881275 0.882452 0.883632 0.884816 0.886003 +0.887194 0.888389 0.889588 0.89079 0.891996 0.893205 0.894419 0.895636 +0.896856 0.898081 0.899309 0.900541 0.901777 0.903017 0.904261 0.905508 +0.906759 0.908014 0.909273 0.910536 0.911803 0.913073 0.914348 0.915626 +0.916909 0.918195 0.919486 0.92078 0.922078 0.92338 0.924687 0.925997 +0.927311 0.92863 0.929952 0.931279 0.932609 0.933944 0.935283 0.936626 +0.937973 0.939324 0.94068 0.942039 0.943403 0.944771 0.946143 0.94752 +0.9489 0.950285 0.951674 0.953068 0.954466 0.955868 0.957274 0.958685 +0.9601 0.961519 0.962943 0.964371 0.965804 0.967241 0.968682 0.970128 +0.971579 0.973033 0.974493 0.975957 0.977425 0.978898 0.980375 0.981857 +0.983343 0.984834 0.98633 0.98783 0.989335 0.990845 0.992359 0.993878 +0.995401 0.996929 0.998462; +#X coords 0 1 4409 0 200 140 1 0 0; +#X restore 509 395 graph; +#X text 497 389 1; +#X text 497 521 0; +#X text 494 48 Examples of "s" curves; +#X obj 592 338 tabwrite~ \$0-curve; +#X connect 0 0 10 1; +#X connect 2 0 0 0; +#X connect 3 0 10 0; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 10 0 4 0; +#X connect 14 0 28 0; +#X connect 15 0 18 0; +#X connect 16 0 18 0; +#X connect 17 0 18 0; +#X connect 18 0 14 0; +#X connect 18 1 19 0; +#X connect 19 0 14 0; +#X connect 19 1 28 0; +#X connect 20 0 18 0; +#X connect 21 0 18 0; +#X connect 22 0 18 0; +#X restore 349 311 pd curve_factor_examples; +#X text 187 530 - curve duration in milliseconds - needs individual +float values into left inlet.; +#X text 187 560 - curve exponential factor parameter (-1 to 1) - needs +individual float values into mid and left inlet; +#X text 187 396 - up to 42 triplets composed of: 1-destination value +\, 2- time (ms) & 3- curve factor (-1 to 1).; +#X text 187 429 - jumps immediately to that value unless duration is +set to other than 0 in the mid inlet.; +#X obj 143 256 cyclone/Scope~ 147 114 256 3 128 -1 1 0 0 0 0 205 229 +232 74 79 77 96 98 102 0; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 7 2 pd; +#N canvas 673 40 366 264 (subpatch) 0; +#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 -74965 -212593 +-262144 1 1; +#X obj 215 68 route dsp; +#X obj 215 37 receive pd; +#N canvas 939 367 324 271 set_color 0; +#X obj 47 30 inlet; +#X obj 96 146 s \$0-cnv; +#X msg 96 114 color -4.86997e+06 -1.34937e+07; +#N canvas 0 22 712 637 off 0; +#X obj 490 220 * -1; +#X obj 424 300 +; +#X obj 409 325 +; +#X obj 347 219 * -65536; +#X obj 424 220 * -256; +#X obj 409 356 - 1; +#X obj 390 189 unpack f f f; +#X obj 225 295 +; +#X obj 210 320 +; +#X obj 148 214 * -65536; +#X obj 225 215 * -256; +#X obj 291 215 * -1; +#X obj 210 351 - 1; +#X obj 191 184 unpack f f f; +#X obj 379 423 pack; +#X msg 378 447 color \$1 \$2; +#X msg 395 152 124 124 124; +#X msg 203 154 220 220 220; +#X obj 238 121 t b b; +#X obj 238 81 inlet; +#X obj 378 485 outlet; +#X connect 0 0 1 1; +#X connect 1 0 2 1; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 1 0; +#X connect 5 0 14 1; +#X connect 6 0 3 0; +#X connect 6 1 4 0; +#X connect 6 2 0 0; +#X connect 7 0 8 1; +#X connect 8 0 12 0; +#X connect 9 0 8 0; +#X connect 10 0 7 0; +#X connect 11 0 7 1; +#X connect 12 0 14 0; +#X connect 13 0 9 0; +#X connect 13 1 10 0; +#X connect 13 2 11 0; +#X connect 14 0 15 0; +#X connect 15 0 20 0; +#X connect 16 0 6 0; +#X connect 17 0 13 0; +#X connect 18 0 17 0; +#X connect 18 1 16 0; +#X connect 19 0 18 0; +#X restore 47 113 pd off; +#X obj 47 83 select 0 1; +#X obj 47 168 list append 0; +#X obj 47 195 list trim; +#X obj 47 220 s \$0-tgl-r; +#X connect 0 0 4 0; +#X connect 2 0 1 0; +#X connect 2 0 5 0; +#X connect 3 0 1 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 4 1 2 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X restore 215 165 pd set_color; +#X obj 135 122 r \$0-tgl-s; +#N canvas 0 22 450 300 (subpatch) 0; +#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 -74965 -212593 +0; +#X coords 0 -1 1 1 42 27 1 100 100; +#X restore 51 144 pd; +#X obj 226 139 s \$0-tgl-r; +#X msg 226 115 set \$1; +#X msg 135 177 \; pd dsp \$1; +#N canvas 256 32 278 194 load_check 0; +#X obj 136 53 sig~ 1; +#X obj 74 24 loadbang; +#X obj 136 86 snapshot~; +#X obj 91 52 del 5; +#X obj 136 151 outlet; +#X obj 74 103 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 74 126 switch~; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 0 5 0; +#X connect 5 0 6 0; +#X restore 51 72 pd load_check; +#X connect 1 0 3 0; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 4 0 8 0; +#X connect 4 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 0 0; +#X coords 0 -1 1 1 44 72 2 50 100; +#X restore 503 91 pd; +#X connect 22 0 23 0; +#X connect 23 0 24 0; +#X connect 23 0 24 1; +#X connect 35 0 23 1; +#X connect 35 0 44 0; +#X connect 35 1 17 0; +#X connect 38 0 35 0; diff --git a/externals/miXed/doc/help/cyclone/cycle-help.pd b/externals/miXed/doc/help/cyclone/cycle-help.pd new file mode 100644 index 000000000..bfa817171 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/cycle-help.pd @@ -0,0 +1,111 @@ +#N canvas 305 130 553 451 10; +#X obj -1 430 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 271 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 445 320 411 239 META 0; +#X text 32 136 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 32 28 LICENSE SIBSD; +#X text 32 118 AUTHOR Miller Puckette; +#X text 32 154 RELEASE_DATE 1997; +#X text 32 100 LIBRARY cyclone; +#X text 32 10 KEYWORDS send data cycle; +#X text 32 46 DESCRIPTION send data to individual outlets; +#X text 32 64 INLET_0 anything; +#X text 32 82 OUTLET_0 anything; +#X text 32 172 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 504 432 pd META; +#X obj -1 310 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 347 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 390 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 193 450 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 432 pd Related_objects; +#X obj 78 280 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 319 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header cycle 3 12 0 18 +-204280 -1 0; +#X obj 510 5 cycle; +#X text 11 23 send data to individual outlets; +#X obj 34 159 cycle 3; +#X floatatom 34 230 5 0 0 0 - - -; +#X floatatom 53 207 5 0 0 0 - - -; +#X floatatom 73 185 5 0 0 0 - - -; +#X msg 34 81 1; +#X msg 65 81 2; +#X msg 96 81 3; +#X obj 308 149 cycle 2; +#X obj 308 102 metro 300; +#X obj 308 82 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 308 174 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 347 173 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 308 125 symbol foo; +#X text 162 107 sets next outlet; +#X msg 125 107 set 2; +#X msg 125 127 thresh; +#X text 170 126 change output mode*; +#X text 89 160 1st arg sets nr of outlets*; +#N canvas 1005 231 450 275 more... 0; +#X obj 271 136 cycle 2 0; +#X floatatom 271 171 5 0 0 0 - - -; +#X floatatom 322 171 5 0 0 0 - - -; +#X floatatom 271 96 5 0 0 0 - - -; +#X floatatom 104 171 5 0 0 0 - - -; +#X floatatom 155 171 5 0 0 0 - - -; +#X floatatom 104 89 5 0 0 0 - - -; +#X obj 104 136 cycle 2 1; +#X msg 187 66 1; +#X msg 187 84 2; +#X msg 187 102 3; +#X msg 134 63 1 2 3; +#X text 55 16 whereas only lists get parted in the expected way.; +#X msg 54 65 thresh; +#X msg 332 72 thresh; +#X msg 341 96 1 2 3 4; +#X text 55 2 new 'events' alway end up in the left outlet; +#X connect 0 0 1 0; +#X connect 0 1 2 0; +#X connect 3 0 0 0; +#X connect 6 0 7 0; +#X connect 7 0 4 0; +#X connect 7 1 5 0; +#X connect 8 0 7 0; +#X connect 9 0 7 0; +#X connect 10 0 7 0; +#X connect 11 0 7 0; +#X connect 13 0 7 0; +#X connect 14 0 0 0; +#X connect 15 0 0 0; +#X restore 308 232 pd more...; +#X text 105 279 anything; +#X text 178 279 - can input anything to send to different outlets; +#X text 105 318 anything; +#X text 178 318 - number based on argument.; +#X text 86 361 1) float; +#X text 178 360 - number of outlets; +#X obj 9 430 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 13 0; +#X connect 12 1 14 0; +#X connect 12 2 15 0; +#X connect 16 0 12 0; +#X connect 17 0 12 0; +#X connect 18 0 12 0; +#X connect 19 0 22 0; +#X connect 19 1 23 0; +#X connect 20 0 24 0; +#X connect 21 0 20 0; +#X connect 24 0 19 0; +#X connect 26 0 12 0; +#X connect 27 0 12 0; diff --git a/externals/miXed/doc/help/cyclone/cycle~-help.pd b/externals/miXed/doc/help/cyclone/cycle~-help.pd new file mode 100644 index 000000000..781b06721 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/cycle~-help.pd @@ -0,0 +1,140 @@ +#N canvas 415 34 552 673 10; +#X obj -1 925 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 611 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 591 463 372 220 META 0; +#X text 11 148 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 22 LICENSE SIBSD; +#X text 11 130 AUTHOR Miller Puckette; +#X text 11 166 RELEASE_DATE 1997; +#X text 11 112 LIBRARY cyclone; +#X text 11 4 KEYWORDS signal oscillator function generator sine wave +; +#X text 11 40 DESCRIPTION table-lookup oscillator or function generator +; +#X text 11 58 INLET_0 float signal; +#X text 11 76 INLET_1 float signal; +#X text 11 94 OUTLET_0 signal; +#X text 11 184 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 499 927 pd META; +#X obj -1 720 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 757 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 833 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 306 573 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 206 927 pd Related_objects; +#X obj 77 621 cnv 17 3 33 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 77 673 cnv 17 3 33 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header cycle~ 3 12 0 18 +-204280 -1 0; +#X text 11 23 Table-lookup oscillator or function generator; +#X floatatom 322 483 0 0 0 0 - - -; +#X obj 301 410 loadbang; +#X msg 301 435 22.5; +#X text 295 333 4 Using your function; +#X obj 301 506 *~ 0; +#X obj 301 461 cycle~ buffsky; +#X msg 31 380 437; +#X obj 31 355 loadbang; +#X obj 32 215 *~ 0.2; +#X obj 32 179 cycle~ 440; +#X obj 31 505 *~ 0.2; +#X floatatom 31 405 0 0 0 0 - - -; +#X msg 31 430 \$1 400; +#X obj 31 455 line~; +#X obj 31 480 cycle~; +#X obj 31 249 dac~; +#X obj 316 243 *~ 0.2; +#X obj 350 173 phasor~ 660; +#X obj 316 207 cycle~; +#X text 26 145 frequency input (float or signal); +#X text 295 146 phase input (float or signal); +#X text 295 127 2 Driven by phase only (frequency is 0):; +#X text 26 128 1 argument sets frequency (default 0); +#N canvas 281 140 183 210 generate-buffer~ 0; +#X obj 40 30 loadbang; +#N canvas 50 40 152 247 sawtooth 0; +#X obj 80 145 - 2; +#X obj 80 120 * 2; +#X obj 22 119 * 2; +#X obj 22 95 split 0 0.5; +#X obj 22 59 / 512; +#X obj 22 33 inlet; +#X obj 22 208 outlet; +#X connect 0 0 6 0; +#X connect 1 0 0 0; +#X connect 2 0 6 0; +#X connect 3 0 2 0; +#X connect 3 1 1 0; +#X connect 4 0 3 0; +#X connect 5 0 4 0; +#X restore 80 120 pd sawtooth; +#X obj 40 143 pack 0 0; +#X obj 40 98 t f f; +#X obj 40 76 line 0 1; +#X msg 40 56 0 \, 512 512; +#X obj 40 164 peek~ buffsky; +#X connect 0 0 5 0; +#X connect 1 0 2 1; +#X connect 2 0 6 0; +#X connect 3 0 2 0; +#X connect 3 1 1 0; +#X connect 4 0 3 0; +#X connect 5 0 4 0; +#X restore 300 355 pd generate-buffer~; +#X text 352 484 listen?; +#X obj 300 376 table buffsky 512; +#X text 26 332 3 Using frequency input; +#X text 109 622 float; +#X text 109 637 signal; +#X text 164 628 - set frequnecy; +#X obj 77 729 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 109 671 float; +#X text 109 686 signal; +#X text 164 677 - drive by phase only (frequency is 0); +#X text 109 728 signal; +#X text 164 726 - the signal with given frequency or phase; +#X text 90 776 1) float; +#X text 164 776 - default frequency; +#X text 108 794 buffer; +#X text 164 794 - can give function stored in buffer object; +#X obj 503 4 cycle~; +#X obj 483 50 pddp/dsp; +#X obj 316 273 dac~; +#X obj 31 534 dac~; +#X obj 301 535 dac~; +#X text 27 52 cycle~ uses a stored table of 512 samples to generate +functions. By default it uses a sine wave \, but you can give it a +function stored in a buffer~ object.; +#X text 96 850 Symbol argument sets name of table to play from. Additional +int argument after that sets sample offset into the table (default +0); +#X obj 6 926 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 15 1; +#X connect 12 0 13 0; +#X connect 13 0 16 0; +#X connect 15 0 55 1; +#X connect 16 0 15 0; +#X connect 17 0 22 0; +#X connect 18 0 17 0; +#X connect 19 0 26 0; +#X connect 20 0 19 0; +#X connect 21 0 54 1; +#X connect 22 0 23 0; +#X connect 23 0 24 0; +#X connect 24 0 25 0; +#X connect 25 0 21 0; +#X connect 27 0 53 0; +#X connect 28 0 29 1; +#X connect 29 0 27 0; diff --git a/externals/miXed/doc/help/cyclone/dbtoa-help.pd b/externals/miXed/doc/help/cyclone/dbtoa-help.pd new file mode 100644 index 000000000..e2d9ee191 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/dbtoa-help.pd @@ -0,0 +1,85 @@ +#N canvas 146 85 568 567 10; +#X obj 4 43 cnv 15 552 40 empty empty dbtoa 3 12 0 18 -204280 -1 0 +; +#X obj 4 356 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#X obj 4 440 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 4 477 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#X obj 83 449 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 83 370 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X text 100 486 (none); +#X obj 4 518 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#N canvas 244 346 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 50 49 cyclone/dbtoa~; +#X obj 152 49 cyclone/atodb~; +#X obj 255 49 cyclone/atodb; +#X restore 210 520 pd Related_objects; +#N canvas 571 307 379 261 META 0; +#X text 1 0 KEYWORDS signal max_compatible; +#X text 1 163 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 1 40 DESCRIPTION absolute value of a signal; +#X text 1 60 INLET_0 signal; +#X text 1 80 OUTLET_0 signal; +#X text 1 121 AUTHOR Krzysztof Czaja; +#X text 1 20 LICENSE SIBSD; +#X text 0 101 VERSION 0.2-beta1; +#X text 0 142 RELEASE_DATE 2002; +#X text 1 193 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X restore 506 520 pd META; +#X obj 153 305 nbx 8 20 -1e+37 1e+37 0 0 empty empty Linear_Amplitude +133 11 0 16 -228856 -1 -1 1e-05 256; +#X obj 82 190 nbx 5 14 -100 0 1 0 empty empty empty 0 -8 0 10 -228856 +-1 -1 -100 256; +#X obj 85 160 hsl 180 15 -100 0 0 1 empty empty empty -2 -8 0 10 -228856 +-1 -1 0 1; +#X obj 509 50 dbtoa; +#X text 12 66 Convert dBFS to linear amplitude; +#X text 273 160 dBFS; +#X text 111 449 float/list; +#X text 148 383 bang; +#X text 154 400 set; +#X text 189 400 - sets next float value to be converted via bang; +#X text 189 383 - outputs the last converted float value; +#X text 170 191 last output; +#X text 231 227 sets next value to be converted via bang; +#X obj 153 190 bng 15 250 50 0 empty empty empty 17 7 0 10 -261682 +-1 -1; +#X msg 177 227 set -60; +#X text 85 102 Converts a decibel value to its corresponding linear +amplitude. Conversion expression: amp = pow(10 \, dBFS / 20); +#X text 112 366 float/list; +#X text 189 366 - dBFS amplitude value(s); +#X text 187 449 - Linear amplitude value(s); +#X obj 153 266 ./cyclone/dbtoa; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 3 7 pd; +#X connect 11 0 29 0; +#X connect 12 0 11 0; +#X connect 23 0 29 0; +#X connect 24 0 29 0; +#X connect 29 0 10 0; diff --git a/externals/miXed/doc/help/cyclone/dbtoa~-help.pd b/externals/miXed/doc/help/cyclone/dbtoa~-help.pd new file mode 100644 index 000000000..4f3cae4a7 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/dbtoa~-help.pd @@ -0,0 +1,186 @@ +#N canvas 655 93 564 578 10; +#X obj 4 40 cnv 15 552 40 empty empty dbtoa~ 3 12 0 18 -204280 -1 0 +; +#X obj 0 413 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#X obj 0 461 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 0 498 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#X obj 83 470 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 83 427 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X text 147 470 signal; +#X text 146 508 (none); +#X obj 4 536 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#N canvas 244 346 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 248 49 cyclone/dbtoa; +#X obj 152 49 cyclone/atodb; +#X obj 50 49 cyclone/atodb~; +#X restore 210 538 pd Related_objects; +#N canvas 571 307 379 261 META 0; +#X text 1 0 KEYWORDS signal max_compatible; +#X text 1 163 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 1 40 DESCRIPTION absolute value of a signal; +#X text 1 60 INLET_0 signal; +#X text 1 80 OUTLET_0 signal; +#X text 1 121 AUTHOR Krzysztof Czaja; +#X text 1 20 LICENSE SIBSD; +#X text 0 101 VERSION 0.2-beta1; +#X text 0 142 RELEASE_DATE 2002; +#X text 1 193 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X restore 506 538 pd META; +#X obj 115 355 nbx 8 20 -1e+37 1e+37 0 0 empty empty Linear_Amplitue +133 11 0 16 -228856 -1 -1 1e-05 256; +#X obj 115 312 cyclone/Snapshot~ 100; +#X obj 115 215 nbx 5 14 -100 0 1 0 empty empty empty 0 -8 0 10 -228856 +-1 -1 0 256; +#X obj 118 189 hsl 180 15 -100 0 0 0 empty empty empty -2 -8 0 10 -228856 +-1 -1 0 1; +#X text 111 427 signal/float; +#X obj 509 47 dbtoa~; +#X text 180 214 dBFS; +#X obj 115 240 sig~ -100; +#X text 77 92 [atodb~] takes any given signal representing a dBFS amplitude +value and outputs a signal which is a linear amplitude conversion of +the input.; +#X text 236 427 - Signal/float representing a dBFS amplitude; +#X text 236 472 - Linear amplitude value; +#X text 12 63 Convert dBFS to linear amplitude at signal rate; +#X text 75 141 Conversion expression: amp = pow(10 \, dBFS / 20); +#X obj 115 277 cyclone/dbtoa~; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 3 4 pd; +#N canvas 673 40 366 264 (subpatch) 0; +#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 -74965 -212593 +-262144 1 1; +#X obj 215 68 route dsp; +#X obj 215 37 receive pd; +#N canvas 939 367 324 271 set_color 0; +#X obj 47 30 inlet; +#X obj 96 146 s \$0-cnv; +#X msg 96 114 color -4.86997e+06 -1.34937e+07; +#N canvas 0 22 712 637 off 0; +#X obj 490 220 * -1; +#X obj 424 300 +; +#X obj 409 325 +; +#X obj 347 219 * -65536; +#X obj 424 220 * -256; +#X obj 409 356 - 1; +#X obj 390 189 unpack f f f; +#X obj 225 295 +; +#X obj 210 320 +; +#X obj 148 214 * -65536; +#X obj 225 215 * -256; +#X obj 291 215 * -1; +#X obj 210 351 - 1; +#X obj 191 184 unpack f f f; +#X obj 379 423 pack; +#X msg 378 447 color \$1 \$2; +#X msg 395 152 124 124 124; +#X msg 203 154 220 220 220; +#X obj 238 121 t b b; +#X obj 238 81 inlet; +#X obj 378 485 outlet; +#X connect 0 0 1 1; +#X connect 1 0 2 1; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 1 0; +#X connect 5 0 14 1; +#X connect 6 0 3 0; +#X connect 6 1 4 0; +#X connect 6 2 0 0; +#X connect 7 0 8 1; +#X connect 8 0 12 0; +#X connect 9 0 8 0; +#X connect 10 0 7 0; +#X connect 11 0 7 1; +#X connect 12 0 14 0; +#X connect 13 0 9 0; +#X connect 13 1 10 0; +#X connect 13 2 11 0; +#X connect 14 0 15 0; +#X connect 15 0 20 0; +#X connect 16 0 6 0; +#X connect 17 0 13 0; +#X connect 18 0 17 0; +#X connect 18 1 16 0; +#X connect 19 0 18 0; +#X restore 47 113 pd off; +#X obj 47 83 select 0 1; +#X obj 47 168 list append 0; +#X obj 47 195 list trim; +#X obj 47 220 s \$0-tgl-r; +#X connect 0 0 4 0; +#X connect 2 0 1 0; +#X connect 2 0 5 0; +#X connect 3 0 1 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 4 1 2 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X restore 215 165 pd set_color; +#X obj 135 122 r \$0-tgl-s; +#N canvas 0 22 450 300 (subpatch) 0; +#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 -74965 -212593 +0; +#X coords 0 -1 1 1 42 27 1 100 100; +#X restore 51 144 pd; +#X obj 226 139 s \$0-tgl-r; +#X msg 226 115 set \$1; +#X msg 135 177 \; pd dsp \$1; +#N canvas 256 32 278 194 load_check 0; +#X obj 136 53 sig~ 1; +#X obj 74 24 loadbang; +#X obj 136 86 snapshot~; +#X obj 91 52 del 5; +#X obj 136 151 outlet; +#X obj 74 103 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 74 126 switch~; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 0 5 0; +#X connect 5 0 6 0; +#X restore 51 72 pd load_check; +#X connect 1 0 3 0; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 4 0 8 0; +#X connect 4 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 0 0; +#X coords 0 -1 1 1 44 72 2 50 100; +#X restore 504 91 pd; +#X connect 12 0 11 0; +#X connect 13 0 18 0; +#X connect 14 0 13 0; +#X connect 18 0 24 0; +#X connect 24 0 12 0; diff --git a/externals/miXed/doc/help/cyclone/decide-help.pd b/externals/miXed/doc/help/cyclone/decide-help.pd new file mode 100644 index 000000000..f56da4a12 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/decide-help.pd @@ -0,0 +1,75 @@ +#N canvas 419 34 554 426 10; +#X obj -1 403 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 213 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 606 199 362 237 META 0; +#X text 12 0 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 12 -140 LICENSE SIBSD; +#X text 12 -20 AUTHOR Miller Puckette; +#X text 12 20 RELEASE_DATE 1997; +#X text 12 -40 LIBRARY cyclone; +#X text 12 -160 KEYWORDS output 0 1 binary random; +#X text 12 -120 DESCRIPTION output 0/1 randomly; +#X text 12 -60 OUTLET_0 float; +#X text 12 -100 INLET_0 bang; +#X text 12 -80 INLET_1 float; +#X text 12 40 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 502 405 pd META; +#X obj -1 270 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 307 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 355 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 314 326 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 11 30 random; +#X obj 60 30 drunk; +#X obj 104 30 rand~; +#X restore 207 405 pd Related_objects; +#X obj 81 220 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 246 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header decide 3 12 0 18 +-204280 -1 0; +#X obj 504 3 decide; +#X text 11 23 output 0/1 randomly; +#X obj 120 140 decide 12; +#X obj 340 132 decide; +#X obj 120 181 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 120 93 metro 300; +#X obj 120 66 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 171 118 5 0 0 0 - - -, f 5; +#X obj 340 106 metro 300; +#X obj 340 79 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 340 169 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X text 117 220 bang; +#X text 117 279 float; +#X obj 81 279 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 117 246 float; +#X text 164 246 - set range of numbers; +#X text 99 325 1) float; +#X text 164 325 - default range; +#X text 164 220 - output 0 or 1 by default.; +#X text 164 279 - random 0 or 1 by default.; +#X text 205 118 reseed range; +#X text 181 141 arg seeds the range; +#X obj 13 404 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 14 0; +#X connect 13 0 20 0; +#X connect 15 0 12 0; +#X connect 16 0 15 0; +#X connect 17 0 12 1; +#X connect 18 0 13 0; +#X connect 19 0 18 0; diff --git a/externals/miXed/doc/help/cyclone/delay~-help.pd b/externals/miXed/doc/help/cyclone/delay~-help.pd new file mode 100644 index 000000000..fdfb1adec --- /dev/null +++ b/externals/miXed/doc/help/cyclone/delay~-help.pd @@ -0,0 +1,141 @@ +#N canvas 423 39 554 490 10; +#X obj -1 528 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 358 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 593 281 370 225 META 0; +#X text 10 142 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 22 LICENSE SIBSD; +#X text 10 122 AUTHOR Miller Puckette; +#X text 10 162 RELEASE_DATE 1997; +#X text 10 102 LIBRARY cyclone; +#X text 10 2 KEYWORDS signal delay samples delayed; +#X text 10 42 DESCRIPTION delay incoming signal for a number of samples +; +#X text 10 62 INLET_0 signal; +#X text 10 82 OUTLET_0 signal; +#X text 10 182 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 501 530 pd META; +#X obj -1 399 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 436 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 291 398 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 9 31 delread~; +#X obj 70 31 delwrite~; +#X obj 137 31 vd~; +#X restore 190 530 pd Related_objects; +#X obj 79 408 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header delay~ 3 12 0 18 +-204280 -1 0; +#X obj 500 3 delay~; +#X text 11 23 delay incoming signal for a number of samples; +#X obj 69 154 delay~ 22050; +#X obj 69 84 adc~; +#X obj 70 120 hip~ 5; +#X obj 138 117 * 4410; +#X floatatom 138 87 5 0 0 0 - - -, f 5; +#X floatatom 266 303 0 0 100 0 - - -; +#N canvas 159 26 532 285 output 0; +#X obj 338 160 t b; +#X obj 338 110 f; +#X obj 338 60 inlet; +#X text 344 29 mute; +#X obj 338 185 f; +#X msg 426 180 0; +#X msg 338 85 bang; +#X obj 338 135 moses 1; +#X obj 397 110 moses 1; +#X obj 83 148 dbtorms; +#X obj 397 85 r master-lvl; +#X obj 83 42 r master-lvl; +#X obj 338 210 s master-lvl; +#X obj 20 155 inlet~; +#X obj 199 41 inlet; +#X text 199 18 level; +#X obj 199 105 s master-lvl; +#X msg 96 65 set \$1; +#X obj 96 90 outlet; +#X msg 214 65 \; pd dsp 1; +#X obj 83 198 line~; +#X obj 20 207 *~; +#X obj 20 232 dac~; +#X obj 83 173 pack 0 50; +#X text 20 132 audio; +#X text 96 114 show level; +#X obj 426 155 t b; +#X obj 20 181 hip~ 1; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 12 0; +#X connect 5 0 12 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 26 0; +#X connect 8 1 4 1; +#X connect 9 0 23 0; +#X connect 10 0 1 1; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 17 0; +#X connect 13 0 27 0; +#X connect 14 0 16 0; +#X connect 14 0 19 0; +#X connect 17 0 18 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 21 0 22 1; +#X connect 23 0 20 0; +#X connect 26 0 5 0; +#X connect 27 0 21 0; +#X restore 241 326 pd output; +#X msg 292 303 MUTE; +#X obj 215 178 -~; +#X floatatom 215 83 5 0 0 0 - - -, f 5; +#X obj 231 153 delay~ 100; +#X floatatom 288 131 5 0 0 0 - - -, f 5; +#X obj 99 201 *~; +#X obj 114 57 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 242 222 *~; +#X obj 257 57 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 215 104 phasor~ 100; +#X text 131 57 try this...; +#X text 275 57 or this; +#X text 108 367 signal; +#X text 170 367 - signal to delay; +#X text 108 408 signal; +#X text 170 408 - delayed signal; +#X text 90 455 1) float; +#X text 170 456 - max delay in samples. Default is 512; +#X obj 481 51 pddp/dsp; +#X obj 77 367 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 299 146 arg is max delay in samples (default 512); +#X obj 10 531 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 22 0; +#X connect 11 0 12 0; +#X connect 12 0 10 0; +#X connect 13 0 10 1; +#X connect 14 0 13 0; +#X connect 15 0 16 1; +#X connect 16 0 15 0; +#X connect 17 0 16 2; +#X connect 18 0 24 0; +#X connect 19 0 26 0; +#X connect 20 0 18 1; +#X connect 21 0 20 1; +#X connect 22 0 16 0; +#X connect 23 0 22 1; +#X connect 24 0 16 0; +#X connect 25 0 24 1; +#X connect 26 0 18 0; +#X connect 26 0 20 0; diff --git a/externals/miXed/doc/help/cyclone/deltaclip~-help.pd b/externals/miXed/doc/help/cyclone/deltaclip~-help.pd new file mode 100644 index 000000000..b6d0422dc --- /dev/null +++ b/externals/miXed/doc/help/cyclone/deltaclip~-help.pd @@ -0,0 +1,231 @@ +#N canvas 307 84 567 723 10; +#X obj 2 679 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#X obj 3 443 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#N canvas 603 278 382 257 META 0; +#X text 0 20 LICENSE SIBSD; +#X text 0 148 LIBRARY cyclone; +#X text 0 73 INLET_0 signal; +#X text 0 128 OUTLET_0 signal; +#X text 0 168 VERSION 0.2-beta1; +#X text 0 186 AUTHOR Krzysztof Czaja; +#X text 1 204 RELEASE_DATE 2002; +#X text 2 223 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 2 255 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X text 0 0 KEYWORDS signal max_compatible; +#X text 0 40 DESCRIPTION limit the change between samples in an incoming +signal; +#X text 0 92 INLET_1 signal; +#X text 0 110 INLET_2 signal; +#X restore 502 681 pd META; +#X obj 3 572 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 3 629 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#X obj 87 454 cnv 17 3 38 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 3 40 cnv 15 552 40 empty empty deltaclip~ 3 12 0 18 -204280 +-1 0; +#X obj 87 581 cnv 17 3 35 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X text 118 582 signal; +#N canvas 90 529 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 13 33 clip~; +#X obj 56 33 -~; +#X obj 87 33 +~; +#X restore 199 681 pd Related_objects; +#X text 15 63 Limit the change between samples in an incoming signal +; +#X obj 483 46 deltaclip~; +#X text 333 173 delta max; +#X floatatom 336 191 0 0 0 0 - - -; +#X floatatom 336 234 0 0 0 0 - - -; +#X obj 336 213 * 1e-05; +#X floatatom 244 191 0 0 0 0 - - -; +#X floatatom 244 234 0 0 0 0 - - -; +#X obj 244 213 * 1e-05; +#X obj 153 234 sig~; +#X floatatom 153 212 0 0 0 0 - - -; +#X text 165 330 amplitude; +#X text 242 173 delta min; +#X obj 153 371 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-228856 -1 -1 0 256; +#X obj 304 351 Snapshot~ 100; +#X obj 156 396 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -228856 +-1 -1 0 1; +#X floatatom 304 377 8 0 0 0 - - -, f 8; +#X obj 304 328 cyclone/delta~; +#X obj 87 499 cnv 17 3 27 empty empty 1 5 9 0 16 -228856 -162280 0 +; +#X obj 87 536 cnv 17 3 27 empty empty 2 5 9 0 16 -228856 -162280 0 +; +#X text 98 101 [deltaclip~] limits the change between samples in an +incoming signal. It is similar to the [clip~] object \, but it limits +amplitude changes with respect to slope rather than amplitude.; +#X text 112 500 float/signal; +#X text 112 536 float/signal; +#X text 201 454 - Any signal; +#X text 114 638 1) float; +#X text 114 655 2) float; +#X msg 88 227 reset; +#X text 201 471 - Resets delta minimum/maximum to the default (0); +#X text 147 454 signal; +#X text 153 473 reset; +#X text 201 499 - delta min: maximum allowed difference in decreasing +signal amplitude; +#X text 201 536 - delta max: maximum allowed difference in increasing +signal amplitude; +#X text 201 582 - The input signal is sent out \, with its change limited +by the delta minimum and maximum values.; +#X text 201 638 - delta minimum - typically negative (default 0); +#X text 201 653 - delta maximum - typically positive (default 0); +#X obj 153 177 tgl 25 0 empty empty empty 17 7 0 10 -228856 -1 -1 0 +1; +#X obj 153 346 cyclone/Snapshot~ 1; +#X text 364 376 difference; +#X obj 153 268 cyclone/deltaclip~ -2e-05 2e-05; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 2 6 pd; +#N canvas 673 40 366 264 (subpatch) 0; +#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 -74965 -212593 +-262144 1 1; +#X obj 215 68 route dsp; +#X obj 215 37 receive pd; +#N canvas 939 367 324 271 set_color 0; +#X obj 47 30 inlet; +#X obj 96 146 s \$0-cnv; +#X msg 96 114 color -4.86997e+06 -1.34937e+07; +#N canvas 0 22 712 637 off 0; +#X obj 490 220 * -1; +#X obj 424 300 +; +#X obj 409 325 +; +#X obj 347 219 * -65536; +#X obj 424 220 * -256; +#X obj 409 356 - 1; +#X obj 390 189 unpack f f f; +#X obj 225 295 +; +#X obj 210 320 +; +#X obj 148 214 * -65536; +#X obj 225 215 * -256; +#X obj 291 215 * -1; +#X obj 210 351 - 1; +#X obj 191 184 unpack f f f; +#X obj 379 423 pack; +#X msg 378 447 color \$1 \$2; +#X msg 395 152 124 124 124; +#X msg 203 154 220 220 220; +#X obj 238 121 t b b; +#X obj 238 81 inlet; +#X obj 378 485 outlet; +#X connect 0 0 1 1; +#X connect 1 0 2 1; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 1 0; +#X connect 5 0 14 1; +#X connect 6 0 3 0; +#X connect 6 1 4 0; +#X connect 6 2 0 0; +#X connect 7 0 8 1; +#X connect 8 0 12 0; +#X connect 9 0 8 0; +#X connect 10 0 7 0; +#X connect 11 0 7 1; +#X connect 12 0 14 0; +#X connect 13 0 9 0; +#X connect 13 1 10 0; +#X connect 13 2 11 0; +#X connect 14 0 15 0; +#X connect 15 0 20 0; +#X connect 16 0 6 0; +#X connect 17 0 13 0; +#X connect 18 0 17 0; +#X connect 18 1 16 0; +#X connect 19 0 18 0; +#X restore 47 113 pd off; +#X obj 47 83 select 0 1; +#X obj 47 168 list append 0; +#X obj 47 195 list trim; +#X obj 47 220 s \$0-tgl-r; +#X connect 0 0 4 0; +#X connect 2 0 1 0; +#X connect 2 0 5 0; +#X connect 3 0 1 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 4 1 2 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X restore 215 165 pd set_color; +#X obj 135 122 r \$0-tgl-s; +#N canvas 0 22 450 300 (subpatch) 0; +#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 -74965 -212593 +0; +#X coords 0 -1 1 1 42 27 1 100 100; +#X restore 51 144 pd; +#X obj 226 139 s \$0-tgl-r; +#X msg 226 115 set \$1; +#X msg 135 177 \; pd dsp \$1; +#N canvas 256 32 278 194 load_check 0; +#X obj 136 53 sig~ 1; +#X obj 74 24 loadbang; +#X obj 136 86 snapshot~; +#X obj 91 52 del 5; +#X obj 136 151 outlet; +#X obj 74 103 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 74 126 switch~; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 0 5 0; +#X connect 5 0 6 0; +#X restore 51 72 pd load_check; +#X connect 1 0 3 0; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 4 0 8 0; +#X connect 4 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 0 0; +#X coords 0 -1 1 1 44 72 2 50 100; +#X restore 500 91 pd; +#X connect 13 0 15 0; +#X connect 14 0 48 2; +#X connect 15 0 14 0; +#X connect 16 0 18 0; +#X connect 17 0 48 1; +#X connect 18 0 17 0; +#X connect 19 0 48 0; +#X connect 20 0 19 0; +#X connect 23 0 25 0; +#X connect 24 0 26 0; +#X connect 27 0 24 0; +#X connect 36 0 48 0; +#X connect 45 0 20 0; +#X connect 46 0 23 0; +#X connect 48 0 27 0; +#X connect 48 0 46 0; diff --git a/externals/miXed/doc/help/cyclone/delta~-help.pd b/externals/miXed/doc/help/cyclone/delta~-help.pd new file mode 100644 index 000000000..d2521e3b0 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/delta~-help.pd @@ -0,0 +1,88 @@ +#N canvas 420 38 554 524 10; +#X obj -2 501 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 340 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 609 279 362 257 META 0; +#X text 13 161 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 13 28 LICENSE SIBSD; +#X text 13 141 AUTHOR Miller Puckette; +#X text 13 181 RELEASE_DATE 1997; +#X text 13 121 LIBRARY cyclone; +#X text 13 81 INLET_0 signal; +#X text 13 101 OUTLET_0 signal; +#X text 13 8 KEYWORDS signal delta transform sample; +#X text 13 48 DESCRIPTION transform signal into difference between +successive samples; +#X text 13 201 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 498 503 pd META; +#X obj -1 382 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 419 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 83 351 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header delta~ 3 12 0 18 +-204280 -1 0; +#X text 114 351 signal; +#X obj 83 391 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 114 391 signal; +#N canvas 90 529 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 13 33 clip~; +#X obj 56 33 -~; +#X obj 87 33 +~; +#X restore 195 503 pd Related_objects; +#X obj 502 2 delta~; +#X obj 352 265 *~ 0.02; +#X obj 352 184 *~ 50; +#X obj 352 132 phasor~ 2.003; +#X obj 352 157 cos~; +#X obj 352 211 +~ 440; +#X obj 352 236 cycle~; +#X obj 268 178 *~ 200000; +#X floatatom 57 233 0 0 0 0 - - -; +#X obj 57 206 snapshot~ 100; +#X obj 268 297 dac~; +#X obj 268 264 *~ 0.02; +#X obj 268 237 cycle~; +#X obj 268 211 +~ 440; +#X obj 268 101 phasor~ 2; +#X obj 268 125 cos~; +#X msg 57 120 0 \, 5000 5000; +#X obj 57 148 line~; +#X text 269 84 Proposal for a new ambulance siren:; +#X text 353 115 "(ambulance)"; +#X obj 57 176 delta~; +#X obj 268 151 delta~; +#X text 177 351 - signal to transform; +#X text 177 391 - transformed signal signal; +#X text 114 430 (none); +#X obj 485 49 pddp/dsp; +#X text 11 23 Transform signal into difference between successive samples +; +#X text 54 84 what's the increment between succesive samples of a +line?; +#X obj 7 503 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 21 1; +#X connect 13 0 16 0; +#X connect 14 0 15 0; +#X connect 15 0 13 0; +#X connect 16 0 17 0; +#X connect 17 0 12 0; +#X connect 18 0 24 0; +#X connect 20 0 19 0; +#X connect 22 0 21 0; +#X connect 23 0 22 0; +#X connect 24 0 23 0; +#X connect 25 0 26 0; +#X connect 26 0 32 0; +#X connect 27 0 28 0; +#X connect 28 0 31 0; +#X connect 31 0 20 0; +#X connect 32 0 18 0; diff --git a/externals/miXed/doc/help/cyclone/drunk-help.pd b/externals/miXed/doc/help/cyclone/drunk-help.pd new file mode 100644 index 000000000..9753d6f8a --- /dev/null +++ b/externals/miXed/doc/help/cyclone/drunk-help.pd @@ -0,0 +1,100 @@ +#N canvas 422 33 554 555 10; +#X obj 0 747 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 442 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 573 272 390 294 META 0; +#X text 29 209 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 29 49 LICENSE SIBSD; +#X text 29 189 AUTHOR Miller Puckette; +#X text 29 229 RELEASE_DATE 1997; +#X text 29 169 LIBRARY cyclone; +#X text 29 109 INLET_1 float; +#X text 29 129 INLET_2 float; +#X text 29 149 OUTLET_0 float; +#X text 29 89 INLET_0 bang float list; +#X text 29 29 KEYWORDS output random numbers range; +#X text 29 69 DESCRIPTION output random numbers in a moving range; +#X text 29 249 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 749 pd META; +#X obj 2 575 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 2 625 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 317 453 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 9 28 random; +#X obj 58 28 decide; +#X obj 107 28 rand~; +#X restore 207 749 pd Related_objects; +#X obj 80 451 cnv 17 3 55 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 523 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header drunk 3 12 0 18 +-204280 -1 0; +#X obj 508 5 drunk; +#X obj 113 383 drunk 10; +#X floatatom 113 411 5 0 0 0 - - -, f 5; +#X obj 113 82 metro 300; +#X obj 113 59 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 122 119 5 0 0 0 - - -, f 5; +#X msg 131 177 set \$1; +#X floatatom 131 158 5 0 0 0 - - -, f 5; +#X text 176 177 set new bound without triggering output; +#X text 171 84 bang triggers output; +#X msg 147 260 10 20 4; +#X text 199 258 first sets current value; +#X text 199 271 second sets bound; +#X text 199 284 third (if present) limits stepsize; +#X msg 147 282 5 30; +#X msg 138 231 seed \$1; +#X floatatom 138 212 5 0 0 0 - - -, f 5; +#X text 155 120 set new value and output; +#X floatatom 135 340 5 0 0 0 - - -, f 5; +#X floatatom 158 360 5 0 0 0 - - -, f 5; +#X text 168 338 set upper bound; +#X text 191 359 set stepsize; +#X text 176 378 args set initial bound and maximum stepsize; +#X text 176 389 default 128 2; +#X text 11 23 output random numbers in a moving range; +#X text 113 451 bang; +#X text 180 451 - trigger output; +#X text 113 472 float; +#X text 180 472 - set new value and output; +#X text 113 490 list; +#X text 180 490 - first value set current value \, second sets bound +\, third limits stepsize; +#X obj 80 584 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 113 523 float; +#X text 113 584 float; +#X text 180 584 - random number output; +#X text 94 638 1) float; +#X text 180 638 - set initial bound \, default to 128; +#X text 94 662 2) float; +#X text 180 662 - set maximum stepsize; +#X text 180 523 - set upper boud; +#X obj 80 547 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 113 547 float; +#X text 180 547 - set stepsize; +#X text 189 230 seed range; +#X obj 11 747 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 11 0; +#X connect 12 0 10 0; +#X connect 13 0 12 0; +#X connect 14 0 10 0; +#X connect 15 0 10 0; +#X connect 16 0 15 0; +#X connect 19 0 10 0; +#X connect 23 0 10 0; +#X connect 24 0 10 0; +#X connect 25 0 24 0; +#X connect 27 0 10 1; +#X connect 28 0 10 2; diff --git a/externals/miXed/doc/help/cyclone/edge~-help.pd b/externals/miXed/doc/help/cyclone/edge~-help.pd new file mode 100644 index 000000000..cbeb63d12 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/edge~-help.pd @@ -0,0 +1,39 @@ +#N canvas 0 26 594 299 10; +#X text 15 35 Detect zero to non-zero signal transitions; +#X text 176 256 zero to non- zero transition; +#X floatatom 156 85 0 0 0 0 - - -; +#X obj 185 235 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 156 259 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 156 113 sig~; +#X text 199 80 change signal value above and below 1; +#X text 209 233 non-zero to zero transition; +#X obj 299 142 expr~; +#X obj 156 149 expr~ $v1>1; +#X obj 156 200 edge~; +#X obj 209 182 Snapshot~ 100; +#X obj 210 205 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256; +#N canvas 77 68 494 395 META 0; +#X text 12 65 PLATFORM windows macosx gnulinux; +#X text 12 195 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 165 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 12 5 KEYWORDS signal conversion max_compatible; +#X text 12 45 DESCRIPTION detect zero to non-zero signal transitions +; +#X text 12 85 INLET_0 signal; +#X text 12 105 OUTLET_0 bang; +#X text 12 125 OUTLET_1 bang; +#X text 12 25 LICENSE SIBSD; +#X text 12 145 AUTHOR Krzysztof Czaja; +#X restore 544 277 pd META; +#X connect 2 0 5 0; +#X connect 5 0 9 0; +#X connect 9 0 10 0; +#X connect 9 0 11 0; +#X connect 10 0 4 0; +#X connect 10 1 3 0; +#X connect 11 0 12 0; diff --git a/externals/miXed/doc/help/cyclone/flush-help.pd b/externals/miXed/doc/help/cyclone/flush-help.pd new file mode 100644 index 000000000..b9fbfa891 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/flush-help.pd @@ -0,0 +1,95 @@ +#N canvas 422 43 553 616 10; +#X obj -1 593 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 316 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 606 378 357 259 META 0; +#X text 10 164 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 20 LICENSE SIBSD; +#X text 10 146 AUTHOR Miller Puckette; +#X text 10 182 RELEASE_DATE 1997; +#X text 10 128 LIBRARY cyclone; +#X text 10 2 KEYWORDS note off notes held velocity; +#X text 10 38 DESCRIPTION provide not offs for held notes; +#X text 10 56 INLET_0 bang clear list float; +#X text 10 74 INLET_1 float; +#X text 10 92 OUTLET_0 float; +#X text 10 110 OUTLET_1 float; +#X text 10 200 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 502 595 pd META; +#X obj -1 446 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 513 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 339 574 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 6 28 midiin; +#X obj 51 28 midiout; +#X obj 102 28 notein; +#X obj 147 28 noteout; +#X obj 198 28 ctlin; +#X obj 238 28 ctlout; +#X obj 283 28 pgmin; +#X obj 322 28 pgmout; +#X obj 6 50 bendin; +#X obj 51 50 bendout; +#X restore 209 595 pd Related_objects; +#X obj 81 325 cnv 17 3 77 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 415 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header flush 3 12 0 18 +-204280 -1 0; +#X obj 510 6 flush; +#X text 11 23 provide note offs for held notes; +#X obj 93 232 flush; +#X msg 82 104 clear; +#X floatatom 93 281 5 0 0 0 - - -, f 5; +#X floatatom 120 260 5 0 0 0 - - -, f 5; +#X text 132 281 pitch; +#X msg 93 145 64 111; +#X text 156 259 velocity; +#X msg 65 64 bang; +#X text 118 104 clear pitch list; +#X text 136 145 list is treated as pitch/velocity pair; +#X floatatom 106 175 5 0 0 0 - - -, f 5; +#X floatatom 120 210 5 0 0 0 - - -, f 5; +#X text 140 174 pitch; +#X text 154 208 velocity; +#X text 105 63 send note off for all pitches for which only a noteon +was received; +#X text 109 324 bang; +#X text 183 324 - send note off for all pitches for which only a noteon +was received; +#X text 109 351 clear; +#X text 183 351 - clear pitch list; +#X text 109 368 list; +#X text 183 368 - pitch/velocity pair; +#X text 109 385 float; +#X text 183 385 - set pitch; +#X obj 81 455 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 109 415 float; +#X text 183 415 - set velocity; +#X text 92 532 1) float; +#X text 183 531 - pitch; +#X text 92 552 2) float; +#X text 183 551 - velocity; +#X obj 81 478 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 109 455 float; +#X text 183 455 - pitch; +#X text 183 478 - velocity; +#X text 109 478 float; +#X obj 12 594 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 13 0; +#X connect 11 1 14 0; +#X connect 12 0 11 0; +#X connect 16 0 11 0; +#X connect 18 0 11 0; +#X connect 21 0 11 0; +#X connect 22 0 11 1; diff --git a/externals/miXed/doc/help/cyclone/forward-help.pd b/externals/miXed/doc/help/cyclone/forward-help.pd new file mode 100644 index 000000000..11a1402a7 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/forward-help.pd @@ -0,0 +1,63 @@ +#N canvas 421 38 554 460 10; +#X obj -1 437 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 261 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 601 283 358 193 META 0; +#X text 11 109 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 19 LICENSE SIBSD; +#X text 11 91 AUTHOR Miller Puckette; +#X text 11 127 RELEASE_DATE 1997; +#X text 11 73 LIBRARY cyclone; +#X text 11 55 INLET_0 anything; +#X text 11 1 KEYWORDS send remote message; +#X text 11 37 DESCRIPTION send remote messages; +#X text 11 145 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 499 439 pd META; +#X obj 0 305 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 342 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 304 365 430 111 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 10 28 receive; +#X obj 62 28 send; +#X restore 207 439 pd Related_objects; +#X obj 79 274 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header forward 3 12 0 +18 -204280 -1 0; +#X text 11 23 send remote messages; +#X floatatom 334 173 5 0 0 0 - - -, f 5; +#X obj 47 206 forward foo; +#X floatatom 64 113 5 0 0 0 - - -, f 5; +#X msg 80 165 send bar; +#X obj 47 79 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X msg 80 146 send foo; +#X text 111 274 anything; +#X text 179 274 - thing to forward; +#X text 94 361 1) anything; +#X text 179 361 - initial message object holds to forward; +#X obj 499 6 forward; +#X text 65 79 bang; +#X text 101 113 number; +#X text 21 56 send anything from forward to receive:; +#X obj 334 147 receive foo; +#X text 122 207 arg matches receive's arg; +#X text 136 146 change where the command is sent; +#X floatatom 441 173 5 0 0 0 - - -, f 5; +#X obj 441 147 receive bar; +#X text 111 314 (none); +#X text 319 119 receive remotely gets the message; +#X obj 10 437 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 10 0; +#X connect 12 0 10 0; +#X connect 13 0 10 0; +#X connect 14 0 10 0; +#X connect 23 0 9 0; +#X connect 27 0 26 0; diff --git a/externals/miXed/doc/help/cyclone/frameaccum~-help.pd b/externals/miXed/doc/help/cyclone/frameaccum~-help.pd new file mode 100644 index 000000000..77eabe2b2 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/frameaccum~-help.pd @@ -0,0 +1,63 @@ +#N canvas 396 137 553 451 10; +#X obj -1 429 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 189 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 576 331 356 236 META 0; +#X text 7 61 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 -72 LICENSE SIBSD; +#X text 7 41 AUTHOR Miller Puckette; +#X text 7 81 RELEASE_DATE 1997; +#X text 7 21 LIBRARY cyclone; +#X text 7 -92 KEYWORDS signal frame phase deviation accumulated; +#X text 7 -52 DESCRIPTION computes running phase of successive phase +deviation frames; +#X text 7 -19 INLET_0 signal; +#X text 7 1 OUTLET_0 signal; +#X text 7 101 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 497 431 pd META; +#X obj -1 233 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 276 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 315 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 275 455 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 10 29 count~; +#X obj 58 29 framedelta~; +#X restore 201 431 pd Related_objects; +#X obj 82 201 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 82 242 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header frameaccum~ 3 12 +0 18 -204280 -1 0; +#X obj 476 6 frameaccum~; +#X obj 115 126 Snapshot~ 100; +#X obj 115 149 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 115 103 frameaccum~; +#X obj 115 80 sig~ 1; +#X text 113 200 signal; +#X text 182 200 - incoming signal vector; +#X text 113 242 signal; +#X text 182 238 - accumulated running phase of successive phase derivation +frames; +#X text 112 289 (none); +#X text 84 343 frameaccum~ accumulates each of the values of the previous +input signal vector from those of the current vector; +#X text 84 371 so \, when used in the context of a pfft~ patch (where +the FFT frame is the vector size) it can be used to compute the running +phase; +#X obj 483 49 pddp/dsp; +#X text 11 23 computes running phase of successive phase deviation +frames; +#X obj 3 431 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 12 0; +#X connect 13 0 11 0; +#X connect 14 0 13 0; diff --git a/externals/miXed/doc/help/cyclone/framedelta~-help.pd b/externals/miXed/doc/help/cyclone/framedelta~-help.pd new file mode 100644 index 000000000..e80f745db --- /dev/null +++ b/externals/miXed/doc/help/cyclone/framedelta~-help.pd @@ -0,0 +1,71 @@ +#N canvas 425 35 553 525 10; +#X obj -1 502 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 258 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 608 303 357 233 META 0; +#X text 7 154 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 21 LICENSE SIBSD; +#X text 7 134 AUTHOR Miller Puckette; +#X text 7 174 RELEASE_DATE 1997; +#X text 7 114 LIBRARY cyclone; +#X text 7 74 INLET_0 signal; +#X text 7 94 OUTLET_0 signal; +#X text 7 1 KEYWORDS signal phase deviation frames FFT; +#X text 7 41 DESCRIPTION computes the phase deviation between successive +FFT frames; +#X text 7 194 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 501 504 pd META; +#X obj -1 301 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 340 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 388 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 304 426 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 12 32 count~; +#X obj 64 32 frameaccum~; +#X restore 203 504 pd Related_objects; +#X obj 81 270 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 82 312 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header framedelta~ 3 12 +0 18 -204280 -1 0; +#X text 107 270 signal; +#X text 181 270 - incoming signal vector; +#X text 107 312 signal; +#X text 107 357 (none); +#X obj 476 5 framedelta~; +#X obj 238 88 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X text 74 82 bang to start the count ->; +#X obj 238 115 count~; +#X obj 237 158 framedelta~; +#X obj 237 182 Snapshot~ 100; +#X obj 237 212 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 131 158 Snapshot~ 100; +#X obj 131 212 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X text 181 312 - phase deviation between successive FFT frames; +#X text 96 435 so \, when used in the context of a pfft~ patch (where +the FFT frame is the vector size) it can be used to compute the phase +deviation; +#X text 95 406 framedelta~ subtracts each of the values of the previous +input signal vector from those of the current vector; +#X obj 484 48 pddp/dsp; +#X text 21 22 computes the phase deviation between successive FFT frames +; +#X obj 8 504 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 17 0; +#X connect 17 0 18 0; +#X connect 17 0 21 0; +#X connect 18 0 19 0; +#X connect 19 0 20 0; +#X connect 21 0 22 0; diff --git a/externals/miXed/doc/help/cyclone/fromsymbol-help.pd b/externals/miXed/doc/help/cyclone/fromsymbol-help.pd new file mode 100644 index 000000000..89576461c --- /dev/null +++ b/externals/miXed/doc/help/cyclone/fromsymbol-help.pd @@ -0,0 +1,89 @@ +#N canvas 427 36 564 598 10; +#X obj -1 571 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 330 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 604 372 364 234 META 0; +#X text 3 148 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 3 28 LICENSE SIBSD; +#X text 3 128 AUTHOR Miller Puckette; +#X text 3 168 RELEASE_DATE 1997; +#X text 3 108 LIBRARY cyclone; +#X text 3 188 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 3 8 KEYWORDS symbol transform messages numbers; +#X text 3 68 INLET_0 symbol list; +#X text 3 88 OUTLET_0 list; +#X text 3 48 DESCRIPTION transform symbol to numbers or messages; +#X restore 502 573 pd META; +#X obj -1 391 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 433 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 479 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 302 498 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 30 35 tosymbol; +#X obj 91 35 symbol; +#X restore 199 573 pd Related_objects; +#X obj 78 341 cnv 17 3 37 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 400 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header fromsymbol 3 12 +0 18 -204280 -1 0; +#X obj 482 4 fromsymbol; +#X obj 212 249 fromsymbol; +#X obj 254 190 tosymbol; +#X text 28 50 since pd lacks a quoting mechanism (like `foo bar`) there +is; +#X text 29 62 no support for spaces in symbols \, so the original max +way of; +#X text 28 74 using from/tosymbol won't work. One has to construct +symbols; +#X text 27 87 with other tools like; +#X obj 178 91 tosymbol; +#X obj 260 91 makesymbol; +#X text 241 87 or; +#X text 335 88 from zexy; +#X msg 254 164 this is a list of symbols; +#X symbolatom 254 216 25 0 0 0 - - -, f 25; +#X obj 212 276 print THIS_IS_A_LIST; +#X obj 34 209 fromsymbol; +#X msg 34 160 4; +#X obj 34 231 route float; +#X floatatom 34 258 5 0 0 0 - - -, f 5; +#X obj 34 187 tosymbol; +#X text 107 340 symbol; +#X text 170 340 - the symbal to be transformed; +#X text 107 362 list; +#X text 170 361 - list of symbols to be transformed; +#X text 107 399 list; +#X text 170 399 - symbols input can be transformed to numbers \, messages +\, etc.; +#X text 107 449 (none); +#X obj 114 515 pddp/pddplink @pd_help/all_about_lists_vs_anythings.pd -text +all_about_lists_vs_anythings; +#X obj 114 536 pddp/pddplink @pd_help/all_about_symbol_construction.pd -text +all_about_symbol_construction; +#X obj 114 494 pddp/pddplink @pd_help/all_about_data_types.pd -text all_about_data_types +; +#X text 27 136 works with symbols:; +#X text 243 136 also works with list of symbols:; +#X text 411 164 so this...; +#X text 410 210 ...becomes a symbol with spaces; +#X text 341 269 ...and can be transformed back into a list; +#X text 11 23 transform symbol to numbers or messages; +#X obj 7 571 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 23 0; +#X connect 12 0 11 0; +#X connect 12 0 22 0; +#X connect 21 0 12 0; +#X connect 24 0 26 0; +#X connect 25 0 28 0; +#X connect 26 0 27 0; +#X connect 28 0 24 0; diff --git a/externals/miXed/doc/help/cyclone/funbuff-help.pd b/externals/miXed/doc/help/cyclone/funbuff-help.pd new file mode 100644 index 000000000..a6e312633 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/funbuff-help.pd @@ -0,0 +1,200 @@ +#N canvas 420 34 554 614 10; +#X obj 1 1106 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 630 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 610 414 359 211 META 0; +#X text 6 108 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 6 -12 LICENSE SIBSD; +#X text 6 88 AUTHOR Miller Puckette; +#X text 6 128 RELEASE_DATE 1997; +#X text 6 68 LIBRARY cyclone; +#X text 6 148 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 6 -32 KEYWORDS store pairs x y together cartesian; +#X text 6 8 DESCRIPTION store x \, y pairs of numbers together; +#X text 6 28 INLET_0 message list float; +#X text 6 48 OUTLET_0 message list float; +#X restore 501 1108 pd META; +#X obj 1 892 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 1 1049 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 299 515 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 15 34 offer; +#X restore 202 1108 pd Related_objects; +#X obj 79 639 cnv 17 3 184 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 901 cnv 17 3 50 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header funbuff 3 12 0 +18 -204280 -1 0; +#X obj 501 4 funbuff; +#C restore; +#X msg 88 83 1 10 \, 2 20 \, 3 3.33; +#X floatatom 153 176 5 0 0 0 - - -, f 5; +#X obj 87 534 print funbuff; +#X msg 115 111 4 4.4; +#X text 210 81 store x y pairs; +#X msg 136 137 4 44.4; +#X text 179 135 replace a previously stored y value; +#X text 186 174 retrieve corresponding y value; +#X msg 29 322 clear; +#X text -3 303 erase contents; +#X msg 173 229 embed \$1; +#X obj 173 209 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X text 233 223 with nonzero arg the contents of the object are; +#X text 232 234 saved with the patch \, this is the default behaviour +; +#X msg 209 284 goto \$1; +#X floatatom 209 264 5 0 0 0 - - -, f 5; +#X text 262 268 jump to x position; +#X msg 213 307 next; +#X text 249 305 and output y val; +#X text 262 279 or next x > num; +#X msg 234 350 min; +#X msg 234 374 max; +#X text 263 352 output smallest; +#X text 263 375 or largest stored y val; +#X msg 31 377 write; +#X text 2 360 save contents; +#X msg 20 429 read; +#X text 2 412 load contents; +#X msg 298 448 read /tmp/test.funbuff; +#X msg 298 427 write /tmp/test.funbuff; +#X text 269 409 with filename as arg no dialog appears:; +#X obj 87 508 funbuff /tmp/test.funbuff; +#C restore; +#X text 109 659 list; +#X text 193 659 - list of x \, y pairs to store in buffer; +#X text 109 638 message; +#X text 109 680 float; +#X text 193 680 - input x to get corresponding y value; +#X text 193 638 - (float \, float) x \, y pair to store in buffer; +#X text 109 704 message; +#X text 193 720 write: save buffer contents to file; +#X text 192 736 read: load contents of buffer from file; +#X text 193 766 max: output largest stored y value; +#X text 193 751 min: output smallest y value; +#X text 193 781 goto x: goes to x position in buffer; +#X text 193 797 delete x y: delete x y pair from buffer; +#X text 193 812 dump: dump buffer contents in list; +#X text 109 917 message; +#X text 193 917 - print x \, y pair specified by input; +#X text 109 935 list; +#X text 193 935 - contents of buffer in x \, y pairs; +#X text 90 1064 1) /path/to/file; +#X text 201 1064 - load buffer from file; +#X text 201 1082 - buffer name to load; +#X text 193 899 - y value corresponding to input x value; +#X text 109 899 float; +#X text 90 1082 2) buffer; +#N canvas 576 142 320 440 more... 0; +#X obj 68 209 funbuff; +#C restore; +#X obj 68 240 print funbuff2; +#X msg 90 53 bang; +#X text 130 53 print status info; +#X msg 68 28 set 1 1 2 2.2 3 3.5; +#X text 46 11 another way to store pairs:; +#X msg 98 98 delete 1 1; +#X text 174 99 delete matching pair; +#X msg 105 120 delete 2; +#X text 168 122 delete pair where x=2; +#X msg 110 166 delete 3 4; +#X obj 64 356 funbuff; +#C restore; +#X obj 83 382 print funbuffY; +#X obj 64 409 print funbuffX; +#X msg 22 296 1 2 \, 3 4 \, 5 6 \, 7 8; +#X msg 64 324 dump; +#X text 144 295 load some vals; +#X text 96 323 and dump them; +#X text 178 164 no! we don't have it; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 4 0 0 0; +#X connect 6 0 0 0; +#X connect 8 0 0 0; +#X connect 10 0 0 0; +#X connect 11 0 13 0; +#X connect 11 1 12 0; +#X connect 14 0 11 0; +#X connect 15 0 11 0; +#X restore 418 571 pd more...; +#X text 11 22 store x \, y pairs of numbers together; +#X obj 7 1106 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X obj 79 839 cnv 17 3 41 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 109 838 float; +#X text 193 838 - y value to be stored (needs to be followed by an +xvalue in th first inlet; +#X obj 79 961 cnv 17 3 30 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 109 959 float; +#X text 247 507 optional argument sets initial filename to load; +#X text 193 704 clear: erase buffer contents; +#X text 193 959 - outputs difference between the currently outputted +value and the last outputted value; +#X obj 79 1000 cnv 17 3 30 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 109 998 bang; +#X text 193 998 - outputs bang when funbuff has reached the end of +its data list. See pd even_more... for additional info; +#N canvas 248 299 678 307 even_more... 0; +#X obj 119 161 funbuff; +#C restore; +#X msg 43 72 set 1 2 4 5 7 8 11 12 13 14; +#X text 39 55 load some values:; +#X msg 119 97 goto 0; +#X msg 141 128 next; +#X text 163 97 goto start; +#X floatatom 119 259 5 0 0 0 - - -, f 5; +#X text 154 258 y value; +#X floatatom 138 230 5 0 0 0 - - -, f 5; +#X obj 158 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 175 194 we reached the end ...; +#X obj 505 200 funbuff; +#C restore; +#X floatatom 544 117 5 0 0 0 - - -, f 5; +#X floatatom 505 170 5 0 0 0 - - -, f 5; +#X floatatom 505 248 5 0 0 0 - - -, f 5; +#X text 401 149 then x \, and use x to retrieve y:; +#X text 504 98 set y value first:; +#X text 38 27 the other outlets make sense too:; +#X text 399 32 and again another way to load data:; +#X text 174 129 hit this a couple of times; +#X text 173 229 difference between current and previous x value; +#X connect 0 0 6 0; +#X connect 0 1 8 0; +#X connect 0 2 9 0; +#X connect 1 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 11 0 14 0; +#X connect 12 0 11 1; +#X connect 13 0 11 0; +#X restore 418 594 pd even_more...; +#X connect 10 0 41 0; +#X connect 11 0 41 0; +#X connect 13 0 41 0; +#X connect 15 0 41 0; +#X connect 18 0 41 0; +#X connect 20 0 41 0; +#X connect 21 0 20 0; +#X connect 24 0 41 0; +#X connect 25 0 24 0; +#X connect 27 0 41 0; +#X connect 30 0 41 0; +#X connect 31 0 41 0; +#X connect 34 0 41 0; +#X connect 36 0 41 0; +#X connect 38 0 41 0; +#X connect 39 0 41 0; +#X connect 41 0 12 0; diff --git a/externals/miXed/doc/help/cyclone/funnel-help.pd b/externals/miXed/doc/help/cyclone/funnel-help.pd new file mode 100644 index 000000000..89ff90eb8 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/funnel-help.pd @@ -0,0 +1,79 @@ +#N canvas 424 36 558 464 10; +#X obj -1 311 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 160 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 587 259 382 213 META 0; +#X text 15 89 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 15 -31 LICENSE SIBSD; +#X text 15 69 AUTHOR Miller Puckette; +#X text 15 109 RELEASE_DATE 1997; +#X text 15 49 LIBRARY cyclone; +#X text 15 129 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 15 -51 KEYWORDS tag data inlet input; +#X text 15 -11 DESCRIPTION tag data based on the inlet it arrived in +; +#X text 15 9 INLET_0 anything bang; +#X text 15 29 OUTLET_0 anything; +#X restore 499 313 pd META; +#X obj 1 231 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 1 268 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 294 360 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 188 314 pd Related_objects; +#X obj 84 169 cnv 17 3 35 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj 84 240 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 -125 cnv 15 552 40 empty \$0-pddp.cnv.header funnel 3 12 +0 18 -204280 -1 0; +#X obj 503 -119 funnel; +#X obj 22 24 funnel 4; +#X floatatom 22 -58 5 0 0 0 - - -, f 5; +#X floatatom 22 114 5 0 0 0 - - -, f 5; +#X floatatom 79 86 5 0 0 0 - - -, f 5; +#X floatatom 37 -38 5 0 0 0 - - -, f 5; +#X floatatom 52 -19 5 0 0 0 - - -, f 5; +#X floatatom 67 0 5 0 0 0 - - -, f 5; +#X obj 351 48 funnel 2; +#X obj 351 85 print; +#X msg 396 17 list bar; +#X text 82 24 arg sets nr of inlets; +#X obj 102 -65 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 84 -65 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 126 -65 repeat last received value of the inlet; +#X msg 351 -7 list foo; +#X text 11 -102 tag data based on the inlet it arrived in; +#X text 113 168 anything; +#X text 183 168 - can have any data input into inlet; +#X text 113 240 anything; +#X text 183 240 - have items gathered by what inlet they came from +; +#X text 94 281 1) float; +#X text 183 281 - number of inlets; +#X text 113 187 bang; +#X text 183 187 - repeat last received value of the inlet; +#X obj 22 47 unpack f f; +#X text 58 115 inlet number; +#X text 116 86 value of inlet; +#X obj 13 312 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 34 0; +#X connect 11 0 10 0; +#X connect 14 0 10 1; +#X connect 15 0 10 2; +#X connect 16 0 10 3; +#X connect 17 0 18 0; +#X connect 19 0 17 1; +#X connect 21 0 10 3; +#X connect 22 0 10 2; +#X connect 24 0 17 0; +#X connect 34 0 12 0; +#X connect 34 1 13 0; diff --git a/externals/miXed/doc/help/cyclone/gate-help.pd b/externals/miXed/doc/help/cyclone/gate-help.pd new file mode 100644 index 000000000..25654d5e6 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/gate-help.pd @@ -0,0 +1,89 @@ +#N canvas 422 36 558 461 10; +#X obj 0 435 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 267 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 576 254 390 217 META 0; +#X text 12 99 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 12 -27 LICENSE SIBSD; +#X text 12 81 AUTHOR Miller Puckette; +#X text 12 117 RELEASE_DATE 1997; +#X text 12 63 LIBRARY cyclone; +#X text 12 135 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 12 -45 KEYWORDS data specific output gate; +#X text 12 -9 DESCRIPTION send data out the specified output; +#X text 12 9 INLET_0 bang float; +#X text 12 27 INLET_1 anything; +#X text 12 45 OUTLET_N anything; +#X restore 501 437 pd META; +#X obj 0 355 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 395 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 304 361 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 13 31 switch; +#X restore 201 437 pd Related_objects; +#X obj 87 276 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 87 326 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 0 2 cnv 15 552 40 empty \$0-pddp.cnv.header gate 3 12 0 18 -204280 +-1 0; +#X obj 516 4 gate; +#X text 12 25 send data out the specified output; +#X obj 151 155 gate 4; +#X text 205 155 arg = nr of outlets; +#X floatatom 193 111 5 0 0 0 - - -, f 5; +#X floatatom 151 74 5 0 0 0 - - -, f 5; +#X floatatom 151 234 5 0 0 0 - - -, f 5; +#X floatatom 165 215 5 0 0 0 - - -, f 5; +#X floatatom 179 196 5 0 0 0 - - -, f 5; +#X floatatom 193 177 5 0 0 0 - - -, f 5; +#X obj 382 161 gate 3; +#X obj 382 90 hradio 15 1 0 4 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X symbolatom 382 230 10 0 0 0 - - -, f 10; +#X symbolatom 398 208 10 0 0 0 - - -, f 10; +#X symbolatom 415 186 10 0 0 0 - - -, f 10; +#X msg 415 111 symbol foo; +#X msg 423 133 symbol bar; +#X text 383 70 works for other data types:; +#X msg 97 112 bang; +#X floatatom 95 181 5 0 0 0 - - -, f 5; +#X text 112 274 bang; +#X text 187 275 - report open outlet; +#X text 112 296 float; +#X text 187 296 - set open gate number (0 is closed); +#X obj 87 367 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X text 112 326 anything; +#X text 187 326 - data to send through gate; +#X text 112 367 anything; +#X text 94 409 1) float; +#X text 187 409 - number of outlets; +#X text 232 110 data to be sent; +#X text 11 105 hit to reportopen outlet; +#X text 18 175 reports the; +#X text 16 185 open outlet:; +#X text 185 66 send data to which outlet? 0 = closed; +#X obj 12 435 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X text 187 366 - data from inlet 1 \, for only the open outlet; +#X connect 11 0 15 0; +#X connect 11 0 28 0; +#X connect 11 1 16 0; +#X connect 11 2 17 0; +#X connect 11 3 18 0; +#X connect 13 0 11 1; +#X connect 14 0 11 0; +#X connect 19 0 21 0; +#X connect 19 1 22 0; +#X connect 19 2 23 0; +#X connect 20 0 19 0; +#X connect 24 0 19 1; +#X connect 25 0 19 1; +#X connect 27 0 11 0; diff --git a/externals/miXed/doc/help/cyclone/grab-help.pd b/externals/miXed/doc/help/cyclone/grab-help.pd new file mode 100644 index 000000000..4f96840f9 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/grab-help.pd @@ -0,0 +1,99 @@ +#N canvas 426 35 561 587 10; +#X obj -1 558 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 410 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 621 373 355 223 META 0; +#X text 7 42 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 -78 LICENSE SIBSD; +#X text 7 22 AUTHOR Miller Puckette; +#X text 7 62 RELEASE_DATE 1997; +#X text 7 2 LIBRARY cyclone; +#X text 7 82 HELP_PATCH_AUTHORS Alex Cleveland updated this patch for +Pd-l2ork version 2013.05.28; +#X text 7 -98 KEYWORDS intercept output grab; +#X text 7 -58 DESCRIPTION intercept the output of another object; +#X text 7 -38 INLET_0 message; +#X text 7 -18 OUTLET_N message; +#X restore 501 560 pd META; +#X obj -1 451 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 488 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 326 487 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 14 32 offer; +#X restore 213 560 pd Related_objects; +#X obj 83 420 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 82 460 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header grab 3 12 0 18 +-204280 -1 0; +#X obj 516 5 grab; +#X text 11 23 intercept the output of another object; +#X msg 115 84 hello; +#X obj 271 102 r foo; +#X obj 271 125 print foo; +#X msg 133 108 set bar; +#X msg 153 133 let's go; +#X obj 341 102 r bar; +#X obj 341 125 print bar; +#X text 157 83 1; +#X text 184 106 2; +#X text 209 133 3; +#X obj 115 176 grab 0 foo; +#X text 191 167 arg is number of additional outlets and; +#X text 191 181 an optional receive object to send it's; +#X text 191 192 input to; +#X text 110 53 can be used as a sort of settable send:; +#X obj 43 292 grab; +#X obj 64 322 * 10; +#X floatatom 64 351 5 0 0 0 - - -, f 5; +#X floatatom 43 373 5 0 0 0 - - -, f 5; +#X msg 43 266 2; +#X text 115 231 or to intercept messages before they are output; +#X text 116 243 by the receiving object:; +#X floatatom 85 301 5 0 0 0 - - -, f 5; +#X obj 268 322 grab 2 test; +#X obj 381 323 r test; +#X floatatom 268 365 5 0 0 0 - - -, f 5; +#X text 94 498 1) float; +#X text 94 530 2) object; +#X text 183 530 - optional received object to send input to; +#X obj 3 560 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X floatatom 331 365 5 0 0 0 - - -, f 5; +#X text 96 321 < this is forwarded below without being outputted +; +#X obj 436 316 loadbang; +#X msg 436 337 1 2 \, 3 4 \, 5 6; +#X msg 268 296 1; +#X obj 381 364 coll; +#C restore; +#X text 303 271 here output from coll's 1stand 2nd outlets correspond +tograb object's outlets; +#X text 111 420 anything; +#X text 111 460 anything; +#X text 183 420 - anything that is sent to grab output; +#X text 183 460 - anything that was grabbed from the object; +#X text 183 498 - optional number of additional outlets (corresponding +to grabbed object's outlets); +#X connect 11 0 21 0; +#X connect 12 0 13 0; +#X connect 14 0 21 0; +#X connect 15 0 21 0; +#X connect 16 0 17 0; +#X connect 26 0 29 0; +#X connect 26 1 27 0; +#X connect 27 0 28 0; +#X connect 30 0 26 0; +#X connect 33 0 27 1; +#X connect 34 0 36 0; +#X connect 34 1 41 0; +#X connect 35 0 46 0; +#X connect 43 0 44 0; +#X connect 44 0 46 0; +#X connect 45 0 34 0; diff --git a/externals/miXed/doc/help/cyclone/index~-help.pd b/externals/miXed/doc/help/cyclone/index~-help.pd new file mode 100644 index 000000000..95fdab4bb --- /dev/null +++ b/externals/miXed/doc/help/cyclone/index~-help.pd @@ -0,0 +1,125 @@ +#N canvas 423 35 559 376 10; +#X obj -1 347 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 229 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 591 163 378 222 META 0; +#X text 11 59 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 -61 LICENSE SIBSD; +#X text 11 39 AUTHOR Miller Puckette; +#X text 11 79 RELEASE_DATE 1997; +#X text 11 19 LIBRARY cyclone; +#X text 11 -21 INLET_0 signal; +#X text 11 -1 OUTLET_0 signal; +#X text 11 99 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 11 -81 KEYWORDS signal interpolation playback sample; +#X text 11 -41 DESCRIPTION sample playback without interpolation; +#X restore 502 349 pd META; +#X obj -1 268 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 305 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 301 275 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 196 349 pd Related_objects; +#X obj 85 239 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 85 278 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header index~ 3 12 0 18 +-204280 -1 0; +#X obj 501 2 index~; +#X text 11 23 sample playback without interpolation; +#X floatatom 275 159 0 0 100 0 - - -; +#N canvas 159 26 532 285 output 0; +#X obj 338 160 t b; +#X obj 338 110 f; +#X obj 338 60 inlet; +#X text 344 29 mute; +#X obj 338 185 f; +#X msg 426 180 0; +#X msg 338 85 bang; +#X obj 338 135 moses 1; +#X obj 397 110 moses 1; +#X obj 83 148 dbtorms; +#X obj 397 85 r master-lvl; +#X obj 83 42 r master-lvl; +#X obj 338 210 s master-lvl; +#X obj 20 155 inlet~; +#X obj 199 41 inlet; +#X text 199 18 level; +#X obj 199 105 s master-lvl; +#X msg 96 65 set \$1; +#X obj 96 90 outlet; +#X msg 214 65 \; pd dsp 1; +#X obj 83 198 line~; +#X obj 20 207 *~; +#X obj 20 232 dac~; +#X obj 83 173 pack 0 50; +#X text 20 132 audio; +#X text 96 114 show level; +#X obj 426 155 t b; +#X obj 20 181 hip~ 1; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 12 0; +#X connect 5 0 12 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 26 0; +#X connect 8 1 4 1; +#X connect 9 0 23 0; +#X connect 10 0 1 1; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 17 0; +#X connect 13 0 27 0; +#X connect 14 0 16 0; +#X connect 14 0 19 0; +#X connect 17 0 18 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 21 0 22 1; +#X connect 23 0 20 0; +#X connect 26 0 5 0; +#X connect 27 0 21 0; +#X restore 250 182 pd output; +#X msg 301 159 MUTE; +#X obj 35 165 table sample; +#X obj 35 87 openpanel; +#X msg 35 112 read -resize \$1 sample; +#X obj 35 137 soundfiler; +#X obj 35 62 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 53 62 load a sample; +#X obj 250 131 index~ sample; +#X obj 250 102 count~; +#X obj 250 75 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 267 75 playback sample at current srate; +#X obj 35 193 table foo; +#X msg 298 102 set foo; +#X text 347 101 set another table; +#X text 110 238 signal; +#X text 177 238 - signal to sample playback; +#X text 110 277 signal; +#X text 177 320 - sample to playback; +#X text 177 277 - signal without interpolation; +#X text 93 320 1) table; +#X obj 481 49 pddp/dsp; +#X obj 7 347 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 12 1; +#X connect 12 0 11 0; +#X connect 13 0 12 2; +#X connect 15 0 16 0; +#X connect 16 0 17 0; +#X connect 18 0 15 0; +#X connect 20 0 12 0; +#X connect 21 0 20 0; +#X connect 22 0 21 0; +#X connect 25 0 20 0; diff --git a/externals/miXed/doc/help/cyclone/iter-help.pd b/externals/miXed/doc/help/cyclone/iter-help.pd new file mode 100644 index 000000000..6a53eb9fc --- /dev/null +++ b/externals/miXed/doc/help/cyclone/iter-help.pd @@ -0,0 +1,62 @@ +#N canvas 422 37 558 370 10; +#X obj -1 343 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 202 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 597 167 366 215 META 0; +#X text 10 -74 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 -194 LICENSE SIBSD; +#X text 10 -94 AUTHOR Miller Puckette; +#X text 10 -54 RELEASE_DATE 1997; +#X text 10 -114 LIBRARY cyclone; +#X text 10 -34 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 -214 KEYWORDS split list series; +#X text 10 -174 DESCRIPTION split a list into a series of data; +#X text 10 -154 INLET_0 list float; +#X text 10 -134 OUTLET_0 float; +#X restore 499 345 pd META; +#X obj -1 258 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 300 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 302 272 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 199 345 pd Related_objects; +#X obj 79 213 cnv 17 3 33 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 271 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header iter 3 12 0 18 +-204280 -1 0; +#X obj 514 2 iter; +#X text 107 212 list; +#X text 107 231 float; +#X text 179 231 - floats just pass through; +#X text 107 271 float; +#X text 107 314 (none); +#X obj 40 123 iter; +#X msg 40 91 1 2 3 4; +#X obj 40 155 print; +#X obj 417 123 iter; +#X floatatom 417 91 5 0 0 0 - - -, f 5; +#X floatatom 417 155 5 0 0 0 - - -, f 5; +#X obj 232 123 iter; +#X obj 232 155 print; +#X msg 232 91 foo bar del mar; +#X text 11 23 split a list into a series of data; +#X text 404 61 single floats just pass through; +#X text 12 61 works for lists of numbers; +#X text 218 61 and for lists of words; +#X text 179 212 - list to split into series of data; +#X text 179 271 - series of data from input list; +#X obj 15 344 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 17 0; +#X connect 16 0 15 0; +#X connect 18 0 20 0; +#X connect 19 0 18 0; +#X connect 21 0 22 0; +#X connect 23 0 21 0; diff --git a/externals/miXed/doc/help/cyclone/kink~-help.pd b/externals/miXed/doc/help/cyclone/kink~-help.pd new file mode 100644 index 000000000..2bbb27586 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/kink~-help.pd @@ -0,0 +1,106 @@ +#N canvas 423 36 565 505 10; +#X obj -120 618 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 +0 14 -233017 -33289 0; +#X obj -122 313 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 +13 -228856 -1 0; +#N canvas 596 277 371 239 META 0; +#X text 9 162 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 9 22 LICENSE SIBSD; +#X text 9 142 AUTHOR Miller Puckette; +#X text 9 182 RELEASE_DATE 1997; +#X text 9 122 LIBRARY cyclone; +#X text 9 62 INLET_0 signal; +#X text 9 102 OUTLET_0 signal; +#X text 9 202 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 9 2 KEYWORDS signal kink distort phasor; +#X text 9 42 DESCRIPTION distort the output of a phasor~; +#X text 9 82 INLET_1 float signal; +#X restore 380 620 pd META; +#X obj -121 388 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 +0 13 -228856 -1 0; +#X obj -121 425 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 +12 0 13 -228856 -1 0; +#X obj -121 467 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info +8 12 0 13 -228856 -1 0; +#N canvas 307 406 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 81 620 pd Related_objects; +#X obj -44 322 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -43 397 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -123 -265 cnv 15 552 40 empty \$0-pddp.cnv.header kink~ 3 12 +0 18 -204280 -1 0; +#X obj -44 345 cnv 17 3 33 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X obj 387 -263 kink~; +#X text -111 -243 Distort the output of a phasor~; +#X msg 11 164 triglevel 0.01; +#X msg 131 163 4 64; +#X obj 71 -23 - 1; +#X obj 56 4 +~; +#X msg 55 -112 1 \, 10 180 10 120 1 700; +#X obj 55 -83 line~ 1; +#X obj 219 154 dac~; +#X obj 219 123 *~ 0.05; +#X obj 208 90 cycle~; +#X floatatom 71 -45 0 0 0 0 - - -; +#X obj 3 -182 phasor~ 440; +#X text -67 -184 phase input; +#X text 251 88 use as table lookup; +#X text 65 39 argument sets initial slope value (default 1.0); +#X obj 4 40 kink~ 1.3; +#X obj 208 206 Scope~ 126 86 4 3 128 -1 1 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 3 207 Scope~ 129 84 4 3 128 -1 1 0 0 0 0.01 102 255 51 135 135 +135 0; +#X obj 11 132 loadbang; +#X text -13 321 signal; +#X text 56 321 - phasor to kink; +#X text -28 474 kink~ takes phasor~ values and distorts them according +to a slope factor. If the input times the slope is less than 0.5 \, +that value is output. Otherwise \, a complentary slope is used \, equal +to 0.5 at the same input value but equal to 1 when the input is 1 This +creates a bend or "kink" in the phase waveform when the slope is not +equal to 1 If you feed the output of kink~ into a cycle~ \, the result +is that the first part (before the kink) of the wavetable is scanned +much more quickly than the second part (after the kink). Can you say +CZ-101? Sure you can.; +#X text -13 345 float; +#X text 56 348 - slope input; +#X text -13 361 signal; +#X text -13 396 signal; +#X text -31 443 1) float; +#X text 56 444 - initial slope; +#X text 56 396 - distorted phasor output; +#X obj 361 -216 pddp/dsp; +#X text 201 -119 This ramps the slope from 1 to 10 and then back to +1 Combine with an amplitude envelope to achieve BRASS ENS. 1 bliss. +; +#X text 99 -53 try different slope values (approx 1-20). Reset to +1 to use the envelope above.; +#X text 51 -142 slope input (float or signal):; +#X text -87 200 distorted phase output; +#X text 56 366 comment; +#X obj -109 619 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage +Guide; +#X connect 13 0 29 0; +#X connect 14 0 28 0; +#X connect 14 0 29 0; +#X connect 15 0 16 1; +#X connect 16 0 27 1; +#X connect 17 0 18 0; +#X connect 18 0 16 0; +#X connect 20 0 19 0; +#X connect 20 0 19 1; +#X connect 21 0 20 0; +#X connect 21 0 28 0; +#X connect 22 0 15 0; +#X connect 23 0 27 0; +#X connect 27 0 21 1; +#X connect 27 0 29 0; +#X connect 30 0 14 0; +#X connect 30 0 13 0; diff --git a/externals/miXed/doc/help/cyclone/linedrive-help.pd b/externals/miXed/doc/help/cyclone/linedrive-help.pd new file mode 100644 index 000000000..efaf99daf --- /dev/null +++ b/externals/miXed/doc/help/cyclone/linedrive-help.pd @@ -0,0 +1,91 @@ +#N canvas 417 33 560 495 10; +#X obj -1 752 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 400 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 599 265 368 237 META 0; +#X text 8 123 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 8 -17 LICENSE SIBSD; +#X text 8 103 AUTHOR Miller Puckette; +#X text 8 143 RELEASE_DATE 1997; +#X text 8 83 LIBRARY cyclone; +#X text 8 163 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 8 -37 KEYWORDS scale exponential line; +#X text 8 3 DESCRIPTION scale numbers exponentially for use with line~ +; +#X text 8 63 OUTLET_0 float; +#X text 8 23 INLET_0 message; +#X text 8 43 INLET_1 float; +#X restore 501 754 pd META; +#X obj -1 464 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 504 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 581 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 297 394 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 39 42 line~; +#X restore 202 754 pd Related_objects; +#X obj 78 410 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 436 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header linedrive 3 12 +0 18 -204280 -1 0; +#X obj 483 2 linedrive; +#X text 11 23 scale numbers exponentially for use with line~; +#X obj 10 318 snapshot~; +#X obj 10 235 metro 10; +#X obj 10 95 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 10 345 10 0 0 0 - - -, f 10; +#X text 105 69 integer message as input; +#X msg 105 91 60; +#X obj 105 165 linedrive 127 1 1.06 30; +#X text 204 239 outputs two values which can be sent to line~ as a +destination and a time in milliseconds; +#X obj 70 280 line~ 0; +#X floatatom 240 101 5 0 0 0 - - -, f 5; +#X msg 70 91 0; +#X obj 105 247 print linedrive; +#X text 106 410 message; +#X text 106 436 float; +#X text 178 436 - time value in milliseconds; +#X text 106 477 float; +#X text 178 477 - scaled number; +#X obj 78 477 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 251 160 argument1 is the reference input (int) \; argument2 +is the reference output (float) \; argument3 is the base value (float) +\; argument4 is the time value in milliseconds (int); +#X text 98 519 1) is the reference input (int) \; 2) is the reference +output (float) \; 3) is the base value (float 4) is the time value +in milliseconds (int); +#X text 93 713 The output is a list of two values \, the second one +being equal to argument4 and can be sent directly to a line~ 0; +#X text 93 600 The [linedrive] object converts integers for use with +line~. Linedrive takes integers ranging from -argument1 to +argument1 +and scales them to fall within the range -argument2 to +argument2. +If the input equals argument1 \, the output is equal to argument value2. +Output varies exponentially with the input depending on argument3. +With the arguments shown \, input values between 0 and 127 are converted +from 2*dB to linear amplitude with 127 becoming 1; +#X text 274 94 integer message to change last argument \, which is +time in milliseconds; +#X text 178 410 - integer message as input; +#X obj 480 48 pddp/dsp; +#X obj 13 752 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 15 0; +#X connect 13 0 12 0; +#X connect 14 0 13 0; +#X connect 17 0 18 0; +#X connect 18 0 20 0; +#X connect 18 0 23 0; +#X connect 20 0 12 0; +#X connect 21 0 18 1; +#X connect 22 0 20 0; diff --git a/externals/miXed/doc/help/cyclone/loadmess-help.pd b/externals/miXed/doc/help/cyclone/loadmess-help.pd new file mode 100644 index 000000000..441f6957e --- /dev/null +++ b/externals/miXed/doc/help/cyclone/loadmess-help.pd @@ -0,0 +1,99 @@ +#N canvas 700 23 564 664 10; +#X obj 6 614 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#N canvas 616 310 382 346 META 0; +#X text 0 19 LICENSE SIBSD; +#X text 0 133 LIBRARY cyclone; +#X text 0 38 DESCRIPTION fold or wrap a signal within a given range +; +#X text 1 153 VERSION 0.2-beta1; +#X text 1 171 AUTHOR Krzysztof Czaja; +#X text 2 189 RELEASE_DATE 2002; +#X text 3 208 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 3 240 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X text 0 76 INLET_1 flaot; +#X text 0 95 INLET_2 float; +#X text 0 57 INLET_0 float/list; +#X text 0 114 OUTLET_0 float; +#X text 0 0 KEYWORDS range limiter (fold \, wrap \, clip); +#X restore 507 616 pd META; +#X obj 6 452 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 6 499 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#N canvas 312 452 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 203 619 pd Related_objects; +#X obj 84 357 cnv 17 3 75 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 84 462 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 6 39 cnv 15 552 40 empty empty loadmess 3 12 0 18 -204280 -1 +0; +#X obj 6 346 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#X obj 6 550 cnv 3 550 3 empty empty attributes 8 12 0 13 -228856 -1 +0; +#X obj 96 225 loadmess bob; +#X obj 96 259 print; +#X obj 355 241 print; +#X obj 212 235 print; +#X obj 501 47 loadmess; +#X text 24 62 Send a message when a patch is loaded; +#X text 134 357 bang; +#X text 139 390 set; +#X text 178 356 - Sending a bang message to a loadmess object causes +it to output its typed message.; +#X text 180 462 - The loadmess object's loaded message is sent when +the patch is loaded or when banged/clicked.; +#X text 180 514 - message to be sent (default "bang").; +#X obj 64 180 bng 18 250 50 0 empty empty empty 17 7 0 10 -228856 -1 +-1; +#X text 147 561 @defer <int> (default: 0): When enabled \, the output +of the loadmess object is deferred (a loadmess with @defer 0 will be +sent before and have priority over @defer 1); +#X text 93 515 1) anything; +#X text 110 462 anything; +#X msg 116 196 set bob; +#X text 110 299 Double-click on [loadmess] to output its loaded message! +; +#X obj 212 206 loadmess foo 99 bar; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 5 3 pd; +#X msg 96 170 set blah 5 2 1 \, bang; +#X obj 355 206 loadmess 3 4 @defer 1; +#X msg 355 174 set 1 2; +#X msg 418 173 set 3 4; +#X text 79 97 [loadmess] outputs a message automatically when the patch +is loaded \, or when the patch is part of another file that is opened. +; +#X text 180 390 - The word set followed by any message will set the +message held by loadmess without any output (can be used for output +in conjunction with bang).; +#X connect 10 0 11 0; +#X connect 21 0 10 0; +#X connect 25 0 10 0; +#X connect 27 0 13 0; +#X connect 29 0 10 0; +#X connect 30 0 12 0; +#X connect 31 0 30 0; +#X connect 32 0 30 0; diff --git a/externals/miXed/doc/help/cyclone/lookup~-help.pd b/externals/miXed/doc/help/cyclone/lookup~-help.pd new file mode 100644 index 000000000..7b534488f --- /dev/null +++ b/externals/miXed/doc/help/cyclone/lookup~-help.pd @@ -0,0 +1,142 @@ +#N canvas 420 35 558 525 10; +#X obj -1 498 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 299 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 598 274 365 259 META 0; +#X text 15 181 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 15 21 LICENSE SIBSD; +#X text 15 161 AUTHOR Miller Puckette; +#X text 15 201 RELEASE_DATE 1997; +#X text 15 141 LIBRARY cyclone; +#X text 15 121 OUTLET_0 signal; +#X text 15 221 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 15 81 INLET_1 float; +#X text 15 1 KEYWORDS signal transfer function lookup table; +#X text 15 41 DESCRIPTION transfer function lookup table; +#X text 15 61 INLET_0 signal; +#X text 15 101 INLET_2 float; +#X restore 502 500 pd META; +#X obj -1 400 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 437 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 305 422 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 208 500 pd Related_objects; +#X obj 86 308 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 86 338 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header lookup~ 3 12 0 +18 -204280 -1 0; +#X obj 499 5 lookup~; +#X text 11 23 transfer function lookup table; +#X obj 29 198 table sample; +#X obj 29 124 openpanel; +#X msg 29 149 read -resize \$1 sample; +#X obj 29 174 soundfiler; +#X obj 29 88 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 55 100 load a sample; +#X floatatom 246 240 0 0 100 0 - - -; +#N canvas 159 26 532 285 output 0; +#X obj 338 160 t b; +#X obj 338 110 f; +#X obj 338 60 inlet; +#X text 344 29 mute; +#X obj 338 185 f; +#X msg 426 180 0; +#X msg 338 85 bang; +#X obj 338 135 moses 1; +#X obj 397 110 moses 1; +#X obj 83 148 dbtorms; +#X obj 397 85 r master-lvl; +#X obj 83 42 r master-lvl; +#X obj 338 210 s master-lvl; +#X obj 20 155 inlet~; +#X obj 199 41 inlet; +#X text 199 18 level; +#X obj 199 105 s master-lvl; +#X msg 96 65 set \$1; +#X obj 96 90 outlet; +#X msg 214 65 \; pd dsp 1; +#X obj 83 198 line~; +#X obj 20 207 *~; +#X obj 20 232 dac~; +#X obj 83 173 pack 0 50; +#X text 20 132 audio; +#X text 96 114 show level; +#X obj 426 155 t b; +#X obj 20 181 hip~ 1; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 12 0; +#X connect 5 0 12 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 26 0; +#X connect 8 1 4 1; +#X connect 9 0 23 0; +#X connect 10 0 1 1; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 17 0; +#X connect 13 0 27 0; +#X connect 14 0 16 0; +#X connect 14 0 19 0; +#X connect 17 0 18 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 21 0 22 1; +#X connect 23 0 20 0; +#X connect 26 0 5 0; +#X connect 27 0 21 0; +#X restore 221 262 pd output; +#X msg 272 240 MUTE; +#X floatatom 221 93 5 0 0 0 - - -, f 5; +#X obj 221 205 lookup~ sample 111; +#X floatatom 273 160 5 0 0 0 - - -, f 5; +#X floatatom 326 180 5 0 0 0 - - -, f 5; +#X obj 221 122 osc~ 0.2; +#X text 220 69 play with it a little:; +#X text 309 159 offset; +#X text 359 180 scale input; +#X msg 296 107 set sample; +#X text 363 106 change array; +#X text 117 307 signal; +#X text 182 307 - signal to do transfer function lookup; +#X obj 86 369 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj 86 410 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 117 338 float; +#X text 117 369 float; +#X text 182 338 - offset; +#X text 182 369 - scale input; +#X text 100 451 1) table; +#X text 182 451 - sample to start with; +#X text 100 469 2) float; +#X text 182 469 - initial offset in sample; +#X text 117 410 signal; +#X text 182 410 - ouput of transfer function lookup; +#X obj 479 52 pddp/dsp; +#X text 334 200 arg is an array and an (optional) offset; +#X obj 14 500 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 13 0; +#X connect 13 0 14 0; +#X connect 15 0 12 0; +#X connect 17 0 18 1; +#X connect 18 0 17 0; +#X connect 19 0 18 2; +#X connect 20 0 24 0; +#X connect 21 0 18 0; +#X connect 22 0 21 1; +#X connect 23 0 21 2; +#X connect 24 0 21 0; +#X connect 28 0 21 0; diff --git a/externals/miXed/doc/help/cyclone/lores~-help.pd b/externals/miXed/doc/help/cyclone/lores~-help.pd new file mode 100644 index 000000000..38b5e1525 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/lores~-help.pd @@ -0,0 +1,90 @@ +#N canvas 423 39 566 594 10; +#X obj -1 619 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 316 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 610 338 360 272 META 0; +#X text 10 186 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 26 LICENSE SIBSD; +#X text 10 166 AUTHOR Miller Puckette; +#X text 10 206 RELEASE_DATE 1997; +#X text 10 146 LIBRARY cyclone; +#X text 10 126 OUTLET_0 signal; +#X text 10 226 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 6 KEYWORDS signal filter low-pass resonance; +#X text 10 46 DESCRIPTION low-pass filter with resonance; +#X text 10 106 INLET_2 signal float; +#X text 10 86 INLET_1 signal float; +#X text 10 66 INLET_0 signal; +#X restore 504 621 pd META; +#X obj -1 438 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 475 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 534 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 310 494 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 207 621 pd Related_objects; +#X obj 78 320 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 349 cnv 17 3 33 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header lores~ 3 12 0 18 +-204280 -1 0; +#X obj 502 7 lores~; +#X text 11 23 Low-pass filter with resonance; +#X msg 221 137 200 \, 2000 500 200 1000; +#X floatatom 194 187 0 0 0 0 - - -; +#X floatatom 150 113 0 0 0 0 - - -; +#X msg 150 138 \$1 30; +#X obj 150 162 line~ 200; +#X obj 107 278 dac~; +#X obj 107 248 *~ 0.15; +#X obj 107 75 phasor~ 150; +#X text 218 187 resonance (signal or float); +#X text 107 56 harmonically rich input source; +#X text 145 97 set cutoff frequency; +#X text 222 122 filter sweep; +#X obj 107 219 lores~ 200 0.75; +#X text 111 320 signal; +#X text 178 320 - signal to go through low-pass filter with resonance +; +#X obj 78 395 cnv 17 3 33 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 111 346 signal; +#X text 178 356 - set cutoff frequency; +#X obj 78 442 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 111 392 signal; +#X text 111 411 float; +#X text 178 400 - set resonance; +#X text 93 538 lores~ implements a cheap lowpass with an adjustment +that lets you add the resonance you've been looking for. The middle +inlet sets a kind of cutoff frequency \, but the sharpness of the filter +depends on the resonance. 0 is a little bit sharp and 1 as sharp as +you're going to get.; +#X text 111 441 signal; +#X text 178 441 - output of filer; +#X text 93 487 1) float; +#X text 178 489 - initial cutoff frequency (default 0); +#X text 93 507 2) float; +#X text 178 507 - intial resonance (default 0); +#X obj 481 49 pddp/dsp; +#X text 111 368 float; +#X text 206 212 arguments for initial cutoff frequency (default 0) +and resonance (default 0); +#X obj 17 620 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 16 0; +#X connect 13 0 24 2; +#X connect 14 0 15 0; +#X connect 15 0 16 0; +#X connect 16 0 24 1; +#X connect 18 0 17 0; +#X connect 18 0 17 1; +#X connect 19 0 24 0; +#X connect 24 0 18 0; diff --git a/externals/miXed/doc/help/cyclone/match-help.pd b/externals/miXed/doc/help/cyclone/match-help.pd new file mode 100644 index 000000000..4e586f155 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/match-help.pd @@ -0,0 +1,67 @@ +#N canvas 419 39 561 478 10; +#X obj 2 449 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 315 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 589 249 370 239 META 0; +#X text 11 146 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 26 LICENSE SIBSD; +#X text 11 126 AUTHOR Miller Puckette; +#X text 11 166 RELEASE_DATE 1997; +#X text 11 106 LIBRARY cyclone; +#X text 11 186 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 11 6 KEYWORDS series match list; +#X text 11 46 DESCRIPTION look for a series of numbers; +#X text 11 66 INLET_0 list; +#X text 11 86 OUTLET_0 list; +#X restore 502 451 pd META; +#X obj 2 354 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 2 391 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 302 378 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 203 451 pd Related_objects; +#X obj 82 326 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 82 363 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header match 3 12 0 18 +-204280 -1 0; +#X obj 511 6 match; +#X text 11 23 look for a series of numbers and output as a list; +#X floatatom 140 260 5 0 0 0 - - -, f 5; +#X floatatom 174 246 5 0 0 0 - - -, f 5; +#X obj 140 207 unpack f f f; +#X floatatom 209 233 5 0 0 0 - - -, f 5; +#X obj 140 185 match 100 nn 2; +#X msg 140 78 100 50 4; +#X msg 158 102 100 50 2; +#X msg 170 145 set nn nn 4; +#X text 246 143 look for a new series; +#X text 233 177 creation args are the series to look for; +#X text 232 189 'nn' can be used as a wildcard to match; +#X text 232 200 any number; +#X text 116 326 list; +#X text 99 406 1) list; +#X text 179 405 - list of numbers to match \, nn can be used as wildcard +for any number; +#X text 179 363 - list of floats that match; +#X text 179 326 - list of floats search for matches; +#X msg 88 130 clear; +#X text 24 129 forget all; +#X text 205 77 input list to check against the match series; +#X text 116 363 list; +#X obj 16 451 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 13 0 11 0; +#X connect 13 1 12 0; +#X connect 13 2 14 0; +#X connect 15 0 13 0; +#X connect 16 0 15 0; +#X connect 17 0 15 0; +#X connect 18 0 15 0; +#X connect 28 0 15 0; diff --git a/externals/miXed/doc/help/cyclone/matrix~-help.pd b/externals/miXed/doc/help/cyclone/matrix~-help.pd new file mode 100644 index 000000000..a721731a8 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/matrix~-help.pd @@ -0,0 +1,130 @@ +#N canvas 420 35 559 584 10; +#X obj 0 895 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 389 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 613 364 351 231 META 0; +#X text -16 143 WEBSITE http://crca.ucsd.edu/~msp/; +#X text -16 23 LICENSE SIBSD; +#X text -16 123 AUTHOR Miller Puckette; +#X text -16 163 RELEASE_DATE 1997; +#X text -16 103 LIBRARY cyclone; +#X text -16 183 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text -16 3 KEYWORDS signal switching matrix mixing; +#X text -16 43 DESCRIPTION a switching or mixing matrix for signals +; +#X text -16 63 INLET_N signal message; +#X text -16 83 OUTLET_N signal list; +#X restore 500 897 pd META; +#X obj 2 468 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 524 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 2 755 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 309 485 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 212 897 pd Related_objects; +#X obj 79 398 cnv 17 3 33 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj 80 479 cnv 17 3 33 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header matrix~ 3 12 0 +18 -204280 -1 0; +#X text 11 23 a switching or mixing matrix for signals; +#X obj 70 354 dac~; +#X obj 70 326 *~ 0.15; +#X obj 108 297 *~ 0.15; +#X obj 71 249 matrix~ 6 2 1; +#X obj 70 93 osc~ 111; +#X obj 87 117 osc~ 222; +#X obj 102 142 osc~ 333; +#X obj 116 167 osc~ 444; +#X obj 131 190 osc~ 555; +#X obj 146 215 osc~ 666; +#X obj 146 274 print dump; +#X msg 60 59 dump; +#X text 95 55 <-- outputs the current gains of all connections out +the rightmost outlet \, in lists like this: inlet# outlet# gain; +#X text 110 396 signal; +#X text 179 396 - signals to mix or switch; +#X text 110 416 message; +#X text 110 478 signal; +#X text 179 417 - dump: outputs the current gains of all connections +out the rightmost outlet in list: inlet # \, outlet# \, gain; +#X text 179 478 - mixed or switched singals from inlets; +#X text 91 560 2) float - argument is the number of signal outlets +; +#X text 91 539 1) float - argument is the number of inlets; +#X text 91 579 3) float - argument is optional \, a 1 turns on "mix +mode" \, otherwise the default is "switch mode"; +#X text 91 682 mix mode:; +#X text 91 614 switch mode:; +#X text 108 627 By default \, [matrix~] is in "switch mode". In switch +mode \, the connections are either on or off. This can cause audible +clicks when switching (Max/MSP calls this "binary mode").; +#X text 108 694 "mix mode" mixes the incoming signals using the values +from the incoming list to specify the gain \, so they can change the +amplitude based on that number. mix mode requires more CPU time. (Max/MSP +calls this "non-binary mode").; +#X text 95 783 If you want to specify the gain of each connection \, +you must use three- or four-element list messages rather than the 'connect' +message. Connections formed with the 'connect' message always have +a gain specified by the third argument initially given to the object. +However \, subsequent list messages can alter the gain of connections +formed with the 'connect' message.; +#X text 110 498 list; +#X text 179 498 - last outlet dumps all info in list; +#X obj 464 4 matrix~ 1 1 1; +#X obj 480 50 pddp/dsp; +#N canvas 966 197 468 311 more... 0; +#X msg 273 47 connect 0 2; +#X text 243 48 i.e.; +#X text 243 88 i.e.; +#X msg 273 87 disconnect 0 2; +#X text 69 101 disconnect inlet# from outlet#; +#X text 54 11 Inlets and outlets are numbered from left to right \, +starting at zero (i.e. hot inlets are 0).; +#X text 72 64 connect inlet# to outlet#; +#X text 243 128 i.e.; +#X msg 273 127 0 2 0.5; +#X text 69 142 if gain is non-zero \, connect inlet# to outlet#. If +gain is zero \, disconnect inlet# from outlet#; +#X msg 343 127 0 2 0; +#X text 243 178 i.e.; +#X msg 273 177 0 2 0.5 500; +#X msg 363 177 0 2 0 1000; +#X text 69 194 connect inlet# to outlet# with "gain" using "ramptime" +in milliseconds; +#X msg 264 277 clear; +#X text 243 228 i.e.; +#X text 69 247 sets the default time in milliseconds used to change +"gain" when in mix mode; +#X msg 273 227 ramp 500; +#X msg 353 227 ramp 1000; +#X text 53 278 clear - remove all connections.; +#X text 53 227 ramp ramptime; +#X text 53 177 inlet# outlet# gain ramptime; +#X text 53 127 inlet# outlet# gain; +#X text 53 87 disconnect inlet# outlet#; +#X text 53 47 connect inlet# outlet#; +#X restore 346 293 pd more...; +#X text 179 445 - connect \, disconnect \, ramp: as specified in pd +more...; +#X obj 16 893 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 11 0; +#X connect 13 0 11 1; +#X connect 14 0 12 0; +#X connect 14 1 13 0; +#X connect 14 2 21 0; +#X connect 15 0 14 0; +#X connect 16 0 14 1; +#X connect 17 0 14 2; +#X connect 18 0 14 3; +#X connect 19 0 14 4; +#X connect 20 0 14 5; +#X connect 22 0 14 0; diff --git a/externals/miXed/doc/help/cyclone/maximum-help.pd b/externals/miXed/doc/help/cyclone/maximum-help.pd new file mode 100644 index 000000000..8d9cebf83 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/maximum-help.pd @@ -0,0 +1,70 @@ +#N canvas 428 34 558 520 10; +#X obj -1 493 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 293 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 615 292 368 238 META 0; +#X text 8 154 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 8 14 LICENSE SIBSD; +#X text 8 134 AUTHOR Miller Puckette; +#X text 8 174 RELEASE_DATE 1997; +#X text 8 114 LIBRARY cyclone; +#X text 8 194 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 8 74 INLET_1 float; +#X text 8 -6 KEYWORDS max maximum greatesst list; +#X text 8 34 DESCRIPTION output the greatest in a list of numbers; +#X text 8 54 INLET_0 list bang float; +#X text 8 94 OUTLET_0 float; +#X restore 504 495 pd META; +#X obj -1 407 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 444 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 287 353 457 172 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 55 55 minimum; +#X restore 198 495 pd Related_objects; +#X obj 80 302 cnv 17 3 49 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 370 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header maximum 3 12 0 +18 -204280 -1 0; +#X obj 493 2 maximum; +#X text 11 23 output the greatest in a list of numbers; +#X msg 86 71 1 2 3 4 3 2; +#X floatatom 86 243 5 0 0 0 - - -, f 5; +#X msg 104 101 bang; +#X floatatom 117 134 5 0 0 0 - - -, f 5; +#X floatatom 137 180 5 0 0 0 - - -, f 5; +#X text 172 179 set current value; +#X text 153 128 output if higher than current value \,; +#X text 152 140 otherwise output current val; +#X text 116 301 list; +#X text 180 301 - list of numbers to get maximum value; +#X text 116 318 bang; +#X text 138 102 send most recent output again; +#X text 180 318 - send most recent output again; +#X text 116 336 float; +#X text 180 336 - output if higher than current value \, otherwise +output current max; +#X obj 80 416 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 116 370 float; +#X text 180 370 - set current max; +#X text 116 415 float; +#X text 180 415 - the stored maximum value; +#X text 99 460 1) float; +#X text 180 460 - initial maximum; +#X obj 86 208 maximum 5; +#X text 150 208 optional argument sets initial maximum; +#X obj 14 494 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 33 0; +#X connect 13 0 33 0; +#X connect 14 0 33 0; +#X connect 15 0 33 1; +#X connect 33 0 12 0; diff --git a/externals/miXed/doc/help/cyclone/maximum~-help.pd b/externals/miXed/doc/help/cyclone/maximum~-help.pd new file mode 100644 index 000000000..3567b349d --- /dev/null +++ b/externals/miXed/doc/help/cyclone/maximum~-help.pd @@ -0,0 +1,71 @@ +#N canvas 419 34 558 469 10; +#X obj -1 442 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 286 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 604 234 360 245 META 0; +#X text 10 168 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 28 LICENSE SIBSD; +#X text 10 148 AUTHOR Miller Puckette; +#X text 10 188 RELEASE_DATE 1997; +#X text 10 128 LIBRARY cyclone; +#X text 10 108 OUTLET_0 signal; +#X text 10 208 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 8 KEYWORDS signal max maximum; +#X text 10 48 DESCRIPTION output the maximum of two signals; +#X text 10 68 INLET_0 signal; +#X text 10 88 INLET_1 signal; +#X restore 501 444 pd META; +#X obj -1 354 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 391 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 274 305 457 172 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 55 55 minimum; +#X restore 205 444 pd Related_objects; +#X obj 81 295 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 323 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header maximum~ 3 12 0 +18 -204280 -1 0; +#X obj 81 363 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 11 23 output the maximum of two signals; +#X obj 488 5 maximum~; +#X obj 351 137 cycle~ 3.14; +#X obj 306 112 cycle~ 2; +#X obj 305 164 maximum~; +#X obj 305 198 Scope~ 125 63 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 46 162 maximum~ 0.5; +#X obj 46 123 sig~; +#X floatatom 46 93 5 0 0 0 - - -, f 5; +#X obj 46 187 Snapshot~ 100; +#X obj 46 214 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X text 109 295 signal; +#X text 109 323 signal; +#X text 109 363 signal; +#X text 180 363 - signal with max value between the two signals output +; +#X obj 479 49 pddp/dsp; +#X text 284 75 outputs the current maximum of two input signals:; +#X text 127 152 optional argument sets initial maximum; +#X text 91 409 1) float; +#X text 180 409 - set the initial maximum; +#X text 180 323 - signal to compare maximum; +#X text 180 295 - signal to compare maximum; +#X obj 15 444 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 14 1; +#X connect 13 0 14 0; +#X connect 14 0 15 0; +#X connect 16 0 19 0; +#X connect 17 0 16 0; +#X connect 18 0 17 0; +#X connect 19 0 20 0; diff --git a/externals/miXed/doc/help/cyclone/maxmode-help.pd b/externals/miXed/doc/help/cyclone/maxmode-help.pd new file mode 100644 index 000000000..f27898967 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/maxmode-help.pd @@ -0,0 +1,70 @@ +#N canvas 418 36 561 600 10; +#X obj 0 572 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 451 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 608 371 354 239 META 0; +#X text 10 152 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 32 LICENSE SIBSD; +#X text 10 132 AUTHOR Miller Puckette; +#X text 10 172 RELEASE_DATE 1997; +#X text 10 112 LIBRARY cyclone; +#X text 10 192 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 12 KEYWORDS import max Max MSP patch mode; +#X text 10 52 DESCRIPTION import tool for Max/MSP patches; +#X text 10 72 INLET_0 message; +#X text 10 92 OUTLET_0 message; +#X restore 500 574 pd META; +#X obj 1 492 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 1 529 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 303 499 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 574 pd Related_objects; +#X obj 79 460 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 501 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header maxmode 3 12 0 +18 -204280 -1 0; +#X obj 500 6 maxmode; +#X text 11 23 import tool for Max/MSP patches; +#X text 145 59 simulate mouse click to open panel; +#X obj 182 323 print mode; +#X msg 197 185 set max; +#X msg 204 206 set barry; +#X msg 207 261 bang; +#X msg 193 164 set; +#X obj 144 386 print result; +#X msg 206 239 get; +#X obj 172 350 pddp/print; +#X obj 133 413 pddp/print; +#X msg 133 80 click 0 0 0 0 0; +#X msg 149 109 cd path; +#X msg 162 131 pwd path; +#X text 201 110 set open panel directory; +#X text 220 131 set current and open panel directory; +#X text 109 460 message; +#X text 179 460 - see above; +#X text 109 501 message; +#X text 179 501 - output of import; +#X text 109 545 (none); +#X obj 133 290 maxmode; +#X obj 14 572 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 13 0 31 0; +#X connect 14 0 31 0; +#X connect 15 0 31 0; +#X connect 16 0 31 0; +#X connect 18 0 31 0; +#X connect 21 0 31 0; +#X connect 22 0 31 0; +#X connect 23 0 31 0; +#X connect 31 0 17 0; +#X connect 31 0 20 0; +#X connect 31 1 12 0; +#X connect 31 1 19 0; diff --git a/externals/miXed/doc/help/cyclone/mean-help.pd b/externals/miXed/doc/help/cyclone/mean-help.pd new file mode 100644 index 000000000..e404a23ba --- /dev/null +++ b/externals/miXed/doc/help/cyclone/mean-help.pd @@ -0,0 +1,74 @@ +#N canvas 421 34 559 534 10; +#X obj -1 506 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 333 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 596 317 370 225 META 0; +#X text 8 148 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 8 22 LICENSE SIBSD; +#X text 8 130 AUTHOR Miller Puckette; +#X text 8 166 RELEASE_DATE 1997; +#X text 8 112 LIBRARY cyclone; +#X text 8 184 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 8 4 KEYWORDS average list mean; +#X text 8 40 DESCRIPTION find the running average of a stream of numbers +; +#X text 8 58 INLET_0 list float message; +#X text 8 94 OUTLET_1 float; +#X text 8 76 OUTLET_0 float; +#X restore 502 508 pd META; +#X obj -1 398 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 458 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 307 431 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 206 508 pd Related_objects; +#X obj 80 342 cnv 17 3 47 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 431 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header mean 3 12 0 18 +-204280 -1 0; +#X obj 518 4 mean; +#X text 11 23 find the running average of a stream of numbers; +#X floatatom 95 278 5 0 0 0 - - -, f 5; +#X obj 95 217 mean; +#X floatatom 123 104 5 0 0 0 - - -, f 5; +#X obj 146 191 line; +#X msg 95 70 clear; +#X msg 146 166 0 \, 1 1000; +#X msg 135 136 1 2 3 4 5; +#X floatatom 116 247 5 0 0 0 - - -, f 5; +#X text 154 241 total no of values included in the; +#X text 154 256 averaging process; +#X text 135 279 mean; +#X text 107 341 list; +#X text 180 341 - list of numbers to take avg; +#X text 107 358 float; +#X text 180 358 - number to add running average; +#X text 107 373 message; +#X text 180 373 - clear: clear avg \, start over; +#X text 107 408 float; +#X text 180 408 - running average; +#X text 107 476 (none); +#X obj 80 408 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 107 431 float; +#X text 180 431 - total number of values processed; +#X text 199 135 list of numbers to average; +#X text 211 164 creates list of numbers; +#X text 131 68 clear average; +#X text 159 103 number to add to running average; +#X obj 11 508 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 11 0; +#X connect 12 1 18 0; +#X connect 13 0 12 0; +#X connect 14 0 12 0; +#X connect 15 0 12 0; +#X connect 16 0 14 0; +#X connect 17 0 12 0; diff --git a/externals/miXed/doc/help/cyclone/midiflush-help.pd b/externals/miXed/doc/help/cyclone/midiflush-help.pd new file mode 100644 index 000000000..9f9bb03bc --- /dev/null +++ b/externals/miXed/doc/help/cyclone/midiflush-help.pd @@ -0,0 +1,60 @@ +#N canvas 422 39 558 440 10; +#X obj 0 244 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 83 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 598 213 366 240 META 0; +#X text 11 153 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 20 LICENSE SIBSD; +#X text 11 133 AUTHOR Miller Puckette; +#X text 11 173 RELEASE_DATE 1997; +#X text 11 113 LIBRARY cyclone; +#X text 11 193 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 11 0 KEYWORDS note midi notes raw stream; +#X text 11 40 DESCRIPTION send note offs for all hanging notes in a +raw midi stream; +#X text 11 73 INLET_0 midi stream message; +#X text 11 93 OUTLET_0 midi strean; +#X restore 505 246 pd META; +#X obj 0 161 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 198 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 306 343 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 203 246 pd Related_objects; +#X obj 81 93 cnv 17 3 33 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 170 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -168 cnv 15 552 40 empty \$0-pddp.cnv.header midiflush 3 12 +0 18 -204280 -1 0; +#X text 12 -145 send note offs for all hanging notes in a raw midi +stream; +#X obj 90 2 midiflush; +#X obj 90 -106 midiin; +#X obj 90 41 midiout; +#X text 155 -6 passes data on unchanged \, upon bang sends note; +#X text 154 9 off for all notes it did not see a note off for; +#X msg 155 -43 bang; +#X msg 139 -68 clear; +#X text 192 -43 send note offs; +#X text 179 -68 forget all previous notes \, no note off; +#X text 112 91 midi stream; +#X text 215 91 - midi stream to flush; +#X text 112 110 message; +#X text 215 110 - bang: send note offs; +#X text 112 170 midi stream; +#X text 215 170 - modified flushed midistream; +#X text 112 214 (none); +#X obj 490 -163 midiflush; +#X text 215 127 - clear: forget all previous notes \, no note off; +#X obj 13 246 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 12 0; +#X connect 11 0 10 0; +#X connect 15 0 10 0; +#X connect 16 0 10 0; diff --git a/externals/miXed/doc/help/cyclone/midiformat-help.pd b/externals/miXed/doc/help/cyclone/midiformat-help.pd new file mode 100644 index 000000000..177311414 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/midiformat-help.pd @@ -0,0 +1,102 @@ +#N canvas 419 36 558 588 10; +#X obj -1 561 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 312 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 608 279 356 320 META 0; +#X text 10 244 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 28 LICENSE SIBSD; +#X text 10 226 AUTHOR Miller Puckette; +#X text 10 262 RELEASE_DATE 1997; +#X text 10 208 LIBRARY cyclone; +#X text 10 280 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 64 INLET_0 message; +#X text 10 82 INLET_1 message; +#X text 10 100 INLET_2 message; +#X text 10 118 INLET_3 float; +#X text 10 136 INLET_4 float; +#X text 10 172 INLET_6 float; +#X text 10 154 INLET_5 float; +#X text 10 190 OUTLET_0 midi message; +#X text 10 46 DESCRIPTION de/construct midi messages; +#X text 10 10 KEYWORDS midi messages construct format; +#X restore 503 563 pd META; +#X obj -1 480 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 521 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 307 486 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 209 563 pd Related_objects; +#X obj 84 453 cnv 17 3 17 empty \$0-pddp.cnv.let.0 6 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header midiformat 3 12 +0 18 -204280 -1 0; +#X obj 450 8 midiformat; +#X text 11 23 de/construct midi messages; +#X obj 105 247 midiformat 5; +#X text 200 248 arg is channelnumber; +#X msg 105 61 88 127; +#X obj 105 281 midiout; +#X msg 119 87 90 88; +#X text 160 89 aftertouch/pitch pairs make poly aftertouch messages +; +#X msg 133 115 70 7; +#X floatatom 147 143 5 0 0 0 - - -, f 5; +#X text 182 142 program change message; +#X floatatom 161 166 5 0 0 0 - - -, f 5; +#X text 195 164 aftertouch; +#X floatatom 175 192 5 0 0 0 - - -, f 5; +#X text 209 190 pitch bend; +#X floatatom 189 218 5 0 0 0 - - -, f 5; +#X text 223 217 channel number (wraps around like n%16); +#X text 115 453 float; +#X obj 84 489 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 84 342 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 84 364 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj 84 387 cnv 17 3 17 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X text 115 387 float; +#X obj 84 408 cnv 17 3 17 empty \$0-pddp.cnv.let.0 4 5 9 0 16 -228856 +-162280 0; +#X text 115 408 float; +#X obj 84 430 cnv 17 3 17 empty \$0-pddp.cnv.let.0 5 5 9 0 16 -228856 +-162280 0; +#X text 115 430 float; +#X obj 84 320 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 115 320 message; +#X text 115 342 message; +#X text 115 364 message; +#X text 152 61 pitch/velocity pairs make noteon messages; +#X text 213 320 - pitch/velocity pairs make noteon messages; +#X text 213 342 - aftertouch/pitch pairs make poly aftertouch messages +; +#X text 164 115 controller val/ controller nr make control messages +; +#X text 213 364 - controller val/ controller nr make control messages +; +#X text 213 387 - program change message; +#X text 213 408 - aftertouch; +#X text 213 430 - pitch bend; +#X text 213 453 - channel number (wraps like n%16); +#X text 115 488 midi message; +#X text 213 489 - midi message based on inlets; +#X text 97 532 1) float; +#X text 213 532 - channel number; +#X obj 12 562 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 13 0; +#X connect 12 0 10 0; +#X connect 14 0 10 1; +#X connect 16 0 10 2; +#X connect 17 0 10 3; +#X connect 19 0 10 4; +#X connect 21 0 10 5; +#X connect 23 0 10 6; diff --git a/externals/miXed/doc/help/cyclone/midiparse-help.pd b/externals/miXed/doc/help/cyclone/midiparse-help.pd new file mode 100644 index 000000000..163350a93 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/midiparse-help.pd @@ -0,0 +1,116 @@ +#N canvas 422 34 559 612 10; +#X obj -1 703 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 446 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 616 314 352 306 META 0; +#X text 8 213 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 8 -3 LICENSE SIBSD; +#X text 8 195 AUTHOR Miller Puckette; +#X text 8 231 RELEASE_DATE 1997; +#X text 8 177 LIBRARY cyclone; +#X text 8 249 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 8 -21 KEYWORDS midi deconstruct parse note; +#X text 8 15 DESCRIPTION deconstruct midi messages; +#X text 8 33 INLET_0 midi message; +#X text 8 51 OUTLET_0 list; +#X text 8 69 OUTLET_1 list; +#X text 8 87 OUTLET_2 list; +#X text 8 105 OUTLET_3 float; +#X text 8 123 OUTLET_4 float; +#X text 8 141 OUTLET_5 float; +#X text 8 159 OUTLET_6 float; +#X restore 498 705 pd META; +#X obj -1 485 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 663 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 310 512 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 705 pd Related_objects; +#X obj 75 632 cnv 17 3 17 empty \$0-pddp.cnv.let.0 6 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header midiparse 3 12 +0 18 -204280 -1 0; +#X text 114 632 float; +#X obj 75 456 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 75 521 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 75 543 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj 75 566 cnv 17 3 17 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X text 114 566 float; +#X obj 75 587 cnv 17 3 17 empty \$0-pddp.cnv.let.0 4 5 9 0 16 -228856 +-162280 0; +#X text 114 587 float; +#X obj 75 609 cnv 17 3 17 empty \$0-pddp.cnv.let.0 5 5 9 0 16 -228856 +-162280 0; +#X text 114 609 float; +#X obj 75 499 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 210 499 - pitch/velocity pairs make noteon messages; +#X text 210 521 - aftertouch/pitch pairs make poly aftertouch messages +; +#X text 210 543 - controller val/ controller nr make control messages +; +#X text 210 566 - program change message; +#X text 210 587 - aftertouch; +#X text 210 609 - pitch bend; +#X text 210 632 - channel number (wraps like n%16); +#X text 114 455 midi message; +#X obj 446 6 midiparse; +#X text 11 23 deconstruct midi messages; +#X obj 143 91 midiparse; +#X obj 143 64 midiin; +#X obj 143 363 unpack f f; +#X floatatom 143 390 5 0 0 0 - - -, f 5; +#X floatatom 200 390 5 0 0 0 - - -, f 5; +#X text 142 406 pitch; +#X text 199 407 velocity; +#X text 225 363 note on messages; +#X obj 157 288 unpack f f; +#X floatatom 157 315 5 0 0 0 - - -, f 5; +#X floatatom 214 315 5 0 0 0 - - -, f 5; +#X text 156 330 aftert; +#X text 214 332 pitch; +#X text 235 288 poly aftertouch messages; +#X obj 171 217 unpack f f; +#X floatatom 171 243 5 0 0 0 - - -, f 5; +#X floatatom 228 243 5 0 0 0 - - -, f 5; +#X text 170 258 value; +#X text 228 258 ctrl nr; +#X text 250 217 controller messages; +#X floatatom 185 185 5 0 0 0 - - -, f 5; +#X floatatom 199 163 5 0 0 0 - - -, f 5; +#X floatatom 213 140 5 0 0 0 - - -, f 5; +#X floatatom 227 117 5 0 0 0 - - -, f 5; +#X text 232 185 program change; +#X text 258 141 pitch bend; +#X text 244 165 aftertouch; +#X text 270 116 channel number; +#X text 114 499 list; +#X text 114 521 list; +#X text 114 543 list; +#X text 210 456 - midi message to parse; +#X text 114 675 (none); +#X obj 12 704 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 29 0 31 0; +#X connect 29 1 37 0; +#X connect 29 2 43 0; +#X connect 29 3 49 0; +#X connect 29 4 50 0; +#X connect 29 5 51 0; +#X connect 29 6 52 0; +#X connect 30 0 29 0; +#X connect 31 0 32 0; +#X connect 31 1 33 0; +#X connect 37 0 38 0; +#X connect 37 1 39 0; +#X connect 43 0 44 0; +#X connect 43 1 45 0; diff --git a/externals/miXed/doc/help/cyclone/minimum-help.pd b/externals/miXed/doc/help/cyclone/minimum-help.pd new file mode 100644 index 000000000..39bd98a8b --- /dev/null +++ b/externals/miXed/doc/help/cyclone/minimum-help.pd @@ -0,0 +1,71 @@ +#N canvas 424 35 559 486 10; +#X obj -1 459 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 280 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 621 249 351 245 META 0; +#X text 10 158 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 18 LICENSE SIBSD; +#X text 10 138 AUTHOR Miller Puckette; +#X text 10 178 RELEASE_DATE 1997; +#X text 10 118 LIBRARY cyclone; +#X text 10 198 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 78 INLET_1 float; +#X text 10 58 INLET_0 list bang float; +#X text 10 98 OUTLET_0 float; +#X text 10 -2 KEYWORDS min minimum least smallest list; +#X text 10 38 DESCRIPTION output the smallest in a list of numbers +; +#X restore 504 461 pd META; +#X obj -1 375 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 412 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 309 323 426 172 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 55 55 minimum; +#X restore 203 461 pd Related_objects; +#X obj 80 289 cnv 17 3 45 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 350 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header minimum 3 12 0 +18 -204280 -1 0; +#X text 115 288 list; +#X text 115 303 bang; +#X text 180 303 - send most recent output again; +#X text 115 319 float; +#X obj 80 385 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 115 350 float; +#X text 115 385 float; +#X text 97 428 1) float; +#X obj 497 6 minimum; +#X text 11 23 output the smallest in a list of numbers; +#X msg 111 65 1 2 3 4 3 2; +#X floatatom 111 237 5 0 0 0 - - -, f 5; +#X msg 132 99 bang; +#X text 166 100 send most recent output again; +#X floatatom 145 126 5 0 0 0 - - -, f 5; +#X floatatom 162 174 5 0 0 0 - - -, f 5; +#X text 209 174 set current value; +#X text 182 134 otherwise output current val; +#X text 183 122 output if lower than current value \,; +#X text 180 288 - list of numbers to get min value; +#X text 180 319 - output if lower than current value \, otherwise output +current min; +#X text 180 350 - set current min; +#X text 180 385 - the stored minimum value; +#X text 180 428 - initial minimum to compare to left outlet; +#X obj 111 202 minimum 5; +#X text 176 203 optional argument sets initial minimum; +#X obj 18 460 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 19 0 33 0; +#X connect 21 0 33 0; +#X connect 23 0 33 0; +#X connect 24 0 33 1; +#X connect 33 0 20 0; diff --git a/externals/miXed/doc/help/cyclone/minimum~-help.pd b/externals/miXed/doc/help/cyclone/minimum~-help.pd new file mode 100644 index 000000000..ab79827bc --- /dev/null +++ b/externals/miXed/doc/help/cyclone/minimum~-help.pd @@ -0,0 +1,71 @@ +#N canvas 420 37 559 487 10; +#X obj -1 458 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 303 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 607 226 360 268 META 0; +#X text 10 153 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 13 LICENSE SIBSD; +#X text 10 133 AUTHOR Miller Puckette; +#X text 10 173 RELEASE_DATE 1997; +#X text 10 113 LIBRARY cyclone; +#X text 10 93 OUTLET_0 signal; +#X text 10 193 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 53 INLET_0 signal; +#X text 10 73 INLET_1 signal; +#X text 10 -7 KEYWORDS signal min minimum; +#X text 10 33 DESCRIPTION output the minimum of two signals; +#X restore 504 460 pd META; +#X obj -1 370 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 407 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 284 324 457 172 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 55 55 minimum; +#X restore 211 460 pd Related_objects; +#X obj 82 314 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 82 341 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header minimum~ 3 12 0 +18 -204280 -1 0; +#X obj 82 381 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 114 314 signal; +#X text 114 341 signal; +#X text 114 381 signal; +#X obj 491 7 minimum~; +#X text 11 23 output the minimum of two signals; +#X obj 353 152 cycle~ 3.14; +#X obj 309 123 cycle~ 2; +#X obj 308 179 maximum~; +#X obj 307 216 Scope~ 125 58 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 50 122 sig~; +#X floatatom 50 92 5 0 0 0 - - -, f 5; +#X obj 50 186 Snapshot~ 100; +#X obj 50 213 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 50 161 minimum~ 0.5; +#X text 185 314 - signal to comparse minium; +#X text 185 341 - signal to comparse minimum; +#X text 185 381 - signal with min value between the two signals output +; +#X obj 482 51 pddp/dsp; +#X text 185 426 - set the initial minimum; +#X text 96 425 1) float; +#X text 296 83 outputs the current minimum of two input signals:; +#X text 129 151 optional argument sets initial minimum; +#X obj 14 460 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 17 1; +#X connect 16 0 17 0; +#X connect 17 0 18 0; +#X connect 19 0 23 0; +#X connect 20 0 19 0; +#X connect 21 0 22 0; +#X connect 23 0 21 0; diff --git a/externals/miXed/doc/help/cyclone/minmax~-help.pd.pd b/externals/miXed/doc/help/cyclone/minmax~-help.pd.pd new file mode 100644 index 000000000..17c8b6864 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/minmax~-help.pd.pd @@ -0,0 +1,50 @@ +#N canvas 0 26 440 469 10; +#X obj 6 5 cnv 15 400 40 empty empty empty 20 12 0 14 -262130 -66577 +0; +#X text 16 428 docs based on the MAX/MSP reference (c) cycling'74; +#X text 15 442 ___________________________________________________ +; +#X floatatom 109 295 5 0 0 1 min - -; +#X msg 21 124 bang; +#N canvas 247 115 494 397 META 0; +#X text 12 235 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 205 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 12 55 DESCRIPTION compute the minimu and maximum values of +a signal; +#X text 12 85 INLET_0 bang signal reset; +#X text 12 105 OUTLET_0 signal; +#X text 12 125 OUTLET_1 signal; +#X text 12 145 OUTLET_2 float; +#X text 12 165 OUTLET_3 float; +#X text 12 5 KEYWORDS control max_compatible needs_work ([minmax~] +"Help" doesn't find this help patch); +#X text 12 35 LICENSE SIBSD; +#X text 12 185 AUTHOR Krzysztof Czaja; +#X restore 390 448 pd META; +#X obj 24 36 minmax~; +#X text 99 35 compute the minimum and maximum values of a signal; +#X obj 83 251 minmax~; +#X obj 84 212 osc~ 440; +#X floatatom 122 274 5 0 0 1 max - -; +#X msg 59 169 reset; +#X text 55 125 send values corresponding to the minimum and maximum +signal values out the two rightmost outlets.; +#X text 103 169 reset the current min and max values to the default +(0); +#X obj 96 332 snapshot~; +#X obj 82 374 snapshot~; +#X floatatom 96 355 5 0 0 1 max - -; +#X floatatom 82 397 5 0 0 1 min - -; +#X text 153 353 (since startup or last reset message); +#X text 142 397 (since startup or last reset message); +#X connect 4 0 8 0; +#X connect 8 0 15 0; +#X connect 8 1 14 0; +#X connect 8 2 3 0; +#X connect 8 3 10 0; +#X connect 9 0 8 0; +#X connect 11 0 8 0; +#X connect 14 0 16 0; +#X connect 15 0 17 0; diff --git a/externals/miXed/doc/help/cyclone/mousefilter-help.pd b/externals/miXed/doc/help/cyclone/mousefilter-help.pd new file mode 100644 index 000000000..76a4a69f8 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/mousefilter-help.pd @@ -0,0 +1,55 @@ +#N canvas 418 34 559 433 10; +#X obj -1 406 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 261 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 603 219 356 221 META 0; +#X text 11 138 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 18 LICENSE SIBSD; +#X text 11 118 AUTHOR Miller Puckette; +#X text 11 158 RELEASE_DATE 1997; +#X text 11 98 LIBRARY cyclone; +#X text 11 178 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 11 -2 KEYWORDS mouse mousebutton pass filter; +#X text 11 38 DESCRIPTION passes numbers only when mousebutton is up +; +#X text 11 58 INLET_0 float list; +#X text 11 78 OUTLET_0 float; +#X restore 499 408 pd META; +#X obj -1 319 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 357 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 301 331 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 201 408 pd Related_objects; +#X obj 79 270 cnv 17 3 37 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 77 330 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header mousefilter 3 12 +0 18 -204280 -1 0; +#X obj 471 8 mousefilter; +#X text 11 23 passes numbers only when mousebutton is up; +#X obj 148 104 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X floatatom 132 70 5 0 0 0 - - -, f 5; +#X obj 132 148 mousefilter; +#X floatatom 153 183 5 0 0 0 - - -, f 5; +#X obj 132 211 print; +#X text 109 269 float; +#X text 179 269 - number to pass; +#X text 109 291 list; +#X text 179 291 - list of numbers to pass; +#X text 109 330 float; +#X text 179 330 - numbers passed from inlet if mousebutton is up; +#X text 109 376 (none); +#X obj 17 407 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 13 0; +#X connect 12 0 13 0; +#X connect 13 0 14 0; +#X connect 13 0 15 0; diff --git a/externals/miXed/doc/help/cyclone/mstosamps~-help.pd b/externals/miXed/doc/help/cyclone/mstosamps~-help.pd new file mode 100644 index 000000000..ac6f054ca --- /dev/null +++ b/externals/miXed/doc/help/cyclone/mstosamps~-help.pd @@ -0,0 +1,72 @@ +#N canvas 427 34 558 489 10; +#X obj -1 461 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 287 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 620 258 359 239 META 0; +#X text 7 105 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 -35 LICENSE SIBSD; +#X text 7 85 AUTHOR Miller Puckette; +#X text 7 125 RELEASE_DATE 1997; +#X text 7 65 LIBRARY cyclone; +#X text 7 145 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 7 25 OUTLET_0 signal; +#X text 7 45 OUTLET_1 float; +#X text 7 5 INLET_0 float signal; +#X text 7 -15 DESCRIPTION convert milliseconds to number of samples +; +#X text 7 -55 KEYWORDS signal sample samples milliseconds seconds; +#X restore 502 463 pd META; +#X obj -1 348 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 405 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 319 385 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 463 pd Related_objects; +#X obj 78 298 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 357 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header mstosamps~ 3 12 +0 18 -204280 -1 0; +#X obj 478 6 mstosamps~; +#X msg 285 103 0 \, 1000 3000; +#X floatatom 285 225 0 0 0 0 - - -; +#X obj 285 123 line~; +#X floatatom 70 170 0 0 0 0 - - -; +#X floatatom 13 123 0 0 0 0 - - -; +#X text 295 184 number of samples out (as a signal); +#X text 295 148 number of milliseconds in (as a signal); +#X obj 13 146 mstosamps~; +#X obj 285 164 mstosamps~; +#X obj 285 203 Snapshot~ 100; +#X text 277 78 or convert signal values; +#X text 40 120 number of milliseconds; +#X text 105 169 number of samples; +#X text 326 228 number of samples; +#X text 111 297 float; +#X text 178 297 - number of milliseconds; +#X text 111 318 signal; +#X text 178 319 - number of milliseconds in (as signal); +#X text 111 358 signal; +#X text 178 357 - number of samples out (as signal); +#X text 111 426 (none); +#X obj 480 50 pddp/dsp; +#X text 10 79 Use as a calculator or for float parameters; +#X text 111 379 float; +#X text 178 379 - number of samples (given float); +#X obj 80 379 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 11 23 Convert milliseconds to number of samples; +#X obj 15 460 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 12 0; +#X connect 12 0 18 0; +#X connect 14 0 17 0; +#X connect 17 1 13 0; +#X connect 18 0 19 0; +#X connect 19 0 11 0; diff --git a/externals/miXed/doc/help/cyclone/mtr-help.pd b/externals/miXed/doc/help/cyclone/mtr-help.pd new file mode 100644 index 000000000..f4783ad47 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/mtr-help.pd @@ -0,0 +1,112 @@ +#N canvas 428 35 558 549 10; +#X obj -1 787 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 379 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 624 299 361 258 META 0; +#X text 9 70 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 9 -90 LICENSE SIBSD; +#X text 9 50 AUTHOR Miller Puckette; +#X text 9 90 RELEASE_DATE 1997; +#X text 9 30 LIBRARY cyclone; +#X text 9 110 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 9 -30 INLET_N track; +#X text 9 -50 INLET_0 message; +#X text 9 -10 OUTLET_0 list; +#X text 9 10 OUTLET_1 track; +#X text 9 -70 DESCRIPTION multi-track recorder for any kind of message +; +#X text 9 -110 KEYWORDS record recorder track multi-track; +#X restore 501 789 pd META; +#X obj -1 585 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 661 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 700 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 323 447 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 45 40 qlist; +#X restore 207 789 pd Related_objects; +#X obj 76 392 cnv 17 3 140 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header mtr 3 12 0 18 -204280 +-1 0; +#X obj 521 8 mtr; +#X text 11 23 Multi-track recorder for any kind of message; +#X msg 108 97 record; +#X msg 127 118 play; +#X obj 210 275 vsl 18 47 0 128 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 184 275 vsl 18 47 0 128 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 158 275 vsl 18 47 0 128 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X msg 162 209 next; +#X msg 154 184 rewind; +#X obj 108 246 mtr 3; +#X msg 140 139 stop; +#X obj 108 338 print; +#X text 142 337 track# duration; +#X msg 146 161 clear; +#X text 107 390 message; +#X text 187 390 - accepts:; +#X text 317 408 mute; +#X text 317 426 unmute; +#X text 317 444 clear; +#X text 317 462 delay ms; +#X text 317 480 write; +#X text 317 498 read; +#X text 207 516 tempo float; +#X text 317 516 first; +#X text 207 408 record; +#X text 207 426 play; +#X text 207 444 stop; +#X text 207 462 clear; +#X text 207 480 rewind; +#X text 207 498 next; +#X text 89 671 1) float; +#X text 187 671 - number of tracks to mix (max 32); +#X text 107 597 list; +#X text 107 555 track; +#X text 187 555 - track to record (for inlets 1...n); +#X obj 76 555 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X text 187 597 - when "next" received \, outputs list with track # +and duration; +#X obj 76 630 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X text 107 630 track; +#X text 187 630 - one to one mapping of inlets to outlets; +#X obj 76 597 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 85 713 The leftmost inlet of mtr is a control inlet for all +tracks. You can send the same messages to individual tracks as well. +Each track records what comes into its inlet \, and plays it back through +the outlet directly below the inlet.; +#X text 166 236 argument: int specifies number of tracks (default +1) up to 32; +#X text 150 96 begin recording sliders; +#X text 154 115 play back; +#X text 78 60 Control messages sent to an individual track affect +that track only.; +#X text 200 202 mtr sends out list with track # and duration when +it receives a "next" message; +#X obj 14 786 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 18 0; +#X connect 12 0 18 0; +#X connect 13 0 18 3; +#X connect 14 0 18 2; +#X connect 15 0 18 1; +#X connect 16 0 18 0; +#X connect 17 0 18 0; +#X connect 18 0 20 0; +#X connect 18 1 15 0; +#X connect 18 2 14 0; +#X connect 18 3 13 0; +#X connect 19 0 18 0; +#X connect 22 0 18 0; diff --git a/externals/miXed/doc/help/cyclone/next-help.pd b/externals/miXed/doc/help/cyclone/next-help.pd new file mode 100644 index 000000000..cd5eab321 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/next-help.pd @@ -0,0 +1,90 @@ +#N canvas 428 35 558 498 10; +#X obj -1 631 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 437 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 621 266 357 242 META 0; +#X text 8 -49 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 8 -189 LICENSE SIBSD; +#X text 8 -69 AUTHOR Miller Puckette; +#X text 8 -29 RELEASE_DATE 1997; +#X text 8 -89 LIBRARY cyclone; +#X text 8 -9 HELP_PATCH_AUTHORS Alex Cleveland updated this patch for +Pd-l2ork version 2013.05.28; +#X text 8 -209 KEYWORDS separate messages logic; +#X text 8 -169 DESCRIPTION separate messages into logical parts; +#X text 8 -149 INLET_0 list float bang; +#X text 8 -129 OUTLET_0 bang; +#X text 8 -109 OUTLET_1 bang; +#X restore 499 633 pd META; +#X obj 0 520 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 590 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 318 397 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 201 633 pd Related_objects; +#X obj 79 448 cnv 17 3 58 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 558 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header next 3 12 0 18 +-204280 -1 0; +#X obj 516 7 next; +#X text 109 447 list; +#X text 179 447 - list of numbers; +#X text 109 469 float; +#X text 109 491 bang; +#X text 179 491 - get next number; +#X text 179 471 - input number; +#X obj 110 329 next; +#X obj 110 393 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 131 357 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 131 112 5 0 0 0 - - -, f 5; +#X obj 165 265 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 165 292 1; +#X msg 196 292 2; +#X msg 228 292 3; +#X text 134 387 bang if the current message is not part; +#X text 133 400 of the same logical stream; +#X text 154 364 of the same logical stream; +#X text 153 351 bang if the current message is part; +#X msg 168 150 1 2 3 4; +#X msg 168 211 4 3 2 1; +#X obj 168 190 spigot; +#X obj 201 172 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 110 87 1 \, 2 \, 3 \, 4; +#X text 107 602 (none); +#X obj 78 529 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 109 528 bang; +#X text 179 528 - bang if current message is not part of same logical +stream; +#X text 179 561 - bang if current message is part of the same logical +stream; +#X text 109 559 bang; +#X text 10 24 separate messages into logical parts; +#X text 79 58 try different inputs:; +#X obj 12 632 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 16 0 17 0; +#X connect 16 1 18 0; +#X connect 19 0 16 0; +#X connect 20 0 21 0; +#X connect 20 0 22 0; +#X connect 20 0 23 0; +#X connect 21 0 16 0; +#X connect 22 0 16 0; +#X connect 23 0 16 0; +#X connect 28 0 16 0; +#X connect 28 0 30 0; +#X connect 29 0 16 0; +#X connect 30 0 29 0; +#X connect 31 0 30 1; +#X connect 32 0 16 0; diff --git a/externals/miXed/doc/help/cyclone/offer-help.pd b/externals/miXed/doc/help/cyclone/offer-help.pd new file mode 100644 index 000000000..ba58af690 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/offer-help.pd @@ -0,0 +1,85 @@ +#N canvas 427 35 558 498 10; +#X obj -1 471 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 272 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 628 289 352 218 META 0; +#X text 7 -8 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 -134 LICENSE SIBSD; +#X text 7 -26 AUTHOR Miller Puckette; +#X text 7 10 RELEASE_DATE 1997; +#X text 7 -44 LIBRARY cyclone; +#X text 7 28 HELP_PATCH_AUTHORS Alex Cleveland updated this patch for +Pd-l2ork version 2013.05.28; +#X text 7 -152 KEYWORDS x y pairs cartesian; +#X text 7 -116 DESCRIPTION store x \, y pairs of values (x is int only) +; +#X text 7 -98 INLET_0 float list message; +#X text 7 -80 INLET_1 float; +#X text 7 -62 OUTLET_0 float; +#X restore 501 473 pd META; +#X obj -1 394 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 431 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 315 396 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 13 27 funbuff; +#C restore; +#X restore 200 473 pd Related_objects; +#X obj 79 281 cnv 17 3 57 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 403 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header offer 3 12 0 18 +-204280 -1 0; +#X obj 509 7 offer; +#X text 11 23 store x \, y pairs of values (x is int only); +#X obj 23 187 offer; +#X msg 63 154 clear; +#X text 105 153 clear contents; +#X msg 23 76 0 0 \, 1 1.1 \, 2 2.2 \, 3 3.3; +#X floatatom 57 120 5 0 0 0 - - -, f 5; +#X obj 23 217 print offer; +#X obj 436 196 offer; +#X obj 436 218 print offer2; +#X obj 436 128 t b b; +#X msg 436 106 bang; +#X msg 436 175 0; +#X msg 463 153 0.23; +#X text 417 177 x:; +#X text 448 152 y:; +#X text 344 69 hit bang and then the x value; +#X text 343 81 again to output stored y:; +#X text 108 280 float; +#X text 179 280 - read find y value correspoding to float and delete +pair; +#X text 108 301 list; +#X text 179 300 - list of x \, y pairs to store in object; +#X text 108 323 message; +#X text 179 324 - if x value input \, find corresponding y and output +value; +#X text 108 402 float; +#X text 179 402 - y values correspoding to input x from inlet; +#X text 108 443 (none); +#X text 179 338 clear: clear contents of buffer; +#X text 94 111 read corresponding y value and delete pair; +#X obj 77 357 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 108 360 float; +#X text 179 360 - input y value; +#X text 175 68 x(int) y(may be float) pairs are stored; +#X obj 13 472 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 16 0; +#X connect 12 0 11 0; +#X connect 14 0 11 0; +#X connect 15 0 11 0; +#X connect 17 0 18 0; +#X connect 19 0 21 0; +#X connect 19 1 22 0; +#X connect 20 0 19 0; +#X connect 21 0 17 0; +#X connect 22 0 17 1; diff --git a/externals/miXed/doc/help/cyclone/onebang-help.pd b/externals/miXed/doc/help/cyclone/onebang-help.pd new file mode 100644 index 000000000..63c71fb7e --- /dev/null +++ b/externals/miXed/doc/help/cyclone/onebang-help.pd @@ -0,0 +1,65 @@ +#N canvas 429 36 558 422 10; +#X obj -1 395 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 243 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 620 193 359 241 META 0; +#X text 9 117 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 9 -23 LICENSE SIBSD; +#X text 9 97 AUTHOR Miller Puckette; +#X text 9 137 RELEASE_DATE 1997; +#X text 9 77 LIBRARY cyclone; +#X text 9 157 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 9 -43 KEYWORDS bang filter traffic control; +#X text 9 -3 DESCRIPTION traffic control for bang messages; +#X text 9 37 INLET_1 bang; +#X text 9 17 INLET_0 bang; +#X text 9 57 OUTLET_0 bang; +#X restore 501 397 pd META; +#X obj -1 311 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 348 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 312 321 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 191 397 pd Related_objects; +#X obj 79 252 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 285 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header onebang 3 12 0 +18 -204280 -1 0; +#X obj 495 9 onebang; +#X text 11 23 traffic control for bang messages; +#X text 111 252 bang; +#X obj 92 142 onebang 1; +#X text 156 142 nonzero arg allows the first bang to get through; +#X obj 92 82 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 92 196 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 143 115 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 112 72 only gets through if a bang was previously received +; +#X text 112 85 in the right inlet; +#X text 179 252 - only gets through if bang was previously received +in the right inlet; +#X obj 79 320 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 111 285 bang; +#X text 179 285 - regulates bangs passed through inlet 0; +#X text 111 320 bang; +#X text 179 320 - only passes if inlet 0 recieves bang after inlet +1; +#X text 93 364 1) float; +#X text 179 364 - nonzero arg allows the first bang on inlet 0 to pass +; +#X obj 11 396 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 15 0; +#X connect 14 0 12 0; +#X connect 16 0 12 1; diff --git a/externals/miXed/doc/help/cyclone/onepole~-help.pd b/externals/miXed/doc/help/cyclone/onepole~-help.pd new file mode 100644 index 000000000..2e66d3c8c --- /dev/null +++ b/externals/miXed/doc/help/cyclone/onepole~-help.pd @@ -0,0 +1,78 @@ +#N canvas 426 34 558 503 10; +#X obj -1 666 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 276 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 619 273 357 233 META 0; +#X text 9 156 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 9 16 LICENSE SIBSD; +#X text 9 136 AUTHOR Miller Puckette; +#X text 9 176 RELEASE_DATE 1997; +#X text 9 116 LIBRARY cyclone; +#X text 9 196 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 9 96 OUTLET_0 signal; +#X text 9 -4 KEYWORDS signal lowpass filter low pass pole; +#X text 9 36 DESCRIPTION single-pole lowpass filter; +#X text 9 56 INLET_0 signal; +#X text 9 76 INLET_1 float signal; +#X restore 501 668 pd META; +#X obj -1 369 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 406 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 449 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 312 395 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 196 668 pd Related_objects; +#X obj 78 285 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 312 cnv 17 3 35 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header onepole~ 3 12 0 +18 -204280 -1 0; +#X obj 489 8 onepole~; +#X text 11 23 single-pole lowpass filter; +#X text 108 284 signal; +#X text 108 311 float; +#X text 108 331 signal; +#X text 108 379 signal; +#X text 90 422 1) float; +#X text 179 423 - initial frequency; +#X text 179 379 - output of low-pass filter based on args; +#X obj 141 143 dac~; +#X text 110 498 where k represents the cutoff frequency in radians. +this generates a single-pole lowpass filter with a 6dB/octave attenuation. +; +#X text 161 478 out = prev + k * (in - prev); +#X text 110 458 onepole~ implements the minimal filter equation:; +#X text 110 584 onepole's advantages are efficiency and simplicity. +it works well as a pre- or post-processing stage for other treatments +\, such as waveshaping or filtering \, which can benefit from a gentle +roll-off of high frequencies.; +#X obj 479 49 pddp/dsp; +#X text 110 539 this filter is equivalent to a biquad~ object with +the coefficients \, [ a0 = k \, b1 = k - 1 ] \, as demonstrated above. +; +#X obj 78 379 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 211 101 optional argument initializes cutoff frequency; +#X floatatom 200 71 5 0 0 0 - - -, f 5; +#X obj 131 175 Scope~ 160 75 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 131 71 osc~ 500; +#X obj 131 109 onepole~ 400; +#X msg 221 148 range -1 1; +#X text 179 284 - input frequency to be filtered; +#X text 179 311 - set cutoff frequency with float; +#X text 179 331 - set cutoff frequency with signal; +#X obj 18 669 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 28 0 31 1; +#X connect 30 0 31 0; +#X connect 31 0 19 0; +#X connect 31 0 29 0; +#X connect 32 0 29 0; diff --git a/externals/miXed/doc/help/cyclone/overdrive~-help.pd b/externals/miXed/doc/help/cyclone/overdrive~-help.pd new file mode 100644 index 000000000..5face35bb --- /dev/null +++ b/externals/miXed/doc/help/cyclone/overdrive~-help.pd @@ -0,0 +1,96 @@ +#N canvas 429 36 559 574 10; +#X obj -1 748 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 413 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 629 336 354 247 META 0; +#X text 3 168 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 3 35 LICENSE SIBSD; +#X text 3 149 AUTHOR Miller Puckette; +#X text 3 187 RELEASE_DATE 1997; +#X text 3 130 LIBRARY cyclone; +#X text 3 206 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 3 111 OUTLET_0 signal; +#X text 3 73 INLET_0 float signal; +#X text 3 3 KEYWORDS signal amplifier amp overdriven distortion analog +sumulate; +#X text 3 54 DESCRIPTION simulate an analog amplifier being overdriven +; +#X text 3 92 INLET_1 ?????; +#X restore 503 750 pd META; +#X obj -1 500 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 537 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 574 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 313 476 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 197 750 pd Related_objects; +#X obj 84 422 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 84 509 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header overdrive~ 3 12 +0 18 -204280 -1 0; +#X obj 479 6 overdrive~; +#X text 111 421 float; +#X text 111 442 signal; +#X text 180 421 - set drive:; +#X text 111 508 signal; +#X text 180 508 - simulated overdriven signal; +#X text 94 547 1) float; +#X text 180 547 - intial drive; +#X text 123 585 overdrive~ simulates the distortion caused when an +analog amplifier is fed a signal that is too high for the inputs. This +is generally known as "overdriving" the amplifier \, and it causes +a characteristic distortion that is often used to generate a "fat" +sound.; +#X obj 132 217 overdrive~; +#N canvas 0 22 450 300 (subpatch) 0; +#X array overdrive 200 float 2; +#X coords 0 1 199 -1 200 140 1; +#X restore 337 251 graph; +#X obj 38 204 tgl 15 1 empty empty empty 0 -6 0 8 -24198 -1 -1 1 1 +; +#X obj 132 260 tabwrite~ overdrive; +#X floatatom 132 143 5 0 0 0 - - -, f 5; +#X obj 132 111 hsl 128 15 1 12 0 1 empty empty drive 45 9 1 12 -262131 +-1 -1 0 1; +#N canvas 0 22 454 304 (subpatch) 0; +#X array osc 200 float 2; +#X coords 0 1 199 -1 200 140 1; +#X restore 336 94 graph; +#X obj 13 260 tabwrite~ osc; +#X obj 13 111 osc~ 400; +#X obj 38 222 metro 442; +#X obj 479 47 pddp/dsp; +#X obj 84 471 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 11 23 Simulate an analog amplifier being overdriven; +#X text 17 48 simulates distortion by applying a non-linear transfer +function to the incoming signal.; +#X text 123 662 If the "drive" is 1 \, the signal is unchanged. Increasing +the "drive" increases the amount of distortion. If the "drive" is less +than 1 \, then it causes a different kind of distortion. If the "drive" +is less than 0 \, VERY LOUD distortion can result \, so be careful! +; +#X obj 9 751 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X floatatom 189 169 5 0 1 0 - - -, f 5; +#X text 171 142 drive factor; +#X text 226 169 set amount of drive (1. = none); +#X text 111 471 float; +#X text 180 471 set amount of overdrive (amplification); +#X connect 19 0 22 0; +#X connect 21 0 28 0; +#X connect 23 0 19 0; +#X connect 24 0 23 0; +#X connect 27 0 19 0; +#X connect 27 0 26 0; +#X connect 28 0 22 0; +#X connect 28 0 26 0; +#X connect 35 0 19 1; diff --git a/externals/miXed/doc/help/cyclone/past-help.pd b/externals/miXed/doc/help/cyclone/past-help.pd new file mode 100644 index 000000000..42b22179b --- /dev/null +++ b/externals/miXed/doc/help/cyclone/past-help.pd @@ -0,0 +1,122 @@ +#N canvas 428 35 558 453 10; +#X obj -1 426 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 255 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 483 187 494 275 META 0; +#X text 12 95 RELEASE_VERSION 0.41.4; +#X text 158 96 Keywords:; +#X text 12 5 GENRE help; +#X text 12 65 DESCRIPTION using help patches in Pure Data; +#X text 12 25 KEYWORDS needs_work (mention how pd finds help files +and replace 'common_terminology' subpatch with link to glossary); +#X text 117 111 control- control rate objects \; signal- audiorate +objects \; data_structure- objects for creating and managing data structures +\; nonlocal- objects that can make nonlocal connections to other objects +(i.e. \, communicate with other objects without using wires) \; storage- +objects whose main function is to store a value \; array- objects for +creating and editing arrays \; GUI- objects that provide a graphical +user interface \; MIDI- objects that provide MIDI functionality \; +time- objects that measure time or which the user can use to manipulate +time \; unfinished- help patches under construction \; orphan- help +patches that can't get accessed by right clicking on the corresponding +object (like [drawsymbol]) \; block-oriented- see Matju's definition +\; analysis- object that does analysis \; conversion- convert from +one set of units to another \; filter \; network \; trigonometry \; +soundfile- object that can play \, manipulate \, and/or save a sound +file (wav \, ogg \, mp3 \, etc.). \; random- object outputs a random +value \, list \, or signal \; symbol_op- object that manipulates or +stores a symbol \; list_op- object that manipulates or stores a list +\; canvas_op- object whose behavior only makes sense in terms of a +canvas \; patchfile_op- object whose behavior only makes sense in terms +of a patchfile \; ramp - a ramp \; bandlimited \; pd-op - object that +can report on or manipulate global Pd operation \; anything_op - store +or manipulate an anything \; abstraction_op - object that only makes +sense in terms of abstractions; +#X restore 499 428 pd META; +#X obj -1 337 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 380 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 323 350 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 207 428 pd Related_objects; +#X obj 78 264 cnv 17 3 56 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 350 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header past 3 12 0 18 +-204280 -1 0; +#X obj 514 8 past; +#X text 11 23 report when input increases beyond a certain number; +#X obj 74 166 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 74 142 past 4; +#X floatatom 74 67 5 0 0 0 - - -, f 5; +#X text 127 144 one arg sets the limit to get past; +#X msg 117 108 set 8; +#X text 160 108 (re)set the limit to pass by; +#X msg 117 81 clear; +#X text 157 82 forget previous input; +#X text 108 263 float; +#X text 179 263 - number to check if past limit; +#X text 108 284 set x; +#X text 179 284 - set the new limit to x; +#X text 108 305 clear; +#X text 179 305 - forget previous input; +#X text 108 350 bang; +#X text 179 350 - bang if input number is more than limit; +#X text 90 394 1) float; +#X text 179 394 - initial limit; +#N canvas 902 165 577 369 weirdness 0; +#X obj 97 178 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 27 55 5 0 0 0 - - -, f 5; +#X msg 97 55 set 10 20 30; +#X obj 27 103 pack f f; +#X obj 27 79 t f f; +#X obj 97 147 past 2 5; +#X msg 141 98 20 30 40; +#X msg 141 78 0 0 0; +#X msg 141 118 40 20 wrdlbrnft; +#X msg 404 72 11 22 33; +#X obj 375 176 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 375 150 past 10 20 30; +#X msg 375 48 0 0 0; +#X msg 426 93 11 33; +#X msg 440 113 33; +#X text 49 288 > item is greater than (>) a corresponding threshold +\, or if; +#X text 50 300 > _all_ list elements are greater or equal (>=). That +is how; +#X text 50 312 > it looks like in Max but I might be wrong ...; +#X text 49 276 > its list handling is weird indeed \, it bangs if _any_ +list; +#X text 94 19 now theses are a bit strange:; +#X text 50 259 this is a quote from an email Krzysztof Czaja sent: +; +#X connect 1 0 4 0; +#X connect 2 0 5 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 4 1 3 1; +#X connect 5 0 0 0; +#X connect 6 0 5 0; +#X connect 7 0 5 0; +#X connect 8 0 5 0; +#X connect 9 0 11 0; +#X connect 11 0 10 0; +#X connect 12 0 11 0; +#X connect 13 0 11 0; +#X connect 14 0 11 0; +#X restore 441 215 pd weirdness; +#X text 238 215 list behavior is a bit strange:; +#X obj 14 428 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 11 0; +#X connect 13 0 12 0; +#X connect 15 0 12 0; +#X connect 17 0 12 0; diff --git a/externals/miXed/doc/help/cyclone/peakamp~-help.pd b/externals/miXed/doc/help/cyclone/peakamp~-help.pd new file mode 100644 index 000000000..ea48ed881 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/peakamp~-help.pd @@ -0,0 +1,104 @@ +#N canvas 427 35 558 587 10; +#X obj -1 559 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 315 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 617 360 363 235 META 0; +#X text -166 154 WEBSITE http://crca.ucsd.edu/~msp/; +#X text -166 21 LICENSE SIBSD; +#X text -166 135 AUTHOR Miller Puckette; +#X text -166 173 RELEASE_DATE 1997; +#X text -166 116 LIBRARY cyclone; +#X text -166 192 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text -166 2 KEYWORDS signal amplitude peak max maximum measure; +#X text -166 40 DESCRIPTION measure the peak amplitude of a signal +; +#X text -166 59 INLET_0 signal bang; +#X text -166 78 INLET_1 float; +#X text -166 97 OUTLET_0 signal; +#X restore 500 561 pd META; +#X obj -1 399 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 436 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 475 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 320 482 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 561 pd Related_objects; +#X obj 77 324 cnv 17 3 34 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 77 371 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header peakamp~ 3 12 0 +18 -204280 -1 0; +#X obj 488 8 peakamp~; +#X text 11 22 measure the peak amplitude of a signal; +#X text 109 323 signal; +#X text 177 323 - signal to measure peak amplitude; +#X text 109 342 bang; +#X floatatom 290 95 0 0 0 0 - - -; +#X floatatom 245 141 10 0 0 0 - - -, f 10; +#X floatatom 30 219 5 0 0 0 - - -, f 5; +#X obj 224 85 adc~; +#X obj 30 197 peakamp~; +#X obj 290 73 hsl 128 15 0 127 0 1 empty empty empty -2 -8 0 10 -262144 +-1 -1 12700 1; +#X obj 245 119 peakamp~; +#X floatatom 274 195 10 0 0 0 - - -, f 10; +#X obj 46 170 metro 250; +#X obj 46 151 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 1 +1; +#X obj 30 126 *~; +#X obj 30 80 noise~; +#X obj 45 104 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 +-1 -1 0 1; +#X floatatom 62 126 5 0 0 0 - - -, f 5; +#X obj 224 195 * 1000; +#X obj 224 220 osc~; +#X obj 224 243 *~ 0.2; +#X obj 224 266 dac~; +#X obj 257 221 hsl 128 15 0.01 1 1 0 empty empty volume 15 8 0 10 -204786 +-1 -1 0 1; +#X obj 224 165 peakamp~ 25; +#X text 267 244 Example: the amplitude sets the frequency; +#X text 177 342 - output current peak value; +#X text 109 407 float; +#X text 177 407 - output current peak amplitude of signal; +#X obj 77 408 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 109 371 float; +#X text 92 446 1) float; +#X text 118 489 peakamp~ tracks and outputs the absolute value of the +peak amplitude of the incoming signal. It outputs when banged or using +its own internal clock. The peak value is reset each time peakamp~ +outputs a value.; +#X obj 478 50 pddp/dsp; +#X text 318 93 <-- set the delay for the internal metro; +#X text 305 160 <-- argument causes automatic reporting; +#X text 177 447 - optional \, report peak amp every x miliseconds; +#X text 177 371 - report every x miliseconds; +#X obj 10 559 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 21 1; +#X connect 18 0 34 0; +#X connect 18 1 21 0; +#X connect 19 0 17 0; +#X connect 20 0 15 0; +#X connect 21 0 16 0; +#X connect 23 0 19 0; +#X connect 24 0 23 0; +#X connect 25 0 19 0; +#X connect 26 0 25 0; +#X connect 27 0 28 0; +#X connect 27 0 25 1; +#X connect 29 0 30 0; +#X connect 30 0 31 0; +#X connect 31 0 32 0; +#X connect 31 0 32 1; +#X connect 33 0 31 1; +#X connect 34 0 22 0; +#X connect 34 0 29 0; diff --git a/externals/miXed/doc/help/cyclone/peek~-help.pd b/externals/miXed/doc/help/cyclone/peek~-help.pd new file mode 100644 index 000000000..bc9f43c3e --- /dev/null +++ b/externals/miXed/doc/help/cyclone/peek~-help.pd @@ -0,0 +1,113 @@ +#N canvas 427 35 558 549 10; +#X obj -1 655 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 446 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 615 294 363 263 META 0; +#X text 11 175 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 23 LICENSE SIBSD; +#X text 11 156 AUTHOR Miller Puckette; +#X text 11 194 RELEASE_DATE 1997; +#X text 11 137 LIBRARY cyclone; +#X text 11 213 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 11 80 INLET_1 float; +#X text 11 4 KEYWORDS read write sample table graph array; +#X text 11 42 DESCRIPTION read and write sample values; +#X text 11 61 INLET_0 list float setx; +#X text 11 99 INLET_2 ?????; +#X text 11 118 OUTLET_0 float; +#X restore 497 657 pd META; +#X obj -1 577 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 614 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 321 451 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 205 657 pd Related_objects; +#X obj 78 457 cnv 17 3 45 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 516 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header peek~ 3 12 0 18 +-204280 -1 0; +#X text 11 24 read and write sample values; +#X obj 247 361 peek~ table; +#N canvas 0 0 450 300 (subpatch) 0; +#X array table 100 float 0; +#X coords 0 1 99 -1 200 140 1; +#X restore 9 135 graph; +#X floatatom 259 93 5 0 0 0 - - -, f 5; +#X floatatom 247 385 5 0 0 0 - - -, f 5; +#X floatatom 354 253 5 0 0 0 - - -, f 5; +#X msg 287 132 4 1; +#X msg 320 132 10 1; +#X obj 327 170 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 327 192 t b b; +#X msg 327 216 12; +#X msg 354 216 1; +#X msg 349 319 clip \$1; +#X obj 349 295 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 247 56 set table; +#X text 369 294 en/disable -1/+1 clipping; +#X text 307 56 change array; +#N canvas 873 284 485 231 multichannel 0; +#X text 77 54 could not get it to work properly as of yet...; +#X text 76 65 sorry; +#X text 77 32 in case you were wondering \, that's what the; +#X text 77 43 third inlet is good for \, unfortunately I; +#X text 72 96 quoting krzyszzof czaja again:; +#X text 73 120 > MSP's peek~ is single channel unlike other buffer~ +; +#X text 73 131 > clients. One may choose a channel with an argument +; +#X text 73 142 > or change it via an inlet but I am not sure how to +; +#X text 74 154 > emulate this in pd.; +#X restore 402 407 pd multichannel; +#X text 107 455 list; +#X text 107 471 float; +#X text 178 471 - set x value (set y value at same time in other outlet) +; +#X obj 78 587 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 107 516 float; +#X text 178 516 - set y value (set x value at same time in other outlet) +; +#X text 107 487 set x; +#X text 178 487 - set new table; +#X text 107 587 float; +#X text 178 587 - output y value correspoing to input x; +#X text 89 625 1) table; +#X text 178 625 - initial table to store x \, y pair into; +#X text 178 455 - output y value coresponding to input x; +#X obj 506 7 peek~; +#X text 8 94 first \, draw something here:; +#X text 299 90 read the y value by setting x here; +#X text 346 167 ...or like this...; +#X text 354 123 to change values in the table \, use lists...; +#X text 389 240 ...or set the y val here and then set the x val in +the first inlet; +#X obj 78 545 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 107 545 ?????; +#X text 178 545 ?????; +#X obj 10 654 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 13 0; +#X connect 12 0 10 0; +#X connect 14 0 10 1; +#X connect 15 0 10 0; +#X connect 16 0 10 0; +#X connect 17 0 18 0; +#X connect 18 0 19 0; +#X connect 18 1 20 0; +#X connect 19 0 10 0; +#X connect 20 0 10 1; +#X connect 21 0 10 0; +#X connect 22 0 21 0; +#X connect 23 0 10 0; diff --git a/externals/miXed/doc/help/cyclone/phasewrap~-help.pd b/externals/miXed/doc/help/cyclone/phasewrap~-help.pd new file mode 100644 index 000000000..3ebf8ab68 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/phasewrap~-help.pd @@ -0,0 +1,57 @@ +#N canvas 428 35 558 390 10; +#X obj -1 364 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 241 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 621 194 359 207 META 0; +#X text 7 115 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 1 LICENSE SIBSD; +#X text 7 96 AUTHOR Miller Puckette; +#X text 7 134 RELEASE_DATE 1997; +#X text 7 77 LIBRARY cyclone; +#X text 7 153 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 7 58 OUTLET_0 signal; +#X text 7 -18 KEYWORDS signal wrap -pi pi phase; +#X text 7 20 DESCRIPTION wrap a signal between -pi and pi; +#X text 7 39 INLET_0 signal; +#X restore 501 366 pd META; +#X obj -1 283 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 322 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 311 290 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 196 366 pd Related_objects; +#X obj 79 253 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 294 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header phasewrap~ 3 12 +0 18 -204280 -1 0; +#X obj 476 10 phasewrap~; +#X text 11 23 wrap a signal between -pi and pi; +#X obj 99 101 sig~; +#X obj 99 76 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 99 130 phasewrap~; +#X obj 99 160 Snapshot~ 100; +#X obj 99 191 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X text 112 253 signal; +#X text 177 253 - signal to wrap the phase; +#X text 112 294 signal; +#X text 177 294 - the wrapped signal; +#X text 112 334 (none); +#X obj 479 47 pddp/dsp; +#X text 159 74 modify the incoming signal; +#X text 162 182 wrapped output (always in the range of -pi to pi) +; +#X obj 10 366 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 13 0; +#X connect 12 0 11 0; +#X connect 13 0 14 0; +#X connect 14 0 15 0; diff --git a/externals/miXed/doc/help/cyclone/pink~-help.pd b/externals/miXed/doc/help/cyclone/pink~-help.pd new file mode 100644 index 000000000..627b594ea --- /dev/null +++ b/externals/miXed/doc/help/cyclone/pink~-help.pd @@ -0,0 +1,58 @@ +#N canvas 429 35 559 466 10; +#X obj -1 436 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 217 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 619 270 359 201 META 0; +#X text 9 100 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 9 -14 LICENSE SIBSD; +#X text 9 81 AUTHOR Miller Puckette; +#X text 9 119 RELEASE_DATE 1997; +#X text 9 62 LIBRARY cyclone; +#X text 9 138 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 9 43 OUTLET_0 signal; +#X text 9 -33 KEYWORDS signal noise pink generator; +#X text 9 5 DESCRIPTION pink noise generator; +#X text 9 24 INLET_0 signal; +#X restore 499 438 pd META; +#X obj -1 256 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 296 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 336 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 322 362 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 205 438 pd Related_objects; +#X obj 79 227 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 268 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header pink~ 3 12 0 18 +-204280 -1 0; +#X text 110 227 signal; +#X text 110 268 signal; +#X text 110 308 (none); +#X obj 507 9 pink~; +#X text 11 23 Pink noise generator; +#X obj 119 172 dac~; +#X obj 119 136 *~ 0.2; +#X obj 119 100 pink~; +#X text 193 227 - ignored; +#X text 193 268 - pink noise; +#X text 111 352 pink~ generates pink noise \, as distinguished from +white noise (which the MSP object noise~ generates). White noise has +constant spectral power per hertz of bandwidth \, while pink noise +has constant power per octave. Subjectively \, pink noise sounds less +hissy than white noise.; +#X obj 480 54 pddp/dsp; +#X text 29 57 very simple to use \, pink~ generates pink noise (see +below) and sends it through its outlet:; +#X obj 10 437 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 16 0 15 0; +#X connect 16 0 15 1; +#X connect 17 0 16 0; diff --git a/externals/miXed/doc/help/cyclone/play~-help.pd b/externals/miXed/doc/help/cyclone/play~-help.pd new file mode 100644 index 000000000..4d5dab88e --- /dev/null +++ b/externals/miXed/doc/help/cyclone/play~-help.pd @@ -0,0 +1,133 @@ +#N canvas 429 36 558 496 10; +#X obj -252 380 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 +0 14 -233017 -33289 0; +#X obj -252 225 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 +13 -228856 -1 0; +#N canvas 622 279 360 227 META 0; +#X text 11 143 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 29 LICENSE SIBSD; +#X text 11 124 AUTHOR Miller Puckette; +#X text 11 162 RELEASE_DATE 1997; +#X text 11 105 LIBRARY cyclone; +#X text 11 181 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 11 86 OUTLET_0 signal; +#X text 11 10 KEYWORDS signal sample playback play position; +#X text 11 48 DESCRIPTION position based sample playback; +#X text 11 67 INLET_0 signal set x; +#X restore 251 382 pd META; +#X obj -252 281 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 +0 13 -228856 -1 0; +#X obj -252 318 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 +12 0 13 -228856 -1 0; +#N canvas 324 397 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore -44 382 pd Related_objects; +#X obj -171 234 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -170 290 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -252 -89 cnv 15 552 40 empty \$0-pddp.cnv.header play~ 3 12 +0 18 -204280 -1 0; +#X obj 253 -80 play~; +#X text -240 -66 position based sample playback; +#X text -146 233 signal; +#X text -71 233 - signal to have positional playback; +#X text -146 253 set x; +#X text -71 253 - change sample to array x; +#X obj -237 83 table sample; +#X obj -237 9 openpanel; +#X msg -237 34 read -resize \$1 sample; +#X obj -237 59 soundfiler; +#X obj -237 -16 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 +-1 -1; +#X text -219 -17 load a sample; +#X floatatom -50 166 0 0 100 0 - - -; +#N canvas 159 26 532 285 output 0; +#X obj 338 160 t b; +#X obj 338 110 f; +#X obj 338 60 inlet; +#X text 344 29 mute; +#X obj 338 185 f; +#X msg 426 180 0; +#X msg 338 85 bang; +#X obj 338 135 moses 1; +#X obj 397 110 moses 1; +#X obj 83 148 dbtorms; +#X obj 397 85 r master-lvl; +#X obj 83 42 r master-lvl; +#X obj 338 210 s master-lvl; +#X obj 20 155 inlet~; +#X obj 199 41 inlet; +#X text 199 18 level; +#X obj 199 105 s master-lvl; +#X msg 96 65 set \$1; +#X obj 96 90 outlet; +#X msg 214 65 \; pd dsp 1; +#X obj 83 198 line~; +#X obj 20 207 *~; +#X obj 20 232 dac~; +#X obj 83 173 pack 0 50; +#X text 20 132 audio; +#X text 96 114 show level; +#X obj 426 155 t b; +#X obj 20 181 hip~ 1; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 12 0; +#X connect 5 0 12 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 26 0; +#X connect 8 1 4 1; +#X connect 9 0 23 0; +#X connect 10 0 1 1; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 17 0; +#X connect 13 0 27 0; +#X connect 14 0 16 0; +#X connect 14 0 19 0; +#X connect 17 0 18 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 21 0 22 1; +#X connect 23 0 20 0; +#X connect 26 0 5 0; +#X connect 27 0 21 0; +#X restore -75 190 pd output; +#X msg -24 166 MUTE; +#X msg -62 67 set sample; +#X text 7 66 change array; +#X obj -75 33 line~; +#X msg -75 -1 0 \, 441 1000; +#X obj -75 123 play~ sample; +#X msg 12 -1 441 \, 0 1000; +#X text -75 -18 forward; +#X text 19 -18 backward; +#X text -146 290 signal; +#X text -71 290 - sample playback; +#X text -164 329 1) table; +#X text -71 329 - sample to play; +#X text -164 350 2) float; +#X text -71 350 - option arg for number of channels; +#X obj 228 -39 pddp/dsp; +#X text 6 104 arg is an array. if a second argument is given \, it's +treated as a number of channels. then play~ tries to load 0-sample +to n-sample where n is the number of channels; +#X obj -236 380 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage +Guide; +#X connect 16 0 17 0; +#X connect 17 0 18 0; +#X connect 19 0 16 0; +#X connect 21 0 22 1; +#X connect 22 0 21 0; +#X connect 23 0 22 2; +#X connect 24 0 28 0; +#X connect 26 0 28 0; +#X connect 27 0 26 0; +#X connect 28 0 22 0; +#X connect 29 0 26 0; diff --git a/externals/miXed/doc/help/cyclone/poke~-help.pd b/externals/miXed/doc/help/cyclone/poke~-help.pd new file mode 100644 index 000000000..b4b6809ad --- /dev/null +++ b/externals/miXed/doc/help/cyclone/poke~-help.pd @@ -0,0 +1,95 @@ +#N canvas 427 34 558 581 10; +#X obj -1 762 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 451 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 598 351 381 238 META 0; +#X text 11 163 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 30 LICENSE SIBSD; +#X text 11 144 AUTHOR Miller Puckette; +#X text 11 182 RELEASE_DATE 1997; +#X text 11 125 LIBRARY cyclone; +#X text 11 201 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 11 68 INLET_0 signal set x; +#X text 11 11 KEYWORDS signal write table sample index; +#X text 11 49 DESCRIPTION write into a table using a signal sample +index; +#X text 11 87 INLET_1 float; +#X text 11 106 INLET_2 float; +#X restore 500 764 pd META; +#X obj -1 557 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 594 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 654 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 317 478 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 203 764 pd Related_objects; +#X obj 78 460 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 504 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header poke~ 3 12 0 18 +-204280 -1 0; +#X obj 502 9 poke~; +#X text 11 23 Write into a table using a signal sample index; +#X msg 156 216 0; +#X floatatom 231 215 0 0 0 0 - - -; +#X obj 89 246 sig~ -1; +#X obj 50 72 cycle~ 440; +#X text 155 196 a source of an increasing index \, also consider fft~ +; +#X obj 442 390 table foo 1000; +#X obj 50 356 poke~ foo; +#X obj 76 311 multiplex~ 0 1; +#X msg 86 170 0; +#X msg 76 147 1; +#X text 107 148 start writing; +#X text 112 169 stop writing by sending -1 signal; +#X floatatom 174 293 5 0 0 0 - - -, f 5; +#X obj 156 238 count~ 0 2048; +#X obj 174 267 Snapshot~ 100; +#X obj 442 416 table bar 1000; +#X msg 58 98 set bar; +#X text 102 459 signal; +#X text 186 459 - signal to sample; +#X text 102 480 set x; +#X text 186 480 - change buffer to x; +#X text 102 504 float; +#X text 186 504 - index of value being recorded; +#X text 84 606 1) table; +#X text 186 606 - buffer to write to (required); +#X text 84 625 2) float; +#X text 186 625 - initial channel (optional \, default 1); +#X text 115 667 poke~ allows you to write samples into a buffer~ at +sample locations specified by a signal. Typically \, the signal will +increase in value by 1 with each sample to write successive values +into successive samples (like record~). If the index signal is negative +or larger than the size of the buffer~ \, no data is recorded.; +#X obj 477 49 pddp/dsp; +#X text 115 346 arguments are name of table (required) and initial +channel to write (optional \, default 1); +#X text 253 215 count maximum sets the number of samples recorded +(think of it as the loop size); +#X obj 78 529 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 102 529 float; +#X text 186 529 - set channel of value being recorded; +#X text 102 566 remotely sent to table; +#X obj 12 763 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 25 0; +#X connect 13 0 25 1; +#X connect 14 0 19 0; +#X connect 15 0 18 0; +#X connect 19 0 18 1; +#X connect 20 0 19 0; +#X connect 21 0 19 0; +#X connect 25 0 19 1; +#X connect 25 0 26 0; +#X connect 26 0 24 0; +#X connect 28 0 18 0; diff --git a/externals/miXed/doc/help/cyclone/poltocar-help.pd b/externals/miXed/doc/help/cyclone/poltocar-help.pd new file mode 100644 index 000000000..3865eabf0 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/poltocar-help.pd @@ -0,0 +1,79 @@ +#N canvas 428 35 560 593 10; +#X obj -1 565 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 396 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 583 339 396 262 META 0; +#X text 27 188 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 27 36 LICENSE SIBSD; +#X text 27 169 AUTHOR Miller Puckette; +#X text 27 207 RELEASE_DATE 1997; +#X text 27 150 LIBRARY cyclone; +#X text 27 226 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 27 17 KEYWORDS polar cartesian conversion coordinate graph +; +#X text 27 55 DESCRIPTION polar to cartesian conversion; +#X text 27 74 INLET_0 float; +#X text 27 93 INLET_1 float; +#X text 27 131 OUTLET_1 float; +#X text 27 112 OUTLET_1 float; +#X restore 499 567 pd META; +#X obj -1 460 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 524 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 329 446 428 153 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 53 39 cartopol; +#X restore 211 568 pd Related_objects; +#X obj 81 409 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header poltocar 3 12 0 +18 -204280 -1 0; +#X obj 81 433 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X text 110 409 float; +#X text 183 470 - real part of argument; +#X text 110 433 float; +#X text 183 495 - imaginary part of argument; +#X obj 81 470 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 495 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X text 110 470 float; +#X text 110 495 float; +#X text 183 409 - amplitude; +#X text 183 433 - phase; +#X text 115 537 (none); +#X obj 486 8 poltocar; +#X text 12 23 polar to cartesian conversion; +#X floatatom 172 158 5 0 0 0 amplitude-> - -, f 5; +#X floatatom 223 112 5 0 0 1 <-phase - -, f 5; +#X floatatom 172 212 5 0 0 0 real-> - -, f 5; +#X floatatom 217 212 5 0 0 1 <-imaginary - -, f 5; +#X obj 172 187 poltocar; +#X obj 176 307 hsl 128 15 -1 1 0 0 empty empty x-axis 133 7 1 10 -262144 +-1 -1 0 1; +#X obj 232 248 vsl 15 128 -1 1 0 0 empty empty y-axis -6 -9 1 10 -262144 +-1 -1 0 1; +#X obj 223 130 t b f; +#X obj 172 61 hsl 128 15 -1 1 0 0 empty empty amplitude 6 7 1 10 -261681 +-1 -1 0 1; +#X obj 223 88 hsl 128 15 0 6.28318 0 0 empty empty phase 7 7 1 10 -225280 +-1 -1 0 1; +#X text 357 86 (0 to 2pi); +#X obj 12 567 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 22 0 26 0; +#X connect 23 0 29 0; +#X connect 24 0 28 0; +#X connect 25 0 27 0; +#X connect 26 0 24 0; +#X connect 26 1 25 0; +#X connect 29 0 22 0; +#X connect 29 1 26 1; +#X connect 30 0 22 0; +#X connect 31 0 23 0; diff --git a/externals/miXed/doc/help/cyclone/poltocar~-help.pd b/externals/miXed/doc/help/cyclone/poltocar~-help.pd new file mode 100644 index 000000000..cf3b458fa --- /dev/null +++ b/externals/miXed/doc/help/cyclone/poltocar~-help.pd @@ -0,0 +1,68 @@ +#N canvas 426 36 559 435 10; +#X obj -1 408 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 234 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 577 209 374 261 META 0; +#X text 7 186 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 34 LICENSE SIBSD; +#X text 7 167 AUTHOR Miller Puckette; +#X text 7 205 RELEASE_DATE 1997; +#X text 7 148 LIBRARY cyclone; +#X text 7 224 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 7 110 OUTLET_0 signal; +#X text 7 15 KEYWORDS signal cartesian polar conversion; +#X text 7 53 DESCRIPTION polar to cartesian coordinate conversion; +#X text 7 72 INLET_0 signal; +#X text 7 129 OUTLET_1 signal; +#X text 7 91 INLET_1 signal; +#X restore 503 410 pd META; +#X obj -1 300 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 365 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 481 329 428 153 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 55 46 cartopol~; +#X restore 201 411 pd Related_objects; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header poltocar~ 3 12 +0 18 -204280 -1 0; +#X text 124 377 (none); +#X obj 483 8 poltocar~; +#X obj 482 55 pddp/dsp; +#X text 190 243 - amplitude; +#X text 190 270 - phase; +#X text 123 243 signal; +#X text 123 270 signal; +#X obj 92 245 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 92 271 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X text 190 311 - real part of signal; +#X text 190 337 - imaginary part of signal; +#X text 123 311 signal; +#X text 123 337 signal; +#X obj 92 312 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 92 338 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X text 50 56 Here's how to connect it to an fft~:; +#X text 177 120 phase (in 271 radians); +#X obj 121 202 ifft~ 256 256 0; +#X obj 121 178 poltocar~; +#X obj 121 103 cartopol~; +#X obj 121 80 fft~ 256 256 0; +#X text 96 119 amp.; +#X text 172 145 <- do some spectral processing here; +#X text 21 23 polar to cartesian coordinate conversion.; +#X obj 14 410 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 25 0 24 0; +#X connect 25 1 24 1; +#X connect 26 0 25 0; +#X connect 26 1 25 1; +#X connect 27 0 26 0; +#X connect 27 1 26 1; diff --git a/externals/miXed/doc/help/cyclone/pong-help.pd b/externals/miXed/doc/help/cyclone/pong-help.pd new file mode 100644 index 000000000..871490442 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/pong-help.pd @@ -0,0 +1,127 @@ +#N canvas 158 23 559 798 10; +#X obj 5 741 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#X obj 5 399 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#N canvas 604 328 360 252 META 0; +#X text 0 19 LICENSE SIBSD; +#X text 0 133 LIBRARY cyclone; +#X text 1 153 VERSION 0.2-beta1; +#X text 3 240 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X text 0 0 KEYWORDS float fold wrap range; +#X text 0 38 DESCRIPTION fold or wrap a float within a given range +; +#X text 0 76 INLET_1 float; +#X text 0 95 INLET_2 float; +#X text 1 171 AUTHOR Derek Kwan; +#X text 2 189 RELEASE_DATE 2016; +#X text 0 57 INLET_0 float list message; +#X text 0 114 OUTLET_0 float list; +#X restore 506 743 pd META; +#X obj 5 527 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 5 572 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#N canvas 312 452 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 202 743 pd Related_objects; +#X obj 89 411 cnv 17 3 50 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 88 541 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 3 39 cnv 15 552 40 empty empty pong 3 12 0 18 -204280 -1 0; +#X text 157 473 float; +#X obj 89 496 cnv 17 3 17 empty empty 2 5 9 0 16 -228856 -162280 0 +; +#X obj 89 472 cnv 17 3 17 empty empty 1 5 9 0 16 -228856 -162280 0 +; +#X text 157 497 float; +#X floatatom 402 307 0 -100 100 0 - - -; +#X floatatom 313 307 0 -100 100 0 - - -; +#X obj 509 47 pong; +#X text 142 579 1) float; +#X text 142 597 2) float; +#X obj 5 624 cnv 3 550 3 empty empty attributes 8 12 0 13 -228856 -1 +0; +#X text 211 472 - set low value of range; +#X text 212 497 - set high value of range; +#X text 209 541 - original \, clipped \, wrapped \, or folded number +; +#X text 128 412 float/list; +#X text 128 541 float/list; +#X msg 193 256 range -0.5 0.5; +#X text 209 597 - high range value (default 0); +#X text 209 579 - low range value (default 0); +#X text 210 413 - value(s) to clip \, fold or wrap; +#X obj 162 311 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-228856 -1 -1 0 256; +#X msg 57 181 none; +#X obj 131 211 symbol; +#X msg 131 255 mode \$1; +#X msg 93 180 clip; +#X msg 169 179 wrap; +#X msg 131 179 fold; +#X symbolatom 131 233 5 0 0 0 - - -, f 5; +#X obj 162 282 trigger b a; +#X text 70 254 set mode; +#X text 285 256 set range; +#X text 308 287 low range; +#X text 399 288 high range; +#X obj 225 365 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-228856 -1 -1 0 256; +#X text 144 637 @mode; +#X text 140 655 @range; +#X text 209 654 - followed by two numbers set low and high range.; +#X text 209 636 - <fold> \, <wrap> \, <clip> & <none>: sets the object +mode; +#X text 110 429 mode <symbol>; +#X text 116 444 range <f \, f>; +#X text 210 429 - sets mode to: none (default) \, clip \, wrap or fold +; +#X text 210 446 - sets low and high values of range; +#X text 19 62 Range limiter in different modes (fold \, wrap & clip) +; +#X obj 4 685 cnv 3 550 3 empty empty more_info 8 12 0 13 -228856 -1 +0; +#X text 140 691 maximum range is always highest value / minimum range +is always lowest value. Wrap mode is useful for modulo arithmetic. +; +#X text 99 91 Use the [pong] object to clip \, fold \, or wrap its +input within the range of a low value and a high value. Beware \, [pong] +is very closely related to [pong~] \, but doesn't work with the same +messages and default values.; +#X obj 225 335 cyclone/pong -10 10 @mode wrap; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 2 4 pd; +#X connect 13 0 54 2; +#X connect 14 0 54 1; +#X connect 24 0 36 0; +#X connect 28 0 54 0; +#X connect 29 0 30 0; +#X connect 30 0 35 0; +#X connect 31 0 36 0; +#X connect 32 0 30 0; +#X connect 33 0 30 0; +#X connect 34 0 30 0; +#X connect 35 0 31 0; +#X connect 36 0 28 0; +#X connect 36 1 54 0; +#X connect 54 0 41 0; diff --git a/externals/miXed/doc/help/cyclone/pong~-help.pd b/externals/miXed/doc/help/cyclone/pong~-help.pd new file mode 100644 index 000000000..54e0202c9 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/pong~-help.pd @@ -0,0 +1,238 @@ +#N canvas 577 23 563 816 10; +#X obj 5 770 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#N canvas 616 310 360 252 META 0; +#X text 0 19 LICENSE SIBSD; +#X text 0 133 LIBRARY cyclone; +#X text 0 114 OUTLET_0 signal; +#X text 0 0 KEYWORDS signal fold wrap range; +#X text 0 38 DESCRIPTION fold or wrap a signal within a given range +; +#X text 0 57 INLET_0 signal float mode; +#X text 0 76 INLET_1 flaot signal; +#X text 0 95 INLET_2 float signal; +#X text 1 153 VERSION 0.2-beta1; +#X text 1 171 AUTHOR Krzysztof Czaja; +#X text 2 189 RELEASE_DATE 2002; +#X text 3 208 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 3 240 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X restore 506 772 pd META; +#X obj 5 550 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 5 587 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#X obj 5 710 cnv 3 550 3 empty empty more_info 8 12 0 13 -228856 -1 +0; +#N canvas 312 452 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 202 772 pd Related_objects; +#X obj 84 418 cnv 17 3 76 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 84 560 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 4 40 cnv 15 552 40 empty empty pong~ 3 12 0 18 -204280 -1 0 +; +#X text 206 502 - set low range; +#X obj 84 525 cnv 17 3 17 empty empty 2 5 9 0 16 -228856 -162280 0 +; +#X obj 84 501 cnv 17 3 17 empty empty 1 5 9 0 16 -228856 -162280 0 +; +#X text 203 526 - set high range; +#X text 147 560 signal; +#X text 136 613 2) float; +#X text 136 630 3) float; +#X obj 510 48 pong~; +#X msg 92 242 mode \$1; +#X floatatom 305 241 0 -100 100 0 - - -; +#X floatatom 228 220 0 -100 100 0 - - -; +#X obj 123 391 cnv 5 5 5 empty empty -1 6 2 0 14 -262144 -1 0; +#X obj 132 301 cnv 5 5 5 empty empty 1 6 2 0 14 -262144 -1 0; +#X obj 231 195 hsl 128 15 -1 1 0 0 empty empty empty -2 -8 0 10 -228856 +-1 -1 0 1; +#X text 110 502 float/signal; +#X text 110 526 float/signal; +#X text 109 420 float/signal; +#X obj 92 161 vradio 15 1 0 4 empty empty empty 0 -8 0 10 -228856 -1 +-1 0; +#X floatatom 92 224 2 0 0 0 - - -, f 2; +#X text 111 159 mode 0: fold; +#X text 111 174 mode 1: wrap; +#X text 111 189 mode 2: clip; +#X text 264 194 low range; +#X obj 308 218 hsl 128 15 -1 1 0 0 empty empty empty -2 -8 0 10 -228856 +-1 -1 0 1; +#X text 346 218 high range; +#X obj 5 408 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#X obj 5 658 cnv 3 550 3 empty empty attributes 8 12 0 13 -228856 -1 +0; +#X text 154 663 @mode; +#X text 148 681 @range; +#X text 136 596 1) float; +#X text 207 682 - followed by two numbers set low and high range.; +#X text 110 438 mode <float>; +#X text 204 438 - 0 (fold) \, 1 (wrap) \, 2 (clip) & 3 (none); +#X text 204 419 - value to limit in a given range; +#X text 204 560 - original \, clipped \, wrapped \, or folded signal +; +#X text 207 664 - <fold> \, <wrap> \, <clip> & <none>: sets the object +mode; +#X text 48 94 Use the [pong~] object to fold \, wrap or clip its input +within the range of a given low and high value. Beware \, [pong~] is +very closely related to [pong] \, but doesn't work with the same messages +and default values.; +#X text 110 476 range <f \, f>; +#X text 204 477 - sets low and high values of range; +#X text 141 716 maximum range is always highest value / minimum range +is always lowest value. Wrap mode is useful for modulo arithmetic. +; +#X text 204 596 - mode: 0 (fold - default) \, 1 (wrap) \, 2 (clip) +\, 3 (none); +#X text 103 456 mode <symbol>; +#X text 20 63 Range limiter in different modes (fold \, wrap & clip) +; +#X text 203 456 - sets mode to: <fold> \, <wrap> \, <clip> or <none> +; +#X text 206 613 - low range value (default 0); +#X text 206 629 - high range value (default 1); +#X text 111 205 mode 3: none; +#X obj 152 267 cyclone/pong~ 1 -0.25 0.25; +#X obj 152 234 phasor~ 1; +#X obj 152 297 scope~ 198 100 256 3 128 -1 1 0 0 0 0 205 229 232 74 +79 77 96 98 102 0; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 3 5 pd; +#N canvas 673 40 366 264 (subpatch) 0; +#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 -74965 -212593 +-262144 1 1; +#X obj 215 68 route dsp; +#X obj 215 37 receive pd; +#N canvas 939 367 324 271 set_color 0; +#X obj 47 30 inlet; +#X obj 96 146 s \$0-cnv; +#X msg 96 114 color -4.86997e+06 -1.34937e+07; +#N canvas 0 22 712 637 off 0; +#X obj 490 220 * -1; +#X obj 424 300 +; +#X obj 409 325 +; +#X obj 347 219 * -65536; +#X obj 424 220 * -256; +#X obj 409 356 - 1; +#X obj 390 189 unpack f f f; +#X obj 225 295 +; +#X obj 210 320 +; +#X obj 148 214 * -65536; +#X obj 225 215 * -256; +#X obj 291 215 * -1; +#X obj 210 351 - 1; +#X obj 191 184 unpack f f f; +#X obj 379 423 pack; +#X msg 378 447 color \$1 \$2; +#X msg 395 152 124 124 124; +#X msg 203 154 220 220 220; +#X obj 238 121 t b b; +#X obj 238 81 inlet; +#X obj 378 485 outlet; +#X connect 0 0 1 1; +#X connect 1 0 2 1; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 1 0; +#X connect 5 0 14 1; +#X connect 6 0 3 0; +#X connect 6 1 4 0; +#X connect 6 2 0 0; +#X connect 7 0 8 1; +#X connect 8 0 12 0; +#X connect 9 0 8 0; +#X connect 10 0 7 0; +#X connect 11 0 7 1; +#X connect 12 0 14 0; +#X connect 13 0 9 0; +#X connect 13 1 10 0; +#X connect 13 2 11 0; +#X connect 14 0 15 0; +#X connect 15 0 20 0; +#X connect 16 0 6 0; +#X connect 17 0 13 0; +#X connect 18 0 17 0; +#X connect 18 1 16 0; +#X connect 19 0 18 0; +#X restore 47 113 pd off; +#X obj 47 83 select 0 1; +#X obj 47 168 list append 0; +#X obj 47 195 list trim; +#X obj 47 220 s \$0-tgl-r; +#X connect 0 0 4 0; +#X connect 2 0 1 0; +#X connect 2 0 5 0; +#X connect 3 0 1 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 4 1 2 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X restore 215 165 pd set_color; +#X obj 135 122 r \$0-tgl-s; +#N canvas 0 22 450 300 (subpatch) 0; +#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 -74965 -212593 +0; +#X coords 0 -1 1 1 42 27 1 100 100; +#X restore 51 144 pd; +#X obj 226 139 s \$0-tgl-r; +#X msg 226 115 set \$1; +#X msg 135 177 \; pd dsp \$1; +#N canvas 256 32 278 194 load_check 0; +#X obj 136 53 sig~ 1; +#X obj 74 24 loadbang; +#X obj 136 86 snapshot~; +#X obj 91 52 del 5; +#X obj 136 151 outlet; +#X obj 74 103 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 74 126 switch~; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 0 5 0; +#X connect 5 0 6 0; +#X restore 51 72 pd load_check; +#X connect 1 0 3 0; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 4 0 8 0; +#X connect 4 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 0 0; +#X coords 0 -1 1 1 44 72 2 50 100; +#X restore 503 101 pd; +#X connect 17 0 56 0; +#X connect 18 0 56 2; +#X connect 19 0 56 1; +#X connect 22 0 19 0; +#X connect 26 0 27 0; +#X connect 27 0 17 0; +#X connect 32 0 18 0; +#X connect 56 0 58 0; +#X connect 57 0 56 0; diff --git a/externals/miXed/doc/help/cyclone/pow~-help.pd b/externals/miXed/doc/help/cyclone/pow~-help.pd new file mode 100644 index 000000000..536d59cd0 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/pow~-help.pd @@ -0,0 +1,98 @@ +#N canvas 428 35 558 537 10; +#X obj -1 674 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 423 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 598 305 385 244 META 0; +#X text 7 118 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 -15 LICENSE SIBSD; +#X text 7 99 AUTHOR Miller Puckette; +#X text 7 137 RELEASE_DATE 1997; +#X text 7 80 LIBRARY cyclone; +#X text 7 156 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 7 61 OUTLET_0 signal; +#X text 7 42 INLET_1 flaot signal; +#X text 7 -34 KEYWORDS signal power exponent base; +#X text 7 4 DESCRIPTION take base to the exponent power using signals +; +#X text 7 23 INLET_0 signal; +#X restore 503 676 pd META; +#X obj -1 505 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 542 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 582 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 328 438 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 208 676 pd Related_objects; +#X obj 81 432 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 459 cnv 17 3 35 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header pow~ 3 12 0 18 +-204280 -1 0; +#X obj 514 8 pow~; +#X text 11 23 Take base to the exponent power using signals; +#X text 107 432 signal; +#X text 181 432 - signal to take to exponent power; +#X obj 81 516 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 107 459 float; +#X text 107 478 signal; +#X text 181 468 - base of power function; +#X text 107 515 signal; +#X text 181 515 - output of power function; +#X text 89 554 1) float; +#X text 181 554 - set intial power (default 0); +#X obj 317 261 *~ 0.2; +#X msg 317 140 -7 \, 1 1500 -1 1500 -7 300; +#X obj 339 205 sig~ 2; +#X obj 317 237 pow~; +#X obj 31 92 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 31 353 dac~; +#X obj 31 303 *~; +#X obj 31 230 *~ 440; +#X msg 31 135 -1 \, 1 3000; +#X obj 31 267 cycle~; +#X obj 31 194 pow~ 2; +#X text 43 248 result goes from 220 to 880 Hz; +#X text 103 136 pitch glissando; +#X obj 316 327 Scope~ 130 77 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X text 53 93 click to hear something; +#X obj 80 327 Scope~ 129 75 256 3 128 -1 1 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 317 173 Line~ -7; +#X obj 31 157 Line~ -1; +#X obj 483 53 pddp/dsp; +#X text 114 597 pow~ is useful for generating curves from line~. In +the example above \, pow~ with an argument 2 (for 2 to the exponent +specified by the input signal) is used to generate a pitch glissando. +; +#X text 72 180 optional argument determines the base of the power +function. Default is 0; +#X text 349 236 base can be a signal or float; +#X text 295 87 amplitude envelope. 2 to the -7 doesn't completely +shut off the signal...; +#X obj 9 674 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 22 0 28 1; +#X connect 22 0 35 0; +#X connect 23 0 38 0; +#X connect 24 0 25 1; +#X connect 25 0 22 0; +#X connect 26 0 30 0; +#X connect 26 0 23 0; +#X connect 28 0 27 0; +#X connect 28 0 37 0; +#X connect 29 0 31 0; +#X connect 30 0 39 0; +#X connect 31 0 28 0; +#X connect 32 0 29 0; +#X connect 38 0 25 0; +#X connect 39 0 32 0; diff --git a/externals/miXed/doc/help/cyclone/prepend-help.pd b/externals/miXed/doc/help/cyclone/prepend-help.pd new file mode 100644 index 000000000..53432b8d7 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/prepend-help.pd @@ -0,0 +1,99 @@ +#N canvas 425 36 552 646 10; +#X obj -1 874 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 667 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 1023 204 494 253 META 0; +#X text 82 183 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 82 57 LICENSE SIBSD; +#X text 82 165 AUTHOR Miller Puckette; +#X text 82 201 RELEASE_DATE 1997; +#X text 82 147 LIBRARY cyclone; +#X text 82 219 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 82 39 KEYWORDS prepend message before front; +#X text 82 75 DESCRIPTION prepend a message with another message; +#X text 82 93 INLET_0 message set; +#X text 82 111 INLET_1 message; +#X text 82 129 OUTLET_0 message; +#X restore 501 876 pd META; +#X obj -1 761 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 798 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 840 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 634 538 430 118 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 14 35 list prepend; +#X restore 205 876 pd Related_objects; +#X obj 80 679 cnv 17 3 36 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 732 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header prepend 5 13 0 +18 -204280 -1 0; +#X obj 10 876 pddp/pddplink help.pd -text help; +#X obj 491 5 prepend; +#X obj 438 24 pddp/pddplink http://wiki.puredata.info/en/help -text +pdpedia: prepend; +#X text 11 23 prepend a message with another message; +#X text 105 678 message; +#X text 201 678 - message to prepend something to; +#X text 105 698 set <message>; +#X text 201 698 - changes what to prepend with <message>; +#X text 105 771 message; +#X text 201 771 - new message with prepended text; +#X text 105 812 1) message; +#X text 201 813 - initial message to prepend; +#X obj 80 772 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 105 732 message; +#X text 201 732 - changes what to prepend; +#X msg 169 184 set a quick brown fox; +#X msg 191 210 jumps; +#X text 128 156 1; +#X text 155 183 2; +#X text 172 210 3; +#X obj 145 268 prepend typewriters; +#X msg 145 156 are boring; +#X obj 145 298 prepend set; +#X text 307 183 "set" changes what to prepend; +#X msg 145 325 a quick brown fox are boring; +#X msg 145 428 are boring; +#X obj 145 612 prepend set; +#X msg 145 639 this is not are boring; +#X msg 191 487 typewriters; +#X obj 145 587 prepend; +#X msg 184 465 234; +#X msg 198 510 symbol people; +#X msg 202 532 list this is a list; +#X msg 206 554 this is not; +#X text 219 156 the message to put something in front of; +#X text 267 260 optional argument sets initial message to prepend +; +#X text 36 129 place a message in front of the incoming message:; +#X text 58 359 This object also has a non-Max/MSP behavior (although +it is still compatible with the Max/MSP prepend). If [prepend] is created +without an argument \, then it has a right inlet. This right inlet +allows you to set what to prepend:; +#X obj 8 53 cnv 15 386 65 empty empty IMPORTANT! 5 11 0 12 -247381 +-1 0; +#X text 13 72 [prepend] is an abstraction replacing legacy behavior +of [prepend] in cyclone library and is considered deprecated in pd-l2ork. +Please use [list prepend] and [list append] instead., f 62; +#X connect 25 0 30 0; +#X connect 26 0 30 0; +#X connect 30 0 32 0; +#X connect 31 0 30 0; +#X connect 32 0 34 0; +#X connect 35 0 39 0; +#X connect 36 0 37 0; +#X connect 38 0 39 1; +#X connect 39 0 36 0; +#X connect 40 0 39 1; +#X connect 41 0 39 1; +#X connect 42 0 39 1; +#X connect 43 0 39 1; diff --git a/externals/miXed/doc/help/cyclone/prepend.pd b/externals/miXed/doc/help/cyclone/prepend.pd new file mode 100644 index 000000000..6d05573fb --- /dev/null +++ b/externals/miXed/doc/help/cyclone/prepend.pd @@ -0,0 +1,26 @@ +#N canvas 421 184 585 297 10; +#X obj 94 175 list prepend; +#X obj 94 197 list trim; +#X obj 163 67 loadbang; +#X obj 94 91 inlet; +#X obj 94 219 outlet; +#X obj 227 141 inlet; +#X obj 163 94 list append \$1; +#X text -1 0 This is a legacy replacement for prepend in cyclone library. +Please use [list prepend] and [list append] instead.; +#X obj 94 123 route set; +#X obj 207 193 loadbang; +#X obj 207 261 print [prepend]; +#X msg 207 214 this object is a legacy replacement for prepend in cyclone +library that is considered deprecated in pd-l2ork. Please use [list +prepend] and [list append] instead.; +#X connect 0 0 1 0; +#X connect 1 0 4 0; +#X connect 2 0 6 0; +#X connect 3 0 8 0; +#X connect 5 0 0 1; +#X connect 6 0 0 1; +#X connect 8 0 0 1; +#X connect 8 1 0 0; +#X connect 9 0 11 0; +#X connect 11 0 10 0; diff --git a/externals/miXed/doc/help/cyclone/prob-help.pd b/externals/miXed/doc/help/cyclone/prob-help.pd new file mode 100644 index 000000000..0655c357d --- /dev/null +++ b/externals/miXed/doc/help/cyclone/prob-help.pd @@ -0,0 +1,108 @@ +#N canvas 428 32 558 554 10; +#X obj -1 723 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 493 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 620 322 359 239 META 0; +#X text 10 88 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 -45 LICENSE SIBSD; +#X text 10 69 AUTHOR Miller Puckette; +#X text 10 107 RELEASE_DATE 1997; +#X text 10 50 LIBRARY cyclone; +#X text 10 126 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 -64 KEYWORDS random generator weighted; +#X text 10 -26 DESCRIPTION weighted series of random numbers; +#X text 10 -7 INLET_0 list bang message; +#X text 10 31 OUTLET_1 bang; +#X text 10 12 OUTLET_0 float; +#X restore 500 726 pd META; +#X obj -1 623 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 686 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 314 452 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 199 726 pd Related_objects; +#X obj 77 502 cnv 17 3 110 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 77 659 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header prob 3 12 0 18 +-204280 -1 0; +#X obj 514 6 prob; +#C restore; +#X text 11 23 weighted series of random numbers; +#X text 16 50 coll maintains a probability matrix a.k.a 1st order; +#X text 16 62 markov chain and outputs a number according to it.; +#X text 31 94 0 has a 80% chance to be followed by 1 \, and; +#X text 31 106 a 10% chance to be followed by 2 or 3; +#X obj 55 158 prob; +#C restore; +#X floatatom 55 183 5 0 0 0 - - -, f 5; +#X msg 55 126 0 1 80 \, 0 2 10 \, 0 3 10; +#X msg 124 257 0 1 30 \, 0 2 30 \, 0 3 40; +#X msg 150 281 1 2 30 \, 1 0 70; +#X floatatom 100 451 5 0 0 0 - - -, f 5; +#X obj 121 430 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 120 236 load probabilities:; +#X text 142 427 bang when we reach a number for which we have no rule +; +#X obj 100 220 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 178 375 reset 0; +#X obj 100 405 prob; +#C restore; +#X msg 175 352 clear; +#X text 216 351 clear matrix:; +#X msg 164 305 dump; +#X text 196 303 print out all rules; +#X msg 172 329 embed; +#X text 211 328 save matrix with the patch; +#X text 105 502 list; +#X text 177 502 - list of triplets \, specifying probability function +in form <x \, y \, prob> where x has an prob% chance of being followed +by y; +#X text 105 550 bang; +#X text 177 550 - puts out a number and sets prob to this value; +#X text 105 572 message; +#X text 105 632 float; +#X text 177 632 - random number based on prob function; +#X obj 77 632 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 105 659 bang; +#X text 177 572 - clear: clear matrix \, dump: print out all rule \, +embed: save matrix with the patch \, reset: when get stuck (reach number +for which there is no rule); +#X text 177 659 - when we reach a number for which there is no rule +; +#X text 105 695 (none); +#X text 229 375 when we get stuck reset to 0; +#X obj 350 161 prob; +#C restore; +#X floatatom 350 186 5 0 0 0 - - -, f 5; +#X obj 350 108 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 360 133 0; +#X text 390 132 resets prob to 0; +#X text 370 96 puts out a number and sets prob to this value; +#X obj 13 724 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 16 0; +#X connect 17 0 15 0; +#X connect 18 0 26 0; +#X connect 19 0 26 0; +#X connect 24 0 26 0; +#X connect 25 0 26 0; +#X connect 26 0 20 0; +#X connect 26 1 21 0; +#X connect 27 0 26 0; +#X connect 29 0 26 0; +#X connect 31 0 26 0; +#X connect 46 0 47 0; +#X connect 48 0 46 0; +#X connect 48 0 49 0; +#X connect 49 0 46 0; diff --git a/externals/miXed/doc/help/cyclone/pv-help.pd b/externals/miXed/doc/help/cyclone/pv-help.pd new file mode 100644 index 000000000..4587edd5d --- /dev/null +++ b/externals/miXed/doc/help/cyclone/pv-help.pd @@ -0,0 +1,62 @@ +#N canvas 426 34 558 433 10; +#X obj -1 405 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 267 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 612 216 369 225 META 0; +#X text -67 136 WEBSITE http://crca.ucsd.edu/~msp/; +#X text -67 22 LICENSE SIBSD; +#X text -67 117 AUTHOR Miller Puckette; +#X text -67 155 RELEASE_DATE 1997; +#X text -67 98 LIBRARY cyclone; +#X text -67 174 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text -67 3 KEYWORDS private variable patch store; +#X text -67 41 DESCRIPTION private variables for patch and its subpatches +; +#X text -67 60 INLET_0 message bang; +#X text -67 79 OUTLET_0 message; +#X restore 502 407 pd META; +#X obj -1 324 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 361 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 313 327 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 198 407 pd Related_objects; +#X obj 81 277 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 333 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header pv 3 12 0 18 -204280 +-1 0; +#X obj 56 109 pv my_private_bar; +#X obj 56 198 pv my_private_bar; +#X msg 56 172 bang; +#X obj 56 227 print my_private_bar; +#X msg 56 85 foo; +#X text 110 275 message; +#X text 185 275 - message to set as stored private variable; +#X text 110 294 bang; +#X text 185 294 - output stored pv; +#X text 110 333 message; +#X text 185 333 - stored private variable; +#X text 92 373 1) message; +#X text 185 373 - name of private variable; +#X obj 501 7 pv foo; +#X obj 292 199 pv my_private_bar; +#X msg 292 173 bang; +#X obj 292 228 print my_private_underground_bar; +#X text 276 150 also works here:; +#X text 37 47 store message in variablemy_private_bar:; +#X text 40 149 ...then access it here:; +#X text 12 23 private variables for patch and its subpatches; +#X obj 11 407 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 10 0 12 0; +#X connect 11 0 10 0; +#X connect 13 0 9 0; +#X connect 23 0 25 0; +#X connect 24 0 23 0; diff --git a/externals/miXed/doc/help/cyclone/rampsmooth~-help.pd b/externals/miXed/doc/help/cyclone/rampsmooth~-help.pd new file mode 100644 index 000000000..1b3b1395a --- /dev/null +++ b/externals/miXed/doc/help/cyclone/rampsmooth~-help.pd @@ -0,0 +1,88 @@ +#N canvas 427 29 559 598 10; +#X obj -1 571 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 383 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 605 387 372 212 META 0; +#X text 12 133 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 12 19 LICENSE SIBSD; +#X text 12 114 AUTHOR Miller Puckette; +#X text 12 152 RELEASE_DATE 1997; +#X text 12 95 LIBRARY cyclone; +#X text 12 171 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 12 76 OUTLET_0 signal; +#X text 12 0 KEYWORDS signal ramp smooth; +#X text 12 38 DESCRIPTION smooth out an incoming signal via a ramp +; +#X text 12 57 INLET_0 signal ramp rampup rampdown; +#X restore 500 573 pd META; +#X obj -1 475 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 512 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 317 491 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 206 573 pd Related_objects; +#X obj 81 392 cnv 17 3 70 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 485 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header rampsmooth~ 3 12 +0 18 -204280 -1 0; +#X text 11 23 smooth out an incoming signal via a ramp; +#X text 110 392 signal; +#X text 230 392 - incoming signal to smooth out; +#X msg 111 162 1; +#X msg 80 162 0; +#X msg 273 223 rampdown \$1; +#X floatatom 273 204 0 0 0 0 - - -; +#X msg 197 223 rampup \$1; +#X floatatom 197 204 0 0 0 0 - - -; +#X obj 94 223 sig~; +#X floatatom 94 204 0 0 0 0 - - -; +#X msg 136 223 ramp \$1; +#X floatatom 136 204 0 0 0 0 - - -; +#X text 243 254 args: <rampup> <rampdown>; +#X obj 218 292 Scope~ 140 64 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 94 296 Snapshot~ 100; +#X obj 94 339 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 94 255 rampsmooth~ 44100 44100; +#X text 110 484 signal; +#X text 230 484 - output ramped signal; +#X text 92 521 1) float; +#X text 92 542 2) float; +#X text 230 521 - rampup value; +#X text 230 542 - rampdown value; +#X text 110 428 rampup <float>; +#X text 110 410 ramp <float>; +#X text 110 446 rampdown <float>; +#X text 230 410 - set ramp value; +#X text 230 428 - set rampup value; +#X text 47 55 rampsmooth~ smooths an incoming signal across n samples. +Each time an incoming value changes \, it begins a linear ramp of n +samples to reach this value. Useful for envelope following and lowpass +filtering. The number of samples is specified either as arguments or +with the ramp \, rampup \, rampdown messages.; +#X obj 469 8 rampsmooth~; +#X obj 476 49 pddp/dsp; +#X text 230 446 - set rampdown value; +#X obj 13 572 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 12 0 19 0; +#X connect 13 0 19 0; +#X connect 14 0 26 0; +#X connect 15 0 14 0; +#X connect 16 0 26 0; +#X connect 17 0 16 0; +#X connect 18 0 26 0; +#X connect 19 0 18 0; +#X connect 20 0 26 0; +#X connect 21 0 20 0; +#X connect 24 0 25 0; +#X connect 26 0 23 0; +#X connect 26 0 24 0; diff --git a/externals/miXed/doc/help/cyclone/rand~-help.pd b/externals/miXed/doc/help/cyclone/rand~-help.pd new file mode 100644 index 000000000..3ee229e5c --- /dev/null +++ b/externals/miXed/doc/help/cyclone/rand~-help.pd @@ -0,0 +1,110 @@ +#N canvas 421 35 559 362 10; +#X obj -1 335 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 213 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 615 163 350 207 META 0; +#X text 8 121 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 8 7 LICENSE SIBSD; +#X text 8 102 AUTHOR Miller Puckette; +#X text 8 140 RELEASE_DATE 1997; +#X text 8 83 LIBRARY cyclone; +#X text 8 159 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 8 64 OUTLET_0 signal; +#X text 8 -12 KEYWORDS signal band limited bandlimited random noise +; +#X text 8 26 DESCRIPTION bandlimited random noise; +#X text 8 45 INLET_0 float; +#X restore 502 337 pd META; +#X obj -1 253 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 290 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 308 259 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 201 337 pd Related_objects; +#X obj 80 224 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 263 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header rand~ 3 12 0 18 +-204280 -1 0; +#X text 11 23 bandlimited random noise; +#X obj 504 9 rand~; +#X text 115 224 float; +#X text 180 224 - set frequency; +#X floatatom 140 143 0 0 100 0 - - -; +#N canvas 159 26 532 285 output 0; +#X obj 338 160 t b; +#X obj 338 110 f; +#X obj 338 60 inlet; +#X text 344 29 mute; +#X obj 338 185 f; +#X msg 426 180 0; +#X msg 338 85 bang; +#X obj 338 135 moses 1; +#X obj 397 110 moses 1; +#X obj 83 148 dbtorms; +#X obj 397 85 r master-lvl; +#X obj 83 42 r master-lvl; +#X obj 338 210 s master-lvl; +#X obj 20 155 inlet~; +#X obj 199 41 inlet; +#X text 199 18 level; +#X obj 199 105 s master-lvl; +#X msg 96 65 set \$1; +#X obj 96 90 outlet; +#X msg 214 65 \; pd dsp 1; +#X obj 83 198 line~; +#X obj 20 207 *~; +#X obj 20 232 dac~; +#X obj 83 173 pack 0 50; +#X text 20 132 audio; +#X text 96 114 show level; +#X obj 426 155 t b; +#X obj 20 181 hip~ 1; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 12 0; +#X connect 5 0 12 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 26 0; +#X connect 8 1 4 1; +#X connect 9 0 23 0; +#X connect 10 0 1 1; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 17 0; +#X connect 13 0 27 0; +#X connect 14 0 16 0; +#X connect 14 0 19 0; +#X connect 17 0 18 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 21 0 22 1; +#X connect 23 0 20 0; +#X connect 26 0 5 0; +#X connect 27 0 21 0; +#X restore 115 167 pd output; +#X msg 166 143 MUTE; +#X floatatom 115 71 5 0 0 0 - - -, f 5; +#X text 154 70 frequency; +#X obj 115 106 rand~ 800; +#X text 179 106 optional arg sets initial freq; +#X text 115 263 signal; +#X text 180 263 - random noise signal; +#X text 97 302 1) float; +#X text 180 302 - set intial frequency; +#X obj 478 51 pddp/dsp; +#X obj 13 335 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 13 0 14 1; +#X connect 14 0 13 0; +#X connect 15 0 14 2; +#X connect 16 0 18 0; +#X connect 18 0 14 0; diff --git a/externals/miXed/doc/help/cyclone/record~-help.pd b/externals/miXed/doc/help/cyclone/record~-help.pd new file mode 100644 index 000000000..0bbfac91c --- /dev/null +++ b/externals/miXed/doc/help/cyclone/record~-help.pd @@ -0,0 +1,130 @@ +#N canvas 427 35 560 556 10; +#X obj -1 779 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 531 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 623 319 349 250 META 0; +#X text 5 173 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 5 21 LICENSE SIBSD; +#X text 5 154 AUTHOR Miller Puckette; +#X text 5 192 RELEASE_DATE 1997; +#X text 5 135 LIBRARY cyclone; +#X text 5 211 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 5 116 OUTLET_0 signal; +#X text 5 2 KEYWORDS signal read write sample record; +#X text 5 40 DESCRIPTION read and write sample values; +#X text 5 59 INLET_0 signal toggle set; +#X text 5 97 INLET_2 float; +#X text 5 78 INLET_1 float; +#X restore 501 781 pd META; +#X obj -1 680 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 717 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 299 459 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 14 30 tabwrite~; +#X restore 192 781 pd Related_objects; +#X obj 80 542 cnv 17 3 65 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj 80 621 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n+1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header record~ 3 12 0 +18 -204280 -1 0; +#X obj 490 10 record~; +#X text 10 23 read and write sample values; +#X text 123 575 toggle; +#X text 208 575 - start/stop recording; +#X text 110 689 signal; +#X text 195 689 - recorded signal; +#X text 123 557 signal; +#X text 208 557 - signal to record; +#X text 123 594 set <table>; +#X text 208 594 - change buffer for recording values; +#X obj 80 652 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n+2 5 9 0 16 -228856 +-162280 0; +#X text 123 621 float; +#X text 208 621 - startpoint in the table in msec; +#X obj 80 689 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 123 652 float; +#X text 208 652 - endpoint in the table in msec; +#X text 105 726 1) table; +#X text 195 726 - buffer to hold recorded date; +#X text 105 746 2) float; +#X text 195 746 - enable multichannel ( can be 1 \, 2 \, 4); +#X obj 224 331 adc~; +#X obj 263 78 tgl 15 0 record empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 263 381 record~ table; +#N canvas 0 0 450 300 (subpatch) 0; +#X array table 44100 float 0; +#X coords 0 1 44099 -1 200 140 1; +#X restore 21 89 graph; +#X obj 263 470 snapshot~; +#X obj 282 449 metro 10; +#X floatatom 263 497 5 0 0 0 - - -, f 5; +#X obj 282 408 r record; +#X text 311 496 end of table = 1; +#X text 286 76 start/stop recording; +#X msg 293 137 append \$1; +#X obj 293 114 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 282 429 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 311 189 loop \$1; +#X obj 311 166 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X text 336 167 record continously; +#X msg 333 224 set table; +#X text 408 225 change table; +#X floatatom 300 331 5 0 0 0 - - -, f 5; +#X floatatom 338 358 5 0 0 0 - - -, f 5; +#X obj 476 48 pddp/dsp; +#X text 319 95 in append mode stop/restart will continue were it was +stopped \, off by default; +#X text 372 349 endpoint in the table in msec; +#X text 334 318 startpoint in the table in msec; +#X obj 9 780 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X text 122 540 n = number of channels given by argument (1 \, 2 \, +or 4); +#N canvas 433 184 296 326 More... 0; +#X obj 47 150 record~ smp 2; +#N canvas 0 0 450 300 (subpatch) 0; +#X array 0-smp 22050 float 0; +#X coords 0 1 22049 -1 80 60 1; +#X restore 44 231 graph; +#N canvas 0 0 450 300 (subpatch) 0; +#X array 1-smp 22050 float 0; +#X coords 0 1 22049 -1 80 60 1; +#X restore 169 232 graph; +#X obj 64 106 adc~; +#X obj 47 77 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X text 33 55 optional int arg is nr of channels:; +#X text 148 150 can be 1 \, 2 or 4; +#X text 33 181 table naming convention is; +#X text 34 194 0...4-tablename:; +#X text 32 42 enable multichannel by using an; +#X connect 3 0 0 0; +#X connect 3 1 0 1; +#X connect 4 0 0 0; +#X restore 27 486 pd More...; +#X connect 29 0 31 0; +#X connect 30 0 31 0; +#X connect 31 0 33 0; +#X connect 33 0 35 0; +#X connect 34 0 33 0; +#X connect 36 0 41 0; +#X connect 39 0 31 0; +#X connect 40 0 39 0; +#X connect 41 0 34 0; +#X connect 42 0 31 0; +#X connect 43 0 42 0; +#X connect 45 0 31 0; +#X connect 47 0 31 1; +#X connect 48 0 31 2; diff --git a/externals/miXed/doc/help/cyclone/reson~-help.pd b/externals/miXed/doc/help/cyclone/reson~-help.pd new file mode 100644 index 000000000..051f9db6f --- /dev/null +++ b/externals/miXed/doc/help/cyclone/reson~-help.pd @@ -0,0 +1,101 @@ +#N canvas 428 33 555 550 10; +#X obj -1 779 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 384 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 613 283 362 275 META 0; +#X text 11 161 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 -23 LICENSE SIBSD; +#X text 11 142 AUTHOR Miller Puckette; +#X text 11 180 RELEASE_DATE 1997; +#X text 11 123 LIBRARY cyclone; +#X text 11 199 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 11 104 OUTLET_0 signal; +#X text 11 47 INLET_1 flaot signal; +#X text 11 66 INLET_2 float signal; +#X text 11 -42 KEYWORDS signal bandpass filter gain frequency; +#X text 11 -4 DESCRIPTION bandpass filter controllable by center frequency +and Q; +#X text 11 28 INLET_0 signal; +#X text 11 85 INLET_3 float signal; +#X restore 501 781 pd META; +#X obj -1 554 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 591 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 660 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 320 447 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 202 781 pd Related_objects; +#X obj 81 393 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 509 cnv 17 3 33 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header reson~ 3 12 0 18 +-204280 -1 0; +#X obj 486 10 reson~; +#X text 12 23 Bandpass filter controllable by center frequency and +Q; +#X text 110 393 signal; +#X text 207 393 - input signal to send through bandpass filter; +#X obj 81 420 cnv 17 3 33 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 81 464 cnv 17 3 33 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj 81 564 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 110 481 float; +#X text 207 427 - set gain; +#X text 110 462 signal; +#X text 207 473 - center frequency; +#X text 110 438 float; +#X text 110 418 signal; +#X text 110 528 float; +#X text 110 509 signal; +#X text 207 520 - set Q \, the range; +#X text 110 564 signal; +#X text 207 564 - filtered output; +#X text 91 600 1) float; +#X text 207 600 - initial gain; +#X text 91 617 2) float; +#X text 91 633 3) float; +#X text 207 617 - initial center freq; +#X text 207 633 - initial range; +#X text 105 674 reson~ implements the following filter equation: y[n] += gain * (x[n] - r * x[n-2]) + c1 * y[n-1] + c2 * y[n-2] \, where r +\, c1 \, and c2 are parameters calculated from the input center frequency +and Q. Q is the filter bandwidth divided by center frequency. Inputs +can be floats or signals. The specification is similar to the nres +unit generator in cmusic.; +#X obj 63 344 dac~; +#X obj 63 305 *~ 0.2; +#X floatatom 150 226 0 0 0 0 - - -; +#X msg 122 156 200 \, 10000 4000; +#X obj 64 83 noise~; +#X text 161 254 optional arguments set values of gain \, center frequency +\, and Q (default 0 \, 0 \, 0.01); +#X obj 63 256 reson~ 1 200 23; +#X obj 122 179 Line~ 200; +#X floatatom 92 125 0 0 0 0 - - -; +#X obj 474 49 pddp/dsp; +#X text 228 156 <--list sets gain \, cf \, q (works unless there are +any signal inputs for filter parameters); +#X text 174 225 Try range of 1-100; +#X text 150 206 Q:; +#X text 120 136 center freq:; +#X text 89 104 gain:; +#X text 61 60 input signal:; +#X obj 9 779 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 36 0 35 0; +#X connect 36 0 35 1; +#X connect 37 0 41 3; +#X connect 38 0 42 0; +#X connect 39 0 41 0; +#X connect 41 0 36 0; +#X connect 42 0 41 2; +#X connect 43 0 41 1; diff --git a/externals/miXed/doc/help/cyclone/round-help.pd b/externals/miXed/doc/help/cyclone/round-help.pd new file mode 100644 index 000000000..b99772906 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/round-help.pd @@ -0,0 +1,117 @@ +#N canvas 552 23 566 776 10; +#X obj 3 734 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#X obj 3 507 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#N canvas 582 203 552 521 META 0; +#X text 0 20 LICENSE SIBSD; +#X text 0 123 LIBRARY cyclone; +#X text 0 143 VERSION 0.2-beta1; +#X text 2 198 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 2 230 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X text 0 161 AUTHOR Derek Kwan; +#X text 0 0 KEYWORDS round; +#X text 1 179 RELEASE_DATE 2016; +#X text 0 60 INLET_0 float list message; +#X text 0 80 INLET_1 float; +#X text 2 101 OUTLET_0 float list; +#X text 0 40 DESCRIPTION rounds floats or lists of floats; +#X restore 506 736 pd META; +#X obj 3 603 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 3 640 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#N canvas 283 325 428 171 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 13 55 cyclone/minimum~; +#X obj 13 33 cyclone/maximum~; +#X obj 13 77 cyclone/pong~; +#X obj 13 99 cyclone/round~; +#X restore 206 736 pd Related_objects; +#X obj 83 612 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 3 39 cnv 15 552 40 empty empty round 3 12 0 18 -204280 -1 0 +; +#X text 123 654 1) float; +#X obj 82 566 cnv 17 3 25 empty empty 1 5 9 0 16 -228856 -162280 0 +; +#X obj 83 514 cnv 17 3 45 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 3 678 cnv 3 550 3 empty empty attributes 8 12 0 13 -228856 -1 +0; +#X text 6 61 rounds floats or lists of floats; +#X obj 514 49 round; +#X text 111 613 float/list; +#X msg 381 375 0.5 5 8; +#X text 139 566 float; +#X floatatom 288 320 0 0 0 0 - - -; +#X text 110 512 float/list; +#X text 194 511 - value(s) to round; +#X obj 291 295 hsl 128 15 0 10 0 0 empty empty empty -2 -8 0 10 -228856 +-1 -1 0 1; +#X obj 72 317 nbx 6 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-228856 -1 -1 0 256; +#X obj 381 435 cyclone/tosymbol; +#X symbolatom 381 466 15 0 0 0 - - -, f 15; +#X floatatom 468 375 5 0 0 0 - - -, f 5; +#X obj 381 403 cyclone/round 3; +#X obj 72 290 trigger b a; +#X msg 72 262 nearest \$1; +#X obj 72 230 tgl 25 0 empty empty empty 17 7 0 10 -228856 -1 -1 0 +1; +#X text 259 420 works with lists:; +#X obj 381 349 loadbang; +#X text 105 95 [round] approximates positive and negative numbers to +an integer multiple of any given number that is greater or equal to +0 (0 makes no approximention - original input is output).; +#X text 104 158 it works in two modes \, rounding to the nearest multiple +(default) or to the approximating to the truncated multiple value. +; +#X text 128 532 nearest; +#X text 192 613 - approximated value(s); +#X text 115 697 @nearest <int>; +#X text 192 654 - value to round to (default = 0 \, no rounding); +#X text 214 696 - sets mode: non zero = round (default) \, 0 = truncate +; +#X text 111 235 (1 = round \, 0 truncate); +#X obj 135 349 cyclone/round 1 @nearest 0; +#X obj 135 384 nbx 6 18 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 14 +-228856 -1 -1 0 256; +#X text 194 531 - "nearest" followed by 0 sets to "truncate mode" \, +non zero number sets to "round mode" (default).; +#X text 192 566 - value to round to (whose multple values will be approximated +to); +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 2 4 pd; +#X connect 15 0 25 0; +#X connect 17 0 39 1; +#X connect 20 0 17 0; +#X connect 21 0 39 0; +#X connect 22 0 23 0; +#X connect 24 0 25 1; +#X connect 25 0 22 0; +#X connect 26 0 21 0; +#X connect 26 1 39 0; +#X connect 27 0 26 0; +#X connect 28 0 27 0; +#X connect 30 0 15 0; +#X connect 39 0 40 0; diff --git a/externals/miXed/doc/help/cyclone/round~-help.pd b/externals/miXed/doc/help/cyclone/round~-help.pd new file mode 100644 index 000000000..718c97079 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/round~-help.pd @@ -0,0 +1,206 @@ +#N canvas 484 188 560 779 10; +#X obj 3 724 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#X obj 3 493 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#N canvas 582 203 552 521 META 0; +#X text 0 20 LICENSE SIBSD; +#X text 0 123 LIBRARY cyclone; +#X text 0 143 VERSION 0.2-beta1; +#X text 2 198 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 2 230 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X text 0 161 AUTHOR Derek Kwan; +#X text 0 0 KEYWORDS round; +#X text 1 179 RELEASE_DATE 2016; +#X text 0 60 INLET_0 float list message; +#X text 0 80 INLET_1 float; +#X text 2 101 OUTLET_0 float list; +#X text 0 40 DESCRIPTION rounds floats or lists of floats; +#X restore 506 726 pd META; +#X obj 3 592 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 3 629 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#N canvas 283 325 428 171 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 13 55 cyclone/minimum~; +#X obj 13 33 cyclone/maximum~; +#X obj 13 77 cyclone/pong~; +#X obj 13 99 cyclone/round~; +#X restore 206 726 pd Related_objects; +#X obj 79 601 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 3 38 cnv 15 552 40 empty empty round~ 3 12 0 18 -204280 -1 0 +; +#X text 123 643 1) float; +#X obj 78 554 cnv 17 3 25 empty empty 1 5 9 0 16 -228856 -162280 0 +; +#X obj 79 502 cnv 17 3 45 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 3 667 cnv 3 550 3 empty empty attributes 8 12 0 13 -228856 -1 +0; +#X text 6 60 rounds floats or lists of floats; +#X text 111 602 float/list; +#X floatatom 281 265 0 0 0 0 - - -; +#X text 193 499 - value(s) to round; +#X obj 284 240 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -228856 +-1 -1 0 1; +#X msg 154 236 nearest \$1; +#X obj 154 204 tgl 25 0 empty empty empty 17 7 0 10 -228856 -1 -1 0 +1; +#X text 191 602 - approximated value(s); +#X text 88 690 @nearest <int>; +#X text 191 643 - value to round to (default = 0 \, no rounding); +#X text 192 690 - sets mode: non zero = round (default) \, 0 = truncate +; +#X text 186 207 (1 = round \, 0 truncate); +#X text 193 519 - "nearest" followed by 0 sets to "truncate mode" \, +non zero number sets to "round mode" (default).; +#X text 44 99 [round~] approximates positive and negative signal values +to an integer multiple of any given number that is greater or equal +to 0 (0 makes no approximention - original input is output). It works +in two modes \, rounding to the nearest multiple (default) or to the +approximating to the truncated multiple value.; +#X obj 110 294 cyclone/round~ 0.1 @nearest 0; +#X text 135 500 signal; +#X text 99 555 float/signal; +#X text 191 554 - value to round to (whose multple values will be approximated +to); +#X text 128 520 nearest; +#X obj 509 48 round~; +#X obj 110 331 cyclone/Scope~ 269 134 2 3 128 -1 1 190 0 0 0 205 229 +232 74 79 77 96 98 102 0; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 3 4 pd; +#X obj 78 226 osc~ 150; +#N canvas 673 40 366 264 (subpatch) 0; +#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 -74965 -212593 +-262144 1 1; +#X obj 215 68 route dsp; +#X obj 215 37 receive pd; +#N canvas 939 367 324 271 set_color 0; +#X obj 47 30 inlet; +#X obj 96 146 s \$0-cnv; +#X msg 96 114 color -4.86997e+06 -1.34937e+07; +#N canvas 0 22 712 637 off 0; +#X obj 490 220 * -1; +#X obj 424 300 +; +#X obj 409 325 +; +#X obj 347 219 * -65536; +#X obj 424 220 * -256; +#X obj 409 356 - 1; +#X obj 390 189 unpack f f f; +#X obj 225 295 +; +#X obj 210 320 +; +#X obj 148 214 * -65536; +#X obj 225 215 * -256; +#X obj 291 215 * -1; +#X obj 210 351 - 1; +#X obj 191 184 unpack f f f; +#X obj 379 423 pack; +#X msg 378 447 color \$1 \$2; +#X msg 395 152 124 124 124; +#X msg 203 154 220 220 220; +#X obj 238 121 t b b; +#X obj 238 81 inlet; +#X obj 378 485 outlet; +#X connect 0 0 1 1; +#X connect 1 0 2 1; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 1 0; +#X connect 5 0 14 1; +#X connect 6 0 3 0; +#X connect 6 1 4 0; +#X connect 6 2 0 0; +#X connect 7 0 8 1; +#X connect 8 0 12 0; +#X connect 9 0 8 0; +#X connect 10 0 7 0; +#X connect 11 0 7 1; +#X connect 12 0 14 0; +#X connect 13 0 9 0; +#X connect 13 1 10 0; +#X connect 13 2 11 0; +#X connect 14 0 15 0; +#X connect 15 0 20 0; +#X connect 16 0 6 0; +#X connect 17 0 13 0; +#X connect 18 0 17 0; +#X connect 18 1 16 0; +#X connect 19 0 18 0; +#X restore 47 113 pd off; +#X obj 47 83 select 0 1; +#X obj 47 168 list append 0; +#X obj 47 195 list trim; +#X obj 47 220 s \$0-tgl-r; +#X connect 0 0 4 0; +#X connect 2 0 1 0; +#X connect 2 0 5 0; +#X connect 3 0 1 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 4 1 2 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X restore 215 165 pd set_color; +#X obj 135 122 r \$0-tgl-s; +#N canvas 0 22 450 300 (subpatch) 0; +#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 -74965 -212593 +0; +#X coords 0 -1 1 1 42 27 1 100 100; +#X restore 51 144 pd; +#X obj 226 139 s \$0-tgl-r; +#X msg 226 115 set \$1; +#X msg 135 177 \; pd dsp \$1; +#N canvas 256 32 278 194 load_check 0; +#X obj 136 53 sig~ 1; +#X obj 74 24 loadbang; +#X obj 136 86 snapshot~; +#X obj 91 52 del 5; +#X obj 136 151 outlet; +#X obj 74 103 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 74 126 switch~; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 0 5 0; +#X connect 5 0 6 0; +#X restore 51 72 pd load_check; +#X connect 1 0 3 0; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 4 0 8 0; +#X connect 4 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 0 0; +#X coords 0 -1 1 1 44 72 2 50 100; +#X restore 503 91 pd; +#X connect 14 0 26 1; +#X connect 16 0 14 0; +#X connect 17 0 26 0; +#X connect 18 0 17 0; +#X connect 26 0 32 0; +#X connect 34 0 26 0; diff --git a/externals/miXed/doc/help/cyclone/sah~-help.pd b/externals/miXed/doc/help/cyclone/sah~-help.pd new file mode 100644 index 000000000..460e56679 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/sah~-help.pd @@ -0,0 +1,89 @@ +#N canvas 429 34 552 520 10; +#X obj -1 736 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 429 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 617 284 356 243 META 0; +#X text 10 165 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 32 LICENSE SIBSD; +#X text 10 146 AUTHOR Miller Puckette; +#X text 10 184 RELEASE_DATE 1997; +#X text 10 127 LIBRARY cyclone; +#X text 10 203 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 108 OUTLET_0 signal; +#X text 10 13 KEYWORDS signal sample hold arpeggiator; +#X text 10 89 INLET_1 signal; +#X text 10 70 INLET_0 signal float; +#X text 10 51 DESCRIPTION sample-and-hold; +#X restore 499 738 pd META; +#X obj -1 517 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 554 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 604 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 311 415 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 198 738 pd Related_objects; +#X obj 79 439 cnv 17 3 34 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 527 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header sah~ 3 12 0 18 +-204280 -1 0; +#X obj 508 8 sah~; +#X text 108 437 signal; +#X obj 79 488 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 108 487 signal; +#X text 179 487 - control signal; +#X text 179 438 - input signal to sample; +#X text 108 527 signal; +#X text 179 527 - output samples of input signal when control triggers +; +#X text 90 565 1) float; +#X text 179 564 - sets trigger value for control input (default 0) +\, needs to be above 0 to work with phasor~; +#X text 106 614 The sah~ object accepts two signals. The left signal +is the "input" and the right signal is the "control." When the control +makes a transition from being at or below the trigger value to being +above the trigger value \, the input is sampled and its current value +is output until another control transition occurs and the input is +sampled again. The default threshold value is 0 \, but can be specified +via a float in the left inlet or as an argument to sah~.; +#X obj 93 320 cycle~; +#X obj 93 292 *~ 1000; +#X obj 93 348 *~ 0.2; +#X floatatom 93 99 0 0 0 0 - - -; +#X obj 93 123 phasor~ 20; +#X floatatom 144 183 0 0 0 0 - - -; +#X floatatom 103 149 0 0 0 0 - - -; +#X obj 93 383 dac~; +#X obj 144 205 phasor~ 11.33; +#X text 166 232 Optional argument sets trigger value for control input +(default 0) \; you need a trigger above 0 to work with phasor~; +#X text 27 54 You've heard it before: the classic arpeggiator \, made +with two phasor~ objects; +#X text 145 292 sah~ output used as the frequency of an oscillator +; +#X text 128 148 set trigger; +#X obj 93 243 sah~ 0.01; +#X obj 477 47 pddp/dsp; +#X text 9 23 Sample-and-hold; +#X text 108 457 float; +#X text 179 458 - set trigger; +#X obj 13 736 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 21 0 23 0; +#X connect 22 0 21 0; +#X connect 23 0 28 0; +#X connect 23 0 28 1; +#X connect 24 0 25 0; +#X connect 25 0 34 0; +#X connect 26 0 29 0; +#X connect 27 0 34 0; +#X connect 29 0 34 1; +#X connect 34 0 22 0; diff --git a/externals/miXed/doc/help/cyclone/sampstoms~-help.pd b/externals/miXed/doc/help/cyclone/sampstoms~-help.pd new file mode 100644 index 000000000..532d9534e --- /dev/null +++ b/externals/miXed/doc/help/cyclone/sampstoms~-help.pd @@ -0,0 +1,73 @@ +#N canvas 427 35 558 460 10; +#X obj -1 433 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 266 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 596 209 385 259 META 0; +#X text 5 198 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 5 52 LICENSE SIBSD; +#X text 5 179 AUTHOR Miller Puckette; +#X text 5 217 RELEASE_DATE 1997; +#X text 5 160 LIBRARY cyclone; +#X text 5 236 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 5 122 OUTLET_0 signal; +#X text 5 103 INLET_0 signal float; +#X text 5 33 KEYWORDS signal samples sample ms milliseconds convert +; +#X text 5 141 OUTLET_1 float; +#X text 5 71 DESCRIPTION convert nummber of samples at sampling rate +to milliseconds; +#X restore 503 435 pd META; +#X obj -1 325 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 388 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 316 355 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 200 435 pd Related_objects; +#X obj 78 275 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 77 360 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header sampstoms~ 3 12 +0 18 -204280 -1 0; +#X obj 476 10 sampstoms~; +#X text 105 274 float; +#X text 178 274 - number of samples; +#X text 105 294 signal; +#X text 178 294 - number of sample in (as signal); +#X text 105 334 signal; +#X text 178 334 - number of ms out \, as signal; +#X msg 291 102 0 \, 44100 3000; +#X floatatom 291 223 0 0 0 0 - - -; +#X obj 291 162 sampstoms~; +#X floatatom 88 168 0 0 0 0 - - -; +#X obj 31 136 sampstoms~; +#X floatatom 31 113 0 0 0 0 - - -; +#X text 56 113 number of samples in; +#X text 300 183 milliseconds out (as a signal); +#X text 301 146 number of samples in (as a signal); +#X obj 291 201 Snapshot~ 100; +#X obj 291 127 Line~; +#X text 105 399 (none); +#X text 105 360 float; +#X text 178 360 - number of ms; +#X obj 77 334 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 480 54 pddp/dsp; +#X text 12 74 Use as a calculator or for float parameters:; +#X text 116 161 number of milliseconds out; +#X text 269 75 or convert signal values:; +#X text 11 23 Convert number of samples at sampling rate to milliseconds +; +#X obj 12 435 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 16 0 26 0; +#X connect 18 0 25 0; +#X connect 20 1 19 0; +#X connect 21 0 20 0; +#X connect 25 0 17 0; +#X connect 26 0 18 0; diff --git a/externals/miXed/doc/help/cyclone/seq-help.pd b/externals/miXed/doc/help/cyclone/seq-help.pd new file mode 100644 index 000000000..80a4c220c --- /dev/null +++ b/externals/miXed/doc/help/cyclone/seq-help.pd @@ -0,0 +1,100 @@ +#N canvas 431 34 559 616 10; +#X obj -1 795 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 454 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 612 382 377 243 META 0; +#X text 15 160 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 15 27 LICENSE SIBSD; +#X text 15 141 AUTHOR Miller Puckette; +#X text 15 179 RELEASE_DATE 1997; +#X text 15 122 LIBRARY cyclone; +#X text 15 198 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 15 8 KEYWORDS player play record MIDI midi; +#X text 15 46 DESCRIPTION simple MIDI file player and recorder; +#X text 15 65 INLET_0 midiin read bang other_message; +#X text 15 84 OUTLET_0 midiout; +#X text 15 103 OUTLET_1 bang; +#X restore 501 797 pd META; +#X obj -1 564 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 626 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 667 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 324 515 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 203 797 pd Related_objects; +#X obj 78 463 cnv 17 3 90 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 573 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header seq 3 12 0 18 -204280 +-1 0; +#X obj 519 8 seq; +#X text 107 462 midiin; +#X text 227 460 - realtime midimessage to play/record; +#X text 107 484 read <midi-file>; +#X text 227 484 - read midi-file to play/record; +#X text 107 507 bang; +#X text 227 507 - play; +#X text 107 528 other message; +#X text 227 528 - stop \, pause \, continue \, record \, stop record +\, write <midi-file>; +#X text 107 572 midiout; +#X text 227 572 - ouput for midi being read; +#X text 106 638 (none); +#X text 106 678 cyclone's [seq] input accepts midi files and realtime +midi messages through [midiin]. All trakcs of a multi-track midi file +are merged into one. [notein] may be connected through a [midiformat] +object. Left inlet outputs midi data to [midiout]. [noteout] may be +connected through a [midiparse] object. Right inlet outputs a bang +message at the sequence's end \, useful for loops. [seq] has his own +midi list editor.; +#X msg 200 269 write test1.mid; +#X msg 216 341 bang; +#X msg 188 229 record; +#X msg 164 107 stop; +#X obj 216 322 bng 15 250 50 0 empty empty empty 0 -6 0 10 -262144 +-1 -1; +#X msg 194 249 stop record; +#X obj 75 425 midiout; +#X obj 75 346 midiin; +#X msg 207 290 read test1.mid; +#X msg 170 128 pause; +#X msg 175 149 continue; +#X text 244 322 loop; +#X text 254 340 play; +#X text 181 393 <-- click object to open list editor; +#X text 298 268 save in patch folder; +#X msg 181 170 goto; +#X msg 149 63 read test.mid; +#X obj 149 392 seq; +#X text 11 24 simple MIDI file player and recorder; +#X obj 78 600 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 107 599 bang; +#X text 227 599 - bang output at sequence's end; +#X text 188 207 recording:; +#X text 242 56 <-- midi file should be in the same folder or an open +window popups to pick file; +#X obj 14 798 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 23 0 40 0; +#X connect 24 0 40 0; +#X connect 25 0 40 0; +#X connect 26 0 40 0; +#X connect 27 0 24 0; +#X connect 28 0 40 0; +#X connect 30 0 29 0; +#X connect 30 0 40 0; +#X connect 31 0 40 0; +#X connect 32 0 40 0; +#X connect 33 0 40 0; +#X connect 38 0 40 0; +#X connect 39 0 40 0; +#X connect 40 0 29 0; +#X connect 40 1 27 0; diff --git a/externals/miXed/doc/help/cyclone/sinh-help.pd b/externals/miXed/doc/help/cyclone/sinh-help.pd new file mode 100644 index 000000000..3cc510c85 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/sinh-help.pd @@ -0,0 +1,64 @@ +#N canvas 429 39 558 449 10; +#X obj 0 421 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 1 270 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 609 231 369 231 META 0; +#X text 8 152 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 8 32 LICENSE SIBSD; +#X text 8 132 AUTHOR Miller Puckette; +#X text 8 172 RELEASE_DATE 1997; +#X text 8 112 LIBRARY cyclone; +#X text 8 72 INLET_0 float bang; +#X text 8 92 OUTLET_0 float; +#X text 8 192 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 0.201305; +#X text 8 12 KEYWORDS sin sine sinh hyperbolic; +#X text 8 52 DESCRIPTION takes the hyperbolic sine value of a float +; +#X restore 500 423 pd META; +#X obj 2 335 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 2 372 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 318 349 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 48 37 cosh; +#X restore 204 423 pd Related_objects; +#X obj 82 344 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header sinh 3 12 0 18 +-204280 -1 0; +#X text 112 284 float; +#X text 112 304 bang; +#X text 112 344 float; +#X text 96 388 1) float; +#X text 187 388 - optional initial value to compute; +#X obj 513 9 sinh; +#X text 11 24 calculate hyperbolic sine function; +#X floatatom 320 187 8 0 0 0 - - -, f 8; +#X msg 320 121 bang; +#X obj 320 154 sinh 0.2; +#X text 187 284 - the number to take sinh of; +#X text 187 304 - output sinh of stored value; +#X obj 82 284 cnv 17 3 36 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X floatatom 146 189 8 0 0 0 - - -, f 8; +#X obj 146 140 / 100; +#X floatatom 146 116 5 0 0 0 - - -, f 5; +#X obj 146 165 sinh 0.2; +#X text 60 63 outputs the hyperbolic sine value of input float value. +; +#X text 187 344 - sinh of stored value; +#X text 42 107 with input as float value to take cosh of; +#X text 394 113 with bang button and argument inside cosh object +; +#X obj 12 420 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 16 0 17 0; +#X connect 17 0 15 0; +#X connect 22 0 24 0; +#X connect 23 0 22 0; +#X connect 24 0 21 0; diff --git a/externals/miXed/doc/help/cyclone/sinh~-help.pd b/externals/miXed/doc/help/cyclone/sinh~-help.pd new file mode 100644 index 000000000..0f8b25de9 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/sinh~-help.pd @@ -0,0 +1,75 @@ +#N canvas 427 36 559 477 10; +#X obj 0 448 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 322 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 603 260 370 225 META 0; +#X text 17 139 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 17 19 LICENSE SIBSD; +#X text 17 119 AUTHOR Miller Puckette; +#X text 17 159 RELEASE_DATE 1997; +#X text 17 99 LIBRARY cyclone; +#X text 17 59 INLET_0 signal; +#X text 17 79 OUTLET_0 signal; +#X text 17 -1 KEYWORDS hyperbolic sine sinh signal; +#X text 17 39 DESCRIPTION takes the hyperbolic sine function for signals +; +#X text 17 179 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 497 450 pd META; +#X obj 0 365 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 402 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 310 376 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 48 42 cosh~; +#X restore 198 450 pd Related_objects; +#X obj 79 375 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header sinh~ 3 12 0 18 +-204280 -1 0; +#X text 113 336 signal; +#X text 113 375 signal; +#X text 113 416 (none); +#X obj 507 8 sinh~; +#X text 16 24 Hyperbolic sine function (sinh(x)) for signals; +#X obj 44 88 cycle~ 2; +#X msg 371 169 range -12 12; +#X obj 282 131 -~ 3.14159; +#X obj 282 108 *~ 6.28319; +#X obj 282 86 phasor~ 2; +#X obj 44 119 *~ 3.14159; +#X obj 282 196 Scope~ 166 87 256 3 128 -12 12 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 44 195 Scope~ 170 86 256 3 128 -12 12 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 371 148 loadbang; +#X obj 282 155 sinh~; +#X obj 44 150 sinh~; +#X text 176 336 - input to sinh function; +#X text 176 375 - output of sinh function; +#X obj 482 49 pddp/dsp; +#X msg 133 168 range -12 12; +#X obj 133 147 loadbang; +#X text 115 122 be greater than 1; +#X text 114 110 input values must; +#X text 350 80 this is probably only useful for mathematical calculations +; +#X obj 79 336 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 13 448 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 13 0 18 0; +#X connect 14 0 19 0; +#X connect 15 0 22 0; +#X connect 16 0 15 0; +#X connect 17 0 16 0; +#X connect 18 0 23 0; +#X connect 21 0 14 0; +#X connect 22 0 19 0; +#X connect 23 0 20 0; +#X connect 27 0 20 0; +#X connect 28 0 27 0; diff --git a/externals/miXed/doc/help/cyclone/sinx~-help.pd b/externals/miXed/doc/help/cyclone/sinx~-help.pd new file mode 100644 index 000000000..9178fe7cf --- /dev/null +++ b/externals/miXed/doc/help/cyclone/sinx~-help.pd @@ -0,0 +1,62 @@ +#N canvas 428 37 558 504 10; +#X obj 0 475 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 286 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 623 285 359 228 META 0; +#X text 4 231 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 4 111 LICENSE SIBSD; +#X text 4 211 AUTHOR Miller Puckette; +#X text 4 251 RELEASE_DATE 1997; +#X text 4 191 LIBRARY cyclone; +#X text 4 151 INLET_0 signal; +#X text 4 171 OUTLET_0 signal; +#X text 4 270 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 4 89 KEYWORDS sine sinx signal sin; +#X text 4 131 DESCRIPTION takes the sine function for signals; +#X restore 504 477 pd META; +#X obj 0 327 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 364 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 0 402 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 331 403 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 42 37 cosx~; +#X obj 42 63 sin~; +#X restore 212 477 pd Related_objects; +#X obj 79 299 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 336 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header sinx~ 3 12 0 18 +-204280 -1 0; +#X text 113 336 signal; +#X text 113 299 signal; +#X text 112 374 (none); +#X obj 509 8 sinx~; +#X msg 276 147 range -1 1; +#X obj 181 107 *~ 6.28319; +#X obj 181 82 phasor~ 2; +#X obj 181 171 Scope~ 164 85 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 276 124 loadbang; +#X obj 181 132 sinx~; +#X text 172 299 - signal to take sinx of; +#X text 172 336 - sin of signal; +#X obj 482 46 pddp/dsp; +#X text 113 415 this is a real sine function whose input expects values +between 0 and 2pi (unlike sin~ which is designed to work with phasor~'s +output from 0 to 1); +#X text 22 23 sine function (sin(x)) for signals; +#X obj 12 478 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 14 0 17 0; +#X connect 15 0 19 0; +#X connect 16 0 15 0; +#X connect 18 0 14 0; +#X connect 19 0 17 0; diff --git a/externals/miXed/doc/help/cyclone/slide~-help.pd b/externals/miXed/doc/help/cyclone/slide~-help.pd new file mode 100644 index 000000000..c330397d0 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/slide~-help.pd @@ -0,0 +1,87 @@ +#N canvas 428 36 558 588 10; +#X obj -1 639 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 357 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 601 340 377 257 META 0; +#X text 10 187 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 43 LICENSE SIBSD; +#X text 10 169 AUTHOR Miller Puckette; +#X text 10 205 RELEASE_DATE 1997; +#X text 10 151 LIBRARY cyclone; +#X text 10 223 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 133 OUTLET_0 signal; +#X text 10 79 INLET_0 signal; +#X text 10 97 INLET_1 float; +#X text 10 115 INLET_2 float; +#X text 10 61 DESCRIPTION smooth-out changes in signal values; +#X text 10 12 KEYWORDS signal smooth smooth-out changes slideup slidedown +slide; +#X restore 500 641 pd META; +#X obj -1 446 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 483 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 547 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 321 491 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 202 641 pd Related_objects; +#X obj 80 366 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 456 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header slide~ 3 12 0 18 +-204280 -1 0; +#X obj 498 11 slide~; +#X text 18 24 Smooth-out changes in signal values; +#X obj 80 392 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 80 419 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 264 148 args: <slideup> <slidedown>; +#X floatatom 247 127 0 0 0 0 - - -; +#X msg 172 60 1; +#X msg 133 60 0; +#X text 272 126 slide down; +#X floatatom 200 102 0 0 0 0 - - -; +#X obj 154 115 sig~; +#X floatatom 154 85 0 0 0 0 - - -; +#X text 225 101 slide up; +#X obj 172 192 Scope~ 142 71 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 155 291 Snapshot~ 100; +#X obj 155 316 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 +-262144 -1 -1 0 256 0; +#X obj 154 150 slide~ 5000 5000; +#X text 107 366 signal; +#X text 182 366 - signal to smooth out; +#X text 107 392 float; +#X text 107 419 float; +#X text 182 392 - slideup value; +#X text 182 419 - slidedown vlaue; +#X text 107 456 signal; +#X text 182 456 - smoothed out signal; +#X text 90 496 1) float; +#X text 90 518 2) float; +#X text 109 565 Slide filters an input signal logarithmically between +changes in signal value. The formula is y(n) = y(n-1) + ((x(n) - y(n-1))/slide). +It's particularly useful for envelope following and lowpass filtering. +; +#X obj 478 50 pddp/dsp; +#X text 182 496 - initial slideup value; +#X text 182 518 - initial slidedown vlaue; +#X obj 9 640 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 26 2; +#X connect 16 0 21 0; +#X connect 17 0 21 0; +#X connect 19 0 26 1; +#X connect 20 0 26 0; +#X connect 21 0 20 0; +#X connect 24 0 25 0; +#X connect 26 0 23 0; +#X connect 26 0 24 0; diff --git a/externals/miXed/doc/help/cyclone/speedlim-help.pd b/externals/miXed/doc/help/cyclone/speedlim-help.pd new file mode 100644 index 000000000..278247ced --- /dev/null +++ b/externals/miXed/doc/help/cyclone/speedlim-help.pd @@ -0,0 +1,65 @@ +#N canvas 422 36 559 465 10; +#X obj -1 438 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 223 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 606 247 361 228 META 0; +#X text 10 155 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 22 LICENSE SIBSD; +#X text 10 136 AUTHOR Miller Puckette; +#X text 10 174 RELEASE_DATE 1997; +#X text 10 117 LIBRARY cyclone; +#X text 10 193 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 3 KEYWORDS delay speed limit ms milliseconds; +#X text 10 41 DESCRIPTION speed limit for incoming messages; +#X text 10 60 INLET_0 anything; +#X text 10 98 OUTLET_1 anything; +#X text 10 79 INLET_1 float; +#X restore 501 440 pd META; +#X obj -1 286 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 339 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 384 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 304 363 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 200 440 pd Related_objects; +#X obj 78 232 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 299 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header speedlim 3 12 0 +18 -204280 -1 0; +#X obj 78 259 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X obj 489 10 speedlim; +#X text 11 23 speed limit for incoming messages; +#X obj 134 135 speedlim 300; +#X floatatom 134 176 5 0 0 0 - - -, f 5; +#X floatatom 134 77 5 0 0 0 - - -, f 5; +#X floatatom 203 103 5 0 0 0 - - -, f 5; +#X text 107 259 float; +#X text 107 231 anything; +#X text 107 298 anything; +#X text 178 231 - message to input; +#X text 178 298 - output message only if minimum delay between outputs +is met; +#X text 89 355 1) float; +#X text 178 355 - delay time; +#X text 121 396 clock message (as in the max version) not supported +for; +#X text 121 409 obvious reasons.; +#X text 170 76 input; +#X text 219 128 optional arg is minimum delay between input to output +in milliseconds; +#X text 241 102 change delay time (ms); +#X text 178 259 - change delay time (ms); +#X obj 11 441 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 13 0 14 0; +#X connect 15 0 13 0; +#X connect 16 0 13 1; diff --git a/externals/miXed/doc/help/cyclone/spell-help.pd b/externals/miXed/doc/help/cyclone/spell-help.pd new file mode 100644 index 000000000..2278cb954 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/spell-help.pd @@ -0,0 +1,54 @@ +#N canvas 427 38 561 392 10; +#X obj -1 365 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 244 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 585 214 379 219 META 0; +#X text 9 117 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 9 3 LICENSE SIBSD; +#X text 9 98 AUTHOR Miller Puckette; +#X text 9 136 RELEASE_DATE 1997; +#X text 9 79 LIBRARY cyclone; +#X text 9 155 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 9 -16 KEYWORDS ascii values convert; +#X text 9 22 DESCRIPTION convert input to ascii values; +#X text 9 41 INLET_0 list; +#X text 9 60 OUTLET_0 list; +#X restore 502 367 pd META; +#X obj -1 282 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 319 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 435 319 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 199 367 pd Related_objects; +#X obj 79 253 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 291 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header spell 3 12 0 18 +-204280 -1 0; +#X obj 505 9 spell; +#X text 11 23 convert input to ascii values; +#X text 118 253 list; +#X text 179 253 - list of any nubers \, text \, etc to concert to ascii +; +#X text 118 291 list; +#X text 179 291 - ascii values of data from inlet; +#X obj 208 177 spell; +#X obj 208 205 print spell; +#X msg 208 56 63; +#X msg 226 112 t h i s; +#X msg 220 83 34 45; +#X msg 230 140 or that; +#X text 116 332 (none); +#X obj 9 365 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 16 0; +#X connect 17 0 15 0; +#X connect 18 0 15 0; +#X connect 19 0 15 0; +#X connect 20 0 15 0; diff --git a/externals/miXed/doc/help/cyclone/spike~-help.pd b/externals/miXed/doc/help/cyclone/spike~-help.pd new file mode 100644 index 000000000..fc7a92b0b --- /dev/null +++ b/externals/miXed/doc/help/cyclone/spike~-help.pd @@ -0,0 +1,75 @@ +#N canvas 419 37 558 484 10; +#X obj -1 457 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 294 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 583 246 378 247 META 0; +#X text 6 135 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 6 2 LICENSE SIBSD; +#X text 6 116 AUTHOR Miller Puckette; +#X text 6 154 RELEASE_DATE 1997; +#X text 6 97 LIBRARY cyclone; +#X text 6 173 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 6 59 INLET_1 float; +#X text 6 -30 KEYWORDS signal intervals transitions refractory zero +non-zero; +#X text 6 21 DESCRIPTION report intervals of zero to non-zero transitions +; +#X text 6 40 INLET_0 signal; +#X text 6 78 OUTLET_0 float bang; +#X restore 500 459 pd META; +#X obj -1 355 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 414 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 306 384 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 459 pd Related_objects; +#X obj 81 303 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 366 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header spike~ 3 12 0 18 +-204280 -1 0; +#X text 11 23 Report intervals of zero to non-zero transitions; +#X text 108 303 signal; +#X text 181 303 - input signal to detect transitions; +#X obj 81 329 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 109 329 float; +#X text 181 329 - set refractory period; +#X text 109 364 float; +#X text 181 364 - report time interval of zero to non-zero transitions +; +#X text 104 425 (none); +#X text 110 386 bang; +#X text 181 386 - bang when number output; +#X obj 499 10 spike~; +#X obj 479 55 pddp/dsp; +#X obj 234 155 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 207 155 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 207 131 edge~; +#X obj 187 242 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X floatatom 220 184 0 0 0 0 - - -; +#X floatatom 186 77 0 0 0 0 - - -; +#X floatatom 220 241 0 0 0 0 - - -; +#X obj 186 105 train~ 85.5; +#X text 214 77 adjust interval; +#X text 249 185 set refractory period; +#X obj 187 208 spike~; +#X obj 8 459 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 24 0 23 0; +#X connect 24 1 22 0; +#X connect 26 0 32 1; +#X connect 27 0 29 0; +#X connect 29 0 24 0; +#X connect 29 0 32 0; +#X connect 32 0 25 0; +#X connect 32 0 28 0; diff --git a/externals/miXed/doc/help/cyclone/split-help.pd b/externals/miXed/doc/help/cyclone/split-help.pd new file mode 100644 index 000000000..3b3638f06 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/split-help.pd @@ -0,0 +1,82 @@ +#N canvas 426 35 560 535 10; +#X obj -1 508 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 281 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 603 279 373 266 META 0; +#X text 7 164 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 -7 LICENSE SIBSD; +#X text 7 145 AUTHOR Miller Puckette; +#X text 7 183 RELEASE_DATE 1997; +#X text 7 126 LIBRARY cyclone; +#X text 7 202 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 7 50 INLET_1 float; +#X text 7 88 OUTLET_0 float; +#X text 7 -26 KEYWORDS min max minimum maximum range; +#X text 7 12 DESCRIPTION look for a range of numbers; +#X text 7 31 INLET_0 list float; +#X text 7 69 INLET_2 float; +#X text 7 107 OUTLET_1 float; +#X restore 500 510 pd META; +#X obj -1 387 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 447 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 319 432 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 510 pd Related_objects; +#X obj 79 290 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 396 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header split 3 12 0 18 +-204280 -1 0; +#X obj 503 10 split; +#X text 11 23 look for a range of numbers; +#X obj 138 181 split 10 20; +#X floatatom 138 230 5 0 0 0 - - -, f 5; +#X floatatom 201 207 5 0 0 0 - - -, f 5; +#X floatatom 146 109 5 0 0 0 - - -, f 5; +#X text 236 206 not in range; +#X text 173 231 in range; +#X floatatom 169 136 5 0 0 0 - - -, f 5; +#X floatatom 201 161 5 0 0 0 - - -, f 5; +#X text 203 136 set min; +#X text 236 160 set max; +#X msg 138 71 3 0 10; +#X obj 79 335 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 79 360 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 111 289 list; +#X text 203 289 - formatat value to compare \, min \, max; +#X text 111 310 float; +#X text 203 310 - number to check if in range; +#X text 111 335 float; +#X text 203 335 - set min; +#X text 111 360 float; +#X text 203 360 - set max; +#X text 93 457 1) float; +#X text 203 457 - initial min; +#X text 93 478 2) float; +#X text 203 478 - initial max; +#X obj 79 420 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 111 396 float; +#X text 203 396 - output if number from inlet 0 in range; +#X text 111 420 float; +#X text 203 420 - output here if number from inlet 0 not in range; +#X text 183 107 value to compare to min/max; +#X text 190 65 3-value list input gives (from left to right) the vaue +to compare \, set new min \, set new max; +#X obj 14 506 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 12 0; +#X connect 11 1 13 0; +#X connect 14 0 11 0; +#X connect 17 0 11 1; +#X connect 18 0 11 2; +#X connect 21 0 11 0; diff --git a/externals/miXed/doc/help/cyclone/spray-help.pd b/externals/miXed/doc/help/cyclone/spray-help.pd new file mode 100644 index 000000000..34a7491da --- /dev/null +++ b/externals/miXed/doc/help/cyclone/spray-help.pd @@ -0,0 +1,60 @@ +#N canvas 417 24 558 436 10; +#X obj -1 408 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 264 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 605 224 355 207 META 0; +#X text 9 92 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 9 -22 LICENSE SIBSD; +#X text 9 73 AUTHOR Miller Puckette; +#X text 9 111 RELEASE_DATE 1997; +#X text 9 54 LIBRARY cyclone; +#X text 9 130 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 9 -41 KEYWORDS integer to number send; +#X text 9 -3 DESCRIPTION distribute an integer to a numbered outlet +; +#X text 9 16 INLET_0 list; +#X text 9 35 OUTLET_N float; +#X restore 500 410 pd META; +#X obj -1 318 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 358 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 298 324 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 201 410 pd Related_objects; +#X obj 86 275 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 86 329 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header spray 3 12 0 18 +-204280 -1 0; +#X obj 503 11 spray; +#X text 11 23 distribute an integer to a numbered outlet; +#X text 114 275 list; +#X text 176 275 - x \, y pairs \, where x is number to send and y is +the outlet number; +#X text 114 329 float; +#X text 176 329 - number send from inlet to specific outlet; +#X text 96 371 1) float; +#X text 176 372 - number of outlets; +#X obj 165 151 spray 3; +#X floatatom 165 221 5 0 0 0 - - -, f 5; +#X floatatom 184 199 5 0 0 0 - - -, f 5; +#X floatatom 204 178 5 0 0 0 - - -, f 5; +#X msg 178 96 1 2; +#X msg 165 73 0 1; +#X msg 188 119 2 3; +#X text 217 150 arg sets number of outlets; +#X text 203 70 outletnumber / value pairs; +#X obj 7 408 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 17 0 18 0; +#X connect 17 1 19 0; +#X connect 17 2 20 0; +#X connect 21 0 17 0; +#X connect 22 0 17 0; +#X connect 23 0 17 0; diff --git a/externals/miXed/doc/help/cyclone/sprintf-help.pd b/externals/miXed/doc/help/cyclone/sprintf-help.pd new file mode 100644 index 000000000..f81dbcafa --- /dev/null +++ b/externals/miXed/doc/help/cyclone/sprintf-help.pd @@ -0,0 +1,54 @@ +#N canvas 427 37 559 385 10; +#X obj 0 357 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 212 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 611 189 366 205 META 0; +#X text 14 103 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 14 -11 LICENSE SIBSD; +#X text 14 84 AUTHOR Miller Puckette; +#X text 14 122 RELEASE_DATE 1997; +#X text 14 65 LIBRARY cyclone; +#X text 14 141 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 14 -30 KEYWORDS print format string; +#X text 14 8 DESCRIPTION format a message of string and numbers; +#X text 14 27 INLET_N message; +#X text 14 46 OUTLET_0 message; +#X restore 500 359 pd META; +#X obj -1 264 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 304 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 319 285 428 113 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 64 41 printf; +#X restore 203 359 pd Related_objects; +#X obj 78 224 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj 78 276 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header sprintf 3 12 0 +18 -204280 -1 0; +#X obj 495 10 sprintf; +#X text 11 23 format a message of strings and numbers; +#X text 115 224 message; +#X text 179 222 - inlet type is speicifed by format string given as +argument to sprintf; +#X text 115 275 message; +#X text 179 275 - the formatted string; +#X obj 157 138 sprintf foo%s-%d; +#X obj 157 172 print; +#X msg 157 75 -bar; +#X floatatom 250 111 5 0 0 0 - - -, f 5; +#X text 191 75 this is the 'hot' inlet; +#X text 263 138 arg is format string; +#X text 98 320 1) string; +#X text 179 320 - the string format to output; +#X obj 11 359 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 16 0; +#X connect 17 0 15 0; +#X connect 18 0 15 1; diff --git a/externals/miXed/doc/help/cyclone/substitute-help.pd b/externals/miXed/doc/help/cyclone/substitute-help.pd new file mode 100644 index 000000000..5ac2c31c4 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/substitute-help.pd @@ -0,0 +1,64 @@ +#N canvas 427 36 558 430 10; +#X obj -1 402 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 226 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 617 203 357 237 META 0; +#X text 203 336 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 203 190 LICENSE SIBSD; +#X text 203 317 AUTHOR Miller Puckette; +#X text 203 355 RELEASE_DATE 1997; +#X text 203 298 LIBRARY cyclone; +#X text 203 374 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 203 171 KEYWORDS substitute symbol replace; +#X text 203 209 DESCRIPTION substitute a symbol for another symbol +in a message; +#X text 203 241 INLET_0 message; +#X text 203 260 INLET_1 message; +#X text 203 279 OUTLET_0 message; +#X restore 496 404 pd META; +#X obj -1 303 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 340 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 314 328 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 200 404 pd Related_objects; +#X obj 78 235 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 312 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header substitute 3 12 +0 18 -204280 -1 0; +#X obj 477 10 substitute; +#X text 11 23 substitute a symbol for another symbol in a message; +#X obj 83 141 substitute foo bar; +#X msg 83 73 bar foo; +#X obj 83 186 print; +#X msg 188 105 bar foo; +#X text 106 235 message; +#X text 181 235 - string to input and check for substitution; +#X obj 78 264 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 106 264 message; +#X text 181 264 - format <str1> <str2> \, change replacement policy +to if see str1 change to str2; +#X text 106 312 message; +#X text 181 312 - output message with replaced strings; +#X text 89 352 1) string; +#X text 89 370 2) string; +#X text 183 352 - string to search for; +#X text 183 370 - string to replace with; +#X text 200 134 arg1 sets initial string to search for \, arg2 sets +initial string to replace it with; +#X text 243 96 string1: set new string to search for \; string2: string +to replace it with; +#X text 136 71 input string to check for substitutions; +#X obj 10 404 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 13 0; +#X connect 12 0 11 0; +#X connect 14 0 11 1; diff --git a/externals/miXed/doc/help/cyclone/sustain-help.pd b/externals/miXed/doc/help/cyclone/sustain-help.pd new file mode 100644 index 000000000..2323574ac --- /dev/null +++ b/externals/miXed/doc/help/cyclone/sustain-help.pd @@ -0,0 +1,97 @@ +#N canvas 427 34 558 562 10; +#X obj -1 534 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#N canvas 611 310 368 258 META 0; +#X text 10 150 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 -21 LICENSE SIBSD; +#X text 10 131 AUTHOR Miller Puckette; +#X text 10 169 RELEASE_DATE 1997; +#X text 10 112 LIBRARY cyclone; +#X text 10 188 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 36 INLET_1 float; +#X text 10 74 OUTLET_0 float; +#X text 10 -40 KEYWORDS pitch velocity hold note offs; +#X text 10 -2 DESCRIPTION hold note offs and output them on request +; +#X text 10 17 INLET_0 list float; +#X text 10 55 INLET_2 toggle; +#X text 10 93 OUTLET_1 float; +#X restore 502 536 pd META; +#X obj -1 429 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 492 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 318 457 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 536 pd Related_objects; +#X obj 80 440 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header sustain 3 12 0 +18 -204280 -1 0; +#X obj 492 10 sustain; +#X text 11 23 hold note offs and output them on request; +#X obj -1 298 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#X obj 80 308 cnv 17 3 45 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 24 179 sustain; +#X floatatom 24 236 5 0 0 0 - - -, f 5; +#X floatatom 63 210 5 0 0 0 - - -, f 5; +#X msg 24 93 44 127; +#X text 69 92 note on =; +#X msg 132 92 pitch velocity; +#X text 226 92 is passed through; +#X text 98 210 velocity; +#X text 59 236 pitch; +#X text 73 118 note off (i.e. velocity = 0); +#X obj 63 155 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X msg 38 118 55 0; +#X text 82 148 when on sustain holds back all note offs; +#X text 82 159 and outputs them when turned off again.; +#X obj 395 179 sustain; +#X obj 434 158 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 395 206 5 0 0 0 - - -, f 5; +#X floatatom 434 205 5 0 0 0 - - -, f 5; +#X floatatom 395 108 5 0 0 0 - - -, f 5; +#X floatatom 414 134 5 0 0 0 - - -, f 5; +#X text 451 131 set velocity; +#X text 430 107 then pitch; +#X text 180 307 - send x \, y pair that represent pitch and velocity +\, velocity zero turns note off; +#X obj 80 389 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 106 389 toggle; +#X text 180 389 - when on \, sustain holds back all note offs and outputs +them when turned off again; +#X text 106 440 float; +#X text 180 440 - pitch; +#X text 105 504 (none); +#X obj 80 465 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 106 465 float; +#X text 180 465 - velocity; +#X text 387 75 alternately:; +#X obj 80 363 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 106 307 list; +#X text 106 363 float; +#X text 180 363 - set velocity; +#X text 106 338 float; +#X text 180 338 - set pitch; +#X obj 5 538 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 12 0; +#X connect 11 1 13 0; +#X connect 14 0 11 0; +#X connect 21 0 11 2; +#X connect 22 0 11 0; +#X connect 25 0 27 0; +#X connect 25 1 28 0; +#X connect 26 0 25 2; +#X connect 29 0 25 0; +#X connect 30 0 25 1; diff --git a/externals/miXed/doc/help/cyclone/svf~-help.pd b/externals/miXed/doc/help/cyclone/svf~-help.pd new file mode 100644 index 000000000..617731aef --- /dev/null +++ b/externals/miXed/doc/help/cyclone/svf~-help.pd @@ -0,0 +1,177 @@ +#N canvas 432 38 559 593 10; +#X obj -1 826 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 422 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 619 316 365 289 META 0; +#X text 10 156 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 -42 LICENSE SIBSD; +#X text 10 138 AUTHOR Miller Puckette; +#X text 10 174 RELEASE_DATE 1997; +#X text 10 120 LIBRARY cyclone; +#X text 10 192 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 -60 KEYWORDS signal filter state variable state-variable +cutoff; +#X text 10 -24 DESCRIPTION state-variable filter; +#X text 10 -6 INLET_0 signal; +#X text 10 12 INLET_1 signal float; +#X text 10 30 INLET_2 signal float; +#X text 10 48 OUTLET_0 signal; +#X text 10 66 OUTLET_1 signal; +#X text 10 84 OUTLET_2 signal; +#X text 10 102 OUTLET_3 signal; +#X restore 499 828 pd META; +#X obj -1 538 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 647 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 704 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 317 494 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 195 828 pd Related_objects; +#X obj 78 431 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 547 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header svf~ 3 12 0 18 +-204280 -1 0; +#X obj 491 9 svf~; +#X text 12 24 state-variable filter; +#X obj 78 498 cnv 17 3 33 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 106 431 signal; +#X text 178 431 - signal to filter; +#X text 106 497 signal; +#X text 106 515 float; +#X text 106 455 signal; +#X text 106 472 float; +#X text 178 463 - set cutoff frequency; +#X text 178 505 - set resonance (0-1); +#X obj 78 456 cnv 17 3 33 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 78 572 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 78 595 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 89 658 1) float; +#X text 89 680 2) float; +#X text 106 785 Floats or signals can modify these in real-time. The +value of these parameters is only sampled once per signal vector.; +#X text 106 739 One of its advantages is that the it produces low-pass +\, high-pass \, band-pass \, and band-reject (notch) output simultaneously +- so all four are available in parallel.; +#X text 106 711 svf~ implements Chamberlin's state-variable filter +algorithm.; +#X obj 109 394 dac~; +#N canvas 976 146 556 460 svf_part2 0; +#X text -1 306 onepole~.help contains yet another example.; +#X text -1 382 svf~ accepts arguments or max messages to change the +frequency input mode. it is generally recommended to set the mode with +an argument and leave it constant \, to avoid confusion.; +#X text -1 244 try sweeping the cutoff frequency in linear mode \, +then in radians mode \, to appreciate the difference. a similar principle +operates in the amplitude domain \, where exponential audio faders +are used to match our logarithmic perception of loudness.; +#X text -51 134 linear; +#X text -27 81 Hz; +#X text -1 177 in this mode \, input values from (0 -> 1) are interpreted +as radians \, producing a quarter-cycle sinusoidal mapping to cutoff +frequencies. this conforms the frequency mapping to a response that +is closer to our logarithmic perception of pitch.; +#X text -1 125 this mode is essentially the same \, but with a normalized +input range. linear input values from (0 -> 1) are mapped to cutoff +frequencies in the effective range \, (0 -> fs/4).; +#X text -1 72 this is the default mode. input values set the cutoff +frequency directly. therefore \, the input range is the same as the +cutoff frequency (0 -> fs/4) \, and response is linear.; +#X text -1 9 svf~ has three different modes for mapping input values +onto cutoff frequency. these are mainly for convenience \, but they +may also improve efficiency slightly.; +#X text -1 329 since svf~ only samples its control inputs once per +vector \, it is more efficient to use the radians mode than to do logarithmic +scaling outside the object at audio rate.; +#X text -59 191 radians; +#X restore 432 382 pd svf_part2; +#X msg 298 135 0.5; +#X text 190 83 frequency range is 0 - f(s)/4; +#X obj 108 56 noise~; +#X msg 142 113 37; +#X text 246 314 outputs: lowpass \, highpass \, bandpass \, notch; +#X obj 130 83 loadbang; +#X obj 142 180 * 11025; +#X obj 142 159 / 512; +#X floatatom 142 201 0 0 0 0 - - -; +#N canvas 858 168 716 389 svf_algorithm 0; +#X text 242 290 bandstop = lowpass + hipass \;; +#X text 59 179 this is the dsp loop. note how the calculations work +together to produce all four outputs simultaneously.; +#X text 62 123 first \, convert hz to radians (this step is not necessary +in radians input mode); +#X text 44 82 this is the basic algorithm inside svf~:; +#X text 237 137 cf_radians = sin(2. * PI * cf_hz * x->ifs) \;; +#X text 242 258 bandpass = bandpass + cf_radians * hipass \;; +#X text 242 242 hipass = in_samp - lowpass - q * bandpass \;; +#X text 242 226 lowpass = lowpass + (cf_radians * bandpass) \;; +#X text 242 274 bandpass = bandpass - (bandpass ^ 3.) * 0.0001 \;; +#X restore 314 382 pd svf_algorithm; +#X obj 230 288 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 195 288 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 163 288 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 130 288 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 +1; +#X obj 209 314 *~ 0; +#X obj 174 314 *~ 0; +#X obj 142 314 *~ 0; +#X obj 109 314 *~ 0; +#X floatatom 177 226 0 0 0 0 - - -; +#X obj 108 251 svf~ 797 0.5; +#X obj 108 361 *~ 0.7; +#X obj 142 137 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 +-1 -1 3700 1; +#X text 106 547 signal; +#X text 178 547 - lowpass signal; +#X text 106 572 signal; +#X text 178 572 - highpass signal; +#X text 106 595 signal; +#X text 178 595 - bandpass signal; +#X obj 78 620 cnv 17 3 17 empty \$0-pddp.cnv.let.0 3 5 9 0 16 -228856 +-162280 0; +#X text 106 620 signal; +#X text 178 620 - notch signal; +#X obj 480 54 pddp/dsp; +#X text 178 655 - initial cutoff frequency (Hz); +#X text 178 679 - initial resonance (0-1); +#X obj 12 829 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 31 0 49 0; +#X connect 33 0 50 0; +#X connect 34 0 52 0; +#X connect 36 0 31 0; +#X connect 36 0 34 0; +#X connect 36 0 44 0; +#X connect 37 0 39 0; +#X connect 38 0 37 0; +#X connect 39 0 50 1; +#X connect 41 0 45 1; +#X connect 42 0 46 1; +#X connect 43 0 47 1; +#X connect 44 0 48 1; +#X connect 45 0 51 0; +#X connect 46 0 51 0; +#X connect 47 0 51 0; +#X connect 48 0 51 0; +#X connect 49 0 50 2; +#X connect 50 0 48 0; +#X connect 50 1 47 0; +#X connect 50 2 46 0; +#X connect 50 3 45 0; +#X connect 51 0 29 0; +#X connect 51 0 29 1; +#X connect 52 0 38 0; diff --git a/externals/miXed/doc/help/cyclone/switch-help.pd b/externals/miXed/doc/help/cyclone/switch-help.pd new file mode 100644 index 000000000..31fd02b73 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/switch-help.pd @@ -0,0 +1,77 @@ +#N canvas 429 37 559 517 10; +#X obj -1 489 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 321 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 631 303 351 222 META 0; +#X text 9 108 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 9 -25 LICENSE SIBSD; +#X text 9 89 AUTHOR Miller Puckette; +#X text 9 127 RELEASE_DATE 1997; +#X text 9 70 LIBRARY cyclone; +#X text 9 146 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 9 -44 KEYWORDS inlet specific switch filter; +#X text 9 -6 DESCRIPTION output a message from a specific inlet; +#X text 9 13 INLET_0 bang float; +#X text 9 32 INLET_N message; +#X text 9 51 OUTLET_0 message; +#X restore 502 491 pd META; +#X obj -1 407 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 446 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 318 415 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 202 491 pd Related_objects; +#X obj 83 332 cnv 17 3 34 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 83 380 cnv 17 3 17 empty \$0-pddp.cnv.let.0 n 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header switch 3 12 0 18 +-204280 -1 0; +#X obj 498 10 switch; +#X text 11 23 output a message from a specific inlet; +#X text 117 381 message; +#X text 187 380 - any message to pass through; +#X text 117 417 message; +#X text 187 417 - passed message \, from open inlet; +#X text 99 451 1) float; +#X text 187 451 - set the number of inlets; +#X text 117 330 float; +#X text 117 350 bang; +#X text 187 351 - output open outlet number; +#X obj 83 418 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 187 330 - set which inlet is open; +#X obj 178 253 switch 4; +#X obj 178 281 print; +#X floatatom 177 64 5 0 0 0 - - -, f 5; +#X msg 192 157 one; +#X msg 206 179 two; +#X msg 220 205 three; +#X msg 234 230 four; +#X text 244 254 arg is nr of inlets; +#X msg 187 101 bang; +#X text 220 100 which one's open ?; +#X obj 243 129 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 215 65 set which inlet is open; +#X obj 6 490 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X text 262 129 bang all inlets \; open inlet passes message; +#X text 187 464 - optionally open an inlet at creation time; +#X text 99 464 2) float; +#X connect 22 0 23 0; +#X connect 24 0 22 0; +#X connect 25 0 22 1; +#X connect 26 0 22 2; +#X connect 27 0 22 3; +#X connect 28 0 22 4; +#X connect 30 0 22 0; +#X connect 32 0 25 0; +#X connect 32 0 26 0; +#X connect 32 0 27 0; +#X connect 32 0 28 0; diff --git a/externals/miXed/doc/help/cyclone/tanh-help.pd b/externals/miXed/doc/help/cyclone/tanh-help.pd new file mode 100644 index 000000000..189aa632a --- /dev/null +++ b/externals/miXed/doc/help/cyclone/tanh-help.pd @@ -0,0 +1,63 @@ +#N canvas 413 35 558 409 10; +#X obj 0 380 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 236 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 592 192 368 226 META 0; +#X text 17 142 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 17 22 LICENSE SIBSD; +#X text 17 122 AUTHOR Miller Puckette; +#X text 17 162 RELEASE_DATE 1997; +#X text 17 102 LIBRARY cyclone; +#X text 17 62 INLET_0 float bang; +#X text 17 82 OUTLET_0 float; +#X text 17 182 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 0.201305; +#X text 17 2 KEYWORDS tan tangent tanh hyperbolic; +#X text 17 42 DESCRIPTION takes hyperbolic tangent value of a float +; +#X restore 503 382 pd META; +#X obj 0 293 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 330 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 299 305 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 203 382 pd Related_objects; +#X obj 75 246 cnv 17 3 34 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 75 302 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header tanh 3 12 0 18 +-204280 -1 0; +#X text 108 245 float; +#X text 108 265 bang; +#X text 108 303 float; +#X text 91 345 1) float; +#X text 178 345 - optional initial value to compute; +#X obj 511 9 tanh; +#X text 11 24 calculate hyperbolic tangent function; +#X text 178 245 - the number to take tanh of; +#X text 178 265 - output tanh of argument; +#X text 178 303 - tanh of input; +#X floatatom 153 186 8 0 0 0 - - -, f 8; +#X obj 153 132 / 100; +#X floatatom 153 107 5 0 0 0 - - -, f 5; +#X obj 153 159 tanh 0.2; +#X floatatom 313 178 8 0 0 0 - - -, f 8; +#X msg 313 112 bang; +#X obj 313 145 tanh 0.2; +#X text 58 55 outputs the hyperbolic tangent value of input float value. +; +#X text 46 108 with input as float value; +#X text 386 105 with bang button and argument inside tanh object +; +#X obj 9 383 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 20 0 22 0; +#X connect 21 0 20 0; +#X connect 22 0 19 0; +#X connect 24 0 25 0; +#X connect 25 0 23 0; diff --git a/externals/miXed/doc/help/cyclone/tanh~-help.pd b/externals/miXed/doc/help/cyclone/tanh~-help.pd new file mode 100644 index 000000000..e1bd5977d --- /dev/null +++ b/externals/miXed/doc/help/cyclone/tanh~-help.pd @@ -0,0 +1,90 @@ +#N canvas 426 34 558 566 10; +#X obj 0 537 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 389 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 487 320 494 254 META 0; +#X text 63 64 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 63 -69 LICENSE SIBSD; +#X text 63 44 AUTHOR Miller Puckette; +#X text 63 84 RELEASE_DATE 1997; +#X text 63 24 LIBRARY cyclone; +#X text 63 -16 INLET_0 signal; +#X text 63 4 OUTLET_0 signal; +#X text 63 104 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 0.201305; +#X text 63 -89 KEYWORDS hyperbolic tan tangent tanh signal; +#X text 63 -49 DESCRIPTION takes the hyperbolic tangent function for +signals; +#X restore 504 539 pd META; +#X obj 0 429 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 468 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 0 504 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 318 463 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 38 34 cosh~; +#X obj 38 60 sinh~; +#X restore 204 539 pd Related_objects; +#X obj 82 400 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 82 440 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -2 cnv 15 552 40 empty \$0-pddp.cnv.header tanh~ 3 12 0 18 +-204280 -1 0; +#X obj 0 539 pddp/pddplink help.pd -text help; +#X text 110 400 signal; +#X text 110 440 signal; +#X text 108 478 (none); +#X obj 511 7 tanh~; +#X text 16 23 Hyperbolic tangent function (tanh(x)) for signals; +#X floatatom 76 140 0 0 0 0 - - -; +#X obj 55 163 *~ 1; +#X obj 55 119 cycle~ 2; +#X obj 331 160 -~ 3.14159; +#X obj 331 137 *~ 6.28319; +#X obj 331 115 phasor~ 2; +#X obj 55 219 Scope~ 139 77 256 3 128 -1 1 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 331 223 Scope~ 142 75 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 331 191 tanh~; +#X obj 55 187 tanh~; +#X text 177 400 - input to tanh function; +#X text 177 440 - output of tanh function; +#X obj 485 53 pddp/dsp; +#N canvas 1039 231 450 300 analog 0; +#X obj 220 69 +~ 11; +#X obj 220 42 *~ 10; +#X obj 220 18 cycle~ 0.5; +#X obj 140 18 cycle~ 110; +#X obj 140 89 *~ 1; +#X obj 140 157 *~ 0.1; +#X obj 140 194 dac~; +#X text 182 134 outputs soft clipped signal; +#X text 42 -21 can be used to simulate analog distortion \, and is +much "smoother" than using clip~; +#X obj 140 122 tanh~; +#X connect 1 0 0 0; +#X connect 2 0 1 0; +#X connect 3 0 4 0; +#X connect 4 0 9 0; +#X connect 5 0 6 0; +#X connect 5 0 6 1; +#X connect 9 0 5 0; +#X restore 331 337 pd analog distortion; +#X text 50 78 turn a sine wave into a square wave by cranking up the +volume!; +#X text 122 336 how to use for analog distortion:; +#X connect 16 0 17 1; +#X connect 17 0 25 0; +#X connect 18 0 17 0; +#X connect 19 0 24 0; +#X connect 20 0 19 0; +#X connect 21 0 20 0; +#X connect 24 0 23 0; +#X connect 25 0 22 0; diff --git a/externals/miXed/doc/help/cyclone/tanx~-help.pd b/externals/miXed/doc/help/cyclone/tanx~-help.pd new file mode 100644 index 000000000..58ae727b4 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/tanx~-help.pd @@ -0,0 +1,61 @@ +#N canvas 427 34 558 516 10; +#X obj 0 487 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 268 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 618 282 357 242 META 0; +#X text 3 157 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 3 37 LICENSE SIBSD; +#X text 3 137 AUTHOR Miller Puckette; +#X text 3 177 RELEASE_DATE 1997; +#X text 3 117 LIBRARY cyclone; +#X text 3 77 INLET_0 signal; +#X text 3 97 OUTLET_0 signal; +#X text 3 15 KEYWORDS tangent tanx signal tan; +#X text 3 57 DESCRIPTION takes the tangent function for signals; +#X text 3 199 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X restore 500 489 pd META; +#X obj 0 310 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 351 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 0 390 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 311 411 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 28 67 sinx~; +#X obj 28 37 cosx~; +#X restore 197 489 pd Related_objects; +#X obj 77 281 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 77 322 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 -1 cnv 15 552 40 empty \$0-pddp.cnv.header tanx~ 3 12 0 18 +-204280 -1 0; +#X text 111 281 signal; +#X text 111 322 signal; +#X text 110 364 (none); +#X obj 507 8 tanx~; +#X text 17 24 tan(x) for signals; +#X msg 243 126 range -10 10; +#X obj 159 101 *~ 6.28319; +#X obj 159 76 phasor~ 2; +#X obj 158 160 Scope~ 164 77 256 3 128 -10 10 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 159 126 tanx~; +#X text 111 441 output values are asymptotic to inf/-inf when input +values approach -pi/2 and pi/2; +#X text 167 281 - input to tan function; +#X text 167 322 - output of tan function; +#X obj 482 55 pddp/dsp; +#X text 111 407 this is a real tangent function whose input expects +values between 0 and 2pi; +#X obj 13 489 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 18 0; +#X connect 16 0 19 0; +#X connect 17 0 16 0; +#X connect 19 0 18 0; diff --git a/externals/miXed/doc/help/cyclone/test.mid b/externals/miXed/doc/help/cyclone/test.mid new file mode 100644 index 0000000000000000000000000000000000000000..24a0b077ebba4828a02f6b6dd2ae9f668bce80a4 GIT binary patch literal 288 zcmYk0u?oU46h&Wa5p{GCoK(6vi1HwmScMEO4jr0ykWL*G1;Igd5BLN5<9d^J=<pz% z9PYhY`M46%5EoFLmG37W6KV!yvEWU1KAnl0OB99ih%D!1ML|~PM<Y~VB#zb6vIegl zzxDXK<<8d!cm$vDA6o`X?qt*AYf=@O1jlOT{RBCwet{AGx_mJ2R}wtx_{uW4K#t5m nUAD`aw>$lw+V=|Iz4N`^*D-duJ<i|v_WY*4m{FW6YPR$T+Gk7` literal 0 HcmV?d00001 diff --git a/externals/miXed/doc/help/cyclone/testmess-help.pd b/externals/miXed/doc/help/cyclone/testmess-help.pd new file mode 100644 index 000000000..d3d590d00 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/testmess-help.pd @@ -0,0 +1,23 @@ +#N canvas 0 26 350 326 10; +#N canvas 247 115 494 344 META 0; +#X text 12 155 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 125 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 12 5 KEYWORDS control max_compatible needs_work (what does +it do?); +#X text 12 45 DESCRIPTION ???; +#X text 12 65 INLET_0 anything; +#X text 12 85 OUTLET_0 anything; +#X text 12 105 AUTHOR Krzysztof Czaja; +#X text 12 25 LICENSE SIBSD; +#X restore 300 302 pd META; +#X msg 84 114 1; +#X obj 84 149 testmess; +#X obj 84 182 print; +#X msg 124 114 asdf; +#X text 79 69 No idea why this object exists... do you?; +#X text 77 232 I don't find it in max/msp docs...; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 4 0 2 0; diff --git a/externals/miXed/doc/help/cyclone/thresh-help.pd b/externals/miXed/doc/help/cyclone/thresh-help.pd new file mode 100644 index 000000000..bee0e0356 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/thresh-help.pd @@ -0,0 +1,61 @@ +#N canvas 428 35 559 401 10; +#X obj -1 373 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 224 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 628 170 351 238 META 0; +#X text 6 123 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 6 -23 LICENSE SIBSD; +#X text 6 104 AUTHOR Miller Puckette; +#X text 6 142 RELEASE_DATE 1997; +#X text 6 85 LIBRARY cyclone; +#X text 6 161 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 6 47 INLET_1 float; +#X text 6 -42 KEYWORDS combine numbers list threshold thresh; +#X text 6 -4 DESCRIPTION combine numbers that are received close together +into a list; +#X text 6 28 INLET_0 float; +#X text 6 66 OUTLET_0 list; +#X restore 501 375 pd META; +#X obj -1 287 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 329 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 318 298 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 199 375 pd Related_objects; +#X obj 78 234 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 299 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header thresh 3 12 0 18 +-204280 -1 0; +#X obj 78 260 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856 +-162280 0; +#X text 110 260 float; +#X text 92 342 1) float; +#X obj 500 10 thresh; +#X obj 159 132 thresh 100; +#X obj 159 176 print thresh; +#X floatatom 159 68 5 0 0 0 - - -, f 5; +#X text 196 69 move fast!!!; +#X floatatom 216 97 5 0 0 0 - - -, f 5; +#X text 254 96 period length; +#X text 110 233 float; +#X text 178 233 - number to store into list; +#X text 178 260 - period length; +#X text 110 299 list; +#X text 178 299 - list of numbers stored that a recieved within period +; +#X text 178 342 - initial period length; +#X text 229 125 inital arg sets period length (default 10msecs); +#X text 11 23 combine numbers that are received close together into +a list; +#X obj 11 375 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 13 0 14 0; +#X connect 15 0 13 0; +#X connect 17 0 13 1; diff --git a/externals/miXed/doc/help/cyclone/tosymbol-help.pd b/externals/miXed/doc/help/cyclone/tosymbol-help.pd new file mode 100644 index 000000000..9c485d143 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/tosymbol-help.pd @@ -0,0 +1,99 @@ +#N canvas 429 35 560 577 10; +#X obj -1 732 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 490 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 617 364 366 224 META 0; +#X text 7 21 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 -99 LICENSE SIBSD; +#X text 7 1 AUTHOR Miller Puckette; +#X text 7 41 RELEASE_DATE 1997; +#X text 7 -19 LIBRARY cyclone; +#X text 7 -39 OUTLET_0 signal; +#X text 7 63 HELP_PATCH_AUTHORS Alex Cleveland updated this patch for +Pd-l2ork version 2013.05.28; +#X text 7 -121 KEYWORDS symbol transform messages numbers; +#X text 7 -79 DESCRIPTION transform messages to symbols; +#X text 7 -59 INLET_0 message list; +#X restore 501 734 pd META; +#X obj -1 554 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 591 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 640 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 322 474 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 38 35 fromsymbol; +#X restore 204 734 pd Related_objects; +#X obj 78 504 cnv 17 3 36 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 563 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header tosymbol 3 12 0 +18 -204280 -1 0; +#X obj 46 324 tosymbol; +#X text 108 324 can also be used to generate non space symbols from +lists:; +#X text 106 525 list; +#X text 104 610 (none); +#X obj 489 10 tosymbol; +#X text 106 502 message; +#X text 178 502 - messgae to be transformed into symbol; +#X text 178 525 - list of messages to turn into symbols; +#X text 106 563 symbol; +#X text 178 563 - symbol (including whitespace) of input; +#X obj 106 676 pddp/pddplink @pd_help/all_about_lists_vs_anythings.pd -text +all_about_lists_vs_anythings; +#X obj 106 697 pddp/pddplink @pd_help/all_about_symbol_construction.pd -text +all_about_symbol_construction; +#X obj 106 655 pddp/pddplink @pd_help/all_about_data_types.pd -text all_about_data_types +; +#X obj 236 246 fromsymbol; +#X obj 265 187 tosymbol; +#X text 39 54 since pd lacks a quoting mechanism (like `foo bar`) there +is; +#X text 40 66 no support for spaces in symbols \, so the original max +way of; +#X text 39 78 using from/tosymbol won't work. One has to construct +symbols; +#X text 38 91 with other tools like; +#X obj 189 95 tosymbol; +#X obj 271 95 makesymbol; +#X text 252 91 or; +#X text 346 92 from zexy; +#X msg 265 161 this is a list of symbols; +#X symbolatom 265 213 25 0 0 0 - - -, f 25; +#X obj 236 273 print THIS_IS_A_LIST; +#X obj 45 206 fromsymbol; +#X msg 45 157 4; +#X obj 45 228 route float; +#X floatatom 45 255 5 0 0 0 - - -, f 5; +#X obj 45 184 tosymbol; +#X text 38 133 works with symbols:; +#X text 254 133 also works with list of symbols:; +#X text 422 161 so this...; +#X text 421 207 ...becomes a symbol with spaces; +#X text 365 266 ...and can be transformed back into a list; +#X obj 106 415 tosymbol; +#X text 66 359 1; +#X text 73 388 2; +#X msg 106 385 lets place a _ instead of a space inside; +#X msg 83 360 separator _; +#X symbolatom 106 440 0 0 0 0 - - -; +#X text 11 23 transform messages to symbols; +#X obj 9 731 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 23 0 35 0; +#X connect 24 0 23 0; +#X connect 24 0 34 0; +#X connect 33 0 24 0; +#X connect 36 0 38 0; +#X connect 37 0 40 0; +#X connect 38 0 39 0; +#X connect 40 0 36 0; +#X connect 46 0 51 0; +#X connect 49 0 46 0; +#X connect 50 0 46 0; diff --git a/externals/miXed/doc/help/cyclone/train~-help.pd b/externals/miXed/doc/help/cyclone/train~-help.pd new file mode 100644 index 000000000..e1bd154fe --- /dev/null +++ b/externals/miXed/doc/help/cyclone/train~-help.pd @@ -0,0 +1,109 @@ +#N canvas 427 24 559 571 10; +#X obj -1 784 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 378 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 621 308 352 262 META 0; +#X text 2 65 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 2 -106 LICENSE SIBSD; +#X text 2 46 AUTHOR Miller Puckette; +#X text 2 84 RELEASE_DATE 1997; +#X text 2 27 LIBRARY cyclone; +#X text 2 -11 OUTLET_0 signal; +#X text 2 103 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 2 -125 KEYWORDS signal metronome pulse train generator; +#X text 2 -87 DESCRIPTION pulse-train generator and metronome; +#X text 2 -68 INLET_0 signal float; +#X text 2 8 OUTLET_1 bang; +#X text 2 -49 INLET_1 signal float; +#X text 2 -30 INLET_2 signal float; +#X restore 500 786 pd META; +#X obj -1 528 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 590 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 666 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 312 458 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 202 786 pd Related_objects; +#X obj 78 387 cnv 17 3 36 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 436 cnv 17 3 35 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header train~ 3 12 0 18 +-204280 -1 0; +#X obj 501 9 train~; +#X text 11 23 Pulse-train generator and metronome; +#X text 105 386 signal; +#X text 105 407 float; +#X obj 78 482 cnv 17 3 35 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj 78 537 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 105 434 signal; +#X text 105 454 float; +#X text 105 481 signal; +#X text 105 502 float; +#X text 178 434 - set pulse width (.01-.99); +#X text 178 481 - sets phase of 0-1 transitions within pulse period +(0 to 1); +#X text 179 386 - set pulse period (ms); +#X text 105 537 signal; +#X text 178 537 - the pulse train signal; +#X text 86 604 1) float; +#X text 86 622 2) float; +#X text 178 605 - initial interval in ms (defaul 1000); +#X text 178 622 - initial width (default .5); +#X text 178 639 - initial phase (default 0); +#X text 86 638 3) float; +#X text 104 678 train~ generates a pulse signal whose period is specifiable +in terms of milliseconds (see <~ for a method of making a pulse wave +at a specified frequency). It also sends out a bang when going from +0 to 1 \, so it can be used as a metronome with a floating-point interval. +The signal output can be used as a control input for sah~ as shown +in the example below \, or at very small intervals \, it is audible. +; +#X obj 78 564 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 105 564 bang; +#X text 178 564 - when transition from 0 to 1 occurs; +#X floatatom 181 157 0 0 0 0 - - -; +#X obj 42 295 *~ 0.2; +#X obj 42 333 dac~; +#X obj 42 273 cycle~; +#X obj 42 248 *~ 1000; +#X msg 94 81 200 \, 100 5000 200 5000; +#X obj 41 183 noise~; +#X obj 42 224 sah~; +#X obj 181 230 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X floatatom 137 130 0 0 0 0 - - -; +#X text 206 230 bang output when transition from 0 to 1 occurs; +#X text 161 129 signal/float sets pulse width (0.01 to .99); +#X text 156 102 signal/float sets pulse period (ms); +#X text 196 184 Optional arguments set initial interval (default 1000) +\, width (default .5) \, and phase (default 0).; +#X text 93 66 modulate interval; +#X obj 94 102 Line~ 200; +#X obj 94 191 train~ 200 0.75; +#X obj 482 53 pddp/dsp; +#X text 208 149 signal/float sets phase of 0-1 transition within pulse +period (0 to 1); +#X obj 10 784 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 35 0 51 2; +#X connect 36 0 37 0; +#X connect 36 0 37 1; +#X connect 38 0 36 0; +#X connect 39 0 38 0; +#X connect 40 0 50 0; +#X connect 41 0 42 0; +#X connect 42 0 39 0; +#X connect 44 0 51 1; +#X connect 50 0 51 0; +#X connect 51 0 42 1; +#X connect 51 1 43 0; diff --git a/externals/miXed/doc/help/cyclone/trapezoid~-help.pd b/externals/miXed/doc/help/cyclone/trapezoid~-help.pd new file mode 100644 index 000000000..7d8ed5628 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/trapezoid~-help.pd @@ -0,0 +1,94 @@ +#N canvas 421 35 558 541 10; +#X obj -1 736 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 473 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 580 280 386 269 META 0; +#X text 8 56 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 8 -104 LICENSE SIBSD; +#X text 8 36 AUTHOR Miller Puckette; +#X text 8 76 RELEASE_DATE 1997; +#X text 8 16 LIBRARY cyclone; +#X text 8 -4 OUTLET_0 signal; +#X text 8 96 HELP_PATCH_AUTHORS Alex Cleveland updated this patch for +Pd-l2ork version 2013.05.28; +#X text 8 -137 KEYWORDS signal trapezoid wavetable lo hi lo/hi phase +ramp wave; +#X text 8 -84 DESCRIPTION a trapezoid wavetable; +#X text 8 -64 INLET_0 signal message; +#X text 8 -44 INLET_1 signal float; +#X text 8 -24 INLET_2 signal float; +#X restore 499 738 pd META; +#X obj -1 630 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 667 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 307 438 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 738 pd Related_objects; +#X obj 78 483 cnv 17 3 36 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 639 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header trapezoid~ 3 12 +0 18 -204280 -1 0; +#X obj 477 11 trapezoid~; +#X text 11 23 a trapezoidal wavetable; +#X text 105 481 signal; +#X obj 78 536 cnv 17 3 34 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 105 534 signal; +#X obj 78 583 cnv 17 3 34 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 105 581 signal; +#X text 105 555 float; +#X text 105 602 float; +#X text 178 534 - change ramp up phase position; +#X text 178 581 - change ramp down phase position; +#X text 178 481 - input signal; +#X text 105 639 signal; +#X text 178 639 - the trapezoidal wavetable output; +#X text 281 293 args: <up> <down>; +#X floatatom 170 183 0 0 0 0 - - -; +#X msg 170 204 hi \$1; +#X floatatom 213 183 0 0 0 0 - - -; +#X msg 213 204 lo \$1; +#X text 320 265 down; +#X floatatom 160 128 0 0 0 0 - - -; +#X text 39 58 trapezoid~ is a trapezoidal wavetable with signal inputs +to change ramp up/down phase position. The default lo/hi points are +0 and 1 \, but may be changed using the lo/hi messages.; +#X text 268 239 up; +#X obj 161 371 Scope~ 135 74 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 185 324 Snapshot~ 100; +#X floatatom 185 349 5 0 0 0 - - -, f 5; +#X obj 160 293 trapezoid~ 0.1 0.9; +#X obj 266 266 sig~ 0.9; +#X obj 212 241 sig~ 0.1; +#X obj 160 149 phasor~ 2; +#X text 87 682 1) float; +#X text 178 682 - initial ramp up; +#X text 87 702 2) float; +#X text 178 702 - initial ramp down; +#X obj 481 56 pddp/dsp; +#X text 105 504 message; +#X text 178 504 - lo/hi messages change the lo/hi points (default 0/1) +; +#X text 255 203 change the lo/hi points; +#X text 221 148 input signal; +#X obj 7 738 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 24 0 25 0; +#X connect 25 0 35 0; +#X connect 26 0 27 0; +#X connect 27 0 35 0; +#X connect 29 0 38 0; +#X connect 33 0 34 0; +#X connect 35 0 32 0; +#X connect 35 0 33 0; +#X connect 36 0 35 2; +#X connect 37 0 35 1; +#X connect 38 0 35 0; diff --git a/externals/miXed/doc/help/cyclone/triangle~-help.pd b/externals/miXed/doc/help/cyclone/triangle~-help.pd new file mode 100644 index 000000000..b8b9c8d5f --- /dev/null +++ b/externals/miXed/doc/help/cyclone/triangle~-help.pd @@ -0,0 +1,91 @@ +#N canvas 426 35 558 480 10; +#X obj 0 731 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj 0 443 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 594 232 384 255 META 0; +#X text 14 138 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 14 -2 LICENSE SIBSD; +#X text 14 118 AUTHOR Miller Puckette; +#X text 14 158 RELEASE_DATE 1997; +#X text 14 98 LIBRARY cyclone; +#X text 14 78 OUTLET_0 signal; +#X text 14 178 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 14 38 INLET_0 signal message; +#X text 14 -35 KEYWORDS signal triangle wavetable lo hi lo/hi phase +ramp wave; +#X text 14 18 DESCRIPTION a triangle / ramp wavetable; +#X text 14 58 INLET_1 signal; +#X restore 500 733 pd META; +#X obj 0 543 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj 0 584 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj 0 629 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12 +0 13 -228856 -1 0; +#N canvas 326 379 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 10 28 square~; +#X obj 9 51 phasor~; +#X obj 10 73 cycle~; +#X restore 210 733 pd Related_objects; +#X obj 79 455 cnv 17 3 36 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 556 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 0 0 cnv 15 552 40 empty \$0-pddp.cnv.header triangle~ 3 12 0 +18 -204280 -1 0; +#X obj 482 10 triangle~; +#X text 11 23 triangle / ramp wavetable; +#X text 108 454 signal; +#X text 179 454 - change phase offset of the peak value; +#X obj 79 507 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 108 505 signal; +#X text 179 505 - ramp up value; +#X text 108 555 signal; +#X text 179 555 - the triangle wavetable output based on args; +#X text 90 599 1) float; +#X text 179 599 - the peak value phase offsset value (default .5); +#X text 109 643 arg (optional): peak-value-phase-offset (default 0.5) +Peak value phase offset \, expressed as a fraction of a cycle \, from +0 to 1.0. The default is 0.5. A value of 0 produces a ramp waveform +when the triangle~ object is driven by a phasor~ \, and a value of +1 produces a sawtooth waveform.; +#X floatatom 183 179 0 0 0 0 - - -; +#X msg 183 201 hi \$1; +#X floatatom 225 179 0 0 0 0 - - -; +#X msg 225 201 lo \$1; +#X floatatom 162 125 0 0 0 0 - - -; +#X text 269 244 up; +#X obj 162 347 Scope~ 140 69 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 188 301 Snapshot~ 100; +#X floatatom 188 326 5 0 0 0 - - -, f 5; +#X obj 213 245 sig~ 0.1; +#X obj 162 146 phasor~ 2; +#X text 33 53 triangle~ is a triangle/ramp wavetable with signal input +to change phase offset of the peak value. The default lo/hi points +are -1 and 1 \, but may be changed using the lo/hi messages.; +#X obj 162 269 triangle~; +#X obj 480 56 pddp/dsp; +#X text 179 476 - lo/hi messages change the lo/hi points (default -1/1) +; +#X text 108 476 message; +#X text 269 201 change the lo/hi points; +#X text 227 145 input signal; +#X obj 13 734 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 22 0 23 0; +#X connect 23 0 34 0; +#X connect 24 0 25 0; +#X connect 25 0 34 0; +#X connect 26 0 32 0; +#X connect 29 0 30 0; +#X connect 31 0 34 1; +#X connect 32 0 34 0; +#X connect 34 0 28 0; +#X connect 34 0 29 0; diff --git a/externals/miXed/doc/help/cyclone/trunc~-help.pd b/externals/miXed/doc/help/cyclone/trunc~-help.pd new file mode 100644 index 000000000..0247fa710 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/trunc~-help.pd @@ -0,0 +1,181 @@ +#N canvas 361 23 565 564 10; +#X obj 7 39 cnv 15 552 40 empty empty trunc~ 3 12 0 18 -204280 -1 0 +; +#X obj 7 385 cnv 3 550 3 empty empty inlets 8 12 0 13 -228856 -1 0 +; +#X obj 7 433 cnv 3 550 3 empty empty outlets 8 12 0 13 -228856 -1 0 +; +#X obj 7 470 cnv 3 550 3 empty empty arguments 8 12 0 13 -228856 -1 +0; +#X obj 86 442 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X obj 86 399 cnv 17 3 17 empty empty 0 5 9 0 16 -228856 -162280 0 +; +#X text 114 442 signal; +#X text 101 480 (none); +#X obj 7 511 cnv 15 552 21 empty empty empty 20 12 0 14 -233017 -33289 +0; +#N canvas 244 346 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty empty empty 3 12 0 14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 140 49 cyclone/round~; +#X restore 213 513 pd Related_objects; +#N canvas 571 307 379 261 META 0; +#X text 1 0 KEYWORDS signal max_compatible; +#X text 1 163 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 1 40 DESCRIPTION absolute value of a signal; +#X text 1 60 INLET_0 signal; +#X text 1 80 OUTLET_0 signal; +#X text 1 121 AUTHOR Krzysztof Czaja; +#X text 1 20 LICENSE SIBSD; +#X text 0 101 VERSION 0.2-beta1; +#X text 0 142 RELEASE_DATE 2002; +#X text 1 193 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template. Alex Cleveland +updated this patch for Pd-l2ork version 2013.05.28. Fred Jan Kraan +adapted the patch to pd-extended 2015-02-02; +#X restore 509 513 pd META; +#X obj 124 332 nbx 5 20 -1e+37 1e+37 0 0 empty empty truncated_value +88 11 0 16 -228856 -1 -1 -105 256; +#X obj 124 184 nbx 8 14 -127 127 0 0 empty empty empty 0 -8 0 10 -228856 +-1 -1 -105.715 256; +#X obj 127 158 hsl 180 15 -127 127 0 0 empty empty empty -2 -8 0 10 +-228856 -1 -1 1500 1; +#X text 114 399 signal/float; +#X obj 512 46 trunc~; +#X text 15 62 Truncate fractional signal values; +#X obj 124 209 sig~; +#X text 167 442 - The truncated input signal.; +#X text 199 399 - A signal whose values will be truncated.; +#X obj 124 289 cyclone/Snapshot~ 10; +#X text 80 99 [trunc~] converts signals with values such as 1.75 to +1.0. Negative values are modified so that -1.75 becomes -1.0.; +#X obj 124 248 cyclone/trunc~; +#N canvas 439 241 715 321 (subpatch) 0; +#X obj 51 51 cnv 15 552 28 empty empty Cyclone: 6 13 0 18 -128992 -233080 +0; +#X obj 217 65 cnv 5 5 5 empty empty Library 0 0 0 12 -128992 -233080 +0; +#X obj 275 65 cnv 5 5 5 empty empty of 0 0 0 12 -128992 -233080 0; +#X obj 298 64 cnv 5 5 5 empty empty objects 0 0 0 12 -128992 -233080 +0; +#X obj 356 64 cnv 5 5 5 empty empty cloned 0 0 0 12 -128992 -233080 +0; +#X obj 406 64 cnv 5 5 5 empty empty from 0 0 0 12 -128992 -233080 0 +; +#X obj 444 64 cnv 5 5 5 empty empty Max/MSP 0 0 0 12 -128992 -233080 +0; +#X coords 0 -1 1 1 554 30 1 50 50; +#X restore 7 4 pd; +#N canvas 673 40 366 264 (subpatch) 0; +#X obj 51 101 tgl 42 0 \$0-tgl-s \$0-tgl-r empty 1 8 1 9 -74965 -212593 +-262144 1 1; +#X obj 215 68 route dsp; +#X obj 215 37 receive pd; +#N canvas 939 367 324 271 set_color 0; +#X obj 47 30 inlet; +#X obj 96 146 s \$0-cnv; +#X msg 96 114 color -4.86997e+06 -1.34937e+07; +#N canvas 0 22 712 637 off 0; +#X obj 490 220 * -1; +#X obj 424 300 +; +#X obj 409 325 +; +#X obj 347 219 * -65536; +#X obj 424 220 * -256; +#X obj 409 356 - 1; +#X obj 390 189 unpack f f f; +#X obj 225 295 +; +#X obj 210 320 +; +#X obj 148 214 * -65536; +#X obj 225 215 * -256; +#X obj 291 215 * -1; +#X obj 210 351 - 1; +#X obj 191 184 unpack f f f; +#X obj 379 423 pack; +#X msg 378 447 color \$1 \$2; +#X msg 395 152 124 124 124; +#X msg 203 154 220 220 220; +#X obj 238 121 t b b; +#X obj 238 81 inlet; +#X obj 378 485 outlet; +#X connect 0 0 1 1; +#X connect 1 0 2 1; +#X connect 2 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 1 0; +#X connect 5 0 14 1; +#X connect 6 0 3 0; +#X connect 6 1 4 0; +#X connect 6 2 0 0; +#X connect 7 0 8 1; +#X connect 8 0 12 0; +#X connect 9 0 8 0; +#X connect 10 0 7 0; +#X connect 11 0 7 1; +#X connect 12 0 14 0; +#X connect 13 0 9 0; +#X connect 13 1 10 0; +#X connect 13 2 11 0; +#X connect 14 0 15 0; +#X connect 15 0 20 0; +#X connect 16 0 6 0; +#X connect 17 0 13 0; +#X connect 18 0 17 0; +#X connect 18 1 16 0; +#X connect 19 0 18 0; +#X restore 47 113 pd off; +#X obj 47 83 select 0 1; +#X obj 47 168 list append 0; +#X obj 47 195 list trim; +#X obj 47 220 s \$0-tgl-r; +#X connect 0 0 4 0; +#X connect 2 0 1 0; +#X connect 2 0 5 0; +#X connect 3 0 1 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 4 1 2 0; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X restore 215 165 pd set_color; +#X obj 135 122 r \$0-tgl-s; +#N canvas 0 22 450 300 (subpatch) 0; +#X obj 101 101 cnv 25 40 25 empty \$0-cnv DSP 3 13 0 20 -74965 -212593 +0; +#X coords 0 -1 1 1 42 27 1 100 100; +#X restore 51 144 pd; +#X obj 226 139 s \$0-tgl-r; +#X msg 226 115 set \$1; +#X msg 135 177 \; pd dsp \$1; +#N canvas 256 32 278 194 load_check 0; +#X obj 136 53 sig~ 1; +#X obj 74 24 loadbang; +#X obj 136 86 snapshot~; +#X obj 91 52 del 5; +#X obj 136 151 outlet; +#X obj 74 103 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +1; +#X obj 74 126 switch~; +#X connect 0 0 2 0; +#X connect 1 0 3 0; +#X connect 1 0 5 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 0 5 0; +#X connect 5 0 6 0; +#X restore 51 72 pd load_check; +#X connect 1 0 3 0; +#X connect 1 0 7 0; +#X connect 2 0 1 0; +#X connect 4 0 8 0; +#X connect 4 0 3 0; +#X connect 7 0 6 0; +#X connect 9 0 0 0; +#X coords 0 -1 1 1 44 72 2 50 100; +#X restore 503 91 pd; +#X connect 12 0 17 0; +#X connect 13 0 12 0; +#X connect 17 0 22 0; +#X connect 20 0 11 0; +#X connect 22 0 20 0; diff --git a/externals/miXed/doc/help/cyclone/universal-help.pd b/externals/miXed/doc/help/cyclone/universal-help.pd new file mode 100644 index 000000000..547d469aa --- /dev/null +++ b/externals/miXed/doc/help/cyclone/universal-help.pd @@ -0,0 +1,213 @@ +#N canvas 426 35 558 555 10; +#X obj -1 680 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 539 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 619 368 360 195 META 0; +#X text 10 -3 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 10 -103 LICENSE SIBSD; +#X text 10 -23 AUTHOR Miller Puckette; +#X text 10 17 RELEASE_DATE 1997; +#X text 10 -43 LIBRARY cyclone; +#X text 10 37 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 10 -123 KEYWORDS send message object objects class remote patch +; +#X text 10 -83 DESCRIPTION send message to all objects of the same +class; +#X text 10 -63 INLET_0 message; +#X restore 500 682 pd META; +#X obj -1 587 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 628 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 316 453 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 201 682 pd Related_objects; +#X obj 76 555 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header universal 3 12 +0 18 -204280 -1 0; +#X obj 482 12 universal; +#X text 108 555 message; +#X text 176 555 - message to send to all instances of same class in +patch; +#X text 107 600 (none); +#X obj 62 204 universal; +#X obj 79 497 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 100 490 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 119 497 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 140 489 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 62 78 tgl bang; +#X msg 93 370 tgl bang; +#X obj 93 425 universal 1; +#N canvas 620 438 290 158 sub 0; +#X obj -4 40 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 17 33 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 36 40 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 57 32 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 50 77 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 71 70 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 90 77 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 111 69 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 69 5 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; +#X obj 88 12 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 109 4 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 102 49 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 123 42 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 142 49 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 163 41 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 126 95 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 147 87 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 140 132 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 161 125 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 180 132 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 201 124 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 159 60 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 178 67 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 199 59 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 192 104 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 14 73 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 35 65 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 28 110 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 49 103 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 226 33 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 221 58 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 237 85 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 106 106 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 101 131 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 188 7 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 183 32 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 48 124 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 10 98 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 5 123 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 50 9 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -262144 +; +#X obj -3 2 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -262144 +; +#X obj 146 17 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 212 8 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 207 33 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X restore 362 493 pd sub; +#X text 179 415 nonzero arg means that; +#X text 178 426 all subpatches get the; +#X text 179 435 messsage too; +#X text 279 491 look here:; +#X obj 48 260 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 +-262144 -1 -1 0 256 0; +#X obj 48 247 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 +-262144 -1 -1 0 256 0; +#X msg 83 125 nbx 4; +#X msg 83 146 nbx 0; +#X msg 71 102 tgl size 20; +#X obj 202 475 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 225 489 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X obj 196 505 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-262144; +#X msg 105 397 bng color 8; +#X obj 48 287 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 +-262144 -1 -1 0 256 0; +#X obj 48 274 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10 +-262144 -1 -1 0 256 0; +#X obj 316 280 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 306 261 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 472 210 vsl 8 30 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 482 215 vsl 8 30 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 493 218 vsl 8 30 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 503 223 vsl 8 30 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 429 193 vsl 8 30 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 439 198 vsl 8 30 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 450 201 vsl 8 30 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 460 206 vsl 8 30 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X text 10 23 send message to all objects of the same class; +#X msg 309 134 hsl \$1; +#X obj 309 109 line; +#X msg 309 88 0 \, 127 1000; +#X msg 369 134 vsl \$1; +#X obj 309 174 universal; +#X obj 127 255 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 148 248 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 167 255 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 188 247 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X text 92 645 1) float; +#X text 176 645 - nonzero arg means all subpatches get the message +too; +#X text 45 336 send message to all objecs in patch and its subpatches: +; +#X text 42 52 send message to all objects of same class in patch:; +#X obj 9 681 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 17 0 12 0; +#X connect 18 0 19 0; +#X connect 27 0 12 0; +#X connect 28 0 12 0; +#X connect 29 0 12 0; +#X connect 33 0 19 0; +#X connect 47 0 51 0; +#X connect 48 0 47 0; +#X connect 48 0 50 0; +#X connect 49 0 48 0; +#X connect 50 0 51 0; diff --git a/externals/miXed/doc/help/cyclone/urn-help.pd b/externals/miXed/doc/help/cyclone/urn-help.pd new file mode 100644 index 000000000..057aa7f78 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/urn-help.pd @@ -0,0 +1,83 @@ +#N canvas 426 36 559 609 10; +#X obj -1 581 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 356 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 630 358 350 259 META 0; +#X text 4 29 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 4 -136 LICENSE SIBSD; +#X text 4 10 AUTHOR Miller Puckette; +#X text 4 48 RELEASE_DATE 1997; +#X text 4 -9 LIBRARY cyclone; +#X text 4 67 HELP_PATCH_AUTHORS Alex Cleveland updated this patch for +Pd-l2ork version 2013.05.28; +#X text 4 -85 INLET_0 bang seed float; +#X text 4 -66 INLET_1 float; +#X text 4 -47 OUTLET_0 float; +#X text 4 -28 OUTLET_1 bang; +#X text 4 -117 DESCRIPTION random number generator without duplicate +numbers; +#X text 4 -155 KEYWORDS random generator number rng; +#X restore 501 583 pd META; +#X obj -1 475 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 539 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 325 506 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 19 30 random; +#X restore 207 583 pd Related_objects; +#X obj 81 373 cnv 17 3 55 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 81 487 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header urn 3 12 0 18 -204280 +-1 0; +#X obj 516 11 urn; +#X floatatom 146 301 5 0 0 0 - - -, f 5; +#X obj 146 70 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 146 238 urn 4; +#X msg 159 102 clear; +#X floatatom 173 206 5 0 0 0 - - -, f 5; +#X msg 170 156 seed \$1; +#X floatatom 170 135 5 0 0 0 - - -, f 5; +#X text 186 236 arg is number of different values to produce; +#X text 212 206 clear rng and set new nr. of values; +#X text 169 70 send out a random nr.; +#X text 226 155 (re)seed rng; +#X text 201 101 clear list of nrs; +#X text 184 301 random output; +#X obj 173 270 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 194 268 sent out all different values; +#X text 11 23 random number generator without duplicate numbers; +#X text 111 372 bang; +#X text 196 372 - send out random number; +#X text 111 392 seed <int>; +#X text 196 392 - reseed random number generator; +#X text 111 412 list; +#X text 196 412 - clear list of numbers; +#X obj 81 441 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 111 440 float; +#X text 196 440 - clear rng and set new nr of values; +#X text 111 486 float; +#X text 196 486 - random output; +#X text 93 552 1) float; +#X text 196 552 - number of different values to produce; +#X obj 81 511 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 111 511 bang; +#X text 196 511 - sent out all different values; +#X obj 13 583 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 12 0; +#X connect 12 0 10 0; +#X connect 12 1 23 0; +#X connect 13 0 12 0; +#X connect 14 0 12 1; +#X connect 15 0 12 0; +#X connect 16 0 15 0; diff --git a/externals/miXed/doc/help/cyclone/vectral~-help.pd b/externals/miXed/doc/help/cyclone/vectral~-help.pd new file mode 100644 index 000000000..5daee4f0b --- /dev/null +++ b/externals/miXed/doc/help/cyclone/vectral~-help.pd @@ -0,0 +1,138 @@ +#N canvas 427 35 558 558 10; +#X obj -1 826 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 481 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 621 300 361 264 META 0; +#X text 11 169 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 11 9 LICENSE SIBSD; +#X text 11 149 AUTHOR Miller Puckette; +#X text 11 189 RELEASE_DATE 1997; +#X text 11 129 LIBRARY cyclone; +#X text 11 109 OUTLET_0 signal; +#X text 11 209 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 11 -24 KEYWORDS signal vector envelope follower rampsmooth +deltaclip slide filter; +#X text 11 29 DESCRIPTION a vector based envelope follower; +#X text 11 49 INLET_0 mode; +#X text 11 69 INLET_1 signal; +#X text 11 89 INLET_2 signal; +#X restore 502 830 pd META; +#X obj -1 673 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 710 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 751 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 320 457 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 828 pd Related_objects; +#X obj 80 491 cnv 17 3 118 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 80 682 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header vectral~ 3 12 0 +18 -204280 -1 0; +#X obj 490 7 vectral~; +#X text 11 23 a vector based envelope follower.; +#X obj 91 334 loadbang; +#X obj 38 329 sqrt~; +#X floatatom 149 130 0 0 0 0 - - -; +#X floatatom 93 130 0 0 0 0 - - -; +#X obj 329 153 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X floatatom 440 130 0 0 0 0 - - -; +#X floatatom 384 130 0 0 0 0 - - -; +#X obj 329 170 pack deltaclip 1 -1; +#X obj 189 153 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X floatatom 270 130 0 0 0 0 - - -; +#X floatatom 229 130 0 0 0 0 - - -; +#X obj 189 170 pack slide 1 1; +#X obj 38 153 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 38 170 pack rampsmooth 1 1; +#X obj 330 202 adc~; +#X obj 330 271 +~; +#X obj 363 250 *~; +#X obj 330 250 *~; +#X obj 330 222 fft~ 256 256 0; +#X text 20 44 vectral~ is useful for filtering frame based signal data +such as the output of fft~. It may operate in one of the following +modes:; +#X obj 38 308 vectral~ 256; +#X obj 38 394 Scope~ 131 71 32 3 128 0 50 0 0 0 0 102 255 51 135 135 +135 0; +#X text 215 553 - deltaclip <max> <min> \; limits the change in samples +to be in the given range; +#X text 215 521 - slide <up> <down> \; logarithmic movement to new +value; +#X text 215 490 - rampsmooth <up> <down> \; linear ramp across up/down +frames to the new value; +#X obj 80 622 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 115 682 signal; +#X text 215 682 - vector based envelope follower signal; +#X text 96 723 1) float; +#X text 215 723 - vector size (default 512).; +#X obj 479 51 pddp/dsp; +#X text 116 760 More information about the different modes may be gleaned +from the rampsmooth~ \, deltaclip~ \, and slide~ helpfiles. Simply +think of the changes happening between frames rather than between samples +; +#X text 124 300 argument is vector size (default 512). whichever mode's +message is received last is the current mode of operation; +#X text 115 490 mode; +#X obj 80 649 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 115 648 signal; +#X text 215 648 - signal to filter; +#X text 35 100 rampsmooth:; +#X text 187 100 slide:; +#X text 327 100 deltaclip:; +#X obj 12 828 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X text 215 621 - unused; +#X msg 162 364 256; +#X msg 61 364 32; +#X msg 91 364 range 0 50; +#X text 115 621 signal; +#X text 215 591 - unused; +#X text 115 591 signal; +#X connect 12 0 54 0; +#X connect 12 0 55 0; +#X connect 12 0 56 0; +#X connect 13 0 33 0; +#X connect 14 0 24 0; +#X connect 14 0 25 2; +#X connect 15 0 24 0; +#X connect 15 0 25 1; +#X connect 16 0 19 0; +#X connect 17 0 16 0; +#X connect 17 0 19 2; +#X connect 18 0 16 0; +#X connect 18 0 19 1; +#X connect 19 0 32 0; +#X connect 20 0 23 0; +#X connect 21 0 20 0; +#X connect 21 0 23 2; +#X connect 22 0 20 0; +#X connect 22 0 23 1; +#X connect 23 0 32 0; +#X connect 24 0 25 0; +#X connect 25 0 32 0; +#X connect 26 0 30 0; +#X connect 27 0 32 2; +#X connect 28 0 27 1; +#X connect 29 0 27 0; +#X connect 30 0 29 0; +#X connect 30 0 29 1; +#X connect 30 1 28 0; +#X connect 30 1 28 1; +#X connect 32 0 13 0; +#X connect 54 0 33 1; +#X connect 55 0 33 0; +#X connect 56 0 33 0; diff --git a/externals/miXed/doc/help/cyclone/wave~-help.pd b/externals/miXed/doc/help/cyclone/wave~-help.pd new file mode 100644 index 000000000..a2ae0a15b --- /dev/null +++ b/externals/miXed/doc/help/cyclone/wave~-help.pd @@ -0,0 +1,185 @@ +#N canvas 429 35 560 523 10; +#X obj -1 770 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 482 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 624 289 348 244 META 0; +#X text 6 168 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 6 24 LICENSE SIBSD; +#X text 6 150 AUTHOR Miller Puckette; +#X text 6 186 RELEASE_DATE 1997; +#X text 6 132 LIBRARY cyclone; +#X text 6 114 OUTLET_0 signal; +#X text 6 204 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 6 60 INLET_0 signal message; +#X text 6 6 KEYWORDS signal wavetable wave table interpolation; +#X text 6 42 DESCRIPTION variable size wavetable; +#X text 6 78 INLET_1 float signal; +#X text 6 96 INLET_2 float signal; +#X restore 495 772 pd META; +#X obj -1 636 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 673 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 322 421 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 204 772 pd Related_objects; +#X obj 85 493 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 85 591 cnv 17 3 35 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header wave~ 3 12 0 18 +-204280 -1 0; +#X obj 504 10 wave~; +#X text 11 23 variable size wavetable; +#X text 109 490 signal; +#X text 223 490 - signal to turn into wavetable; +#X obj 85 544 cnv 17 3 35 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X obj 85 645 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X text 109 543 float; +#X text 109 590 float; +#X floatatom 62 431 0 0 100 0 - - -; +#N canvas 159 26 532 285 output 0; +#X obj 338 160 t b; +#X obj 338 110 f; +#X obj 338 60 inlet; +#X text 344 29 mute; +#X obj 338 185 f; +#X msg 426 180 0; +#X msg 338 85 bang; +#X obj 338 135 moses 1; +#X obj 397 110 moses 1; +#X obj 83 148 dbtorms; +#X obj 397 85 r master-lvl; +#X obj 83 42 r master-lvl; +#X obj 338 210 s master-lvl; +#X obj 20 155 inlet~; +#X obj 199 41 inlet; +#X text 199 18 level; +#X obj 199 105 s master-lvl; +#X msg 96 65 set \$1; +#X obj 96 90 outlet; +#X msg 214 65 \; pd dsp 1; +#X obj 83 198 line~; +#X obj 20 207 *~; +#X obj 20 232 dac~; +#X obj 83 173 pack 0 50; +#X text 20 132 audio; +#X text 96 114 show level; +#X obj 426 155 t b; +#X obj 20 181 hip~ 1; +#X connect 0 0 4 0; +#X connect 1 0 7 0; +#X connect 2 0 6 0; +#X connect 4 0 12 0; +#X connect 5 0 12 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 7 1 26 0; +#X connect 8 1 4 1; +#X connect 9 0 23 0; +#X connect 10 0 1 1; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 17 0; +#X connect 13 0 27 0; +#X connect 14 0 16 0; +#X connect 14 0 19 0; +#X connect 17 0 18 0; +#X connect 20 0 21 1; +#X connect 21 0 22 0; +#X connect 21 0 22 1; +#X connect 23 0 20 0; +#X connect 26 0 5 0; +#X connect 27 0 21 0; +#X restore 37 451 pd output; +#X msg 88 431 MUTE; +#X obj 447 159 table sample; +#X obj 370 109 openpanel; +#X msg 370 134 read -resize \$1 sample; +#X obj 370 159 soundfiler; +#X obj 370 84 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X text 396 85 load a sample; +#X obj 37 101 phasor~; +#X floatatom 37 78 5 0 0 0 - - -, f 5; +#X floatatom 71 322 5 0 0 0 - - -, f 5; +#X floatatom 106 348 5 0 0 0 - - -, f 5; +#X floatatom 370 209 10 0 0 0 - - -, f 10; +#N canvas 0 22 206 239 samples2len 0; +#X obj 45 25 inlet; +#X obj 61 86 samplerate~; +#X obj 45 115 /; +#X obj 45 59 t f b; +#X obj 45 140 * 1000; +#X obj 45 175 outlet; +#X connect 0 0 3 0; +#X connect 1 0 2 1; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 1 1 0; +#X connect 4 0 5 0; +#X restore 370 184 pd samples2len; +#X text 115 324 startpoint (msec); +#X text 151 348 endpoint (msec); +#X text 445 209 length in msec; +#X obj 37 384 wave~ sample; +#X msg 54 138 set sample; +#X msg 69 192 enable \$1; +#X obj 69 170 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X text 138 193 en/disable object; +#X obj 76 225 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X msg 76 250 interp \$1; +#X text 148 250 en/disable interpolation; +#X text 109 645 signal; +#X text 223 645 - ouput of wavetable; +#X text 223 679 - initial table name; +#X text 92 701 2) float; +#X text 223 701 - initial startpoint; +#X text 92 722 3) float; +#X text 223 722 - initial endpoint; +#X text 92 743 4) float; +#X text 223 743 - channel number; +#X text 109 565 signal; +#X text 109 611 signal; +#X text 92 679 1) table; +#X text 128 136 change table; +#X text 96 74 frequency (1=normal speed negative is backwards); +#X text 109 513 message; +#X text 223 513 - change table \, en/disable object or interpolation +; +#X text 223 542 - set startpoint as float (ms); +#X text 223 565 - set startpoint as signal (ms); +#X text 223 588 - set endpoint as float (ms); +#X text 223 611 - set endpoint as signal (ms); +#X text 128 374 arg is table name \, you can also use:<table name> +<startpoint> <endpoint> <num_channels>; +#X obj 479 51 pddp/dsp; +#X obj 13 772 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X text 109 513; +#X connect 17 0 18 1; +#X connect 18 0 17 0; +#X connect 19 0 18 2; +#X connect 21 0 22 0; +#X connect 22 0 23 0; +#X connect 23 0 31 0; +#X connect 24 0 21 0; +#X connect 26 0 35 0; +#X connect 27 0 26 0; +#X connect 28 0 35 1; +#X connect 29 0 35 2; +#X connect 31 0 30 0; +#X connect 35 0 18 0; +#X connect 36 0 35 0; +#X connect 37 0 35 0; +#X connect 38 0 37 0; +#X connect 40 0 41 0; +#X connect 41 0 35 0; diff --git a/externals/miXed/doc/help/cyclone/xbendin-help.pd b/externals/miXed/doc/help/cyclone/xbendin-help.pd new file mode 100644 index 000000000..92b20851e --- /dev/null +++ b/externals/miXed/doc/help/cyclone/xbendin-help.pd @@ -0,0 +1,73 @@ +#N canvas 427 38 559 519 10; +#X obj -1 492 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 292 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 630 298 351 235 META 0; +#X text 3 104 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 3 -36 LICENSE SIBSD; +#X text 3 84 AUTHOR Miller Puckette; +#X text 3 124 RELEASE_DATE 1997; +#X text 3 64 LIBRARY cyclone; +#X text 3 144 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 3 -56 KEYWORDS midi pitchbend pitch bend 14 bit channel; +#X text 3 -16 DESCRIPTION midi pitchbend in; +#X text 3 4 INLET_0 midi; +#X text 3 24 OUTLET_0 float; +#X text 3 44 OUTLET_1 float; +#X restore 503 494 pd META; +#X obj -1 332 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 395 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 436 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 320 412 428 119 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 29 35 xbendout; +#X obj 29 61 xbendin2; +#X obj 29 87 xbendout2; +#X restore 205 494 pd Related_objects; +#X obj 79 304 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 344 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header xbendin 3 12 0 +18 -204280 -1 0; +#X obj 496 12 xbendin; +#X floatatom 178 237 5 0 0 0 - - -, f 5; +#X floatatom 229 207 5 0 0 0 - - -, f 5; +#X text 269 208 channel nr; +#X floatatom 178 73 5 0 0 0 - - -, f 5; +#X floatatom 235 101 5 0 0 0 - - -, f 5; +#X text 219 238 14 bit pitchbend value; +#X text 219 72 14 bit pitchbend value; +#X text 274 101 channel nr; +#X text 179 304 - midi stream to input; +#X text 110 343 float; +#X text 179 343 - 14 bit pitchbend value; +#X obj 79 368 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 110 367 float; +#X text 179 367 - channel number; +#X text 11 23 midi pitchbend in; +#X text 110 304 midi; +#X text 110 452 in/output from; +#X obj 218 457 midiin; +#X obj 309 457 midiout; +#X text 268 452 or to; +#X obj 178 131 xbendout 0; +#X obj 178 168 xbendin 0; +#X text 243 158 optional arg sets initial channel number; +#X text 92 408 1) float; +#X text 179 408 - sets initial channel number; +#X obj 10 494 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 14 0 31 0; +#X connect 15 0 31 1; +#X connect 31 0 32 0; +#X connect 32 0 11 0; +#X connect 32 1 12 0; diff --git a/externals/miXed/doc/help/cyclone/xbendin2-help.pd b/externals/miXed/doc/help/cyclone/xbendin2-help.pd new file mode 100644 index 000000000..9e5e697d2 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/xbendin2-help.pd @@ -0,0 +1,77 @@ +#N canvas 426 35 559 499 10; +#X obj -1 471 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 274 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 633 249 351 249 META 0; +#X text 2 48 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 2 -92 LICENSE SIBSD; +#X text 2 28 AUTHOR Miller Puckette; +#X text 2 68 RELEASE_DATE 1997; +#X text 2 8 LIBRARY cyclone; +#X text 2 88 HELP_PATCH_AUTHORS Alex Cleveland updated this patch for +Pd-l2ork version 2013.05.28; +#X text 2 -52 INLET_0 midi; +#X text 2 -32 OUTLET_0 float; +#X text 2 -12 OUTLET_1 float; +#X text 2 -125 KEYWORDS midi pitchbend pitch bend 14 bit channel msb +lsb most significant bit least; +#X text 2 -72 DESCRIPTION midi pitchbend in using msb and lsb; +#X restore 503 473 pd META; +#X obj -1 313 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 376 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 415 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 325 383 427 123 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 37 62 xbendout; +#X obj 37 87 xbendout2; +#X obj 37 37 xbendin; +#X restore 209 473 pd Related_objects; +#X obj 79 285 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 325 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header xbendin2 3 12 0 +18 -204280 -1 0; +#X text 179 285 - midi stream to input; +#X text 112 325 float; +#X obj 79 349 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 112 349 float; +#X obj 489 12 xbendin2; +#X obj 186 177 xbendin2 1; +#X obj 186 144 xbendout2 1; +#X floatatom 186 232 5 0 0 0 - - -, f 5; +#X floatatom 186 69 5 0 0 0 - - -, f 5; +#X floatatom 243 208 5 0 0 0 - - -, f 5; +#X floatatom 249 121 5 0 0 0 - - -, f 5; +#X text 291 122 channel; +#X text 261 96 lsb; +#X text 229 70 msb; +#X floatatom 217 94 5 0 0 0 - - -, f 5; +#X text 285 206 lsb; +#X text 228 232 msb; +#X text 95 387 1) float; +#X text 179 387 - initial channel number; +#X text 179 325 - Most Significant Byte (msb); +#X text 179 349 - Least Significant Byte (lsb); +#X text 11 23 midi pitchbend in using msb and lsb; +#X text 112 285 midi; +#X text 258 169 optional arg sets initial channel number; +#X text 113 431 in/output from; +#X obj 221 436 midiin; +#X obj 312 436 midiout; +#X text 271 431 or to; +#X obj 11 473 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 15 0 17 0; +#X connect 15 1 19 0; +#X connect 16 0 15 0; +#X connect 18 0 16 0; +#X connect 20 0 16 2; +#X connect 24 0 16 1; diff --git a/externals/miXed/doc/help/cyclone/xbendout-help.pd b/externals/miXed/doc/help/cyclone/xbendout-help.pd new file mode 100644 index 000000000..506f5fcdb --- /dev/null +++ b/externals/miXed/doc/help/cyclone/xbendout-help.pd @@ -0,0 +1,73 @@ +#N canvas 428 37 558 520 10; +#X obj -1 493 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 296 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 606 277 366 243 META 0; +#X text 4 162 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 4 22 LICENSE SIBSD; +#X text 4 142 AUTHOR Miller Puckette; +#X text 4 182 RELEASE_DATE 1997; +#X text 4 122 LIBRARY cyclone; +#X text 4 202 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 4 2 KEYWORDS midi pitchbend pitch bend 14 bit channel; +#X text 4 42 DESCRIPTION midi pitchbend out; +#X text 4 102 OUTLET_0 midi; +#X text 4 62 INLET_0 float; +#X text 4 82 INLET_1 float; +#X restore 503 495 pd META; +#X obj -1 362 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 403 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 442 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 477 389 428 135 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 40 67 xbendin2; +#X obj 40 93 xbendout2; +#X obj 40 41 xbendin; +#X restore 196 495 pd Related_objects; +#X obj 76 374 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 76 308 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header xbendout 3 12 0 +18 -204280 -1 0; +#X text 115 308 float; +#X obj 76 332 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 115 332 float; +#X text 97 416 1) float; +#X text 191 416 - initial channel number; +#X obj 487 10 xbendout; +#X text 191 332 - channel number; +#X text 191 374 - output of midi stream; +#X floatatom 180 241 5 0 0 0 - - -, f 5; +#X floatatom 231 211 5 0 0 0 - - -, f 5; +#X text 271 212 channel nr; +#X floatatom 180 77 5 0 0 0 - - -, f 5; +#X floatatom 237 105 5 0 0 0 - - -, f 5; +#X text 221 242 14 bit pitchbend value; +#X text 221 76 14 bit pitchbend value; +#X text 276 105 channel nr; +#X obj 180 135 xbendout 0; +#X obj 180 172 xbendin 0; +#X text 253 128 optional arg sets initial channel number; +#X text 191 308 - 14 bit pitchbend value; +#X text 115 374 midi; +#X text 114 456 in/output from; +#X obj 222 461 midiin; +#X obj 313 461 midiout; +#X text 272 456 or to; +#X text 11 23 midi pitchbend out; +#X obj 8 495 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 21 0 26 0; +#X connect 22 0 26 1; +#X connect 26 0 27 0; +#X connect 27 0 18 0; +#X connect 27 1 19 0; diff --git a/externals/miXed/doc/help/cyclone/xbendout2-help.pd b/externals/miXed/doc/help/cyclone/xbendout2-help.pd new file mode 100644 index 000000000..31623b1bf --- /dev/null +++ b/externals/miXed/doc/help/cyclone/xbendout2-help.pd @@ -0,0 +1,82 @@ +#N canvas 427 33 560 546 10; +#X obj -1 518 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 305 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 621 289 359 265 META 0; +#X text 4 172 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 4 12 LICENSE SIBSD; +#X text 4 152 AUTHOR Miller Puckette; +#X text 4 192 RELEASE_DATE 1997; +#X text 4 132 LIBRARY cyclone; +#X text 4 212 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 4 -21 KEYWORDS midi pitchbend pitch bend 14 bit channel msb +lsb most significant bit least; +#X text 4 32 DESCRIPTION midi pitchbend out using msb and lsb; +#X text 4 112 OUTLET_0 midi; +#X text 4 52 INLET_0 float; +#X text 4 72 INLET_1 float; +#X text 4 92 INLET_2 float; +#X restore 503 520 pd META; +#X obj -1 394 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 433 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 472 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 324 426 428 127 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X obj 36 62 xbendout; +#X obj 36 37 xbendin; +#X obj 36 87 xbendin2; +#X restore 208 520 pd Related_objects; +#X obj 79 405 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 317 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header xbendout2 3 12 +0 18 -204280 -1 0; +#X text 113 405 midiout; +#X text 113 317 float; +#X obj 79 341 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 113 341 float; +#X text 95 445 1) float; +#X text 191 405 - output of midi stream; +#X obj 483 11 xbendout2; +#X obj 79 365 cnv 17 3 17 empty \$0-pddp.cnv.let.0 2 5 9 0 16 -228856 +-162280 0; +#X text 113 365 float; +#X text 191 365 - channel number; +#X text 11 23 midi pitchbend out using msb and lsb; +#X obj 188 197 xbendin2 1; +#X obj 188 164 xbendout2 1; +#X floatatom 188 252 5 0 0 0 - - -, f 5; +#X floatatom 188 73 5 0 0 0 - - -, f 5; +#X floatatom 245 228 5 0 0 0 - - -, f 5; +#X floatatom 251 125 5 0 0 0 - - -, f 5; +#X text 293 126 channel; +#X text 263 100 lsb; +#X text 231 74 msb; +#X floatatom 219 98 5 0 0 0 - - -, f 5; +#X text 287 226 lsb; +#X text 230 252 msb; +#X text 265 156 optional arg sets initial channel number; +#X text 191 445 - initial channel number; +#X text 113 484 in/output from; +#X obj 221 489 midiin; +#X obj 312 489 midiout; +#X text 271 484 or to; +#X text 191 317 - Most Significant Byte (msb); +#X text 191 341 - Least Significant Byte (lsb); +#X obj 14 518 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 21 0 23 0; +#X connect 21 1 25 0; +#X connect 22 0 21 0; +#X connect 24 0 22 0; +#X connect 26 0 22 2; +#X connect 30 0 22 1; diff --git a/externals/miXed/doc/help/cyclone/xnotein-help.pd b/externals/miXed/doc/help/cyclone/xnotein-help.pd new file mode 100644 index 000000000..6bea07d7a --- /dev/null +++ b/externals/miXed/doc/help/cyclone/xnotein-help.pd @@ -0,0 +1,61 @@ +#N canvas 0 26 550 377 10; +#X obj 4 4 cnv 15 400 40 empty empty empty 20 12 0 14 -262130 -66577 +0; +#X text 34 334 docs based on the MAX/MSP reference (c) cycling'74; +#X text 33 348 ___________________________________________________ +; +#X obj 33 20 xnotein; +#X obj 32 45 xnoteout; +#X text 116 26 interpret midi messages with release velocity; +#X obj 67 188 xnotein 1; +#X obj 346 190 xnoteout 1; +#X text 135 185 optional arg = midi channel; +#X floatatom 346 100 5 0 0 0 - - -; +#X floatatom 367 122 5 0 0 0 - - -; +#X floatatom 389 144 5 0 0 0 - - -; +#X floatatom 411 167 5 0 0 0 - - -; +#X text 454 170 change channel; +#X floatatom 67 263 5 0 0 0 - - -; +#X floatatom 96 238 5 0 0 0 - - -; +#X obj 346 237 print out; +#X text 398 96 these are; +#X text 418 109 individual; +#X text 435 125 bytes of a; +#X text 450 138 midi stream; +#X obj 353 215 midiout 1; +#X text 35 105 note on:; +#X text 93 143 and off:; +#X msg 36 123 144 \, 68 \, 120; +#X msg 94 161 128 \, 68 \, 88; +#X obj 125 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X text 147 212 on/off; +#X text 111 263 note; +#X text 140 237 velocity; +#X text 278 218 send out:; +#N canvas 247 115 494 416 META 0; +#X text 12 195 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 165 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 12 5 KEYWORDS control MIDI max_compatible; +#X text 12 45 DESCRIPTION interpret midi messages with release velocity +; +#X text 12 65 INLET_0 float; +#X text 12 85 OUTLET_0 float; +#X text 12 105 OUTLET_1 float; +#X text 12 125 OUTLET_2 float; +#X text 12 25 LICENSE SIBSD; +#X text 12 145 AUTHOR Krzysztof Czaja; +#X restore 501 358 pd META; +#X connect 6 0 14 0; +#X connect 6 1 15 0; +#X connect 6 2 26 0; +#X connect 7 0 16 0; +#X connect 7 0 21 0; +#X connect 9 0 7 0; +#X connect 10 0 7 1; +#X connect 11 0 7 2; +#X connect 12 0 7 3; +#X connect 24 0 6 0; +#X connect 25 0 6 0; diff --git a/externals/miXed/doc/help/cyclone/xnoteout-help.pd b/externals/miXed/doc/help/cyclone/xnoteout-help.pd new file mode 100644 index 000000000..822f396b1 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/xnoteout-help.pd @@ -0,0 +1,62 @@ +#N canvas 0 26 551 377 10; +#X obj 4 4 cnv 15 400 40 empty empty empty 20 12 0 14 -262130 -66577 +0; +#X text 34 334 docs based on the MAX/MSP reference (c) cycling'74; +#X text 33 348 ___________________________________________________ +; +#X obj 33 20 xnotein; +#X obj 32 45 xnoteout; +#X text 116 26 interpret midi messages with release velocity; +#X obj 67 188 xnotein 1; +#X obj 346 190 xnoteout 1; +#X text 135 185 optional arg = midi channel; +#X floatatom 346 100 5 0 0 0 - - -; +#X floatatom 367 122 5 0 0 0 - - -; +#X floatatom 389 144 5 0 0 0 - - -; +#X floatatom 411 167 5 0 0 0 - - -; +#X text 454 170 change channel; +#X floatatom 67 263 5 0 0 0 - - -; +#X floatatom 96 238 5 0 0 0 - - -; +#X obj 346 237 print out; +#X text 398 96 these are; +#X text 418 109 individual; +#X text 435 125 bytes of a; +#X text 450 138 midi stream; +#X obj 353 215 midiout 1; +#X text 35 105 note on:; +#X text 93 143 and off:; +#X msg 36 123 144 \, 68 \, 120; +#X msg 94 161 128 \, 68 \, 88; +#X obj 125 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X text 147 212 on/off; +#X text 111 263 note; +#X text 140 237 velocity; +#X text 278 218 send out:; +#N canvas 247 115 494 437 META 0; +#X text 12 215 HELP_PATCH_AUTHORS Christoph Kummerer. Revised by Jonathan +Wilkes for Pd-extended 0.42 to conform to the PDDP template.; +#X text 12 185 WEBSITE http://suita.chopin.edu.pl/~czaja/miXed/externs/cyclone.html +; +#X text 12 5 KEYWORDS control MIDI max_compatible; +#X text 12 45 DESCRIPTION interpret midi messages with release velocity +; +#X text 12 65 INLET_0 float; +#X text 12 85 INLET_1 float; +#X text 12 105 INLET_2 float; +#X text 12 125 INLET_3 float; +#X text 12 145 OUTLET_0 float; +#X text 12 25 LICENSE SIBSD; +#X text 12 165 AUTHOR Krzysztof Czaja; +#X restore 500 356 pd META; +#X connect 6 0 14 0; +#X connect 6 1 15 0; +#X connect 6 2 26 0; +#X connect 7 0 16 0; +#X connect 7 0 21 0; +#X connect 9 0 7 0; +#X connect 10 0 7 1; +#X connect 11 0 7 2; +#X connect 12 0 7 3; +#X connect 24 0 6 0; +#X connect 25 0 6 0; diff --git a/externals/miXed/doc/help/cyclone/zerox~-help.pd b/externals/miXed/doc/help/cyclone/zerox~-help.pd new file mode 100644 index 000000000..2e5755fa7 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/zerox~-help.pd @@ -0,0 +1,92 @@ +#N canvas 417 36 558 568 10; +#X obj -1 614 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 406 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 602 350 359 228 META 0; +#X text 7 126 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 7 0 LICENSE SIBSD; +#X text 7 108 AUTHOR Miller Puckette; +#X text 7 144 RELEASE_DATE 1997; +#X text 7 90 LIBRARY cyclone; +#X text 7 54 OUTLET_0 signal; +#X text 7 162 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 7 36 INLET_0 signal message; +#X text 7 -31 KEYWORDS signal zero cross crossing couter transient +detector; +#X text 7 18 DESCRIPTION zero crossing couter or transient detector +; +#X text 7 72 OUTLET_0 signal; +#X restore 500 616 pd META; +#X obj -1 480 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 543 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#N canvas 294 469 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 197 616 pd Related_objects; +#X obj 78 419 cnv 17 3 36 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 78 492 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header zerox~ 3 12 0 18 +-204280 -1 0; +#X obj 499 10 zerox~; +#X text 11 23 zero crossing counter or transient detector; +#X obj 379 169 osc~ 0.2; +#X obj 379 193 zerox~; +#X obj 411 218 edge~; +#X obj 411 246 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 69 198 loadbang; +#X obj 69 220 samplerate~; +#X obj 69 242 / 64; +#X obj 50 97 osc~ 500; +#X obj 49 170 zerox~; +#X obj 48 266 *~ 0; +#X obj 48 288 *~ 0.5; +#X obj 48 336 snapshot~; +#X floatatom 48 363 5 0 0 0 - - -, f 5; +#X obj 81 311 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X msg 66 134 set 0.5; +#X text 109 418 signal; +#X text 179 418 - signal for zero crossing counter; +#X text 109 491 signal; +#X text 179 491 - zero crossing counter signal; +#X text 91 556 1) float; +#X text 179 556 - float sets the output volume for the click sent out +the right outlet. Volume values are in the range 0.0-1.0. The default +value is 1.0.; +#X obj 78 514 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 109 513 signal; +#X text 179 513 - impulse sent to right outlet; +#X obj 479 53 pddp/dsp; +#X text 28 56 drive the frequency of an oscillator(accuracy is dependent +on signal vector size):; +#X text 332 116 synchronize a control event with the zero-crossing +of an lfo:; +#X text 109 439 message; +#X text 179 439 - set volume of click (impulse) sent to right outlet. +the default value is 1; +#X text 120 125 sets the volume of the click (impulse) sent out the +right outlet. ; +#X obj 11 616 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 11 0 12 0; +#X connect 12 1 13 0; +#X connect 13 0 14 0; +#X connect 15 0 16 0; +#X connect 16 0 17 0; +#X connect 17 0 20 1; +#X connect 18 0 19 0; +#X connect 19 0 20 0; +#X connect 20 0 21 0; +#X connect 21 0 22 0; +#X connect 22 0 23 0; +#X connect 24 0 22 0; +#X connect 25 0 19 0; diff --git a/externals/miXed/doc/help/cyclone/zl-help.pd b/externals/miXed/doc/help/cyclone/zl-help.pd new file mode 100644 index 000000000..414df15b3 --- /dev/null +++ b/externals/miXed/doc/help/cyclone/zl-help.pd @@ -0,0 +1,271 @@ +#N canvas 429 36 558 429 10; +#X obj -1 750 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0 +14 -233017 -33289 0; +#X obj -1 441 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13 +-228856 -1 0; +#N canvas 630 173 351 268 META 0; +#X text 6 162 WEBSITE http://crca.ucsd.edu/~msp/; +#X text 6 -11 LICENSE SIBSD; +#X text 6 142 AUTHOR Miller Puckette; +#X text 6 182 RELEASE_DATE 1997; +#X text 6 122 LIBRARY cyclone; +#X text 6 202 HELP_PATCH_AUTHORS Alex Cleveland updated this patch +for Pd-l2ork version 2013.05.28; +#X text 6 -31 KEYWORDS swiss army knife multi purpose list processing +; +#X text 6 9 DESCRIPTION multi purpose list processing object a.k.a. +swiss army knife; +#X text 6 42 INLET_0 list message; +#X text 6 62 INLET_1 list float; +#X text 6 82 OUTLET_0 list; +#X text 6 102 OUTLET_1 float; +#X restore 500 752 pd META; +#X obj -1 553 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0 +13 -228856 -1 0; +#X obj -1 627 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12 +0 13 -228856 -1 0; +#X obj -1 699 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 +12 0 13 -228856 -1 0; +#N canvas 315 328 428 109 Related_objects 0; +#X obj 0 0 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0 +14 -204280 -1 0; +#X text 6 1 Related Objects; +#X restore 198 752 pd Related_objects; +#X obj 79 452 cnv 17 3 35 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj 79 564 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 +-162280 0; +#X obj -1 0 cnv 15 552 40 empty \$0-pddp.cnv.header zl 3 12 0 18 -204280 +-1 0; +#X obj 514 11 zl; +#X text 11 23 multi purpose list processing object a.k.a. swiss army +knife; +#X text 113 449 list; +#X obj 79 502 cnv 17 3 35 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 113 523 float; +#X text 204 521 - change number of elements per group; +#X text 204 473 - change to <mode> and <int> number of elements per +group; +#X text 113 563 list; +#X text 204 563 - the processed list based on mode and number of elements +; +#X text 97 637 1) mode; +#X text 204 637 - mode can be group \, iter \, join \, len \, reg \, +rev \, rotate \, sect \, nth \, slice \, ecils \, or union; +#X text 97 670 2) float; +#X text 204 670 - intial number of elements per group; +#X text 29 54 zl supports multiple modes that perform various useful +tasks; +#X text 92 717 modes can be set as an arg or with a; +#X msg 328 717 mode mode_name [n]; +#X msg 29 144 list a b; +#X msg 43 169 list c d e f; +#X obj 29 343 print group; +#X text 454 717 message.; +#X text 12 104 in group mode messages are grouped; +#X text 12 116 in numbers of elements:; +#X text 11 143 1; +#X text 11 168 2; +#X text 112 308 arg sets mode and optionally the; +#X text 113 319 number of elements to group; +#X msg 86 201 3; +#X text 69 201 3; +#X msg 128 256 list a b c d e; +#X msg 128 277 list f g; +#X text 110 255 4; +#X text 111 278 5; +#X obj 29 315 zl group 2; +#X text 200 278 <- click again; +#X text 120 224 remaining items are stored and; +#X text 120 236 used for the next group:; +#X text 113 203 change nr of elements per group; +#X obj 376 273 zl iter 3; +#X msg 388 166 1 2 3 4; +#X msg 376 144 1 2 3 4 5 6; +#X floatatom 427 248 5 0 0 0 - - -, f 5; +#X text 325 107 iter is similar to group but always; +#X msg 402 188 1; +#X text 325 119 sends out all available elements:; +#X msg 427 226 mode iter 4; +#X text 424 208 change nr here; +#X text 469 248 or here; +#X obj 376 298 print iter; +#N canvas 806 135 643 551 trivial 0; +#X obj 66 88 zl len; +#X obj 66 111 print len; +#X msg 41 40 this produces 3; +#X msg 66 63 and this should be five; +#X text 40 18 len outputs the nr. of elements:; +#X text 301 16 rev reverses:; +#X obj 303 83 zl rev; +#X obj 303 108 print rev; +#X msg 312 59 10 9 8 7 6 5 4 3 2 1 0; +#X msg 303 36 way this something means this; +#X text 32 163 reg can be used to store lists:; +#X obj 33 284 zl reg; +#X msg 33 186 this is sent out immediately; +#X obj 33 310 print reg; +#X msg 39 246 bang; +#X msg 66 218 this is just stored; +#X obj 293 330 print rotate; +#X msg 293 219 sometimes my grammar is all messed up; +#X obj 293 307 zl rot 3; +#X text 292 199 master yoda says:; +#X msg 365 266 1 2 3 4 5 6 7 8; +#X floatatom 338 241 5 0 0 0 - - -, f 5; +#X text 281 219 1; +#X text 322 240 2; +#X text 350 267 3; +#X text 76 246 output last stored list; +#X text 290 163 rot rotates:; +#X text 34 365 nth sends out the nth element:; +#X obj 39 445 zl nth 3; +#X obj 39 469 print nth; +#X floatatom 84 418 5 0 0 0 - - -, f 5; +#X msg 39 393 1 10 11 100 101 110 111 1000; +#X text 126 419 change 'n'; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 6 0 7 0; +#X connect 8 0 6 0; +#X connect 9 0 6 0; +#X connect 11 0 13 0; +#X connect 12 0 11 0; +#X connect 14 0 11 0; +#X connect 15 0 11 1; +#X connect 17 0 18 0; +#X connect 18 0 16 0; +#X connect 20 0 18 0; +#X connect 21 0 18 1; +#X connect 28 0 29 0; +#X connect 30 0 28 1; +#X connect 31 0 28 0; +#X restore 402 410 pd trivial ones; +#X text 155 409 look here for rev \, len \, reg \, rot[ate]:; +#X text 29 65 on lists. the modes are group \, iter \, join \, len +\, reg \, rev \,; +#X text 29 76 rotate \, sect \, nth \, slice \, ecils or union.; +#X text 107 374 look here for sect \, slice \, ecils \, join \, union: +; +#N canvas 901 231 672 509 more 0; +#X msg 77 -463 this is a list; +#X msg 116 -441 this is another list; +#X text 74 -527 are common to both input lists:; +#X obj 77 -487 t b b; +#X obj 77 -506 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 77 -415 zl sect; +#X obj 77 -389 print sect; +#X text 74 -537 sect outputs the elements that; +#X obj 347 -415 zl slice 3; +#X msg 347 -494 1 2 3 4 5 6 7; +#X obj 347 -361 print slice1; +#X obj 404 -388 print slice2; +#X floatatom 404 -443 5 0 0 0 - - -, f 5; +#X msg 359 -470 a b c d e f g i; +#X text 345 -562 slice is the only mode to use the 2nd; +#X text 346 -549 outlet \, it divides the list into two; +#X text 346 -536 lists at the specified element nr:; +#X text 445 -444 change nr; +#X msg 517 -498 1 2 3 4 5 6 7; +#X floatatom 574 -447 5 0 0 0 - - -, f 5; +#X msg 529 -474 a b c d e f g i; +#X obj 517 -419 zl ecils 3; +#X obj 517 -365 print ecils1; +#X obj 574 -392 print ecils2; +#X text 483 -518 ecils is the reverse; +#X obj 191 -155 zl; +#X msg 100 -245 mode join; +#X obj 191 -133 print join; +#X msg 218 -202 joined together; +#X obj 191 -247 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 +-1 -1; +#X obj 191 -223 t b b; +#X text 84 -279 in join mode lists are \, well joined:; +#X text 85 -245 1; +#X text 174 -246 2; +#X msg 191 -180 these are; +#X text 360 -280 union sends out the contents of; +#X msg 408 -177 this is another list; +#X obj 363 -218 t b b; +#X obj 363 -236 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 +-1 -1; +#X obj 363 -156 zl union; +#X obj 363 -135 print union; +#X msg 363 -198 this is a list; +#X text 361 -267 both lists \, without repeating any; +#X text 361 -256 of the elements in both lists:; +#N canvas 1037 345 405 241 but.... 0; +#X obj 89 95 t b b; +#X obj 89 76 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 89 167 zl union; +#X obj 89 191 print union_but; +#X msg 89 119 this is a list list list; +#X msg 119 143 this is is is another list; +#X text 43 18 I'm not sure if it should be this way ...; +#X text 42 29 either is is is or one list seems logical.; +#X text 43 42 how does max do it ?; +#X connect 0 0 4 0; +#X connect 0 1 5 0; +#X connect 1 0 0 0; +#X connect 2 0 3 0; +#X connect 4 0 2 0; +#X connect 5 0 2 1; +#X restore 507 -134 pd but....; +#X text 447 -129 more...:; +#X connect 0 0 5 0; +#X connect 1 0 5 1; +#X connect 3 0 0 0; +#X connect 3 1 1 0; +#X connect 4 0 3 0; +#X connect 5 0 6 0; +#X connect 8 0 10 0; +#X connect 8 1 11 0; +#X connect 9 0 8 0; +#X connect 12 0 8 1; +#X connect 13 0 8 0; +#X connect 18 0 21 0; +#X connect 19 0 21 1; +#X connect 20 0 21 0; +#X connect 21 0 22 0; +#X connect 21 1 23 0; +#X connect 25 0 27 0; +#X connect 26 0 25 0; +#X connect 28 0 25 1; +#X connect 29 0 30 0; +#X connect 30 0 34 0; +#X connect 30 1 28 0; +#X connect 34 0 25 0; +#X connect 36 0 39 1; +#X connect 37 0 41 0; +#X connect 37 1 36 0; +#X connect 38 0 37 0; +#X connect 39 0 40 0; +#X connect 41 0 39 0; +#X restore 402 374 pd more; +#X text 113 501 list; +#X text 204 499 - list to process; +#X text 204 449 - list to process; +#X obj 79 592 cnv 17 3 17 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 +-162280 0; +#X text 113 591 list; +#X text 204 589 - the processed list based on where split is (slice +and ecils only); +#X text 113 472 message; +#X obj 12 752 pddp/pddplink @pd_help/all_about_help_patches.pd -text Usage Guide +; +#X connect 26 0 42 0; +#X connect 27 0 42 0; +#X connect 36 0 42 1; +#X connect 38 0 42 0; +#X connect 39 0 42 0; +#X connect 42 0 28 0; +#X connect 47 0 57 0; +#X connect 48 0 47 0; +#X connect 49 0 47 0; +#X connect 50 0 47 1; +#X connect 52 0 47 0; +#X connect 54 0 47 0; diff --git a/externals/miXed/doc/help/toxy/tot-help.pd b/externals/miXed/doc/help/toxy/tot-help.pd new file mode 100644 index 000000000..ce201eeae --- /dev/null +++ b/externals/miXed/doc/help/toxy/tot-help.pd @@ -0,0 +1,118 @@ +#N canvas 176 71 848 625 10; +#X text 13 15 creation arguments; +#X obj 41 63 tot window_name scriptlet; +#X obj 453 500 tot other_window; +#X msg 500 118 read; +#X msg 507 139 write; +#X msg 455 55 tot; +#X msg 543 176 push; +#X msg 550 197 qpush; +#X msg 467 76 query; +#X msg 588 265 add; +#X msg 582 246 reset; +#X msg 595 284 addnext; +#X msg 596 334 prealloc; +#X text 589 318 preset scriptlet buffer size; +#X text 565 228 build a scriptlet dynamically; +#X msg 597 371 capture; +#X text 595 354 capture gui messages from a window; +#X text 491 103 read and write scriplets from files; +#X msg 591 408 attach; +#X msg 591 432 detach; +#X msg 576 472 lastmotion; +#X text 16 254 scriptlets; +#X text 28 273 A scriptlet is a sequence of Pd atoms (symbols and floats) +which is to be transferred to the pd-gui process for execution.; +#X text 547 16 all [tot] messages; +#X text 40 87 window_name - which window to receive message from; +#X text 39 101 scriptlet - a Tcl scriptlet to be read on [tot] load +; +#X text 16 320 dot-sequences; +#X text 30 333 Symbols in a scriptlet may contain special dot-sequences: +dot-parameters \, dot-names \, callback brackets \, and dot-separators. +All of these start with a dot followed by a hash \, dash \, hat \, +tilde \, grave \, colon \, or angle or square bracket.; +#N canvas 35 135 503 486 capture 0; +#X obj 74 113 tot; +#X obj 271 111 tot .; +#X text 102 47 These reference this window:; +#X msg 74 95 capture \$1; +#X obj 74 69 tgl 25 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X msg 271 93 capture \$1; +#X obj 271 67 tgl 25 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 301 130 bng 18 750 50 0 empty empty banged_on_window_creation +20 8 1 9 -262144 -1 -1; +#X msg 180 298 capture \$1; +#X obj 180 241 tgl 25 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 180 317 tot other_window; +#X msg 192 267 \; pd-other_window vis \$1; +#X obj 287 337 bng 18 750 50 0 empty empty banged_on_window_creation +20 8 1 9 -262144 -1 -1; +#X obj 90 132 bng 18 750 50 0 empty empty banged_on_window_creation +20 8 1 9 -262144 -1 -1; +#X text 72 34 [capture( message; +#N canvas 470 50 510 360 other_window 0; +#X restore 326 218 pd other_window; +#X obj 291 150 prepend set; +#X msg 291 169 motion 279 76 0; +#X obj 84 152 prepend set; +#X msg 84 171 motion 279 76 0; +#X obj 251 357 prepend set; +#X msg 251 376 motion 279 76 0; +#X text 38 217 you can capture from other windows too:; +#X text 38 401 - To capture from subpatches \, just add "pd-" to the +front of name of the subpatch: pd-my_subpatch; +#X text 37 436 - To capture from abstractions \, add "pd-" to the front +of the file name of the abtraction: pd-my_abstraction.pd; +#X text 17 9 capturing canvas/glist messages with [tot]; +#X connect 0 2 18 0; +#X connect 0 3 13 0; +#X connect 1 2 16 0; +#X connect 1 3 7 0; +#X connect 3 0 0 0; +#X connect 4 0 3 0; +#X connect 5 0 1 0; +#X connect 6 0 5 0; +#X connect 8 0 10 0; +#X connect 9 0 8 0; +#X connect 9 0 11 0; +#X connect 10 2 20 0; +#X connect 10 3 12 0; +#X connect 16 0 17 0; +#X connect 18 0 19 0; +#X connect 20 0 21 0; +#X restore 700 379 pd capture; +#X text 27 405 .- a Tk pathname of a destination item; +#X text 28 431 .^ a Tk pathname of a destination window; +#X text 28 455 .^.c a Tk pathname of a destination canvas; +#X text 19 481 dot-separators; +#X text 37 506 .` is a backslash; +#X text 37 519 .: is a semicolon; +#X text 37 533 .( and .) are curly braces; +#X text 27 38 Both creation arguments are optional.; +#X text 29 121 If [tot] has no creation arguments \, it will grab its +parent window.; +#X text 32 570 help page by Hans-Christoph Steiner <hans@at.or.at> +; +#X text 29 586 [tot] and example patches by Krzysztof Czaja; +#X text 19 162 outlets; +#X text 23 221 4 - outlet #4 is banged when the window; +#X text 24 205 3 - outlet #4 outputs the msgs set to the specified +window; +#X connect 3 0 2 0; +#X connect 4 0 2 0; +#X connect 5 0 2 0; +#X connect 6 0 2 0; +#X connect 7 0 2 0; +#X connect 8 0 2 0; +#X connect 9 0 2 0; +#X connect 10 0 2 0; +#X connect 11 0 2 0; +#X connect 12 0 2 0; +#X connect 15 0 2 0; +#X connect 18 0 2 0; +#X connect 19 0 2 0; +#X connect 20 0 2 0; diff --git a/externals/miXed/doc/src/Makefile b/externals/miXed/doc/src/Makefile new file mode 100644 index 000000000..97368fd16 --- /dev/null +++ b/externals/miXed/doc/src/Makefile @@ -0,0 +1,8 @@ +include Makefile.dirs + +default: all + +.DEFAULT: + @for SUB_DIR in $(SUB_DIRS) ; \ + do ( if [ -d $$SUB_DIR ] && [ -f $$SUB_DIR/Makefile ] ; then \ + cd $$SUB_DIR; $(MAKE) $@ ; fi ) ; done diff --git a/externals/miXed/doc/src/Makefile.dirs b/externals/miXed/doc/src/Makefile.dirs new file mode 100644 index 000000000..3bc700a1e --- /dev/null +++ b/externals/miXed/doc/src/Makefile.dirs @@ -0,0 +1,2 @@ +SUB_DIRS = \ +externs diff --git a/externals/miXed/doc/src/externs/keepme b/externals/miXed/doc/src/externs/keepme new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/externals/miXed/doc/src/externs/keepme @@ -0,0 +1 @@ + diff --git a/externals/miXed/dumpsetups b/externals/miXed/dumpsetups new file mode 100755 index 000000000..53cca0bd9 --- /dev/null +++ b/externals/miXed/dumpsetups @@ -0,0 +1,16 @@ +#!/bin/sh +# LATER make this into a regular awk script +DIR=`pwd` +LIB=`basename $DIR` +echo '// Do not edit this file, run "make" instead. + +/* Copyright (c) 2002-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +' +awk '/void .*_setup\(void\)$/&&!/'$LIB'/{print $0";"}' *.c +echo "" +echo 'void all'$LIB's_setup(void)' +echo '{' +awk -F '[ (]' '/void .*_setup\(void\)$/&&!/'$LIB'/{print " "$2"();"}' *.c +echo '}' diff --git a/externals/miXed/pddp/Makefile b/externals/miXed/pddp/Makefile new file mode 100644 index 000000000..fc022be6c --- /dev/null +++ b/externals/miXed/pddp/Makefile @@ -0,0 +1,2 @@ +ROOT_DIR = .. +include $(ROOT_DIR)/Makefile.common diff --git a/externals/miXed/pddp/Makefile.objects b/externals/miXed/pddp/Makefile.objects new file mode 100644 index 000000000..3ad9b7a85 --- /dev/null +++ b/externals/miXed/pddp/Makefile.objects @@ -0,0 +1,3 @@ +PDDPLINK_OBJECTS = \ +common/loud.o \ +common/os.o diff --git a/externals/miXed/pddp/Makefile.sources b/externals/miXed/pddp/Makefile.sources new file mode 100644 index 000000000..634925561 --- /dev/null +++ b/externals/miXed/pddp/Makefile.sources @@ -0,0 +1,3 @@ +TYPES = PDDPLINK + +PDDPLINK_SOURCES = pddplink.c diff --git a/externals/miXed/pddp/build_counter b/externals/miXed/pddp/build_counter new file mode 100644 index 000000000..9a4c0abe9 --- /dev/null +++ b/externals/miXed/pddp/build_counter @@ -0,0 +1,7 @@ +#define PDDP_VERSION "0.1" +#define PDDP_RELEASE "alpha" +#define PDDP_BUILD 3 + +#if 0 +PDDP_SNAPSHOT = 0.1-alpha3 +#endif diff --git a/externals/miXed/pddp/notes.txt b/externals/miXed/pddp/notes.txt new file mode 100644 index 000000000..f087ed874 --- /dev/null +++ b/externals/miXed/pddp/notes.txt @@ -0,0 +1,31 @@ +TODO for pddp + * pddplink: + . standardize server's root directory (use $help_directory from pd.tk?) + +DONE for pddp + +alpha3 + * .pd back-link tries not to open patches that are already open: + if a patch window already exists, it is raised and given focus instead + * new option "-gop" (visible in a gop) + * bug fix: unclickable in gop, unless visible + +alpha2 + * loading tcl scripts through "package require pddp": + . storing them in an immediate subdirectory of the path of pddplink's binary + . storing a hand-crafted pkgIndex.tcl there + . pddplink's setup appends the path of its binary to tcl's "auto_path" + * pddpserver asks for auto-assigning its port first, then starts + incrementing from 32768 + * pddplink's appearance controlled with creation options (an option switch + is any symbol starting from '-' followed by a letter) + * options currently recognized: + . "-box" (standard object box) + . "-text" followed by any number of non-option atoms (body text) + * nonboxed version (default) has a custom widgetbehavior, which is a thin + layer on top of the standard text widgetbehavior (using all rtext routines), + so that merging into core Pd, as a new object type, T_LINK, would be easy. + +alpha1 + * prototype versions of the external "pddplink" and two pd-gui extensions + "pddpserver.tcl", "pddpclient.tcl" diff --git a/externals/miXed/pddp/pddp-all.exclude b/externals/miXed/pddp/pddp-all.exclude new file mode 100644 index 000000000..d9e9df122 --- /dev/null +++ b/externals/miXed/pddp/pddp-all.exclude @@ -0,0 +1,8 @@ +*~ +*.o +*.gz +*.html +*.out +ref +ref/* +dumpsetups diff --git a/externals/miXed/pddp/pddp-help.include b/externals/miXed/pddp/pddp-help.include new file mode 100644 index 000000000..e69de29bb diff --git a/externals/miXed/pddp/pddp-shared.include b/externals/miXed/pddp/pddp-shared.include new file mode 100644 index 000000000..ab7ac29f8 --- /dev/null +++ b/externals/miXed/pddp/pddp-shared.include @@ -0,0 +1,5 @@ +shared/shared.h +shared/common/loud.c +shared/common/loud.h +shared/common/os.c +shared/common/os.h diff --git a/externals/miXed/pddp/pddp-test.exclude b/externals/miXed/pddp/pddp-test.exclude new file mode 100644 index 000000000..6b3cc437c --- /dev/null +++ b/externals/miXed/pddp/pddp-test.exclude @@ -0,0 +1,5 @@ +*~ +import-result.pd +import-debug.pd +temporary +temporary/* diff --git a/externals/miXed/pddp/pddp-vicious.exclude b/externals/miXed/pddp/pddp-vicious.exclude new file mode 100644 index 000000000..5e5a82ec6 --- /dev/null +++ b/externals/miXed/pddp/pddp-vicious.exclude @@ -0,0 +1,3 @@ +*~ +old +old/* diff --git a/externals/miXed/pddp/pddplink.c b/externals/miXed/pddp/pddplink.c new file mode 100644 index 000000000..1fa1a20b0 --- /dev/null +++ b/externals/miXed/pddp/pddplink.c @@ -0,0 +1,409 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is a prototype of an active comment. It might be replaced with + a new core object type, T_LINK (te_type bitfield would have to be + extended then). */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "m_imp.h" /* FIXME need access to c_externdir... */ +#include "g_canvas.h" +#include "common/loud.h" +#include "build_counter" + +#ifdef KRZYSZCZ +//#define PDDPLINK_DEBUG +#endif + +enum { PDDPLINK_PD, PDDPLINK_HTML }; /* LATER add others */ + +typedef struct _pddplink +{ + t_object x_ob; + t_glist *x_glist; + int x_isboxed; + int x_isgopvisible; + char *x_vistext; + int x_vissize; + int x_vislength; + int x_rtextactive; + t_symbol *x_dirsym; + t_symbol *x_ulink; + t_atom x_openargs[2]; + int x_linktype; + int x_ishit; +} t_pddplink; + +static t_class *pddplink_class; +static t_class *pddplinkbox_class; + +/* Code that might be merged back to g_text.c starts here: */ + +static void pddplink_getrect(t_gobj *z, t_glist *glist, + int *xp1, int *yp1, int *xp2, int *yp2) +{ + t_pddplink *x = (t_pddplink *)z; + int width, height; + float x1, y1, x2, y2; + if (glist->gl_editor && glist->gl_editor->e_rtext) + { + if (x->x_rtextactive) + { + t_rtext *y = glist_findrtext(glist, (t_text *)x); + width = rtext_width(y); + height = rtext_height(y) - 2; + } + else + { + int font = glist_getfont(glist); + width = x->x_vislength * sys_fontwidth(font) + 2; + height = sys_fontheight(font) + 2; + } + } + else width = height = 10; + x1 = text_xpix((t_text *)x, glist); + y1 = text_ypix((t_text *)x, glist); + x2 = x1 + width; + y2 = y1 + height; + y1 += 1; + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; +} + +static void pddplink_displace(t_gobj *z, t_glist *glist, int dx, int dy) +{ + t_text *t = (t_text *)z; + t->te_xpix += dx; + t->te_ypix += dy; + if (glist_isvisible(glist)) + { + t_rtext *y = glist_findrtext(glist, t); + rtext_displace(y, dx, dy); + } +} + +static void pddplink_select(t_gobj *z, t_glist *glist, int state) +{ + t_pddplink *x = (t_pddplink *)z; + t_rtext *y = glist_findrtext(glist, (t_text *)x); + rtext_select(y, state); + if (glist_isvisible(glist) && glist->gl_havewindow) + { + if (state) + sys_vgui(".x%lx.c itemconfigure %s -fill blue\n", + glist, rtext_gettag(y)); + else + sys_vgui(".x%lx.c itemconfigure %s -text {%s} -fill #0000dd -activefill #e70000\n", + glist, rtext_gettag(y), x->x_vistext); + } +} + +static void pddplink_activate(t_gobj *z, t_glist *glist, int state) +{ + t_pddplink *x = (t_pddplink *)z; + t_rtext *y = glist_findrtext(glist, (t_text *)x); + rtext_activate(y, state); + x->x_rtextactive = state; +} + +static void pddplink_vis(t_gobj *z, t_glist *glist, int vis) +{ + t_pddplink *x = (t_pddplink *)z; + t_rtext *y; + if (vis) + { + if ((glist->gl_havewindow || x->x_isgopvisible) + && (y = glist_findrtext(glist, (t_text *)x))) + { + rtext_draw(y); + sys_vgui(".x%lx.c itemconfigure %s -text {%s} -fill #0000dd -activefill #e70000\n", + glist_getcanvas(glist), rtext_gettag(y), x->x_vistext); + } + } + else + { + if ((glist->gl_havewindow || x->x_isgopvisible) + && (y = glist_findrtext(glist, (t_text *)x))) + rtext_erase(y); + } +} + +static int pddplink_wbclick(t_gobj *z, t_glist *glist, int xpix, int ypix, + int shift, int alt, int dbl, int doit); + +static t_widgetbehavior pddplink_widgetbehavior = +{ + pddplink_getrect, + pddplink_displace, + pddplink_select, + pddplink_activate, + 0, + pddplink_vis, + pddplink_wbclick, +}; + +/* Code that might be merged back to g_text.c ends here. */ + +/* FIXME need access to glob_pdobject... */ +static t_pd *pddplink_pdtarget(t_pddplink *x) +{ + t_pd *pdtarget = gensym("pd")->s_thing; + if (pdtarget && !strcmp(class_getname(*pdtarget), "pd")) + return (pdtarget); + else + return ((t_pd *)x); /* internal error */ +} + +static void pddplink_anything(t_pddplink *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_ishit) + { + startpost("pddplink: internal error (%s", (s ? s->s_name : "")); + postatom(ac, av); + post(")"); + } +} + +static void pddplink_click(t_pddplink *x, t_floatarg xpos, t_floatarg ypos, + t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +{ + x->x_ishit = 1; + switch (x->x_linktype) + { + case PDDPLINK_PD: + typedmess(pddplink_pdtarget(x), gensym("open"), 2, x->x_openargs); + break; + case PDDPLINK_HTML: + sys_vgui("after 0 {::pddp::cliOpen {%s}}\n", x->x_ulink->s_name); + break; + } + x->x_ishit = 0; +} + +static int pddplink_wbclick(t_gobj *z, t_glist *glist, int xpix, int ypix, + int shift, int alt, int dbl, int doit) +{ + t_pddplink *x = (t_pddplink *)z; + if (glist->gl_havewindow || x->x_isgopvisible) + { + if (doit) + pddplink_click(x, (t_floatarg)xpix, (t_floatarg)ypix, + (t_floatarg)shift, 0, (t_floatarg)alt); + return (1); + } + else return (0); +} + +static int pddplink_isoption(char *name) +{ + if (*name == '-') + { + char c = name[1]; + return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); + } + else return (0); +} + +static t_symbol *pddplink_nextsymbol(int ac, t_atom *av, int opt, int *skipp) +{ + int ndx; + for (ndx = 0; ndx < ac; ndx++, av++) + { + if (av->a_type == A_SYMBOL && + (!opt || pddplink_isoption(av->a_w.w_symbol->s_name))) + { + *skipp = ++ndx; + return (av->a_w.w_symbol); + } + } + return (0); +} + +static int pddplink_dooptext(char *dst, int maxsize, int ac, t_atom *av) +{ + int i, sz, sep, len; + char buf[32], *src; + for (i = 0, sz = 0, sep = 0; i < ac; i++, av++) + { + if (sep) + { + sz++; + if (sz >= maxsize) + break; + else if (dst) + { + *dst++ = ' '; + *dst = 0; + } + } + else sep = 1; + if (av->a_type == A_SYMBOL) + src = av->a_w.w_symbol->s_name; + else if (av->a_type == A_FLOAT) + { + src = buf; + sprintf(src, "%g", av->a_w.w_float); + } + else + { + sep = 0; + continue; + } + len = strlen(src); + sz += len; + if (sz >= maxsize) + break; + else if (dst) + { + strcpy(dst, src); + dst += len; + } + } + return (sz); +} + +static char *pddplink_optext(int *sizep, int ac, t_atom *av) +{ + char *result; + int sz = pddplink_dooptext(0, MAXPDSTRING, ac, av); + *sizep = sz + (sz >= MAXPDSTRING ? 4 : 1); + result = getbytes(*sizep); + pddplink_dooptext(result, sz + 1, ac, av); + if (sz >= MAXPDSTRING) + { + sz = strlen(result); + strcpy(result + sz, "..."); + } + return (result); +} + +#ifdef PDDPLINK_DEBUG +static void pddplink_debug(t_pddplink *x) +{ +} +#endif + +static void pddplink_free(t_pddplink *x) +{ + if (x->x_vistext) + freebytes(x->x_vistext, x->x_vissize); +} + +static void *pddplink_new(t_symbol *s, int ac, t_atom *av) +{ + t_pddplink xgen, *x; + int skip; + xgen.x_isboxed = 0; + xgen.x_isgopvisible = 0; + xgen.x_vistext = 0; + xgen.x_vissize = 0; + if (xgen.x_ulink = pddplink_nextsymbol(ac, av, 0, &skip)) + { + t_symbol *opt; + ac -= skip; + av += skip; + while (opt = pddplink_nextsymbol(ac, av, 1, &skip)) + { + ac -= skip; + av += skip; + if (opt == gensym("-box")) + xgen.x_isboxed = 1; + else if (opt == gensym("-gop")) + xgen.x_isgopvisible = 1; + else if (opt == gensym("-text")) + { + t_symbol *nextsym = pddplink_nextsymbol(ac, av, 1, &skip); + int natoms = (nextsym ? skip - 1 : ac); + if (natoms) + xgen.x_vistext = + pddplink_optext(&xgen.x_vissize, natoms, av); + } + } + } + x = (t_pddplink *) + pd_new(xgen.x_isboxed ? pddplinkbox_class : pddplink_class); + x->x_glist = canvas_getcurrent(); + x->x_dirsym = canvas_getdir(x->x_glist); /* FIXME */ + + x->x_isboxed = xgen.x_isboxed; + x->x_isgopvisible = xgen.x_isgopvisible; + x->x_vistext = xgen.x_vistext; + x->x_vissize = xgen.x_vissize; + x->x_vislength = (x->x_vistext ? strlen(x->x_vistext) : 0); + x->x_rtextactive = 0; + if (xgen.x_ulink) + { + int len = strlen(xgen.x_ulink->s_name); + if (len > 3 && !strcmp(xgen.x_ulink->s_name + len - 3, ".pd")) + x->x_linktype = PDDPLINK_PD; + else + x->x_linktype = PDDPLINK_HTML; + x->x_ulink = xgen.x_ulink; + } + else + { + x->x_linktype = PDDPLINK_HTML; + x->x_ulink = gensym("index.html"); + } + SETSYMBOL(&x->x_openargs[0], x->x_ulink); + SETSYMBOL(&x->x_openargs[1], x->x_dirsym); + x->x_ishit = 0; + if (x->x_isboxed) + outlet_new((t_object *)x, &s_anything); + else + { + /* do we need to set ((t_text *)x)->te_type = T_TEXT; ? */ + if (!x->x_vistext) + { + x->x_vislength = strlen(x->x_ulink->s_name); + x->x_vissize = x->x_vislength + 1; + x->x_vistext = getbytes(x->x_vissize); + strcpy(x->x_vistext, x->x_ulink->s_name); + } + } + if (x->x_linktype == PDDPLINK_HTML) + sys_vgui("after 0 {::pddp::srvUse {%s}}\n", x->x_dirsym->s_name); + return (x); +} + +void pddplink_setup(void) +{ + t_symbol *dirsym; + post("this is pddplink %s, %s %s build...", + PDDP_VERSION, loud_ordinal(PDDP_BUILD), PDDP_RELEASE); + + pddplink_class = class_new(gensym("pddplink"), + (t_newmethod)pddplink_new, + (t_method)pddplink_free, + sizeof(t_pddplink), + CLASS_NOINLET | CLASS_PATCHABLE, + A_GIMME, 0); + class_addanything(pddplink_class, pddplink_anything); + class_setwidget(pddplink_class, &pddplink_widgetbehavior); + + pddplinkbox_class = class_new(gensym("pddplink"), 0, + (t_method)pddplink_free, + sizeof(t_pddplink), 0, A_GIMME, 0); + class_addanything(pddplinkbox_class, pddplink_anything); + class_addmethod(pddplinkbox_class, (t_method)pddplink_click, + gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + +#ifdef PDDPLINK_DEBUG + class_addmethod(pddplink_class, (t_method)pddplink_debug, + gensym("debug"), 0); + class_addmethod(pddplinkbox_class, (t_method)pddplink_debug, + gensym("debug"), 0); +#endif + + dirsym = pddplink_class->c_externdir; /* FIXME */ + sys_vgui( + "if {[lsearch $auto_path \"%s\"] < 0} {lappend auto_path \"%s\"}\n", + dirsym->s_name, dirsym->s_name); + sys_gui("after 0 {package require pddp}\n"); +} diff --git a/externals/miXed/riddle/rdremote.c b/externals/miXed/riddle/rdremote.c new file mode 100644 index 000000000..689e079b4 --- /dev/null +++ b/externals/miXed/riddle/rdremote.c @@ -0,0 +1,814 @@ +/* Copyright (c) 2007 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <math.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" +#include "sickle/sic.h" +#include "riddle.h" +#include "riddleguts.h" + +/* obj_starttraverseoutlet, obj_nexttraverseoutlet, obj_noutlets, + obj_nsiginlets, obj_nsigoutlets, obj_siginletindex, obj_sigoutletindex, + obj_issignalinlet, obj_issignaloutlet */ +#include "m_imp.h" + +/* struct _glist, canvas_class, vinlet_class */ +#include "g_canvas.h" + +EXTERN_STRUCT _rdpool; +#define t_rdpool struct _rdpool + +typedef struct _rdenvironment +{ + t_pd en_pd; + t_rdpool *en_graphpools; + t_rdremote *en_writers; + t_rdremote *en_readers; /* list of orphaned readers */ + t_clock *en_updatedspclock; +} t_rdenvironment; + +static t_class *rdenvironment_class = 0; + +#define RDREMOTE_INISIZE 1024 + +struct _rdremote +{ + int re_id; /* positive for readers, otherwise zero */ + t_symbol *re_name; + t_riddle *re_owner; + int re_phase; + t_rdremote *re_portlink; /* slist of object i/o */ + t_rdremote *re_prev; /* double-linked list of readers or writers */ + t_rdremote *re_next; + + /* common part, copied from writer to all its readers + immediately after any change */ + int re_nframes; + int re_framesize; + int re_npoints; + int re_maxphase; + t_float *re_data; + + /* writer-specific part */ + t_rdremote *re_readers; + int re_datasize; + t_float *re_inidata; +}; + +#define RDPICKER_INISIZE 64 + +struct _rdpool +{ + t_canvas *po_graph; + int po_refcount; + t_rdpicker *po_pickstore; + t_rdpool *po_prev; + t_rdpool *po_next; +}; + +struct _rdpicker +{ + t_symbol *pi_key; + int pi_refcount; + t_rdpool *pi_graphpool; + int pi_size; + int pi_maxsize; + t_float *pi_data; + t_float pi_inidata[RDPICKER_INISIZE]; + t_rdpicker *pi_prev; + t_rdpicker *pi_next; +}; + +typedef struct _rdfeeder +{ + t_rdpicker *fe_picker; + struct _rdfeeder *fe_next; +} t_rdfeeder; + +struct _rdfeedchain +{ + t_rdfeeder *ch_head; + int ch_outno; +}; + +static t_symbol *rdps__idle = 0; + +static void rdenvironment_updatedsptick(t_rdenvironment *en) +{ + canvas_update_dsp(); +} + +static void rdenvironment_anything(t_rdenvironment *en, + t_symbol *s, int ac, t_atom *av) +{ + /* FIXME */ +} + +static t_rdenvironment *rdenvironment_provide(void) +{ + t_rdenvironment *en; + t_symbol *ps__riddle = gensym("_riddle"); /* class name */ + t_symbol *ps_hashriddle = gensym("#riddle"); /* instance binding */ + if (ps_hashriddle->s_thing) + { + char *cname = class_getname(*ps_hashriddle->s_thing); + if (strcmp(cname, ps__riddle->s_name)) + { + /* FIXME protect against the danger of someone else + (e.g. receive) binding to #riddle */ + loudbug_bug("rdenvironment_provide"); + } + else + { + /* FIXME compatibility test */ + rdenvironment_class = *ps_hashriddle->s_thing; + return ((t_rdenvironment *)ps_hashriddle->s_thing); + } + } + rdps__idle = gensym("_idle"); + rdenvironment_class = class_new(ps__riddle, 0, 0, + sizeof(t_rdenvironment), + CLASS_PD | CLASS_NOINLET, 0); + class_addanything(rdenvironment_class, rdenvironment_anything); + en = (t_rdenvironment *)pd_new(rdenvironment_class); /* never freed */ + en->en_graphpools = 0; + en->en_writers = 0; + en->en_readers = 0; + en->en_updatedspclock = + clock_new(en, (t_method)rdenvironment_updatedsptick); + pd_bind((t_pd *)en, ps_hashriddle); /* never unbound */ + return (en); +} + +t_pd *riddle_getenvironment(void) +{ + return ((t_pd *)rdenvironment_provide()); +} + + +/* subgraph-localized remote connections: feeders and pickers + LATER should become a kind of rdremote writers and readers */ + +t_rdpicker *rdpicker_attach(t_riddle *rd, t_symbol *key) +{ + t_rdenvironment *en = rdenvironment_provide(); + /* FIXME protect against calling outside of the constructor */ + t_canvas *graph = canvas_getcurrent(); + t_rdpool *po; + t_rdpicker *pi; + for (po = en->en_graphpools; po; po = po->po_next) + { + if (po->po_graph == graph) + { + for (pi = po->po_pickstore; pi; pi = pi->pi_next) + { + if (pi->pi_key == key) + { + pi->pi_refcount++; + return (pi); + } + } + } + } + + if (po) + po->po_refcount++; + else + { + po = getbytes(sizeof(*po)); + po->po_graph = graph; + po->po_refcount = 1; + po->po_pickstore = 0; + po->po_prev = 0; + if (en->en_graphpools) + en->en_graphpools->po_prev = po; + po->po_next = en->en_graphpools; + en->en_graphpools = po; + } + + pi = getbytes(sizeof(*pi)); + pi->pi_key = key; + pi->pi_refcount = 1; + pi->pi_graphpool = po; + pi->pi_size = 0; + pi->pi_maxsize = RDPICKER_INISIZE; + pi->pi_data = pi->pi_inidata; + pi->pi_prev = 0; + if (po->po_pickstore) + po->po_pickstore->pi_prev = pi; + pi->pi_next = po->po_pickstore; + po->po_pickstore = pi; + return (pi); +} + +void rdpicker_detach(t_rdpicker *pi, t_riddle *rd) +{ + if (pi->pi_refcount > 1) + pi->pi_refcount--; + else + { + if (pi->pi_data && pi->pi_data != pi->pi_inidata) + freebytes(pi->pi_data, pi->pi_maxsize * sizeof(*pi->pi_data)); + if (pi->pi_prev) + pi->pi_prev->pi_next = pi->pi_next; + else if (pi->pi_graphpool) + pi->pi_graphpool->po_pickstore = pi->pi_next; + else + loudbug_bug("rdpicker_detach 1"); + if (pi->pi_next) + pi->pi_next->pi_prev = pi->pi_prev; + if (pi->pi_graphpool) + { + t_rdpool *po = pi->pi_graphpool; + t_rdenvironment *en = rdenvironment_provide(); + if (po->po_refcount > 1) + po->po_refcount--; + else + { + if (po->po_pickstore) + loudbug_bug("rdpicker_detach 2"); + if (po->po_prev) + po->po_prev->po_next = po->po_next; + else + en->en_graphpools = po->po_next; + if (po->po_next) + po->po_next->po_prev = po->po_prev; + freebytes(po, sizeof(*po)); + } + } + freebytes(pi, sizeof(*pi)); + } +} + +t_float *rdpicker_pick(t_rdpicker *pi, int *sizep) +{ + *sizep = pi->pi_size; + return (pi->pi_data); +} + +t_float rdpicker_pick1(t_rdpicker *pi) +{ + return (*pi->pi_data); +} + +static t_rdpicker *rdpool_linkpicker(t_rdpool *po, t_symbol *key, int size) +{ + t_rdpicker *pi; + for (pi = po->po_pickstore; pi; pi = pi->pi_next) + { + if (pi->pi_key == key) + { + if (size > pi->pi_maxsize) + pi->pi_data = grow_nodata(&size, &pi->pi_maxsize, pi->pi_data, + RDPICKER_INISIZE, pi->pi_inidata, + sizeof(*pi->pi_data)); + pi->pi_size = size; + return (pi); + } + } + return (0); +} + +/* LATER think about rdpool_unlinkpicker() */ + +static void rdfeedchain_proliferate(t_rdfeedchain *ch, t_rdpool *pohead, + t_gobj *g, t_symbol *key, int size) +{ + int result = 0; + for (; g; g = g->g_next) + { + if (pd_class((t_pd *)g) == canvas_class) + { + t_canvas *graph = (t_canvas *)g; + t_rdpool *po; + t_rdpicker *pi; + for (po = pohead; po; po = po->po_next) + if (po->po_graph == graph) + break; + if (po && (pi = rdpool_linkpicker(po, key, size))) + { + t_rdfeeder *fe = getbytes(sizeof(*fe)); /* FIXME reuse */ + fe->fe_picker = pi; + fe->fe_next = ch->ch_head; + ch->ch_head = fe; + } + rdfeedchain_proliferate(ch, pohead, graph->gl_list, key, size); + } + } +} + +void rdfeedchain_free(t_rdfeedchain *ch) +{ + t_rdfeeder *fe, *fenext; + for (fe = ch->ch_head; fe; fe = fenext) + { + fenext = fe->fe_next; + freebytes(fe, sizeof(*fe)); + } +} + +t_rdfeedchain *rdfeedchain_new(int outno) +{ + t_rdfeedchain *ch = getbytes(sizeof(*ch)); + ch->ch_head = 0; + ch->ch_outno = outno; +} + +t_rdfeedchain *riddle_usefeedchain(t_riddle *rd, + int sigoutno, t_symbol *key, int size) +{ + t_rdfeedchain *ch; + if (ch = riddle_getfeedchain(rd, sigoutno)) + { + t_canvas *graph; + t_rdfeeder *fe, *fenext; + /* LATER reuse */ + for (fe = ch->ch_head; fe; fe = fenext) + { + fenext = fe->fe_next; + freebytes(fe, sizeof(*fe)); + } + for (graph = riddle_firstgraph(rd, ch->ch_outno); + graph; graph = riddle_nextgraph(rd)) + { + t_rdenvironment *en = rdenvironment_provide(); + t_rdpool *po; + t_rdpicker *pi; + for (po = en->en_graphpools; po; po = po->po_next) + if (po->po_graph == graph) + break; + if (po && (pi = rdpool_linkpicker(po, key, size))) + { + t_rdfeeder *fe = getbytes(sizeof(*fe)); + fe->fe_picker = pi; + fe->fe_next = 0; + ch->ch_head = fe; + } + else ch->ch_head = 0; + rdfeedchain_proliferate(ch, en->en_graphpools, + (t_gobj *)graph, key, size); + } + } + return (ch); +} + +t_rdfeedchain *riddle_useidlechain(t_riddle *rd, int sigoutno) +{ + return (riddle_usefeedchain(rd, sigoutno, rdps__idle, 1)); +} + +void rdfeedchain_feed(t_rdfeedchain *ch, int size, t_float *data) +{ + t_rdfeeder *fe; + for (fe = ch->ch_head; fe; fe = fe->fe_next) + { + t_rdpicker *pi = fe->fe_picker; + if (size > pi->pi_size) + size = pi->pi_size; + memcpy(pi->pi_data, data, size * sizeof(*pi->pi_data)); + } +} + +void rdfeedchain_feed1(t_rdfeedchain *ch, t_float v) +{ + t_rdfeeder *fe; + for (fe = ch->ch_head; fe; fe = fe->fe_next) + *fe->fe_picker->pi_data = v; +} + +int riddle_isidle(t_riddle *rd) +{ + return (rd->rd_idlepicker && *rd->rd_idlepicker->pi_data > .5); +} + +void riddle_updatedsp(void) +{ + t_rdenvironment *en = rdenvironment_provide(); + loud_warning((t_pd *)en, 0, "...trying to reconstruct the dsp chain"); + clock_delay(en->en_updatedspclock, 0); +} + + +/* rdremote: global named writers, global named readers, + and private anonymous bidirectional buffers */ + + +static t_rdremote *rdenvironment_getbuffer(t_rdenvironment *en, t_symbol *name) +{ + t_rdremote *re = en->en_writers; + while (re) + { + if (re->re_name == name) + return (re); + re = re->re_next; + } + return (0); +} + +t_rdremote *rdremote_getwriter(t_rdremote *re) +{ + t_rdenvironment *en = rdenvironment_provide(); + return (rdenvironment_getbuffer(en, re->re_name)); +} + +t_rdremote *rdremote_nextreader(t_rdremote *re) +{ + while (re && !re->re_id) + re = re->re_portlink; + return (re); +} + +int rdremote_getsourceblock(t_rdremote *re) +{ + if (re->re_owner && re->re_id > 0) + return (riddle_getsourceblock(re->re_owner, -re->re_id)); + else + { + loudbug_bug("rdremote_getsourceblock"); + return (0); + } +} + +t_symbol *rdremote_getsourcelayout(t_rdremote *re, int *maxblockp) +{ + if (re->re_owner && re->re_id > 0) + return (riddle_getsourcelayout(re->re_owner, -re->re_id, maxblockp)); + else + { + loudbug_bug("rdremote_getsourcelayout"); + return (0); + } +} + +int rdremote_getsourceflags(t_rdremote *re) +{ + if (re->re_owner && re->re_id > 0) + return (riddle_getsourceflags(re->re_owner, -re->re_id)); + else + { + loudbug_bug("rdremote_getsourceflags"); + return (0); + } +} + +/* this call reallocates memory if necessary, so the caller should check + for failures: the number of frames and/ot framesize may decrease + (the actually available framesize is returned by the call) */ +/* LATER optionally use old contents by zero-padding, interpolating, etc. */ +static int rdremote_setframesize(t_rdremote *re, int framesize) +{ + t_rdremote *reader; + if (re->re_inidata == 0) + { + /* not a writer */ + loudbug_bug("rdremote_setframesize 1"); + return (0); + } + if (framesize <= 0) + { + if (re->re_owner) + framesize = re->re_owner->rd_graphblock; + else + { + loudbug_bug("rdremote_setframesize 2"); + return (0); + } + } + re->re_npoints = framesize * re->re_nframes; + if (re->re_npoints > re->re_datasize) + { + int reqsize = re->re_npoints; + /* LATER use grow_withdata() */ + re->re_data = grow_nodata(&re->re_npoints, &re->re_datasize, + re->re_data, RDREMOTE_INISIZE, + re->re_inidata, sizeof(*re->re_data)); + if (re->re_npoints != reqsize) + { + re->re_nframes = re->re_npoints / framesize; + if (re->re_nframes < 1) + { + loudbug_bug("rdremote_setframesize 3"); + re->re_nframes = 1; + framesize = re->re_npoints; + } + } + } + /* LATER convert old buffer's contents of re->re_framesize * re->re_nframes + points into the new buffer of framesize * re->re_nframes points */ + memset(re->re_data, 0, re->re_npoints * sizeof(*re->re_data)); + re->re_phase = 0; /* LATER adjust */ + re->re_maxphase = re->re_npoints - framesize; + re->re_framesize = framesize; + + for (reader = re->re_readers; reader; reader = reader->re_next) + { + reader->re_nframes = re->re_nframes; + reader->re_framesize = re->re_framesize; + reader->re_npoints = re->re_npoints; + reader->re_maxphase = re->re_maxphase; + reader->re_data = re->re_data; + reader->re_phase = 0; /* LATER adjust */ + } + return (framesize); +} + +void rdremote_setoutblock(t_rdremote *re, int nblock) +{ + if (nblock = rdremote_setframesize(re, nblock)) + { + t_rdremote *reader; + for (reader = re->re_readers; reader; reader = reader->re_next) + if (reader->re_owner && reader->re_id > 0) + riddle_setsourceblock(reader->re_owner, -reader->re_id, + re->re_framesize); + } +} + +void rdremote_setoutlayout(t_rdremote *re, t_symbol *pattern, int maxblock) +{ + if (maxblock = rdremote_setframesize(re, maxblock)) + { + t_rdremote *reader; + for (reader = re->re_readers; reader; reader = reader->re_next) + if (reader->re_owner && reader->re_id > 0) + riddle_setsourcelayout(reader->re_owner, -reader->re_id, + pattern, re->re_framesize); + } +} + +void rdremote_setoutflags(t_rdremote *re, int flags) +{ + t_rdremote *reader; + for (reader = re->re_readers; reader; reader = reader->re_next) + if (reader->re_owner && reader->re_id > 0) + riddle_setsourceflags(reader->re_owner, -reader->re_id, flags); +} + +void rdremote_reset(t_rdremote *re) +{ + if (re->re_inidata) + { + memset(re->re_data, 0, re->re_npoints * sizeof(*re->re_data)); + re->re_phase = 0; + } + else + { + t_rdremote *writer = rdremote_getwriter(re); + if (writer) + re->re_phase = writer->re_phase; + else + re->re_phase = 0; + } +} + +t_float *rdremote_gethead(t_rdremote *re) +{ + return (re->re_data + re->re_phase); +} + +void rdremote_stephead(t_rdremote *re) +{ + re->re_phase += re->re_framesize; + if (re->re_phase > re->re_maxphase) + re->re_phase = 0; +} + +void rdremote_movehead(t_rdremote *re, int nframes) +{ + if (re->re_nframes <= 0) + { + loudbug_bug("rdremote_movehead"); + } + else if (nframes > 0) + { + if (nframes >= re->re_nframes) + nframes = re->re_nframes - 1; + re->re_phase += nframes * re->re_framesize; + while (re->re_phase > re->re_maxphase) + re->re_phase -= re->re_npoints; + } + else if (nframes < 0) + { + nframes = -nframes; + if (nframes >= re->re_nframes) + nframes = re->re_nframes - 1; + re->re_phase -= nframes * re->re_framesize; + while (re->re_phase < 0) + re->re_phase += re->re_npoints; + } +} + +void rdremote_delayhead(t_rdremote *re, int nframes) +{ + if (re->re_inidata) + loudbug_bug("rdremote_delayhead"); /* not a reader */ + else + { + t_rdremote *writer = rdremote_getwriter(re); + if (writer) + { + re->re_phase = writer->re_phase; + rdremote_movehead(re, -nframes); + } + } +} + +static void rdremote_free(t_rdremote *re) +{ + if (re->re_inidata) + { + if (re->re_data != re->re_inidata) + freebytes(re->re_data, re->re_datasize * sizeof(*re->re_data)); + if (re->re_name) + { + t_rdremote *reader; + t_rdenvironment *en = rdenvironment_provide(); + /* remove from the environment */ + if (re->re_next) + re->re_next->re_prev = re->re_prev; + if (re->re_prev) + re->re_prev->re_next = re->re_next; + else + en->en_writers = re->re_next; + /* move all readers to the orphanage */ + if (reader = re->re_readers) + { + while (reader->re_next) + reader = reader->re_next; + if (en->en_readers) + en->en_readers->re_prev = reader; + reader->re_next = en->en_readers; + en->en_readers = re->re_readers; + } + } + } + else + { + if (re->re_name) + { + /* remove from writer's list or orphanage */ + if (re->re_next) + re->re_next->re_prev = re->re_prev; + if (re->re_prev) + re->re_prev->re_next = re->re_next; + else + { + t_rdenvironment *en = rdenvironment_provide(); + t_rdremote *writer = rdenvironment_getbuffer(en, re->re_name); + if (writer) + writer->re_readers = re->re_next; + else + en->en_readers = re->re_next; + } + } + } + freebytes(re, sizeof(*re)); +} + +void rdremote_freeports(t_rdremote *re) +{ + while (re) + { + t_rdremote *nxt = re->re_portlink; + rdremote_free(re); + re = nxt; + } +} + +/* FIXME do not rely on pd_new() callocing owner->rd_nremoteslots + and owner->rd_remoteports to zero... one option is to traverse + environment in riddle_new() after newfn call */ +static t_rdremote *rdremote_newany(t_riddle *owner, t_symbol *name, int nframes) +{ + t_rdremote *re = (t_rdremote *)getbytes(sizeof(*re)); + if (name && !nframes) + { + owner->rd_nremoteslots++; + re->re_id = owner->rd_nremoteslots; /* starting from 1 */ + } + else re->re_id = 0; + re->re_name = 0; + re->re_owner = owner; + re->re_phase = 0; + re->re_nframes = nframes; + re->re_framesize = 0; + re->re_npoints = 0; + re->re_maxphase = 0; + if (nframes) + { + re->re_datasize = RDREMOTE_INISIZE; + re->re_inidata = getbytes(re->re_datasize * sizeof(*re->re_inidata)); + re->re_data = re->re_inidata; + } + else + { + re->re_datasize = 0; + re->re_inidata = 0; + re->re_data = 0; + } + re->re_readers = 0; + re->re_prev = 0; + re->re_next = 0; + if (owner->rd_remoteports) + { + t_rdremote *prv = owner->rd_remoteports; + while (prv->re_portlink) + prv = prv->re_portlink; + prv->re_portlink = re; + } + else owner->rd_remoteports = re; + re->re_portlink = 0; + return (re); +} + +t_rdremote *rdremote_newwriter(t_riddle *owner, t_symbol *name, int nframes) +{ + if (name && *name->s_name) + { + t_rdremote *re = + rdremote_newany(owner, name, (nframes > 1 ? nframes : 1)); + t_rdenvironment *en = rdenvironment_provide(); + if (rdenvironment_getbuffer(en, re->re_name)) + { + /* LATER accumulating writers case */ + loud_error((t_pd *)owner, "duplicate buffer name \"%s\"", + re->re_name->s_name); + /* FIXME put on the namesakes queue */ + } + else + { + t_rdremote *reader; + /* store in the environment */ + if (en->en_writers) + en->en_writers->re_prev = re; + re->re_next = en->en_writers; + en->en_writers = re; + /* recover readers from the orphanage */ + for (reader = en->en_readers; reader; reader = reader->re_next) + { + if (reader->re_name == re->re_name) + { + if (reader->re_next) + reader->re_next->re_prev = reader->re_prev; + if (reader->re_prev) + reader->re_prev->re_next = reader->re_next; + else + en->en_readers = reader->re_next; + if (re->re_readers) + re->re_readers->re_prev = reader; + reader->re_next = re->re_readers; + re->re_readers = reader; + } + } + } + return (re); + } + else + { + loudbug_bug("rdremote_newwriter"); + return (0); + } +} + +t_rdremote *rdremote_newreader(t_riddle *owner, t_symbol *name) +{ + if (name && *name->s_name) + { + t_rdremote *re = rdremote_newany(owner, name, 0); + t_rdenvironment *en = rdenvironment_provide(); + t_rdremote *writer = rdenvironment_getbuffer(en, name); + if (writer) + { + /* register to the writer */ + if (writer->re_readers) + writer->re_readers->re_prev = re; + re->re_next = writer->re_readers; + writer->re_readers = re; + } + else + { + /* store in the orphanage */ + if (en->en_readers) + en->en_readers->re_prev = re; + re->re_next = en->en_readers; + en->en_readers = re; + } + return (re); + } + else + { + loudbug_bug("rdremote_newreader"); + return (0); + } +} + +t_rdremote *rdremote_newbuffer(t_riddle *owner, int nframes) +{ + return (rdremote_newany(owner, 0, (nframes > 1 ? nframes : 1))); +} diff --git a/externals/miXed/riddle/riddle.c b/externals/miXed/riddle/riddle.c new file mode 100644 index 000000000..134841379 --- /dev/null +++ b/externals/miXed/riddle/riddle.c @@ -0,0 +1,1069 @@ +/* Copyright (c) 2007 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <math.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" +#include "sickle/sic.h" +#include "riddle.h" +#include "riddleguts.h" + +/* obj_starttraverseoutlet, obj_nexttraverseoutlet, obj_noutlets, + obj_nsiginlets, obj_nsigoutlets, obj_siginletindex, obj_sigoutletindex, + obj_issignalinlet, obj_issignaloutlet */ +#include "m_imp.h" + +/* struct _glist, canvas_class, vinlet_class */ +#include "g_canvas.h" + +/* it is horrible, but we need x_canvas and x_parentoutlet and o_next for + pushing through an outlet~, which is here for the completeness of the tests; + LATER remove from library version, unless there is an API way to do it... */ + +/* from g_io.c */ +typedef struct _rdvoutlet +{ + t_object x_obj; + t_canvas *x_canvas; + t_outlet *x_parentoutlet; + /* ... */ +} t_rdvoutlet; + +/* from m_obj.c */ +typedef struct _rdoutlet +{ + t_object *o_owner; + struct _rdoutlet *o_next; + /* ... */ +} t_rdoutlet; + +#define RIDDLE_DEBUG + +struct _rdprivate +{ + t_outconnect *pr_oc; +}; + +struct _rdsource +{ + t_riddle *so_riddle; + t_rdremote *so_remote; + int so_sourcecount; + t_symbol *so_pattern; + t_symbol *so_newpattern; + int so_block; /* if non-zero pattern: largest expected block */ + int so_newblock; + int so_flags; +}; + +struct _rdsink +{ + t_riddle *si_riddle; + int si_outno; + t_symbol *si_pattern; + int si_block; /* if non-zero pattern: largest expected block */ + int si_flags; + t_atom si_outbuf[4]; /* siginno, pattern, block, flags */ + t_rdfeedchain *si_feedchain; + int si_isready; +}; + +/* these are filled in riddle_setup() */ +static t_symbol *rdps__reblock = 0; +static t_symbol *rdps__ = 0; + +void riddlebug_post(t_riddle *rd, char *pfx, char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + if (fmt) + { + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + fprintf(stderr, "%s \"%s\" (%x): %s\n", + pfx, class_getname(*(t_pd *)rd), (int)rd, buf); + } + else fprintf(stderr, "%s \"%s\" (%x)\n", + pfx, class_getname(*(t_pd *)rd), (int)rd); +#ifdef MSW + fflush(stderr); +#endif +} + +int riddle_getsr(t_riddle *rd) +{ + return (rd->rd_graphsr); +} + +int riddle_getgraphblock(t_riddle *rd) +{ + return (rd->rd_graphblock); +} + +int riddle_getsourceblock(t_riddle *rd, int siginno) +{ + if (siginno >= rd->rd_nsiginlets || -siginno > rd->rd_nremoteslots) + { + loudbug_bug("riddle_getsourceblock"); + return (0); + } + else + { + t_rdsource *so = (siginno >= 0 ? + rd->rd_inslots + siginno : + rd->rd_remoteslots - ++siginno); + return (so->so_pattern ? 0 : so->so_block); /* FIXME disable? */ + } +} + +t_symbol *riddle_getsourcelayout(t_riddle *rd, int siginno, int *maxblockp) +{ + if (siginno >= rd->rd_nsiginlets || -siginno > rd->rd_nremoteslots) + { + loudbug_bug("riddle_getsourcelayout"); + return (0); + } + else + { + t_rdsource *so = (siginno >= 0 ? + rd->rd_inslots + siginno : + rd->rd_remoteslots - ++siginno); + if (maxblockp) + *maxblockp = so->so_block; + return (so->so_pattern); + } +} + +int riddle_getsourceflags(t_riddle *rd, int siginno) +{ + if (siginno >= rd->rd_nsiginlets || -siginno > rd->rd_nremoteslots) + { + loudbug_bug("riddle_getsourceflags"); + return (0); + } + else + { + t_rdsource *so = (siginno >= 0 ? + rd->rd_inslots + siginno : + rd->rd_remoteslots - ++siginno); + return (so->so_flags); + } +} + +/* LATER rethink the remote case */ +void riddle_setsourceblock(t_riddle *rd, int siginno, int newblock) +{ + int slotno = (siginno < 0 ? rd->rd_nsiginlets - siginno - 1 : siginno); +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "setsourceblock", "%d (%d) %d", + siginno, slotno, newblock); +#endif + if (siginno >= rd->rd_nsiginlets || -siginno > rd->rd_nremoteslots) + loudbug_bug("riddle_setsourceblock"); + else if (newblock <= 0) + loud_error((t_pd *)rd, + "invalid source block on inlet %d: %d", siginno, newblock); + else + { + t_rdsource *so = rd->rd_inslots + slotno; + /* LATER if (so->so_newpattern) complain */ + if (newblock == so->so_newblock) + so->so_sourcecount++; + else if (so->so_sourcecount > 0) + loud_error((t_pd *)rd, + "source block mismatch on inlet %d: %d != %d", + siginno, newblock, so->so_newblock); + else + { + so->so_newblock = newblock; + so->so_sourcecount = 1; + } + } +} + +#define RDLAYOUT_MAXNVECTORS 32 + +/* apart from normalization, this is used only as a sanity check; patterns + are never interpreted, they just have to match (after normalization) */ +static t_symbol *riddle_validatepattern(t_symbol *pattern) +{ + char *p = pattern->s_name, lc, uc; + switch (*p) + { + case 'a': + case 'A': + lc = 'b'; uc = 'A'; break; + case 'b': + lc = 'c'; uc = 'B'; break; + default: + lc = 0; + } + if (lc) + { + /* we require at least one vector for each size element */ + int vused[RDLAYOUT_MAXNVECTORS], i; + for (i = 0; i < RDLAYOUT_MAXNVECTORS; i++) + vused[i] = 0; + if (*p == 'A') + vused[0] = 1; + for (p++; *p; p++) + { + if (*p == lc) + { + if (lc - 'a' < RDLAYOUT_MAXNVECTORS) + lc++, uc++; + else + break; + } + else if (*p >= 'A' && *p <= uc) + vused[*p - 'A'] = 1; + else + break; + } + if (!*p) + { + for (i = 0; i < lc - 'a'; i++) + if (!vused[i]) + break; + if (i == lc - 'a') + { + if (*pattern->s_name == 'a') /* normalization */ + pattern = gensym(pattern->s_name + 1); + return (pattern); + } + } + } + loudbug_bug("riddle_validatepattern"); + return (0); +} + +void riddle_setsourcelayout(t_riddle *rd, int siginno, + t_symbol *newpattern, int maxblock) +{ + int slotno = (siginno < 0 ? rd->rd_nsiginlets - siginno - 1 : siginno); +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "setsourcelayout", "%d (%d) %s %d", + siginno, slotno, newpattern->s_name, maxblock); +#endif + if (siginno >= rd->rd_nsiginlets || -siginno > rd->rd_nremoteslots) + loudbug_bug("riddle_setsourcelayout"); + else + { + t_rdsource *so = rd->rd_inslots + slotno; + if (newpattern == so->so_newpattern) + so->so_sourcecount++; + else if (so->so_sourcecount > 0) + { + if (so->so_newpattern) + loud_error((t_pd *)rd, + "source layout mismatch on inlet %d: %s != %s", + siginno, newpattern->s_name, + so->so_newpattern->s_name); + else + loud_error((t_pd *)rd, + "source layout/block mismatch on inlet %d"); + } + else if (newpattern = riddle_validatepattern(newpattern)) + { + so->so_newpattern = newpattern; + if (maxblock) + { + if (maxblock > so->so_newblock) + so->so_newblock = maxblock; + } + else so->so_newblock = rd->rd_graphblock; + so->so_sourcecount = 1; + } + } +} + +void riddle_setsourceflags(t_riddle *rd, int siginno, int flags) +{ + int slotno = (siginno < 0 ? rd->rd_nsiginlets - siginno - 1 : siginno); +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "setsourceflags", "%d (%d) %d", + siginno, slotno, flags); +#endif + if (siginno >= rd->rd_nsiginlets || -siginno > rd->rd_nremoteslots) + loudbug_bug("riddle_setsourceflags"); + else + { + t_rdsource *so = rd->rd_inslots + slotno; + so->so_flags = flags; + } +} + +void riddle_setoutblock(t_riddle *rd, int sigoutno, int block) +{ +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "setoutblock", "%d %d", sigoutno, block); +#endif + if (sigoutno < 0 || sigoutno >= rd->rd_nsigoutlets) + loudbug_bug("riddle_setoutblock"); + else + { + t_rdsink *si = rd->rd_outslots + sigoutno; + si->si_pattern = 0; + si->si_block = block; + si->si_outbuf[1].a_w.w_symbol = rdps__; + si->si_outbuf[2].a_w.w_float = (t_float)block; + si->si_isready = 1; + } +} + +void riddle_setoutlayout(t_riddle *rd, int sigoutno, + t_symbol *pattern, int maxblock) +{ +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "setoutlayout", "%d %s %d", + sigoutno, pattern->s_name, maxblock); +#endif + if (sigoutno < 0 || sigoutno >= rd->rd_nsigoutlets) + loudbug_bug("riddle_setoutlayout"); + else if (pattern = riddle_validatepattern(pattern)) + { + t_rdsink *si = rd->rd_outslots + sigoutno; + if (maxblock <= 0) + maxblock = rd->rd_graphblock; + si->si_pattern = pattern; + si->si_block = maxblock; + si->si_outbuf[1].a_w.w_symbol = pattern; + si->si_outbuf[2].a_w.w_float = (t_float)maxblock; + si->si_isready = 1; + } +} + +void riddle_setoutflags(t_riddle *rd, int sigoutno, int flags) +{ +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "setoutflags", "%d %d", sigoutno, flags); +#endif + if (sigoutno < 0 || sigoutno >= rd->rd_nsigoutlets) + loudbug_bug("riddle_setoutflags"); + else + { + t_rdsink *si = rd->rd_outslots + sigoutno; + si->si_flags = flags; + si->si_outbuf[3].a_w.w_float = (t_float)flags; + } +} + +int riddle_checksourceblock(t_riddle *rd, int siginno, int reqblock) +{ + int block = riddle_getsourceblock(rd, siginno); + if (block == reqblock) + return (1); + else + { + if (!rd->rd_wasdisabled && rd->rd_inslots[siginno].so_sourcecount) + loud_error((t_pd *)rd, + "invalid source block on inlet %d: %d (%d expected)", + siginno, block, reqblock); + rd->rd_disabled = 1; + return (0); + } +} + +int riddle_checksourcelayout(t_riddle *rd, int siginno, + t_symbol *reqpattern, int *maxblockp) +{ + t_symbol *pattern = riddle_getsourcelayout(rd, siginno, maxblockp); + if (reqpattern == pattern || + riddle_validatepattern(reqpattern) == pattern) + return (1); + else + { + if (!rd->rd_wasdisabled && rd->rd_inslots[siginno].so_sourcecount) + { + if (pattern) + loud_error((t_pd *)rd, + "wrong source layout on inlet %d: %s (%s expected)", + siginno, pattern->s_name, reqpattern->s_name); + else + loud_error((t_pd *)rd, + "invalid source on inlet %d: layout %s expected", + siginno, reqpattern->s_name); + } + rd->rd_disabled = 1; + return (0); + } +} + +int riddle_checkanysource(t_riddle *rd, int siginno) +{ + if (siginno >= rd->rd_nsiginlets || -siginno > rd->rd_nremoteslots) + loudbug_bug("riddle_checkanysource"); + else + { + t_rdsource *so = (siginno >= 0 ? + rd->rd_inslots + siginno : + rd->rd_remoteslots - ++siginno); + if (so->so_sourcecount > 0) + return (1); + } + rd->rd_disabled = 1; + return (0); +} + +int riddle_isdisabled(t_riddle *rd) +{ + return (rd->rd_disabled); +} + +void riddle_disable(t_riddle *rd) +{ + /* FIXME allow calling from the dsp routine (mute then) */ + rd->rd_disabled = 1; +} + +t_rdfeedchain *riddle_getfeedchain(t_riddle *rd, int sigoutno) +{ + if (sigoutno < 0 || sigoutno >= rd->rd_nsigoutlets) + { + loudbug_bug("riddle_getfeedchain 1"); + return (0); + } + else + { + t_rdsink *si = rd->rd_outslots + sigoutno; + if (si->si_outno >= 0) + { + /* LATER update ch_outno */ + return (si->si_feedchain); + } + else + { + loudbug_bug("riddle_getfeedchain 2"); + return (0); + } + } +} + +/* ensures that sinks match signal outlets -- this is needed in the constructor, + but is called before each push, perhaps too defensively... LATER rethink */ +static int riddle_validatesinks(t_riddle *rd) +{ + t_object *x = (t_object *)rd; + int sigoutno, outno, nouts = obj_noutlets(x); + for (sigoutno = 0, outno = 0; outno < nouts; outno++) + { + if (obj_issignaloutlet(x, outno)) + { + if (sigoutno < rd->rd_nsigoutlets) + { + if (rd->rd_outslots[sigoutno].si_outno != outno) + { + if (rd->rd_outslots[sigoutno].si_outno < 0) + rd->rd_outslots[sigoutno].si_outno = outno; + else + { + loudbug_bug("riddle_validatesinks 1"); + return (0); + } + } + } + else + { + loudbug_bug("riddle_validatesinks 2"); + /* LATER grow */ + return (0); + } + sigoutno++; + } + } + if (sigoutno < rd->rd_nsigoutlets) + { + loudbug_bug("riddle_validatesinks 3"); + /* LATER shrink */ + return (0); + } + return (1); +} + +t_canvas *riddle_nextgraph(t_riddle *rd) +{ + while (rd->rd_private->pr_oc) + { + t_object *dst; + t_inlet *ip; + int inno; + rd->rd_private->pr_oc = + obj_nexttraverseoutlet(rd->rd_private->pr_oc, &dst, &ip, &inno); + if (dst) + { + int siginno = obj_siginletindex(dst, inno); + if (siginno < 0) + { + /* should not happen, LATER rethink */ + break; + } + else if (pd_class((t_pd *)dst) != canvas_class) + { + loud_error((t_pd *)rd, "invalid connection (not to a canvas)"); + break; + } + else return ((t_canvas *)dst); + } + } + return (0); +} + +t_canvas *riddle_firstgraph(t_riddle *rd, int outno) +{ + t_outlet *op; + rd->rd_private->pr_oc = obj_starttraverseoutlet((t_object *)rd, &op, outno); + return (rd->rd_private->pr_oc ? riddle_nextgraph(rd) : 0); +} + +static int rdsink_push(t_rdsink *si, t_object *x, int outno) +{ + int result = 1; + t_outlet *op; + t_outconnect *oc = obj_starttraverseoutlet(x, &op, outno); + while (oc) + { + t_object *dst; + t_inlet *ip; + int inno; + oc = obj_nexttraverseoutlet(oc, &dst, &ip, &inno); + if (dst) + { + int siginno = obj_siginletindex(dst, inno); + if (siginno < 0) + { + /* should not happen, LATER rethink */ + } + else if (zgetfn((t_pd *)dst, rdps__reblock)) + { + si->si_outbuf->a_w.w_float = (t_float)siginno; + typedmess((t_pd *)dst, rdps__reblock, 4, si->si_outbuf); + } + else if (pd_class((t_pd *)dst) == canvas_class) + { + t_gobj *ob; + int i; + for (i = 0, ob = ((t_canvas *)dst)->gl_list; + ob; ob = ob->g_next) + { + if (pd_class((t_pd *)ob) == vinlet_class) + { + if (i == inno) + break; + else + i++; + } + } + if (ob) + { +#ifdef RIDDLE_DEBUG + riddlebug_post(si->si_riddle, "PUSH-SUBCANVAS", + "vinlet %d (\"%s\")", + inno, class_getname(*(t_pd *)ob)); +#endif + rdsink_push(si, (t_object *)ob, 0); + } + else loudbug_bug("rdsink_push 1"); + } + else if (pd_class((t_pd *)dst) == voutlet_class) + { + t_rdvoutlet *vout = (t_rdvoutlet *)dst; + if (vout->x_canvas) + { + int n; + t_outlet *o; + for (o = ((t_object *)vout->x_canvas)->ob_outlet, n = 0; + o; o = (t_outlet *)(((t_rdoutlet *)o)->o_next), n++) + if (o == vout->x_parentoutlet) + break; + if (o) + { +#ifdef RIDDLE_DEBUG + riddlebug_post(si->si_riddle, "PUSH-OUTLET", + "outno %d, graph %x", + n, (int)vout->x_canvas); +#endif + rdsink_push(si, (t_object *)vout->x_canvas, n); + } + else loudbug_bug("rdsink_push 2"); + } +#ifdef RIDDLE_DEBUG + else riddlebug_post(si->si_riddle, "PUSH-OUTLET", + "void canvas..."); +#endif + } + else + { + char *dstname = class_getname(*(t_pd *)dst); +#ifdef RIDDLE_DEBUG + riddlebug_post(si->si_riddle, "PUSH-RIDDLESS", + "inlet %d (\"%s\")", inno, dstname); +#endif + if (si->si_flags & RIDDLE_STRICTNESSMASK) + { + if (strcmp(dstname, "print~")) + { + loud_error((t_pd *)x, "not a riddle: \"%s\"", dstname); + result = 0; + } + } + else if (!strcmp(dstname, "send~") || + !strcmp(dstname, "throw~")) + { + loud_error((t_pd *)x, "bad destination: \"%s\"", dstname); + result = 0; + } + } + } + } + return (result); +} + +static void riddle_mute(t_riddle *rd, t_signal **sp) +{ + int i, j, nouts = obj_nsigoutlets((t_object *)rd); + t_rdsink *si = rd->rd_outslots; +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "MUTE", 0); +#endif + if (rd->rd_nsigoutlets != nouts) + { + loudbug_bug("riddle_mute"); + riddle_validatesinks(rd); + if (rd->rd_nsigoutlets != nouts) + return; + } + i = 0; + j = obj_nsiginlets((t_object *)rd); + while (nouts--) + { + si->si_pattern = 0; + si->si_block = sp[j]->s_n; + si->si_outbuf[1].a_w.w_symbol = rdps__; + si->si_outbuf[2].a_w.w_float = (t_float)si->si_block; + si->si_isready = 1; + dsp_add_zero(sp[j]->s_vec, sp[j]->s_n); + i++; j++; + si++; + } +} + +static void riddle_dsp(t_riddle *rd, t_signal **sp) +{ + int failed = 0, unarmed = 1, doreblock = 0; + int oldgraphsr = rd->rd_graphsr; + int oldgraphblock = rd->rd_graphblock; + int inslotno, ninslots = rd->rd_nsiginlets + rd->rd_nremoteslots; + int outslotno; + t_rdsource *inslot; + t_rdsink *outslot; + +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "\nriddle_dsp", 0); + for (inslotno = 0, inslot = rd->rd_inslots; + inslotno < ninslots; inslotno++, inslot++) + loudbug_post("%d sources: %d reblocks of %d -> %d", + inslotno, inslot->so_sourcecount, + inslot->so_block, inslot->so_newblock); +#endif + + rd->rd_graphsr = (int)sp[0]->s_sr; + rd->rd_graphblock = sp[0]->s_n; + + /* this belongs to step 2., but should precede all "muteandreset" gotos */ + if (rd->rd_wasdisabled = rd->rd_disabled) + { + rd->rd_disabled = 0; + if (rd->rd_blockfn) + doreblock = 1; + else + { + loudbug_bug("riddle_dsp 1"); + goto muteandreset; + } + } + + /* step 1: verify all source slots */ + + for (inslotno = 0, inslot = rd->rd_inslots; + inslotno < ninslots; inslotno++, inslot++) + { + if (inslot->so_newblock > rd->rd_graphblock) + { + if (inslotno < rd->rd_nsiginlets) + { + loud_error((t_pd *)rd, + "inslot %d: source block too large (%d > %d)", + inslotno, inslot->so_newblock, rd->rd_graphblock); + failed = 1; + } + } + else if (inslot->so_sourcecount <= 0) + { + if (inslotno < rd->rd_nsiginlets) + { + /* bash unconfirmed declarations to graphblock */ + inslot->so_newpattern = 0; + inslot->so_newblock = rd->rd_graphblock; + } + else if (inslot->so_remote) + { + if (rdremote_getwriter(inslot->so_remote)) + { + loud_warning((t_pd *)rd, 0, "misplaced buffer reader..."); + riddle_updatedsp(); + failed = 1; /* LATER rethink */ + } + else + { + loud_warning((t_pd *)rd, 0, "orphaned buffer reader"); + + /* remote slots preserve unconfirmed declarations */ + inslot->so_newpattern = inslot->so_pattern; + if (inslot->so_block > 0) + inslot->so_newblock = inslot->so_block; + else + inslot->so_newblock = rd->rd_graphblock; + } + } + else loudbug_bug("riddle_dsp 2"); + } + else if (inslot->so_newblock <= 0) /* should not happen */ + { + loudbug_bug("riddle_dsp 3"); + failed = 1; + } + } + if (failed) + goto muteandreset; + + /* step 2: determine outslot sizes/layouts -- blockfn fires on the very + first call to riddle_dsp(), and then after any change of block or sr, + and each time the object is disabled... LATER reconsider the pros + and cons of performing the reblocking during every dsp call */ + + /* 2a: was there any change of inslot size/layout or graph block/sr? */ + if (!doreblock && rd->rd_blockfn) + { + if (rd->rd_graphsr != oldgraphsr || + rd->rd_graphblock != oldgraphblock) + doreblock = 1; + else for (inslotno = 0, inslot = rd->rd_inslots; + inslotno < ninslots; inslotno++, inslot++) + { + if (inslot->so_newpattern != inslot->so_pattern || + inslot->so_newblock != inslot->so_block) + { + doreblock = 1; + break; + } + } + } + + /* 2b: update the inslots, reset the outslots */ + if (doreblock || !rd->rd_blockfn) + { + for (inslotno = 0, inslot = rd->rd_inslots; + inslotno < ninslots; inslotno++, inslot++) + { + inslot->so_pattern = inslot->so_newpattern; + inslot->so_block = inslot->so_newblock; + } + for (outslotno = 0, outslot = rd->rd_outslots; + outslotno < rd->rd_nsigoutlets; outslotno++, outslot++) + { + outslot->si_pattern = 0; + outslot->si_block = 0; + outslot->si_isready = 0; + } + } + + /* 2c: call the instance-specific method which redeclares the outslots */ + if (doreblock) + { +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "REBLOCK", 0); +#endif + rd->rd_blockfn(rd); + if (rd->rd_disabled) + goto muteandreset; + } + + /* 2d: assign defaults to undeclared outslots */ + for (outslotno = 0, outslot = rd->rd_outslots; + outslotno < rd->rd_nsigoutlets; outslotno++, outslot++) + { + if (outslot->si_block < 0) + { + loudbug_bug("riddle_dsp 4"); + failed = 1; + } + else if (outslot->si_block == 0) + outslot->si_block = rd->rd_graphblock; + } + /* LATER think about not redeclared remote writers */ + if (failed) + goto muteandreset; + + /* step 3: transfer outslot declarations down to destination objects */ + +#ifdef RIDDLE_DEBUG + riddlebug_post(rd, "PUSH", 0); +#endif + if (riddle_validatesinks(rd)) + { + for (outslotno = 0, outslot = rd->rd_outslots; + outslotno < rd->rd_nsigoutlets; outslotno++, outslot++) + if (outslot->si_isready && + rdsink_push(outslot, (t_object *)rd, outslot->si_outno) == 0) + failed = 1; + } + else failed = 1; + /* remote declarations are propagated directly from within + rdremote_setoutblock/layout(), cf. rdremote_pushblock/layout() */ + if (failed) + goto muteandreset; + + + /* step 4: call the wrappee */ + + if (rd->rd_dspfn) + { + rd->rd_dspfn(rd, sp); + unarmed = 0; + } + else loudbug_bug("riddle_dsp 5"); + + /* step 5: mute if disabled, then reset the inslots */ + +muteandreset: + if (unarmed) + { + rd->rd_disabled = 1; + riddle_mute(rd, sp); + } + for (inslotno = 0, inslot = rd->rd_inslots; + inslotno < ninslots; inslotno++, inslot++) + { + inslot->so_newpattern = 0; + inslot->so_newblock = 0; + inslot->so_sourcecount = 0; + } +} + +static void riddle__reblock(t_riddle *rd, t_symbol *pattern, + t_floatarg f1, t_floatarg f2, t_floatarg f3) +{ + riddle_setsourceflags(rd, (int)f1, (int)f3); + if (pattern == rdps__) + riddle_setsourceblock(rd, (int)f1, (int)f2); + else if (pattern) + riddle_setsourcelayout(rd, (int)f1, pattern, (int)f2); + else + loud_error((t_pd *)rd, "bad arguments to '_reblock'"); +} + +static void riddle_free(t_riddle *rd) +{ + t_gotfn freefn = zgetfn((t_pd *)rd, gensym("_free")); + if (freefn) + freefn(rd); + + if (rd->rd_private) + freebytes(rd->rd_private, sizeof(*rd->rd_private)); + + if (rd->rd_inslots) + { + int nslots = rd->rd_nsiginlets + rd->rd_nremoteslots; + freebytes(rd->rd_inslots, nslots * sizeof(*rd->rd_inslots)); + } + + if (rd->rd_outslots) + { + t_rdsink *si; + int i; + for (i = 0, si = rd->rd_outslots; i < rd->rd_nsigoutlets; i++, si++) + if (si->si_feedchain) + rdfeedchain_free(si->si_feedchain); + freebytes(rd->rd_outslots, + rd->rd_nsigoutlets * sizeof(*rd->rd_outslots)); + } + + rdremote_freeports(rd->rd_remoteports); + + if (rd->rd_idlepicker) + rdpicker_detach(rd->rd_idlepicker, rd); +} + +typedef t_pd *(*t_newgimme)(t_symbol *s, int argc, t_atom *argv); + +static void *riddle_new(t_symbol *s, int ac, t_atom *av) +{ + /* IFBUILTIN remove: this is a bad hack */ + t_pd *en = riddle_getenvironment(); + t_newgimme newfn = (t_newgimme)zgetfn(en, s); + if (!newfn) + { + loudbug_bug("riddle_new 1"); + return (0); + } + else + { + t_riddle *rd = (t_riddle *)newfn(s, ac, av); + int i, nslots; + t_rdsource *inslot; + t_rdsink *outslot; + t_rdremote *re; + if (!rd) + return (0); + + rd->rd_private = getbytes(sizeof(*rd->rd_private)); + + rd->rd_disabled = 0; + rd->rd_wasdisabled = 0; + rd->rd_blockfn = (t_rdblockfn)zgetfn((t_pd *)rd, gensym("dspblock")); + rd->rd_dspfn = (t_rddspfn)zgetfn((t_pd *)rd, gensym("_dsp")); + if (!rd->rd_dspfn) + loudbug_bug("riddle_new 2"); + + rd->rd_graphsr = (int)sys_getsr(); + rd->rd_graphblock = sys_getblksize(); + rd->rd_nsiginlets = obj_nsiginlets((t_object *)rd); + rd->rd_nsigoutlets = obj_nsigoutlets((t_object *)rd); + + /* currently, rd_nremoteslots is incremented in rdbuffer_newreader(), + which relies on calloc in pd_new(), LATER rethink */ + + nslots = rd->rd_nsiginlets + rd->rd_nremoteslots; + rd->rd_inslots = getbytes(nslots * sizeof(*rd->rd_inslots)); + for (i = 0, inslot = rd->rd_inslots; i < nslots; i++, inslot++) + { + inslot->so_riddle = rd; + inslot->so_remote = 0; + inslot->so_sourcecount = 0; + inslot->so_pattern = 0; + inslot->so_newpattern = 0; + inslot->so_block = 0; + inslot->so_newblock = 0; + inslot->so_flags = 0; + } + rd->rd_remoteslots = rd->rd_inslots + rd->rd_nsiginlets; + + for (i = 0, inslot = rd->rd_remoteslots, re = rd->rd_remoteports; + i < rd->rd_nremoteslots; i++, inslot++) + { + if (re = rdremote_nextreader(re)) + inslot->so_remote = re; + else + { + loudbug_bug("riddle_new 3"); + break; /* FIXME this is fatal */ + } + } + + rd->rd_outslots = + getbytes(rd->rd_nsigoutlets * sizeof(*rd->rd_outslots)); + for (i = 0, outslot = rd->rd_outslots; + i < rd->rd_nsigoutlets; i++, outslot++) + { + outslot->si_riddle = rd; + outslot->si_outno = -1; + outslot->si_pattern = 0; + outslot->si_block = 0; + outslot->si_flags = 0; + outslot->si_outbuf[0].a_type = A_FLOAT; + outslot->si_outbuf[1].a_type = A_SYMBOL; + outslot->si_outbuf[1].a_w.w_symbol = rdps__; + outslot->si_outbuf[2].a_type = A_FLOAT; + outslot->si_outbuf[3].a_type = A_FLOAT; + outslot->si_outbuf[3].a_w.w_float = 0.; + outslot->si_feedchain = 0; + outslot->si_isready = 0; + } + + riddle_validatesinks(rd); + + for (i = 0, outslot = rd->rd_outslots; + i < rd->rd_nsigoutlets; i++, outslot++) + if (outslot->si_outno >= 0) + outslot->si_feedchain = rdfeedchain_new(outslot->si_outno); + + rd->rd_idlepicker = rdpicker_attach(rd, gensym("_idle")); + + return (rd); + } +} + +/* IFBUILTIN remove: classes would use explicit class_addmethod calls */ +/* obligatory: newfn, dspfn */ +/* optional: freefn, blockfn, floatfn */ +t_class *riddle_setup(t_symbol *name, t_newmethod newfn, t_method freefn, + size_t sz, t_method floatfn, + t_rdblockfn blockfn, t_rddspfn dspfn) +{ + t_class *c = class_new(name, (t_newmethod)riddle_new, + (t_method)riddle_free, sz, 0, A_GIMME, 0); + + /* IFBUILTIN remove: this is a bad hack */ + t_pd *en = riddle_getenvironment(); + class_addmethod(*en, (t_method)newfn, name, 0); + + if (strlen(name->s_name) < 60) + { + char rdstr[64]; + sprintf(rdstr, "rd.%s", name->s_name); + class_addcreator((t_newmethod)riddle_new, gensym(rdstr), A_GIMME, 0); + class_addmethod(*en, (t_method)newfn, gensym(rdstr), 0); + } + + rdps__reblock = gensym("_reblock"); + rdps__ = gensym("_"); + + sic_setup(c, riddle_dsp, floatfn); + if (blockfn) + class_addmethod(c, (t_method)blockfn, gensym("dspblock"), 0); + /* IFBUILTIN "_dsp" -> "dsp" */ + class_addmethod(c, (t_method)dspfn, gensym("_dsp"), 0); + /* IFBUILTIN remove these two */ + class_addmethod(c, (t_method)newfn, gensym("_new"), 0); + if (freefn) + class_addmethod(c, (t_method)freefn, gensym("_free"), 0); + class_addmethod(c, (t_method)riddle__reblock, + rdps__reblock, A_FLOAT, A_SYMBOL, A_FLOAT, A_FLOAT, 0); + return (c); +} + +/* Fills an array of band sizes, in bins, which partition an nbins-point power + spectrum into nbands or less ERB bands (nbands is a requested number of + bands, the actual number is returned). The buffer is then zero-terminated + (and zero-padded if necessary), so its size has to be at least nbands+1. */ +int riddle_erbfill(int nbands, int *buf, int nbins, int sr) +{ + static double coef = 9.293902; /* 21.4 / log(10) */ + double df = (double)sr / (double)nbins; + double fmax = .5 * (nbins + 1) * df; + double fc = df; + int i, erbcount = 0, bincount = 0, lastbin = 0; + int bufsize = nbands + 1; + while (erbcount < nbands && fc < fmax) + { + /* the formula is taken from ~jos/bbt + (the results slightly differ from moore-glasberg's demos) */ + double erbnumber = coef * log(.00437 * fc + 1.); + bincount++; + if ((int)erbnumber > erbcount) /* LATER rethink */ + { + buf[erbcount++] = bincount - lastbin; + lastbin = bincount; + } + fc += df; + } + for (i = erbcount; i < bufsize; i++) + buf[i] = 0; + return (erbcount); +} diff --git a/externals/miXed/riddle/riddle.h b/externals/miXed/riddle/riddle.h new file mode 100644 index 000000000..0795f5f54 --- /dev/null +++ b/externals/miXed/riddle/riddle.h @@ -0,0 +1,133 @@ +/* Copyright (c) 2007 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* these are the riddle external API declarations */ + +#ifndef __RIDDLE_H__ +#define __RIDDLE_H__ + +EXTERN_STRUCT _riddle; +#define t_riddle struct _riddle + +EXTERN_STRUCT _rdprivate; +#define t_rdprivate struct _rdprivate + +EXTERN_STRUCT _rdsource; +#define t_rdsource struct _rdsource + +EXTERN_STRUCT _rdsink; +#define t_rdsink struct _rdsink + +EXTERN_STRUCT _rdpicker; +#define t_rdpicker struct _rdpicker + +EXTERN_STRUCT _rdfeedchain; +#define t_rdfeedchain struct _rdfeedchain + +EXTERN_STRUCT _rdremote; +#define t_rdremote struct _rdremote + +typedef void (*t_rdblockfn)(t_riddle *); +typedef void (*t_rddspfn)(t_riddle *, t_signal **); + +struct _riddle +{ + t_sic rd_sic; + + /* LATER rethink: indirection cost vs. abi stability */ + t_rdprivate *rd_private; + + /* designed for system-level control: block mismatches, etc. + (user-level control possible via the '_idle' slot in graphpool) */ + int rd_disabled; + int rd_wasdisabled; + + t_rdblockfn rd_blockfn; + t_rddspfn rd_dspfn; + + int rd_graphsr; + int rd_graphblock; + + int rd_nsiginlets; + int rd_nremoteslots; + t_rdsource *rd_inslots; /* nsiginlets + nremoteslots elements */ + t_rdsource *rd_remoteslots; /* == inslots + nsiginlets (readers only) */ + t_rdremote *rd_remoteports; /* the list of all remotes */ + + int rd_nsigoutlets; + t_rdsink *rd_outslots; /* nsigoutlets elements */ + + t_rdpicker *rd_idlepicker; +}; + +#define RIDDLE_STRICTNESSMASK 1 /* if set: non-riddle sinks are rejected */ + +/* the main part of the API */ + +int riddle_getsourceblock(t_riddle *rd, int siginno); +t_symbol *riddle_getsourcelayout(t_riddle *rd, int siginno, int *maxblockp); +int riddle_getsourceflags(t_riddle *rd, int siginno); +/* or perhaps, IFBUILTIN, int inlet_getblock(t_inlet *)... */ + +void riddle_setoutblock(t_riddle *rd, int sigoutno, int newblock); +void riddle_setoutlayout(t_riddle *rd, int sigoutno, + t_symbol *pattern, int maxblock); +void riddle_setoutflags(t_riddle *rd, int sigoutno, int flags); +/* or perhaps, IFBUILTIN, void outlet_setblock(t_outlet *, int)... */ + +int riddle_checksourceblock(t_riddle *rd, int siginno, int reqblock); +int riddle_checksourcelayout(t_riddle *rd, int siginno, + t_symbol *reqpattern, int *maxblockp); + +int riddle_isdisabled(t_riddle *rd); +void riddle_disable(t_riddle *rd); + +/* this part is specific to the library implementation */ + +t_class *riddle_setup(t_symbol *name, t_newmethod newfn, t_method freefn, + size_t sz, t_method floatfn, + t_rdblockfn blockfn, t_rddspfn dspfn); + +/* this part is very experimental: remote connections */ + +t_rdremote *rdremote_newwriter(t_riddle *owner, t_symbol *name, int nframes); +t_rdremote *rdremote_newreader(t_riddle *owner, t_symbol *name); +t_rdremote *rdremote_newbuffer(t_riddle *owner, int nframes); + +int rdremote_getsourceblock(t_rdremote *re); +t_symbol *rdremote_getsourcelayout(t_rdremote *re, int *maxblockp); +int rdremote_getsourceflags(t_rdremote *re); + +void rdremote_setoutblock(t_rdremote *re, int nblock); +void rdremote_setoutlayout(t_rdremote *re, t_symbol *pattern, int maxblock); +void rdremote_setoutflags(t_rdremote *re, int flags); + +void rdremote_reset(t_rdremote *re); +t_float *rdremote_gethead(t_rdremote *re); +void rdremote_stephead(t_rdremote *re); +void rdremote_movehead(t_rdremote *re, int nframes); +void rdremote_delayhead(t_rdremote *re, int nframes); + +t_rdpicker *rdpicker_attach(t_riddle *rd, t_symbol *key); +void rdpicker_detach(t_rdpicker *pi, t_riddle *rd); +t_float *rdpicker_pick(t_rdpicker *pi, int *sizep); +t_float rdpicker_pick1(t_rdpicker *pi); +int riddle_isidle(t_riddle *rd); + +t_rdfeedchain *riddle_usefeedchain(t_riddle *rd, + int sigoutno, t_symbol *key, int size); +t_rdfeedchain *riddle_useidlechain(t_riddle *rd, int sigoutno); +void rdfeedchain_feed(t_rdfeedchain *ch, int size, t_float *data); +void rdfeedchain_feed1(t_rdfeedchain *ch, t_float v); + +/* utilities */ + +void riddlebug_post(t_riddle *rd, char *pfx, char *fmt, ...); + +int riddle_getsr(t_riddle *rd); +int riddle_getgraphblock(t_riddle *rd); + +int riddle_erbfill(int nbands, int *buf, int nbins, int sr); + +#endif diff --git a/externals/miXed/riddle/riddleguts.h b/externals/miXed/riddle/riddleguts.h new file mode 100644 index 000000000..b6354e2e0 --- /dev/null +++ b/externals/miXed/riddle/riddleguts.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2007 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* these declarations do not belong to the riddle API + and should not be used by riddle externals */ + +#ifndef __RIDDLEGUTS_H__ +#define __RIDDLEGUTS_H__ + +/* from riddle.c */ + +void riddle_setsourceblock(t_riddle *rd, int siginno, int newblock); +void riddle_setsourcelayout(t_riddle *rd, int siginno, + t_symbol *newpattern, int maxblock); +void riddle_setsourceflags(t_riddle *rd, int siginno, int flags); + +t_canvas *riddle_nextgraph(t_riddle *rd); +t_canvas *riddle_firstgraph(t_riddle *rd, int outno); + +t_rdfeedchain *riddle_getfeedchain(t_riddle *rd, int sigoutno); + +/* from rdremote.c */ + +t_pd *riddle_getenvironment(void); +void riddle_updatedsp(void); + +void rdfeedchain_free(t_rdfeedchain *ch); +t_rdfeedchain *rdfeedchain_new(int outno); + +t_rdremote *rdremote_getwriter(t_rdremote *re); +t_rdremote *rdremote_nextreader(t_rdremote *re); +void rdremote_freeports(t_rdremote *re); + +#endif diff --git a/externals/miXed/shared/Makefile b/externals/miXed/shared/Makefile new file mode 100644 index 000000000..fc022be6c --- /dev/null +++ b/externals/miXed/shared/Makefile @@ -0,0 +1,2 @@ +ROOT_DIR = .. +include $(ROOT_DIR)/Makefile.common diff --git a/externals/miXed/shared/Makefile.dirs b/externals/miXed/shared/Makefile.dirs new file mode 100644 index 000000000..5764f410f --- /dev/null +++ b/externals/miXed/shared/Makefile.dirs @@ -0,0 +1 @@ +MIXED_DIRS = common hammer sickle toxy unstable diff --git a/externals/miXed/shared/Makefile.objects b/externals/miXed/shared/Makefile.objects new file mode 100644 index 000000000..e69de29bb diff --git a/externals/miXed/shared/Makefile.sources b/externals/miXed/shared/Makefile.sources new file mode 100644 index 000000000..6e792b856 --- /dev/null +++ b/externals/miXed/shared/Makefile.sources @@ -0,0 +1,2 @@ +OTHER_SOURCES = \ +shared.c diff --git a/externals/miXed/shared/common/Makefile b/externals/miXed/shared/common/Makefile new file mode 100644 index 000000000..5dcb2c8cc --- /dev/null +++ b/externals/miXed/shared/common/Makefile @@ -0,0 +1,4 @@ +ROOT_DIR = ../.. +include $(ROOT_DIR)/Makefile.common + +all: $(OBJECTS) diff --git a/externals/miXed/shared/common/Makefile.objects b/externals/miXed/shared/common/Makefile.objects new file mode 100644 index 000000000..e69de29bb diff --git a/externals/miXed/shared/common/Makefile.sources b/externals/miXed/shared/common/Makefile.sources new file mode 100644 index 000000000..72977d285 --- /dev/null +++ b/externals/miXed/shared/common/Makefile.sources @@ -0,0 +1,17 @@ +OTHER_SOURCES = \ +binport.c \ +clc.c \ +dict.c \ +fitter.c \ +grow.c \ +lex.c \ +loud.c \ +messtree.c \ +mifi.c \ +os.c \ +patchvalue.c \ +port.c \ +props.c \ +qtree.c \ +rand.c \ +vefl.c diff --git a/externals/miXed/shared/common/binport.c b/externals/miXed/shared/common/binport.c new file mode 100644 index 000000000..90cf25126 --- /dev/null +++ b/externals/miXed/shared/common/binport.c @@ -0,0 +1,853 @@ +/* Copyright (c) 1997-2005 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER verify endianness transparency */ + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <math.h> + +#define BINPORT_MAXSTRING 1000 +#define BINPORT_SYMGROW 64 + +#ifndef MIXED_STANDALONE +/* load a max binary file into a Pd binbuf */ + +#include "m_pd.h" + +#else +/* make a max-textual listing from a max binary file */ + +/* This is a standalone version of a ``max binary to binbuf'' module. + It uses certain Pd calls and structs, which are duplicated in the + "standalone" module defined in shared/unstable. + LATER standalone binport should be linked to the Pd API library. */ + +#include "unstable/standalone.h" + +#ifdef KRZYSZCZ +//#define BINPORT_DEBUG +#endif +#define BINPORT_VERBOSE +#endif + +#include "common/lex.h" +#include "binport.h" + +static void binport_error(char *fmt, ...) +{ + char buf[BINPORT_MAXSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); +#ifdef MIXED_STANDALONE + fprintf(stderr, "ERROR (binport): %s\n", buf); +#else + post("ERROR (binport): %s", buf); +#endif + va_end(ap); +} + +static void binport_warning(char *fmt, ...) +{ +#if defined (MIXED_STANDALONE) || defined(BINPORT_VERBOSE) + char buf[BINPORT_MAXSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); +#ifdef MIXED_STANDALONE + fprintf(stderr, "warning (binport): %s\n", buf); +#else + post("warning (binport): %s", buf); +#endif + va_end(ap); +#endif +} + +static void binport_bug(char *fmt, ...) +{ + char buf[BINPORT_MAXSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); +#ifdef MIXED_STANDALONE + fprintf(stderr, "BUG (binport): %s\n", buf); +#else + bug("(binport) %s", buf); +#endif + va_end(ap); +} + +static void binport_failure(char *filename) +{ + binport_error("\"%s\" doesn't look like a patch file", filename); +} + +static void binpold_failure(char *filename) +{ + binport_error("tried reading \"%s\" as an old format file, but failed", + filename); +} + +enum { + BINPORT_NULLTYPE, + BINPORT_INTTYPE = 1, BINPORT_FLOATTYPE, BINPORT_SYMTYPE, + BINPORT_DEFINTTYPE = 5, BINPORT_DEFFLOATTYPE, BINPORT_DEFSYMTYPE, + BINPORT_DEFDOLLSYMTYPE = 9, + BINPORT_SEMITYPE = 10, BINPORT_COMMATYPE, + BINPORT_DOLLARTYPE, BINPORT_DOLLSYMTYPE +}; + +/* We use A_INT atom type not only for listing, but for import too -- + the parser passes ints to individual token handlers, so that any + required conversion has to be done during Pd message generation. */ +#define A_INT A_DEFFLOAT + +static int binport_readbuf(FILE *fp, char *buf, size_t sz) +{ + return (fread(buf, 1, sz, fp) == sz ? sz : 0); +} + +static int binport_readbyte(FILE *fp, unsigned char *buf) +{ + int c; + if ((c = fgetc(fp)) == EOF) + return (0); + *buf = (unsigned char)c; + return (1); +} + +static int binport_readint(FILE *fp, int *iptr) +{ + unsigned char word[4]; + if (fread(word, 1, 4, fp) == 4) + { + *iptr = ((word[0] << 24) | (word[1] << 16) | (word[2] << 8) | word[3]); + return (4); + } + else return (0); +} + +/* LATER more testing */ +/* make it binpold_readfloat() */ +static int binport_readfloat(FILE *fp, float *fptr) +{ + unsigned char word[10]; + if (fread(word, 1, 10, fp) == 10) + { + int ex; + unsigned hi, lo; + ex = ((word[0] & 0x7F) << 8) | word[1]; + hi = ((unsigned)word[2] << 24) | ((unsigned)word[3] << 16) | + ((unsigned)word[4] << 8) | (unsigned)word[5]; + lo = ((unsigned)word[6] << 24) | ((unsigned)word[7] << 16) | + ((unsigned)word[8] << 8) | (unsigned)word[9]; + if (ex == 0x7FFF) + { + binport_warning("NaN atom bashed to zero"); + *fptr = 0.; + } + else if (ex || hi || lo) + { + double dhi, dlo, dabs; + ex -= 0x401e; + dhi = (double)((hi - 0x7fffffff) - 1) + ((float)0x7fffffff + 1.); + dlo = (double)((lo - 0x7fffffff) - 1) + ((float)0x7fffffff + 1.); + dabs = ldexp(dhi, ex) + ldexp(dlo, ex - 32); + *fptr = ((word[0] & 0x80) ? -(float)dabs : (float)dabs); + } + else *fptr = 0.; +#ifdef BINPORT_DEBUG + fprintf(stderr, "%02x%02x", (int)word[0], (int)word[1]); + fprintf(stderr, " %02x%02x%02x%02x", + (int)word[2], (int)word[3], (int)word[4], (int)word[5]); + fprintf(stderr, " %02x%02x%02x%02x", + (int)word[6], (int)word[7], (int)word[8], (int)word[9]); + fprintf(stderr, " == %g\n", *fptr); +#endif + return (10); + } + else return (0); +} + +static int binport_readstring(FILE *fp, char *buf) +{ + int c, i = 1; + while (c = fgetc(fp)) + { + if (c == EOF) + return (0); + if (++i < BINPORT_MAXSTRING) + *buf++ = (unsigned char)c; + } + *buf = '\0'; + if (i >= BINPORT_MAXSTRING) + binport_warning("symbol string too long, skipped"); + return (i); +} + +typedef struct _binpold +{ + FILE *o_fp; + int o_natoms; + int o_bodysize; + int o_nsymbols; + int o_symbolid; + int o_ndx; + t_atom *o_atombuf; +} t_binpold; + +#define BINPOLD_NATOMTYPES 16 +#define BINPOLD_MAXATOMS 1000000 /* LATER rethink */ + +static t_atomtype binpold_atomtypes[BINPOLD_NATOMTYPES] = { + A_NULL, A_INT, A_FLOAT, A_SYMBOL, + A_CANT, A_CANT, A_CANT, A_CANT, A_CANT, A_CANT, + A_SEMI, A_COMMA, A_DOLLAR, A_CANT, A_CANT, A_CANT +}; + +static int binpold_gettype(t_binpold *old, t_atom *ap) +{ + int typecode; + if ((typecode = fgetc(old->o_fp)) != EOF) + { + if (typecode > 0 && typecode < BINPOLD_NATOMTYPES) + { + ap->a_type = binpold_atomtypes[typecode]; + if (ap->a_type != A_CANT) + return (1); + else binport_warning("unsupported type of atom %d: %d", + old->o_ndx, typecode); + } + else binport_warning("bad type of atom %d: %d", old->o_ndx, typecode); + } + else binport_warning("failed reading type of atom %d", old->o_ndx); + return (0); +} + +static int binpold_getvalue(t_binpold *old, t_atom *ap, int *countp) +{ + int ival; + float fval; + *countp = 0; + switch (ap->a_type) + { + case A_INT: + case A_SYMBOL: + if (*countp = binport_readint(old->o_fp, &ival)) + ap->a_w.w_index = ival; + else + goto valuefailed; + if (ap->a_type == A_SYMBOL) + { + if (ival >= old->o_nsymbols) + old->o_nsymbols = ival + 1; + ap->a_type = A_DEFSYM; /* invalidate, until w_symbol is known */ + } + break; + case A_FLOAT: + if (*countp = binport_readfloat(old->o_fp, &fval)) + ap->a_w.w_float = fval; + else + goto valuefailed; + break; + case A_SEMI: + case A_COMMA: + break; + case A_DOLLAR: + if (*countp = binport_readint(old->o_fp, &ival)) + ap->a_w.w_index = ival; + else + goto valuefailed; + break; + default: + goto valuefailed; + } + return (1); +valuefailed: + binport_warning("failed reading value of atom %d (type %d)", + old->o_ndx, ap->a_type); + return (0); +} + +static int binpold_load(t_binpold *old) +{ + char buf[BINPORT_MAXSTRING]; + t_atom *ap; + int total; +#ifdef BINPORT_DEBUG + fprintf(stderr, "old format: %d atoms, %d-byte chunk of atom values\n", + old->o_natoms, old->o_bodysize); +#endif + for (old->o_ndx = 0, ap = old->o_atombuf; + old->o_ndx < old->o_natoms; old->o_ndx++, ap++) + if (!binpold_gettype(old, ap)) + return (0); + old->o_nsymbols = 0; + total = 0; + for (old->o_ndx = 0, ap = old->o_atombuf; + old->o_ndx < old->o_natoms; old->o_ndx++, ap++) + { + int count; + if (!binpold_getvalue(old, ap, &count)) + return (0); + total += count; + } + if (total != old->o_bodysize) + { + binport_warning("actual chunk size %d inconsistent with declared %d", + total, old->o_bodysize); + return (0); + } + for (old->o_symbolid = 0; + old->o_symbolid < old->o_nsymbols; old->o_symbolid++) + { + if (binport_readstring(old->o_fp, buf)) + { + t_symbol *s = gensym(buf); + for (old->o_ndx = 0, ap = old->o_atombuf; + old->o_ndx < old->o_natoms; old->o_ndx++, ap++) + { + if (ap->a_type == A_DEFSYM && + ap->a_w.w_index == old->o_symbolid) + { + ap->a_type = A_SYMBOL; + ap->a_w.w_symbol = s; + } + } + } + else + { + binport_warning("failed reading string for symbol %d", + old->o_symbolid); + return (0); + } + } + for (old->o_ndx = 0, ap = old->o_atombuf; + old->o_ndx < old->o_natoms; old->o_ndx++, ap++) + { + if (ap->a_type == A_DEFSYM) + { + binport_warning("unknown string for symbol %d", ap->a_w.w_index); + return (0); + } + else if (ap->a_type == A_DOLLAR) + { + sprintf(buf, "#%d", ap->a_w.w_index); + ap->a_type = A_SYMBOL; + ap->a_w.w_symbol = gensym(buf); + } + /* CHECKME A_DOLLSYM */ + } + return (1); +} + +static int binpold_nextatom(t_binpold *old, t_atom *ap) +{ + if (old->o_ndx < old->o_natoms) + { + *ap = old->o_atombuf[old->o_ndx++]; + return (1); + } + else return (0); +} + +static void binpold_free(t_binpold *old) +{ + if (old->o_fp) + fclose(old->o_fp); + if (old->o_atombuf) + freebytes(old->o_atombuf, old->o_natoms * sizeof(*old->o_atombuf)); + freebytes(old, sizeof(*old)); +} + +static t_binpold *binpold_new(FILE *fp) +{ + int natoms, bodysize; + if (binport_readint(fp, &natoms)) + { + if (natoms < 0 || natoms > BINPOLD_MAXATOMS) + binport_warning("bad number of atoms: %d", natoms); + else if (binport_readint(fp, &bodysize)) + { + if (bodysize < 0) + binport_warning("negative chunk size: %d", bodysize); + else + { + t_binpold *old = getbytes(sizeof(*old)); + old->o_fp = fp; + old->o_natoms = natoms; + old->o_bodysize = bodysize; + if (!(old->o_atombuf = + getbytes(old->o_natoms * sizeof(*old->o_atombuf)))) + { + binport_error("could not allocate %d atoms", old->o_natoms); + freebytes(old, sizeof(*old)); + fclose(fp); + return (0); + } + return (old); + } + } + } + else binport_warning("file too short"); + fclose(fp); + return (0); +} + +typedef struct _binport +{ + FILE *b_fp; + int b_ftype; + int b_nsymbols; + int b_symsize; + t_symbol **b_symtable; + t_binpold *b_old; + t_lex *b_lex; +} t_binport; + +static void binport_setint(t_atom *ap, int i) +{ + ap->a_type = A_INT; + ap->a_w.w_index = i; +} + +static void binport_setfloat(t_atom *ap, float f) +{ + ap->a_type = A_FLOAT; + ap->a_w.w_float = f; +} + +static void binport_setsymbol(t_atom *ap, t_symbol *s) +{ + ap->a_type = A_SYMBOL; + ap->a_w.w_symbol = s; +} + +static t_symbol *binport_makesymbol(t_binport *bp, int id) +{ + char s[BINPORT_MAXSTRING]; + if (id < bp->b_nsymbols) + binport_bug("symbol id mismatch"); + else if (id > bp->b_nsymbols) + binport_error("unexpected symbol id"); + else if (binport_readstring(bp->b_fp, s)) + { + int reqsize = ++bp->b_nsymbols; + if (reqsize > bp->b_symsize) + { + reqsize += (BINPORT_SYMGROW - 1); +#ifdef BINPORT_DEBUG + binport_warning("resizing symbol table to %d elements", reqsize); +#endif + if (bp->b_symtable = + resizebytes(bp->b_symtable, + bp->b_symsize * sizeof(*bp->b_symtable), + reqsize * sizeof(*bp->b_symtable))) + bp->b_symsize = reqsize; + else + { + bp->b_nsymbols = bp->b_symsize = 0; + return (0); + } + } + return (bp->b_symtable[id] = gensym(s)); + } + return (0); +} + +static int binport_setbysymtable(t_binport *bp, t_atom *ap, int id) +{ + t_symbol *s; + if (id < bp->b_nsymbols) + s = bp->b_symtable[id]; + else + s = binport_makesymbol(bp, id); + if (s) + { + ap->a_type = A_SYMBOL; + ap->a_w.w_symbol = s; + } + return (s != 0); +} + +static int binport_nextatom(t_binport *bp, t_atom *ap) +{ + unsigned char opcode; + int opval; + char buf[64]; + + if (bp->b_ftype == BINPORT_MAXTEXT && bp->b_lex) + return (lex_nextatom(bp->b_lex, ap)); + else if (bp->b_ftype == BINPORT_MAXOLD && bp->b_old) + return (binpold_nextatom(bp->b_old, ap)); + + if (!binport_readbyte(bp->b_fp, &opcode)) + goto badbin; + opval = opcode & 0x0f; + switch (opcode >> 4) + { + case BINPORT_INTTYPE: /* variable length int, + opval: length (number of bytes that follow) */ + if (!binport_readbuf(bp->b_fp, buf, opval)) + goto badbin; + else + { + unsigned char *p = (unsigned char *)buf + opval; + int i = 0; + while (opval--) i = (i << 8) | *--p; + if (opcode == 0x12) /* FIXME */ + i = (short)i; + binport_setint(ap, i); + } + break; + case BINPORT_FLOATTYPE: /* variable length float, + opval: length (number of bytes that follow) */ + if (!binport_readbuf(bp->b_fp, buf, opval)) + goto badbin; + else + { + unsigned char *p = (unsigned char *)buf + opval; + int i = 0; + while (opval--) i = (i << 8) | *--p; + binport_setfloat(ap, *(t_float *)&i); + } + break; + case BINPORT_SYMTYPE: /* variable length symbol id, + opval: length (number of bytes that follow) */ + if (!binport_readbuf(bp->b_fp, buf, opval)) + goto badbin; + else + { + unsigned char *p = (unsigned char *)buf + opval; + int i = 0; + while (opval--) i = (i << 8) | *--p; + if (!binport_setbysymtable(bp, ap, i)) + goto badbin; + } + break; + case BINPORT_DEFINTTYPE: /* half-byte int */ + binport_setint(ap, opval); + break; + case BINPORT_DEFSYMTYPE: /* half-byte symbol id */ + if (!binport_setbysymtable(bp, ap, opval)) + goto badbin; + break; + case BINPORT_DEFDOLLSYMTYPE: /* half-byte #symbol id */ + if (!binport_setbysymtable(bp, ap, opval)) + goto badbin; + sprintf(buf, "#%s", ap->a_w.w_symbol->s_name); +#ifdef BINPORT_DEBUG + binport_warning(buf); +#endif + ap->a_w.w_symbol = gensym(buf); + break; + case BINPORT_SEMITYPE: + /* LATER warn about nonzero opval */ + ap->a_type = A_SEMI; + break; + case BINPORT_COMMATYPE: + /* CHECKME apparently never used? */ + binport_warning("found the comma type in max binary..."); + /* LATER warn about nonzero opval */ + ap->a_type = A_COMMA; + break; + case BINPORT_DOLLARTYPE: /* #number */ + sprintf(buf, "#%d", opval); + ap->a_type = A_SYMBOL; + ap->a_w.w_symbol = gensym(buf); + break; + case BINPORT_DOLLSYMTYPE: /* #symbol id, + opval: length (number of bytes that follow) */ + if (!binport_readbuf(bp->b_fp, buf, opval)) + goto badbin; + else + { + unsigned char *p = (unsigned char *)buf + opval; + int i = 0; + while (opval--) i = (i << 8) | *--p; + if (!binport_setbysymtable(bp, ap, i)) + goto badbin; + } + sprintf(buf, "#%s", ap->a_w.w_symbol->s_name); +#ifdef BINPORT_DEBUG + binport_warning(buf); +#endif + ap->a_w.w_symbol = gensym(buf); + break; + default: + binport_error("unknown opcode %x", (int)opcode); + goto badbin; + } + return (1); +badbin: + return (0); +} + +static int binport_alike(char *header, int *ftypep) +{ + static char bin_header[4] = { 2, 0, 0, 0 }; /* CHECKME any others? */ + static char old_header[4] = { 0, 0, 0, 1 }; /* CHECKME any others? */ + static char text_header[4] = { 'm', 'a', 'x', ' ' }; + static char pd_header[3] = { '#', 'N', ' ' }; /* canvas or struct */ + if (memcmp(header, bin_header, 4) == 0) + *ftypep = BINPORT_MAXBINARY; + else if (memcmp(header, text_header, 4) == 0) + *ftypep = BINPORT_MAXTEXT; + else if (memcmp(header, old_header, 4) == 0) + *ftypep = BINPORT_MAXOLD; + else + { + if (memcmp(header, pd_header, 3) == 0) + *ftypep = BINPORT_PDFILE; + else + *ftypep = BINPORT_INVALID; + return (0); + } + return (1); +} + +static void binport_free(t_binport *bp) +{ + fclose(bp->b_fp); + if (bp->b_symtable) + freebytes(bp->b_symtable, bp->b_symsize * sizeof(*bp->b_symtable)); + if (bp->b_old) + { + bp->b_old->o_fp = 0; + binpold_free(bp->b_old); + } + if (bp->b_lex) + { + bp->b_lex->l_fp = 0; + lex_free(bp->b_lex); + } + freebytes(bp, sizeof(*bp)); +} + +static t_binport *binport_new(FILE *fp, int *ftypep) +{ + t_binport *bp = 0; + char header[4]; + if (fread(header, 1, 4, fp) == 4) + { + int alike = binport_alike(header, ftypep); + if (alike) + { + bp = getbytes(sizeof(*bp)); + bp->b_fp = fp; + bp->b_ftype = *ftypep; + bp->b_nsymbols = 0; + if (*ftypep == BINPORT_MAXBINARY) + { + bp->b_symsize = BINPORT_SYMGROW; + bp->b_symtable = + getbytes(bp->b_symsize * sizeof(*bp->b_symtable)); + } + else + { + bp->b_symsize = 0; + bp->b_symtable = 0; + } + bp->b_old = 0; + bp->b_lex = 0; + } + else if (*ftypep != BINPORT_PDFILE) + binport_warning("unknown header: %02x%02x%02x%02x", + (int)header[0], (int)header[1], + (int)header[2], (int)header[3]); + } + else + { + binport_warning("file too short"); + *ftypep = BINPORT_INVALID; + } + if (!bp) fclose(fp); + return (bp); +} + +static void binport_print(t_binport *bp, FILE *fp) +{ + char buf[BINPORT_MAXSTRING]; + t_atom at; + int cnt = 0; + if (bp->b_old) + bp->b_old->o_ndx = 0; + while (binport_nextatom(bp, &at)) + { + if (at.a_type == A_SEMI) + { + fputs(";\n", fp); + cnt = 0; + } + else if (at.a_type != A_NULL) + { + if (cnt++) fputc(' ', fp); + lex_atomstring(&at, buf, BINPORT_MAXSTRING, A_INT); + fputs(buf, fp); + } + } +} + +#ifndef MIXED_STANDALONE + +static int binport_tobinbuf(t_binport *bp, t_binbuf *bb) +{ + t_atom at; + if (bp->b_old) + bp->b_old->o_ndx = 0; + while (binport_nextatom(bp, &at)) + if (at.a_type != A_NULL) + binbuf_add(bb, 1, &at); + return (1); +} + +/* LATER deal with corrupt binary files? */ +int binport_read(t_binbuf *bb, char *filename, char *dirname) +{ + int result; + FILE *fp; + char namebuf[MAXPDSTRING]; + namebuf[0] = 0; + if (*dirname) + strcat(namebuf, dirname), strcat(namebuf, "/"); + strcat(namebuf, filename); + sys_bashfilename(namebuf, namebuf); + if (fp = fopen(namebuf, "rb")) + { + int ftype; + t_binport *bp = binport_new(fp, &ftype); + if (bp) + { + if (ftype == BINPORT_MAXBINARY) + result = (binport_tobinbuf(bp, bb) + ? BINPORT_MAXBINARY : BINPORT_CORRUPT); + else if (ftype == BINPORT_MAXTEXT) + { + t_atom at; + if (bp->b_lex = lex_new(fp, A_INT)) + { + while (binport_nextatom(bp, &at)) + if (at.a_type == A_SEMI) + break; + binbuf_addv(bb, "ss;", gensym("max"), gensym("v2")); + result = (binport_tobinbuf(bp, bb) + ? BINPORT_MAXTEXT : BINPORT_CORRUPT); + } + else result = BINPORT_FAILED; + } + else if (ftype == BINPORT_MAXOLD) + { + t_binpold *old = binpold_new(fp); + result = BINPORT_FAILED; + if (old) + { + bp->b_old = old; + if (binpold_load(old) && binport_tobinbuf(bp, bb)) + result = BINPORT_MAXOLD; + } + else binpold_failure(filename); + } + else result = BINPORT_FAILED; + binport_free(bp); + } + else if (ftype == BINPORT_PDFILE) + result = (binbuf_read(bb, filename, dirname, 0) + ? BINPORT_FAILED : BINPORT_PDFILE); + else + { + binport_failure(filename); + result = BINPORT_INVALID; + } + } + else + { + binport_bug("cannot open file"); + result = BINPORT_FAILED; + } + return (result); +} + +/* save as MAXTEXT */ +void binport_write(t_binbuf *bb, char *filename, char *dirname) +{ + int result; + FILE *fp; + char namebuf[MAXPDSTRING]; + namebuf[0] = 0; + if (*dirname) + strcat(namebuf, dirname), strcat(namebuf, "/"); + strcat(namebuf, filename); + sys_bashfilename(namebuf, namebuf); + if (fp = fopen(namebuf, "w")) + { + char buf[BINPORT_MAXSTRING]; + t_atom *ap = binbuf_getvec(bb); + int cnt = 0, ac = binbuf_getnatom(bb); + while (ac--) + { + if (ap->a_type == A_SEMI) + { + fputs(";\n", fp); + cnt = 0; + } + else if (ap->a_type != A_NULL) + { + if (cnt++) fputc(' ', fp); + lex_atomstring(ap, buf, BINPORT_MAXSTRING, A_INT); + fputs(buf, fp); + } + ap++; + } + fclose(fp); + } +} + +#else + +int main(int ac, char **av) +{ + if (ac > 1) + { + FILE *fp = fopen(av[1], "rb"); + if (fp) + { + int ftype; + t_binport *bp = binport_new(fp, &ftype); + if (bp) + { + if (ftype == BINPORT_MAXBINARY) + binport_print(bp, stdout); + else if (ftype == BINPORT_MAXTEXT) + binport_warning("\"%s\" looks like a Max text file", av[1]); + else if (ftype == BINPORT_MAXOLD) + { + t_binpold *old = binpold_new(fp); + if (old) + { + bp->b_old = old; + if (binpold_load(old)) + binport_print(bp, stdout); + else + ftype = BINPORT_FAILED; + } + else ftype = BINPORT_FAILED; + if (ftype == BINPORT_FAILED) binpold_failure(av[1]); + } + binport_free(bp); + } + else if (ftype == BINPORT_PDFILE) + binport_warning("\"%s\" looks like a Pd patch file", av[1]); + else + binport_failure(av[1]); + } + else binport_error("cannot open file \"%s\"", av[1]); + } + else binport_error("what file?"); + return (0); +} + +#endif diff --git a/externals/miXed/shared/common/binport.h b/externals/miXed/shared/common/binport.h new file mode 100644 index 000000000..b70c55556 --- /dev/null +++ b/externals/miXed/shared/common/binport.h @@ -0,0 +1,24 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __BINPORT_H__ +#define __BINPORT_H__ + +/* return values of binport_read() and import_max(), also passed to + outlet_float() by cyclone library objects (cyclone, maxmode...) */ +#define BINPORT_FAILED -4 /* internal error */ +#define BINPORT_CORRUPT -3 /* file contents inconsistency */ +#define BINPORT_INVALID -2 /* file type not recognized */ +#define BINPORT_NOFILE -1 /* file not found */ +#define BINPORT_MAXBINARY 0 +#define BINPORT_MAXTEXT 1 +#define BINPORT_MAXOLD 2 +#define BINPORT_PDFILE 3 + +#ifndef MIXED_STANDALONE +int binport_read(t_binbuf *bb, char *filename, char *dirname); +void binport_write(t_binbuf *bb, char *filename, char *dirname); +#endif + +#endif diff --git a/externals/miXed/shared/common/clc.c b/externals/miXed/shared/common/clc.c new file mode 100644 index 000000000..28244f53a --- /dev/null +++ b/externals/miXed/shared/common/clc.c @@ -0,0 +1,85 @@ +/* Copyright (c) 2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <math.h> +#include "clc.h" + +/* Problem: find a function f : p -> q (where p is user's curve control + parameter, q is log factor) such that the curves will bend in + a semi-linear way over the p's range of 0..1. The curve function is + then g(x, p) = (exp(f(p) * x) - 1) / (exp(f(p)) - 1), where x is + curve's domain. If, for example, the points g(0.5, p) are to make + a semi-linear pattern, then the solution is a function f that minimizes + the integral of the error function e(p) = sqr(((1-p)/2)-g(.5, p)) + over 0..1. Until someone does this analytically, we are left with + a lame formula, which has been tweaked and tested in gnuplot: + f(p) = h(p) / (1 - h(p)), where h(p) = (((p + 1e-20) * 1.2) ** .41) * .91. + The file curve.gp, in the sickle's source directory, may come handy, + in case there is anyone, who fancy tweaking it even further. + + To implement this, start from these equations: + nhops = npoints - 1 + bb * mm ^ nhops = bb + 1 + (bb ^ 2) * (mm ^ nhops) = ((exp(ff/2) - 1) / (exp(ff) - 1)) ^ 2 + + and calculate: + hh = pow(((p + c1) * c2), c3) * c4 + ff = hh / (1 - hh) + eff = exp(ff) - 1 + gh = (exp(ff * .5) - 1) / eff + bb = gh * (gh / (1 - (gh + gh))) + mm = ((exp(ff * (1/nhops)) - 1) / (eff * bb)) + 1 + + The loop is: + for (vv = bb, i = 0; i <= nhops; vv *= mm, i++) + result = (vv - bb) * (y1 - y0) + y0 + where y0, y1 are start and destination values + + This formula generates curves with < .000004% deviation from the straight + line for p = 0 at half-domain, range 1. There are no nans for -1 <= p <= 1. +*/ + +#define CLCCURVE_C1 1e-20 +#define CLCCURVE_C2 1.2 +#define CLCCURVE_C3 0.41 +#define CLCCURVE_C4 0.91 + +void clccurve_coefs(int nhops, double crv, double *bbp, double *mmp) +{ + if (nhops > 0) + { + double hh, ff, eff, gh; + if (crv < 0) + { + if (crv < -1.) + crv = -1.; + hh = pow(((CLCCURVE_C1 - crv) * CLCCURVE_C2), CLCCURVE_C3) + * CLCCURVE_C4; + ff = hh / (1. - hh); + eff = exp(ff) - 1.; + gh = (exp(ff * .5) - 1.) / eff; + *bbp = gh * (gh / (1. - (gh + gh))); + *mmp = 1. / (((exp(ff * (1. / (double)nhops)) - 1.) / + (eff * *bbp)) + 1.); + *bbp += 1.; + } + else + { + if (crv > 1.) + crv = 1.; + hh = pow(((crv + CLCCURVE_C1) * CLCCURVE_C2), CLCCURVE_C3) + * CLCCURVE_C4; + ff = hh / (1. - hh); + eff = exp(ff) - 1.; + gh = (exp(ff * .5) - 1.) / eff; + *bbp = gh * (gh / (1. - (gh + gh))); + *mmp = ((exp(ff * (1. / (double)nhops)) - 1.) / + (eff * *bbp)) + 1.; + } + } + else if (crv < 0) + *bbp = 2., *mmp = 1.; + else + *bbp = *mmp = 1.; +} diff --git a/externals/miXed/shared/common/clc.h b/externals/miXed/shared/common/clc.h new file mode 100644 index 000000000..7618704c3 --- /dev/null +++ b/externals/miXed/shared/common/clc.h @@ -0,0 +1,10 @@ +/* Copyright (c) 2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __CLC_H__ +#define __CLC_H__ + +void clccurve_coefs(int nhops, double crv, double *bbp, double *mmp); + +#endif diff --git a/externals/miXed/shared/common/dict.c b/externals/miXed/shared/common/dict.c new file mode 100644 index 000000000..19d8b2eff --- /dev/null +++ b/externals/miXed/shared/common/dict.c @@ -0,0 +1,288 @@ +/* Copyright (c) 1997-2004 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* this is merely an abstraction layer over gensym() from m_class.c + with various additions adapted from m_pd.c */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "dict.h" + +#ifdef KRZYSZCZ +//#define DICT_DEBUG +#endif +#define DICT_VERBOSE + +#define DICT_HASHSIZE_DEFAULT 1024 +#define DICT_HASHSIZE_MIN 8 +#define DICT_HASHSIZE_MAX 16384 + +/* two structures local to m_pd.c */ +typedef struct _dict_bindelem +{ + t_pd *e_who; + struct _dict_bindelem *e_next; +} t_dict_bindelem; + +typedef struct _dict_bindlist +{ + t_pd b_pd; + t_dict_bindelem *b_list; +} t_dict_bindlist; + +/* adapted bindlist_anything() from m_pd.c */ +static void dict_bindlist_anything(t_dict_bindlist *x, t_symbol *s, + int argc, t_atom *argv) +{ + t_dict_bindelem *e; + for (e = x->b_list; e; e = e->e_next) + pd_typedmess(e->e_who, s, argc, argv); +} + +/* adapted m_pd_setup() from m_pd.c */ +static void dict_bindlist_setup(t_dict *x) +{ + x->d_bindlist_class = class_new(dict_key(x, "bindlist"), 0, 0, + sizeof(t_dict_bindlist), CLASS_PD, 0); + class_addanything(x->d_bindlist_class, dict_bindlist_anything); +} + +t_dict *dict_new(size_t hashsize) +{ + t_dict *x = getbytes(sizeof(*x)); + size_t sz; + if (x) + { + if (!hashsize) + sz = DICT_HASHSIZE_DEFAULT; + else if (hashsize >= DICT_HASHSIZE_MAX) + sz = DICT_HASHSIZE_MAX; + else if (hashsize <= DICT_HASHSIZE_MIN) + sz = DICT_HASHSIZE_MIN; + else for (sz = DICT_HASHSIZE_MAX; sz > DICT_HASHSIZE_MIN; sz >>= 1) + if (sz <= hashsize) break; +#ifdef DICT_DEBUG + fprintf(stderr, + "allocating dictionary with %d-element hashtable\n", sz); +#endif + if (x->d_hashtable = + getbytes((x->d_hashsize = sz) * sizeof(*x->d_hashtable))) + { + dict_bindlist_setup(x); + return (x); + } + freebytes(x, sizeof(*x)); + } + return (0); +} + +void dict_free(t_dict *x) +{ + if (x->d_hashtable) + freebytes(x->d_hashtable, x->d_hashsize * sizeof(*x->d_hashtable)); + freebytes(x, sizeof(*x)); +} + +/* adapted dogensym() from m_class.c */ +t_symbol *dict_dokey(t_dict *x, char *s, t_symbol *oldsym) +{ + t_symbol **sym1, *sym2; + unsigned int hash1 = 0, hash2 = 0; + int length = 0; + char *s2 = s; + int mask = x->d_hashsize - 1; +#ifdef DICT_DEBUG + fprintf(stderr, "make symbol-key from \"%s\"", s); +#endif + while (*s2) + { + hash1 += *s2; + hash2 += hash1; + length++; + s2++; + } + sym1 = x->d_hashtable + (hash2 & mask); +#ifdef DICT_DEBUG + fprintf(stderr, " in slot %d\n", (hash2 & mask)); +#endif + while (sym2 = *sym1) + { +#ifdef DICT_DEBUG + fprintf(stderr, "try \"%s\"\n", sym2->s_name); +#endif + if (!strcmp(sym2->s_name, s)) + { +#ifdef DICT_DEBUG + fprintf(stderr, "found at address %x\n", (int)sym2); +#endif + return(sym2); + } + sym1 = &sym2->s_next; + } + if (oldsym) sym2 = oldsym; + else + { + sym2 = (t_symbol *)t_getbytes(sizeof(*sym2)); + sym2->s_name = t_getbytes(length+1); + sym2->s_next = 0; + sym2->s_thing = 0; + strcpy(sym2->s_name, s); + } + *sym1 = sym2; +#ifdef DICT_DEBUG + fprintf(stderr, "appended at address %x\n", (int)sym2); +#endif + return (sym2); +} + +/* adapted gensym() from m_class.c */ +t_symbol *dict_key(t_dict *x, char *s) +{ + return (dict_dokey(x, s, 0)); +} + +/* adapted pd_bind() from m_pd.c */ +void dict_bind(t_dict *x, t_pd *obj, t_symbol *s) +{ +#ifdef DICT_DEBUG + fprintf(stderr, "bind %x to \"%s\" at %x\n", (int)obj, s->s_name, (int)s); +#endif + if (s->s_thing) + { +#ifdef DICT_DEBUG + fprintf(stderr, "(next one)\n"); +#endif + if (*s->s_thing == x->d_bindlist_class) + { + t_dict_bindlist *b = (t_dict_bindlist *)s->s_thing; + t_dict_bindelem *e = + (t_dict_bindelem *)getbytes(sizeof(t_dict_bindelem)); + e->e_next = b->b_list; + e->e_who = obj; + b->b_list = e; + } + else + { + t_dict_bindlist *b = + (t_dict_bindlist *)pd_new(x->d_bindlist_class); + t_dict_bindelem *e1 = + (t_dict_bindelem *)getbytes(sizeof(t_dict_bindelem)); + t_dict_bindelem *e2 = + (t_dict_bindelem *)getbytes(sizeof(t_dict_bindelem)); + b->b_list = e1; + e1->e_who = obj; + e1->e_next = e2; + e2->e_who = s->s_thing; + e2->e_next = 0; + s->s_thing = &b->b_pd; + } + } + else s->s_thing = obj; +} + +/* adapted pd_unbind() from m_pd.c */ +void dict_unbind(t_dict *x, t_pd *obj, t_symbol *s) +{ +#ifdef DICT_DEBUG + fprintf(stderr, "unbind %x from \"%s\" at %x\n", + (int)obj, s->s_name, (int)s); +#endif + if (s->s_thing == obj) s->s_thing = 0; + else if (s->s_thing && *s->s_thing == x->d_bindlist_class) + { + /* bindlists always have at least two elements... if the number + goes down to one, get rid of the bindlist and bind the symbol + straight to the remaining element. */ + + t_dict_bindlist *b = (t_dict_bindlist *)s->s_thing; + t_dict_bindelem *e, *e2; + if ((e = b->b_list)->e_who == obj) + { + b->b_list = e->e_next; + freebytes(e, sizeof(t_dict_bindelem)); + } + else for (e = b->b_list; e2 = e->e_next; e = e2) + if (e2->e_who == obj) + { + e->e_next = e2->e_next; + freebytes(e2, sizeof(t_dict_bindelem)); + break; + } + if (!b->b_list->e_next) + { + s->s_thing = b->b_list->e_who; + freebytes(b->b_list, sizeof(t_dict_bindelem)); + pd_free(&b->b_pd); + } + } + else pd_error(obj, "%s: couldn't unbind", s->s_name); +} + +t_pd *dict_firstvalue(t_dict *dict, t_symbol *s, void **nextp) +{ + if (s->s_thing) + { + if (*s->s_thing == dict->d_bindlist_class) + { + t_dict_bindelem *e = ((t_dict_bindlist *)s->s_thing)->b_list; + if (e) + { + if (nextp) + *nextp = e->e_next; + return (e->e_who); + } + else return (0); + } + else + { + if (nextp) + *nextp = 0; + return (s->s_thing); + } + } + else return (0); +} + +t_pd *dict_nextvalue(t_dict *dict, t_symbol *s, void **nextp) +{ + if (s->s_thing) + { + if (*s->s_thing == dict->d_bindlist_class && *nextp) + { + t_dict_bindelem *e = (t_dict_bindelem *)*nextp; + *nextp = e->e_next; + return (e->e_who); + } + } + else bug("dict_nextvalue"); + return (0); +} + +#if 0 +t_pd *dict_xvalue(t_dict *x, t_symbol *s) +{ + return (s && s != &s_ ? dict_value(x, dict_key(x, s->s_name)) : 0); +} +#endif + +int dict_forall(t_dict *x, t_symbol *s, t_dict_hook hook, void *hookarg) +{ + if (!s->s_thing) + return (0); + if (*s->s_thing == x->d_bindlist_class) + { + t_dict_bindelem *e = ((t_dict_bindlist *)s->s_thing)->b_list; + if (!e) + return (0); + if (!hook) + return (1); + do + if (!hook(e->e_who, hookarg)) + return (0); + while (e = e->e_next); + return (1); + } + return (hook ? hook(s->s_thing, hookarg) : 1); +} diff --git a/externals/miXed/shared/common/dict.h b/externals/miXed/shared/common/dict.h new file mode 100644 index 000000000..4ab48c86d --- /dev/null +++ b/externals/miXed/shared/common/dict.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __DICT_H__ +#define __DICT_H__ + +typedef struct _dict +{ + size_t d_hashsize; + t_symbol **d_hashtable; + t_class *d_bindlist_class; +} t_dict; + +typedef int (*t_dict_hook)(t_pd *x, void *arg); + +t_dict *dict_new(size_t hashsize); +void dict_free(t_dict *x); +t_symbol *dict_dokey(t_dict *x, char *s, t_symbol *oldsym); +t_symbol *dict_key(t_dict *x, char *s); +void dict_bind(t_dict *x, t_pd *obj, t_symbol *s); +void dict_unbind(t_dict *x, t_pd *obj, t_symbol *s); +t_pd *dict_firstvalue(t_dict *dict, t_symbol *s, void **nextp); +t_pd *dict_nextvalue(t_dict *dict, t_symbol *s, void **nextp); +#if 0 +t_pd *dict_xvalue(t_dict *x, t_symbol *s); +#endif +int dict_forall(t_dict *x, t_symbol *s, t_dict_hook hook, void *hookarg); + +#endif diff --git a/externals/miXed/shared/common/fitter.c b/externals/miXed/shared/common/fitter.c new file mode 100644 index 000000000..48e5653fb --- /dev/null +++ b/externals/miXed/shared/common/fitter.c @@ -0,0 +1,271 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include "m_pd.h" +#include "fitter.h" + +#ifdef KRZYSZCZ +# include "loud.h" +# define FITTER_DEBUG +#else +# define loudbug_bug(msg) fprintf(stderr, "BUG: %s\n", msg), bug(msg) +#endif + +/* FIXME compatibility mode should be a standard Pd feature. When it is, + it will be possible to simplify the implementation. Until then, + we have to handle multiple copies of the 'fitterstate_mode' variable + (coming from different externals), and the only way is multicasting + through a symbol (#miXed). */ +static t_symbol *fitterstate_mode = 0; + +/* FIXME keep state in an extensible fitterstate_dictionary */ +static t_symbol *fitterstate_test = 0; + +typedef struct _fitterstate_client +{ + t_class *fc_owner; + t_canvas *fc_canvas; + t_fitterstate_callback fc_callback; + struct _fitterstate_client *fc_next; +} t_fitterstate_client; + +static t_fitterstate_client *fitterstate_clients = 0; +static t_class *fitterstate_class = 0; +static t_pd *fitterstate_target = 0; +static int fitterstate_ready = 0; +static t_symbol *fitterps_hashmiXed = 0; +static t_symbol *fitterps_mode = 0; +static t_symbol *fitterps_test = 0; +static t_symbol *fitterps_max = 0; +static t_symbol *fitterps_none = 0; + +/* read access (query), called only from fitterstate_dosetup() + or through "#miXed" */ +static void fitterstate_bang(t_pd *x) +{ + if (fitterps_hashmiXed) + { + if (fitterstate_ready /* do not reply to own request */ + && fitterps_hashmiXed->s_thing) + { + t_atom atout[2]; + /* these proliferate for the third and subsequent + fitterstate_dosetup() calls... */ + SETSYMBOL(&atout[0], fitterps_mode); + SETSYMBOL(&atout[1], fitterstate_mode); + typedmess(fitterps_hashmiXed->s_thing, gensym("reply"), 2, atout); + SETSYMBOL(&atout[0], fitterps_test); + SETSYMBOL(&atout[1], fitterstate_test); + typedmess(fitterps_hashmiXed->s_thing, gensym("reply"), 2, atout); + } + } + else loudbug_bug("fitterstate_bang"); +} + +/* read access (query), called only through "#miXed" */ +static void fitterstate_symbol(t_pd *x, t_symbol *s) +{ + if (fitterstate_ready && fitterps_hashmiXed && fitterps_hashmiXed->s_thing) + { + t_atom atout[2]; + if (s == fitterps_mode) + { + SETSYMBOL(&atout[0], fitterps_mode); + SETSYMBOL(&atout[1], fitterstate_mode); + typedmess(fitterps_hashmiXed->s_thing, gensym("reply"), 2, atout); + } + else if (s == fitterps_test) + { + SETSYMBOL(&atout[0], fitterps_test); + SETSYMBOL(&atout[1], fitterstate_test); + typedmess(fitterps_hashmiXed->s_thing, gensym("reply"), 2, atout); + } + else post("\"%s\": no such key in the miXed state", + (s ? s->s_name : "???")); + } + else loudbug_bug("fitterstate_symbol"); +} + +/* read access (reply), called only from fitter_dosetup() or through "#miXed" */ +static void fitterstate_reply(t_pd *x, t_symbol *s1, t_symbol *s2) +{ + if (!s2 || s2 == &s_) + { + loudbug_bug("fitterstate_reply"); + s2 = fitterps_none; + } + if (s1 == fitterps_mode) + fitterstate_mode = s2; + else if (s1 == fitterps_test) + fitterstate_test = s2; +} + +/* write access, called only from fitter_setmode() or through "#miXed" */ +static void fitterstate_set(t_pd *x, t_symbol *s1, t_symbol *s2) +{ + t_fitterstate_client *fc; + if (s1 == fitterps_mode) + fitterstate_mode = s2; + else if (s1 == fitterps_test) + fitterstate_test = s2; + for (fc = fitterstate_clients; fc; fc = fc->fc_next) + if (fc->fc_callback) + fc->fc_callback(); +} + +static void fitterstate_dosetup(int noquery) +{ + if (fitterstate_class || fitterstate_target) + loudbug_bug("fitterstate_dosetup"); + fitterps_hashmiXed = gensym("#miXed"); + fitterps_mode = gensym("mode"); + fitterps_test = gensym("test"); + fitterps_max = gensym("max"); + fitterps_none = gensym("none"); + fitterstate_mode = fitterps_none; + fitterstate_test = fitterps_none; + fitterstate_class = class_new(fitterps_hashmiXed, + 0, 0, sizeof(t_pd), + CLASS_PD | CLASS_NOINLET, 0); + class_addbang(fitterstate_class, fitterstate_bang); + class_addsymbol(fitterstate_class, fitterstate_symbol); + class_addmethod(fitterstate_class, + (t_method)fitterstate_reply, + gensym("reply"), A_SYMBOL, A_SYMBOL, 0); + class_addmethod(fitterstate_class, + (t_method)fitterstate_set, + gensym("set"), A_SYMBOL, A_SYMBOL, 0); + fitterstate_target = pd_new(fitterstate_class); + pd_bind(fitterstate_target, fitterps_hashmiXed); + if (!noquery) + pd_bang(fitterps_hashmiXed->s_thing); + fitterstate_ready = 1; +} + +void fitter_setup(t_class *owner, t_fitterstate_callback callback) +{ + if (!fitterstate_class) + fitterstate_dosetup(0); + if (callback) + { + t_fitterstate_client *fc = getbytes(sizeof(*fc)); + fc->fc_owner = owner; + fc->fc_canvas = 0; /* a global client */ + fc->fc_callback = callback; + fc->fc_next = fitterstate_clients; + fitterstate_clients = fc; + } +} + +void fitter_drop(t_class *owner) +{ + if (fitterstate_class && fitterps_hashmiXed->s_thing) + { + t_fitterstate_client *fcp = 0, + *fc = fitterstate_clients; + while (fc) + { + if (fc->fc_owner == owner) + { + if (fcp) + fcp->fc_next = fc->fc_next; + else + fitterstate_clients = fc->fc_next; + break; + } + fcp = fc; + fc = fc->fc_next; + } + if (fc) + freebytes(fc, sizeof(*fc)); + else + loudbug_bug("fitter_drop 1"); + } + else loudbug_bug("fitter_drop 2"); +} + +t_float *fitter_getfloat(t_symbol *s) +{ + if (!fitterstate_class) + fitterstate_dosetup(0); + loudbug_bug("fitter_getfloat"); + return (0); +} + +t_symbol *fitter_getsymbol(t_symbol *s) +{ + if (!fitterstate_class) + fitterstate_dosetup(0); + if (s == fitterps_mode) + return (fitterstate_mode); + else if (s == fitterps_test) + return (fitterstate_test); + else + { + loudbug_bug("fitter_getsymbol"); + return (0); + } +} + +void fitter_setmode(t_symbol *s) +{ + if (!s || s == &s_) + s = fitterps_none; + post("setting compatibility mode to '%s'", s->s_name); + if (!fitterstate_class) + fitterstate_dosetup(1); + if (fitterps_hashmiXed->s_thing) + { + t_atom atout[2]; + SETSYMBOL(&atout[0], fitterps_mode); + SETSYMBOL(&atout[1], s); + typedmess(fitterps_hashmiXed->s_thing, gensym("set"), 2, atout); + } + else loudbug_bug("fitter_setmode"); +} + +t_symbol *fitter_getmode(void) +{ + if (!fitterstate_class) + fitterstate_dosetup(0); + return (fitterstate_mode); +} + +void fittermax_set(void) +{ + if (!fitterstate_class) + fitterstate_dosetup(0); + fitter_setmode(fitterps_max); +} + +int fittermax_get(void) +{ + if (!fitterstate_class) + fitterstate_dosetup(0); + return (fitterstate_mode == fitterps_max); +} + +void fittermax_warning(t_class *c, char *fmt, ...) +{ + if (!fitterstate_class) + fitterstate_dosetup(0); + if (fitterstate_mode == fitterps_max) + { + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + post("'%s' class incompatibility warning:\n\t%s", + class_getname(c), buf); + va_end(ap); + } +} + +void fittermax_rangewarning(t_class *c, int maxmax, char *what) +{ + fittermax_warning(c, "more than %d %s requested", maxmax, what); +} diff --git a/externals/miXed/shared/common/fitter.h b/externals/miXed/shared/common/fitter.h new file mode 100644 index 000000000..a6797e5a6 --- /dev/null +++ b/externals/miXed/shared/common/fitter.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __FITTER_H__ +#define __FITTER_H__ + +typedef void (*t_fitterstate_callback)(void); + +void fitter_setup(t_class *owner, t_fitterstate_callback callback); +void fitter_drop(t_class *owner); +t_float *fitter_getfloat(t_symbol *s); +t_symbol *fitter_getsymbol(t_symbol *s); +void fitter_setmode(t_symbol *s); +t_symbol *fitter_getmode(void); +void fittermax_set(void); +int fittermax_get(void); +void fittermax_warning(t_class *c, char *fmt, ...); +void fittermax_rangewarning(t_class *c, int maxmax, char *what); + +#endif diff --git a/externals/miXed/shared/common/grow.c b/externals/miXed/shared/common/grow.c new file mode 100644 index 000000000..c67ab503c --- /dev/null +++ b/externals/miXed/shared/common/grow.c @@ -0,0 +1,105 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER generic handling of reentrant output request and self-invoked set */ + +#include <string.h> +#include "m_pd.h" +#include "grow.h" + +/* Prior to this call a caller is supposed to check for *nrequested > *sizep. + Returns a reallocated buffer's pointer (success) or a given 'bufini' + default value (failure). + Upon return *nrequested contains the actual number of elements: + requested (success) or a given default value of 'inisize' (failure). */ +void *grow_nodata(int *nrequested, int *sizep, void *bufp, + int inisize, void *bufini, size_t typesize) +{ + int newsize = *sizep * 2; + while (newsize < *nrequested) newsize *= 2; + if (bufp == bufini) + bufp = getbytes(newsize * typesize); + else + bufp = resizebytes(bufp, *sizep * typesize, newsize * typesize); + if (bufp) + { + *sizep = newsize; + return (bufp); + } + else + { + *nrequested = *sizep = inisize; + return (bufini); + } +} + +/* Like grow_nodata(), but preserving first *nexisting elements. */ +void *grow_withdata(int *nrequested, int *nexisting, + int *sizep, void *bufp, + int inisize, void *bufini, size_t typesize) +{ + int newsize = *sizep * 2; + while (newsize < *nrequested) newsize *= 2; + if (bufp == bufini) + { + if (!(bufp = getbytes(newsize * typesize))) + { + *nrequested = *sizep = inisize; + return (bufini); + } + *sizep = newsize; + memcpy(bufp, bufini, *nexisting * typesize); + } + else + { + int oldsize = *sizep; + if (!(bufp = resizebytes(bufp, *sizep * typesize, newsize * typesize))) + { + *nrequested = *sizep = inisize; + *nexisting = 0; + return (bufini); + } + *sizep = newsize; + } + return (bufp); +} + +/* Like grow_nodata(), but preserving a 'tail' of *nexisting elements, + starting from *startp. */ +/* LATER rethink handling of a start pointer (clumsy now) */ +void *grow_withtail(int *nrequested, int *nexisting, char **startp, + int *sizep, void *bufp, + int inisize, void *bufini, size_t typesize) +{ + int newsize = *sizep * 2; + while (newsize < *nrequested) newsize *= 2; + if (bufp == bufini) + { + char *oldstart = *startp; + if (!(bufp = getbytes(newsize * typesize))) + { + *nrequested = *sizep = inisize; + return (bufini); + } + *startp = (char *)bufp + (newsize - *nexisting) * typesize; + *sizep = newsize; + memcpy(*startp, oldstart, *nexisting * typesize); + } + else + { + int oldsize = *sizep; + if (!(bufp = resizebytes(bufp, *sizep * typesize, newsize * typesize))) + { + *startp = (char *)bufini + inisize * typesize; + *nrequested = *sizep = inisize; + *nexisting = 0; + return (bufini); + } + *startp = (char *)bufp + (newsize - *nexisting) * typesize; + *sizep = newsize; + memmove(*startp, (char *)bufp + (oldsize - *nexisting) * typesize, + *nexisting * typesize); + } + return (bufp); +} diff --git a/externals/miXed/shared/common/grow.h b/externals/miXed/shared/common/grow.h new file mode 100644 index 000000000..1749cfc39 --- /dev/null +++ b/externals/miXed/shared/common/grow.h @@ -0,0 +1,17 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __GROW_H__ +#define __GROW_H__ + +void *grow_nodata(int *nrequested, int *sizep, void *bufp, + int inisize, void *bufini, size_t typesize); +void *grow_withdata(int *nrequested, int *nexisting, + int *sizep, void *bufp, + int inisize, void *bufini, size_t typesize); +void *grow_withtail(int *nrequested, int *nexisting, char **startp, + int *sizep, void *bufp, + int inisize, void *bufini, size_t typesize); + +#endif diff --git a/externals/miXed/shared/common/lex.c b/externals/miXed/shared/common/lex.c new file mode 100644 index 000000000..aafed9dbc --- /dev/null +++ b/externals/miXed/shared/common/lex.c @@ -0,0 +1,272 @@ +/* Copyright (c) 1997-2004 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifdef MIXED_STANDALONE +#include "unstable/standalone.h" +#else +#include "m_pd.h" +#endif +#include "lex.h" + +static int lex_nextbyte(t_lex *lx, unsigned char *buf) +{ + int ich; + if (lx->l_fp) + { + if ((ich = fgetc(lx->l_fp)) == EOF) + return (0); + } + else if (lx->l_buf) + { + if (lx->l_bufndx < lx->l_bufsize) + ich = lx->l_buf[lx->l_bufndx++]; + else + return (0); + } + else return (0); + if (ich) + { + *buf = (unsigned char)ich; + return (1); + } + else + { + lx->l_errbinary = 1; + return (0); + } +} + +static void lex_ungetbyte(t_lex *lx, unsigned char ch) +{ + if (lx->l_fp) + { + ungetc(ch, lx->l_fp); + } + else if (lx->l_buf) + { + if (lx->l_bufndx > 0) + lx->l_buf[--lx->l_bufndx] = ch; + } +} + +/* single pass of binbuf_text(), optionally int-preserving version */ +int lex_nextatom(t_lex *lx, t_atom *ap) +{ + char buf[1001], *bufp, *ebuf = buf + 1000; + int ready; + unsigned char ch; + ap->a_type = A_NULL; + while ((ready = lex_nextbyte(lx, &ch)) && + (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t')); + if (!ready) + { + /* ??? */ + if (lx->l_lasttype == A_SEMI) + return (0); + else + ap->a_type = A_SEMI; + } + else if (ch == ';') + ap->a_type = A_SEMI; + else if (ch == ',') + ap->a_type = A_COMMA; + else + { + int floatstate = 0, slash = 0, lastslash = 0, firstslash = (ch == '\\'); + bufp = buf; + do + { + *bufp = ch; + lastslash = slash; + slash = (ch == '\\'); + + if (floatstate >= 0) + { + int digit = (ch >= '0' && ch <= '9'), + dot = (ch == '.'), minus = (ch == '-'), + plusminus = (minus || (ch == '+')), + expon = (ch == 'e' || ch == 'E'); + if (floatstate == 0) /* beginning */ + { + if (minus) floatstate = 1; + else if (digit) floatstate = 2; + else if (dot) floatstate = 3; + else floatstate = -1; + } + else if (floatstate == 1) /* got minus */ + { + if (digit) floatstate = 2; + else if (dot) floatstate = 3; + else floatstate = -1; + } + else if (floatstate == 2) /* got digits */ + { + if (dot) floatstate = 4; + else if (expon) floatstate = 6; + else if (!digit) floatstate = -1; + } + else if (floatstate == 3) /* got '.' without digits */ + { + if (digit) floatstate = 5; + else floatstate = -1; + } + else if (floatstate == 4) /* got '.' after digits */ + { + if (digit) floatstate = 5; + else if (expon) floatstate = 6; + else floatstate = -1; + } + else if (floatstate == 5) /* got digits after . */ + { + if (expon) floatstate = 6; + else if (!digit) floatstate = -1; + } + else if (floatstate == 6) /* got 'e' */ + { + if (plusminus) floatstate = 7; + else if (digit) floatstate = 8; + else floatstate = -1; + } + else if (floatstate == 7) /* got plus or minus */ + { + if (digit) floatstate = 8; + else floatstate = -1; + } + else if (floatstate == 8) /* got digits */ + { + if (!digit) floatstate = -1; + } + } + if (!slash) bufp++; + } + while ((ready = lex_nextbyte(lx, &ch)) && bufp != ebuf + && (slash || (ch != ' ' && ch != '\n' && ch != '\r' + && ch != '\t' && ch != ',' && ch != ';'))); + if (ready && (ch == ',' || ch == ';')) + lex_ungetbyte(lx, ch); + *bufp = 0; +#if 0 + fprintf(stderr, "buf %s\n", buf); +#endif + if (*buf == '$' && buf[1] >= '0' && buf[1] <= '9' && !firstslash) + { + for (bufp = buf+2; *bufp; bufp++) + { + if (*bufp < '0' || *bufp > '9') + { + ap->a_type = A_DOLLSYM; + ap->a_w.w_symbol = gensym(buf+1); + break; + } + } + if (ap->a_type == A_NULL) + { + ap->a_type = A_DOLLAR; + ap->a_w.w_index = atoi(buf+1); + } + } + else if (floatstate == 2) + { + if (lx->l_inttype == A_FLOAT) + { + ap->a_type = A_FLOAT; + ap->a_w.w_float = (float)atof(buf); + } + else + { + ap->a_type = lx->l_inttype; + ap->a_w.w_index = atoi(buf); + } + } + else if (floatstate == 4 || floatstate == 5 || floatstate == 8) + { + ap->a_type = A_FLOAT; + ap->a_w.w_float = (float)atof(buf); + } + else + { + ap->a_type = A_SYMBOL; + ap->a_w.w_symbol = gensym(buf); + } + } + lx->l_lasttype = ap->a_type; + return (1); +} + +void lex_atomstring(t_atom *ap, char *buf, int bufsize, t_atomtype inttype) +{ + char *sp, *bp, *ep; + switch(ap->a_type) + { + case A_SEMI: + strcpy(buf, ";"); break; + case A_COMMA: + strcpy(buf, ","); break; + case A_FLOAT: + sprintf(buf, "%#f", ap->a_w.w_float); + ep = buf + strlen(buf) - 1; + while (ep > buf && *ep == '0') *ep-- = 0; + break; + case A_SYMBOL: + sp = ap->a_w.w_symbol->s_name; + bp = buf; + ep = buf + (bufsize-5); + while (bp < ep && *sp) + { + if (*sp == ';' || *sp == ',' || *sp == '\\' || + (*sp == '$' && bp == buf && sp[1] >= '0' && sp[1] <= '9')) + *bp++ = '\\'; + if ((unsigned char)*sp < 127) + *bp++ = *sp++; + else + /* FIXME this is temporary -- codepage horror */ + sprintf(bp, "\\%.3o", (unsigned char)*sp++), bp += 4; + } + if (*sp) *bp++ = '*'; + *bp = 0; + break; + case A_DOLLAR: + sprintf(buf, "$%d", ap->a_w.w_index); + break; + case A_DOLLSYM: + sprintf(buf, "$%s", ap->a_w.w_symbol->s_name); + break; + default: + if (ap->a_type == inttype) + sprintf(buf, "%d", ap->a_w.w_index); + else + { +#ifdef MIXED_STANDALONE + fprintf(stderr, "BUG (lex): bad atom type\n"); +#else + bug("lex_atomstring (bad atom type)"); +#endif + strcpy(buf, "???"); + } + } +} + +int lex_isbinary(t_lex *lx) +{ + return (lx->l_errbinary); +} + +void lex_free(t_lex *lx) +{ + freebytes(lx, sizeof(*lx)); +} + +t_lex *lex_new(FILE *fp, t_atomtype inttype) +{ + t_lex *lx = (t_lex *)getbytes(sizeof(*lx)); + lx->l_fp = fp; + lx->l_buf = 0; /* FIXME */ + lx->l_inttype = inttype; + lx->l_lasttype = A_SEMI; + lx->l_errbinary = 0; + return (lx); +} diff --git a/externals/miXed/shared/common/lex.h b/externals/miXed/shared/common/lex.h new file mode 100644 index 000000000..041aa23e7 --- /dev/null +++ b/externals/miXed/shared/common/lex.h @@ -0,0 +1,25 @@ +/* Copyright (c) 2003-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __LEX_H__ +#define __LEX_H__ + +typedef struct _lex +{ + FILE *l_fp; + unsigned char *l_buf; + int l_bufsize; + int l_bufndx; + t_atomtype l_inttype; + t_atomtype l_lasttype; + int l_errbinary; +} t_lex; + +int lex_nextatom(t_lex *lx, t_atom *ap); +void lex_atomstring(t_atom *ap, char *buf, int bufsize, t_atomtype inttype); +int lex_isbinary(t_lex *lx); +void lex_free(t_lex *lx); +t_lex *lex_new(FILE *fp, t_atomtype inttype); + +#endif diff --git a/externals/miXed/shared/common/loud.c b/externals/miXed/shared/common/loud.c new file mode 100644 index 000000000..7129962a5 --- /dev/null +++ b/externals/miXed/shared/common/loud.c @@ -0,0 +1,446 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <errno.h> +#include "m_pd.h" +#include "loud.h" + +#ifdef MSW +#define vsnprintf _vsnprintf +#endif + +/* The 'shared_' calls do not really belong here, + LATER find them a permanent home. */ + +int shared_matchignorecase(char *test, char *pattern) +{ + char ct, cp; + for (ct = *test, cp = *pattern; ct && cp; ct = *++test, cp = *++pattern) + if (ct != cp + && ((ct < 'A' || ct > 'z') + || ((ct > 'Z' || ct + 32 != cp) + && (ct < 'a' || ct - 32 != cp)))) + return (0); + return (ct == cp); +} + +struct _loudcontext +{ + t_pd *lc_caller; /* an object reporting trouble */ + char *lc_callername; + int lc_cnsize; + /* during object creation, use the following: */ + t_symbol *lc_selector; /* creation message selector (class name) */ + int lc_ac; /* creation message arguments */ + t_atom *lc_av; /* void out of creation context */ + int lc_andindent; +}; + +#define LOUD_ERROR_DEFAULT "error (miXed):" + +char *loud_ordinal(int n) +{ + static char buf[16]; /* assuming 10-digit INT_MAX */ + sprintf(buf, "%dth", n); + if (n < 0) n = -n; + n %= 100; + if (n > 20) n %= 10; + if (n && n <= 3) + { + char *ptr = buf + strlen(buf) - 2; + switch (n) + { + case 1: strcpy(ptr, "st"); break; + case 2: strcpy(ptr, "nd"); break; + case 3: strcpy(ptr, "rd"); break; + } + } + return (buf); +} + +void loud_error(t_pd *x, char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + if (x) + { + startpost("%s's ", class_getname(*x)); + pd_error(x, buf); + } + else post("%s %s", LOUD_ERROR_DEFAULT, buf); + va_end(ap); +} + +void loud_errand(t_pd *x, char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + post("%*s%s", (int)(x ? strlen(class_getname(*x)) + 10 + : strlen(LOUD_ERROR_DEFAULT) + 1), "", buf); + va_end(ap); +} + +void loud_syserror(t_pd *x, char *fmt, ...) +{ + if (fmt) + { + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + loud_error(x, "%s (%s)", buf, strerror(errno)); + va_end(ap); + } + else loud_error(x, strerror(errno)); +} + +void loud_nomethod(t_pd *x, t_symbol *s) +{ + loud_error(x, "doesn't understand \"%s\"", s->s_name); +} + +void loud_messarg(t_pd *x, t_symbol *s) +{ + loud_error(x, "bad arguments for message \"%s\"", s->s_name); +} + +int loud_checkint(t_pd *x, t_float f, int *valuep, t_symbol *mess) +{ + if ((*valuep = (int)f) == f) + return (1); + else + { + static t_symbol *floatsym = 0; + if (!floatsym) + floatsym = gensym("noninteger float"); + if (mess == &s_float) + loud_nomethod(x, floatsym); + else if (mess) + loud_error(x, "\"%s\" argument invalid for message \"%s\"", + floatsym->s_name, mess->s_name); + return (0); + } +} + +void loud_classarg(t_class *c) +{ + loud_error(0, "missing or bad arguments in \"%s\"", class_getname(c)); +} + +void loud_warning(t_pd *x, char *who, char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + post("warning (%s): %s", + (x ? class_getname(*x) : (who ? who : "miXed")), buf); + va_end(ap); +} + +void loud_notimplemented(t_pd *x, char *name) +{ + if (name) + loud_warning(x, 0, "\"%s\" method not implemented (yet)", name); + else + loud_warning(x, 0, "not implemented (yet)"); +} + +int loud_floatarg(t_class *c, int which, int ac, t_atom *av, + t_float *vp, t_float minval, t_float maxval, + int underaction, int overaction, char *what) +{ + int result = LOUD_ARGOK; + if (which < ac) + { + av += which; + if (av->a_type == A_FLOAT) + { + t_float f = av->a_w.w_float; + if (f < minval) + { + *vp = (underaction & LOUD_CLIP ? minval : f); + if (underaction) + result = LOUD_ARGUNDER; + } + else if (f > maxval) + { + *vp = (overaction & LOUD_CLIP ? maxval : f); + if (overaction) + result = LOUD_ARGOVER; + } + else *vp = f; + } + else result = LOUD_ARGTYPE; + } + else result = LOUD_ARGMISSING; + if (what) + { + switch (result) + { + case LOUD_ARGUNDER: + if (underaction & LOUD_WARN) + { + if (underaction & LOUD_CLIP) + loud_warning(&c, 0, "%s rounded up to %g", what, minval); + else + loud_warning(&c, 0, "less than %g %s requested", + minval, what); + } + break; + case LOUD_ARGOVER: + if (overaction & LOUD_WARN) + { + if (overaction & LOUD_CLIP) + loud_warning(&c, 0, "%s truncated to %g", what, maxval); + else + loud_warning(&c, 0, "more than %g %s requested", + maxval, what); + } + break; + case LOUD_ARGTYPE: + loud_error(0, "bad argument %d (%s)", which, class_getname(c)); + break; + default:; + } + } + return (result); +} + +void loudx_error(t_loudcontext *lc, char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + if (lc->lc_caller) + { + startpost("%s's ", (lc->lc_callername ? + lc->lc_callername : class_getname(*lc->lc_caller))); + pd_error(lc->lc_caller, buf); + } + else + { + if (lc->lc_callername) + post("error (%s): %s", lc->lc_callername, buf); + else if (lc->lc_selector) + post("error (%s): %s", lc->lc_selector->s_name, buf); + else + post("%s %s", LOUD_ERROR_DEFAULT, buf); + } + va_end(ap); +} + +void loudx_errand(t_loudcontext *lc, char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + post("%*s%s", lc->lc_andindent, "", buf); + va_end(ap); +} + +void loudx_nomethod(t_loudcontext *lc, t_symbol *s) +{ + loudx_error(lc, "doesn't understand \"%s\"", s->s_name); +} + +void loudx_messarg(t_loudcontext *lc, t_symbol *s) +{ + loudx_error(lc, "bad arguments for message \"%s\"", s->s_name); +} + +void loudx_warning(t_loudcontext *lc, char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + if (lc->lc_callername) + post("warning (%s): %s", lc->lc_callername, buf); + else if (lc->lc_selector) + post("warning (%s): %s", lc->lc_selector->s_name, buf); + else + post("warning (miXed): %s", buf); + va_end(ap); +} + +void loudx_setcontext(t_loudcontext *lc, t_pd *caller, char *callername, + t_symbol *s, int ac, t_atom *av) +{ + if (lc->lc_callername) + freebytes(lc->lc_callername, lc->lc_cnsize); + lc->lc_caller = caller; + if (callername) + { + lc->lc_cnsize = strlen(callername) + 1; + lc->lc_callername = getbytes(lc->lc_cnsize); + strcpy(lc->lc_callername, callername); + } + else + { + lc->lc_callername = 0; + lc->lc_cnsize = 0; + } + lc->lc_selector = s; + lc->lc_ac = ac; + lc->lc_av = av; + if (callername) + lc->lc_andindent = lc->lc_cnsize + 9; + else if (caller) + lc->lc_andindent = strlen(class_getname(*caller)) + 10; + else if (s) + lc->lc_andindent = strlen(s->s_name) + 10; + else + lc->lc_andindent = strlen(LOUD_ERROR_DEFAULT) + 1; +} + +/* must call before going out of creation context */ +void loudx_setcaller(t_loudcontext *lc, t_pd *caller, char *callerfmt, ...) +{ + va_list ap; + va_start(ap, callerfmt); + if (callerfmt) + { + char buf[MAXPDSTRING]; + vsprintf(buf, callerfmt, ap); + loudx_setcontext(lc, caller, buf, lc->lc_selector, 0, 0); + } + else loudx_setcontext(lc, caller, 0, lc->lc_selector, 0, 0); + va_end(ap); +} + +t_symbol *loudx_getselector(t_loudcontext *lc) +{ + return (lc->lc_selector); +} + +t_atom *loudx_getarguments(t_loudcontext *lc, int *acp) +{ + *acp = lc->lc_ac; + return (lc->lc_av); +} + +void loudx_freecontext(t_loudcontext *lc) +{ + if (lc->lc_callername) + freebytes(lc->lc_callername, lc->lc_cnsize); + freebytes(lc, sizeof(*lc)); +} + +t_loudcontext *loudx_newcontext(t_pd *caller, char *callername, + t_symbol *s, int ac, t_atom *av) +{ + t_loudcontext *lc = getbytes(sizeof(*lc)); + lc->lc_callername = 0; + loudx_setcontext(lc, caller, callername, s, ac, av); + return (lc); +} + +void loudbug_post(char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + fprintf(stderr, "%s\n", buf); +#ifdef MSW + fflush(stderr); +#endif +} + +void loudbug_startpost(char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + fputs(buf, stderr); +#ifdef MSW + fflush(stderr); +#endif +} + +void loudbug_stringpost(char *s) +{ + fputs(s, stderr); +#ifdef MSW + fflush(stderr); +#endif +} + +void loudbug_endpost(void) +{ + fputs("\n", stderr); +#ifdef MSW + fflush(stderr); +#endif +} + +void loudbug_postatom(int ac, t_atom *av) +{ + while (ac--) + { + char buf[MAXPDSTRING]; + atom_string(av++, buf, MAXPDSTRING); + fprintf(stderr, " %s", buf); +#ifdef MSW + fflush(stderr); +#endif + } +} + +void loudbug_postbinbuf(t_binbuf *bb) +{ + int ac = binbuf_getnatom(bb); + t_atom *aprev = 0, *ap = binbuf_getvec(bb); + while (ac--) + { + char buf[MAXPDSTRING]; + atom_string(ap, buf, MAXPDSTRING); + if (aprev) + { + if (aprev->a_type == A_SEMI) + fprintf(stderr, "\n%s", buf); + else + fprintf(stderr, " %s", buf); + } + else fprintf(stderr, "%s", buf); +#ifdef MSW + fflush(stderr); +#endif + aprev = ap++; + } + if (aprev) + { + fputs("\n", stderr); +#ifdef MSW + fflush(stderr); +#endif + } +} + +void loudbug_bug(char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, MAXPDSTRING-1, fmt, ap); + va_end(ap); + fprintf(stderr, "miXed consistency check failed: %s\n", buf); +#ifdef MSW + fflush(stderr); +#endif + bug(buf); +} diff --git a/externals/miXed/shared/common/loud.h b/externals/miXed/shared/common/loud.h new file mode 100644 index 000000000..9497e0db1 --- /dev/null +++ b/externals/miXed/shared/common/loud.h @@ -0,0 +1,54 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __LOUD_H__ +#define __LOUD_H__ + +#define LOUD_CLIP 1 +#define LOUD_WARN 2 + +enum { LOUD_ARGOK, LOUD_ARGUNDER, LOUD_ARGOVER, LOUD_ARGTYPE, LOUD_ARGMISSING }; + +EXTERN_STRUCT _loudcontext; +#define t_loudcontext struct _loudcontext + +int shared_matchignorecase(char *test, char *pattern); + +char *loud_ordinal(int n); +void loud_error(t_pd *x, char *fmt, ...); +void loud_errand(t_pd *x, char *fmt, ...); +void loud_syserror(t_pd *x, char *fmt, ...); +void loud_nomethod(t_pd *x, t_symbol *s); +void loud_messarg(t_pd *x, t_symbol *s); +int loud_checkint(t_pd *x, t_float f, int *valuep, t_symbol *mess); +void loud_classarg(t_class *c); +void loud_warning(t_pd *x, char *who, char *fmt, ...); +void loud_notimplemented(t_pd *x, char *name); +int loud_floatarg(t_class *c, int which, int ac, t_atom *av, + t_float *vp, t_float minval, t_float maxval, + int underaction, int overaction, char *what); + +void loudx_error(t_loudcontext *lc, char *fmt, ...); +void loudx_errand(t_loudcontext *lc, char *fmt, ...); +void loudx_nomethod(t_loudcontext *lc, t_symbol *s); +void loudx_messarg(t_loudcontext *lc, t_symbol *s); +void loudx_warning(t_loudcontext *lc, char *fmt, ...); +void loudx_setcontext(t_loudcontext *lc, t_pd *caller, char *callername, + t_symbol *s, int ac, t_atom *av); +void loudx_setcaller(t_loudcontext *lc, t_pd *caller, char *callerfmt, ...); +t_symbol *loudx_getselector(t_loudcontext *lc); +t_atom *loudx_getarguments(t_loudcontext *lc, int *acp); +void loudx_freecontext(t_loudcontext *lc); +t_loudcontext *loudx_newcontext(t_pd *caller, char *callername, + t_symbol *s, int ac, t_atom *av); + +void loudbug_post(char *fmt, ...); +void loudbug_startpost(char *fmt, ...); +void loudbug_stringpost(char *s); +void loudbug_endpost(void); +void loudbug_postatom(int ac, t_atom *av); +void loudbug_postbinbuf(t_binbuf *bb); +void loudbug_bug(char *fmt, ...); + +#endif diff --git a/externals/miXed/shared/common/messtree.c b/externals/miXed/shared/common/messtree.c new file mode 100644 index 000000000..6d778aa33 --- /dev/null +++ b/externals/miXed/shared/common/messtree.c @@ -0,0 +1,144 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This module covers parsing of a single message received by an object + or used for creation of an object, as well as parsing of multiple messages + contained in an imported buffer, etc. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "messtree.h" + +#ifdef KRZYSZCZ +#define MESSTREE_DEBUG +#endif + +/* There are two different messtree structures: the compile-time input + (t_messslot/t_messnode) and the run-time one (t_messtree). The reasons are: + to allow plugins to extend a message tree, and to make the compile-time + input initializer-friendly. */ + +struct _messtree +{ + t_messslot *mt_slot; + t_symbol *mt_selector; + t_messcall mt_method; + int mt_nonexclusive; + struct _messtree *mt_sublist; + struct _messtree *mt_next; +}; + +t_messtree *messtree_new(t_symbol *selector) +{ + t_messtree *mt = getbytes(sizeof(*mt)); + mt->mt_slot = 0; + mt->mt_selector = selector; + mt->mt_method = 0; /* LATER define a default */ + mt->mt_nonexclusive = 0; + mt->mt_sublist = 0; + mt->mt_next = 0; + return (mt); +} + +static void messtree_addnode(t_messtree *mt, t_messnode *mn) +{ + /* LATER respect mn->mn_index */ + t_messslot *ms; + int i; + for (i = 0, ms = mn->mn_table + mn->mn_nslots - 1; + i < mn->mn_nslots; i++, ms--) + { + t_messtree *bch = messtree_new(gensym(ms->ms_name)); + bch->mt_slot = ms; + bch->mt_method = ms->ms_call; + bch->mt_nonexclusive = (ms->ms_flags & MESSTREE_NONEXCLUSIVE); + bch->mt_next = mt->mt_sublist; + mt->mt_sublist = bch; + if (ms->ms_subnode) + messtree_addnode(bch, ms->ms_subnode); + } +} + +void messtree_add(t_messtree *mt, t_messnode *rootnode) +{ + messtree_addnode(mt, rootnode); +} + +t_messtree *messtree_build(t_messslot *rootslot) +{ + t_messtree *mt = messtree_new(gensym(rootslot->ms_name)); + mt->mt_slot = rootslot; + mt->mt_method = rootslot->ms_call; + mt->mt_nonexclusive = (rootslot->ms_flags & MESSTREE_NONEXCLUSIVE); + mt->mt_sublist = 0; + mt->mt_next = 0; + if (rootslot->ms_subnode) + messtree_addnode(mt, rootslot->ms_subnode); + return (mt); +} + +int messtree_doit(t_messtree *mt, t_messslot **msp, int *nargp, + t_pd *target, t_symbol *s, int ac, t_atom *av) +{ + int result = MESSTREE_OK, nargpdummy; + t_messslot *mspdummy; + if (!msp) + msp = &mspdummy; + if (!nargp) + nargp = &nargpdummy; + if (s && s != mt->mt_selector) + { + loud_warning(target, (target ? 0 : "messtree"), + "unexpected selector \"%s\"", s->s_name); + *msp = 0; + *nargp = 0; + return (MESSTREE_CORRUPT); + } + if (ac && av->a_type == A_SYMBOL) + { + t_messtree *bch; + for (bch = mt->mt_sublist; bch; bch = bch->mt_next) + { + if (av->a_w.w_symbol == bch->mt_selector) + { + if (bch->mt_sublist) + return (messtree_doit(bch, msp, nargp, target, + av->a_w.w_symbol, ac - 1, av + 1)); + else + { + if (target && bch->mt_method) + result = bch->mt_method(target, av->a_w.w_symbol, + ac - 1, av + 1); + *msp = (result == MESSTREE_OK ? bch->mt_slot : 0); + *nargp = ac - 1; + return (result); + } + } + } + if (mt->mt_nonexclusive) + { + if (target && mt->mt_method) + result = mt->mt_method(target, 0, ac, av); /* LATER rethink */ + *msp = (result == MESSTREE_OK ? mt->mt_slot : 0); + *nargp = ac; + return (result); + } + else + { + loud_warning(target, (target ? 0 : "messtree"), + "unknown property \"%s\"", av->a_w.w_symbol->s_name); + *msp = 0; + *nargp = 0; + return (MESSTREE_UNKNOWN); + } + } + else + { + if (target && mt->mt_method) + result = mt->mt_method(target, 0, ac, av); + *msp = (result == MESSTREE_OK ? mt->mt_slot : 0); + *nargp = ac; + return (result); + } +} diff --git a/externals/miXed/shared/common/messtree.h b/externals/miXed/shared/common/messtree.h new file mode 100644 index 000000000..a3a3326f2 --- /dev/null +++ b/externals/miXed/shared/common/messtree.h @@ -0,0 +1,47 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __MESSTREE_H__ +#define __MESSTREE_H__ + +typedef int (*t_messcall)(t_pd *, t_symbol *, int, t_atom *); +typedef char *t_messarg; + +typedef struct _messslot +{ + char *ms_name; + t_messcall ms_call; + char *ms_argument; + int ms_flags; + struct _messnode *ms_subnode; +} t_messslot; + +typedef struct _messnode /* a parser's symbol definition, sort of... */ +{ + t_messslot *mn_table; + int mn_nslots; + int mn_index; +} t_messnode; + +EXTERN_STRUCT _messtree; +#define t_messtree struct _messtree + +#define MESSTREE_NSLOTS(slots) (sizeof(slots)/sizeof(*(slots))) + +enum { MESSTREE_OK, /* done current message parsing, parse next */ + MESSTREE_CONTINUE, /* continue current message parsing */ + MESSTREE_UNKNOWN, /* current message unknown, parse next */ + MESSTREE_CORRUPT, /* current message corrupt, parse next */ + MESSTREE_FATAL /* exit parsing */ +}; + +#define MESSTREE_NONEXCLUSIVE 1 + +t_messtree *messtree_new(t_symbol *selector); +void messtree_add(t_messtree *mt, t_messnode *rootnode); +t_messtree *messtree_build(t_messslot *rootslot); +int messtree_doit(t_messtree *mt, t_messslot **msp, int *nargp, + t_pd *target, t_symbol *s, int ac, t_atom *av); + +#endif diff --git a/externals/miXed/shared/common/mifi.c b/externals/miXed/shared/common/mifi.c new file mode 100644 index 000000000..e3da3fe00 --- /dev/null +++ b/externals/miXed/shared/common/mifi.c @@ -0,0 +1,1508 @@ +/* Copyright (c) 2004-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifdef NT +#include <io.h> +#else +#include <unistd.h> +#endif +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <errno.h> +#include "m_pd.h" +#include "mifi.h" + +#ifdef __linux__ +#include <sys/types.h> +#ifndef uint32 +typedef u_int32_t uint32; +#endif +#ifndef uint16 +typedef u_int16_t uint16; +#endif +#ifndef uchar +typedef u_int8_t uchar; +#endif +#elif defined(NT) +#ifndef uint32 +typedef unsigned long uint32; +#endif +#ifndef uint16 +typedef unsigned short uint16; +#endif +#ifndef uchar +typedef unsigned char uchar; +#endif +#elif defined(IRIX) +#ifndef uint32 +typedef unsigned long uint32; +#endif +#ifndef uint16 +typedef unsigned short uint16; +#endif +#ifndef uchar +typedef unsigned char uchar; +#endif +#elif defined(__FreeBSD__) +#include <sys/types.h> +#ifndef uint32 +typedef u_int32_t uint32; +#endif +#ifndef uint16 +typedef u_int16_t uint16; +#endif +#ifndef uchar +typedef u_int8_t uchar; +#endif +#else /* MACOSX */ +#ifndef uint32 +typedef unsigned int uint32; +#endif +#ifndef uint16 +typedef unsigned short uint16; +#endif +#ifndef uchar +typedef unsigned char uchar; +#endif +#endif + +#ifdef KRZYSZCZ +# include "loud.h" +# define MIFI_DEBUG +#else +# define loudbug_bug(msg) fprintf(stderr, "BUG: %s\n", msg), bug(msg) +#endif +#define MIFI_VERBOSE + +#define MIFI_SHORTESTEVENT 2 /* singlebyte delta and one databyte */ +#define MIFI_TICKEPSILON ((double).0001) + +#define MIFIHARD_HEADERSIZE 14 /* in case t_mifiheader is padded to 16 */ +#define MIFIHARD_HEADERDATASIZE 6 +#define MIFIHARD_TRACKHEADERSIZE 8 + +/* midi file standard defaults */ +#define MIFIHARD_DEFBEATTICKS 192 +#define MIFIHARD_DEFTEMPO 500000 /* 120 bpm in microseconds per beat */ + +/* user-space defaults */ +#define MIFIUSER_DEFWHOLETICKS ((double)241920) /* whole note, 256*27*5*7 */ +#define MIFIUSER_DEFTEMPO ((double)120960) /* 120 bpm in ticks/sec */ + +#define MIFIEVENT_NALLOC 256 /* LATER do some research (average max?) */ +#define MIFIEVENT_INISIZE 2 /* always be able to handle channel events */ +#define MIFIEVENT_MAXSYSEX 256 /* FIXME */ + +typedef struct _mifievent +{ + uint32 e_delay; + uchar e_status; + uchar e_channel; + uchar e_meta; /* meta-event type */ + uint32 e_length; + size_t e_datasize; + uchar *e_data; + uchar e_dataini[MIFIEVENT_INISIZE]; +} t_mifievent; + +/* midi file header */ +typedef struct _mifiheader +{ + char h_type[4]; + uint32 h_length; + uint16 h_format; + uint16 h_ntracks; + uint16 h_division; +} t_mifiheader; + +/* midi file track header */ +typedef struct _mifitrackheader +{ + char th_type[4]; + uint32 th_length; +} t_mifitrackheader; + +typedef struct _mifireadtx +{ + double rt_wholeticks; /* userticks per whole note (set by user) */ + double rt_deftempo; /* userticks per second (default, adjusted) */ + double rt_tempo; /* userticks per second (current) */ + double rt_tickscoef; /* userticks per hardtick */ + double rt_mscoef; /* ms per usertick (current) */ + double rt_userbar; /* userticks per bar */ + uint16 rt_beatticks; /* hardticks per beat or per frame */ + double rt_hardbar; /* hardticks per bar */ +} t_mifireadtx; + +struct _mifiread +{ + t_pd *mr_owner; + FILE *mr_fp; + t_mifiheader mr_header; + t_mifievent mr_event; + uint32 mr_scoretime; /* current time in hardticks */ + uint32 mr_tempo; /* microseconds per beat */ + uint32 mr_meternum; + uint32 mr_meterden; + uchar mr_status; + uchar mr_channel; + int mr_nevents; + int mr_ntempi; + uint16 mr_hdtracks; /* ntracks, as declared in the file header */ + uint16 mr_ntracks; /* as actually contained in a file */ + uint16 mr_trackndx; + t_symbol **mr_tracknames; + uchar mr_nframes; /* fps if nonzero, else use metrical time */ + uint16 mr_format; /* anything > 0 handled as 1, FIXME */ + uint32 mr_bytesleft; /* nbytes remaining to be read from a track */ + int mr_pass; + int mr_eof; /* set in case of early eof (error) */ + int mr_newtrack; /* reset after reading track's first event */ + t_mifireadtx mr_ticks; +}; + +typedef struct _mifiwritetx +{ + double wt_wholeticks; /* userticks per whole note (set by user) */ + double wt_deftempo; /* userticks per second (default, adjusted) */ + double wt_tempo; /* userticks per second (set by user, quantized) */ + double wt_tickscoef; /* hardticks per usertick */ + uint16 wt_beatticks; /* hardticks per beat or per frame (set by user) */ + double wt_mscoef; /* hardticks per ms */ +} t_mifiwritetx; + +struct _mifiwrite +{ + t_pd *mw_owner; + FILE *mw_fp; + t_mifiheader mw_header; + t_mifievent mw_event; + uint32 mw_tempo; /* microseconds per beat */ + uint32 mw_meternum; + uint32 mw_meterden; + uchar mw_status; + uchar mw_channel; + int mw_ntempi; + uint16 mw_ntracks; + uint16 mw_trackndx; + t_symbol **mw_tracknames; + uchar mw_nframes; /* fps if nonzero, else use metrical time */ + uint16 mw_format; /* anything > 0 handled as 1, FIXME */ + uint32 mw_trackbytes; /* nbytes written to a track so far */ + int mw_trackdirty; /* after opentrack, before adjusttrack */ + t_mifiwritetx mw_ticks; +}; + +static int mifi_swapping = 1; + +static void mifi_initialize(void) +{ + unsigned short s = 1; + unsigned char c = *(char *)(&s); + mifi_swapping = (c != 0); +} + +static void mifi_error(t_pd *x, char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + if (x) + { + startpost("%s's ", class_getname(*x)); + pd_error(x, buf); + } + else post("mifi error: %s", buf); + va_end(ap); +} + +static void mifi_warning(t_pd *x, char *fmt, ...) +{ + char buf[MAXPDSTRING]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); + if (x) + post("%s's warning: %s", class_getname(*x), buf); + else + post("mifi warning: %s", buf); + va_end(ap); +} + +static uint32 mifi_swap4(uint32 n) +{ + if (mifi_swapping) + return (((n & 0xff) << 24) | ((n & 0xff00) << 8) | + ((n & 0xff0000) >> 8) | ((n & 0xff000000) >> 24)); + else + return (n); +} + +static uint16 mifi_swap2(uint16 n) +{ + if (mifi_swapping) + return (((n & 0xff) << 8) | ((n & 0xff00) >> 8)); + else + return (n); +} + +static int mifievent_initialize(t_mifievent *ep, size_t nalloc) +{ + ep->e_length = 0; + if (ep->e_data = getbytes(nalloc)) + { + ep->e_datasize = nalloc; + return (1); + } + else + { + ep->e_data = ep->e_dataini; + ep->e_datasize = MIFIEVENT_INISIZE; + return (0); + } +} + +static int mifievent_setlength(t_mifievent *ep, size_t length) +{ + if (length > ep->e_datasize) + { + size_t newsize = ep->e_datasize; + while (newsize < length) + newsize *= 2; + if (ep->e_data = resizebytes(ep->e_data, ep->e_datasize, newsize)) + ep->e_datasize = newsize; + else + { + ep->e_length = 0; + /* rather hopeless... */ + newsize = MIFIEVENT_NALLOC; + if (ep->e_data = getbytes(newsize)) + ep->e_datasize = newsize; + else + { + ep->e_data = ep->e_dataini; + ep->e_datasize = MIFIEVENT_INISIZE; + } + return (0); + } + } + ep->e_length = (uint32)length; + return (1); +} + +static int mifievent_settext(t_mifievent *ep, unsigned type, char *text) +{ + if (type > 127) + { + loudbug_bug("mifievent_settext"); + return (0); + } + if (mifievent_setlength(ep, strlen(text) + 1)) + { + ep->e_status = MIFIEVENT_META; + ep->e_meta = (uchar)type; + strcpy(ep->e_data, text); + return (1); + } + else + { + ep->e_status = 0; + return (0); + } +} + +#ifdef MIFI_DEBUG +static void mifi_printsysex(int length, uchar *buf) +{ + loudbug_startpost("sysex:"); + while (length--) + loudbug_startpost(" %d", (int)*buf++); + loudbug_endpost(); +} + +static void mifievent_printsysex(t_mifievent *ep) +{ + mifi_printsysex(ep->e_length, ep->e_data); +} +#endif + +static void mifievent_printmeta(t_mifievent *ep) +{ + static int isprintable[MIFIMETA_MAXPRINTABLE+1] = + { +#ifdef MIFI_DEBUG + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +#elif defined MIFI_VERBOSE + 0, 0, 1, 1, 1, 1, 1, 1 +#endif + }; + static char *printformat[MIFIMETA_MAXPRINTABLE+1] = + { + "", "text: %s", "copyright: %s", "track name: %s", + "instrument name: %s", "lyric: %s", "marker: %s", "cue point: %s" + }; + if (ep->e_meta <= MIFIMETA_MAXPRINTABLE) + { +#if 0 + if (isprintable[ep->e_meta] && printformat[ep->e_meta]) + post(printformat[ep->e_meta], ep->e_data); +#endif + } +#ifdef MIFI_DEBUG + else if (ep->e_meta == MIFIMETA_TEMPO) + { + int tempo = mifi_swap4(*(uint32 *)ep->e_data); + loudbug_post("tempo (hard) %d after %d", tempo, ep->e_delay); + } + else if (ep->e_meta == MIFIMETA_TIMESIG) + { + loudbug_post("meter %d/%d after %d", + ep->e_data[0], (1 << ep->e_data[1]), ep->e_delay); + } +#endif +} + +static void mifiread_earlyeof(t_mifiread *mr) +{ + mr->mr_bytesleft = 0; + mr->mr_eof = 1; +} + +/* Get next byte from track data. On error: return 0 (which is a valid + result) and set mr->mr_eof. */ +static uchar mifiread_getbyte(t_mifiread *mr) +{ + if (mr->mr_bytesleft) + { + int c; + if ((c = fgetc(mr->mr_fp)) == EOF) + { + mifiread_earlyeof(mr); + return (0); + } + else + { + mr->mr_bytesleft--; + return ((uchar)c); + } + } + else return (0); +} + +static uint32 mifiread_getbytes(t_mifiread *mr, uchar *buf, uint32 size) +{ + size_t res; + if (size > mr->mr_bytesleft) + size = mr->mr_bytesleft; + if ((res = fread(buf, 1, (size_t)size, mr->mr_fp)) == size) + mr->mr_bytesleft -= res; + else + mifiread_earlyeof(mr); + return (res); +} + +static int mifiread_skipbytes(t_mifiread *mr, uint32 size) +{ + if (size > mr->mr_bytesleft) + size = mr->mr_bytesleft; + if (size) + { + int res = fseek(mr->mr_fp, size, SEEK_CUR); + if (res < 0) + mifiread_earlyeof(mr); + else + mr->mr_bytesleft -= size; + return res; + } + else return (0); +} + +static uint32 mifiread_getvarlen(t_mifiread *mr) +{ + uint32 n = 0; + uchar c; + uint32 count = mr->mr_bytesleft; + if (count > 4) + count = 4; + while (count--) + { + n = (n << 7) + ((c = mifiread_getbyte(mr)) & 0x7f); + if ((c & 0x80) == 0) + break; + } + return (n); +} + +static size_t mifiwrite_putvarlen(t_mifiwrite *mw, uint32 n) +{ + uint32 buf = n & 0x7f; + size_t length = 1; + while ((n >>= 7) > 0) + { + buf <<= 8; + buf |= 0x80; + buf += n & 0x7f; + length++; + } + return ((fwrite(&buf, 1, length, mw->mw_fp) == length) ? length : 0); +} + +static void mifiread_updateticks(t_mifiread *mr) +{ + if (mr->mr_nframes) + { + mr->mr_ticks.rt_userbar = mr->mr_ticks.rt_wholeticks; + /* LATER ntsc */ + mr->mr_ticks.rt_tickscoef = mr->mr_ticks.rt_deftempo / + (mr->mr_nframes * mr->mr_ticks.rt_beatticks); + mr->mr_ticks.rt_hardbar = mr->mr_ticks.rt_userbar / + mr->mr_ticks.rt_tickscoef; + mr->mr_ticks.rt_tempo = mr->mr_ticks.rt_deftempo; + } + else + { + mr->mr_ticks.rt_userbar = + (mr->mr_ticks.rt_wholeticks * mr->mr_meternum) / mr->mr_meterden; + mr->mr_ticks.rt_hardbar = + (mr->mr_ticks.rt_beatticks * 4. * mr->mr_meternum) / + mr->mr_meterden; + mr->mr_ticks.rt_tickscoef = + mr->mr_ticks.rt_wholeticks / (mr->mr_ticks.rt_beatticks * 4.); + mr->mr_ticks.rt_tempo = + ((double)MIFIHARD_DEFTEMPO * mr->mr_ticks.rt_deftempo) / + ((double)mr->mr_tempo); + if (mr->mr_ticks.rt_tempo < MIFI_TICKEPSILON) + { + loudbug_bug("mifiread_updateticks"); + mr->mr_ticks.rt_tempo = mr->mr_ticks.rt_deftempo; + } + } + mr->mr_ticks.rt_mscoef = 1000. / mr->mr_ticks.rt_tempo; +} + +static void mifiread_resetticks(t_mifiread *mr) +{ + mr->mr_ticks.rt_wholeticks = MIFIUSER_DEFWHOLETICKS; + mr->mr_ticks.rt_deftempo = MIFIUSER_DEFTEMPO; + mr->mr_ticks.rt_beatticks = MIFIHARD_DEFBEATTICKS; +} + +static void mifiread_reset(t_mifiread *mr) +{ + mr->mr_eof = 0; + mr->mr_newtrack = 0; + mr->mr_fp = 0; + mr->mr_format = 0; + mr->mr_nframes = 0; + mr->mr_tempo = MIFIHARD_DEFTEMPO; + mr->mr_meternum = 4; + mr->mr_meterden = 4; + mr->mr_ntracks = 0; + mr->mr_status = 0; + mr->mr_channel = 0; + mr->mr_bytesleft = 0; + mr->mr_pass = 0; + mr->mr_hdtracks = 1; + mr->mr_tracknames = 0; + mifiread_updateticks(mr); +} + +/* Calling this is optional. The obligatory part is supplied elsewhere: + in the constructor (owner), and in the doit() call (hook function). */ +void mifiread_setuserticks(t_mifiread *mr, double wholeticks) +{ + mr->mr_ticks.rt_wholeticks = (wholeticks > MIFI_TICKEPSILON ? + wholeticks : MIFIUSER_DEFWHOLETICKS); + mr->mr_ticks.rt_deftempo = mr->mr_ticks.rt_wholeticks * + (MIFIUSER_DEFTEMPO / MIFIUSER_DEFWHOLETICKS); + mifiread_updateticks(mr); +} + +/* open a file and read its header */ +static int mifiread_startfile(t_mifiread *mr, const char *filename, + const char *dirname, int complain) +{ + char errmess[MAXPDSTRING], path[MAXPDSTRING], *fnameptr; + int fd; + mr->mr_fp = 0; + if ((fd = open_via_path(dirname, filename, + "", path, &fnameptr, MAXPDSTRING, 1)) < 0) + { + strcpy(errmess, "cannot open"); + goto rstartfailed; + } + close(fd); + if (path != fnameptr) + { + char *slashpos = path + strlen(path); + *slashpos++ = '/'; + /* try not to be dependent on current open_via_path() implementation */ + if (fnameptr != slashpos) + strcpy(slashpos, fnameptr); + } + sys_bashfilename(path, path); + if (!(mr->mr_fp = fopen(path, "rb"))) + { + strcpy(errmess, "cannot open"); + goto rstartfailed; + } + if (fread(&mr->mr_header, 1, + MIFIHARD_HEADERSIZE, mr->mr_fp) < MIFIHARD_HEADERSIZE) + { + strcpy(errmess, "missing header of"); + goto rstartfailed; + } + return (1); +rstartfailed: + if (complain) + mifi_error(mr->mr_owner, "%s file \"%s\" (errno %d: %s)", + errmess, filename, errno, strerror(errno)); + if (mr->mr_fp) + { + fclose(mr->mr_fp); + mr->mr_fp = 0; + } + return (0); +} + +static int mifiread_starttrack(t_mifiread *mr) +{ + t_mifitrackheader th; + long skip; + int notyet = 1; + do { + if (fread(&th, 1, MIFIHARD_TRACKHEADERSIZE, + mr->mr_fp) < MIFIHARD_TRACKHEADERSIZE) + goto nomoretracks; + th.th_length = mifi_swap4(th.th_length); + if (strncmp(th.th_type, "MTrk", 4)) + { + char buf[8]; + strncpy(buf, th.th_type, 4); + buf[4] = 0; + if (mr->mr_pass == 1) + mifi_warning(mr->mr_owner, + "unknown chunk %s in midi file... skipped", buf); + } + else if (th.th_length < MIFI_SHORTESTEVENT) + { + if (mr->mr_pass == 1) + mifi_warning(mr->mr_owner, + "empty track in midi file... skipped"); + } + else notyet = 0; + if (notyet && (skip = th.th_length) && + fseek(mr->mr_fp, skip, SEEK_CUR) < 0) + goto nomoretracks; + } while (notyet); + mr->mr_scoretime = 0; + mr->mr_newtrack = 1; + mr->mr_status = mr->mr_channel = 0; + mr->mr_bytesleft = th.th_length; + return (1); +nomoretracks: + if (mr->mr_ntracks == 0 && mr->mr_pass == 1) + mifi_warning(mr->mr_owner, "no valid miditracks"); + return (0); +} + +static int mifiread_nextevent(t_mifiread *mr) +{ + t_mifievent *ep = &mr->mr_event; + uchar status, channel; + uint32 length; + mr->mr_newtrack = 0; +nextattempt: + if (mr->mr_bytesleft < MIFI_SHORTESTEVENT && + !mifiread_starttrack(mr)) + return (MIFIREAD_EOF); + mr->mr_scoretime += (mr->mr_event.e_delay = mifiread_getvarlen(mr)); + if ((status = mifiread_getbyte(mr)) < 0x80) + { + if (MIFI_ISCHANNEL(mr->mr_status)) + { + ep->e_data[0] = status; + ep->e_length = 1; + status = mr->mr_status; + ep->e_channel = mr->mr_channel; + } + else + { + if (mr->mr_pass == 1) + mifi_warning(mr->mr_owner, + "missing running status in midi file... skip to end of track"); + goto endoftrack; + } + } + else ep->e_length = 0; + + /* channel message */ + if (status < 0xf0) + { + if (ep->e_length == 0) + { + ep->e_data[0] = mifiread_getbyte(mr); + ep->e_length = 1; + mr->mr_status = status & 0xf0; + mr->mr_channel = ep->e_channel = status & 0x0f; + status = mr->mr_status; + } + if (!MIFI_ONEDATABYTE(status)) + { + ep->e_data[1] = mifiread_getbyte(mr); + ep->e_length = 2; + } + } + + /* system exclusive */ + else if (status == MIFISYSEX_FIRST || status == MIFISYSEX_NEXT) + { + length = mifiread_getvarlen(mr); + if (length > MIFIEVENT_MAXSYSEX) /* FIXME optional read */ + { + if (mifiread_skipbytes(mr, length) < 0) + return (MIFIREAD_FATAL); + } + else + { + uchar *tempbuf = getbytes(length); + if (mifiread_getbytes(mr, tempbuf, length) != length) + return (MIFIREAD_FATAL); +#ifdef MIFI_DEBUG + mifi_printsysex(length, tempbuf); +#endif + freebytes(tempbuf, length); + } + goto nextattempt; + } + + /* meta-event */ + else if (status == MIFIEVENT_META) + { + ep->e_meta = mifiread_getbyte(mr); + length = mifiread_getvarlen(mr); + if (ep->e_meta > 127) + { + /* try to skip corrupted meta-event (quietly) */ +#ifdef MIFI_VERBOSE + if (mr->mr_pass == 1) + mifi_warning(mr->mr_owner, "bad meta: %d > 127", ep->e_meta); +#endif + if (mifiread_skipbytes(mr, length) < 0) + return (MIFIREAD_FATAL); + goto nextattempt; + } + switch (ep->e_meta) + { + case MIFIMETA_EOT: + if (length) + { + /* corrupted eot: ignore and skip to the real end of track */ +#ifdef MIFI_VERBOSE + if (mr->mr_pass == 1) + mifi_warning(mr->mr_owner, + "corrupted eot, length %d", length); +#endif + goto endoftrack; + } + break; + case MIFIMETA_TEMPO: + if (length != 3) + { + if (mr->mr_pass == 1) + mifi_warning(mr->mr_owner, + "corrupted tempo event in midi file... skip to end of track"); + goto endoftrack; + } + if (mifiread_getbytes(mr, ep->e_data + 1, 3) != 3) + return (MIFIREAD_FATAL); + ep->e_data[0] = 0; + mr->mr_tempo = mifi_swap4(*(uint32 *)ep->e_data); + if (!mr->mr_tempo) + mr->mr_tempo = MIFIHARD_DEFTEMPO; + mifiread_updateticks(mr); + break; + case MIFIMETA_TIMESIG: + if (length != 4) + { + if (mr->mr_pass == 1) + mifi_warning(mr->mr_owner, + "corrupted time signature event in midi file... skip to end of track"); + goto endoftrack; + } + if (mifiread_getbytes(mr, ep->e_data, 4) != 4) + return (MIFIREAD_FATAL); + mr->mr_meternum = ep->e_data[0]; + mr->mr_meterden = (1 << ep->e_data[1]); + if (!mr->mr_meternum || !mr->mr_meterden) + mr->mr_meternum = mr->mr_meterden = 4; + mifiread_updateticks(mr); +#ifdef MIFI_DEBUG + if (mr->mr_pass == 1) + loudbug_post("barspan (hard) %g", mr->mr_ticks.rt_hardbar); +#endif + break; + default: + if (length + 1 > MIFIEVENT_NALLOC) + { + if (mifiread_skipbytes(mr, length) < 0) + return (MIFIREAD_FATAL); + goto nextattempt; + } + if (mifiread_getbytes(mr, ep->e_data, length) != length) + return (MIFIREAD_FATAL); + ep->e_length = length; + if (ep->e_meta && ep->e_meta <= MIFIMETA_MAXPRINTABLE) + ep->e_data[length] = '\0'; /* text meta-event nultermination */ + } + } + else + { + if (mr->mr_pass == 1) + mifi_warning(mr->mr_owner, + "unknown event type in midi file... skip to end of track"); + goto endoftrack; + } + return ((ep->e_status = status) == MIFIEVENT_META ? ep->e_meta : status); +endoftrack: + if (mifiread_skipbytes(mr, mr->mr_bytesleft) < 0) + return (MIFIREAD_FATAL); + else + return (MIFIREAD_SKIP); +} + +static int mifiread_restart(t_mifiread *mr, int complain) +{ + mr->mr_eof = 0; + mr->mr_newtrack = 0; + mr->mr_status = 0; + mr->mr_channel = 0; + mr->mr_bytesleft = 0; + mr->mr_pass = 0; + if (fseek(mr->mr_fp, 0, SEEK_SET)) + { + if (complain) + mifi_error(mr->mr_owner, + "file error (errno %d: %s)", errno, strerror(errno)); + return (0); + } + else return (1); +} + +static int mifiread_doopen(t_mifiread *mr, const char *filename, + const char *dirname, int complain) +{ + long skip; + mifiread_reset(mr); + if (!mifiread_startfile(mr, filename, dirname, complain)) + return (0); + if (strncmp(mr->mr_header.h_type, "MThd", 4)) + goto badheader; + mr->mr_header.h_length = mifi_swap4(mr->mr_header.h_length); + if (mr->mr_header.h_length < MIFIHARD_HEADERDATASIZE) + goto badheader; + if (skip = mr->mr_header.h_length - MIFIHARD_HEADERDATASIZE) + { + mifi_warning(mr->mr_owner, + "%ld extra bytes of midi file header... skipped", skip); + if (fseek(mr->mr_fp, skip, SEEK_CUR) < 0) + goto badstart; + } + mr->mr_format = mifi_swap2(mr->mr_header.h_format); + mr->mr_hdtracks = mifi_swap2(mr->mr_header.h_ntracks); + if (mr->mr_hdtracks > 1000) /* a sanity check */ + mifi_warning(mr->mr_owner, "%d tracks declared in midi file \"%s\"", + mr->mr_hdtracks, filename); + mr->mr_tracknames = getbytes(mr->mr_hdtracks * sizeof(*mr->mr_tracknames)); + mr->mr_ticks.rt_beatticks = mifi_swap2(mr->mr_header.h_division); + if (mr->mr_ticks.rt_beatticks & 0x8000) + { + mr->mr_nframes = (mr->mr_ticks.rt_beatticks >> 8); + mr->mr_ticks.rt_beatticks &= 0xff; + } + else mr->mr_nframes = 0; + if (mr->mr_ticks.rt_beatticks == 0) + goto badheader; + mifiread_updateticks(mr); +#ifdef MIFI_DEBUG + if (mr->mr_nframes) + loudbug_post( + "midi file (format %d): %d tracks, %d ticks (%d smpte frames)", + mr->mr_format, mr->mr_hdtracks, + mr->mr_ticks.rt_beatticks, mr->mr_nframes); + else + loudbug_post("midi file (format %d): %d tracks, %d ticks per beat", + mr->mr_format, mr->mr_hdtracks, mr->mr_ticks.rt_beatticks); +#endif + return (1); +badheader: + if (complain) + mifi_error(mr->mr_owner, "\"%s\" is not a valid midi file", filename); +badstart: + fclose(mr->mr_fp); + mr->mr_fp = 0; + return (0); +} + +/* Gather statistics (nevents, ntracks, ntempi), pick track names, and + allocate the maps. To be called in the first pass of reading. + LATER consider optional reading of nonchannel events. */ +/* FIXME complaining */ +static int mifiread_analyse(t_mifiread *mr, int complain) +{ + t_mifievent *ep = &mr->mr_event; + int i, evtype, isnewtrack = 0; + char tnamebuf[MAXPDSTRING]; + t_symbol **tnamep = 0; + + mr->mr_pass = 1; + *tnamebuf = '\0'; + mr->mr_ntracks = 0; + mr->mr_nevents = 0; + mr->mr_ntempi = 0; + while ((evtype = mifiread_nextevent(mr)) >= MIFIREAD_SKIP) + { + if (evtype == MIFIREAD_SKIP) + continue; + if (mr->mr_newtrack) + { +#ifdef MIFI_DEBUG + loudbug_post("track %d", mr->mr_ntracks); +#endif + isnewtrack = 1; + *tnamebuf = '\0'; + tnamep = 0; /* set to nonzero for nonempty tracks only */ + } + if (MIFI_ISCHANNEL(evtype)) + { + if (isnewtrack) + { + isnewtrack = 0; + tnamep = mr->mr_tracknames + mr->mr_ntracks; + mr->mr_ntracks++; + if (mr->mr_ntracks > mr->mr_hdtracks) + { + if (complain) + mifi_error(mr->mr_owner, + "midi file has more tracks than header-declared %d", mr->mr_hdtracks); + /* FIXME grow? */ + goto anafail; + } + if (*tnamebuf) + { + *tnamep = gensym(tnamebuf); +#ifdef MIFI_DEBUG + loudbug_post("nonempty track name %s", (*tnamep)->s_name); +#endif + } + else *tnamep = &s_; + } + mr->mr_nevents++; + } + /* FIXME sysex */ + else if (evtype < 0x80) + { + mifievent_printmeta(ep); + if (evtype == MIFIMETA_TEMPO) + mr->mr_ntempi++; + else if (evtype == MIFIMETA_TRACKNAME) + { + char *p1 = ep->e_data; + if (*p1 && + !*tnamebuf) /* take the first one */ + { + while (*p1 == ' ') p1++; + if (*p1) + { + char *p2 = ep->e_data + ep->e_length - 1; + while (p2 > p1 && *p2 == ' ') *p2-- = '\0'; + p2 = p1; + do if (*p2 == ' ' || *p2 == ',' || *p2 == ';') + *p2 = '-'; + while (*++p2); + if (tnamep) + { + if (*tnamep == &s_) + /* trackname after channel-event */ + *tnamep = gensym(p1); + else + strcpy(tnamebuf, p1); + } + } + } + } + } + } + if (evtype == MIFIREAD_EOF) + { + for (i = 0, tnamep = mr->mr_tracknames; i < mr->mr_ntracks; i++, tnamep++) + { + if (!*tnamep || *tnamep == &s_) + { + sprintf(tnamebuf, "%d-track", i); + *tnamep = gensym(tnamebuf); + } + } +#ifdef MIFI_VERBOSE + post("got %d midi tracks (out of %d)", mr->mr_ntracks, mr->mr_hdtracks); +#endif + return (MIFIREAD_EOF); + } + else return (evtype); +anafail: + return (MIFIREAD_FATAL); +} + +/* to be called in the second pass of reading */ +int mifiread_doit(t_mifiread *mr, t_mifireadhook hook, void *hookdata) +{ + int evtype, ntracks = 0, isnewtrack = 0; + mr->mr_pass = 2; + mr->mr_trackndx = 0; + while ((evtype = mifiread_nextevent(mr)) >= MIFIREAD_SKIP) + { + if (evtype == MIFIREAD_SKIP) + continue; + if (mr->mr_newtrack) + isnewtrack = 1; + if (isnewtrack && MIFI_ISCHANNEL(evtype)) + { + isnewtrack = 0; + mr->mr_trackndx = ntracks++; + if (ntracks > mr->mr_ntracks) + { + loudbug_bug("mifiread_doit: too many tracks"); + goto doitfail; + } + if (!mr->mr_tracknames[mr->mr_trackndx] || + mr->mr_tracknames[mr->mr_trackndx] == &s_) + { + loudbug_bug("mifiread_doit: empty track name"); + mr->mr_tracknames[mr->mr_trackndx] = gensym("bug-track"); + } + } + if (!hook(mr, hookdata, evtype)) + goto doitfail; + } + if (evtype == MIFIREAD_EOF) + { +#ifdef MIFI_DEBUG + if (evtype == MIFIREAD_EOF) + loudbug_post("finished reading %d events from midi file", + mr->mr_nevents); +#endif + return (MIFIREAD_EOF); + } +doitfail: + return (MIFIREAD_FATAL); +} + +/* mifiread_get... calls to be used in the main read routine */ + +int mifiread_getnevents(t_mifiread *mr) +{ + return (mr->mr_nevents); +} + +int mifiread_getntempi(t_mifiread *mr) +{ + return (mr->mr_ntempi); +} + +int mifiread_gethdtracks(t_mifiread *mr) +{ + return (mr->mr_hdtracks); +} + +int mifiread_getformat(t_mifiread *mr) +{ + return (mr->mr_format); +} + +int mifiread_getnframes(t_mifiread *mr) +{ + return (mr->mr_nframes); +} + +int mifiread_getbeatticks(t_mifiread *mr) +{ + return (mr->mr_ticks.rt_beatticks); +} + +double mifiread_getdeftempo(t_mifiread *mr) +{ + return (mr->mr_ticks.rt_deftempo); +} + +/* mifiread_get... calls to be used in a mifireadhook */ + +int mifiread_getbarindex(t_mifiread *mr) +{ + return (mr->mr_scoretime / (int)mr->mr_ticks.rt_hardbar); +} + +double mifiread_getbarspan(t_mifiread *mr) +{ + return (mr->mr_ticks.rt_userbar); +} + +double mifiread_gettick(t_mifiread *mr) +{ + return (mr->mr_ticks.rt_tickscoef * + (mr->mr_scoretime % (int)mr->mr_ticks.rt_hardbar)); +} + +double mifiread_getscoretime(t_mifiread *mr) +{ + return (mr->mr_ticks.rt_tickscoef * mr->mr_scoretime); +} + +double mifiread_gettempo(t_mifiread *mr) +{ + return (mr->mr_ticks.rt_tempo); +} + +double mifiread_getmscoef(t_mifiread *mr) +{ + return (mr->mr_ticks.rt_mscoef); +} + +t_symbol *mifiread_gettrackname(t_mifiread *mr) +{ + if (mr->mr_pass == 2 && + mr->mr_tracknames && + mr->mr_trackndx < mr->mr_ntracks) + return (mr->mr_tracknames[mr->mr_trackndx]); + else + { + loudbug_bug("mifiread_gettrackname"); + return (0); + } +} + +unsigned mifiread_getstatus(t_mifiread *mr) +{ + if (mr->mr_pass != 2) + loudbug_bug("mifiread_getstatus"); + return (mr->mr_event.e_status); +} + +unsigned mifiread_getdata1(t_mifiread *mr) +{ + if (mr->mr_pass != 2) + loudbug_bug("mifiread_getdata1"); + return (mr->mr_event.e_data[0]); +} + +unsigned mifiread_getdata2(t_mifiread *mr) +{ + if (mr->mr_pass != 2) + loudbug_bug("mifiread_getdata2"); + if (mr->mr_event.e_length < 2) + loudbug_bug("mifiread_getdata2"); + return (mr->mr_event.e_data[1]); +} + +unsigned mifiread_getchannel(t_mifiread *mr) +{ + if (mr->mr_pass != 2) + loudbug_bug("mifiread_getchannel"); + return (mr->mr_event.e_channel); +} + +t_pd *mifiread_getowner(t_mifiread *mr) +{ + return (mr->mr_owner); +} + +int mifiread_open(t_mifiread *mr, const char *filename, + const char *dirname, int complain) +{ + return (mifiread_doopen(mr, filename, dirname, complain) && + (mifiread_analyse(mr, complain) == MIFIREAD_EOF) && + mifiread_restart(mr, complain)); +} + +void mifiread_close(t_mifiread *mr) +{ + mr->mr_pass = 0; + if (mr->mr_fp) + { + fclose(mr->mr_fp); + mr->mr_fp = 0; + } + if (mr->mr_tracknames) + freebytes(mr->mr_tracknames, + mr->mr_hdtracks * sizeof(*mr->mr_tracknames)); +} + +void mifiread_free(t_mifiread *mr) +{ + mifiread_close(mr); + if (mr->mr_event.e_data != mr->mr_event.e_dataini) + freebytes(mr->mr_event.e_data, mr->mr_event.e_datasize); + freebytes(mr, sizeof(*mr)); +} + +t_mifiread *mifiread_new(t_pd *owner) +{ + t_mifiread *mr = getbytes(sizeof(*mr)); + mifi_initialize(); + mr->mr_owner = owner; + mifievent_initialize(&mr->mr_event, MIFIEVENT_NALLOC); + mifiread_resetticks(mr); + mifiread_reset(mr); + return (mr); +} + +static void mifiwrite_updateticks(t_mifiwrite *mw) +{ + if (mw->mw_nframes) + { + /* LATER ntsc */ + mw->mw_ticks.wt_tickscoef = + (mw->mw_nframes * mw->mw_ticks.wt_beatticks) / + mw->mw_ticks.wt_deftempo; + mw->mw_ticks.wt_tempo = mw->mw_ticks.wt_deftempo; + mw->mw_ticks.wt_mscoef = + .001 * (mw->mw_nframes * mw->mw_ticks.wt_beatticks); + } + else + { + mw->mw_ticks.wt_tickscoef = + (mw->mw_ticks.wt_beatticks * 4.) / mw->mw_ticks.wt_wholeticks; + mw->mw_ticks.wt_tempo = + ((double)MIFIHARD_DEFTEMPO * mw->mw_ticks.wt_deftempo) / + ((double)mw->mw_tempo); + if (mw->mw_ticks.wt_tempo < MIFI_TICKEPSILON) + { + loudbug_bug("mifiwrite_updateticks"); + mw->mw_ticks.wt_tempo = mw->mw_ticks.wt_deftempo; + } + mw->mw_ticks.wt_mscoef = + (1000. * mw->mw_ticks.wt_beatticks) / mw->mw_tempo; + } +} + +static void mifiwrite_resetticks(t_mifiwrite *mw) +{ + mw->mw_ticks.wt_wholeticks = MIFIUSER_DEFWHOLETICKS; + mw->mw_ticks.wt_deftempo = MIFIUSER_DEFTEMPO; + mw->mw_ticks.wt_beatticks = MIFIHARD_DEFBEATTICKS; +} + +static void mifiwrite_reset(t_mifiwrite *mw) +{ + mw->mw_trackndx = 0; + mw->mw_trackdirty = 0; + mw->mw_fp = 0; + mw->mw_format = 1; /* LATER settable parameter */ + mw->mw_nframes = 0; + mw->mw_meternum = 4; + mw->mw_meterden = 4; + mw->mw_status = 0; + mw->mw_channel = 0; + mw->mw_trackbytes = 0; + mifiwrite_updateticks(mw); +} + +void mifiwrite_sethardticks(t_mifiwrite *mw, int beatticks) +{ + mw->mw_ticks.wt_beatticks = + (beatticks > 0 && beatticks < MIFI_MAXBEATTICKS ? + beatticks : MIFIHARD_DEFBEATTICKS); + mifiwrite_updateticks(mw); +} + +void mifiwrite_setuserticks(t_mifiwrite *mw, double wholeticks) +{ + mw->mw_ticks.wt_wholeticks = (wholeticks > MIFI_TICKEPSILON ? + wholeticks : MIFIUSER_DEFWHOLETICKS); + mw->mw_ticks.wt_deftempo = mw->mw_ticks.wt_wholeticks * + (MIFIUSER_DEFTEMPO / MIFIUSER_DEFWHOLETICKS); + mifiwrite_updateticks(mw); +} + +void mifiwrite_setusertempo(t_mifiwrite *mw, double tickspersec) +{ + mw->mw_tempo = (tickspersec > MIFI_TICKEPSILON ? + ((double)MIFIHARD_DEFTEMPO * mw->mw_ticks.wt_deftempo) / + tickspersec : MIFIHARD_DEFTEMPO); + mifiwrite_updateticks(mw); +} + +/* LATER analyse shrinking effect caused by truncation */ +static int mifiwrite_putnextevent(t_mifiwrite *mw, t_mifievent *ep) +{ + uchar buf[3], *ptr = buf; + size_t size = mifiwrite_putvarlen(mw, ep->e_delay); + if (!size) + return (0); + mw->mw_trackbytes += size; + if (MIFI_ISCHANNEL(ep->e_status)) + { + if ((*ptr = ep->e_status | ep->e_channel) == mw->mw_status) + size = 1; + else + { + mw->mw_status = *ptr++; + size = 2; + } + *ptr++ = ep->e_data[0]; + if (!MIFI_ONEDATABYTE(ep->e_status)) + { + *ptr = ep->e_data[1]; + size++; + } + ptr = buf; + } + else if (ep->e_status == MIFIEVENT_META) + { + mw->mw_status = 0; /* sysex and meta cancel any running status */ + buf[0] = ep->e_status; + buf[1] = ep->e_meta; + if (fwrite(buf, 1, 2, mw->mw_fp) != 2) + return (0); + mw->mw_trackbytes += 2; + size = mifiwrite_putvarlen(mw, ep->e_length); + if (!size) + return (0); + mw->mw_trackbytes += size; + size = ep->e_length; + ptr = ep->e_data; + } + else return (0); + if (size) + { + if (fwrite(ptr, 1, size, mw->mw_fp) != size) + return (0); + mw->mw_trackbytes += size; + } + return (1); +} + +/* open a midi file for saving, write the header */ +int mifiwrite_open(t_mifiwrite *mw, const char *filename, + const char *dirname, int ntracks, int complain) +{ + char errmess[MAXPDSTRING], fnamebuf[MAXPDSTRING]; + if (ntracks < 1 || ntracks > MIFI_MAXTRACKS) + { + loudbug_bug("mifiwrite_open 1"); + complain = 0; + goto wopenfailed; + } + mw->mw_ntracks = ntracks; + mifiwrite_reset(mw); + if (mw->mw_format == 0) + { + if (mw->mw_ntracks != 1) + { /* LATER consider replacing with a warning */ + loudbug_bug("mifiwrite_open 2"); + complain = 0; + goto wopenfailed; + } +#ifdef MIFI_VERBOSE + post("writing single-track midi file \"%s\"", filename); +#endif + } +#ifdef MIFI_VERBOSE + else post("writing midi file \"%s\" (%d tracks)", filename, mw->mw_ntracks); +#endif + strncpy(mw->mw_header.h_type, "MThd", 4); + mw->mw_header.h_length = mifi_swap4(MIFIHARD_HEADERDATASIZE); + mw->mw_header.h_format = mifi_swap2(mw->mw_format); + mw->mw_header.h_ntracks = mifi_swap2(mw->mw_ntracks); + if (mw->mw_nframes) + mw->mw_header.h_division = + ((mw->mw_nframes << 8) | mw->mw_ticks.wt_beatticks) | 0x8000; + else + mw->mw_header.h_division = mw->mw_ticks.wt_beatticks & 0x7fff; + mw->mw_header.h_division = mifi_swap2(mw->mw_header.h_division); + fnamebuf[0] = 0; + if (*dirname) + strcat(fnamebuf, dirname), strcat(fnamebuf, "/"); + strcat(fnamebuf, filename); + sys_bashfilename(fnamebuf, fnamebuf); + if (!(mw->mw_fp = fopen(fnamebuf, "wb"))) + { + strcpy(errmess, "cannot open"); + goto wopenfailed; + } + if (fwrite(&mw->mw_header, 1, + MIFIHARD_HEADERSIZE, mw->mw_fp) < MIFIHARD_HEADERSIZE) + { + strcpy(errmess, "cannot write header of"); + goto wopenfailed; + } + return (1); +wopenfailed: + if (complain) + mifi_error(mw->mw_owner, "%s file \"%s\" (errno %d: %s)", + errmess, filename, errno, strerror(errno)); + if (mw->mw_fp) + { + fclose(mw->mw_fp); + mw->mw_fp = 0; + } + return (0); +} + +/* append eot meta and update length field in a track header */ +static int mifiwrite_adjusttrack(t_mifiwrite *mw, uint32 eotdelay, int complain) +{ + t_mifievent *ep = &mw->mw_event; + long skip; + uint32 length; + mw->mw_trackdirty = 0; + ep->e_delay = eotdelay; + ep->e_status = MIFIEVENT_META; + ep->e_meta = MIFIMETA_EOT; + ep->e_length = 0; + if (!mifiwrite_putnextevent(mw, ep)) + return (0); + skip = mw->mw_trackbytes + 4; + length = mifi_swap4(mw->mw_trackbytes); +#ifdef MIFI_DEBUG + loudbug_post("adjusting track size to %d", mw->mw_trackbytes); +#endif + /* LATER add sanity check (compare to saved filepos) */ + if (skip > 4 && + fseek(mw->mw_fp, -skip, SEEK_CUR) < 0 || + fwrite(&length, 1, 4, mw->mw_fp) != 4 || + fseek(mw->mw_fp, 0, SEEK_END) < 0) + { + if (complain) + mifi_error(mw->mw_owner, + "unable to adjust length field to %d in a midi file\ + track header (errno %d: %s)", mw->mw_trackbytes, errno, strerror(errno)); + return (0); + } + return (1); +} + +int mifiwrite_opentrack(t_mifiwrite *mw, char *trackname, int complain) +{ + t_mifitrackheader th; + if (mw->mw_trackdirty && !mifiwrite_adjusttrack(mw, 0, complain)) + return (0); + if (mw->mw_trackndx > mw->mw_ntracks) + return (0); + else if (mw->mw_trackndx++ == mw->mw_ntracks) + { + loudbug_bug("mifiwrite_opentrack"); + return (0); + } + strncpy(th.th_type, "MTrk", 4); + th.th_length = 0; + mw->mw_status = mw->mw_channel = 0; + mw->mw_trackbytes = 0; + if (fwrite(&th, 1, MIFIHARD_TRACKHEADERSIZE, + mw->mw_fp) != MIFIHARD_TRACKHEADERSIZE) + { + if (complain) + mifi_error(mw->mw_owner, + "unable to write midi file header (errno %d: %s)", + errno, strerror(errno)); + return (0); + } + if (trackname) + { + if (!mifiwrite_textevent(mw, 0., MIFIMETA_TRACKNAME, trackname)) + { + if (complain) + mifi_error(mw->mw_owner, + "unable to write midi file track name \"%s\" (errno %d: %s)", + trackname, errno, strerror(errno)); + return (0); + } + } + mw->mw_trackdirty = 1; + return (1); +} + +/* calling this is optional (if skipped, enddelay defaults to 0.) */ +int mifiwrite_closetrack(t_mifiwrite *mw, double enddelay, int complain) +{ + if (mw->mw_trackdirty) + { + uint32 eotdelay = (uint32)(enddelay * mw->mw_ticks.wt_mscoef); + return (mifiwrite_adjusttrack(mw, eotdelay, complain)); + } + else + { + loudbug_bug("mifiwrite_closetrack"); + return (0); + } +} + +int mifiwrite_textevent(t_mifiwrite *mw, double delay, + unsigned type, char *text) +{ + t_mifievent *ep = &mw->mw_event; + if (!mifievent_settext(ep, type, text)) + return (0); + ep->e_delay = (uint32)(delay * mw->mw_ticks.wt_mscoef); + return (mifiwrite_putnextevent(mw, ep)); +} + +int mifiwrite_channelevent(t_mifiwrite *mw, double delay, unsigned status, + unsigned channel, unsigned data1, unsigned data2) +{ + t_mifievent *ep = &mw->mw_event; + int shorter = MIFI_ONEDATABYTE(status); + if (!MIFI_ISCHANNEL(status) || channel > 15 || data1 > 127 + || (!shorter && data2 > 127)) + { + loudbug_bug("mifiwrite_channelevent"); + return (0); + } + ep->e_delay = (uint32)(delay * mw->mw_ticks.wt_mscoef); + ep->e_status = (uchar)(status & 0xf0); + ep->e_channel = (uchar)channel; + ep->e_data[0] = (uchar)data1; + if (shorter) + ep->e_length = 1; + else + { + ep->e_data[1] = (uchar)data2; + ep->e_length = 2; + } + return (mifiwrite_putnextevent(mw, ep)); +} + +void mifiwrite_close(t_mifiwrite *mw) +{ + if (mw->mw_trackdirty) + mifiwrite_adjusttrack(mw, 0, 0); + if (mw->mw_fp) + { + fclose(mw->mw_fp); + mw->mw_fp = 0; + } +} + +void mifiwrite_free(t_mifiwrite *mw) +{ + mifiwrite_close(mw); + if (mw->mw_event.e_data != mw->mw_event.e_dataini) + freebytes(mw->mw_event.e_data, mw->mw_event.e_datasize); + freebytes(mw, sizeof(*mw)); +} + +t_mifiwrite *mifiwrite_new(t_pd *owner) +{ + t_mifiwrite *mw = getbytes(sizeof(*mw)); + mifi_initialize(); + mw->mw_owner = owner; + mw->mw_ntracks = 0; + mw->mw_tempo = MIFIHARD_DEFTEMPO; + mifievent_initialize(&mw->mw_event, MIFIEVENT_NALLOC); + mifiwrite_resetticks(mw); + mifiwrite_reset(mw); + return (mw); +} diff --git a/externals/miXed/shared/common/mifi.h b/externals/miXed/shared/common/mifi.h new file mode 100644 index 000000000..e7948c71e --- /dev/null +++ b/externals/miXed/shared/common/mifi.h @@ -0,0 +1,110 @@ +/* Copyright (c) 2004-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __MIFI_H__ +#define __MIFI_H__ + +EXTERN_STRUCT _mifiread; +#define t_mifiread struct _mifiread +EXTERN_STRUCT _mifiwrite; +#define t_mifiwrite struct _mifiwrite + +typedef int (*t_mifireadhook)(t_mifiread *mf, void *hookdata, int evtype); + +#define MIFI_MAXTRACKS 0x7fff +#define MIFI_MAXBEATTICKS 0x7fff + +/* event types, as returned by mifiread_nextevent(), ... */ + +#define MIFIREAD_FATAL -3 /* unexpected eof, last track's or file error */ +#define MIFIREAD_EOF -2 /* regular eof */ +#define MIFIREAD_SKIP -1 /* error and successful skip to the next track */ + +#define MIFIMETA_SEQNUM 0 +#define MIFIMETA_TEXT 1 +#define MIFIMETA_COPYRIGHT 2 +#define MIFIMETA_TRACKNAME 3 +#define MIFIMETA_INSTRUMENT 4 +#define MIFIMETA_LYRIC 5 +#define MIFIMETA_MARKER 6 +#define MIFIMETA_CUE 7 +#define MIFIMETA_MAXPRINTABLE 15 /* 1..15 are various text meta-events */ +#define MIFIMETA_CHANNEL 0x20 /* channel prefix (obsolete) */ +#define MIFIMETA_PORT 0x21 /* port prefix (obsolete) */ +#define MIFIMETA_EOT 0x2f /* end of track */ +#define MIFIMETA_TEMPO 0x51 +#define MIFIMETA_SMPTE 0x54 /* SMPTE offset */ +#define MIFIMETA_TIMESIG 0x58 /* time signature */ +#define MIFIMETA_KEYSIG 0x59 /* key signature */ +#define MIFIMETA_PROPRIETARY 0x7f + +/* ...channel status codes go here, too obvious to #define... */ + +#define MIFISYSEX_FIRST 0xf0 +#define MIFISYSEX_NEXT 0xf7 +#define MIFISYSEX_ESCAPE 0xf7 /* without preceding MIFISYSEX_FIRST */ + +/* this code is not returned as an event type, but in e_status of t_mifievent */ +#define MIFIEVENT_META 0xff + +/* system messages (expected inside of sysex escape events) */ +#define MIFISYS_SONGPOINTER 0xf2 +#define MIFISYS_SONGSELECT 0xf3 +#define MIFISYS_TUNEREQUEST 0xf6 +#define MIFISYS_CLOCK 0xf8 +#define MIFISYS_START 0xfa +#define MIFISYS_CONTINUE 0xfb +#define MIFISYS_STOP 0xfc +#define MIFISYS_ACTIVESENSING 0xfe + +/* true if one of channel messages */ +#define MIFI_ISCHANNEL(status) (((status) & 0x80) && (status) < 0xf0) +/* true if one of the two shorter channel messages */ +#define MIFI_ONEDATABYTE(status) (((status) & 0xe0) == 0xc0) + +int mifiread_getnevents(t_mifiread *mr); +int mifiread_getntempi(t_mifiread *mr); +int mifiread_gethdtracks(t_mifiread *mr); +int mifiread_getformat(t_mifiread *mr); +int mifiread_getnframes(t_mifiread *mr); +int mifiread_getbeatticks(t_mifiread *mr); +double mifiread_getdeftempo(t_mifiread *mr); + +int mifiread_getbarindex(t_mifiread *mr); +double mifiread_getbarspan(t_mifiread *mr); +double mifiread_gettick(t_mifiread *mr); +double mifiread_getscoretime(t_mifiread *mr); +double mifiread_gettempo(t_mifiread *mr); +double mifiread_getmscoef(t_mifiread *mr); +t_symbol *mifiread_gettrackname(t_mifiread *mr); +unsigned mifiread_getstatus(t_mifiread *mr); +unsigned mifiread_getdata1(t_mifiread *mr); +unsigned mifiread_getdata2(t_mifiread *mr); +unsigned mifiread_getchannel(t_mifiread *mr); +t_pd *mifiread_getowner(t_mifiread *mr); + +t_mifiread *mifiread_new(t_pd *owner); +void mifiread_setuserticks(t_mifiread *mr, double wholeticks); +int mifiread_open(t_mifiread *mr, const char *filename, + const char *dirname, int complain); +int mifiread_doit(t_mifiread *mr, t_mifireadhook hook, void *hookdata); +void mifiread_close(t_mifiread *mr); +void mifiread_free(t_mifiread *mr); + +t_mifiwrite *mifiwrite_new(t_pd *owner); +void mifiwrite_sethardticks(t_mifiwrite *mw, int beatticks); +void mifiwrite_setuserticks(t_mifiwrite *mw, double wholeticks); +void mifiwrite_setusertempo(t_mifiwrite *mw, double tickspersec); +int mifiwrite_open(t_mifiwrite *mw, const char *filename, + const char *dirname, int ntracks, int complain); +int mifiwrite_opentrack(t_mifiwrite *mw, char *trackname, int complain); +int mifiwrite_textevent(t_mifiwrite *mw, double delay, + unsigned type, char *text); +int mifiwrite_channelevent(t_mifiwrite *mw, double delay, unsigned status, + unsigned channel, unsigned data1, unsigned data2); +int mifiwrite_closetrack(t_mifiwrite *mw, double enddelay, int complain); +void mifiwrite_close(t_mifiwrite *mw); +void mifiwrite_free(t_mifiwrite *mw); + +#endif diff --git a/externals/miXed/shared/common/os.c b/externals/miXed/shared/common/os.c new file mode 100644 index 000000000..408fdfbaa --- /dev/null +++ b/externals/miXed/shared/common/os.c @@ -0,0 +1,334 @@ +/* Copyright (c) 2004-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifdef MSW +#include <io.h> +#else +#include <unistd.h> +#include <dirent.h> +#endif +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "os.h" + +static int ospath_doabsolute(char *path, char *cwd, char *result) +{ + if (*path == 0) + { + if (result) + strcpy(result, cwd); + else + return (strlen(cwd)); + } + else if (*path == '~') + { + path++; + if (*path == '/' || *path == 0) + { +#ifdef UNIX + char *home = getenv("HOME"); + if (home) + { + if (result) + { + strcpy(result, home); + if (*path) + strcat(result, path); + } + else return (strlen(home) + strlen(path)); + } + else goto badpath; +#else + goto badpath; +#endif + } + else goto badpath; + } + else if (*path == '/') + { +#ifdef MSW + /* path is absolute, drive is implicit, LATER UNC? */ + if (*cwd && cwd[1] == ':') + { + if (result) + { + *result = *cwd; + result[1] = ':'; + strcpy(result + 2, path); + } + else return (2 + strlen(path)); + } + else goto badpath; +#else + /* path is absolute */ + if (result) + strcpy(result, path); + else + return (strlen(path)); +#endif + } + else + { +#ifdef MSW + if (path[1] == ':') + { + if (path[2] == '/') + { + /* path is absolute */ + if (result) + strcpy(result, path); + else + return (strlen(path)); + } + else if (*cwd == *path) + { + /* path is relative, drive is explicitly current */ + if (result) + { + int ndx = strlen(cwd); + strcpy(result, cwd); + result[ndx++] = '/'; + strcpy(result + ndx, path + 2); + } + else return (strlen(cwd) + strlen(path) - 1); + } + /* we do not maintain per-drive cwd, LATER rethink */ + else goto badpath; + } + /* LATER devices? */ + else + { + /* path is relative */ + if (result) + { + int ndx = strlen(cwd); + strcpy(result, cwd); + result[ndx++] = '/'; + strcpy(result + ndx, path); + } + else return (strlen(cwd) + 1 + strlen(path)); + } +#else + /* path is relative */ + if (result) + { + int ndx = strlen(cwd); + strcpy(result, cwd); + result[ndx++] = '/'; + strcpy(result + ndx, path); + } + else return (strlen(cwd) + 1 + strlen(path)); +#endif + } + if (result && *result && *result != '.') + { + /* clean-up */ + char *inptr, *outptr = result; + int ndx = strlen(result); + if (result[ndx - 1] == '.') + { + result[ndx] = '/'; /* guarding slash */ + result[ndx + 1] = 0; + } + for (inptr = result + 1; *inptr; inptr++) + { + if (*inptr == '/') + { + if (*outptr == '/') + continue; + else if (*outptr == '.') + { + if (outptr[-1] == '/') + { + outptr--; + continue; + } + else if (outptr[-1] == '.' && outptr[-2] == '/') + { + outptr -= 2; + if (outptr == result) + continue; + else for (outptr--; outptr != result; outptr--) + if (*outptr == '/') + break; + continue; + } + } + } + *++outptr = *inptr; + } + if (*outptr == '/' && outptr != result) + *outptr = 0; + else + outptr[1] = 0; + } + else bug("ospath_doabsolute 1"); + return (0); +badpath: + if (result) + bug("ospath_doabsolute 2"); + return (0); +} + +/* Returns an estimated length of an absolute path made up from the first arg. + The actual ospath_absolute()'s length may be shorter (since it erases + superfluous slashes and dots), but not longer. Both args should be unbashed + (system-independent), cwd should be absolute. Returns 0 in case of any + error (LATER revisit). */ +int ospath_length(char *path, char *cwd) +{ + /* one extra byte used internally (guarding slash) */ + return (ospath_doabsolute(path, cwd, 0) + 1); +} + +/* Copies an absolute path to result. Arguments: path and cwd, are the same + as in ospath_length(). Caller should first consult ospath_length(), and + allocate at least ospath_length() + 1 bytes to the result buffer. + Should never fail (failure is a bug). */ +char *ospath_absolute(char *path, char *cwd, char *result) +{ + ospath_doabsolute(path, cwd, result); + return (result); +} + +FILE *fileread_open(char *filename, t_canvas *cv, int textmode) +{ + int fd; + char path[MAXPDSTRING+2], *nameptr; + t_symbol *dirsym = (cv ? canvas_getdir(cv) : 0); + /* path arg is returned unbashed (system-independent) */ + if ((fd = open_via_path((dirsym ? dirsym->s_name : ""), filename, + "", path, &nameptr, MAXPDSTRING, 1)) < 0) + return (0); + /* Closing/reopening dance. This is unnecessary under linux, and we + could have tried to convert fd to fp, but under windows open_via_path() + returns what seems to be an invalid fd. + LATER try to understand what is going on here... */ + close(fd); + if (path != nameptr) + { + char *slashpos = path + strlen(path); + *slashpos++ = '/'; + /* try not to be dependent on current open_via_path() implementation */ + if (nameptr != slashpos) + strcpy(slashpos, nameptr); + } + sys_bashfilename(path, path); + return (fopen(path, (textmode ? "r" : "rb"))); +} + +FILE *filewrite_open(char *filename, t_canvas *cv, int textmode) +{ + char path[MAXPDSTRING+2]; + if (cv) + /* path arg is returned unbashed (system-independent) */ + canvas_makefilename(cv, filename, path, MAXPDSTRING); + else + { + strncpy(path, filename, MAXPDSTRING); + path[MAXPDSTRING-1] = 0; + } + sys_bashfilename(path, path); + return (fopen(path, (textmode ? "w" : "wb"))); +} + +/* FIXME add MSW */ + +struct _osdir +{ +#ifndef MSW + DIR *dir_handle; + struct dirent *dir_entry; +#endif + int dir_flags; +}; + +/* returns 0 on error, a caller is then expected to call + loud_syserror(owner, "cannot open \"%s\"", dirname) */ +t_osdir *osdir_open(char *dirname) +{ +#ifndef MSW + DIR *handle = opendir(dirname); + if (handle) + { +#endif + t_osdir *dp = getbytes(sizeof(*dp)); +#ifndef MSW + dp->dir_handle = handle; + dp->dir_entry = 0; +#endif + dp->dir_flags = 0; + return (dp); +#ifndef MSW + } + else return (0); +#endif +} + +void osdir_setmode(t_osdir *dp, int flags) +{ + if (dp) + dp->dir_flags = flags; +} + +void osdir_close(t_osdir *dp) +{ + if (dp) + { +#ifndef MSW + closedir(dp->dir_handle); +#endif + freebytes(dp, sizeof(*dp)); + } +} + +void osdir_rewind(t_osdir *dp) +{ + if (dp) + { +#ifndef MSW + rewinddir(dp->dir_handle); + dp->dir_entry = 0; +#endif + } +} + +char *osdir_next(t_osdir *dp) +{ +#ifndef MSW + if (dp) + { + while (dp->dir_entry = readdir(dp->dir_handle)) + { + if (!dp->dir_flags || + (dp->dir_entry->d_type == DT_REG + && (dp->dir_flags & OSDIR_FILEMODE)) || + (dp->dir_entry->d_type == DT_DIR + && (dp->dir_flags & OSDIR_DIRMODE))) + return (dp->dir_entry->d_name); + } + } +#endif + return (0); +} + +int osdir_isfile(t_osdir *dp) +{ +#ifndef MSW + return (dp && dp->dir_entry && dp->dir_entry->d_type == DT_REG); +#else + return (0); +#endif +} + +int osdir_isdir(t_osdir *dp) +{ +#ifndef MSW + return (dp && dp->dir_entry && dp->dir_entry->d_type == DT_DIR); +#else + return (0); +#endif +} diff --git a/externals/miXed/shared/common/os.h b/externals/miXed/shared/common/os.h new file mode 100644 index 000000000..7bf3c9a4a --- /dev/null +++ b/externals/miXed/shared/common/os.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2004-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __OS_H__ +#define __OS_H__ + +EXTERN_STRUCT _osdir; +#define t_osdir struct _osdir + +#define OSDIR_FILEMODE 1 +#define OSDIR_DIRMODE 2 + +int ospath_length(char *path, char *cwd); +char *ospath_absolute(char *path, char *cwd, char *result); + +FILE *fileread_open(char *filename, t_canvas *cv, int textmode); +FILE *filewrite_open(char *filename, t_canvas *cv, int textmode); + +t_osdir *osdir_open(char *dirname); +void osdir_setmode(t_osdir *dp, int flags); +void osdir_close(t_osdir *dp); +void osdir_rewind(t_osdir *dp); +char *osdir_next(t_osdir *dp); +int osdir_isfile(t_osdir *dp); +int osdir_isdir(t_osdir *dp); + +#endif diff --git a/externals/miXed/shared/common/patchvalue.c b/externals/miXed/shared/common/patchvalue.c new file mode 100644 index 000000000..b75b565b6 --- /dev/null +++ b/externals/miXed/shared/common/patchvalue.c @@ -0,0 +1,265 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "patchvalue.h" + +#ifdef KRZYSZCZ +# include "loud.h" +# define PATCHVALUE_DEBUG +#else +# define loudbug_bug(msg) fprintf(stderr, "BUG: %s\n", msg), bug(msg) +#endif + +typedef struct _patchstorage +{ + t_glist *ps_glist; + t_patchvalue *ps_values; + struct _patchstorage *ps_next; +} t_patchstorage; + +typedef struct _patchboard +{ + t_pd pb_pd; + t_symbol *pb_category; + t_patchstorage *pb_contents; +} t_patchboard; + +static t_class *patchboard_class = 0; + +/* assuming there is no 'name' in the storage */ +static t_patchvalue *patchstorage_addvalue( + t_patchstorage *ps, t_patchvalue *prv, t_class *cls, t_symbol *name) +{ + t_patchvalue *pv = (t_patchvalue *)pd_new(cls); + pv->pv_name = name; + pv->pv_refcount = 0; + if (prv) + { + pv->pv_next = prv->pv_next; + prv->pv_next = pv; + } + else + { + pv->pv_next = ps->ps_values; + ps->ps_values = pv; + } + return (pv); +} + +/* assuming there is no 'glist' on the board */ +static t_patchstorage *patchboard_addstorage( + t_patchboard *pb, t_patchstorage *prv, t_glist *glist) +{ + t_patchstorage *ps = getbytes(sizeof(*ps)); + ps->ps_glist = glist; + ps->ps_values = 0; + if (prv) + { + ps->ps_next = prv->ps_next; + prv->ps_next = ps; + } + else + { + ps->ps_next = pb->pb_contents; + pb->pb_contents = ps; + } + return (ps); +} + +/* not used (LATER find a gc scheme) */ +static void patchstorage_removevalue( + t_patchstorage *ps, t_patchvalue *prv, t_patchvalue *pv, int force) +{ + if (force || pv->pv_refcount < 1) + { + if (prv) + prv->pv_next = pv->pv_next; + else + ps->ps_values = pv->pv_next; + pd_free((t_pd *)pv); + } +} + +/* not used (LATER find a gc scheme) */ +static void patchboard_removestorage( + t_patchboard *pb, t_patchstorage *prv, t_patchstorage *ps, int force) +{ + if (prv) + prv->ps_next = ps->ps_next; + else + pb->pb_contents = ps->ps_next; + if (force) + { + t_patchvalue *pv, *pvnext = ps->ps_values; + while (pv = pvnext) + { + pvnext = pv->pv_next; + pd_free((t_pd *)pv); + } + } + else if (ps->ps_values) + return; + freebytes(ps, sizeof(*ps)); +} + +static t_patchvalue *patchstorage_findvalue( + t_patchstorage *ps, t_symbol *name) +{ + t_patchvalue *pv; + for (pv = ps->ps_values; pv; pv = pv->pv_next) + if (pv->pv_name == name) + break; + return (pv); +} + +static t_patchstorage *patchboard_findstorage( + t_patchboard *pb, t_glist *glist) +{ + t_patchstorage *ps; + for (ps = pb->pb_contents; ps; ps = ps->ps_next) + if (ps->ps_glist == glist) + break; + return (ps); +} + +static t_patchboard *patchboard_find(t_symbol *category) +{ + if (!patchboard_class) + patchboard_class = + patchvalue_classnew(gensym("_patchboard"), sizeof(t_patchboard)); + return ((t_patchboard *)pd_findbyclass(category, patchboard_class)); +} + +static t_patchboard *patchboard_use(t_symbol *category) +{ + if (!patchboard_class) + patchboard_class = + patchvalue_classnew(gensym("_patchboard"), sizeof(t_patchboard)); + if (category && *category->s_name == '#') + { + t_patchboard *pb; + if (!(pb = (t_patchboard *)pd_findbyclass(category, patchboard_class))) + { + pb = (t_patchboard *)pd_new(patchboard_class); + pb->pb_category = category; + pd_bind((t_pd *)pb, category); /* never unbound */ + pb->pb_contents = 0; + } + return (pb); + } + else + { + loudbug_bug("patchboard_use"); + return (0); + } +} + +static t_patchstorage *patchstorage_use(t_symbol *category, t_glist *glist) +{ + t_patchboard *pb; + if (pb = patchboard_use(category)) + { + t_patchstorage *ps; + if (!(ps = patchboard_findstorage(pb, glist))) + ps = patchboard_addstorage(pb, 0, glist); + return (ps); + } + else return (0); +} + +/* The class might have been created by another dll... + This is public, because apart from the "_patchboard" class above, + it is called for the "_raftentry" class too. LATER rethink. */ +t_class *patchvalue_classnew(t_symbol *cname, size_t size) +{ + t_class *cls; + t_symbol *bindsym; + char buf[MAXPDSTRING]; + sprintf(buf, "#%s", cname->s_name); + bindsym = gensym(buf); + if (bindsym->s_thing) + { + t_pd *pd = bindsym->s_thing; + char *name = class_getname(*pd); + if (strcmp(name, cname->s_name)) + { + /* FIXME handle this properly... */ + loudbug_bug("patchvalue_classnew"); + } + else return (*pd); + } + cls = class_new(cname, 0, 0, size, CLASS_PD | CLASS_NOINLET, 0); + pd_bind(pd_new(cls), bindsym); /* never unbound */ + return (cls); +} + +t_patchvalue *patchvalue_use(t_symbol *category, t_glist *glist, + t_class *cls, t_symbol *name) +{ + t_patchstorage *ps; + if (ps = patchstorage_use(category, glist)) + { + t_patchvalue *pv; + if (pv = patchstorage_findvalue(ps, name)) + { + if (*(t_pd *)pv != cls) + { + loudbug_bug("patchvalue_use"); + return (0); + } + } + else pv = patchstorage_addvalue(ps, 0, cls, name); + return (pv); + } + else return (0); +} + +t_patchvalue *patchvalue_get(t_symbol *category, t_glist *glist, + t_class *cls, t_symbol *name) +{ + t_patchboard *pb; + t_patchstorage *ps; + t_patchvalue *pv; + if ((pb = patchboard_find(category)) && + (ps = patchboard_findstorage(pb, glist)) && + (pv = patchstorage_findvalue(ps, name))) + { + if (*(t_pd *)pv == cls) + return (pv); + else + loudbug_bug("patchvalue_get"); + } + return (0); +} + +t_patchvalue *patchvalue_resolve(t_symbol *category, t_glist *glist, + t_class *cls, t_symbol *name) +{ + t_patchboard *pb; + if (pb = patchboard_find(category)) + { + t_patchstorage *ps; + t_patchvalue *pv; + while (glist) + { + if ((ps = patchboard_findstorage(pb, glist)) && + (pv = patchstorage_findvalue(ps, name))) + { + if (*(t_pd *)pv == cls) + return (pv); + else + loudbug_bug("patchvalue_resolve"); + } + else if (canvas_isabstraction(glist)) + break; + else + glist = glist->gl_owner; + } + } + return (0); +} diff --git a/externals/miXed/shared/common/patchvalue.h b/externals/miXed/shared/common/patchvalue.h new file mode 100644 index 000000000..1a7bc7960 --- /dev/null +++ b/externals/miXed/shared/common/patchvalue.h @@ -0,0 +1,24 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __PATCHVALUE_H__ +#define __PATCHVALUE_H__ + +typedef struct _patchvalue +{ + t_pd pv_pd; + t_symbol *pv_name; + int pv_refcount; + struct _patchvalue *pv_next; +} t_patchvalue; + +t_class *patchvalue_classnew(t_symbol *cname, size_t size); +t_patchvalue *patchvalue_use(t_symbol *category, t_glist *glist, + t_class *cls, t_symbol *name); +t_patchvalue *patchvalue_get(t_symbol *category, t_glist *glist, + t_class *cls, t_symbol *name); +t_patchvalue *patchvalue_resolve(t_symbol *category, t_glist *glist, + t_class *cls, t_symbol *name); + +#endif diff --git a/externals/miXed/shared/common/port.c b/externals/miXed/shared/common/port.c new file mode 100644 index 000000000..fe58b6ed2 --- /dev/null +++ b/externals/miXed/shared/common/port.c @@ -0,0 +1,1671 @@ +/* Copyright (c) 1997-2005 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER think about abstractions */ +/* LATER sort out escaping rules (also revisit binport.c) */ +/* LATER quoting */ +/* LATER rethink inlet/inlet~ case */ + +#ifdef UNIX +#include <unistd.h> +#endif +#ifdef NT +#include <io.h> +#endif +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "unstable/forky.h" +#include "unstable/fragile.h" +#include "unstable/fringe.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/binport.h" +#include "port.h" + +#ifdef KRZYSZCZ +//#define PORT_DEBUG +#endif +#define PORT_LOG +#define PORT_DUMP /* fill separate files with ignored data, e.g. pictures */ + +#define PORT_INISTACK 256 /* LATER rethink */ +#define PORT_INISIZE 512 /* LATER rethink */ + +/* FIXME use messtree api */ + +enum { PORT_OK, /* MESSTREE_CONTINUE */ + PORT_NEXT, /* next line, please: MESSTREE_OK */ + PORT_UNKNOWN, PORT_CORRUPT, PORT_FATAL }; + +/* cf binport.c */ +#define A_INT A_DEFFLOAT + +/* without access to sys_defaultfont, we just mimic defs from s_main.c */ +#ifdef MSW +#define PORT_DEFFONTSIZE 12. +#else +#define PORT_DEFFONTSIZE 10. +#endif + +#define PORT_XSTRETCH 1.25 +#define PORT_YSTRETCH 1.1 +#define PORT_WSTRETCH 1.25 + +typedef struct _port +{ + t_binbuf *x_outbb; + int x_messcount; + int x_illmess; + int x_lastunexpected; + int x_lastbroken; + int x_lastinconsistent; + int x_nobj; + int x_withbogus; + int x_inatoms; + t_atom *x_inmess; + int x_outsize; + int x_outatoms; + t_atom *x_outmess; + t_atom x_outini[PORT_INISIZE]; + int x_stacksize; + int x_stackdepth; + int *x_stack; + int x_stackini[PORT_INISTACK]; + t_symbol *x_emstate; + t_binbuf *x_embb; + t_symbol *x_emname; + int x_emsize; + int x_emcount; + int x_dumping; + /* class-specifics, LATER find a better way */ + FILE *x_pictfp; + int x_pictno; +} t_port; + +static t_symbol *portps_bogus; +static t_symbol *portps_cleanup; +static t_symbol *portps_inlet; +static t_symbol *portps_outlet; +static t_symbol *portps_vtable; +static t_symbol *portps_coll; +static t_symbol *portps_funbuff; +static t_symbol *portps_prob; +static t_symbol *portps_picture; + +static char *import_defmapping[] = +{ + /* clashing clones */ + "append", "Append", + "b", "bangbang", + "clip", "Clip", + "clip~", "Clip~", + "line~", "Line~", + "scope~", "Scope~", + "snapshot~", "Snapshot~", + + /* clashing dummies */ + "biquad~", "Biquad~", + "change", "Change", + "key", "Key", + "keyup", "Keyup", + "line", "Line", + "poly", "Poly", + + /* doomed dummies */ + "appledvd", "c74.appledvd", + "plugconfig", "c74.plugconfig", + "plugin~", "c74.plugin~", + "plugmidiin", "c74.plugmidiin", + "plugmidiout", "c74.plugmidiout", + "plugmod", "c74.plugmod", + "plugmorph", "c74.plugmorph", + "plugmultiparam", "c74.plugmultiparam", + "plugout~", "c74.plugout~", + "plugphasor~", "c74.plugphasor~", + "plugreceive~", "c74.plugreceive~", + "plugsend~", "c74.plugsend~", + "plugstore", "c74.plugstore", + "plugsync~", "c74.plugsync~", + "pp", "c74.pp", + "pptempo", "c74.pptempo", + "pptime", "c74.pptime", + "rewire~", "c74.rewire~", + "sndmgrin~", "c74.sndmgrin~", + "vdp", "c74.vdp", + "vst~", "c74.vst~" +}; + +static int import_mapsize = 0; +static char **import_mapping = 0; + +static void import_setdefmapping(void) +{ + import_mapsize = sizeof(import_defmapping)/(2 * sizeof(*import_defmapping)); + import_mapping = import_defmapping; +} + +void import_setmapping(int size, char **mapping) +{ + import_mapsize = size; + import_mapping = mapping; +} + +char **import_getmapping(int *sizep) +{ + if (!import_mapping) import_setdefmapping(); + *sizep = import_mapsize; + return (import_mapping); +} + +char *port_usemapping(char *from, int mapsize, char **mapping) +{ + while (mapsize--) + { + if (strcmp(*mapping, from)) + mapping += 2; + else + return (mapping[1]); + } + return (0); +} + +static t_int port_getint(t_port *x, int ndx) +{ + if (ndx < x->x_inatoms) + { + t_atom *av = &x->x_inmess[ndx]; + if (av->a_type == A_INT) + return (av->a_w.w_index); + else if (av->a_type == A_FLOAT) + { + loud_warning(0, "import", "[%d] float atom %d, int expected", + x->x_messcount, ndx); + return ((t_int)av->a_w.w_float); + } + } + return (0); +} + +static t_float port_getfloat(t_port *x, int ndx) +{ + if (ndx < x->x_inatoms) + { + t_atom *av = &x->x_inmess[ndx]; + return (av->a_type == A_FLOAT ? av->a_w.w_float : 0); + } + else return (0); +} + +static t_symbol *port_getsymbol(t_port *x, int ndx) +{ + if (ndx < x->x_inatoms) + { + t_atom *av = &x->x_inmess[ndx]; + return (av->a_type == A_SYMBOL ? av->a_w.w_symbol : &s_); + } + else return (&s_); +} + +static t_symbol *port_getanysymbol(t_port *x, int ndx) +{ + t_symbol *sel = &s_; + if (ndx < x->x_inatoms) + { + t_atom *av = &x->x_inmess[ndx]; + if (av->a_type == A_SYMBOL) + sel = av->a_w.w_symbol; + else if (av->a_type == A_INT) + sel = gensym("int"); + else if (av->a_type == A_FLOAT) + sel = &s_float; + } + return (sel); +} + +static t_symbol *port_gettarget(t_port *x) +{ + t_symbol *sel = port_getsymbol(x, 0); + if (sel == &s_) loudbug_bug("port_gettarget"); + return (sel); +} + +static t_symbol *port_getselector(t_port *x) +{ + t_symbol *sel = port_getanysymbol(x, 1); + if (sel == &s_) loudbug_bug("port_getselector"); + return (sel); +} + +static int port_xstretch(float f) +{ + return ((int)(f * PORT_XSTRETCH + 0.5)); +} + +static int port_ystretch(float f) +{ + return ((int)(f * PORT_YSTRETCH + 0.5)); +} + +static int port_wstretch(float f) +{ + return ((int)(f * PORT_WSTRETCH + 0.5)); +} + +static t_float port_getx(t_port *x, int ndx) +{ + return ((t_float)port_xstretch(port_getint(x, ndx))); +} + +static t_float port_gety(t_port *x, int ndx) +{ + return ((t_float)port_ystretch(port_getint(x, ndx))); +} + +static t_float port_getwidth(t_port *x, int ndx) +{ + return ((t_float)port_wstretch(port_getint(x, ndx))); +} + +static void port_setxy(t_port *x, int ndx, t_atom *ap) +{ + float f = port_getx(x, ndx); + SETFLOAT(ap, f); + ndx++; ap++; + f = port_gety(x, ndx); + SETFLOAT(ap, f); +} + +static t_atom *import_copyatoms(t_atom *out, t_atom *in, int ac) +{ + while (ac-- > 0) + { + if (in->a_type == A_INT) + { + out->a_type = A_FLOAT; + out++->a_w.w_float = (float)in++->a_w.w_index; + } + else *out++ = *in++; + } + return (out); +} + +static void import_unexpected(t_port *x) +{ + if (x->x_lastunexpected < x->x_messcount) /* ignore redundant calls */ + { + x->x_lastunexpected = x->x_messcount; + loud_warning(0, "import", "[%d] unexpected \"%s %s\"", x->x_messcount, + port_gettarget(x)->s_name, port_getselector(x)->s_name); + } +} + +static void import_illegal(t_port *x) +{ + x->x_illmess++; +} + +static void import_flushillegal(t_port *x) +{ + if (x->x_illmess) + { + if (x->x_illmess == 1) + loud_warning(0, "import", "[%d] illegal line", x->x_messcount); + else + loud_warning(0, "import", "[%d] %d illegal lines", + x->x_messcount, x->x_illmess); + x->x_illmess = 0; + } +} + +static void import_embroken(t_port *x, char *cause) +{ + if (x->x_lastbroken < x->x_messcount) /* ignore redundant calls */ + { + x->x_lastbroken = x->x_messcount; + loud_warning(0, "import", "[%d] %s embedding broken by %s", + x->x_messcount, x->x_emstate->s_name, cause); + } +} + +static int import_emcheck(t_port *x, t_symbol *state) +{ + if (x->x_emstate == state) + return (1); + else if (x->x_emstate) + import_embroken(x, state->s_name); + else + import_unexpected(x); + return (0); +} + +static void import_eminconsistent(t_port *x, t_symbol *state) +{ + if (import_emcheck(x, state) && + x->x_lastinconsistent < x->x_messcount) /* ignore redundant calls */ + { + x->x_lastinconsistent = x->x_messcount; + loud_warning(0, "import", "[%d] %s embedding ended inconsistently", + x->x_messcount, state->s_name); + } +} + +static int import_emcheckend(t_port *x, t_symbol *state, t_symbol *name) +{ + if (import_emcheck(x, state)) + { + if (x->x_emcount /* empty ok for vtable, CHECKME other cases */ + && x->x_emsize != x->x_emcount) + loud_warning(0, "import", + "[%d] corrupt %s (%d atoms declared, %d provided)", + x->x_messcount, state->s_name, + x->x_emsize, x->x_emcount); + else + { + if (name != x->x_emname) /* warn and accept, LATER rethink */ + import_eminconsistent(x, state); + return (1); + } + } + return (0); +} + +static void import_emstart(t_port *x, t_symbol *state, t_symbol *name, int size) +{ + if (x->x_emstate) import_embroken(x, state->s_name); + x->x_emstate = state; + binbuf_clear(x->x_embb); + x->x_emname = name; + x->x_emsize = size; + x->x_emcount = 0; +} + +static void import_emend(t_port *x, t_symbol *state, t_symbol *name) +{ + import_emcheckend(x, state, name); + x->x_emstate = 0; + x->x_emname = 0; + x->x_emsize = 0; + x->x_emcount = 0; + binbuf_clear(x->x_embb); +} + +static void import_emflush(t_port *x, t_symbol *state, t_symbol *name) +{ + int ac = binbuf_getnatom(x->x_embb); + if (import_emcheckend(x, state, name) && ac) + binbuf_add(x->x_outbb, ac, binbuf_getvec(x->x_embb)); + x->x_emstate = 0; + x->x_emname = 0; + x->x_emsize = 0; + x->x_emcount = 0; + if (ac) binbuf_clear(x->x_embb); + binbuf_addv(x->x_outbb, "ss;", gensym("#C"), gensym("restore")); +} + +static int import_emcopy(t_port *x, t_symbol *state) +{ + if (import_emcheck(x, state)) + { + t_atom *out = x->x_outmess; + SETSYMBOL(out, gensym("#C")); out++; + out = import_copyatoms(out, x->x_inmess + 1, x->x_inatoms - 1); + SETSEMI(out); + binbuf_add(x->x_embb, x->x_inatoms + 1, x->x_outmess); + return (1); + } + else return (0); +} + +static int import_emadd(t_port *x, t_symbol *state, int ac, t_atom *av) +{ + if (import_emcheck(x, state)) + { + t_atom at; + SETSYMBOL(&at, gensym("#C")); + binbuf_add(x->x_embb, 1, &at); + binbuf_add(x->x_embb, ac, av); + binbuf_addsemi(x->x_embb); + return (1); + } + else return (0); +} + +static int import_emaddv(t_port *x, t_symbol *state, char *fmt, ...) +{ + va_list ap; + t_atom arg[64], *at = arg; + int nargs = 0; + char *fp = fmt; + va_start(ap, fmt); + SETSYMBOL(at, gensym("#C")); + at++; nargs++; + if (import_emcheck(x, state)) while (1) + { + switch(*fp++) + { + case 'i': SETFLOAT(at, va_arg(ap, t_int)); break; + case 'f': SETFLOAT(at, va_arg(ap, double)); break; + case 's': SETSYMBOL(at, va_arg(ap, t_symbol *)); break; + case ';': SETSEMI(at); break; + case 0: goto done; + default: nargs = 0; goto done; + } + at++; nargs++; + } +done: + va_end(ap); + if (nargs > 1) + { + binbuf_add(x->x_embb, nargs, arg); + return (1); + } + else return (0); +} + +static void import_addclassname(t_port *x, char *outname, t_atom *inatom) +{ + t_atom at; + if (outname) + SETSYMBOL(&at, gensym(outname)); + else + { + t_symbol *insym = 0; + if (inatom->a_type == A_SYMBOL) + { + /* LATER bash inatom to lowercase (CHECKME first) */ + insym = inatom->a_w.w_symbol; + if (import_mapping && import_mapsize) + { + char **fromp = import_mapping, **top = import_mapping + 1; + int cnt = import_mapsize; + while (cnt--) + { + if (strcmp(*fromp, insym->s_name)) + { + fromp += 2; + top += 2; + } + else + { + insym = gensym(*top); + inatom = 0; + break; + } + } + } + if (insym != &s_bang && insym != &s_float && + insym != &s_symbol && insym != &s_list && + (insym == portps_inlet || insym == portps_outlet || + zgetfn(&pd_objectmaker, insym) == 0)) + { + x->x_withbogus = 1; + SETSYMBOL(&at, portps_bogus); + binbuf_add(x->x_outbb, 1, &at); + } + } + if (inatom) + import_copyatoms(&at, inatom, 1); + else if (insym) + SETSYMBOL(&at, insym); + else + { + loudbug_bug("import_addclassname"); + SETSYMBOL(&at, gensym("???")); + } + } + binbuf_add(x->x_outbb, 1, &at); +} + +static int import_obj(t_port *x, char *name) +{ + int ndx = (x->x_inmess[1].a_w.w_symbol == gensym("user") ? 3 : 2); + binbuf_addv(x->x_outbb, "ssff", + gensym("#X"), gensym("obj"), + port_getx(x, ndx), port_gety(x, ndx + 1)); + import_addclassname(x, name, &x->x_inmess[ndx == 2 ? 6 : 2]); + binbuf_addsemi(x->x_outbb); + x->x_nobj++; + return (PORT_NEXT); +} + +static int import_objarg(t_port *x, char *name) +{ + int ndx = (x->x_inmess[1].a_w.w_symbol == gensym("user") ? 3 : 2); + if (x->x_inatoms > 6 + || (ndx == 3 && x->x_inatoms > 4)) + { + t_atom *out = x->x_outmess; + SETSYMBOL(out, gensym("#X")); out++; + SETSYMBOL(out, gensym("obj")); out++; + port_setxy(x, ndx, out); + binbuf_add(x->x_outbb, 4, x->x_outmess); + import_addclassname(x, name, &x->x_inmess[ndx == 2 ? 6 : 2]); + out = import_copyatoms(x->x_outmess, x->x_inmess + 7, x->x_inatoms - 7); + SETSEMI(out); + binbuf_add(x->x_outbb, x->x_inatoms - 6, x->x_outmess); + x->x_nobj++; + return (PORT_NEXT); + } + else return (PORT_CORRUPT); +} + +static int imaction_N1_vpatcher(t_port *x, char *arg) +{ + if (x->x_stackdepth >= x->x_stacksize) + { + int rqsz = x->x_stackdepth + 1; + int sz = rqsz; + x->x_stack = grow_withdata(&rqsz, &x->x_stackdepth, + &x->x_stacksize, x->x_stack, + PORT_INISTACK, x->x_stackini, + sizeof(*x->x_stack)); + if (rqsz != sz) + { + post("too many embedded patches"); + return (PORT_FATAL); + } + } + x->x_stack[x->x_stackdepth++] = x->x_nobj; + x->x_nobj = 0; + binbuf_addv(x->x_outbb, "ssfffff;", + gensym("#N"), gensym("canvas"), + port_getx(x, 2), port_gety(x, 3), + (float)port_xstretch(port_getint(x, 4) - port_getint(x, 2)), + (float)port_ystretch(port_getint(x, 5) - port_getint(x, 3)), + PORT_DEFFONTSIZE); + return (PORT_NEXT); +} + +static int imaction_N1_vtable(t_port *x, char *arg) +{ + int range = port_getint(x, 8), + left = port_getint(x, 3), + top = port_getint(x, 4), + right = port_getint(x, 5), + bottom = port_getint(x, 6), + flags = port_getint(x, 7); + import_emstart(x, portps_vtable, port_getsymbol(x, 9), port_getint(x, 2)); +#ifdef PORT_DEBUG + loudbug_post( + "vtable \"%s\": size %d, range %d, coords %d %d %d %d, flags %d", + x->x_emname->s_name, x->x_emsize, + range, left, top, right, bottom, flags); +#endif + import_emaddv(x, portps_vtable, "si;", gensym("size"), x->x_emsize); + import_emaddv(x, portps_vtable, "siiii;", gensym("flags"), + /* CHECKED */ + (flags & 16) != 0, (flags & 4) != 0, + (flags & 8) != 0, (flags & 2) != 0); + import_emaddv(x, portps_vtable, "si;", gensym("tabrange"), range); + import_emaddv(x, portps_vtable, "siiiii;", gensym("_coords"), + left, top, right, bottom, flags & 1); + return (PORT_NEXT); +} + +static int imaction_N1_coll(t_port *x, char *arg) +{ + import_emstart(x, portps_coll, port_getsymbol(x, 2), 0); + return (PORT_NEXT); +} + +static int imaction_N1_funbuff(t_port *x, char *arg) +{ + import_emstart(x, portps_funbuff, &s_, 0); + import_emaddv(x, portps_funbuff, "si;", gensym("embed"), + port_getint(x, 2) != 0); + return (PORT_NEXT); +} + +static int imaction_N1_prob(t_port *x, char *arg) +{ + import_emstart(x, portps_prob, &s_, 0); + return (PORT_NEXT); +} + +static int imaction_N1_picture(t_port *x, char *arg) +{ + import_emstart(x, portps_picture, 0, 0); + if (x->x_pictfp) + { + import_unexpected(x); + if (x->x_dumping) + fclose(x->x_pictfp); + x->x_pictfp = 0; + } + return (PORT_NEXT); +} + +static int imaction_P6_patcher(t_port *x, char *arg) +{ + if (x->x_withbogus) + binbuf_addv(x->x_outbb, "ss;", portps_cleanup, portps_cleanup); + binbuf_addv(x->x_outbb, "ssffss;", + gensym("#X"), gensym("restore"), + port_getx(x, 2), port_gety(x, 3), + gensym("pd"), port_getsymbol(x, 7)); + if (x->x_stackdepth) /* LATER consider returning PORT_FATAL otherwise */ + x->x_stackdepth--; + x->x_nobj = x->x_stack[x->x_stackdepth]; + x->x_nobj++; + return (PORT_NEXT); +} + +static int imaction_P6_table(t_port *x, char *arg) +{ + t_symbol *tablename = port_getsymbol(x, 7); + binbuf_addv(x->x_outbb, "ssffs", + gensym("#X"), gensym("obj"), + port_getx(x, 2), port_gety(x, 3), gensym("Table")); + if (tablename != &s_) + { + t_atom at; + SETSYMBOL(&at, tablename); + binbuf_add(x->x_outbb, 1, &at); + } + binbuf_addsemi(x->x_outbb); + import_emflush(x, portps_vtable, tablename); + x->x_nobj++; + return (PORT_NEXT); +} + +static int imaction_P6_coll(t_port *x, char *arg) +{ + t_symbol *collname = port_getsymbol(x, 7); + binbuf_addv(x->x_outbb, "ssffs", + gensym("#X"), gensym("obj"), + port_getx(x, 2), port_gety(x, 3), portps_coll); + if (collname != &s_) + { + t_atom at; + SETSYMBOL(&at, collname); + binbuf_add(x->x_outbb, 1, &at); + } + binbuf_addsemi(x->x_outbb); + import_emflush(x, portps_coll, collname); + x->x_nobj++; + return (PORT_NEXT); +} + +static int imaction_P6_funbuff(t_port *x, char *arg) +{ + binbuf_addv(x->x_outbb, "ssffs;", + gensym("#X"), gensym("obj"), + port_getx(x, 2), port_gety(x, 3), portps_funbuff); + import_emflush(x, portps_funbuff, &s_); + x->x_nobj++; + return (PORT_NEXT); +} + +static int imaction_P6_prob(t_port *x, char *arg) +{ + binbuf_addv(x->x_outbb, "ssffs;", + gensym("#X"), gensym("obj"), + port_getx(x, 2), port_gety(x, 3), portps_prob); + import_emflush(x, portps_prob, &s_); + x->x_nobj++; + return (PORT_NEXT); +} + +/* LATER use hammer replacements */ +static int imaction_P6_pack(t_port *x, char *arg) +{ + int i; + for (i = 7; i < x->x_inatoms; i++) + { + if (x->x_inmess[i].a_type == A_SYMBOL) + { + t_symbol *s = x->x_inmess[i].a_w.w_symbol; + if (s->s_name[1]) + { + loud_warning(0, "import", + "%s's argument '%s' bashed to 's'", + port_getsymbol(x, 6)->s_name, s->s_name); + x->x_inmess[i].a_w.w_symbol = gensym("s"); + } + else switch (*s->s_name) + { + case 'b': case 'f': case 's': case 'l': + break; + case 'i': + x->x_inmess[i].a_w.w_symbol = gensym("f"); + break; + default: + x->x_inmess[i].a_w.w_symbol = gensym("s"); + } + } + } + return (PORT_OK); +} + +/* LATER consider using hammer replacements */ +static int imaction_P6_midi(t_port *x, char *arg) +{ + x->x_inatoms = 7; /* ugly, LATER rethink */ + return (PORT_OK); +} + +static int imaction_P2_scope(t_port *x, char *name) +{ + if (x->x_inatoms > 6) + { + t_atom *out = x->x_outmess; + int i, xpix, ypix; + SETSYMBOL(out, gensym("#X")); out++; + SETSYMBOL(out, gensym("obj")); out++; + port_setxy(x, 3, out); + xpix = (int)out++->a_w.w_float; + ypix = (int)out->a_w.w_float; + binbuf_add(x->x_outbb, 4, x->x_outmess); + import_addclassname(x, name, &x->x_inmess[2]); + out = x->x_outmess; + port_setxy(x, 5, out); + out++->a_w.w_float -= xpix; + out++->a_w.w_float -= ypix; + out = import_copyatoms(out, x->x_inmess + 7, x->x_inatoms - 7); + SETSEMI(out); + binbuf_add(x->x_outbb, x->x_inatoms - 4, x->x_outmess); + x->x_nobj++; + return (PORT_NEXT); + } + else return (PORT_CORRUPT); +} + +/* width fontsize fontfamily encoding fontprops red green blue text... */ +static int imaction_P1_comment(t_port *x, char *arg) +{ + int outatoms; + SETSYMBOL(x->x_outmess, gensym("#X")); + SETSYMBOL(x->x_outmess + 1, gensym("obj")); + port_setxy(x, 2, x->x_outmess + 2); + SETSYMBOL(x->x_outmess + 4, gensym("comment")); + if (x->x_inatoms > 5) + { + int i, fontsize, fontprops; + float width = port_getwidth(x, 4); + t_atom *ap = x->x_inmess + 5; + SETFLOAT(x->x_outmess + 5, width); + if (ap->a_type == A_INT) + { + fontsize = ap->a_w.w_index & 0x0ff; + fontprops = ap->a_w.w_index >> 8; + } + else if (ap->a_type == A_FLOAT) /* FIXME */ + { + fontsize = ((int)ap->a_w.w_float) & 0x0ff; + fontprops = ((int)ap->a_w.w_float) >> 8; + } + else fontsize = 10, fontprops = 0; + SETFLOAT(x->x_outmess + 6, fontsize); + SETSYMBOL(x->x_outmess + 7, gensym("helvetica")); + SETSYMBOL(x->x_outmess + 8, gensym("?")); + SETFLOAT(x->x_outmess + 9, fontprops); + SETFLOAT(x->x_outmess + 10, 0); + SETFLOAT(x->x_outmess + 11, 0); + SETFLOAT(x->x_outmess + 12, 0); + outatoms = x->x_inatoms + 7; + import_copyatoms(x->x_outmess + 13, x->x_inmess + 6, x->x_inatoms - 6); + } + else outatoms = 5; + SETSEMI(x->x_outmess + outatoms); + binbuf_add(x->x_outbb, outatoms + 1, x->x_outmess); + x->x_nobj++; + return (PORT_NEXT); +} + +static int imaction_P1_message(t_port *x, char *arg) +{ + int i; + t_atom *out; + SETSYMBOL(x->x_outmess, gensym("#X")); + SETSYMBOL(x->x_outmess + 1, gensym("msg")); + port_setxy(x, 2, x->x_outmess + 2); + out = import_copyatoms(x->x_outmess + 4, x->x_inmess + 6, x->x_inatoms - 6); + SETSEMI(out); + binbuf_add(x->x_outbb, x->x_inatoms - 1, x->x_outmess); + x->x_nobj++; + return (PORT_NEXT); +} + +static int imaction_P1_io(t_port *x, char *arg) +{ + binbuf_addv(x->x_outbb, "ssff", + gensym("#X"), gensym("obj"), + port_getx(x, 2), port_gety(x, 3)); + if (x->x_inmess[1].a_w.w_symbol == portps_inlet || + x->x_inmess[1].a_w.w_symbol == portps_outlet) + { + t_atom at; + SETSYMBOL(&at, portps_bogus); + binbuf_add(x->x_outbb, 1, &at); + } + binbuf_add(x->x_outbb, 1, &x->x_inmess[1]); + binbuf_addsemi(x->x_outbb); + x->x_nobj++; + return (PORT_NEXT); +} + +static int imaction_P1_number(t_port *x, char *arg) +{ + binbuf_addv(x->x_outbb, "ssff;", + gensym("#X"), gensym("floatatom"), + port_getx(x, 2), port_gety(x, 3)); + x->x_nobj++; + return (PORT_NEXT); +} + +static int imaction_P1_vpicture(t_port *x, char *arg) +{ + import_emend(x, portps_picture, 0); + if (x->x_pictfp) + { + if (x->x_dumping) + fclose(x->x_pictfp); + x->x_pictfp = 0; + } + else import_unexpected(x); + binbuf_addv(x->x_outbb, "ssffs;", + gensym("#X"), gensym("obj"), + port_getx(x, 2), port_gety(x, 3), + gensym("vpicture")); + x->x_nobj++; + return (PORT_NEXT); +} + +static int imaction_P1_connect(t_port *x, char *arg) +{ + binbuf_addv(x->x_outbb, "ssiiii;", + gensym("#X"), gensym("connect"), + x->x_nobj - port_getint(x, 2) - 1, + port_getint(x, 3), + x->x_nobj - port_getint(x, 4) - 1, + port_getint(x, 5)); + return (PORT_NEXT); +} + +static int imaction_T1_int(t_port *x, char *arg) +{ + if (x->x_emstate == portps_coll) + import_emcopy(x, portps_coll); + else if (x->x_emstate == portps_prob) + import_emcopy(x, portps_prob); + else + import_unexpected(x); + return (PORT_NEXT); +} + +static int imaction_T1_flags(t_port *x, char *arg) +{ + import_emcopy(x, portps_coll); + return (PORT_NEXT); +} + +static int imaction_T1_set(t_port *x, char *arg) +{ + if (x->x_emstate == portps_vtable) + { + if (import_emcopy(x, portps_vtable)) + { + int count = port_getint(x, 2); + if (count != x->x_emcount) + loud_warning(0, "import", + "[%d] bad vtable chunk index %d (%d already taken)", + x->x_messcount, count, x->x_emcount); + x->x_emcount += x->x_inatoms - 3; + } + } + else if (x->x_emstate == portps_funbuff) + import_emcopy(x, portps_funbuff); + else + import_unexpected(x); + return (PORT_NEXT); +} + +static int imaction_T1_reset(t_port *x, char *arg) +{ + import_emcopy(x, portps_prob); + return (PORT_NEXT); +} + +static int imaction_T1_embed(t_port *x, char *arg) +{ + import_emcopy(x, portps_prob); + return (PORT_NEXT); +} + +static int imaction_K1_replace(t_port *x, char *arg) +{ + if (x->x_pictfp) + { + import_unexpected(x); + if (x->x_dumping) + fclose(x->x_pictfp); + x->x_pictfp = 0; + } + else if (import_emcheck(x, portps_picture)) + { + char buf[32]; + x->x_emsize = port_getint(x, 2); + x->x_emcount = 0; + sprintf(buf, "port-%02d.pict", ++x->x_pictno); + if (x->x_dumping) + { + if (x->x_pictfp = fopen(buf, "wb")) + { + int i; + for (i = 0; i < 512; i++) fputc(0, x->x_pictfp); + } + } + else x->x_pictfp = (FILE *)1; + } + return (PORT_NEXT); +} + +static int imaction_K1_set(t_port *x, char *arg) +{ + if (!x->x_pictfp) + import_unexpected(x); + else if (import_emcheck(x, portps_picture)) + { + int i, count = port_getint(x, 2); + if (count != x->x_emcount) + loud_warning(0, "import", + "[%d] bad picture chunk index %d (%d already taken)", + x->x_messcount, count, x->x_emcount); + x->x_emcount += x->x_inatoms - 3; + if (x->x_dumping) + { + for (i = 3; i < x->x_inatoms; i++) + { + int v = port_getint(x, i); + fputc(v >> 24, x->x_pictfp); + fputc((v >> 16) & 0x0ff, x->x_pictfp); + fputc((v >> 8) & 0x0ff, x->x_pictfp); + fputc(v & 0x0ff, x->x_pictfp); + } + } + } + return (PORT_NEXT); +} + +typedef int (*t_portaction)(t_port *, char *arg); + +typedef struct _portslot +{ + char *s_name; + t_portaction s_action; + char *s_actionarg; + struct _portnode *s_subtree; + t_symbol *s_symbol; +} t_portslot; + +typedef struct _portnode /* a parser's symbol definition, sort of... */ +{ + t_portslot *n_table; + int n_nslots; + int n_index; +} t_portnode; + +#define PORT_NSLOTS(slots) (sizeof(slots)/sizeof(*(slots))) + +static t_portslot imslots__N[] = +{ + { "vpatcher", imaction_N1_vpatcher, 0, 0, 0 }, + { "vtable", imaction_N1_vtable, 0, 0, 0 }, + { "coll", imaction_N1_coll, 0, 0, 0 }, + { "funbuff", imaction_N1_funbuff, 0, 0, 0 }, + { "prob", imaction_N1_prob, 0, 0, 0 }, + { "picture", imaction_N1_picture, 0, 0, 0 } +}; +static t_portnode imnode__N = { imslots__N, PORT_NSLOTS(imslots__N), 1 }; + +static t_portslot imslots_newobj[] = +{ + { "patcher", imaction_P6_patcher, 0, 0, 0 }, + { "p", imaction_P6_patcher, 0, 0, 0 }, + { "table", imaction_P6_table, 0, 0, 0 }, + { "coll", imaction_P6_coll, 0, 0, 0 }, + { "funbuff", imaction_P6_funbuff, 0, 0, 0 }, + { "prob", imaction_P6_prob, 0, 0, 0 } +}; +static t_portnode imnode_newobj = { imslots_newobj, + PORT_NSLOTS(imslots_newobj), 6 }; + +/* LATER consider merging newobj and newex */ +static t_portslot imslots_newex[] = +{ + { "key", import_obj, "Key", 0, 0 }, + { "keyup", import_obj, "Keyup", 0, 0 }, + + { "pack", imaction_P6_pack, 0, 0, 0 }, + { "unpack", imaction_P6_pack, 0, 0, 0 }, + { "trigger", imaction_P6_pack, 0, 0, 0 }, + { "t", imaction_P6_pack, 0, 0, 0 }, + + { "midiin", imaction_P6_midi, 0, 0, 0 }, + { "midiout", imaction_P6_midi, 0, 0, 0 }, + { "notein", imaction_P6_midi, 0, 0, 0 }, + { "noteout", imaction_P6_midi, 0, 0, 0 }, + { "pgmin", imaction_P6_midi, 0, 0, 0 }, + { "pgmout", imaction_P6_midi, 0, 0, 0 }, + { "ctlin", imaction_P6_midi, 0, 0, 0 }, + { "ctlout", imaction_P6_midi, 0, 0, 0 }, + { "bendin", imaction_P6_midi, 0, 0, 0 }, + { "bendout", imaction_P6_midi, 0, 0, 0 }, + + /* LATER rethink */ + { "Borax", import_objarg, "Borax", 0, 0 }, + { "Bucket", import_objarg, "Bucket", 0, 0 }, + { "Decode", import_objarg, "Decode", 0, 0 }, + { "Histo", import_objarg, "Histo", 0, 0 }, + { "MouseState", import_objarg, "MouseState", 0, 0 }, + { "Peak", import_objarg, "Peak", 0, 0 }, + { "TogEdge", import_objarg, "TogEdge", 0, 0 }, + { "Trough", import_objarg, "Trough", 0, 0 }, + { "Uzi", import_objarg, "Uzi", 0, 0 } +}; +static t_portnode imnode_newex = { imslots_newex, + PORT_NSLOTS(imslots_newex), 6 }; + +static t_portslot imslots_user[] = +{ + { "GSwitch", import_objarg, "Gswitch", 0, 0 }, + { "GSwitch2", import_objarg, "Ggate", 0, 0 }, + { "number~", import_obj, 0, 0, 0 }, + { "scope~", imaction_P2_scope, "Scope~", 0, 0 }, + { "uslider", import_obj, "vsl", 0, 0 } /* LATER range and offset */ +}; +static t_portnode imnode_user = { imslots_user, + PORT_NSLOTS(imslots_user), 2 }; + +static t_portslot imslots__P[] = +{ + { "comment", imaction_P1_comment, 0, 0, 0 }, + { "message", imaction_P1_message, 0, 0, 0 }, + { "newobj", import_objarg, 0, &imnode_newobj, 0 }, + { "newex", import_objarg, 0, &imnode_newex, 0 }, + { "inlet", imaction_P1_io, 0, 0, 0 }, + { "inlet~", imaction_P1_io, 0, 0, 0 }, + { "outlet", imaction_P1_io, 0, 0, 0 }, + { "outlet~", imaction_P1_io, 0, 0, 0 }, + { "number", imaction_P1_number, 0, 0, 0 }, + { "flonum", imaction_P1_number, 0, 0, 0 }, + { "button", import_obj, "bng", 0, 0 }, + { "slider" , import_obj, "vsl", 0, 0 }, /* LATER range and offset */ + { "hslider", import_obj, "hsl", 0, 0 }, /* LATER range and offset */ + { "toggle", import_obj, "tgl", 0, 0 }, + { "user", import_objarg, 0, &imnode_user, 0 }, + /* state is embedded in #N vpreset <nslots>; #X append... */ + { "preset", import_obj, "preset", 0, 0 }, + /* an object created from the "Paste Picture" menu, + state is embedded in #N picture; #K...; */ + { "vpicture", imaction_P1_vpicture, 0, 0, 0 }, + { "connect", imaction_P1_connect, 0, 0, 0 }, + { "fasten", imaction_P1_connect, 0, 0, 0 } +}; +static t_portnode imnode__P = { imslots__P, PORT_NSLOTS(imslots__P), 1 }; + +static t_portslot imslots__T[] = +{ + { "int", imaction_T1_int, 0, 0, 0 }, + { "flags", imaction_T1_flags, 0, 0, 0 }, + { "set", imaction_T1_set, 0, 0, 0 }, + { "reset", imaction_T1_reset, 0, 0, 0 }, + { "embed", imaction_T1_embed, 0, 0, 0 } +}; +static t_portnode imnode__T = { imslots__T, PORT_NSLOTS(imslots__T), 1 }; + +static t_portslot imslots__K[] = +{ + { "replace", imaction_K1_replace, 0, 0, 0 }, + { "set", imaction_K1_set, 0, 0, 0 } +}; +static t_portnode imnode__K = { imslots__K, PORT_NSLOTS(imslots__K), 1 }; + +static t_portslot imslots_[] = +{ + { "#N", 0, 0, &imnode__N, 0 }, + { "#P", 0, 0, &imnode__P, 0 }, + { "#T", 0, 0, &imnode__T, 0 }, + { "#K", 0, 0, &imnode__K, 0 } +}; +static t_portnode imnode_ = { imslots_, PORT_NSLOTS(imslots_), 0 }; + +static int port_doparse(t_port *x, t_portnode *node) +{ + int nslots = node->n_nslots; + if (nslots > 0) + { + t_portslot *slot = node->n_table; + t_symbol *insym = port_getanysymbol(x, node->n_index); + char *inname = 0; +secondpass: + while (nslots--) + { + if (slot->s_symbol == insym + || (inname && shared_matchignorecase(inname, slot->s_name))) + { + if (slot->s_subtree) + { + int nobj = x->x_nobj; + int result = port_doparse(x, slot->s_subtree); + if (result == PORT_FATAL || result == PORT_CORRUPT || + result == PORT_NEXT) + return (result); + } + if (slot->s_action) + return (slot->s_action(x, slot->s_actionarg)); + else + return (PORT_OK); /* LATER rethink */ + } + slot++; + } + if (!inname) + { + inname = insym->s_name; + nslots = node->n_nslots; + slot = node->n_table; + goto secondpass; + } + } + else loudbug_bug("port_doparse"); + return (PORT_UNKNOWN); +} + +static int port_parsemessage(t_port *x) +{ + import_flushillegal(x); + x->x_messcount++; + return (port_doparse(x, &imnode_)); +} + +static void port_startparsing(t_port *x) +{ +#ifdef PORT_DEBUG + loudbug_post("parsing..."); +#endif + x->x_messcount = 0; + x->x_illmess = 0; + x->x_lastunexpected = -1; + x->x_lastbroken = -1; + x->x_lastinconsistent = -1; + x->x_nobj = 0; + x->x_emstate = 0; + binbuf_clear(x->x_embb); + x->x_pictno = 0; + x->x_pictfp = 0; +} + +static void port_endparsing(t_port *x) +{ + import_flushillegal(x); + if (x->x_emstate) + { + import_embroken(x, "end of file"); + x->x_emstate = 0; + } + binbuf_clear(x->x_embb); + if (x->x_pictfp) + { + loud_warning(0, "import", "incomplete picture"); + if (x->x_dumping) + fclose(x->x_pictfp); + x->x_pictfp = 0; + } +#ifdef PORT_DEBUG + loudbug_post("end of parsing"); +#endif +} + +static void port_dochecksetup(t_portnode *node) +{ + t_portslot *slots = node->n_table; + int i, nslots = node->n_nslots; + for (i = 0; i < nslots; i++) + { + t_portnode *subtree = slots[i].s_subtree; + slots[i].s_symbol = gensym(slots[i].s_name); + if (subtree) + port_dochecksetup(subtree); + } + import_setdefmapping(); +} + +#define BOGUS_NINLETS 23 +#define BOGUS_NOUTLETS 24 + +typedef struct _bogus +{ + t_object x_ob; + t_glist *x_glist; /* used also as 'dirty' flag */ + int x_bound; + t_inlet *x_inlets[BOGUS_NINLETS]; + t_outlet *x_outlets[BOGUS_NOUTLETS]; + t_clock *x_clock; +} t_bogus; + +typedef struct _bogushook +{ + t_pd x_pd; + t_pd *x_who; + t_glist *x_glist; /* used also as 'dirty' flag */ + t_clock *x_clock; +} t_bogushook; + +static t_class *bogus_class; +static t_class *bogushook_class; + +static void bogus_tick(t_bogus *x) +{ + if (x->x_bound) + { +#ifdef PORT_DEBUG + loudbug_post("bogus_tick: unbinding '%x'", (int)x); +#endif + pd_unbind((t_pd *)x, portps_cleanup); + x->x_bound = 0; + } +} + +static void bogushook_tick(t_bogushook *x) +{ + pd_free((t_pd *)x); +} + +static void bogus_cleanup(t_bogus *x) +{ + if (x->x_glist && x->x_glist == canvas_getcurrent()) + { + t_text *t = (t_text *)x; + int ac = binbuf_getnatom(t->te_binbuf); + if (ac) + { + t_atom *av = binbuf_getvec(t->te_binbuf); + t_binbuf *bb = binbuf_new(); + t_inlet **ip; + t_outlet **op; + int i; +#ifdef PORT_DEBUG + loudbug_startpost("self-adjusting "); + loudbug_postbinbuf(t->te_binbuf); +#endif + binbuf_add(bb, ac - 1, av + 1); + binbuf_free(t->te_binbuf); + t->te_binbuf = bb; + + for (i = BOGUS_NINLETS, ip = x->x_inlets + BOGUS_NINLETS - 1; + i ; i--, ip--) + { + if (forky_hasfeeders((t_object *)x, x->x_glist, i, 0)) + break; + else + inlet_free(*ip); + } +#ifdef PORT_DEBUG + loudbug_post("%d inlets deleted", BOGUS_NINLETS - i); +#endif + for (i = 0, op = x->x_outlets + BOGUS_NOUTLETS - 1; + i < BOGUS_NOUTLETS; i++, op--) + { + if (fragile_outlet_connections(*op)) + break; + else + outlet_free(*op); + } +#ifdef PORT_DEBUG + loudbug_post("%d outlets deleted", i); +#endif + glist_retext(x->x_glist, t); + } + else loudbug_bug("bogus_cleanup"); + x->x_glist = 0; + clock_delay(x->x_clock, 0); + } +} + +static void bogus_free(t_bogus *x) +{ + if (x->x_bound) pd_unbind((t_pd *)x, portps_cleanup); + if (x->x_clock) clock_free(x->x_clock); +} + +static void *bogus_new(t_symbol *s, int ac, t_atom *av) +{ + t_bogus *x = 0; + t_glist *glist; + if (glist = canvas_getcurrent()) + { + char buf[80]; + int i; + if (av->a_type == A_SYMBOL) + { + t_pd *z; + if (z = forky_newobject(av->a_w.w_symbol, ac - 1, av + 1)) + { + t_bogushook *y = (t_bogushook *)pd_new(bogushook_class); + y->x_who = z; + y->x_glist = glist; + pd_bind((t_pd *)y, portps_cleanup); + y->x_clock = clock_new(y, (t_method)bogushook_tick); +#ifdef PORT_DEBUG + loudbug_post("reclaiming %s", av->a_w.w_symbol->s_name); +#endif + return (z); + } + } + x = (t_bogus *)pd_new(bogus_class); + atom_string(av, buf, 80); + loud_error((t_pd *)x, "unknown class '%s'", buf); + x->x_glist = glist; + for (i = 0; i < BOGUS_NINLETS; i++) + x->x_inlets[i] = inlet_new((t_object *)x, (t_pd *)x, 0, 0); + for (i = 0; i < BOGUS_NOUTLETS; i++) + x->x_outlets[i] = outlet_new((t_object *)x, &s_anything); + pd_bind((t_pd *)x, portps_cleanup); + x->x_bound = 1; + x->x_clock = clock_new(x, (t_method)bogus_tick); + } + return (x); +} + +static void bogushook_cleanup(t_bogushook *x) +{ + if (x->x_glist) + { + t_text *t = (t_text *)x->x_who; + int ac = binbuf_getnatom(t->te_binbuf); + if (ac > 1) + { + int dorecreate = 0; + t_atom *av = binbuf_getvec(t->te_binbuf); + t_binbuf *bb = binbuf_new(); +#ifdef PORT_DEBUG + loudbug_startpost("hook-adjusting "); + loudbug_postbinbuf(t->te_binbuf); +#endif + ac--; av++; + if (av->a_type == A_SYMBOL) + { + if (av->a_w.w_symbol == portps_outlet) + { + if (forky_hasfeeders((t_object *)x->x_who, x->x_glist, + 0, &s_signal)) + { + t_atom at; + SETSYMBOL(&at, gensym("outlet~")); + binbuf_add(bb, 1, &at); + ac--; av++; + dorecreate = 1; + } + } + else if (av->a_w.w_symbol == portps_inlet) + { + /* LATER */ + } + } + if (ac) binbuf_add(bb, ac, av); + if (dorecreate) gobj_recreate(x->x_glist, (t_gobj *)t, bb); + else + { + binbuf_free(t->te_binbuf); + t->te_binbuf = bb; + glist_retext(x->x_glist, t); + } + } + else loudbug_bug("bogushook_cleanup"); + x->x_glist = 0; + clock_delay(x->x_clock, 0); + } +} + +static void bogushook_free(t_bogushook *x) +{ +#ifdef PORT_DEBUG + loudbug_post("destroing the hook of '%s'", class_getname(*x->x_who)); +#endif + pd_unbind((t_pd *)x, portps_cleanup); + if (x->x_clock) clock_free(x->x_clock); +} + +static void port_checksetup(void) +{ + static int done = 0; + if (!done) + { + port_dochecksetup(&imnode_); + + portps_bogus = gensym("_port.bogus"); + portps_cleanup = gensym("_port.cleanup"); + portps_inlet = gensym("inlet"); + portps_outlet = gensym("outlet"); + portps_vtable = gensym("vtable"); + portps_coll = gensym("coll"); + portps_funbuff = gensym("funbuff"); + portps_prob = gensym("prob"); + portps_picture = gensym("picture"); + + if (zgetfn(&pd_objectmaker, portps_bogus) == 0) + { + bogus_class = class_new(portps_bogus, + (t_newmethod)bogus_new, + (t_method)bogus_free, + sizeof(t_bogus), 0, A_GIMME, 0); + class_addmethod(bogus_class, (t_method)bogus_cleanup, + portps_cleanup, 0); + bogushook_class = class_new(gensym("_port.bogushook"), 0, + (t_method)bogushook_free, + sizeof(t_bogushook), CLASS_PD, 0); + class_addmethod(bogushook_class, (t_method)bogushook_cleanup, + portps_cleanup, 0); + } + done = 1; + } +} + +static t_port *port_new(void) +{ + t_port *x = (t_port *)getbytes(sizeof(*x)); + x->x_outbb = 0; + x->x_withbogus = 0; + x->x_outsize = PORT_INISIZE; + x->x_outatoms = 0; + x->x_outmess = x->x_outini; + x->x_stacksize = PORT_INISTACK; + x->x_stackdepth = 0; + x->x_stack = x->x_stackini; + x->x_emstate = 0; + x->x_embb = binbuf_new(); +#ifdef PORT_DUMP + x->x_dumping = 1; +#else + x->x_dumping = 0; +#endif + return (x); +} + +static void port_free(t_port *x) +{ + if (portps_cleanup->s_thing) + { + /* clean up toplevel glist */ + typedmess(portps_cleanup->s_thing, portps_cleanup, 0, 0); + /* LATER unbind all bogus objects, and destroy all bogushooks + by traversing the portps_cleanup's bindlist, instead of + using per-object clocks. Need to have bindlist traversal + in Pd API first... Otherwise, consider fragilizing this + (and fragilizing grab too). */ + } + if (x->x_outmess != x->x_outini) + freebytes(x->x_outmess, x->x_outsize * sizeof(*x->x_outmess)); + if (x->x_stack != x->x_stackini) + freebytes(x->x_stack, x->x_stacksize * sizeof(*x->x_stack)); + if (x->x_embb) + binbuf_free(x->x_embb); + freebytes(x, sizeof(*x)); +} + +static int import_binbuf(t_port *x, t_binbuf *inbb, t_binbuf *outbb) +{ + int result = PORT_OK; + t_atom *av = binbuf_getvec(inbb); + int ac = binbuf_getnatom(inbb); + int startmess, endmess; + x->x_outbb = outbb; + port_startparsing(x); + for (startmess = 0; startmess < ac; startmess = endmess + 1) + { + t_atom *mess = av + startmess, *ap; + int i; + for (endmess = startmess, ap = mess; + ap->a_type != A_SEMI; endmess++, ap++) + if (endmess == ac) + { + result = PORT_CORRUPT; /* no final semi */ + goto endparsing; + } + if (endmess == startmess || endmess == startmess + 1 + || mess->a_type != A_SYMBOL) + { + startmess = endmess + 1; + import_illegal(x); + continue; + } + if (mess[1].a_type != A_SYMBOL) + { + if (mess[1].a_type != A_INT && mess[1].a_type != A_FLOAT) + { + startmess = endmess + 1; + import_illegal(x); + continue; + } + } + else if (mess[1].a_w.w_symbol == gensym("hidden")) + { + t_symbol *sel = mess[1].a_w.w_symbol; + mess[1].a_w.w_symbol = mess->a_w.w_symbol; + startmess++; + mess++; + if (endmess == startmess + 1 || mess[1].a_type != A_SYMBOL) + { + startmess = endmess + 1; + import_illegal(x); + continue; + } + } + x->x_inatoms = endmess - startmess; + x->x_inmess = mess; + if ((i = x->x_inatoms + 16) > x->x_outsize) /* LATER rethink */ + { + int sz = i; + x->x_outmess = grow_nodata(&sz, &x->x_outsize, x->x_outmess, + PORT_INISIZE, x->x_outini, + sizeof(*x->x_outmess)); + if (sz != i) + { + startmess = endmess + 1; + continue; /* LATER rethink */ + } + } + + /* dollar signs in file translate to symbols, + LATER rethink, also #-signs */ + for (i = 0, ap = x->x_inmess; i < x->x_inatoms; i++, ap++) + { + if (ap->a_type == A_DOLLAR) + { + char buf[100]; + sprintf(buf, "$%d", ap->a_w.w_index); + SETSYMBOL(ap, gensym(buf)); + } + else if (ap->a_type == A_DOLLSYM) + { + char buf[100]; + sprintf(buf, "$%s", ap->a_w.w_symbol->s_name); + SETSYMBOL(ap, gensym(buf)); + } + } + if (port_parsemessage(x) == PORT_FATAL) + { + result = PORT_FATAL; + goto endparsing; + } + } +endparsing: + port_endparsing(x); + return (result); +} + +int import_max(char *fn, char *dir) +{ + int result; + t_port *x; + t_binbuf *inbb, *outbb; + int fd; + char buf[MAXPDSTRING], *bufp; + t_pd *stackp = 0; + int dspstate = canvas_suspend_dsp(); + port_checksetup(); + if ((fd = open_via_path(dir, fn, "", buf, &bufp, MAXPDSTRING, 0)) < 0) + { + loud_error(0, "%s: can't open", fn); + return (BINPORT_NOFILE); + } + else close (fd); + + x = port_new(); + inbb = binbuf_new(); + glob_setfilename(0, gensym(bufp), gensym(buf)); + result = binport_read(inbb, bufp, buf); + if (result == BINPORT_MAXBINARY || + result == BINPORT_MAXTEXT || + result == BINPORT_MAXOLD) + { + int bbresult; +#ifdef PORT_DEBUG + binport_write(inbb, "import-debug.pat", ""); +#endif + outbb = binbuf_new(); + if ((bbresult = import_binbuf(x, inbb, outbb)) != PORT_OK) + { + loud_error(0, "%s: import failed (%d)", fn, bbresult); + if (bbresult == PORT_CORRUPT) + result = BINPORT_CORRUPT; + else + result = BINPORT_FAILED; + binbuf_free(outbb); + outbb = 0; + } + binbuf_free(inbb); +#ifdef PORT_LOG + if (outbb) binbuf_write(outbb, "import-result.pd", "", 0); +#endif + } + else if (result == BINPORT_PDFILE) + outbb = inbb; + else + { + perror(fn); /* FIXME */ + binbuf_free(inbb); + outbb = 0; + } + if (outbb) + { + binbuf_eval(outbb, 0, 0, 0); + binbuf_free(outbb); + } + port_free(x); + + glob_setfilename(0, &s_, &s_); + canvas_resume_dsp(dspstate); + while ((stackp != s__X.s_thing) && (stackp = s__X.s_thing)) + vmess(stackp, gensym("pop"), "i", 1); + +#if 0 /* LATER */ + pd_doloadbang(); +#endif + + return (result); +} diff --git a/externals/miXed/shared/common/port.h b/externals/miXed/shared/common/port.h new file mode 100644 index 000000000..48f58bd36 --- /dev/null +++ b/externals/miXed/shared/common/port.h @@ -0,0 +1,13 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __PORT_H__ +#define __PORT_H__ + +int import_max(char *fn, char *dir); +void import_setmapping(int size, char **mapping); +char **import_getmapping(int *sizep); +char *port_usemapping(char *from, int mapsize, char **mapping); + +#endif diff --git a/externals/miXed/shared/common/props.c b/externals/miXed/shared/common/props.c new file mode 100644 index 000000000..4445bf298 --- /dev/null +++ b/externals/miXed/shared/common/props.c @@ -0,0 +1,661 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" +#include "props.h" + +#ifdef KRZYSZCZ +//#define PROPS_DEBUG +#endif + +#define PROPS_INISIZE 32 /* LATER rethink */ +#define PROPS_MAXMIXUPS 32 + +/* return values of props_iskey() */ +enum { PROPS_NONE = 0, PROPS_THIS, PROPS_MIXUP }; + +/* 'mode' argument values of props_iskey() and props_update() */ +enum { PROPS_SINGLEMODE = 0, PROPS_MULTIMODE }; + +typedef struct _propelem +{ + char *e_key; + char *e_value; + struct _propelem *e_next; +} t_propelem; + +struct _props +{ + char p_thisescape; + char *p_thisinitial; + char *p_name; + int p_size; /* as allocated */ + int p_natoms; /* as used */ + t_atom *p_buffer; + t_atom p_bufini[PROPS_INISIZE]; + int p_nextindex; + t_pd *p_owner; + t_propsresolver p_resolver; + t_propelem *p_dict; + t_propelem *p_nextelem; + int p_badupdate; + char p_mixupescapes[PROPS_MAXMIXUPS]; + t_props *p_firstmixup; /* points to the props list's head */ + t_props *p_next; +}; + +/* Dictionary of properties, p_dict, meant to be nothing more, but an + optimization detail, is handled implicitly, through its owning t_props. + This optimization has to be enabled by passing a nonzero 'resolver' + argument to props_new(). + Since p_dict stores resolved strings, it is a secondary, `shallow' storage, + which has to be synced to its master, p_buffer of atoms. + Currently, p_dict is implemented as an unsorted linked list, which should + be fine in most cases (but might need revisiting LATER). */ + +static t_propelem *propelem_new(char *key, char *value) +{ + t_propelem *ep = (t_propelem *)getbytes(sizeof(*ep)); + ep->e_key = getbytes(strlen(key) + 1); + strcpy(ep->e_key, key); + ep->e_value = getbytes(strlen(value) + 1); + strcpy(ep->e_value, value); + ep->e_next = 0; + return (ep); +} + +static void propelem_free(t_propelem *ep) +{ + if (ep->e_key) freebytes(ep->e_key, strlen(ep->e_key) + 1); + if (ep->e_value) freebytes(ep->e_value, strlen(ep->e_value) + 1); + freebytes(ep, sizeof(*ep)); +} + +/* Returns zero if the key was found (and value replaced), + nonzero if a new element was added. */ +static t_propelem *propelem_add(t_propelem *ep, char *key, char *value) +{ + while (ep) + { + if (strcmp(ep->e_key, key)) + ep = ep->e_next; + else + break; + } + if (ep) + { + if (strcmp(ep->e_value, value)) + { + if (ep->e_value) + ep->e_value = resizebytes(ep->e_value, strlen(ep->e_value) + 1, + strlen(value) + 1); + else + ep->e_value = getbytes(strlen(value) + 1); + strcpy(ep->e_value, value); + } + return (0); + } + else return (propelem_new(key, value)); +} + +static void props_dictadd(t_props *pp, t_symbol *s, int ac, t_atom *av) +{ + if (s && *s->s_name && s->s_name[1] && ac) + { + t_propelem *ep; + char *value = pp->p_resolver(pp->p_owner, ac, av); + if (value && + (ep = propelem_add(pp->p_dict, s->s_name + 1, value))) + { + ep->e_next = pp->p_dict; + pp->p_dict = ep; + } + } +} + +/* API calls for lookup (getvalue) and traversal (firstvalue, nextvalue), and + non-api calls (removevalue) of resolved properties. Only dictionary-enabled + properties handle these calls. Plain 'key', without escape, is expected. + Traversal is not thread-safe (will we need threaded props, LATER?) */ + +char *props_getvalue(t_props *pp, char *key) +{ + if (pp->p_resolver) + { + t_propelem *ep = pp->p_dict; + while (ep) + { + if (strcmp(ep->e_key, key)) + ep = ep->e_next; + else + return (ep->e_value); + } + } + return (0); +} + +char *props_nextvalue(t_props *pp, char **keyp) +{ + if (pp->p_nextelem) + { + char *value = pp->p_nextelem->e_value; + *keyp = pp->p_nextelem->e_key; + pp->p_nextelem = pp->p_nextelem->e_next; + return (value); + } + return (0); +} + +char *props_firstvalue(t_props *pp, char **keyp) +{ + if (pp->p_nextelem) + loudbug_bug("props_firstvalue"); + if (pp->p_resolver) + pp->p_nextelem = pp->p_dict; + return (props_nextvalue(pp, keyp)); +} + +static void props_removevalue(t_props *pp, char *key) +{ + if (pp->p_resolver && *key) + { + t_propelem *ep = pp->p_dict, *epp = 0; + while (ep) + { + if (strcmp(ep->e_key, key)) + { + epp = ep; + ep = ep->e_next; + } + else + { + if (epp) + epp->e_next = ep->e_next; + else + pp->p_dict = ep->e_next; + propelem_free(ep); + break; + } + } + } +} + +void props_clearvalues(t_props *pp) +{ + while (pp->p_dict) + { + t_propelem *ep = pp->p_dict->e_next; + propelem_free(pp->p_dict); + pp->p_dict = ep; + } +} + +/* LATER think about 'deep' cloning, i.e. propagating source atoms into + the destination buffer. Since cloning, unless requested by the user, + should never be persistent (source atoms should not stick to the + destination object in a .pd file), deep cloning requires introducing + a two-buffer scheme. There is no reason for deep cloning of arguments, + or handlers, but options could benefit. */ + +void props_clonevalues(t_props *to, t_props *from) +{ + if (to->p_resolver) + { + int ac; + t_atom *ap = props_getfirst(from, &ac); + while (ap) + { + props_dictadd(to, ap->a_w.w_symbol, ac - 1, ap + 1); + ap = props_getnext(from, &ac); + } + } +} + +static char *props_mixupinitial(t_props *pp, char c) +{ + t_props *pp1 = pp->p_firstmixup; + while (pp1) + { + if (pp1 != pp && pp1->p_thisescape == c) + return (pp1->p_thisinitial); + pp1 = pp1->p_next; + } + loudbug_bug("props_mixupinitial"); + loudbug_post("(%c \"%s\")", c, pp->p_mixupescapes); + return (0); +} + +/* If buf is pp's key, returns PROPS_THIS; otherwise, if PROPS_MULTIMODE + was passed and buf is a key of one of pp's mixups, returns PROPS_MIXUP; + otherwise, returns PROPS_NONE. */ +static int props_iskey(t_props *pp, int mode, char *buf) +{ + char *mixupinitial; + if (*buf == pp->p_thisescape) + { + char c = buf[1]; + if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') + || (pp->p_thisinitial && strchr(pp->p_thisinitial, c))) + return (PROPS_THIS); + } + else if (mode == PROPS_MULTIMODE && + *pp->p_mixupescapes && strchr(pp->p_mixupescapes, *buf)) + { + char c = buf[1]; + if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') + || ((mixupinitial = props_mixupinitial(pp, *buf)) + && *mixupinitial && strchr(mixupinitial, c))) + return (PROPS_MIXUP); + } + return (PROPS_NONE); +} + +/* Lookup (getone) and traversal (getfirst, getnext) of unresolved properties. + These calls return a pointer to the key atom (the contents follows it), + unlike the get/first/nextvalue calls, which return the (resolved) value. + Traversal is not thread-safe (will we need threaded props, LATER?) */ + +t_atom *props_getone(t_props *pp, t_symbol *keysym, int *npp) +{ + if (keysym && + props_iskey(pp, PROPS_SINGLEMODE, keysym->s_name) != PROPS_NONE) + { + int ibeg, iend = 0; + t_atom *ap; + for (ibeg = 0, ap = pp->p_buffer; ibeg < pp->p_natoms; ibeg++, ap++) + { + if (ap->a_type == A_SYMBOL && ap->a_w.w_symbol == keysym) + { + for (iend = ibeg + 1, ap++; iend < pp->p_natoms; iend++, ap++) + if (ap->a_type == A_SYMBOL && + props_iskey(pp, PROPS_SINGLEMODE, + ap->a_w.w_symbol->s_name) != PROPS_NONE) + break; + break; + } + } + if (iend > ibeg) + { + *npp = iend - ibeg; + return (pp->p_buffer + ibeg); + } + } + *npp = 0; + return (0); +} + +t_atom *props_getnext(t_props *pp, int *npp) +{ + if (pp->p_nextindex >= 0) + { + int ibeg = pp->p_nextindex; + t_atom *ap; + for (ap = pp->p_buffer + ibeg; ibeg < pp->p_natoms; ibeg++, ap++) + if (ap->a_type == A_SYMBOL && + props_iskey(pp, PROPS_SINGLEMODE, + ap->a_w.w_symbol->s_name) != PROPS_NONE) + break; + if (ibeg < pp->p_natoms) + { + int iend; + for (iend = ibeg + 1, ap++; iend < pp->p_natoms; iend++, ap++) + if (ap->a_type == A_SYMBOL && + props_iskey(pp, PROPS_SINGLEMODE, + ap->a_w.w_symbol->s_name) != PROPS_NONE) + break; + if (iend < pp->p_natoms) + pp->p_nextindex = iend; + else + pp->p_nextindex = -1; + *npp = iend - ibeg; + return (pp->p_buffer + ibeg); + } + else pp->p_nextindex = -1; + } + *npp = 0; + return (0); +} + +t_atom *props_getfirst(t_props *pp, int *npp) +{ + if (pp->p_nextindex >= 0) + loudbug_bug("props_getfirst"); + pp->p_nextindex = 0; + return (props_getnext(pp, npp)); +} + +t_atom *props_getall(t_props *pp, int *npp) +{ + *npp = pp->p_natoms; + return (pp->p_buffer); +} + +char *props_getname(t_props *pp) +{ + return (pp ? pp->p_name : "property"); +} + +/* Search for a property, replace its value if found, otherwise add. + If 'filter' contains an exact copy, do nothing. Assuming 'keysym' + is valid. Returning nafter - nbefore. */ +static int props_update(t_props *pp, int mode, t_props *filter, + t_symbol *keysym, int ac, t_atom *av, int doit) +{ + int nadd, ndiff, ibeg, iend = 0; + t_atom *ap; + for (nadd = 0, ap = av; nadd < ac; nadd++, ap++) + if (ap->a_type == A_SYMBOL && + props_iskey(pp, mode, ap->a_w.w_symbol->s_name) != PROPS_NONE) + break; + if (!nadd) + { + pp->p_badupdate = 1; + return (0); + } + pp->p_badupdate = 0; + nadd++; + + if (filter) + { + int acf; + t_atom *apf = props_getone(filter, keysym, &acf); + if (acf == nadd) + { + int i; +#ifdef PROPS_DEBUG + loudbug_startpost("checking %s", keysym->s_name); + loudbug_postatom(nadd - 1, av); +#endif + for (i = 1, ap = av, apf++; i < nadd; i++, ap++, apf++) + if (ap->a_type != apf->a_type || + ap->a_w.w_symbol != apf->a_w.w_symbol) + break; + if (i == nadd) +#ifndef PROPS_DEBUG + return (0); +#else + { + loudbug_post(" ... filtered"); + return (0); + } + else loudbug_post(" ... updated"); +#endif + } + } + + for (ibeg = 0, ap = pp->p_buffer; ibeg < pp->p_natoms; ibeg++, ap++) + { + if (ap->a_type == A_SYMBOL && ap->a_w.w_symbol == keysym) + { + for (iend = ibeg + 1, ap++; iend < pp->p_natoms; iend++, ap++) + if (ap->a_type == A_SYMBOL && + props_iskey(pp, PROPS_SINGLEMODE, + ap->a_w.w_symbol->s_name) != PROPS_NONE) + break; + break; + } + } + ndiff = (iend > ibeg ? nadd - (iend - ibeg) : nadd); + if (doit) + { + int i, newnatoms = pp->p_natoms + ndiff; + if (newnatoms > pp->p_size) + { + loudbug_bug("props_update"); + return (0); + } +#ifdef PROPS_DEBUG + loudbug_post("%s %s, [%d..%d), ndiff %d", + (iend > ibeg ? "replacing" : "adding"), keysym->s_name, + ibeg, iend, ndiff); +#endif + if (iend > ibeg) + { + if (ndiff > 0) + { + t_atom *ap2 = pp->p_buffer + newnatoms; + t_atom *ap1 = ap2 - ndiff; + for (i = iend; i < pp->p_natoms; i++) *--ap2 = *--ap1; + } + else if (ndiff < 0) + { + t_atom *ap2 = pp->p_buffer + iend; + t_atom *ap1 = ap2 + ndiff; + for (i = iend; i < pp->p_natoms; i++) *ap1++ = *ap2++; + } + ap = pp->p_buffer + ibeg; + } + else + { + ap = pp->p_buffer + pp->p_natoms; + SETSYMBOL(ap, keysym); + } + ap++; + nadd--; + if (pp->p_resolver) + props_dictadd(pp, keysym, nadd, av); + for (i = 0; i < nadd; i++) *ap++ = *av++; + pp->p_natoms = newnatoms; + } + return (ndiff); +} + +/* Carve out all properties of a given kind from a message. If in a single + mode, ignore `mixup' properties -- their keys are parsed through as values. + If there is an empty property, which is not to be ignored, do not parse + beyond. Return an offending key symbol, if any. */ +t_symbol *props_add(t_props *pp, int single, t_props *filter, + t_symbol *s, int ac, t_atom *av) +{ + t_symbol *empty = 0; + t_atom *av1, *ap; + int mode = (single ? PROPS_SINGLEMODE : PROPS_MULTIMODE); + int ac1, i, ngrown = 0; + if (!s || props_iskey(pp, PROPS_SINGLEMODE, s->s_name) == PROPS_NONE) + { + s = 0; + while (ac) + { + s = (av->a_type == A_SYMBOL ? av->a_w.w_symbol : 0); + ac--; av++; + if (s && + props_iskey(pp, PROPS_SINGLEMODE, s->s_name) != PROPS_NONE) + break; + s = 0; + } + } + if (!s || !ac) + { + empty = s; + goto done; + } + ngrown += props_update(pp, mode, filter, s, ac, av, 0); + if (pp->p_badupdate) + empty = s; + else for (i = 0, ap = av; i < ac; i++, ap++) + { + if (ap->a_type == A_SYMBOL && + props_iskey(pp, PROPS_SINGLEMODE, + ap->a_w.w_symbol->s_name) != PROPS_NONE) + { + ngrown += props_update(pp, mode, filter, ap->a_w.w_symbol, + ac - i - 1, ap + 1, 0); + if (pp->p_badupdate) + { + empty = ap->a_w.w_symbol; + break; + } + } + } + ngrown += pp->p_natoms; + if (ngrown > pp->p_size) + { + int nrequested = ngrown; + pp->p_buffer = grow_withdata(&nrequested, &pp->p_natoms, + &pp->p_size, pp->p_buffer, + PROPS_INISIZE, pp->p_bufini, + sizeof(*pp->p_buffer)); + if (nrequested != ngrown) + goto done; + } + props_update(pp, mode, filter, s, ac, av, 1); + if (pp->p_badupdate) + empty = s; + else for (i = 0, ap = av; i < ac; i++, ap++) + { + if (ap->a_type == A_SYMBOL && + props_iskey(pp, PROPS_SINGLEMODE, + ap->a_w.w_symbol->s_name) != PROPS_NONE) + { + props_update(pp, mode, filter, ap->a_w.w_symbol, + ac - i - 1, ap + 1, 1); + if (pp->p_badupdate) + { + empty = ap->a_w.w_symbol; + break; + } + } + } +done: + return (empty); +} + +int props_remove(t_props *pp, t_symbol *keysym) +{ + int ac; + t_atom *av = props_getone(pp, keysym, &ac); + if (keysym && *keysym->s_name) + props_removevalue(pp, keysym->s_name + 1); + if (av) + { + int i; + t_atom *ap = av + ac; + t_atom *guard = pp->p_buffer + pp->p_natoms; + while (ap < guard) *av++ = *ap++; + pp->p_natoms -= ac; + return (1); + } + else return (0); +} + +static void props_clearone(t_props *pp) +{ + pp->p_natoms = 0; + props_clearvalues(pp); +} + +void props_clearall(t_props *pp) +{ + if (pp && (pp = pp->p_firstmixup)) + { + while (pp) + { + props_clearone(pp); + pp = pp->p_next; + } + } + else loudbug_bug("props_clearall"); +} + +/* Compute pp0 = pp1 - pp2, using key-only equivalence. */ +void props_diff(t_props *pp0, t_props *pp1, t_props *pp2) +{ + int ac1; + t_atom *ap1 = props_getfirst(pp1, &ac1); + props_clearone(pp0); + while (ap1) + { + int ac2; + if (!props_getone(pp2, ap1->a_w.w_symbol, &ac2)) + props_add(pp0, 0, 0, 0, ac1, ap1); + ap1 = props_getnext(pp1, &ac1); + } +} + +static void props_freeone(t_props *pp) +{ + if (pp->p_buffer != pp->p_bufini) + freebytes(pp->p_buffer, pp->p_size * sizeof(*pp->p_buffer)); + props_clearvalues(pp); + freebytes(pp, sizeof(*pp)); +} + +void props_freeall(t_props *pp) +{ + if (pp && (pp = pp->p_firstmixup)) + { + while (pp) + { + t_props *pp1 = pp->p_next; + props_freeone(pp); + pp = pp1; + } + } + else loudbug_bug("props_freeall"); +} + +static void props_setupmixups(t_props *pp, t_props *mixup) +{ + t_props *pp1; + pp->p_next = (mixup ? mixup->p_firstmixup : 0); + for (pp1 = pp; pp1; pp1 = pp1->p_next) + { + t_props *pp2; + char *bp = pp1->p_mixupescapes; + int i; + pp1->p_firstmixup = pp; + for (pp2 = pp, i = 1; pp2 && i < PROPS_MAXMIXUPS; + pp2 = pp2->p_next, i++) + if (pp2 != pp1) + *bp++ = pp2->p_thisescape; + *bp = 0; +#ifdef PROPS_DEBUG + loudbug_startpost("%c \"%s\" ", pp1->p_thisescape, pp1->p_mixupescapes); +#endif + } +#ifdef PROPS_DEBUG + loudbug_endpost(); +#endif +} + +/* nonzero resolver requires the owner to be nonzero */ +t_props *props_new(t_pd *owner, char *name, char *thisdelim, + t_props *mixup, t_propsresolver resolver) +{ + t_props *pp = getbytes(sizeof(*pp)); + if (pp) + { + pp->p_name = name; + if (thisdelim && *thisdelim) + { + pp->p_thisescape = *thisdelim++; + pp->p_thisinitial = (*thisdelim ? thisdelim : 0); + } + else + { + loudbug_bug("props_new (no escape)"); + pp->p_thisescape = '-'; + pp->p_thisinitial = 0; + } + props_setupmixups(pp, mixup); + pp->p_size = PROPS_INISIZE; + pp->p_natoms = 0; + pp->p_buffer = pp->p_bufini; + pp->p_nextindex = -1; + if (pp->p_owner = owner) + pp->p_resolver = resolver; + else + { + if (resolver) + loudbug_bug("props_new (no owner)"); + pp->p_resolver = 0; + } + pp->p_dict = 0; + pp->p_nextelem = 0; + } + return (pp); +} diff --git a/externals/miXed/shared/common/props.h b/externals/miXed/shared/common/props.h new file mode 100644 index 000000000..c9d81a6d2 --- /dev/null +++ b/externals/miXed/shared/common/props.h @@ -0,0 +1,34 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __PROPS_H__ +#define __PROPS_H__ + +EXTERN_STRUCT _props; +#define t_props struct _props + +typedef char *(*t_propsresolver)(t_pd *, int, t_atom *); + +char *props_getvalue(t_props *pp, char *key); +char *props_firstvalue(t_props *pp, char **keyp); +char *props_nextvalue(t_props *pp, char **keyp); +void props_clearvalues(t_props *pp); +void props_clonevalues(t_props *to, t_props *from); + +t_atom *props_getone(t_props *pp, t_symbol *keysym, int *npp); +t_atom *props_getfirst(t_props *pp, int *npp); +t_atom *props_getnext(t_props *pp, int *npp); +t_atom *props_getall(t_props *pp, int *npp); +char *props_getname(t_props *pp); + +t_symbol *props_add(t_props *pp, int single, t_props *filter, + t_symbol *s, int ac, t_atom *av); +int props_remove(t_props *pp, t_symbol *keysym); +void props_diff(t_props *pp0, t_props *pp1, t_props *pp2); +void props_clearall(t_props *pp); +void props_freeall(t_props *pp); +t_props *props_new(t_pd *owner, char *name, char *thisdelim, + t_props *mixup, t_propsresolver resolver); + +#endif diff --git a/externals/miXed/shared/common/qtree.c b/externals/miXed/shared/common/qtree.c new file mode 100644 index 000000000..b749b3ae3 --- /dev/null +++ b/externals/miXed/shared/common/qtree.c @@ -0,0 +1,943 @@ +/* Copyright (c) 2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "loud.h" +#include "qtree.h" + +/* Since there is no sentinel node, the deletion routine has to have + a few extra checks. LATER rethink. */ + +/* LATER freelist */ + +typedef t_qnode *(*t_qtree_inserthook)(t_qnode *); + +#ifdef QTREE_DEBUG +/* returns black-height or 0 if failed */ +static int qnode_verify(t_qnode *np) +{ + if (np) + { + int bhl, bhr; + if (((bhl = qnode_verify(np->n_left)) == 0) || + ((bhr = qnode_verify(np->n_right)) == 0)) + return (0); + if (bhl != bhr) + { + /* failure: two paths rooted in the same node + contain different number of black nodes */ + loudbug_bug("qnode_verify: not balanced"); + return (0); + } + if (np->n_black) + return (bhl + 1); + else + { + if ((np->n_left && !np->n_left->n_black) || + (np->n_right && !np->n_right->n_black)) + { + loudbug_bug("qnode_verify: adjacent red nodes"); + return (0); + } + return (bhl); + } + } + else return (1); +} + +/* returns black-height or 0 if failed */ +static int qtree_verify(t_qtree *tree) +{ + return (qnode_verify(tree->t_root)); +} + +static int qnode_checkmulti(t_qnode *np1, t_qnode *np2) +{ + if (np1 && np2 && np1->n_key == np2->n_key) + { + if (np1 == np2) + loudbug_bug("qnode_checkmulti"); + else + return (1); + } + return (0); +} + +static void qnode_post(t_qtree *tree, t_qnode *np, + t_qnode_vshowhook hook, char *message) +{ + loudbug_startpost("%g ", np->n_key); + if (tree->t_valuetype == QTREETYPE_FLOAT) + loudbug_startpost("%g ", QNODE_GETFLOAT(np)); + else if (tree->t_valuetype == QTREETYPE_SYMBOL) + loudbug_startpost("%s ", QNODE_GETSYMBOL(np)->s_name); + else if (tree->t_valuetype == QTREETYPE_ATOM) + { + t_atom *ap = QNODE_GETATOMPTR(np); + if (ap->a_type == A_FLOAT) + loudbug_startpost("%g ", ap->a_w.w_float); + else if (ap->a_type == A_SYMBOL) + loudbug_startpost("%s ", ap->a_w.w_symbol->s_name); + } + else if (hook) + { + char buf[MAXPDSTRING]; + (*hook)(np, buf, MAXPDSTRING); + loudbug_startpost("%s ", buf); + } + else loudbug_startpost("0x%08x ", (int)QNODE_GETSYMBOL(np)); + loudbug_startpost("%s ", (np->n_black ? "black" : "red")); + + if (qnode_checkmulti(np, np->n_parent) || + qnode_checkmulti(np, np->n_left) || + qnode_checkmulti(np, np->n_right) || + qnode_checkmulti(np->n_parent, np->n_left) || + qnode_checkmulti(np->n_parent, np->n_right) || + qnode_checkmulti(np->n_left, np->n_right)) + loudbug_startpost("multi "); + + if (np->n_parent) + loudbug_startpost("(%g -> ", np->n_parent->n_key); + else + loudbug_startpost("(nul -> "); + if (np->n_left) + loudbug_startpost("%g, ", np->n_left->n_key); + else + loudbug_startpost("nul, "); + if (np->n_right) + loudbug_startpost("%g)", np->n_right->n_key); + else + loudbug_startpost("nul)"); + if (message) + loudbug_post(": %s", message); + else + loudbug_endpost(); +} + +/* Assert a standard stackless traversal producing the same sequence, + as the auxiliary list. */ +static int qtree_checktraversal(t_qtree *tree) +{ + t_qnode *treewalk = tree->t_root; + t_qnode *listwalk = tree->t_first; + int count = 0; + while (treewalk) + { + t_qnode *prev = treewalk->n_left; + if (prev) + { + while (prev->n_right && prev->n_right != treewalk) + prev = prev->n_right; + if (prev->n_right) + { + prev->n_right = 0; + count++; + if (treewalk == listwalk) + listwalk = listwalk->n_next; + else + { + loudbug_bug("qtree_checktraversal 1"); + qnode_post(tree, treewalk, 0, "treewalk"); + if (listwalk) + qnode_post(tree, listwalk, 0, "listwalk"); + else + loudbug_post("empty listwalk pointer"); + listwalk = treewalk; + } + treewalk = treewalk->n_right; + } + else + { + prev->n_right = treewalk; + treewalk = treewalk->n_left; + } + } + else + { + count++; + if (treewalk == listwalk) + listwalk = listwalk->n_next; + else + { + loudbug_bug("qtree_checktraversal 2"); + qnode_post(tree, treewalk, 0, "treewalk"); + if (listwalk) + qnode_post(tree, listwalk, 0, "listwalk"); + else + loudbug_post("empty listwalk pointer"); + listwalk = treewalk; + } + treewalk = treewalk->n_right; + } + } + return (count); +} + +static int qnode_height(t_qnode *np) +{ + if (np) + { + int lh = qnode_height(np->n_left); + int rh = qnode_height(np->n_right); + return (lh > rh ? lh + 1 : rh + 1); + } + else return (0); +} + +void qtree_debug(t_qtree *tree, int level, t_qnode_vshowhook hook) +{ + t_qnode *np; + int count; + loudbug_post("------------------------"); + count = qtree_checktraversal(tree); + if (level) + { + for (np = tree->t_first; np; np = np->n_next) + qnode_post(tree, np, hook, 0); + if (level > 1) + { + loudbug_post("************"); + for (np = tree->t_last; np; np = np->n_prev) + loudbug_startpost("%g ", np->n_key); + loudbug_endpost(); + } + } + if (tree->t_root) + { + t_qnode *first = tree->t_root, *last = tree->t_root; + while (first->n_left && first->n_left != tree->t_root) + first = first->n_left; + while (last->n_right && last->n_right != tree->t_root) + last = last->n_right; + loudbug_post("count %d, height %d, root %g", + count, qnode_height(tree->t_root), tree->t_root->n_key); + loudbug_post("first %g, root->left* %g, last %g, root->right* %g", + (tree->t_first ? tree->t_first->n_key : 0), first->n_key, + (tree->t_last ? tree->t_last->n_key : 0), last->n_key); + } + else loudbug_post("empty"); + loudbug_post("...verified (black-height is %d)", qtree_verify(tree)); + loudbug_post("------------------------"); +} +#endif + +/* assuming that target node (np->n_right) exists */ +static void qtree_lrotate(t_qtree *tree, t_qnode *np) +{ + t_qnode *target = np->n_right; + if (np->n_right = target->n_left) + np->n_right->n_parent = np; + if (!(target->n_parent = np->n_parent)) + tree->t_root = target; + else if (np == np->n_parent->n_left) + np->n_parent->n_left = target; + else + np->n_parent->n_right = target; + target->n_left = np; + np->n_parent = target; +} + +/* assuming that target node (np->n_left) exists */ +static void qtree_rrotate(t_qtree *tree, t_qnode *np) +{ + t_qnode *target = np->n_left; + if (np->n_left = target->n_right) + np->n_left->n_parent = np; + if (!(target->n_parent = np->n_parent)) + tree->t_root = target; + else if (np == np->n_parent->n_left) + np->n_parent->n_left = target; + else + np->n_parent->n_right = target; + target->n_right = np; + np->n_parent = target; +} + +static t_qnode *qtree_preinserthook(t_qnode *np) +{ + while (np->n_prev && np->n_prev->n_key == np->n_key) + np = np->n_prev; + if (np->n_left) + { + np = np->n_prev; + if (np->n_right) + { + /* LATER revisit */ + loudbug_bug("qtree_preinserthook"); + return (0); /* do nothing */ + } + } + return (np); +} + +static t_qnode *qtree_postinserthook(t_qnode *np) +{ + while (np->n_next && np->n_next->n_key == np->n_key) + np = np->n_next; + if (np->n_right) + { + np = np->n_next; + if (np->n_left) + { + /* LATER revisit */ + loudbug_bug("qtree_postinserthook"); + return (0); /* do nothing */ + } + } + return (np); +} + +/* Returns a newly inserted or already existing node (or 0 if allocation + failed). A caller is responsible for assigning a value. If hook is + supplied, it is called iff key is found. In case of key being found + (which means foundp returns 1), a new node is inserted, unless hook is + either empty, or returns null. Hook's nonempty return is the parent + for the new node. It is expected to have no more than one child. */ +static t_qnode *qtree_doinsert(t_qtree *tree, double key, t_qnode *preexisting, + t_qtree_inserthook hook, int *foundp) +{ + t_qnode *np, *parent, *result; + int leftchild; + *foundp = 0; + if (!(np = tree->t_root)) + { + if (!(np = (tree->t_nodesize > 0 ? + getbytes(tree->t_nodesize) : preexisting))) + { + if (tree->t_nodesize == 0) + loudbug_bug("qtree_insert, node not supplied"); + return (0); + } + np->n_key = key; + np->n_black = 1; + np->n_left = np->n_right = np->n_parent = 0; + tree->t_root = tree->t_first = tree->t_last = np; + np->n_prev = np->n_next = 0; + return (np); + } + + do + { + if (np->n_key == key) + { + *foundp = 1; + if (hook && (parent = (*hook)(np))) + { + if (parent->n_left && parent->n_right) + { + loudbug_bug("qtree_insert, callback return 1"); + parent = parent->n_next; + } + if (leftchild = (key < parent->n_key)) + { + if (parent->n_left) + { + loudbug_bug("qtree_insert, callback return 2"); + leftchild = 0; + } + } + else if (parent->n_right) + leftchild = 1; + goto addit; + } + else return (np); /* a caller may then keep or replace the value */ + } + else parent = np; + } + while (np = (key < np->n_key ? np->n_left : np->n_right)); + leftchild = (key < parent->n_key); +addit: + /* parent has no more than one child, new node becomes + parent's immediate successor or predecessor */ + if (!(np = (tree->t_nodesize > 0 ? + getbytes(tree->t_nodesize) : preexisting))) + { + if (tree->t_nodesize == 0) + loudbug_bug("qtree_insert, node not supplied"); + return (0); + } + np->n_key = key; + np->n_parent = parent; + if (leftchild) + { + parent->n_left = np; + /* update the auxiliary linked list structure */ + np->n_next = parent; + if (np->n_prev = parent->n_prev) + np->n_prev->n_next = np; + else + tree->t_first = np; + parent->n_prev = np; + } + else + { + parent->n_right = np; + /* update the auxiliary linked list structure */ + np->n_prev = parent; + if (np->n_next = parent->n_next) + np->n_next->n_prev = np; + else + tree->t_last = np; + parent->n_next = np; + } + result = np; + + /* balance the tree -- LATER clean this if possible... */ + np->n_black = 0; + while (np != tree->t_root && !np->n_parent->n_black) + { + t_qnode *uncle; + /* np->n_parent->n_parent exists (we always paint root node in black) */ + if (np->n_parent == np->n_parent->n_parent->n_left) + { + uncle = np->n_parent->n_parent->n_right; + if (!uncle /* (sentinel not used) */ + || uncle->n_black) + { + if (np == np->n_parent->n_right) + { + np = np->n_parent; + qtree_lrotate(tree, np); + } + np->n_parent->n_black = 1; + np->n_parent->n_parent->n_black = 0; + qtree_rrotate(tree, np->n_parent->n_parent); + } + else + { + np->n_parent->n_black = 1; + uncle->n_black = 1; + np = np->n_parent->n_parent; + np->n_black = 0; + } + } + else + { + uncle = np->n_parent->n_parent->n_left; + if (!uncle /* (sentinel not used) */ + || uncle->n_black) + { + if (np == np->n_parent->n_left) + { + np = np->n_parent; + qtree_rrotate(tree, np); + } + np->n_parent->n_black = 1; + np->n_parent->n_parent->n_black = 0; + qtree_lrotate(tree, np->n_parent->n_parent); + } + else + { + np->n_parent->n_black = 1; + uncle->n_black = 1; + np = np->n_parent->n_parent; + np->n_black = 0; + } + } + } + tree->t_root->n_black = 1; + return (result); +} + +/* assuming that requested node exists */ +void qtree_delete(t_qtree *tree, t_qnode *gone) +{ + t_qnode *parent; /* parent of gone, after relinking */ + t_qnode *child; /* gone's only child (or null), after relinking */ + /* gone has to be the parent of no more than one child */ + if (gone->n_left && gone->n_right) + { + /* Successor is the new parent of gone's children, and a new child + of gone's parent (if any). Successor always exists in this context, + and it has no left child. The simplistic scheme is to replace + gone's fields with successor's fields, and delete the successor. + We cannot do so, however, because 1. nodes may be caller-owned + (nodesize == 0), 2. successor may be pointed at... */ + t_qnode *successor = gone->n_next; + child = successor->n_right; + successor->n_left = gone->n_left; + successor->n_left->n_parent = successor; + if (successor == gone->n_right) + parent = successor; + else + { + /* successor's parent always exists in this context, + successor is the left child of its parent */ + parent = successor->n_parent; + parent->n_left = child; + if (child) /* (sentinel not used) */ + child->n_parent = parent; + successor->n_right = gone->n_right; + successor->n_right->n_parent = successor; + } + if (gone->n_parent) + { + int swp; + if (gone == gone->n_parent->n_left) + gone->n_parent->n_left = successor; + else + gone->n_parent->n_right = successor; + successor->n_parent = gone->n_parent; + swp = gone->n_black; + gone->n_black = successor->n_black; + successor->n_black = swp; + } + else + { + tree->t_root = successor; + successor->n_parent = 0; + gone->n_black = successor->n_black; + successor->n_black = 1; /* LATER rethink */ + } + + /* update the auxiliary linked list structure */ + if (successor->n_prev = gone->n_prev) + gone->n_prev->n_next = successor; + else + tree->t_first = successor; + } + else + { + /* update the auxiliary linked list structure */ + if (gone->n_prev) + gone->n_prev->n_next = gone->n_next; + else + tree->t_first = gone->n_next; + if (gone->n_next) + gone->n_next->n_prev = gone->n_prev; + else + tree->t_last = gone->n_prev; + + /* connect gone's child with gone's parent */ + if (gone->n_left) + child = gone->n_left; + else + child = gone->n_right; + if (parent = gone->n_parent) + { + if (child) /* (sentinel not used) */ + child->n_parent = parent; + if (gone == parent->n_left) + parent->n_left = child; + else + parent->n_right = child; + } + else + { + if (tree->t_root = child) + { + child->n_parent = 0; + child->n_black = 1; /* LATER rethink */ + } + goto done; + } + } + + if (gone->n_black) + { + /* balance the tree -- LATER clean this if possible... */ + /* on entry: tree is not empty, parent always exists, child + not necessarily... */ + while (child != tree->t_root && + (!child || /* (sentinel not used) */ + child->n_black)) + { + t_qnode *other; /* another child of the same parent */ + if (child == parent->n_left) + { + other = parent->n_right; + if (other && /* (sentinel not used) */ + !other->n_black) + { + other->n_black = 1; + parent->n_black = 0; + qtree_lrotate(tree, parent); + other = parent->n_right; + } + if (!other || /* (sentinel not used) */ + (!other->n_left || other->n_left->n_black) && + (!other->n_right || other->n_right->n_black)) + { + if (other) /* (sentinel not used) */ + other->n_black = 0; + child = parent; + parent = parent->n_parent; + } + else + { + if (!other || /* (sentinel not used) */ + !other->n_right || other->n_right->n_black) + { + if (other) /* (sentinel not used) */ + { + if (other->n_left) other->n_left->n_black = 1; + other->n_black = 0; + qtree_rrotate(tree, other); + other = parent->n_right; + } + } + if (other) /* (sentinel not used) */ + { + if (other->n_right) other->n_right->n_black = 1; + other->n_black = parent->n_black; + } + parent->n_black = 1; + qtree_lrotate(tree, parent); + tree->t_root->n_black = 1; /* LATER rethink */ + goto done; + } + } + else /* right child */ + { + other = parent->n_left; + if (other && /* (sentinel not used) */ + !other->n_black) + { + other->n_black = 1; + parent->n_black = 0; + qtree_rrotate(tree, parent); + other = parent->n_left; + } + if (!other || /* (sentinel not used) */ + (!other->n_left || other->n_left->n_black) && + (!other->n_right || other->n_right->n_black)) + { + if (other) /* (sentinel not used) */ + other->n_black = 0; + child = parent; + parent = parent->n_parent; + } + else + { + if (!other || /* (sentinel not used) */ + !other->n_left || other->n_left->n_black) + { + if (other) /* (sentinel not used) */ + { + if (other->n_right) other->n_right->n_black = 1; + other->n_black = 0; + qtree_lrotate(tree, other); + other = parent->n_left; + } + } + if (other) /* (sentinel not used) */ + { + if (other->n_left) other->n_left->n_black = 1; + other->n_black = parent->n_black; + } + parent->n_black = 1; + qtree_rrotate(tree, parent); + tree->t_root->n_black = 1; /* LATER rethink */ + goto done; + } + } + } + if (child) /* (sentinel not used) */ + child->n_black = 1; + } +done: + if (tree->t_nodesize) + freebytes(gone, tree->t_nodesize); +#ifdef QTREE_DEBUG + qtree_verify(tree); +#endif +} + +t_qnode *qtree_search(t_qtree *tree, double key) +{ + t_qnode *np = tree->t_root; + while (np && np->n_key != key) + np = (key < np->n_key ? np->n_left : np->n_right); + return (np); +} + +/* Returns the greatest node <= key, if any (may return null). + If deltap is not null, it will hold the abs diff (key - node.n_key). */ +t_qnode *qtree_closestunder(t_qtree *tree, double key, double *deltap) +{ + t_qnode *np, *parent; + if (!(np = tree->t_root)) + return (0); + do + if (np->n_key == key) + { + if (deltap) + *deltap = 0.; + return (np); + } + else parent = np; + while (np = (key < np->n_key ? np->n_left : np->n_right)); + if (np = (key < parent->n_key ? parent->n_prev : parent)) + { + if (deltap) + *deltap = key - np->n_key; + return (np); + } + else return (0); +} + +/* Returns the smallest node >= key, if any (may return null). + If deltap is not null, it will hold the abs diff (node.n_key - key). */ +t_qnode *qtree_closestover(t_qtree *tree, double key, double *deltap) +{ + t_qnode *np, *parent; + if (!(np = tree->t_root)) + return (0); + do + if (np->n_key == key) + { + if (deltap) + *deltap = 0.; + return (np); + } + else parent = np; + while (np = (key < np->n_key ? np->n_left : np->n_right)); + if (np = (key > parent->n_key ? parent->n_next : parent)) + { + if (deltap) + *deltap = np->n_key - key; + return (np); + } + else return (0); +} + +/* Returns the smallest node >= key or the greatest node <= key, whichever + makes the smallest abs diff, |key - node.n_key|. Returns null only for + an empty tree. If deltap is not null, it will hold the signed diff + (negative for an undernode, i.e. when node < key). */ +t_qnode *qtree_closest(t_qtree *tree, double key, double *deltap) +{ + t_qnode *np, *parent; + if (!(np = tree->t_root)) + return (0); + do + if (np->n_key == key) + { + if (deltap) + *deltap = 0.; + return (np); + } + else parent = np; + while (np = (key < np->n_key ? np->n_left : np->n_right)); + if (key > parent->n_key) + { + if (np = parent->n_next) + { + double delta1 = key - parent->n_key; + double delta2 = np->n_key - key; + if (delta1 < delta2) + { + if (deltap) + *deltap = -delta1; + return (parent); + } + else + { + if (deltap) + *deltap = delta2; + return (np); + } + } + else + { + if (deltap) + *deltap = parent->n_key - key; + return (parent); + } + } + else + { + if (np = parent->n_prev) + { + double delta1 = key - np->n_key; + double delta2 = parent->n_key - key; + if (delta1 < delta2) + { + if (deltap) + *deltap = -delta1; + return (np); + } + else + { + if (deltap) + *deltap = delta2; + return (parent); + } + } + else + { + if (deltap) + *deltap = parent->n_key - key; + return (parent); + } + } +} + +t_qnode *qtree_insert(t_qtree *tree, double key, + t_qnode *preexisting, int *foundp) +{ + int found; + return (qtree_doinsert(tree, key, preexisting, 0, + (foundp ? foundp : &found))); +} + +t_qnode *qtree_multiinsert(t_qtree *tree, double key, + t_qnode *preexisting, int fifoflag) +{ + int found; + return (qtree_doinsert(tree, key, preexisting, + (fifoflag ? + qtree_postinserthook : + qtree_preinserthook), &found)); +} + +t_qnode *qtree_override(t_qtree *tree, t_qnode *oldnode, t_qnode *newnode) +{ + if (tree->t_nodesize) + { + loudbug_bug("qtree_override 1"); + return (0); + } + else + { + newnode->n_key = oldnode->n_key; + newnode->n_black = oldnode->n_black; + if (newnode->n_left = oldnode->n_left) + newnode->n_left->n_parent = newnode; + if (newnode->n_right = oldnode->n_right) + newnode->n_right->n_parent = newnode; + if (newnode->n_parent = oldnode->n_parent) + { + if (oldnode == newnode->n_parent->n_left) + newnode->n_parent->n_left = newnode; + else if (oldnode == newnode->n_parent->n_right) + newnode->n_parent->n_right = newnode; + else + loudbug_bug("qtree_override 2"); + } + if (newnode->n_prev = oldnode->n_prev) + newnode->n_prev->n_next = newnode; + if (newnode->n_next = oldnode->n_next) + newnode->n_next->n_prev = newnode; + if (tree->t_root == oldnode) + tree->t_root = newnode; + if (tree->t_first == oldnode) + tree->t_first = newnode; + if (tree->t_last == oldnode) + tree->t_last = newnode; + return (newnode); + } +} + +t_qnode *qtree_insertfloat(t_qtree *tree, double key, t_float f, + int replaceflag) +{ + int found; + t_qnode *np = qtree_doinsert(tree, key, 0, 0, &found); + if (np && (!found || replaceflag)) + { + if (tree->t_valuetype == QTREETYPE_FLOAT) + { + t_qnode_float *npf = (t_qnode_float *)np; + npf->nf_value = f; + } + else if (tree->t_valuetype == QTREETYPE_ATOM) + { + t_qnode_atom *npa = (t_qnode_atom *)np; + t_atom *ap = &npa->na_value; + SETFLOAT(ap, f); + } + else loudbug_bug("qtree_insertfloat"); + } + return (np); +} + +t_qnode *qtree_insertsymbol(t_qtree *tree, double key, t_symbol *s, + int replaceflag) +{ + int found; + t_qnode *np = qtree_doinsert(tree, key, 0, 0, &found); + if (np && (!found || replaceflag)) + { + if (tree->t_valuetype == QTREETYPE_SYMBOL) + { + t_qnode_symbol *nps = (t_qnode_symbol *)np; + nps->ns_value = s; + } + else if (tree->t_valuetype == QTREETYPE_ATOM) + { + t_qnode_atom *npa = (t_qnode_atom *)np; + t_atom *ap = &npa->na_value; + SETSYMBOL(ap, s); + } + else loudbug_bug("qtree_insertsymbol"); + } + return (np); +} + +t_qnode *qtree_insertatom(t_qtree *tree, double key, t_atom *ap, + int replaceflag) +{ + int found; + t_qnode *np = qtree_doinsert(tree, key, 0, 0, &found); + if (np && (!found || replaceflag)) + { + if (tree->t_valuetype == QTREETYPE_ATOM) + { + t_qnode_atom *npa = (t_qnode_atom *)np; + npa->na_value = *ap; + } + else loudbug_bug("qtree_insertatom"); + } + return (np); +} + +/* LATER preallocate 'freecount' nodes */ +static void qtree_doinit(t_qtree *tree, t_qtreetype vtype, + size_t nodesize, int freecount) +{ + tree->t_root = tree->t_first = tree->t_last = 0; + tree->t_valuetype = vtype; + tree->t_nodesize = nodesize; +} + +void qtree_inittyped(t_qtree *tree, t_qtreetype vtype, int freecount) +{ + size_t nsize; + switch (vtype) + { + case QTREETYPE_FLOAT: + nsize = sizeof(t_qnode_float); + break; + case QTREETYPE_SYMBOL: + nsize = sizeof(t_qnode_symbol); + break; + case QTREETYPE_ATOM: + nsize = sizeof(t_qnode_atom); + break; + default: + loudbug_bug("qtree_inittyped"); + vtype = QTREETYPE_ILLEGAL; + nsize = sizeof(t_qnode); + } + qtree_doinit(tree, vtype, nsize, freecount); +} + +void qtree_initcustom(t_qtree *tree, size_t nodesize, int freecount) +{ + qtree_doinit(tree, QTREETYPE_CUSTOM, nodesize, freecount); +} + +/* LATER keep and/or preallocate 'freecount' nodes (if negative, keep all) */ +void qtree_clear(t_qtree *tree, int freecount) +{ + t_qnode *np, *next = tree->t_first; + while (np = next) + { + next = next->n_next; + if (tree->t_nodesize) + freebytes(np, tree->t_nodesize); + } + qtree_doinit(tree, tree->t_valuetype, tree->t_nodesize, 0); +} diff --git a/externals/miXed/shared/common/qtree.h b/externals/miXed/shared/common/qtree.h new file mode 100644 index 000000000..18e409878 --- /dev/null +++ b/externals/miXed/shared/common/qtree.h @@ -0,0 +1,88 @@ +/* Copyright (c) 2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __QTREE_H__ +#define __QTREE_H__ + +#ifdef KRZYSZCZ +#define QTREE_DEBUG +#endif + +typedef enum +{ + QTREETYPE_FLOAT, QTREETYPE_SYMBOL, QTREETYPE_ATOM, + QTREETYPE_CUSTOM, QTREETYPE_ILLEGAL +} t_qtreetype; + +typedef struct _qnode +{ + double n_key; + int n_black; + struct _qnode *n_left; + struct _qnode *n_right; + struct _qnode *n_parent; + struct _qnode *n_prev; + struct _qnode *n_next; +} t_qnode; + +typedef struct _qnode_float +{ + t_qnode nf_node; + t_float nf_value; +} t_qnode_float; + +typedef struct _qnode_symbol +{ + t_qnode ns_node; + t_symbol *ns_value; +} t_qnode_symbol; + +typedef struct _qnode_atom +{ + t_qnode na_node; + t_atom na_value; +} t_qnode_atom; + +typedef struct _qtree +{ + t_qnode *t_root; + t_qnode *t_first; + t_qnode *t_last; + t_qtreetype t_valuetype; + size_t t_nodesize; +} t_qtree; + +#define QNODE_GETFLOAT(np) (((t_qnode_float *)(np))->nf_value) +#define QNODE_GETSYMBOL(np) (((t_qnode_symbol *)(np))->ns_value) +#define QNODE_GETATOMPTR(np) (&((t_qnode_atom *)(np))->na_value) + +typedef void (*t_qnode_vshowhook)(t_qnode *, char *, unsigned); + +t_qnode *qtree_search(t_qtree *tree, double key); +t_qnode *qtree_closestunder(t_qtree *tree, double key, double *deltap); +t_qnode *qtree_closestover(t_qtree *tree, double key, double *deltap); +t_qnode *qtree_closest(t_qtree *tree, double key, double *deltap); + +t_qnode *qtree_insert(t_qtree *tree, double key, + t_qnode *preexisting, int *foundp); +t_qnode *qtree_multiinsert(t_qtree *tree, double key, + t_qnode *preexisting, int fifoflag); +t_qnode *qtree_override(t_qtree *tree, t_qnode *oldnode, t_qnode *newnode); +t_qnode *qtree_insertfloat(t_qtree *tree, double key, t_float f, + int replaceflag); +t_qnode *qtree_insertsymbol(t_qtree *tree, double key, t_symbol *s, + int replaceflag); +t_qnode *qtree_insertatom(t_qtree *tree, double key, t_atom *ap, + int replaceflag); +void qtree_delete(t_qtree *tree, t_qnode *np); + +void qtree_inittyped(t_qtree *tree, t_qtreetype vtype, int freecount); +void qtree_initcustom(t_qtree *tree, size_t nodesize, int freecount); +void qtree_clear(t_qtree *tree, int freecount); + +#ifdef QTREE_DEBUG +void qtree_debug(t_qtree *tree, int level, t_qnode_vshowhook hook); +#endif + +#endif diff --git a/externals/miXed/shared/common/rand.c b/externals/miXed/shared/common/rand.c new file mode 100644 index 000000000..4a54b3a24 --- /dev/null +++ b/externals/miXed/shared/common/rand.c @@ -0,0 +1,69 @@ +/* Copyright (c) 1997-2004 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <time.h> +#include "m_pd.h" +EXTERN double sys_getrealtime(void); /* used to be in m_imp.h */ +#include "rand.h" + +/* borrowed from x_misc.c, LATER rethink */ +void rand_seed(unsigned int *statep, unsigned int seed) +{ + if (seed) *statep = (seed & 0x7fffffff); + else + { + /* LATER consider using time elapsed from system startup, + (or login -- in linux we might call getutent) */ + static unsigned int failsafe = 1489853723; + static int shift = 0; + static unsigned int lastticks = 0; + /* LATER rethink -- it might fail on faster machine than mine + (but does it matter?) */ + unsigned int newticks = (unsigned int)(sys_getrealtime() * 1000000.); + if (newticks == lastticks) + { + failsafe = failsafe * 435898247 + 938284287; + *statep = (failsafe & 0x7fffffff); +#ifdef RAND_DEBUG + post("rand_seed failed (newticks %d)", newticks); +#endif + } + else + { + if (!shift) + shift = (int)time(0); /* LATER deal with error return (-1) */ + *statep = ((newticks + shift) & 0x7fffffff); +#if 0 + post("rand_seed: newticks %d, shift %d", newticks, shift); +#endif + } + lastticks = newticks; + } +} + +/* borrowed from x_misc.c, LATER rethink */ +int rand_int(unsigned int *statep, int range) +{ + int result; + *statep = *statep * 472940017 + 832416023; + result = ((double)range) * ((double)*statep) * (1./4294967296.); + return (result < range ? result : range - 1); +} + +float rand_unipolar(unsigned int *statep) +{ + float result; + *statep = *statep * 472940017 + 832416023; + result = (float)((double)*statep * (1./4294967296.)); + return (result); +} + +/* borrowed from d_osc.c, LATER rethink */ +float rand_bipolar(unsigned int *statep) +{ + float result = ((float)(((int)*statep & 0x7fffffff) - 0x40000000)) + * (float)(1.0 / 0x40000000); + *statep = (unsigned)((int)*statep * 435898247 + 382842987); + return (result); +} diff --git a/externals/miXed/shared/common/rand.h b/externals/miXed/shared/common/rand.h new file mode 100644 index 000000000..1590869b2 --- /dev/null +++ b/externals/miXed/shared/common/rand.h @@ -0,0 +1,15 @@ +/* Copyright (c) 2002-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __RAND_H__ +#define __RAND_H__ + +#define RAND_DEBUG + +void rand_seed(unsigned int *statep, unsigned int seed); +int rand_int(unsigned int *statep, int range); +float rand_unipolar(unsigned int *statep); +float rand_bipolar(unsigned int *statep); + +#endif diff --git a/externals/miXed/shared/common/vefl.c b/externals/miXed/shared/common/vefl.c new file mode 100644 index 000000000..5510654ef --- /dev/null +++ b/externals/miXed/shared/common/vefl.c @@ -0,0 +1,231 @@ +/* Copyright (c) 1997-2003 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* The simplest of garrays: vector of floats */ + +/* Array checking is done in three points: + 1. vefl_new(): never complains + 2. vefl_renew(): this should be called once per every message + 3. vefl_tick(): no template checking (only redraw is involved) +*/ + +/* LATER rethink indsp flag */ + +#include "m_pd.h" +#include "g_canvas.h" +#include "shared.h" +#include "unstable/fragile.h" +#include "common/loud.h" +#include "vefl.h" + +#ifdef KRZYSZCZ +//#define VEFL_DEBUG +#endif +#define VEFL_VERBOSE + +/* on failure *vszp is not modified */ +t_float *vefl_get(t_symbol *name, int *vszp, int indsp, t_pd *complain) +{ + if (name && name != &s_) + { + t_garray *ap = (t_garray *)pd_findbyclass(name, garray_class); + if (ap) + { + int vsz; + t_float *vec; + if (garray_getfloatarray(ap, &vsz, &vec)) + { + if (indsp) garray_usedindsp(ap); + if (vszp) *vszp = vsz; + return (vec); + } + else loud_error(complain, /* always complain */ + "bad template of array '%s'", name->s_name); + } + else if (complain) + loud_error(complain, "no such array '%s'", name->s_name); + } + return (0); +} + +static void vefl_tick(t_vefl *vp) +{ + if (vp->v_name && vp->v_name != &s_ + /* Check if an array has not been deleted + (e.g. during patch closing sequence). */ + && (vp->v_garray = + (t_garray *)pd_findbyclass(vp->v_name, garray_class))) + { + vp->v_glist = fragile_garray_glist(vp->v_garray); + garray_redraw(vp->v_garray); + } + vp->v_clockset = 0; + vp->v_updtime = clock_getsystime(); +} + +t_vefl *vefl_placement_new(t_vefl *vp, t_symbol *name, + int writable, t_glist *gl, t_garray *arr) +{ + if (sizeof(t_word) != sizeof(t_float)) + { + loudbug_bug("vefl_new: sizeof(t_word) != sizeof(t_float)"); + return (0); + } + if (!vp) + { + if (!(vp = getbytes(sizeof(*vp)))) + return (0); + vp->v_autoalloc = 1; + } + else vp->v_autoalloc = 0; + vp->v_name = name; + if (writable) + { + vp->v_updtime = clock_getsystime(); + vp->v_clock = clock_new(vp, (t_method)vefl_tick); + vp->v_clockset = 0; + } + else vp->v_clock = 0; + vp->v_glist = gl; + vp->v_garray = arr; + vp->v_size = 0; + vp->v_data = 0; + vp->v_type = &s_float; + if (!arr && name && name != &s_) + { + vp->v_garray = (t_garray *)pd_findbyclass(name, garray_class); + vp->v_glist = vp->v_garray ? fragile_garray_glist(vp->v_garray) : 0; + } + if (vp->v_garray + && !garray_getfloatarray(vp->v_garray, &vp->v_size, &vp->v_data)) + { + vp->v_glist = 0; + vp->v_garray = 0; + vp->v_type = 0; /* template mismatch */ + } + return (vp); +} + +t_vefl *vefl_new(t_symbol *name, int writable, t_glist *gl, t_garray *arr) +{ + return (vefl_placement_new(0, name, writable, gl, arr)); +} + +void vefl_free(t_vefl *vp) +{ + if (vp->v_clock) clock_free(vp->v_clock); + if (vp->v_autoalloc) freebytes(vp, sizeof(*vp)); +} + +/* LATER handle yonset */ +int vefl_renew(t_vefl *vp, t_symbol *name, t_pd *complain) +{ + if (!name || name == &s_) name = vp->v_name; + if (name && name != &s_) + { + vp->v_glist = 0; + /* There are three possible ways: */ +#if 0 + vp->v_name = 0; +#elif 1 /* , do nothing, and */ + vp->v_name = name; +#endif /* LATER check all the cases and decide... */ + if (!(vp->v_garray = (t_garray *)pd_findbyclass(name, garray_class))) + { + if (complain) + loud_error(complain, "no such array '%s'", name->s_name); + } + else if (!garray_getfloatarray(vp->v_garray, &vp->v_size, &vp->v_data)) + { + vp->v_garray = 0; + loud_error(complain, /* always complain */ + "bad template of array '%s'", name->s_name); + } + else + { + vp->v_glist = fragile_garray_glist(vp->v_garray); + vp->v_name = name; + return (1); + } + } + return (0); +} + +void vefl_redraw(t_vefl *vp, float suppresstime) +{ + if (vp->v_clock) /* requests from readers are ignored */ + { + if (suppresstime > 0) + { + double timesince = clock_gettimesince(vp->v_updtime); + if (timesince > suppresstime) + { + clock_unset(vp->v_clock); + vefl_tick(vp); + } + else if (!vp->v_clockset) + { + clock_delay(vp->v_clock, suppresstime - timesince); + vp->v_clockset = 1; + } + } + else { + clock_unset(vp->v_clock); + vefl_tick(vp); + } + } +} + +void vefl_redraw_stop(t_vefl *vp) +{ + if (vp->v_clock) /* requests from readers are ignored */ + { + clock_unset(vp->v_clock); + vp->v_clockset = 0; + } +} + +/* Y-bounds flipped here */ +void vefl_getbounds(t_vefl *vp, t_float *xminp, t_float *yminp, + t_float *xmaxp, t_float *ymaxp) +{ + t_glist *gl = vp->v_glist; + if (gl) + { + *xminp = gl->gl_x1; + *xmaxp = gl->gl_x2; + *yminp = gl->gl_y2; + *ymaxp = gl->gl_y1; + } +} + +/* Y-bounds flipped here */ +void vefl_setbounds(t_vefl *vp, t_float xmin, t_float ymin, + t_float xmax, t_float ymax) +{ + vmess((t_pd *)vp->v_glist, gensym("bounds"), "ffff", + xmin, ymax, xmax, ymin); +} + +void vefl_getrange(t_vefl *vp, t_float *yminp, t_float *ymaxp) +{ + int vsz = vp->v_size; + t_float *vec = vp->v_data; + if (vec && vsz) + { + t_float ymin = SHARED_FLT_MAX, ymax = -SHARED_FLT_MAX; + while (vsz--) + { + if (*vec > ymax) + { + ymax = *vec; + if (ymax < ymin) ymin = ymax; + } + else if (*vec < ymin) ymin = *vec; + vec++; + } + *yminp = ymin; + *ymaxp = ymax; + } +} diff --git a/externals/miXed/shared/common/vefl.h b/externals/miXed/shared/common/vefl.h new file mode 100644 index 000000000..e470a8015 --- /dev/null +++ b/externals/miXed/shared/common/vefl.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2001-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __VEFL_H__ +#define __VEFL_H__ + +typedef struct _vefl +{ + int v_autoalloc; + t_symbol *v_name; + t_glist *v_glist; + t_garray *v_garray; + int v_size; + t_float *v_data; + t_symbol *v_type; + t_clock *v_clock; + int v_clockset; + double v_updtime; +} t_vefl; + +t_float *vefl_get(t_symbol *name, int *vszp, int indsp, t_pd *complain); +t_vefl *vefl_new(t_symbol *name, int writable, t_glist *gl, t_garray *arr); +t_vefl *vefl_placement_new(t_vefl *vp, t_symbol *name, + int writable, t_glist *gl, t_garray *arr); +void vefl_free(t_vefl *vp); +int vefl_renew(t_vefl *vp, t_symbol *name, t_pd *complain); +void vefl_redraw(t_vefl *vp, float suppresstime); +void vefl_redraw_stop(t_vefl *vp); +void vefl_getbounds(t_vefl *vp, t_float *xminp, t_float *yminp, + t_float *xmaxp, t_float *ymaxp); +void vefl_setbounds(t_vefl *vp, t_float xmin, t_float ymin, + t_float xmax, t_float ymax); +void vefl_getrange(t_vefl *vp, t_float *yminp, t_float *ymaxp); + +#endif diff --git a/externals/miXed/shared/getridof.baddeps b/externals/miXed/shared/getridof.baddeps new file mode 100644 index 000000000..2886622a0 --- /dev/null +++ b/externals/miXed/shared/getridof.baddeps @@ -0,0 +1,22 @@ +This is the list of all dependencies among miXed/shared objects. +Some are inevitable, but others can, and should be removed. + +unstable/fragile -> common/loud +unstable/fringe -> unstable/forky +unstable/loader -> common/os common/loud +common/props -> common/grow common/loud +common/vefl -> common/loud, unstable/fragile +common/messtree -> common/loud +common/qtree -> common/loud +common/binport -> common/lex +common/port -> common/loud, common/grow, common/binport, + unstable/forky, unstable/fragile, unstable/fringe +hammer/file -> common/os unstable/forky +sickle/sic -> common/loud +sickle/arsic -> common/loud, common/vefl, sickle/sic, unstable/fragile +toxy/plusbob -> common/loud +toxy/scriptlet -> common/loud, common/grow, common/props +xeq/squ* -> common/loud, common/dict, common/qtree, common/messtree, + common/mifi, xeq/squ* +vex/hyphen -> common/dict +vex/sofi -> vex/bifi diff --git a/externals/miXed/shared/hammer/Makefile b/externals/miXed/shared/hammer/Makefile new file mode 100644 index 000000000..5dcb2c8cc --- /dev/null +++ b/externals/miXed/shared/hammer/Makefile @@ -0,0 +1,4 @@ +ROOT_DIR = ../.. +include $(ROOT_DIR)/Makefile.common + +all: $(OBJECTS) diff --git a/externals/miXed/shared/hammer/Makefile.objects b/externals/miXed/shared/hammer/Makefile.objects new file mode 100644 index 000000000..e69de29bb diff --git a/externals/miXed/shared/hammer/Makefile.sources b/externals/miXed/shared/hammer/Makefile.sources new file mode 100644 index 000000000..5a6d99a2c --- /dev/null +++ b/externals/miXed/shared/hammer/Makefile.sources @@ -0,0 +1,4 @@ +OTHER_SOURCES = \ +file.c \ +gui.c \ +tree.c diff --git a/externals/miXed/shared/hammer/file.c b/externals/miXed/shared/hammer/file.c new file mode 100644 index 000000000..096493756 --- /dev/null +++ b/externals/miXed/shared/hammer/file.c @@ -0,0 +1,593 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* The three uses of the 'hammerfile' proxy class are: + 1. providing `embedding' facility -- storing master object's state + in a .pd file, + 2. encapsulating openpanel/savepanel management, + 3. extending the gui of Pd with a simple text editor window. + + A master class which needs embedding feature (like coll), passes + a nonzero flag to the hammerfile setup routine, and a nonzero embedfn + function pointer to the hammerfile constructor. If a master needs + access to the panels (like collcommon), then it passes nonzero readfn + and/or writefn callback pointers to the constructor. A master which has + an associated text editor, AND wants to update object's state after + edits, passes a nonzero updatefn callback in a call to the constructor. + + LATER extract the embedding stuff. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/os.h" +#include "unstable/forky.h" +#include "hammer/file.h" + +struct _hammerfile +{ + t_pd f_pd; + t_pd *f_master; + t_canvas *f_canvas; + t_symbol *f_bindname; + t_symbol *f_currentdir; + t_symbol *f_inidir; + t_symbol *f_inifile; + t_hammerfilefn f_panelfn; + t_hammerfilefn f_editorfn; + t_hammerembedfn f_embedfn; + t_binbuf *f_binbuf; + t_clock *f_panelclock; + t_clock *f_editorclock; + struct _hammerfile *f_savepanel; + struct _hammerfile *f_next; +}; + +static t_class *hammerfile_class = 0; +static t_hammerfile *hammerfile_proxies; +static t_symbol *ps__C; + +static t_hammerfile *hammerfile_getproxy(t_pd *master) +{ + t_hammerfile *f; + for (f = hammerfile_proxies; f; f = f->f_next) + if (f->f_master == master) + return (f); + return (0); +} + +static void hammereditor_guidefs(void) +{ + sys_gui("proc hammereditor_open {name geometry title sendable} {\n"); + sys_gui(" if {[winfo exists $name]} {\n"); + sys_gui(" $name.text delete 1.0 end\n"); + sys_gui(" wm deiconify $name\n"); + sys_gui(" raise $name\n"); + sys_gui(" focus $name\n"); + sys_gui(" } else {\n"); + sys_gui(" toplevel $name -class [winfo class .]\n"); + sys_gui(" wm title $name $title\n"); + sys_gui(" wm geometry $name $geometry\n"); + sys_gui(" text $name.text -relief sunken -bd 1 \\\n"); + sys_gui(" -font console_font \\\n"); + sys_gui(" -highlightthickness 0 -takefocus 0 \\\n"); + sys_gui(" -yscrollcommand \"$name.scroll set\" -background white\n"); + sys_gui(" ttk::scrollbar $name.scroll -command \"$name.text yview\"\n"); + sys_gui(" pack $name.scroll -side right -fill y\n"); + sys_gui(" pack $name.text -side left -fill both -expand 1\n"); + sys_gui(" bind $name <Control-a> [concat $name.text tag add sel 1.0 end]\n"); + sys_gui(" bind $name <Control-s> [concat hammereditor_send $name]\n"); + sys_gui(" bind $name <Control-w> [concat hammereditor_keyboard_close $name]\n"); + sys_gui(" if {$sendable} {\n"); + sys_gui(" wm protocol $name WM_DELETE_WINDOW \\\n"); + sys_gui(" [concat hammereditor_close $name 1]\n"); + sys_gui(" bind $name <<Modified>> \"hammereditor_dodirty $name\"\n"); + sys_gui(" }\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + sys_gui("proc hammereditor_dodirty {name} {\n"); + sys_gui(" if {[catch {$name.text edit modified} dirty]} {set dirty 1}\n"); + sys_gui(" set title [wm title $name]\n"); + sys_gui(" set dt [string equal -length 1 $title \"*\"]\n"); + sys_gui(" if {$dirty} {\n"); + sys_gui(" if {$dt == 0} {wm title $name *$title}\n"); + sys_gui(" } else {\n"); + sys_gui(" if {$dt} {wm title $name [string range $title 1 end]}\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + sys_gui("proc hammereditor_setdirty {name flag} {\n"); + sys_gui(" if {[winfo exists $name]} {\n"); + sys_gui(" catch {$name.text edit modified $flag}\n"); + sys_gui(" hammereditor_dodirty $name\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + sys_gui("proc hammereditor_doclose {name} {\n"); + sys_gui(" destroy $name\n"); + sys_gui("}\n"); + + sys_gui("proc hammereditor_append {name contents} {\n"); + sys_gui(" if {[winfo exists $name]} {\n"); + sys_gui(" $name.text insert end $contents\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + /* FIXME make it more reliable */ + sys_gui("proc hammereditor_send {name} {\n"); + sys_gui(" if {[winfo exists $name]} {\n"); + sys_gui(" pd [concat miXed$name clear \\;]\n"); + sys_gui(" for {set i 1} \\\n"); + sys_gui(" {[$name.text compare $i.end < end]} \\\n"); + sys_gui(" {incr i 1} {\n"); + sys_gui(" set lin [$name.text get $i.0 $i.end]\n"); + sys_gui(" if {$lin != \"\"} {\n"); + /* LATER rethink semi/comma mapping */ + sys_gui(" regsub -all \\; $lin \" _semi_ \" tmplin\n"); + sys_gui(" regsub -all \\, $tmplin \" _comma_ \" lin\n"); + sys_gui(" pd [concat miXed$name addline $lin \\;]\n"); + sys_gui(" }\n"); + sys_gui(" }\n"); + sys_gui(" pd [concat miXed$name end \\;]\n"); + sys_gui(" set dirty 0\n"); + sys_gui(" hammereditor_setdirty $name 0\n"); + sys_gui(" hammereditor_dodirty $name\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + sys_gui("proc hammereditor_keyboard_close {name} {\n"); + sys_gui(" if {[winfo exists $name]} {\n"); + sys_gui(" if {[catch {$name.text edit modified} dirty]} {set dirty 1}\n"); + sys_gui(" hammereditor_close $name $dirty\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + sys_gui("proc hammereditor_close {name ask} {\n"); + sys_gui(" if {[winfo exists $name]} {\n"); + sys_gui(" if {[catch {$name.text edit modified} dirty]} {set dirty 1}\n"); + sys_gui(" if {$ask && $dirty} {\n"); + sys_gui(" set title [wm title $name]\n"); + sys_gui(" if {[string equal -length 1 $title \"*\"]} {\n"); + sys_gui(" set title [string range $title 1 end]\n"); + sys_gui(" }\n"); + sys_gui(" set answer [tk_messageBox \\-type yesnocancel \\\n"); + sys_gui(" \\-icon question -parent $name\\\n"); + sys_gui(" \\-message [concat Save changes to \\\"$title\\\"?]]\n"); + sys_gui(" if {$answer == \"yes\"} {hammereditor_send $name}\n"); + sys_gui(" if {$answer != \"cancel\"} {hammereditor_doclose $name}\n"); + sys_gui(" } else {hammereditor_doclose $name}\n"); + sys_gui(" }\n"); + sys_gui("}\n"); +} + +/* null owner defaults to class name, pass "" to supress */ +void hammereditor_open(t_hammerfile *f, char *title, char *owner) +{ + if (!owner) + owner = class_getname(*f->f_master); + if (!*owner) + owner = 0; + if (!title) + { + title = owner; + owner = 0; + } + if (owner) + sys_vgui("hammereditor_open .%x %dx%d {%s: %s} %d\n", + (int)f, 600, 600, owner, title, (f->f_editorfn != 0)); + else + sys_vgui("hammereditor_open .%x %dx%d {%s} %d\n", + (int)f, 600, 600, (title ? title : "Untitled"), + (f->f_editorfn != 0)); +} + +static void hammereditor_tick(t_hammerfile *f) +{ + sys_vgui("hammereditor_close .%x 1\n", (int)f); +} + +void hammereditor_close(t_hammerfile *f, int ask) +{ + if (ask && f->f_editorfn) + /* hack: deferring modal dialog creation in order to allow for + a message box redraw to happen -- LATER investigate */ + clock_delay(f->f_editorclock, 0); + else + sys_vgui("hammereditor_close .%x 0\n", (int)f); +} + +void hammereditor_append(t_hammerfile *f, char *contents) +{ + if (contents) + { + char *ptr; + for (ptr = contents; *ptr; ptr++) + { + if (*ptr == '{' || *ptr == '}') + { + char c = *ptr; + *ptr = 0; + sys_vgui("hammereditor_append .%x {%s}\n", (int)f, contents); + sys_vgui("hammereditor_append .%x \"%c\"\n", (int)f, c); + *ptr = c; + contents = ptr + 1; + } + } + if (*contents) + sys_vgui("hammereditor_append .%x {%s}\n", (int)f, contents); + } +} + +void hammereditor_setdirty(t_hammerfile *f, int flag) +{ + if (f->f_editorfn) + sys_vgui("hammereditor_setdirty .%x %d\n", (int)f, flag); +} + +static void hammereditor_clear(t_hammerfile *f) +{ + if (f->f_editorfn) + { + if (f->f_binbuf) + binbuf_clear(f->f_binbuf); + else + f->f_binbuf = binbuf_new(); + } +} + +static void hammereditor_addline(t_hammerfile *f, + t_symbol *s, int ac, t_atom *av) +{ + if (f->f_editorfn) + { + int i; + t_atom *ap; + for (i = 0, ap = av; i < ac; i++, ap++) + { + if (ap->a_type == A_SYMBOL) + { + /* LATER rethink semi/comma mapping */ + if (!strcmp(ap->a_w.w_symbol->s_name, "_semi_")) + SETSEMI(ap); + else if (!strcmp(ap->a_w.w_symbol->s_name, "_comma_")) + SETCOMMA(ap); + } + } + binbuf_add(f->f_binbuf, ac, av); + } +} + +static void hammereditor_end(t_hammerfile *f) +{ + if (f->f_editorfn) + { + (*f->f_editorfn)(f->f_master, 0, binbuf_getnatom(f->f_binbuf), + binbuf_getvec(f->f_binbuf)); + binbuf_clear(f->f_binbuf); + } +} + +static void hammerpanel_guidefs(void) +{ + sys_gui("proc hammerpanel_open {target inidir} {\n"); + sys_gui(" global pd_opendir\n"); + sys_gui(" if {$inidir == \"\"} {\n"); + sys_gui(" set $inidir $pd_opendir\n"); + sys_gui(" }\n"); + sys_gui(" set filename [tk_getOpenFile \\\n"); + sys_gui(" -initialdir $inidir]\n"); + sys_gui(" if {$filename != \"\"} {\n"); + sys_gui(" set directory [string range $filename 0 \\\n"); + sys_gui(" [expr [string last / $filename ] - 1]]\n"); + sys_gui(" if {$directory == \"\"} {set directory \"/\"}\n"); +#if 1 + sys_gui(" puts stderr [concat $directory]\n"); +#endif + sys_gui(" pd [concat $target path \\\n"); + sys_gui(" [pdtk_enquote $filename] [pdtk_enquote $directory] \\;]\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + sys_gui("proc hammerpanel_save {target inidir inifile} {\n"); + sys_gui(" if {$inifile != \"\"} {\n"); + sys_gui(" set filename [tk_getSaveFile \\\n"); + sys_gui(" -initialdir $inidir -initialfile $inifile]\n"); + sys_gui(" } else {\n"); + sys_gui(" set filename [tk_getSaveFile]\n"); + sys_gui(" }\n"); + sys_gui(" if {$filename != \"\"} {\n"); + sys_gui(" set directory [string range $filename 0 \\\n"); + sys_gui(" [expr [string last / $filename ] - 1]]\n"); + sys_gui(" if {$directory == \"\"} {set directory \"/\"}\n"); + sys_gui(" pd [concat $target path \\\n"); + sys_gui(" [pdtk_enquote $filename] [pdtk_enquote $directory] \\;]\n"); + sys_gui(" }\n"); + sys_gui("}\n"); +} + +/* There are two modes of -initialdir persistence: + 1. Using last reply from gui (if any, default is canvas directory): + pass null to hammerpanel_open/save() (for explicit cd, optionally call + hammerpanel_setopen/savedir() first). + 2. Starting always in the same directory (eg. canvasdir): + feed hammerpanel_open/save(). + Usually, first mode fits opening better, the second -- saving. */ + +/* This is obsolete, but has to stay, because older versions of miXed libraries + might overwrite new hammerpanel_guidefs(). FIXME we need version control. */ +static void hammerpanel_symbol(t_hammerfile *f, t_symbol *s) +{ + if (s && s != &s_ && f->f_panelfn) + (*f->f_panelfn)(f->f_master, s, 0, 0); +} + +static void hammerpanel_path(t_hammerfile *f, t_symbol *s1, t_symbol *s2) +{ + if (s2 && s2 != &s_) + f->f_currentdir = s2; + if (s1 && s1 != &s_ && f->f_panelfn) + (*f->f_panelfn)(f->f_master, s1, 0, 0); +} + +static void hammerpanel_tick(t_hammerfile *f) +{ + if (f->f_savepanel) + sys_vgui("hammerpanel_open %s {%s}\n", f->f_bindname->s_name, + f->f_inidir->s_name); + else + sys_vgui("hammerpanel_save %s {%s} {%s}\n", f->f_bindname->s_name, + f->f_inidir->s_name, f->f_inifile->s_name); +} + +/* these are hacks: deferring modal dialog creation in order to allow for + a message box redraw to happen -- LATER investigate */ +void hammerpanel_open(t_hammerfile *f, t_symbol *inidir) +{ + if (inidir) + f->f_inidir = inidir; + else + f->f_inidir = (f->f_currentdir ? f->f_currentdir : &s_); + clock_delay(f->f_panelclock, 0); +} + +void hammerpanel_setopendir(t_hammerfile *f, t_symbol *dir) +{ + if (f->f_currentdir && f->f_currentdir != &s_) + { + if (dir && dir != &s_) + { + int length; + if (length = ospath_length(dir->s_name, f->f_currentdir->s_name)) + { + char *path = getbytes(length + 1); + if (ospath_absolute(dir->s_name, f->f_currentdir->s_name, path)) + /* LATER stat (think how to report a failure) */ + f->f_currentdir = gensym(path); + freebytes(path, length + 1); + } + } + else if (f->f_canvas) + f->f_currentdir = canvas_getdir(f->f_canvas); + } + else bug("hammerpanel_setopendir"); +} + +t_symbol *hammerpanel_getopendir(t_hammerfile *f) +{ + return (f->f_currentdir); +} + +void hammerpanel_save(t_hammerfile *f, t_symbol *inidir, t_symbol *inifile) +{ + if (f = f->f_savepanel) + { + if (inidir) + f->f_inidir = inidir; + else + /* LATER ask if we can rely on s_ pointing to "" */ + f->f_inidir = (f->f_currentdir ? f->f_currentdir : &s_); + f->f_inifile = (inifile ? inifile : &s_); + clock_delay(f->f_panelclock, 0); + } +} + +void hammerpanel_setsavedir(t_hammerfile *f, t_symbol *dir) +{ + if (f = f->f_savepanel) + hammerpanel_setopendir(f, dir); +} + +t_symbol *hammerpanel_getsavedir(t_hammerfile *f) +{ + return (f->f_savepanel ? f->f_savepanel->f_currentdir : 0); +} + +/* Currently embeddable hammer classes do not use the 'saveto' method. + In order to use it, any embeddable class would have to add a creation + method to pd_canvasmaker -- then saving could be done with a 'proper' + sequence: #N <master> <args>; #X <whatever>; ...; #X restore <x> <y>; + However, this works only for -lib externals. So, we choose a sequence: + #X obj <x> <y> <master> <args>; #C <whatever>; ...; #C restore; + Since the first message in this sequence is a valid creation message + on its own, we have to distinguish loading from a .pd file, and other + cases (editing). */ + +static void hammerembed_gc(t_pd *x, t_symbol *s, int expected) +{ + t_pd *garbage; + int count = 0; + while (garbage = pd_findbyclass(s, *x)) pd_unbind(garbage, s), count++; + if (count != expected) + bug("hammerembed_gc (%d garbage bindings)", count); +} + +static void hammerembed_restore(t_pd *master) +{ + hammerembed_gc(master, ps__C, 1); +} + +void hammerembed_save(t_gobj *master, t_binbuf *bb) +{ + t_hammerfile *f = hammerfile_getproxy((t_pd *)master); + t_text *t = (t_text *)master; + binbuf_addv(bb, "ssii", &s__X, gensym("obj"), + (int)t->te_xpix, (int)t->te_ypix); + binbuf_addbinbuf(bb, t->te_binbuf); + binbuf_addsemi(bb); + if (f && f->f_embedfn) + (*f->f_embedfn)(f->f_master, bb, ps__C); + binbuf_addv(bb, "ss;", ps__C, gensym("restore")); +} + +int hammerfile_ismapped(t_hammerfile *f) +{ + return (f->f_canvas->gl_mapped); +} + +int hammerfile_isloading(t_hammerfile *f) +{ + return (f->f_canvas->gl_loading); +} + +/* LATER find a better way */ +int hammerfile_ispasting(t_hammerfile *f) +{ + int result = 0; + t_canvas *cv = f->f_canvas; + if (!cv->gl_loading) + { + t_pd *z = s__X.s_thing; + if (z == (t_pd *)cv) + { + pd_popsym(z); + if (s__X.s_thing == (t_pd *)cv) result = 1; + pd_pushsym(z); + } + else if (z) result = 1; + } +#if 0 + if (result) post("pasting"); +#endif + return (result); +} + +void hammerfile_free(t_hammerfile *f) +{ + t_hammerfile *prev, *next; + hammereditor_close(f, 0); + if (f->f_embedfn) + /* just in case of missing 'restore' */ + hammerembed_gc(f->f_master, ps__C, 0); + if (f->f_savepanel) + { + pd_unbind((t_pd *)f->f_savepanel, f->f_savepanel->f_bindname); + pd_free((t_pd *)f->f_savepanel); + } + if (f->f_bindname) pd_unbind((t_pd *)f, f->f_bindname); + if (f->f_panelclock) clock_free(f->f_panelclock); + if (f->f_editorclock) clock_free(f->f_editorclock); + for (prev = 0, next = hammerfile_proxies; + next; prev = next, next = next->f_next) + if (next == f) + break; + if (prev) + prev->f_next = f->f_next; + else if (f == hammerfile_proxies) + hammerfile_proxies = f->f_next; + pd_free((t_pd *)f); +} + +t_hammerfile *hammerfile_new(t_pd *master, t_hammerembedfn embedfn, + t_hammerfilefn readfn, t_hammerfilefn writefn, + t_hammerfilefn updatefn) +{ + t_hammerfile *result = (t_hammerfile *)pd_new(hammerfile_class); + result->f_master = master; + result->f_next = hammerfile_proxies; + hammerfile_proxies = result; + if (!(result->f_canvas = canvas_getcurrent())) + { + bug("hammerfile_new: out of context"); + return (result); + } + + /* 1. embedding */ + if (result->f_embedfn = embedfn) + { + /* just in case of missing 'restore' */ + hammerembed_gc(master, ps__C, 0); + if (hammerfile_isloading(result) || hammerfile_ispasting(result)) + pd_bind(master, ps__C); + } + + /* 2. the panels */ + if (readfn || writefn) + { + t_hammerfile *f; + char buf[64]; + sprintf(buf, "miXed.%x", (int)result); + result->f_bindname = gensym(buf); + pd_bind((t_pd *)result, result->f_bindname); + result->f_currentdir = + result->f_inidir = canvas_getdir(result->f_canvas); + result->f_panelfn = readfn; + result->f_panelclock = clock_new(result, (t_method)hammerpanel_tick); + f = (t_hammerfile *)pd_new(hammerfile_class); + f->f_master = master; + f->f_canvas = result->f_canvas; + sprintf(buf, "miXed.%x", (int)f); + f->f_bindname = gensym(buf); + pd_bind((t_pd *)f, f->f_bindname); + f->f_currentdir = f->f_inidir = result->f_currentdir; + f->f_panelfn = writefn; + f->f_panelclock = clock_new(f, (t_method)hammerpanel_tick); + result->f_savepanel = f; + } + else result->f_savepanel = 0; + + /* 3. editor */ + if (result->f_editorfn = updatefn) + { + result->f_editorclock = clock_new(result, (t_method)hammereditor_tick); + if (!result->f_bindname) + { + char buf[64]; + sprintf(buf, "miXed.%x", (int)result); + result->f_bindname = gensym(buf); + pd_bind((t_pd *)result, result->f_bindname); + } + } + return (result); +} + +void hammerfile_setup(t_class *c, int embeddable) +{ + if (embeddable) + { + forky_setsavefn(c, hammerembed_save); + class_addmethod(c, (t_method)hammerembed_restore, + gensym("restore"), 0); + } + if (!hammerfile_class) + { + ps__C = gensym("#C"); + hammerfile_class = class_new(gensym("_hammerfile"), 0, 0, + sizeof(t_hammerfile), + CLASS_PD | CLASS_NOINLET, 0); + class_addsymbol(hammerfile_class, hammerpanel_symbol); + class_addmethod(hammerfile_class, (t_method)hammerpanel_path, + gensym("path"), A_SYMBOL, A_DEFSYM, 0); + class_addmethod(hammerfile_class, (t_method)hammereditor_clear, + gensym("clear"), 0); + class_addmethod(hammerfile_class, (t_method)hammereditor_addline, + gensym("addline"), A_GIMME, 0); + class_addmethod(hammerfile_class, (t_method)hammereditor_end, + gensym("end"), 0); + /* LATER find a way of ensuring that these are not defined yet... */ + hammereditor_guidefs(); + hammerpanel_guidefs(); + } +} diff --git a/externals/miXed/shared/hammer/file.h b/externals/miXed/shared/hammer/file.h new file mode 100644 index 000000000..7e68cdca4 --- /dev/null +++ b/externals/miXed/shared/hammer/file.h @@ -0,0 +1,33 @@ +/* Copyright (c) 2002-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __HAMMERFILE_H__ +#define __HAMMERFILE_H__ + +EXTERN_STRUCT _hammerfile; +#define t_hammerfile struct _hammerfile + +typedef void (*t_hammerfilefn)(t_pd *, t_symbol *, int, t_atom *); +typedef void (*t_hammerembedfn)(t_pd *, t_binbuf *, t_symbol *); + +void hammereditor_open(t_hammerfile *f, char *title, char *owner); +void hammereditor_close(t_hammerfile *f, int ask); +void hammereditor_append(t_hammerfile *f, char *contents); +void hammereditor_setdirty(t_hammerfile *f, int flag); +void hammerpanel_open(t_hammerfile *f, t_symbol *inidir); +void hammerpanel_setopendir(t_hammerfile *f, t_symbol *dir); +t_symbol *hammerpanel_getopendir(t_hammerfile *f); +void hammerpanel_save(t_hammerfile *f, t_symbol *inidir, t_symbol *inifile); +void hammerpanel_setsavedir(t_hammerfile *f, t_symbol *dir); +t_symbol *hammerpanel_getsavedir(t_hammerfile *f); +int hammerfile_ismapped(t_hammerfile *f); +int hammerfile_isloading(t_hammerfile *f); +int hammerfile_ispasting(t_hammerfile *f); +void hammerfile_free(t_hammerfile *f); +t_hammerfile *hammerfile_new(t_pd *master, t_hammerembedfn embedfn, + t_hammerfilefn readfn, t_hammerfilefn writefn, + t_hammerfilefn updatefn); +void hammerfile_setup(t_class *c, int embeddable); + +#endif diff --git a/externals/miXed/shared/hammer/gui.c b/externals/miXed/shared/hammer/gui.c new file mode 100644 index 000000000..104af3a6c --- /dev/null +++ b/externals/miXed/shared/hammer/gui.c @@ -0,0 +1,538 @@ +/* Copyright (c) 2003-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* FIXME use guiconnect */ + +/* LATER revisit tracking the mouse state within the focusless pd-gui + (event bindings are local only in tk8.4, and there is no other call + to XQueryPointer() but from winfo pointer). */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "hammer/gui.h" + +#ifdef KRZYSZCZ +//#define HAMMERGUI_DEBUG +#endif + +static t_class *hammergui_class = 0; +static t_hammergui *hammergui_sink = 0; +static t_symbol *ps_hashhammergui; +static t_symbol *ps__hammergui; +static t_symbol *ps__up; +static t_symbol *ps__focus; +static t_symbol *ps__vised; + +static void hammergui_anything(t_hammergui *snk, + t_symbol *s, int ac, t_atom *av) +{ + /* Dummy method, filtering out messages from gui to the masters. This is + needed in order to keep Pd's message system happy in a ``gray period'' + -- after last master is unbound, and before gui bindings are cleared. */ +#ifdef HAMMERGUI_DEBUG + /* FIXME */ + startpost("%s", s->s_name); + postatom(ac, av); + post(" (sink %x)", (int)snk); +#endif +} + +/* filtering out redundant "_up" messages */ +static void hammergui__up(t_hammergui *snk, t_floatarg f) +{ +#ifdef HAMMERGUI_DEBUG + fprintf(stderr, "_up %g (sink %x)\n", f, (int)snk); +#endif + if (!snk->g_psmouse) + { + bug("hammergui__up"); + return; + } + if ((int)f) + { + if (!snk->g_isup) + { + snk->g_isup = 1; + if (snk->g_psmouse->s_thing) + { + t_atom at; + SETFLOAT(&at, 1); + pd_typedmess(snk->g_psmouse->s_thing, ps__up, 1, &at); + } + } + } + else + { + if (snk->g_isup) + { + snk->g_isup = 0; + if (snk->g_psmouse->s_thing) + { + t_atom at; + SETFLOAT(&at, 0); + pd_typedmess(snk->g_psmouse->s_thing, ps__up, 1, &at); + } + } + } +} + +static void hammergui__focus(t_hammergui *snk, t_symbol *s, t_floatarg f) +{ +#ifdef HAMMERGUI_DEBUG + fprintf(stderr, "_focus %s %g (sink %x)\n", + (s ? s->s_name : "???"), f, (int)snk); +#endif + if (!snk->g_psfocus) + { + bug("hammergui__focus"); + return; + } + if (snk->g_psfocus->s_thing) + { + t_atom at[2]; + SETSYMBOL(&at[0], s); + SETFLOAT(&at[1], f); + pd_typedmess(snk->g_psfocus->s_thing, ps__focus, 2, at); + } +} + +static void hammergui__vised(t_hammergui *snk, t_symbol *s, t_floatarg f) +{ +#ifdef HAMMERGUI_DEBUG + fprintf(stderr, "_vised %s %g (sink %x)\n", + (s ? s->s_name : "???"), f, (int)snk); +#endif + if (!snk->g_psvised) + { + bug("hammergui__vised"); + return; + } + if (snk->g_psvised->s_thing) + { + t_atom at[2]; + SETSYMBOL(&at[0], s); + SETFLOAT(&at[1], f); + pd_typedmess(snk->g_psvised->s_thing, ps__vised, 2, at); + } +#if 0 + /* How to be notified about changes of button state, prior to gui objects + in a canvas? LATER find a reliable way -- delete if failed */ + sys_vgui("bindtags %s {hammertag %s Canvas . all}\n", + s->s_name, s->s_name); +#endif +} + + +static void hammergui_dobindmouse(t_hammergui *snk) +{ +#ifdef HAMMERGUI_DEBUG + fprintf(stderr, "dobindmouse (sink %x)\n", (int)snk); +#endif +#if 0 + /* How to be notified about changes of button state, prior to gui objects + in a canvas? LATER find a reliable way -- delete if failed */ + sys_vgui("bind hammertag <<hammerdown>> {pd [concat %s _up 0 \\;]}\n", + snk->g_psgui->s_name); + sys_vgui("bind hammertag <<hammerup>> {pd [concat %s _up 1 \\;]}\n", + snk->g_psgui->s_name); +#endif + sys_vgui("bind all <<hammerdown>> {pd [concat %s _up 0 \\;]}\n", + snk->g_psgui->s_name); + sys_vgui("bind all <<hammerup>> {pd [concat %s _up 1 \\;]}\n", + snk->g_psgui->s_name); +} + +static void hammergui__remouse(t_hammergui *snk) +{ + if (!snk->g_psmouse) + { + bug("hammergui__remouse"); + return; + } + if (snk->g_psmouse->s_thing) + { + /* if a new master was bound in a gray period, we need to + restore gui bindings */ +#if 1 + post("rebinding mouse..."); +#endif + hammergui_dobindmouse(snk); + } +} + +static void hammergui_dobindfocus(t_hammergui *snk) +{ + sys_vgui("bind Canvas <<hammerfocusin>> \ + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _focus %%W 1 \\;]}}\n", snk->g_psgui->s_name); + sys_vgui("bind Canvas <<hammerfocusout>> \ + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _focus %%W 0 \\;]}}\n", snk->g_psgui->s_name); +} + +static void hammergui__refocus(t_hammergui *snk) +{ + if (!snk->g_psfocus) + { + bug("hammergui__refocus"); + return; + } + if (snk->g_psfocus->s_thing) + { + /* if a new master was bound in a gray period, we need to + restore gui bindings */ +#if 1 + post("rebinding focus..."); +#endif + hammergui_dobindfocus(snk); + } +} + +static void hammergui_dobindvised(t_hammergui *snk) +{ +#ifdef HAMMERGUI_DEBUG + fprintf(stderr, "dobindvised (sink %x)\n", (int)snk); +#endif + sys_vgui("bind Canvas <<hammervised>> \ + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _vised %%W 1 \\;]}}\n", snk->g_psgui->s_name); + sys_vgui("bind Canvas <<hammerunvised>> \ + {if {[hammergui_ispatcher %%W]} \ + {pd [concat %s _vised %%W 0 \\;]}}\n", snk->g_psgui->s_name); +} + +static void hammergui__revised(t_hammergui *snk) +{ + if (!snk->g_psvised) + { + bug("hammergui__revised"); + return; + } + if (snk->g_psvised->s_thing) + { + /* if a new master was bound in a gray period, we need to + restore gui bindings */ +#if 1 + post("rebinding vised events..."); +#endif + hammergui_dobindvised(snk); + } +} + +static int hammergui_setup(void) +{ + ps_hashhammergui = gensym("#hammergui"); + ps__hammergui = gensym("_hammergui"); + ps__up = gensym("_up"); + ps__focus = gensym("_focus"); + ps__vised = gensym("_vised"); + if (ps_hashhammergui->s_thing) + { + char *cname = class_getname(*ps_hashhammergui->s_thing); +#ifdef HAMMERGUI_DEBUG + fprintf(stderr, + "'%s' already registered as the global hammergui sink \n", + (cname ? cname : "???")); +#endif + if (strcmp(cname, ps__hammergui->s_name)) + { + /* FIXME protect against the danger of someone else + (e.g. receive) binding to #hammergui */ + bug("hammergui_setup"); + return (0); + } + else + { + /* FIXME compatibility test */ + hammergui_class = *ps_hashhammergui->s_thing; + return (1); + } + } + hammergui_class = class_new(ps__hammergui, 0, 0, + sizeof(t_hammergui), + CLASS_PD | CLASS_NOINLET, 0); + class_addanything(hammergui_class, hammergui_anything); + class_addmethod(hammergui_class, (t_method)hammergui__remouse, + gensym("_remouse"), 0); + class_addmethod(hammergui_class, (t_method)hammergui__refocus, + gensym("_refocus"), 0); + class_addmethod(hammergui_class, (t_method)hammergui__revised, + gensym("_revised"), 0); + class_addmethod(hammergui_class, (t_method)hammergui__up, + ps__up, A_FLOAT, 0); + class_addmethod(hammergui_class, (t_method)hammergui__focus, + ps__focus, A_SYMBOL, A_FLOAT, 0); + class_addmethod(hammergui_class, (t_method)hammergui__vised, + ps__vised, A_SYMBOL, A_FLOAT, 0); + + /* Protect against pdCmd being called (via "Canvas <Destroy>" binding) + during Tcl_Finalize(). FIXME this should be a standard exit handler. */ + sys_gui("proc hammergui_exithook {cmd op} {proc pd {} {}}\n"); + sys_gui("if {[info tclversion] >= 8.4} {\n\ + trace add execution exit enter hammergui_exithook}\n"); + + sys_gui("proc hammergui_ispatcher {cv} {\n"); + sys_gui(" if {[string range $cv 0 1] == \".x\""); + sys_gui(" && [string range $cv end-1 end] == \".c\"} {\n"); + sys_gui(" return 1} else {return 0}\n"); + sys_gui("}\n"); + + sys_gui("proc hammergui_remouse {} {\n"); + sys_gui(" bind all <<hammerdown>> {}\n"); + sys_gui(" bind all <<hammerup>> {}\n"); + sys_gui(" pd [concat #hammergui _remouse \\;]\n"); + sys_gui("}\n"); + + sys_gui("proc hammergui_mousexy {target} {\n"); + sys_gui(" set x [winfo pointerx .]\n"); + sys_gui(" set y [winfo pointery .]\n"); + sys_gui(" pd [concat #hammermouse $target $x $y \\;]\n"); + sys_gui("}\n"); + + /* visibility hack for msw, LATER rethink */ + sys_gui("global hammergui_ispolling\n"); + sys_gui("global hammergui_x\n"); + sys_gui("global hammergui_y\n"); + sys_gui("set hammergui_ispolling 0\n"); + sys_gui("set hammergui_x 0\n"); + sys_gui("set hammergui_y 0\n"); + + sys_gui("proc hammergui_poll {} {\n"); + sys_gui(" global hammergui_ispolling\n"); + sys_gui(" global hammergui_x\n"); + sys_gui(" global hammergui_y\n"); + sys_gui(" if {$hammergui_ispolling == 1} {\n"); + sys_gui(" set x [winfo pointerx .]\n"); + sys_gui(" set y [winfo pointery .]\n"); + sys_gui(" if {$hammergui_x != $x || $hammergui_y != $y} {\n"); + sys_gui(" pd [concat #hammermouse _poll $x $y \\;]\n"); + sys_gui(" set hammergui_x $x\n"); + sys_gui(" set hammergui_y $y\n"); + sys_gui(" }\n"); + sys_gui(" after 50 hammergui_poll\n"); + sys_gui(" }\n"); + sys_gui("}\n"); + + sys_gui("proc hammergui_refocus {} {\n"); + sys_gui(" bind Canvas <<hammerfocusin>> {}\n"); + sys_gui(" bind Canvas <<hammerfocusout>> {}\n"); + sys_gui(" pd [concat #hammergui _refocus \\;]\n"); + sys_gui("}\n"); + + sys_gui("proc hammergui_revised {} {\n"); + sys_gui(" bind Canvas <<hammervised>> {}\n"); + sys_gui(" bind Canvas <<hammerunvised>> {}\n"); + sys_gui(" pd [concat #hammergui _revised \\;]\n"); + sys_gui("}\n"); + return (1); +} + +static int hammergui_validate(int dosetup) +{ + if (dosetup && !hammergui_sink + && (hammergui_class || hammergui_setup())) + { + if (ps_hashhammergui->s_thing) + hammergui_sink = (t_hammergui *)ps_hashhammergui->s_thing; + else + { + hammergui_sink = (t_hammergui *)pd_new(hammergui_class); + hammergui_sink->g_psgui = ps_hashhammergui; + pd_bind((t_pd *)hammergui_sink, + ps_hashhammergui); /* never unbound */ + } + } + if (hammergui_class && hammergui_sink) + return (1); + else + { + bug("hammergui_validate"); + return (0); + } +} + +static int hammergui_mousevalidate(int dosetup) +{ + if (dosetup && !hammergui_sink->g_psmouse) + { + hammergui_sink->g_psmouse = gensym("#hammermouse"); + sys_gui("event add <<hammerdown>> <ButtonPress>\n"); + sys_gui("event add <<hammerup>> <ButtonRelease>\n"); + } + if (hammergui_sink->g_psmouse) + return (1); + else + { + bug("hammergui_mousevalidate"); + return (0); + } +} + +static int hammergui_pollvalidate(int dosetup) +{ + if (dosetup && !hammergui_sink->g_pspoll) + { + hammergui_sink->g_pspoll = gensym("#hammerpoll"); + pd_bind((t_pd *)hammergui_sink, + hammergui_sink->g_pspoll); /* never unbound */ + } + if (hammergui_sink->g_pspoll) + return (1); + else + { + bug("hammergui_pollvalidate"); + return (0); + } +} + +static int hammergui_focusvalidate(int dosetup) +{ + if (dosetup && !hammergui_sink->g_psfocus) + { + hammergui_sink->g_psfocus = gensym("#hammerfocus"); + sys_gui("event add <<hammerfocusin>> <FocusIn>\n"); + sys_gui("event add <<hammerfocusout>> <FocusOut>\n"); + } + if (hammergui_sink->g_psfocus) + return (1); + else + { + bug("hammergui_focusvalidate"); + return (0); + } +} + +static int hammergui_visedvalidate(int dosetup) +{ + if (dosetup && !hammergui_sink->g_psvised) + { + hammergui_sink->g_psvised = gensym("#hammervised"); + /* subsequent map events have to be filtered out at the caller's side, + LATER investigate */ + sys_gui("event add <<hammervised>> <Map>\n"); + sys_gui("event add <<hammerunvised>> <Destroy>\n"); + } + if (hammergui_sink->g_psvised) + return (1); + else + { + bug("hammergui_visedvalidate"); + return (0); + } +} + +void hammergui_bindmouse(t_pd *master) +{ +#ifdef HAMMERGUI_DEBUG + fprintf(stderr, "bindmouse, master %x\n", (int)master); +#endif + hammergui_validate(1); + hammergui_mousevalidate(1); + if (!hammergui_sink->g_psmouse->s_thing) + hammergui_dobindmouse(hammergui_sink); + pd_bind(master, hammergui_sink->g_psmouse); +} + +void hammergui_unbindmouse(t_pd *master) +{ + if (hammergui_validate(0) && hammergui_mousevalidate(0) + && hammergui_sink->g_psmouse->s_thing) + { + pd_unbind(master, hammergui_sink->g_psmouse); + if (!hammergui_sink->g_psmouse->s_thing) + sys_gui("hammergui_remouse\n"); + } + else bug("hammergui_unbindmouse"); +} + +void hammergui_mousexy(t_symbol *s) +{ + if (hammergui_validate(0)) + sys_vgui("hammergui_mousexy %s\n", s->s_name); +} + +void hammergui_willpoll(void) +{ + hammergui_validate(1); + hammergui_pollvalidate(1); +} + +void hammergui_startpolling(t_pd *master) +{ + if (hammergui_validate(0) && hammergui_pollvalidate(0)) + { + int doinit = + (hammergui_sink->g_pspoll->s_thing == (t_pd *)hammergui_sink); + pd_bind(master, hammergui_sink->g_pspoll); + if (doinit) + { + /* visibility hack for msw, LATER rethink */ + sys_gui("global hammergui_ispolling\n"); + sys_gui("set hammergui_ispolling 1\n"); + sys_gui("hammergui_poll\n"); + } + } +} + +void hammergui_stoppolling(t_pd *master) +{ + if (hammergui_validate(0) && hammergui_pollvalidate(0)) + { + pd_unbind(master, hammergui_sink->g_pspoll); + if (hammergui_sink->g_pspoll->s_thing == (t_pd *)hammergui_sink) + { + sys_gui("after cancel hammergui_poll\n"); + /* visibility hack for msw, LATER rethink */ + sys_gui("global hammergui_ispolling\n"); + sys_gui("set hammergui_ispolling 0\n"); + } + } +} + +void hammergui_bindfocus(t_pd *master) +{ + hammergui_validate(1); + hammergui_focusvalidate(1); + if (!hammergui_sink->g_psfocus->s_thing) + hammergui_dobindfocus(hammergui_sink); + pd_bind(master, hammergui_sink->g_psfocus); +} + +void hammergui_unbindfocus(t_pd *master) +{ + if (hammergui_validate(0) && hammergui_focusvalidate(0) + && hammergui_sink->g_psfocus->s_thing) + { + pd_unbind(master, hammergui_sink->g_psfocus); + if (!hammergui_sink->g_psfocus->s_thing) + sys_gui("hammergui_refocus\n"); + } + else bug("hammergui_unbindfocus"); +} + +void hammergui_bindvised(t_pd *master) +{ +#ifdef HAMMERGUI_DEBUG + fprintf(stderr, "bindvised, master %x\n", (int)master); +#endif + hammergui_validate(1); + hammergui_visedvalidate(1); + if (!hammergui_sink->g_psvised->s_thing) + hammergui_dobindvised(hammergui_sink); + pd_bind(master, hammergui_sink->g_psvised); +} + +void hammergui_unbindvised(t_pd *master) +{ + if (hammergui_validate(0) && hammergui_visedvalidate(0) + && hammergui_sink->g_psvised->s_thing) + { + pd_unbind(master, hammergui_sink->g_psvised); + if (!hammergui_sink->g_psvised->s_thing) + sys_gui("hammergui_revised\n"); + } + else bug("hammergui_unbindvised"); +} diff --git a/externals/miXed/shared/hammer/gui.h b/externals/miXed/shared/hammer/gui.h new file mode 100644 index 000000000..3cab05544 --- /dev/null +++ b/externals/miXed/shared/hammer/gui.h @@ -0,0 +1,30 @@ +/* Copyright (c) 2003-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __HAMMERGUI_H__ +#define __HAMMERGUI_H__ + +typedef struct _hammergui +{ + t_pd g_pd; + t_symbol *g_psgui; + t_symbol *g_psmouse; + t_symbol *g_pspoll; + t_symbol *g_psfocus; + t_symbol *g_psvised; + int g_isup; +} t_hammergui; + +void hammergui_bindmouse(t_pd *master); +void hammergui_unbindmouse(t_pd *master); +void hammergui_mousexy(t_symbol *s); +void hammergui_willpoll(void); +void hammergui_startpolling(t_pd *master); +void hammergui_stoppolling(t_pd *master); +void hammergui_bindfocus(t_pd *master); +void hammergui_unbindfocus(t_pd *master); +void hammergui_bindvised(t_pd *master); +void hammergui_unbindvised(t_pd *master); + +#endif diff --git a/externals/miXed/shared/hammer/tree.c b/externals/miXed/shared/hammer/tree.c new file mode 100644 index 000000000..9957da740 --- /dev/null +++ b/externals/miXed/shared/hammer/tree.c @@ -0,0 +1,784 @@ +/* Copyright (c) 2003-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "hammer/tree.h" + +/* Since there is no sentinel node, the deletion routine has to have + a few extra checks. LATER rethink. */ + +/* LATER freelist */ + +typedef t_hammernode *(*t_hammertree_inserthook)(t_hammernode *); + +#ifdef HAMMERTREE_DEBUG +/* returns black-height or 0 if failed */ +static int hammernode_verify(t_hammernode *np) +{ + if (np) + { + int bhl, bhr; + if (((bhl = hammernode_verify(np->n_left)) == 0) || + ((bhr = hammernode_verify(np->n_right)) == 0)) + return (0); + if (bhl != bhr) + { + /* failure: two paths rooted in the same node + contain different number of black nodes */ + bug("hammernode_verify: not balanced"); + return (0); + } + if (np->n_black) + return (bhl + 1); + else + { + if ((np->n_left && !np->n_left->n_black) || + (np->n_right && !np->n_right->n_black)) + { + bug("hammernode_verify: adjacent red nodes"); + return (0); + } + return (bhl); + } + } + else return (1); +} + +/* returns black-height or 0 if failed */ +static int hammertree_verify(t_hammertree *tree) +{ + return (hammernode_verify(tree->t_root)); +} + +static int hammernode_checkmulti(t_hammernode *np1, t_hammernode *np2) +{ + if (np1 && np2 && np1->n_key == np2->n_key) + { + if (np1 == np2) + bug("hammernode_checkmulti"); + else + return (1); + } + return (0); +} + +static void hammernode_post(t_hammertree *tree, t_hammernode *np, + t_hammernode_vshowhook hook, char *message) +{ + startpost("%d ", np->n_key); + if (tree->t_valuetype == HAMMERTYPE_FLOAT) + startpost("%g ", HAMMERNODE_GETFLOAT(np)); + else if (tree->t_valuetype == HAMMERTYPE_SYMBOL) + startpost("%s ", HAMMERNODE_GETSYMBOL(np)->s_name); + else if (tree->t_valuetype == HAMMERTYPE_ATOM) + { + t_atom *ap = HAMMERNODE_GETATOMPTR(np); + if (ap->a_type == A_FLOAT) + startpost("%g ", ap->a_w.w_float); + else if (ap->a_type == A_SYMBOL) + startpost("%s ", ap->a_w.w_symbol->s_name); + } + else if (hook) + { + char buf[MAXPDSTRING]; + (*hook)(np, buf, MAXPDSTRING); + startpost("%s ", buf); + } + else startpost("0x%08x ", (int)HAMMERNODE_GETSYMBOL(np)); + startpost("%s ", (np->n_black ? "black" : "red")); + + if (hammernode_checkmulti(np, np->n_parent) || + hammernode_checkmulti(np, np->n_left) || + hammernode_checkmulti(np, np->n_right) || + hammernode_checkmulti(np->n_parent, np->n_left) || + hammernode_checkmulti(np->n_parent, np->n_right) || + hammernode_checkmulti(np->n_left, np->n_right)) + startpost("multi "); + + if (np->n_parent) + startpost("(%d -> ", np->n_parent->n_key); + else + startpost("(nul -> "); + if (np->n_left) + startpost("%d, ", np->n_left->n_key); + else + startpost("nul, "); + if (np->n_right) + startpost("%d)", np->n_right->n_key); + else + startpost("nul)"); + if (message) + post(": %s", message); + else + endpost(); +} + +/* Assert a standard stackless traversal producing the same sequence, + as the auxiliary list. */ +static int hammertree_checktraversal(t_hammertree *tree) +{ + t_hammernode *treewalk = tree->t_root; + t_hammernode *listwalk = tree->t_first; + int count = 0; + while (treewalk) + { + t_hammernode *prev = treewalk->n_left; + if (prev) + { + while (prev->n_right && prev->n_right != treewalk) + prev = prev->n_right; + if (prev->n_right) + { + prev->n_right = 0; + count++; + if (treewalk == listwalk) + listwalk = listwalk->n_next; + else + { + bug("hammertree_checktraversal 1"); + hammernode_post(tree, treewalk, 0, "treewalk"); + if (listwalk) + hammernode_post(tree, listwalk, 0, "listwalk"); + else + post("empty listwalk pointer"); + listwalk = treewalk; + } + treewalk = treewalk->n_right; + } + else + { + prev->n_right = treewalk; + treewalk = treewalk->n_left; + } + } + else + { + count++; + if (treewalk == listwalk) + listwalk = listwalk->n_next; + else + { + bug("hammertree_checktraversal 2"); + hammernode_post(tree, treewalk, 0, "treewalk"); + if (listwalk) + hammernode_post(tree, listwalk, 0, "listwalk"); + else + post("empty listwalk pointer"); + listwalk = treewalk; + } + treewalk = treewalk->n_right; + } + } + return (count); +} + +static int hammernode_height(t_hammernode *np) +{ + if (np) + { + int lh = hammernode_height(np->n_left); + int rh = hammernode_height(np->n_right); + return (lh > rh ? lh + 1 : rh + 1); + } + else return (0); +} + +void hammertree_debug(t_hammertree *tree, int level, + t_hammernode_vshowhook hook) +{ + t_hammernode *np; + int count; + post("------------------------"); + count = hammertree_checktraversal(tree); + if (level) + { + for (np = tree->t_first; np; np = np->n_next) + hammernode_post(tree, np, hook, 0); + if (level > 1) + { + post("************"); + for (np = tree->t_last; np; np = np->n_prev) + startpost("%d ", np->n_key); + endpost(); + } + } + if (tree->t_root) + { + t_hammernode *first = tree->t_root, *last = tree->t_root; + while (first->n_left && first->n_left != tree->t_root) + first = first->n_left; + while (last->n_right && last->n_right != tree->t_root) + last = last->n_right; + post("count %d, height %d, root %d", + count, hammernode_height(tree->t_root), tree->t_root->n_key); + post("first %d, root->left* %d, last %d, root->right* %d", + (tree->t_first ? tree->t_first->n_key : 0), first->n_key, + (tree->t_last ? tree->t_last->n_key : 0), last->n_key); + } + else post("empty"); + post("...verified (black-height is %d)", hammertree_verify(tree)); + post("------------------------"); +} +#endif + +/* assuming that target node (np->n_right) exists */ +static void hammertree_lrotate(t_hammertree *tree, t_hammernode *np) +{ + t_hammernode *target = np->n_right; + if (np->n_right = target->n_left) + np->n_right->n_parent = np; + if (!(target->n_parent = np->n_parent)) + tree->t_root = target; + else if (np == np->n_parent->n_left) + np->n_parent->n_left = target; + else + np->n_parent->n_right = target; + target->n_left = np; + np->n_parent = target; +} + +/* assuming that target node (np->n_left) exists */ +static void hammertree_rrotate(t_hammertree *tree, t_hammernode *np) +{ + t_hammernode *target = np->n_left; + if (np->n_left = target->n_right) + np->n_left->n_parent = np; + if (!(target->n_parent = np->n_parent)) + tree->t_root = target; + else if (np == np->n_parent->n_left) + np->n_parent->n_left = target; + else + np->n_parent->n_right = target; + target->n_right = np; + np->n_parent = target; +} + +static t_hammernode *hammertree_preinserthook(t_hammernode *np) +{ + while (np->n_prev && np->n_prev->n_key == np->n_key) + np = np->n_prev; + if (np->n_left) + { + np = np->n_prev; + if (np->n_right) + { + /* LATER revisit */ + bug("hammertree_preinserthook"); + return (0); /* do nothing */ + } + } + return (np); +} + +static t_hammernode *hammertree_postinserthook(t_hammernode *np) +{ + while (np->n_next && np->n_next->n_key == np->n_key) + np = np->n_next; + if (np->n_right) + { + np = np->n_next; + if (np->n_left) + { + /* LATER revisit */ + bug("hammertree_postinserthook"); + return (0); /* do nothing */ + } + } + return (np); +} + +/* Returns a newly inserted or already existing node (or 0 if allocation + failed). A caller is responsible for assigning a value. If hook is + supplied, it is called iff key is found. In case of key being found + (which means foundp returns 1), a new node is inserted, unless hook is + either empty, or returns null. Hook's nonempty return is the parent + for the new node. It is expected to have no more than one child. */ +static t_hammernode *hammertree_doinsert(t_hammertree *tree, int key, + t_hammertree_inserthook hook, + int *foundp) +{ + t_hammernode *np, *parent, *result; + int leftchild; + *foundp = 0; + if (!(np = tree->t_root)) + { + if (!(np = getbytes(tree->t_nodesize))) + return (0); + np->n_key = key; + np->n_black = 1; + tree->t_root = tree->t_first = tree->t_last = np; + return (np); + } + + do + { + if (np->n_key == key) + { + *foundp = 1; + if (hook && (parent = (*hook)(np))) + { + if (parent->n_left && parent->n_right) + { + bug("hammertree_insert, callback return 1"); + parent = parent->n_next; + } + if (leftchild = (key < parent->n_key)) + { + if (parent->n_left) + { + bug("hammertree_insert, callback return 2"); + leftchild = 0; + } + } + else if (parent->n_right) + leftchild = 1; + goto addit; + } + else return (np); /* a caller may then keep or replace the value */ + } + else parent = np; + } + while (np = (key < np->n_key ? np->n_left : np->n_right)); + leftchild = (key < parent->n_key); +addit: + /* parent has no more than one child, new node becomes + parent's immediate successor or predecessor */ + if (!(np = getbytes(tree->t_nodesize))) + return (0); + np->n_key = key; + np->n_parent = parent; + if (leftchild) + { + parent->n_left = np; + /* update the auxiliary linked list structure */ + np->n_next = parent; + if (np->n_prev = parent->n_prev) + np->n_prev->n_next = np; + else + tree->t_first = np; + parent->n_prev = np; + } + else + { + parent->n_right = np; + /* update the auxiliary linked list structure */ + np->n_prev = parent; + if (np->n_next = parent->n_next) + np->n_next->n_prev = np; + else + tree->t_last = np; + parent->n_next = np; + } + result = np; + + /* balance the tree -- LATER clean this if possible... */ + np->n_black = 0; + while (np != tree->t_root && !np->n_parent->n_black) + { + t_hammernode *uncle; + /* np->n_parent->n_parent exists (we always paint root node in black) */ + if (np->n_parent == np->n_parent->n_parent->n_left) + { + uncle = np->n_parent->n_parent->n_right; + if (!uncle /* (sentinel not used) */ + || uncle->n_black) + { + if (np == np->n_parent->n_right) + { + np = np->n_parent; + hammertree_lrotate(tree, np); + } + np->n_parent->n_black = 1; + np->n_parent->n_parent->n_black = 0; + hammertree_rrotate(tree, np->n_parent->n_parent); + } + else + { + np->n_parent->n_black = 1; + uncle->n_black = 1; + np = np->n_parent->n_parent; + np->n_black = 0; + } + } + else + { + uncle = np->n_parent->n_parent->n_left; + if (!uncle /* (sentinel not used) */ + || uncle->n_black) + { + if (np == np->n_parent->n_left) + { + np = np->n_parent; + hammertree_rrotate(tree, np); + } + np->n_parent->n_black = 1; + np->n_parent->n_parent->n_black = 0; + hammertree_lrotate(tree, np->n_parent->n_parent); + } + else + { + np->n_parent->n_black = 1; + uncle->n_black = 1; + np = np->n_parent->n_parent; + np->n_black = 0; + } + } + } + tree->t_root->n_black = 1; + return (result); +} + +/* assuming that requested node exists */ +void hammertree_delete(t_hammertree *tree, t_hammernode *gone) +{ + t_hammernode *parent; /* parent of gone, after relinking */ + t_hammernode *child; /* gone's only child (or null), after relinking */ + /* gone has to be the parent of no more than one child */ + if (gone->n_left && gone->n_right) + { + /* Successor is the new parent of gone's children, and a new child + of gone's parent (if any). Successor always exists in this context, + and it has no left child. The simplistic scheme is to replace + gone's fields with successor's fields, and delete the successor. + We cannot do so, however, because successor may be pointed at... */ + t_hammernode *successor = gone->n_next; + child = successor->n_right; + successor->n_left = gone->n_left; + successor->n_left->n_parent = successor; + if (successor == gone->n_right) + parent = successor; + else + { + /* successor's parent always exists in this context, + successor is the left child of its parent */ + parent = successor->n_parent; + parent->n_left = child; + if (child) /* (sentinel not used) */ + child->n_parent = parent; + successor->n_right = gone->n_right; + successor->n_right->n_parent = successor; + } + if (gone->n_parent) + { + int swp; + if (gone == gone->n_parent->n_left) + gone->n_parent->n_left = successor; + else + gone->n_parent->n_right = successor; + successor->n_parent = gone->n_parent; + swp = gone->n_black; + gone->n_black = successor->n_black; + successor->n_black = swp; + } + else + { + tree->t_root = successor; + successor->n_parent = 0; + gone->n_black = successor->n_black; + successor->n_black = 1; /* LATER rethink */ + } + + /* update the auxiliary linked list structure */ + if (successor->n_prev = gone->n_prev) + gone->n_prev->n_next = successor; + else + tree->t_first = successor; + } + else + { + /* update the auxiliary linked list structure */ + if (gone->n_prev) + gone->n_prev->n_next = gone->n_next; + else + tree->t_first = gone->n_next; + if (gone->n_next) + gone->n_next->n_prev = gone->n_prev; + else + tree->t_last = gone->n_prev; + + /* connect gone's child with gone's parent */ + if (gone->n_left) + child = gone->n_left; + else + child = gone->n_right; + if (parent = gone->n_parent) + { + if (child) /* (sentinel not used) */ + child->n_parent = parent; + if (gone == parent->n_left) + parent->n_left = child; + else + parent->n_right = child; + } + else + { + if (tree->t_root = child) + { + child->n_parent = 0; + child->n_black = 1; /* LATER rethink */ + } + goto done; + } + } + + if (gone->n_black) + { + /* balance the tree -- LATER clean this if possible... */ + /* on entry: tree is not empty, parent always exists, child + not necessarily... */ + while (child != tree->t_root && + (!child || /* (sentinel not used) */ + child->n_black)) + { + t_hammernode *other; /* another child of the same parent */ + if (child == parent->n_left) + { + other = parent->n_right; + if (other && /* (sentinel not used) */ + !other->n_black) + { + other->n_black = 1; + parent->n_black = 0; + hammertree_lrotate(tree, parent); + other = parent->n_right; + } + if (!other || /* (sentinel not used) */ + (!other->n_left || other->n_left->n_black) && + (!other->n_right || other->n_right->n_black)) + { + if (other) /* (sentinel not used) */ + other->n_black = 0; + child = parent; + parent = parent->n_parent; + } + else + { + if (!other || /* (sentinel not used) */ + !other->n_right || other->n_right->n_black) + { + if (other) /* (sentinel not used) */ + { + if (other->n_left) other->n_left->n_black = 1; + other->n_black = 0; + hammertree_rrotate(tree, other); + other = parent->n_right; + } + } + if (other) /* (sentinel not used) */ + { + if (other->n_right) other->n_right->n_black = 1; + other->n_black = parent->n_black; + } + parent->n_black = 1; + hammertree_lrotate(tree, parent); + tree->t_root->n_black = 1; /* LATER rethink */ + goto done; + } + } + else /* right child */ + { + other = parent->n_left; + if (other && /* (sentinel not used) */ + !other->n_black) + { + other->n_black = 1; + parent->n_black = 0; + hammertree_rrotate(tree, parent); + other = parent->n_left; + } + if (!other || /* (sentinel not used) */ + (!other->n_left || other->n_left->n_black) && + (!other->n_right || other->n_right->n_black)) + { + if (other) /* (sentinel not used) */ + other->n_black = 0; + child = parent; + parent = parent->n_parent; + } + else + { + if (!other || /* (sentinel not used) */ + !other->n_left || other->n_left->n_black) + { + if (other) /* (sentinel not used) */ + { + if (other->n_right) other->n_right->n_black = 1; + other->n_black = 0; + hammertree_lrotate(tree, other); + other = parent->n_left; + } + } + if (other) /* (sentinel not used) */ + { + if (other->n_left) other->n_left->n_black = 1; + other->n_black = parent->n_black; + } + parent->n_black = 1; + hammertree_rrotate(tree, parent); + tree->t_root->n_black = 1; /* LATER rethink */ + goto done; + } + } + } + if (child) /* (sentinel not used) */ + child->n_black = 1; + } +done: + freebytes(gone, tree->t_nodesize); +#ifdef HAMMERTREE_DEBUG + hammertree_verify(tree); +#endif +} + +t_hammernode *hammertree_search(t_hammertree *tree, int key) +{ + t_hammernode *np = tree->t_root; + while (np && np->n_key != key) + np = (key < np->n_key ? np->n_left : np->n_right); + return (np); +} + +t_hammernode *hammertree_closest(t_hammertree *tree, int key, int geqflag) +{ + t_hammernode *np, *parent; + if (!(np = tree->t_root)) + return (0); + do + if (np->n_key == key) + return (np); + else + parent = np; + while (np = (key < np->n_key ? np->n_left : np->n_right)); + if (geqflag) + return (key > parent->n_key ? parent->n_next : parent); + else + return (key < parent->n_key ? parent->n_prev : parent); +} + +t_hammernode *hammertree_insert(t_hammertree *tree, int key, int *foundp) +{ + return (hammertree_doinsert(tree, key, 0, foundp)); +} + +t_hammernode *hammertree_multiinsert(t_hammertree *tree, int key, int fifoflag) +{ + int found; + return (hammertree_doinsert(tree, key, (fifoflag ? + hammertree_postinserthook : + hammertree_preinserthook), &found)); +} + +t_hammernode *hammertree_insertfloat(t_hammertree *tree, int key, t_float f, + int replaceflag) +{ + int found; + t_hammernode *np = hammertree_doinsert(tree, key, 0, &found); + if (np && (!found || replaceflag)) + { + if (tree->t_valuetype == HAMMERTYPE_FLOAT) + { + t_hammernode_float *npf = (t_hammernode_float *)np; + npf->nf_value = f; + } + else if (tree->t_valuetype == HAMMERTYPE_ATOM) + { + t_hammernode_atom *npa = (t_hammernode_atom *)np; + t_atom *ap = &npa->na_value; + SETFLOAT(ap, f); + } + else bug("hammertree_insertfloat"); + } + return (np); +} + +t_hammernode *hammertree_insertsymbol(t_hammertree *tree, int key, t_symbol *s, + int replaceflag) +{ + int found; + t_hammernode *np = hammertree_doinsert(tree, key, 0, &found); + if (np && (!found || replaceflag)) + { + if (tree->t_valuetype == HAMMERTYPE_SYMBOL) + { + t_hammernode_symbol *nps = (t_hammernode_symbol *)np; + nps->ns_value = s; + } + else if (tree->t_valuetype == HAMMERTYPE_ATOM) + { + t_hammernode_atom *npa = (t_hammernode_atom *)np; + t_atom *ap = &npa->na_value; + SETSYMBOL(ap, s); + } + else bug("hammertree_insertsymbol"); + } + return (np); +} + +t_hammernode *hammertree_insertatom(t_hammertree *tree, int key, t_atom *ap, + int replaceflag) +{ + int found; + t_hammernode *np = hammertree_doinsert(tree, key, 0, &found); + if (np && (!found || replaceflag)) + { + if (tree->t_valuetype == HAMMERTYPE_ATOM) + { + t_hammernode_atom *npa = (t_hammernode_atom *)np; + npa->na_value = *ap; + } + else bug("hammertree_insertatom"); + } + return (np); +} + +/* LATER preallocate 'freecount' nodes */ +static void hammertree_doinit(t_hammertree *tree, t_hammertype vtype, + size_t nodesize, int freecount) +{ + tree->t_root = tree->t_first = tree->t_last = 0; + tree->t_valuetype = vtype; + tree->t_nodesize = nodesize; +} + +void hammertree_inittyped(t_hammertree *tree, + t_hammertype vtype, int freecount) +{ + size_t nsize; + switch (vtype) + { + case HAMMERTYPE_FLOAT: + nsize = sizeof(t_hammernode_float); + break; + case HAMMERTYPE_SYMBOL: + nsize = sizeof(t_hammernode_symbol); + break; + case HAMMERTYPE_ATOM: + nsize = sizeof(t_hammernode_atom); + break; + default: + bug("hammertree_inittyped"); + vtype = HAMMERTYPE_ILLEGAL; + nsize = sizeof(t_hammernode); + } + hammertree_doinit(tree, vtype, nsize, freecount); +} + +void hammertree_initcustom(t_hammertree *tree, + size_t nodesize, int freecount) +{ + hammertree_doinit(tree, HAMMERTYPE_CUSTOM, nodesize, freecount); +} + +/* LATER keep and/or preallocate 'freecount' nodes (if negative, keep all) */ +void hammertree_clear(t_hammertree *tree, int freecount) +{ + t_hammernode *np, *next = tree->t_first; + while (next) + { + np = next; + next = next->n_next; + freebytes(np, tree->t_nodesize); + } + hammertree_doinit(tree, tree->t_valuetype, tree->t_nodesize, 0); +} diff --git a/externals/miXed/shared/hammer/tree.h b/externals/miXed/shared/hammer/tree.h new file mode 100644 index 000000000..368fed2ae --- /dev/null +++ b/externals/miXed/shared/hammer/tree.h @@ -0,0 +1,86 @@ +/* Copyright (c) 2003-2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __HAMMERTREE_H__ +#define __HAMMERTREE_H__ + +#ifdef KRZYSZCZ +#define HAMMERTREE_DEBUG +#endif + +typedef enum +{ + HAMMERTYPE_FLOAT, HAMMERTYPE_SYMBOL, HAMMERTYPE_ATOM, + HAMMERTYPE_CUSTOM, HAMMERTYPE_ILLEGAL +} t_hammertype; + +typedef struct _hammernode +{ + int n_key; + int n_black; + struct _hammernode *n_left; + struct _hammernode *n_right; + struct _hammernode *n_parent; + struct _hammernode *n_prev; + struct _hammernode *n_next; +} t_hammernode; + +typedef struct _hammernode_float +{ + t_hammernode nf_node; + t_float nf_value; +} t_hammernode_float; + +typedef struct _hammernode_symbol +{ + t_hammernode ns_node; + t_symbol *ns_value; +} t_hammernode_symbol; + +typedef struct _hammernode_atom +{ + t_hammernode na_node; + t_atom na_value; +} t_hammernode_atom; + +typedef struct _hammertree +{ + t_hammernode *t_root; + t_hammernode *t_first; + t_hammernode *t_last; + t_hammertype t_valuetype; + size_t t_nodesize; +} t_hammertree; + +#define HAMMERNODE_GETFLOAT(np) (((t_hammernode_float *)(np))->nf_value) +#define HAMMERNODE_GETSYMBOL(np) (((t_hammernode_symbol *)(np))->ns_value) +#define HAMMERNODE_GETATOMPTR(np) (&((t_hammernode_atom *)(np))->na_value) + +typedef void (*t_hammernode_vshowhook)(t_hammernode *, char *, unsigned); + +t_hammernode *hammertree_search(t_hammertree *tree, int key); +t_hammernode *hammertree_closest(t_hammertree *tree, int key, int geqflag); + +t_hammernode *hammertree_insert(t_hammertree *tree, int key, int *foundp); +t_hammernode *hammertree_multiinsert(t_hammertree *tree, int key, int fifoflag); +t_hammernode *hammertree_insertfloat(t_hammertree *tree, int key, t_float f, + int replaceflag); +t_hammernode *hammertree_insertsymbol(t_hammertree *tree, int key, t_symbol *s, + int replaceflag); +t_hammernode *hammertree_insertatom(t_hammertree *tree, int key, t_atom *ap, + int replaceflag); +void hammertree_delete(t_hammertree *tree, t_hammernode *np); + +void hammertree_inittyped(t_hammertree *tree, + t_hammertype vtype, int freecount); +void hammertree_initcustom(t_hammertree *tree, + size_t nodesize, int freecount); +void hammertree_clear(t_hammertree *tree, int freecount); + +#ifdef HAMMERTREE_DEBUG +void hammertree_debug(t_hammertree *tree, int level, + t_hammernode_vshowhook hook); +#endif + +#endif diff --git a/externals/miXed/shared/notes.txt b/externals/miXed/shared/notes.txt new file mode 100644 index 000000000..43f4867c8 --- /dev/null +++ b/externals/miXed/shared/notes.txt @@ -0,0 +1,76 @@ +TODO for root and shared + * fitter: abstraction-scoped, class-selective compatibility control + * fitter: fittterstate map + * hammerfile, hammergui: version control + +DONE for root and shared + +with cyclone alpha55 + * new module: messtree + * qtree: + . nodes of a custom tree may be caller-owned: a caller may pass 0 as + nodesize to qtree_initcustom() and pass pre-allocated nodes to + insert/multiinsert calls + . new calls: qtree_override(), qtree_closestunder(), qtree_closestover() + . all "closest" calls report a diff between key requested and key found + * os: new calls (dummy under MSW, though): osdir_open(), osdir_setmode(), + osdir_close(), osdir_rewind(), osdir_next(), osdir_isfile(), osdir_isdir() + * loader: new calls, unstable_dirload_lib(), unstable_dirload_all() + * fitter: + . added "test" hook (as a first step towards a fittterstate map) + . new calls: fitter_getfloat(), fitter_getsymbol() + * fragile: new call fragile_class_getexterndir() + * loud: loud_syserror() accepts a format string + * support for building into subdirectory of the main bin directory + (so that a library may automatically load all its plugin externals) + +with toxy alpha18 + * plusbob: stubifying t_plusbob, in order to minimize memory leak to 4 words + +with rafts prealpha1 + * new module: patchvalue + +with toxy alpha17 + * scriptlet: new call scriptlet_newalike() + +with cyclone alpha54 and toxy alpha16 + * props: + . code cleanup + . new calls: props_getfirst(), props_getnext(), props_diff(), + props_clearall(), props_clearvalues() + . props_add(): additional argument 'filter' (skip exact input-filter copies) + * fragile: new call fragile_class_getnames() + * hammereditor: + . hammereditor_append() accepts unbalanced braces + . defaults to dirty, if (older) tk misses edit command + +with cyclone alpha53 + * binport: added half-byte #symbol id + * hammereditor: + . fixed closing by window manager + . dirty flag bound, shown and observed (unless in viewer mode) + . title specification simplified and standardized + . bug fix: incomplete transfer from editor + +with cyclone alpha52 + * fragile: class name resolution based on voluntary mutation and raising + * fitter: mirroring removed + * new module, os: opening files, parsing path + * hammerpanel: two modes of -initialdir persistence + * more mingw fixes + +with cyclone alpha51 + * new module, fitter: encapsulates compatibility support (formerly in maxmode) + * fitter: per-class callback and mirroring interface to compatibility mode + * mingw fixes + +with toxy alpha14 + * scriptlet: version control (verslet_ routines) + * debug printout restricted to krzYszcz, sent to stderr + +with cyclone alpha50 + * bug fixes + . hammertree crasher (affecting funbuff and offer) + . MouseState/toxy clash + * builds with gcc3 by default (no need to edit Makefile.common) + * midi file code has been cleaned, now ready for using in qlist diff --git a/externals/miXed/shared/shared.c b/externals/miXed/shared/shared.c new file mode 100644 index 000000000..d6d2c9863 --- /dev/null +++ b/externals/miXed/shared/shared.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "shared.h" + +void shared_debug(void) +{ + /* LATER */ +} diff --git a/externals/miXed/shared/shared.h b/externals/miXed/shared/shared.h new file mode 100644 index 000000000..73e84e2a3 --- /dev/null +++ b/externals/miXed/shared/shared.h @@ -0,0 +1,189 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __SHARED_H__ +#define __SHARED_H__ + +/* LATER find a proper place for #include <limits.h> */ +#ifdef INT_MAX +#define SHARED_INT_MAX INT_MAX +#else +#define SHARED_INT_MAX 0x7FFFFFFF +#endif +#ifdef INT_MIN +#define SHARED_INT_MIN INT_MIN +#else +#define SHARED_INT_MIN ((int)0x80000000) +#endif +/* LATER find a proper place for #include <float.h> */ +#ifdef FLT_MAX +#define SHARED_FLT_MAX FLT_MAX +#else +#define SHARED_FLT_MAX 1E+36 +#endif + +typedef unsigned long shared_t_bitmask; + +#ifdef __linux__ +#include <sys/types.h> +#ifndef int32 +typedef int32_t int32; +#endif +#ifndef uint32 +typedef u_int32_t uint32; +#endif +#ifndef int16 +typedef int16_t int16; +#endif +#ifndef uint16 +typedef u_int16_t uint16; +#endif +#ifndef uchar +typedef u_int8_t uchar; +#endif +#include <endian.h> +#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN) +#error No byte order defined +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define SHARED_HIOFFSET 1 +#define SHARED_LOWOFFSET 0 +#else +#define SHARED_HIOFFSET 0 +#define SHARED_LOWOFFSET 1 +#endif +#endif + +#ifdef NT +#ifndef int32 +typedef long int32; +#endif +#ifndef uint32 +typedef unsigned long uint32; +#endif +#ifndef int16 +typedef short int16; +#endif +#ifndef uint16 +typedef unsigned short uint16; +#endif +#ifndef uchar +typedef unsigned char uchar; +#endif +#define SHARED_HIOFFSET 1 +#define SHARED_LOWOFFSET 0 +#endif + +#ifdef MACOSX +#ifndef int32 +typedef int int32; +#endif +#ifndef uint32 +typedef unsigned int uint32; +#endif +#ifndef int16 +typedef short int16; +#endif +#ifndef uint16 +typedef unsigned short uint16; +#endif +#ifndef uchar +typedef unsigned char uchar; +#endif +#ifdef __BIG_ENDIAN__ +#define SHARED_HIOFFSET 0 +#define SHARED_LOWOFFSET 1 +#else +#define SHARED_HIOFFSET 1 +#define SHARED_LOWOFFSET 0 +#endif +#endif + +#ifdef IRIX +#ifndef int32 +typedef long int32; +#endif +#ifndef uint32 +typedef unsigned long uint32; +#endif +#ifndef int16 +typedef short int16; +#endif +#ifndef uint16 +typedef unsigned short uint16; +#endif +#ifndef uchar +typedef unsigned char uchar; +#endif +#define SHARED_HIOFFSET 0 +#define SHARED_LOWOFFSET 1 +#endif + +#ifdef __FreeBSD__ +#include <sys/types.h> +#ifndef int32 +typedef int32_t int32; +#endif +#ifndef uint32 +typedef u_int32_t uint32; +#endif +#ifndef int16 +typedef int16_t int16; +#endif +#ifndef uint16 +typedef u_int16_t uint16; +#endif +#ifndef uchar +typedef u_int8_t uchar; +#endif +#include <machine/endian.h> +#if BYTE_ORDER == LITTLE_ENDIAN +#define SHARED_HIOFFSET 1 +#define SHARED_LOWOFFSET 0 +#else +#define SHARED_HIOFFSET 0 +#define SHARED_LOWOFFSET 1 +#endif +#endif + +#define SHARED_UNITBIT32 1572864. /* 3*(2^19) gives 32 fractional bits */ +#define SHARED_UNITBIT0 6755399441055744. /* 3*(2^51), no fractional bits */ +#define SHARED_UNITBIT0_HIPART 0x43380000 + +typedef union _shared_wrappy +{ + double w_d; + int32 w_i[2]; +} t_shared_wrappy; + +typedef union _shared_floatint +{ + t_float fi_f; + int32 fi_i; +} t_shared_floatint; + +#define SHARED_TRUEBITS 0x3f800000 /* t_float f = 1; *(int32 *)&f */ + +#define SHARED_PI 3.14159265359 +#define SHARED_2PI 6.28318530718 + +#ifndef PD_BADFLOAT +#ifdef __i386__ +#define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \ + (((*(unsigned int*)&(f))&0x7f800000)==0x7f800000)) +#else +#define PD_BADFLOAT(f) 0 +#endif +#endif + +#ifndef PD_BIGORSMALL +#ifdef __i386__ +#define PD_BIGORSMALL(f) ((((*(unsigned int*)&(f))&0x60000000)==0) || \ + (((*(unsigned int*)&(f))&0x60000000)==0x60000000)) +#else +#define PD_BIGORSMALL(f) 0 +#endif +#endif + +#endif diff --git a/externals/miXed/shared/sickle/Makefile b/externals/miXed/shared/sickle/Makefile new file mode 100644 index 000000000..5dcb2c8cc --- /dev/null +++ b/externals/miXed/shared/sickle/Makefile @@ -0,0 +1,4 @@ +ROOT_DIR = ../.. +include $(ROOT_DIR)/Makefile.common + +all: $(OBJECTS) diff --git a/externals/miXed/shared/sickle/Makefile.objects b/externals/miXed/shared/sickle/Makefile.objects new file mode 100644 index 000000000..e69de29bb diff --git a/externals/miXed/shared/sickle/Makefile.sources b/externals/miXed/shared/sickle/Makefile.sources new file mode 100644 index 000000000..5575605c5 --- /dev/null +++ b/externals/miXed/shared/sickle/Makefile.sources @@ -0,0 +1,3 @@ +OTHER_SOURCES = \ +sic.c \ +arsic.c diff --git a/externals/miXed/shared/sickle/arsic.c b/externals/miXed/shared/sickle/arsic.c new file mode 100644 index 000000000..fe9f5954f --- /dev/null +++ b/externals/miXed/shared/sickle/arsic.c @@ -0,0 +1,222 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* generic array-based signal class */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "shared.h" +#include "common/loud.h" +#include "common/vefl.h" +#include "sickle/sic.h" +#include "sickle/arsic.h" + +void arsic_clear(t_arsic *x) +{ + x->s_vecsize = 0; + memset(x->s_vectors, 0, x->s_nchannels * sizeof(*x->s_vectors)); +} + +void arsic_redraw(t_arsic *x) +{ + if (x->s_mononame) + { + t_garray *ap = + (t_garray *)pd_findbyclass(x->s_mononame, garray_class); + if (ap) garray_redraw(ap); + else if (x->s_vectors[0]) loudbug_bug("arsic_redraw 1"); + } + else if (*x->s_stub) + { + int ch = x->s_nchannels; + while (ch--) + { + t_garray *ap = + (t_garray *)pd_findbyclass(x->s_channames[ch], garray_class); + if (ap) garray_redraw(ap); + else if (x->s_vectors[ch]) loudbug_bug("arsic_redraw 2"); + } + } +} + +void arsic_validate(t_arsic *x, int complain) +{ + arsic_clear(x); + x->s_vecsize = SHARED_INT_MAX; + if (x->s_mononame) + { + x->s_vectors[0] = + vefl_get(x->s_mononame, &x->s_vecsize, 1, + (complain ? (t_pd *)x : 0)); + } + else if (*x->s_stub) + { + int ch; + for (ch = 0; ch < x->s_nchannels ; ch++) + { + int vsz = x->s_vecsize; /* ignore missing arrays */ + x->s_vectors[ch] = + vefl_get(x->s_channames[ch], &vsz, 1, + (complain ? (t_pd *)x : 0)); + if (vsz < x->s_vecsize) x->s_vecsize = vsz; + } + } + if (x->s_vecsize == SHARED_INT_MAX) x->s_vecsize = 0; +} + +void arsic_check(t_arsic *x) +{ + x->s_playable = (!((t_sic *)x)->s_disabled && x->s_vecsize >= x->s_minsize); +} + +int arsic_getnchannels(t_arsic *x) +{ + return (x->s_nchannels); +} + +void arsic_setarray(t_arsic *x, t_symbol *s, int complain) +{ + if (s) + { + if (x->s_mononame) x->s_mononame = s; + else + { + x->s_stub = s->s_name; + if (*x->s_stub) + { + char buf[MAXPDSTRING]; + int ch; + for (ch = 0; ch < x->s_nchannels; ch++) + { + sprintf(buf, "%d-%s", ch, x->s_stub); + x->s_channames[ch] = gensym(buf); + } + } + } + arsic_validate(x, complain); + } + arsic_check(x); +} + +void arsic_setminsize(t_arsic *x, int i) +{ + x->s_minsize = i; +} + +void arsic_dsp(t_arsic *x, t_signal **sp, t_perfroutine perf, int complain) +{ + t_int *ap = x->s_perfargs; + if (ap) + { + int i, nsigs = x->s_nperfargs - 2; + x->s_ksr = sp[0]->s_sr * 0.001; + arsic_validate(x, complain); + arsic_check(x); + + /* LATER consider glist traversing, and, if we have no feeders, + choosing an optimized version of perform routine */ + + *ap++ = (t_int)x; + *ap++ = (t_int)sp[0]->s_n; + for (i = 0; i < nsigs; i++) *ap++ = (t_int)sp[i]->s_vec; + dsp_addv(perf, x->s_nperfargs, x->s_perfargs); + } + else loudbug_bug("arsic_dsp"); +} + +void arsic_free(t_arsic *x) +{ + if (x->s_vectors) + freebytes(x->s_vectors, x->s_nchannels * sizeof(*x->s_vectors)); + if (x->s_channames) + freebytes(x->s_channames, + x->s_nchannels * sizeof(*x->s_channames)); + if (x->s_perfargs) + freebytes(x->s_perfargs, x->s_nperfargs * sizeof(*x->s_perfargs)); +} + +/* If nauxsigs is positive, then the number of signals is nchannels + nauxsigs; + otherwise the channels are not used as signals, and the number of signals is + nsigs -- provided that nsigs is positive -- or, if it is not, then an arsic + is not used in dsp (peek~). */ +void *arsic_new(t_class *c, t_symbol *s, + int nchannels, int nsigs, int nauxsigs) +{ + t_arsic *x; + t_symbol *mononame; + char *stub; + t_float **vectors; + int nperfargs = 0; + t_int *perfargs = 0; + t_symbol **channames = 0; + if (!s) s = &s_; + if (nchannels < 1) + { + nchannels = 1; + mononame = s; + stub = 0; + } + else + { + mononame = 0; + stub = s->s_name; + } + if (!(vectors = (t_float **)getbytes(nchannels * sizeof(*vectors)))) + return (0); + if (nauxsigs > 0) + nperfargs = nchannels + nauxsigs + 2; + else if (nsigs > 0) + nperfargs = nsigs + 2; + if (nperfargs + && !(perfargs = (t_int *)getbytes(nperfargs * sizeof(*perfargs)))) + { + freebytes(vectors, nchannels * sizeof(*vectors)); + return (0); + } + if (stub && + !(channames = (t_symbol **)getbytes(nchannels * sizeof(*channames)))) + { + freebytes(vectors, nchannels * sizeof(*vectors)); + if (perfargs) freebytes(perfargs, nperfargs * sizeof(*perfargs)); + return (0); + } + x = (t_arsic *)pd_new(c); + x->s_vecsize = 0; + x->s_nchannels = nchannels; + x->s_vectors = vectors; + x->s_channames = channames; + x->s_nperfargs = nperfargs; + x->s_perfargs = perfargs; + x->s_mononame = mononame; + x->s_stub = stub; + x->s_ksr = sys_getsr() * 0.001; + ((t_sic *)x)->s_disabled = 0; + x->s_playable = 0; + x->s_minsize = 1; + arsic_setarray(x, s, 0); + return (x); +} + +static void arsic_enable(t_arsic *x, t_floatarg f) +{ + ((t_sic *)x)->s_disabled = (f == 0); + arsic_check(x); +} + +/* LATER somehow link this to sic_setup() */ +void arsic_setup(t_class *c, void *dspfn, void *floatfn) +{ + if (floatfn != SIC_NOMAINSIGNALIN) + { + if (floatfn) + { + class_domainsignalin(c, -1); + class_addfloat(c, floatfn); + } + else CLASS_MAINSIGNALIN(c, t_sic, s_f); + } + class_addmethod(c, (t_method)dspfn, gensym("dsp"), 0); + class_addmethod(c, (t_method)arsic_enable, gensym("enable"), 0); +} diff --git a/externals/miXed/shared/sickle/arsic.h b/externals/miXed/shared/sickle/arsic.h new file mode 100644 index 000000000..a941279a1 --- /dev/null +++ b/externals/miXed/shared/sickle/arsic.h @@ -0,0 +1,38 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __ARSIC_H__ +#define __ARSIC_H__ + +typedef struct _arsic +{ + t_sic s_sic; + int s_vecsize; /* used also as a validation flag */ + int s_nchannels; + t_float **s_vectors; + t_symbol **s_channames; + int s_nperfargs; + t_int *s_perfargs; + t_symbol *s_mononame; /* used also as an 'ismono' flag */ + char *s_stub; + float s_ksr; + int s_playable; + int s_minsize; +} t_arsic; + +void arsic_clear(t_arsic *x); +void arsic_redraw(t_arsic *x); +void arsic_validate(t_arsic *x, int complain); +void arsic_check(t_arsic *x); +int arsic_getnchannels(t_arsic *x); +void arsic_setarray(t_arsic *x, t_symbol *s, int complain); +void arsic_setminsize(t_arsic *x, int i); + +void arsic_dsp(t_arsic *x, t_signal **sp, t_perfroutine perf, int complain); +void *arsic_new(t_class *c, t_symbol *s, + int nchannels, int nsigs, int nauxsigs); +void arsic_free(t_arsic *x); +void arsic_setup(t_class *c, void *dspfn, void *floatfn); + +#endif diff --git a/externals/miXed/shared/sickle/sic.c b/externals/miXed/shared/sickle/sic.c new file mode 100644 index 000000000..3630b2b7b --- /dev/null +++ b/externals/miXed/shared/sickle/sic.c @@ -0,0 +1,121 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* generic signal class */ + +#include <math.h> +#include "m_pd.h" +#include "shared.h" +#include "common/loud.h" +#include "sickle/sic.h" + +#ifdef KRZYSZCZ +//#define SIC_DEBUG +#endif + +#if defined(NT) || defined(MACOSX) +/* cf pd/src/x_arithmetic.c */ +#define cosf cos +#endif + +t_inlet *sic_inlet(t_sic *x, int ix, t_float df, int ax, int ac, t_atom *av) +{ + t_inlet *in = 0; + if (ax < ac) + { + if (av[ax].a_type == A_FLOAT) + df = av[ax].a_w.w_float; + else + loud_error((t_pd *)x, "bad argument %d (float expected)", ax + 1); + } + if (ix) + { + in = inlet_new((t_object *)x, (t_pd *)x, &s_signal, &s_signal); + /* this is persistent (in->i_un.iu_floatsignalvalue = df) */ + pd_float((t_pd *)in, df); + } + else + { + in = ((t_object *)x)->ob_inlet; + pd_float((t_pd *)x, df); + } + return (in); +} + +t_inlet *sic_newinlet(t_sic *x, t_float f) +{ + return (sic_inlet(x, 1, f, 0, 0, 0)); +} + +t_float *sic_makecostable(int *sizep) +{ + /* permanent cache (tables are never freed); LATER rethink */ + static t_float *sic_costables[SIC_NCOSTABLES]; + int ndx, sz; + /* round upwards -- always return at least requested number of elements, + unless the maximum of 2^SIC_NCOSTABLES is exceeded; LATER rethink */ + /* (the minimum, at ndx 0, is 2^1) */ + for (ndx = 0, sz = 2; ndx < (SIC_NCOSTABLES - 1); ndx++, sz <<= 1) + if (sz >= *sizep) + break; +#ifdef SIC_DEBUG + loudbug_post("request for a costable of %d points (effective %d, ndx %d)", + *sizep, sz, ndx); +#endif + *sizep = sz; + if (sic_costables[ndx]) + return (sic_costables[ndx]); + else if (sz == COSTABSIZE && cos_table) + return (sic_costables[ndx] = cos_table); + else + { + int cnt = sz + 1; + float phase = 0, phsinc = SHARED_2PI / sz; + t_float *table = (t_float *)getbytes(cnt * sizeof(*table)), *tp = table; + if (table) + { +#ifdef SIC_DEBUG + loudbug_post("got %d points of a costable", cnt); +#endif + while (cnt--) + { + *tp++ = cosf(phase); + phase += phsinc; + } + } + return (sic_costables[ndx] = table); + } +} + +static void sic_enable(t_sic *x, t_floatarg f) +{ + x->s_disabled = (f == 0); +} + +void sic_setup(t_class *c, void *dspfn, void *floatfn) +{ + static int checked = 0; + if (!checked) + { + /* MSP: here we check at startup whether the byte alignment + is as we declared it. If not, the code has to be + recompiled the other way. */ + t_shared_wrappy wrappy; + wrappy.w_d = SHARED_UNITBIT32 + 0.5; + if ((unsigned)wrappy.w_i[SHARED_LOWOFFSET] != 0x80000000) + loudbug_bug("sic_setup: unexpected machine alignment"); + checked = 1; + } + if (floatfn != SIC_NOMAINSIGNALIN) + { + if (floatfn) + { + class_domainsignalin(c, -1); + class_addfloat(c, floatfn); + } + else CLASS_MAINSIGNALIN(c, t_sic, s_f); + } + class_addmethod(c, (t_method)dspfn, gensym("dsp"), 0); + class_addmethod(c, (t_method)sic_enable, gensym("enable"), 0); +} diff --git a/externals/miXed/shared/sickle/sic.h b/externals/miXed/shared/sickle/sic.h new file mode 100644 index 000000000..9dce95f68 --- /dev/null +++ b/externals/miXed/shared/sickle/sic.h @@ -0,0 +1,25 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __SIC_H__ +#define __SIC_H__ + +typedef struct _sic +{ + t_object s_ob; + t_float s_f; + int s_disabled; +} t_sic; + +#define SIC_FLOATTOSIGNAL ((void *)0) +#define SIC_NOMAINSIGNALIN ((void *)-1) + +#define SIC_NCOSTABLES 16 /* this is oscbank~'s max, LATER rethink */ + +t_inlet *sic_inlet(t_sic *x, int ix, t_float df, int ax, int ac, t_atom *av); +t_inlet *sic_newinlet(t_sic *x, t_float f); +t_float *sic_makecostable(int *sizep); +void sic_setup(t_class *c, void *dspfn, void *floatfn); + +#endif diff --git a/externals/miXed/shared/toxy/Makefile b/externals/miXed/shared/toxy/Makefile new file mode 100644 index 000000000..5dcb2c8cc --- /dev/null +++ b/externals/miXed/shared/toxy/Makefile @@ -0,0 +1,4 @@ +ROOT_DIR = ../.. +include $(ROOT_DIR)/Makefile.common + +all: $(OBJECTS) diff --git a/externals/miXed/shared/toxy/Makefile.objects b/externals/miXed/shared/toxy/Makefile.objects new file mode 100644 index 000000000..e69de29bb diff --git a/externals/miXed/shared/toxy/Makefile.sources b/externals/miXed/shared/toxy/Makefile.sources new file mode 100644 index 000000000..0613017d4 --- /dev/null +++ b/externals/miXed/shared/toxy/Makefile.sources @@ -0,0 +1,3 @@ +OTHER_SOURCES = \ +scriptlet.c \ +plusbob.c diff --git a/externals/miXed/shared/toxy/plusbob.c b/externals/miXed/shared/toxy/plusbob.c new file mode 100644 index 000000000..350b3c808 --- /dev/null +++ b/externals/miXed/shared/toxy/plusbob.c @@ -0,0 +1,400 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" +#include "plusbob.h" + +#ifdef KRZYSZCZ +//#define PLUSBOB_DEBUG +#endif + +/* The main failure of the current implementation is when a foreign object + stores a faked symbol beyond lifetime of a wrappee. There is no obvious + way of protecting against stale pointers, other than leaking small + portions of memory (four words) with every new faked symbol. In case of + plustot, this is not a very big deal, since for each [+tot] object the + number of wrapped tcl objects is small and constant. + + Another failure is when a foreign object binds something to a faked + symbol (for example, when a faked symbol is passed to an array's rename + method). This should not happen in usual contexts, and even if it does, + it will unlikely cause any real harm. + + LATER let there be a choice of using either fake-symbols, or gpointers. + The gpointer layout would be such: gs_un points to a plusbob-like + structure (without the bob_stub field), a unique integer code has to be + reserved for gs_which, the fields gp_un and gp_valid are ignored. + Using bob_refcount instead of gs_refcount is likely to simplify code. */ + +typedef struct _plusstub +{ + t_symbol sb_tag; /* common value for all bob types */ + t_plusbob *sb_bob; +} t_plusstub; + +/* Currently, objects of all +bob types are tagged with the same name: */ +static char plustag_name[] = "+bob"; + +static void plustag_init(t_symbol *tag) +{ + tag->s_name = plustag_name; + tag->s_thing = 0; + tag->s_next = 0; +} + +/* returns tagged +bob if valid, null otherwise (silent if caller is empty) */ +t_plusbob *plustag_isvalid(t_symbol *tag, t_pd *caller) +{ + if (tag->s_name == plustag_name) + return (((t_plusstub *)tag)->sb_bob); + else if (caller) + { + if (strcmp(tag->s_name, plustag_name)) + loud_error((caller == PLUSBOB_OWNER ? 0 : caller), + "does not understand '%s' (check object connections)", tag->s_name); + else + loud_error((caller == PLUSBOB_OWNER ? 0 : caller), "confused..."); + } + return (0); +} + +static t_plusstub *plusstub_create(t_plusbob *bob) +{ + t_plusstub *stub = getbytes(sizeof(*stub)); + plustag_init(&stub->sb_tag); + stub->sb_bob = bob; + return (stub); +} + +/* +bob is an object tossed around, a bobbing object. Currently, this is + a wrapping for Tcl_Interp, Tcl_Obj, or a tcl variable, but the +bob + interface is abstract enough to be suitable for other types of objects. + The t_plusbob is kind of a virtual base. */ + +struct _plustype +{ + t_plustype *tp_base; /* empty, if directly derived from t_plusbob */ + t_symbol *tp_name; + size_t tp_size; + /* constructor is to be called explicitly, from derived constructors, + or from a public wrapper. */ + t_plustypefn tp_deletefn; /* destructor */ + t_plustypefn tp_preservefn; + t_plustypefn tp_releasefn; + t_plustypefn tp_attachfn; +}; + +static t_plustype *plustype_default = 0; + +t_plustype *plustype_new(t_plustype *base, t_symbol *name, size_t sz, + t_plustypefn deletefn, + t_plustypefn preservefn, t_plustypefn releasefn, + t_plustypefn attachfn) +{ + t_plustype *tp = getbytes(sizeof(*tp)); + tp->tp_base = base; + tp->tp_name = name; + tp->tp_size = sz; + tp->tp_deletefn = deletefn; + tp->tp_preservefn = preservefn; + tp->tp_releasefn = releasefn; + tp->tp_attachfn = attachfn; + return (tp); +} + +static void plusbob_doattach(t_plusbob *bob, t_plusbob *parent) +{ + if (bob->bob_parent = parent) + { + /* become the youngest child: */ + bob->bob_prev = 0; + if (bob->bob_next = parent->bob_children) + { + if (parent->bob_children->bob_prev) + loudbug_bug("plusbob_doattach 1"); + parent->bob_children->bob_prev = bob; + } + parent->bob_children = bob; + } + else loudbug_bug("plusbob_doattach 2"); +} + +static void plusbob_dodetach(t_plusbob *bob) +{ + if (bob->bob_parent) + { + if (bob->bob_prev) + { + if (bob == bob->bob_parent->bob_children) + loudbug_bug("plusbob_dodetach 1"); + bob->bob_prev->bob_next = bob->bob_next; + } + if (bob->bob_next) + bob->bob_next->bob_prev = bob->bob_prev; + if (bob == bob->bob_parent->bob_children) + bob->bob_parent->bob_children = bob->bob_next; + } + else loudbug_bug("plusbob_dodetach 2"); +} + +/* To be called from derived constructors. + Preserving is caller's responsibility. */ +t_plusbob *plusbob_create(t_plustype *tp, t_plusbob *parent) +{ + t_plusbob *bob; + if (!tp) + { + if (!plustype_default) + plustype_default = plustype_new(0, 0, sizeof(t_plusbob), + 0, 0, 0, 0); + tp = plustype_default; + } + if (bob = getbytes(tp->tp_size)) + { + bob->bob_stub = (t_symbol *)plusstub_create(bob); + bob->bob_type = tp; + while (tp->tp_base) tp = tp->tp_base; + bob->bob_root = tp; + bob->bob_owner = 0; + bob->bob_refcount = 0; + bob->bob_dorefcount = 1; + bob->bob_children = 0; + if (parent) + plusbob_doattach(bob, parent); + else + bob->bob_parent = 0; + } + return (bob); +} + +/* Should never be called, but from plusbob_release(). + Calling from a derived destructor is illegal. */ +static void plusbob_free(t_plusbob *bob) +{ + t_plustype *tp; + if (bob->bob_parent) + plusbob_dodetach(bob); + for (tp = bob->bob_type; tp; tp = tp->tp_base) + if (tp->tp_deletefn) (*tp->tp_deletefn)(bob); + freebytes(bob, (bob->bob_type ? bob->bob_type->tp_size : sizeof(*bob))); + /* the stub remains... */ +} + +void plusbob_preserve(t_plusbob *bob) +{ + if (bob->bob_dorefcount) + { + t_plustype *tp; + for (tp = bob->bob_type; tp; tp = tp->tp_base) + if (tp->tp_preservefn) (*tp->tp_preservefn)(bob); + bob->bob_refcount++; + } +} + +void plusbob_release(t_plusbob *bob) +{ + if (bob->bob_dorefcount) + { + t_plustype *tp; + for (tp = bob->bob_type; tp; tp = tp->tp_base) + if (tp->tp_releasefn) (*tp->tp_releasefn)(bob); + if (--bob->bob_refcount <= 0) + { + if (bob->bob_refcount == 0) + plusbob_free(bob); + else + loudbug_bug("plusbob_release"); + } + } +} + +t_plusbob *plusbob_getparent(t_plusbob *bob) +{ + return (bob->bob_parent); +} + +/* To be called for redirection only. Bobs created as orphans are a special + case, and cannot be attached later on. Likewise, changing non-orphan bobs + to orphans is illegal. */ +void plusbob_attach(t_plusbob *bob, t_plusbob *newparent) +{ + if (bob->bob_parent && newparent) + { + t_plustype *tp; + plusbob_dodetach(bob); + plusbob_doattach(bob, newparent); + for (tp = bob->bob_type; tp; tp = tp->tp_base) + if (tp->tp_attachfn) (*tp->tp_attachfn)(bob); + } + else if (newparent) + loudbug_bug("plusbob_attach 1"); + else + loudbug_bug("plusbob_attach 2"); +} + +t_plusbob *plusbob_getnext(t_plusbob *bob) +{ + return (bob->bob_next); +} + +t_plusbob *plusbob_getchildren(t_plusbob *bob) +{ + return (bob->bob_children); +} + +/* Redirect all bobs to a replacement parent. + Assuming replacement exists. */ +void plusbob_detachchildren(t_plusbob *bob, t_plusbob *newparent) +{ + while (bob->bob_children) + plusbob_attach(bob->bob_children, newparent); +} + +void plusbob_detachownedchildren(t_plusbob *bob, t_plusbob *newparent, + t_pd *owner) +{ + t_plusbob *child = bob->bob_children, *next; + while (child) + { + next = child->bob_next; + if (child->bob_owner == owner) + plusbob_attach(child, newparent); + child = next; + } +} + +void plusbob_setowner(t_plusbob *bob, t_pd *owner) +{ + bob->bob_owner = owner; +} + +t_pd *plusbob_getowner(t_plusbob *bob) +{ + return (bob->bob_owner); +} + +void outlet_plusbob(t_outlet *o, t_plusbob *bob) +{ + outlet_symbol(o, bob->bob_stub); +} + +/* returns tagged +bob if valid, null otherwise (silent if caller is empty) */ +t_plusbob *plustag_validtype(t_symbol *tag, t_symbol *tname, t_pd *caller) +{ + if (tag->s_name == plustag_name) + { + t_plusbob *bob = ((t_plusstub *)tag)->sb_bob; + if (bob->bob_type->tp_name == tname) + return (bob); + else if (caller) + { + t_symbol *s = bob->bob_type->tp_name; + loud_error((caller == PLUSBOB_OWNER ? bob->bob_owner : caller), + "invalid type '%s' ('%s' expected)", + (s ? s->s_name : "<unknown>"), + (tname ? tname->s_name : "<unknown>")); + } + } + else if (plustag_isvalid(tag, caller)) /* print the error there */ + loudbug_bug("plustag_validtype"); + return (0); +} + +/* returns tagged +bob if valid, null otherwise (silent if caller is empty) */ +t_plusbob *plustag_validroot(t_symbol *tag, t_symbol *rname, t_pd *caller) +{ + if (tag->s_name == plustag_name) + { + t_plusbob *bob = ((t_plusstub *)tag)->sb_bob; + if (bob->bob_root->tp_name == rname) + return (bob); + else if (caller) + { + t_symbol *s = bob->bob_root->tp_name; + loud_error((caller == PLUSBOB_OWNER ? bob->bob_owner : caller), + "invalid base type '%s' ('%s' expected)", + (s ? s->s_name : "<unknown>"), + (rname ? rname->s_name : "<unknown>")); + } + } + else if (plustag_isvalid(tag, caller)) /* print the error there */ + loudbug_bug("plustag_validroot"); + return (0); +} + +t_symbol *plustag_typename(t_symbol *tag, int validate, t_pd *caller) +{ + if (!validate || tag->s_name == plustag_name) + return (((t_plusstub *)tag)->sb_bob->bob_type->tp_name); + else if (plustag_isvalid(tag, caller)) /* print the error there */ + loudbug_bug("plustag_typename"); + return (0); +} + +t_symbol *plustag_rootname(t_symbol *tag, int validate, t_pd *caller) +{ + if (!validate || tag->s_name == plustag_name) + return (((t_plusstub *)tag)->sb_bob->bob_root->tp_name); + else if (plustag_isvalid(tag, caller)) /* print the error there */ + loudbug_bug("plustag_rootname"); + return (0); +} + +/* Plusenv (aka +env) is the base for an `environment' +bob. Environment + encapsulates data common for a collection of +bobs. This is the standard + way of grouping +bobs, according to a parent/children relationship. */ + +static t_plustype *plusenv_type = 0; +static t_plusbob *plusenv_parent = 0; /* the parent of all environments */ + +/* To be called from derived constructors (or, LATER, plusenv's provider). */ +t_plusenv *plusenv_create(t_plustype *tp, t_plusbob *parent, t_symbol *id) +{ + t_plusenv *env = 0; + if (env = (t_plusenv *)plusbob_create(tp, parent)) + { + if (!id) + /* LATER design a public interface for bob_dorefcount */ + ((t_plusbob *)env)->bob_dorefcount = 0; + env->env_id = id; /* LATER rethink */ + } + return (env); +} + +t_plusenv *plusenv_find(t_symbol *id, t_plusenv *defenv) +{ + if (plusenv_parent && id) + { + t_plusbob *bob; + for (bob = plusenv_parent->bob_children; bob; bob = bob->bob_next) + if (((t_plusenv *)bob)->env_id == id) + break; + return ((t_plusenv *)bob); + } + else return (defenv); +} + +t_symbol *plusenv_getid(t_plusenv *env) +{ + return (env->env_id); +} + +/* Type ignored, LATER rethink. */ +t_plusbob *plusenv_getparent(t_plustype *tp) +{ + if (!plusenv_parent) plusenv_parent = plusbob_create(0, 0); + return (plusenv_parent); +} + +t_plustype *plusenv_setup(void) +{ + if (!plusenv_type) + { + plusenv_type = plustype_new(0, gensym("+env"), + sizeof(t_plusenv), 0, 0, 0, 0); + } + return (plusenv_type); +} diff --git a/externals/miXed/shared/toxy/plusbob.h b/externals/miXed/shared/toxy/plusbob.h new file mode 100644 index 000000000..391e5c1d9 --- /dev/null +++ b/externals/miXed/shared/toxy/plusbob.h @@ -0,0 +1,72 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __PLUSBOB_H__ +#define __PLUSBOB_H__ + +EXTERN_STRUCT _plustype; +#define t_plustype struct _plustype +EXTERN_STRUCT _plusbob; +#define t_plusbob struct _plusbob +EXTERN_STRUCT _plusenv; +#define t_plusenv struct _plusenv + +/* LATER move to plusbob.c */ +struct _plusbob +{ + t_symbol *bob_stub; /* points back to stub = symbol, pointer-to-here */ + t_plustype *bob_type; /* our type */ + t_plustype *bob_root; /* our base type directly derived from t_plusbob */ + t_pd *bob_owner; + int bob_refcount; + int bob_dorefcount; + t_plusbob *bob_children; /* empty, unless we are a parent */ + /* each bob has exactly one parent, unless being a special, `orphan' case */ + t_plusbob *bob_parent; + t_plusbob *bob_prev; /* younger brother */ + t_plusbob *bob_next; /* older sister */ +}; + +struct _plusenv +{ + t_plusbob env_bob; + t_symbol *env_id; /* LATER use local symbol namespace */ +}; + +#define PLUSBOB_OWNER ((t_pd *)-1) + +typedef void (*t_plustypefn)(void *); + +t_plusbob *plustag_isvalid(t_symbol *tag, t_pd *caller); +t_plusbob *plustag_validtype(t_symbol *tag, t_symbol *tname, t_pd *caller); +t_plusbob *plustag_validroot(t_symbol *tag, t_symbol *rname, t_pd *caller); +t_symbol *plustag_typename(t_symbol *tag, int validate, t_pd *caller); +t_symbol *plustag_rootname(t_symbol *tag, int validate, t_pd *caller); + +t_plustype *plustype_new(t_plustype *base, t_symbol *name, size_t sz, + t_plustypefn deletefn, + t_plustypefn preservefn, t_plustypefn releasefn, + t_plustypefn attachfn); + +t_plusbob *plusbob_create(t_plustype *tp, t_plusbob *parent); +void plusbob_preserve(t_plusbob *bob); +void plusbob_release(t_plusbob *bob); +t_plusbob *plusbob_getparent(t_plusbob *bob); +void plusbob_attach(t_plusbob *bob, t_plusbob *newparent); +t_plusbob *plusbob_getnext(t_plusbob *bob); +t_plusbob *plusbob_getchildren(t_plusbob *bob); +void plusbob_detachchildren(t_plusbob *bob, t_plusbob *newparent); +void plusbob_detachownedchildren(t_plusbob *bob, t_plusbob *newparent, + t_pd *owner); +void plusbob_setowner(t_plusbob *bob, t_pd *owner); +t_pd *plusbob_getowner(t_plusbob *bob); +void outlet_plusbob(t_outlet *o, t_plusbob *bob); + +t_plusenv *plusenv_create(t_plustype *tp, t_plusbob *parent, t_symbol *id); +t_plusenv *plusenv_find(t_symbol *id, t_plusenv *defenv); +t_symbol *plusenv_getid(t_plusenv *env); +t_plusbob *plusenv_getparent(t_plustype *tp); +t_plustype *plusenv_setup(void); + +#endif diff --git a/externals/miXed/shared/toxy/scriptlet.c b/externals/miXed/shared/toxy/scriptlet.c new file mode 100644 index 000000000..42e3c02db --- /dev/null +++ b/externals/miXed/shared/toxy/scriptlet.c @@ -0,0 +1,1089 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <string.h> +#ifdef UNIX +#include <unistd.h> +#endif +#ifdef NT +#include <io.h> +#endif +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/props.h" +#include "scriptlet.h" + +#ifdef KRZYSZCZ +//#define SCRIPTLET_DEBUG +#endif + +#define SCRIPTLET_INISIZE 1024 +#define SCRIPTLET_INIDOTSIZE 256 +#define SCRIPTLET_MARGIN 64 +#define SCRIPTLET_DOTMARGIN 16 +/* cf SOCKSIZE in older versions of t_tkcmd.c, FIXME */ +#define SCRIPTLET_MAXPUSH 20000 + +enum { SCRIPTLET_CVOK, SCRIPTLET_CVUNKNOWN, SCRIPTLET_CVMISSING }; + +#define VERSLET_MAXPACKAGE 32 +#define VERSLET_MAXVERSION 32 + +typedef struct _verslet +{ + t_pd *v_owner; + char v_package[VERSLET_MAXPACKAGE]; + char v_version[VERSLET_MAXVERSION]; +} t_verslet; + +struct _scriptlet +{ + t_pd *s_owner; + t_glist *s_glist; /* containing glist (empty allowed) */ + t_symbol *s_rptarget; /* reply target */ + t_symbol *s_cbtarget; /* callback target */ + t_symbol *s_item; /* item's name (readable part of its path) */ + t_scriptlet_cvfn s_cvfn; /* if empty, passing resolveall is a bug */ + t_canvas *s_cv; /* as returned by cvfn */ + int s_cvstate; + int s_locked; /* append lock, for filtering, when reading from file */ + int s_size; + char *s_buffer; + char s_bufini[SCRIPTLET_INISIZE]; + char *s_head; /* ptr to the command part of a scriptlet */ + char *s_tail; + char s_separator; /* current separator, set before a new token */ + int s_dotsize; + int s_dotoffset; + char *s_dotbuffer; + char s_dotbufini[SCRIPTLET_INIDOTSIZE]; +}; + +static t_canvas *scriptlet_canvasvalidate(t_scriptlet *sp, int visedonly) +{ + t_canvas *cv; + if (sp->s_cvstate == SCRIPTLET_CVUNKNOWN) + { + if (sp->s_cvfn) + cv = sp->s_cv = sp->s_cvfn(sp->s_owner); + else + { + loudbug_bug("scriptlet_canvasvalidate"); + return (0); + } + if (cv && (!visedonly || glist_isvisible(cv))) + sp->s_cvstate = SCRIPTLET_CVOK; + else + sp->s_cvstate = SCRIPTLET_CVMISSING; + } + else cv = sp->s_cv; + return (sp->s_cvstate == SCRIPTLET_CVOK ? cv : 0); +} + +static int scriptlet_ready(t_scriptlet *sp) +{ + int len = sp->s_tail - sp->s_head; + if (len > 0 && *sp->s_head && sp->s_cvstate != SCRIPTLET_CVMISSING) + { + if (len < SCRIPTLET_MAXPUSH) + return (1); + else + loud_error(sp->s_owner, + "scriptlet too long to be pushed (%d bytes)", len); + } + return (0); +} + +static int scriptlet_doappend(t_scriptlet *sp, char *buf) +{ + if (buf && !sp->s_locked) + { + int nprefix = sp->s_head - sp->s_buffer; + int nused = sp->s_tail - sp->s_buffer; + int newsize = nused + strlen(buf) + SCRIPTLET_MARGIN; + if (newsize > sp->s_size) + { + int nrequested = newsize; + sp->s_buffer = grow_withdata(&nrequested, &nused, + &sp->s_size, sp->s_buffer, + SCRIPTLET_INISIZE, sp->s_bufini, + sizeof(*sp->s_buffer)); + if (nrequested != newsize) + { + scriptlet_reset(sp); + return (0); + } + sp->s_head = sp->s_buffer + nprefix; + sp->s_tail = sp->s_buffer + nused; + } + if (sp->s_separator && sp->s_tail > sp->s_head) + *sp->s_tail++ = sp->s_separator; + *sp->s_tail = 0; + strcpy(sp->s_tail, buf); + sp->s_tail += strlen(sp->s_tail); + } + sp->s_separator = 0; + return (1); +} + +static int scriptlet_dotstring(t_scriptlet *sp, char *st) +{ + int len = strlen(st), + newsize = sp->s_dotoffset + len + SCRIPTLET_DOTMARGIN; + if (newsize > sp->s_dotsize) + { + int nrequested = newsize; + sp->s_dotbuffer = grow_withdata(&nrequested, &sp->s_dotoffset, + &sp->s_dotsize, sp->s_dotbuffer, + SCRIPTLET_INIDOTSIZE, sp->s_dotbufini, + sizeof(*sp->s_dotbuffer)); + if (nrequested != newsize) + { + sp->s_dotoffset = 0; + sp->s_dotbuffer[0] = 0; + return (0); + } + } + strcpy(sp->s_dotbuffer + sp->s_dotoffset, st); + sp->s_dotoffset += len; + return (1); +} + +static int scriptlet_dotfloat(t_scriptlet *sp, float f) +{ + char obuf[32]; + sprintf(obuf, "%g", f); + return (scriptlet_dotstring(sp, obuf)); +} + +static char *scriptlet_dedot(t_scriptlet *sp, char *ibuf, + int resolveall, int visedonly, + int ac, t_atom *av, t_props *argprops) +{ + int len = 0; + char *obuf = sp->s_dotbuffer; + sp->s_dotoffset = 0; + switch (*ibuf) + { + case '#': + if (resolveall) + { + int which = ibuf[1] - '1'; + if (which >= 0 && which < 9) + { + if (which < ac) + { + av += which; + if (av->a_type == A_FLOAT) + sprintf(obuf, "%g", av->a_w.w_float); + else if (av->a_type == A_SYMBOL && av->a_w.w_symbol) + scriptlet_dotstring(sp, av->a_w.w_symbol->s_name); + else + obuf[0] = 0; /* LATER rethink */ + } + else strcpy(obuf, "0"); + len = 2; + } + else if (!strncmp(&ibuf[1], "args", 4)) + { + if (ac) while (1) + { + if (av->a_type == A_FLOAT) + scriptlet_dotfloat(sp, av->a_w.w_float); + else if (av->a_type == A_SYMBOL && av->a_w.w_symbol) + scriptlet_dotstring(sp, av->a_w.w_symbol->s_name); + else + { /* LATER rethink */ + obuf[0] = 0; + break; + } + ac--; av++; + if (ac) + sp->s_dotbuffer[sp->s_dotoffset++] = ' '; + else + break; + } + else obuf[0] = 0; + len = 5; + } + else if (argprops) + { + char *iptr, *optr, c; + int cnt; + for (iptr = ibuf + 1, c = *iptr, cnt = 1; c; + iptr++, c = *iptr, cnt++) + { + if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) + { + *iptr = 0; + break; + } + } + if (optr = props_getvalue(argprops, ibuf + 1)) + { + scriptlet_dotstring(sp, optr); + len = cnt; + } + if (c) *iptr = c; + } + } + break; + case '-': + if (resolveall && sp->s_item) + { + t_canvas *cv; + if (cv = scriptlet_canvasvalidate(sp, visedonly)) + { + sprintf(obuf, ".x%x.c.%s%x", (int)cv, sp->s_item->s_name, + (int)sp->s_owner); + len = 1; + } + } + break; + case '^': + if (resolveall) + { + t_canvas *cv; + if (cv = scriptlet_canvasvalidate(sp, visedonly)) + { + sprintf(obuf, ".x%x", (int)cv); + len = 1; + } + } + break; + case '|': + if (resolveall) + { + strcpy(obuf, sp->s_cbtarget->s_name); + len = 1; + } + break; + case '~': /* FIXME, the dot-tilde stuff is purely experimental. */ + if (resolveall) + { + t_canvas *cv; + if (cv = scriptlet_canvasvalidate(sp, 0)) + { + t_glist *glist; + if (!strncmp(&ibuf[1], "tag", 3)) + { + t_rtext *rt; + glist = cv->gl_owner; + if (glist && glist_isvisible(glist) && glist->gl_editor + && (rt = glist_findrtext(glist, (t_object *)cv))) + sprintf(obuf, "%s", rtext_gettag(rt)); + else + obuf[0] = 0; + len = 4; + } + else if (!strncmp(&ibuf[1], "parent", 6)) + { + glist = cv->gl_owner; + if (glist && glist_isvisible(glist)) + sprintf(obuf, ".x%x", (int)glist); + else + obuf[0] = 0; + len = 7; + } + else if (!strncmp(&ibuf[1], "root", 4)) + { + glist = canvas_getrootfor(cv); + if (glist && glist_isvisible(glist)) + sprintf(obuf, ".x%x", (int)glist); + else + obuf[0] = 0; + len = 5; + } + else if (!strncmp(&ibuf[1], "owner", 5)) + { + if (glist = canvas_getrootfor(cv)) + glist = glist->gl_owner; + if (glist && glist_isvisible(glist)) + sprintf(obuf, ".x%x", (int)glist); + else + obuf[0] = 0; + len = 6; + } + else if (!strncmp(&ibuf[1], "top", 3)) + { + glist = cv; + while (glist->gl_owner) glist = glist->gl_owner; + if (glist && glist_isvisible(glist)) + sprintf(obuf, ".x%x", (int)glist); + else + obuf[0] = 0; + len = 4; + } + /* LATER find out when gl_<coords> are updated, + think how to better sync them to Tk. */ + else if (!strncmp(&ibuf[1], "x1", 2)) + { + sprintf(obuf, "%d", cv->gl_screenx1); + len = 3; + } + else if (!strncmp(&ibuf[1], "x2", 2)) + { + sprintf(obuf, "%d", cv->gl_screenx2); + len = 3; + } + else if (!strncmp(&ibuf[1], "y1", 2)) + { + sprintf(obuf, "%d", cv->gl_screeny1); + len = 3; + } + else if (!strncmp(&ibuf[1], "y2", 2)) + { + sprintf(obuf, "%d", cv->gl_screeny2); + len = 3; + } + else if (!strncmp(&ibuf[1], "edit", 4)) + { + sprintf(obuf, "%d", cv->gl_edit); + len = 5; + } + else if (!strncmp(&ibuf[1], "gop", 3)) + { + sprintf(obuf, "%d", glist_isgraph(cv)); + len = 4; + } + else if (!strncmp(&ibuf[1], "dir", 3)) + { + sprintf(obuf, "%s", canvas_getdir(cv)->s_name); + len = 4; + } + else loud_error(sp->s_owner, "bad field '%s'", &ibuf[1]); + } + } + break; + case '`': + sprintf(obuf, "\\"); + len = 1; + break; + case ':': + sprintf(obuf, ";"); + len = 1; + break; + case '(': + sprintf(obuf, "{"); + len = 1; + break; + case ')': + sprintf(obuf, "}"); + len = 1; + break; + case '<': + if (resolveall) + { + if (ibuf[1] == ':') + { + sprintf(obuf, "{pd [concat "); + len = 2; + } + else if (ibuf[1] == '|') + { + sprintf(obuf, "{pd [concat %s ", sp->s_rptarget->s_name); + len = 2; + } + else + { + sprintf(obuf, "{pd [concat %s _cb ", sp->s_cbtarget->s_name); + len = 1; + } + } + break; + case '>': + if (resolveall) + { + sprintf(obuf, "\\;]}"); + len = 1; + } + break; + } + return (len ? ibuf + len : 0); +} + +int scriptlet_isempty(t_scriptlet *sp) +{ + return (!(sp->s_tail > sp->s_head && *sp->s_head)); +} + +void scriptlet_reset(t_scriptlet *sp) +{ + sp->s_cvstate = SCRIPTLET_CVUNKNOWN; + sp->s_locked = 0; + sp->s_separator = 0; + strcpy(sp->s_buffer, "namespace eval ::toxy {\ + proc query {} {set ::toxy::reply [\n"); + sp->s_head = sp->s_tail = sp->s_buffer + strlen(sp->s_buffer); +} + +void scriptlet_prealloc(t_scriptlet *sp, int sz, int mayshrink) +{ + if (sz < SCRIPTLET_INISIZE) + sz = SCRIPTLET_INISIZE; + if (sz < sp->s_size && mayshrink) + { + if (sp->s_buffer != sp->s_bufini) + freebytes(sp->s_buffer, sp->s_size * sizeof(*sp->s_buffer)); + else + loudbug_bug("scriptlet_prealloc"); + sp->s_size = SCRIPTLET_INISIZE; + sp->s_buffer = sp->s_bufini; + } + if (sz > sp->s_size) + sp->s_buffer = grow_nodata(&sz, &sp->s_size, sp->s_buffer, + SCRIPTLET_INISIZE, sp->s_bufini, + sizeof(*sp->s_buffer)); + scriptlet_reset(sp); +} + +static int scriptlet_addstring(t_scriptlet *sp, char *ibuf, + int resolveall, int visedonly, + int ac, t_atom *av, t_props *argprops) +{ + int result = 1; + char *bp = ibuf, *ep = ibuf, *ep1; + if (!sp->s_separator) + sp->s_separator = ' '; + while (*ep) + { + if (*ep == '.' + && (ep1 = scriptlet_dedot(sp, ep + 1, resolveall, visedonly, + ac, av, argprops))) + { + *ep = 0; + if (!(result = scriptlet_doappend(sp, bp))) + break; + *ep = '.'; + if (!(result = scriptlet_doappend(sp, sp->s_dotbuffer))) + break; + bp = ep = ep1; + } + else ep++; + } + if (result) + result = scriptlet_doappend(sp, bp); + sp->s_separator = 0; + return (result); +} + +static int scriptlet_addfloat(t_scriptlet *sp, t_float f) +{ + char buf[64]; + if (!sp->s_separator) + sp->s_separator = ' '; + sprintf(buf, "%g", f); + return (scriptlet_doappend(sp, buf)); +} + +int scriptlet_add(t_scriptlet *sp, + int resolveall, int visedonly, int ac, t_atom *av) +{ + while (ac--) + { + int result = 1; + if (av->a_type == A_SYMBOL) + result = scriptlet_addstring(sp, av->a_w.w_symbol->s_name, + resolveall, visedonly, 0, 0, 0); + else if (av->a_type == A_FLOAT) + result = scriptlet_addfloat(sp, av->a_w.w_float); + if (!result) + return (0); + av++; + } + return (1); +} + +void scriptlet_setseparator(t_scriptlet *sp, char c) +{ + sp->s_separator = c; +} + +void scriptlet_push(t_scriptlet *sp) +{ + if (scriptlet_ready(sp)) + { + char *tail = sp->s_tail; + strcpy(tail, "\n"); + sys_gui(sp->s_head); + *tail = 0; + } +} + +void scriptlet_qpush(t_scriptlet *sp) +{ + if (scriptlet_ready(sp)) + { + char buf[MAXPDSTRING]; + char *tail = sp->s_tail; + /* Could not find any other way, than to postpone processing of the + query, after everything which might have been glued to our tail, + is evaluated. Otherwise, any command arriving later, during + blocking of the query (e.g. in a Tk dialog), would be evaluated + prior to our tail, via Tcl_DoOneEvent(). We postpone also the + setup step (defining the query proc), in order to be able to + handle several queries at once. All this is far from ideal -- + the sequence "query this, tot that", is swapped, unless written + as "query this, tot after 0 .(that.)", which is going to cause + much confusion... LATER revisit. Do not forget, that since + pd_readsocket() is not reentrant, sys_gui()d commands should never + enter event loop directly by blocking on a dialog, vwait, etc., + because the pd_readsocket handler is event-driven on unix. */ + sys_gui("after 0 {\n"); + strcpy(tail, "]}}\n"); + sys_gui(sp->s_buffer); + *tail = 0; + sprintf(buf, "\ + if {[info tclversion] < 8.4} {\n\ + trace variable ::toxy::reply w \"::toxy::doreply %s\"\n\ + } else {\n\ + trace add variable ::toxy::reply write \"::toxy::doreply %s\"\n\ + }\n\ + ::toxy::query}\n", sp->s_rptarget->s_name, sp->s_rptarget->s_name); + sys_gui(buf); + } +} + +/* Non-substituting -- LATER think if this is likely to cause any confusion. + Especially, consider the widget_vis() vs. widget_update() case. */ +void scriptlet_vpush(t_scriptlet *sp, char *varname) +{ + if (scriptlet_ready(sp)) + { + char *tail = sp->s_tail; + strcpy(tail, "}\n"); + sys_vgui("set ::toxy::%s { ", varname); + sys_gui(sp->s_head); + *tail = 0; + } +} + +int scriptlet_evaluate(t_scriptlet *insp, t_scriptlet *outsp, int visedonly, + int ac, t_atom *av, t_props *argprops) +{ + if (scriptlet_ready(insp)) + { + t_atom *ap; + int i; + char *bp; + char separator = 0; + /* FIXME pregrowing of the transient scriptlet */ + scriptlet_reset(outsp); + /* LATER abstract this into scriptlet_parse() */ + bp = insp->s_head; + while (*bp) + { + if (*bp == '\n') + separator = '\n'; + else if (*bp == ' ' || *bp == '\t') + { + if (!separator) separator = ' '; + } + else + { + int done = 1; + char *ep = bp; + char c = ' '; + while (*++ep) + { + if (*ep == ' ' || *bp == '\t' || *ep == '\n') + { + done = 0; + c = *ep; + *ep = 0; + break; + } + } + outsp->s_separator = separator; + scriptlet_addstring(outsp, bp, 1, visedonly, ac, av, argprops); + if (done) + break; + *ep = c; + bp = ep; + separator = (c == '\t' ? ' ' : c); + } + bp++; + } + return (outsp->s_cvstate != SCRIPTLET_CVMISSING); + } + else return (0); +} + +/* utility function to be used in a comment-parsing callback */ +char *scriptlet_nextword(char *buf) +{ + while (*++buf) + { + if (*buf == ' ' || *buf == '\t') + { + char *ptr = buf + 1; + while (*ptr == ' ' || *ptr == '\t') ptr++; + *buf = 0; + return (*ptr ? ptr : 0); + } + } + return (0); +} + +static t_verslet *verslet_new(t_pd *owner) +{ + t_verslet *vp = getbytes(sizeof(*vp)); + vp->v_owner = owner; + vp->v_package[0] = 0; + vp->v_version[0] = 0; + return (vp); +} + +static void verslet_free(t_verslet *vp) +{ + freebytes(vp, sizeof(*vp)); +} + +static void verslet_set(t_verslet *vp, char *pname, char *vname) +{ + strncpy(vp->v_package, pname, VERSLET_MAXPACKAGE-1); + vp->v_package[VERSLET_MAXPACKAGE-1] = 0; + strncpy(vp->v_version, vname, VERSLET_MAXVERSION-1); + vp->v_version[VERSLET_MAXVERSION-1] = 0; +} + +static int verslet_parse(t_verslet *vp, char *buf, int multiline) +{ + char *ptr = buf; + int plen = 0; + vp->v_package[0] = 0; + vp->v_version[0] = 0; + if (multiline) + { + while (*ptr) + { + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (strncmp(ptr, "package", 7)) + { + while (*ptr && *ptr != '\n') ptr++; + if (*ptr) + buf = ++ptr; + } + else break; + } + if (*ptr) + ptr += 7; + else + ptr = 0; + } + else + { + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (strncmp(ptr, "package", 7)) + ptr = 0; + else + ptr += 7; + } + if (ptr) + { + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (!strncmp(ptr, "provide", 7)) + { + ptr += 7; + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (*ptr) + { + for (plen = 0; plen < VERSLET_MAXPACKAGE-1 && *ptr; + plen++, ptr++) + { + if (*ptr == '\n' || *ptr == '\r') + break; + else if (*ptr == ' ' || *ptr == '\t') + { + vp->v_package[plen] = 0; +#ifdef SCRIPTLET_DEBUG + loudbug_post("package \"%s\"", vp->v_package); +#endif + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (*ptr >= '0' && *ptr <= '9') + { + int vlen; + for (vlen = 0; vlen < VERSLET_MAXVERSION-1 && *ptr; + vlen++, ptr++) + { + if ((*ptr >= '0' && *ptr <= '9') || *ptr == '.') + vp->v_version[vlen] = *ptr; + else + break; + } + if (vlen) + { + vp->v_version[vlen] = 0; +#ifdef SCRIPTLET_DEBUG + loudbug_post("version \"%s\"", vp->v_version); +#endif + return (1); + } + } + break; + } + else vp->v_package[plen] = *ptr; + } + } + } + if (plen) + loud_error(vp->v_owner, + "incomplete scriptlet version declaration \"%s\"", buf); + } + return (0); +} + +static int verslet_compare(t_verslet *vp1, t_verslet *vp2) +{ + char *vname1 = vp1->v_version, *vname2 = vp2->v_version; + while (*vname1 || *vname2) + { + int v1, v2; + for (v1 = 0; *vname1 >= '0' && *vname1 <= '9'; vname1++) + v1 = v1 * 10 + *vname1 - '0'; + for (v2 = 0; *vname2 >= '0' && *vname2 <= '9'; vname2++) + v2 = v2 * 10 + *vname2 - '0'; + if (v1 < v2) + return (-1); + else if (v1 > v2) + return (1); + if (*vname1) + { + if (*vname1 == '.') + *vname1++; + if (*vname1 < '0' || *vname1 > '9') + { + loud_error(vp1->v_owner, "invalid version \"%s\"", + vp1->v_version); + while (*vname1) *vname1++; + } + } + if (*vname2) + { + if (*vname2 == '.') + *vname2++; + if (*vname2 < '0' || *vname2 > '9') + { + loud_error(vp2->v_owner, "invalid version \"%s\"", + vp2->v_version); + while (*vname2) *vname2++; + } + } + } + return (0); +} + +static int scriptlet_doread(t_scriptlet *sp, t_pd *caller, FILE *fp, + char *rc, t_verslet *vcompare, + char *builtin, t_scriptlet_cmntfn cmntfn) +{ + t_scriptlet *outsp = sp, *newsp; + t_verslet *vp; + int vdiff = 0; + char buf[MAXPDSTRING]; + if (!caller) caller = sp->s_owner; + vp = (vcompare ? verslet_new(caller) : 0); + while ((fp && !feof(fp) && fgets(buf, MAXPDSTRING - 1, fp)) + || builtin) + { + char *ptr; + if (builtin) + { + int i; + for (i = 0, ptr = buf; i < MAXPDSTRING - 1; i++, ptr++) + { + if ((*ptr = (*builtin ? *builtin : '\n')) == '\n') + { + ptr[1] = 0; + if (*builtin) builtin++; + if (!*builtin) builtin = 0; + break; + } + else builtin++; + } + } + else + { + for (ptr = buf; *ptr; ptr++) + if (*ptr == '\r') + *ptr = ' '; /* LATER rethink */ + if (vp && verslet_parse(vp, buf, 0)) + { + if (vdiff = verslet_compare(vp, vcompare)) + goto readfailed; + else + { + verslet_free(vp); + vp = 0; + } + } + } + ptr = buf; + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (*ptr == '#') + { + if (cmntfn) + { + char sel = *++ptr; + if (sel && sel != '\n') + { + ptr++; + while (*ptr == ' ' || *ptr == '\t') ptr++; + if (*ptr == '\n') + *ptr = 0; + if (*ptr) + { + char *ep = ptr + strlen(ptr) - 1; + while (*ep == ' ' || *ep == '\t' || *ep == '\n') + ep--; + ep[1] = 0; + } + if (vp) + goto readfailed; /* FIXME call a request cmntfn? */ + newsp = cmntfn(caller, rc, sel, ptr); + if (newsp == SCRIPTLET_UNLOCK) + outsp->s_locked = 0; + else if (newsp == SCRIPTLET_LOCK) + outsp->s_locked = 1; + else if (newsp != outsp) + { + outsp->s_locked = 0; + outsp = newsp; + } + } + } + } + else if (*ptr && *ptr != '\n') + scriptlet_doappend(outsp, buf); + } +readfailed: + outsp->s_locked = 0; + if (vp) + { + verslet_free(vp); + scriptlet_reset(sp); + if (vdiff < 0) + return (SCRIPTLET_OLDERVERSION); + else if (vdiff > 0) + return (SCRIPTLET_NEWERVERSION); + else + return (SCRIPTLET_NOVERSION); + } + else return (SCRIPTLET_OK); +} + +/* Load particular section(s) from buffer (skip up to an unlocking comment, + keep appending up to a locking comment, repeat). */ +int scriptlet_rcparse(t_scriptlet *sp, t_pd *caller, char *rc, char *contents, + t_scriptlet_cmntfn cmntfn) +{ + int result; + sp->s_locked = 1; /* see scriptlet_doread() above for unlocking scheme */ + result = scriptlet_doread(sp, caller, 0, rc, 0, contents, cmntfn); + return (result); +} + +int scriptlet_rcload(t_scriptlet *sp, t_pd *caller, char *rc, char *ext, + char *builtin, t_scriptlet_cmntfn cmntfn) +{ + int result; + char filename[MAXPDSTRING], buf[MAXPDSTRING], *nameptr, *dir; + int fd; + if (sp->s_glist) + dir = canvas_getdir(sp->s_glist)->s_name; + else + dir = ""; /* which means pwd, usually the same as at Pd startup... */ + if ((fd = open_via_path(dir, rc, ext, buf, &nameptr, MAXPDSTRING, 0)) < 0) + { + result = SCRIPTLET_NOFILE; + } + else + { + FILE *fp; + close(fd); + if (nameptr != buf) + { + strcpy(filename, buf); + strcat(filename, "/"); + strcat(filename, nameptr); + sys_bashfilename(filename, filename); + } + else sys_bashfilename(nameptr, filename); + if (fp = fopen(filename, "r")) + { + t_verslet *vp; + if (builtin) + { + vp = verslet_new(sp->s_owner); + if (!verslet_parse(vp, builtin, 1)) + { + loudbug_bug("scriptlet_rcload 1"); + verslet_free(vp); + vp = 0; + } + } + else vp = 0; + result = scriptlet_doread(sp, caller, fp, rc, vp, 0, cmntfn); + fclose(fp); + if (vp) + verslet_free(vp); + } + else + { + loudbug_bug("scriptlet_rcload 2"); + result = SCRIPTLET_NOFILE; + } + } + if (result != SCRIPTLET_OK) + { + scriptlet_doread(sp, caller, 0, rc, 0, builtin, cmntfn); + } + return (result); +} + +int scriptlet_read(t_scriptlet *sp, t_symbol *fn) +{ + int result; + FILE *fp; + char buf[MAXPDSTRING]; + post("loading scriptlet file \"%s\"", fn->s_name); + /* FIXME use open_via_path() */ + if (sp->s_glist) + canvas_makefilename(sp->s_glist, fn->s_name, buf, MAXPDSTRING); + else + strncpy(buf, fn->s_name, MAXPDSTRING); + sys_bashfilename(buf, buf); + if (fp = fopen(buf, "r")) + { + scriptlet_reset(sp); + result = scriptlet_doread(sp, 0, fp, 0, 0, 0, 0); + fclose(fp); + } + else + { + loud_error(sp->s_owner, "error while loading file \"%s\"", fn->s_name); + result = SCRIPTLET_NOFILE; + } + return (result); +} + +int scriptlet_write(t_scriptlet *sp, t_symbol *fn) +{ + int size = sp->s_tail - sp->s_head; + if (size > 0 && *sp->s_head) + { + FILE *fp; + char buf[MAXPDSTRING]; + post("saving scriptlet file \"%s\"", fn->s_name); + if (sp->s_glist) + canvas_makefilename(sp->s_glist, fn->s_name, buf, MAXPDSTRING); + else + strncpy(buf, fn->s_name, MAXPDSTRING); + sys_bashfilename(buf, buf); + if (fp = fopen(buf, "w")) + { + int result = fwrite(sp->s_head, 1, size, fp); + fclose(fp); + if (result == size) + return (SCRIPTLET_OK); + } + loud_error(sp->s_owner, "error while saving file \"%s\"", fn->s_name); + return (fp ? SCRIPTLET_BADFILE : SCRIPTLET_NOFILE); + } + else + { + loud_warning(sp->s_owner, "scriptlet", "empty scriptlet not written"); + return (SCRIPTLET_IGNORED); + } +} + +char *scriptlet_getcontents(t_scriptlet *sp, int *lenp) +{ + *lenp = sp->s_tail - sp->s_head; + return (sp->s_head); +} + +char *scriptlet_getbuffer(t_scriptlet *sp, int *sizep) +{ + *sizep = sp->s_size; + return (sp->s_buffer); +} + +void scriptlet_setowner(t_scriptlet *sp, t_pd *owner) +{ + sp->s_owner = owner; +} + +void scriptlet_clone(t_scriptlet *to, t_scriptlet *from) +{ + scriptlet_reset(to); + to->s_separator = ' '; + /* LATER add a flag to optionally use from's buffer with refcount */ + scriptlet_doappend(to, from->s_head); +} + +void scriptlet_append(t_scriptlet *to, t_scriptlet *from) +{ + to->s_separator = ' '; + scriptlet_doappend(to, from->s_head); +} + +void scriptlet_free(t_scriptlet *sp) +{ + if (sp) + { + if (sp->s_buffer != sp->s_bufini) + freebytes(sp->s_buffer, sp->s_size * sizeof(*sp->s_buffer)); + if (sp->s_dotbuffer != sp->s_dotbufini) + freebytes(sp->s_dotbuffer, + sp->s_dotsize * sizeof(*sp->s_dotbuffer)); + freebytes(sp, sizeof(*sp)); + } +} + +/* The parameter 'gl' (null accepted) is necessary, because the 's_glist' + field, if implicitly set, would be dangerous (after a glist is gone) + and confusing (current directory used for i/o of a global scriptlet). */ +t_scriptlet *scriptlet_new(t_pd *owner, + t_symbol *rptarget, t_symbol *cbtarget, + t_symbol *item, t_glist *glist, + t_scriptlet_cvfn cvfn) +{ + t_scriptlet *sp = getbytes(sizeof(*sp)); + if (sp) + { + static int configured = 0; + if (!configured) + { + sys_gui("image create bitmap ::toxy::img::empty -data {}\n"); + sys_gui("proc ::toxy::doreply {target vname vndx op} {\n"); + sys_gui(" pd [concat $target _rp $::toxy::reply \\;]\n"); + sys_gui(" unset ::toxy::reply\n"); + sys_gui("}\n"); + configured = 1; + } + sp->s_owner = owner; + sp->s_glist = glist; + sp->s_rptarget = rptarget; + sp->s_cbtarget = cbtarget; + sp->s_item = item; + sp->s_cvfn = cvfn; + sp->s_size = SCRIPTLET_INISIZE; + sp->s_buffer = sp->s_bufini; + sp->s_dotsize = SCRIPTLET_INIDOTSIZE; + sp->s_dotoffset = 0; + sp->s_dotbuffer = sp->s_dotbufini; + scriptlet_reset(sp); + } + return (sp); +} + +t_scriptlet *scriptlet_newalike(t_scriptlet *sp) +{ + return (scriptlet_new(sp->s_owner, sp->s_rptarget, sp->s_cbtarget, + sp->s_item, sp->s_glist, sp->s_cvfn)); +} diff --git a/externals/miXed/shared/toxy/scriptlet.h b/externals/miXed/shared/toxy/scriptlet.h new file mode 100644 index 000000000..588795094 --- /dev/null +++ b/externals/miXed/shared/toxy/scriptlet.h @@ -0,0 +1,50 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __SCRIPTLET_H__ +#define __SCRIPTLET_H__ + +enum { SCRIPTLET_OK = 0, SCRIPTLET_NOFILE, SCRIPTLET_BADFILE, + SCRIPTLET_NOVERSION, SCRIPTLET_OLDERVERSION, SCRIPTLET_NEWERVERSION, + SCRIPTLET_IGNORED }; +#define SCRIPTLET_UNLOCK ((t_scriptlet *)0) +#define SCRIPTLET_LOCK ((t_scriptlet *)1) + +EXTERN_STRUCT _scriptlet; +#define t_scriptlet struct _scriptlet + +typedef t_canvas *(*t_scriptlet_cvfn)(t_pd *); +typedef t_scriptlet *(*t_scriptlet_cmntfn)(t_pd *, char *, char, char *); + +int scriptlet_isempty(t_scriptlet *sp); +void scriptlet_reset(t_scriptlet *sp); +void scriptlet_prealloc(t_scriptlet *sp, int sz, int mayshrink); +int scriptlet_add(t_scriptlet *sp, + int resolveall, int visedonly, int ac, t_atom *av); +void scriptlet_setseparator(t_scriptlet *sp, char c); +void scriptlet_push(t_scriptlet *sp); +void scriptlet_qpush(t_scriptlet *sp); +void scriptlet_vpush(t_scriptlet *sp, char *varname); +int scriptlet_evaluate(t_scriptlet *insp, t_scriptlet *outsp, int visedonly, + int ac, t_atom *av, t_props *argprops); +char *scriptlet_nextword(char *buf); +int scriptlet_rcparse(t_scriptlet *sp, t_pd *caller, char *rc, char *contents, + t_scriptlet_cmntfn cmntfn); +int scriptlet_rcload(t_scriptlet *sp, t_pd *caller, char *rc, char *ext, + char *builtin, t_scriptlet_cmntfn cmntfn); +int scriptlet_read(t_scriptlet *sp, t_symbol *fn); +int scriptlet_write(t_scriptlet *sp, t_symbol *fn); +char *scriptlet_getcontents(t_scriptlet *sp, int *lenp); +char *scriptlet_getbuffer(t_scriptlet *sp, int *sizep); +void scriptlet_setowner(t_scriptlet *sp, t_pd *owner); +void scriptlet_clone(t_scriptlet *to, t_scriptlet *from); +void scriptlet_append(t_scriptlet *to, t_scriptlet *from); +void scriptlet_free(t_scriptlet *sp); +t_scriptlet *scriptlet_new(t_pd *owner, + t_symbol *rptarget, t_symbol *cbtarget, + t_symbol *item, t_glist *glist, + t_scriptlet_cvfn cvfn); +t_scriptlet *scriptlet_newalike(t_scriptlet *sp); + +#endif diff --git a/externals/miXed/shared/unstable/Makefile b/externals/miXed/shared/unstable/Makefile new file mode 100644 index 000000000..5dcb2c8cc --- /dev/null +++ b/externals/miXed/shared/unstable/Makefile @@ -0,0 +1,4 @@ +ROOT_DIR = ../.. +include $(ROOT_DIR)/Makefile.common + +all: $(OBJECTS) diff --git a/externals/miXed/shared/unstable/Makefile.objects b/externals/miXed/shared/unstable/Makefile.objects new file mode 100644 index 000000000..e69de29bb diff --git a/externals/miXed/shared/unstable/Makefile.sources b/externals/miXed/shared/unstable/Makefile.sources new file mode 100644 index 000000000..56f996946 --- /dev/null +++ b/externals/miXed/shared/unstable/Makefile.sources @@ -0,0 +1,5 @@ +OTHER_SOURCES = \ +forky.c \ +fragile.c \ +fringe.c \ +loader.c diff --git a/externals/miXed/shared/unstable/forky.c b/externals/miXed/shared/unstable/forky.c new file mode 100644 index 000000000..3383dac2d --- /dev/null +++ b/externals/miXed/shared/unstable/forky.c @@ -0,0 +1,108 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Put here compilation conditionals supporting older Pd versions. */ + +#include "m_pd.h" +#include "g_canvas.h" +#include "shared.h" +#include "unstable/forky.h" + +#if FORKY_VERSION < 37 +/* need this for t_class::c_wb field access */ +#include "unstable/pd_imp.h" +#endif + +#ifdef KRZYSZCZ +//#define FORKY_DEBUG +#endif + +t_pd *forky_newobject(t_symbol *s, int ac, t_atom *av) +{ +#if FORKY_VERSION >= 37 + typedmess(&pd_objectmaker, s, ac, av); + return (pd_newest()); +#else + return (0); +#endif +} + +void forky_setsavefn(t_class *c, t_forkysavefn fn) +{ +#if FORKY_VERSION >= 37 + class_setsavefn(c, fn); +#else + if (c->c_wb->w_savefn) + { + /* cloning is necessary, because class_setwidget has not been called */ + t_widgetbehavior *wb = getbytes(sizeof(*wb)); /* never freed */ +#ifdef FORKY_DEBUG + fprintf(stderr, "cloning widgetbehavior...\n"); +#endif + *wb = *c->c_wb; + wb->w_savefn = fn; + class_setwidget(c, wb); + } + else c->c_wb->w_savefn = fn; +#endif +} + +void forky_setpropertiesfn(t_class *c, t_forkypropertiesfn fn) +{ +#if FORKY_VERSION >= 37 + class_setpropertiesfn(c, fn); +#else + /* assuming wb has already been either cloned (in forky_setsavefn), + or defined from scratch -- it is unlikely to ever need props without + a specialized save (always be sure to set props after save, though). */ + c->c_wb->w_propertiesfn = fn; +#endif +} + +/* To be called in a 'dsp' method -- e.g. if there are no feeders, the caller + might use an optimized version of a 'perform' routine. + LATER think about replacing 'linetraverser' calls with something faster. */ +int forky_hasfeeders(t_object *x, t_glist *glist, int inno, t_symbol *outsym) +{ + t_linetraverser t; + linetraverser_start(&t, glist); + while (linetraverser_next(&t)) + if (t.tr_ob2 == x && t.tr_inno == inno +#if FORKY_VERSION >= 36 + && (!outsym || outsym == outlet_getsymbol(t.tr_outlet)) +#endif + ) + return (1); + return (0); +} + +/* Not really a forky, just found no better place to put it in. + Used in sickle's bitwise signal binops (which use forky_hasfeeders() too). + Checked against msp2. */ +t_int forky_getbitmask(int ac, t_atom *av) +{ + t_int result = 0; + if (sizeof(shared_t_bitmask) >= sizeof(t_int)) + { + int nbits = sizeof(t_int) * 8; + shared_t_bitmask bitmask = 1 << (nbits - 1); + if (ac > nbits) + ac = nbits; + while (ac--) + { + if (av->a_type == A_FLOAT && + (int)av->a_w.w_float) /* CHECKED */ + result |= bitmask; + /* CHECKED symbols are zero */ + bitmask >>= 1; + av++; + } + /* CHECKED missing are zero */ +#ifdef FORKY_DEBUG + fprintf(stderr, "mask set to %.8x\n", result); +#endif + } + else bug("sizeof(shared_t_bitmask)"); + return (result); +} diff --git a/externals/miXed/shared/unstable/forky.h b/externals/miXed/shared/unstable/forky.h new file mode 100644 index 000000000..b7cbee1d7 --- /dev/null +++ b/externals/miXed/shared/unstable/forky.h @@ -0,0 +1,32 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __FORKY_H__ +#define __FORKY_H__ + +#ifdef PD_MINOR_VERSION +#define FORKY_VERSION PD_MINOR_VERSION +#elif defined(PD_VERSION) +#define FORKY_VERSION 36 +#else +#define FORKY_VERSION 35 +#endif + +#if FORKY_VERSION >= 37 +#define FORKY_WIDGETPADDING +#else +#warning You are entering a back-compatibility mode. Delete this warning from forky.h to proceed. +#define FORKY_WIDGETPADDING 0,0 +#endif + +typedef void (*t_forkysavefn)(t_gobj *x, t_binbuf *bb); +typedef void (*t_forkypropertiesfn)(t_gobj *x, t_glist *gl); + +t_pd *forky_newobject(t_symbol *s, int ac, t_atom *av); +void forky_setsavefn(t_class *c, t_forkysavefn fn); +void forky_setpropertiesfn(t_class *c, t_forkypropertiesfn fn); +int forky_hasfeeders(t_object *x, t_glist *glist, int inno, t_symbol *outsym); +t_int forky_getbitmask(int ac, t_atom *av); + +#endif diff --git a/externals/miXed/shared/unstable/fragile.c b/externals/miXed/shared/unstable/fragile.c new file mode 100644 index 000000000..82d5065d5 --- /dev/null +++ b/externals/miXed/shared/unstable/fragile.c @@ -0,0 +1,345 @@ +/* Copyright (c) 1997-2005 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Put here bits and pieces likely to break with any new Pd version. */ + +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" +#include "unstable/pd_imp.h" +#include "unstable/fragile.h" + +/* this one rather belongs to fringe.c... */ +t_symbol *fragile_class_getexterndir(t_class *c) +{ + return (c->c_externdir); +} + +int fragile_class_count(void) +{ + return (pd_objectmaker->c_nmethod); +} + +int fragile_class_getnames(t_atom *av, int maxnames) +{ + int ac = pd_objectmaker->c_nmethod; + t_methodentry *mp = pd_objectmaker->c_methods; + if (ac > maxnames) + ac = maxnames; + else + maxnames = ac; + while (ac--) + { + SETSYMBOL(av, mp->me_name); + mp++; av++; + } + return (maxnames); +} + +/* Raising and voluntary mutation is a method of resolving name clashes. + A raised class hides other equivocal candidates. A simpler method, + raising and lowering, works only in global scope, because, currently, Pd + has only one visibility stack. Until this is changed, abstraction scope + will involve some kind of a hack for overriding global visibility stack. */ + +void fragile_class_raise(t_symbol *cname, t_newmethod thiscall) +{ + t_methodentry *mp = pd_objectmaker->c_methods, *topmp = 0; + int count = pd_objectmaker->c_nmethod; + while (count--) + { + if (mp->me_name == cname) + { + if (mp->me_fun == (t_gotfn)thiscall) + { + if (topmp) + { + t_methodentry auxmp; + /* no linkage there, but anyway... */ + loud_warning(0, 0, "%s is raising itself...", + cname->s_name); + memcpy(&auxmp, mp, sizeof(t_methodentry)); + memcpy(mp, topmp, sizeof(t_methodentry)); + memcpy(topmp, &auxmp, sizeof(t_methodentry)); + } + return; + } + else if (!topmp) + topmp = mp; + } + mp++; + } + loudbug_bug("fragile_class_raise"); +} + +t_pd *fragile_class_mutate(t_symbol *cname, t_newmethod thiscall, + int ac, t_atom *av) +{ + t_newmethod fn; + t_atomtype *argtypes; + if (fn = fragile_class_getalien(cname, thiscall, &argtypes)) + { + t_pd *z; + loud_warning(0, 0, "%s is mutating now...", cname->s_name); + if (z = fragile_class_createobject(cname, fn, argtypes, ac, av)) + { + post("...succeeded"); + return (z); + } + else post("...failed"); + } + return (0); +} + +t_newmethod fragile_class_getalien(t_symbol *cname, t_newmethod thiscall, + t_atomtype **argtypesp) +{ + t_methodentry *mp = pd_objectmaker->c_methods; + int count = pd_objectmaker->c_nmethod; + while (count--) + { + if (mp->me_name == cname && mp->me_fun != (t_gotfn)thiscall) + { + *argtypesp = mp->me_arg; + return ((t_newmethod)mp->me_fun); + } + mp++; + } + return (0); +} + +/* A specialized copy of pd_typedmess() from m_class.c, + somewhat simplified for readability. */ + +typedef t_pd *(*t_newgimme)(t_symbol *s, int ac, t_atom *av); +typedef t_pd *(*t_new0)( + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); +typedef t_pd *(*t_new1)( + t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); +typedef t_pd *(*t_new2)( + t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); +typedef t_pd *(*t_new3)( + t_symbol*, t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); +typedef t_pd *(*t_new4)( + t_symbol*, t_symbol*, t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); +typedef t_pd *(*t_new5)( + t_symbol*, t_symbol*, t_symbol*, t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); +typedef t_pd *(*t_new6)( + t_symbol*, t_symbol*, t_symbol*, t_symbol*, t_symbol*, t_symbol*, + t_floatarg, t_floatarg, t_floatarg, t_floatarg, t_floatarg); + +t_pd *fragile_class_createobject(t_symbol *cname, t_newmethod callthis, + t_atomtype *argtypes, int ac, t_atom *av) +{ + t_floatarg ff[MAXPDARG+1], *fp = ff; + t_symbol *ss[MAXPDARG+1], **sp = ss; + int nsymbols = 0; + t_atomtype wanttype; + if (*argtypes == A_GIMME) + return ((*((t_newgimme)(callthis)))(cname, ac, av)); + if (ac > MAXPDARG) + ac = MAXPDARG; + while (wanttype = *argtypes++) + { + switch (wanttype) + { + case A_POINTER: + goto badarg; + case A_FLOAT: + if (!ac) goto badarg; + case A_DEFFLOAT: + if (!ac) *fp = 0; + else + { + if (av->a_type == A_FLOAT) + *fp = av->a_w.w_float; + else goto badarg; + ac--; av++; + } + fp++; + break; + case A_SYMBOL: + if (!ac) goto badarg; + case A_DEFSYM: + if (!ac) *sp = &s_; + else + { + if (av->a_type == A_SYMBOL) + *sp = av->a_w.w_symbol; + else if (av->a_type == A_FLOAT && av->a_w.w_float == 0) + *sp = &s_; + else goto badarg; + ac--; av++; + } + nsymbols++; + sp++; + } + } + switch (nsymbols) + { + case 0: return ((*(t_new0)(callthis)) + (ff[0], ff[1], ff[2], ff[3], ff[4])); + case 1: return ((*(t_new1)(callthis)) + (ss[0], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 2: return ((*(t_new2)(callthis)) + (ss[0], ss[1], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 3: return ((*(t_new3)(callthis)) + (ss[0], ss[1], ss[2], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 4: return ((*(t_new4)(callthis)) + (ss[0], ss[1], ss[2], ss[3], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 5: return ((*(t_new5)(callthis)) + (ss[0], ss[1], ss[2], ss[3], ss[4], + ff[0], ff[1], ff[2], ff[3], ff[4])); + case 6: return ((*(t_new6)(callthis)) + (ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], + ff[0], ff[1], ff[2], ff[3], ff[4])); + } +badarg: + loud_error(0, "bad creation arguments for class '%s'", cname->s_name); + return (0); +} + +void fragile_class_printnames(char *msg, int firstndx, int lastndx) +{ + t_methodentry *mp = pd_objectmaker->c_methods; + int ndx, len = strlen(msg); + startpost(msg); + for (ndx = firstndx, mp += ndx; ndx <= lastndx; ndx++, mp++) + { + t_symbol *s = mp->me_name; + if (s && s->s_name[0] != '_') + { + int l = 1 + strlen(s->s_name); + if ((len += l) > 66) + { + endpost(); + startpost(" "); + len = 3 + l; + } + poststring(s->s_name); + } + } + endpost(); +} + +/* This structure is local to g_array.c. We need it, + because there is no other way to get into array's graph. */ +struct _garray +{ + t_gobj x_gobj; + t_glist *x_glist; + /* ... */ +}; + +t_glist *fragile_garray_glist(void *arr) +{ + return (((struct _garray *)arr)->x_glist); +} + +/* This is local to m_obj.c. + LATER export write access to o_connections field ('grab' class). + LATER encapsulate 'traverseoutlet' routines (not in the stable API yet). */ +struct _outlet +{ + t_object *o_owner; + struct _outlet *o_next; + t_outconnect *o_connections; + t_symbol *o_sym; +}; + +/* obj_starttraverseoutlet() replacement */ +t_outconnect *fragile_outlet_connections(t_outlet *o) +{ + return (o ? o->o_connections : 0); +} + +t_outconnect *fragile_outlet_nextconnection(t_outconnect *last, + t_object **destp, int *innop) +{ + t_inlet *dummy; + return (obj_nexttraverseoutlet(last, destp, &dummy, innop)); +} + +/* silent, if caller is empty */ +t_object *fragile_outlet_destination(t_outlet *op, + int ntypes, t_symbol **types, + t_pd *caller, char *errand) +{ + t_object *booty = 0; + t_symbol *badtype = 0; + int count = 0; + t_outconnect *tobooty = fragile_outlet_connections(op); + while (tobooty) + { + t_object *ob; + int inno; + count++; + tobooty = fragile_outlet_nextconnection(tobooty, &ob, &inno); + if (ob && inno == 0) + { + /* LATER ask for class_getname()'s symbol version */ + t_symbol **tp, *dsttype = gensym(class_getname(*(t_pd *)ob)); + int i; + for (i = 0, tp = types; i < ntypes; i++, tp++) + { + if (*tp == dsttype) + { + booty = ob; + break; + } + else badtype = dsttype; + } + } + } + if (booty) + { + if (count > 1 && caller) + loud_warning(caller, 0, "multiple targets"); + } + else if (caller) + { + if (badtype) + loud_error(caller, "bad target type '%s'", badtype->s_name); + else + loud_error(caller, "no target"); + if (errand) + loud_errand(caller, errand); + } + return (booty); +} + +/* These are local to m_obj.c. */ +union inletunion +{ + t_symbol *iu_symto; + t_gpointer *iu_pointerslot; + t_float *iu_floatslot; + t_symbol **iu_symslot; + t_sample iu_floatsignalvalue; +}; + +struct _inlet +{ + t_pd i_pd; + struct _inlet *i_next; + t_object *i_owner; + t_pd *i_dest; + t_symbol *i_symfrom; + union inletunion i_un; +}; + +/* simplified obj_findsignalscalar(), works for non-left inlets */ +t_sample *fragile_inlet_signalscalar(t_inlet *i) +{ + return (&i->i_un.iu_floatsignalvalue); +} diff --git a/externals/miXed/shared/unstable/fragile.h b/externals/miXed/shared/unstable/fragile.h new file mode 100644 index 000000000..9a5587d02 --- /dev/null +++ b/externals/miXed/shared/unstable/fragile.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __FRAGILE_H__ +#define __FRAGILE_H__ + +t_symbol *fragile_class_getexterndir(t_class *c); +int fragile_class_count(void); +int fragile_class_getnames(t_atom *av, int maxnames); +void fragile_class_raise(t_symbol *cname, t_newmethod thiscall); +t_pd *fragile_class_mutate(t_symbol *cname, t_newmethod thiscall, + int ac, t_atom *av); +t_newmethod fragile_class_getalien(t_symbol *cname, t_newmethod thiscall, + t_atomtype **argtypesp); +t_pd *fragile_class_createobject(t_symbol *cname, t_newmethod callthis, + t_atomtype *argtypes, int ac, t_atom *av); +void fragile_class_printnames(char *msg, int firstndx, int lastndx); +t_glist *fragile_garray_glist(void *arr); +t_outconnect *fragile_outlet_connections(t_outlet *o); +t_outconnect *fragile_outlet_nextconnection(t_outconnect *last, + t_object **destp, int *innop); +t_object *fragile_outlet_destination(t_outlet *op, + int ntypes, t_symbol **types, + t_pd *caller, char *errand); +t_sample *fragile_inlet_signalscalar(t_inlet *i); + +#endif diff --git a/externals/miXed/shared/unstable/fringe.c b/externals/miXed/shared/unstable/fringe.c new file mode 100644 index 000000000..2bfe478cf --- /dev/null +++ b/externals/miXed/shared/unstable/fringe.c @@ -0,0 +1,106 @@ +/* Copyright (c) 1997-2003 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Put here calls which are likely to (and should) make into Pd API some day. */ + +#include "m_pd.h" +#include "g_canvas.h" +#include "unstable/forky.h" +#include "unstable/fringe.h" + +#ifdef KRZYSZCZ +//#define FRINGE_DEBUG +#endif + +static int gobj_getindex(t_glist *gl, t_gobj *ob) +{ + t_gobj *ob1; + int ndx; + for (ob1 = gl->gl_list, ndx = 0; ob1 && ob1 != ob; ob1 = ob1->g_next) + ndx++; + return (ndx); +} + +static void gobj_totail(t_glist *gl, t_gobj *ob) +{ + if (ob->g_next) + { + t_gobj *ob1; + if (ob == gl->gl_list) ob1 = gl->gl_list = ob->g_next; + else + { + for (ob1 = gl->gl_list; ob1; ob1 = ob1->g_next) + if (ob1->g_next == ob) + break; + if (!ob1) + { + bug("gobj_totail"); + return; + } + ob1->g_next = ob->g_next; + ob1 = ob1->g_next; + } + while (ob1->g_next) ob1 = ob1->g_next; + ob1->g_next = ob; + ob->g_next = 0; + } +} + +static void gobj_stowconnections(t_glist *gl, t_gobj *ob, t_binbuf *bb) +{ + t_linetraverser lt; + t_outconnect *oc; + binbuf_clear(bb); + linetraverser_start(<, gl); + while (oc = linetraverser_next(<)) + { + if ((t_gobj *)lt.tr_ob == ob || (t_gobj *)lt.tr_ob2 == ob) + binbuf_addv(bb, "ssiiii;", + gensym("#X"), gensym("connect"), + gobj_getindex(gl, (t_gobj *)lt.tr_ob), lt.tr_outno, + gobj_getindex(gl, (t_gobj *)lt.tr_ob2), lt.tr_inno); + } +#ifdef FRINGE_DEBUG + fprintf(stderr, "packed connections:\n"); + binbuf_print(bb); +#endif +} + +static void gobj_restoreconnections(t_glist *gl, t_binbuf *bb) +{ +#ifdef FRINGE_DEBUG + fprintf(stderr, "restoring connections:\n"); + binbuf_print(bb); +#endif + canvas_setcurrent(gl); + binbuf_eval(bb, 0, 0, 0); + canvas_unsetcurrent(gl); +} + +void gobj_recreate(t_glist *gl, t_gobj *ob, t_binbuf *bb) +{ + /* LATER revisit all gobj calls, and sort out the gop case */ + t_text *newt; + int xpix = ((t_text *)ob)->te_xpix, ypix = ((t_text *)ob)->te_ypix; + t_binbuf *bb1 = binbuf_new(); + int ac = binbuf_getnatom(bb); + t_atom *av = binbuf_getvec(bb); + canvas_setcurrent(gl); + gobj_totail(gl, ob); + gobj_stowconnections(gl, ob, bb1); + glist_delete(gl, ob); + if (newt = (t_text *)forky_newobject(av->a_w.w_symbol, ac - 1, av + 1)) + { + newt->te_binbuf = bb; + newt->te_xpix = xpix; + newt->te_ypix = ypix; + newt->te_width = 0; + newt->te_type = T_OBJECT; + glist_add(gl, (t_gobj *)newt); + gobj_restoreconnections(gl, bb1); + } + else bug("gobj_recreate"); + binbuf_free(bb1); + canvas_unsetcurrent(gl); +} diff --git a/externals/miXed/shared/unstable/fringe.h b/externals/miXed/shared/unstable/fringe.h new file mode 100644 index 000000000..0768183e8 --- /dev/null +++ b/externals/miXed/shared/unstable/fringe.h @@ -0,0 +1,10 @@ +/* Copyright (c) 1997-2003 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __FRINGE_H__ +#define __FRINGE_H__ + +void gobj_recreate(t_glist *gl, t_gobj *ob, t_binbuf *bb); + +#endif diff --git a/externals/miXed/shared/unstable/loader.c b/externals/miXed/shared/unstable/loader.c new file mode 100644 index 000000000..487250043 --- /dev/null +++ b/externals/miXed/shared/unstable/loader.c @@ -0,0 +1,223 @@ +/* Copyright (c) 1997-2005 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is just a not-yet-in-the-API-sys_load_lib() duplication + (modulo differentiating the error return codes). LATER use the original. */ + +#ifdef __linux__ +#include <dlfcn.h> +#endif +#ifdef UNIX +#include <stdlib.h> +#include <unistd.h> +#endif +#ifdef NT +#include <io.h> +#include <windows.h> +#endif +#ifdef MACOSX +#include <mach-o/dyld.h> +#endif +#include <string.h> +#include <stdio.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/os.h" +#include "loader.h" + +typedef void (*t_xxx)(void); + +static char sys_dllextent[] = +#ifdef __FreeBSD__ + ".pd_freebsd"; +#endif +#ifdef IRIX +#ifdef N32 + ".pd_irix6"; +#else + ".pd_irix5"; +#endif +#endif +#ifdef __linux__ + ".pd_linux"; +#endif +#ifdef MACOSX + ".pd_darwin"; +#endif +#ifdef NT + ".dll"; +#endif + +static int unstable_doload_lib(char *dirname, char *classname) +{ + char symname[MAXPDSTRING], filename[MAXPDSTRING], *lastdot; + void *dlobj; + t_xxx makeout; +#ifdef NT + HINSTANCE ntdll; +#endif + /* refabricate the pathname */ + strcpy(filename, dirname); + strcat(filename, "/"); + strcat(filename, classname); + /* extract the setup function name */ + if (lastdot = strrchr(classname, '.')) + *lastdot = 0; + +#ifdef MACOSX + strcpy(symname, "_"); + strcat(symname, classname); +#else + strcpy(symname, classname); +#endif + /* if the last character is a tilde, replace with "_tilde" */ + if (symname[strlen(symname) - 1] == '~') + strcpy(symname + (strlen(symname) - 1), "_tilde"); + /* and append _setup to form the C setup function name */ + strcat(symname, "_setup"); +#ifdef __linux__ + dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL); + if (!dlobj) + { + post("%s: %s", filename, dlerror()); + return (LOADER_BADFILE); + } + makeout = (t_xxx)dlsym(dlobj, symname); +#endif +#ifdef NT + sys_bashfilename(filename, filename); + ntdll = LoadLibrary(filename); + if (!ntdll) + { + post("%s: couldn't load", filename); + return (LOADER_BADFILE); + } + makeout = (t_xxx)GetProcAddress(ntdll, symname); +#endif +#ifdef MACOSX + { + NSObjectFileImage image; + void *ret; + NSSymbol s; + if ( NSCreateObjectFileImageFromFile( filename, &image) != NSObjectFileImageSuccess ) + { + post("%s: couldn't load", filename); + return (LOADER_BADFILE); + } + ret = NSLinkModule( image, filename, + NSLINKMODULE_OPTION_BINDNOW + + NSLINKMODULE_OPTION_PRIVATE); + + s = NSLookupSymbolInModule(ret, symname); + + if (s) + makeout = (t_xxx)NSAddressOfSymbol( s); + else makeout = 0; + } +#endif + if (!makeout) + { + post("load_object: Symbol \"%s\" not found", symname); + return (LOADER_NOENTRY); + } + (*makeout)(); + return (LOADER_OK); +} + +/* start searching from dirname, then search the path */ +int unstable_load_lib(char *dirname, char *classname) +{ + char dirbuf[MAXPDSTRING], *nameptr; + int fd; + if ((fd = open_via_path(dirname, classname, sys_dllextent, + dirbuf, &nameptr, MAXPDSTRING, 1)) < 0) + { + return (LOADER_NOFILE); + } + else + { + close(fd); + return (unstable_doload_lib(dirbuf, nameptr)); + } +} + +/* only dirname is searched */ +int unstable_dirload_lib(char *dirname, char *classname) +{ + if (strlen(dirname) + strlen(classname) + strlen(sys_dllextent) + 3 < + MAXPDSTRING) + { + char namebuf[MAXPDSTRING], *slash, *nameptr; + strcpy(namebuf, dirname); + if (*dirname && namebuf[strlen(namebuf)-1] != '/') + strcat(namebuf, "/"); + strcat(namebuf, classname); + strcat(namebuf, sys_dllextent); + slash = strrchr(namebuf, '/'); + if (slash) + { + *slash = 0; + nameptr = slash + 1; + } + else nameptr = namebuf; + return (unstable_doload_lib(namebuf, nameptr)); + } + else return (LOADER_FAILED); +} + +/* return the number of successfully loaded libraries, or -1 on error */ +int unstable_dirload_all(char *dirname, int beloud, int withclasses) +{ + t_osdir *dp = osdir_open(dirname); + if (dp) + { + int result = 0; + char namebuf[MAXPDSTRING], *name; + osdir_setmode(dp, OSDIR_FILEMODE); + while (name = osdir_next(dp)) + { + int namelen = strlen(name), extlen = strlen(sys_dllextent); + if ((namelen -= extlen) > 0 && + strcmp(name + namelen, sys_dllextent) == 0) + { + strncpy(namebuf, name, namelen); + namebuf[namelen] = 0; + if (zgetfn(&pd_objectmaker, gensym(namebuf))) + { + if (beloud) + loud_warning(0, "xeq", "plugin \"%s\" already loaded", + namebuf); + } + else + { + int err; + if (beloud) + post("loading xeq plugin \"%s\"", namebuf); + err = unstable_dirload_lib(dirname, namebuf); + if (err == LOADER_NOFILE) + { + if (beloud) + loud_error(0, "xeq plugin \"%s\" disappeared", + namebuf); + } + else if (!zgetfn(&pd_objectmaker, gensym(namebuf))) + { + if (beloud) + loud_error(0, "library \"%s\" not compatible", + namebuf); + } + else result++; + } + } + } + osdir_close(dp); + return (result); + } + else + { + if (beloud) + loud_syserror(0, "cannot open \"%s\"", dirname); + return (-1); + } +} diff --git a/externals/miXed/shared/unstable/loader.h b/externals/miXed/shared/unstable/loader.h new file mode 100644 index 000000000..7c1803635 --- /dev/null +++ b/externals/miXed/shared/unstable/loader.h @@ -0,0 +1,15 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __LOADER_H__ +#define __LOADER_H__ + +enum { LOADER_OK, LOADER_FAILED, + LOADER_NOFILE, LOADER_BADFILE, LOADER_NOENTRY }; + +int unstable_load_lib(char *dirname, char *classname); +int unstable_dirload_lib(char *dirname, char *classname); +int unstable_dirload_all(char *dirname, int beloud, int withclasses); + +#endif diff --git a/externals/miXed/shared/unstable/pd_imp.h b/externals/miXed/shared/unstable/pd_imp.h new file mode 100644 index 000000000..513f9276b --- /dev/null +++ b/externals/miXed/shared/unstable/pd_imp.h @@ -0,0 +1,62 @@ +/* Copyright (c) 1997-2003 Miller Puckette and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __PD_IMP_H__ +#define __PD_IMP_H__ + +#ifdef PD_MINOR_VERSION +/* 0.37 and up */ +#include "m_imp.h" +#else +/* 0.36 and down */ + +typedef struct _methodentry +{ + t_symbol *me_name; + t_gotfn me_fun; + t_atomtype me_arg[MAXPDARG+1]; +} t_methodentry; + +EXTERN_STRUCT _widgetbehavior; + +typedef void (*t_bangmethod)(t_pd *x); +typedef void (*t_pointermethod)(t_pd *x, t_gpointer *gp); +typedef void (*t_floatmethod)(t_pd *x, t_float f); +typedef void (*t_symbolmethod)(t_pd *x, t_symbol *s); +typedef void (*t_listmethod)(t_pd *x, t_symbol *s, int argc, t_atom *argv); +typedef void (*t_anymethod)(t_pd *x, t_symbol *s, int argc, t_atom *argv); + +struct _class +{ + t_symbol *c_name; /* name (mostly for error reporting) */ + t_symbol *c_helpname; /* name of help file */ + size_t c_size; /* size of an instance */ + t_methodentry *c_methods; /* methods other than bang, etc below */ + int c_nmethod; /* number of methods */ + t_method c_freemethod; /* function to call before freeing */ + t_bangmethod c_bangmethod; /* common methods */ + t_pointermethod c_pointermethod; + t_floatmethod c_floatmethod; + t_symbolmethod c_symbolmethod; + t_listmethod c_listmethod; + t_anymethod c_anymethod; + struct _widgetbehavior *c_wb; /* "gobjs" only */ + struct _parentwidgetbehavior *c_pwb;/* widget behavior in parent */ + int c_floatsignalin; /* onset to float for signal input */ + char c_gobj; /* true if is a gobj */ + char c_patchable; /* true if we have a t_object header */ + char c_firstin; /* if patchable, true if draw first inlet */ + char c_drawcommand; /* a drawing command for a template */ +}; + +EXTERN int obj_noutlets(t_object *x); +EXTERN int obj_ninlets(t_object *x); +EXTERN t_outconnect *obj_starttraverseoutlet(t_object *x, t_outlet **op, + int nout); +EXTERN t_outconnect *obj_nexttraverseoutlet(t_outconnect *lastconnect, + t_object **destp, t_inlet **inletp, int *whichp); + +#endif + +#endif diff --git a/externals/miXed/shared/unstable/standalone.c b/externals/miXed/shared/unstable/standalone.c new file mode 100644 index 000000000..5b780e998 --- /dev/null +++ b/externals/miXed/shared/unstable/standalone.c @@ -0,0 +1,80 @@ +/* Copyright (c) 1997-2004 Miller Puckette, krzYszcz, and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* Parts of Pd API are duplicated here, as needed by standalone versions of + Pd modules. LATER standalones should be linked to the Pd API library. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "standalone.h" + +void *getbytes(size_t nbytes) +{ + void *ret; + if (nbytes < 1) nbytes = 1; + ret = (void *)calloc(nbytes, 1); + if (!ret) + fprintf(stderr, "ERROR: getbytes() failed -- out of memory"); + return (ret); +} + +void *resizebytes(void *old, size_t oldsize, size_t newsize) +{ + void *ret; + if (newsize < 1) newsize = 1; + if (oldsize < 1) oldsize = 1; + ret = (void *)realloc((char *)old, newsize); + if (newsize > oldsize && ret) + memset(((char *)ret) + oldsize, 0, newsize - oldsize); + if (!ret) + fprintf(stderr, "ERROR: resizebytes() failed -- out of memory"); + return (ret); +} + +void freebytes(void *fatso, size_t nbytes) +{ + free(fatso); +} + +#define HASHSIZE 1024 + +static t_symbol *symhash[HASHSIZE]; + +static t_symbol *dogensym(char *s, t_symbol *oldsym) +{ + t_symbol **sym1, *sym2; + unsigned int hash1 = 0, hash2 = 0; + int length = 0; + char *s2 = s; + while (*s2) + { + hash1 += *s2; + hash2 += hash1; + length++; + s2++; + } + sym1 = symhash + (hash2 & (HASHSIZE-1)); + while (sym2 = *sym1) + { + if (!strcmp(sym2->s_name, s)) return(sym2); + sym1 = &sym2->s_next; + } + if (oldsym) sym2 = oldsym; + else + { + sym2 = (t_symbol *)getbytes(sizeof(*sym2)); + sym2->s_name = getbytes(length+1); + sym2->s_next = 0; + sym2->s_thing = 0; + strcpy(sym2->s_name, s); + } + *sym1 = sym2; + return (sym2); +} + +t_symbol *gensym(char *s) +{ + return(dogensym(s, 0)); +} diff --git a/externals/miXed/shared/unstable/standalone.h b/externals/miXed/shared/unstable/standalone.h new file mode 100644 index 000000000..6ca62d1ab --- /dev/null +++ b/externals/miXed/shared/unstable/standalone.h @@ -0,0 +1,57 @@ +/* Copyright (c) 2004 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef MIXED_STANDALONE +#error MIXED_STANDALONE not defined +#else +#ifndef __STANDALONE_H__ +#define __STANDALONE_H__ + +typedef int t_int; +typedef float t_float; + +typedef struct _symbol +{ + char *s_name; + void *s_thing; + struct _symbol *s_next; +} t_symbol; + +typedef union word +{ + t_float w_float; + t_symbol *w_symbol; + int w_index; +} t_word; + +typedef enum +{ + A_NULL, + A_FLOAT, + A_SYMBOL, + A_POINTER, + A_SEMI, + A_COMMA, + A_DEFFLOAT, + A_DEFSYM, + A_DOLLAR, + A_DOLLSYM, + A_GIMME, + A_CANT +} t_atomtype; + +typedef struct _atom +{ + t_atomtype a_type; + union word a_w; +} t_atom; + + +void *getbytes(size_t nbytes); +void *resizebytes(void *old, size_t oldsize, size_t newsize); +void freebytes(void *fatso, size_t nbytes); +t_symbol *gensym(char *s); + +#endif +#endif diff --git a/externals/miXed/test/cyclone/Borax-test.pd b/externals/miXed/test/cyclone/Borax-test.pd new file mode 100644 index 000000000..aa2970b61 --- /dev/null +++ b/externals/miXed/test/cyclone/Borax-test.pd @@ -0,0 +1,120 @@ +#N canvas 137 29 642 442 12; +#X obj 24 185 Borax dummy; +#X floatatom 24 220 5 0 0; +#X floatatom 24 124 5 0 0; +#X msg 24 86 1; +#X msg 80 86 0; +#X msg 118 152 bang; +#X obj 129 86 counter; +#X msg 57 51 set 0; +#X msg 129 18 128; +#X obj 129 51 Uzi; +#X obj 326 220 Borax dummy; +#X obj 469 324 funbuff; +#C restore; +#X obj 230 324 funbuff; +#C restore; +#X obj 356 324 funbuff; +#C restore; +#X obj 326 185 makenote; +#X obj 326 86 random 128; +#X obj 393 152 random 1000; +#X obj 326 51 t b b b; +#X msg 326 18 bang; +#X msg 209 220 dump; +#X obj 230 359 pack; +#X obj 230 392 print pitch; +#X obj 469 359 pack; +#X obj 469 392 print delta; +#X obj 356 359 pack; +#X obj 356 392 print dur; +#X msg 260 220 dump; +#X msg 486 220 dump; +#X msg 230 263 clear; +#X obj 356 288 spigot; +#X msg 405 263 1; +#X msg 419 288 0; +#X obj 469 288 spigot; +#X msg 518 263 1; +#X msg 532 288 0; +#X obj 92 220 print voice; +#X obj 210 86 urn 128; +#X msg 210 18 128; +#X obj 210 51 Uzi; +#X msg 258 51 clear; +#X msg 536 18 128; +#X obj 411 51 Uzi; +#X msg 420 185 bang; +#X obj 456 51 t b b b; +#X obj 456 86 urn 128; +#X obj 514 152 random 1000; +#X msg 536 51 clear; +#X obj 456 18 t 0 b; +#X msg 485 119 64; +#X msg 355 119 64; +#X connect 0 0 1 0; +#X connect 0 1 35 0; +#X connect 2 0 0 0; +#X connect 3 0 0 1; +#X connect 4 0 0 1; +#X connect 5 0 0 2; +#X connect 6 0 0 0; +#X connect 7 0 6 0; +#X connect 8 0 9 0; +#X connect 9 0 6 0; +#X connect 10 0 12 0; +#X connect 10 0 32 0; +#X connect 10 0 29 0; +#X connect 10 3 12 1; +#X connect 10 6 13 1; +#X connect 10 6 30 0; +#X connect 10 8 11 1; +#X connect 10 8 33 0; +#X connect 11 0 22 0; +#X connect 11 1 22 1; +#X connect 12 0 20 0; +#X connect 12 1 20 1; +#X connect 13 0 24 0; +#X connect 13 1 24 1; +#X connect 14 0 10 0; +#X connect 14 1 10 1; +#X connect 15 0 14 0; +#X connect 16 0 14 2; +#X connect 17 0 15 0; +#X connect 17 1 49 0; +#X connect 17 2 16 0; +#X connect 18 0 17 0; +#X connect 19 0 12 0; +#X connect 20 0 21 0; +#X connect 22 0 23 0; +#X connect 24 0 25 0; +#X connect 26 0 13 0; +#X connect 27 0 11 0; +#X connect 28 0 12 0; +#X connect 28 0 13 0; +#X connect 28 0 11 0; +#X connect 29 0 31 0; +#X connect 29 0 13 0; +#X connect 30 0 29 1; +#X connect 31 0 29 1; +#X connect 32 0 34 0; +#X connect 32 0 11 0; +#X connect 33 0 32 1; +#X connect 34 0 32 1; +#X connect 36 0 0 0; +#X connect 37 0 38 0; +#X connect 38 0 36 0; +#X connect 39 0 36 0; +#X connect 40 0 47 0; +#X connect 41 0 43 0; +#X connect 42 0 10 2; +#X connect 43 0 44 0; +#X connect 43 1 48 0; +#X connect 43 2 45 0; +#X connect 44 0 14 0; +#X connect 45 0 14 2; +#X connect 46 0 44 0; +#X connect 47 0 41 0; +#X connect 47 1 46 0; +#X connect 48 0 14 1; +#X connect 49 0 14 1; diff --git a/externals/miXed/test/cyclone/Bucket-test.pd b/externals/miXed/test/cyclone/Bucket-test.pd new file mode 100644 index 000000000..c43b0ed8d --- /dev/null +++ b/externals/miXed/test/cyclone/Bucket-test.pd @@ -0,0 +1,40 @@ +#N canvas 306 219 459 482 12; +#X obj 134 126 Bucket 10 padding; +#X floatatom 134 433 5 0 0; +#X floatatom 150 403 5 0 0; +#X floatatom 166 374 5 0 0; +#X floatatom 183 343 5 0 0; +#X floatatom 199 313 5 0 0; +#X floatatom 216 282 5 0 0; +#X floatatom 232 255 5 0 0; +#X floatatom 249 224 5 0 0; +#X floatatom 265 192 5 0 0; +#X floatatom 282 162 5 0 0; +#X msg 233 21 roll; +#X floatatom 232 56 5 0 0; +#X msg 232 88 set \$1; +#X floatatom 81 56 5 0 0; +#X msg 156 21 l2r; +#X msg 156 56 r2l; +#X msg 332 56 freeze; +#X msg 332 88 thaw; +#X msg 21 56 bang; +#X connect 0 0 1 0; +#X connect 0 1 2 0; +#X connect 0 2 3 0; +#X connect 0 3 4 0; +#X connect 0 4 5 0; +#X connect 0 5 6 0; +#X connect 0 6 7 0; +#X connect 0 7 8 0; +#X connect 0 8 9 0; +#X connect 0 9 10 0; +#X connect 11 0 0 0; +#X connect 12 0 13 0; +#X connect 13 0 0 0; +#X connect 14 0 0 0; +#X connect 15 0 0 0; +#X connect 16 0 0 0; +#X connect 17 0 0 0; +#X connect 18 0 0 0; +#X connect 19 0 0 0; diff --git a/externals/miXed/test/cyclone/Decode-test.pd b/externals/miXed/test/cyclone/Decode-test.pd new file mode 100644 index 000000000..bd35b6161 --- /dev/null +++ b/externals/miXed/test/cyclone/Decode-test.pd @@ -0,0 +1,18 @@ +#N canvas 314 293 450 300 12; +#X obj 151 134 Decode 4; +#X obj 151 256 print a; +#X obj 173 230 print b; +#X obj 195 200 print c; +#X obj 218 172 print d; +#X floatatom 68 81 5 0 0; +#X obj 184 81 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 218 81 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X connect 0 0 1 0; +#X connect 0 1 2 0; +#X connect 0 2 3 0; +#X connect 0 3 4 0; +#X connect 5 0 0 0; +#X connect 6 0 0 1; +#X connect 7 0 0 2; diff --git a/externals/miXed/test/cyclone/Histo-test.pd b/externals/miXed/test/cyclone/Histo-test.pd new file mode 100644 index 000000000..cd2273091 --- /dev/null +++ b/externals/miXed/test/cyclone/Histo-test.pd @@ -0,0 +1,20 @@ +#N canvas 386 259 450 300 12; +#X obj 158 150 Histo 1000; +#X obj 158 226 print a; +#X obj 243 226 print b; +#X msg 51 93 bang; +#X msg 158 93 700; +#X msg 111 93 -1; +#X msg 243 44 1000; +#X msg 263 93 700.5; +#X msg 178 121 clear; +#X msg 139 44 1 1; +#X connect 0 0 1 0; +#X connect 0 1 2 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 1; +#X connect 7 0 0 1; +#X connect 8 0 0 0; +#X connect 9 0 0 0; diff --git a/externals/miXed/test/cyclone/MouseState-test.pd b/externals/miXed/test/cyclone/MouseState-test.pd new file mode 100644 index 000000000..12b13ff60 --- /dev/null +++ b/externals/miXed/test/cyclone/MouseState-test.pd @@ -0,0 +1,54 @@ +#N canvas 228 259 751 304 12; +#X obj 179 129 MouseState; +#X obj 179 264 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 200 238 5 0 0 0 - - -; +#X floatatom 221 213 5 0 0 0 - - -; +#X floatatom 242 185 5 0 0 0 - - -; +#X floatatom 264 159 5 0 0 0 - - -; +#X obj 179 19 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 179 54 metro 50; +#X msg 272 54 zero; +#X msg 272 86 reset; +#X msg 35 87 poll; +#X msg 99 87 nopoll; +#X obj 523 129 MouseState; +#X obj 523 264 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 544 238 5 0 0 0 - - -; +#X floatatom 565 213 5 0 0 0 - - -; +#X floatatom 586 185 5 0 0 0 - - -; +#X floatatom 608 159 5 0 0 0 - - -; +#X obj 523 19 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 523 54 metro 50; +#X msg 616 54 zero; +#X msg 616 86 reset; +#X msg 379 87 poll; +#X msg 443 87 nopoll; +#X obj 53 213 capture; +#X connect 0 0 1 0; +#X connect 0 1 2 0; +#X connect 0 1 24 0; +#X connect 0 2 3 0; +#X connect 0 2 24 0; +#X connect 0 3 4 0; +#X connect 0 4 5 0; +#X connect 6 0 7 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 0 0; +#X connect 11 0 0 0; +#X connect 12 0 13 0; +#X connect 12 1 14 0; +#X connect 12 2 15 0; +#X connect 12 3 16 0; +#X connect 12 4 17 0; +#X connect 18 0 19 0; +#X connect 19 0 12 0; +#X connect 20 0 12 0; +#X connect 21 0 12 0; +#X connect 22 0 12 0; +#X connect 23 0 12 0; diff --git a/externals/miXed/test/cyclone/Table-test.pd b/externals/miXed/test/cyclone/Table-test.pd new file mode 100644 index 000000000..9e4af5514 --- /dev/null +++ b/externals/miXed/test/cyclone/Table-test.pd @@ -0,0 +1,62 @@ +#N canvas 278 182 656 317 12; +#X msg 24 43 load; +#X obj 100 73 Uzi; +#X msg 100 43 100; +#X msg 29 222 size 100; +#X obj 119 256 print; +#X msg 157 102 next; +#X msg 159 137 prev; +#X msg 148 70 goto \$1; +#X floatatom 148 43 5 0 0 0 - - -; +#X msg 313 70 fquantile \$1; +#X floatatom 313 43 5 0 0 0 - - -; +#X msg 441 70 quantile \$1; +#X floatatom 441 43 5 0 0 0 - - -; +#X obj 508 222 r test; +#X obj 508 256 print test; +#X msg 295 223 send test \$1; +#X floatatom 295 196 5 0 0 0 - - -; +#X obj 119 222 Table t; +#C restore; +#X obj 295 253 Table t; +#C restore; +#X obj 313 137 print; +#X obj 313 107 Table t; +#C restore; +#X msg 261 73 bang; +#X msg 360 196 symbol length; +#X msg 24 73 normal; +#X floatatom 159 184 5 0 0 0 - - -; +#X msg 24 184 dump \$1 \$2; +#X obj 24 154 pack; +#X floatatom 24 120 5 0 0 0 - - -; +#X floatatom 79 120 5 0 0 0 - - -; +#X msg 79 154 dump; +#X msg 404 107 sum \, min \, max; +#X connect 0 0 17 0; +#X connect 1 2 17 0; +#X connect 2 0 1 0; +#X connect 3 0 17 0; +#X connect 5 0 17 0; +#X connect 6 0 17 0; +#X connect 7 0 17 0; +#X connect 8 0 7 0; +#X connect 9 0 20 0; +#X connect 10 0 9 0; +#X connect 11 0 20 0; +#X connect 12 0 11 0; +#X connect 13 0 14 0; +#X connect 15 0 18 0; +#X connect 16 0 15 0; +#X connect 17 0 4 0; +#X connect 20 0 19 0; +#X connect 21 0 20 0; +#X connect 22 0 15 0; +#X connect 23 0 17 0; +#X connect 24 0 17 0; +#X connect 25 0 17 0; +#X connect 26 0 25 0; +#X connect 27 0 26 0; +#X connect 28 0 26 1; +#X connect 29 0 17 0; +#X connect 30 0 20 0; diff --git a/externals/miXed/test/cyclone/TogEdge-test.pd b/externals/miXed/test/cyclone/TogEdge-test.pd new file mode 100644 index 000000000..91980757d --- /dev/null +++ b/externals/miXed/test/cyclone/TogEdge-test.pd @@ -0,0 +1,16 @@ +#N canvas 516 361 368 289 12; +#X obj 109 129 TogEdge; +#X obj 109 184 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 167 184 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 168 74 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 109 74 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X msg 36 74 1.5; +#X connect 0 0 1 0; +#X connect 0 1 2 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; diff --git a/externals/miXed/test/cyclone/Uzi-test.pd b/externals/miXed/test/cyclone/Uzi-test.pd new file mode 100644 index 000000000..c01ad33be --- /dev/null +++ b/externals/miXed/test/cyclone/Uzi-test.pd @@ -0,0 +1,27 @@ +#N canvas 407 221 414 285 12; +#X obj 153 97 Uzi; +#X obj 153 194 counter; +#X floatatom 153 225 5 0 0; +#X msg 153 35 bang; +#X msg 212 35 99; +#X msg 212 66 11; +#X floatatom 336 171 5 0 0; +#X msg 62 225 pause; +#X msg 55 35 resume; +#X obj 296 136 t 0 0; +#X obj 62 194 sel 10; +#X floatatom 267 77 5 0 0; +#X obj 164 136 print carry; +#X connect 0 0 1 0; +#X connect 0 1 12 0; +#X connect 0 2 9 0; +#X connect 1 0 2 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 1; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 10 0; +#X connect 9 1 6 0; +#X connect 10 0 7 0; +#X connect 11 0 0 1; diff --git a/externals/miXed/test/cyclone/a-mix2.pd b/externals/miXed/test/cyclone/a-mix2.pd new file mode 100644 index 000000000..31ba6b2ec --- /dev/null +++ b/externals/miXed/test/cyclone/a-mix2.pd @@ -0,0 +1,41 @@ +#N canvas 26 52 303 333 12; +#X obj 128 272 *~ 0; +#X obj 171 272 *~ 0; +#X obj 202 230 dbtorms; +#X obj 17 248 hsl 80 15 0 90 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 0; +#X obj 121 230 dbtorms; +#X msg 203 194 90; +#X msg 65 194 90; +#X msg 142 194 0; +#X msg 14 194 0; +#X obj 14 128 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 129 128 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 142 156 sel 1; +#X obj 52 31 inlet~; +#X obj 171 31 inlet~; +#X obj 171 299 outlet~; +#X obj 242 33 vsl 15 80 0 90 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 0; +#X connect 0 0 14 0; +#X connect 1 0 14 0; +#X connect 2 0 1 1; +#X connect 3 0 4 0; +#X connect 4 0 0 1; +#X connect 5 0 15 0; +#X connect 6 0 3 0; +#X connect 7 0 15 0; +#X connect 8 0 3 0; +#X connect 9 0 8 0; +#X connect 9 0 7 0; +#X connect 10 0 11 0; +#X connect 11 0 7 0; +#X connect 11 0 6 0; +#X connect 11 1 5 0; +#X connect 11 1 8 0; +#X connect 12 0 0 0; +#X connect 13 0 1 0; +#X connect 15 0 2 0; +#X coords 0 0 1 1 150 100 1; diff --git a/externals/miXed/test/cyclone/active-test.pd b/externals/miXed/test/cyclone/active-test.pd new file mode 100644 index 000000000..6f40f96ac --- /dev/null +++ b/externals/miXed/test/cyclone/active-test.pd @@ -0,0 +1,19 @@ +#N canvas 52 81 262 185 12; +#X obj 27 29 active; +#X obj 27 74 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 129 29 active; +#X obj 129 74 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#N canvas 376 80 255 181 test 1; +#X obj 27 29 active; +#X obj 27 74 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 129 29 active; +#X obj 129 74 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X connect 0 0 1 0; +#X connect 2 0 3 0; +#X restore 31 138 pd test; +#X connect 0 0 1 0; +#X connect 2 0 3 0; diff --git a/externals/miXed/test/cyclone/anal-test.pd b/externals/miXed/test/cyclone/anal-test.pd new file mode 100644 index 000000000..a4ec7ab0e --- /dev/null +++ b/externals/miXed/test/cyclone/anal-test.pd @@ -0,0 +1,17 @@ +#N canvas 466 161 450 300 12; +#X obj 62 215 print; +#X msg 62 67 1; +#X floatatom 119 67 5 0 0; +#X msg 189 67 reset; +#X msg 189 108 clear; +#X obj 198 215 anal 1025; +#X obj 62 167 anal; +#X msg 118 27 128 \, -1; +#X msg 203 27 1.1; +#X connect 1 0 6 0; +#X connect 2 0 6 0; +#X connect 3 0 6 0; +#X connect 4 0 6 0; +#X connect 6 0 0 0; +#X connect 7 0 6 0; +#X connect 8 0 6 0; diff --git a/externals/miXed/test/cyclone/append-test.pd b/externals/miXed/test/cyclone/append-test.pd new file mode 100644 index 000000000..821c22e6b --- /dev/null +++ b/externals/miXed/test/cyclone/append-test.pd @@ -0,0 +1,78 @@ +#N canvas 516 251 510 466 12; +#X obj 25 416 print; +#X msg 25 298 1 2 3; +#X msg 102 298 set test; +#X obj 25 241 print; +#X msg 25 51 1 2 3; +#X obj 25 169 t a b; +#X msg 111 241 4 5 6; +#X obj 190 206 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 347 50 testmess 1000; +#X msg 347 19 mess; +#X msg 101 19 mess; +#X obj 101 50 testmess 100; +#X msg 155 128 set changed; +#X obj 111 169 gate; +#X obj 111 206 t b b; +#X obj 25 377 t a b b; +#X msg 220 416 set mess1; +#X msg 108 416 set mess2; +#X msg 285 241 bang; +#X msg 347 241 99; +#X obj 285 377 print list; +#X obj 285 339 route list; +#X obj 408 377 print; +#X msg 227 241 mess; +#X msg 398 241 set bang; +#X msg 400 278 set 0; +#X obj 101 81 prepend check; +#X msg 160 19 set set; +#X msg 244 19 set check; +#X obj 25 128 Append test; +#X obj 25 339 Append test; +#X obj 285 298 Append; +#X obj 347 81 prepend check; +#X msg 398 206 set test; +#X obj 301 159 Append test it; +#X obj 301 190 print; +#X msg 301 128 symbol mess; +#X connect 1 0 30 0; +#X connect 2 0 30 0; +#X connect 4 0 29 0; +#X connect 5 0 3 0; +#X connect 5 1 13 1; +#X connect 6 0 29 0; +#X connect 7 0 13 0; +#X connect 8 0 32 0; +#X connect 9 0 8 0; +#X connect 10 0 11 0; +#X connect 11 0 26 0; +#X connect 12 0 29 0; +#X connect 13 0 14 0; +#X connect 14 0 6 0; +#X connect 14 1 7 0; +#X connect 15 0 0 0; +#X connect 15 1 17 0; +#X connect 15 2 16 0; +#X connect 16 0 30 0; +#X connect 17 0 30 0; +#X connect 18 0 31 0; +#X connect 19 0 31 0; +#X connect 21 0 20 0; +#X connect 21 1 22 0; +#X connect 23 0 31 0; +#X connect 24 0 31 0; +#X connect 25 0 31 0; +#X connect 26 0 29 0; +#X connect 27 0 26 0; +#X connect 27 0 32 0; +#X connect 28 0 26 0; +#X connect 28 0 32 0; +#X connect 29 0 5 0; +#X connect 30 0 15 0; +#X connect 31 0 21 0; +#X connect 32 0 29 0; +#X connect 33 0 31 0; +#X connect 34 0 35 0; +#X connect 36 0 34 0; diff --git a/externals/miXed/test/cyclone/bad.coll b/externals/miXed/test/cyclone/bad.coll new file mode 100644 index 000000000..bb76cf722 --- /dev/null +++ b/externals/miXed/test/cyclone/bad.coll @@ -0,0 +1,4 @@ +11, testing coll; +12, missing semi +13 extra key, with data; +14 empty,; diff --git a/externals/miXed/test/cyclone/bondo-test.pd b/externals/miXed/test/cyclone/bondo-test.pd new file mode 100644 index 000000000..38a43ba52 --- /dev/null +++ b/externals/miXed/test/cyclone/bondo-test.pd @@ -0,0 +1,73 @@ +#N canvas 289 274 747 476 12; +#X obj 78 164 print first; +#X obj 199 165 print last; +#X msg 78 22 any message; +#X msg 199 21 other message; +#X msg 94 62 11; +#X msg 211 62 55; +#X obj 78 108 bondo 5 1000 n; +#X obj 412 203 print first; +#X obj 530 169 print last; +#X msg 412 22 any message; +#X msg 533 57 other message; +#X msg 437 92 11; +#X msg 545 92 55; +#X obj 412 133 bondo 5 1000; +#X obj 437 169 print 2nd; +#X msg 429 57 1 2 3; +#X msg 21 62 test; +#X msg 356 92 test; +#X obj 78 390 print first; +#X obj 199 391 print last; +#X msg 78 248 any message; +#X msg 199 247 other message; +#X msg 94 288 11; +#X msg 211 288 55; +#X obj 412 429 print first; +#X obj 530 395 print last; +#X msg 412 248 any message; +#X msg 533 283 other message; +#X msg 437 318 11; +#X msg 528 318 55; +#X obj 437 395 print 2nd; +#X msg 429 283 1 2 3; +#X msg 21 288 test; +#X msg 356 318 test; +#X obj 78 334 bondo 5 n; +#X obj 412 359 bondo 5; +#X msg 583 319 -1 -2 \, -2 -3; +#X msg 600 92 -1 -2 \, -2 -3; +#X connect 2 0 6 0; +#X connect 3 0 6 4; +#X connect 4 0 6 0; +#X connect 5 0 6 4; +#X connect 6 0 0 0; +#X connect 6 4 1 0; +#X connect 9 0 13 0; +#X connect 10 0 13 4; +#X connect 11 0 13 0; +#X connect 12 0 13 4; +#X connect 13 0 7 0; +#X connect 13 1 14 0; +#X connect 13 4 8 0; +#X connect 15 0 13 0; +#X connect 16 0 6 0; +#X connect 17 0 13 0; +#X connect 20 0 34 0; +#X connect 21 0 34 4; +#X connect 22 0 34 0; +#X connect 23 0 34 4; +#X connect 26 0 35 0; +#X connect 27 0 35 4; +#X connect 28 0 35 0; +#X connect 29 0 35 4; +#X connect 31 0 35 0; +#X connect 32 0 34 0; +#X connect 33 0 35 0; +#X connect 34 0 18 0; +#X connect 34 4 19 0; +#X connect 35 0 24 0; +#X connect 35 1 30 0; +#X connect 35 4 25 0; +#X connect 36 0 35 3; +#X connect 37 0 13 3; diff --git a/externals/miXed/test/cyclone/buddy-test.pd b/externals/miXed/test/cyclone/buddy-test.pd new file mode 100644 index 000000000..3c072b1a1 --- /dev/null +++ b/externals/miXed/test/cyclone/buddy-test.pd @@ -0,0 +1,28 @@ +#N canvas 242 401 623 363 12; +#X obj 66 268 print a; +#X obj 168 268 print b; +#X floatatom 107 83 5 0 0; +#X floatatom 264 184 5 0 0; +#X msg 136 116 symbol test1; +#X msg 264 152 symbol test2; +#X msg 264 77 one two three; +#X msg 264 116 1 2 3 4 5 6 7 8 9; +#X msg 38 25 a long message with floats 1 2 3 4 5 6 7 8 9 (lets make +it even longer); +#X obj 260 268 print c; +#X obj 139 212 buddy 3; +#X msg 40 156 clear; +#X connect 2 0 10 0; +#X connect 2 0 10 1; +#X connect 3 0 10 2; +#X connect 4 0 10 0; +#X connect 4 0 10 1; +#X connect 5 0 10 2; +#X connect 6 0 10 2; +#X connect 7 0 10 2; +#X connect 8 0 10 0; +#X connect 8 0 10 1; +#X connect 10 0 0 0; +#X connect 10 1 1 0; +#X connect 10 2 9 0; +#X connect 11 0 10 0; diff --git a/externals/miXed/test/cyclone/buffir-test.pd b/externals/miXed/test/cyclone/buffir-test.pd new file mode 100644 index 000000000..7fd65e157 --- /dev/null +++ b/externals/miXed/test/cyclone/buffir-test.pd @@ -0,0 +1,66 @@ +#N canvas 163 60 571 448 12; +#N canvas 0 0 450 300 graph1 0; +#X array t 1027 float 0; +#X coords 0 1 1026 -1 200 140 1; +#X restore 351 15 graph; +#X obj 24 47 click~; +#X obj 118 170 record~ tout; +#N canvas 0 0 450 300 graph1 0; +#X array tout 1024 float 0; +#X coords 0 1 1023 -1 200 140 1; +#X restore 351 166 graph; +#X msg 118 15 bang; +#X msg 118 136 1; +#X obj 23 107 buffir~ t 0 128; +#X msg 153 47 set t 0 256; +#X msg 153 77 set t 0 1024; +#X obj 376 362 loadbang; +#X obj 116 407 record~ tout; +#X msg 116 216 bang; +#X msg 116 373 1; +#X obj 21 339 buffir~ t 0 128; +#X msg 191 248 set t 0 256; +#X msg 177 281 set t 0 1024; +#X msg 177 216 bang; +#X obj 21 297 *~ 0.05; +#X msg 30 248 0.05; +#X msg 275 327 \; t const 0; +#X msg 199 310 bang; +#X floatatom 267 107 5 0 0 0 - - -; +#X floatatom 267 170 5 0 0 0 - - -; +#X msg 376 392 \; t sinesum 1024 0.4; +#X obj 267 134 peek~ t; +#X obj 199 340 t b b; +#X obj 257 407 peek~ t; +#X msg 125 248 0; +#X msg 79 248 1; +#X obj 21 216 osc~ 44; +#X msg 199 370 127 1; +#X connect 1 0 6 0; +#X connect 4 0 1 0; +#X connect 4 0 5 0; +#X connect 5 0 2 0; +#X connect 6 0 2 0; +#X connect 7 0 6 0; +#X connect 8 0 6 0; +#X connect 9 0 23 0; +#X connect 11 0 12 0; +#X connect 12 0 10 0; +#X connect 13 0 10 0; +#X connect 14 0 13 0; +#X connect 15 0 13 0; +#X connect 16 0 15 0; +#X connect 16 0 12 0; +#X connect 16 0 27 0; +#X connect 17 0 13 0; +#X connect 18 0 17 1; +#X connect 20 0 25 0; +#X connect 20 0 28 0; +#X connect 21 0 24 0; +#X connect 24 0 22 0; +#X connect 25 0 30 0; +#X connect 25 1 19 0; +#X connect 27 0 17 1; +#X connect 28 0 17 1; +#X connect 29 0 17 0; +#X connect 30 0 26 0; diff --git a/externals/miXed/test/cyclone/capture-test.pd b/externals/miXed/test/cyclone/capture-test.pd new file mode 100644 index 000000000..0ebc045fa --- /dev/null +++ b/externals/miXed/test/cyclone/capture-test.pd @@ -0,0 +1,48 @@ +#N canvas 548 272 562 363 12; +#X obj 81 169 capture; +#X obj 169 169 capture 100000; +#X obj 169 216 print; +#X floatatom 81 96 5 0 0 0 - - -; +#X floatatom 169 96 5 0 0 0 - - -; +#X obj 323 169 capture 2; +#X obj 431 169 capture 1; +#X floatatom 323 96 5 0 0 0 - - -; +#X floatatom 431 96 5 0 0 0 - - -; +#X msg 242 96 wclose; +#X msg 59 59 write; +#X msg 266 59 write test.capture; +#X msg 16 96 dump; +#X msg 147 24 1 2 3 4 5 6 7 8 9; +#X msg 133 59 clear; +#X msg 500 96 dump; +#X msg 500 128 count; +#X msg 376 134 count; +#X obj 265 297 capture 10 x; +#X obj 402 297 capture 10 m; +#X floatatom 347 243 5 0 0 0 - - -; +#X msg 226 134 count; +#X msg 250 243 write; +#X connect 0 0 2 0; +#X connect 1 0 2 0; +#X connect 3 0 0 0; +#X connect 4 0 1 0; +#X connect 5 0 2 0; +#X connect 6 0 2 0; +#X connect 7 0 5 0; +#X connect 8 0 6 0; +#X connect 9 0 0 0; +#X connect 9 0 1 0; +#X connect 9 0 5 0; +#X connect 9 0 6 0; +#X connect 10 0 0 0; +#X connect 11 0 1 0; +#X connect 12 0 0 0; +#X connect 13 0 1 0; +#X connect 14 0 1 0; +#X connect 15 0 6 0; +#X connect 16 0 6 0; +#X connect 17 0 5 0; +#X connect 20 0 18 0; +#X connect 20 0 19 0; +#X connect 21 0 1 0; +#X connect 22 0 18 0; diff --git a/externals/miXed/test/cyclone/click-test.pd b/externals/miXed/test/cyclone/click-test.pd new file mode 100644 index 000000000..3a16ae6ce --- /dev/null +++ b/externals/miXed/test/cyclone/click-test.pd @@ -0,0 +1,26 @@ +#N canvas 480 212 450 300 12; +#X obj 45 136 click~; +#X obj 247 136 click~ -1; +#X obj 45 59 testmess 100; +#X msg 45 24 bang; +#X obj 45 98 prepend set; +#X obj 68 237 capture~ f; +#X msg 68 207 clear; +#X obj 212 237 capture~ f; +#X msg 212 207 clear; +#X msg 176 98 bang; +#X msg 182 24 bang; +#X obj 182 59 testmess 1000; +#X connect 0 0 5 0; +#X connect 1 0 7 0; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 4 0 0 0; +#X connect 6 0 5 0; +#X connect 8 0 7 0; +#X connect 9 0 0 0; +#X connect 9 0 1 0; +#X connect 9 0 6 0; +#X connect 9 0 8 0; +#X connect 10 0 11 0; +#X connect 11 0 4 0; diff --git a/externals/miXed/test/cyclone/clip-test.pd b/externals/miXed/test/cyclone/clip-test.pd new file mode 100644 index 000000000..9bc83efe4 --- /dev/null +++ b/externals/miXed/test/cyclone/clip-test.pd @@ -0,0 +1,41 @@ +#N canvas 282 194 586 335 12; +#X obj 32 223 Clip -5; +#X obj 32 255 print; +#X msg 32 176 set test; +#X msg 122 175 set test -5; +#X floatatom 46 103 5 0 0; +#X msg 122 143 set test 3; +#X msg 58 143 set; +#X obj 406 234 Clip -5 0; +#X obj 406 266 print; +#X msg 427 207 set; +#X msg 406 176 set -5; +#X floatatom 314 207 5 0 0; +#X msg 129 30 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7; +#X msg 129 62 -7 -6 -5 -4 -3 test -1 0 1 2 3 4 5 6 7; +#X msg 132 103 test; +#X msg 252 175 set -5 test -4; +#X msg 312 103 bang; +#X msg 198 103 set 11 333; +#X obj 252 143 testmess 350; +#X msg 444 103 bang; +#X obj 384 143 testmess 200; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 7 0 8 0; +#X connect 9 0 7 0; +#X connect 10 0 7 0; +#X connect 11 0 7 0; +#X connect 12 0 0 0; +#X connect 13 0 0 0; +#X connect 14 0 0 0; +#X connect 15 0 0 0; +#X connect 16 0 18 0; +#X connect 17 0 0 0; +#X connect 18 0 0 0; +#X connect 19 0 20 0; +#X connect 20 0 0 0; diff --git a/externals/miXed/test/cyclone/coll-print.pd b/externals/miXed/test/cyclone/coll-print.pd new file mode 100644 index 000000000..8ef57dcb3 --- /dev/null +++ b/externals/miXed/test/cyclone/coll-print.pd @@ -0,0 +1,12 @@ +#N canvas 24 90 450 300 12; +#X obj 169 170 print; +#X obj 169 129 prepend dummy; +#X msg 169 83 set \$1; +#X obj 66 83 prepend :; +#X obj 66 40 inlet; +#X obj 169 40 inlet; +#X connect 1 0 0 0; +#X connect 2 0 1 0; +#X connect 3 0 1 0; +#X connect 4 0 3 0; +#X connect 5 0 2 0; diff --git a/externals/miXed/test/cyclone/coll-test.pd b/externals/miXed/test/cyclone/coll-test.pd new file mode 100644 index 000000000..d955ce153 --- /dev/null +++ b/externals/miXed/test/cyclone/coll-test.pd @@ -0,0 +1,117 @@ +#N canvas 392 153 614 512 12; +#X obj 40 57 coll; +#C restore; +#X msg 40 20 debug; +#X obj 106 57 coll; +#C restore; +#X msg 106 20 debug; +#X msg 42 136 debug; +#X msg 184 136 debug; +#X obj 42 172 coll good.coll; +#C restore; +#X obj 184 205 coll good.coll; +#C restore; +#X msg 42 218 debug; +#X obj 42 280 coll good.coll; +#C restore; +#X msg 41 366 debug; +#X obj 41 406 coll bad.coll; +#C restore; +#X msg 113 218 dump; +#X msg 25 103 store one first element; +#X msg 260 103 store 2 2nd element; +#X obj 321 451 coll good.coll; +#C restore; +#X msg 265 136 store 3 3rd; +#X msg 248 172 store 4 4; +#X floatatom 113 248 5 0 0 0 - - -; +#X msg 205 248 renumber 11; +#X msg 246 280 swap 11 one; +#X msg 308 376 read good.coll; +#X msg 246 406 read; +#X msg 191 406 open; +#X obj 42 322 coll-print; +#X obj 41 444 coll-print; +#X msg 111 366 dump; +#X obj 167 57 coll missing; +#C restore; +#X msg 285 344 refer bad.coll; +#X msg 440 344 refer good.coll; +#X msg 443 415 write test.coll; +#X msg 379 415 write; +#X msg 349 172 flags 1 0; +#X msg 380 224 sort -1; +#X msg 394 248 sort -1 -1; +#X msg 409 280 sort 1; +#X msg 423 309 sort 1 -1; +#X msg 191 376 wclose; +#N canvas 502 158 450 423 large 0; +#X obj 241 341 coll big.coll; +#C restore; +#X msg 33 205 store \$1; +#X obj 33 277 testmess 10; +#X obj 33 92 Uzi; +#X msg 99 92 clear; +#X obj 33 57 t 0 b; +#X obj 33 169 t 0 b; +#X msg 167 277 wclose; +#X obj 241 380 print; +#X floatatom 164 341 5 0 0 0 - - -; +#X msg 261 277 sort -1 -1; +#X obj 129 205 random 10000; +#X msg 129 241 set 10 \$1; +#X msg 241 241 clear; +#X msg 33 21 5000; +#X obj 33 131 urn 50000; +#X msg 283 308 sort 1; +#X connect 0 0 8 0; +#X connect 1 0 2 0; +#X connect 2 0 0 0; +#X connect 3 0 15 0; +#X connect 4 0 15 0; +#X connect 5 0 3 0; +#X connect 5 1 4 0; +#X connect 6 0 1 0; +#X connect 6 1 11 0; +#X connect 7 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 0 0; +#X connect 11 0 12 0; +#X connect 12 0 2 0; +#X connect 13 0 0 0; +#X connect 14 0 5 0; +#X connect 15 0 6 0; +#X connect 16 0 0 0; +#X restore 320 20 pd large; +#X connect 1 0 0 0; +#X connect 3 0 2 0; +#X connect 4 0 6 0; +#X connect 5 0 7 0; +#X connect 8 0 9 0; +#X connect 9 0 24 0; +#X connect 9 1 24 1; +#X connect 10 0 11 0; +#X connect 11 0 25 0; +#X connect 11 1 25 1; +#X connect 12 0 9 0; +#X connect 13 0 6 0; +#X connect 14 0 7 0; +#X connect 16 0 7 0; +#X connect 17 0 7 0; +#X connect 18 0 9 0; +#X connect 19 0 15 0; +#X connect 20 0 15 0; +#X connect 21 0 15 0; +#X connect 22 0 15 0; +#X connect 23 0 15 0; +#X connect 26 0 11 0; +#X connect 28 0 15 0; +#X connect 29 0 15 0; +#X connect 30 0 15 0; +#X connect 31 0 15 0; +#X connect 32 0 7 0; +#X connect 33 0 15 0; +#X connect 34 0 15 0; +#X connect 35 0 15 0; +#X connect 36 0 15 0; +#X connect 37 0 15 0; diff --git a/externals/miXed/test/cyclone/comb-test.pd b/externals/miXed/test/cyclone/comb-test.pd new file mode 100644 index 000000000..dc2e599f9 --- /dev/null +++ b/externals/miXed/test/cyclone/comb-test.pd @@ -0,0 +1,80 @@ +#N canvas 134 225 749 475 12; +#X floatatom 137 89 5 0 0; +#X floatatom 534 89 5 0 0; +#X msg 68 154 clear; +#X obj 36 427 dac~; +#X floatatom 376 89 5 0 0; +#X obj 220 119 osc~; +#X floatatom 220 89 5 0 0; +#X obj 137 154 line~; +#X msg 137 119 \$1 5; +#X obj 220 154 *~ 1; +#X floatatom 303 89 5 0 0; +#X floatatom 458 89 5 0 0; +#N canvas 80 0 592 295 graph1 0; +#X array test 1000 float 0; +#X coords 0 1 999 -1 200 140 1; +#X restore 522 282 graph; +#X obj 65 282 tabwrite~ test; +#X msg 65 246 bang; +#X obj 36 59 adc~; +#X obj 267 282 int; +#X msg 267 246 0; +#X msg 313 246 1; +#X obj 347 18 loadbang; +#X msg 220 59 0.33; +#X msg 137 59 2; +#X msg 303 59 1; +#X obj 534 154 line~; +#X msg 534 119 \$1 5; +#X obj 93 354 dbtorms; +#X obj 93 427 line~; +#X obj 36 390 *~; +#X msg 93 390 \$1 10; +#X obj 96 312 hsl 128 25 0 100 0 0 empty empty empty -2 -6 0 8 -24198 +-1 -1 0 0; +#X obj 267 312 vex_pool~ pool test.pool; +#X msg 458 59 0.4; +#X msg 376 59 0.7; +#X msg 534 59 0.66; +#X obj 36 209 comb~ 100 2 0.7 0.4 0.66; +#X connect 0 0 8 0; +#X connect 1 0 24 0; +#X connect 2 0 34 0; +#X connect 4 0 34 2; +#X connect 5 0 9 0; +#X connect 6 0 5 0; +#X connect 7 0 34 1; +#X connect 8 0 7 0; +#X connect 9 0 34 1; +#X connect 10 0 9 1; +#X connect 11 0 34 3; +#X connect 14 0 13 0; +#X connect 15 0 34 0; +#X connect 16 0 30 0; +#X connect 17 0 16 0; +#X connect 18 0 16 0; +#X connect 19 0 33 0; +#X connect 19 0 31 0; +#X connect 19 0 32 0; +#X connect 19 0 22 0; +#X connect 19 0 20 0; +#X connect 19 0 21 0; +#X connect 20 0 6 0; +#X connect 21 0 0 0; +#X connect 22 0 10 0; +#X connect 23 0 34 4; +#X connect 24 0 23 0; +#X connect 25 0 28 0; +#X connect 26 0 27 1; +#X connect 27 0 3 0; +#X connect 27 0 3 1; +#X connect 28 0 26 0; +#X connect 29 0 25 0; +#X connect 30 0 34 0; +#X connect 30 1 16 0; +#X connect 31 0 11 0; +#X connect 32 0 4 0; +#X connect 33 0 1 0; +#X connect 34 0 13 0; +#X connect 34 0 27 0; diff --git a/externals/miXed/test/cyclone/comment-dotest.pd b/externals/miXed/test/cyclone/comment-dotest.pd new file mode 100644 index 000000000..7a780802d --- /dev/null +++ b/externals/miXed/test/cyclone/comment-dotest.pd @@ -0,0 +1,37 @@ +#N canvas 286 325 415 463 12; +#N canvas 454 204 548 368 doit 0; +#X obj 27 120 counter; +#X obj 27 254 pack 0 0 0; +#X obj 27 188 * 10; +#X obj 27 21 inlet; +#X obj 27 85 Uzi; +#X obj 27 53 t 0 b; +#X msg 73 85 set 0; +#X obj 27 220 + 10; +#X obj 81 220 + 10; +#X obj 138 220 + 7; +#X obj 27 154 t 0 0 0 0; +#X obj 81 188 *; +#X obj 138 188 * 3; +#X msg 27 289 \; pd-comment-dotest.pd obj \$1 \$2 comment 0 \$3 . test +; +#X connect 0 0 10 0; +#X connect 1 0 13 0; +#X connect 2 0 7 0; +#X connect 3 0 5 0; +#X connect 4 0 0 0; +#X connect 5 0 4 0; +#X connect 5 1 6 0; +#X connect 6 0 0 0; +#X connect 7 0 1 0; +#X connect 8 0 1 1; +#X connect 9 0 1 2; +#X connect 10 0 2 0; +#X connect 10 1 11 0; +#X connect 10 2 11 1; +#X connect 10 3 12 0; +#X connect 11 0 8 0; +#X connect 12 0 9 0; +#X restore 283 92 pd doit; +#X msg 283 60 20; +#X connect 1 0 0 0; diff --git a/externals/miXed/test/cyclone/comment-ogonki.pd b/externals/miXed/test/cyclone/comment-ogonki.pd new file mode 100644 index 000000000..1e0902e83 --- /dev/null +++ b/externals/miXed/test/cyclone/comment-ogonki.pd @@ -0,0 +1,9 @@ +#N canvas 232 153 767 466 12; +#X obj 41 14 comment 550 72 helvetica iso8859-2 0 255 0 0 ê󱶳¿¼æñ +ÊÓ¡¦£¯¬ÆÑ; +#X obj 48 321 comment 200 24 courier iso8859-2 0 0 255 0 ê󱶳¿¼æñ +ÊÓ¡¦£¯¬ÆÑ; +#X obj 275 316 comment 200 24 times iso8859-2 0 0 255 255 ê󱶳¿¼æñ +ÊÓ¡¦£¯¬ÆÑ; +#X obj 500 316 comment 200 24 helvetica iso8859-2 0 255 255 0 ê󱶳¿¼æñ +ÊÓ¡¦£¯¬ÆÑ; diff --git a/externals/miXed/test/cyclone/comment-test.pd b/externals/miXed/test/cyclone/comment-test.pd new file mode 100644 index 000000000..03edff61d --- /dev/null +++ b/externals/miXed/test/cyclone/comment-test.pd @@ -0,0 +1,21 @@ +#N canvas 85 23 415 463 12; +#X obj 10 10 comment 0 7 courier ? 0 0 0 0 test; +#X obj 20 10 comment 0 10 courier ? 0 0 0 0 test; +#X obj 30 14 comment 0 13 courier ? 0 0 0 0 test; +#X obj 40 19 comment 0 16 courier ? 0 0 0 0 test; +#X obj 50 26 comment 0 19 courier ? 0 0 0 0 test; +#X obj 60 35 comment 0 22 courier ? 0 0 0 0 test; +#X obj 70 46 comment 0 25 courier ? 0 0 0 0 test; +#X obj 80 59 comment 0 28 courier ? 0 0 0 0 test; +#X obj 90 74 comment 0 31 courier ? 0 0 0 0 test; +#X obj 100 91 comment 0 34 courier ? 0 0 0 0 test; +#X obj 110 110 comment 0 37 courier ? 0 0 0 0 test; +#X obj 120 131 comment 0 40 courier ? 0 0 0 0 test; +#X obj 130 154 comment 0 43 courier ? 0 0 0 0 test; +#X obj 140 179 comment 0 46 courier ? 0 0 0 0 test; +#X obj 150 206 comment 0 49 courier ? 0 0 0 0 test; +#X obj 160 235 comment 0 52 courier ? 0 0 0 0 test; +#X obj 170 266 comment 0 55 courier ? 0 0 0 0 test; +#X obj 180 299 comment 0 58 courier ? 0 0 0 0 test; +#X obj 190 334 comment 0 61 courier ? 0 0 0 0 test; +#X obj 200 371 comment 0 64 courier ? 0 0 0 0 test; diff --git a/externals/miXed/test/cyclone/count-test.pd b/externals/miXed/test/cyclone/count-test.pd new file mode 100644 index 000000000..27fe4544c --- /dev/null +++ b/externals/miXed/test/cyclone/count-test.pd @@ -0,0 +1,19 @@ +#N canvas 229 256 450 300 12; +#X obj 121 167 snapshot~; +#X obj 294 122 metro 30; +#X obj 294 88 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X floatatom 121 215 0 0 0; +#X msg 121 60 bang; +#X msg 59 60 stop; +#X obj 121 118 count~; +#X msg 177 60 3; +#X msg 232 60 100; +#X connect 0 0 3 0; +#X connect 1 0 0 0; +#X connect 2 0 1 0; +#X connect 4 0 6 0; +#X connect 5 0 6 0; +#X connect 6 0 0 0; +#X connect 7 0 6 0; +#X connect 8 0 6 1; diff --git a/externals/miXed/test/cyclone/counter-test.pd b/externals/miXed/test/cyclone/counter-test.pd new file mode 100644 index 000000000..5716b527d --- /dev/null +++ b/externals/miXed/test/cyclone/counter-test.pd @@ -0,0 +1,46 @@ +#N canvas 476 253 450 390 12; +#X obj 68 234 counter; +#X floatatom 68 344 0 0 0; +#X msg 16 173 bang; +#X msg 68 35 up; +#X msg 80 61 down; +#X msg 89 87 updown; +#X msg 96 117 bang; +#X msg 106 145 bang; +#X msg 116 173 bang; +#X msg 126 203 bang; +#X floatatom 152 117 5 0 0; +#X floatatom 161 145 5 0 0; +#X floatatom 167 173 5 0 0; +#X floatatom 177 203 5 0 0; +#X floatatom 126 259 5 0 0; +#X obj 87 315 print second; +#X obj 106 286 print third; +#X msg 319 203 max \$1; +#X msg 243 203 min \$1; +#X floatatom 243 177 5 0 0; +#X floatatom 319 177 5 0 0; +#X msg 16 117 inc; +#X msg 16 145 dec; +#X connect 0 0 1 0; +#X connect 0 1 15 0; +#X connect 0 2 16 0; +#X connect 0 3 14 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 1; +#X connect 7 0 0 2; +#X connect 8 0 0 3; +#X connect 9 0 0 4; +#X connect 10 0 0 1; +#X connect 11 0 0 2; +#X connect 12 0 0 3; +#X connect 13 0 0 4; +#X connect 17 0 0 0; +#X connect 18 0 0 0; +#X connect 19 0 18 0; +#X connect 20 0 17 0; +#X connect 21 0 0 0; +#X connect 22 0 0 0; diff --git a/externals/miXed/test/cyclone/curve-test.pd b/externals/miXed/test/cyclone/curve-test.pd new file mode 100644 index 000000000..dd1f325e2 --- /dev/null +++ b/externals/miXed/test/cyclone/curve-test.pd @@ -0,0 +1,89 @@ +#N canvas 52 64 618 381 12; +#N canvas 0 0 450 300 graph1 0; +#X array t 133000 float 0; +#X coords 0 1000 132999 -1000 200 140 1; +#X restore 373 92 graph; +#X obj 23 261 tabwrite~ t; +#X msg 277 291 clear; +#X msg 212 291 clear; +#X floatatom 206 230 5 0 0 0 - - -; +#X obj 46 291 delay~ 4096 4096; +#X obj 23 135 curve~; +#X obj 206 196 Snapshot~ 100; +#X floatatom 23 22 5 0 0 0 - - -; +#X obj 23 64 t 0 b; +#X obj 46 330 capture~ f; +#X msg 23 96 0 \, 1000 100 \$1; +#X obj 277 330 capture~ f 2206; +#N canvas 47 16 654 382 curves 0; +#X obj 31 351 outlet; +#X obj 31 17 inlet; +#X msg 31 86 0 \, 1000 1000 0.5 0 1000 0.5 1000 1000 0; +#X msg 62 146 1000 \, 0 1000 1 1000 1000 1 0 1000 0; +#X msg 88 209 0 \, 1000 1000 0.9 0 0 0 -500 1000 0.8 0 0 0 1000 1000 +0.7; +#X msg 105 278 0 \, 1000 1000 0.1 0 0 0 -500 1000 0.2 0 0 0 1000 1000 +0.3; +#X obj 31 49 sel 1 -1 2 -2 3 -3 4 -4; +#X msg 73 311 0 \, 1000 1000 -0.1 0 0 0 -500 1000 -0.2 0 0 0 1000 1000 +-0.3; +#X msg 94 243 0 \, 1000 1000 -0.9 0 0 0 -500 1000 -0.8 0 0 0 1000 1000 +-0.7; +#X msg 80 174 1000 \, 0 1000 -1 1000 1000 -1 0 1000 0; +#X msg 47 117 0 \, 1000 1000 -0.5 0 1000 -0.5 1000 1000 0; +#X connect 1 0 6 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 2 0; +#X connect 6 1 10 0; +#X connect 6 2 3 0; +#X connect 6 3 9 0; +#X connect 6 4 4 0; +#X connect 6 5 8 0; +#X connect 6 6 5 0; +#X connect 6 7 7 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 0 0; +#X restore 237 96 pd curves; +#X obj 237 64 t 0 b; +#X msg 107 22 1; +#X msg 151 22 -1; +#X msg 193 22 2; +#X msg 237 22 -2; +#X msg 282 22 3; +#X msg 368 22 4; +#X msg 326 22 -3; +#X msg 412 22 -4; +#X obj 72 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X connect 2 0 12 0; +#X connect 3 0 10 0; +#X connect 5 0 10 0; +#X connect 6 0 1 0; +#X connect 6 0 5 0; +#X connect 6 0 7 0; +#X connect 6 0 12 0; +#X connect 6 1 3 0; +#X connect 6 1 23 0; +#X connect 7 0 4 0; +#X connect 8 0 9 0; +#X connect 9 0 11 0; +#X connect 9 1 1 0; +#X connect 9 1 2 0; +#X connect 11 0 6 0; +#X connect 13 0 6 0; +#X connect 14 0 13 0; +#X connect 14 1 1 0; +#X connect 14 1 2 0; +#X connect 15 0 14 0; +#X connect 16 0 14 0; +#X connect 17 0 14 0; +#X connect 18 0 14 0; +#X connect 19 0 14 0; +#X connect 20 0 14 0; +#X connect 21 0 14 0; +#X connect 22 0 14 0; diff --git a/externals/miXed/test/cyclone/cycle-test.pd b/externals/miXed/test/cyclone/cycle-test.pd new file mode 100644 index 000000000..97d008e36 --- /dev/null +++ b/externals/miXed/test/cyclone/cycle-test.pd @@ -0,0 +1,30 @@ +#N canvas 257 195 450 300 12; +#X msg 77 196 bang; +#X obj 131 235 print a; +#X obj 218 235 print b; +#X msg 131 153 test; +#X msg 192 152 symbol test; +#X msg 72 86 1 2 3 \, 4 5; +#X msg 204 86 1 2 3; +#X msg 230 115 4 5; +#X obj 131 195 cycle 2 1; +#X msg 242 18 bang; +#X obj 204 59 del 100; +#X obj 293 59 del 100; +#X obj 312 205 cycle; +#X obj 312 237 print; +#X msg 312 151 test 1 2 3; +#X connect 0 0 8 0; +#X connect 3 0 8 0; +#X connect 4 0 8 0; +#X connect 5 0 8 0; +#X connect 6 0 8 0; +#X connect 7 0 8 0; +#X connect 8 0 1 0; +#X connect 8 1 2 0; +#X connect 9 0 10 0; +#X connect 9 0 11 0; +#X connect 10 0 6 0; +#X connect 11 0 7 0; +#X connect 12 0 13 0; +#X connect 14 0 12 0; diff --git a/externals/miXed/test/cyclone/cyclone-test.pd b/externals/miXed/test/cyclone/cyclone-test.pd new file mode 100644 index 000000000..fefeb16d5 --- /dev/null +++ b/externals/miXed/test/cyclone/cyclone-test.pd @@ -0,0 +1,64 @@ +#N canvas 331 48 650 459 12; +#X obj 37 419 cyclone; +#X msg 76 133 bang; +#X msg 61 95 import; +#X obj 41 240 forward texthelp; +#X obj 61 302 r texthelp; +#X msg 50 272 send binhelp; +#X msg 176 272 send texthelp; +#X obj 88 329 r binhelp; +#X obj 88 358 sprintf import ../../../ref/c74help/bin/%s.help; +#X obj 61 389 sprintf import ../../../ref/c74help/text/%s.help; +#X msg 130 203 buffir~; +#X msg 41 203 record~; +#X msg 220 203 fffb~; +#X msg 295 203 pictctrl; +#X msg 41 168 universal; +#X msg 138 168 funbuff; +#X msg 220 168 prob; +#X obj 137 16 loadbang; +#X obj 137 133 cyclone; +#X msg 183 95 cd ../../../rob; +#X obj 307 272 cyclone; +#X obj 390 240 loadbang; +#X msg 390 269 cd ../krzYszcz/max-help; +#X msg 393 203 import scope~; +#X obj 307 310 print result; +#X obj 394 168 print pwd; +#X obj 394 133 r \$0-pwd; +#X msg 321 133 pwd \$1; +#X msg 321 51 bang; +#X obj 321 95 symbol \$0-pwd; +#X msg 145 95 cd; +#X obj 206 133 print result; +#X msg 296 168 matrix~; +#X msg 137 55 cd ../../../ref; +#X connect 1 0 18 0; +#X connect 2 0 18 0; +#X connect 4 0 9 0; +#X connect 5 0 3 0; +#X connect 6 0 3 0; +#X connect 7 0 8 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 3 0; +#X connect 11 0 3 0; +#X connect 12 0 3 0; +#X connect 13 0 3 0; +#X connect 14 0 3 0; +#X connect 15 0 3 0; +#X connect 16 0 3 0; +#X connect 17 0 33 0; +#X connect 18 0 31 0; +#X connect 19 0 18 0; +#X connect 20 0 24 0; +#X connect 21 0 22 0; +#X connect 22 0 20 0; +#X connect 23 0 20 0; +#X connect 26 0 25 0; +#X connect 27 0 18 0; +#X connect 28 0 29 0; +#X connect 29 0 27 0; +#X connect 30 0 18 0; +#X connect 32 0 3 0; +#X connect 33 0 18 0; diff --git a/externals/miXed/test/cyclone/decide-test.pd b/externals/miXed/test/cyclone/decide-test.pd new file mode 100644 index 000000000..27c534ce1 --- /dev/null +++ b/externals/miXed/test/cyclone/decide-test.pd @@ -0,0 +1,27 @@ +#N canvas 242 258 450 300 12; +#X obj 116 111 decide; +#X msg 47 68 bang; +#X obj 116 68 Uzi; +#X obj 116 198 counter; +#X obj 200 198 counter; +#X obj 116 151 sel 0 1; +#X floatatom 116 249 0 0 0; +#X floatatom 200 249 0 0 0; +#X msg 116 29 10000; +#X obj 276 73 decide; +#X msg 237 29 bang; +#X msg 325 29 1; +#X msg 382 29 -1; +#X obj 276 111 print; +#X connect 0 0 5 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 6 0; +#X connect 4 0 7 0; +#X connect 5 0 3 0; +#X connect 5 1 4 0; +#X connect 8 0 2 0; +#X connect 9 0 13 0; +#X connect 10 0 9 0; +#X connect 11 0 9 1; +#X connect 12 0 9 1; diff --git a/externals/miXed/test/cyclone/drunk-test.pd b/externals/miXed/test/cyclone/drunk-test.pd new file mode 100644 index 000000000..fdd608717 --- /dev/null +++ b/externals/miXed/test/cyclone/drunk-test.pd @@ -0,0 +1,45 @@ +#N canvas 366 150 514 397 12; +#X obj 43 265 drunk; +#X obj 43 305 print; +#X msg 43 112 bang; +#X msg 53 142 seed 123; +#X floatatom 147 172 5 0 0; +#X floatatom 171 196 5 0 0; +#X floatatom 189 219 5 0 0; +#X msg 147 142 11 22 33; +#X obj 282 305 print; +#X msg 282 112 bang; +#X msg 292 142 seed 123; +#X floatatom 386 172 5 0 0; +#X floatatom 410 196 5 0 0; +#X floatatom 428 219 5 0 0; +#X msg 386 142 11 22 33; +#X obj 282 265 drunk 100 -2; +#X msg 124 265 -----; +#X msg 62 177 set 50; +#X msg 301 177 set 50; +#X msg 43 28 1000; +#X obj 43 66 Uzi; +#X msg 282 28 1000; +#X obj 282 66 Uzi; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 1; +#X connect 6 0 0 2; +#X connect 7 0 0 0; +#X connect 9 0 15 0; +#X connect 10 0 15 0; +#X connect 11 0 15 0; +#X connect 12 0 15 1; +#X connect 13 0 15 2; +#X connect 14 0 15 0; +#X connect 15 0 8 0; +#X connect 16 0 1 0; +#X connect 17 0 0 0; +#X connect 18 0 15 0; +#X connect 19 0 20 0; +#X connect 20 0 0 0; +#X connect 21 0 22 0; +#X connect 22 0 15 0; diff --git a/externals/miXed/test/cyclone/forward-test.pd b/externals/miXed/test/cyclone/forward-test.pd new file mode 100644 index 000000000..af4b2994e --- /dev/null +++ b/externals/miXed/test/cyclone/forward-test.pd @@ -0,0 +1,27 @@ +#N canvas 489 306 462 351 12; +#X msg 197 169 send there; +#X msg 197 205 send elsewhere; +#X msg 197 240 send; +#X obj 62 45 r there; +#X obj 167 45 r elsewhere; +#X obj 62 83 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 167 83 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 67 195 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 207 83 print; +#X msg 100 124 any message; +#X obj 100 279 forward here; +#X obj 266 240 r here; +#X obj 266 279 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X connect 0 0 10 0; +#X connect 1 0 10 0; +#X connect 2 0 10 0; +#X connect 3 0 5 0; +#X connect 4 0 6 0; +#X connect 4 0 8 0; +#X connect 7 0 10 0; +#X connect 9 0 10 0; +#X connect 11 0 12 0; diff --git a/externals/miXed/test/cyclone/frameaccum-test.pd b/externals/miXed/test/cyclone/frameaccum-test.pd new file mode 100644 index 000000000..61e4ffddb --- /dev/null +++ b/externals/miXed/test/cyclone/frameaccum-test.pd @@ -0,0 +1,15 @@ +#N canvas 0 0 450 300 12; +#X obj 31 52 frameaccum~; +#X obj 31 93 capture~; +#X obj 177 183 Scope~ 234 106 8 3 256 0 1 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 325 93 capture~; +#X obj 325 52 framedelta~; +#X msg 33 143 range 0 1 \, bufsize 256 \, 8; +#X obj 177 13 train~ 46.4399; +#X connect 0 0 1 0; +#X connect 4 0 3 0; +#X connect 5 0 2 0; +#X connect 6 0 2 0; +#X connect 6 0 0 0; +#X connect 6 0 4 0; diff --git a/externals/miXed/test/cyclone/fromsymbol-test.pd b/externals/miXed/test/cyclone/fromsymbol-test.pd new file mode 100644 index 000000000..cacbc832a --- /dev/null +++ b/externals/miXed/test/cyclone/fromsymbol-test.pd @@ -0,0 +1,64 @@ +#N canvas 352 169 704 560 12; +#X obj 81 108 tosymbol; +#X msg 81 62 one two three; +#X obj 81 147 fromsymbol; +#X msg 29 62 one; +#X obj 243 62 testmess 100; +#X msg 243 31 test; +#X msg 385 31 test; +#X obj 385 62 testmess 300; +#X obj 81 190 route one test; +#X obj 81 229 print one; +#X obj 184 229 print test; +#X obj 293 229 print unknown; +#X obj 42 316 tosymbol; +#X obj 42 359 fromsymbol; +#X floatatom 106 416 5 0 0; +#X floatatom 158 390 5 0 0; +#X floatatom 42 282 5 0 0; +#X obj 158 359 f; +#X obj 268 322 tosymbol; +#X obj 268 359 fromsymbol; +#X msg 133 316 99; +#X msg 178 316 0.99; +#X msg 133 282 1 2 3; +#X obj 42 416 print; +#X msg 268 397 test2; +#X msg 364 282 set test2; +#X msg 268 282 set test1; +#X msg 476 246 1 2 3 4; +#X obj 476 282 tosymbol; +#X obj 476 322 fromsymbol; +#X obj 476 359 unpack 0 0 0 0; +#X obj 476 397 print; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 2 0 8 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 7 0 0 0; +#X connect 8 0 9 0; +#X connect 8 1 10 0; +#X connect 8 2 11 0; +#X connect 12 0 13 0; +#X connect 12 0 17 0; +#X connect 13 0 14 0; +#X connect 13 0 23 0; +#X connect 16 0 12 0; +#X connect 17 0 15 0; +#X connect 18 0 19 0; +#X connect 19 0 24 0; +#X connect 20 0 13 0; +#X connect 21 0 13 0; +#X connect 22 0 13 0; +#X connect 25 0 18 0; +#X connect 26 0 18 0; +#X connect 27 0 28 0; +#X connect 28 0 29 0; +#X connect 29 0 30 0; +#X connect 30 0 31 0; +#X connect 30 1 31 0; +#X connect 30 2 31 0; +#X connect 30 3 31 0; diff --git a/externals/miXed/test/cyclone/funbuff-etest.pd b/externals/miXed/test/cyclone/funbuff-etest.pd new file mode 100644 index 000000000..5d6a1a325 --- /dev/null +++ b/externals/miXed/test/cyclone/funbuff-etest.pd @@ -0,0 +1,164 @@ +#N canvas 116 34 735 514 12; +#X msg 49 113 clear; +#X floatatom 172 181 5 0 0; +#X obj 212 243 * -1; +#X obj 172 213 t 0 0; +#X floatatom 172 147 5 0 0; +#X obj 279 113 Uzi; +#X msg 49 181 debug \$1; +#X msg 71 147 1; +#X obj 279 71 t 0 0; +#X msg 224 34 1000; +#X msg 279 34 10000; +#X msg 173 34 100; +#X obj 530 147 counter; +#X obj 530 113 Uzi; +#X msg 595 34 100000; +#X msg 475 34 1000; +#X msg 530 34 10000; +#X msg 424 34 100; +#X msg 578 113 set 0; +#X obj 530 71 t 0 b; +#X msg 114 147 2; +#X obj 279 147 urn; +#X msg 344 34 100000; +#X obj 531 306 counter; +#X obj 531 271 Uzi; +#X msg 579 271 set 0; +#X obj 531 235 t 0 b; +#X msg 531 196 50; +#X msg 582 196 100; +#X obj 429 235 Uzi; +#X msg 429 196 50; +#X msg 480 196 100; +#X obj 429 271 urn 100; +#X obj 49 355 funbuff; +#C embed 1; +#C set 1 -1 2 -2 3 -3 5 -5 6 -6 7 -7 8 -8 9 -9 10 -10 11 -11 12 -12 +13 -13 14 -14 15 -15 16 -16 18 -18 19 -19 20 -20 21 -21 22 -22 23 -23 +25 -25 26 -26 27 -27 28 -28 30 -30 31 -31 33 -33 34 -34; +#C restore; +#X obj 49 426 print; +#X msg 60 213 bang; +#X msg 69 243 dump; +#X obj 49 389 pack; +#X msg 126 288 set; +#X msg 194 288 set 1 2 3; +#X msg 171 83 goto 15; +#X msg 171 112 next; +#X msg 148 426 write test.funbuff; +#X msg 157 461 read test.funbuff; +#X msg 184 364 read; +#X msg 184 393 write; +#X obj 398 389 funbuff test.funbuff; +#C embed 1; +#C set 0 -0 1 -1 2 -2 3 -3 4 -4 5 -5 6 -6 7 -7 8 -8 9 -9 10 -10 11 +-11 12 -12 13 -13 14 -14 15 -15 16 -16 17 -17 18 -18 19 -19 20 -20 +21 -21 22 -22 23 -23 24 -24 25 -25 26 -26 27 -27 28 -28 29 -29 30 -30 +31 -31 32 -32 33 -33 34 -34 35 -35 36 -36 37 -37 38 -38 39 -39 40 -40 +41 -41 42 -42 43 -43 44 -44 45 -45 46 -46 47 -47 48 -48 49 -49 50 -50 +51 -51 52 -52 53 -53 54 -54 55 -55 56 -56 57 -57 58 -58 59 -59 60 -60 +61 -61 62 -62 63 -63 64 -64 65 -65 66 -66 67 -67 68 -68 69 -69 70 -70 +71 -71 72 -72 73 -73 74 -74 75 -75 76 -76 77 -77 78 -78 79 -79 80 -80 +81 -81 82 -82 83 -83 84 -84 85 -85 86 -86 87 -87 88 -88 89 -89 90 -90 +91 -91 92 -92 93 -93 94 -94 95 -95 96 -96 97 -97 98 -98 99 -99; +#C restore; +#X obj 398 461 print; +#X obj 398 426 pack; +#X msg 398 355 bang; +#X msg 456 355 next; +#X msg 514 355 goto 0; +#N canvas 478 69 552 396 interp 0; +#X obj 52 124 funbuff test.funbuff; +#C restore; +#X msg 52 85 interp \$1; +#X floatatom 52 53 5 0 0; +#N canvas 0 0 450 300 graph1 0; +#X array t 100 float 1; +#A 0 0 -0.0285716 -0.0548876 -0.0812036 -0.10752 -0.133836 -0.160152 +-0.186468 -0.212784 -0.2391 -0.265416 -0.291732 -0.318048 -0.344364 +-0.37068 -0.396996 -0.423312 -0.449628 -0.475944 -0.50226 -0.528575 +-0.55429 -0.580004 -0.605719 -0.631433 -0.657148 -0.682863 -0.708577 +-0.734292 -0.760006 -0.785721 -0.811435 -0.83715 -0.862864 -0.888579 +-0.914293 -0.939293 -0.964293 -0.989294 -1.01429 -1.04287 -1.07144 +-1.10001 -1.12382 -1.14763 -1.17144 -1.18572 -1.20001 -1.22858 -1.25715 +-1.28096 -1.30477 -1.32858 -1.35715 -1.40715 -1.45715 -1.40001 -1.38573 +-1.15715 -0.942865 -0.0285715 0.242859 0.343812 0.444765 0.545719 0.646672 +0.747625 0.848578 0.949531 1.05048 1.15144 1.25239 1.35334 1.4543 1.55525 +1.6562 1.77144 1.84922 1.927 2.68574 2.67145 2.65716 2.64288 2.62859 +2.61431 2.6041 2.5939 2.58369 2.57349 2.56329 2.55308 2.54288 2.54288 +2.54696 2.55104 2.55512 2.5592 2.56329 2.56737 2.62859; +#X coords 0 1 99 -1 200 140 1; +#X restore 290 173 graph; +#X floatatom 184 53 5 0 0; +#X msg 184 85 interptab \$1 t; +#X floatatom 52 168 0 0 0; +#X connect 0 0 6 0; +#X connect 1 0 0 0; +#X connect 2 0 1 0; +#X connect 4 0 5 0; +#X connect 5 0 0 0; +#X restore 49 34 pd interp; +#X msg 306 235 embed 1; +#X msg 332 355 dump; +#X connect 0 0 33 0; +#X connect 1 0 3 0; +#X connect 2 0 33 1; +#X connect 3 0 33 0; +#X connect 3 1 2 0; +#X connect 4 0 33 0; +#X connect 5 0 21 0; +#X connect 6 0 33 0; +#X connect 7 0 6 0; +#X connect 8 0 5 0; +#X connect 8 1 21 1; +#X connect 9 0 8 0; +#X connect 10 0 8 0; +#X connect 11 0 8 0; +#X connect 12 0 3 0; +#X connect 13 0 12 0; +#X connect 14 0 19 0; +#X connect 15 0 19 0; +#X connect 16 0 19 0; +#X connect 17 0 19 0; +#X connect 18 0 12 0; +#X connect 19 0 13 0; +#X connect 19 1 18 0; +#X connect 20 0 6 0; +#X connect 21 0 3 0; +#X connect 22 0 8 0; +#X connect 23 0 33 0; +#X connect 24 0 23 0; +#X connect 25 0 23 0; +#X connect 26 0 24 0; +#X connect 26 1 25 0; +#X connect 27 0 26 0; +#X connect 28 0 26 0; +#X connect 29 0 32 0; +#X connect 30 0 29 0; +#X connect 31 0 29 0; +#X connect 32 0 33 0; +#X connect 33 0 37 0; +#X connect 33 1 37 1; +#X connect 33 2 34 0; +#X connect 35 0 33 0; +#X connect 36 0 33 0; +#X connect 37 0 34 0; +#X connect 38 0 33 0; +#X connect 39 0 33 0; +#X connect 40 0 33 0; +#X connect 41 0 33 0; +#X connect 42 0 33 0; +#X connect 43 0 33 0; +#X connect 44 0 33 0; +#X connect 45 0 33 0; +#X connect 46 0 48 0; +#X connect 46 1 48 1; +#X connect 46 2 47 0; +#X connect 48 0 47 0; +#X connect 49 0 46 0; +#X connect 50 0 46 0; +#X connect 51 0 46 0; +#X connect 53 0 46 0; +#X connect 53 0 33 0; +#X connect 54 0 46 0; diff --git a/externals/miXed/test/cyclone/funbuff-test.pd b/externals/miXed/test/cyclone/funbuff-test.pd new file mode 100644 index 000000000..230368e24 --- /dev/null +++ b/externals/miXed/test/cyclone/funbuff-test.pd @@ -0,0 +1,149 @@ +#N canvas 116 34 735 514 12; +#X msg 49 113 clear; +#X floatatom 172 181 5 0 0; +#X obj 212 243 * -1; +#X obj 172 213 t 0 0; +#X floatatom 172 147 5 0 0; +#X obj 279 113 Uzi; +#X msg 49 181 debug \$1; +#X msg 71 147 1; +#X obj 279 71 t 0 0; +#X msg 224 34 1000; +#X msg 279 34 10000; +#X msg 173 34 100; +#X obj 530 147 counter; +#X obj 530 113 Uzi; +#X msg 595 34 100000; +#X msg 475 34 1000; +#X msg 530 34 10000; +#X msg 424 34 100; +#X msg 578 113 set 0; +#X obj 530 71 t 0 b; +#X msg 114 147 2; +#X obj 279 147 urn; +#X msg 344 34 100000; +#X obj 531 306 counter; +#X obj 531 271 Uzi; +#X msg 579 271 set 0; +#X obj 531 235 t 0 b; +#X msg 531 196 50; +#X msg 582 196 100; +#X obj 429 235 Uzi; +#X msg 429 196 50; +#X msg 480 196 100; +#X obj 429 271 urn 100; +#X obj 49 355 funbuff; +#C restore; +#X obj 49 426 print; +#X msg 60 213 bang; +#X msg 69 243 dump; +#X obj 49 389 pack; +#X msg 126 288 set; +#X msg 194 288 set 1 2 3; +#X msg 171 83 goto 15; +#X msg 171 112 next; +#X msg 148 426 write test.funbuff; +#X msg 157 461 read test.funbuff; +#X msg 184 364 read; +#X msg 184 393 write; +#X obj 398 389 funbuff test.funbuff; +#C restore; +#X obj 398 461 print; +#X obj 398 426 pack; +#X msg 398 355 bang; +#X msg 456 355 next; +#X msg 514 355 goto 0; +#N canvas 478 69 552 396 interp 0; +#X obj 52 124 funbuff test.funbuff; +#C restore; +#X msg 52 85 interp \$1; +#X floatatom 52 53 5 0 0; +#N canvas 0 0 450 300 graph1 0; +#X array t 100 float 1; +#A 0 0 -0.0285716 -0.0548876 -0.0812036 -0.10752 -0.133836 -0.160152 +-0.186468 -0.212784 -0.2391 -0.265416 -0.291732 -0.318048 -0.344364 +-0.37068 -0.396996 -0.423312 -0.449628 -0.475944 -0.50226 -0.528575 +-0.55429 -0.580004 -0.605719 -0.631433 -0.657148 -0.682863 -0.708577 +-0.734292 -0.760006 -0.785721 -0.811435 -0.83715 -0.862864 -0.888579 +-0.914293 -0.939293 -0.964293 -0.989294 -1.01429 -1.04287 -1.07144 +-1.10001 -1.12382 -1.14763 -1.17144 -1.18572 -1.20001 -1.22858 -1.25715 +-1.28096 -1.30477 -1.32858 -1.35715 -1.40715 -1.45715 -1.40001 -1.38573 +-1.15715 -0.942865 -0.0285715 0.242859 0.343812 0.444765 0.545719 0.646672 +0.747625 0.848578 0.949531 1.05048 1.15144 1.25239 1.35334 1.4543 1.55525 +1.6562 1.77144 1.84922 1.927 2.68574 2.67145 2.65716 2.64288 2.62859 +2.61431 2.6041 2.5939 2.58369 2.57349 2.56329 2.55308 2.54288 2.54288 +2.54696 2.55104 2.55512 2.5592 2.56329 2.56737 2.62859; +#X coords 0 1 99 -1 200 140 1; +#X restore 290 173 graph; +#X floatatom 184 53 5 0 0; +#X msg 184 85 interptab \$1 t; +#X floatatom 52 168 0 0 0; +#X connect 0 0 6 0; +#X connect 1 0 0 0; +#X connect 2 0 1 0; +#X connect 4 0 5 0; +#X connect 5 0 0 0; +#X restore 49 34 pd interp; +#X msg 306 235 embed 1; +#X msg 332 355 dump; +#X connect 0 0 33 0; +#X connect 1 0 3 0; +#X connect 2 0 33 1; +#X connect 3 0 33 0; +#X connect 3 1 2 0; +#X connect 4 0 33 0; +#X connect 5 0 21 0; +#X connect 6 0 33 0; +#X connect 7 0 6 0; +#X connect 8 0 5 0; +#X connect 8 1 21 1; +#X connect 9 0 8 0; +#X connect 10 0 8 0; +#X connect 11 0 8 0; +#X connect 12 0 3 0; +#X connect 13 0 12 0; +#X connect 14 0 19 0; +#X connect 15 0 19 0; +#X connect 16 0 19 0; +#X connect 17 0 19 0; +#X connect 18 0 12 0; +#X connect 19 0 13 0; +#X connect 19 1 18 0; +#X connect 20 0 6 0; +#X connect 21 0 3 0; +#X connect 22 0 8 0; +#X connect 23 0 33 0; +#X connect 24 0 23 0; +#X connect 25 0 23 0; +#X connect 26 0 24 0; +#X connect 26 1 25 0; +#X connect 27 0 26 0; +#X connect 28 0 26 0; +#X connect 29 0 32 0; +#X connect 30 0 29 0; +#X connect 31 0 29 0; +#X connect 32 0 33 0; +#X connect 33 0 37 0; +#X connect 33 1 37 1; +#X connect 33 2 34 0; +#X connect 35 0 33 0; +#X connect 36 0 33 0; +#X connect 37 0 34 0; +#X connect 38 0 33 0; +#X connect 39 0 33 0; +#X connect 40 0 33 0; +#X connect 41 0 33 0; +#X connect 42 0 33 0; +#X connect 43 0 33 0; +#X connect 44 0 33 0; +#X connect 45 0 33 0; +#X connect 46 0 48 0; +#X connect 46 1 48 1; +#X connect 46 2 47 0; +#X connect 48 0 47 0; +#X connect 49 0 46 0; +#X connect 50 0 46 0; +#X connect 51 0 46 0; +#X connect 53 0 46 0; +#X connect 53 0 33 0; +#X connect 54 0 46 0; diff --git a/externals/miXed/test/cyclone/funnel-test.pd b/externals/miXed/test/cyclone/funnel-test.pd new file mode 100644 index 000000000..3580e5d11 --- /dev/null +++ b/externals/miXed/test/cyclone/funnel-test.pd @@ -0,0 +1,33 @@ +#N canvas 557 414 450 300 12; +#X obj 93 108 funnel 5; +#X obj 93 147 spray 5; +#X obj 58 200 print a; +#X obj 174 200 print e; +#X msg 116 64 bang; +#X msg 49 64 2 3 4; +#X msg 172 64 5 6 7; +#X msg 172 26 -7; +#X msg 49 26 -4; +#X obj 245 64 testmess 50; +#X msg 245 26 11 test; +#X obj 187 147 print; +#X obj 283 147 funnel 1 7; +#X msg 283 108 99; +#X msg 331 108 list test; +#X msg 222 108 bang; +#X connect 0 0 1 0; +#X connect 0 0 11 0; +#X connect 1 0 2 0; +#X connect 1 4 3 0; +#X connect 4 0 0 0; +#X connect 4 0 0 4; +#X connect 5 0 0 0; +#X connect 6 0 0 4; +#X connect 7 0 0 4; +#X connect 8 0 0 0; +#X connect 9 0 0 4; +#X connect 10 0 9 0; +#X connect 12 0 11 0; +#X connect 13 0 12 0; +#X connect 14 0 12 0; +#X connect 15 0 12 0; diff --git a/externals/miXed/test/cyclone/gate-test.pd b/externals/miXed/test/cyclone/gate-test.pd new file mode 100644 index 000000000..80cdb61ee --- /dev/null +++ b/externals/miXed/test/cyclone/gate-test.pd @@ -0,0 +1,48 @@ +#N canvas 250 108 629 425 12; +#X obj 209 222 switch 11 0 padding; +#X msg 90 37 bang; +#X msg 141 37 2; +#X msg 184 37 symbol three; +#X msg 264 67 1 2 3 4; +#X msg 318 94 five is anything; +#X msg 34 37 bang; +#X obj 34 67 grab; +#X floatatom 34 182 5 0 0; +#X floatatom 54 113 5 0 0; +#X obj 209 274 route bang float symbol list; +#X obj 209 314 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 270 310 5 0 0; +#X symbolatom 332 310 10 0 0; +#X obj 394 347 print list; +#X obj 456 310 print anything; +#X msg 357 123 last is anything too; +#X obj 227 165 gate 11 0 padding; +#X connect 0 0 10 0; +#X connect 1 0 17 1; +#X connect 2 0 17 1; +#X connect 3 0 17 1; +#X connect 4 0 17 1; +#X connect 5 0 17 1; +#X connect 6 0 7 0; +#X connect 7 0 8 0; +#X connect 7 1 17 0; +#X connect 9 0 0 0; +#X connect 9 0 17 0; +#X connect 10 0 11 0; +#X connect 10 1 12 0; +#X connect 10 2 13 0; +#X connect 10 3 14 0; +#X connect 10 4 15 0; +#X connect 16 0 17 1; +#X connect 17 0 0 1; +#X connect 17 1 0 2; +#X connect 17 2 0 3; +#X connect 17 3 0 4; +#X connect 17 4 0 5; +#X connect 17 5 0 6; +#X connect 17 6 0 7; +#X connect 17 7 0 8; +#X connect 17 8 0 9; +#X connect 17 9 0 10; +#X connect 17 10 0 11; diff --git a/externals/miXed/test/cyclone/good.coll b/externals/miXed/test/cyclone/good.coll new file mode 100644 index 000000000..fcbd42833 --- /dev/null +++ b/externals/miXed/test/cyclone/good.coll @@ -0,0 +1,4 @@ +11, testing coll; +12, who is going to do that?; +13 !, not; +me 14, and you?; diff --git a/externals/miXed/test/cyclone/grab-test.pd b/externals/miXed/test/cyclone/grab-test.pd new file mode 100644 index 000000000..7d1b31b5b --- /dev/null +++ b/externals/miXed/test/cyclone/grab-test.pd @@ -0,0 +1,42 @@ +#N canvas 402 375 591 368 12; +#X obj 252 43 r t1; +#X msg 121 43 set t2; +#X obj 495 129 r t2; +#X obj 27 175 print 1st; +#X obj 103 129 print 2nd; +#X obj 252 253 print pass1; +#X obj 292 214 print pass2; +#X obj 27 89 grab 2 t1; +#X obj 419 43 r t1; +#X obj 419 253 print pass3; +#X floatatom 27 43 5 0 0; +#X floatatom 286 129 5 0 0; +#X obj 252 175 t 0 b; +#X obj 419 175 + 100; +#X obj 495 175 print t2; +#X obj 271 83 print t1-a; +#X obj 445 83 print t1-b; +#X obj 142 214 grab; +#X obj 204 294 +; +#X floatatom 142 293 5 0 0; +#X msg 142 175 \$1 1; +#X obj 173 255 grab; +#X connect 0 0 12 0; +#X connect 0 0 15 0; +#X connect 1 0 7 0; +#X connect 2 0 12 0; +#X connect 2 0 14 0; +#X connect 7 0 3 0; +#X connect 7 1 4 0; +#X connect 8 0 13 0; +#X connect 8 0 16 0; +#X connect 10 0 7 0; +#X connect 10 0 20 0; +#X connect 11 0 12 0; +#X connect 12 0 5 0; +#X connect 12 1 6 0; +#X connect 13 0 9 0; +#X connect 17 0 19 0; +#X connect 17 1 21 0; +#X connect 20 0 17 0; +#X connect 21 1 18 0; diff --git a/externals/miXed/test/cyclone/index-test.pd b/externals/miXed/test/cyclone/index-test.pd new file mode 100644 index 000000000..ea925fdff --- /dev/null +++ b/externals/miXed/test/cyclone/index-test.pd @@ -0,0 +1,51 @@ +#N canvas 391 378 743 455 12; +#N canvas 0 0 450 300 graph1 0; +#X array 0-t 100 float 0; +#X coords 0 1 99 -1 200 140 1; +#X restore 279 34 graph; +#X obj 43 280 index~ t; +#X obj 43 321 snapshot~; +#X floatatom 43 359 5 0 0; +#X floatatom 43 245 5 0 0; +#X obj 155 280 metro 10; +#X obj 155 245 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#N canvas 0 0 450 300 graph1 0; +#X array t 100 float 0; +#X coords 0 1 99 -1 200 140 1; +#X restore 37 34 graph; +#X obj 273 321 snapshot~; +#X floatatom 273 359 5 0 0; +#X floatatom 273 245 5 0 0; +#X obj 385 280 metro 10; +#X obj 385 245 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 273 280 index~ t 1; +#N canvas 0 0 450 300 graph1 0; +#X array 1-t 100 float 0; +#X coords 0 1 99 -1 200 140 1; +#X restore 518 34 graph; +#X msg 121 202 1; +#X msg 161 202 2; +#X msg 80 202 0; +#X msg 324 202 1; +#X msg 364 202 2; +#X msg 283 202 0; +#X msg 408 202 3; +#X connect 1 0 2 0; +#X connect 2 0 3 0; +#X connect 4 0 1 0; +#X connect 5 0 2 0; +#X connect 6 0 5 0; +#X connect 8 0 9 0; +#X connect 10 0 13 0; +#X connect 11 0 8 0; +#X connect 12 0 11 0; +#X connect 13 0 8 0; +#X connect 15 0 1 1; +#X connect 16 0 1 1; +#X connect 17 0 1 1; +#X connect 18 0 13 1; +#X connect 19 0 13 1; +#X connect 20 0 13 1; +#X connect 21 0 13 1; diff --git a/externals/miXed/test/cyclone/kanon.mid b/externals/miXed/test/cyclone/kanon.mid new file mode 100644 index 0000000000000000000000000000000000000000..a07f5ecaca33130e66304d6eb1ae20bb96910416 GIT binary patch literal 5282 zcmZ|TOH<oe7Qpe_FddtRd55H^>VyUxKQO|^*fK`O_=%rL2~I~zIggplB9&CAO0U8q zDNCLYAn7h=HS5{Wy1VBS%qQykUz60#rdP78`#9&G9|yr;`1Y?th&$pt@%?w>!SLtz z+}#zwKbj5wV_W=g|7mXae%Srzo8J$`?ZfYRI2#)N{O33Cx3l7x_hIkCbbs<X_R9D| zI6bdxhsGV@roH~l$ha#mz3ymn+!xNC*D+W5BIk9jMMmh{&vW1On${}!&X!l}FO8eR z$*|(axF(#UcW&QPtHyY=K0X&t)T>(|9=#gZ#apl5f5-KyS06ZAe0b>9noirhu)=Dx z?wy(oYI4yt*zi=Ce6c<@#0B@u+z-4H0y0F$JF`~CC!+10T65zwG4jr*<J|!})(FAb z=EDQ;%yzdJvdNI9r`xkE@z^U6yDpx1$M(XwAco$Ny*fS?S6;@NA0G+#i<h_8#u?$h z_l`%a<GgS-cpPWAyXhS<W;)iMW9*f8WQG~~+}pF3)ZDO_v?Aj@7EM^Q<D_t!-T}KM zgmW`K5cj<U`~3E5J@YcdFrVLehjxS|oHA2F<3r(o^!8XhA>11;N^*O`F}$7r<~S-E zUX<hCA=^EBoqP9#7rk6&gyrqBOH_2nyFz$Bww*3Jt&M*aj^^##OKjtYJdF_diR@r_ zXRN73k0|zma6S?E28q?UlA!t8%MaB-y!e)WfyHLX+WpL8b4-~CFF8_+ISDULU6P1N zjw0hY2eQvD<el}B_FYDFyadRS6nu{olhn0JsQXJg?9~;)CQs{%U<-mxMX*g&Ef#D+ zu&oF-sdx*5Eh^lEV3RXwQO+tUBX7$)gJ4w=tV8f@iU)$M8sm}D1HlSsdj`P@1S=4% z5K%=DtU&Ng5v&s*lXXvrAd`z;kqvbS>JThKut=&p1oH$`B(o9(^AOajQi-A{vbunv z0YO6%G$2?~1a%0Oh&cyA9fC*1o`YZpf=ARugJ6c!OT$Z31hbSctq5iym{kNb5X>lo z8e^tosfETI4T5P1?r`$V4SO*N?yzVSf-yxfImH3NBm|QXoL(WAhF}tc`w&bkf>DlX zUlH74ae&=;+a$N6v^;>|HUzgh{s&~c1Ho-Ya2tX<5PZlk+Yo#R!5<XCBsu(`2*x3p zR0LCm7$>qM1XF5Jjbfwa6M=7#SdA+QLNE(K4T4|OFR<7QSwk>RWJyIZ2En)@xJzAP zh>1aPmjj8j3wdX~7zE=KDhjd~1>d2>By~-=e>?bJbKLyD=J<E<>tDitADaH9z2eXV zd%kIhoJ(l>k6uO`Q(XGyXwi8DP5;td<%^teT8oU(xu560>36MF?wu|FqQB&Hp~;FH zj_PZE)4r!xjqzyRfp64rTOl63a@yjp-|oNT`qXbjlMfI53uyX%E378#{<*oJCKvrG z8=ec3FV>x^xZr-7`+<K(KvmK4>(+{MCffeFHRsgD$Zt-^y90Kt5rVVLhX;Ngnhe=w zNYgj$S(bS0pAx$vp7<yBf^#Z{zHYBNC*sP_Tk{UOzxXA4&B;U4KN+n$C1~<E&Tx0r z*BLV%YtJ$E%Gb>>L!bLJ1vNM9YgWXe2l)rqtV0iK`urd`^q?E(NZj|2?DN~J^~}!? z!+d_@AKMX@aLP;xIrN~9K0Syj?v0-$IeL)c$NQU3QZ)P|#~&x#eS4jI_k*9jTxNvj zC)gz^x=um}e-E1MwC2!<G(Tf6v5gz@bA*^7vZLW0C#M$GDfSUG34DXZYFtUseC?Np z>L6ZxOTWNkGi2?4X0bV@OoXqE)M8G;Pg55SG1@5Nq&bibyO4L**X+BD==cX9(<t~p zB_^qBl~DKBTG($Zf?b}{1ABfCf?Y*$KvX>z>_Kp#2zIG>4}v`^+=XD5Gw4yy7AYfd z%dbPQr3khmsQQ{;g&?cOc%<||u)*2ZA=rRm1A+}AYAAvY2-X$BHt{i8_YDX#x#*YK z(14%;!7>EPq-sF0L_lRSt3a>>L4zt)D2gI$&>h*aMhFnBLa?F;8W5}ya}k0D1a)FB zLNE_OotoqznCJAe@X9HI1<IFI1oIFqD1vzi<`uylW2R%NMUFW+2xcKjQ&4lmehPy0 zAoR>S^q?jt6%Gh$5Y!+zy+SYxK@EZ#2-1SfObJmm2-1TTup2){a`Yg>--Tcdf-#PN zmu%w@j46UK2*x28WtSKPqY&It1T}J?v1)!Ag7oc>e@KXFBGVvvs20spY_xnL@C_2H zaV0?r79f~|;MepEEH*>d5KI%9rU<4WNJ~#(f0;Zl`67b<D@ZP>yt94^f@uns1X+rL z$0;#MT@&sfb;o~+-@4)85j2A<d&Q*(_JW}ua<8Bn{PZ&74#j0K94)#(K{L2ASNS3r z46Q{*=-kh9-waG^m3wC^==Yag6Pm2J;i|qCbnSa;)fkV~UHC?WffeG>D|aB?27~@P zu1|vjH2Lr_=tDDjWQEmaJ!qN>YH~5)O~GvnlP}iYmbl=4nfpOdC!m(-1Z``@t&4Wh zwC3El7zMoC^4uM;V~r4;Z9Y5*+R$XkCPSJ*)t+U@<KUdwtKvy;W-qwsVi*|qs(U7` zf|51wqWeowvDe%ZG=sCzs#}33kK+t?Hv@w))3Np(W3K|k3^Vk3KvPh2!$Ho9xb&dl z$eMNOLCt_41eYFk<LcsmpxfuSSL<0&8ix7&COEMpEa8-y5_0K59|L+2Q{0<CBRP7I z5v2Q@t|l6R#_^}gHe;`I?|ulh%VkDb0dJ^$(RB}m2=<}LPHQfGNDK1z65F_;ph$>$ zBGZR=+@f04px8Pz34DXZYFtUsd>vGV>L6ZxOTWNkGi2?4X0bV@Ohk|ysl}W`kfkm; z#N<X1H_L(K*@e8bLC(I*h)!?>vK$4^P-2q0Rta@~dlL=@ilE6;dSEZGAZRLrkBQ1+ zK?{P96+x4VTM)FUun9qvGq5OUkCc(O6|^DPQv?SPRDCUIL6B8rJW_ff*x_v35bQv( z1Hldvbriu41lx+>fcTiK2UQ3%xfs;gunNH{1Zxnik!lr!6#}Y}Sp$L<2v(_5gQ6(1 zRYkA`!ImP}f?z`ttU|Cs%w-5xA!rbL8G<DU8q}l+!4juefLBowJf(aEMX&_HQ$?@@ zLEb|*spI_ZSZYyZP7#6y2+|bP+;DIRL3$8+W?gzv6O#%D1alC~L2!D7U;%<T2<9P3 z3obJyMA0Bf4^qHxf)vTogNz^n!4w2j9Djmr(-2H4f++~5A;=plUv%9h1mlWejvQ#L zT9AbxeLEB!6JnOgau7ULixw$1T0Rl@28q?Uk{|?6Ay|aq*Ypc4Hbd4B%o15n5j=z- zEj@w#W%9h_iwOR&Ai1RS&IX4N%u*-~WQP<yO^HeBnsEQ9JN`%fdoL`z(3E|9WkUPv z$$=f3^r0!umyyXpT*|>{ae}-(**91DA}0sdA|rI}=ecjnwzbN=vn8ATr3t7qthh1Z zO|dBJ_C2*~j7RGeej7(+%L?)6)ubif%2xj!*Qc@tO+Gx7O=!xl6;_jVd1fxC$wgUV z!!u#>#rmWoF1TOjejp73s)&xPS}PMnwB?yKH>rw|tWU?g19q$tg0szs2eJxHhHNsV zDNFV&OFWh*#9k6lq;4-vPQ*~=?bQkIfs$X!6KH&qMSE>RHQ!5pv^t@YZ16bFaCcMk zetA3Ao@4Bl%$s3`K9@;rNzDz*v=x~oS#;l;ouH~IGwep2x|w9eeVMV(Z?D!fnHz@r z{6-$x5teYuObJcsA0K6s#rgZ@M#f2wU;2iO^*1MR(U5VDKSs7md!2jtgN$D;Gs2R4 z>=GB<$(|503Qcxen?#{0HG7F|+>iv#L?g1y@XiEPhRjoJTGb~4-ypFXR}wT|%i>TS z#EWm~7g%hDtliHnHpi5Skm-?H%t^=;bx9*8J&H_H90-5EtGu%^ZQo@?NA80xO~I3t zn53>%LfwBKhGk0;Z1a@%)sr0vwiUr1QFU0b13`M;o@`U`4g@<?xDCNJXV9UX4N^wl zmaIasp$N7h$eSW~AjqmQ9w|K#tZ}wg2-YB2gJ6w_YKmYDf>lMZMSM)wWeI{zF3M9j zEJ3gY!BYsHl4=QpMFKh{voZvW5G+xpGDT5j`2ilVV~r3XSb<<!5iCKlOw0ucmLQlX z_5uWR5ac(O%tDa&KzRr+UKzj0W6H;WS>DSW1ZgB2JdQIQg1leej-?j-K9X4o9zrn2 z$ul=B6A+BCXdHqGMKC?Z0l_o`(-53qA$SPEGz2vW(of1v2~ji%##kI+H*%Nc_%qdz zKSFR9g1a35k7OHz;I1OL3&9u!ci3eYf;$l0Rs_@Ju&oHDAjrQ7Lh^tRQ$&`A;DK5+ zOR>@NiNH5Vtj3iDA$SbIECj!%UtqBrvW8%a$kK{n0)i<;aF4nq5R-u59tXnT?<()C YOh7P2q2eG*Q1BQfCaG(}op#6n0+CAT6951J literal 0 HcmV?d00001 diff --git a/externals/miXed/test/cyclone/kink-test.pd b/externals/miXed/test/cyclone/kink-test.pd new file mode 100644 index 000000000..44bade7eb --- /dev/null +++ b/externals/miXed/test/cyclone/kink-test.pd @@ -0,0 +1,22 @@ +#N canvas 289 161 465 369 12; +#X obj 31 88 kink~; +#X floatatom 99 88 0 0 0 0 - - -; +#X obj 32 156 Scope~ 400 200 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 30 16 phasor~ 3; +#X obj 30 53 *~ 1; +#X floatatom 100 53 0 0 0 0 - - -; +#X obj 242 53 kink~; +#X floatatom 242 120 5 0 0 0 - - -; +#X floatatom 242 16 5 0 0 0 - - -; +#X floatatom 315 16 5 0 0 0 - - -; +#X obj 242 88 Snapshot~ 10; +#X connect 0 0 2 0; +#X connect 1 0 0 1; +#X connect 3 0 4 0; +#X connect 4 0 0 0; +#X connect 5 0 4 1; +#X connect 6 0 10 0; +#X connect 8 0 6 0; +#X connect 9 0 6 1; +#X connect 10 0 7 0; diff --git a/externals/miXed/test/cyclone/line-test.pd b/externals/miXed/test/cyclone/line-test.pd new file mode 100644 index 000000000..76df2dad3 --- /dev/null +++ b/externals/miXed/test/cyclone/line-test.pd @@ -0,0 +1,54 @@ +#N canvas 95 168 608 427 12; +#X obj 37 222 Line~; +#N canvas 0 0 450 300 graph1 0; +#X array t 133000 float 0; +#X coords 0 1000 132999 -1000 200 140 1; +#X restore 390 37 graph; +#X obj 38 303 tabwrite~ t; +#X obj 37 53 t b b; +#X obj 37 16 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 106 53 t b b; +#X obj 106 16 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 296 380 capture~ f; +#X msg 296 341 clear; +#X obj 61 380 capture~ f; +#X msg 231 341 clear; +#X obj 354 241 Snapshot~ 150; +#X floatatom 354 279 5 0 0 0 - - -; +#X obj 77 268 print; +#X obj 61 341 delay~ 4096 4096; +#X obj 175 53 t b b; +#X obj 175 16 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 37 89 0 \, 1000 1000 0 1000 1000 1000; +#X msg 103 187 0 \, 1000 1; +#X msg 56 120 0 \, 1000 1 0 640 -1000 0 1000 640 0; +#X msg 77 152 0 \, 1000 640; +#X connect 0 0 2 0; +#X connect 0 0 7 0; +#X connect 0 0 11 0; +#X connect 0 0 14 0; +#X connect 0 1 13 0; +#X connect 0 1 10 0; +#X connect 3 0 17 0; +#X connect 3 1 2 0; +#X connect 3 1 8 0; +#X connect 4 0 3 0; +#X connect 5 0 19 0; +#X connect 5 1 2 0; +#X connect 5 1 8 0; +#X connect 6 0 5 0; +#X connect 8 0 7 0; +#X connect 10 0 9 0; +#X connect 11 0 12 0; +#X connect 14 0 9 0; +#X connect 15 0 20 0; +#X connect 15 1 8 0; +#X connect 15 1 2 0; +#X connect 16 0 15 0; +#X connect 17 0 0 0; +#X connect 18 0 0 0; +#X connect 19 0 0 0; +#X connect 20 0 0 0; diff --git a/externals/miXed/test/cyclone/linedrive-test.pd b/externals/miXed/test/cyclone/linedrive-test.pd new file mode 100644 index 000000000..2a1dc362b --- /dev/null +++ b/externals/miXed/test/cyclone/linedrive-test.pd @@ -0,0 +1,11 @@ +#N canvas 204 82 318 300 12; +#X floatatom 34 39 5 0 0 0 - - -; +#X floatatom 34 118 0 0 0 0 - - -; +#X obj 34 76 linedrive 100 100 1.01 0; +#X obj 32 209 maxmode; +#X msg 124 171 set max; +#X msg 32 171 set none; +#X connect 0 0 2 0; +#X connect 2 0 1 0; +#X connect 4 0 3 0; +#X connect 5 0 3 0; diff --git a/externals/miXed/test/cyclone/lores-test.pd b/externals/miXed/test/cyclone/lores-test.pd new file mode 100644 index 000000000..545d2ffa2 --- /dev/null +++ b/externals/miXed/test/cyclone/lores-test.pd @@ -0,0 +1,78 @@ +#N canvas 189 10 584 487 12; +#X obj 39 18 noise~; +#X obj 144 435 dac~; +#X floatatom 308 111 5 0 0 0 - - -; +#X obj 391 143 *~ 10; +#X obj 391 172 +~ 0; +#X floatatom 479 114 5 0 0 0 - - -; +#X floatatom 391 82 5 0 0 0 - - -; +#X obj 159 303 a-mix2; +#X obj 38 82 a-mix2; +#X obj 349 18 loadbang; +#X msg 479 58 0; +#X msg 308 82 1000; +#X obj 391 114 osc~ 4; +#X msg 522 58 1000; +#X msg 243 82 5000; +#X msg 514 82 10000; +#X msg 354 58 13; +#X msg 397 58 4; +#X obj 323 268 lores~; +#X obj 92 268 vcf~; +#X floatatom 123 236 5 0 0 0 - - -; +#X floatatom 310 160 5 0 0 0 - - -; +#X obj 248 211 - 1; +#X obj 248 240 t b 0; +#X obj 196 211 / -1; +#X obj 196 182 * -0.001; +#X obj 323 303 *~ 0.1; +#N canvas 217 47 350 257 pulse 0; +#X obj 144 176 train~ 10 0.1; +#X obj 145 21 inlet; +#X obj 144 206 outlet~; +#X obj 144 146 /; +#X obj 145 51 t b 0; +#X msg 123 96 1000; +#X connect 0 0 2 0; +#X connect 1 0 4 0; +#X connect 3 0 0 0; +#X connect 4 0 5 0; +#X connect 4 1 3 1; +#X connect 5 0 3 0; +#X restore 133 50 pd pulse; +#X floatatom 133 18 5 0 0 0 - - -; +#X connect 0 0 8 0; +#X connect 2 0 4 1; +#X connect 2 0 25 0; +#X connect 3 0 4 0; +#X connect 4 0 18 1; +#X connect 4 0 19 1; +#X connect 5 0 3 1; +#X connect 6 0 12 0; +#X connect 7 0 1 0; +#X connect 7 0 1 1; +#X connect 8 0 18 0; +#X connect 8 0 19 0; +#X connect 9 0 11 0; +#X connect 9 0 10 0; +#X connect 10 0 5 0; +#X connect 11 0 2 0; +#X connect 12 0 3 0; +#X connect 13 0 5 0; +#X connect 14 0 2 0; +#X connect 15 0 5 0; +#X connect 16 0 6 0; +#X connect 17 0 6 0; +#X connect 18 0 26 0; +#X connect 19 0 7 0; +#X connect 20 0 19 2; +#X connect 21 0 18 2; +#X connect 21 0 22 0; +#X connect 22 0 23 0; +#X connect 23 0 24 0; +#X connect 23 1 24 1; +#X connect 24 0 20 0; +#X connect 25 0 24 0; +#X connect 26 0 7 1; +#X connect 27 0 8 1; +#X connect 28 0 27 0; diff --git a/externals/miXed/test/cyclone/match-reentrant.pd b/externals/miXed/test/cyclone/match-reentrant.pd new file mode 100644 index 000000000..495cfaddd --- /dev/null +++ b/externals/miXed/test/cyclone/match-reentrant.pd @@ -0,0 +1,20 @@ +#N canvas 496 270 520 430 12; +#X obj 38 135 t a b; +#X obj 38 244 print; +#X obj 38 88 match -1 -2 -3 -4 -5 -6 -7 -8 -9; +#X msg 38 38 -1 -2 -3 -4 -5 -6 -7 -8 -9; +#X msg 78 195 set 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17; +#X obj 228 330 t a b; +#X msg 268 373 4 5 6; +#X obj 228 289 match 1 nn 3; +#X msg 228 244 1 2 3; +#X connect 0 0 1 0; +#X connect 0 1 4 0; +#X connect 2 0 0 0; +#X connect 3 0 2 0; +#X connect 4 0 2 0; +#X connect 5 0 1 0; +#X connect 5 1 6 0; +#X connect 6 0 7 0; +#X connect 7 0 5 0; +#X connect 8 0 7 0; diff --git a/externals/miXed/test/cyclone/match-test.pd b/externals/miXed/test/cyclone/match-test.pd new file mode 100644 index 000000000..e02a9098d --- /dev/null +++ b/externals/miXed/test/cyclone/match-test.pd @@ -0,0 +1,33 @@ +#N canvas 79 190 867 561 12; +#X obj 490 63 match; +#X obj 27 182 match one two nn one; +#X obj 29 451 match 0 one two nn one 0; +#X msg 27 26 one two 99 one; +#X msg 47 63 list one two 99 one; +#X msg 66 101 one \, two \, and \, one \, two \, or \, one; +#X msg 82 141 one \, two \, and \, one \, one \, two \, or \, one; +#X msg 29 308 0 \, one \, two \, and \, one \, 0 \, one \, two \, or +\, one \, 0; +#X msg 46 350 0 \, one \, two \, set two three \, three \, set 0 one +two nn one 0; +#X msg 61 392 0 \, one \, two \, set two three \, two \, three \, set +0 one two nn one 0; +#X msg 490 26 test; +#X obj 593 63 match test; +#X msg 593 26 test \, set \, test \, set test; +#X obj 490 101 print; +#X obj 27 226 print; +#X obj 29 494 print; +#X connect 0 0 13 0; +#X connect 1 0 14 0; +#X connect 2 0 15 0; +#X connect 3 0 1 0; +#X connect 4 0 1 0; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 7 0 2 0; +#X connect 8 0 2 0; +#X connect 9 0 2 0; +#X connect 10 0 0 0; +#X connect 11 0 13 0; +#X connect 12 0 11 0; diff --git a/externals/miXed/test/cyclone/matrix-test.pd b/externals/miXed/test/cyclone/matrix-test.pd new file mode 100644 index 000000000..1a6642ca5 --- /dev/null +++ b/externals/miXed/test/cyclone/matrix-test.pd @@ -0,0 +1,173 @@ +#N canvas 414 169 541 334 12; +#X obj 21 60 sig~; +#X floatatom 21 25 5 0 0 0 - - -; +#X floatatom 21 258 5 0 0 0 - - -; +#X obj 21 222 Snapshot~ 10; +#X floatatom 143 258 5 0 0 0 - - -; +#X obj 143 222 Snapshot~ 10; +#X obj 104 60 sig~; +#X floatatom 104 25 5 0 0 0 - - -; +#X obj 186 179 matrix~ 3 3; +#X floatatom 269 258 5 0 0 0 - - -; +#X obj 269 222 Snapshot~ 10; +#X obj 184 60 sig~; +#X floatatom 184 25 5 0 0 0 - - -; +#X msg 26 179 print; +#X msg 284 101 connect 1 2; +#X msg 283 138 connect 0 1; +#X msg 388 101 disconnect 1 2; +#X msg 390 138 disconnect 0 1; +#X msg 285 25 connect 2 2; +#X msg 389 25 disconnect 2 2; +#X msg 284 60 connect 1 1; +#X msg 391 60 disconnect 1 1; +#N canvas 172 110 546 362 bigblock 0; +#X obj 21 60 sig~; +#X floatatom 21 25 5 0 0 0 - - -; +#X floatatom 21 258 5 0 0 0 - - -; +#X obj 21 222 Snapshot~ 10; +#X floatatom 143 258 5 0 0 0 - - -; +#X obj 143 222 Snapshot~ 10; +#X obj 104 60 sig~; +#X floatatom 104 25 5 0 0 0 - - -; +#X floatatom 269 258 5 0 0 0 - - -; +#X obj 269 222 Snapshot~ 10; +#X obj 184 60 sig~; +#X floatatom 184 25 5 0 0 0 - - -; +#X msg 284 101 connect 1 2; +#X msg 283 137 connect 0 1; +#X msg 388 101 disconnect 1 2; +#X msg 390 137 disconnect 0 1; +#X msg 285 25 connect 2 2; +#X msg 389 25 disconnect 2 2; +#X msg 284 60 connect 1 1; +#X msg 391 60 disconnect 1 1; +#X obj 406 258 block~ 4096; +#X msg 62 181 print; +#X msg 62 143 debug; +#X obj 343 181 print; +#X obj 186 181 matrix~ 3 3 0.5; +#X msg 22 101 ramp 3000; +#X connect 0 0 24 0; +#X connect 1 0 0 0; +#X connect 3 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 24 1; +#X connect 7 0 6 0; +#X connect 9 0 8 0; +#X connect 10 0 24 2; +#X connect 11 0 10 0; +#X connect 12 0 24 0; +#X connect 13 0 24 0; +#X connect 14 0 24 0; +#X connect 15 0 24 0; +#X connect 16 0 24 0; +#X connect 17 0 24 0; +#X connect 18 0 24 0; +#X connect 19 0 24 0; +#X connect 21 0 24 0; +#X connect 22 0 24 0; +#X connect 24 0 3 0; +#X connect 24 1 5 0; +#X connect 24 2 9 0; +#X connect 24 3 23 0; +#X connect 25 0 24 0; +#X restore 413 258 pd bigblock; +#X msg 88 139 debug; +#X obj 306 179 print; +#X msg 26 138 dump; +#X msg 23 101 dumptarget; +#N canvas 179 79 698 356 lists 1; +#X obj 363 29 osc~ 220; +#X obj 450 29 osc~ 230; +#X obj 362 73 matrix~ 3 2 1; +#X obj 362 165 dac~; +#X obj 492 73 r \$0-mixer; +#X floatatom 30 213 5 0 0 0 - - -; +#X floatatom 112 213 5 0 0 0 - - -; +#X obj 30 297 s \$0-mixer; +#X msg 30 253 1 0 1 \$1; +#X msg 112 253 1 1 1 \$1; +#X msg 180 73 disconnect 0 0 1; +#X floatatom 33 73 5 0 0 0 - - -; +#X floatatom 115 73 5 0 0 0 - - -; +#X obj 33 165 s \$0-mixer; +#X msg 33 117 0 0 1 \$1; +#X msg 115 117 0 1 1 \$1; +#X msg 186 213 disconnect 1 0 1; +#X floatatom 361 213 5 0 0 0 - - -; +#X floatatom 443 213 5 0 0 0 - - -; +#X obj 361 297 s \$0-mixer; +#X msg 256 29 ramp 1000; +#X msg 361 253 2 0 1 \$1; +#X msg 443 253 2 1 1 \$1; +#X msg 511 213 disconnect 2 0 1; +#X msg 35 29 connect 0 0 1; +#X msg 188 165 connect 1 0 1; +#X msg 513 165 connect 2 0 1; +#X obj 540 29 osc~ 235; +#X obj 361 117 *~ 0.01; +#X obj 443 117 *~ 0.01; +#X msg 174 29 ramp 0; +#X msg 608 57 0; +#X msg 609 87 1; +#X floatatom 541 108 5 0 0 0 - - -; +#X msg 541 133 set \$1 1000; +#X connect 0 0 2 0; +#X connect 1 0 2 1; +#X connect 2 0 28 0; +#X connect 2 1 29 0; +#X connect 4 0 2 0; +#X connect 5 0 8 0; +#X connect 6 0 9 0; +#X connect 8 0 7 0; +#X connect 9 0 7 0; +#X connect 10 0 13 0; +#X connect 11 0 14 0; +#X connect 12 0 15 0; +#X connect 14 0 13 0; +#X connect 15 0 13 0; +#X connect 16 0 7 0; +#X connect 17 0 21 0; +#X connect 18 0 22 0; +#X connect 20 0 2 0; +#X connect 21 0 19 0; +#X connect 22 0 19 0; +#X connect 23 0 19 0; +#X connect 24 0 2 0; +#X connect 25 0 2 0; +#X connect 26 0 2 0; +#X connect 27 0 2 2; +#X connect 28 0 3 0; +#X connect 29 0 3 1; +#X connect 30 0 2 0; +#X connect 31 0 33 0; +#X connect 32 0 33 0; +#X connect 33 0 34 0; +#X connect 34 0 2 0; +#X restore 413 221 pd lists; +#X connect 0 0 8 0; +#X connect 1 0 0 0; +#X connect 3 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 8 1; +#X connect 7 0 6 0; +#X connect 8 0 3 0; +#X connect 8 1 5 0; +#X connect 8 2 10 0; +#X connect 8 3 24 0; +#X connect 10 0 9 0; +#X connect 11 0 8 2; +#X connect 12 0 11 0; +#X connect 13 0 8 0; +#X connect 14 0 8 0; +#X connect 15 0 8 0; +#X connect 16 0 8 0; +#X connect 17 0 8 0; +#X connect 18 0 8 0; +#X connect 19 0 8 0; +#X connect 20 0 8 0; +#X connect 21 0 8 0; +#X connect 23 0 8 0; +#X connect 25 0 8 0; +#X connect 26 0 8 0; diff --git a/externals/miXed/test/cyclone/maxmin-test.pd b/externals/miXed/test/cyclone/maxmin-test.pd new file mode 100644 index 000000000..278aa8e06 --- /dev/null +++ b/externals/miXed/test/cyclone/maxmin-test.pd @@ -0,0 +1,65 @@ +#N canvas 212 65 529 484 12; +#X obj 82 209 maximum; +#X msg 57 54 1 2 3 4 5 4 3 2 1; +#X floatatom 140 175 5 0 0; +#X floatatom 140 149 5 0 0; +#X floatatom 82 251 5 0 0; +#X msg 21 175 bang; +#X msg 36 23 1 2 3 4 5 5 4 3 2 1; +#X msg 292 54 1 2 3 4 5 4 3 2 1; +#X floatatom 401 175 5 0 0; +#X floatatom 401 149 5 0 0; +#X floatatom 316 251 5 0 0; +#X msg 255 175 bang; +#X msg 270 23 1 2 3 4 5 4 3 2; +#X obj 316 209 minimum -1; +#X msg 82 84 list a b c 4; +#X msg 316 84 list a 2 c 4; +#X msg 103 115 1 b c d; +#X msg 334 115 1 b 3 d; +#X obj 78 365 Peak; +#X floatatom 109 330 5 0 0; +#X floatatom 78 453 5 0 0; +#X obj 93 426 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 109 399 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +1; +#X msg 42 330 bang; +#X floatatom 109 297 5 0 0; +#X floatatom 306 330 5 0 0; +#X floatatom 257 453 5 0 0; +#X obj 281 426 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 306 399 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +1; +#X msg 221 330 bang; +#X floatatom 308 297 5 0 0; +#X obj 257 365 Trough; +#X connect 0 0 4 0; +#X connect 1 0 0 0; +#X connect 2 0 0 1; +#X connect 3 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 7 0 13 0; +#X connect 8 0 13 1; +#X connect 9 0 13 0; +#X connect 11 0 13 0; +#X connect 12 0 13 0; +#X connect 13 0 10 0; +#X connect 14 0 0 0; +#X connect 15 0 13 0; +#X connect 16 0 0 0; +#X connect 17 0 13 0; +#X connect 18 0 20 0; +#X connect 18 1 21 0; +#X connect 18 2 22 0; +#X connect 19 0 18 1; +#X connect 23 0 18 0; +#X connect 24 0 18 0; +#X connect 25 0 31 1; +#X connect 29 0 31 0; +#X connect 30 0 31 0; +#X connect 31 0 26 0; +#X connect 31 1 27 0; +#X connect 31 2 28 0; diff --git a/externals/miXed/test/cyclone/maxmode-test.pd b/externals/miXed/test/cyclone/maxmode-test.pd new file mode 100644 index 000000000..685814b08 --- /dev/null +++ b/externals/miXed/test/cyclone/maxmode-test.pd @@ -0,0 +1,38 @@ +#N canvas 289 109 635 329 12; +#X obj 31 245 prepend test; +#X msg 142 174 set this; +#X msg 143 211 set that; +#X msg 31 174 x; +#X obj 273 111 print mode; +#X msg 182 34 set max; +#X msg 273 34 set barry; +#X msg 83 174 bang; +#X obj 31 280 print pp; +#X msg 372 174 set this; +#X msg 373 211 set that; +#X msg 261 174 x; +#X msg 313 174 bang; +#X obj 261 280 print aa; +#X obj 261 245 Append test; +#X msg 397 34 bang; +#X obj 182 75 maxmode; +#X msg 112 34 set; +#X obj 127 111 print result; +#X msg 46 34 get; +#X connect 0 0 8 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 5 0 16 0; +#X connect 6 0 16 0; +#X connect 7 0 0 0; +#X connect 9 0 14 0; +#X connect 10 0 14 0; +#X connect 11 0 14 0; +#X connect 12 0 14 0; +#X connect 14 0 13 0; +#X connect 15 0 16 0; +#X connect 16 0 18 0; +#X connect 16 1 4 0; +#X connect 17 0 16 0; +#X connect 19 0 16 0; diff --git a/externals/miXed/test/cyclone/mean-test.pd b/externals/miXed/test/cyclone/mean-test.pd new file mode 100644 index 000000000..29fb8a6b3 --- /dev/null +++ b/externals/miXed/test/cyclone/mean-test.pd @@ -0,0 +1,16 @@ +#N canvas 368 260 327 204 12; +#X obj 84 84 mean; +#X msg 141 34 1 2 3 4; +#X msg 233 34 99; +#X floatatom 84 123 5 0 0; +#X floatatom 156 123 5 0 0; +#X msg 21 34 clear; +#X msg 84 34 bang; +#X floatatom 233 64 5 0 0; +#X connect 0 0 3 0; +#X connect 0 1 4 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 7 0 0 0; diff --git a/externals/miXed/test/cyclone/midi-test.pd b/externals/miXed/test/cyclone/midi-test.pd new file mode 100644 index 000000000..8846f70dd --- /dev/null +++ b/externals/miXed/test/cyclone/midi-test.pd @@ -0,0 +1,33 @@ +#N canvas 236 201 400 408 12; +#X obj 207 181 flush; +#X msg 46 29 bang; +#X obj 207 76 midiparse; +#X obj 207 29 midiin; +#X obj 207 283 midiformat; +#X obj 207 234 pack; +#X obj 207 336 midiout; +#X obj 46 181 midiflush; +#X obj 46 128 spigot; +#X obj 207 128 spigot; +#X obj 134 25 tgl 25 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 134 76 == 0; +#X floatatom 46 222 5 0 0; +#X floatatom 294 336 5 0 0; +#X connect 0 0 5 0; +#X connect 0 1 5 1; +#X connect 1 0 9 0; +#X connect 1 0 8 0; +#X connect 2 0 9 0; +#X connect 3 0 8 0; +#X connect 3 0 2 0; +#X connect 4 0 6 0; +#X connect 4 0 13 0; +#X connect 5 0 4 0; +#X connect 7 0 6 0; +#X connect 7 0 12 0; +#X connect 8 0 7 0; +#X connect 9 0 0 0; +#X connect 10 0 8 1; +#X connect 10 0 11 0; +#X connect 11 0 9 1; diff --git a/externals/miXed/test/cyclone/midiparse-test.pd b/externals/miXed/test/cyclone/midiparse-test.pd new file mode 100644 index 000000000..b006c941e --- /dev/null +++ b/externals/miXed/test/cyclone/midiparse-test.pd @@ -0,0 +1,28 @@ +#N canvas 445 218 450 300 12; +#X obj 124 189 midiparse; +#X obj 124 225 funnel 7; +#X obj 124 262 print; +#X msg 124 18 145 \, 0 \, 64; +#X msg 137 44 145 \, 1 \, 0; +#X floatatom 39 18 5 0 0; +#X msg 152 71 128 \, 2 \, 0; +#X msg 44 148 bang; +#X msg 42 71 1 2 3; +#X msg 207 103 248; +#X msg 160 103 240; +#X connect 0 0 1 0; +#X connect 0 1 1 1; +#X connect 0 2 1 2; +#X connect 0 3 1 3; +#X connect 0 4 1 4; +#X connect 0 5 1 5; +#X connect 0 6 1 6; +#X connect 1 0 2 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 0 0; diff --git a/externals/miXed/test/cyclone/mousefilter-test.pd b/externals/miXed/test/cyclone/mousefilter-test.pd new file mode 100644 index 000000000..084086f7e --- /dev/null +++ b/externals/miXed/test/cyclone/mousefilter-test.pd @@ -0,0 +1,28 @@ +#N canvas 199 54 444 300 12; +#X obj 50 198 mousefilter; +#X floatatom 50 158 5 0 0; +#X obj 50 239 print; +#X obj 50 38 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 50 116 random 1000; +#X obj 214 198 mousefilter; +#X floatatom 214 158 5 0 0; +#X obj 214 239 print; +#X obj 214 38 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 214 116 random 1000; +#X obj 50 74 metro 500; +#X obj 214 74 metro 500; +#X obj 341 26 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 6800 0; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 3 0 10 0; +#X connect 4 0 1 0; +#X connect 5 0 7 0; +#X connect 6 0 5 0; +#X connect 8 0 11 0; +#X connect 9 0 6 0; +#X connect 10 0 4 0; +#X connect 11 0 9 0; +#X connect 12 0 5 0; diff --git a/externals/miXed/test/cyclone/mstosamps-test.pd b/externals/miXed/test/cyclone/mstosamps-test.pd new file mode 100644 index 000000000..67f23cd06 --- /dev/null +++ b/externals/miXed/test/cyclone/mstosamps-test.pd @@ -0,0 +1,23 @@ +#N canvas 0 0 450 300 12; +#X obj 160 72 mstosamps~; +#X floatatom 160 39 5 0 0 0 - - -; +#X obj 245 143 sampstoms~; +#X floatatom 330 180 5 0 0 0 - - -; +#X floatatom 245 110 5 0 0 0 - - -; +#X obj 244 212 Snapshot~ 100; +#X floatatom 244 246 5 0 0 0 - - -; +#X obj 98 143 Snapshot~ 100; +#X floatatom 98 180 5 0 0 0 - - -; +#X floatatom 41 39 5 0 0 0 - - -; +#X obj 41 72 sig~; +#X connect 0 0 7 0; +#X connect 0 0 2 0; +#X connect 0 1 4 0; +#X connect 1 0 0 0; +#X connect 2 0 5 0; +#X connect 2 1 3 0; +#X connect 4 0 2 0; +#X connect 5 0 6 0; +#X connect 7 0 8 0; +#X connect 9 0 10 0; +#X connect 10 0 0 0; diff --git a/externals/miXed/test/cyclone/mtr-test.pd b/externals/miXed/test/cyclone/mtr-test.pd new file mode 100644 index 000000000..6d4084295 --- /dev/null +++ b/externals/miXed/test/cyclone/mtr-test.pd @@ -0,0 +1,85 @@ +#N canvas 80 56 592 383 12; +#X obj 150 267 mtr 7 ________; +#X msg 125 81 write; +#X msg 21 17 record; +#X obj 232 142 hsl 128 15 0 127 0 0 empty hs1 empty -2 -6 64 8 -262144 +-1 -1 0 1; +#X obj 167 337 s hs1; +#X obj 249 173 hsl 128 15 0 127 0 0 empty hs2 empty -2 -6 64 8 -262144 +-1 -1 0 1; +#X obj 184 302 s hs2; +#X msg 52 48 play; +#X msg 416 159 record; +#X msg 430 192 play; +#X msg 446 227 write; +#X obj 271 227 testmess 100; +#X obj 271 204 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 107 48 stop; +#X msg 490 192 stop; +#X msg 92 17 record 6; +#X msg 142 109 write test.mtr; +#X msg 23 183 first 0; +#X msg 21 81 play 0 6; +#X msg 423 267 write test1.mtr; +#X msg 26 267 read; +#X msg 27 302 read test.mtr; +#X msg 189 17 rewind; +#X msg 25 218 debug; +#X obj 26 337 print stamp; +#X obj 271 302 print tr7; +#X obj 362 109 print tr1; +#X obj 322 17 r hs1; +#X obj 322 44 spigot; +#X msg 389 44 0; +#X obj 322 71 t b a; +#X msg 260 17 next; +#X msg 389 17 1; +#X obj 260 44 t a b; +#X obj 445 44 spigot; +#X msg 512 44 0; +#X obj 445 71 t b a; +#X msg 512 17 1; +#X obj 485 109 print tr2; +#X obj 445 17 r hs2; +#X connect 0 0 24 0; +#X connect 0 1 4 0; +#X connect 0 2 6 0; +#X connect 0 7 25 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 0 1; +#X connect 5 0 0 2; +#X connect 7 0 0 0; +#X connect 8 0 0 2; +#X connect 9 0 0 2; +#X connect 10 0 0 2; +#X connect 11 0 0 7; +#X connect 12 0 11 0; +#X connect 13 0 0 0; +#X connect 14 0 0 2; +#X connect 15 0 0 0; +#X connect 16 0 0 0; +#X connect 17 0 0 0; +#X connect 18 0 0 0; +#X connect 19 0 0 2; +#X connect 20 0 0 0; +#X connect 21 0 0 0; +#X connect 22 0 0 0; +#X connect 23 0 0 0; +#X connect 27 0 28 0; +#X connect 28 0 30 0; +#X connect 29 0 28 1; +#X connect 30 0 29 0; +#X connect 30 1 26 0; +#X connect 31 0 33 0; +#X connect 32 0 28 1; +#X connect 33 0 0 0; +#X connect 33 1 32 0; +#X connect 33 1 37 0; +#X connect 34 0 36 0; +#X connect 35 0 34 1; +#X connect 36 0 35 0; +#X connect 36 1 38 0; +#X connect 37 0 34 1; +#X connect 39 0 34 0; diff --git a/externals/miXed/test/cyclone/next-test.pd b/externals/miXed/test/cyclone/next-test.pd new file mode 100644 index 000000000..50d78d19b --- /dev/null +++ b/externals/miXed/test/cyclone/next-test.pd @@ -0,0 +1,16 @@ +#N canvas 225 213 485 258 12; +#X obj 91 143 next; +#X msg 91 26 bang \, bang; +#X msg 118 78 bang; +#X obj 236 105 delay 0; +#X msg 236 55 bang; +#X obj 122 177 print same; +#X obj 91 208 print new; +#X text 286 49 this fails without geteventno; +#X connect 0 0 6 0; +#X connect 0 1 5 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 3 0; +#X connect 4 0 0 0; diff --git a/externals/miXed/test/cyclone/offer-test.pd b/externals/miXed/test/cyclone/offer-test.pd new file mode 100644 index 000000000..94cdfa77b --- /dev/null +++ b/externals/miXed/test/cyclone/offer-test.pd @@ -0,0 +1,83 @@ +#N canvas 299 297 735 363 12; +#X obj 49 244 offer; +#X floatatom 49 279 5 0 0 0 - - -; +#X msg 50 114 clear; +#X floatatom 172 181 5 0 0 0 - - -; +#X obj 212 244 * -1; +#X obj 172 209 t 0 0; +#X floatatom 172 147 5 0 0 0 - - -; +#X obj 279 110 Uzi; +#X msg 49 181 debug \$1; +#X msg 71 147 1; +#X obj 279 71 t 0 0; +#X msg 224 31 1000; +#X msg 279 31 10000; +#X msg 173 31 100; +#X obj 530 147 counter; +#X obj 530 110 Uzi; +#X msg 595 31 100000; +#X msg 475 31 1000; +#X msg 530 31 10000; +#X msg 424 31 100; +#X msg 578 110 set 0; +#X obj 530 71 t 0 b; +#X msg 114 147 2; +#X obj 279 147 urn; +#X msg 344 31 100000; +#X obj 531 306 counter; +#X obj 531 271 Uzi; +#X msg 579 271 set 0; +#X obj 531 234 t 0 b; +#X msg 531 196 50; +#X msg 582 196 100; +#X obj 409 218 Uzi; +#X msg 330 147 50; +#X msg 369 147 100; +#X msg 117 209 1.5; +#X obj 409 181 t 0 0; +#X obj 409 255 urn; +#X msg 409 147 500; +#X msg 449 147 5000; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 5 0; +#X connect 4 0 0 1; +#X connect 5 0 0 0; +#X connect 5 1 4 0; +#X connect 6 0 0 0; +#X connect 7 0 23 0; +#X connect 8 0 0 0; +#X connect 9 0 8 0; +#X connect 10 0 7 0; +#X connect 10 1 23 1; +#X connect 11 0 10 0; +#X connect 12 0 10 0; +#X connect 13 0 10 0; +#X connect 14 0 5 0; +#X connect 15 0 14 0; +#X connect 16 0 21 0; +#X connect 17 0 21 0; +#X connect 18 0 21 0; +#X connect 19 0 21 0; +#X connect 20 0 14 0; +#X connect 21 0 15 0; +#X connect 21 1 20 0; +#X connect 22 0 8 0; +#X connect 23 0 5 0; +#X connect 24 0 10 0; +#X connect 25 0 0 0; +#X connect 26 0 25 0; +#X connect 27 0 25 0; +#X connect 28 0 26 0; +#X connect 28 1 27 0; +#X connect 29 0 28 0; +#X connect 30 0 28 0; +#X connect 31 0 36 0; +#X connect 32 0 35 0; +#X connect 33 0 35 0; +#X connect 34 0 0 0; +#X connect 35 0 31 0; +#X connect 35 1 36 1; +#X connect 36 0 0 0; +#X connect 37 0 35 0; +#X connect 38 0 35 0; diff --git a/externals/miXed/test/cyclone/onebang-test.pd b/externals/miXed/test/cyclone/onebang-test.pd new file mode 100644 index 000000000..56f0440a2 --- /dev/null +++ b/externals/miXed/test/cyclone/onebang-test.pd @@ -0,0 +1,26 @@ +#N canvas 516 361 450 300 12; +#X obj 65 144 onebang; +#X obj 65 89 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 65 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 221 89 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 221 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 221 144 onebang 1; +#X obj 123 109 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 297 109 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 297 62 metro 500; +#X obj 297 24 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 3 0 5 0; +#X connect 5 0 4 0; +#X connect 6 0 0 1; +#X connect 7 0 5 1; +#X connect 8 0 5 0; +#X connect 9 0 8 0; diff --git a/externals/miXed/test/cyclone/onepole-test.pd b/externals/miXed/test/cyclone/onepole-test.pd new file mode 100644 index 000000000..4165e6c30 --- /dev/null +++ b/externals/miXed/test/cyclone/onepole-test.pd @@ -0,0 +1,63 @@ +#N canvas 274 148 584 417 12; +#X obj 39 16 noise~; +#X obj 144 376 dac~; +#X floatatom 308 112 5 0 0 0 - - -; +#X obj 92 209 lop~; +#X obj 323 209 onepole~; +#X obj 391 145 *~ 10; +#X obj 391 175 +~ 0; +#X floatatom 479 115 5 0 0 0 - - -; +#X floatatom 391 82 5 0 0 0 - - -; +#X obj 159 244 a-mix2; +#X obj 38 82 a-mix2; +#X obj 349 16 loadbang; +#X obj 141 209 Snapshot~ 2; +#X msg 479 58 0; +#X msg 308 82 1000; +#X obj 391 115 osc~ 4; +#X msg 522 58 1000; +#X msg 243 82 5000; +#X msg 514 82 10000; +#X msg 354 58 13; +#X msg 397 58 4; +#N canvas 217 47 350 257 pulse 0; +#X obj 144 176 train~ 10 0.1; +#X obj 145 21 inlet; +#X obj 144 206 outlet~; +#X obj 144 146 /; +#X obj 145 51 t b 0; +#X msg 123 96 1000; +#X connect 0 0 2 0; +#X connect 1 0 4 0; +#X connect 3 0 0 0; +#X connect 4 0 5 0; +#X connect 4 1 3 1; +#X connect 5 0 3 0; +#X restore 133 50 pd pulse; +#X floatatom 133 16 5 0 0 0 - - -; +#X connect 0 0 10 0; +#X connect 2 0 6 1; +#X connect 3 0 9 0; +#X connect 4 0 9 1; +#X connect 5 0 6 0; +#X connect 6 0 4 1; +#X connect 6 0 12 0; +#X connect 7 0 5 1; +#X connect 8 0 15 0; +#X connect 9 0 1 0; +#X connect 9 0 1 1; +#X connect 10 0 3 0; +#X connect 10 0 4 0; +#X connect 11 0 14 0; +#X connect 11 0 13 0; +#X connect 12 0 3 1; +#X connect 13 0 7 0; +#X connect 14 0 2 0; +#X connect 15 0 5 0; +#X connect 16 0 7 0; +#X connect 17 0 2 0; +#X connect 18 0 7 0; +#X connect 19 0 8 0; +#X connect 20 0 8 0; +#X connect 21 0 10 1; +#X connect 22 0 21 0; diff --git a/externals/miXed/test/cyclone/past-test.pd b/externals/miXed/test/cyclone/past-test.pd new file mode 100644 index 000000000..3c1b1c522 --- /dev/null +++ b/externals/miXed/test/cyclone/past-test.pd @@ -0,0 +1,38 @@ +#N canvas 280 124 570 391 12; +#X obj 56 244 print; +#X floatatom 56 109 5 0 0; +#X obj 185 244 print; +#X floatatom 185 109 5 0 0; +#X obj 185 198 past 1 2 3; +#X obj 296 244 print; +#X obj 296 198 past 1 2 3; +#X msg 317 128 2 3 4; +#X msg 309 93 1 2 3; +#X msg 296 53 0 1 2; +#X msg 121 109 clear; +#X msg 121 138 set 3; +#X obj 56 198 past 7; +#X msg 245 53 0; +#X msg 121 167 set 7; +#X msg 402 157 2 0 0 \, 1 2 3; +#X msg 402 128 0 3 4 \, 1 2 3; +#X msg 401 93 2 3 0; +#X msg 461 93 1 1 4; +#X msg 283 13 set 1 2 3 4 5 6 7 8 9; +#X connect 1 0 12 0; +#X connect 3 0 4 0; +#X connect 4 0 2 0; +#X connect 6 0 5 0; +#X connect 7 0 6 0; +#X connect 8 0 6 0; +#X connect 9 0 6 0; +#X connect 10 0 12 0; +#X connect 11 0 12 0; +#X connect 12 0 0 0; +#X connect 13 0 6 0; +#X connect 14 0 12 0; +#X connect 15 0 6 0; +#X connect 16 0 6 0; +#X connect 17 0 6 0; +#X connect 18 0 6 0; +#X connect 19 0 6 0; diff --git a/externals/miXed/test/cyclone/peakamp-test.pd b/externals/miXed/test/cyclone/peakamp-test.pd new file mode 100644 index 000000000..c0c31215c --- /dev/null +++ b/externals/miXed/test/cyclone/peakamp-test.pd @@ -0,0 +1,25 @@ +#N canvas 354 192 367 254 12; +#X obj 190 160 peakamp~ 1; +#X obj 31 82 count~ 0 64 1 1; +#X obj 31 225 capture~; +#X msg 190 124 bang; +#X floatatom 126 225 5 0 0 0 - - -; +#X obj 190 221 capture 1000; +#X msg 31 47 min \$1; +#X floatatom 31 16 5 0 0 0 - - -; +#X floatatom 161 16 5 0 0 0 - - -; +#X msg 59 192 open; +#X obj 59 160 delay 0; +#X msg 59 124 bang; +#X connect 0 0 4 0; +#X connect 0 0 5 0; +#X connect 1 0 0 0; +#X connect 1 0 2 0; +#X connect 3 0 0 0; +#X connect 6 0 1 0; +#X connect 7 0 6 0; +#X connect 8 0 1 1; +#X connect 9 0 2 0; +#X connect 9 0 5 0; +#X connect 10 0 9 0; +#X connect 11 0 10 0; diff --git a/externals/miXed/test/cyclone/peek-test.pd b/externals/miXed/test/cyclone/peek-test.pd new file mode 100644 index 000000000..ef0db24a9 --- /dev/null +++ b/externals/miXed/test/cyclone/peek-test.pd @@ -0,0 +1,51 @@ +#N canvas 326 171 584 586 12; +#N canvas 0 0 450 300 graph1 0; +#X array 0-t 20000 float 0; +#X coords 0 1 19999 -1 200 140 1; +#X restore 59 17 graph; +#N canvas 0 0 450 300 graph1 0; +#X array 1-t 20000 float 0; +#X coords 0 1 19999 -1 200 140 1; +#X restore 326 17 graph; +#X obj 122 511 peek~ t 1; +#X floatatom 122 548 5 0 0; +#X msg 286 362 1; +#X msg 286 394 2; +#X msg 286 430 3; +#X msg 286 326 0; +#X floatatom 390 548 5 0 0; +#X floatatom 390 438 5 0 0; +#X floatatom 428 469 5 0 0; +#X obj 390 511 peek~ 0-t; +#X floatatom 122 438 5 0 0; +#X floatatom 160 474 5 0 0; +#X floatatom 41 253 5 0 0; +#X obj 41 400 pack 0 0 0; +#X floatatom 171 362 5 0 0; +#X obj 41 287 t 0 b; +#X obj 81 326 random 1000; +#X obj 41 438 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X msg 41 474 clip \$1; +#X obj 81 362 / -500; +#X floatatom 150 400 5 0 0; +#X connect 2 0 3 0; +#X connect 4 0 2 2; +#X connect 5 0 2 2; +#X connect 6 0 2 2; +#X connect 7 0 2 2; +#X connect 9 0 11 0; +#X connect 10 0 11 1; +#X connect 11 0 8 0; +#X connect 12 0 2 0; +#X connect 13 0 2 1; +#X connect 14 0 17 0; +#X connect 15 0 2 0; +#X connect 16 0 15 2; +#X connect 17 0 15 0; +#X connect 17 1 18 0; +#X connect 18 0 21 0; +#X connect 19 0 20 0; +#X connect 20 0 2 0; +#X connect 21 0 15 1; +#X connect 21 0 22 0; diff --git a/externals/miXed/test/cyclone/pink-test.pd b/externals/miXed/test/cyclone/pink-test.pd new file mode 100644 index 000000000..b1f4fdf77 --- /dev/null +++ b/externals/miXed/test/cyclone/pink-test.pd @@ -0,0 +1,55 @@ +#N canvas 114 365 411 405 12; +#X obj 27 23 pink~; +#X obj 146 212 Scope~ 249 177 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#N canvas 540 253 607 486 spectrum 1; +#X obj 24 233 Scope~ 562 220 2 3 512 0 512 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 136 117 cartopol~; +#X obj 136 73 rfft~; +#X obj 380 25 block~ 1024; +#X obj 24 159 vectral~ 1024; +#X obj 24 25 count~ 0 1024 1 1; +#X floatatom 73 73 5 0 0 0 - - -; +#X msg 172 159 slide 10 10; +#X msg 92 193 range 0 512 \, 2 \, bufsize 512; +#X obj 226 25 inlet~; +#X obj 24 117 *~ 0.55; +#X obj 226 73 *~ 1; +#X floatatom 295 25 5 0 0 0 - - -; +#X connect 1 0 4 2; +#X connect 2 0 1 0; +#X connect 2 1 1 1; +#X connect 4 0 0 0; +#X connect 5 0 4 1; +#X connect 5 0 10 0; +#X connect 6 0 10 1; +#X connect 7 0 4 0; +#X connect 8 0 0 0; +#X connect 9 0 11 0; +#X connect 10 0 4 0; +#X connect 11 0 2 0; +#X connect 12 0 11 1; +#X restore 27 369 pd spectrum; +#X obj 52 274 osc~ 1000; +#X floatatom 52 241 5 0 0 0 - - -; +#X floatatom 84 306 5 0 0 0 - - -; +#X obj 53 337 *~ 0; +#X obj 101 65 minmax~; +#X obj 101 95 Snapshot~ 100; +#X obj 231 95 Snapshot~ 100; +#X floatatom 101 125 5 0 0 0 - - -; +#X floatatom 231 125 5 0 0 0 - - -; +#X msg 101 35 reset; +#X connect 0 0 1 0; +#X connect 0 0 2 0; +#X connect 0 0 7 0; +#X connect 3 0 6 0; +#X connect 4 0 3 0; +#X connect 5 0 6 1; +#X connect 6 0 2 0; +#X connect 7 0 8 0; +#X connect 7 1 9 0; +#X connect 8 0 10 0; +#X connect 9 0 11 0; +#X connect 12 0 7 0; diff --git a/externals/miXed/test/cyclone/poke-test.pd b/externals/miXed/test/cyclone/poke-test.pd new file mode 100644 index 000000000..ec92e81ab --- /dev/null +++ b/externals/miXed/test/cyclone/poke-test.pd @@ -0,0 +1,58 @@ +#N canvas 334 79 638 463 12; +#N canvas 0 0 450 300 graph1 0; +#X array 0-t 20000 float 0; +#X coords 0 1 19999 -1 200 140 1; +#X restore 59 17 graph; +#N canvas 0 0 450 300 graph1 0; +#X array 1-t 20000 float 0; +#X coords 0 1 19999 -1 200 140 1; +#X restore 326 17 graph; +#X msg 279 259 1; +#X msg 279 295 2; +#X msg 279 331 3; +#X msg 279 224 0; +#X obj 150 384 poke~ t 1; +#X obj 65 217 Uzi; +#X obj 65 247 counter; +#X msg 65 187 1000; +#X obj 65 313 % 1000; +#X obj 65 277 t 0 0; +#X obj 65 349 / 1000; +#X msg 122 217 set 0; +#X floatatom 150 281 5 0 0 0 - - -; +#X floatatom 188 317 5 0 0 0 - - -; +#X floatatom 392 199 5 0 0 0 - - -; +#X floatatom 392 270 5 0 0 0 - - -; +#X obj 392 234 peek~ t 1; +#X obj 432 349 sig~; +#X floatatom 432 322 5 0 0 0 - - -; +#X obj 505 349 sig~; +#X floatatom 505 322 5 0 0 0 - - -; +#X msg 373 349 bang; +#X obj 432 379 poke~ t 2; +#X floatatom 504 199 5 0 0 0 - - -; +#X floatatom 504 270 5 0 0 0 - - -; +#X obj 504 234 peek~ t 2; +#X connect 2 0 6 2; +#X connect 3 0 6 2; +#X connect 4 0 6 2; +#X connect 5 0 6 2; +#X connect 7 0 8 0; +#X connect 8 0 11 0; +#X connect 9 0 7 0; +#X connect 10 0 12 0; +#X connect 11 0 10 0; +#X connect 11 1 6 1; +#X connect 12 0 6 0; +#X connect 13 0 8 0; +#X connect 14 0 6 0; +#X connect 15 0 6 1; +#X connect 16 0 18 0; +#X connect 18 0 17 0; +#X connect 19 0 24 0; +#X connect 20 0 19 0; +#X connect 21 0 24 1; +#X connect 22 0 21 0; +#X connect 23 0 24 0; +#X connect 25 0 27 0; +#X connect 27 0 26 0; diff --git a/externals/miXed/test/cyclone/pong-test.pd b/externals/miXed/test/cyclone/pong-test.pd new file mode 100644 index 000000000..2a5e97a7f --- /dev/null +++ b/externals/miXed/test/cyclone/pong-test.pd @@ -0,0 +1,17 @@ +#N canvas 0 0 450 300 12; +#X obj 143 147 pong~; +#X obj 143 194 Snapshot~ 100; +#X floatatom 143 229 5 0 0 0 - - -; +#X floatatom 143 36 5 0 0 0 - - -; +#X floatatom 163 69 5 0 0 0 - - -; +#X floatatom 183 99 5 0 0 0 - - -; +#X msg 46 99 mode \$1; +#X obj 46 69 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 3 0 0 0; +#X connect 4 0 0 1; +#X connect 5 0 0 2; +#X connect 6 0 0 0; +#X connect 7 0 6 0; diff --git a/externals/miXed/test/cyclone/prepend-test.pd b/externals/miXed/test/cyclone/prepend-test.pd new file mode 100644 index 000000000..d43b8c1cd --- /dev/null +++ b/externals/miXed/test/cyclone/prepend-test.pd @@ -0,0 +1,73 @@ +#N canvas 479 230 524 465 12; +#X obj 25 416 print; +#X msg 25 298 1 2 3; +#X msg 102 298 set test; +#X obj 25 241 print; +#X msg 25 55 1 2 3; +#X obj 25 169 t a b; +#X msg 111 241 4 5 6; +#X obj 190 206 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 347 55 testmess 1000; +#X msg 347 19 mess; +#X msg 101 19 mess; +#X obj 101 55 testmess 100; +#X msg 155 128 set changed; +#X obj 111 169 gate; +#X obj 111 206 t b b; +#X obj 25 377 t a b b; +#X msg 220 416 set mess1; +#X msg 108 416 set mess2; +#X msg 285 241 bang; +#X msg 347 241 99; +#X obj 285 377 print list; +#X obj 285 339 route list; +#X obj 408 377 print; +#X msg 227 241 mess; +#X obj 25 128 prepend test; +#X obj 25 339 prepend test; +#X msg 398 241 set bang; +#X msg 400 278 set 0; +#X obj 285 298 prepend; +#X obj 101 88 prepend check; +#X obj 347 88 prepend check; +#X msg 160 19 set set; +#X msg 244 19 set check; +#X msg 348 211 list; +#X connect 1 0 25 0; +#X connect 2 0 25 0; +#X connect 4 0 24 0; +#X connect 5 0 3 0; +#X connect 5 1 13 1; +#X connect 6 0 24 0; +#X connect 7 0 13 0; +#X connect 8 0 30 0; +#X connect 9 0 8 0; +#X connect 10 0 11 0; +#X connect 11 0 29 0; +#X connect 12 0 24 0; +#X connect 13 0 14 0; +#X connect 14 0 6 0; +#X connect 14 1 7 0; +#X connect 15 0 0 0; +#X connect 15 1 17 0; +#X connect 15 2 16 0; +#X connect 16 0 25 0; +#X connect 17 0 25 0; +#X connect 18 0 28 0; +#X connect 19 0 28 0; +#X connect 21 0 20 0; +#X connect 21 1 22 0; +#X connect 23 0 28 0; +#X connect 24 0 5 0; +#X connect 25 0 15 0; +#X connect 26 0 28 0; +#X connect 27 0 28 0; +#X connect 28 0 21 0; +#X connect 29 0 24 0; +#X connect 30 0 24 0; +#X connect 31 0 30 0; +#X connect 31 0 29 0; +#X connect 32 0 30 0; +#X connect 32 0 29 0; +#X connect 33 0 28 0; diff --git a/externals/miXed/test/cyclone/prob-test.pd b/externals/miXed/test/cyclone/prob-test.pd new file mode 100644 index 000000000..e21a3c57f --- /dev/null +++ b/externals/miXed/test/cyclone/prob-test.pd @@ -0,0 +1,33 @@ +#N canvas 482 332 476 300 12; +#X obj 146 119 anal; +#X obj 146 174 prob; +#X floatatom 114 221 5 0 0; +#X obj 213 221 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 146 84 5 0 0; +#X msg 52 139 dump; +#X msg 125 48 bang; +#X floatatom 222 84 5 0 0; +#X msg 297 84 2 -1 1; +#X msg 359 119 reset 2; +#X msg 51 84 embed 1; +#X msg 221 48 clear; +#X msg 298 48 -1; +#X msg 375 84 1 1 1; +#X msg 344 48 1; +#X msg 47 14 clear \, 2 -1 1 \, -1 \, bang \, reset 2; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 1 1 3 0; +#X connect 4 0 0 0; +#X connect 5 0 1 0; +#X connect 6 0 1 0; +#X connect 7 0 1 0; +#X connect 8 0 1 0; +#X connect 9 0 1 0; +#X connect 10 0 1 0; +#X connect 11 0 1 0; +#X connect 12 0 1 0; +#X connect 13 0 1 0; +#X connect 14 0 1 0; +#X connect 15 0 1 0; diff --git a/externals/miXed/test/cyclone/pv-test.pd b/externals/miXed/test/cyclone/pv-test.pd new file mode 100644 index 000000000..c1252b520 --- /dev/null +++ b/externals/miXed/test/cyclone/pv-test.pd @@ -0,0 +1,83 @@ +#N canvas 400 284 560 390 12; +#X obj 53 112 pv x; +#X floatatom 53 77 5 0 0; +#X msg 132 40 bang; +#X floatatom 132 112 5 0 0; +#X msg 197 40 status; +#X msg 29 40 status; +#X floatatom 57 238 5 0 0; +#X msg 286 238 bang; +#X msg 351 238 status; +#X msg 32 190 status; +#X obj 286 280 pv common; +#N canvas 556 81 496 259 sub-a 0; +#X floatatom 59 88 5 0 0; +#X msg 317 88 bang; +#X msg 382 88 status; +#X msg 35 51 status; +#X obj 317 123 pv common; +#X msg 133 88 bang; +#X floatatom 250 88 5 0 0; +#X obj 59 161 print private-a; +#X obj 317 161 print common-a; +#X obj 59 123 pv private symbol test; +#X connect 0 0 9 0; +#X connect 1 0 4 0; +#X connect 2 0 4 0; +#X connect 3 0 9 0; +#X connect 4 0 8 0; +#X connect 5 0 9 0; +#X connect 6 0 4 0; +#X connect 9 0 7 0; +#X restore 454 280 pd sub-a; +#X msg 455 64 \; x bang; +#X obj 455 148 r x; +#X obj 455 190 print; +#N canvas 556 81 496 259 sub-b 0; +#X floatatom 91 87 5 0 0; +#X msg 317 87 bang; +#X msg 382 87 status; +#X msg 67 50 status; +#X obj 317 122 pv common; +#X msg 165 87 bang; +#X floatatom 250 87 5 0 0; +#X obj 91 160 print private-b; +#X obj 317 160 print common-b; +#X obj 91 122 pv private 1 2 3; +#X connect 0 0 9 0; +#X connect 1 0 4 0; +#X connect 2 0 4 0; +#X connect 3 0 9 0; +#X connect 4 0 8 0; +#X connect 5 0 9 0; +#X connect 6 0 4 0; +#X connect 9 0 7 0; +#X restore 453 318 pd sub-b; +#X obj 286 318 print common; +#X msg 116 190 symbol test; +#X obj 288 195 testmess 100; +#X msg 288 159 bang; +#X msg 344 159 test; +#X msg 288 88 bang; +#X msg 344 88 test; +#X obj 288 124 testmess 300; +#X obj 57 280 pv common test message; +#X obj 132 77 pv x 99; +#X connect 1 0 0 0; +#X connect 2 0 25 0; +#X connect 4 0 25 0; +#X connect 5 0 0 0; +#X connect 6 0 24 0; +#X connect 7 0 10 0; +#X connect 8 0 10 0; +#X connect 9 0 24 0; +#X connect 10 0 16 0; +#X connect 13 0 14 0; +#X connect 17 0 24 0; +#X connect 18 0 24 0; +#X connect 19 0 18 0; +#X connect 20 0 18 0; +#X connect 21 0 23 0; +#X connect 22 0 23 0; +#X connect 23 0 24 0; +#X connect 25 0 3 0; diff --git a/externals/miXed/test/cyclone/rand-test.pd b/externals/miXed/test/cyclone/rand-test.pd new file mode 100644 index 000000000..2a438d650 --- /dev/null +++ b/externals/miXed/test/cyclone/rand-test.pd @@ -0,0 +1,37 @@ +#N canvas 224 159 762 415 12; +#X obj 33 348 tabwrite~ t; +#N canvas 0 0 450 300 graph1 0; +#X array t 400 float 0; +#X coords 0 1 399 -1 400 300 1; +#X restore 330 44 graph; +#X obj 35 54 osc~ 10; +#X obj 35 89 *~ 1000; +#X floatatom 35 19 5 0 0 0 - - -; +#X obj 256 174 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X floatatom 114 54 5 0 0 0 - - -; +#X msg 64 189 \$1 \; pd dsp \$1; +#X obj 45 244 metro 300; +#X obj 33 151 rand~ 1000; +#X floatatom 168 114 5 0 0 0 - - -; +#X obj 171 315 hsl 128 15 -1 1 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X obj 168 151 rand~; +#X obj 64 315 capture~ f; +#X msg 64 278 clear; +#X obj 177 204 sel 1; +#X obj 168 278 Snapshot~ 20; +#X connect 2 0 3 0; +#X connect 4 0 2 0; +#X connect 5 0 7 0; +#X connect 5 0 15 0; +#X connect 6 0 3 1; +#X connect 7 0 8 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 9 0 13 0; +#X connect 10 0 12 0; +#X connect 12 0 16 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 16 0 11 0; diff --git a/externals/miXed/test/cyclone/record-sync-test.pd b/externals/miXed/test/cyclone/record-sync-test.pd new file mode 100644 index 000000000..368bf0630 --- /dev/null +++ b/externals/miXed/test/cyclone/record-sync-test.pd @@ -0,0 +1,64 @@ +#N canvas 380 162 635 531 12; +#X obj 56 320 record~ t; +#N canvas 0 0 450 300 graph1 0; +#X array t 100000 float 0; +#X coords 0 1 99999 -1 200 140 1; +#X restore 46 20 graph; +#X floatatom 77 241 5 0 0; +#X floatatom 149 241 5 0 0; +#X obj 345 279 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 +1; +#X obj 56 437 threshold~ 0; +#X obj 56 401 -~; +#X obj 56 365 delay~ 1 1; +#N canvas 0 0 450 300 graph1 0; +#X array sync 100000 float 0; +#X coords 0 1 99999 -1 200 140 1; +#X restore 299 20 graph; +#X floatatom 400 324 5 0 0; +#X floatatom 400 246 5 0 0; +#X msg 56 205 loop \$1; +#X msg 161 205 append \$1; +#X obj 56 179 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1 +; +#X obj 161 179 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 +1; +#X obj 56 476 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 149 279 / 44.1; +#X obj 77 279 / 44.1; +#X obj 345 365 record~ sync; +#X obj 400 286 tabread sync; +#X msg 303 189 \; sync const 0; +#X obj 240 437 snapshot~; +#X obj 240 401 metro 10; +#X floatatom 240 476 5 0 0; +#X obj 240 369 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 +1; +#X obj 345 437 snapshot~; +#X floatatom 345 476 5 0 0; +#X connect 0 0 6 1; +#X connect 0 0 7 0; +#X connect 0 0 18 0; +#X connect 0 0 21 0; +#X connect 2 0 17 0; +#X connect 3 0 16 0; +#X connect 4 0 0 0; +#X connect 4 0 18 0; +#X connect 5 0 15 0; +#X connect 6 0 5 0; +#X connect 7 0 6 0; +#X connect 10 0 19 0; +#X connect 11 0 0 0; +#X connect 12 0 0 0; +#X connect 13 0 11 0; +#X connect 14 0 12 0; +#X connect 16 0 0 2; +#X connect 17 0 0 1; +#X connect 18 0 25 0; +#X connect 19 0 9 0; +#X connect 21 0 23 0; +#X connect 22 0 21 0; +#X connect 22 0 25 0; +#X connect 24 0 22 0; +#X connect 25 0 26 0; diff --git a/externals/miXed/test/cyclone/record-test.pd b/externals/miXed/test/cyclone/record-test.pd new file mode 100644 index 000000000..8896aeca5 --- /dev/null +++ b/externals/miXed/test/cyclone/record-test.pd @@ -0,0 +1,60 @@ +#N canvas 106 146 768 968 12; +#X obj 254 110 record~ bulk 8; +#X obj 53 36 osc~ 1; +#X obj 124 36 osc~ 2; +#X obj 193 36 osc~ 3; +#X obj 263 36 osc~ 4; +#X obj 335 36 osc~ 5; +#X obj 403 36 osc~ 6; +#X obj 479 36 osc~ 7; +#X obj 549 36 osc~ 8; +#X obj 154 95 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#N canvas 0 0 450 300 graph65 0; +#X array 0-bulk 10000 float 0; +#X coords 0 1 9999 -1 600 60 1; +#X restore 84 192 graph; +#N canvas 0 0 450 300 graph65 0; +#X array 1-bulk 10000 float 0; +#X coords 0 1 9999 -1 600 60 1; +#X restore 84 269 graph; +#N canvas 0 0 450 300 graph65 0; +#X array 2-bulk 10000 float 0; +#X coords 0 1 9999 -1 600 60 1; +#X restore 83 345 graph; +#N canvas 0 0 450 300 graph65 0; +#X array 3-bulk 10000 float 0; +#X coords 0 1 9999 -1 600 60 1; +#X restore 83 422 graph; +#N canvas 0 0 450 300 graph65 0; +#X array 4-bulk 10000 float 0; +#X coords 0 1 9999 -1 600 60 1; +#X restore 83 501 graph; +#N canvas 0 0 450 300 graph65 0; +#X array 5-bulk 10000 float 0; +#X coords 0 1 9999 -1 600 60 1; +#X restore 83 578 graph; +#N canvas 0 0 450 300 graph65 0; +#X array 6-bulk 10000 float 0; +#X coords 0 1 9999 -1 600 60 1; +#X restore 82 654 graph; +#N canvas 0 0 450 300 graph65 0; +#X array 7-bulk 10000 float 0; +#X coords 0 1 9999 -1 600 60 1; +#X restore 82 731 graph; +#X obj 254 146 record~ sync; +#N canvas 0 0 450 300 graph65 0; +#X array sync 10000 float 0; +#X coords 0 1 9999 -1 600 60 1; +#X restore 80 839 graph; +#X connect 0 0 18 0; +#X connect 1 0 0 0; +#X connect 2 0 0 1; +#X connect 3 0 0 2; +#X connect 4 0 0 3; +#X connect 5 0 0 4; +#X connect 6 0 0 5; +#X connect 7 0 0 6; +#X connect 8 0 0 7; +#X connect 9 0 0 0; +#X connect 9 0 18 0; diff --git a/externals/miXed/test/cyclone/reson-test.pd b/externals/miXed/test/cyclone/reson-test.pd new file mode 100644 index 000000000..2f5267ee3 --- /dev/null +++ b/externals/miXed/test/cyclone/reson-test.pd @@ -0,0 +1,73 @@ +#N canvas 274 148 584 487 12; +#X obj 39 19 noise~; +#X obj 144 435 dac~; +#X floatatom 308 117 5 0 0 0 - - -; +#X obj 391 149 *~ 10; +#X obj 391 181 +~ 0; +#X floatatom 479 117 5 0 0 0 - - -; +#X floatatom 391 85 5 0 0 0 - - -; +#X obj 159 300 a-mix2; +#X obj 38 92 a-mix2; +#X obj 348 19 loadbang; +#X msg 479 58 0; +#X msg 308 85 1000; +#X obj 391 117 osc~ 4; +#X msg 522 58 1000; +#X msg 243 85 5000; +#X msg 354 58 13; +#X msg 397 58 4; +#X obj 38 265 vcf~; +#X floatatom 216 186 5 0 0 0 - - -; +#X obj 346 265 reson~ 1; +#X obj 37 300 *~ 0.25; +#X obj 346 300 *~ 0.25; +#X msg 522 92 4000; +#X floatatom 216 255 5 0 0 0 - - -; +#X floatatom 419 218 5 0 0 0 - - -; +#N canvas 217 47 350 257 pulse 0; +#X obj 144 176 train~ 10 0.1; +#X obj 145 21 inlet; +#X obj 144 206 outlet~; +#X obj 144 146 /; +#X obj 145 51 t b 0; +#X msg 123 96 1000; +#X connect 0 0 2 0; +#X connect 1 0 4 0; +#X connect 3 0 0 0; +#X connect 4 0 5 0; +#X connect 4 1 3 1; +#X connect 5 0 3 0; +#X restore 133 50 pd pulse; +#X floatatom 133 19 5 0 0 0 - - -; +#X connect 0 0 8 0; +#X connect 2 0 4 1; +#X connect 3 0 4 0; +#X connect 4 0 19 2; +#X connect 4 0 17 1; +#X connect 5 0 3 1; +#X connect 6 0 12 0; +#X connect 7 0 1 0; +#X connect 7 0 1 1; +#X connect 8 0 17 0; +#X connect 8 0 19 0; +#X connect 9 0 11 0; +#X connect 9 0 10 0; +#X connect 10 0 5 0; +#X connect 11 0 2 0; +#X connect 12 0 3 0; +#X connect 13 0 5 0; +#X connect 14 0 2 0; +#X connect 15 0 6 0; +#X connect 16 0 6 0; +#X connect 17 0 20 0; +#X connect 18 0 19 3; +#X connect 18 0 17 2; +#X connect 19 0 21 0; +#X connect 20 0 7 0; +#X connect 21 0 7 1; +#X connect 22 0 5 0; +#X connect 23 0 21 1; +#X connect 23 0 20 1; +#X connect 24 0 19 1; +#X connect 25 0 8 1; +#X connect 26 0 25 0; diff --git a/externals/miXed/test/cyclone/scope-gop.pd b/externals/miXed/test/cyclone/scope-gop.pd new file mode 100644 index 000000000..a5980d03e --- /dev/null +++ b/externals/miXed/test/cyclone/scope-gop.pd @@ -0,0 +1,2 @@ +#N canvas 315 186 464 344 12; +#X obj 186 108 scope-test; diff --git a/externals/miXed/test/cyclone/scope-test.pd b/externals/miXed/test/cyclone/scope-test.pd new file mode 100644 index 000000000..8a69d6b1f --- /dev/null +++ b/externals/miXed/test/cyclone/scope-test.pd @@ -0,0 +1,125 @@ +#N canvas 188 168 778 363 12; +#X obj 19 207 Scope~ 130 130 150 3 200 -1 1 100 0 0 0 50 255 0 202 +32 49 0; +#X floatatom 18 18 5 0 0 0 - - -; +#X floatatom 132 18 5 0 0 0 - - -; +#X obj 18 73 *~; +#X msg 100 161 bufsize \$1; +#X floatatom 100 135 5 0 0 0 - - -; +#X floatatom 247 80 5 0 0 0 - - -; +#X floatatom 276 106 5 0 0 0 - - -; +#X floatatom 305 130 5 0 0 0 - - -; +#X floatatom 36 136 5 0 0 0 - - -; +#X floatatom 364 80 5 0 0 0 - - -; +#X floatatom 393 106 5 0 0 0 - - -; +#X floatatom 422 130 5 0 0 0 - - -; +#N canvas 0 0 262 195 frgb 0; +#X obj 17 25 inlet; +#X obj 94 25 inlet; +#X obj 173 25 inlet; +#X obj 17 148 outlet; +#X obj 17 56 bondo 3; +#X obj 17 86 pack 0 0 0; +#X msg 17 116 frgb \$1 \$2 \$3; +#X connect 0 0 4 0; +#X connect 1 0 4 1; +#X connect 2 0 4 2; +#X connect 4 0 5 0; +#X connect 4 1 5 1; +#X connect 4 2 5 2; +#X connect 5 0 6 0; +#X connect 6 0 3 0; +#X restore 247 161 pd frgb; +#N canvas 0 0 250 195 brgb 0; +#X obj 17 25 inlet; +#X obj 94 25 inlet; +#X obj 173 25 inlet; +#X obj 17 148 outlet; +#X msg 17 116 brgb \$1 \$2 \$3; +#X obj 17 56 bondo 3; +#X obj 17 86 pack 0 0 0; +#X connect 0 0 5 0; +#X connect 1 0 5 1; +#X connect 2 0 5 2; +#X connect 4 0 3 0; +#X connect 5 0 6 0; +#X connect 5 1 6 1; +#X connect 5 2 6 2; +#X connect 6 0 4 0; +#X restore 364 161 pd brgb; +#X obj 18 44 osc~ 5; +#X obj 132 44 osc~ 11; +#X floatatom 100 80 5 0 0 0 - - -; +#X floatatom 167 80 5 0 0 0 - - -; +#N canvas 0 0 262 195 range 0; +#X obj 17 25 inlet; +#X obj 94 25 inlet; +#X obj 17 145 outlet; +#X msg 17 115 range \$1 \$2; +#X obj 17 85 pack; +#X obj 17 55 bondo; +#X connect 0 0 5 0; +#X connect 1 0 5 1; +#X connect 3 0 2 0; +#X connect 4 0 3 0; +#X connect 5 0 4 0; +#X connect 5 1 4 1; +#X restore 100 106 pd range; +#X floatatom 240 18 5 0 0 0 - - -; +#X msg 240 44 delay \$1; +#X floatatom 171 207 5 0 0 0 - - -; +#X obj 171 233 osc~ 5; +#X obj 243 207 Scope~ 130 130 256 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X floatatom 73 18 5 0 0 0 - - -; +#X floatatom 386 207 5 0 0 0 - - -; +#X obj 386 233 osc~ 5; +#X floatatom 441 207 5 0 0 0 - - -; +#X floatatom 512 18 5 0 0 0 - - -; +#X obj 512 44 pack; +#X floatatom 575 18 5 0 0 0 - - -; +#X msg 512 73 triglevel \$1 \, trigger \$2; +#X obj 512 207 Scope~ 130 130 256 3 128 -1 1 300 0 1 0 253 86 245 17 +40 152 0; +#X floatatom 655 136 5 0 0 0 - - -; +#X floatatom 731 136 5 0 0 0 - - -; +#X floatatom 530 136 5 0 0 0 - - -; +#X msg 530 162 delay \$1; +#X obj 655 162 osc~ 1.35; +#X connect 1 0 15 0; +#X connect 2 0 16 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 4 0; +#X connect 6 0 13 0; +#X connect 7 0 13 1; +#X connect 8 0 13 2; +#X connect 9 0 0 0; +#X connect 10 0 14 0; +#X connect 11 0 14 1; +#X connect 12 0 14 2; +#X connect 13 0 0 0; +#X connect 14 0 0 0; +#X connect 15 0 3 0; +#X connect 16 0 3 1; +#X connect 17 0 19 0; +#X connect 18 0 19 1; +#X connect 19 0 0 0; +#X connect 20 0 21 0; +#X connect 21 0 0 0; +#X connect 22 0 23 0; +#X connect 23 0 24 0; +#X connect 25 0 15 1; +#X connect 26 0 27 0; +#X connect 27 0 24 1; +#X connect 28 0 27 1; +#X connect 29 0 30 0; +#X connect 30 0 32 0; +#X connect 31 0 30 1; +#X connect 32 0 33 0; +#X connect 34 0 38 0; +#X connect 35 0 38 1; +#X connect 36 0 37 0; +#X connect 37 0 33 0; +#X connect 38 0 33 0; +#X coords 0 0 1 1 200 140 1; diff --git a/externals/miXed/test/cyclone/scope-test1.pd b/externals/miXed/test/cyclone/scope-test1.pd new file mode 100644 index 000000000..60af46d2f --- /dev/null +++ b/externals/miXed/test/cyclone/scope-test1.pd @@ -0,0 +1,28 @@ +#N canvas 236 201 450 300 12; +#X obj 17 27 osc~ 440; +#X obj 15 250 dac~; +#X obj 16 190 *~ 0.1; +#X obj 177 135 Scope~ 252 152 10 3 100 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X floatatom 177 96 5 0 0 0 - - -; +#X msg 270 96 bufsize \$1; +#X floatatom 270 60 5 0 0 0 - - -; +#X msg 177 21 10; +#X msg 270 21 100; +#X obj 38 96 triangle~; +#X obj 17 141 *~; +#X floatatom 107 27 5 0 0 0 - - -; +#X obj 38 60 phasor~ 4; +#X connect 0 0 10 0; +#X connect 2 0 1 0; +#X connect 2 0 1 1; +#X connect 4 0 3 0; +#X connect 5 0 3 0; +#X connect 6 0 5 0; +#X connect 7 0 4 0; +#X connect 8 0 6 0; +#X connect 9 0 10 1; +#X connect 10 0 2 0; +#X connect 10 0 3 0; +#X connect 11 0 12 0; +#X connect 12 0 9 0; diff --git a/externals/miXed/test/cyclone/scope-test2.pd b/externals/miXed/test/cyclone/scope-test2.pd new file mode 100644 index 000000000..47ad60441 --- /dev/null +++ b/externals/miXed/test/cyclone/scope-test2.pd @@ -0,0 +1,31 @@ +#N canvas 495 177 450 300 12; +#X obj 15 250 dac~; +#X obj 16 190 *~ 0.1; +#X obj 177 135 Scope~ 252 152 30 3 250 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X floatatom 177 96 5 0 0 0 - - -; +#X msg 270 96 bufsize \$1; +#X floatatom 270 60 5 0 0 0 - - -; +#X obj 38 96 triangle~; +#X obj 17 141 *~; +#X floatatom 107 27 5 0 0 0 - - -; +#X obj 17 27 osc~ 110; +#X obj 38 60 phasor~ 111; +#X msg 177 21 30; +#X msg 270 21 250; +#X msg 195 60 4; +#X connect 1 0 0 0; +#X connect 1 0 0 1; +#X connect 3 0 2 0; +#X connect 4 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 7 1; +#X connect 6 0 2 1; +#X connect 7 0 1 0; +#X connect 7 0 2 0; +#X connect 8 0 10 0; +#X connect 9 0 7 0; +#X connect 10 0 6 0; +#X connect 11 0 3 0; +#X connect 12 0 5 0; +#X connect 13 0 3 0; diff --git a/externals/miXed/test/cyclone/seq-test.pd b/externals/miXed/test/cyclone/seq-test.pd new file mode 100644 index 000000000..66a087bd2 --- /dev/null +++ b/externals/miXed/test/cyclone/seq-test.pd @@ -0,0 +1,125 @@ +#N canvas 288 50 601 359 12; +#X obj 125 191 seq; +#X msg 61 249 print; +#X floatatom 63 83 5 0 0 0 - - -; +#X msg 160 74 record; +#X msg 144 48 stop; +#X msg 217 180 read nosuchfile; +#X obj 125 249 print; +#X obj 125 24 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 217 206 write; +#X msg 379 215 write; +#X msg 168 102 144; +#X msg 217 102 240; +#X obj 61 147 midiin; +#X obj 379 249 seq test.seq; +#X obj 242 319 midiout; +#X msg 217 128 read test.seq; +#X msg 445 215 start \$1; +#X msg 445 154 512; +#X floatatom 445 180 5 0 0 0 - - -; +#X msg 379 154 stop; +#X msg 217 232 write test.seq; +#X obj 242 293 midiflush; +#X msg 189 293 bang; +#X msg 264 102 read kanon.mid; +#X msg 231 74 append; +#X msg 217 258 write test.mid; +#X msg 217 154 read test.mid; +#X msg 448 97 delay \$1; +#X floatatom 448 74 5 0 0 0 - - -; +#X obj 379 284 print; +#X msg 499 151 hook \$1; +#X floatatom 499 128 5 0 0 0 - - -; +#X msg 448 284 print; +#N canvas 329 51 450 309 slavemode 1; +#X obj 227 237 seq; +#X obj 227 278 print; +#X obj 38 142 metro 1000; +#X obj 38 65 t b 0; +#X msg 38 92 1; +#X obj 167 118 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 38 169 random 128; +#X msg 38 196 144 \, \$1 \, \$1; +#X obj 227 201 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 261 196 stop; +#X msg 38 14 500; +#X floatatom 38 41 5 0 0 0 - - -; +#X msg 261 169 start -1; +#X obj 205 118 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 205 168 tick; +#X msg 165 278 print; +#X msg 92 14 record; +#X obj 272 96 / 48; +#X obj 205 141 metro 21; +#X obj 272 69 * 1000; +#X floatatom 272 45 5 0 0 0 - - -; +#X msg 272 18 1; +#X msg 158 196 read; +#X obj 288 278 midiout; +#X connect 0 0 1 0; +#X connect 0 0 23 0; +#X connect 0 1 1 0; +#X connect 2 0 6 0; +#X connect 3 0 4 0; +#X connect 3 1 2 1; +#X connect 4 0 5 0; +#X connect 5 0 2 0; +#X connect 6 0 7 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 11 0; +#X connect 11 0 3 0; +#X connect 12 0 0 0; +#X connect 13 0 18 0; +#X connect 14 0 0 0; +#X connect 15 0 0 0; +#X connect 16 0 0 0; +#X connect 17 0 18 1; +#X connect 18 0 14 0; +#X connect 19 0 17 0; +#X connect 20 0 19 0; +#X connect 21 0 20 0; +#X connect 22 0 0 0; +#X restore 306 28 pd slavemode; +#X connect 0 0 6 0; +#X connect 0 0 21 0; +#X connect 0 1 6 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 4 0 22 0; +#X connect 5 0 0 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 13 0; +#X connect 10 0 0 0; +#X connect 11 0 0 0; +#X connect 12 0 0 0; +#X connect 12 0 14 0; +#X connect 13 0 21 0; +#X connect 13 0 29 0; +#X connect 13 1 29 0; +#X connect 15 0 0 0; +#X connect 16 0 13 0; +#X connect 17 0 18 0; +#X connect 18 0 16 0; +#X connect 19 0 13 0; +#X connect 20 0 0 0; +#X connect 21 0 14 0; +#X connect 22 0 21 0; +#X connect 23 0 0 0; +#X connect 24 0 0 0; +#X connect 25 0 0 0; +#X connect 26 0 0 0; +#X connect 27 0 13 0; +#X connect 28 0 27 0; +#X connect 30 0 13 0; +#X connect 31 0 30 0; +#X connect 32 0 13 0; diff --git a/externals/miXed/test/cyclone/sigbits-test.pd b/externals/miXed/test/cyclone/sigbits-test.pd new file mode 100644 index 000000000..9fcb65dad --- /dev/null +++ b/externals/miXed/test/cyclone/sigbits-test.pd @@ -0,0 +1,157 @@ +#N canvas 138 178 832 338 12; +#X floatatom 208 168 5 0 0 0 - - -; +#X floatatom 266 155 5 0 0 0 - - -; +#X obj 208 250 Snapshot~ 50; +#X floatatom 208 290 0 0 0 0 - - -; +#X msg 332 168 mode \$1; +#X floatatom 332 134 5 0 0 0 - - -; +#X obj 62 207 bitand~; +#X floatatom 62 168 5 0 0 0 - - -; +#X obj 62 250 Snapshot~ 50; +#X floatatom 62 290 0 0 0 0 - - -; +#X msg 126 168 mode \$1; +#X floatatom 126 134 5 0 0 0 - - -; +#X obj 62 104 prepend bits; +#X obj 62 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 83 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 103 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 123 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 143 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 163 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 183 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 203 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 223 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 243 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 263 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 283 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 303 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 323 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 343 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 363 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 385 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 405 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 425 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 445 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 465 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 485 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 505 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 525 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 545 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 565 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 585 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 605 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 625 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 645 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 665 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 685 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 62 57 pack 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0; +#X obj 26 57 int; +#X obj 26 29 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 419 168 5 0 0 0 - - -; +#X obj 419 250 Snapshot~ 50; +#X floatatom 419 290 0 0 0 0 - - -; +#X msg 489 168 mode \$1; +#X floatatom 489 134 5 0 0 0 - - -; +#X obj 419 214 bitnot~; +#X obj 208 214 bitxor~; +#X floatatom 577 168 5 0 0 0 - - -; +#X obj 577 250 Snapshot~ 50; +#X floatatom 577 290 0 0 0 0 - - -; +#X msg 647 168 mode \$1; +#X floatatom 647 134 5 0 0 0 - - -; +#X msg 683 214 shift \$1; +#X obj 577 214 bitshift~; +#X floatatom 731 168 5 0 0 0 - - -; +#X connect 0 0 54 0; +#X connect 1 0 54 1; +#X connect 2 0 3 0; +#X connect 4 0 54 0; +#X connect 5 0 4 0; +#X connect 6 0 8 0; +#X connect 7 0 6 0; +#X connect 8 0 9 0; +#X connect 10 0 6 0; +#X connect 11 0 10 0; +#X connect 12 0 6 0; +#X connect 13 0 46 1; +#X connect 14 0 45 1; +#X connect 15 0 45 2; +#X connect 16 0 45 3; +#X connect 17 0 45 4; +#X connect 18 0 45 5; +#X connect 19 0 45 6; +#X connect 20 0 45 7; +#X connect 21 0 45 8; +#X connect 22 0 45 9; +#X connect 23 0 45 10; +#X connect 24 0 45 11; +#X connect 25 0 45 12; +#X connect 26 0 45 13; +#X connect 27 0 45 14; +#X connect 28 0 45 15; +#X connect 29 0 45 16; +#X connect 30 0 45 17; +#X connect 31 0 45 18; +#X connect 32 0 45 19; +#X connect 33 0 45 20; +#X connect 34 0 45 21; +#X connect 35 0 45 22; +#X connect 36 0 45 23; +#X connect 37 0 45 24; +#X connect 38 0 45 25; +#X connect 39 0 45 26; +#X connect 40 0 45 27; +#X connect 41 0 45 28; +#X connect 42 0 45 29; +#X connect 43 0 45 30; +#X connect 44 0 45 31; +#X connect 45 0 12 0; +#X connect 46 0 45 0; +#X connect 47 0 46 0; +#X connect 48 0 53 0; +#X connect 49 0 50 0; +#X connect 51 0 53 0; +#X connect 52 0 51 0; +#X connect 53 0 49 0; +#X connect 54 0 2 0; +#X connect 55 0 61 0; +#X connect 56 0 57 0; +#X connect 58 0 61 0; +#X connect 59 0 58 0; +#X connect 60 0 61 0; +#X connect 61 0 56 0; +#X connect 62 0 60 0; diff --git a/externals/miXed/test/cyclone/sigcapture-test.pd b/externals/miXed/test/cyclone/sigcapture-test.pd new file mode 100644 index 000000000..2225e6147 --- /dev/null +++ b/externals/miXed/test/cyclone/sigcapture-test.pd @@ -0,0 +1,25 @@ +#N canvas 249 232 527 300 12; +#X obj 200 34 phasor~ 1; +#X floatatom 45 34 5 0 0 0 - - -; +#X msg 306 34 clear; +#X msg 306 69 write; +#X obj 199 107 capture~ 1000 7; +#X obj 47 215 *~ 100; +#X obj 47 256 capture~ 1000 0; +#X obj 47 174 osc~ 100; +#X msg 76 69 clear; +#X obj 45 107 capture~ f; +#X obj 225 215 count~; +#X obj 225 174 bang~; +#X obj 225 256 capture~ 100 0 3 5 7 11 999 13; +#X obj 328 234 capture~ 1000; +#X connect 0 0 4 0; +#X connect 1 0 9 0; +#X connect 2 0 4 0; +#X connect 3 0 4 0; +#X connect 5 0 6 0; +#X connect 7 0 5 0; +#X connect 8 0 9 0; +#X connect 10 0 12 0; +#X connect 10 0 13 0; +#X connect 11 0 10 0; diff --git a/externals/miXed/test/cyclone/sigcycle-test.pd b/externals/miXed/test/cyclone/sigcycle-test.pd new file mode 100644 index 000000000..99034870e --- /dev/null +++ b/externals/miXed/test/cyclone/sigcycle-test.pd @@ -0,0 +1,156 @@ +#N canvas 442 270 466 287 12; +#N canvas 179 250 728 409 test1 0; +#X obj 27 146 cycle~; +#X obj 28 225 Scope~ 301 138 126 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 368 225 Scope~ 301 138 126 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X floatatom 239 58 5 0 0 0 - - -; +#X floatatom 150 146 5 0 0 0 - - -; +#X msg 233 146 trigger \$1; +#X obj 233 118 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 76 102 phasor~ 3; +#X obj 367 146 cycle~ 3; +#N canvas 0 0 450 300 graph1 0; +#X array t1 1000 float 0; +#X coords 0 1 999 -1 200 140 1; +#X restore 481 34 graph; +#X msg 137 58 set; +#X msg 27 58 set t1 \$1; +#X floatatom 27 23 5 0 0 0 - - -; +#X connect 0 0 1 0; +#X connect 3 0 7 0; +#X connect 3 0 8 0; +#X connect 4 0 1 0; +#X connect 4 0 2 0; +#X connect 5 0 1 0; +#X connect 5 0 2 0; +#X connect 6 0 5 0; +#X connect 7 0 0 1; +#X connect 8 0 2 0; +#X connect 10 0 0 0; +#X connect 10 0 8 0; +#X connect 11 0 0 0; +#X connect 11 0 8 0; +#X connect 12 0 11 0; +#X restore 42 39 pd test1; +#N canvas 125 182 742 644 test2 0; +#X obj 29 255 Scope~ 301 138 72 3 128 -1 1 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 382 255 Scope~ 301 138 72 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X floatatom 29 19 5 0 0 0 - - -; +#X floatatom 152 211 5 0 0 0 - - -; +#X msg 235 211 trigger \$1; +#X obj 235 181 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 382 211 cycle~ 3; +#X obj 29 211 cycle~ 3; +#X obj 96 143 cycle~ 3; +#X obj 384 105 cycle~ 3; +#X obj 383 177 +~ 3; +#X obj 384 143 *~ 1; +#X obj 95 177 *~ 1; +#X floatatom 96 19 5 0 0 0 - - -; +#X floatatom 168 19 5 0 0 0 - - -; +#X obj 508 112 *; +#X obj 508 63 bondo; +#X obj 548 90 * 6.28; +#X obj 188 435 Scope~ 301 138 72 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 30 513 phasor~ 3; +#X obj 107 435 osc~ 3; +#X obj 107 474 *~ 1; +#X obj 30 575 cos~; +#X obj 30 544 +~; +#X connect 2 0 10 1; +#X connect 2 0 7 0; +#X connect 2 0 19 0; +#X connect 3 0 0 0; +#X connect 3 0 1 0; +#X connect 3 0 18 0; +#X connect 4 0 0 0; +#X connect 4 0 1 0; +#X connect 4 0 18 0; +#X connect 5 0 4 0; +#X connect 6 0 1 0; +#X connect 7 0 0 0; +#X connect 8 0 12 0; +#X connect 9 0 11 0; +#X connect 10 0 6 0; +#X connect 11 0 10 0; +#X connect 12 0 7 1; +#X connect 13 0 9 0; +#X connect 13 0 8 0; +#X connect 13 0 16 0; +#X connect 13 0 20 0; +#X connect 14 0 12 1; +#X connect 14 0 16 1; +#X connect 14 0 21 1; +#X connect 15 0 11 1; +#X connect 16 0 15 0; +#X connect 16 1 17 0; +#X connect 17 0 15 1; +#X connect 19 0 23 0; +#X connect 20 0 21 0; +#X connect 21 0 23 1; +#X connect 22 0 18 0; +#X connect 23 0 22 0; +#X restore 164 39 pd test2; +#N canvas 180 253 749 421 test3 0; +#X obj 29 255 Scope~ 301 138 118 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X obj 382 255 Scope~ 301 138 118 3 128 -1 1 0 0 0 0 102 255 51 135 +135 135 0; +#X floatatom 29 19 5 0 0 0 - - -; +#X floatatom 152 211 5 0 0 0 - - -; +#X msg 235 211 trigger \$1; +#X obj 235 181 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 382 211 cycle~ 3; +#X obj 29 211 cycle~ 3; +#X obj 383 177 +~ 3; +#X obj 444 140 *~ 1; +#X obj 95 177 *~ 1; +#X floatatom 126 20 5 0 0 0 - - -; +#X obj 508 112 *; +#X obj 508 63 bondo; +#X obj 548 90 * 6.28; +#X obj 47 138 delwrite~ d1; +#X obj 174 138 delread~ d1; +#X obj 258 90 delwrite~ d2; +#X obj 385 90 delread~ d2; +#X connect 2 0 8 1; +#X connect 2 0 7 0; +#X connect 2 0 13 0; +#X connect 3 0 0 0; +#X connect 3 0 1 0; +#X connect 4 0 0 0; +#X connect 4 0 1 0; +#X connect 5 0 4 0; +#X connect 6 0 1 0; +#X connect 6 0 17 0; +#X connect 7 0 0 0; +#X connect 7 0 15 0; +#X connect 8 0 6 0; +#X connect 9 0 8 0; +#X connect 10 0 7 1; +#X connect 11 0 10 1; +#X connect 11 0 13 1; +#X connect 12 0 9 1; +#X connect 13 0 12 0; +#X connect 13 1 14 0; +#X connect 14 0 12 1; +#X connect 16 0 10 0; +#X connect 18 0 9 0; +#X restore 293 39 pd test3; +#X floatatom 120 99 5 0 0 0 - - -; +#X floatatom 44 216 0 0 0 0 - - -; +#X msg 44 99 set; +#X obj 44 137 cycle~ t2; +#X obj 44 177 Snapshot~ 20; +#X connect 3 0 6 1; +#X connect 5 0 6 0; +#X connect 6 0 7 0; +#X connect 7 0 4 0; diff --git a/externals/miXed/test/cyclone/sigmeters-test.pd b/externals/miXed/test/cyclone/sigmeters-test.pd new file mode 100644 index 000000000..edf97e846 --- /dev/null +++ b/externals/miXed/test/cyclone/sigmeters-test.pd @@ -0,0 +1,45 @@ +#N canvas 296 215 621 370 12; +#X obj 146 187 minmax~; +#X floatatom 146 29 5 0 0 0 - - -; +#X obj 117 29 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 57 29 reset; +#X obj 204 221 print; +#X obj 174 71 abs~; +#X obj 365 92 avg~; +#X floatatom 365 124 5 0 0 0 - - -; +#X obj 365 29 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 287 60 osc~ 1; +#X obj 365 60 metro 250; +#X obj 164 255 Snapshot~ 150; +#X floatatom 164 287 5 0 0 0 - - -; +#X obj 29 255 Snapshot~ 150; +#X floatatom 29 287 5 0 0 0 - - -; +#X obj 174 106 Snapshot~ 150; +#X floatatom 174 138 5 0 0 0 - - -; +#X floatatom 287 29 5 0 0 0 - - -; +#X obj 367 187 osc~ 100; +#X floatatom 367 257 5 0 0 0 - - -; +#X obj 367 221 average~ 10000 rms; +#X msg 459 187 absolute; +#X connect 0 0 13 0; +#X connect 0 1 11 0; +#X connect 0 2 4 0; +#X connect 0 3 4 0; +#X connect 1 0 0 0; +#X connect 1 0 5 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 5 0 15 0; +#X connect 6 0 7 0; +#X connect 8 0 10 0; +#X connect 9 0 6 0; +#X connect 10 0 6 0; +#X connect 11 0 12 0; +#X connect 13 0 14 0; +#X connect 15 0 16 0; +#X connect 17 0 9 0; +#X connect 18 0 20 0; +#X connect 20 0 19 0; +#X connect 21 0 20 0; diff --git a/externals/miXed/test/cyclone/sigops-test.pd b/externals/miXed/test/cyclone/sigops-test.pd new file mode 100644 index 000000000..d2eb9a181 --- /dev/null +++ b/externals/miXed/test/cyclone/sigops-test.pd @@ -0,0 +1,64 @@ +#N canvas 281 205 642 407 12; +#X obj 25 108 %~; +#X floatatom 25 181 10 0 0 0 - - -; +#X floatatom 25 40 5 0 0 0 - - -; +#X floatatom 96 71 5 0 0 0 - - -; +#X obj 25 71 * 0.01; +#X floatatom 277 40 5 0 0 0 - - -; +#X obj 277 71 +=~; +#X floatatom 277 144 10 0 0 0 - - -; +#X msg 337 40 set 999; +#X msg 222 40 bang; +#X floatatom 442 144 10 0 0 0 - - -; +#X floatatom 442 40 5 0 0 0 - - -; +#X floatatom 513 40 5 0 0 0 - - -; +#X obj 442 71 !/~; +#X obj 277 108 Snapshot~ 50; +#X obj 442 108 Snapshot~ 50; +#X obj 25 144 Snapshot~ 50; +#X floatatom 26 340 10 0 0 0 - - -; +#X floatatom 26 236 10 0 0 0 - - -; +#X floatatom 152 236 5 0 0 0 - - -; +#X obj 26 304 Snapshot~ 50; +#X obj 26 267 log~; +#X obj 183 108 >~ 10000; +#X obj 183 144 edge~; +#X floatatom 234 342 10 0 0 0 - - -; +#X floatatom 234 238 10 0 0 0 - - -; +#X floatatom 360 238 5 0 0 0 - - -; +#X obj 234 306 Snapshot~ 50; +#X obj 234 269 pow~; +#X floatatom 439 341 10 0 0 0 - - -; +#X floatatom 439 237 10 0 0 0 - - -; +#X floatatom 565 237 5 0 0 0 - - -; +#X obj 439 305 Snapshot~ 50; +#X obj 439 268 atan2~; +#X connect 0 0 16 0; +#X connect 2 0 4 0; +#X connect 3 0 0 1; +#X connect 4 0 0 0; +#X connect 5 0 6 0; +#X connect 6 0 14 0; +#X connect 6 0 22 0; +#X connect 8 0 6 0; +#X connect 9 0 6 0; +#X connect 11 0 13 0; +#X connect 12 0 13 1; +#X connect 13 0 15 0; +#X connect 14 0 7 0; +#X connect 15 0 10 0; +#X connect 16 0 1 0; +#X connect 18 0 21 0; +#X connect 19 0 21 1; +#X connect 20 0 17 0; +#X connect 21 0 20 0; +#X connect 22 0 23 0; +#X connect 23 0 6 0; +#X connect 25 0 28 0; +#X connect 26 0 28 1; +#X connect 27 0 24 0; +#X connect 28 0 27 0; +#X connect 30 0 33 0; +#X connect 31 0 33 1; +#X connect 32 0 29 0; +#X connect 33 0 32 0; diff --git a/externals/miXed/test/cyclone/sigsmoothers-test.pd b/externals/miXed/test/cyclone/sigsmoothers-test.pd new file mode 100644 index 000000000..803d95040 --- /dev/null +++ b/externals/miXed/test/cyclone/sigsmoothers-test.pd @@ -0,0 +1,34 @@ +#N canvas 304 91 587 409 12; +#X obj 51 371 cyclone; +#X obj 51 340 sprintf import ../../../ref/c74help/text/%s.help; +#X msg 62 281 slide~; +#X msg 51 253 deltaclip~; +#X msg 72 309 rampsmooth~; +#X msg 114 48 1; +#X msg 65 48 0; +#X floatatom 65 79 0 0 0 0 - - -; +#X msg 165 85 ramp \$1; +#X floatatom 165 48 0 0 0 0 - - -; +#X obj 27 149 capture~ f; +#X msg 95 17 clear; +#X msg 27 17 clear; +#X obj 65 117 rampsmooth~; +#X obj 244 148 Scope~ 130 130 256 3 128 0 1 0 0 0 0 102 255 51 135 +135 135 0; +#X msg 244 117 range 0 1; +#X connect 1 0 0 0; +#X connect 2 0 1 0; +#X connect 3 0 1 0; +#X connect 4 0 1 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 13 0; +#X connect 8 0 13 0; +#X connect 9 0 8 0; +#X connect 11 0 10 0; +#X connect 11 0 5 0; +#X connect 12 0 6 0; +#X connect 12 0 10 0; +#X connect 13 0 10 0; +#X connect 13 0 14 0; +#X connect 15 0 14 0; diff --git a/externals/miXed/test/cyclone/sigtrig-test.pd b/externals/miXed/test/cyclone/sigtrig-test.pd new file mode 100644 index 000000000..01d88e5ab --- /dev/null +++ b/externals/miXed/test/cyclone/sigtrig-test.pd @@ -0,0 +1,80 @@ +#N canvas 210 153 573 323 12; +#N canvas 0 0 749 559 coords 0; +#X obj 199 114 cartopol~; +#X floatatom 199 21 5 0 0 0 - - -; +#X floatatom 275 58 5 0 0 0 - - -; +#X floatatom 199 287 0 0 0 0 - - -; +#X floatatom 275 205 0 0 0 0 - - -; +#X obj 199 257 snapshot~; +#X obj 275 175 snapshot~; +#X obj 66 114 metro 50; +#X obj 66 84 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 66 458 0 0 0 0 - - -; +#X floatatom 142 376 0 0 0 0 - - -; +#X obj 66 428 snapshot~; +#X obj 66 286 poltocar~; +#X obj 142 346 snapshot~; +#X floatatom 571 21 5 0 0 0 - - -; +#X floatatom 647 58 5 0 0 0 - - -; +#X floatatom 571 287 0 0 0 0 - - -; +#X floatatom 647 205 0 0 0 0 - - -; +#X obj 571 257 snapshot~; +#X obj 647 175 snapshot~; +#X obj 438 114 metro 50; +#X obj 438 84 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 438 458 0 0 0 0 - - -; +#X floatatom 514 376 0 0 0 0 - - -; +#X obj 438 428 snapshot~; +#X obj 514 346 snapshot~; +#X obj 571 114 poltocar~; +#X obj 438 286 cartopol~; +#X obj 346 21 loadbang; +#X connect 0 0 5 0; +#X connect 0 0 12 0; +#X connect 0 1 6 0; +#X connect 0 1 12 1; +#X connect 1 0 0 0; +#X connect 2 0 0 1; +#X connect 5 0 3 0; +#X connect 6 0 4 0; +#X connect 7 0 6 0; +#X connect 7 0 5 0; +#X connect 7 0 13 0; +#X connect 7 0 11 0; +#X connect 8 0 7 0; +#X connect 11 0 9 0; +#X connect 12 0 11 0; +#X connect 12 1 13 0; +#X connect 13 0 10 0; +#X connect 14 0 26 0; +#X connect 15 0 26 1; +#X connect 18 0 16 0; +#X connect 19 0 17 0; +#X connect 20 0 19 0; +#X connect 20 0 18 0; +#X connect 20 0 25 0; +#X connect 20 0 24 0; +#X connect 21 0 20 0; +#X connect 24 0 22 0; +#X connect 25 0 23 0; +#X connect 26 0 18 0; +#X connect 26 0 27 0; +#X connect 26 1 19 0; +#X connect 26 1 27 1; +#X connect 27 0 24 0; +#X connect 27 1 25 0; +#X connect 28 0 8 0; +#X connect 28 0 21 0; +#X restore 42 41 pd coords; +#N canvas 135 57 659 466 -lm 0; +#X obj 31 70 acos~; +#X obj 30 120 Scope~ 229 132 256 3 128 0 3.15 0 0 0 0 102 255 51 135 +135 135 0; +#X msg 122 70 range 0 3.15; +#X obj 31 25 cycle~ 1; +#X connect 0 0 1 0; +#X connect 2 0 1 0; +#X connect 3 0 0 0; +#X restore 177 41 pd -lm; diff --git a/externals/miXed/test/cyclone/sigwrappers-speed.pd b/externals/miXed/test/cyclone/sigwrappers-speed.pd new file mode 100644 index 000000000..f6809713f --- /dev/null +++ b/externals/miXed/test/cyclone/sigwrappers-speed.pd @@ -0,0 +1,101 @@ +#N canvas 220 91 570 539 12; +#X obj 65 200 phasewrap~; +#X msg 20 19 0; +#X msg 71 19 1; +#X msg 122 19 2; +#X floatatom 71 53 5 0 0 0 - - -; +#X obj 168 200 phasewrap~; +#X obj 272 200 phasewrap~; +#X obj 376 200 phasewrap~; +#X obj 71 229 phasewrap~; +#X obj 174 229 phasewrap~; +#X obj 278 229 phasewrap~; +#X obj 382 229 phasewrap~; +#X obj 71 261 phasewrap~; +#X obj 174 261 phasewrap~; +#X obj 278 261 phasewrap~; +#X obj 382 261 phasewrap~; +#X obj 77 291 phasewrap~; +#X obj 180 291 phasewrap~; +#X obj 284 291 phasewrap~; +#X obj 388 291 phasewrap~; +#X obj 83 323 phasewrap~; +#X obj 186 323 phasewrap~; +#X obj 290 323 phasewrap~; +#X obj 394 323 phasewrap~; +#X obj 59 354 phasewrap~; +#X obj 162 354 phasewrap~; +#X obj 266 354 phasewrap~; +#X obj 370 354 phasewrap~; +#X obj 65 383 phasewrap~; +#X obj 168 383 phasewrap~; +#X obj 272 383 phasewrap~; +#X obj 376 383 phasewrap~; +#X obj 65 415 phasewrap~; +#X obj 168 415 phasewrap~; +#X obj 272 415 phasewrap~; +#X obj 376 415 phasewrap~; +#X obj 71 445 phasewrap~; +#X obj 174 445 phasewrap~; +#X obj 278 445 phasewrap~; +#X obj 382 445 phasewrap~; +#X obj 77 477 phasewrap~; +#X obj 180 477 phasewrap~; +#X obj 284 477 phasewrap~; +#X obj 388 477 phasewrap~; +#X msg 197 124 \$2 \, _algo \$1 \; pd dsp 0 \; pd dsp 1; +#X obj 197 92 pack; +#X floatatom 237 19 5 0 0 0 - - -; +#X obj 164 19 inlet; +#X obj 305 19 inlet; +#X obj 197 58 bondo; +#X connect 1 0 4 0; +#X connect 2 0 4 0; +#X connect 3 0 4 0; +#X connect 4 0 49 0; +#X connect 44 0 0 0; +#X connect 44 0 5 0; +#X connect 44 0 6 0; +#X connect 44 0 7 0; +#X connect 44 0 8 0; +#X connect 44 0 9 0; +#X connect 44 0 10 0; +#X connect 44 0 11 0; +#X connect 44 0 12 0; +#X connect 44 0 14 0; +#X connect 44 0 13 0; +#X connect 44 0 15 0; +#X connect 44 0 16 0; +#X connect 44 0 17 0; +#X connect 44 0 18 0; +#X connect 44 0 19 0; +#X connect 44 0 20 0; +#X connect 44 0 21 0; +#X connect 44 0 22 0; +#X connect 44 0 23 0; +#X connect 44 0 24 0; +#X connect 44 0 25 0; +#X connect 44 0 26 0; +#X connect 44 0 27 0; +#X connect 44 0 28 0; +#X connect 44 0 29 0; +#X connect 44 0 30 0; +#X connect 44 0 31 0; +#X connect 44 0 32 0; +#X connect 44 0 33 0; +#X connect 44 0 34 0; +#X connect 44 0 35 0; +#X connect 44 0 36 0; +#X connect 44 0 37 0; +#X connect 44 0 38 0; +#X connect 44 0 39 0; +#X connect 44 0 40 0; +#X connect 44 0 41 0; +#X connect 44 0 42 0; +#X connect 44 0 43 0; +#X connect 45 0 44 0; +#X connect 46 0 49 1; +#X connect 47 0 4 0; +#X connect 48 0 46 0; +#X connect 49 0 45 0; +#X connect 49 1 45 1; diff --git a/externals/miXed/test/cyclone/sigwrappers-speed20.pd b/externals/miXed/test/cyclone/sigwrappers-speed20.pd new file mode 100644 index 000000000..98143ecf5 --- /dev/null +++ b/externals/miXed/test/cyclone/sigwrappers-speed20.pd @@ -0,0 +1,63 @@ +#N canvas 441 249 467 396 12; +#X obj 46 77 sigwrappers-speed; +#X floatatom 123 29 5 0 0 0 - - -; +#X floatatom 293 29 5 0 0 0 - - -; +#X obj 46 107 sigwrappers-speed; +#X obj 46 137 sigwrappers-speed; +#X obj 46 167 sigwrappers-speed; +#X obj 46 197 sigwrappers-speed; +#X obj 46 227 sigwrappers-speed; +#X obj 46 257 sigwrappers-speed; +#X obj 228 77 sigwrappers-speed; +#X obj 228 107 sigwrappers-speed; +#X obj 228 137 sigwrappers-speed; +#X obj 228 167 sigwrappers-speed; +#X obj 228 197 sigwrappers-speed; +#X obj 228 227 sigwrappers-speed; +#X obj 228 257 sigwrappers-speed; +#X obj 46 287 sigwrappers-speed; +#X obj 46 317 sigwrappers-speed; +#X obj 46 347 sigwrappers-speed; +#X obj 228 287 sigwrappers-speed; +#X obj 228 317 sigwrappers-speed; +#X obj 228 347 sigwrappers-speed; +#X connect 1 0 0 0; +#X connect 1 0 3 0; +#X connect 1 0 4 0; +#X connect 1 0 5 0; +#X connect 1 0 6 0; +#X connect 1 0 7 0; +#X connect 1 0 8 0; +#X connect 1 0 9 0; +#X connect 1 0 10 0; +#X connect 1 0 11 0; +#X connect 1 0 12 0; +#X connect 1 0 13 0; +#X connect 1 0 14 0; +#X connect 1 0 15 0; +#X connect 1 0 16 0; +#X connect 1 0 17 0; +#X connect 1 0 18 0; +#X connect 1 0 19 0; +#X connect 1 0 20 0; +#X connect 1 0 21 0; +#X connect 2 0 0 1; +#X connect 2 0 3 1; +#X connect 2 0 4 1; +#X connect 2 0 5 1; +#X connect 2 0 6 1; +#X connect 2 0 7 1; +#X connect 2 0 8 1; +#X connect 2 0 16 1; +#X connect 2 0 17 1; +#X connect 2 0 18 1; +#X connect 2 0 9 1; +#X connect 2 0 10 1; +#X connect 2 0 11 1; +#X connect 2 0 12 1; +#X connect 2 0 13 1; +#X connect 2 0 14 1; +#X connect 2 0 15 1; +#X connect 2 0 19 1; +#X connect 2 0 20 1; +#X connect 2 0 21 1; diff --git a/externals/miXed/test/cyclone/sigwrappers-test.pd b/externals/miXed/test/cyclone/sigwrappers-test.pd new file mode 100644 index 000000000..c675fb497 --- /dev/null +++ b/externals/miXed/test/cyclone/sigwrappers-test.pd @@ -0,0 +1,34 @@ +#N canvas 468 231 530 478 12; +#X obj 38 200 phasewrap~; +#X floatatom 234 68 0 0 0 0 - - -; +#X obj 175 200 _phasewrap1~; +#X obj 336 200 _phasewrap2~; +#X obj 234 102 * 0.01; +#X floatatom 38 273 0 0 0 0 - - -; +#X floatatom 175 273 0 0 0 0 - - -; +#X floatatom 336 273 0 0 0 0 - - -; +#X floatatom 175 154 0 0 0 0 - - -; +#X floatatom 49 68 5 0 0 0 - - -; +#X obj 129 102 acos; +#X obj 107 135 *; +#X msg 129 68 -1; +#X obj 129 33 loadbang; +#X obj 38 237 Snapshot~ 20; +#X obj 175 237 Snapshot~ 20; +#X obj 336 237 Snapshot~ 20; +#X connect 0 0 14 0; +#X connect 1 0 4 0; +#X connect 2 0 15 0; +#X connect 3 0 16 0; +#X connect 4 0 8 0; +#X connect 8 0 0 0; +#X connect 8 0 2 0; +#X connect 8 0 3 0; +#X connect 9 0 11 0; +#X connect 10 0 11 1; +#X connect 11 0 8 0; +#X connect 12 0 10 0; +#X connect 13 0 12 0; +#X connect 14 0 5 0; +#X connect 15 0 6 0; +#X connect 16 0 7 0; diff --git a/externals/miXed/test/cyclone/spectrum-pm.pd b/externals/miXed/test/cyclone/spectrum-pm.pd new file mode 100644 index 000000000..db35ca835 --- /dev/null +++ b/externals/miXed/test/cyclone/spectrum-pm.pd @@ -0,0 +1,34 @@ +#N canvas 189 215 712 594 12; +#X obj 62 350 Scope~ 562 220 2 3 512 0 512 0 0 0 0 102 255 51 135 135 +135 0; +#X obj 174 234 cartopol~; +#X obj 174 190 rfft~; +#X obj 23 25 block~ 1024; +#X obj 62 276 vectral~ 1024; +#X obj 62 142 count~ 0 1024 1 1; +#X floatatom 284 100 5 0 0 0 - - -; +#X floatatom 378 25 5 0 0 0 - - -; +#X floatatom 111 190 5 0 0 0 - - -; +#X obj 378 100 *~ 1; +#X floatatom 440 100 5 0 0 0 - - -; +#X obj 62 234 *~ 0.3; +#X obj 284 142 cycle~ 3000; +#X obj 378 62 cycle~ 1000; +#X msg 210 276 slide 10 10; +#X msg 130 310 range 0 512 \, 2 \, bufsize 512; +#X connect 1 0 4 2; +#X connect 2 0 1 0; +#X connect 2 1 1 1; +#X connect 4 0 0 0; +#X connect 5 0 4 1; +#X connect 5 0 11 0; +#X connect 6 0 12 0; +#X connect 7 0 13 0; +#X connect 8 0 11 1; +#X connect 9 0 12 1; +#X connect 10 0 9 1; +#X connect 11 0 4 0; +#X connect 12 0 2 0; +#X connect 13 0 9 0; +#X connect 14 0 4 0; +#X connect 15 0 0 0; diff --git a/externals/miXed/test/cyclone/speedlim-rescheduling.pd b/externals/miXed/test/cyclone/speedlim-rescheduling.pd new file mode 100644 index 000000000..62727ae09 --- /dev/null +++ b/externals/miXed/test/cyclone/speedlim-rescheduling.pd @@ -0,0 +1,54 @@ +#N canvas 246 121 642 393 12; +#X msg 126 17 bang; +#X obj 126 58 t b b b; +#X msg 151 108 1; +#X msg 60 151 2; +#X msg 401 17 bang; +#X obj 401 58 t b b b; +#X msg 426 108 1; +#X msg 335 151 2; +#X obj 151 288 timer; +#X obj 151 241 sel 1 2; +#X obj 426 288 timer; +#X obj 426 241 sel 1 2; +#X obj 285 241 print; +#X floatatom 151 332 5 0 0 0 - - -; +#X floatatom 426 332 5 0 0 0 - - -; +#X msg 242 108 1000; +#X obj 151 198 speedlim 200; +#X msg 202 151 200; +#X msg 517 108 1000; +#X msg 478 151 200; +#X obj 426 198 speedlim 200; +#X obj 60 108 del 600; +#X obj 335 108 del 600; +#X connect 0 0 1 0; +#X connect 1 0 21 0; +#X connect 1 1 15 0; +#X connect 1 2 2 0; +#X connect 2 0 16 0; +#X connect 3 0 16 0; +#X connect 4 0 5 0; +#X connect 5 0 22 0; +#X connect 5 1 6 0; +#X connect 5 2 18 0; +#X connect 6 0 20 0; +#X connect 7 0 20 0; +#X connect 8 0 13 0; +#X connect 9 0 8 0; +#X connect 9 1 8 1; +#X connect 9 1 17 0; +#X connect 10 0 14 0; +#X connect 11 0 10 0; +#X connect 11 1 10 1; +#X connect 11 1 19 0; +#X connect 15 0 16 1; +#X connect 16 0 9 0; +#X connect 16 0 12 0; +#X connect 17 0 16 1; +#X connect 18 0 20 1; +#X connect 19 0 20 1; +#X connect 20 0 11 0; +#X connect 20 0 12 0; +#X connect 21 0 3 0; +#X connect 22 0 7 0; diff --git a/externals/miXed/test/cyclone/speedlim-test.pd b/externals/miXed/test/cyclone/speedlim-test.pd new file mode 100644 index 000000000..04b6edf0e --- /dev/null +++ b/externals/miXed/test/cyclone/speedlim-test.pd @@ -0,0 +1,63 @@ +#N canvas 385 195 511 382 12; +#X obj 191 306 speedlim; +#X msg 191 31 bang; +#X obj 191 331 print; +#X msg 258 266 0; +#X msg 301 266 10; +#X msg 342 266 500; +#X msg 263 66 1; +#X msg 306 66 2; +#X msg 349 66 3; +#X msg 393 66 4; +#X obj 279 92 pipe 490; +#X obj 279 117 pipe 510; +#X obj 279 142 pipe 990; +#X obj 279 167 pipe 1600; +#X obj 279 192 pipe 2010; +#X obj 279 217 pipe 2020; +#X msg 393 91 5; +#X msg 393 116 6; +#X msg 393 141 7; +#X msg 263 31 bang; +#X msg 384 266 3000; +#X msg 106 235 one; +#X msg 80 203 symbol two; +#X msg 55 175 perhaps three; +#X obj 30 143 testmess 300; +#X msg 30 66 test; +#X obj 30 104 t a b b b; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 3 0 0 1; +#X connect 4 0 0 1; +#X connect 5 0 0 1; +#X connect 6 0 0 0; +#X connect 7 0 10 0; +#X connect 8 0 11 0; +#X connect 9 0 12 0; +#X connect 10 0 0 0; +#X connect 11 0 0 0; +#X connect 12 0 0 0; +#X connect 13 0 0 0; +#X connect 14 0 0 0; +#X connect 15 0 0 0; +#X connect 16 0 13 0; +#X connect 17 0 14 0; +#X connect 18 0 15 0; +#X connect 19 0 6 0; +#X connect 19 0 7 0; +#X connect 19 0 8 0; +#X connect 19 0 9 0; +#X connect 19 0 16 0; +#X connect 19 0 17 0; +#X connect 19 0 18 0; +#X connect 20 0 0 1; +#X connect 21 0 0 0; +#X connect 22 0 0 0; +#X connect 23 0 0 0; +#X connect 24 0 0 0; +#X connect 25 0 26 0; +#X connect 26 0 24 0; +#X connect 26 1 23 0; +#X connect 26 2 22 0; +#X connect 26 3 21 0; diff --git a/externals/miXed/test/cyclone/spell-test.pd b/externals/miXed/test/cyclone/spell-test.pd new file mode 100644 index 000000000..dd56e0c7f --- /dev/null +++ b/externals/miXed/test/cyclone/spell-test.pd @@ -0,0 +1,26 @@ +#N canvas 469 262 450 300 12; +#X obj 130 233 spell 7 -0.5; +#X msg 311 140 symbol test; +#X obj 130 261 print; +#X msg 311 168 another test; +#X msg 40 191 bang; +#X msg 130 106 99; +#X msg 177 106 99.99; +#X msg 79 106 -99; +#X msg 243 106 1 2 3; +#X msg 311 106 1 2.5 3; +#X msg 311 78 1 test 3; +#X obj 35 58 sprintf %c; +#X msg 35 30 129; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 0 0; +#X connect 11 0 0 0; +#X connect 12 0 11 0; diff --git a/externals/miXed/test/cyclone/spike-test.pd b/externals/miXed/test/cyclone/spike-test.pd new file mode 100644 index 000000000..4fb168c76 --- /dev/null +++ b/externals/miXed/test/cyclone/spike-test.pd @@ -0,0 +1,23 @@ +#N canvas 442 260 450 300 12; +#X obj 59 186 spike~; +#X obj 59 225 print; +#X obj 59 75 phasor~ 1; +#X floatatom 59 38 5 0 0 0 - - -; +#X floatatom 131 149 5 0 0 0 - - -; +#X floatatom 133 225 10 0 0 0 - - -; +#X obj 59 112 change~; +#X obj 59 149 +~ 1; +#X obj 239 186 spike~; +#X floatatom 311 149 5 0 0 0 - - -; +#X floatatom 313 225 10 0 0 0 - - -; +#X obj 239 149 -~ 1; +#X connect 0 0 5 0; +#X connect 2 0 6 0; +#X connect 3 0 2 0; +#X connect 4 0 0 1; +#X connect 6 0 7 0; +#X connect 6 0 11 0; +#X connect 7 0 0 0; +#X connect 8 0 10 0; +#X connect 9 0 8 1; +#X connect 11 0 8 0; diff --git a/externals/miXed/test/cyclone/split-test.pd b/externals/miXed/test/cyclone/split-test.pd new file mode 100644 index 000000000..860faa8f9 --- /dev/null +++ b/externals/miXed/test/cyclone/split-test.pd @@ -0,0 +1,48 @@ +#N canvas 300 45 610 348 12; +#X obj 176 212 split; +#X msg 99 95 1.5 1 2; +#X floatatom 176 252 5 0 0; +#X floatatom 279 252 5 0 0; +#X obj 176 295 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 279 295 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 176 36 5 0 0; +#X floatatom 196 68 5 0 0; +#X floatatom 216 101 5 0 0; +#X msg 313 89 test; +#X msg 313 121 list test; +#X msg 313 57 1.5 test; +#X msg 36 68 1.5 1.5 2; +#X msg 36 142 2.5 1.5 2.4; +#X floatatom 433 222 5 0 0; +#X floatatom 536 222 5 0 0; +#X obj 433 265 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 536 265 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 433 142 5 0 0; +#X obj 433 101 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 313 153 3.5; +#X obj 433 182 split 3.5; +#X connect 0 0 2 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 2 0 4 0; +#X connect 3 0 5 0; +#X connect 6 0 0 0; +#X connect 7 0 0 1; +#X connect 8 0 0 2; +#X connect 9 0 0 0; +#X connect 10 0 0 0; +#X connect 11 0 0 0; +#X connect 12 0 0 0; +#X connect 13 0 0 0; +#X connect 14 0 16 0; +#X connect 15 0 17 0; +#X connect 18 0 21 0; +#X connect 19 0 18 0; +#X connect 20 0 0 1; +#X connect 21 0 14 0; +#X connect 21 1 15 0; diff --git a/externals/miXed/test/cyclone/spray-test.pd b/externals/miXed/test/cyclone/spray-test.pd new file mode 100644 index 000000000..5c2cbd155 --- /dev/null +++ b/externals/miXed/test/cyclone/spray-test.pd @@ -0,0 +1,82 @@ +#N canvas 210 202 708 466 12; +#X obj 75 243 spray; +#X obj 75 324 print a; +#X obj 115 284 print b; +#X obj 221 332 spray 5; +#X obj 235 374 print; +#X obj 221 405 print first; +#X obj 465 370 print; +#X obj 451 401 print first; +#X obj 451 328 spray 5 -3; +#X msg 451 110 \$1 1 2 3 4 5; +#X msg 470 136 \$1 1 2 3 4; +#X msg 484 163 \$1 1 2 3; +#X msg 497 190 \$1 1 2; +#X msg 504 216 \$1 1; +#X msg 513 240 \$1 test 2 3 4 5; +#X msg 517 269 \$1 1 test 3 4 5; +#X msg 221 114 \$1 1 2 3 4 5; +#X msg 240 141 \$1 1 2 3 4; +#X msg 254 167 \$1 1 2 3; +#X msg 266 194 \$1 1 2; +#X msg 274 220 \$1 1; +#X msg 283 244 \$1 test 2 3 4 5; +#X msg 287 273 \$1 1 test 3 4 5; +#X msg 75 110 \$1 1 2 3 4 5; +#X msg 94 136 \$1 1 2 3 4; +#X msg 108 163 \$1 1 2 3; +#X msg 120 190 \$1 1 2; +#X msg 128 216 \$1 1; +#X floatatom 130 61 5 0 0; +#X floatatom 250 62 5 0 0; +#X floatatom 487 58 5 0 0; +#X connect 0 0 1 0; +#X connect 0 1 2 0; +#X connect 3 0 5 0; +#X connect 3 1 4 0; +#X connect 3 2 4 0; +#X connect 3 3 4 0; +#X connect 3 4 4 0; +#X connect 8 0 7 0; +#X connect 8 1 6 0; +#X connect 8 2 6 0; +#X connect 8 3 6 0; +#X connect 8 4 6 0; +#X connect 9 0 8 0; +#X connect 10 0 8 0; +#X connect 11 0 8 0; +#X connect 12 0 8 0; +#X connect 13 0 8 0; +#X connect 14 0 8 0; +#X connect 15 0 8 0; +#X connect 16 0 3 0; +#X connect 17 0 3 0; +#X connect 18 0 3 0; +#X connect 19 0 3 0; +#X connect 20 0 3 0; +#X connect 21 0 3 0; +#X connect 22 0 3 0; +#X connect 23 0 0 0; +#X connect 24 0 0 0; +#X connect 25 0 0 0; +#X connect 26 0 0 0; +#X connect 27 0 0 0; +#X connect 28 0 23 0; +#X connect 28 0 24 0; +#X connect 28 0 25 0; +#X connect 28 0 26 0; +#X connect 28 0 27 0; +#X connect 29 0 16 0; +#X connect 29 0 17 0; +#X connect 29 0 18 0; +#X connect 29 0 19 0; +#X connect 29 0 20 0; +#X connect 29 0 21 0; +#X connect 29 0 22 0; +#X connect 30 0 9 0; +#X connect 30 0 10 0; +#X connect 30 0 11 0; +#X connect 30 0 12 0; +#X connect 30 0 13 0; +#X connect 30 0 14 0; +#X connect 30 0 15 0; diff --git a/externals/miXed/test/cyclone/substitute-test.pd b/externals/miXed/test/cyclone/substitute-test.pd new file mode 100644 index 000000000..37e1a952c --- /dev/null +++ b/externals/miXed/test/cyclone/substitute-test.pd @@ -0,0 +1,56 @@ +#N canvas 179 48 593 501 12; +#X obj 281 458 substitute; +#X msg 281 418 1 2 3; +#X obj 180 342 print replaced; +#X obj 398 347 print unchanged; +#X obj 180 314 substitute foo bar; +#X msg 28 73 bang; +#X msg 61 102 set bang; +#X msg 180 30 hello foo boo; +#X msg 147 102 set bang; +#X msg 252 102 one; +#X msg 148 149 foo 34; +#X msg 253 137 1 2 3 4; +#X msg 302 102 one two three; +#X msg 334 137 1 2 foo 4; +#X msg 438 102 foo foo foo 77; +#X msg 337 172 foo fum; +#X msg 427 172 1 otherhit; +#X msg 427 200 set 1 hithere; +#X msg 428 236 set; +#X msg 218 73 bang; +#X msg 39 259 symbol sym; +#X msg 428 264 symbol test; +#X msg 255 381 bang; +#X msg 341 381 bang; +#X msg 256 172 1; +#X msg 366 418 1 2; +#X msg 426 418 2 3; +#X connect 0 0 2 0; +#X connect 0 0 26 0; +#X connect 0 1 3 0; +#X connect 1 0 0 0; +#X connect 4 0 2 0; +#X connect 4 1 3 0; +#X connect 5 0 4 0; +#X connect 6 0 4 0; +#X connect 7 0 4 0; +#X connect 8 0 4 1; +#X connect 9 0 4 0; +#X connect 10 0 4 0; +#X connect 11 0 4 0; +#X connect 12 0 4 1; +#X connect 13 0 4 0; +#X connect 14 0 4 0; +#X connect 15 0 4 1; +#X connect 16 0 4 1; +#X connect 17 0 4 1; +#X connect 18 0 4 1; +#X connect 19 0 4 1; +#X connect 20 0 4 0; +#X connect 21 0 4 1; +#X connect 22 0 0 0; +#X connect 23 0 0 1; +#X connect 24 0 4 0; +#X connect 25 0 0 1; +#X connect 26 0 0 1; diff --git a/externals/miXed/test/cyclone/svf-test.pd b/externals/miXed/test/cyclone/svf-test.pd new file mode 100644 index 000000000..d110efe58 --- /dev/null +++ b/externals/miXed/test/cyclone/svf-test.pd @@ -0,0 +1,81 @@ +#N canvas 197 96 582 543 12; +#X obj 38 21 noise~; +#X obj 77 504 dac~; +#X floatatom 307 110 5 0 0 0 - - -; +#X obj 390 142 *~ 10; +#X obj 390 176 +~ 0; +#X floatatom 478 110 5 0 0 0 - - -; +#X floatatom 390 78 5 0 0 0 - - -; +#X obj 53 277 a-mix2; +#X obj 37 85 a-mix2; +#X obj 348 21 loadbang; +#X msg 478 50 0; +#X msg 307 78 1000; +#X obj 390 110 osc~ 4; +#X msg 521 50 1000; +#X msg 242 78 5000; +#X msg 353 50 13; +#X msg 396 50 4; +#X floatatom 246 176 5 0 0 0 - - -; +#X obj 53 245 *~ 0.25; +#X obj 139 245 *~ 0.25; +#X msg 521 85 4000; +#X floatatom 410 250 5 0 0 0 - - -; +#X obj 215 212 svf~; +#X obj 235 277 a-mix2; +#X obj 235 245 *~ 0.25; +#X obj 321 245 *~ 0.25; +#X obj 91 391 a-mix2; +#N canvas 217 47 350 257 pulse 0; +#X obj 144 176 train~ 10 0.1; +#X obj 145 21 inlet; +#X obj 144 206 outlet~; +#X obj 144 146 /; +#X obj 145 51 t b 0; +#X msg 123 96 1000; +#X connect 0 0 2 0; +#X connect 1 0 4 0; +#X connect 3 0 0 0; +#X connect 4 0 5 0; +#X connect 4 1 3 1; +#X connect 5 0 3 0; +#X restore 133 50 pd pulse; +#X floatatom 133 21 5 0 0 0 - - -; +#X msg 435 50 689; +#X connect 0 0 8 0; +#X connect 2 0 4 1; +#X connect 3 0 4 0; +#X connect 4 0 22 1; +#X connect 5 0 3 1; +#X connect 6 0 12 0; +#X connect 7 0 26 0; +#X connect 8 0 22 0; +#X connect 9 0 11 0; +#X connect 9 0 10 0; +#X connect 10 0 5 0; +#X connect 11 0 2 0; +#X connect 12 0 3 0; +#X connect 13 0 5 0; +#X connect 14 0 2 0; +#X connect 15 0 6 0; +#X connect 16 0 6 0; +#X connect 17 0 22 2; +#X connect 18 0 7 0; +#X connect 19 0 7 1; +#X connect 20 0 5 0; +#X connect 21 0 19 1; +#X connect 21 0 18 1; +#X connect 21 0 24 1; +#X connect 21 0 25 1; +#X connect 22 0 18 0; +#X connect 22 1 19 0; +#X connect 22 2 24 0; +#X connect 22 3 25 0; +#X connect 23 0 26 1; +#X connect 24 0 23 0; +#X connect 25 0 23 1; +#X connect 26 0 1 0; +#X connect 26 0 1 1; +#X connect 27 0 8 1; +#X connect 28 0 27 0; +#X connect 29 0 6 0; diff --git a/externals/miXed/test/cyclone/switch-test.pd b/externals/miXed/test/cyclone/switch-test.pd new file mode 100644 index 000000000..ec7fe2f11 --- /dev/null +++ b/externals/miXed/test/cyclone/switch-test.pd @@ -0,0 +1,35 @@ +#N canvas 333 279 593 442 12; +#X obj 123 227 switch 11 1 padding; +#X msg 138 50 bang; +#X msg 153 87 2; +#X msg 168 122 symbol three; +#X msg 183 155 1 2 3 4; +#X msg 198 190 five is anything; +#X msg 72 155 bang; +#X obj 72 190 grab; +#X floatatom 72 318 5 0 0; +#X floatatom 68 50 5 0 0; +#X obj 167 282 route bang float symbol list; +#X obj 167 322 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 228 318 5 0 0; +#X symbolatom 290 318 10 0 0; +#X obj 352 355 print list; +#X obj 414 318 print anything; +#X msg 289 50 last is anything too; +#X connect 0 0 10 0; +#X connect 1 0 0 1; +#X connect 2 0 0 2; +#X connect 3 0 0 3; +#X connect 4 0 0 4; +#X connect 5 0 0 5; +#X connect 6 0 7 0; +#X connect 7 0 8 0; +#X connect 7 1 0 0; +#X connect 9 0 0 0; +#X connect 10 0 11 0; +#X connect 10 1 12 0; +#X connect 10 2 13 0; +#X connect 10 3 14 0; +#X connect 10 4 15 0; +#X connect 16 0 0 11; diff --git a/externals/miXed/test/cyclone/test.capture b/externals/miXed/test/cyclone/test.capture new file mode 100644 index 000000000..238343ab7 --- /dev/null +++ b/externals/miXed/test/cyclone/test.capture @@ -0,0 +1,2 @@ +ffffffff fffffffe fffffffd fffffffc fffffffb fffffffa fffffff9 fffffff8 fffffff7 +fffffff6 diff --git a/externals/miXed/test/cyclone/test.funbuff b/externals/miXed/test/cyclone/test.funbuff new file mode 100644 index 000000000..2c89038dd --- /dev/null +++ b/externals/miXed/test/cyclone/test.funbuff @@ -0,0 +1,10 @@ +funbuff 0 -0 1 -1 2 -2 3 -3 4 -4 5 -5 6 -6 7 -7 8 -8 9 -9 10 -10 11 +-11 12 -12 13 -13 14 -14 15 -15 16 -16 17 -17 18 -18 19 -19 20 -20 +21 -21 22 -22 23 -23 24 -24 25 -25 26 -26 27 -27 28 -28 29 -29 30 -30 +31 -31 32 -32 33 -33 34 -34 35 -35 36 -36 37 -37 38 -38 39 -39 40 -40 +41 -41 42 -42 43 -43 44 -44 45 -45 46 -46 47 -47 48 -48 49 -49 50 -50 +51 -51 52 -52 53 -53 54 -54 55 -55 56 -56 57 -57 58 -58 59 -59 60 -60 +61 -61 62 -62 63 -63 64 -64 65 -65 66 -66 67 -67 68 -68 69 -69 70 -70 +71 -71 72 -72 73 -73 74 -74 75 -75 76 -76 77 -77 78 -78 79 -79 80 -80 +81 -81 82 -82 83 -83 84 -84 85 -85 86 -86 87 -87 88 -88 89 -89 90 -90 +91 -91 92 -92 93 -93 94 -94 95 -95 96 -96 97 -97 98 -98 99 -99 \ No newline at end of file diff --git a/externals/miXed/test/cyclone/test.mid b/externals/miXed/test/cyclone/test.mid new file mode 100644 index 0000000000000000000000000000000000000000..9547e79a1546126e9a5843f2aa6ba22c21b35935 GIT binary patch literal 4855 zcmXY!+ioMr5r%6Hq(mt|fFJ>OAy_N%G~!tlb)=3IMJ`2=nvs^U2VQ1@#4!-SS8;N; zL4YCo0zKUi6gzp5Jc;u)*B1gYUDeff{Oi|r_Se6NNR~fG{ym-j_=Cvr{wKe9xxat^ zx5hty{L^<o$WK3b>V240ALEVWy?n36v6nnb@&`5flugD`R^xdlnaHbp3^)0HtHx0V zg&n?qzVm7jZSp-)_mgZgkZ&-SOYY^Px{J3l_{w=Mxsw;wk37y>ed(zF<T&X|P4%Y} zet)a(2j9J4OFyd1FvG2He*UwUPC`*vJa#Do$GPN63Vd(yT~-%3b0u%n=Xhf=5m()C zeu4Zl@{=2BsJqBZ!`MOBSv(U>`tm8e2xSvbcGGa~;+?m6kqO_~^f}yAH?bgpn}$(_ z3p<?oeCN|~w8{5AhPN>ME`2|7)!EvxyBJGJof7?-RMyTO$C>0*yv2JQJc>7yW2vY^ z92ua0Bsm;?<$i84ke756Sv^mkpm!+w#Yj5oXmZSNMIFzbbTrK-Co<&Q!_Id4ez2jA z<9Rw+->a%40$tmW-SjTB_C4&E)KTbRudd3G{AcXxmr&AP^hJCp0jjx0PYRrEEbhox zC34dnu9U^+{H^{FZ!BNLP5Y6k1MXEMv$#S3F7g+BX{3Y5)3ey&uBb*N%MY@V9LPT# zvaK3%Mt}V&yPU};5pE^xvuH!l<}MlVmS4-RI-Gf&SCD7*htN^2IE%NE_G97RTRn?1 znA}0;^ZgYrcu7k{htVeI`?#@%8}IaF;-*(?H{4|?rSy_2T}fpf?nUgVGS$5l!8La| zk#c$#Z!RvV(h2U5xpyWx!hBW5NU-JG@RwtG(bLF7-&6UCq+RZuh?5j$Z#gC0BK@AH zwaT&RDLq}38t0YtV(#eaG`r}^kZ+H7w)JG-s^YVsUc@f81680)ic&0KW`9Ig*3VSa zGqSpND|YpObTnwfGx2cEPxfUmJqtZtsHe3^{#*9Un1QJA`Y^H)c*_A1Hl)ne+;S)d z&NnzKq|M0Heatn{s}b1{y_&o+lXzn_7FUlVNgK$TMB11+%Rcg^<n<u(mm_KDapak4 z>{$EhQ6#GgZXbaL4Ut7dKGSQmpr7eMH$93oCj69LO=Xh|=8!pGWFfL>!%XKc8TVEp zb9XWmbux32+lCC#&l)@A$8$-K<1C?y9>sz!q4(dIX_VpZ9dvxoc5Hg+c?aLU#j%JP zMVrX?@p}uu-<iS0)xEXf?rJ0@eMi^yq+;`?Z(=7UcjV7q(!9iBbLXrE<nJopT;9+< zUE=O@|4MS?={2oHf=ypl=3?`>>f?7!LNkm!?uiPBKbVNVjeQ2iUv`PTB70VUMb6U- z9TV_Yz)aU7-@b2#6BpeqdNp)PsuFwpX6~5b)W^27yaiDYfZ~emAouWV+YAQ6JiBS- z*|8l>EH3^8=>c6|k>UYQl}EJ4+O4X-qKwQejhE5g*flqyLz#rIJi_u9W!ckLp@+M5 zeHh74bx-wyi9@`*jcoMZ>SkTxGFNk}TPbk9!C66fBG+7Du7lno8M#I8P~NBk9{0sH zJ?7~MSx3C|Xy&Z0kar|+ZX$oxlZIgjsA23_`}!;r_JyQpATu4cJd)3JwJe!U2E)~7 zaYl{kx}j{6`5ZFmi!4MIZK&bgrCMGxl3m@MF|RWhxt)vv{j3@g)5To$MVuv6!H$?7 z1J=dgA!}toM-8aZ5VR*f45EYY-tvOV_L$d!?Bn+qe!o*U6W4Ute!EFeO6G#j>rz$n zX4nRr+>t+b#a-gC)8Vi!$_8{_u^mi@xWTK{2@}!>cW&sKCLPh7i_Ige%ps4Vx&`mZ zO<E`Z`b5lm>@%hQszdBe00I4koa-jrsm@z<@aHh{)h+gTAKff^HFQd8Gxp5c+)=kv zAKT9AoNd-%T{dM0xrbld>SiE-i>sT@4in)Li;F*jZZJ7bDKaFwHljV&ZdJ_*WjvDt z&6hEqm_-;mlt~E7BP@SelRa}1dbnFR4A0N^UOHmF&*_Sjb@U#)(pI?4)m(DU0y<}L zW6}_@I>Fp|<gAz_WU>SU(lH*7SnyqDv4*TJo<5s7;DaoQNCBZq7gWAt&pxqdv2SQ< zcC+X!wh`Z}ntZ0KWpyYyhQl?7aVDM8bx-gCW*wRHMHV89Hqs~f!4(^1D!ZmLW4>oD zayuCT`q^}iCv!1Jah6a;b?Kfb{JF*7C-}pdjv7;;CpH=BVHh2J_f~X9I%H<Y@QE|{ zL>E5Mhfj3Ye!B~c2S;>XhpO7V9mbBSfcGbC5$+O)&7H#rEUV_4H&j%exWPQ|J4c>g zu_q>oeBA+q$RkVLA&+7D0A_;ox=o(jOnPbJGo^k~C-wk9K!5Q-?gBP%o3~2fA>~dV zuveigI+8`NhE7R$Vox2yQ68o~ww<KS?l^)tbYus)<saK=e?Ui)>)_d8B3xo|@h324 zCMS?$nWu^)+GFijl~v_)tw8f-R2@nK$WSJ`mOR4pS1e)Ggs0S@HhHMccb=Xy-`8|S za~-|M{<jq_b2YcPW(!_JaV%vlft+2;wV^Y4GIEVxQ{LzhkEc+bTc}PESxG!|ICH=U zSrJhRj4p1WJUuu=1ZTiLbV=YFVot!N;`+VMG$LS~V>VpCJfmM}x(Eu?V~N=0tYslG zs89qI>OqBGp+fZ;<2|#>z`{a+epZJTPUdz=Wr<YMTbd{0nRDEYphh7L6;hyxrAT&| zMF-bC7Ki93MmB^ZT|tp<p-3Yr()rqLcliVyoY8pa6xF7UVN`jVpb2C!Aisv<utdvg zXH9!5X`8TtYT!FZnqJi&Lp*{i<q5w&x1_=$jiG)7GDn<MiGLT`bQ=2%slR9w`yO~u z2jU({-5yZ8ODt93kZRla_2a}vH;Y~kosy}?UU~wZdYt;$b{40sjvAz;E<4CA7uwdN z0S(Dpd(RF7;S!6BPl0;J;Ot599Z!7)#j;FpBvm$*&$R-*mr2{utRB3GnIbHYu>9mJ zP_+ZiYD2REXjaQJLq;#ayL%{-RqL%QT;^(SdCwBOhh|w0O~m>Zb5-;L(C;3-0NOIb z;~{JM0h(1oR)uC&pjiNSQe{+n?B@q)7Bs><LN~AvWfLfis3wh7VS!YjSxtT!Yi7d* z%roW*n)L|H8nQ%ecGfazRuh`_2+bNov!0+?ZD>{-nuQK}0s2|9h7)MkAvBBe)(><K zRbh1Bm`7;Vh>jXTv+O^1q=#8_@ZDo^h<RXSN6@SuH0uGH)q`eTul;sc77niHylbjT z-ryTfO76&?Yay37>~uIR(Xu{=X0bH&DRJL&|C|XK0$C-7xChND0YT&uQsI!t(A)!= z<OcHWrUe$<B{Zu<o==Ir1RkKjBIjv|&VpGl3M^!x&%ST&p;;wpRtcJQ53H7;SzTz> zJv1u-5-(XDMMz5tnsrZ&yU?s2G%L?rC1_TW`oW#>CrFD-PDzT)dzy!4S@zeHDx1nO zz5>mc(WlTXForVOt>h7wzsQ5C=g_QEXjUD!>bP|YH?ndthVqoTlUrS~{Vw5G*wQT! z^Bg-Z^cW&!!k#Y}a1OrUEL-rZCcKL6xM(pPT^8~+yy}(`ViSG_H)FHWI_&Syw6B25 zIi|n`wSP})bDUXz#u+@S6XhsHUZ29BPT^0;kO$~x8AQ8zviL9Nnu$4;Z*6=`lY=iF z$Y10AE#A+YQ?`3o4gkT;)u~h=2aYCQVs-&H>x+#yFm3n{+s(A_yDf8FB`;L~0uUh1 z4=`F+AFy$b;XPI2Z{cf|39SMORW>SAcX_~eB%j!K(a9ozNvm+3&fMB?R>xp>1=diN zUEcZ)Q|;<1{H6lGfwb^epewX&Rf=?{4n{|;21~IDR6Ao@bV`TmXftUnM$?ARwBR!( zo@^6ln-1*Azsv#O#}E?Rk!>lmbe+`!<fKCykL4qT1~S7gpad+u&y-!ju^esVf^)lk zTQb8pq@y0yTkwoacm@$5YSOG0p0hkHH0!t4CA!Vw84qYo&P@q~YBTZtgTWigr77T0 zi;<x1ap(ga&NcgN`4*eIKrgmv{{qVcQn%V?3<(+|?yvF}-HNwtAiBw3Y)Ortbxnco z-INSA1Cyt=1u0tm-y3}-jXC1jT<yu%ri!C=Nj%etvTJ~^6G=n<XxczlT|T$bZAW|L zZi{>#9?xv`n^bI*YJH0tA^ph>cI@s*?##j5+W7!m*dVFp^>>-Rsbc>?Vsj90At&iT S?E!sQA}fI;rzMeJTJnG0R-h38 literal 0 HcmV?d00001 diff --git a/externals/miXed/test/cyclone/test.pool b/externals/miXed/test/cyclone/test.pool new file mode 100644 index 000000000..22c43be22 --- /dev/null +++ b/externals/miXed/test/cyclone/test.pool @@ -0,0 +1,2 @@ +sample /mnt/win_d/III_rok/Janek/krotkie/niskie_smyki.wav +sample /mnt/win_d/III_rok/Janek/krotkie/wysokie_smyki.wav diff --git a/externals/miXed/test/cyclone/test.seq b/externals/miXed/test/cyclone/test.seq new file mode 100644 index 000000000..88b165764 --- /dev/null +++ b/externals/miXed/test/cyclone/test.seq @@ -0,0 +1,1208 @@ +0 193 107; +10 145 71 79; +455 145 73 88; +475 129 71 0; +739 145 74 88; +748 129 73 0; +1138 145 76 94; +1154 129 74 0; +1255 145 74 92; +1270 129 76 0; +1486 145 73 79; +1508 129 74 0; +1574 145 74 80; +1589 129 73 0; +1660 145 73 79; +1673 129 74 0; +1762 145 69 80; +1784 129 73 0; +1984 145 66 76; +2002 129 69 0; +2231 145 71 79; +2257 129 66 0; +2496 145 64 88; +2525 129 71 0; +2739 145 66 76; +2763 129 64 0; +2976 145 67 80; +2985 129 66 0; +3108 129 67 0; +3243 145 67 76; +3381 129 67 0; +3494 145 67 77; +3694 129 67 0; +3734 145 66 69; +3994 145 71 80; +4004 129 66 0; +4242 145 59 79; +4256 129 71 0; +4483 194 98; +4493 146 76 79; +4494 145 60 80; +4509 129 59 0; +4611 145 59 79; +4635 129 60 0; +4727 145 60 80; +4746 129 59 0; +4846 145 57 79; +4868 129 60 0; +4934 146 78 88; +4954 130 76 0; +4961 145 62 80; +4981 129 57 0; +5074 145 59 80; +5085 129 62 0; +5204 145 64 80; +5214 146 79 88; +5219 129 59 0; +5222 130 78 0; +5612 146 81 94; +5628 130 79 0; +5650 129 64 0; +5729 146 79 92; +5735 145 64 88; +5744 130 81 0; +5943 129 64 0; +5959 146 78 79; +5981 145 62 88; +5981 130 79 0; +6047 146 79 80; +6062 130 78 0; +6133 146 78 79; +6146 130 79 0; +6235 146 74 80; +6257 130 78 0; +6345 145 59 80; +6373 129 62 0; +6456 146 71 76; +6462 145 55 88; +6465 129 59 0; +6472 130 74 0; +6570 145 54 80; +6592 129 55 0; +6700 146 76 79; +6702 145 52 88; +6716 129 54 0; +6725 130 71 0; +6825 145 50 88; +6847 129 52 0; +6955 145 48 80; +6964 146 69 88; +6967 129 50 0; +6993 130 76 0; +7207 146 71 76; +7231 130 69 0; +7444 146 72 80; +7453 130 71 0; +7462 145 53 88; +7485 129 48 0; +7576 130 72 0; +7711 146 72 76; +7849 130 72 0; +7957 145 52 92; +7962 146 72 77; +7978 129 53 0; +8161 130 72 0; +8170 129 52 0; +8201 146 71 69; +8220 145 52 88; +8460 146 76 80; +8470 130 71 0; +8580 145 50 80; +8593 129 52 0; +8701 145 48 88; +8707 146 64 79; +8712 129 50 0; +8721 130 76 0; +8819 145 50 79; +8829 129 48 0; +8946 145 38 80; +8947 195 74; +8957 147 81 79; +8958 146 65 80; +8963 129 50 0; +8973 130 64 0; +9075 146 64 79; +9099 130 65 0; +9191 146 65 80; +9210 130 64 0; +9303 145 41 80; +9309 146 62 79; +9319 129 38 0; +9330 130 65 0; +9396 147 83 88; +9416 131 81 0; +9423 146 67 80; +9425 145 40 80; +9428 129 41 0; +9442 130 62 0; +9535 146 64 80; +9546 130 67 0; +9665 146 69 80; +9675 147 84 88; +9680 130 64 0; +9681 145 45 80; +9683 131 83 0; +9702 129 40 0; +10026 129 45 0; +10057 145 45 88; +10072 147 86 94; +10088 131 84 0; +10110 130 69 0; +10138 129 45 0; +10169 145 45 80; +10188 147 84 92; +10194 146 69 88; +10203 131 86 0; +10283 145 48 84; +10293 129 45 0; +10401 130 69 0; +10417 147 83 79; +10420 145 47 88; +10436 129 48 0; +10437 146 67 88; +10437 131 84 0; +10503 147 84 80; +10518 131 83 0; +10589 147 83 79; +10602 131 84 0; +10680 145 40 80; +10689 129 47 0; +10691 147 79 80; +10713 131 83 0; +10801 146 64 80; +10829 130 67 0; +10912 147 76 76; +10918 146 60 88; +10921 130 64 0; +10928 131 79 0; +11026 146 59 80; +11048 130 60 0; +11156 147 81 79; +11158 146 57 88; +11163 145 38 88; +11172 130 59 0; +11174 129 40 0; +11180 131 76 0; +11280 146 55 88; +11302 130 57 0; +11410 146 53 80; +11419 147 74 88; +11422 130 55 0; +11448 131 81 0; +11662 145 36 80; +11662 147 76 76; +11673 129 38 0; +11686 131 74 0; +11899 147 77 80; +11908 131 76 0; +11917 145 34 76; +11917 146 58 88; +11940 130 53 0; +11945 129 36 0; +12030 131 77 0; +12032 145 36 79; +12045 129 34 0; +12164 145 38 88; +12164 147 77 76; +12188 129 36 0; +12301 131 77 0; +12409 146 57 92; +12414 147 77 77; +12430 130 58 0; +12613 131 77 0; +12622 130 57 0; +12653 147 76 69; +12660 145 36 78; +12671 146 57 88; +12678 129 38 0; +12782 145 35 80; +12804 129 36 0; +12900 129 35 0; +12900 145 33 72; +12910 147 81 80; +12920 131 76 0; +13030 146 55 80; +13043 130 57 0; +13151 146 53 88; +13157 147 69 79; +13160 145 45 88; +13161 130 55 0; +13170 131 81 0; +13183 129 33 0; +13268 146 55 79; +13278 130 53 0; +13395 146 43 80; +13396 196 38; +13406 148 74 79; +13407 145 43 88; +13407 147 70 80; +13412 130 55 0; +13422 131 69 0; +13424 129 45 0; +13524 147 69 79; +13548 131 70 0; +13640 147 70 80; +13659 131 69 0; +13752 146 46 80; +13758 147 67 79; +13763 145 46 80; +13768 130 43 0; +13779 131 70 0; +13780 129 43 0; +13845 148 76 88; +13865 132 74 0; +13872 147 72 80; +13874 146 45 80; +13877 130 46 0; +13886 145 45 84; +13891 131 67 0; +13893 129 46 0; +13984 147 69 80; +13995 131 72 0; +14114 147 74 80; +14124 148 77 88; +14129 131 69 0; +14130 146 50 80; +14132 132 76 0; +14134 145 50 94; +14150 129 45 0; +14150 130 45 0; +14472 129 50 0; +14473 130 50 0; +14497 145 50 80; +14503 146 50 88; +14518 148 79 94; +14534 132 77 0; +14556 131 74 0; +14580 129 50 0; +14583 130 50 0; +14607 145 50 79; +14613 146 50 80; +14632 148 77 92; +14638 147 74 88; +14647 132 79 0; +14727 146 53 84; +14729 145 53 84; +14736 130 50 0; +14741 129 50 0; +14843 131 74 0; +14859 148 76 79; +14860 145 52 92; +14862 146 52 88; +14878 130 53 0; +14879 147 72 88; +14879 132 77 0; +14880 129 53 0; +14945 148 77 80; +14960 132 76 0; +15031 148 76 79; +15044 132 77 0; +15115 145 45 88; +15117 129 52 0; +15120 146 45 80; +15129 130 52 0; +15131 148 72 80; +15153 132 76 0; +15241 147 69 80; +15269 131 72 0; +15352 148 69 76; +15358 147 65 88; +15361 131 69 0; +15368 132 72 0; +15466 147 64 80; +15488 131 65 0; +15596 148 74 79; +15598 147 62 88; +15603 146 43 88; +15605 145 43 88; +15611 131 64 0; +15613 130 45 0; +15615 129 45 0; +15618 132 69 0; +15718 147 60 88; +15740 131 62 0; +15848 147 58 80; +15857 148 67 88; +15860 131 60 0; +15886 132 74 0; +16100 146 41 80; +16100 148 69 76; +16111 145 41 92; +16111 130 43 0; +16124 132 67 0; +16129 129 43 0; +16337 148 70 80; +16346 132 69 0; +16347 145 39 80; +16354 146 39 76; +16354 147 63 88; +16365 129 41 0; +16376 131 58 0; +16381 130 41 0; +16465 145 41 92; +16466 132 70 0; +16468 146 41 79; +16481 129 39 0; +16481 130 39 0; +16589 145 43 80; +16600 146 43 88; +16600 148 70 76; +16606 129 41 0; +16624 130 41 0; +16737 132 70 0; +16835 145 41 88; +16844 147 62 92; +16849 148 70 77; +16862 129 43 0; +16865 131 63 0; +16956 145 40 88; +16976 129 41 0; +17047 132 70 0; +17056 131 62 0; +17087 148 69 69; +17088 145 38 80; +17094 146 41 78; +17097 129 40 0; +17104 147 62 88; +17111 130 43 0; +17215 146 40 80; +17237 130 41 0; +17333 130 40 0; +17333 146 38 72; +17343 148 74 80; +17353 132 69 0; +17463 147 60 80; +17476 131 62 0; +17569 129 38 0; +17583 147 58 88; +17589 148 62 79; +17592 146 50 88; +17593 131 60 0; +17602 132 74 0; +17615 130 38 0; +17700 147 60 79; +17710 131 58 0; +17827 147 48 80; +17828 193 44; +17838 145 67 79; +17839 146 48 88; +17839 148 63 80; +17844 131 60 0; +17854 132 62 0; +17856 130 50 0; +17956 148 62 79; +17980 132 63 0; +18072 148 63 80; +18091 132 62 0; +18184 147 51 80; +18190 148 60 79; +18195 146 51 80; +18200 131 48 0; +18211 132 63 0; +18212 130 48 0; +18277 145 69 88; +18297 129 67 0; +18304 148 65 80; +18306 147 50 80; +18309 131 51 0; +18318 146 50 84; +18323 132 60 0; +18325 130 51 0; +18416 148 62 80; +18427 132 65 0; +18546 148 67 80; +18556 145 70 88; +18561 132 62 0; +18562 147 55 80; +18564 129 69 0; +18566 146 55 94; +18582 130 50 0; +18582 131 50 0; +18904 130 55 0; +18905 131 55 0; +18929 146 55 80; +18935 147 55 88; +18950 145 72 94; +18966 129 70 0; +18988 132 67 0; +19012 130 55 0; +19015 131 55 0; +19039 146 55 79; +19045 147 55 80; +19064 145 70 92; +19070 148 67 88; +19079 129 72 0; +19159 147 58 84; +19161 146 58 84; +19168 131 55 0; +19173 130 55 0; +19275 132 67 0; +19291 145 69 79; +19292 146 57 92; +19294 147 57 88; +19310 131 58 0; +19311 129 70 0; +19311 148 65 88; +19312 130 58 0; +19377 145 70 80; +19392 129 69 0; +19463 145 69 79; +19476 129 70 0; +19547 146 50 88; +19549 130 57 0; +19552 147 50 80; +19561 131 57 0; +19563 145 65 80; +19585 129 69 0; +19673 148 62 80; +19701 132 65 0; +19784 145 62 76; +19790 148 58 88; +19793 132 62 0; +19800 129 65 0; +19898 148 57 80; +19920 132 58 0; +20028 145 67 79; +20030 148 55 88; +20035 147 48 88; +20037 146 48 88; +20043 132 57 0; +20045 131 50 0; +20047 130 50 0; +20050 129 62 0; +20150 148 53 88; +20172 132 55 0; +20280 148 51 80; +20289 145 60 88; +20292 132 53 0; +20318 129 67 0; +20532 145 62 76; +20532 147 46 80; +20543 146 46 92; +20543 131 48 0; +20556 129 60 0; +20561 130 48 0; +20769 145 63 80; +20778 129 62 0; +20779 146 44 80; +20786 147 44 76; +20786 148 56 88; +20797 130 46 0; +20808 132 51 0; +20813 131 46 0; +20897 146 46 92; +20898 129 63 0; +20900 147 46 79; +20913 130 44 0; +20913 131 44 0; +21021 146 48 80; +21032 145 63 76; +21032 147 48 88; +21038 130 46 0; +21056 131 46 0; +21169 129 63 0; +21267 146 46 88; +21276 148 55 92; +21281 145 63 77; +21294 130 48 0; +21297 132 56 0; +21388 146 45 88; +21408 130 46 0; +21479 129 63 0; +21488 132 55 0; +21519 145 62 69; +21520 146 43 80; +21526 147 46 78; +21529 130 45 0; +21536 148 55 88; +21543 131 48 0; +21647 147 45 80; +21669 131 46 0; +21765 131 45 0; +21765 147 43 72; +21775 145 67 80; +21785 129 62 0; +21895 148 53 80; +21908 132 55 0; +22001 130 43 0; +22015 148 51 88; +22021 145 55 79; +22024 147 55 88; +22025 132 53 0; +22034 129 67 0; +22047 131 43 0; +22132 148 53 79; +22142 132 51 0; +22259 148 41 80; +22260 194 66; +22270 146 72 79; +22271 145 56 80; +22271 147 53 88; +22276 132 53 0; +22286 129 55 0; +22288 131 55 0; +22388 145 55 79; +22412 129 56 0; +22504 145 56 80; +22523 129 55 0; +22616 148 44 80; +22622 145 53 79; +22627 147 56 80; +22632 132 41 0; +22643 129 56 0; +22644 131 53 0; +22709 146 74 88; +22729 130 72 0; +22736 145 58 80; +22738 148 43 80; +22741 132 44 0; +22750 147 55 84; +22755 129 53 0; +22757 131 56 0; +22848 145 55 80; +22859 129 58 0; +22978 145 60 80; +22988 146 75 88; +22993 129 55 0; +22994 148 48 80; +22996 130 74 0; +22998 147 60 94; +23014 131 55 0; +23014 132 43 0; +23336 131 60 0; +23337 132 48 0; +23361 147 60 80; +23367 148 48 88; +23382 146 77 94; +23398 130 75 0; +23420 129 60 0; +23444 131 60 0; +23447 132 48 0; +23471 147 60 79; +23477 148 48 80; +23496 146 75 92; +23502 145 60 88; +23511 130 77 0; +23591 148 51 84; +23593 147 63 84; +23600 132 48 0; +23605 131 60 0; +23707 129 60 0; +23723 146 74 79; +23724 147 62 92; +23726 148 50 88; +23742 132 51 0; +23743 145 58 88; +23743 130 75 0; +23744 131 63 0; +23809 146 75 80; +23824 130 74 0; +23895 146 74 79; +23908 130 75 0; +23979 147 55 88; +23981 131 62 0; +23984 148 43 80; +23993 132 50 0; +23995 146 70 80; +24017 130 74 0; +24105 145 55 80; +24133 129 58 0; +24216 146 67 76; +24222 145 51 88; +24225 129 55 0; +24232 130 70 0; +24330 145 50 80; +24352 129 51 0; +24460 146 72 79; +24462 145 48 88; +24467 148 41 88; +24469 147 53 88; +24475 129 50 0; +24477 132 43 0; +24479 131 55 0; +24482 130 67 0; +24582 145 46 88; +24604 129 48 0; +24712 145 44 80; +24721 146 65 88; +24724 129 46 0; +24750 130 72 0; +24964 146 67 76; +24964 148 39 80; +24975 147 51 92; +24975 132 41 0; +24988 130 65 0; +24993 131 53 0; +25201 146 68 80; +25210 130 67 0; +25211 147 49 80; +25218 145 49 88; +25218 148 37 76; +25229 131 51 0; +25240 129 44 0; +25245 132 39 0; +25329 147 51 92; +25330 130 68 0; +25332 148 39 79; +25345 131 49 0; +25345 132 37 0; +25453 147 53 80; +25464 146 68 76; +25464 148 41 88; +25470 131 51 0; +25488 132 39 0; +25601 130 68 0; +25699 147 51 88; +25708 145 48 92; +25713 146 68 77; +25726 131 53 0; +25729 129 49 0; +25820 147 50 88; +25840 131 51 0; +25911 130 68 0; +25920 129 48 0; +25951 146 67 69; +25952 147 48 80; +25958 148 39 78; +25961 131 50 0; +25968 145 48 88; +25975 132 41 0; +26079 148 38 80; +26101 132 39 0; +26197 132 38 0; +26197 148 36 72; +26207 146 72 80; +26217 130 67 0; +26327 145 46 80; +26340 129 48 0; +26433 131 48 0; +26447 145 44 88; +26453 146 60 79; +26456 148 48 88; +26457 129 46 0; +26466 130 72 0; +26479 132 36 0; +26564 145 46 79; +26574 129 44 0; +26691 145 34 80; +26692 195 99; +26702 147 77 79; +26703 146 61 80; +26703 148 46 88; +26708 129 46 0; +26718 130 60 0; +26720 132 48 0; +26820 146 60 79; +26844 130 61 0; +26936 146 61 80; +26955 130 60 0; +27048 145 37 80; +27054 146 58 79; +27059 148 49 80; +27064 129 34 0; +27075 130 61 0; +27076 132 46 0; +27141 147 79 88; +27161 131 77 0; +27168 146 63 80; +27170 145 36 80; +27173 129 37 0; +27182 148 48 84; +27187 130 58 0; +27189 132 49 0; +27280 146 60 80; +27291 130 63 0; +27410 146 65 80; +27420 147 80 88; +27425 130 60 0; +27426 145 41 80; +27428 131 79 0; +27430 148 53 94; +27446 129 36 0; +27446 132 48 0; +27768 132 53 0; +27769 129 41 0; +27793 148 53 80; +27799 145 41 88; +27814 147 82 94; +27830 131 80 0; +27852 130 65 0; +27876 132 53 0; +27879 129 41 0; +27903 148 53 79; +27909 145 41 80; +27928 147 80 92; +27934 146 65 88; +27943 131 82 0; +28023 145 44 84; +28025 148 56 84; +28032 129 41 0; +28037 132 53 0; +28139 130 65 0; +28155 147 79 79; +28156 148 55 92; +28158 145 43 88; +28174 129 44 0; +28175 146 63 88; +28175 131 80 0; +28176 132 56 0; +28241 147 80 80; +28256 131 79 0; +28327 147 79 79; +28340 131 80 0; +28411 148 48 88; +28413 132 55 0; +28416 145 36 80; +28425 129 43 0; +28427 147 75 80; +28449 131 79 0; +28537 146 60 80; +28565 130 63 0; +28648 147 72 76; +28654 146 56 88; +28657 130 60 0; +28664 131 75 0; +28762 146 55 80; +28784 130 56 0; +28892 147 77 79; +28894 146 53 88; +28899 145 34 88; +28901 148 46 88; +28907 130 55 0; +28909 129 36 0; +28911 132 48 0; +28914 131 72 0; +29014 146 51 88; +29036 130 53 0; +29144 146 49 80; +29153 147 70 88; +29156 130 51 0; +29182 131 77 0; +29396 145 32 80; +29396 147 72 76; +29407 129 34 0; +29407 148 44 92; +29420 131 70 0; +29425 132 46 0; +29633 147 73 80; +29642 131 72 0; +29643 148 42 80; +29650 145 30 76; +29650 146 54 88; +29661 132 44 0; +29672 130 49 0; +29677 129 32 0; +29761 148 44 92; +29762 131 73 0; +29764 145 32 79; +29777 129 30 0; +29777 132 42 0; +29885 148 46 80; +29896 145 34 88; +29896 147 73 76; +29902 132 44 0; +29920 129 32 0; +30033 131 73 0; +30131 148 44 88; +30140 146 53 92; +30145 147 73 77; +30158 132 46 0; +30161 130 54 0; +30252 148 43 88; +30272 132 44 0; +30343 131 73 0; +30352 130 53 0; +30383 147 72 69; +30384 148 41 80; +30390 145 32 78; +30393 132 43 0; +30400 146 53 88; +30407 129 34 0; +30511 145 31 80; +30533 129 32 0; +30629 129 31 0; +30629 145 29 72; +30639 147 77 80; +30649 131 72 0; +30759 146 51 80; +30772 130 53 0; +30865 132 41 0; +30879 146 49 88; +30885 147 65 79; +30888 145 41 88; +30889 130 51 0; +30898 131 77 0; +30911 129 29 0; +30996 146 51 79; +31006 130 49 0; +31123 146 39 80; +31124 196 47; +31134 148 70 79; +31135 145 39 88; +31135 147 66 80; +31140 130 51 0; +31150 131 65 0; +31152 129 41 0; +31252 147 65 79; +31276 131 66 0; +31368 147 66 80; +31387 131 65 0; +31480 146 42 80; +31486 147 63 79; +31491 145 42 80; +31496 130 39 0; +31507 131 66 0; +31508 129 39 0; +31573 148 72 88; +31593 132 70 0; +31600 147 68 80; +31602 146 41 80; +31605 130 42 0; +31614 145 41 84; +31619 131 63 0; +31621 129 42 0; +31712 147 65 80; +31723 131 68 0; +31842 147 70 80; +31852 148 73 88; +31857 131 65 0; +31858 146 46 80; +31860 132 72 0; +31862 145 46 94; +31878 129 41 0; +31878 130 41 0; +32200 129 46 0; +32201 130 46 0; +32225 145 46 80; +32231 146 46 88; +32246 148 75 94; +32262 132 73 0; +32284 131 70 0; +32308 129 46 0; +32311 130 46 0; +32335 145 46 79; +32341 146 46 80; +32360 148 73 92; +32366 147 70 88; +32375 132 75 0; +32455 146 49 84; +32457 145 49 84; +32464 130 46 0; +32469 129 46 0; +32571 131 70 0; +32587 148 72 79; +32588 145 48 92; +32590 146 48 88; +32606 130 49 0; +32607 147 68 88; +32607 132 73 0; +32608 129 49 0; +32673 148 73 80; +32688 132 72 0; +32759 148 72 79; +32772 132 73 0; +32843 145 41 88; +32845 129 48 0; +32848 146 41 80; +32857 130 48 0; +32859 148 68 80; +32881 132 72 0; +32969 147 65 80; +32997 131 68 0; +33080 148 65 76; +33086 147 61 88; +33089 131 65 0; +33096 132 68 0; +33194 147 60 80; +33216 131 61 0; +33324 148 70 79; +33326 147 58 88; +33331 146 39 88; +33333 145 39 88; +33339 131 60 0; +33341 130 41 0; +33343 129 41 0; +33346 132 65 0; +33446 147 56 88; +33468 131 58 0; +33576 147 54 80; +33585 148 63 88; +33588 131 56 0; +33614 132 70 0; +33828 146 37 80; +33828 148 65 76; +33839 145 37 92; +33839 130 39 0; +33852 132 63 0; +33857 129 39 0; +34065 148 66 80; +34074 132 65 0; +34075 145 35 80; +34082 146 35 76; +34082 147 59 88; +34093 129 37 0; +34104 131 54 0; +34109 130 37 0; +34193 145 37 92; +34194 132 66 0; +34196 146 37 79; +34209 129 35 0; +34209 130 35 0; +34317 145 39 80; +34328 146 39 88; +34328 148 66 76; +34334 129 37 0; +34352 130 37 0; +34465 132 66 0; +34563 145 37 88; +34572 147 58 92; +34577 148 66 77; +34590 129 39 0; +34593 131 59 0; +34684 145 36 88; +34704 129 37 0; +34775 132 66 0; +34784 131 58 0; +34815 148 65 69; +34816 145 34 80; +34822 146 37 78; +34825 129 36 0; +34832 147 58 88; +34839 130 39 0; +34943 146 36 80; +34965 130 37 0; +35061 130 36 0; +35061 146 34 72; +35071 148 70 80; +35081 132 65 0; +35191 147 56 80; +35204 131 58 0; +35297 129 34 0; +35311 147 54 88; +35317 148 58 79; +35320 146 46 88; +35321 131 56 0; +35330 132 70 0; +35343 130 34 0; +35428 147 56 79; +35438 131 54 0; +35555 147 44 80; +35568 146 44 88; +35568 148 59 80; +35573 131 56 0; +35583 132 58 0; +35585 130 46 0; +35685 148 58 79; +35709 132 59 0; +35801 148 59 80; +35820 132 58 0; +35913 147 47 80; +35919 148 56 79; +35924 146 47 80; +35929 131 44 0; +35940 132 59 0; +35941 130 44 0; +36034 148 61 80; +36036 147 46 80; +36039 131 47 0; +36048 146 46 84; +36053 132 56 0; +36055 130 47 0; +36146 148 58 80; +36157 132 61 0; +36276 148 63 80; +36291 132 58 0; +36292 147 51 80; +36297 146 51 94; +36313 130 46 0; +36313 131 46 0; +36635 130 51 0; +36636 131 51 0; +36660 146 51 80; +36666 147 51 88; +36720 132 63 0; +36744 130 51 0; +36747 131 51 0; +36771 146 51 79; +36777 147 51 80; +36803 148 63 88; +36892 147 54 84; +36894 146 54 84; +36901 131 51 0; +36906 130 51 0; +37008 132 63 0; +37026 146 53 92; +37028 147 53 88; +37044 131 54 0; +37045 148 61 88; +37046 130 54 0; +37282 146 46 88; +37284 130 53 0; +37287 147 46 80; +37296 131 53 0; +37409 148 58 80; +37437 132 61 0; +37526 148 54 88; +37529 132 58 0; +37635 148 53 80; +37657 132 54 0; +37767 148 51 88; +37772 147 44 88; +37774 146 44 88; +37780 132 53 0; +37782 131 46 0; +37784 130 46 0; +37888 148 49 88; +37910 132 51 0; +38018 148 47 80; +38031 132 49 0; +38271 147 42 80; +38282 146 42 92; +38282 131 44 0; +38300 130 44 0; +38518 146 40 80; +38525 147 40 76; +38525 148 52 88; +38536 130 42 0; +38547 132 47 0; +38552 131 42 0; +38636 146 42 92; +38639 147 42 79; +38652 130 40 0; +38652 131 40 0; +38760 146 44 80; +38771 147 44 88; +38777 130 42 0; +38795 131 42 0; +39007 146 42 88; +39016 148 51 92; +39034 130 44 0; +39037 132 52 0; +39128 146 41 88; +39148 130 42 0; +39228 132 51 0; +39260 146 39 80; +39266 147 42 78; +39269 130 41 0; +39276 148 51 88; +39283 131 44 0; +39387 147 41 80; +39409 131 42 0; +39505 131 41 0; +39505 147 39 72; +39636 148 49 80; +39649 132 51 0; +39742 130 39 0; +39756 148 47 88; +39766 147 51 88; +39767 132 49 0; +39789 131 39 0; +39874 148 49 79; +39884 132 47 0; +40001 148 37 80; +40014 147 49 88; +40019 132 49 0; +40032 131 51 0; +40362 148 40 80; +40373 147 52 80; +40378 132 37 0; +40391 131 49 0; +40487 148 39 80; +40490 132 40 0; +40499 147 51 84; +40506 131 52 0; +40745 148 44 80; +40750 147 56 94; +40766 131 51 0; +40766 132 39 0; +41088 131 56 0; +41089 132 44 0; +41113 147 56 80; +41119 148 44 88; +41198 131 56 0; +41201 132 44 0; +41225 147 56 79; +41231 148 44 80; +41346 148 47 84; +41348 147 59 84; +41355 132 44 0; +41360 131 56 0; +41481 147 58 92; +41483 148 46 88; +41499 132 47 0; +41501 131 59 0; +41737 147 51 88; +41739 131 58 0; +41742 148 39 80; +41751 132 46 0; +42231 148 37 88; +42233 147 49 88; +42242 132 39 0; +42244 131 51 0; +42732 148 35 80; +42743 147 47 92; +42743 132 37 0; +42761 131 49 0; +42979 147 45 80; +42986 148 33 76; +42997 131 47 0; +43013 132 35 0; +43097 147 47 92; +43100 148 35 79; +43113 131 45 0; +43113 132 33 0; +43221 147 49 80; +43232 148 37 88; +43238 131 47 0; +43256 132 35 0; +43468 147 47 88; +43495 131 49 0; +43590 147 46 88; +43610 131 47 0; +43723 147 44 80; +43729 148 35 78; +43732 131 46 0; +43747 132 37 0; +43851 148 34 80; +43873 132 35 0; +43969 132 34 0; +43969 148 32 72; +44207 131 44 0; +44231 148 44 88; +44254 132 32 0; +44480 148 42 88; +44498 132 44 0; +44840 148 45 80; +44858 132 42 0; +44967 148 44 84; +44974 132 45 0; +45218 148 49 94; +45234 132 44 0; +45556 132 49 0; +45582 148 49 80; +45667 132 49 0; +45695 148 49 79; +45820 148 52 84; +45833 132 49 0; +45954 148 51 92; +45976 132 52 0; +46212 148 44 88; +46214 132 51 0; +46710 148 42 88; +46721 132 44 0; +47221 148 40 92; +47239 132 42 0; +47457 148 38 80; +47476 132 40 0; +47577 148 40 92; +47593 132 38 0; +47701 148 42 80; +47719 132 40 0; +47949 148 40 88; +47976 132 42 0; +48071 148 39 88; +48091 132 40 0; +48204 148 37 80; +48214 132 39 0; +48690 132 37 0; diff --git a/externals/miXed/test/cyclone/test1.seq b/externals/miXed/test/cyclone/test1.seq new file mode 100644 index 000000000..5b695dc0d --- /dev/null +++ b/externals/miXed/test/cyclone/test1.seq @@ -0,0 +1,1208 @@ +0 193 107; +7 145 71 79; +449 145 73 88; +467 129 71 0; +730 145 74 88; +737 129 73 0; +1125 145 76 94; +1140 129 74 0; +1238 145 74 92; +1251 129 76 0; +1464 145 73 79; +1484 129 74 0; +1549 145 74 80; +1562 129 73 0; +1632 145 73 79; +1642 129 74 0; +1730 145 69 80; +1750 129 73 0; +1947 145 66 76; +1962 129 69 0; +2188 145 71 79; +2211 129 66 0; +2447 145 64 88; +2475 129 71 0; +2688 145 66 76; +2711 129 64 0; +2921 145 67 80; +2928 129 66 0; +3050 129 67 0; +3182 145 67 76; +3317 129 67 0; +3428 145 67 77; +3625 129 67 0; +3664 145 66 69; +3921 145 71 80; +3928 129 66 0; +4164 145 59 79; +4177 129 71 0; +4403 194 98; +4410 146 76 79; +4410 145 60 80; +4423 129 59 0; +4524 145 59 79; +4547 129 60 0; +4638 145 60 80; +4656 129 59 0; +4754 145 57 79; +4774 129 60 0; +4839 146 78 88; +4857 130 76 0; +4862 145 62 80; +4880 129 57 0; +4971 145 59 80; +4981 129 62 0; +5098 145 64 80; +5105 146 79 88; +5107 129 59 0; +5109 130 78 0; +5497 146 81 94; +5512 130 79 0; +5532 129 64 0; +5610 146 79 92; +5615 145 64 88; +5622 130 81 0; +5819 129 64 0; +5834 146 78 79; +5854 145 62 88; +5854 130 79 0; +5919 146 79 80; +5932 130 78 0; +6002 146 78 79; +6012 130 79 0; +6100 146 74 80; +6120 130 78 0; +6205 145 59 80; +6231 129 62 0; +6311 146 71 76; +6316 145 55 88; +6318 129 59 0; +6323 130 74 0; +6419 145 54 80; +6439 129 55 0; +6545 146 76 79; +6545 145 52 88; +6558 129 54 0; +6565 130 71 0; +6663 145 50 88; +6683 129 52 0; +6789 145 48 80; +6796 146 69 88; +6798 129 50 0; +6821 130 76 0; +7034 146 71 76; +7057 130 69 0; +7267 146 72 80; +7274 130 71 0; +7281 145 53 88; +7301 129 48 0; +7389 130 72 0; +7521 146 72 76; +7656 130 72 0; +7762 145 52 92; +7764 146 72 77; +7779 129 53 0; +7961 130 72 0; +7968 129 52 0; +7996 146 71 69; +8014 145 52 88; +8253 146 76 80; +8260 130 71 0; +8369 145 50 80; +8379 129 52 0; +8485 145 48 88; +8490 146 64 79; +8492 129 50 0; +8499 130 76 0; +8595 145 50 79; +8602 129 48 0; +8716 145 38 80; +8716 195 74; +8723 147 81 79; +8723 146 65 80; +8725 129 50 0; +8732 130 64 0; +8833 146 64 79; +8856 130 65 0; +8947 146 65 80; +8965 130 64 0; +9056 145 41 80; +9061 146 62 79; +9068 129 38 0; +9078 130 65 0; +9143 147 83 88; +9161 131 81 0; +9166 146 67 80; +9166 145 40 80; +9168 129 41 0; +9181 130 62 0; +9272 146 64 80; +9282 130 67 0; +9399 146 69 80; +9406 147 84 88; +9408 130 64 0; +9408 145 45 80; +9408 131 83 0; +9426 129 40 0; +9748 129 45 0; +9776 145 45 88; +9789 147 86 94; +9804 131 84 0; +9824 130 69 0; +9850 129 45 0; +9878 145 45 80; +9896 147 84 92; +9901 146 69 88; +9908 131 86 0; +9986 145 48 84; +9993 129 45 0; +10099 130 69 0; +10114 147 83 79; +10116 145 47 88; +10131 129 48 0; +10131 146 67 88; +10131 131 84 0; +10196 147 84 80; +10209 131 83 0; +10279 147 83 79; +10289 131 84 0; +10364 145 40 80; +10371 129 47 0; +10371 147 79 80; +10391 131 83 0; +10476 146 64 80; +10502 130 67 0; +10582 147 76 76; +10587 146 60 88; +10589 130 64 0; +10594 131 79 0; +10690 146 59 80; +10710 130 60 0; +10816 147 81 79; +10816 146 57 88; +10818 145 38 88; +10825 130 59 0; +10825 129 40 0; +10830 131 76 0; +10928 146 55 88; +10948 130 57 0; +11054 146 53 80; +11061 147 74 88; +11063 130 55 0; +11086 131 81 0; +11299 145 36 80; +11299 147 76 76; +11309 129 38 0; +11319 131 74 0; +11529 147 77 80; +11536 131 76 0; +11543 145 34 76; +11543 146 58 88; +11563 130 53 0; +11565 129 36 0; +11648 131 77 0; +11648 145 36 79; +11658 129 34 0; +11775 145 38 88; +11775 147 77 76; +11798 129 36 0; +11909 131 77 0; +12015 146 57 92; +12017 147 77 77; +12032 130 58 0; +12214 131 77 0; +12221 130 57 0; +12249 147 76 69; +12254 145 36 78; +12264 146 57 88; +12269 129 38 0; +12370 145 35 80; +12390 129 36 0; +12483 129 35 0; +12483 145 33 72; +12490 147 81 80; +12497 131 76 0; +12606 146 55 80; +12616 130 57 0; +12722 146 53 88; +12727 147 69 79; +12729 145 45 88; +12729 130 55 0; +12736 131 81 0; +12746 129 33 0; +12829 146 55 79; +12836 130 53 0; +12950 146 43 80; +12950 196 38; +12957 148 74 79; +12957 145 43 88; +12957 147 70 80; +12959 130 55 0; +12966 131 69 0; +12966 129 45 0; +13064 147 69 79; +13087 131 70 0; +13178 147 70 80; +13196 131 69 0; +13287 146 46 80; +13292 147 67 79; +13294 145 46 80; +13296 130 43 0; +13306 131 70 0; +13306 129 43 0; +13368 148 76 88; +13386 132 74 0; +13391 147 72 80; +13391 146 45 80; +13393 130 46 0; +13400 145 45 84; +13402 131 67 0; +13402 129 46 0; +13490 147 69 80; +13500 131 72 0; +13617 147 74 80; +13624 148 77 88; +13626 131 69 0; +13626 146 50 80; +13626 132 76 0; +13626 145 50 94; +13641 129 45 0; +13641 130 45 0; +13961 129 50 0; +13961 130 50 0; +13984 145 50 80; +13989 146 50 88; +14002 148 79 94; +14017 132 77 0; +14037 131 74 0; +14060 129 50 0; +14062 130 50 0; +14085 145 50 79; +14090 146 50 80; +14108 148 77 92; +14113 147 74 88; +14120 132 79 0; +14198 146 53 84; +14198 145 53 84; +14203 130 50 0; +14205 129 50 0; +14306 131 74 0; +14321 148 76 79; +14321 145 52 92; +14321 146 52 88; +14336 130 53 0; +14336 147 72 88; +14336 132 77 0; +14336 129 53 0; +14398 148 77 80; +14411 132 76 0; +14481 148 76 79; +14491 132 77 0; +14561 145 45 88; +14561 129 52 0; +14563 146 45 80; +14570 130 52 0; +14570 148 72 80; +14590 132 76 0; +14675 147 69 80; +14701 131 72 0; +14781 148 69 76; +14786 147 65 88; +14788 131 69 0; +14793 132 72 0; +14889 147 64 80; +14909 131 65 0; +15015 148 74 79; +15015 147 62 88; +15017 146 43 88; +15017 145 43 88; +15022 131 64 0; +15022 130 45 0; +15022 129 45 0; +15024 132 69 0; +15122 147 60 88; +15142 131 62 0; +15248 147 58 80; +15255 148 67 88; +15257 131 60 0; +15280 132 74 0; +15493 146 41 80; +15493 148 69 76; +15503 145 41 92; +15503 130 43 0; +15513 132 67 0; +15515 129 43 0; +15720 148 70 80; +15727 132 69 0; +15727 145 39 80; +15732 146 39 76; +15732 147 63 88; +15742 129 41 0; +15752 131 58 0; +15754 130 41 0; +15837 145 41 92; +15837 132 70 0; +15837 146 41 79; +15847 129 39 0; +15847 130 39 0; +15953 145 43 80; +15963 146 43 88; +15963 148 70 76; +15968 129 41 0; +15983 130 41 0; +16094 132 70 0; +16190 145 41 88; +16197 147 62 92; +16199 148 70 77; +16209 129 43 0; +16211 131 63 0; +16299 145 40 88; +16317 129 41 0; +16387 132 70 0; +16394 131 62 0; +16422 148 69 69; +16422 145 38 80; +16427 146 41 78; +16429 129 40 0; +16434 147 62 88; +16439 130 43 0; +16540 146 40 80; +16560 130 41 0; +16653 130 40 0; +16653 146 38 72; +16660 148 74 80; +16667 132 69 0; +16776 147 60 80; +16786 131 62 0; +16877 129 38 0; +16890 147 58 88; +16895 148 62 79; +16897 146 50 88; +16897 131 60 0; +16904 132 74 0; +16914 130 38 0; +16997 147 60 79; +17004 131 58 0; +17118 147 48 80; +17118 193 44; +17125 145 67 79; +17125 146 48 88; +17125 148 63 80; +17127 131 60 0; +17134 132 62 0; +17134 130 50 0; +17232 148 62 79; +17255 132 63 0; +17346 148 63 80; +17364 132 62 0; +17455 147 51 80; +17460 148 60 79; +17462 146 51 80; +17464 131 48 0; +17474 132 63 0; +17474 130 48 0; +17536 145 69 88; +17554 129 67 0; +17559 148 65 80; +17559 147 50 80; +17561 131 51 0; +17568 146 50 84; +17570 132 60 0; +17570 130 51 0; +17658 148 62 80; +17668 132 65 0; +17785 148 67 80; +17792 145 70 88; +17794 132 62 0; +17794 147 55 80; +17794 129 69 0; +17794 146 55 94; +17809 130 50 0; +17809 131 50 0; +18129 130 55 0; +18129 131 55 0; +18152 146 55 80; +18157 147 55 88; +18170 145 72 94; +18185 129 70 0; +18205 132 67 0; +18228 130 55 0; +18230 131 55 0; +18253 146 55 79; +18258 147 55 80; +18276 145 70 92; +18281 148 67 88; +18288 129 72 0; +18366 147 58 84; +18366 146 58 84; +18371 131 55 0; +18373 130 55 0; +18474 132 67 0; +18489 145 69 79; +18489 146 57 92; +18489 147 57 88; +18504 131 58 0; +18504 129 70 0; +18504 148 65 88; +18504 130 58 0; +18566 145 70 80; +18579 129 69 0; +18649 145 69 79; +18659 129 70 0; +18729 146 50 88; +18729 130 57 0; +18731 147 50 80; +18738 131 57 0; +18738 145 65 80; +18758 129 69 0; +18843 148 62 80; +18869 132 65 0; +18949 145 62 76; +18954 148 58 88; +18956 132 62 0; +18961 129 65 0; +19057 148 57 80; +19077 132 58 0; +19183 145 67 79; +19183 148 55 88; +19185 147 48 88; +19185 146 48 88; +19190 132 57 0; +19190 131 50 0; +19190 130 50 0; +19192 129 62 0; +19290 148 53 88; +19310 132 55 0; +19416 148 51 80; +19423 145 60 88; +19425 132 53 0; +19448 129 67 0; +19661 145 62 76; +19661 147 46 80; +19671 146 46 92; +19671 131 48 0; +19681 129 60 0; +19683 130 48 0; +19888 145 63 80; +19895 129 62 0; +19895 146 44 80; +19900 147 44 76; +19900 148 56 88; +19910 130 46 0; +19920 132 51 0; +19922 131 46 0; +20005 146 46 92; +20005 129 63 0; +20005 147 46 79; +20015 130 44 0; +20015 131 44 0; +20121 146 48 80; +20131 145 63 76; +20131 147 48 88; +20136 130 46 0; +20151 131 46 0; +20262 129 63 0; +20358 146 46 88; +20365 148 55 92; +20367 145 63 77; +20377 130 48 0; +20379 132 56 0; +20467 146 45 88; +20485 130 46 0; +20555 129 63 0; +20562 132 55 0; +20590 145 62 69; +20590 146 43 80; +20595 147 46 78; +20597 130 45 0; +20602 148 55 88; +20607 131 48 0; +20708 147 45 80; +20728 131 46 0; +20821 131 45 0; +20821 147 43 72; +20828 145 67 80; +20835 129 62 0; +20944 148 53 80; +20954 132 55 0; +21045 130 43 0; +21058 148 51 88; +21063 145 55 79; +21065 147 55 88; +21065 132 53 0; +21072 129 67 0; +21082 131 43 0; +21165 148 53 79; +21172 132 51 0; +21286 148 41 80; +21286 194 66; +21293 146 72 79; +21293 145 56 80; +21293 147 53 88; +21295 132 53 0; +21302 129 55 0; +21302 131 55 0; +21400 145 55 79; +21423 129 56 0; +21514 145 56 80; +21532 129 55 0; +21623 148 44 80; +21628 145 53 79; +21630 147 56 80; +21632 132 41 0; +21642 129 56 0; +21642 131 53 0; +21704 146 74 88; +21722 130 72 0; +21727 145 58 80; +21727 148 43 80; +21729 132 44 0; +21736 147 55 84; +21738 129 53 0; +21738 131 56 0; +21826 145 55 80; +21836 129 58 0; +21953 145 60 80; +21960 146 75 88; +21962 129 55 0; +21962 148 48 80; +21962 130 74 0; +21962 147 60 94; +21977 131 55 0; +21977 132 43 0; +22297 131 60 0; +22297 132 48 0; +22320 147 60 80; +22325 148 48 88; +22338 146 77 94; +22353 130 75 0; +22373 129 60 0; +22396 131 60 0; +22398 132 48 0; +22421 147 60 79; +22426 148 48 80; +22444 146 75 92; +22449 145 60 88; +22456 130 77 0; +22534 148 51 84; +22534 147 63 84; +22539 132 48 0; +22541 131 60 0; +22642 129 60 0; +22657 146 74 79; +22657 147 62 92; +22657 148 50 88; +22672 132 51 0; +22672 145 58 88; +22672 130 75 0; +22672 131 63 0; +22734 146 75 80; +22747 130 74 0; +22817 146 74 79; +22827 130 75 0; +22897 147 55 88; +22897 131 62 0; +22899 148 43 80; +22906 132 50 0; +22906 146 70 80; +22926 130 74 0; +23011 145 55 80; +23037 129 58 0; +23117 146 67 76; +23122 145 51 88; +23124 129 55 0; +23129 130 70 0; +23225 145 50 80; +23245 129 51 0; +23351 146 72 79; +23351 145 48 88; +23353 148 41 88; +23353 147 53 88; +23358 129 50 0; +23358 132 43 0; +23358 131 55 0; +23360 130 67 0; +23458 145 46 88; +23478 129 48 0; +23584 145 44 80; +23591 146 65 88; +23593 129 46 0; +23616 130 72 0; +23829 146 67 76; +23829 148 39 80; +23839 147 51 92; +23839 132 41 0; +23849 130 65 0; +23851 131 53 0; +24056 146 68 80; +24063 130 67 0; +24063 147 49 80; +24068 145 49 88; +24068 148 37 76; +24078 131 51 0; +24088 129 44 0; +24090 132 39 0; +24173 147 51 92; +24173 130 68 0; +24173 148 39 79; +24183 131 49 0; +24183 132 37 0; +24289 147 53 80; +24299 146 68 76; +24299 148 41 88; +24304 131 51 0; +24319 132 39 0; +24430 130 68 0; +24526 147 51 88; +24533 145 48 92; +24535 146 68 77; +24545 131 53 0; +24547 129 49 0; +24635 147 50 88; +24653 131 51 0; +24723 130 68 0; +24730 129 48 0; +24758 146 67 69; +24758 147 48 80; +24763 148 39 78; +24765 131 50 0; +24770 145 48 88; +24775 132 41 0; +24876 148 38 80; +24896 132 39 0; +24989 132 38 0; +24989 148 36 72; +24996 146 72 80; +25003 130 67 0; +25112 145 46 80; +25122 129 48 0; +25213 131 48 0; +25226 145 44 88; +25231 146 60 79; +25233 148 48 88; +25233 129 46 0; +25240 130 72 0; +25250 132 36 0; +25333 145 46 79; +25340 129 44 0; +25454 145 34 80; +25454 195 99; +25461 147 77 79; +25461 146 61 80; +25461 148 46 88; +25463 129 46 0; +25470 130 60 0; +25470 132 48 0; +25568 146 60 79; +25591 130 61 0; +25682 146 61 80; +25700 130 60 0; +25791 145 37 80; +25796 146 58 79; +25798 148 49 80; +25800 129 34 0; +25810 130 61 0; +25810 132 46 0; +25872 147 79 88; +25890 131 77 0; +25895 146 63 80; +25895 145 36 80; +25897 129 37 0; +25904 148 48 84; +25906 130 58 0; +25906 132 49 0; +25994 146 60 80; +26004 130 63 0; +26121 146 65 80; +26128 147 80 88; +26130 130 60 0; +26130 145 41 80; +26130 131 79 0; +26130 148 53 94; +26145 129 36 0; +26145 132 48 0; +26465 132 53 0; +26465 129 41 0; +26488 148 53 80; +26493 145 41 88; +26506 147 82 94; +26521 131 80 0; +26541 130 65 0; +26564 132 53 0; +26566 129 41 0; +26589 148 53 79; +26594 145 41 80; +26612 147 80 92; +26617 146 65 88; +26624 131 82 0; +26702 145 44 84; +26702 148 56 84; +26707 129 41 0; +26709 132 53 0; +26810 130 65 0; +26825 147 79 79; +26825 148 55 92; +26825 145 43 88; +26840 129 44 0; +26840 146 63 88; +26840 131 80 0; +26840 132 56 0; +26902 147 80 80; +26915 131 79 0; +26985 147 79 79; +26995 131 80 0; +27065 148 48 88; +27065 132 55 0; +27067 145 36 80; +27074 129 43 0; +27074 147 75 80; +27094 131 79 0; +27179 146 60 80; +27205 130 63 0; +27285 147 72 76; +27290 146 56 88; +27292 130 60 0; +27297 131 75 0; +27393 146 55 80; +27413 130 56 0; +27519 147 77 79; +27519 146 53 88; +27521 145 34 88; +27521 148 46 88; +27526 130 55 0; +27526 129 36 0; +27526 132 48 0; +27528 131 72 0; +27626 146 51 88; +27646 130 53 0; +27752 146 49 80; +27759 147 70 88; +27761 130 51 0; +27784 131 77 0; +27997 145 32 80; +27997 147 72 76; +28007 129 34 0; +28007 148 44 92; +28017 131 70 0; +28019 132 46 0; +28224 147 73 80; +28231 131 72 0; +28231 148 42 80; +28236 145 30 76; +28236 146 54 88; +28246 132 44 0; +28256 130 49 0; +28258 129 32 0; +28341 148 44 92; +28341 131 73 0; +28341 145 32 79; +28351 129 30 0; +28351 132 42 0; +28457 148 46 80; +28467 145 34 88; +28467 147 73 76; +28472 132 44 0; +28487 129 32 0; +28598 131 73 0; +28694 148 44 88; +28701 146 53 92; +28703 147 73 77; +28713 132 46 0; +28715 130 54 0; +28803 148 43 88; +28821 132 44 0; +28891 131 73 0; +28898 130 53 0; +28926 147 72 69; +28926 148 41 80; +28931 145 32 78; +28933 132 43 0; +28938 146 53 88; +28943 129 34 0; +29044 145 31 80; +29064 129 32 0; +29157 129 31 0; +29157 145 29 72; +29164 147 77 80; +29171 131 72 0; +29280 146 51 80; +29290 130 53 0; +29381 132 41 0; +29394 146 49 88; +29399 147 65 79; +29401 145 41 88; +29401 130 51 0; +29408 131 77 0; +29418 129 29 0; +29501 146 51 79; +29508 130 49 0; +29622 146 39 80; +29622 196 47; +29629 148 70 79; +29629 145 39 88; +29629 147 66 80; +29631 130 51 0; +29638 131 65 0; +29638 129 41 0; +29736 147 65 79; +29759 131 66 0; +29850 147 66 80; +29868 131 65 0; +29959 146 42 80; +29964 147 63 79; +29966 145 42 80; +29968 130 39 0; +29978 131 66 0; +29978 129 39 0; +30040 148 72 88; +30058 132 70 0; +30063 147 68 80; +30063 146 41 80; +30065 130 42 0; +30072 145 41 84; +30074 131 63 0; +30074 129 42 0; +30162 147 65 80; +30172 131 68 0; +30289 147 70 80; +30296 148 73 88; +30298 131 65 0; +30298 146 46 80; +30298 132 72 0; +30298 145 46 94; +30313 129 41 0; +30313 130 41 0; +30633 129 46 0; +30633 130 46 0; +30656 145 46 80; +30661 146 46 88; +30674 148 75 94; +30689 132 73 0; +30709 131 70 0; +30732 129 46 0; +30734 130 46 0; +30757 145 46 79; +30762 146 46 80; +30780 148 73 92; +30785 147 70 88; +30792 132 75 0; +30870 146 49 84; +30870 145 49 84; +30875 130 46 0; +30877 129 46 0; +30978 131 70 0; +30993 148 72 79; +30993 145 48 92; +30993 146 48 88; +31008 130 49 0; +31008 147 68 88; +31008 132 73 0; +31008 129 49 0; +31070 148 73 80; +31083 132 72 0; +31153 148 72 79; +31163 132 73 0; +31233 145 41 88; +31233 129 48 0; +31235 146 41 80; +31242 130 48 0; +31242 148 68 80; +31262 132 72 0; +31347 147 65 80; +31373 131 68 0; +31453 148 65 76; +31458 147 61 88; +31460 131 65 0; +31465 132 68 0; +31561 147 60 80; +31581 131 61 0; +31687 148 70 79; +31687 147 58 88; +31689 146 39 88; +31689 145 39 88; +31694 131 60 0; +31694 130 41 0; +31694 129 41 0; +31696 132 65 0; +31794 147 56 88; +31814 131 58 0; +31920 147 54 80; +31927 148 63 88; +31929 131 56 0; +31952 132 70 0; +32165 146 37 80; +32165 148 65 76; +32175 145 37 92; +32175 130 39 0; +32185 132 63 0; +32187 129 39 0; +32392 148 66 80; +32399 132 65 0; +32399 145 35 80; +32404 146 35 76; +32404 147 59 88; +32414 129 37 0; +32424 131 54 0; +32426 130 37 0; +32509 145 37 92; +32509 132 66 0; +32509 146 37 79; +32519 129 35 0; +32519 130 35 0; +32625 145 39 80; +32635 146 39 88; +32635 148 66 76; +32640 129 37 0; +32655 130 37 0; +32766 132 66 0; +32862 145 37 88; +32869 147 58 92; +32871 148 66 77; +32881 129 39 0; +32883 131 59 0; +32971 145 36 88; +32989 129 37 0; +33059 132 66 0; +33066 131 58 0; +33094 148 65 69; +33094 145 34 80; +33099 146 37 78; +33101 129 36 0; +33106 147 58 88; +33111 130 39 0; +33212 146 36 80; +33232 130 37 0; +33325 130 36 0; +33325 146 34 72; +33332 148 70 80; +33339 132 65 0; +33448 147 56 80; +33458 131 58 0; +33549 129 34 0; +33562 147 54 88; +33567 148 58 79; +33569 146 46 88; +33569 131 56 0; +33576 132 70 0; +33586 130 34 0; +33669 147 56 79; +33676 131 54 0; +33790 147 44 80; +33800 146 44 88; +33800 148 59 80; +33802 131 56 0; +33809 132 58 0; +33809 130 46 0; +33907 148 58 79; +33930 132 59 0; +34021 148 59 80; +34039 132 58 0; +34130 147 47 80; +34135 148 56 79; +34137 146 47 80; +34139 131 44 0; +34149 132 59 0; +34149 130 44 0; +34240 148 61 80; +34240 147 46 80; +34242 131 47 0; +34249 146 46 84; +34251 132 56 0; +34251 130 47 0; +34339 148 58 80; +34349 132 61 0; +34466 148 63 80; +34479 132 58 0; +34479 147 51 80; +34481 146 51 94; +34496 130 46 0; +34496 131 46 0; +34816 130 51 0; +34816 131 51 0; +34839 146 51 80; +34844 147 51 88; +34896 132 63 0; +34919 130 51 0; +34921 131 51 0; +34944 146 51 79; +34949 147 51 80; +34972 148 63 88; +35060 147 54 84; +35060 146 54 84; +35065 131 51 0; +35067 130 51 0; +35168 132 63 0; +35183 146 53 92; +35183 147 53 88; +35198 131 54 0; +35198 148 61 88; +35198 130 54 0; +35432 146 46 88; +35432 130 53 0; +35434 147 46 80; +35441 131 53 0; +35552 148 58 80; +35578 132 61 0; +35666 148 54 88; +35668 132 58 0; +35772 148 53 80; +35792 132 54 0; +35901 148 51 88; +35903 147 44 88; +35903 146 44 88; +35908 132 53 0; +35908 131 46 0; +35908 130 46 0; +36009 148 49 88; +36029 132 51 0; +36135 148 47 80; +36145 132 49 0; +36384 147 42 80; +36394 146 42 92; +36394 131 44 0; +36409 130 44 0; +36625 146 40 80; +36630 147 40 76; +36630 148 52 88; +36640 130 42 0; +36650 132 47 0; +36652 131 42 0; +36735 146 42 92; +36737 147 42 79; +36747 130 40 0; +36747 131 40 0; +36853 146 44 80; +36863 147 44 88; +36868 130 42 0; +36883 131 42 0; +37093 146 42 88; +37100 148 51 92; +37115 130 44 0; +37117 132 52 0; +37205 146 41 88; +37223 130 42 0; +37301 132 51 0; +37332 146 39 80; +37337 147 42 78; +37339 130 41 0; +37344 148 51 88; +37349 131 44 0; +37450 147 41 80; +37470 131 42 0; +37563 131 41 0; +37563 147 39 72; +37693 148 49 80; +37703 132 51 0; +37794 130 39 0; +37807 148 47 88; +37814 147 51 88; +37814 132 49 0; +37834 131 39 0; +37917 148 49 79; +37924 132 47 0; +38038 148 37 80; +38048 147 49 88; +38050 132 49 0; +38060 131 51 0; +38388 148 40 80; +38398 147 52 80; +38400 132 37 0; +38410 131 49 0; +38503 148 39 80; +38505 132 40 0; +38512 147 51 84; +38517 131 52 0; +38753 148 44 80; +38755 147 56 94; +38770 131 51 0; +38770 132 39 0; +39090 131 56 0; +39090 132 44 0; +39113 147 56 80; +39118 148 44 88; +39196 131 56 0; +39198 132 44 0; +39221 147 56 79; +39226 148 44 80; +39340 148 47 84; +39340 147 59 84; +39345 132 44 0; +39347 131 56 0; +39466 147 58 92; +39466 148 46 88; +39481 132 47 0; +39481 131 59 0; +39715 147 51 88; +39715 131 58 0; +39717 148 39 80; +39724 132 46 0; +40203 148 37 88; +40203 147 49 88; +40210 132 39 0; +40210 131 51 0; +40696 148 35 80; +40706 147 47 92; +40706 132 37 0; +40721 131 49 0; +40937 147 45 80; +40942 148 33 76; +40952 131 47 0; +40967 132 35 0; +41050 147 47 92; +41052 148 35 79; +41062 131 45 0; +41062 132 33 0; +41168 147 49 80; +41178 148 37 88; +41183 131 47 0; +41198 132 35 0; +41408 147 47 88; +41434 131 49 0; +41527 147 46 88; +41545 131 47 0; +41656 147 44 80; +41661 148 35 78; +41663 131 46 0; +41676 132 37 0; +41777 148 34 80; +41797 132 35 0; +41890 132 34 0; +41890 148 32 72; +42126 131 44 0; +42149 148 44 88; +42169 132 32 0; +42392 148 42 88; +42407 132 44 0; +42748 148 45 80; +42763 132 42 0; +42869 148 44 84; +42874 132 45 0; +43116 148 49 94; +43131 132 44 0; +43451 132 49 0; +43474 148 49 80; +43557 132 49 0; +43583 148 49 79; +43708 148 52 84; +43718 132 49 0; +43837 148 51 92; +43857 132 52 0; +44091 148 44 88; +44091 132 51 0; +44585 148 42 88; +44595 132 44 0; +45095 148 40 92; +45110 132 42 0; +45326 148 38 80; +45344 132 40 0; +45442 148 40 92; +45457 132 38 0; +45563 148 42 80; +45578 132 40 0; +45807 148 40 88; +45833 132 42 0; +45926 148 39 88; +45944 132 40 0; +46055 148 37 80; +46062 132 39 0; +46535 132 37 0; diff --git a/externals/miXed/test/cyclone/testmess-reentrant.pd b/externals/miXed/test/cyclone/testmess-reentrant.pd new file mode 100644 index 000000000..afac922ef --- /dev/null +++ b/externals/miXed/test/cyclone/testmess-reentrant.pd @@ -0,0 +1,25 @@ +#N canvas 326 112 405 388 12; +#X obj 67 328 print; +#X obj 67 57 t a b; +#X obj 67 136 spigot; +#X msg 193 95 1; +#X msg 194 136 0; +#X msg 117 220 -9 -8 -7 -6 -5 -4 -3 -2 -1; +#X msg 67 19 test this mess; +#X msg 92 254 test; +#X obj 92 290 testmess 16 heap; +#X obj 67 95 testmess 8; +#X obj 67 181 t a b b b; +#X connect 1 0 9 0; +#X connect 1 1 3 0; +#X connect 2 0 10 0; +#X connect 3 0 2 1; +#X connect 4 0 2 1; +#X connect 5 0 9 0; +#X connect 6 0 1 0; +#X connect 7 0 8 0; +#X connect 9 0 2 0; +#X connect 10 0 0 0; +#X connect 10 1 7 0; +#X connect 10 2 5 0; +#X connect 10 3 4 0; diff --git a/externals/miXed/test/cyclone/testmess-test.pd b/externals/miXed/test/cyclone/testmess-test.pd new file mode 100644 index 000000000..442ffc3ae --- /dev/null +++ b/externals/miXed/test/cyclone/testmess-test.pd @@ -0,0 +1,69 @@ +#N canvas 319 97 771 509 12; +#X obj 97 235 until; +#X msg 97 266 test; +#X obj 68 202 t b 0 b; +#X obj 62 371 realtime; +#X floatatom 62 411 0 0 0; +#X obj 346 235 until; +#X msg 346 266 test; +#X obj 317 202 t b 0 b; +#X obj 311 371 realtime; +#X floatatom 311 411 0 0 0; +#X obj 614 235 until; +#X msg 614 266 test; +#X obj 579 371 realtime; +#X floatatom 579 411 0 0 0; +#X obj 317 49 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 317 18 loadbang; +#X obj 346 299 testmess 1 heap; +#X obj 346 332 testmess 1 heap; +#X obj 614 332 testmess 1; +#X obj 614 299 testmess 1; +#X obj 97 299 testmess 1 stack; +#X obj 97 332 testmess 1 stack; +#X msg 585 166 1000; +#X msg 317 166 1000; +#X msg 68 166 1000; +#X msg 416 239 set \$1; +#X obj 317 112 t b b; +#X obj 585 202 t b 0 b; +#X obj 317 79 metro 500; +#X floatatom 501 112 5 0 0; +#X obj 416 202 random 120; +#X connect 0 0 1 0; +#X connect 1 0 20 0; +#X connect 2 0 3 1; +#X connect 2 1 0 0; +#X connect 2 2 3 0; +#X connect 3 0 4 0; +#X connect 5 0 6 0; +#X connect 6 0 16 0; +#X connect 7 0 8 1; +#X connect 7 1 5 0; +#X connect 7 2 8 0; +#X connect 8 0 9 0; +#X connect 10 0 11 0; +#X connect 11 0 19 0; +#X connect 12 0 13 0; +#X connect 14 0 28 0; +#X connect 15 0 14 0; +#X connect 16 0 17 0; +#X connect 19 0 18 0; +#X connect 20 0 21 0; +#X connect 22 0 27 0; +#X connect 23 0 7 0; +#X connect 24 0 2 0; +#X connect 25 0 16 0; +#X connect 25 0 19 0; +#X connect 25 0 20 0; +#X connect 26 0 24 0; +#X connect 26 0 22 0; +#X connect 26 0 23 0; +#X connect 26 1 30 0; +#X connect 27 0 12 1; +#X connect 27 1 10 0; +#X connect 27 2 12 0; +#X connect 28 0 26 0; +#X connect 29 0 30 1; +#X connect 30 0 25 0; diff --git a/externals/miXed/test/cyclone/thresh-test.pd b/externals/miXed/test/cyclone/thresh-test.pd new file mode 100644 index 000000000..35e8ab70d --- /dev/null +++ b/externals/miXed/test/cyclone/thresh-test.pd @@ -0,0 +1,41 @@ +#N canvas 415 237 602 431 12; +#X obj 339 290 print; +#X msg 339 173 1 test \, 2 test \, 3 test; +#X obj 339 256 thresh; +#X msg 472 218 300; +#X msg 516 218 1000; +#X msg 388 218 0; +#X msg 430 218 10; +#X msg 276 173 99; +#X msg 315 55 33; +#X obj 315 129 pipe 1; +#X obj 315 89 t 0 0; +#X obj 87 206 pipe 900; +#X msg 154 173 900; +#X msg 199 173 1000; +#X obj 87 89 t b b b; +#X msg 87 129 12; +#X msg 175 129 11; +#X msg 130 129 0; +#X msg 87 55 bang; +#X connect 1 0 2 0; +#X connect 2 0 0 0; +#X connect 3 0 2 1; +#X connect 4 0 2 1; +#X connect 5 0 2 1; +#X connect 6 0 2 1; +#X connect 7 0 2 0; +#X connect 8 0 10 0; +#X connect 9 0 2 0; +#X connect 10 0 9 0; +#X connect 10 1 2 0; +#X connect 11 0 2 0; +#X connect 12 0 11 1; +#X connect 13 0 11 1; +#X connect 14 0 15 0; +#X connect 14 1 17 0; +#X connect 14 2 16 0; +#X connect 15 0 11 0; +#X connect 16 0 2 0; +#X connect 17 0 2 1; +#X connect 18 0 14 0; diff --git a/externals/miXed/test/cyclone/tosymbol-test.pd b/externals/miXed/test/cyclone/tosymbol-test.pd new file mode 100644 index 000000000..f20783117 --- /dev/null +++ b/externals/miXed/test/cyclone/tosymbol-test.pd @@ -0,0 +1,44 @@ +#N canvas 200 14 639 535 12; +#X obj 190 190 tosymbol; +#X msg 201 84 test; +#X obj 190 221 print; +#X msg 190 51 symbol test; +#X msg 259 84 bang; +#X msg 265 150 1 2 3; +#X msg 132 84 -0.99; +#X msg 265 119 one two three; +#X obj 28 221 prepend set; +#X msg 28 257 test; +#X msg 26 84 separator; +#X msg 26 115 separator /; +#X msg 405 119 one 2 3; +#X msg 341 150 1 two three; +#X msg 26 146 separator ----; +#X obj 329 51 testmess 300; +#X msg 414 20 test; +#X msg 329 20 7e+10; +#X msg 264 20 bang; +#X obj 478 51 testmess 3000; +#X msg 478 20 huge mess; +#X obj 478 82 print; +#X connect 0 0 2 0; +#X connect 0 0 8 0; +#X connect 1 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 7 0 0 0; +#X connect 8 0 9 0; +#X connect 10 0 0 0; +#X connect 11 0 0 0; +#X connect 12 0 0 0; +#X connect 13 0 0 0; +#X connect 14 0 0 0; +#X connect 15 0 0 0; +#X connect 16 0 15 0; +#X connect 17 0 15 0; +#X connect 18 0 15 0; +#X connect 19 0 0 0; +#X connect 19 0 21 0; +#X connect 20 0 19 0; diff --git a/externals/miXed/test/cyclone/train-test.pd b/externals/miXed/test/cyclone/train-test.pd new file mode 100644 index 000000000..cbf6c4a11 --- /dev/null +++ b/externals/miXed/test/cyclone/train-test.pd @@ -0,0 +1,17 @@ +#N canvas 450 299 450 300 12; +#X floatatom 71 50 5 0 0 0 - - -; +#X floatatom 95 77 5 0 0 0 - - -; +#X floatatom 120 108 5 0 0 0 - - -; +#X floatatom 71 229 5 0 0 0 - - -; +#X obj 158 229 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 201 187 capture~; +#X obj 71 144 train~; +#X obj 71 187 Snapshot~ 20; +#X connect 0 0 6 0; +#X connect 1 0 6 1; +#X connect 2 0 6 2; +#X connect 6 0 5 0; +#X connect 6 0 7 0; +#X connect 6 1 4 0; +#X connect 7 0 3 0; diff --git a/externals/miXed/test/cyclone/trig-test.pd b/externals/miXed/test/cyclone/trig-test.pd new file mode 100644 index 000000000..b4888f830 --- /dev/null +++ b/externals/miXed/test/cyclone/trig-test.pd @@ -0,0 +1,66 @@ +#N canvas 337 140 550 476 12; +#X obj 171 59 acos; +#X floatatom 171 33 5 0 0 0 - - -; +#X floatatom 171 88 0 0 0 0 - - -; +#X msg 236 33 bang; +#X floatatom 297 33 5 0 0 0 - - -; +#X floatatom 297 88 0 0 0 0 - - -; +#X obj 297 59 asin; +#X floatatom 101 139 5 0 0 0 - - -; +#X floatatom 101 194 0 0 0 0 - - -; +#X obj 101 165 cosh; +#X floatatom 230 139 5 0 0 0 - - -; +#X floatatom 230 194 0 0 0 0 - - -; +#X obj 230 165 sinh; +#X floatatom 366 139 5 0 0 0 - - -; +#X floatatom 366 194 0 0 0 0 - - -; +#X obj 366 165 tanh; +#X floatatom 40 320 5 0 0 0 - - -; +#X floatatom 40 405 0 0 0 0 - - -; +#X obj 40 346 cartopol; +#X floatatom 107 376 0 0 0 0 - - -; +#X floatatom 107 320 5 0 0 0 - - -; +#X floatatom 196 320 5 0 0 0 - - -; +#X floatatom 196 405 0 0 0 0 - - -; +#X floatatom 263 376 0 0 0 0 - - -; +#X floatatom 263 320 5 0 0 0 - - -; +#X obj 196 346 poltocar; +#X floatatom 346 320 5 0 0 0 - - -; +#X floatatom 346 405 0 0 0 0 - - -; +#X obj 346 346 cartopol; +#X floatatom 413 376 0 0 0 0 - - -; +#X floatatom 413 320 5 0 0 0 - - -; +#X obj 40 282 MouseState; +#X msg 40 253 poll; +#X msg 95 253 nopoll; +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 6 0; +#X connect 6 0 5 0; +#X connect 7 0 9 0; +#X connect 9 0 8 0; +#X connect 10 0 12 0; +#X connect 12 0 11 0; +#X connect 13 0 15 0; +#X connect 15 0 14 0; +#X connect 16 0 18 0; +#X connect 18 0 17 0; +#X connect 18 0 25 0; +#X connect 18 1 19 0; +#X connect 18 1 25 1; +#X connect 20 0 18 1; +#X connect 21 0 25 0; +#X connect 24 0 25 1; +#X connect 25 0 22 0; +#X connect 25 0 28 0; +#X connect 25 1 23 0; +#X connect 25 1 28 1; +#X connect 26 0 28 0; +#X connect 28 0 27 0; +#X connect 28 1 29 0; +#X connect 30 0 28 1; +#X connect 31 1 16 0; +#X connect 31 2 20 0; +#X connect 32 0 31 0; +#X connect 33 0 31 0; diff --git a/externals/miXed/test/cyclone/universal-test.pd b/externals/miXed/test/cyclone/universal-test.pd new file mode 100644 index 000000000..a1b083d8a --- /dev/null +++ b/externals/miXed/test/cyclone/universal-test.pd @@ -0,0 +1,55 @@ +#N canvas 329 126 483 198 12; +#X obj 25 60 universal; +#X msg 25 25 print bang; +#X obj 26 112 print one; +#X obj 27 152 print two; +#N canvas 0 0 384 238 sub 0; +#X obj 25 60 universal; +#X msg 25 25 print bang; +#X msg 159 25 print bang; +#X obj 159 60 universal 1; +#X obj 26 112 print sub-one; +#X obj 27 152 print sub-two; +#N canvas 0 0 390 231 sub-sub 0; +#X obj 25 60 universal; +#X msg 25 25 print bang; +#X msg 159 25 print bang; +#X obj 159 60 universal 1; +#X obj 26 112 print sub-sub-one; +#X obj 27 152 print sub-sub-two; +#X connect 1 0 0 0; +#X connect 2 0 3 0; +#X restore 212 151 pd sub-sub; +#X connect 1 0 0 0; +#X connect 2 0 3 0; +#X restore 163 152 pd sub; +#X msg 327 25 print bang; +#N canvas 0 0 384 238 zub 0; +#X obj 25 60 universal; +#X msg 25 25 print bang; +#X msg 159 25 print bang; +#X obj 159 60 universal 1; +#X obj 26 112 print zub-one; +#X obj 27 152 print zub-two; +#N canvas 0 0 390 231 zub-zub 0; +#X obj 25 60 universal; +#X msg 25 25 print bang; +#X msg 159 25 print bang; +#X obj 159 60 universal 1; +#X obj 26 112 print zub-zub-one; +#X obj 27 152 print zub-zub-two; +#X connect 1 0 0 0; +#X connect 2 0 3 0; +#X restore 212 151 pd zub-zub; +#X connect 1 0 0 0; +#X connect 2 0 3 0; +#X restore 262 152 pd zub; +#X obj 327 60 universal 1; +#X msg 138 25 print; +#X msg 206 25 print list; +#X msg 137 74 list; +#X connect 1 0 0 0; +#X connect 5 0 7 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 2 0; diff --git a/externals/miXed/test/cyclone/urn-test.pd b/externals/miXed/test/cyclone/urn-test.pd new file mode 100644 index 000000000..ab2787d38 --- /dev/null +++ b/externals/miXed/test/cyclone/urn-test.pd @@ -0,0 +1,15 @@ +#N canvas 433 476 450 300 12; +#X obj 152 131 urn 10; +#X obj 152 190 print; +#X msg 152 73 bang; +#X msg 220 73 clear; +#X msg 94 73 99; +#X msg 28 73 99.9; +#X msg 295 72 10000; +#X connect 0 0 1 0; +#X connect 0 1 1 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 1; diff --git a/externals/miXed/test/cyclone/vectral-test.pd b/externals/miXed/test/cyclone/vectral-test.pd new file mode 100644 index 000000000..dad23437f --- /dev/null +++ b/externals/miXed/test/cyclone/vectral-test.pd @@ -0,0 +1,56 @@ +#N canvas 368 287 673 449 12; +#X obj 268 277 Scope~ 307 152 2 3 128 0 1 0 0 0 0 102 255 51 135 135 +135 0; +#X floatatom 303 111 5 0 0 0 - - -; +#X msg 404 171 2; +#X floatatom 404 200 5 0 0 0 - - -; +#X msg 503 226 bufsize \$1; +#X floatatom 503 200 5 0 0 0 - - -; +#X floatatom 18 80 5 0 0 0 - - -; +#X floatatom 80 80 5 0 0 0 - - -; +#X floatatom 370 111 5 0 0 0 - - -; +#X obj 303 137 sig~; +#X obj 18 106 sig~; +#X obj 80 106 sig~; +#X obj 370 137 phasor~ 0.5; +#X obj 267 227 vectral~ 256; +#X obj 9 15 block~ 256; +#X msg 503 171 128; +#X msg 404 226 range 0 1; +#X msg 23 180 slide \$1; +#X floatatom 23 154 5 0 0 0 - - -; +#X obj 267 54 count~ 0 256 1 1; +#X floatatom 27 221 5 0 0 0 - - -; +#X msg 27 345 deltaclip \$1 \$2; +#X obj 27 253 t 0 0; +#X obj 67 286 * -1; +#X obj 27 316 pack; +#X obj 303 86 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 24 406 capture~ 256; +#X connect 1 0 9 0; +#X connect 2 0 3 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 4 0; +#X connect 6 0 10 0; +#X connect 7 0 11 0; +#X connect 8 0 12 0; +#X connect 9 0 13 2; +#X connect 10 0 13 0; +#X connect 11 0 13 1; +#X connect 13 0 0 0; +#X connect 13 0 26 0; +#X connect 15 0 5 0; +#X connect 16 0 0 0; +#X connect 17 0 13 0; +#X connect 18 0 17 0; +#X connect 19 0 13 0; +#X connect 19 0 13 1; +#X connect 20 0 22 0; +#X connect 21 0 13 0; +#X connect 22 0 24 0; +#X connect 22 1 23 0; +#X connect 23 0 24 1; +#X connect 24 0 21 0; +#X connect 25 0 1 0; diff --git a/externals/miXed/test/cyclone/xbend-test.pd b/externals/miXed/test/cyclone/xbend-test.pd new file mode 100644 index 000000000..c7dcaa8a2 --- /dev/null +++ b/externals/miXed/test/cyclone/xbend-test.pd @@ -0,0 +1,89 @@ +#N canvas 220 178 814 503 12; +#X msg 124 18 145 \, 0 \, 64; +#X msg 137 44 145 \, 1 \, 0; +#X floatatom 39 18 5 0 0; +#X msg 152 71 128 \, 2 \, 0; +#X msg 42 71 1 2 3; +#X msg 207 103 248; +#X msg 160 103 240; +#X obj 124 189 xbendin; +#X obj 124 225 funnel 2; +#X msg 198 143 224 \, 1 \, 2; +#X obj 247 189 xbendin 1; +#X obj 247 263 print single; +#X obj 124 263 print omni; +#X msg 311 143 225 \, 1 \, 2; +#X msg 499 18 145 \, 0 \, 64; +#X msg 512 44 145 \, 1 \, 0; +#X floatatom 414 18 5 0 0; +#X msg 527 71 128 \, 2 \, 0; +#X msg 417 71 1 2 3; +#X msg 582 103 248; +#X msg 535 103 240; +#X msg 573 143 224 \, 1 \, 2; +#X obj 622 263 print single; +#X obj 499 263 print omni; +#X msg 686 143 225 \, 1 \, 2; +#X obj 499 189 xbendin2; +#X obj 499 225 funnel 3; +#X obj 622 189 xbendin2 1; +#X obj 622 225 funnel 2; +#X obj 125 396 xbendout; +#X obj 125 442 print; +#X floatatom 125 327 5 0 0; +#X floatatom 192 358 5 0 0; +#X msg 50 358 bang; +#X obj 424 438 print; +#X floatatom 424 297 5 0 0; +#X floatatom 462 327 5 0 0; +#X msg 324 358 bang; +#X obj 424 392 xbendout2; +#X floatatom 500 358 5 0 0; +#X msg 360 327 1 2 3; +#X connect 0 0 7 0; +#X connect 1 0 7 0; +#X connect 2 0 7 0; +#X connect 2 0 10 0; +#X connect 3 0 7 0; +#X connect 4 0 7 0; +#X connect 4 0 10 0; +#X connect 5 0 7 0; +#X connect 6 0 7 0; +#X connect 7 0 8 0; +#X connect 7 1 8 1; +#X connect 8 0 12 0; +#X connect 9 0 7 0; +#X connect 9 0 10 0; +#X connect 10 0 11 0; +#X connect 13 0 7 0; +#X connect 13 0 10 0; +#X connect 14 0 25 0; +#X connect 15 0 25 0; +#X connect 16 0 25 0; +#X connect 16 0 27 0; +#X connect 17 0 25 0; +#X connect 18 0 25 0; +#X connect 18 0 27 0; +#X connect 19 0 25 0; +#X connect 20 0 25 0; +#X connect 21 0 25 0; +#X connect 21 0 27 0; +#X connect 24 0 25 0; +#X connect 24 0 27 0; +#X connect 25 0 26 0; +#X connect 25 1 26 1; +#X connect 25 2 26 2; +#X connect 26 0 23 0; +#X connect 27 0 28 0; +#X connect 27 1 28 1; +#X connect 28 0 22 0; +#X connect 29 0 30 0; +#X connect 31 0 29 0; +#X connect 32 0 29 1; +#X connect 33 0 29 0; +#X connect 35 0 38 0; +#X connect 36 0 38 1; +#X connect 37 0 38 0; +#X connect 38 0 34 0; +#X connect 39 0 38 2; +#X connect 40 0 38 0; diff --git a/externals/miXed/test/cyclone/xnote-test.pd b/externals/miXed/test/cyclone/xnote-test.pd new file mode 100644 index 000000000..8f9ac4463 --- /dev/null +++ b/externals/miXed/test/cyclone/xnote-test.pd @@ -0,0 +1,50 @@ +#N canvas 372 121 442 534 12; +#X msg 124 18 145 \, 0 \, 64; +#X msg 137 44 145 \, 1 \, 0; +#X floatatom 39 18 5 0 0; +#X msg 42 72 1 2 3; +#X msg 207 103 248; +#X msg 160 103 240; +#X msg 198 143 224 \, 1 \, 2; +#X obj 247 263 print single; +#X obj 124 263 print omni; +#X obj 116 482 print; +#X floatatom 116 317 5 0 0; +#X floatatom 138 341 5 0 0; +#X msg 41 367 bang; +#X obj 124 190 xnotein; +#X obj 124 225 funnel 4; +#X obj 247 225 funnel 3; +#X obj 247 190 xnotein 2; +#X msg 152 72 129 \, 2 \, 0; +#X obj 116 436 xnoteout; +#X floatatom 160 367 5 0 0; +#X floatatom 183 392 5 0 0; +#X connect 0 0 13 0; +#X connect 0 0 16 0; +#X connect 1 0 13 0; +#X connect 1 0 16 0; +#X connect 2 0 13 0; +#X connect 2 0 16 0; +#X connect 3 0 13 0; +#X connect 3 0 16 0; +#X connect 4 0 13 0; +#X connect 5 0 13 0; +#X connect 6 0 13 0; +#X connect 10 0 18 0; +#X connect 11 0 18 1; +#X connect 12 0 18 0; +#X connect 13 0 14 0; +#X connect 13 1 14 1; +#X connect 13 2 14 2; +#X connect 13 3 14 3; +#X connect 14 0 8 0; +#X connect 15 0 7 0; +#X connect 16 0 15 0; +#X connect 16 1 15 1; +#X connect 16 2 15 2; +#X connect 17 0 13 0; +#X connect 17 0 16 0; +#X connect 18 0 9 0; +#X connect 19 0 18 2; +#X connect 20 0 18 3; diff --git a/externals/miXed/test/cyclone/zerox-test.pd b/externals/miXed/test/cyclone/zerox-test.pd new file mode 100644 index 000000000..f57924298 --- /dev/null +++ b/externals/miXed/test/cyclone/zerox-test.pd @@ -0,0 +1,33 @@ +#N canvas 235 256 580 405 12; +#X obj 88 184 zerox~; +#X msg 154 149 set \$1; +#X floatatom 154 120 5 0 0 0 - - -; +#X obj 89 84 cycle~ 1; +#X floatatom 89 55 5 0 0 0 - - -; +#X obj 225 219 Snapshot~ 100; +#X floatatom 225 251 5 0 0 0 - - -; +#X obj 88 219 Snapshot~ 100; +#X floatatom 88 251 5 0 0 0 - - -; +#X obj 48 313 capture~ f 512; +#X msg 88 280 clear; +#X obj 409 184 zerox~; +#X obj 459 219 edge~; +#X obj 409 256 counter; +#X floatatom 409 288 5 0 0 0 - - -; +#X msg 376 219 set 0; +#X floatatom 409 149 5 0 0 0 - - -; +#X connect 0 0 7 0; +#X connect 0 0 9 0; +#X connect 0 1 5 0; +#X connect 1 0 0 0; +#X connect 2 0 1 0; +#X connect 3 0 0 0; +#X connect 4 0 3 0; +#X connect 5 0 6 0; +#X connect 7 0 8 0; +#X connect 10 0 9 0; +#X connect 11 1 12 0; +#X connect 12 0 13 0; +#X connect 13 0 14 0; +#X connect 15 0 13 0; +#X connect 16 0 11 0; diff --git a/externals/miXed/test/cyclone/zl-test.pd b/externals/miXed/test/cyclone/zl-test.pd new file mode 100644 index 000000000..64900d04f --- /dev/null +++ b/externals/miXed/test/cyclone/zl-test.pd @@ -0,0 +1,148 @@ +#N canvas 442 94 629 579 12; +#X msg 196 21 bang; +#X obj 196 161 zl group 3; +#X msg 296 21 a b c; +#X msg 62 133 symbol test; +#X floatatom 54 171 5 0 0 0 - - -; +#X msg 307 171 bang; +#X msg 308 105 symbol test; +#X floatatom 308 133 5 0 0 0 - - -; +#X msg 29 21 b c d e f; +#X msg 69 489 mode len \, debug \, bang \, mode previous \, debug; +#X msg 433 77 2nd; +#X msg 433 21 1st; +#X obj 433 105 testmess 150; +#X obj 433 49 testmess 150; +#X msg 69 517 mode reg \, debug \, bang \, mode previous \, debug; +#X msg 111 171 debug 1; +#X msg 54 77 -1 -2 -3 -4 -5; +#X msg 308 77 -4 -5 -6; +#X obj 524 237 zl; +#X msg 524 209 bang; +#X msg 462 209 debug; +#X msg 406 297 mode rev \, bang; +#X msg 487 21 set 1000; +#X msg 488 77 set 1000; +#X msg 406 353 mode union \, bang; +#X msg 406 325 mode sect \, bang; +#X floatatom 49 301 5 0 0 0 - - -; +#X msg 172 271 mode group \$1 \, bang; +#X floatatom 49 276 5 0 0 0 - - -; +#X msg 172 327 mode slice \$1 \, bang; +#X msg 406 381 mode join \, bang; +#X msg 172 243 mode iter \$1 \, bang; +#X floatatom 49 326 5 0 0 0 - - -; +#X floatatom 49 251 5 0 0 0 - - -; +#X msg 172 299 mode rot \$1 \, bang; +#X msg 172 355 mode ecils \$1 \, bang; +#X floatatom 49 351 5 0 0 0 - - -; +#X obj 196 189 print left; +#X obj 307 199 print right; +#X msg 172 383 mode nth \$1 \, bang; +#N canvas 0 0 450 300 prev 0; +#X obj 45 39 r doit; +#X obj 173 246 outlet; +#X obj 45 75 route mode; +#X obj 173 211 prepend mode; +#X obj 173 177 zl reg; +#X msg 173 143 bang; +#X obj 45 109 route len reg previous; +#X msg 92 177 debug 1; +#X connect 0 0 2 0; +#X connect 2 0 6 0; +#X connect 3 0 1 0; +#X connect 4 0 3 0; +#X connect 5 0 4 0; +#X connect 6 2 5 0; +#X connect 6 3 4 1; +#X connect 7 0 4 0; +#X restore 206 105 pd prev; +#X obj 41 549 s doit; +#X obj 359 458 s doit; +#X obj 196 133 r doit; +#X obj 409 133 s doit; +#X obj 104 458 s doit; +#X floatatom 49 382 5 0 0 0 - - -; +#X floatatom 49 407 5 0 0 0 - - -; +#X msg 172 411 mode nth \$1 x \, bang; +#X msg 406 409 mode sub \, bang; +#X obj 29 199 s doit; +#X msg 62 105 1 1 2 2 1 2; +#X msg 45 49 1 a b c test; +#X msg 259 49 1 2; +#X msg 308 49 148 149; +#X msg 487 133 bang; +#N canvas 419 256 450 300 more 0; +#X obj 118 117 zl sub; +#X obj 78 78 t a a; +#X obj 51 185 print upto; +#X obj 170 185 print downfrom; +#X msg 78 42 a list with a pattern to split upon; +#X msg 167 78 a pattern; +#X obj 51 150 zl slice; +#X msg 271 78 a list; +#X msg 351 78 upon; +#X msg 23 42 bang; +#X obj 23 78 t b b; +#X connect 0 0 6 1; +#X connect 1 0 6 0; +#X connect 1 1 0 0; +#X connect 4 0 1 0; +#X connect 5 0 0 1; +#X connect 6 0 2 0; +#X connect 6 1 3 0; +#X connect 7 0 0 1; +#X connect 8 0 0 1; +#X connect 9 0 10 0; +#X connect 10 0 6 0; +#X connect 10 1 0 0; +#X restore 396 251 pd more; +#X connect 0 0 1 0; +#X connect 1 0 37 0; +#X connect 1 1 38 0; +#X connect 2 0 1 1; +#X connect 3 0 50 0; +#X connect 4 0 50 0; +#X connect 5 0 1 1; +#X connect 6 0 1 1; +#X connect 7 0 1 1; +#X connect 8 0 50 0; +#X connect 9 0 41 0; +#X connect 10 0 12 0; +#X connect 11 0 13 0; +#X connect 12 0 1 1; +#X connect 13 0 44 0; +#X connect 14 0 41 0; +#X connect 15 0 1 0; +#X connect 16 0 50 0; +#X connect 17 0 1 1; +#X connect 19 0 18 0; +#X connect 20 0 18 0; +#X connect 21 0 42 0; +#X connect 22 0 13 0; +#X connect 23 0 12 0; +#X connect 24 0 42 0; +#X connect 25 0 42 0; +#X connect 26 0 34 0; +#X connect 27 0 45 0; +#X connect 28 0 27 0; +#X connect 29 0 45 0; +#X connect 30 0 42 0; +#X connect 31 0 45 0; +#X connect 32 0 29 0; +#X connect 33 0 31 0; +#X connect 34 0 45 0; +#X connect 35 0 45 0; +#X connect 36 0 35 0; +#X connect 39 0 45 0; +#X connect 40 0 1 0; +#X connect 43 0 1 0; +#X connect 46 0 39 0; +#X connect 47 0 48 0; +#X connect 48 0 45 0; +#X connect 49 0 42 0; +#X connect 51 0 50 0; +#X connect 52 0 50 0; +#X connect 53 0 1 1; +#X connect 54 0 1 1; +#X connect 55 0 12 0; diff --git a/externals/miXed/test/pddp/pddp.css b/externals/miXed/test/pddp/pddp.css new file mode 100644 index 000000000..40042d128 --- /dev/null +++ b/externals/miXed/test/pddp/pddp.css @@ -0,0 +1,18 @@ +body { + color: brown ; + background: gray url(test.bg.jpg) ; + margin-top: 10 ; + font-family: Helvetica, sans-serif ; + font-size: larger ; +} + +pre.programlisting { + display: table ; + background-color: #EEEEEE ; + padding: 2pt ; + border-style: solid ; + border-width: 1pt ; + border-color: #000000 ; + border-spacing: 3pt ; + margin: 3pt ; +} diff --git a/externals/miXed/test/pddp/pddplink-test-01.html b/externals/miXed/test/pddp/pddplink-test-01.html new file mode 100644 index 000000000..b73ea5473 --- /dev/null +++ b/externals/miXed/test/pddp/pddplink-test-01.html @@ -0,0 +1,5 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>first simple test</title><link rel="stylesheet" href="pddp.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2447708"></a>first simple test</h2></div></div><hr></div><p>test patch is here: <a href="pddplink-test-01.pd" target="_top">pddplink-test-01.pd</a></p><p>The above link works if you opened this page from Pd, + for example, by clicking on an object + </p><pre class="programlisting"><span><b class="command">pddplink</b></span> pddplink-test-01.html</pre><p> + </p><p>Pd links should also work in all pages opened through any other, + initiating, Pd-opened page.</p><p>Another simple test page is here: <a href="pddplink-test-02.html" target="_top">pddplink-test-02.html</a></p></div></body></html> diff --git a/externals/miXed/test/pddp/pddplink-test-01.pd b/externals/miXed/test/pddp/pddplink-test-01.pd new file mode 100644 index 000000000..e7ca4b0f2 --- /dev/null +++ b/externals/miXed/test/pddp/pddplink-test-01.pd @@ -0,0 +1,17 @@ +#N canvas 421 92 475 404 12; +#X text 20 10 first entry; +#X text 50 50 three ways of linking to a; +#X obj 270 50 pddplink pddplink-test-01.html -text local html page +; +#X obj 50 75 pddplink pddplink-test-01.html; +#X obj 50 110 pddplink pddplink-test-01.html -box; +#X text 50 170 three ways of linking to a; +#X obj 270 170 pddplink http://puredata.info -text remote html page +; +#X obj 50 195 pddplink http://puredata.info; +#X obj 50 230 pddplink http://puredata.info -box; +#X text 50 290 three ways of linking to; +#X obj 260 290 pddplink pddplink-test-02.pd -text another local patch +; +#X obj 50 315 pddplink pddplink-test-02.pd; +#X obj 50 350 pddplink pddplink-test-02.pd -box; diff --git a/externals/miXed/test/pddp/pddplink-test-01.xml b/externals/miXed/test/pddp/pddplink-test-01.xml new file mode 100644 index 000000000..0282ea63b --- /dev/null +++ b/externals/miXed/test/pddp/pddplink-test-01.xml @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> + +<sect1> + <title>first simple test</title> + + <para>test patch is here: <ulink url="pddplink-test-01.pd"/></para> + + <para>The above link works if you opened this page from Pd, + for example, by clicking on an object + <programlisting><command>pddplink</command> pddplink-test-01.html</programlisting> + </para> + + <para>Pd links should also work in all pages opened through any other, + initiating, Pd-opened page.</para> + + <para>Another simple test page is here: <ulink url="pddplink-test-02.html"/></para> +</sect1> diff --git a/externals/miXed/test/pddp/pddplink-test-02.html b/externals/miXed/test/pddp/pddplink-test-02.html new file mode 100644 index 000000000..aed49db84 --- /dev/null +++ b/externals/miXed/test/pddp/pddplink-test-02.html @@ -0,0 +1,5 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>second simple test</title><link rel="stylesheet" href="pddp.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2447708"></a>second simple test</h2></div></div><hr></div><p>test patch is here: <a href="pddplink-test-02.pd" target="_top">pddplink-test-02.pd</a></p><p>The above link works if you opened this page from Pd, + for example, by clicking on an object + </p><pre class="programlisting"><span><b class="command">pddplink</b></span> pddplink-test-02.html</pre><p> + </p><p>Pd links should also work in all pages opened through any other, + initiating, Pd-opened page.</p><p>Another simple test page is here: <a href="pddplink-test-01.html" target="_top">pddplink-test-01.html</a></p></div></body></html> diff --git a/externals/miXed/test/pddp/pddplink-test-02.pd b/externals/miXed/test/pddp/pddplink-test-02.pd new file mode 100644 index 000000000..839c0b610 --- /dev/null +++ b/externals/miXed/test/pddp/pddplink-test-02.pd @@ -0,0 +1,17 @@ +#N canvas 321 192 475 404 12; +#X text 20 10 first entry; +#X text 50 50 three ways of linking to a; +#X obj 270 50 pddplink pddplink-test-02.html -text local html page +; +#X obj 50 75 pddplink pddplink-test-02.html; +#X obj 50 110 pddplink pddplink-test-02.html -box; +#X text 50 170 three ways of linking to a; +#X obj 270 170 pddplink http://puredata.info -text remote html page +; +#X obj 50 195 pddplink http://puredata.info; +#X obj 50 230 pddplink http://puredata.info -box; +#X text 50 290 three ways of linking to; +#X obj 260 290 pddplink pddplink-test-01.pd -text another local patch +; +#X obj 50 315 pddplink pddplink-test-01.pd; +#X obj 50 350 pddplink pddplink-test-01.pd -box; diff --git a/externals/miXed/test/pddp/pddplink-test-02.xml b/externals/miXed/test/pddp/pddplink-test-02.xml new file mode 100644 index 000000000..349f95e85 --- /dev/null +++ b/externals/miXed/test/pddp/pddplink-test-02.xml @@ -0,0 +1,19 @@ +<?xml version="1.0"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> + +<sect1> + <title>second simple test</title> + + <para>test patch is here: <ulink url="pddplink-test-02.pd"/></para> + + <para>The above link works if you opened this page from Pd, + for example, by clicking on an object + <programlisting><command>pddplink</command> pddplink-test-02.html</programlisting> + </para> + + <para>Pd links should also work in all pages opened through any other, + initiating, Pd-opened page.</para> + + <para>Another simple test page is here: <ulink url="pddplink-test-01.html"/></para> +</sect1> diff --git a/externals/miXed/test/pddp/test.bg.jpg b/externals/miXed/test/pddp/test.bg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8224bbc5b68ee4e6dd586ebc20536d0a4894d5f6 GIT binary patch literal 5491 zcmbuB2UJtp*2ixOB%uV75Mbyf5Q>2GI#Q$sL7E6MNC&CX+eitBG?kXnK{^Nws6Y^e zCoPm<qbtRcZW%#9L>yFJz?pe7Z_WGG`_|i8cb}ZS?>+aw&pG$r-@&tk1%TbekYEUa zz#zbw{sRuynNlpg0zv~qyaED+6lISCYI+1S$U1On?1yInAOQS(dz5>Bl!G66x;u<P znT~p(Z#_KwQICm!<u?N#UH9RrV+_c7deSp~bkBGc0sR&!FDU#YqCn4p0DHRs{T$_^ zh|IqtM`P~M`v4F~uj6kG^6D`Cx2c2wC3jTww;4FBm0l-U=iBkyd?4si0KrXnhjT#u zc7W(@5B)FvGr$di4*qU6z5;kdZ$A&Ah+yx~P>+j3u2Dj|?g6eILVv8$O(7-vA{}f1 z$fE?{P9Ky$*c^}uu)yJP1e^tdU_mi6F{7|-EG%qTZVU#C!EmEkj_kMQTj$?Bh?SX{ z70JquM6z=rkw}h1hvfKn3F^NY;GhRU!Rgf!As`U|i~>PWpo8ZC6o4O4LE3bc44@;U z3qCXmeHTI*7-4V(6Eo=Flk`mo`8~-FfS@1<7z$>9F~S)jEQ<6b3IY{I%QNU&x?n_t z;uRP<vdZu1iQ=$Uy{?K%!3kq0VPe_Vn~Pg+A<CQ;&6maXNoU**`YJ<JxW;XkJhodB z`zOMd-y7n|RaaVbsFN!@)s%s$)emPq!;^Ar+6JfBc2$jRFGM8g)!rR?`tl<R0E6jj zp+}lvj10<05`^W^P`ZL35e$Pud=|%{f?lh!O+}pRVsJwCNo%ZIh|-oA<DmeUxN_e( zT|_09yMc{LsK?SD68^IS{J$g|%mOTsqkEzNZD1#R0TfE(0Whdfw^_mwtc?thp#@_n zHm6CwK~@yoAhA9pN>>dd_w-PE!I+X-?)6!a_?dRiVF7}qKhK_D2Q`LvH5AfpmXz?3 zE#w-2*%C*{mu(VEa4@uCvDok=fe*+ef&y`SxQY2;9IkrSodz-B?CN+NVjqoZUH4AX z7oYGPD`St{A=Ao;syYz6_mYVLbBx9X#%;#e<05O>1!Yne#pFxIFX)xdn<}wtk|%`N z)y#QyNOknv$mD@=S;Kr{?F3(=JepL01UJ6hy(hyw@P><+_QB{*QVHOm9c_J&@bP5j zZS#(v)A5zW3ZCg!46dDaMcO8>&1060fgLpea#sVI>Y2b&%JC~#&=YrZO?zGpyB1nt z$yi(*9LQ|AjE+PQLCv2uBN38Tr`N0Cqa5)vb+=>j1423hW6&B|K7Vm!W_E$%<U9dD z_UgxA+E3LQR)x1dsJVnEjz33)WLuTAa!26p5D1)dBQZ*{6}fh*TO@OmdnJN!D)`y+ zGI?Rq&ZGkTJsn^s<$2FuHT#0&B^@uqsSICZ<Z=mzdoHEYFx|Y+0uh*SDf<Qp2VwOw zi8~nEA=(Q!dgD@Yb(~$jQS^I@mpl$x=wYt_aO&Fx9tLTfOdM&jWaMfw{VfvGA*`;* z+lqW!jFM&D-6fN$zdD0p`qjxnxL+zVvqJ-kVUpE@u5dnFHMfQ_t6*BxWc)+iLWDlp zMUg1*5`s5FTXis+4kbhdP&PCI^NA`H;`RBeb$8Ud3&8|A`qpdHn^1jEkd-Oe&UgzX zUvk;Wuc|s}f{_LJy4N=~HJ*0bGwOPGVNpa<H<aAC1os<CvoHmeR>+jOhENkk{4JiU z+Jo_(gvHy8!#TnV#-kvbakj?_d;$7c)SIEJ&c5EWO1;K-!|FKCDM~4FRn~B9-5G7- zA}}g`30M8N39QD)#!)!k>aXz~IfWIMcd4Yp3{ayqhfb2o<!uhjnnuZCsM{*gWE9Q3 z)t|*XU!$%)^OYC+(jKn5bwx9==MwUzd9TW-;j@C3+N6B1<7lhP`9kaK6&5<a#cB)D zR<b~D>TbFfQAabQK)Y8=hKB}?ti3pH41KbR*byu#U#wFN?FCL(LCJ$BskB+9D9=v{ z=I&Lb+e$i9CM@Yad$`(ziJd%vkyhd%+Um266KlUtMc~%G5Ja~Kg4j?#{h>q3ebiUN z`?mgU1ktBbMxUQ_vmhtD!T|cX>ISeXNuz2>9cEQbc`W1iO8Iyej)Ypt&S}P(cf7u8 z6rsacE4)IOtXgaJ_r|=?CwJwkp(^z}Rrs}%QV3ty;@L5p6Mlr_nox2l2x#BlplJw# z`gJmA0Zob)n4~NET8D?Ul${%rFSfM;4jdgnuW^G0b~rV}U#&$D8@!N6Ze{(vYX(K1 zZt08iyExaU2W@}YNz5)inA|D&*s}ml6*cUfH_a{`=%nyu=ldnNm`t60xeZtBiwyMQ z5ogFGEO>!E?}k4W^b2G%anf;yA1?}=Tj%3<DE9XoY>E(*2?x|*WOB>=!pR>LF4Zw6 z-5?0z2vD_rRG%~MK}UqJn6%Zx&tRR)RMe6+<H?kbOSQSlAdCQg$D%!5%^@_2XnklA zzU$&Cv)jr~$>dsNmw-4Nk(G6V{_KPRUZG|iA~0N4b+CvtM|pftj0ifx>DE0oB%)(h zpr1y6XH4y6^0s$Ubr28$^1=%38=e||r^lGfKS-<2zTsj>As-Y(tvmIkeTWA-=*;#A zVf-8)Uxtv>$!!)fu?Y3^_w&h|2q8`hmq9Z^ItV6UQ&LZ6rqD(xH88K8l^RY&CwmQ} z!z3l0PyTQ(OaoeVhqPR_C8jQiw~L>VJ-wv-Han+5N09KG#O=$t_6zNbh-0K6x@b=J z`uVkNva=HU*(O4L%^3~nsZHj;6*P8l-PGY@(2GQJ**I)`Rfy-A*tog-#w3-Hn)4m2 zJ4jADf&P-1-YHT3h*?1AK17K9{5>fd`NQ_9`O&2)D~eruSa=y>uNEV;?INKWwwoNX zl$&6DV!Eo@=M|#I3-?823~UYT5>0(_hk0X3C3S>TIzn6+h*e1yznfJ|H?+9F6~T(= zd1_sGDYB~O7{vG515$51PiJDj!%KF?>5l}W&gROe5fkfK`%&EcpYS3A8w2xLPD<4; zbr)|J6S7V9OzbFB0D5E91RhCZ^)f}whL;u)$``MPT-$?^TMU=!8VGxM-xP1{;^nGp zP7QaE7L@X$ZaD)=J^&78j`-;t*}>>^Nk;<^aPU8|51jGP=pN1jhrwBpOmH|8lAV=~ zGpy|Y4Z463barAwFe4DmNM=@MB<hfTeuJL>2m8bUaeu=;74!;We?}hw$^Zc~f`H%H z2MmV%Ir~@k0fQii?869y&>c7g1csoX00SL<bS)V%E_C?eP{=BWVZX7*q9Uj3CN4N( zOYEeQb#_IwTS%X>KAu$BqQZ5?J+yy(2`+va!NmPtBH6&Os`c!IjRep3^7}*n@d&$; z^NoT20|KcT+j&K%<lk%`e)eilQk`(lJ1VuHu7fu7`jeD~iM`K{X@&LoMrPmq`i+$! z3=DLBgTf&Y|37d|m%);*m@z0mOQHPECP(ksqNpC$$~AaP5vO!Afiv4$tir9i4;C`6 zyrh4b>kNs$BHZ7Js~GU$-9v3uw<}xvB_t=7-zSo*TK_89@K4<KXKee6=Kn+TU-4?g zpvUUNitVC}Lxr|$eEZko5l6Uyk(F62U&PHjbpg!|YaNuko}O5z_!H9>O4re)yaG;0 z8~!vlYY)D{_IJ%OXCa@9ZEhv0M>d{+7Bgd@!o06e&}Xz2<h>zP$v@sm&8_Xb&)tw} zF_7=S8xkhS-XJ$)nQs9+uDZLuX1#A_<H?PlRaVyowTU;q<83yK)w(y1ZV<$3Bh@nX zu4w70VjUzLVQds#-GMW1*qn3I$qRc0El`Gm6GQ7N&fbr%fV0wCySb>w^V<&u8cO5! zuIxprSSnXatPdR{N?gep*sV+JOz27uUf%7_J5I{cyL@-n?`Fb}{?r>vn}aR&J?YYh z*a4@5(G7_gaMUE}^Gv{SX?n)cuAvj&@_~o$t}Qo8RA(qlHcDC1VYY5Fcx9h$bx;CU zMBB$NI#36iN2j`izoMU?c=~q1R`gE5ZLUutY}c=Xy&a`<Arfoe!(Vbnn6Oa<>;AV* z*syc|IL*RY%GBm;(nF5>P&9O02>%Sa%H`DZI(I2nK&}4O7kgtnwryMPP7(jdCSPVQ zBw!pJ=47w(CR+HOHvO5qp?L5oi>Z_^S%p`gmGQANZI7ImGMWDA1xCe5?ztjpH}>g$ zsdsItjxDF{kmC`1>>u{cic$>Vj4$6d*>PmH6n5-OX}UJ5f0+Tb?JLz-tBU+&AZls( zu0Rhpn4DHhNe7gDyc#y+)4C7FHkd3dQHW#eihNN7Gafxau(^Z$KAWIc2pZx6=h|jh z=SNEyu1zhpU?vv7R9?FP(u=3PSXWpj*@x_%{QB5Vnl`O{c{j?n!MvhOhIjFiUB*pn z>D9#{IdN^~G|9bm8;9*>Lz{iIh78Q+q!il_|M`&&is?f(sUQ~b>w%Tap;|?Ydx6sF zztA#d@w>q^gNwm}Z3;w&aU4`kUBz<m)kcxzQoBuWL1n#!qZ8%p>GKu|lUjCe`Q@%J zD5l<Zs01HPx%aM3Ryk<)o}m46Cd0b^Q(SyLr{pgd1#OPV-C0tPYlxSXWn!0VaO`kb zRGq1ii{q<VHJkY2a9`Q2V@Z|1E5<j(o{lr+INGf?5_ly9z1GC8y9-&rtzT7l6tmZ+ z6s|orG87)&7TryE8?d|@;DlT+s^1iZ>I8d^@Wq8Q_|nU}5DqSNkIDKxlY@dm?%X;y zV1sbO4;}zWuf7Hjlal-5Y7Kc;&OeHjOOAHlN!Y^Ly6hJ5_eQ2<K26=bvvJNog|l|I zOWvl|<5+h1asd$)`=R6AoOD9_QvaeLM&&$qE<=jpOR>#B7NH_qpS~nl;I8W5t2J3> znQPcY-q30u##+DOx%8zntreU$iFKfOjdY&*tc~&bLbS~j-Ipu?l^a1)-c*7c8JrTU zZfLjU)*OH9b82smVQz6jBLAz*ND)J=?gUf!!Ni6s*M4;!b~T@j{nF-8;qYEUY9sPi z^C~gL-A3=_Zn|%g!*|bPY%9vX6t}w8y}6C8?I*`Y_S!2_*;?`i%q?1()NXArHR`vT zTgErW`6`yK!bl#Q=lDUfx+jheT*Xj749LpY2itF5*f%5poauP_W!hfE1BsQehPa&E zNtP5KV0M6&ho|d$FL#j5!%oIPBXPd79YxC$Pj-Wvwxk(%9w@6VHDtvoF{y@ZsrZCA zZ_CMQUyxrYqpF`RTHCYuvB|u5*B0wl^7L99Z|T)J*;IZTLW5vhM<uedh$mQ`l)@i% zcXq&`OZ|Jqh>cJtZx;Sml9LKtkhq$&S+)S9&XF7taR-wdPN+QR$eSZ#v3>IAKPh@- z7Yz)L#me3Akfz>cnQo(48Hr_nj#XQdsPF3iYDpF#-m!}FuvIA6;<4=Q_6Tg~h;}TT z$j-Q$;TNDPKgF5C<}|CeD#eiqi))>6x+qWm%oJp6g2NdSw*p$9E!?SOuME@*!RYbl zPnR-Xt2+Nx=K1|;snMl#Z(_0h%~LedSgrdbYc}@x(l0Nq7M!m)kqO_o!}b@&ke;r~ zKO(@HX?klQ?*ZED2kABziLWpm_Y4$-4CZau-SS7bndj1Oj(DE$9@&@9MLogR0nw(< zEXJ4}k><a)FO1-XBm`dabS2{jF`&)u5oUu%Um4Z7XeK(=Ol|1g48gCfEp;Rdfk#_n zYKEkKbnW)~`dBF#)h)W^Nue}ZwYtnLe07KzJfX0kwYiG*@6L(4pzMuT5#*Y&>1$%h zQWIvG$q>=YR*T=YRi#2G;5MI4IE8O+-Pu+Gdu(NAmCTKeP(A?g$KLBcN?F~tRpzPV z67Hrxx?-<s$eB!9HMRq>Yh%6+ziofhEfQl=%F>_teaGE_cv%<xN6WZgzQ>;<Md~|Q z+a6R>5c`5B+DCnw?y#kv=8(N;G7R5)k|h7B1J@vNOYnwv+MxdY)qkjMHCdn)LDo)` zwDv^v<QvW+SOe&!WxD6e=Si#5mUjj5QX&R>uvtHwgXs-nw}vgNbIn8cxaf2DCn7zP zJh2wK-zyA<8I`ZhH2Pax<jl7O3S#1N((T{&uUoHsmZPSg^u>-k)Yoiiu-&f2I>0n! zovluoYTR7<DLA3IOsn49LW8C3W~;tXw$EGhXsOjROMGctd-py((4%rnadb3BD{9Cw zth|5`U#A0%(8Bm#Sh`eA8VjF+ZPs29zrl}zLeeoc4=W7ON=cWSuifS>ee2bI%%%p8 zOVzz47(E|58z;ZIx$GwYt_SIC!TF2nJ)k&M`^{40rVMqxC#EttF8tvdrM9OM<1)gQ zm}5S}U3ONdi<dNUUy5QO^kUcO=b4nSYx<qWb8YsO?`YFq^=67fl`1c@ep#k}F=qY= D7kUm} literal 0 HcmV?d00001 diff --git a/externals/miXed/test/pddp/toonepage b/externals/miXed/test/pddp/toonepage new file mode 100755 index 000000000..f59273aa2 --- /dev/null +++ b/externals/miXed/test/pddp/toonepage @@ -0,0 +1,21 @@ +#!/bin/bash + +usage () { + cat << EOF +usage: toonepage <pddpsource>.xml +EOF +} + +[ "$#" == 0 ] && { usage; exit 1; } + +SOURCE_NAME="$(basename $1)" +SOURCE_STUB="$(basename $SOURCE_NAME .xml)" + +[ $SOURCE_STUB == $SOURCE_NAME ] && { usage; exit 1; } + +xmllint >/dev/null --xinclude --postvalid $1 +xsltproc --nonet --xinclude \ + --stringparam html.stylesheet pddp.css \ + -o "$SOURCE_STUB.html" \ + /usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl \ + $1 diff --git a/externals/miXed/test/pddp/topdf b/externals/miXed/test/pddp/topdf new file mode 100755 index 000000000..adf4b4331 --- /dev/null +++ b/externals/miXed/test/pddp/topdf @@ -0,0 +1,23 @@ +#!/bin/bash + +usage () { + cat << EOF +usage: topdf <pddpsource>.xml +EOF +} + +[ "$#" == 0 ] && { usage; exit 1; } + +SOURCE_NAME="$(basename $1)" +SOURCE_STUB="$(basename $SOURCE_NAME .xml)" + +[ $SOURCE_STUB == $SOURCE_NAME ] && { usage; exit 1; } + +xmllint >/dev/null --xinclude --postvalid $1 +xsltproc --nonet --xinclude \ + -o "$SOURCE_STUB.fo" \ + /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl \ + $1 + +# FIXME need to run this twice, it should be check-wrapped too +pdfxmltex "$SOURCE_STUB.fo" diff --git a/externals/miXed/test/toxy/button-test.pd b/externals/miXed/test/toxy/button-test.pd new file mode 100644 index 000000000..221031937 --- /dev/null +++ b/externals/miXed/test/toxy/button-test.pd @@ -0,0 +1,44 @@ +#N canvas 106 44 636 366 12; +#X obj 21 259 widget button b -bg red -activebackground yellow -text +red -command .<.>; +#X msg 130 162 -command .<.>; +#X msg 48 295 debug; +#X obj 21 324 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X obj 193 268 r t1; +#X obj 193 324 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 45 74 -bg pink -text pink; +#X msg 21 21 -bg red -text red; +#X msg 34 47 -bg green -text green; +#X msg 56 101 -bg gray -text ""; +#X msg 250 74 query tk_chooseColor; +#X obj 250 101 tot .; +#X msg 166 186 -command .<:t1 bang.>; +#X msg 68 186 -width \$1; +#X floatatom 68 162 5 0 0 0 - - -; +#X msg 62 132 set -activebackground \$1; +#X msg 90 213 -command .(set c [tk_chooseColor] .: eval .<| set "-bg" +$c "-text" $c.>.); +#X obj 294 268 loadbang; +#X msg 294 295 set @vis .- config -textvariable ""; +#X obj 250 21 widget button bb -bg green -activebackground yellow +-command .<.> ; +#X connect 0 0 3 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 4 0 5 0; +#X connect 6 0 0 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 11 0; +#X connect 11 0 15 0; +#X connect 12 0 0 0; +#X connect 13 0 0 0; +#X connect 14 0 13 0; +#X connect 15 0 0 0; +#X connect 16 0 0 0; +#X connect 17 0 18 0; +#X connect 18 0 0 0; +#X connect 19 0 10 0; diff --git a/externals/miXed/test/toxy/defaults-test.pd b/externals/miXed/test/toxy/defaults-test.pd new file mode 100644 index 000000000..c0c5aaf1a --- /dev/null +++ b/externals/miXed/test/toxy/defaults-test.pd @@ -0,0 +1,25 @@ +#N canvas 281 172 504 371 12; +#X obj 247 89 widget bang b; +#X obj 33 89 widget float f; +#X obj 124 247 widget symbol s; +#X floatatom 33 325 5 0 0 0 - - -; +#X obj 247 175 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 124 325 print; +#X msg 33 20 debug; +#X msg 247 20 bang; +#X msg 307 55 remove @bang; +#X msg 307 20 @bang .- invoke; +#X floatatom 121 20 5 0 0 0 - - -; +#X msg 124 206 symbol test; +#X connect 0 0 4 0; +#X connect 1 0 3 0; +#X connect 2 0 5 0; +#X connect 6 0 0 0; +#X connect 6 0 1 0; +#X connect 6 0 2 0; +#X connect 7 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 1 0; +#X connect 11 0 2 0; diff --git a/externals/miXed/test/toxy/editors/bpf-test.pd b/externals/miXed/test/toxy/editors/bpf-test.pd new file mode 100644 index 000000000..77fc3fc4c --- /dev/null +++ b/externals/miXed/test/toxy/editors/bpf-test.pd @@ -0,0 +1,13 @@ +#N canvas 212 48 778 592 12; +#X obj 70 95 widget bpf f1; +#X obj 240 321 widget bpf f1; +#X obj 432 92 widget bpf f2; +#X msg 77 331 redefine; +#X obj 77 370 tow . bpf f1; +#X msg 80 432 redefine; +#X msg 578 336 redefine; +#X obj 578 375 tow . bpf f2; +#X obj 80 471 tow . bpf; +#X connect 3 0 4 0; +#X connect 5 0 8 0; +#X connect 6 0 7 0; diff --git a/externals/miXed/test/toxy/editors/bpf.wid b/externals/miXed/test/toxy/editors/bpf.wid new file mode 100644 index 000000000..6fa7f4523 --- /dev/null +++ b/externals/miXed/test/toxy/editors/bpf.wid @@ -0,0 +1,224 @@ +::toxy::console show +::toxy::package_require BLT "e:/Tcl/bin/BLT24.dll" + +namespace eval ::toxy::bpf {} + +proc ::toxy::bpf::ondrag {path ndx} { + set ${path}::idrag $ndx + if {$ndx > 0} { + incr ndx -1 + set ${path}::mindrag [${path}::xvec range $ndx $ndx] + incr ndx + } else { + set ${path}::mindrag 0 + } + incr ndx + if {$ndx < [${path}::xvec length]} { + set ${path}::maxdrag [${path}::xvec range $ndx $ndx] + } else { + set ${path}::maxdrag [set ${path}::xmax] + } +} + +proc ::toxy::bpf::atData {path args} { + set cmd [lindex $args 0] + switch -- $cmd { + set { + set idrag [lindex $args 1] + set gx [lindex $args 2] + set gy [lindex $args 3] + if {[string is double -strict $idrag] && + [string is double -strict $gx] && + [string is double -strict $gy]} { + + ${path}::xvec variable xvec + ${path}::yvec variable yvec + array set xvec [list $idrag $gx] + array set yvec [list $idrag $gy] + ${path}::xvec sort ${path}::yvec ${path}::zvec + } + } + add { + set gx [lindex $args 1] + set gy [lindex $args 2] + if {[string is double -strict $gx] && + [string is double -strict $gy]} { + + ${path}::xvec append $gx + ${path}::yvec append $gy + ${path}::zvec append 0 + ${path}::xvec sort ${path}::yvec ${path}::zvec + set ndx [${path}::xvec search $gx] + if {[llength $ndx] > 1} { + set ndx [lindex $ndx 0] + } elseif {[llength $ndx] < 1} { + set ${path}::idrag -1 + return + } + ::toxy::bpf::ondrag $path $ndx + } + } + } +} + +proc ::toxy::bpf::motion {path x y} { + if {[set ${path}::locked]} { return } + if {[$path element closest $x $y cl -halo 10 el]} { + $path config -cursor arrow + } else { + $path config -cursor crosshair + } +} + +proc ::toxy::bpf::b1motion {path x y} { + if {[set ${path}::locked]} { return } + variable ${path}::idrag + if {$idrag >= 0 && [$path inside $x $y]} { + variable ${path}::mindrag + variable ${path}::maxdrag + set gxy [$path invtransform $x $y] + set gx [lindex $gxy 0] + if {$gx < $mindrag} { + set gx $mindrag + } elseif {$gx > $maxdrag} { + set gx $maxdrag + } + ${path}::xvec variable xvec + ${path}::yvec variable yvec + array set xvec [list $idrag $gx] + array set yvec [list $idrag [lindex $gxy 1]] + } +} + +proc ::toxy::bpf::b1release {path x y} { + if {[set ${path}::locked]} { return } + variable ${path}::idrag + if {$idrag >= 0 && [$path inside $x $y]} { + variable ${path}::mindrag + variable ${path}::maxdrag + set gxy [$path invtransform $x $y] + set gx [lindex $gxy 0] + set gy [lindex $gxy 1] + if {$gx < $mindrag} { + set gx $mindrag + } elseif {$gx > $maxdrag} { + set gx $maxdrag + } + + variable ${path}::target + pd $target.rp _data set $idrag $gx $gy \; + } + set ${path}::idrag -1 + set ${path}::mindrag 0 + set ${path}::maxdrag ${path}::xmax +} + +proc ::toxy::bpf::b1click {path x y} { + if {[set ${path}::locked]} { return } + if {[$path element closest $x $y cl -halo 10 el]} { + set gxy [$path invtransform $x $y] + set ${path}::xdrag [lindex $gxy 0] + set ${path}::ydrag [lindex $gxy 1] + ::toxy::bpf::ondrag $path $cl(index) + } elseif {[$path inside $x $y]} { + set gxy [$path invtransform $x $y] + set ${path}::xdrag [lindex $gxy 0] + set ${path}::ydrag [lindex $gxy 1] + variable ${path}::xdrag + variable ${path}::ydrag + + variable ${path}::target + pd $target.rp _data add $xdrag $ydrag \; + } else { + set ${path}::idrag -1 + } +} + +proc ::toxy::bpf::shiftb1click {path x y} { + if {[set ${path}::locked]} { return } + if {[$path element closest $x $y cl -halo 10 el]} { + set ndx $cl(index) + ${path}::xvec delete $ndx + ${path}::yvec delete $ndx + ${path}::zvec delete $ndx + } + set ${path}::idrag -1 +} + +proc ::toxy::bpf::lock {path v} { + set ${path}::locked $v + if {$v} { + $path config -cursor hand2 + } else { + $path config -cursor crosshair + } +} + +proc ::toxy::bpf::atVis {path} { + bind $path <Motion> +[concat ::toxy::bpf::motion %W %x %y] + bind $path <1> +[concat ::toxy::bpf::b1click %W %x %y] + bind $path <B1-Motion> +[concat ::toxy::bpf::b1motion %W %x %y] + bind $path <ButtonRelease> +[concat ::toxy::bpf::b1release %W %x %y] + bind $path <<disable>> +[concat ::toxy::bpf::lock %W 1] + bind $path <<enable>> +[concat ::toxy::bpf::lock %W 0] + $path element bind el <Shift-1> "::toxy::bpf::shiftb1click %W %x %y" +} + +proc ::toxy::bpf::atNew {path} { + variable ${path}::xmax + variable ${path}::ymin + variable ${path}::ymax + $path axis configure x -min 0.0 -max $xmax + $path axis configure y -min $ymin -max $ymax + $path element create el -x ${path}::xvec -y ${path}::yvec \ + -symbol "circle" -pixels 2 -linewidth 2 -color darkgreen -hide 0 + $path legend config -hide yes +} + +proc ::toxy::bpf::atFree {path} { + blt::vector destroy ${path}::xvec + blt::vector destroy ${path}::yvec + blt::vector destroy ${path}::zvec +} + +#> bpf blt::graph +#. -width 300 -height 200 -bg lightblue -plotbackground lightgrey -halo 10 +#. #domain 1000. + +#@ vis + +# LATER reconsider calling standard procs implicitly, followed by scripts +::toxy::bpf::atVis .- + +#@ new + +# LATER reconsider replacing this with global .- (using ::${path} in procs) +namespace eval ::toxy::bpf::.- { +# this might be implicit + set target .| + +# array interface seems broken inside namespaces +# (cf sf.net/projects/blt bug 651993) + blt::vector create xvec -variable "" + blt::vector create yvec -variable "" + blt::vector create zvec -variable "" + set locked 0 + set xmax .#domain + set ymin 0.0 + set ymax 1.0 + set idrag -1 + set mindrag 0 + set maxdrag $xmax + set xdrag 0 + set ydrag 0 +} + +::toxy::bpf::atNew .- + +#@ free + +::toxy::bpf::atFree .- + +#@ data + +::toxy::bpf::atData .- .#args diff --git a/externals/miXed/test/toxy/kb-test.pd b/externals/miXed/test/toxy/kb-test.pd new file mode 100644 index 000000000..df6fdefb9 --- /dev/null +++ b/externals/miXed/test/toxy/kb-test.pd @@ -0,0 +1,63 @@ +#N canvas 238 92 749 477 12; +#X obj 37 59 widget kb k1; +#X floatatom 37 160 5 0 0 0 - - -; +#X obj 37 310 widget kb k2 #oct 10 #size 0.5 -bg red; +#X floatatom 37 402 5 0 0 0 - - -; +#X floatatom 120 237 5 0 0 0 - - -; +#X floatatom 37 24 5 0 0 0 - - -; +#X msg 114 24 bang; +#X floatatom 37 237 5 0 0 0 - - -; +#X floatatom 205 237 5 0 0 0 - - -; +#X msg 205 271 #size \$1; +#X msg 120 271 #oct \$1; +#X msg 180 24 redefine; +#X msg 374 196 redefine; +#X obj 111 160 unpack; +#X floatatom 154 196 5 0 0 0 - - -; +#X obj 108 402 unpack; +#X floatatom 151 437 5 0 0 0 - - -; +#X obj 214 160 print; +#X obj 309 271 print; +#X msg 284 24 clear; +#X obj 309 233 tow . kb k2; +#X msg 309 196 bang; +#N canvas 126 77 407 234 out 0; +#X obj 119 28 inlet; +#X obj 119 65 unpack; +#X obj 119 185 s sf2in; +#X obj 119 145 pack; +#X obj 217 28 inlet; +#X obj 119 103 + 24; +#X connect 0 0 1 0; +#X connect 1 0 5 0; +#X connect 1 1 3 1; +#X connect 3 0 2 0; +#X connect 4 0 5 1; +#X connect 5 0 3 0; +#X restore 382 271 pd out; +#X floatatom 425 233 5 0 0 0 - - -; +#X msg 474 196 clear; +#X obj 483 233 tow . kb k1; +#X connect 0 0 1 0; +#X connect 0 0 13 0; +#X connect 0 0 17 0; +#X connect 2 0 3 0; +#X connect 2 0 15 0; +#X connect 4 0 10 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 7 0 2 0; +#X connect 8 0 9 0; +#X connect 9 0 2 0; +#X connect 10 0 2 0; +#X connect 11 0 0 0; +#X connect 12 0 20 0; +#X connect 13 1 14 0; +#X connect 15 1 16 0; +#X connect 19 0 0 0; +#X connect 20 0 18 0; +#X connect 20 0 22 0; +#X connect 21 0 20 0; +#X connect 23 0 22 1; +#X connect 24 0 20 0; +#X connect 25 0 22 0; diff --git a/externals/miXed/test/toxy/kb.wid b/externals/miXed/test/toxy/kb.wid new file mode 100644 index 000000000..b3bd051ce --- /dev/null +++ b/externals/miXed/test/toxy/kb.wid @@ -0,0 +1,215 @@ +proc ::toxy::kbout {path target remote oldchord newchord} { + foreach key $oldchord { + pd [concat $target _cb [lindex $key 0] 0 \;] + if {$remote != "."} { + pd [concat $remote [lindex $key 0] 0 \;] + } + } + foreach key $newchord { + pd [concat $target _cb [lindex $key 0] [lindex $key 1] \;] + if {$remote != "."} { + pd [concat $remote [lindex $key 0] [lindex $key 1] \;] + } + } +} + +proc ::toxy::kbput {path target remote keys appendmode doout} { + set oldchord {} + set newchord {} + if {$appendmode} { + foreach key $keys { + set ndx [lindex $key 0] +# FIXME upper limit + if {$ndx >= 0} { + if {$appendmode == 1} { + set found \ + [lsearch $::toxy::kbchord($target) [concat $ndx *]] + } else { set found -1 } + if {$found < 0} { + $path itemconfig $path.$ndx -fill grey + lappend newchord $key + lappend ::toxy::kbchord($target) $key + } else { + $path itemconfig $path.$ndx \ + -fill [lindex [$path gettags $path.$ndx] 2] + lappend oldchord $key + set ::toxy::kbchord($target) \ + [lreplace $::toxy::kbchord($target) $found $found] + } + } + } +# FIXME oldchord + set ::toxy::kbchord($target) \ + [lsort -unique -integer -index 0 $::toxy::kbchord($target)] + } else { + set oldchord $::toxy::kbchord($target) + foreach key $::toxy::kbchord($target) { + set ndx [lindex $key 0] + $path itemconfig $path.$ndx \ + -fill [lindex [$path gettags $path.$ndx] 2] + } + foreach key $keys { + set ndx [lindex $key 0] +# FIXME upper limit + if {$ndx >= 0} { + $path itemconfig $path.$ndx -fill grey + lappend newchord $key + } + } + set ::toxy::kbchord($target) [lsort -unique -integer -index 0 $newchord] + } + if {$doout} { + ::toxy::kbout $path $target $remote $oldchord $newchord + } +} + +proc ::toxy::kb {path target remote noctaves size} { +# guard against BadAlloc crashes + if {$size > 10} {set size 10} + set lft [expr {round(5 * $size)}] + set top [expr {round(5 * $size)}] + set bot [expr {round(100 * $size)}] + set dx [expr {round(17 * $size)}] + set wid [expr {round($dx - $size * .5)}] + set blbot [expr {round($bot * .65)}] + + $path config -height [expr {$bot + $top}] \ + -width [expr {$dx * ($noctaves * 7 + 1) + $lft * 2 - 1}] + + bind $path <Enter> +[concat ::toxy::kbenter $path $target] + bind $path <Leave> +[concat ::toxy::kbleave $path $target] + bind $path <B1-Motion> \ + +[concat ::toxy::kbdrag $path $target $remote %X %Y 0] + bind $path <B1-Shift-Motion> \ + +[concat ::toxy::kbdrag $path $target $remote %X %Y 1] + bind $path <B1-Control-Motion> \ + +[concat ::toxy::kbdrag $path $target $remote %X %Y 2] + + for {set octave 0} {$octave <= $noctaves} {incr octave} { + set prevkey 0 + foreach key {0 2 4 5 7 9 11} { + set ndx [expr $octave * 12 + $key] + set id [$path create rect $lft $top [expr {$lft + $wid}] $bot \ + -fill white -tags "$ndx $path.$ndx white"] + $path bind $id <1> \ + [concat ::toxy::kbpress $path $target $remote $ndx %y 0] + $path bind $id <Shift-1> \ + [concat ::toxy::kbpress $path $target $remote $ndx %y 1] + $path bind $id <Control-1> \ + [concat ::toxy::kbcontrolon $path $target $remote $ndx %y] + $path bind $id <Control-ButtonRelease> \ + [concat ::toxy::kbcontroloff $path $target $remote $ndx] + if {$key - $prevkey > 1} { + incr ndx -1 + set x [expr {$lft - $wid * .22}] + set id [$path create rect $x $top [expr {$x + $wid * .44}] \ + $blbot -fill black -tags "$ndx $path.$ndx black"] + $path bind $id <1> \ + [concat ::toxy::kbpress $path $target $remote $ndx %y 0] + $path bind $id <Shift-1> \ + [concat ::toxy::kbpress $path $target $remote $ndx %y 1] + $path bind $id <Control-1> \ + [concat ::toxy::kbcontrolon $path $target $remote $ndx %y] + $path bind $id <Control-ButtonRelease> \ + [concat ::toxy::kbcontroloff $path $target $remote $ndx] + } + set prevkey $key + incr lft $dx + if {$octave == $noctaves && $key == 0} break + } + } + set ::toxy::kbisinside($target) 0 + set chord $::toxy::kbchord($target) + set ::toxy::kbchord($target) {} + ::toxy::kbput $path $target $remote $chord 0 0 +} + +proc ::toxy::kbgetvel {path ndx y} { + set g [$path coords $path.$ndx] + set top [lindex $g 1] + set bot [lindex $g 3] + set vel [expr 100.0 - 99.0 * ($top - $y) / ($top - $bot)] + if {$vel < 1.0} {set vel 1.0} elseif {$vel > 100.0} {set vel 100.0} + return $vel +} + +proc ::toxy::kbcontrolon {path target remote ndx y} { + if {[$path cget -state] == "normal"} { + $path itemconfig $path.$ndx -fill red + ::toxy::kbout $path $target $remote {} \ + [list [concat $ndx [::toxy::kbgetvel $path $ndx $y]]] + } +} + +proc ::toxy::kbcontroloff {path target remote ndx} { + if {[$path cget -state] == "normal"} { + if {[lsearch $::toxy::kbchord($target) [concat $ndx *]] < 0} { + $path itemconfig $path.$ndx \ + -fill [lindex [$path gettags $path.$ndx] 2] + } else { + $path itemconfig $path.$ndx -fill grey + } + ::toxy::kbout $path $target $remote [list [concat $ndx 0]] {} + } +} + +proc ::toxy::kbpress {path target remote ndx y shift} { + if {[$path cget -state] == "normal"} { + ::toxy::kbput $path $target $remote \ + [list [concat $ndx [::toxy::kbgetvel $path $ndx $y]]] $shift 1 + } +} + +proc ::toxy::kbdrag {path target remote rx ry shift} { + if {$shift <= 1 && $::toxy::kbisinside($target) && \ + [$path cget -state] == "normal"} { + set x [expr $rx - [winfo rootx $path]] + set y [expr $ry - [winfo rooty $path]] + set ndx [lindex [$path gettags [$path find closest $x $y]] 0] + if {[lsearch $::toxy::kbchord($target) [concat $ndx *]] < 0} { + ::toxy::kbput $path $target $remote \ + [list [concat $ndx [::toxy::kbgetvel $path $ndx $y]]] $shift 1 + } + } +} + +proc ::toxy::kbenter {path target} { + set ::toxy::kbisinside($target) 1 +} + +proc ::toxy::kbleave {path target} { + set ::toxy::kbisinside($target) 0 +} + +proc ::toxy::kbbang {path target remote} { + ::toxy::kbout $path $target $remote {} $::toxy::kbchord($target) +} + +proc ::toxy::kbfloat {path target remote ndx} { + ::toxy::kbput $path $target $remote [list [concat $ndx 50.0]] 0 1 +} + +proc ::toxy::kblist {path target remote args} { +# LATER (::toxy::kbput ... 1) +} + +proc ::toxy::kbset {path target remote args} { +# LATER (::toxy::kbput ... 0) +} + +#> kb canvas +#. -bg yellow -cursor hand1 +#. #oct 4 #size .75 +#. @bang ::toxy::kbbang .- .| . +#. @float ::toxy::kbfloat .- .| . .#1 +#. @list ::toxy::kblist .- .| . .#args +#. @set ::toxy::kbset .- .| . .#args +#. @clear ::toxy::kbput .- .| . {} 0 1 + +::toxy::kb .- .| . .#oct .#size + +#@ new +set ::toxy::kbchord(.|) {} + +#@ free +unset ::toxy::kbchord(.|) diff --git a/externals/miXed/test/toxy/lbpict-test.pd b/externals/miXed/test/toxy/lbpict-test.pd new file mode 100644 index 000000000..b2214b67f --- /dev/null +++ b/externals/miXed/test/toxy/lbpict-test.pd @@ -0,0 +1,3 @@ +#N canvas 0 0 756 516 12; +#X obj 47 50 widget lbpict p1 #fname /usr/lib/tk8.4/demos/images/earth.gif +; diff --git a/externals/miXed/test/toxy/lbpict.wid b/externals/miXed/test/toxy/lbpict.wid new file mode 100644 index 000000000..6378f8ef4 --- /dev/null +++ b/externals/miXed/test/toxy/lbpict.wid @@ -0,0 +1,9 @@ +proc ::toxy::lbpict {path fname} { + if {[catch {$path config -image [image create photo -file $fname]} res]} { + puts stderr [concat failed ::toxy::lbpict: $res] + } +} + +#> lbpict label + +::toxy::lbpict .- .#fname diff --git a/externals/miXed/test/toxy/listbox-test.pd b/externals/miXed/test/toxy/listbox-test.pd new file mode 100644 index 000000000..99bf2e8be --- /dev/null +++ b/externals/miXed/test/toxy/listbox-test.pd @@ -0,0 +1,24 @@ +#N canvas 445 76 626 425 12; +#X obj 281 179 widget listbox lb -width 32 -height 12 -bg black -fg +white @bang ::toxy::lbcommand .- .|; +#X obj 20 295 tow . listbox lb; +#X obj 20 23 loadbang; +#X obj 236 179 widget button b -text ok -height 1 -bg black -fg white +-command .<.>; +#X obj 84 179 tow . button b; +#X msg 20 337; +#X msg 54 257 tot puts [.- size]; +#X msg 44 222 tot .- delete 0 end; +#X msg 33 179 bang; +#X msg 20 57 tot proc ::toxy::lbcommand .(path target.) .(if .([$path +curselection] != "".) .(pd [concat $target _cb set [$path get [$path +curselection]] .`.:].).) \, @vis if .([.- size] == 0.) .(foreach fn +[lsort [glob *]] .(.- insert end $fn.) .: bind .- <Double-Button-1> +.(::toxy::lbcommand .- .|.).) \, @bang ::toxy::lbcommand .- .|; +#X connect 1 0 5 0; +#X connect 2 0 9 0; +#X connect 4 0 1 0; +#X connect 6 0 1 0; +#X connect 7 0 1 0; +#X connect 8 0 1 0; +#X connect 9 0 1 0; diff --git a/externals/miXed/test/toxy/multiscale-test.pd b/externals/miXed/test/toxy/multiscale-test.pd new file mode 100644 index 000000000..9776d2725 --- /dev/null +++ b/externals/miXed/test/toxy/multiscale-test.pd @@ -0,0 +1,58 @@ +#N canvas 39 49 800 548 12; +#X obj 25 84 widget multiscale m1 #n 50 #dx 15 #dy 90; +#X obj 25 326 widget multiscale m2 #bg red #dy 120; +#X msg 25 52 #n \$1; +#X floatatom 25 23 5 0 0 0 - - -; +#N canvas 0 0 450 300 graph1 0; +#X array t 50 float 0; +#X coords 0 100 49 0 400 140 1; +#X restore 296 206 graph; +#X obj 265 511 tabwrite t; +#X obj 25 474 unpack; +#X floatatom 25 511 5 0 0 0 - - -; +#X floatatom 98 511 5 0 0 0 - - -; +#X floatatom 94 199 5 0 0 0 - - -; +#X obj 589 511 tabread t; +#X obj 589 477 t 0 0; +#X obj 589 413 until; +#X obj 265 477 tow . multiscale m1; +#X obj 589 381 r rcount; +#X obj 589 445 int; +#X obj 629 445 + 1; +#X obj 527 511 pack; +#X msg 265 445 tot pd [concat rcount .#n .`.:]; +#X obj 265 408 t b b; +#X msg 653 413 0; +#X obj 127 23 widget button b -command .<.> -bg yellow -width 3 -height +2; +#X obj 265 372 tow . button b; +#X obj 25 228 pack; +#X floatatom 25 199 5 0 0 0 - - -; +#X msg 95 282 #hi \$1; +#X floatatom 95 246 5 0 0 0 - - -; +#X connect 1 0 6 0; +#X connect 2 0 0 0; +#X connect 3 0 2 0; +#X connect 6 0 7 0; +#X connect 6 1 8 0; +#X connect 9 0 1 0; +#X connect 9 0 23 1; +#X connect 10 0 17 0; +#X connect 11 0 10 0; +#X connect 11 1 17 1; +#X connect 12 0 15 0; +#X connect 13 0 5 0; +#X connect 14 0 12 0; +#X connect 15 0 16 0; +#X connect 15 0 11 0; +#X connect 16 0 15 1; +#X connect 17 0 13 0; +#X connect 18 0 13 0; +#X connect 19 0 18 0; +#X connect 19 1 20 0; +#X connect 20 0 15 1; +#X connect 22 0 19 0; +#X connect 23 0 1 0; +#X connect 24 0 23 0; +#X connect 25 0 1 0; +#X connect 26 0 25 0; diff --git a/externals/miXed/test/toxy/multiscale.wid b/externals/miXed/test/toxy/multiscale.wid new file mode 100644 index 000000000..063146bd6 --- /dev/null +++ b/externals/miXed/test/toxy/multiscale.wid @@ -0,0 +1,52 @@ +proc ::toxy::multiscale_command {target sel ndx v} { + pd [concat $target $sel $v $ndx \;] +} + +proc ::toxy::multiscale_float {path target count ndx} { + if {$ndx >= 0 && $ndx < $count} { + pd [concat $target _cb [$path.s$ndx get] $ndx \;] + } +} + +proc ::toxy::multiscale_list {path count ndx v} { + if {$ndx >= 0 && $ndx < $count} { + $path.s$ndx set $v + } +} + +proc ::toxy::multiscale {path cvpath target remote count lo hi res dx dy bg} { + if {[winfo exists $path.s0]} { +# puts stderr [concat $path.s0 exists] + } else { + set width [expr {$count * $dx + 10}] + set height [expr {$dy + 10}] + $path config -width $width -height $height -bg $bg + set px 5 + set py 5 + for {set ndx 0} {$ndx < $count} {incr ndx} { + scale $path.s$ndx -width $dx -length $dy \ + -from $hi -to $lo -resolution $res \ + -bg $bg -highlightthickness 0 \ + -command [concat ::toxy::multiscale_command $target _cb $ndx] + if {$dx < 50} { + $path.s$ndx config -showvalue 0 -relief flat + } else { + $path.s$ndx config -digits 3 -relief sunken + } + set id [$path create window $px $py -width $dx -height $dy \ + -anchor nw -window $path.s$ndx -tags $path.s$ndx] + ::toxy::subwidget $path.s$ndx $path $cvpath $target + incr px $dx + } + } +} + +#> multiscale canvas +# FIXME fractional resolution: scalePtr->value == value fails in TkScaleSetValue +#. #n 3 #lo 0 #hi 100 #res 1 +#. #dx 60 #dy 90 +#. #bg yellow +#. @float ::toxy::multiscale_float .- .| .#n .#1 +#. @list ::toxy::multiscale_list .- .#n .#2 .#1 + +::toxy::multiscale .- .^.c .| . .#n .#lo .#hi .#res .#dx .#dy .#bg diff --git a/externals/miXed/test/toxy/pop1.wid b/externals/miXed/test/toxy/pop1.wid new file mode 100644 index 000000000..88b659529 --- /dev/null +++ b/externals/miXed/test/toxy/pop1.wid @@ -0,0 +1,10 @@ +#> pop1 menubutton +#. -menu .-.pop +#. -bg purple -fg white -activebackground magenta -width 8 -text jeden +#. @float if .(.#1 >= 1.) .(.-.pop invoke .#1.) + +::toxy::popup .- .| rpop1 \ + [list {one jeden} {two dwa} {three trzy} \ + {four cztery} {five piêæ} {six sze¶æ} {seven siedem} \ + {eight osiem} {nine dziewiêæ} {ten dziesiêæ}] \ + -bg purple -fg white -activebackground magenta diff --git a/externals/miXed/test/toxy/pop2.wid b/externals/miXed/test/toxy/pop2.wid new file mode 100644 index 000000000..8f7ccf58b --- /dev/null +++ b/externals/miXed/test/toxy/pop2.wid @@ -0,0 +1,8 @@ +#> pop2 menubutton +#. -menu .-.pop +#. -bg purple -fg white -activebackground magenta -width 6 -text kura +#. @float if .(.#1 >= 1.) .(.-.pop invoke .#1.) + +::toxy::popup .- .| rpop2 \ + [list {hen kura} {duck kaczka} {cat kot} {cow krowa} {horse koñ}] \ + -bg purple -fg white -activebackground magenta diff --git a/externals/miXed/test/toxy/popcustom-test.pd b/externals/miXed/test/toxy/popcustom-test.pd new file mode 100644 index 000000000..2589bfe6d --- /dev/null +++ b/externals/miXed/test/toxy/popcustom-test.pd @@ -0,0 +1,39 @@ +#N canvas 356 9 338 241 12; +#X obj 38 104 r rpop; +#X floatatom 38 142 5 0 0 0 - - -; +#X floatatom 120 142 5 0 0 0 - - -; +#X obj 120 104 r rpop1; +#X floatatom 210 142 5 0 0 0 - - -; +#X obj 210 104 r rpop2; +#N canvas 12 11 293 279 blackpanel 1; +#X obj 23 111 widget menubutton mb -menu .-.pop -bg green -activebackground +yellow -width 5 -text one @float if .(.#1 >= 1.) .(.-.pop invoke .#1.) +; +#X obj 23 12 loadbang; +#X obj 96 110 widget pop1 p1; +#X obj 188 110 widget pop2 p2; +#X msg 23 41 set @vis ::toxy::popup .- .| rpop [list one two three four five] +-bg green -activebackground yellow .: destroy .^.m .: .^.scrollvert +configure -width 0 .: .^.scrollhort configure -width 0 .: .^.c configure +-bg black; +#X obj 23 150 r topop; +#X obj 96 150 r topop1; +#X obj 188 150 r topop2; +#X connect 1 0 4 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 2 0; +#X connect 7 0 3 0; +#X restore 95 198 pd blackpanel; +#X floatatom 38 24 5 0 0 0 - - -; +#X floatatom 120 24 5 0 0 0 - - -; +#X floatatom 210 24 5 0 0 0 - - -; +#X obj 38 58 s topop; +#X obj 120 58 s topop1; +#X obj 210 58 s topop2; +#X connect 0 0 1 0; +#X connect 3 0 2 0; +#X connect 5 0 4 0; +#X connect 7 0 10 0; +#X connect 8 0 11 0; +#X connect 9 0 12 0; diff --git a/externals/miXed/test/toxy/popup-test.pd b/externals/miXed/test/toxy/popup-test.pd new file mode 100644 index 000000000..ff8df82e2 --- /dev/null +++ b/externals/miXed/test/toxy/popup-test.pd @@ -0,0 +1,51 @@ +#N canvas 80 56 700 405 12; +#X obj 17 17 widget popup p #items [.- config] -width 20; +#X obj 20 130 tow . popup p; +#X floatatom 20 71 5 0 0 0 - - -; +#X obj 437 287 tow . popup q; +#X obj 271 17 widget popup q -width 40; +#X obj 20 208 t 0 0; +#X obj 150 130 r rdefault; +#X msg 55 249 list rdefault \$1 3; +#X msg 20 287 list rcurrent \$1 4; +#X msg 89 71 tot pd [concat \$1 set [lindex [.- config [lindex [lindex +[.- config] \$2] 0]] \$3] .`.:]; +#X obj 20 170 - 1; +#X obj 331 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 405 130 r rcurrent; +#X msg 150 170; +#X msg 405 170; +#X obj 225 213 route set; +#X obj 331 249 random 20; +#X msg 437 249 tot .-.pop add separator; +#X msg 225 330 tot .-.pop add command -label \$1 .: set [.- cget -textvariable] +\$1; +#X obj 490 208 sel 1; +#X obj 331 170 t 0 0; +#X obj 331 208 metro 500; +#X obj 225 249 route float; +#X obj 308 287 symbol; +#X connect 1 0 10 0; +#X connect 2 0 1 0; +#X connect 5 0 8 0; +#X connect 5 1 7 0; +#X connect 6 0 13 0; +#X connect 7 0 9 0; +#X connect 8 0 9 0; +#X connect 9 0 1 0; +#X connect 10 0 5 0; +#X connect 11 0 20 0; +#X connect 12 0 14 0; +#X connect 12 0 15 0; +#X connect 15 0 22 0; +#X connect 16 0 8 0; +#X connect 17 0 3 0; +#X connect 18 0 3 0; +#X connect 19 0 17 0; +#X connect 20 0 21 0; +#X connect 20 1 19 0; +#X connect 21 0 16 0; +#X connect 22 0 18 0; +#X connect 22 1 23 0; +#X connect 23 0 18 0; diff --git a/externals/miXed/test/toxy/radio-test.pd b/externals/miXed/test/toxy/radio-test.pd new file mode 100644 index 000000000..24e1a3b66 --- /dev/null +++ b/externals/miXed/test/toxy/radio-test.pd @@ -0,0 +1,50 @@ +#N canvas 179 90 559 300 12; +#X obj 20 158 widget radiobutton r -variable ::toxy::r -value 0 -command +.<:common $::toxy::r.> -bg orange -activebackground magenta -width +44 -height 44 -indicatoron off -image ::toxy::img::empty; +#X obj 70 158 widget radiobutton r -variable ::toxy::r -value 1 -command +.<:common $::toxy::r.> -bg orange -activebackground magenta -width +44 -height 44 -indicatoron off -image ::toxy::img::empty; +#X obj 120 158 widget radiobutton r -variable ::toxy::r -value 2 -command +.<:common $::toxy::r.> -bg orange -activebackground magenta -width +44 -height 44 -indicatoron off -image ::toxy::img::empty; +#X obj 170 158 widget radiobutton r -variable ::toxy::r -value 3 -command +.<:common $::toxy::r.> -bg orange -activebackground magenta -width +44 -height 44 -indicatoron off -image ::toxy::img::empty; +#X obj 20 221 r t0; +#X obj 70 221 r t1; +#X obj 120 221 r t2; +#X obj 170 221 r t3; +#X obj 261 260 hradio 15 1 0 4 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X obj 20 127 t a; +#X obj 20 260 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 70 260 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 120 260 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 170 260 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 261 222 r common; +#X msg 20 15 -command .<:common $::toxy::r.>; +#X msg 31 46 -command .<:[join [list t $::toxy::r] ""] $::toxy::r.> +; +#X obj 366 260 hradio 15 1 0 4 empty empty empty 0 -6 0 8 -262144 -1 +-1 0; +#X connect 4 0 10 0; +#X connect 4 0 8 0; +#X connect 5 0 11 0; +#X connect 5 0 8 0; +#X connect 6 0 12 0; +#X connect 6 0 8 0; +#X connect 7 0 13 0; +#X connect 7 0 8 0; +#X connect 9 0 0 0; +#X connect 9 0 1 0; +#X connect 9 0 2 0; +#X connect 9 0 3 0; +#X connect 14 0 8 0; +#X connect 14 0 17 0; +#X connect 15 0 9 0; +#X connect 16 0 9 0; diff --git a/externals/miXed/test/toxy/scale-test.pd b/externals/miXed/test/toxy/scale-test.pd new file mode 100644 index 000000000..dad485f65 --- /dev/null +++ b/externals/miXed/test/toxy/scale-test.pd @@ -0,0 +1,47 @@ +#N canvas 79 51 599 397 12; +#X obj 22 197 widget scale s -command [concat ::toxy::scale_command +.| _cb] -variable ::toxy::simplescale -label "Simple Scale" -orient +h -length 300 -width 50 -font "Helvetica 12" -from -16 -to 16 -showvalue +0 @float .- set .#1; +#X floatatom 22 336 5 0 0 0 - - -; +#X floatatom 191 128 5 0 0 0 - - -; +#X msg 191 159 -from \$1; +#X floatatom 287 128 5 0 0 0 - - -; +#X msg 287 159 -to \$1; +#X msg 44 159 -showvalue \$1; +#X obj 44 133 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X floatatom 214 336 5 0 0 0 - - -; +#X msg 33 103 -command [concat ::toxy::scale_command .| _cb]; +#X obj 214 306 r \$0-scale; +#X msg 22 70 -command [concat ::toxy::scale_command \$1-scale float] +; +#X obj 22 10 loadbang; +#X obj 22 40 int \$0; +#X msg 113 10 bang; +#X msg 188 10 @float .- set .#1; +#X msg 188 40 remove @float; +#X floatatom 89 45 5 0 0 0 - - -; +#N canvas 0 0 450 420 linked 0; +#X obj 54 49 widget scale s -command [concat ::toxy::scale_command .| +_cb] -variable ::toxy::simplescale -orient v -length 300 -width 50 +-font "Helvetica 12" -from -16 -to 16 -showvalue 0 @float .- set .#1 +; +#X coords 0 0 1 1 80 360 1; +#X restore 472 20 pd linked; +#X connect 0 0 1 0; +#X connect 2 0 3 0; +#X connect 3 0 0 0; +#X connect 4 0 5 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 7 0 6 0; +#X connect 9 0 0 0; +#X connect 10 0 8 0; +#X connect 11 0 0 0; +#X connect 12 0 13 0; +#X connect 13 0 11 0; +#X connect 14 0 13 0; +#X connect 15 0 0 0; +#X connect 16 0 0 0; +#X connect 17 0 0 0; diff --git a/externals/miXed/test/toxy/setup.wid b/externals/miXed/test/toxy/setup.wid new file mode 100644 index 000000000..0794ce8d3 --- /dev/null +++ b/externals/miXed/test/toxy/setup.wid @@ -0,0 +1,344 @@ +package provide toxywidgets 0.1.0.17 + +# LATER keep standard widget setup in a .tcl file (transfered into a .wiq), and +# glue separate .wid files with standard widget definitions into another .wiq +# LATER think about using a slave interpreter, and a toxy-specific connection +# LATER gather aqua incompatibilities, and decide, if there is no other +# way than branching (different meaning of -bg, -borderwidth trouble, +# right click, etc.) + +# LATER ask for adding something of the sort to pd.tk: +bind Canvas <1> {+focus %W} + +# FIXME args +proc ::toxy::package_require {pkg dll} { + if {[catch {package require $pkg} res] == 0} { + puts stderr "using package $pkg $res" + } elseif {[catch {load $dll $pkg}] != 0} { + puts stderr "ERROR: missing package $pkg ($res)" + } +} + +# valid options: "show", "hide" +proc ::toxy::console {op} { + if {[catch {::console $op}]} { + if {[catch {package require tkcon}] == 0} { + tkcon $op + } + } +} + +# FIXME this should be explicitly requested +# In order to keep the state after tk canvas has been destroyed +# try setting -variable and -textvariable traces + +proc ::toxy::item_dotrace {target varname ndxname op} { + if {[catch {set v [set $varname]} res] == 0} { + if {$v != [set $varname.last]} { +# FIXME activate this on demand (for explicit traces) +# pd $target.rp _data $v \; + set $varname.last $v + } + } else { puts stderr [concat failed ::toxy::item_dotrace: $res] } +} + +proc ::toxy::item_bindtrace {varname mastername ndxname op} { + set $varname [set $mastername] +} + +proc ::toxy::item_settrace {op path target varname} { + if {[catch {$path cget $op} res] == 0} { + if {$res == ""} { + if {[catch {$path config $op $varname} err]} { + error $err + } + } else { + if {[info tclversion] < 8.4} { + trace variable $res w "::toxy::item_bindtrace $varname" + } else { + trace add variable $res write "::toxy::item_bindtrace $varname" + } + } + if {![info exists $varname.last]} { set $varname.last "" } + if {[info tclversion] < 8.4} { + trace variable $varname w "::toxy::item_dotrace $target" + } else { + trace add variable $varname write "::toxy::item_dotrace $target" + } + return + } else { return 0 } +} + +# LATER revisit -- seems clumsy and fragile +proc ::toxy::item_removetrace {op path varname} { + if {[catch {$path cget $op} res] == 0} { + if {$res == $varname} { + if {[catch {$path config $op ""} err]} { + error $err + } + } elseif {$res != ""} { + if {[info tclversion] < 8.4} { + catch { trace vdelete $res w "::toxy::item_bindtrace $varname" } + } else { + catch { trace remove variable \ + $res write "::toxy::item_bindtrace $varname" } + } + } + } +} + +proc ::toxy::item_destroy {path varname} { + ::toxy::item_removetrace -variable $path $varname.var + ::toxy::item_removetrace -textvariable $path $varname.txt + if {[info tclversion] < 8.4} { + catch { unset $varname.last $varname.var $varname.txt $varname } + } else { + unset -nocomplain $varname.last $varname.var $varname.txt $varname + } + catch {destroy $path} +} + +proc ::toxy::item_getconfig {path target} { + set wd [winfo reqwidth $path] + set ht [winfo reqheight $path] + if {$wd < 2 || $ht < 2} { +# LATER rethink + update idletasks + set wd [winfo width $path] + set ht [winfo height $path] + } + pd $target.rp _config $target.rp [$path cget -bg] $wd $ht \ + [catch {$path config -state normal}]\; +} + +proc ::toxy::item_visconfig {path target name varname cvpath px py} { + if {[info exists ::toxy::itemoptions]} { + set failed [catch {eval $path config $::toxy::itemoptions} res] + unset ::toxy::itemoptions + if {$failed} { error [concat in $path config: $res] } + } + + if {[info exists ::toxy::longnewhook]} { + set failed [catch {eval $::toxy::longnewhook} res] + unset ::toxy::longnewhook + if {$failed} { error [concat in ::toxy::longnewhook: $res] } + } + + $cvpath create window $px $py \ + -anchor nw -window $path -tags [concat toxy$name $target] + +# FIXME use ${name}::explicittrace + if {[info exists ::toxy::storethispath]} { +# FIXME explicit traces + set needtraces 0 + } else { + set needtraces 1 + } + + if {$needtraces != 0} { + if {[catch {::toxy::item_settrace -variable \ + $path $target $varname.var} res1]} { + error [concat in ::toxy::item_settrace: $res1] + } + if {[catch {::toxy::item_settrace -textvariable \ + $path $target $varname.txt} res2]} { + error [concat in ::toxy::item_settrace: $res2] + } +# puts stderr [concat traces: ($res1) ($res2)] + if {$res1 == 0 && $res2 == 0} { +# puts stderr [concat toxy warning: $path untraceable] + } + } + + set failed [catch {::toxy::master $path $cvpath $target} res] + if {$failed} { error [concat in ::toxy::master: $res] } + + if {[info exists ::toxy::longvishook]} { + set failed [catch {eval $::toxy::longvishook} res] + unset ::toxy::longvishook + if {$failed} { error [concat in ::toxy::longvishook: $res] } + } + if {[info exists ::toxy::shortvishook]} { + set failed [catch {eval $::toxy::shortvishook} res] + unset ::toxy::shortvishook + if {$failed} { error [concat in ::toxy::shortvishook: $res] } + } + + ::toxy::item_getconfig $path $target + + return +} + +proc ::toxy::item_vis {tkclass path target name varname cvpath px py} { + if {[winfo exists $path]} { +# puts stderr [concat $path exists] + set ::toxy::itemfailure 0 + } else { + set ::toxy::itemfailure [catch {$tkclass $path} ::toxy::itemerrmess] + } + if {$::toxy::itemfailure == 0} { + set ::toxy::itemfailure [catch {::toxy::item_visconfig \ + $path $target $name $varname $cvpath $px $py} \ + ::toxy::itemerrmess] + } + if {$::toxy::itemfailure} { + if {[winfo exists $path]} {destroy $path} + puts stderr [concat tcl error: $::toxy::itemerrmess] + pd $target.rp _failure \; + } +} + +# empirically, binding event coords as %X - [winfo rootx $cvpath] works +# better, than %x + [winfo x %W], or %x + t->te_xpix, LATER investigate + +proc ::toxy::item_click {target cvpath x y b f} { + pd $target.rp _click \ + [$cvpath canvasx [expr {$x - [winfo rootx $cvpath]}]] \ + [$cvpath canvasy [expr {$y - [winfo rooty $cvpath]}]] $b $f\; +} + +proc ::toxy::item_inout {target v} { + pd [concat $target.rp _inout $v \;] +} + +proc ::toxy::master_release {target cvpath x y b} { + ::toxy::item_inout $target 3 +# pdtk_canvas_mouseup is a hack, which we must call anyway + pdtk_canvas_mouseup $cvpath \ + [expr {$x - [winfo rootx $cvpath]}] \ + [expr {$y - [winfo rooty $cvpath]}] $b +} + +proc ::toxy::master_motion {target cvpath x y} { + pd $target.rp _motion \ + [$cvpath canvasx [expr {$x - [winfo rootx $cvpath]}]] \ + [$cvpath canvasy [expr {$y - [winfo rooty $cvpath]}]] 0 \; +} + +proc ::toxy::master {path cvpath target} { + bind $path <ButtonRelease> "::toxy::master_release $target $cvpath %X %Y %b" + bind $path <1> "::toxy::item_click $target $cvpath %X %Y %b 0" + bind $path <Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 1" + bind $path <Control-1> "::toxy::item_click $target $cvpath %X %Y %b 2" + bind $path <Control-Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 3" + bind $path <Alt-1> "::toxy::item_click $target $cvpath %X %Y %b 4" + bind $path <Alt-Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 5" + bind $path <Alt-Control-1> "::toxy::item_click $target $cvpath %X %Y %b 6" + bind $path <Alt-Control-Shift-1> \ + "::toxy::item_click $target $cvpath %X %Y %b 7" + bind $path <3> "::toxy::item_click $target $cvpath %X %Y %b 8" + + bind $path <Motion> "::toxy::master_motion $target $cvpath %X %Y" + bind $path <B1-Motion> "::toxy::master_motion $target $cvpath %X %Y" + bind $path <Enter> "::toxy::item_inout $target 1" + bind $path <Leave> "::toxy::item_inout $target 0" + + if {[catch {$path config -state normal}] == 0} { + bind $path <<disable>> "$path config -state disabled" + bind $path <<enable>> "$path config -state normal" + } + + if {[winfo class $path] == "Canvas"} { +# undo the "bind Canvas <1> {+focus %W}" from above + bind $path <FocusIn> "focus $cvpath" + } +} + +# to be called explicitly from vis proc, LATER rethink +proc ::toxy::subwidget {path parent cvpath target} { + bind $path <ButtonRelease> "::toxy::master_release $target $cvpath %X %Y %b" + bind $path <1> "::toxy::item_click $target $cvpath %X %Y %b 0" + bind $path <Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 1" + bind $path <Control-1> "::toxy::item_click $target $cvpath %X %Y %b 2" + bind $path <Control-Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 3" + bind $path <Alt-1> "::toxy::item_click $target $cvpath %X %Y %b 4" + bind $path <Alt-Shift-1> "::toxy::item_click $target $cvpath %X %Y %b 5" + bind $path <Alt-Control-1> "::toxy::item_click $target $cvpath %X %Y %b 6" + bind $path <Alt-Control-Shift-1> \ + "::toxy::item_click $target $cvpath %X %Y %b 7" + bind $path <3> "::toxy::item_click $target $cvpath %X %Y %b 8" + + bind $path <Motion> "::toxy::master_motion $target $cvpath %X %Y" + bind $path <B1-Motion> "::toxy::master_motion $target $cvpath %X %Y" + bind $path <Enter> "::toxy::item_inout $target 1" + bind $path <Leave> "::toxy::item_inout $target 0" + + if {[catch {$path config -state normal}] == 0} { + bind $parent <<disable>> "+$path config -state disabled" + bind $parent <<enable>> "+$path config -state normal" + } +} + +# standard widget types, LATER move to separate .wid files + +# FIXME +proc ::toxy::scale_command {target sel v} { + if {$::toxy::scale_isactive} { + pd [concat $target $sel $v \;] + } + set ::toxy::scale_isactive 1 +} + +proc ::toxy::scale_doset {path v} { + set ::toxy::scale_isactive 0 + $path set $v +} + +proc ::toxy::popup_command {path target remote i text} { + set [$path cget -textvariable] $text + pd [concat $target _cb $i \;] + if {$remote != "."} { + pd [concat $remote $i \;] + } +} + +proc ::toxy::popup {path target remote entries args} { + if {[winfo exists $path.pop]} { +# puts stderr [concat $path.pop exists] + } elseif {[catch {eval {menu $path.pop} $args} err] == 0} { + set i 0 + foreach e $entries { + if {$e == "."} { + $path.pop add separator + } else { + incr i + $path.pop add command -label [lindex $e 0] \ + -command [concat ::toxy::popup_command \ + $path $target $remote $i \ + [lindex $e [expr {[llength $e] > 1}]]] + } + } + } else { error [concat in ::toxy::popup: $err] } +} + +# FIXME should be part of the float widget type, but we need it for plain scales +set ::toxy::scale_isactive 1 + +#> bang button +#. -image ::toxy::img::empty -command .<.> +#. -bg pink -activebackground red -width 50 -height 50 +#. @bang .- flash .: .- invoke + +#> float scale +#. -command [concat ::toxy::scale_command .| _cb] +#. -bg pink -activebackground red -length 200 +#. @float .- set .#1 +#. @vset ::toxy::scale_doset .- .#1 + +#> symbol entry +#. -bg pink -font .(helvetica 24.) -width 16 +#. @symbol .- delete 0 end .: .- insert 0 .#1 + +#@ vis +bind .- <Return> {eval .<[.- get].>; focus .^.c} + +#> popup menubutton +#. -menu .-.pop +#. -bg purple -fg white -activebackground magenta -text popup +#. -width 8 -relief raised -borderwidth 3 +#. @float if .(.#1 >= 1.) .(.-.pop invoke .#1.) +#. #items test +#. #iprops "-bg" purple "-fg" white "-activebackground" magenta "-borderwidth" 3 + +#@ vis +::toxy::popup .- .| . [concat .#items] .#iprops diff --git a/externals/miXed/test/toxy/stress/bulk.pd b/externals/miXed/test/toxy/stress/bulk.pd new file mode 100644 index 000000000..e4efc49f9 --- /dev/null +++ b/externals/miXed/test/toxy/stress/bulk.pd @@ -0,0 +1,78 @@ +#N canvas 75 60 628 612 12; +#X obj 62 449 pack; +#X obj 62 387 t b b; +#X obj 62 356 until; +#X obj 33 250 makefilename #%x; +#X obj 33 219 + 256; +#X obj 33 188 random 3840; +#X obj 62 418 random 500; +#X obj 175 418 random 500; +#X obj 33 126 + 3; +#X obj 83 6 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; +#X obj 157 95 random 10; +#X obj 157 126 sel 7; +#X obj 175 449 + 20; +#X obj 33 6 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1 +; +#X msg 130 33 tot .^.c delete bulk; +#X msg 62 480 add [expr \$1 + .#1] [expr \$2 + .#2]; +#X msg 62 511 debug; +#X obj 33 285 pack s 0 0; +#X msg 33 320 add -tags bulk -fill \$1 -smooth true \, push \$2 \$3 +; +#X msg 157 188 reset \, add .^.c create polygon; +#X obj 261 250 random 150; +#X obj 201 219 random 100; +#X obj 201 250 + 10; +#X obj 33 95 random 700; +#X obj 33 544 tot .; +#X obj 328 414 makefilename #%x; +#X obj 328 383 + 256; +#X obj 328 352 random 3840; +#X msg 328 449 tot .^.c configure -bg \$1; +#X obj 33 157 t b b b 0 b; +#X obj 33 64 t b b b; +#X obj 277 95 random 5; +#X obj 277 126 sel 3; +#X obj 33 33 metro 300; +#X connect 0 0 15 0; +#X connect 1 0 6 0; +#X connect 1 1 7 0; +#X connect 2 0 1 0; +#X connect 3 0 17 0; +#X connect 4 0 3 0; +#X connect 5 0 4 0; +#X connect 6 0 0 0; +#X connect 7 0 12 0; +#X connect 8 0 29 0; +#X connect 9 0 33 0; +#X connect 10 0 11 0; +#X connect 11 0 14 0; +#X connect 12 0 0 1; +#X connect 13 0 30 0; +#X connect 14 0 24 0; +#X connect 15 0 24 0; +#X connect 16 0 24 0; +#X connect 17 0 18 0; +#X connect 18 0 24 0; +#X connect 19 0 24 0; +#X connect 20 0 17 2; +#X connect 21 0 22 0; +#X connect 22 0 17 1; +#X connect 23 0 8 0; +#X connect 24 3 27 0; +#X connect 25 0 28 0; +#X connect 26 0 25 0; +#X connect 27 0 26 0; +#X connect 28 0 24 0; +#X connect 29 0 5 0; +#X connect 29 1 21 0; +#X connect 29 2 20 0; +#X connect 29 3 2 0; +#X connect 29 4 19 0; +#X connect 30 0 23 0; +#X connect 30 1 10 0; +#X connect 30 2 31 0; +#X connect 31 0 32 0; +#X connect 32 0 27 0; +#X connect 33 0 30 0; diff --git a/externals/miXed/test/toxy/stress/bulkyhurd.pd b/externals/miXed/test/toxy/stress/bulkyhurd.pd new file mode 100644 index 000000000..0edda17f3 --- /dev/null +++ b/externals/miXed/test/toxy/stress/bulkyhurd.pd @@ -0,0 +1,163 @@ +#N canvas 26 42 948 596 12; +#X floatatom 17 24 5 0 0 0 - - -; +#X floatatom 17 220 5 0 0 0 - - -; +#N canvas 152 43 785 527 1001-hurd 0; +#X obj 99 7 widget popup 1-p #items test -width 18; +#X obj 259 7 widget popup 2-p #items test -width 18; +#X obj 419 7 widget popup 3-p #items test -width 18; +#X obj 579 7 widget popup 4-p #items test -width 18; +#X obj 99 37 widget popup 5-p #items test; +#X obj 179 37 widget popup 6-p #items test; +#X obj 259 37 widget popup 7-p #items test; +#X obj 339 37 widget popup 8-p #items test; +#X obj 419 37 widget popup 9-p #items test; +#X obj 499 37 widget popup 10-p #items test; +#X obj 579 37 widget popup 11-p #items test; +#X obj 659 37 widget popup 12-p #items test; +#X obj 99 67 widget popup 13-p #items test; +#X obj 179 67 widget popup 14-p #items test; +#X obj 259 67 widget popup 15-p #items test; +#X obj 339 67 widget popup 16-p #items test; +#X obj 419 67 widget popup 17-p #items test; +#X obj 499 67 widget popup 18-p #items test; +#X obj 579 67 widget popup 19-p #items test; +#X obj 659 67 widget popup 20-p #items test; +#X obj 99 97 widget popup 21-p #items test; +#X obj 179 97 widget popup 22-p #items test; +#X obj 259 97 widget popup 23-p #items test; +#X obj 339 97 widget popup 24-p #items test; +#X obj 419 97 widget popup 25-p #items test; +#X obj 499 97 widget popup 26-p #items test; +#X obj 579 97 widget popup 27-p #items test; +#X obj 659 97 widget popup 28-p #items test; +#X obj 99 127 widget popup 29-p #items test; +#X obj 179 127 widget popup 30-p #items test; +#X obj 259 127 widget popup 31-p #items test; +#X obj 339 127 widget popup 32-p #items test; +#X obj 419 127 widget popup 33-p #items test; +#X obj 499 127 widget popup 34-p #items test; +#X obj 579 127 widget popup 35-p #items test; +#X obj 659 127 widget popup 36-p #items test; +#X obj 99 157 widget popup 37-p #items test; +#X obj 179 157 widget popup 38-p #items test; +#X obj 259 157 widget popup 39-p #items test; +#X obj 339 157 widget popup 40-p #items test; +#X obj 419 157 widget popup 41-p #items test; +#X obj 499 157 widget popup 42-p #items test; +#X obj 579 157 widget popup 43-p #items test; +#X obj 659 157 widget popup 44-p #items test; +#X obj 99 187 widget popup 45-p #items test; +#X obj 179 187 widget popup 46-p #items test; +#X obj 259 187 widget popup 47-p #items test; +#X obj 339 187 widget popup 48-p #items test; +#X obj 419 187 widget popup 49-p #items test; +#X obj 499 187 widget popup 50-p #items test; +#X obj 579 187 widget popup 51-p #items test; +#X obj 659 187 widget popup 52-p #items test; +#X obj 99 217 widget popup 53-p #items test; +#X obj 179 217 widget popup 54-p #items test; +#X obj 259 217 widget popup 55-p #items test; +#X obj 339 217 widget popup 56-p #items test; +#X obj 419 217 widget popup 57-p #items test; +#X obj 499 217 widget popup 58-p #items test; +#X obj 579 217 widget popup 59-p #items test; +#X obj 659 217 widget popup 60-p #items test; +#X obj 99 247 widget popup 61-p #items test; +#X obj 179 247 widget popup 62-p #items test; +#X obj 259 247 widget popup 63-p #items test; +#X obj 339 247 widget popup 64-p #items test; +#X obj 419 247 widget popup 65-p #items test; +#X obj 499 247 widget popup 66-p #items test; +#X obj 579 247 widget popup 67-p #items test; +#X obj 659 247 widget popup 68-p #items test; +#X obj 99 277 widget popup 69-p #items test; +#X obj 179 277 widget popup 70-p #items test; +#X obj 259 277 widget popup 71-p #items test; +#X obj 339 277 widget popup 72-p #items test; +#X obj 419 277 widget popup 73-p #items test; +#X obj 499 277 widget popup 74-p #items test; +#X obj 579 277 widget popup 75-p #items test; +#X obj 659 277 widget popup 76-p #items test; +#X obj 99 307 widget popup 77-p #items test; +#X obj 179 307 widget popup 78-p #items test; +#X obj 259 307 widget popup 79-p #items test; +#X obj 339 307 widget popup 80-p #items test; +#X obj 419 307 widget popup 81-p #items test; +#X obj 499 307 widget popup 82-p #items test; +#X obj 579 307 widget popup 83-p #items test; +#X obj 659 307 widget popup 84-p #items test; +#X obj 99 337 widget popup 85-p #items test; +#X obj 179 337 widget popup 86-p #items test; +#X obj 259 337 widget popup 87-p #items test; +#X obj 339 337 widget popup 88-p #items test; +#X obj 419 337 widget popup 89-p #items test; +#X obj 499 337 widget popup 90-p #items test; +#X obj 579 337 widget popup 91-p #items test; +#X obj 659 337 widget popup 92-p #items test; +#X obj 99 367 widget popup 93-p #items test; +#X obj 179 367 widget popup 94-p #items test; +#X obj 259 367 widget popup 95-p #items test; +#X obj 339 367 widget popup 96-p #items test; +#X obj 419 367 widget popup 97-p #items test; +#X obj 499 367 widget popup 98-p #items test; +#X obj 579 367 widget popup 99-p #items test; +#X obj 659 367 widget popup 100-p #items test; +#X obj 99 397 widget popup 101-p #items test; +#X obj 179 397 widget popup 102-p #items test; +#X obj 259 397 widget popup 103-p #items test; +#X obj 339 397 widget popup 104-p #items test; +#X obj 419 397 widget popup 105-p #items test; +#X obj 499 397 widget popup 106-p #items test; +#X obj 579 397 widget popup 107-p #items test; +#X obj 659 397 widget popup 108-p #items test; +#X obj 99 427 widget popup 109-p #items test; +#X obj 179 427 widget popup 110-p #items test; +#X obj 259 427 widget popup 111-p #items test; +#X obj 339 427 widget popup 112-p #items test; +#X obj 419 427 widget popup 113-p #items test; +#X obj 499 427 widget popup 114-p #items test; +#X obj 579 427 widget popup 115-p #items test; +#X obj 659 427 widget popup 116-p #items test; +#X obj 99 457 widget popup 117-p #items test; +#X obj 179 457 widget popup 118-p #items test; +#X obj 259 457 widget popup 119-p #items test; +#X obj 339 457 widget popup 120-p #items test; +#X obj 419 457 widget popup 121-p #items test; +#X obj 499 457 widget popup 122-p #items test; +#X obj 579 457 widget popup 123-p #items test; +#X obj 659 457 widget popup 124-p #items test; +#X obj 99 487 widget popup 125-p #items test; +#X obj 179 487 widget popup 126-p #items test; +#X obj 259 487 widget popup 127-p #items test; +#X obj 339 487 widget popup 128-p #items test; +#X obj 419 487 widget popup 129-p #items test; +#X obj 499 487 widget popup 130-p #items test; +#X obj 579 487 widget popup 131-p #items test; +#X obj 659 487 widget popup 132-p #items test; +#X coords 0 0 1 1 750 550 1; +#X restore 159 19 pd \$0-hurd; +#X obj 20 548 tow \$0-hurd popup p; +#X obj 17 185 tow \$0-hurd popup p; +#X obj 20 271 loadbang; +#X floatatom 32 60 5 0 0 0 - - -; +#X obj 20 351 Uzi; +#X msg 20 314 132; +#X msg 39 430 retarget \$1 popup \$2-p; +#X obj 39 389 prepend list \$0-hurd; +#X obj 32 100 prepend list \$0-hurd; +#X msg 32 142 retarget \$1 popup \$2-p; +#X obj 20 506 testmess c; +#X msg 20 467 #items; +#X connect 0 0 4 0; +#X connect 4 0 1 0; +#X connect 5 0 8 0; +#X connect 6 0 11 0; +#X connect 7 0 14 0; +#X connect 7 2 10 0; +#X connect 8 0 7 0; +#X connect 9 0 3 0; +#X connect 10 0 9 0; +#X connect 11 0 12 0; +#X connect 12 0 4 0; +#X connect 13 0 3 0; +#X connect 14 0 13 0; diff --git a/externals/miXed/test/toxy/stress/catchme.pd b/externals/miXed/test/toxy/stress/catchme.pd new file mode 100644 index 000000000..318cf7011 --- /dev/null +++ b/externals/miXed/test/toxy/stress/catchme.pd @@ -0,0 +1,117 @@ +#N canvas 68 66 301 201 12; +#N canvas 106 79 583 484 catchme 0; +#X obj 150 96 t b b; +#X obj 150 207 + 100; +#X obj 251 207 + 100; +#X obj 150 133 random 10; +#X obj 251 133 random 10; +#X obj 22 22 inlet; +#X msg 22 290 tot wm geometry .^ \$1; +#X obj 150 60 metro 30; +#X obj 349 60 metro 3000; +#X obj 349 96 random 300; +#X obj 452 96 random 300; +#X obj 190 170 line; +#X obj 291 170 line; +#X obj 22 60 metro 1000; +#X obj 22 253 sprintf symbol %dx%d+%d+%d; +#X obj 22 170 line; +#X obj 89 207 + 200; +#X msg 22 133 \$1 900; +#X msg 452 133 \$1 2900; +#X msg 349 133 \$1 2900; +#X obj 22 96 random 75; +#X obj 22 207 + 300; +#X obj 490 60 metro 300; +#X obj 22 325 tot catchme.pd; +#X obj 143 363 delay 500; +#X obj 143 443 s catchme-start; +#X obj 260 325 key; +#X obj 260 363 sel 32; +#X msg 191 401 0; +#X msg 143 401 1; +#N canvas 90 49 662 516 selfornamentation 0; +#X obj 38 85 random 256; +#X obj 135 85 random 256; +#X obj 233 85 random 256; +#X obj 113 407 symbol; +#X obj 113 290 random 3; +#X obj 113 322 sel 0 1 2; +#X obj 38 120 sprintf symbol #%02x%02x%02x; +#X msg 193 363 scraTchme; +#X msg 113 363 caTchme; +#X msg 297 363 deTachme; +#X obj 38 14 inlet; +#X msg 38 159 tot .~root.c itemconfig .~tagR -fill \$1; +#X msg 66 206 tot .~root.c itemconfig .~tagR -width 11; +#X msg 86 244 tot .~root.c itemconfig .~tag -font .(helvetica 48 bold +italic.); +#X obj 38 48 t b b b b; +#X obj 169 14 inlet; +#X obj 38 476 tot catchme; +#X msg 113 443 tot .~owner.c itemconfig .~tag -text \$1; +#X connect 0 0 6 0; +#X connect 1 0 6 1; +#X connect 2 0 6 2; +#X connect 3 0 17 0; +#X connect 4 0 5 0; +#X connect 5 0 8 0; +#X connect 5 1 7 0; +#X connect 5 2 9 0; +#X connect 6 0 11 0; +#X connect 7 0 3 0; +#X connect 8 0 3 0; +#X connect 9 0 3 0; +#X connect 10 0 14 0; +#X connect 11 0 16 0; +#X connect 12 0 16 0; +#X connect 13 0 16 0; +#X connect 14 0 0 0; +#X connect 14 1 1 0; +#X connect 14 2 2 0; +#X connect 14 3 4 0; +#X connect 15 0 12 0; +#X connect 15 0 13 0; +#X connect 17 0 16 0; +#X restore 319 253 pd selfornamentation; +#X connect 0 0 3 0; +#X connect 0 1 4 0; +#X connect 1 0 14 2; +#X connect 2 0 14 3; +#X connect 3 0 1 0; +#X connect 4 0 2 0; +#X connect 5 0 7 0; +#X connect 5 0 8 0; +#X connect 5 0 13 0; +#X connect 5 0 22 0; +#X connect 6 0 23 0; +#X connect 7 0 0 0; +#X connect 8 0 9 0; +#X connect 8 0 10 0; +#X connect 9 0 19 0; +#X connect 10 0 18 0; +#X connect 11 0 1 1; +#X connect 12 0 2 1; +#X connect 13 0 20 0; +#X connect 14 0 6 0; +#X connect 15 0 16 0; +#X connect 15 0 21 0; +#X connect 16 0 14 1; +#X connect 17 0 15 0; +#X connect 18 0 12 0; +#X connect 19 0 11 0; +#X connect 20 0 17 0; +#X connect 21 0 14 0; +#X connect 22 0 30 0; +#X connect 23 3 24 0; +#X connect 23 3 30 1; +#X connect 24 0 29 0; +#X connect 26 0 27 0; +#X connect 27 0 28 0; +#X connect 28 0 25 0; +#X connect 29 0 25 0; +#X coords 0 0 0.00362319 0.00319489 200 140 0; +#X restore 15 80 pd catchme; +#X obj 15 29 tgl 10 0 empty catchme-start empty 0 -6 0 8 -262144 -1 +-1 0 1; +#X connect 1 0 0 0; diff --git a/externals/miXed/test/toxy/stress/mstots.pd b/externals/miXed/test/toxy/stress/mstots.pd new file mode 100644 index 000000000..7c823e084 --- /dev/null +++ b/externals/miXed/test/toxy/stress/mstots.pd @@ -0,0 +1,50 @@ +#N canvas 337 46 624 565 12; +#X obj 278 125 Uzi 10; +#X msg 49 16 1000; +#X msg 103 16 5000; +#X msg 154 16 10000; +#X msg 278 160 push; +#X obj 49 287 tot .; +#X obj 278 291 tot .; +#X msg 374 160 tot catch .(console show.); +#X msg 394 47 50000; +#X text 137 46 don't even try this on windows:; +#X msg 316 207 add #; +#X msg 466 81 80000; +#X obj 50 512 tot .; +#X msg 49 246 tot ::mstots::readclock \$1; +#X obj 49 95 t 0 0 b; +#X msg 62 211 tot ::mstots::setclock; +#X msg 50 369 tot namespace eval mstots .(proc setclock .(.) .(set +::mstots::lastclock [clock clicks -milliseconds].).); +#X obj 374 125 loadbang; +#X obj 50 336 loadbang; +#X floatatom 49 65 5 0 0 0 - - -; +#X msg 70 423 tot namespace eval mstots .(proc readclock .(niter.) +.(set delta [expr .([clock clicks -milliseconds] - $::mstots::lastclock.)] +.: puts [concat $delta ms ([expr .($niter / $delta.)] Mb/s)].).); +#X obj 316 246 testmess . 128 7; +#X text 458 245 1024 characters; +#X text 128 80 this takes ~ one second on a 2.66 linux:; +#X connect 0 0 4 0; +#X connect 1 0 19 0; +#X connect 2 0 19 0; +#X connect 3 0 19 0; +#X connect 4 0 6 0; +#X connect 7 0 6 0; +#X connect 8 0 19 0; +#X connect 10 0 21 0; +#X connect 11 0 19 0; +#X connect 13 0 5 0; +#X connect 14 0 13 0; +#X connect 14 1 0 0; +#X connect 14 2 15 0; +#X connect 15 0 5 0; +#X connect 16 0 12 0; +#X connect 17 0 7 0; +#X connect 17 0 10 0; +#X connect 18 0 16 0; +#X connect 18 0 20 0; +#X connect 19 0 14 0; +#X connect 20 0 12 0; +#X connect 21 0 6 0; diff --git a/externals/miXed/test/toxy/stress/nbulkyhurds.pd b/externals/miXed/test/toxy/stress/nbulkyhurds.pd new file mode 100644 index 000000000..528df2d45 --- /dev/null +++ b/externals/miXed/test/toxy/stress/nbulkyhurds.pd @@ -0,0 +1,16 @@ +#N canvas 36 57 313 293 12; +#X obj 23 117 Uzi; +#X msg 23 29 10; +#X msg 23 210 \; pd open bulkyhurd.pd \$1; +#X msg 129 117 pwd pwd; +#X obj 66 117 r pwd; +#X obj 23 71 t 0 b; +#X obj 23 162 symbol; +#X obj 129 162 tow .; +#X connect 0 0 6 0; +#X connect 1 0 5 0; +#X connect 3 0 7 0; +#X connect 4 0 6 1; +#X connect 5 0 0 0; +#X connect 5 1 3 0; +#X connect 6 0 2 0; diff --git a/externals/miXed/test/toxy/stress/pophurd.pd b/externals/miXed/test/toxy/stress/pophurd.pd new file mode 100644 index 000000000..23ab80597 --- /dev/null +++ b/externals/miXed/test/toxy/stress/pophurd.pd @@ -0,0 +1,138 @@ +#N canvas 20 49 923 553 12; +#X obj 16 47 tow . popup p; +#X floatatom 16 15 5 0 0 0 - - -; +#X floatatom 16 84 5 0 0 0 - - -; +#X obj 180 10 widget popup p #items [info globals] -width 18; +#X obj 340 10 widget popup p #items [info globals] -width 18; +#X obj 500 10 widget popup p #items [info globals] -width 18; +#X obj 660 10 widget popup p #items [info globals] -width 18; +#X obj 180 40 widget popup p #items [info globals]; +#X obj 260 40 widget popup p #items [info globals]; +#X obj 340 40 widget popup p #items [info globals]; +#X obj 420 40 widget popup p #items [info globals]; +#X obj 500 40 widget popup p #items [info globals]; +#X obj 580 40 widget popup p #items [info globals]; +#X obj 660 40 widget popup p #items [info globals]; +#X obj 740 40 widget popup p #items [info globals]; +#X obj 180 70 widget popup p #items [info globals]; +#X obj 260 70 widget popup p #items [info globals]; +#X obj 340 70 widget popup p #items [info globals]; +#X obj 420 70 widget popup p #items [info globals]; +#X obj 500 70 widget popup p #items [info globals]; +#X obj 580 70 widget popup p #items [info globals]; +#X obj 660 70 widget popup p #items [info globals]; +#X obj 740 70 widget popup p #items [info globals]; +#X obj 180 100 widget popup p #items [info globals]; +#X obj 260 100 widget popup p #items [info globals]; +#X obj 340 100 widget popup p #items [info globals]; +#X obj 420 100 widget popup p #items [info globals]; +#X obj 500 100 widget popup p #items [info globals]; +#X obj 580 100 widget popup p #items [info globals]; +#X obj 660 100 widget popup p #items [info globals]; +#X obj 740 100 widget popup p #items [info globals]; +#X obj 180 130 widget popup p #items [info globals]; +#X obj 260 130 widget popup p #items [info globals]; +#X obj 340 130 widget popup p #items [info globals]; +#X obj 420 130 widget popup p #items [info globals]; +#X obj 500 130 widget popup p #items [info globals]; +#X obj 580 130 widget popup p #items [info globals]; +#X obj 660 130 widget popup p #items [info globals]; +#X obj 740 130 widget popup p #items [info globals]; +#X obj 180 160 widget popup p #items [info globals]; +#X obj 260 160 widget popup p #items [info globals]; +#X obj 340 160 widget popup p #items [info globals]; +#X obj 420 160 widget popup p #items [info globals]; +#X obj 500 160 widget popup p #items [info globals]; +#X obj 580 160 widget popup p #items [info globals]; +#X obj 660 160 widget popup p #items [info globals]; +#X obj 740 160 widget popup p #items [info globals]; +#X obj 180 190 widget popup p #items [info globals]; +#X obj 260 190 widget popup p #items [info globals]; +#X obj 340 190 widget popup p #items [info globals]; +#X obj 420 190 widget popup p #items [info globals]; +#X obj 500 190 widget popup p #items [info globals]; +#X obj 580 190 widget popup p #items [info globals]; +#X obj 660 190 widget popup p #items [info globals]; +#X obj 740 190 widget popup p #items [info globals]; +#X obj 180 220 widget popup p #items [info globals]; +#X obj 260 220 widget popup p #items [info globals]; +#X obj 340 220 widget popup p #items [info globals]; +#X obj 420 220 widget popup p #items [info globals]; +#X obj 500 220 widget popup p #items [info globals]; +#X obj 580 220 widget popup p #items [info globals]; +#X obj 660 220 widget popup p #items [info globals]; +#X obj 740 220 widget popup p #items [info globals]; +#X obj 180 250 widget popup p #items [info globals]; +#X obj 260 250 widget popup p #items [info globals]; +#X obj 340 250 widget popup p #items [info globals]; +#X obj 420 250 widget popup p #items [info globals]; +#X obj 500 250 widget popup p #items [info globals]; +#X obj 580 250 widget popup p #items [info globals]; +#X obj 660 250 widget popup p #items [info globals]; +#X obj 740 250 widget popup p #items [info globals]; +#X obj 180 280 widget popup p #items [info globals]; +#X obj 260 280 widget popup p #items [info globals]; +#X obj 340 280 widget popup p #items [info globals]; +#X obj 420 280 widget popup p #items [info globals]; +#X obj 500 280 widget popup p #items [info globals]; +#X obj 580 280 widget popup p #items [info globals]; +#X obj 660 280 widget popup p #items [info globals]; +#X obj 740 280 widget popup p #items [info globals]; +#X obj 180 310 widget popup p #items [info globals]; +#X obj 260 310 widget popup p #items [info globals]; +#X obj 340 310 widget popup p #items [info globals]; +#X obj 420 310 widget popup p #items [info globals]; +#X obj 500 310 widget popup p #items [info globals]; +#X obj 580 310 widget popup p #items [info globals]; +#X obj 660 310 widget popup p #items [info globals]; +#X obj 740 310 widget popup p #items [info globals]; +#X obj 180 340 widget popup p #items [info globals]; +#X obj 260 340 widget popup p #items [info globals]; +#X obj 340 340 widget popup p #items [info globals]; +#X obj 420 340 widget popup p #items [info globals]; +#X obj 500 340 widget popup p #items [info globals]; +#X obj 580 340 widget popup p #items [info globals]; +#X obj 660 340 widget popup p #items [info globals]; +#X obj 740 340 widget popup p #items [info globals]; +#X obj 180 370 widget popup p #items [info globals]; +#X obj 260 370 widget popup p #items [info globals]; +#X obj 340 370 widget popup p #items [info globals]; +#X obj 420 370 widget popup p #items [info globals]; +#X obj 500 370 widget popup p #items [info globals]; +#X obj 580 370 widget popup p #items [info globals]; +#X obj 660 370 widget popup p #items [info globals]; +#X obj 740 370 widget popup p #items [info globals]; +#X obj 180 400 widget popup p #items [info globals]; +#X obj 260 400 widget popup p #items [info globals]; +#X obj 340 400 widget popup p #items [info globals]; +#X obj 420 400 widget popup p #items [info globals]; +#X obj 500 400 widget popup p #items [info globals]; +#X obj 580 400 widget popup p #items [info globals]; +#X obj 660 400 widget popup p #items [info globals]; +#X obj 740 400 widget popup p #items [info globals]; +#X obj 180 430 widget popup p #items [info globals]; +#X obj 260 430 widget popup p #items [info globals]; +#X obj 340 430 widget popup p #items [info globals]; +#X obj 420 430 widget popup p #items [info globals]; +#X obj 500 430 widget popup p #items [info globals]; +#X obj 580 430 widget popup p #items [info globals]; +#X obj 660 430 widget popup p #items [info globals]; +#X obj 740 430 widget popup p #items [info globals]; +#X obj 180 460 widget popup p #items [info globals]; +#X obj 260 460 widget popup p #items [info globals]; +#X obj 340 460 widget popup p #items [info globals]; +#X obj 420 460 widget popup p #items [info globals]; +#X obj 500 460 widget popup p #items [info globals]; +#X obj 580 460 widget popup p #items [info globals]; +#X obj 660 460 widget popup p #items [info globals]; +#X obj 740 460 widget popup p #items [info globals]; +#X obj 180 490 widget popup p #items [info globals]; +#X obj 260 490 widget popup p #items [info globals]; +#X obj 340 490 widget popup p #items [info globals]; +#X obj 420 490 widget popup p #items [info globals]; +#X obj 500 490 widget popup p #items [info globals]; +#X obj 580 490 widget popup p #items [info globals]; +#X obj 660 490 widget popup p #items [info globals]; +#X obj 740 490 widget popup p #items [info globals]; +#X connect 0 0 2 0; +#X connect 1 0 0 0; diff --git a/externals/miXed/test/toxy/tclversion.pd b/externals/miXed/test/toxy/tclversion.pd new file mode 100644 index 000000000..442e81f37 --- /dev/null +++ b/externals/miXed/test/toxy/tclversion.pd @@ -0,0 +1,20 @@ +#N canvas 68 131 662 379 24; +#X obj 38 247 tot .; +#X obj 38 29 loadbang; +#X msg 38 299; +#X msg 147 247 set; +#X obj 38 79 t b b b; +#X obj 231 247 tot .; +#X msg 231 299; +#X msg 78 188 query concat set patchlevel [info patchlevel]; +#X msg 38 138 query concat set version [info tclversion]; +#X connect 0 0 2 0; +#X connect 1 0 4 0; +#X connect 3 0 2 0; +#X connect 3 0 6 0; +#X connect 4 0 8 0; +#X connect 4 1 7 0; +#X connect 4 2 3 0; +#X connect 5 0 6 0; +#X connect 7 0 5 0; +#X connect 8 0 0 0; diff --git a/externals/miXed/test/toxy/test.wid b/externals/miXed/test/toxy/test.wid new file mode 100644 index 000000000..3cb82f175 --- /dev/null +++ b/externals/miXed/test/toxy/test.wid @@ -0,0 +1,6 @@ +puts before + +#> test button +#. -bg green -text test + +puts after diff --git a/externals/miXed/test/toxy/test1.tot b/externals/miXed/test/toxy/test1.tot new file mode 100644 index 000000000..3faf74ef2 --- /dev/null +++ b/externals/miXed/test/toxy/test1.tot @@ -0,0 +1,301 @@ +puts [concat .#0 .#1 .#9 .#: .^.c] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] +puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 .#9] \ No newline at end of file diff --git a/externals/miXed/test/toxy/testmess-test.pd b/externals/miXed/test/toxy/testmess-test.pd new file mode 100644 index 000000000..712cbfc41 --- /dev/null +++ b/externals/miXed/test/toxy/testmess-test.pd @@ -0,0 +1,35 @@ +#N canvas 235 56 752 558 12; +#X obj 326 23 widget testmess t; +#X obj 122 241 tow . testmess t; +#X msg 141 113 1; +#X msg 122 75 1 2 3 4 5 6 7 8 9 10; +#X msg 245 113 1 2 test; +#X floatatom 243 194 0 0 0 0 - - -; +#X obj 14 152 testmess 20; +#X msg 76 28 50; +#X msg 137 28 100; +#X msg 190 113 list; +#X msg 14 113 set \$1 \, bang; +#X msg 14 28 20; +#X floatatom 14 75 5 0 0 0 - - -; +#X obj 16 241 r lb; +#X obj 122 194 t b a; +#X obj 243 152 tow . testmess t; +#X msg 16 282; +#X msg 212 28 debug; +#X connect 2 0 14 0; +#X connect 3 0 14 0; +#X connect 4 0 14 0; +#X connect 6 0 14 0; +#X connect 7 0 12 0; +#X connect 8 0 12 0; +#X connect 9 0 14 0; +#X connect 10 0 6 0; +#X connect 11 0 12 0; +#X connect 12 0 10 0; +#X connect 13 0 16 0; +#X connect 14 0 1 0; +#X connect 14 1 1 0; +#X connect 15 0 5 0; +#X connect 17 0 15 0; +#X connect 17 0 0 0; diff --git a/externals/miXed/test/toxy/testmess.wid b/externals/miXed/test/toxy/testmess.wid new file mode 100644 index 000000000..85894bedd --- /dev/null +++ b/externals/miXed/test/toxy/testmess.wid @@ -0,0 +1,44 @@ +puts "setup script: evaluated once per Pd session" + +proc testmess_list {path target args} { + set sum 0 + foreach a $args { + incr sum $a + } + set lb [concat [lindex $args 0]] + foreach a [lrange $args 1 end] { + lappend lb + $a + } + lappend lb = $sum + set [$path cget -textvariable] $lb + pd [concat $target _cb $sum \;] +} + +proc testmess_command {path} { + pd [concat lb set [set [$path cget -textvariable]] \;] +} + +#> testmess button +#. -bg green -wraplength 350 -text test +#. -command [concat testmess_command .-] +#. @bang .- invoke +#. @float testmess_list .- .| .#args +#. @list testmess_list .- .| .#args + +puts "\nwidget initializer: evaluated whenever a Tk widget is created" +puts "which may happen several times during Pd object\'s lifetime" +puts "widget needs reinitializing after:" +puts ". closing and reopening of a subpatch window" +puts ". minimizing and maximizing a window" +puts ". switching virtual desktops" + +#@ new +puts "\nconstructor: evaluated once per Pd object" +puts "(after Pd object creation, before Tk widget creation)" + +#@ vis +puts "another initializer part added from \"#@ vis\" block" + +#@ free +puts "\ndestructor: evaluated once, after Pd object destruction" +puts "(Tk widget should be already gone)" diff --git a/externals/miXed/test/toxy/tot-color.pd b/externals/miXed/test/toxy/tot-color.pd new file mode 100644 index 000000000..c79919504 --- /dev/null +++ b/externals/miXed/test/toxy/tot-color.pd @@ -0,0 +1,27 @@ +#N canvas 307 84 527 317 12; +#X obj 20 92 tot .; +#X msg 82 73 query winfo rgb . green; +#X obj 20 129 unpack 0 0 0; +#X obj 20 168 / 256; +#X obj 95 168 / 256; +#X obj 170 168 / 256; +#X obj 20 276 print; +#X obj 20 241 pack 0 0 0; +#X obj 20 205 int; +#X obj 95 205 int; +#X obj 170 205 int; +#X msg 20 22 query set cl [tk_chooseColor] .: if .($cl != "".) .(winfo +rgb . $cl.); +#X connect 0 0 2 0; +#X connect 1 0 0 0; +#X connect 2 0 3 0; +#X connect 2 1 4 0; +#X connect 2 2 5 0; +#X connect 3 0 8 0; +#X connect 4 0 9 0; +#X connect 5 0 10 0; +#X connect 7 0 6 0; +#X connect 8 0 7 0; +#X connect 9 0 7 1; +#X connect 10 0 7 2; +#X connect 11 0 0 0; diff --git a/externals/miXed/test/toxy/tot-cover.pd b/externals/miXed/test/toxy/tot-cover.pd new file mode 100644 index 000000000..267c22d58 --- /dev/null +++ b/externals/miXed/test/toxy/tot-cover.pd @@ -0,0 +1,87 @@ +#N canvas 392 177 590 367 12; +#X msg 58 239 cover; +#X msg 125 239 uncover; +#N canvas 354 120 500 400 cv 1; +#X restore 16 12 pd cv; +#X obj 16 305 tot cv; +#X obj 258 225 snapshot~; +#X obj 481 225 snapshot~; +#X obj 258 283 pack; +#X obj 393 195 metro 50; +#X obj 393 170 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 481 254 * 5; +#X obj 258 254 * 5; +#X msg 308 12 0 \; pd dsp 0; +#X msg 199 12 1 \; pd dsp 1; +#X obj 363 193 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 363 225 metro 500; +#X obj 363 254 random 20; +#X obj 258 170 osc~ 3; +#X obj 481 170 osc~ 7; +#X obj 199 62 pipe 3000; +#X msg 122 58 stop; +#X msg 122 29 bang; +#X obj 16 62 delay 5000; +#N canvas 80 35 613 356 commands 0; +#X obj 25 13 inlet; +#X obj 25 198 route cover uncover; +#X obj 25 306 outlet; +#X obj 48 46 loadbang; +#X msg 25 226 tot tot_cover .^.c [ expr .~x2 - .~x1 ] [ expr .~y2 - +.~y1 ]; +#X msg 42 259 tot if .( [winfo exists .^.c.cover] .) .( destroy .^.c.cover +.); +#X obj 48 145 tot .; +#X msg 48 78 tot proc tot_cover .( cv wd ht .) .( if .( [expr ![winfo +exists $cv.cover]] .) .( canvas $cv.cover -width $wd -height $ht -bg +red -bd 0 .: pack $cv.cover .) .); +#X connect 0 0 1 0; +#X connect 1 0 4 0; +#X connect 1 1 5 0; +#X connect 3 0 7 0; +#X connect 4 0 2 0; +#X connect 5 0 2 0; +#X connect 7 0 6 0; +#X restore 58 268 pd commands; +#X msg 16 91 tot .^.c create polygon 50 50 170 130 400 70 50 50 -fill +#abcdef -tags t1 \, tot .^.c create text 200 90 -text "hide me" -font +"times 24" -fill #fedcba -tags t1; +#X msg 34 170 tot .^.c delete t1; +#X msg 43 202 tot .^.c move t1 \$1 \$2; +#X msg 65 336 tot .^.c configure -bg red; +#X connect 0 0 22 0; +#X connect 1 0 22 0; +#X connect 3 3 26 0; +#X connect 4 0 10 0; +#X connect 5 0 9 0; +#X connect 6 0 25 0; +#X connect 7 0 4 0; +#X connect 7 0 5 0; +#X connect 8 0 7 0; +#X connect 9 0 6 1; +#X connect 10 0 6 0; +#X connect 11 0 8 0; +#X connect 11 0 24 0; +#X connect 11 0 13 0; +#X connect 11 0 19 0; +#X connect 12 0 23 0; +#X connect 12 0 18 0; +#X connect 13 0 14 0; +#X connect 14 0 15 0; +#X connect 15 0 10 1; +#X connect 15 0 9 1; +#X connect 16 0 4 0; +#X connect 17 0 5 0; +#X connect 18 0 13 0; +#X connect 18 0 8 0; +#X connect 19 0 21 0; +#X connect 20 0 21 0; +#X connect 21 0 23 0; +#X connect 22 0 3 0; +#X connect 23 0 3 0; +#X connect 23 0 20 0; +#X connect 24 0 3 0; +#X connect 25 0 3 0; +#X connect 26 0 3 0; diff --git a/externals/miXed/test/toxy/tot-files.pd b/externals/miXed/test/toxy/tot-files.pd new file mode 100644 index 000000000..b21fd41b4 --- /dev/null +++ b/externals/miXed/test/toxy/tot-files.pd @@ -0,0 +1,29 @@ +#N canvas 331 164 627 378 12; +#X msg 33 336 debug; +#X msg 83 178 tot puts [concat .#0 .#1 .#9 .#: .^.c ]; +#X msg 62 143 reset \, add puts [concat .#0 .#1 .#9 .#: .^.c]; +#X msg 276 306 push a b c; +#X msg 276 335 push; +#X msg 276 277 push a b c d e f g h i j k l m n; +#X msg 100 216 write; +#X msg 113 245 read; +#X msg 171 245 read test1.tot; +#X msg 171 216 write test1.tot; +#X obj 37 51 until; +#X msg 37 22 300; +#X msg 37 86 addnext puts [concat .#0 .#1 .#2 .#3 .#4 .#5 .#6 .#7 .#8 +.#9]; +#X obj 96 336 tot . test1.tot; +#X connect 0 0 13 0; +#X connect 1 0 13 0; +#X connect 2 0 13 0; +#X connect 3 0 13 0; +#X connect 4 0 13 0; +#X connect 5 0 13 0; +#X connect 6 0 13 0; +#X connect 7 0 13 0; +#X connect 8 0 13 0; +#X connect 9 0 13 0; +#X connect 10 0 12 0; +#X connect 11 0 10 0; +#X connect 12 0 13 0; diff --git a/externals/miXed/test/toxy/tot-head.pd b/externals/miXed/test/toxy/tot-head.pd new file mode 100644 index 000000000..d5e5ec63e --- /dev/null +++ b/externals/miXed/test/toxy/tot-head.pd @@ -0,0 +1,17 @@ +#N canvas 7 0 606 345 12; +#X obj 38 156 -; +#X floatatom 36 83 5 0 0 0 - - -; +#X obj 36 122 t 0 0; +#X msg 38 191 tot .^.c move head \$1 0; +#X msg 54 224 tot .^.c delete head; +#X msg 21 18 tot global margin .: set margin 3 .: .^.c create line +300 $margin 300 [expr .~y2 - .~y1 - 2 * $margin ] -tags head; +#X obj 21 264 tot .; +#X connect 0 0 3 0; +#X connect 1 0 2 0; +#X connect 2 0 0 1; +#X connect 2 1 0 0; +#X connect 3 0 6 0; +#X connect 4 0 6 0; +#X connect 5 0 6 0; +#X connect 6 3 5 0; diff --git a/externals/miXed/test/toxy/tot-monkey.pd b/externals/miXed/test/toxy/tot-monkey.pd new file mode 100644 index 000000000..2128ae8dd --- /dev/null +++ b/externals/miXed/test/toxy/tot-monkey.pd @@ -0,0 +1,50 @@ +#N canvas 199 254 540 290 12; +#X obj 198 62 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X msg 41 62 capture \$1; +#X obj 99 171 unpack 0 0 0; +#X floatatom 99 212 5 0 0 0 - - -; +#X floatatom 150 212 5 0 0 0 - - -; +#X floatatom 202 212 5 0 0 0 - - -; +#X obj 99 136 route motion mouseup mouse key; +#X msg 260 171 \$1; +#X obj 260 212 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +1; +#X obj 297 208 route float; +#X msg 297 171 \$2; +#X floatatom 297 242 5 0 0 0 - - -; +#X obj 364 171 print other; +#N canvas 10 26 352 252 dux 1; +#X obj 30 20 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 84 19 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X text 29 222 do some editing here \, too; +#X restore 248 32 pd dux; +#N canvas 408 26 352 252 comes 1; +#X obj 30 20 vsl 15 128 0 127 0 0 empty empty empty 0 -8 0 8 -262144 +-1 -1 0 1; +#X obj 84 19 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 0 1; +#X restore 326 32 pd comes; +#X obj 41 97 tot dux; +#X obj 79 242 s pd-comes; +#X msg 121 97 1; +#X connect 0 0 1 0; +#X connect 1 0 15 0; +#X connect 2 0 3 0; +#X connect 2 1 4 0; +#X connect 2 2 5 0; +#X connect 6 0 2 0; +#X connect 6 1 2 0; +#X connect 6 2 2 0; +#X connect 6 3 7 0; +#X connect 6 3 10 0; +#X connect 6 4 12 0; +#X connect 7 0 8 0; +#X connect 9 0 11 0; +#X connect 10 0 9 0; +#X connect 15 2 16 0; +#X connect 15 2 6 0; +#X connect 15 3 17 0; +#X connect 17 0 0 0; diff --git a/externals/miXed/test/toxy/tot-nomenu.pd b/externals/miXed/test/toxy/tot-nomenu.pd new file mode 100644 index 000000000..f2beccad0 --- /dev/null +++ b/externals/miXed/test/toxy/tot-nomenu.pd @@ -0,0 +1,12 @@ +#N canvas 128 254 589 218 12; +#X obj 13 175 tot nomenu; +#N canvas 329 49 450 300 nomenu 1; +#X restore 12 16 pd nomenu; +#X msg 54 142 debug; +#X msg 13 57 tot destroy .^.m \, tot bind .^.c <Control-Key> ""; +#X msg 41 92 tot global sz .: set sz [wm maxsize .^] .: wm geometry +.^ [expr [lindex $sz 0] - 20]x[expr [lindex $sz 1] - 20]+20+20; +#X connect 0 3 3 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; diff --git a/externals/miXed/test/toxy/tot-qlist.pd b/externals/miXed/test/toxy/tot-qlist.pd new file mode 100644 index 000000000..24f7ba644 --- /dev/null +++ b/externals/miXed/test/toxy/tot-qlist.pd @@ -0,0 +1,59 @@ +#N canvas 250 295 422 249 12; +#X obj 75 126 qlist; +#N canvas 59 33 296 202 src 1; +#X restore 15 186 pd src; +#N canvas 407 33 296 202 dst 1; +#X restore 15 216 pd dst; +#X obj 37 24 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +; +#X msg 16 126 print; +#X obj 37 89 tot src; +#X msg 139 89 rewind; +#X msg 37 54 capture \$1 pd-dst; +#X msg 271 54 read tot.ql; +#X msg 270 89 write tot.ql; +#X obj 271 20 loadbang; +#X obj 139 156 tot dst; +#X obj 209 54 t b b; +#X msg 249 126 detach; +#X msg 139 126 attach; +#X obj 332 126 r pd-dst; +#X obj 332 156 s pd-src; +#X obj 249 156 tot src; +#X obj 148 216 spigot; +#X obj 258 216 spigot; +#X obj 209 24 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 216 216 0; +#X msg 197 186 1; +#X msg 307 186 1; +#X connect 0 1 14 0; +#X connect 3 0 7 0; +#X connect 4 0 0 0; +#X connect 5 2 0 0; +#X connect 6 0 0 0; +#X connect 6 0 14 0; +#X connect 7 0 5 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 8 0; +#X connect 11 3 22 0; +#X connect 11 3 19 0; +#X connect 12 0 0 0; +#X connect 12 1 13 0; +#X connect 13 0 11 0; +#X connect 13 0 17 0; +#X connect 14 0 11 0; +#X connect 14 0 17 0; +#X connect 15 0 16 0; +#X connect 17 3 23 0; +#X connect 17 3 18 0; +#X connect 18 0 12 0; +#X connect 18 0 21 0; +#X connect 19 0 12 0; +#X connect 19 0 21 0; +#X connect 20 0 12 0; +#X connect 21 0 18 1; +#X connect 21 0 19 1; +#X connect 22 0 18 1; +#X connect 23 0 19 1; diff --git a/externals/miXed/test/toxy/tot-query.pd b/externals/miXed/test/toxy/tot-query.pd new file mode 100644 index 000000000..7ecb091b1 --- /dev/null +++ b/externals/miXed/test/toxy/tot-query.pd @@ -0,0 +1,61 @@ +#N canvas 210 60 778 551 12; +#X msg 21 8 symbol pinecone; +#X obj 455 142 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 186 8 symbol conehead; +#X obj 67 174 sel 1; +#X obj 128 238 sel 0; +#X obj 128 339 print error; +#X obj 199 238 metro 150; +#X msg 128 311 open it first...; +#X msg 54 124 tot global ch .: set ch [open ~/PureData/miXed/test/toxy/tot-query.pd +r]; +#X msg 75 435 query concat set [lsort -decreasing [glob *]]; +#X msg 37 90 reset \, addnext set x -1 .: concat set [expr acos($x)] +\, qpush; +#X msg 21 44 tot global ans .: regsub cone \$1 apple ans \, query global +ans .: concat set $ans; +#X msg 199 266 tot global txt ch .: set txt [gets $ch] \, query global +txt .: concat set $txt; +#N canvas 0 0 578 346 more 0; +#X msg 35 73 query .^.c bbox foo; +#X obj 19 280 print reply; +#X msg 84 152 query winfo id .^.c; +#X msg 84 231 query winfo pathname \$1; +#X msg 19 26 tot .^.c create text 400 100 -width 80 -font "times 24" +-anchor nw -text "abcd efgh ijkl mnop" -tags foo; +#X msg 48 104 tot .^.c delete foo; +#X obj 19 231 tot .; +#X obj 84 191 tot .; +#X connect 0 0 6 0; +#X connect 2 0 7 0; +#X connect 3 0 6 0; +#X connect 4 0 6 0; +#X connect 5 0 6 0; +#X connect 6 0 1 0; +#X connect 7 0 3 0; +#X restore 576 174 pd more; +#X obj 21 468 tot .; +#X obj 67 238 tot .; +#X msg 67 202 tot eval .< [global ch .: info exists ch] .>; +#X msg 21 502; +#X msg 54 376 tot set ::ch [open ~/.pdrc] \, query concat set [read +$::ch] \, tot after 0 .(close $::ch .: unset ::ch.); +#X connect 0 0 11 0; +#X connect 1 0 3 0; +#X connect 2 0 11 0; +#X connect 3 0 16 0; +#X connect 3 1 6 0; +#X connect 4 0 7 0; +#X connect 4 1 6 0; +#X connect 6 0 12 0; +#X connect 7 0 5 0; +#X connect 8 0 14 0; +#X connect 9 0 14 0; +#X connect 10 0 14 0; +#X connect 11 0 14 0; +#X connect 12 0 14 0; +#X connect 14 0 17 0; +#X connect 15 1 4 0; +#X connect 16 0 15 0; +#X connect 18 0 14 0; diff --git a/externals/miXed/test/toxy/tot-rstring.pd b/externals/miXed/test/toxy/tot-rstring.pd new file mode 100644 index 000000000..24d1e1cc5 --- /dev/null +++ b/externals/miXed/test/toxy/tot-rstring.pd @@ -0,0 +1,15 @@ +#N canvas 254 48 671 300 12; +#X obj 21 179 tot .; +#X obj 164 77 tosymbol; +#X msg 50 77 123456; +#X msg 21 124 query set lst [list] .: foreach el [split " \$1 " ""] +.(set lst [linsert $lst 0 $el].) .: concat set [join $lst ""]; +#X msg 164 40 One Two Three; +#X msg 21 40 symbol abcdef; +#X msg 21 221; +#X connect 0 0 6 0; +#X connect 1 0 3 0; +#X connect 2 0 3 0; +#X connect 3 0 0 0; +#X connect 4 0 1 0; +#X connect 5 0 3 0; diff --git a/externals/miXed/test/toxy/tot.ql b/externals/miXed/test/toxy/tot.ql new file mode 100644 index 000000000..fa2b22e82 --- /dev/null +++ b/externals/miXed/test/toxy/tot.ql @@ -0,0 +1,186 @@ +590.4762 pd-dst motion 70 11 0; +64.58 pd-dst text 0; +0 pd-dst motion 117 114 0; +1.45125 pd-dst motion 115 114 0; +68.2086 pd-dst motion 103 110 0; +23.22 pd-dst motion 87 106 0; +17.415 pd-dst motion 65 98 0; +23.22 pd-dst motion 53 92 0; +29.0249 pd-dst motion 47 90 0; +58.0499 pd-dst motion 47 89 0; +29.0249 pd-dst motion 47 88 0; +23.22 pd-dst motion 47 87 0; +68.345 pd-dst motion 48 87 0; +29.0249 pd-dst motion 50 87 0; +23.22 pd-dst motion 53 87 0; +17.415 pd-dst motion 59 85 0; +23.22 pd-dst motion 63 79 0; +17.415 pd-dst motion 63 78 0; +69.6599 pd-dst motion 62 78 0; +29.0249 pd-dst motion 61 76 0; +23.22 pd-dst motion 55 70 0; +17.415 pd-dst motion 49 66 0; +23.22 pd-dst motion 45 62 0; +29.0249 pd-dst motion 43 61 0; +50 pd-dst key 1 32 0; +50 pd-dst key 0 32 0; +59.773 pd-dst mouse 43 61 1 0; +76.9161 pd-dst mouseup 43 61 1; +0 pd-dst relocate 298x204+0+0 319x225+99+33; +63.8549 pd-dst motion 44 61 0; +17.415 pd-dst motion 47 61 0; +21.7687 pd-dst motion 55 63 0; +18.8662 pd-dst motion 63 65 0; +29.0249 pd-dst motion 66 65 0; +23.22 pd-dst motion 67 65 0; +451.25 pd-dst key 1 116 0; +75.4649 pd-dst key 1 101 0; +74.0136 pd-dst key 0 116 0; +47.8912 pd-dst key 1 115 0; +29.0249 pd-dst key 0 101 0; +46.4399 pd-dst key 0 115 0; +95.283 pd-dst key 1 116 0; +69.6599 pd-dst key 0 116 0; +23.22 pd-dst key 1 105 0; +75.4649 pd-dst key 1 110 0; +46.4399 pd-dst key 0 105 0; +69.6599 pd-dst key 0 110 0; +77.551 pd-dst key 1 103 0; +50.7937 pd-dst key 0 103 0; +88.934 pd-dst key 1 32 0; +75.4649 pd-dst key 0 32 0; +36.689 pd-dst key 1 116 0; +75.4649 pd-dst key 0 116 0; +69.6599 pd-dst key 1 111 0; +76.9161 pd-dst key 0 111 0; +21.7687 pd-dst key 1 116 0; +29.0249 pd-dst key 0 116 0; +48.844 pd-dst key 1 39 0; +46.4399 pd-dst key 1 115 0; +29.0249 pd-dst key 0 39 0; +52.2449 pd-dst key 0 115 0; +57.823 pd-dst key 1 32 0; +75.4649 pd-dst key 0 32 0; +88.934 pd-dst key 1 113 0; +75.4649 pd-dst key 0 113 0; +81.2698 pd-dst key 1 108 0; +75.4649 pd-dst key 1 105 0; +29.0249 pd-dst key 0 108 0; +69.6599 pd-dst key 0 105 0; +23.22 pd-dst key 1 115 0; +52.2449 pd-dst key 0 115 0; +69.6599 pd-dst key 1 116 0; +75.4649 pd-dst key 0 116 0; +70.204 pd-dst key 1 32 0; +63.8549 pd-dst key 0 32 0; +58.594 pd-dst key 1 102 0; +21.905 pd-dst key 0 102 0; +17.415 pd-dst key 1 97 0; +29.0249 pd-dst key 0 97 0; +267.029 pd-dst key 1 99 0; +52.2449 pd-dst key 0 99 0; +69.6599 pd-dst key 1 105 0; +69.6599 pd-dst key 0 105 0; +36.689 pd-dst key 1 108 0; +92.8798 pd-dst key 1 105 0; +26.1224 pd-dst key 0 108 0; +49.3424 pd-dst key 0 105 0; +75.4649 pd-dst key 1 116 0; +52.2449 pd-dst key 0 116 0; +92.8798 pd-dst key 1 121 0; +46.4399 pd-dst key 0 121 0; +399.773 pd-dst motion 67 66 0; +17.415 pd-dst motion 85 86 0; +23.22 pd-dst motion 105 102 0; +17.415 pd-dst motion 115 104 0; +69.6599 pd-dst motion 116 104 0; +21.905 pd-dst mouse 116 104 1 0; +69.6599 pd-dst mouseup 116 104 1; +280.86 pd-dst motion 117 104 0; +20.3175 pd-dst motion 129 94 0; +17.415 pd-dst motion 143 82 0; +23.22 pd-dst motion 157 72 0; +17.415 pd-dst motion 169 66 0; +29.0249 pd-dst motion 171 65 0; +72.063 pd-dst mouse 171 65 1 0; +52.2449 pd-dst motion 170 65 0; +29.0249 pd-dst motion 156 65 0; +17.415 pd-dst motion 138 65 0; +23.22 pd-dst motion 126 67 0; +17.415 pd-dst motion 116 69 0; +23.22 pd-dst motion 112 73 0; +29.0249 pd-dst motion 111 74 0; +17.415 pd-dst motion 110 76 0; +23.22 pd-dst motion 110 84 0; +17.415 pd-dst motion 110 94 0; +29.0249 pd-dst motion 112 102 0; +23.22 pd-dst motion 116 108 0; +17.415 pd-dst motion 124 112 0; +23.22 pd-dst motion 136 116 0; +29.0249 pd-dst motion 152 116 0; +17.415 pd-dst motion 170 116 0; +23.22 pd-dst motion 178 110 0; +17.415 pd-dst motion 182 100 0; +23.22 pd-dst motion 182 97 0; +29.0249 pd-dst motion 180 91 0; +17.415 pd-dst motion 177 91 0; +23.22 pd-dst motion 174 91 0; +17.415 pd-dst motion 172 90 0; +29.0249 pd-dst motion 166 88 0; +23.22 pd-dst motion 156 84 0; +17.415 pd-dst motion 148 82 0; +23.22 pd-dst motion 146 81 0; +29.0249 pd-dst motion 145 80 0; +52.2449 pd-dst motion 145 79 0; +17.415 pd-dst motion 145 65 0; +23.22 pd-dst motion 147 41 0; +17.415 pd-dst motion 147 15 0; +17.415 pd-dst motion 147 7 0; +81.2698 pd-dst motion 147 8 0; +23.22 pd-dst motion 149 14 0; +17.415 pd-dst motion 157 22 0; +29.0249 pd-dst motion 167 28 0; +23.22 pd-dst motion 175 44 0; +17.415 pd-dst motion 183 64 0; +23.22 pd-dst motion 183 80 0; +17.415 pd-dst motion 181 92 0; +29.0249 pd-dst motion 173 104 0; +23.22 pd-dst motion 163 114 0; +17.415 pd-dst motion 157 118 0; +23.22 pd-dst motion 154 118 0; +29.0249 pd-dst motion 148 120 0; +17.415 pd-dst motion 145 120 0; +23.22 pd-dst motion 139 118 0; +17.415 pd-dst motion 133 110 0; +29.0249 pd-dst motion 133 100 0; +23.22 pd-dst motion 133 86 0; +17.415 pd-dst motion 133 72 0; +23.22 pd-dst motion 133 64 0; +17.415 pd-dst motion 137 58 0; +29.0249 pd-dst motion 139 57 0; +23.22 pd-dst motion 141 56 0; +17.415 pd-dst motion 143 56 0; +23.22 pd-dst motion 151 62 0; +29.0249 pd-dst motion 157 72 0; +17.415 pd-dst motion 159 80 0; +23.22 pd-dst motion 159 88 0; +17.415 pd-dst motion 159 90 0; +29.0249 pd-dst motion 157 91 0; +23.22 pd-dst motion 156 91 0; +17.415 pd-dst motion 155 91 0; +23.22 pd-dst motion 155 89 0; +29.0249 pd-dst motion 155 88 0; +36.689 pd-dst mouseup 155 88 1; +52.2449 pd-dst motion 155 89 0; +17.415 pd-dst motion 167 101 0; +23.22 pd-dst motion 177 111 0; +29.0249 pd-dst motion 185 127 0; +17.415 pd-dst motion 187 133 0; +59.138 pd-dst mouse 187 133 1 0; +69.6599 pd-dst mouseup 187 133 1; +23.22 pd-dst motion 188 133 0; +46.4399 pd-dst motion 189 133 0; +74.15 pd-dst motion 189 134 0; +29.0249 pd-dst motion 188 136 0; +17.415 pd-dst motion 184 154 0; +23.22 pd-dst motion 178 194 0; diff --git a/externals/miXed/test/toxy/tow-test.pd b/externals/miXed/test/toxy/tow-test.pd new file mode 100644 index 000000000..cf6ece4f7 --- /dev/null +++ b/externals/miXed/test/toxy/tow-test.pd @@ -0,0 +1,65 @@ +#N canvas 275 304 262 189 12; +#N canvas 23 43 450 305 panel 1; +#X obj 37 49 widget float f -bg orange; +#X floatatom 37 273 5 0 0 0 - - -; +#X floatatom 37 15 5 0 0 0 - - -; +#X obj 269 49 widget bang b1; +#X msg 269 15 bang; +#X obj 269 126 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 104 49 widget float f -bg orange; +#X floatatom 104 273 5 0 0 0 - - -; +#X floatatom 104 15 5 0 0 0 - - -; +#X obj 267 195 widget bang b2 -bg violet; +#X obj 267 273 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 267 160 bang; +#X connect 0 0 1 0; +#X connect 2 0 0 0; +#X connect 3 0 5 0; +#X connect 4 0 3 0; +#X connect 6 0 7 0; +#X connect 8 0 6 0; +#X connect 9 0 10 0; +#X connect 11 0 9 0; +#X restore 21 32 pd panel; +#N canvas 329 98 450 310 guts 1; +#X msg 253 123 bang; +#X obj 253 279 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 72 56 bang; +#X obj 136 123 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X obj 136 88 tow panel bang b1; +#X obj 253 245 tow panel bang b2; +#X msg 280 215 debug; +#X msg 280 183 -bg violet; +#X msg 262 153 -bg white; +#X obj 29 245 tow panel float f; +#X floatatom 29 279 5 0 0 0 - - -; +#X floatatom 29 123 5 0 0 0 - - -; +#X msg 63 215 debug; +#X msg 63 183 -bg orange; +#X msg 50 153 -bg brown; +#X obj 136 21 loadbang; +#X msg 136 56 set @vis .^.c configure -bg darkgreen; +#X connect 0 0 5 0; +#X connect 2 0 4 0; +#X connect 4 0 3 0; +#X connect 5 0 1 0; +#X connect 6 0 5 0; +#X connect 7 0 5 0; +#X connect 8 0 5 0; +#X connect 9 0 10 0; +#X connect 11 0 9 0; +#X connect 12 0 9 0; +#X connect 13 0 9 0; +#X connect 14 0 9 0; +#X connect 15 0 16 0; +#X connect 16 0 4 0; +#X restore 120 32 pd guts; +#X obj 21 105 tow panel float f; +#X floatatom 21 139 5 0 0 0 - - -; +#X floatatom 21 72 5 0 0 0 - - -; +#X connect 2 0 3 0; +#X connect 4 0 2 0; diff --git a/externals/miXed/test/toxy/txt-test.pd b/externals/miXed/test/toxy/txt-test.pd new file mode 100644 index 000000000..fe4b48ae3 --- /dev/null +++ b/externals/miXed/test/toxy/txt-test.pd @@ -0,0 +1,25 @@ +#N canvas 0 0 487 327 12; +#X obj 20 24 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X floatatom 72 92 5 0 0 0 - - -; +#X obj 95 251 print; +#X obj 20 210 route bang; +#N canvas 517 44 481 430 txtpanel 1; +#X obj 64 37 widget txt t; +#X restore 305 31 pd txtpanel; +#X obj 20 173 tow txtpanel txt t; +#X msg 79 126 tot pd nlines [expr [.- index end] - 1] .`.:; +#X obj 243 173 r nlines; +#X floatatom 243 210 5 0 0 0 - - -; +#X msg 136 92 replace test; +#X msg 65 59 insert trailer end; +#X msg 60 24 insert header "0.0"; +#X connect 0 0 5 0; +#X connect 1 0 5 0; +#X connect 3 1 2 0; +#X connect 5 0 3 0; +#X connect 6 0 5 0; +#X connect 7 0 8 0; +#X connect 9 0 5 0; +#X connect 10 0 5 0; +#X connect 11 0 5 0; diff --git a/externals/miXed/test/toxy/txt.wid b/externals/miXed/test/toxy/txt.wid new file mode 100644 index 000000000..29d7a3e29 --- /dev/null +++ b/externals/miXed/test/toxy/txt.wid @@ -0,0 +1,9 @@ +#> txt text +#. -bg lightgreen -foreground brown -font .(helvetica 12 bold.) -width 40 -height 16 +#. @bang pd .| _cb [string map .(" " ".`.` ".) [.- get "0.0" end]] .`.: +#. @float pd .| _cb [string map .(" " ".`.` ".) [.- get .#1.0 .#1.end]] .`.: +#. @insert .- insert .#2 .#1 +#. @replace .- delete "0.0" end .: .- insert "0.0" .#1 + +#. @store set .#1 [.- get 0.0 end] +#. @restore insert 0.0 .#1 diff --git a/externals/miXed/toxy/Makefile b/externals/miXed/toxy/Makefile new file mode 100644 index 000000000..fada68daa --- /dev/null +++ b/externals/miXed/toxy/Makefile @@ -0,0 +1,20 @@ +ROOT_DIR = .. +WIDPATH = $(ROOT_DIR)/test/toxy/setup.wid +WIQFILE = $(notdir $(WIDPATH:.wid=.wiq)) +redefault: checkwiq $(WIQFILE) default +checkwiq: + @if [ -f $(WIQFILE) ] && ! [ -s $(WIQFILE) ] ; then \ + echo ERROR: empty file $(WIQFILE)... removed ; \ + rm -f $(WIQFILE) ; fi +$(WIQFILE): $(WIDPATH) + @echo transferring widget definitions from \"$<\" to \"$@\" +# LATER think how to replace puts with pdtk_post + printf '// Do not edit this file (edit "$<", and run "make").\n//\nputs stderr [concat loading built-in widget definitions]\n' \ + | cat - $< | sed \ +-e '1,\|//$$|{p;d;}' \ +-e 's/\([\\\"]\)/\\\1/g' \ +-e 's/^.*$$/\"&\\n\"/' > $@ + @if [ -f $(WIQFILE) ] && ! [ -s $(WIQFILE) ] ; then \ + echo ERROR: transfer failed... $(WIQFILE) removed ; \ + rm -f $(WIQFILE) ; fi +include $(ROOT_DIR)/Makefile.common diff --git a/externals/miXed/toxy/Makefile.objects b/externals/miXed/toxy/Makefile.objects new file mode 100644 index 000000000..7fb09788d --- /dev/null +++ b/externals/miXed/toxy/Makefile.objects @@ -0,0 +1,49 @@ +TOT_OBJECTS = \ +unstable/forky.o \ +common/loud.o \ +common/grow.o \ +common/os.o \ +hammer/file.o \ +hammer/gui.o \ +common/props.o \ +toxy/scriptlet.o + +PLUSTOT_OBJECTS = \ +unstable/fragile.o \ +unstable/forky.o \ +common/loud.o \ +common/grow.o \ +common/os.o \ +hammer/file.o \ +common/props.o \ +toxy/scriptlet.o \ +toxy/plusbob.o + +PLUSTOT_PRIVATEOBJECTS = \ +plustot.ar.o \ +plustot.env.o \ +plustot.in.o \ +plustot.var.o \ +plustot.out.o \ +plustot.qlist.o \ +plustot.print.o \ +pluswidget.o + +PLUSTOT_LIBS = $(TCL_LIB) + +TOW_OBJECTS = \ +common/loud.o \ +common/os.o \ +unstable/loader.o + +WIDGET_OBJECTS = \ +unstable/forky.o \ +common/loud.o \ +common/grow.o \ +common/dict.o \ +common/os.o \ +hammer/file.o \ +common/props.o \ +toxy/scriptlet.o + +WIDGET_PRIVATEOBJECTS = widgettype.o widgethandlers.o diff --git a/externals/miXed/toxy/Makefile.sources b/externals/miXed/toxy/Makefile.sources new file mode 100644 index 000000000..3cc3f7a6f --- /dev/null +++ b/externals/miXed/toxy/Makefile.sources @@ -0,0 +1,10 @@ +ifdef TCL_LIB +TYPES = TOT TOW WIDGET PLUSTOT +else +TYPES = TOT TOW WIDGET +endif + +TOT_SOURCES = tot.c +TOW_SOURCES = tow.c +WIDGET_SOURCES = widget.c +PLUSTOT_SOURCES = plustot.c diff --git a/externals/miXed/toxy/build_counter b/externals/miXed/toxy/build_counter new file mode 100644 index 000000000..375ead73f --- /dev/null +++ b/externals/miXed/toxy/build_counter @@ -0,0 +1,7 @@ +#define TOXY_VERSION "0.1" +#define TOXY_RELEASE "alpha" +#define TOXY_BUILD 19 + +#if 0 +TOXY_SNAPSHOT = 0.1-alpha19 +#endif diff --git a/externals/miXed/toxy/notes.txt b/externals/miXed/toxy/notes.txt new file mode 100644 index 000000000..43a2a6349 --- /dev/null +++ b/externals/miXed/toxy/notes.txt @@ -0,0 +1,120 @@ +TODO for toxy + * widget + . push long message handlers if defined, instead of short + . widgetcontainer: woc and wiw-list + . better megawidgets + . editor: handle semicolons (need to revisit resolution rules) + . editor: break editorhook into separate properties, add them in single mode + . find a way for "package require" to work out-of-the-box on windows + * tow: canvas-wide and type-on-canvas-wide broadcasting + * plustot: + . do not evaluate if fresh, unless explicitly forced to (are side-effects + to be modal, requested with a flag, or triggered with a message?) + . pull inputs + +DONE for toxy + +alpha19 + * plustot + . rules for slot creation: + - there is always at least one slot, although it may be deaf + - if a command contains a pseudo-scalar, there is exactly one, + listening slot + - if a command contains pseudo-array elements, there are as many slots + as the highest index + 1 (but not more than 256, a sanity limit); + listening slots are created for explicitly used elements, all other + slots are deaf + - mixing pseudo-scalar and pseudo-array forms in a single command + is prohibited + - if a command does not contain pseudo-variables, there is exactly one, + deaf slot + . firing rules established for push inputs: + - firing (evaluation with output) is executed iff all listening slots + have data and a) a hot slot receives input, or b) any slot receives + an explicit firing request ('bang' message) + - $Hin and $Cin forms of pseudo-variables: each slot may be explicitly + declared hot (Hin) or cold (Cin), overriding the default rule (leftmost + slot, if listening, is hot, others are cold) observed when the plain + form, $in, is used + - $Tin form of pseudo-variables, which is a ``pure dataflow'' variant + of $Hin: a hot slot, which looses data after evaluation (all other + kinds of slots keep data after evaluation, unless explicitly 'cleared') + - 'set' message accepted in all inlets as the `cold' input + - 'bang' message accepted in all inlets as the firing trigger + . evaluation without output: + - executed iff all listening slots have data and a) an object has + just been created (creation time evaluation), or b) an object + received an explicit evaluation request ('eval' message) + - creation time evaluation suppresses all error messages, explicit + evaluation does not + . message 'clear' in any inlet clears its slot of data + . message 'clearall' in leftmost inlet clears all listening slots + . appearance: converting dot-sequences to valid Tcl for presentation + . bug fix: made unclickable in gop + +alpha18 + * plustot: + . adjusted to the new, stubified +bob handling + . +selectors registered as creation selectors, so that, e.g. "+in" is + a valid input form for "plustot +in" ("+tot +in" remains valid too) + . "save" callback changes every "+tot" selector to "plustot", + and every "+selector" to "plustot +selector" + . customized appearance: + - creation selector omitted if equals "plustot" or "+tot" + - text, border and i/o outline is brown, border is thicker, + inlets and outlets are lightgrey inside and taller + . mouse click interpreted as the message 'bang' + . accepting commands without arguments (beware: this is yet to be debugged) + +alpha17 + * widget: + . first sketch of an editor widget (bpf), introducing a basic set of rules: + - instance data kept in its own namespace + - gui sends '_data' (replaces '_value') requests to pd, specifying one + of the standard submessages: add, delete, set, get + - pd uses the new special handler for replying: @data + (for the time being, there is only an idle loop between the two sides) + . maintaining a scriptlet collection, which mirrors type and instance + handler properties (including specials: @vis, @new, @free and @data) + . lookup in the mirror for faster and more robust handling of messages + . '@ini' section and 'ini' message removed, after being unified as the + @vis special handler (use 'set @vis' message form for passing options) + . all special handlers support short definitions (inside #. comments) + and long definitions (tagged with #@ comments), however only short + ones may be overriden by instance definitions + . long message handlers are stored, but not used yet + . .wid file header may include requirements (base widget definitions) + . fixed: patch's directory handling in 'redefine' + +alpha16 + * widget: + . editor for options, handlers and arguments made more or less functional + . better 'redefine' (although still only external types may be redefined) + * tow: + . fixed handling of gop-ed targets and missing windows + . new messages: 'retarget', 'pwd' + * tot: + . scriptlet editor improved a little bit (still unfinished) + +alpha15 + * fixes for megawidgets + . setting sub-item bindings in ::toxy::subwidget + (to be called explicitly from type initializer) + . handling widget's state through virtual events + . getting implicit geometry (needed for Frame widgets) + . automatically rebinding focus for Canvas widgets + +alpha14 + * 'redefine' message to widget + * version control, using package provide (both in tcl and parsed from pd) + * "> master" section removed: master initializer defined directly + by proc ::toxy::master + * better kb: chords (shift-click), latch (control-click), dragging + +alpha13 + * @new and @free handlers, defined in #@ new and #@ free sections, + invoked by widget object creation and destruction + * optional sections #@ ini (aka #@ vis) appended to initializer (which still + defines in default section too -- old .wid files do not need updating) + * .#args parameter of message handlers, replaced (during scriptlet + evaluation) by all arguments of an invoking message diff --git a/externals/miXed/toxy/plustot.ar.c b/externals/miXed/toxy/plustot.ar.c new file mode 100644 index 000000000..adca72c6e --- /dev/null +++ b/externals/miXed/toxy/plustot.ar.c @@ -0,0 +1,128 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "toxy/plusbob.h" +#include "plustot.h" + +typedef struct _plusproxy_ar +{ + t_pd pp_pd; + t_plustob *pp_tob; +} t_plusproxy_ar; + +typedef struct _plustot_ar +{ + t_plusobject x_plusobject; + t_glist *x_glist; + t_plustob *x_tob; + t_plusproxy_ar *x_proxy; +} t_plustot_ar; + +static t_class *plusproxy_ar_class; +static t_class *plustot_ar_class; + +static t_plusproxy_ar *plusproxy_ar_new(t_pd *master) +{ + t_plusproxy_ar *pp = (t_plusproxy_ar *)pd_new(plusproxy_ar_class); + pp->pp_tob = ((t_plustot_ar *)master)->x_tob; + return (pp); +} + +static void plusproxy_ar_float(t_plusproxy_ar *pp, t_float f) +{ + plustob_setfloat(pp->pp_tob, f); +} + +static void plusproxy_ar_symbol(t_plusproxy_ar *pp, t_symbol *s) +{ + plustob_setsymbol(pp->pp_tob, s); +} + +static void plusproxy_ar_list(t_plusproxy_ar *pp, + t_symbol *s, int ac, t_atom *av) +{ + plustob_setlist(pp->pp_tob, ac, av); +} + +static void plustot_ar_bang(t_plustot_ar *x) +{ + if (plustob_getvalue(x->x_tob)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); +} + +static void plustot_ar_float(t_plustot_ar *x, t_float f) +{ + if (plustob_setfloat(x->x_tob, f)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); +} + +static void plustot_ar_symbol(t_plustot_ar *x, t_symbol *s) +{ + if (plustob_setsymbol(x->x_tob, s)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); +} + +static void plustot_ar_list(t_plustot_ar *x, t_symbol *s, int ac, t_atom *av) +{ + if (plustob_setlist(x->x_tob, ac, av)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); +} + +static void plustot_ar_free(t_plustot_ar *x) +{ + plusbob_release((t_plusbob *)x->x_tob); + if (x->x_proxy) pd_free((t_pd *)x->x_proxy); + plusobject_free(&x->x_plusobject); +} + +void *plustot_ar_new(t_symbol *s, int ac, t_atom *av) +{ + t_plustot_ar *x = 0; + t_glist *glist = canvas_getcurrent(); + t_plustin *tin = 0; + t_plustob *tob = 0; + if ((tin = plustin_glistprovide(glist, PLUSTIN_GLIST_ANY, 0)) && + (tob = plustob_new(tin, 0))) + { + x = (t_plustot_ar *)plusobject_new(plustot_ar_class, s, ac, av, 0); + plusbob_preserve((t_plusbob *)tob); + plusbob_setowner((t_plusbob *)tob, (t_pd *)x); + plustob_setlist(tob, ac, av); + x->x_glist = glist; + x->x_tob = tob; + x->x_proxy = plusproxy_ar_new((t_pd *)x); + plusinlet_new(&x->x_plusobject, (t_pd *)x->x_proxy, 0, 0); + plusoutlet_new(&x->x_plusobject, &s_symbol); + } + else + { + loud_error(0, "+ar: cannot initialize"); + if (tin) + { + plusbob_preserve((t_plusbob *)tin); + plusbob_release((t_plusbob *)tin); + } + } + return (x); +} + +void plustot_ar_setup(void) +{ + plustot_ar_class = class_new(gensym("+ar"), 0, + (t_method)plustot_ar_free, + sizeof(t_plustot_ar), 0, 0); + plusclass_inherit(plustot_ar_class, gensym("+ar")); + class_addbang(plustot_ar_class, plustot_ar_bang); + class_addfloat(plustot_ar_class, plustot_ar_float); + class_addsymbol(plustot_ar_class, plustot_ar_symbol); + class_addlist(plustot_ar_class, plustot_ar_list); + + plusproxy_ar_class = class_new(gensym("+ar proxy"), 0, 0, + sizeof(t_plusproxy_ar), CLASS_PD, 0); + class_addfloat(plusproxy_ar_class, plusproxy_ar_float); + class_addsymbol(plusproxy_ar_class, plusproxy_ar_symbol); + class_addlist(plusproxy_ar_class, plusproxy_ar_list); +} diff --git a/externals/miXed/toxy/plustot.c b/externals/miXed/toxy/plustot.c new file mode 100644 index 000000000..cb3917b40 --- /dev/null +++ b/externals/miXed/toxy/plustot.c @@ -0,0 +1,2391 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "common/grow.h" +#include "unstable/forky.h" +#include "hammer/file.h" +#include "common/props.h" +#include "toxy/scriptlet.h" +#include "toxy/plusbob.h" +#include "plustot.h" +#include "build_counter" + +#define PLUSTOT_VERBOSE + +#ifdef PLUSTOT_DEBUG +//# define PLUSTOT_DEBUGREFCOUNTS +# define PLUSDEBUG_ENDPOST(fn) fputc('\n', stderr) +#else +# define PLUSDEBUG_ENDPOST(fn) +#endif + +#ifdef PLUSTOT_DEBUGREFCOUNTS +# define PLUSDEBUG_INCRREFCOUNT(ob, fn) \ + {fprintf(stderr, "++ %x "fn"\n", (int)(ob)); Tcl_IncrRefCount(ob);} +# define PLUSDEBUG_DECRREFCOUNT(ob, fn) \ + {fprintf(stderr, "-- %x "fn"\n", (int)(ob)); Tcl_DecrRefCount(ob);} +#else +# define PLUSDEBUG_INCRREFCOUNT(ob, fn) Tcl_IncrRefCount(ob) +# define PLUSDEBUG_DECRREFCOUNT(ob, fn) Tcl_DecrRefCount(ob) +#endif + +static t_symbol *plusps_ar; +static t_symbol *plusps_env; +static t_symbol *plusps_in; +static t_symbol *plusps_var; +static t_symbol *plusps_out; +static t_symbol *plusps_qlist; +static t_symbol *plusps_print; +static t_symbol *totps_query; + +static void plussymbols_create(void) +{ + /* public */ + totps_plustot = gensym("plustot"); + plusps_tot = gensym("+tot"); + plusps_Ti = gensym("+Ti"); + plusps_To = gensym("+To"); + plusps_Tv = gensym("+Tv"); + + /* private */ + plusps_ar = gensym("+ar"); + plusps_env = gensym("+env"); + plusps_in = gensym("+in"); + plusps_var = gensym("+var"); + plusps_out = gensym("+out"); + plusps_qlist = gensym("+qlist"); + plusps_print = gensym("+print"); + totps_query = gensym("query"); +} + +static void plusloud_tcldirty(t_pd *caller, char *fnname) +{ + loud_warning((caller == PLUSBOB_OWNER ? 0 : caller), "+tot", + "(%s) tcl plays dirty tricks, sorry", fnname); +} + +void plusloud_tclerror(t_pd *caller, Tcl_Interp *interp, char *msg) +{ + Tcl_Obj *ob = Tcl_GetObjResult(interp); + loud_error((caller == PLUSBOB_OWNER ? 0 : caller), msg); + if (ob) + { + int len; + char *res = Tcl_GetStringFromObj(ob, &len); + if (res && len > 0) + { + char buf[MAXPDSTRING]; + if (len > (MAXPDSTRING-2)) + { + len = (MAXPDSTRING-2); + buf[MAXPDSTRING-2] = '*'; + buf[MAXPDSTRING-1] = 0; + } + else buf[len] = 0; + strncpy(buf, res, len); + loud_errand((caller == PLUSBOB_OWNER ? 0 : caller), + "(tcl) %s", buf); + } + else ob = 0; + Tcl_ResetResult(interp); + } + if (!ob) loud_errand((caller == PLUSBOB_OWNER ? 0 : caller), + "unknown error (probably a bug)"); +} + +/* Plustin (aka +Ti) is a Tcl_Interp wrapped as a +bob. + This is a glist-based flavor of Plusenv. */ + +struct _plustin +{ + t_plusenv tin_env; + t_glist *tin_glist; + Tcl_Interp *tin_interp; + Tcl_CmdInfo *tin_cinfop; +}; + +static t_plustype *plustin_basetype; +static t_plustype *plustin_type; +static t_plustin *plustin_default = 0; + +static int plustin_testCmd(ClientData cd, Tcl_Interp *interp, + int objc, Tcl_Obj **objv) +{ + Tcl_Obj *result; + post("this is a test"); + if (objc != 2) + { + Tcl_WrongNumArgs(interp, 1, objv, "anyValue"); + return (TCL_ERROR); + } + + post("in refcount: %d", objv[1]->refCount); + result = Tcl_DuplicateObj(objv[1]); + post("out refcount: %d", result->refCount); + + if (result == NULL) + return (TCL_ERROR); + Tcl_SetObjResult(interp, result); + post("exit refcount: %d", result->refCount); + return (TCL_OK); +} + +/* To be called from derived constructors or plustin's provider. */ +t_plustin *plustin_create(t_plustype *tp, t_plusbob *parent, t_symbol *id) +{ + t_plustin *tin = 0; + Tcl_Interp *interp = Tcl_CreateInterp(); + if (interp && (tin = (t_plustin *)plusenv_create(tp, parent, id))) + { +#ifdef PLUSTOT_DEBUG + loudbug_post("plustin_create '%s' over %x", + (id ? id->s_name : "default"), (int)interp); +#endif + tin->tin_interp = interp; + tin->tin_cinfop = 0; + Tcl_Preserve(interp); + if (Tcl_Init(interp) == TCL_ERROR) + plusloud_tclerror(0, interp, "interpreter initialization failed"); + else + { + Tcl_CmdInfo cinfo; + /* store Tcl_CmdInfo for off-API Tcl_InfoObjCmd() */ + if (Tcl_GetCommandInfo(interp, "info", &cinfo) + && cinfo.isNativeObjectProc) + tin->tin_cinfop = copybytes(&cinfo, sizeof(*tin->tin_cinfop)); + /* create custom commands */ + Tcl_CreateObjCommand(interp, "test::test", + (Tcl_ObjCmdProc*)plustin_testCmd, + (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); + } + Tcl_Release(interp); + } + else loud_error(0, "failed attempt to create an interpreter"); + return (tin); +} + +/* To be registered for calling from plusbob_release(). + Should never be called explicitly. */ +static void plustin_delete(t_plustin *tin) +{ +#ifdef PLUSTOT_DEBUG + t_symbol *id = plusenv_getid((t_plusenv *)tin); + loudbug_post("plustin_delete '%s' over %x", + (id ? id->s_name : "default"), (int)tin->tin_interp); +#endif + if (tin->tin_cinfop) + freebytes(tin->tin_cinfop, sizeof(*tin->tin_cinfop)); + Tcl_Preserve(tin->tin_interp); + if (!Tcl_InterpDeleted(tin->tin_interp)) + Tcl_DeleteInterp(tin->tin_interp); + Tcl_Release(tin->tin_interp); +} + +Tcl_Interp *plustin_getinterp(t_plustin *tin) +{ + return (tin->tin_interp); +} + +int plustin_procargc(t_plustin *tin, char *pname) +{ + int result = -1; + if (tin->tin_cinfop) + { + /* FIXME preallocate */ + Tcl_Obj *argv[3]; + argv[0] = Tcl_NewStringObj("info", -1); + PLUSDEBUG_INCRREFCOUNT(argv[0], "plustin_procargc"); + argv[1] = Tcl_NewStringObj("args", -1); + PLUSDEBUG_INCRREFCOUNT(argv[0], "plustin_procargc"); + argv[2] = Tcl_NewStringObj(pname, -1); + PLUSDEBUG_INCRREFCOUNT(argv[1], "plustin_procargc"); + if ((*tin->tin_cinfop->objProc)(tin->tin_cinfop->objClientData, + tin->tin_interp, + 3, argv) == TCL_OK) + { + Tcl_Obj *rob; + if (rob = Tcl_GetObjResult(tin->tin_interp)) + { + PLUSDEBUG_INCRREFCOUNT(rob, "plustin_procargc"); + if (Tcl_ListObjLength(tin->tin_interp, rob, &result) != TCL_OK) + { + result = -1; + plusloud_tcldirty(0, "plustin_procargc"); + } + Tcl_ResetResult(tin->tin_interp); + PLUSDEBUG_DECRREFCOUNT(rob, "plustin_procargc"); + } + else plusloud_tcldirty(0, "plustin_procargc"); + } + PLUSDEBUG_DECRREFCOUNT(argv[0], "plustin_procargc"); + PLUSDEBUG_DECRREFCOUNT(argv[1], "plustin_procargc"); + PLUSDEBUG_DECRREFCOUNT(argv[2], "plustin_procargc"); + } + return (result); +} + +t_symbol *plustin_glistid(t_glist *gl) +{ + char buf[32]; + sprintf(buf, "+ti%x", (int)gl); + return (gensym(buf)); +} + +t_plustin *plustin_glistfind(t_glist *gl, int mode) +{ + t_plustin *tin = 0; + if (mode == PLUSTIN_GLIST_UP) + { + gl = gl->gl_owner; + mode = PLUSTIN_GLIST_ANY; + } + if (mode == PLUSTIN_GLIST_THIS) + return ((t_plustin *)plusenv_find(plustin_glistid(gl), + (t_plusenv *)plustin_default)); + else + { + while (gl) + { + char buf[32]; + sprintf(buf, "+ti%x", (int)gl); + if (tin = (t_plustin *)plusenv_find(gensym(buf), + (t_plusenv *)plustin_default)) + break; + gl = gl->gl_owner; + } + return (tin ? tin : plustin_default); + } +} + +/* To be called from client code, instead of plustin_create(). + Preserving is caller's responsibility. + Never returns null, even when called with create == 0: + if requested id not found, default returned, created if necessary. */ +t_plustin *plustin_glistprovide(t_glist *gl, int mode, int create) +{ + t_plustin *tin = 0; + t_plusbob *parent = plusenv_getparent(plustin_type); + if (mode == PLUSTIN_GLIST_UP) + { + gl = gl->gl_owner; + mode = PLUSTIN_GLIST_ANY; + } + tin = plustin_glistfind(gl, mode); + if (!tin && create) + { + if (tin = plustin_create(plustin_type, parent, plustin_glistid(gl))) + tin->tin_glist = gl; + } + if (!tin) + { + if (!plustin_default) + plustin_default = plustin_create(plustin_type, parent, 0); + tin = plustin_default; + } + return (tin); +} + +t_symbol *plustin_getglistname(t_plustin *tin) +{ + return (tin->tin_glist ? tin->tin_glist->gl_name : 0); +} + +/* Plustob (aka +To) is a Tcl_Obj wrapped as a +bob. */ + +/* LATER rethink the plustob/plusvar rules, measure performance. + There are two cases: + + `Bobbing' is taking an object from its wrapping bob, wrapping it into + another bob and, optionally, setting a variable to it. + + The main deal of bobbing design is not to Tcl_DuplicateObj while passing + bobs around. + + `Messing' is converting a Pd message (float, symbol or list) to an object, + wrapping it and, optionally, setting a variable to it. + + The obvious sequence of {Decr(old), New, Incr(new), SetVar(new)}, which + is currently used, involves picking a new object (New), while returning + an old one to the pool (by SetVar or Decr, depending on a third party + changing or not the tcl variable's value in the meantime). I guess + the overhead is negligible, unless we hit at the bottom of the pool. + Moreover, we can reduce the sequence to just {Set(old), SetVar(old)}, + in the case when old is not shared (referenced neither by a variable, + nor by a third party). The main advantage is being consistent with + the way Tcl itself was designed. + + An alternative: in the original messing design, the trick was to: + + . call Set on a prepicked object, instead of New + . call SetVar on a preserved object, as usual (var would not own its value) + . alternate between two prepicked objects in order to avoid calling UnsetVar + + So, the sequence was just {Set(v1), SetVar(v1)}, then {Set(v2), SetVar(v2)}, + again {Set(v1), SetVar(v1)}, and so on, unless a third party (other than + plusvar and a tcl variable) referenced our prepicked object. */ + +#define PLUSTOB_INIELBUFSIZE 128 /* LATER rethink */ + +struct _plustob +{ + t_plusbob tob_bob; + Tcl_Obj *tob_value; + t_plustin *tob_tin; /* redundant, LATER rethink */ + t_plusifsharedfn tob_ifsharedfn; + int tob_elbufsize; + Tcl_Obj **tob_elbuf; + Tcl_Obj *tob_elbufini[PLUSTOB_INIELBUFSIZE]; +}; + +static t_plustype *plustob_type; + +/* To be called from derived constructors. + Preserving is caller's responsibility. */ +t_plustob *plustob_create(t_plustype *tp, t_plustin *tin, Tcl_Obj *ob) +{ + t_plustob *tob = 0; + if (tin && (ob != PLUSTOB_MAKEIT || (ob = Tcl_NewObj())) + && (tob = (t_plustob *)plusbob_create(tp, (t_plusbob *)tin))) + { + if (ob) PLUSDEBUG_INCRREFCOUNT(ob, "plustob_create"); + plusbob_preserve((t_plusbob *)tin); + tob->tob_value = ob; + tob->tob_tin = tin; + tob->tob_ifsharedfn = 0; + tob->tob_elbufsize = PLUSTOB_INIELBUFSIZE; + tob->tob_elbuf = tob->tob_elbufini; + } + return (tob); +} + +/* To be registered for calling from plusbob_release(). + Should never be called explicitly. */ +static void plustob_delete(t_plustob *tob) +{ + if (tob->tob_tin) + plusbob_release((t_plusbob *)tob->tob_tin); + if (tob->tob_value) + PLUSDEBUG_DECRREFCOUNT(tob->tob_value, "plustob_delete"); + if (tob->tob_elbuf != tob->tob_elbufini) + freebytes(tob->tob_elbuf, tob->tob_elbufsize * sizeof(*tob->tob_elbuf)); +} + +/* To be registered for calling from plusbob_attach(). + Should never be called explicitly. */ +static void plustob_attach(t_plustob *tob) +{ + t_plustin *tin; + if (tin = (t_plustin *)plusbob_getparent((t_plusbob *)tob)) + { + if (tob->tob_tin) + plusbob_release((t_plusbob *)tob->tob_tin); + tob->tob_tin = tin; + plusbob_preserve((t_plusbob *)tin); + } + else loudbug_bug("plustob_attach"); +} + +/* To be called from client code. + Preserving is caller's responsibility. */ +t_plustob *plustob_new(t_plustin *tin, Tcl_Obj *ob) +{ + return (plustob_create(plustob_type, tin, ob)); +} + +void plustob_setifshared(t_plustob *tob, t_plusifsharedfn ifsharedfn) +{ + tob->tob_ifsharedfn = ifsharedfn; +} + +int plustob_isshared(t_plustob *tob) +{ + return (tob->tob_value && Tcl_IsShared(tob->tob_value)); +} + +Tcl_Obj *plustob_getvalue(t_plustob *tob) +{ + return (tob->tob_value); +} + +/* silent, if caller is empty */ +t_plustin *plustag_tobtin(t_symbol *tag, t_pd *caller) +{ + t_plusbob *bob = plustag_validroot(tag, plusps_To, caller); + return (bob ? ((t_plustob *)bob)->tob_tin : 0); +} + +/* silent, if caller is empty */ +Tcl_Obj *plustag_tobvalue(t_symbol *tag, t_pd *caller) +{ + t_plusbob *bob = plustag_validroot(tag, plusps_To, caller); + return (bob ? ((t_plustob *)bob)->tob_value : 0); +} + +/* silent, if caller is empty */ +Tcl_Obj *plusatom_tobvalue(t_atom *ap, t_pd *caller) +{ + if (ap->a_type == A_SYMBOL) + return (plustag_tobvalue(ap->a_w.w_symbol, caller)); + else if (caller) + { + char buf[80]; + atom_string(ap, buf, 80); + loud_error((caller == PLUSBOB_OWNER ? 0 : caller), + "+tot does not understand '%s' (check object connections)", buf); + } + return (0); +} + +int plustob_clear(t_plustob *tob) +{ + if (!tob->tob_tin) + { + /* FIXME */ + loud_warning(0, "+tot", "+To: environment missing"); + return (0); + } + if (tob->tob_value) + { + PLUSDEBUG_DECRREFCOUNT(tob->tob_value, "plustob_clear"); + tob->tob_value = 0; + return (1); + } + else return (0); +} + +Tcl_Obj *plustob_set(t_plustob *tob, t_plustin *tin, Tcl_Obj *ob) +{ + if (tin != tob->tob_tin) + { + /* FIXME */ + loud_warning(0, "+tot", "+To: environment mismatch"); + return (0); + } + if (ob != tob->tob_value) + { + if (tob->tob_value) + PLUSDEBUG_DECRREFCOUNT(tob->tob_value, "plustob_set"); + if (ob) + { + PLUSDEBUG_INCRREFCOUNT(ob, "plustob_set"); + if (Tcl_IsShared(ob)) + { + /* FIXME */ + } + } + tob->tob_value = ob; + } + return (ob); +} + +Tcl_Obj *plustob_setfloat(t_plustob *tob, t_float f) +{ + Tcl_Obj *ob = tob->tob_value; + if (!ob || Tcl_IsShared(ob)) + { + Tcl_Obj *tmp; + int i = (int)f; + if (ob && tob->tob_ifsharedfn) + { + if ((*tob->tob_ifsharedfn)((t_plusbob *)tob, ob) == 0) + return (0); + } + if (f == i) /* LATER rethink */ + tmp = Tcl_NewIntObj(i); + else + tmp = Tcl_NewDoubleObj((double)f); + if (tmp) + { + if (ob) PLUSDEBUG_DECRREFCOUNT(ob, "plustob_setfloat"); + tob->tob_value = ob = tmp; + PLUSDEBUG_INCRREFCOUNT(ob, "plustob_setfloat"); + } + else return (0); + } + else + { + int i = (int)f; + if (f == i) /* LATER rethink */ + Tcl_SetIntObj(ob, i); + else + Tcl_SetDoubleObj(ob, (double)f); + } + return (ob); +} + +Tcl_Obj *plustob_setsymbol(t_plustob *tob, t_symbol *s) +{ + if (plustag_isvalid(s, 0)) + { + t_plusbob *bob; + if (bob = plustag_validroot(s, plusps_To, PLUSBOB_OWNER)) + { + t_plustob *from = (t_plustob *)bob; + return (plustob_set(tob, from->tob_tin, from->tob_value)); + } + else return (0); + } + else + { + Tcl_Obj *ob = tob->tob_value; + if (!ob || Tcl_IsShared(ob)) + { + Tcl_Obj *tmp; + if (ob && tob->tob_ifsharedfn) + { + if ((*tob->tob_ifsharedfn)((t_plusbob *)tob, ob) == 0) + return (0); + } + if (tmp = Tcl_NewStringObj(s->s_name, -1)) + { + if (ob) PLUSDEBUG_DECRREFCOUNT(ob, "plustob_setsymbol"); + tob->tob_value = ob = tmp; + PLUSDEBUG_INCRREFCOUNT(ob, "plustob_setsymbol"); + } + else return (0); + } + else Tcl_SetStringObj(ob, s->s_name, -1); + return (ob); + } +} + +Tcl_Obj *plustob_setlist(t_plustob *tob, int ac, t_atom *av) +{ + if (ac == 1) + { + if (av->a_type == A_FLOAT) + return (plustob_setfloat(tob, av->a_w.w_float)); + else if (av->a_type == A_SYMBOL) + return (plustob_setsymbol(tob, av->a_w.w_symbol)); + } + else if (ac > 1) + { + Tcl_Obj *ob = tob->tob_value; + int count; + t_atom *ap; + for (count = 0, ap = av; count < ac; count++, ap++) + if (ap->a_type != A_FLOAT && ap->a_type != A_SYMBOL) + break; + if (count > tob->tob_elbufsize) + { +#ifdef PLUSTOT_DEBUG + loudbug_post("growing +To %d -> %d", tob->tob_elbufsize, count); +#endif + tob->tob_elbuf = + grow_nodata(&count, &tob->tob_elbufsize, tob->tob_elbuf, + PLUSTOB_INIELBUFSIZE, tob->tob_elbufini, + sizeof(*tob->tob_elbuf)); + } + if (count > 0) + { + int i; + Tcl_Obj **elp; + for (i = 0, elp = tob->tob_elbuf; i < count; i++, elp++, av++) + { + if (av->a_type == A_FLOAT) + *elp = Tcl_NewDoubleObj((double)av->a_w.w_float); + else if (av->a_type == A_SYMBOL) + *elp = Tcl_NewStringObj(av->a_w.w_symbol->s_name, -1); + } + if (!ob || Tcl_IsShared(ob)) + { + Tcl_Obj *tmp; + if (ob && tob->tob_ifsharedfn) + { + if ((*tob->tob_ifsharedfn)((t_plusbob *)tob, ob) == 0) + return (0); + } + if (tmp = Tcl_NewListObj(count, tob->tob_elbuf)) + { + if (ob) PLUSDEBUG_DECRREFCOUNT(ob, "plustob_setlist"); + tob->tob_value = ob = tmp; + PLUSDEBUG_INCRREFCOUNT(ob, "plustob_setlist"); + } + else return (0); + } + else Tcl_SetListObj(ob, count, tob->tob_elbuf); + return (ob); + } + } + return (0); /* count == 0, LATER rethink */ +} + +static int plustob_parseatoms(int ac, t_atom *av, int *natomsp, int *nlistsp, + Tcl_Obj **listobs, Tcl_Obj **atomobs) +{ + int i, natoms = 0, nlists = 0, start = 1; + t_atom *ap; + int atomcnt = 0; + Tcl_Obj **atomptr = atomobs; + for (i = 0, ap = av; i < ac; i++, ap++) + { + if (ap->a_type == A_SEMI || ap->a_type == A_COMMA) + { + /* empty lists are filtered out, LATER rethink */ + if (!start) + { + if (listobs) + { + if (listobs[nlists] = Tcl_NewListObj(atomcnt, atomptr)) + { + atomptr += atomcnt; + atomcnt = 0; + } + else goto parsefailed; + } + nlists++; + } + start = 1; + } + else + { + /* other types are ignored, LATER rethink */ + start = 0; + if (ap->a_type == A_FLOAT || ap->a_type == A_SYMBOL) + { + if (atomobs) + { + if (!(atomobs[natoms] = + (ap->a_type == A_FLOAT ? + Tcl_NewDoubleObj((double)ap->a_w.w_float) : + Tcl_NewStringObj(ap->a_w.w_symbol->s_name, -1)))) + goto parsefailed; + atomcnt++; + } + natoms++; + } + } + } + if (natoms && !start) + { + if (listobs && + !(listobs[nlists] = Tcl_NewListObj(atomcnt, atomptr))) + goto parsefailed; + nlists++; + } + if (natomsp) *natomsp = natoms; + if (nlistsp) *nlistsp = nlists; + return (1); +parsefailed: + /* FIXME cleanup */ + return (0); +} + +Tcl_Obj *plustob_setbinbuf(t_plustob *tob, t_binbuf *bb) +{ + int ac = binbuf_getnatom(bb); + if (ac) + { + t_atom *av = binbuf_getvec(bb); + Tcl_Obj *ob = tob->tob_value; + int count, natoms, nlists; + plustob_parseatoms(ac, av, &natoms, &nlists, 0, 0); + count = natoms + nlists; + if (count > tob->tob_elbufsize) + { + int n = count; +#ifdef PLUSTOT_DEBUG + loudbug_post("growing +To %d -> %d", tob->tob_elbufsize, count); +#endif + tob->tob_elbuf = + grow_nodata(&n, &tob->tob_elbufsize, tob->tob_elbuf, + PLUSTOB_INIELBUFSIZE, tob->tob_elbufini, + sizeof(*tob->tob_elbuf)); + if (n < count) + goto setbbfailed; + } + if (!plustob_parseatoms(ac, av, 0, 0, + tob->tob_elbuf, tob->tob_elbuf + nlists)) + goto setbbfailed; + if (!ob || Tcl_IsShared(ob)) + { + Tcl_Obj *tmp; + if (ob && tob->tob_ifsharedfn) + { + if ((*tob->tob_ifsharedfn)((t_plusbob *)tob, ob) == 0) + goto setbbfailed; + } + if (tmp = Tcl_NewListObj(nlists, tob->tob_elbuf)) + { + if (ob) PLUSDEBUG_DECRREFCOUNT(ob, "plustob_setbinbuf"); + tob->tob_value = ob = tmp; + PLUSDEBUG_INCRREFCOUNT(ob, "plustob_setbinbuf"); + } + else goto setbbfailed; + } + else Tcl_SetListObj(ob, nlists, tob->tob_elbuf); + return (ob); + } +setbbfailed: + return (0); +} + +Tcl_Obj *plustob_grabresult(t_plustob *tob) +{ + Tcl_Interp *interp = tob->tob_tin->tin_interp; + Tcl_Obj *rob; + if (rob = Tcl_GetObjResult(interp)) + { + if (rob == tob->tob_value) + Tcl_ResetResult(interp); + else + { + PLUSDEBUG_INCRREFCOUNT(rob, "plustob_grabresult"); + Tcl_ResetResult(interp); + if (Tcl_IsShared(rob)) + { + /* FIXME */ + } + if (tob->tob_value) + PLUSDEBUG_DECRREFCOUNT(tob->tob_value, "plustob_grabresult"); + tob->tob_value = rob; + } + } + else plusloud_tcldirty(plusbob_getowner((t_plusbob *)tob), + "plustob_grabresult"); + return (rob); +} + +Tcl_Obj *plustob_evalob(t_plustob *tob, Tcl_Obj *ob) +{ + Tcl_Interp *interp = tob->tob_tin->tin_interp; + Tcl_Obj *rob; + Tcl_Preserve(interp); + if (Tcl_EvalObj(interp, ob) == TCL_OK) + rob = plustob_grabresult(tob); + else + { + plusloud_tclerror(plusbob_getowner((t_plusbob *)tob), interp, + "immediate command failed"); + rob = 0; + } + Tcl_Release(interp); + return (rob); +} + +/* Plusvar (aka +Tv) is a plustob with a one-way link to a tcl variable. + Whenever plusvar's value changes, the variable is set to it (the opposite + update requires explicitly calling the plusvar_pull() request). + This is different from one-way linking by passing TCL_LINK_READ_ONLY flag + to Tcl_LinkVar(): plusvar's variable is not forced to be read-only, + and its value's form and internal representation are not constrained. */ + +struct _plusvar +{ + t_plustob var_tob; + char *var_name; + char *var_index; + Tcl_Obj *var_part1; + Tcl_Obj *var_part2; +}; + +static t_plustype *plusvar_type; + +/* Since tcl always uses a hash table of string indices for array element + lookup, there are never any gains when using integer indices. */ + +/* To be called from derived constructors. + Preserving is caller's responsibility. */ +t_plusvar *plusvar_create(t_plustype *tp, t_plustin *tin, Tcl_Obj *ob, + char *name, char *index) +{ + t_plusvar *var = 0; + Tcl_Obj *ntob = 0; + Tcl_Obj *itob = 0; + if (name && *name) + { + if (ntob = Tcl_NewStringObj(name, -1)) + { + PLUSDEBUG_INCRREFCOUNT(ntob, "plusvar_create"); + } + else goto varfailed1; + } + else + { + loudbug_bug("plusvar_create"); + goto varfailed2; + } + if (index) + { + if (itob = Tcl_NewStringObj(index, -1)) + { + PLUSDEBUG_INCRREFCOUNT(itob, "plusvar_create"); + } + else goto varfailed1; + } + if (var = (t_plusvar *)plustob_create(tp, tin, ob)) + { + var->var_name = getbytes(strlen(name) + 1); + strcpy(var->var_name, name); + if (index) + { + var->var_index = getbytes(strlen(index) + 1); + strcpy(var->var_index, index); + } + else var->var_index = 0; + var->var_part1 = ntob; + var->var_part2 = itob; + } + else goto varfailed2; + return (var); +varfailed1: + plusloud_tcldirty(0, "plusvar_create"); +varfailed2: + if (ntob) PLUSDEBUG_DECRREFCOUNT(ntob, "plusvar_create"); + if (itob) PLUSDEBUG_DECRREFCOUNT(itob, "plusvar_create"); + return (0); +} + +/* To be registered for calling from plusbob_release(). + Should never be called explicitly. */ +static void plusvar_delete(t_plusvar *var) +{ + freebytes(var->var_name, strlen(var->var_name) + 1); + if (var->var_index) + freebytes(var->var_index, strlen(var->var_index) + 1); + PLUSDEBUG_DECRREFCOUNT(var->var_part1, "plusvar_delete"); + if (var->var_part2) + PLUSDEBUG_DECRREFCOUNT(var->var_part2, "plusvar_delete"); +} + +/* To be called from client code. + Preserving is caller's responsibility */ +t_plusvar *plusvar_new(char *name, char *index, t_plustin *tin) +{ + return (plusvar_create(plusvar_type, tin, 0, name, index)); +} + +/* not used yet */ +static int plusvar_ifshared(t_plusbob *bob, Tcl_Obj *ob) +{ + /* Shared means either the variable still holds our value, or the value + is referenced by a third party, or both. In either case, we have to + pick a new object. + LATER consider testing for illegal use of a pseudo-variable. */ + return (1); +} + +/* synchronize a Tcl variable to a +var */ +/* LATER try making it more efficient */ +static Tcl_Obj *plusvar_postset(t_plusvar *var) +{ + Tcl_Obj *rob; + t_plustob *tob = (t_plustob *)var; + Tcl_Interp *interp = tob->tob_tin->tin_interp; + Tcl_Preserve(interp); + if (tob->tob_value) + { + rob = Tcl_ObjSetVar2(interp, var->var_part1, var->var_part2, + tob->tob_value, 0); + if (!rob) + { + if (Tcl_UnsetVar2(interp, var->var_name, var->var_index, + TCL_LEAVE_ERR_MSG) == TCL_OK) + rob = Tcl_ObjSetVar2(interp, var->var_part1, var->var_part2, + tob->tob_value, TCL_LEAVE_ERR_MSG); + } + if (rob) + { +#ifdef PLUSTOT_DEBUGREFCOUNTS + if (var->var_index) + loudbug_post("vv %x plusvar_postset [%s(%s)]", + (int)tob->tob_value, var->var_name, + var->var_index); + else + loudbug_post("vv %x plusvar_postset [%s]", + (int)tob->tob_value, var->var_name); +#endif + } + else plusloud_tclerror(0, interp, "cannot set variable"); + } + else + { + if (Tcl_UnsetVar2(interp, var->var_name, var->var_index, + TCL_LEAVE_ERR_MSG) != TCL_OK) + plusloud_tclerror(0, interp, "cannot unset variable"); + rob = 0; + } + Tcl_Release(interp); + return (rob); +} + +/* move a +var's value into a Tcl variable */ +Tcl_Obj *plusvar_push(t_plusvar *var) +{ + if (((t_plustob *)var)->tob_value) + return (plusvar_postset(var)); + else + return (0); +} + +/* move a Tcl variable's value into a +var */ +Tcl_Obj *plusvar_pull(t_plusvar *var) +{ + Tcl_Obj *rob; + t_plustob *tob = (t_plustob *)var; + Tcl_Interp *interp = tob->tob_tin->tin_interp; + Tcl_Preserve(interp); + if (rob = Tcl_ObjGetVar2(interp, var->var_part1, var->var_part2, + TCL_LEAVE_ERR_MSG)) + plustob_set(tob, tob->tob_tin, rob); + else + plusloud_tclerror(0, interp, "cannot read variable"); + Tcl_Release(interp); + return (rob); +} + +void plusvar_clear(t_plusvar *var, int doit) +{ + if (plustob_clear((t_plustob *)var) && doit) + plusvar_postset(var); +} + +Tcl_Obj *plusvar_set(t_plusvar *var, Tcl_Obj *ob, int doit) +{ + t_plustob *tob = (t_plustob *)var; + if (plustob_set(tob, tob->tob_tin, ob)) + return (doit ? plusvar_postset(var) : tob->tob_value); + else + return (0); +} + +Tcl_Obj *plusvar_setfloat(t_plusvar *var, t_float f, int doit) +{ + t_plustob *tob = (t_plustob *)var; + if (plustob_setfloat(tob, f)) + return (doit ? plusvar_postset(var) : tob->tob_value); + else + return (0); +} + +Tcl_Obj *plusvar_setsymbol(t_plusvar *var, t_symbol *s, int doit) +{ + t_plustob *tob = (t_plustob *)var; + if (plustob_setsymbol(tob, s)) + return (doit ? plusvar_postset(var) : tob->tob_value); + else + return (0); +} + +Tcl_Obj *plusvar_setlist(t_plusvar *var, int ac, t_atom *av, int doit) +{ + t_plustob *tob = (t_plustob *)var; + if (plustob_setlist(tob, ac, av)) + return (doit ? plusvar_postset(var) : tob->tob_value); + else + return (0); +} + +/* LATER derive +string from +bob */ + +struct _plusstring +{ + int ps_len; + char *ps_buf; + int ps_refcount; +}; + +/* Resolving dot-separators, unless script is empty. */ +static t_plusstring *plusstring_fromatoms(t_symbol *s, int ac, t_atom *av, + t_scriptlet *script) +{ + t_plusstring *ps = 0; + char *buf; + int length; + if (script) + { + char *start; + scriptlet_reset(script); + if (s && s != &s_) + { + t_atom at; + SETSYMBOL(&at, s); + scriptlet_add(script, 1, 1, 1, &at); + } + scriptlet_add(script, 1, 1, ac, av); + start = scriptlet_getcontents(script, &length); + buf = copybytes(start, length); + } + else + { + char string[MAXPDSTRING]; + char *newbuf; + if (s && s != &s_) + { + t_atom at; + SETSYMBOL(&at, s); + atom_string(&at, string, MAXPDSTRING); + length = strlen(string) + 1; + buf = getbytes(length); + strcpy(buf, string); + buf[length-1] = ' '; + } + else + { + buf = getbytes(0); + length = 0; + } + while (ac--) + { + int newlength; + if ((av->a_type == A_SEMI || av->a_type == A_COMMA) && + length && buf[length-1] == ' ') length--; + atom_string(av, string, MAXPDSTRING); + newlength = length + strlen(string) + 1; + if (!(newbuf = resizebytes(buf, length, newlength))) break; + buf = newbuf; + strcpy(buf + length, string); + length = newlength; + if (av->a_type == A_SEMI) buf[length-1] = '\n'; + else buf[length-1] = ' '; + av++; + } + if (length && buf[length-1] == ' ') + { + if (newbuf = resizebytes(buf, length, length-1)) + { + buf = newbuf; + length--; + } + } + } + ps = getbytes(sizeof(*ps)); + ps->ps_len = length; + ps->ps_buf = buf; + ps->ps_refcount = 0; + return (ps); +} + +void plusstring_preserve(t_plusstring *ps) +{ + ps->ps_refcount++; +} + +void plusstring_release(t_plusstring *ps) +{ + if (--ps->ps_refcount <= 0) + { + if (ps->ps_refcount == 0) + { + if (ps->ps_buf) freebytes(ps->ps_buf, ps->ps_len); + freebytes(ps, sizeof(*ps)); + } + else loudbug_bug("plusstring_release"); + } +} + +char *plusstring_get(t_plusstring *ps, int *lenp) +{ + *lenp = ps->ps_len; + return (ps->ps_buf); +} + +struct _plustot; +#define t_plustot struct _plustot +static int plustot_doit(t_plustot *x, int sendit); + +typedef struct _plusproxy +{ + t_pd pp_pd; + t_plustot *pp_master; + t_plusvar *pp_var; + int pp_ndx; + int pp_ishot; + int pp_istransient; + int pp_warned; +} t_plusproxy; + +static t_class *plusproxy_class; + +/* Variable is to be created during the second parsing pass, in order to give + it an actual name, and in order to fill only the slots that are actually + referenced. If ndx is negative, then this is a pseudo-scalar, otherwise + this is a pseudo-array element. */ +static t_plusproxy *plusproxy_new(t_plustot *master, int ndx, + int ishot, int istransient, + t_plustin *tin) +{ + t_plusproxy *pp = (t_plusproxy *)pd_new(plusproxy_class); + pp->pp_master = master; + pp->pp_var = 0; + pp->pp_ndx = ndx; + pp->pp_ishot = ishot; + pp->pp_istransient = istransient; + pp->pp_warned = 0; + return (pp); +} + +static void plusproxy_free(t_plusproxy *pp) +{ +#ifdef PLUSTOT_DEBUG + loudbug_post("plusproxy_free (%s %d)", + (pp->pp_var ? pp->pp_var->var_name : "deaf"), pp->pp_ndx); +#endif + if (pp->pp_var) + plusbob_release((t_plusbob *)pp->pp_var); +} + +static void plusproxy_deafhit(t_plusproxy *pp) +{ + if (!pp->pp_warned) + { + loud_error((t_pd *)pp->pp_master, "deaf slot hit"); + pp->pp_warned = 1; + } +} + +static void plusproxy_clear(t_plusproxy *pp) +{ + if (pp->pp_var) + plusvar_clear(pp->pp_var, 1); + else + plusproxy_deafhit(pp); +} + +static void plusproxy_bang(t_plusproxy *pp) +{ + if (pp->pp_var) + plustot_doit(pp->pp_master, 1); + else + plusproxy_deafhit(pp); +} + +static void plusproxy_float(t_plusproxy *pp, t_float f) +{ + if (pp->pp_var) + { + plusvar_setfloat(pp->pp_var, f, 0); + if (pp->pp_ishot) + plustot_doit(pp->pp_master, 1); + } + else plusproxy_deafhit(pp); +} + +static void plusproxy_symbol(t_plusproxy *pp, t_symbol *s) +{ + if (pp->pp_var) + { + plusvar_setsymbol(pp->pp_var, s, 0); + if (pp->pp_ishot) + plustot_doit(pp->pp_master, 1); + } + else plusproxy_deafhit(pp); +} + +static void plusproxy_list(t_plusproxy *pp, t_symbol *s, int ac, t_atom *av) +{ + if (pp->pp_var) + { + plusvar_setlist(pp->pp_var, ac, av, 0); + if (pp->pp_ishot) + plustot_doit(pp->pp_master, 1); + } + else plusproxy_deafhit(pp); +} + +static void plusproxy_set(t_plusproxy *pp, t_symbol *s, int ac, t_atom *av) +{ + if (pp->pp_var) + { + if (ac == 1) + { + if (av->a_type == A_FLOAT) + plusvar_setfloat(pp->pp_var, av->a_w.w_float, 0); + else if (av->a_type == A_SYMBOL) + plusvar_setsymbol(pp->pp_var, av->a_w.w_symbol, 0); + } + else plusvar_setlist(pp->pp_var, ac, av, 0); + } + else plusproxy_deafhit(pp); +} + +#ifdef PLUSTOT_DEBUG +static void plusproxy_debug(t_plusproxy *pp) +{ + t_plustin *tin = ((t_plustob *)pp->pp_var)->tob_tin; + t_symbol *id = plusenv_getid((t_plusenv *)tin); + t_symbol *glname = plustin_getglistname(tin); + loudbug_post("+proxy %d, glist %x", + pp->pp_ndx, (int)((t_plusobject *)pp->pp_master)->po_glist); + loudbug_post(" plustin '%s' (%s) over %x", (id ? id->s_name : "default"), + (glname ? glname->s_name : "<anonymous>"), + (int)tin->tin_interp); +} +#endif + +typedef struct _plusword +{ + int pw_type; + Tcl_Obj *pw_ob; + Tcl_Token *pw_ndxv; /* index part of this word (if array variable) */ + int pw_ndxc; /* numComponents of the above */ +} t_plusword; + +#define PLUSTOT_MAXINLETS 256 /* LATER rethink */ +#define PLUSTOT_INIMAXWORDS 16 + +/* LATER elaborate */ +#define PLUSTOT_ERRUNKNOWN -1 +#define PLUSTOT_ERROTHER -2 + +struct _plustot +{ + t_plusobject x_plusobject; + t_plustob *x_tob; /* interpreter's result (after invocation) */ + t_scriptlet *x_script; + Tcl_Obj *x_cname; /* command name, main validation flag */ + Tcl_CmdInfo x_cinfo; + t_plusstring *x_ctail; /* command arguments, parse validation flag */ + Tcl_Parse x_tailparse; + int x_maxwords; /* as allocated */ + int x_nwords; /* as used, including command name */ + t_plusword *x_words; /* arguments, not evaluated */ + t_plusword x_wordsini[PLUSTOT_INIMAXWORDS]; + int x_maxargs; /* == maxwords, except during growing */ + int x_argc; /* 0 or nwords, except during evaluation */ + Tcl_Obj **x_argv; /* command name and evaluated arguments */ + Tcl_Obj *x_argvini[PLUSTOT_INIMAXWORDS]; + int x_pseudoscalar; + int x_nproxies; + t_plusproxy **x_proxies; + t_plusproxy *x_mainproxy; /* == x_proxies[0] or null if 1st slot deaf */ + t_plusproxy *x_deafproxy; /* dummy/x_proxies[0] if deaf, else null */ + int x_grabwarned; + int x_isloud; +}; + +static t_class *plustot_class; + +static void plustot_tclerror(t_plustot *x, Tcl_Interp *interp, char *msg) +{ + if (x->x_isloud) + plusloud_tclerror((t_pd *)x, interp, msg); +} + +/* First pass (!doit): determine number of slots. + Second pass (doit): create variables for listening slots. */ +static int plustot_usevariable(t_plustot *x, Tcl_Token *tp, int doit) +{ + int nc = tp->numComponents; + char *errmess = 0; + int errcode = PLUSTOT_ERRUNKNOWN; +#ifdef PLUSTOT_DEBUG + if (!doit) + { + char buf[MAXPDSTRING]; + int size = tp->size; + if (size > (MAXPDSTRING-2)) + { + size = (MAXPDSTRING-2); + buf[MAXPDSTRING-2] = '*'; + buf[MAXPDSTRING-1] = 0; + } + else buf[size] = 0; + strncpy(buf, tp->start, size); + loudbug_startpost("%s ", buf); + } +#endif + tp++; + if (nc && tp->type == TCL_TOKEN_TEXT) + { + int ishot = 0, iscold = 0, istransient = 0; + if (strncmp(tp->start, "Hin", tp->size) == 0) + ishot = 1; + else if (strncmp(tp->start, "Cin", tp->size) == 0) + iscold = 1; + else if (strncmp(tp->start, "Tin", tp->size) == 0) + istransient = ishot = 1; + if (!ishot && !iscold && strncmp(tp->start, "in", tp->size)) + { + /* regular variable */ + /* LATER it should be write-traced (2nd pass, but only if there are + pull inputs) in order to know when the object becomes stale */ + } + else + { + /* pseudo-variable */ + int inno = -1; + tp++; + if (nc == 1) + { + if (x->x_nproxies && !x->x_pseudoscalar) + { + errmess = "mixed scalar and array forms of pseudo-variable"; + errcode = PLUSTOT_ERROTHER; + goto badvariable; + } + inno = 0; + x->x_pseudoscalar = 1; + } + else if (nc == 2 && tp->type == TCL_TOKEN_TEXT) + { + int i; + char *p; + if (x->x_pseudoscalar) + { + errmess = "mixed scalar and array forms of pseudo-variable"; + errcode = PLUSTOT_ERROTHER; + goto badvariable; + } + inno = 0; + for (i = 0, p = (char *)tp->start; i < tp->size; i++, p++) + { + if (*p < '0' || *p > '9') + { + errmess = "invalid inlet number in pseudo-variable"; + errcode = PLUSTOT_ERROTHER; + goto badvariable; + } + inno = inno * 10 + (int)(*p - '0'); + } + if (inno > PLUSTOT_MAXINLETS) + { + errmess = "inlet number too large in pseudo-variable"; + errcode = PLUSTOT_ERROTHER; + goto badvariable; + } + } + else + { + errmess = "invalid index format in pseudo-variable"; + errcode = PLUSTOT_ERROTHER; + goto badvariable; + } + if (inno >= 0) + { + if (!doit) + { +#ifdef PLUSTOT_DEBUG + loudbug_startpost("(inlet %d) ", inno); +#endif + if (inno >= x->x_nproxies) + x->x_nproxies = inno + 1; + } + else if (inno < x->x_nproxies) + { + t_plusproxy *pp = x->x_proxies[inno]; + if (!pp->pp_var) + { + t_plusvar *var; + char buf[8], *ptr; + if (x->x_pseudoscalar) + ptr = 0; + else + sprintf(ptr = buf, "%d", inno); + if (istransient) + { + pp->pp_istransient = pp->pp_ishot = 1; + var = plusvar_new("Tin", ptr, x->x_tob->tob_tin); + } + else if (ishot) + { + pp->pp_ishot = 1; + var = plusvar_new("Hin", ptr, x->x_tob->tob_tin); + } + else if (iscold) + { + pp->pp_ishot = 0; + var = plusvar_new("Cin", ptr, x->x_tob->tob_tin); + } + /* keep defaults, as set in plustot_makeproxies(): */ + else var = plusvar_new("in", ptr, x->x_tob->tob_tin); + plusbob_preserve((t_plusbob *)var); + plusbob_setowner((t_plusbob *)var, (t_pd *)x); + pp->pp_var = var; + } + } + else + { + PLUSDEBUG_ENDPOST("plustot_usevariable"); + loudbug_bug("plustot_usevariable"); + goto badvariable; + } + } + else + { + errmess = "invalid pseudo-variable"; + errcode = PLUSTOT_ERROTHER; + goto badvariable; + } + } + return (1); + } + else plusloud_tcldirty((t_pd *)x, "plustot_usevariable"); +badvariable: + if (errmess) + { + PLUSDEBUG_ENDPOST("plustot_usevariable"); + loud_error((t_pd *)x, errmess); + } + return (errcode); +} + +static int plustot_doparsevariables(t_plustot *x, Tcl_Interp *interp, + const char *buf, int len, + Tcl_Parse *parsep, int doit) +{ + int nvars = 0; + int errcode = PLUSTOT_ERRUNKNOWN; + if (Tcl_ParseCommand(interp, buf, len, 0, parsep) == TCL_OK) + { + int ntok = parsep->numTokens; + Tcl_Token *tp = parsep->tokenPtr; + while (ntok--) + { + if (tp->type == TCL_TOKEN_VARIABLE) + { + int res = plustot_usevariable(x, tp, doit); + if (res > 0) + nvars++; + else + { + errcode = res; + goto parsefailed; + } + } + else if (tp->type == TCL_TOKEN_COMMAND) + { + if (tp->size > 2) + { + Tcl_Parse parse; + int res = + plustot_doparsevariables(x, interp, tp->start + 1, + tp->size - 2, &parse, doit); + if (res != PLUSTOT_ERRUNKNOWN) + Tcl_FreeParse(&parse); + if (res >= 0) + nvars += res; + else + { + errcode = res; + goto parsefailed; + } + } + } + else if (tp->type == TCL_TOKEN_SIMPLE_WORD + && tp->size > 2 && *tp->start == '{') + { + tp++; +#if 0 && defined(PLUSTOT_DEBUG) + if (doit && tp->size > 0) + { + char buf[MAXPDSTRING+1]; + int sz = (tp->size < MAXPDSTRING ? tp->size : MAXPDSTRING); + strncpy(buf, tp->start, sz); + buf[sz] = 0; + loudbug_post("simple word's text: %s", buf); + } +#endif + if (ntok-- && tp->type == TCL_TOKEN_TEXT && tp->size > 0) + { + Tcl_Parse parse; + int res = + plustot_doparsevariables(x, interp, tp->start, + tp->size, &parse, doit); + if (res != PLUSTOT_ERRUNKNOWN) + Tcl_FreeParse(&parse); + if (res >= 0) + nvars += res; + else + { + errcode = res; + goto parsefailed; + } + } + else + { + plusloud_tcldirty((t_pd *)x, "plustot_doparsevariables"); + goto parsefailed; + } + } +#if 0 && defined(PLUSTOT_DEBUG) + else if (doit && tp->size > 0) + { + char buf[MAXPDSTRING+1]; + int sz = (tp->size < MAXPDSTRING ? tp->size : MAXPDSTRING); + strncpy(buf, tp->start, sz); + buf[sz] = 0; + loudbug_post("other type (%d): %s", tp->type, buf); + } +#endif + tp++; + } + } + else goto parsefailed; + return (nvars); +parsefailed: + return (errcode); +} + +static int plustot_parsevariables(t_plustot *x, Tcl_Interp *interp, + const char *buf, int len, + Tcl_Parse *parsep, int doit) +{ + int nvars; +#ifdef PLUSTOT_DEBUG + if (!doit) loudbug_startpost("variables: "); +#endif + nvars = plustot_doparsevariables(x, interp, buf, len, parsep, doit); +#ifdef PLUSTOT_DEBUG + if (!doit) + { + if (nvars > 0) + { + loudbug_post("\n%d variable substitutions", nvars); + loudbug_post("%d inlets requested", x->x_nproxies); + } + else if (nvars == 0) loudbug_post("none"); + } +#endif + return (nvars); +} + +static int plustot_makeproxies(t_plustot *x) +{ + Tcl_Interp *interp = x->x_tob->tob_tin->tin_interp; + if (interp) + { + if (x->x_nproxies == 0) + { + x->x_proxies = 0; + x->x_mainproxy = 0; + x->x_deafproxy = plusproxy_new(x, -2, 0, 0, x->x_tob->tob_tin); + } + else if (x->x_nproxies == 1 + || (x->x_nproxies > 1 && !x->x_pseudoscalar)) + { + if (x->x_proxies = getbytes(x->x_nproxies * sizeof(*x->x_proxies))) + { + int i; + x->x_proxies[0] = + plusproxy_new(x, (x->x_pseudoscalar ? -1 : 0), 1, 0, + x->x_tob->tob_tin); + for (i = 1; i < x->x_nproxies; i++) + { + x->x_proxies[i] = + plusproxy_new(x, i, 0, 0, x->x_tob->tob_tin); + plusinlet_new(&x->x_plusobject, + (t_pd *)x->x_proxies[i], 0, 0); + } + /* second pass: traverse listening slots, create variables */ + plustot_parsevariables(x, interp, + x->x_ctail->ps_buf, x->x_ctail->ps_len, + &x->x_tailparse, 1); + if (x->x_proxies[0]->pp_var) + { + x->x_mainproxy = x->x_proxies[0]; + x->x_deafproxy = 0; + } + else + { + x->x_mainproxy = 0; + x->x_deafproxy = x->x_proxies[0]; + } + } + else goto proxiesfailed; + } + else + { + loudbug_bug("plustot_makeproxies"); + goto proxiesfailed; + } + return (1); + } +proxiesfailed: + return (0); +} + +static void plustot_initwords(t_plustot *x) +{ + if (x->x_words != x->x_wordsini) + freebytes(x->x_words, x->x_maxwords * sizeof(*x->x_words)); + x->x_maxwords = PLUSTOT_INIMAXWORDS; + x->x_nwords = 0; + x->x_words = x->x_wordsini; +} + +static void plustot_initargs(t_plustot *x) +{ + if (x->x_argv != x->x_argvini) + freebytes(x->x_argv, x->x_maxargs * sizeof(*x->x_argv)); + x->x_maxargs = PLUSTOT_INIMAXWORDS; + x->x_argc = 0; + x->x_argv = x->x_argvini; + x->x_argv[0] = x->x_cname; +} + +static int plustot_resetwords(t_plustot *x) +{ + int i; + for (i = 1; i < x->x_nwords; i++) + PLUSDEBUG_DECRREFCOUNT(x->x_words[i].pw_ob, "plustot_resetwords"); + x->x_nwords = 0; + if (x->x_ctail) /* does object command exist && is parse valid? */ + { + int nwords = x->x_tailparse.numWords + 1; + if (nwords > x->x_maxwords) + { + int n = nwords; +#ifdef PLUSTOT_DEBUG + loudbug_post("growing words %d -> %d", x->x_maxwords, nwords); +#endif + x->x_words = grow_nodata(&n, &x->x_maxwords, x->x_words, + PLUSTOT_INIMAXWORDS, x->x_wordsini, + sizeof(*x->x_words)); + if (n != nwords) + return (0); + } + return (1); + } + else return (0); +} + +static int plustot_resetargs(t_plustot *x) +{ + int i; + for (i = 1; i < x->x_argc; i++) + PLUSDEBUG_DECRREFCOUNT(x->x_argv[i], "plustot_resetargs"); + x->x_argc = 0; + x->x_argv[0] = x->x_cname; + if (x->x_ctail) /* does object command exist && is parse valid? */ + { + int nargs = x->x_maxwords; + if (nargs > x->x_maxargs) + { + int n = nargs; +#ifdef PLUSTOT_DEBUG + loudbug_post("growing argv %d -> %d", x->x_maxargs, nargs); +#endif + x->x_argv = grow_nodata(&n, &x->x_maxargs, x->x_argv, + PLUSTOT_INIMAXWORDS, x->x_argvini, + sizeof(*x->x_argv)); + x->x_argv[0] = x->x_cname; + if (n != nargs) + { + plustot_initwords(x); + plustot_initargs(x); + return (0); + } + } + else if (nargs < x->x_maxargs) + { + loudbug_bug("plustot_resetargs"); /* LATER rethink */ + plustot_initwords(x); + plustot_initargs(x); + return (0); + } + return (1); + } + else return (0); +} + +static int plustot_makewords(t_plustot *x) +{ + if (plustot_resetwords(x)) + { + int i, ncomponents = 0, nwords = x->x_tailparse.numWords + 1; + Tcl_Token *tp; + int len; + char buf[TCL_UTF_MAX]; +#ifdef PLUSTOT_DEBUG + loudbug_post("arguments:"); +#endif + for (i = 1, tp = x->x_tailparse.tokenPtr; + i < nwords; i++, tp += ncomponents) + { +#ifdef PLUSTOT_DEBUG + loudbug_post(" %s token: type %d[%d], having %d[%d] component%s", + loud_ordinal(i), tp->type, tp[1].type, + tp->numComponents, tp[1].numComponents, + (tp->numComponents > 1 ? "s" : "")); +#endif + ncomponents = tp->numComponents; + tp++; + switch (x->x_words[i].pw_type = tp->type) + { + case TCL_TOKEN_TEXT: + x->x_words[i].pw_ob = Tcl_NewStringObj(tp->start, tp->size); + break; + + case TCL_TOKEN_BS: + len = Tcl_UtfBackslash(tp->start, 0, buf); + x->x_words[i].pw_ob = Tcl_NewStringObj(buf, len); + break; + + case TCL_TOKEN_COMMAND: + x->x_words[i].pw_ob = Tcl_NewStringObj(tp->start + 1, + tp->size - 2); + break; + + case TCL_TOKEN_VARIABLE: + if (tp->numComponents > 1) + { + x->x_words[i].pw_ndxv = tp + 2; + x->x_words[i].pw_ndxc = tp->numComponents - 1; + } + else x->x_words[i].pw_ndxv = 0; + x->x_words[i].pw_ob = Tcl_NewStringObj(tp[1].start, tp[1].size); + break; + + default: + plusloud_tcldirty((t_pd *)x, + "plustot_makewords (unexpected token type)"); + goto wordsfailed; + } + PLUSDEBUG_INCRREFCOUNT(x->x_words[i].pw_ob, "plustot_makewords"); + } + x->x_nwords = nwords; + return (1); +wordsfailed: + x->x_nwords = i; + plustot_resetwords(x); + } + return (0); +} + +static int plustot_argsfromwords(t_plustot *x, Tcl_Interp *interp) +{ + if (plustot_resetargs(x)) + { + t_plusword *pw; + int i; + for (i = 1, pw = &x->x_words[1]; i < x->x_nwords; i++, pw++) + { + int result; + if (pw->pw_type == TCL_TOKEN_COMMAND) + { + result = Tcl_EvalObjEx(interp, pw->pw_ob, 0); + if (result == TCL_OK) + { + if (x->x_argv[i] = Tcl_GetObjResult(interp)) + { + PLUSDEBUG_INCRREFCOUNT(x->x_argv[i], + "plustot_argsfromwords"); + Tcl_ResetResult(interp); + } + else + { + plusloud_tcldirty((t_pd *)x, "plustot_argsfromwords"); + goto evalfailed; + } + } + else + { + plustot_tclerror(x, interp, "bad word (command)"); + goto evalfailed; + } + } + else if (pw->pw_type == TCL_TOKEN_VARIABLE) + { + Tcl_Obj *indexp; + if (x->x_words[i].pw_ndxv) + { + /* FIXME */ + int res = Tcl_EvalTokensStandard(interp, + x->x_words[i].pw_ndxv, + x->x_words[i].pw_ndxc); + if (res == TCL_OK) + { + indexp = Tcl_GetObjResult(interp); + PLUSDEBUG_INCRREFCOUNT(indexp, + "plustot_argsfromwords"); + Tcl_ResetResult(interp); + } + else + { + plustot_tclerror(x, interp, "bad index"); + goto evalfailed; + } + } + else indexp = 0; + if (x->x_argv[i] = Tcl_ObjGetVar2(interp, pw->pw_ob, indexp, + TCL_LEAVE_ERR_MSG)) + { + PLUSDEBUG_INCRREFCOUNT(x->x_argv[i], + "plustot_argsfromwords"); + Tcl_ResetResult(interp); + } + else + { + plustot_tclerror(x, interp, "bad word (variable)"); + goto evalfailed; + } + } + else + { + x->x_argv[i] = pw->pw_ob; + /* refcount is 1 already (makewords), but we need to comply to + a general rule: args are decremented after use (resetargs) */ + PLUSDEBUG_INCRREFCOUNT(x->x_argv[i], "plustot_argsfromwords"); + } + } + x->x_argc = x->x_nwords; + return (1); +evalfailed: + x->x_argc = i; + plustot_resetargs(x); + } + return (0); /* LATER find a proper way for passing a result */ +} + +static int plustot_argsfromtokens(t_plustot *x, Tcl_Interp *interp) +{ + if (plustot_resetargs(x)) + { + int i, nwords = x->x_tailparse.numWords + 1; + Tcl_Token *tp; +#ifdef PLUSTOT_DEBUG + loudbug_post("arguments:"); +#endif + for (i = 1, tp = x->x_tailparse.tokenPtr; + i < nwords; i++, tp += (tp->numComponents + 1)) + { + int result; +#ifdef PLUSTOT_DEBUG + loudbug_startpost(" %s token: type %d[%d], having %d component%s", + loud_ordinal(i), tp->type, tp[1].type, + tp->numComponents, + (tp->numComponents > 1 ? "s" : "")); +#endif + result = Tcl_EvalTokensStandard(interp, tp + 1, tp->numComponents); + if (result == TCL_OK) + { + if (x->x_argv[i] = Tcl_GetObjResult(interp)) + { + PLUSDEBUG_INCRREFCOUNT(x->x_argv[i], + "plustot_argsfromwords"); + Tcl_ResetResult(interp); +#ifdef PLUSTOT_DEBUG + loudbug_post(", %sshared: '%s'", + (Tcl_IsShared(x->x_argv[i]) ? "" : "not "), + Tcl_GetString(x->x_argv[i])); +#endif + } + else + { + PLUSDEBUG_ENDPOST("plustot_argsfromtokens"); + plusloud_tcldirty((t_pd *)x, "plustot_argsfromtokens"); + } + } + else + { + PLUSDEBUG_ENDPOST("plustot_argsfromtokens"); + plustot_tclerror(x, interp, "bad token"); + while (--i) + PLUSDEBUG_DECRREFCOUNT(x->x_argv[i], + "plustot_argsfromtokens"); + return (0); /* LATER find a proper way for passing a result */ + } + } + x->x_argc = nwords; + return (1); + } + else return (0); +} + +/* not used yet */ +static int plustot_ifgrabshared(t_plustot *x, Tcl_Obj *ob) +{ + if (!x->x_grabwarned) + { + x->x_grabwarned = 1; + loud_warning((t_pd *)x, 0, "shared result of a command '%s'", + (x->x_cname ? Tcl_GetString(x->x_cname) : "???")); + } + return (1); +} + +static int plustot_push(t_plustot *x) +{ + if (x->x_proxies) + { + int i; + for (i = 0; i < x->x_nproxies; i++) + if (x->x_proxies[i]->pp_var) + if (!plusvar_push(x->x_proxies[i]->pp_var)) + return (0); + } + return (1); +} + +static void plustot_cleartransients(t_plustot *x) +{ + if (x->x_proxies) + { + int i; + for (i = 0; i < x->x_nproxies; i++) + if (x->x_proxies[i]->pp_var && x->x_proxies[i]->pp_istransient) + plusvar_clear(x->x_proxies[i]->pp_var, 1); + } +} + +/* This is the seed of it all: if sendit == 1, this routine executes + a full firing step, otherwise, it performs a plain evaluation. */ +static int plustot_doit(t_plustot *x, int sendit) +{ + int result = 0; + Tcl_Interp *interp = x->x_tob->tob_tin->tin_interp; + if (x->x_cname && plustot_push(x) && + plustot_argsfromwords(x, interp)) + { + if ((*x->x_cinfo.objProc)(x->x_cinfo.objClientData, interp, + x->x_argc, x->x_argv) == TCL_OK) + { + if (plustob_grabresult(x->x_tob)) + result = 1; + } + else plustot_tclerror(x, interp, "command failed"); + /* Although args are to be reset in the next call to + plustot_argsfromwords(), however, plusvar_preset() will be called + first, so, unless reset is done here, $ins would be shared there. + LATER rethink. */ + plustot_resetargs(x); + plustot_cleartransients(x); + } + if (result && sendit) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); + return (result); +} + +static void plustot_eval(t_plustot *x) +{ + plustot_doit(x, 0); +} + +static void plustot_get(t_plustot *x) +{ + if (x->x_tob->tob_value) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); +} + +/* set in(0), no evaluation */ +static void plustot_set(t_plustot *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_mainproxy) + plusproxy_set(x->x_mainproxy, s, ac, av); + else if (x->x_deafproxy) + plusproxy_deafhit(x->x_deafproxy); +} + +static void plustot_clear(t_plustot *x) +{ + if (x->x_mainproxy) + plusproxy_clear(x->x_mainproxy); +} + +static void plustot_clearall(t_plustot *x) +{ + if (x->x_proxies) + { + int i; + for (i = 0; i < x->x_nproxies; i++) + if (x->x_proxies[i]->pp_var) + plusvar_clear(x->x_proxies[i]->pp_var, 1); + } +} + +static void plustot_bang(t_plustot *x) +{ + if (x->x_mainproxy) + plusproxy_bang(x->x_mainproxy); + else + plustot_doit(x, 1); +} + +static void plustot_float(t_plustot *x, t_float f) +{ + if (x->x_mainproxy) + plusproxy_float(x->x_mainproxy, f); + else if (x->x_deafproxy) + plusproxy_deafhit(x->x_deafproxy); +} + +static void plustot_symbol(t_plustot *x, t_symbol *s) +{ + if (x->x_mainproxy) + plusproxy_symbol(x->x_mainproxy, s); + else if (x->x_deafproxy) + plusproxy_deafhit(x->x_deafproxy); +} + +static void plustot_list(t_plustot *x, t_symbol *s, int ac, t_atom *av) +{ + if (x->x_mainproxy) + plusproxy_list(x->x_mainproxy, s, ac, av); + else if (x->x_deafproxy) + plusproxy_deafhit(x->x_deafproxy); +} + +static void plustot_tot(t_plustot *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac) + { + Tcl_Obj *ob; + char *start; + int len; + scriptlet_reset(x->x_script); + scriptlet_add(x->x_script, 1, 1, ac, av); + start = scriptlet_getcontents(x->x_script, &len); + if (len > 0 && (ob = Tcl_NewStringObj(start, len))) + { + /* LATER set a persistent ob, rather than create a new one */ + PLUSDEBUG_INCRREFCOUNT(ob, "plustot_tot"); + if (plustob_evalob(x->x_tob, ob) && s == totps_query) + outlet_plusbob(((t_object *)x)->ob_outlet, + (t_plusbob *)x->x_tob); + PLUSDEBUG_DECRREFCOUNT(ob, "plustot_tot"); + } + } +} + +static void plustot_save(t_gobj *z, t_binbuf *bb) +{ + t_text *t = (t_text *)z; + t_binbuf *inbb = t->te_binbuf; + int ac = binbuf_getnatom(inbb); + t_atom *av = binbuf_getvec(inbb); + binbuf_addv(bb, "ssii", gensym("#X"), gensym("obj"), + (int)t->te_xpix, (int)t->te_ypix); + if (ac && av->a_type == A_SYMBOL) + { + t_symbol *s = av->a_w.w_symbol; + if (s != totps_plustot) + { + t_atom at; + SETSYMBOL(&at, totps_plustot); + binbuf_add(bb, 1, &at); + if (s == plusps_tot && ac > 1) + { + inbb = binbuf_new(); + binbuf_add(inbb, ac - 1, av + 1); + } + } + } + else loudbug_bug("plustot_save"); + binbuf_addbinbuf(bb, inbb); + binbuf_addsemi(bb); + if (inbb != t->te_binbuf) + binbuf_free(inbb); +} + +#ifdef PLUSTOT_DEBUG +static void plustot_debug(t_plustot *x) +{ + t_plusobject *po = (t_plusobject *)x; + t_plustin *tin = x->x_tob->tob_tin; + t_symbol *id = plusenv_getid((t_plusenv *)tin); + t_symbol *glname = plustin_getglistname(tin); + loudbug_post("+tot, glist %x", (int)po->po_glist); + loudbug_post(" plustin '%s' (%s) over %x", (id ? id->s_name : "default"), + (glname ? glname->s_name : "<anonymous>"), + (int)tin->tin_interp); + if (x->x_mainproxy) + plusproxy_debug(x->x_mainproxy); +} +#endif + +static void plustot_free(t_plustot *x) +{ + int i; + plusbob_release((t_plusbob *)x->x_tob); + if (x->x_cname) PLUSDEBUG_DECRREFCOUNT(x->x_cname, "plustot_free"); + if (x->x_ctail) /* does object command exist && is parse valid? */ + { + for (i = 1; i < x->x_nwords; i++) + PLUSDEBUG_DECRREFCOUNT(x->x_words[i].pw_ob, "plustot_free"); + for (i = 1; i < x->x_argc; i++) + PLUSDEBUG_DECRREFCOUNT(x->x_argv[i], "plustot_free"); + if (x->x_words != x->x_wordsini) + freebytes(x->x_words, x->x_maxwords * sizeof(*x->x_words)); + if (x->x_argv != x->x_argvini) + freebytes(x->x_argv, x->x_maxwords * sizeof(*x->x_argv)); + Tcl_FreeParse(&x->x_tailparse); + plusstring_release(x->x_ctail); + } + if (x->x_proxies) + { + for (i = 0; i < x->x_nproxies; i++) + pd_free((t_pd *)x->x_proxies[i]); + freebytes(x->x_proxies, x->x_nproxies * sizeof(*x->x_proxies)); + } + else if (x->x_deafproxy) + pd_free((t_pd *)x->x_deafproxy); + if (x->x_script) scriptlet_free(x->x_script); + plusobject_free(&x->x_plusobject); +} + +static void *plustot_new(t_symbol *s, int ac, t_atom *av) +{ + t_plustot *x = 0; + t_plusstring *ctail = 0; + t_symbol *cmdname = 0; /* command name or +selector */ + t_glist *glist = canvas_getcurrent(); + t_plustin *tin = 0; + t_plustob *tob = 0; + t_scriptlet *script = scriptlet_new(0, 0, 0, 0, glist, 0); + if (s != plusps_tot && s != totps_plustot && s != &s_) + cmdname = s; + else if (ac && av->a_type == A_SYMBOL) + { + cmdname = av->a_w.w_symbol; + ac--; av++; + } + if (cmdname) + { + if (*cmdname->s_name == '+') + { + if (cmdname == plusps_ar) + return (plustot_ar_new(cmdname, ac, av)); + else if (cmdname == plusps_env) + return (plustot_env_new(cmdname, ac, av)); + else if (cmdname == plusps_in) + return (plustot_in_new(cmdname, ac, av)); + else if (cmdname == plusps_var) + return (plustot_var_new(cmdname, ac, av)); + else if (cmdname == plusps_out) + return (plustot_out_new(cmdname, ac, av)); + else if (cmdname == plusps_qlist) + return (plustot_qlist_new(cmdname, ac, av)); + else if (cmdname == plusps_print) + return (plustot_print_new(cmdname, ac, av)); + else + { + loud_error(0, "unknown +tot's subclass"); + return (0); + } + } + /* If ac == 0, ctail is an empty plusstring, but not null. We rely + on getbytes(0), copybytes(x, 0), and freebytes(x, 0) being safe. + LATER reconsider using a separate parse validation flag, while + moving tests for a null ctail to where they really belong. */ + ctail = plusstring_fromatoms(0, ac, av, script); + plusstring_preserve(ctail); + } + if ((tin = plustin_glistprovide(glist, PLUSTIN_GLIST_ANY, 0)) && + (tob = plustob_new(tin, 0))) + { + t_plusstring *vistext = plusstring_fromatoms(cmdname, ac, av, script); + plusstring_preserve(vistext); + x = (t_plustot *) + plusobject_new(plustot_class, cmdname, ac, av, vistext); + plusstring_release(vistext); + x->x_isloud = 1; + /* tin already preserved (plustob_new() did it) */ + plusbob_preserve((t_plusbob *)tob); + plusbob_setowner((t_plusbob *)tob, (t_pd *)x); + x->x_tob = tob; + scriptlet_setowner(script, (t_pd *)x); + x->x_script = script; + x->x_cname = 0; + x->x_ctail = 0; + x->x_words = x->x_wordsini; + plustot_initwords(x); + x->x_argv = x->x_argvini; + plustot_initargs(x); + x->x_pseudoscalar = 0; + x->x_nproxies = 0; + x->x_proxies = 0; + x->x_mainproxy = 0; + x->x_deafproxy = 0; + x->x_grabwarned = 0; + if (cmdname && *cmdname->s_name) + { + Tcl_Interp *interp = tin->tin_interp; + if (interp) + { + if (Tcl_GetCommandInfo(interp, cmdname->s_name, &x->x_cinfo)) + { + if (x->x_cinfo.isNativeObjectProc) + { + x->x_cname = Tcl_NewStringObj(cmdname->s_name, -1); + PLUSDEBUG_INCRREFCOUNT(x->x_cname, "plustot_new"); + x->x_argv[0] = x->x_cname; + } + else loud_error((t_pd *)x, "'%s' is not an object command", + cmdname->s_name); + } + else loud_error((t_pd *)x, "command '%s' does not exist", + cmdname->s_name); + if (x->x_cname && ctail) + { /* object command exists, now parse the arguments: */ + /* 1. do syntax validation and locate pseudo-variables */ + int nvars = + plustot_parsevariables(x, interp, + ctail->ps_buf, ctail->ps_len, + &x->x_tailparse, 0); + if (nvars >= 0) + { + int res = 1; + x->x_ctail = ctail; + /* 2. create input slots */ + res = plustot_makeproxies(x); + if (res) + /* 3. shallow objectifying: create a Tcl_Obj for + each argument; subcommand arguments will be + compiled to bytecode during first evaluation -- + either below, or when the +tot object fires. */ + res = plustot_makewords(x); + if (res) + { + /* FIXME [+tot +ar pname] */ + int n = plustin_procargc(tin, cmdname->s_name); + loudbug_post("plustin_procargc: %d", n); + + /* creation time evaluation, LATER rethink: + should this be immediate or scheduled? */ + x->x_isloud = 0; + plustot_doit(x, 0); + x->x_isloud = 1; + } + else + { + /* here we invalidate parse, but leave the command + valid, LATER revisit */ + x->x_ctail = 0; + } + Tcl_FreeParse(&x->x_tailparse); + } + else + { + if (nvars == PLUSTOT_ERRUNKNOWN) + plustot_tclerror(x, interp, + "parsing command arguments failed"); + else + Tcl_FreeParse(&x->x_tailparse); + PLUSDEBUG_DECRREFCOUNT(x->x_cname, "plustot_new"); + x->x_cname = 0; + } + } + } + } + plusoutlet_new(&x->x_plusobject, &s_symbol); + } + else + { + loud_error(0, "+tot: cannot initialize"); + if (tin) + { + plusbob_preserve((t_plusbob *)tin); + plusbob_release((t_plusbob *)tin); + } + if (script) scriptlet_free(script); + } + if (ctail && !(x && x->x_ctail)) + plusstring_release(ctail); + return (x); +} + +void plusobject_widgetfree(t_plusobject *po); +void plusobject_widgetcreate(t_plusobject *po, t_symbol *s, int ac, t_atom *av, + t_plusstring *ps); +void plusclass_widgetsetup(t_class *c); + +void plusobject_free(t_plusobject *po) +{ + plusobject_widgetfree(po); +} + +t_plusobject *plusobject_new(t_class *c, t_symbol *s, int ac, t_atom *av, + t_plusstring *ps) +{ + t_plusobject *po = (t_plusobject *)pd_new(c); + po->po_glist = canvas_getcurrent(); + po->po_ninlets = 1; + po->po_noutlets = 0; + plusobject_widgetcreate(po, s, ac, av, ps); + return (po); +} + +t_inlet *plusinlet_new(t_plusobject *po, t_pd *dest, + t_symbol *s1, t_symbol *s2) +{ + po->po_ninlets++; + return (inlet_new((t_object *)po, dest, s1, s2)); +} + +t_outlet *plusoutlet_new(t_plusobject *po, t_symbol *s) +{ + po->po_noutlets++; + return (outlet_new((t_object *)po, s)); +} + +void plusclass_inherit(t_class *c, t_symbol *s) +{ + class_addcreator((t_newmethod)plustot_new, s, A_GIMME, 0); + forky_setsavefn(c, plustot_save); + plusclass_widgetsetup(c); +} + +void plustot_setup(void) +{ + post("beware! this is plustot %s, %s %s build...", + TOXY_VERSION, loud_ordinal(TOXY_BUILD), TOXY_RELEASE); + plussymbols_create(); + + plustot_class = class_new(totps_plustot, + (t_newmethod)plustot_new, + (t_method)plustot_free, + sizeof(t_plustot), 0, A_GIMME, 0); + plusclass_inherit(plustot_class, plusps_tot); + + class_addbang(plustot_class, plustot_bang); + class_addfloat(plustot_class, plustot_float); + class_addsymbol(plustot_class, plustot_symbol); + class_addlist(plustot_class, plustot_list); + class_addmethod(plustot_class, (t_method)plustot_eval, + gensym("eval"), 0); + class_addmethod(plustot_class, (t_method)plustot_clear, + gensym("clear"), 0); + class_addmethod(plustot_class, (t_method)plustot_clearall, + gensym("clearall"), 0); + class_addmethod(plustot_class, (t_method)plustot_set, + gensym("set"), A_GIMME, 0); + class_addmethod(plustot_class, (t_method)plustot_get, + gensym("get"), 0); + class_addmethod(plustot_class, (t_method)plustot_tot, + gensym("tot"), A_GIMME, 0); + class_addmethod(plustot_class, (t_method)plustot_tot, + gensym("query"), A_GIMME, 0); + + plusproxy_class = class_new(gensym("+tot proxy"), 0, + (t_method)plusproxy_free, + sizeof(t_plusproxy), CLASS_PD, 0); + class_addfloat(plusproxy_class, plusproxy_float); + class_addsymbol(plusproxy_class, plusproxy_symbol); + class_addlist(plusproxy_class, plusproxy_list); + class_addmethod(plusproxy_class, (t_method)plusproxy_clear, + gensym("clear"), 0); + class_addmethod(plusproxy_class, (t_method)plusproxy_set, + gensym("set"), A_GIMME, 0); + +#ifdef PLUSTOT_DEBUG + class_addmethod(plustot_class, (t_method)plustot_debug, + gensym("debug"), 0); + class_addmethod(plusproxy_class, (t_method)plusproxy_debug, + gensym("debug"), 0); +#endif + + plustin_basetype = plusenv_setup(); + plustin_type = plustype_new(plustin_basetype, plusps_Ti, + sizeof(t_plustin), + (t_plustypefn)plustin_delete, 0, 0, 0); + plustob_type = plustype_new(0, plusps_To, + sizeof(t_plustob), + (t_plustypefn)plustob_delete, 0, 0, + (t_plustypefn)plustob_attach); + plusvar_type = plustype_new(plustob_type, plusps_Tv, + sizeof(t_plusvar), + (t_plustypefn)plusvar_delete, 0, 0, 0); + plustot_ar_setup(); + plustot_env_setup(); + plustot_in_setup(); + plustot_var_setup(); + plustot_out_setup(); + plustot_qlist_setup(); + plustot_print_setup(); +} diff --git a/externals/miXed/toxy/plustot.env.c b/externals/miXed/toxy/plustot.env.c new file mode 100644 index 000000000..ba28bbb22 --- /dev/null +++ b/externals/miXed/toxy/plustot.env.c @@ -0,0 +1,152 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <string.h> +#ifdef UNIX +#include <unistd.h> +#endif +#ifdef NT +#include <io.h> +#endif +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "hammer/file.h" +#include "toxy/plusbob.h" +#include "plustot.h" + +typedef struct _plustot_env +{ + t_plusobject x_plusobject; + t_plustin *x_tin; + t_glist *x_glist; + t_hammerfile *x_filehandle; +} t_plustot_env; + +static t_class *plustot_env_class; + +static void plustot_env_takeover(t_glist *glist, t_plusbob *defparent, + t_plusbob *newparent) +{ + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + { + if (pd_class(&g->g_pd) == canvas_class) + { + if (!plustin_glistfind((t_glist *)g, PLUSTIN_GLIST_THIS)) + plustot_env_takeover((t_glist *)g, defparent, newparent); + } + else plusbob_detachownedchildren(defparent, newparent, (t_pd *)g); + } +} + +static void plustot_env_evalfile(t_plustot_env *x, t_symbol *fname) +{ + char buf1[MAXPDSTRING], buf2[MAXPDSTRING], *nameptr, *dir; + int fd; + dir = canvas_getdir(x->x_glist)->s_name; + if ((fd = open_via_path(dir, fname->s_name, "", + buf1, &nameptr, MAXPDSTRING, 0)) < 0) + { + loud_error((t_pd *)x, "file '%s' not found", fname->s_name); + } + else + { + Tcl_Interp *interp = plustin_getinterp(x->x_tin); + FILE *fp; + close(fd); + strcpy(buf2, buf1); + strcat(buf2, "/"); + strcat(buf2, nameptr); + sys_bashfilename(buf2, buf2); + Tcl_Preserve(interp); + if (Tcl_EvalFile(interp, buf2) != TCL_OK) + { + strcpy(buf1, "evaluation failed ("); + strncat(buf1, buf2, MAXPDSTRING - strlen(buf1) - 2); + strcat(buf1, ")"); + plusloud_tclerror((t_pd *)x, interp, buf1); + } + Tcl_Release(interp); + } +} + +static void plustot_env_evalfilehook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + plustot_env_evalfile((t_plustot_env *)z, fn); +} + +static void plustot_env_bang(t_plustot_env *x) +{ + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tin); +} + +static void plustot_env_source(t_plustot_env *x, t_symbol *s) +{ + if (s && s != &s_) + plustot_env_evalfile(x, s); + else + hammerpanel_open(x->x_filehandle, 0); +} + +static void plustot_env_free(t_plustot_env *x) +{ + t_plustin *tin = plustin_glistprovide(x->x_glist, PLUSTIN_GLIST_UP, 0); + plusbob_detachchildren((t_plusbob *)x->x_tin, (t_plusbob *)tin); + plusbob_release((t_plusbob *)x->x_tin); + hammerfile_free(x->x_filehandle); + plusobject_free(&x->x_plusobject); +} + +void *plustot_env_new(t_symbol *s, int ac, t_atom *av) +{ + t_plustot_env *x = 0; + t_glist *gl = canvas_getcurrent(); + t_plustin *oldtin = plustin_glistfind(gl, PLUSTIN_GLIST_THIS); + t_plustin *deftin = (oldtin ? 0 : plustin_glistfind(gl, PLUSTIN_GLIST_ANY)); + t_plustin *tin = 0; + if ((tin = oldtin) + || (tin = plustin_glistprovide(gl, PLUSTIN_GLIST_THIS, 1))) + { + int warned = 0; + x = (t_plustot_env *)plusobject_new(plustot_env_class, s, ac, av, 0); + x->x_tin = tin; + plusbob_preserve((t_plusbob *)tin); + x->x_glist = gl; + plusoutlet_new(&x->x_plusobject, &s_symbol); + if (deftin) + /* true if both oldtin == 0 (we are first in this glist) + and plustin_default != 0 (bobs exist already) */ + plustot_env_takeover(x->x_glist, + (t_plusbob *)deftin, (t_plusbob *)tin); + x->x_filehandle = hammerfile_new((t_pd *)x, 0, + plustot_env_evalfilehook, 0, 0); + while (ac--) + { + if (av->a_type == A_SYMBOL) + plustot_env_evalfile(x, av->a_w.w_symbol); + else if (!warned) + { + loud_warning((t_pd *)x, 0, "bad atom"); + warned = 1; + } + av++; + } + } + else loud_error(0, "+env: cannot initialize"); + return (x); +} + +void plustot_env_setup(void) +{ + plustot_env_class = class_new(gensym("+env"), 0, + (t_method)plustot_env_free, + sizeof(t_plustot_env), 0, 0); + plusclass_inherit(plustot_env_class, gensym("+env")); + class_addbang(plustot_env_class, plustot_env_bang); + class_addmethod(plustot_env_class, (t_method)plustot_env_source, + gensym("source"), A_DEFSYM, 0); + hammerfile_setup(plustot_env_class, 0); +} diff --git a/externals/miXed/toxy/plustot.h b/externals/miXed/toxy/plustot.h new file mode 100644 index 000000000..7022fd6c2 --- /dev/null +++ b/externals/miXed/toxy/plustot.h @@ -0,0 +1,120 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __PLUSTOT_H__ +#define __PLUSTOT_H__ + +#define PD_EXTERN EXTERN +#undef EXTERN +#include <tcl.h> +#undef EXTERN +#define EXTERN PD_EXTERN +#undef PD_EXTERN + +#ifdef KRZYSZCZ +#define PLUSTOT_DEBUG +#endif + +EXTERN_STRUCT _plustin; +#define t_plustin struct _plustin +EXTERN_STRUCT _plustob; +#define t_plustob struct _plustob +EXTERN_STRUCT _plusvar; +#define t_plusvar struct _plusvar + +EXTERN_STRUCT _plusstring; +#define t_plusstring struct _plusstring + +EXTERN_STRUCT _pluswidget; +#define t_pluswidget struct _pluswidget + +typedef struct _plusobject +{ + t_object po_ob; + t_glist *po_glist; + t_pluswidget *po_widget; + int po_ninlets; + int po_noutlets; +} t_plusobject; + +t_symbol *totps_plustot; +t_symbol *plusps_tot; +t_symbol *plusps_Ti; +t_symbol *plusps_To; +t_symbol *plusps_Tv; + +#define PLUSTOB_MAKEIT ((Tcl_Obj *)-1) + +typedef int (*t_plusifsharedfn)(t_plusbob *, Tcl_Obj *); + +enum { PLUSTIN_GLIST_THIS, PLUSTIN_GLIST_ANY, PLUSTIN_GLIST_UP }; + +void plusloud_tclerror(t_pd *caller, Tcl_Interp *interp, char *msg); + +t_plustin *plustin_create(t_plustype *tp, t_plusbob *parent, t_symbol *id); +Tcl_Interp *plustin_getinterp(t_plustin *tin); +t_symbol *plustin_glistid(t_glist *gl); +t_plustin *plustin_glistfind(t_glist *gl, int mode); +t_plustin *plustin_glistprovide(t_glist *gl, int mode, int create); +t_symbol *plustin_getglistname(t_plustin *tin); + +t_plustob *plustob_create(t_plustype *tp, t_plustin *tin, Tcl_Obj *ob); +t_plustob *plustob_new(t_plustin *tin, Tcl_Obj *ob); +void plustob_setifshared(t_plustob *tob, t_plusifsharedfn ifsharedfn); +int plustob_isshared(t_plustob *tob); +Tcl_Obj *plustob_getvalue(t_plustob *tob); + +t_plustin *plustag_tobtin(t_symbol *s, t_pd *caller); +Tcl_Obj *plustag_tobvalue(t_symbol *s, t_pd *caller); +Tcl_Obj *plusatom_tobvalue(t_atom *ap, t_pd *caller); + +int plustob_clear(t_plustob *tob); +Tcl_Obj *plustob_set(t_plustob *tob, t_plustin *tin, Tcl_Obj *ob); +Tcl_Obj *plustob_setfloat(t_plustob *tob, t_float f); +Tcl_Obj *plustob_setsymbol(t_plustob *tob, t_symbol *s); +Tcl_Obj *plustob_setlist(t_plustob *tob, int ac, t_atom *av); +Tcl_Obj *plustob_setbinbuf(t_plustob *tob, t_binbuf *bb); +Tcl_Obj *plustob_grabresult(t_plustob *tob); +Tcl_Obj *plustob_evalob(t_plustob *tob, Tcl_Obj *ob); + +t_plusvar *plusvar_create(t_plustype *tp, t_plustin *tin, Tcl_Obj *ob, + char *name, char *index); +t_plusvar *plusvar_new(char *name, char *index, t_plustin *tin); +Tcl_Obj *plusvar_push(t_plusvar *var); +Tcl_Obj *plusvar_pull(t_plusvar *var); +void plusvar_clear(t_plusvar *var, int doit); +Tcl_Obj *plusvar_set(t_plusvar *var, Tcl_Obj *ob, int doit); +Tcl_Obj *plusvar_setfloat(t_plusvar *var, t_float f, int doit); +Tcl_Obj *plusvar_setsymbol(t_plusvar *var, t_symbol *s, int doit); +Tcl_Obj *plusvar_setlist(t_plusvar *var, int ac, t_atom *av, int doit); + +void plusstring_preserve(t_plusstring *ps); +void plusstring_release(t_plusstring *ps); +char *plusstring_get(t_plusstring *ps, int *lenp); + +void plusobject_free(t_plusobject *po); +t_plusobject *plusobject_new(t_class *c, t_symbol *s, int ac, t_atom *av, + t_plusstring *ps); +t_inlet *plusinlet_new(t_plusobject *po, t_pd *dest, + t_symbol *s1, t_symbol *s2); +t_outlet *plusoutlet_new(t_plusobject *po, t_symbol *s); +void plusclass_inherit(t_class *c, t_symbol *s); + +void plustot_ar_setup(void); +void plustot_env_setup(void); +void plustot_in_setup(void); +void plustot_var_setup(void); +void plustot_out_setup(void); +void plustot_qlist_setup(void); +void plustot_print_setup(void); + +void *plustot_ar_new(t_symbol *s, int ac, t_atom *av); +void *plustot_env_new(t_symbol *s, int ac, t_atom *av); +void *plustot_in_new(t_symbol *s, int ac, t_atom *av); +void *plustot_var_new(t_symbol *s, int ac, t_atom *av); +void *plustot_out_new(t_symbol *s, int ac, t_atom *av); +void *plustot_qlist_new(t_symbol *s, int ac, t_atom *av); +void *plustot_print_new(t_symbol *s, int ac, t_atom *av); + +#endif diff --git a/externals/miXed/toxy/plustot.in.c b/externals/miXed/toxy/plustot.in.c new file mode 100644 index 000000000..37c1bc943 --- /dev/null +++ b/externals/miXed/toxy/plustot.in.c @@ -0,0 +1,128 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "toxy/plusbob.h" +#include "plustot.h" + +typedef struct _plusproxy_in +{ + t_pd pp_pd; + t_plustob *pp_tob; +} t_plusproxy_in; + +typedef struct _plustot_in +{ + t_plusobject x_plusobject; + t_glist *x_glist; + t_plustob *x_tob; + t_plusproxy_in *x_proxy; +} t_plustot_in; + +static t_class *plusproxy_in_class; +static t_class *plustot_in_class; + +static t_plusproxy_in *plusproxy_in_new(t_pd *master) +{ + t_plusproxy_in *pp = (t_plusproxy_in *)pd_new(plusproxy_in_class); + pp->pp_tob = ((t_plustot_in *)master)->x_tob; + return (pp); +} + +static void plusproxy_in_float(t_plusproxy_in *pp, t_float f) +{ + plustob_setfloat(pp->pp_tob, f); +} + +static void plusproxy_in_symbol(t_plusproxy_in *pp, t_symbol *s) +{ + plustob_setsymbol(pp->pp_tob, s); +} + +static void plusproxy_in_list(t_plusproxy_in *pp, + t_symbol *s, int ac, t_atom *av) +{ + plustob_setlist(pp->pp_tob, ac, av); +} + +static void plustot_in_bang(t_plustot_in *x) +{ + if (plustob_getvalue(x->x_tob)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); +} + +static void plustot_in_float(t_plustot_in *x, t_float f) +{ + if (plustob_setfloat(x->x_tob, f)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); +} + +static void plustot_in_symbol(t_plustot_in *x, t_symbol *s) +{ + if (plustob_setsymbol(x->x_tob, s)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); +} + +static void plustot_in_list(t_plustot_in *x, t_symbol *s, int ac, t_atom *av) +{ + if (plustob_setlist(x->x_tob, ac, av)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_tob); +} + +static void plustot_in_free(t_plustot_in *x) +{ + plusbob_release((t_plusbob *)x->x_tob); + if (x->x_proxy) pd_free((t_pd *)x->x_proxy); + plusobject_free(&x->x_plusobject); +} + +void *plustot_in_new(t_symbol *s, int ac, t_atom *av) +{ + t_plustot_in *x = 0; + t_glist *glist = canvas_getcurrent(); + t_plustin *tin = 0; + t_plustob *tob = 0; + if ((tin = plustin_glistprovide(glist, PLUSTIN_GLIST_ANY, 0)) && + (tob = plustob_new(tin, 0))) + { + x = (t_plustot_in *)plusobject_new(plustot_in_class, s, ac, av, 0); + plusbob_preserve((t_plusbob *)tob); + plusbob_setowner((t_plusbob *)tob, (t_pd *)x); + plustob_setlist(tob, ac, av); + x->x_glist = glist; + x->x_tob = tob; + x->x_proxy = plusproxy_in_new((t_pd *)x); + plusinlet_new(&x->x_plusobject, (t_pd *)x->x_proxy, 0, 0); + plusoutlet_new(&x->x_plusobject, &s_symbol); + } + else + { + loud_error(0, "+in: cannot initialize"); + if (tin) + { + plusbob_preserve((t_plusbob *)tin); + plusbob_release((t_plusbob *)tin); + } + } + return (x); +} + +void plustot_in_setup(void) +{ + plustot_in_class = class_new(gensym("+in"), 0, + (t_method)plustot_in_free, + sizeof(t_plustot_in), 0, 0); + plusclass_inherit(plustot_in_class, gensym("+in")); + class_addbang(plustot_in_class, plustot_in_bang); + class_addfloat(plustot_in_class, plustot_in_float); + class_addsymbol(plustot_in_class, plustot_in_symbol); + class_addlist(plustot_in_class, plustot_in_list); + + plusproxy_in_class = class_new(gensym("+in proxy"), 0, 0, + sizeof(t_plusproxy_in), CLASS_PD, 0); + class_addfloat(plusproxy_in_class, plusproxy_in_float); + class_addsymbol(plusproxy_in_class, plusproxy_in_symbol); + class_addlist(plusproxy_in_class, plusproxy_in_list); +} diff --git a/externals/miXed/toxy/plustot.out.c b/externals/miXed/toxy/plustot.out.c new file mode 100644 index 000000000..80c64dc46 --- /dev/null +++ b/externals/miXed/toxy/plustot.out.c @@ -0,0 +1,74 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "toxy/plusbob.h" +#include "plustot.h" + +typedef struct _plustot_out +{ + t_plusobject x_plusobject; + t_binbuf *x_bb; +} t_plustot_out; + +static t_class *plustot_out_class; + +static void plustot_out_symbol(t_plustot_out *x, t_symbol *s) +{ + Tcl_Obj *ob = plustag_tobvalue(s, (t_pd *)x); + if (ob) + { + int len; + char *ptr; + Tcl_IncrRefCount(ob); + ptr = Tcl_GetStringFromObj(ob, &len); + if (ptr && len) + { + int ac; + binbuf_text(x->x_bb, ptr, len); + if (ac = binbuf_getnatom(x->x_bb)) + { + t_atom *av = binbuf_getvec(x->x_bb); + if (av->a_type == A_SYMBOL) + outlet_anything(((t_object *)x)->ob_outlet, + av->a_w.w_symbol, ac - 1, av + 1); + else if (av->a_type == A_FLOAT) + { + if (ac > 1) + outlet_list(((t_object *)x)->ob_outlet, + &s_list, ac, av); + else + outlet_float(((t_object *)x)->ob_outlet, + av->a_w.w_float); + } + } + } + Tcl_DecrRefCount(ob); + } +} + +static void plustot_out_free(t_plustot_out *x) +{ + binbuf_free(x->x_bb); + plusobject_free(&x->x_plusobject); +} + +void *plustot_out_new(t_symbol *s, int ac, t_atom *av) +{ + t_plustot_out *x = + (t_plustot_out *)plusobject_new(plustot_out_class, s, ac, av, 0); + x->x_bb = binbuf_new(); + plusoutlet_new(&x->x_plusobject, &s_anything); + return (x); +} + +void plustot_out_setup(void) +{ + plustot_out_class = class_new(gensym("+out"), 0, + (t_method)plustot_out_free, + sizeof(t_plustot_out), 0, 0); + plusclass_inherit(plustot_out_class, gensym("+out")); + class_addsymbol(plustot_out_class, plustot_out_symbol); +} diff --git a/externals/miXed/toxy/plustot.print.c b/externals/miXed/toxy/plustot.print.c new file mode 100644 index 000000000..b622d8f61 --- /dev/null +++ b/externals/miXed/toxy/plustot.print.c @@ -0,0 +1,97 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "toxy/plusbob.h" +#include "plustot.h" + +typedef struct _plustot_print +{ + t_plusobject x_plusobject; + t_symbol *x_label; + t_binbuf *x_bb; +} t_plustot_print; + +static t_class *plustot_print_class; + +static char *plustot_print_symbolname(t_symbol *s) +{ + return (s && s != &s_ ? s->s_name : "???"); +} + +static void plustot_print_symbol(t_plustot_print *x, t_symbol *s) +{ + Tcl_Obj *ob = plustag_tobvalue(s, (t_pd *)x); + if (ob) + { + int len; + char *ptr; + Tcl_IncrRefCount(ob); + ptr = Tcl_GetStringFromObj(ob, &len); + if (ptr && len) + { + int ac; + binbuf_text(x->x_bb, ptr, len); + if (ac = binbuf_getnatom(x->x_bb)) + { + t_plustin *tin = plustag_tobtin(s, (t_pd *)x); + t_symbol *glname = (tin ? plustin_getglistname(tin) : 0); + t_atom *av = binbuf_getvec(x->x_bb); + if (av->a_type == A_SYMBOL || av->a_type == A_FLOAT) + { + char *lstring = (x->x_label ? x->x_label->s_name : + plustot_print_symbolname( + plustag_typename(s, 1, (t_pd *)x))); + if (glname) + startpost("%s (%s):", lstring, glname->s_name); + else + startpost("%s:", lstring); + } + /* FIXME {1.0, 1.0}, etc. */ + if (av->a_type == A_SYMBOL) + { + startpost(" %s", av->a_w.w_symbol->s_name); + postatom(ac - 1, av + 1); + endpost(); + } + else if (av->a_type == A_FLOAT) + { + if (ac > 1) + { + postatom(ac, av); + endpost(); + } + else post(" %g", av->a_w.w_float); + } + } + /* LATER consider printing empty list as 'bang' */ + } + Tcl_DecrRefCount(ob); + } +} + +static void plustot_print_free(t_plustot_print *x) +{ + binbuf_free(x->x_bb); + plusobject_free(&x->x_plusobject); +} + +void *plustot_print_new(t_symbol *s, int ac, t_atom *av) +{ + t_plustot_print *x = + (t_plustot_print *)plusobject_new(plustot_print_class, s, ac, av, 0); + x->x_label = (ac && av->a_type == A_SYMBOL ? av->a_w.w_symbol : 0); + x->x_bb = binbuf_new(); + return (x); +} + +void plustot_print_setup(void) +{ + plustot_print_class = class_new(gensym("+print"), 0, + (t_method)plustot_print_free, + sizeof(t_plustot_print), 0, 0); + plusclass_inherit(plustot_print_class, gensym("+print")); + class_addsymbol(plustot_print_class, plustot_print_symbol); +} diff --git a/externals/miXed/toxy/plustot.qlist.c b/externals/miXed/toxy/plustot.qlist.c new file mode 100644 index 000000000..a098df32d --- /dev/null +++ b/externals/miXed/toxy/plustot.qlist.c @@ -0,0 +1,218 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <string.h> +#include "m_pd.h" +#include "unstable/fragile.h" +#include "common/loud.h" +#include "toxy/plusbob.h" +#include "plustot.h" + +#ifdef KRZYSZCZ +#define PLUSTOT_QLIST_DEBUG +#endif + +/* Need only an access to x_binbuf field. */ +typedef struct _qlist +{ + t_object x_ob; + t_outlet *x_bangout; + void *x_binbuf; +} t_qlist; + +typedef struct _plusproxy_qlist +{ + t_pd pp_pd; + struct _plustot_qlist *pp_master; +} t_plusproxy_qlist; + +typedef struct _plustot_qlist +{ + t_plusobject x_plusobject; + t_glist *x_glist; + t_plustob *x_tob; + t_outlet *x_rightout; + t_plusproxy_qlist *x_proxy; +} t_plustot_qlist; + +static t_class *plusproxy_qlist_class; +static t_class *plustot_qlist_class; + +static t_binbuf *plustot_qlist_usurp(t_plustot_qlist *x) +{ + static t_symbol *types[2]; + static int ntypes = 0; + t_object *booty; + if (ntypes == 0) + { + types[0] = gensym("qlist"); + types[1] = gensym("textfile"); + ntypes = 2; + } + if (booty = fragile_outlet_destination( + ((t_object *)x)->ob_outlet, ntypes, types, + (t_pd *)x, "(connect left outlet to a qlist or textfile)")) + { + t_binbuf *bb = ((t_qlist *)booty)->x_binbuf; +#ifdef PLUSTOT_QLIST_DEBUG + loudbug_post("booty '%s' at %x:", + class_getname(*(t_pd *)booty), (int)booty); + loudbug_postbinbuf(bb); +#endif + return (bb); + } + else return (0); +} + +static t_plusproxy_qlist *plusproxy_qlist_new(t_plustot_qlist *master) +{ + t_plusproxy_qlist *pp = (t_plusproxy_qlist *)pd_new(plusproxy_qlist_class); + pp->pp_master = master; + return (pp); +} + +static void plusproxy_qlist_symbol(t_plusproxy_qlist *pp, t_symbol *s) +{ + t_plustot_qlist *x = pp->pp_master; + Tcl_Interp *interp = 0; + if (plustag_isvalid(s, 0)) + { + t_plustin *tin; + Tcl_Obj *ob; + if ((tin = plustag_tobtin(s, PLUSBOB_OWNER)) && + (ob = plustob_getvalue((t_plustob *)s))) + { + t_binbuf *bb; + if (bb = plustot_qlist_usurp(x)) + { + int nlists; + Tcl_Obj **lists; + interp = plustin_getinterp(tin); + if (Tcl_ListObjGetElements(interp, ob, + &nlists, &lists) == TCL_OK) + { + int lc; + Tcl_Obj **lp; + binbuf_clear(bb); + for (lc = 0, lp = lists; lc < nlists; lc++, lp++) + { + int natoms; + Tcl_Obj **atoms; + if (Tcl_ListObjGetElements(interp, *lp, + &natoms, &atoms) == TCL_OK) + { + int ac; + Tcl_Obj **ap; + for (ac = 0, ap = atoms; ac < natoms; ac++, ap++) + { + double d; + int len; + char *ptr; + Tcl_IncrRefCount(*ap); + if (Tcl_GetDoubleFromObj(interp, + *ap, &d) == TCL_OK) + { + t_atom at; + SETFLOAT(&at, (float)d); + binbuf_add(bb, 1, &at); + } + else if ((ptr = Tcl_GetStringFromObj(*ap, &len)) + && len) + { + t_atom at; + if (ptr[len - 1]) + { + char buf[MAXPDSTRING]; + if (len > MAXPDSTRING - 1) + len = MAXPDSTRING - 1; + strncpy(buf, ptr, len); + buf[len] = 0; + ptr = buf; + } + SETSYMBOL(&at, gensym(ptr)); + binbuf_add(bb, 1, &at); + } + /* FIXME else */ + Tcl_DecrRefCount(*ap); + } + binbuf_addsemi(bb); + } + else + { + binbuf_clear(bb); + goto notalist; + } + } + } + else goto notalist; + } + } + } + return; +notalist: + if (interp) plusloud_tclerror((t_pd *)x, interp, "not a list"); +} + +static void plustot_qlist_bang(t_plustot_qlist *x) +{ + t_binbuf *bb; + if (bb = plustot_qlist_usurp(x)) + { + if (plustob_setbinbuf(x->x_tob, bb)) + outlet_plusbob(x->x_rightout, (t_plusbob *)x->x_tob); + } +} + +static void plustot_qlist_free(t_plustot_qlist *x) +{ + plusbob_release((t_plusbob *)x->x_tob); + if (x->x_proxy) pd_free((t_pd *)x->x_proxy); + plusobject_free(&x->x_plusobject); +} + +void *plustot_qlist_new(t_symbol *s, int ac, t_atom *av) +{ + t_plustot_qlist *x = 0; + t_glist *glist = canvas_getcurrent(); + t_plustin *tin = 0; + t_plustob *tob = 0; + if ((tin = plustin_glistprovide(glist, PLUSTIN_GLIST_ANY, 0)) && + (tob = plustob_new(tin, 0))) + { + x = (t_plustot_qlist *) + plusobject_new(plustot_qlist_class, s, ac, av, 0); + plusbob_preserve((t_plusbob *)tob); + plusbob_setowner((t_plusbob *)tob, (t_pd *)x); + plustob_setlist(tob, ac, av); + x->x_glist = glist; + x->x_tob = tob; + x->x_proxy = plusproxy_qlist_new(x); + plusinlet_new(&x->x_plusobject, (t_pd *)x->x_proxy, 0, 0); + plusoutlet_new(&x->x_plusobject, &s_anything); + x->x_rightout = outlet_new((t_object *)x, &s_symbol); + } + else + { + loud_error(0, "+qlist: cannot initialize"); + if (tin) + { + plusbob_preserve((t_plusbob *)tin); + plusbob_release((t_plusbob *)tin); + } + } + return (x); +} + +void plustot_qlist_setup(void) +{ + plustot_qlist_class = class_new(gensym("+qlist"), 0, + (t_method)plustot_qlist_free, + sizeof(t_plustot_qlist), 0, 0); + plusclass_inherit(plustot_qlist_class, gensym("+qlist")); + class_addbang(plustot_qlist_class, plustot_qlist_bang); + + plusproxy_qlist_class = class_new(gensym("+qlist proxy"), 0, 0, + sizeof(t_plusproxy_qlist), CLASS_PD, 0); + class_addsymbol(plusproxy_qlist_class, plusproxy_qlist_symbol); +} diff --git a/externals/miXed/toxy/plustot.var.c b/externals/miXed/toxy/plustot.var.c new file mode 100644 index 000000000..338c04444 --- /dev/null +++ b/externals/miXed/toxy/plustot.var.c @@ -0,0 +1,132 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "toxy/plusbob.h" +#include "plustot.h" + +typedef struct _plusproxy_var +{ + t_pd pp_pd; + t_plusvar *pp_var; +} t_plusproxy_var; + +typedef struct _plustot_var +{ + t_plusobject x_plusobject; + t_glist *x_glist; + t_plusvar *x_var; + t_plusproxy_var *x_proxy; +} t_plustot_var; + +static t_class *plusproxy_var_class; +static t_class *plustot_var_class; + +static t_plusproxy_var *plusproxy_var_new(t_pd *master) +{ + t_plusproxy_var *pp = (t_plusproxy_var *)pd_new(plusproxy_var_class); + pp->pp_var = ((t_plustot_var *)master)->x_var; + return (pp); +} + +static void plusproxy_var_float(t_plusproxy_var *pp, t_float f) +{ + plusvar_setfloat(pp->pp_var, f, 1); +} + +static void plusproxy_var_symbol(t_plusproxy_var *pp, t_symbol *s) +{ + plusvar_setsymbol(pp->pp_var, s, 1); +} + +static void plusproxy_var_list(t_plusproxy_var *pp, + t_symbol *s, int ac, t_atom *av) +{ + plusvar_setlist(pp->pp_var, ac, av, 1); +} + +static void plustot_var_bang(t_plustot_var *x) +{ + if (plusvar_pull(x->x_var)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_var); +} + +static void plustot_var_float(t_plustot_var *x, t_float f) +{ + if (plusvar_setfloat(x->x_var, f, 1)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_var); +} + +static void plustot_var_symbol(t_plustot_var *x, t_symbol *s) +{ + if (plusvar_setsymbol(x->x_var, s, 1)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_var); +} + +static void plustot_var_list(t_plustot_var *x, t_symbol *s, int ac, t_atom *av) +{ + if (plusvar_setlist(x->x_var, ac, av, 1)) + outlet_plusbob(((t_object *)x)->ob_outlet, (t_plusbob *)x->x_var); +} + +static void plustot_var_free(t_plustot_var *x) +{ + plusbob_release((t_plusbob *)x->x_var); + if (x->x_proxy) pd_free((t_pd *)x->x_proxy); + plusobject_free(&x->x_plusobject); +} + +void *plustot_var_new(t_symbol *s, int ac, t_atom *av) +{ + t_plustot_var *x = 0; + t_glist *glist = canvas_getcurrent(); + t_plustin *tin = 0; + t_plusvar *var = 0; + if (ac && av->a_type == A_SYMBOL && + (tin = plustin_glistprovide(glist, PLUSTIN_GLIST_ANY, 0)) && + (var = plusvar_new(av->a_w.w_symbol->s_name, 0, tin))) + { + x = (t_plustot_var *)plusobject_new(plustot_var_class, s, ac, av, 0); + plusbob_preserve((t_plusbob *)var); + plusbob_setowner((t_plusbob *)var, (t_pd *)x); + plusvar_setlist(var, ac - 1, av + 1, 1); + x->x_glist = glist; + x->x_var = var; + x->x_proxy = plusproxy_var_new((t_pd *)x); + plusinlet_new(&x->x_plusobject, (t_pd *)x->x_proxy, 0, 0); + plusoutlet_new(&x->x_plusobject, &s_symbol); + } + else + { + if (!ac || av->a_type != A_SYMBOL) + loud_error(0, "+var: missing name of a variable"); + else + loud_error(0, "+var: cannot initialize"); + if (tin) + { + plusbob_preserve((t_plusbob *)tin); + plusbob_release((t_plusbob *)tin); + } + } + return (x); +} + +void plustot_var_setup(void) +{ + plustot_var_class = class_new(gensym("+var"), 0, + (t_method)plustot_var_free, + sizeof(t_plustot_var), 0, 0); + plusclass_inherit(plustot_var_class, gensym("+var")); + class_addbang(plustot_var_class, plustot_var_bang); + class_addfloat(plustot_var_class, plustot_var_float); + class_addsymbol(plustot_var_class, plustot_var_symbol); + class_addlist(plustot_var_class, plustot_var_list); + + plusproxy_var_class = class_new(gensym("+var proxy"), 0, 0, + sizeof(t_plusproxy_var), CLASS_PD, 0); + class_addfloat(plusproxy_var_class, plusproxy_var_float); + class_addsymbol(plusproxy_var_class, plusproxy_var_symbol); + class_addlist(plusproxy_var_class, plusproxy_var_list); +} diff --git a/externals/miXed/toxy/pluswidget.c b/externals/miXed/toxy/pluswidget.c new file mode 100644 index 000000000..60c4955db --- /dev/null +++ b/externals/miXed/toxy/pluswidget.c @@ -0,0 +1,271 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* This is a prototype of a custom object box. It might be replaced with + a new core object type, T_CUSTOM (te_type bitfield would have to be + extended then). */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "toxy/plusbob.h" +#include "plustot.h" + +#ifdef KRZYSZCZ +//#define PLUSWIDGET_DEBUG +#endif + +struct _pluswidget +{ + t_plusstring *pw_visstring; + char *pw_visbuf; /* binbuf_gettext()-style: no null termination */ + int pw_vissize; + int pw_rtextactive; + int pw_ishit; +}; + +/* Code that might be merged back to g_text.c starts here: */ + +static void pluswidget_getrect(t_gobj *z, t_glist *glist, + int *xp1, int *yp1, int *xp2, int *yp2) +{ + t_pluswidget *pw = ((t_plusobject *)z)->po_widget; + int width, height; + float x1, y1, x2, y2; + if (glist->gl_editor && glist->gl_editor->e_rtext) + { + if (pw->pw_rtextactive) + { + t_rtext *y = glist_findrtext(glist, (t_text *)z); + width = rtext_width(y); + height = rtext_height(y); + } + else + { + int font = glist_getfont(glist); + width = pw->pw_vissize * sys_fontwidth(font) + 2; + height = sys_fontheight(font) + 4; /* 2-pixel top/bottom margins */ + } + } + else width = height = 10; + x1 = text_xpix((t_text *)z, glist); + y1 = text_ypix((t_text *)z, glist); + x2 = x1 + width; + y2 = y1 + height; + y1 += 1; + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; +} + +static void pluswidget_drawiofor(t_glist *glist, t_plusobject *po, + int firsttime, + char *tag, int x1, int y1, int x2, int y2) +{ + int n, nplus, i, width = x2 - x1; + for (n = po->po_noutlets, nplus = (n == 1 ? 1 : n-1), i = 0; i < n; i++) + { + int onset = x1 + (width - IOWIDTH) * i / nplus; + if (firsttime) + sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %so%d\ + -outline brown -fill lightgrey\n", + glist_getcanvas(glist), + onset, y2 - 3, + onset + IOWIDTH, y2 + 2, + tag, i); + else + sys_vgui(".x%lx.c coords %so%d %d %d %d %d\n", + glist_getcanvas(glist), tag, i, + onset, y2 - 3, + onset + IOWIDTH, y2 + 2); + } + for (n = po->po_ninlets, nplus = (n == 1 ? 1 : n-1), i = 0; i < n; i++) + { + int onset = x1 + (width - IOWIDTH) * i / nplus; + if (firsttime) + sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %si%d\ + -outline brown -fill lightgrey\n", + glist_getcanvas(glist), + onset, y1 - 3, + onset + IOWIDTH, y1 + 2, + tag, i); + else + sys_vgui(".x%lx.c coords %si%d %d %d %d %d\n", + glist_getcanvas(glist), tag, i, + onset, y1 - 3, + onset + IOWIDTH, y1 + 2); + } +} + +static void pluswidget_drawborder(t_text *t, t_glist *glist, + char *tag, int firsttime) +{ + int x1, y1, x2, y2; + pluswidget_getrect(&t->te_g, glist, &x1, &y1, &x2, &y2); + if (firsttime) + sys_vgui(".x%lx.c create line\ + %d %d %d %d %d %d %d %d %d %d -width 2 -fill brown -tags %sR\n", + glist_getcanvas(glist), + x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, tag); + else + sys_vgui(".x%lx.c coords %sR\ + %d %d %d %d %d %d %d %d %d %d\n", + glist_getcanvas(glist), tag, + x1, y1, x2, y1, x2, y2, x1, y2, x1, y1); + pluswidget_drawiofor(glist, (t_plusobject *)t, firsttime, + tag, x1, y1, x2, y2); +} + +static void pluswidget_displace(t_gobj *z, t_glist *glist, int dx, int dy) +{ + t_text *t = (t_text *)z; + t->te_xpix += dx; + t->te_ypix += dy; + if (glist_isvisible(glist)) + { + t_rtext *y = glist_findrtext(glist, t); + rtext_displace(y, dx, dy); + pluswidget_drawborder(t, glist, rtext_gettag(y), 0); + canvas_fixlinesfor(glist, t); + } +} + +static void pluswidget_select(t_gobj *z, t_glist *glist, int state) +{ + t_pluswidget *pw = ((t_plusobject *)z)->po_widget; + t_rtext *y = glist_findrtext(glist, (t_text *)z); + rtext_select(y, state); + if (glist_isvisible(glist) && glist->gl_havewindow) + { + if (state) + sys_vgui(".x%lx.c itemconfigure %s -fill blue\n", + glist, rtext_gettag(y)); + else + sys_vgui(".x%lx.c itemconfigure %s -text {%.*s} -fill brown\n", + glist, rtext_gettag(y), pw->pw_vissize, pw->pw_visbuf); + } +} + +static void pluswidget_activate(t_gobj *z, t_glist *glist, int state) +{ + t_pluswidget *pw = ((t_plusobject *)z)->po_widget; + t_rtext *y = glist_findrtext(glist, (t_text *)z); + rtext_activate(y, state); + pw->pw_rtextactive = state; + pluswidget_drawborder((t_text *)z, glist, rtext_gettag(y), 0); +} + +static void pluswidget_delete(t_gobj *z, t_glist *glist) +{ + canvas_deletelinesfor(glist, (t_text *)z); +} + +static void pluswidget_vis(t_gobj *z, t_glist *glist, int vis) +{ + t_pluswidget *pw = ((t_plusobject *)z)->po_widget; + if (vis) + { + if (glist->gl_havewindow) + { + t_rtext *y = glist_findrtext(glist, (t_text *)z); + pluswidget_drawborder((t_text *)z, glist, rtext_gettag(y), 1); + rtext_draw(y); + sys_vgui(".x%lx.c itemconfigure %s -text {%.*s} -fill brown\n", + glist, rtext_gettag(y), pw->pw_vissize, pw->pw_visbuf); + } + } + else + { + if (glist->gl_havewindow) + { + t_rtext *y = glist_findrtext(glist, (t_text *)z); + text_eraseborder((t_text *)z, glist, rtext_gettag(y)); + rtext_erase(y); + } + } +} + +static int pluswidget_click(t_gobj *z, t_glist *glist, int xpix, int ypix, + int shift, int alt, int dbl, int doit) +{ + if (glist->gl_havewindow) + { + if (doit) + pd_bang((t_pd *)z); + return (1); + } + else return (0); +} + +static t_widgetbehavior pluswidget_widgetbehavior = +{ + pluswidget_getrect, + pluswidget_displace, + pluswidget_select, + pluswidget_activate, + pluswidget_delete, + pluswidget_vis, + pluswidget_click, +}; + +/* Code that might be merged back to g_text.c ends here. */ + +void plusobject_widgetfree(t_plusobject *po) +{ + t_pluswidget *pw = po->po_widget; + if (pw) + { + if (pw->pw_visstring) + plusstring_release(pw->pw_visstring); + else if (pw->pw_visbuf) + freebytes(pw->pw_visbuf, pw->pw_vissize); + freebytes(pw, sizeof(*pw)); + } +} + +/* assuming non-null ps will remain constant, LATER rethink */ +void plusobject_widgetcreate(t_plusobject *po, t_symbol *s, int ac, t_atom *av, + t_plusstring *ps) +{ + t_pluswidget *pw = getbytes(sizeof(*pw)); + pw->pw_visstring = 0; + if (ps) + { + plusstring_preserve(ps); + pw->pw_visbuf = plusstring_get(ps, &pw->pw_vissize); + if (pw->pw_vissize > 0) + pw->pw_visstring = ps; + else + plusstring_release(ps); + } + if (pw->pw_visstring == 0) + { + t_binbuf *inbb = binbuf_new(); + if (!s || s == &s_) + s = plusps_tot; + if ((s != totps_plustot && s != plusps_tot) || ac == 0) + { + t_atom at; + if (s == totps_plustot) + s = plusps_tot; + SETSYMBOL (&at, s); + binbuf_add(inbb, 1, &at); + } + if (ac > 0) + binbuf_add(inbb, ac, av); + binbuf_gettext(inbb, &pw->pw_visbuf, &pw->pw_vissize); + binbuf_free(inbb); + } + pw->pw_rtextactive = 0; + pw->pw_ishit = 0; + po->po_widget = pw; +} + +void plusclass_widgetsetup(t_class *c) +{ + class_setwidget(c, &pluswidget_widgetbehavior); +} diff --git a/externals/miXed/toxy/setup.wiq b/externals/miXed/toxy/setup.wiq new file mode 100644 index 000000000..db3fe6727 --- /dev/null +++ b/externals/miXed/toxy/setup.wiq @@ -0,0 +1,347 @@ +// Do not edit this file (edit "../test/toxy/setup.wid", and run "make"). +// +"puts stderr [concat loading built-in widget definitions]\n" +"package provide toxywidgets 0.1.0.17\n" +"\n" +"# LATER keep standard widget setup in a .tcl file (transfered into a .wiq), and\n" +"# glue separate .wid files with standard widget definitions into another .wiq\n" +"# LATER think about using a slave interpreter, and a toxy-specific connection\n" +"# LATER gather aqua incompatibilities, and decide, if there is no other\n" +"# way than branching (different meaning of -bg, -borderwidth trouble,\n" +"# right click, etc.)\n" +"\n" +"# LATER ask for adding something of the sort to pd.tk:\n" +"bind Canvas <1> {+focus %W}\n" +"\n" +"# FIXME args\n" +"proc ::toxy::package_require {pkg dll} {\n" +" if {[catch {package require $pkg} res] == 0} {\n" +" puts stderr \"using package $pkg $res\"\n" +" } elseif {[catch {load $dll $pkg}] != 0} {\n" +" puts stderr \"ERROR: missing package $pkg ($res)\"\n" +" }\n" +"}\n" +"\n" +"# valid options: \"show\", \"hide\"\n" +"proc ::toxy::console {op} {\n" +" if {[catch {::console $op}]} {\n" +" if {[catch {package require tkcon}] == 0} {\n" +" tkcon $op\n" +" }\n" +" }\n" +"}\n" +"\n" +"# FIXME this should be explicitly requested\n" +"# In order to keep the state after tk canvas has been destroyed\n" +"# try setting -variable and -textvariable traces\n" +"\n" +"proc ::toxy::item_dotrace {target varname ndxname op} {\n" +" if {[catch {set v [set $varname]} res] == 0} {\n" +" if {$v != [set $varname.last]} {\n" +"# FIXME activate this on demand (for explicit traces)\n" +"# pd $target.rp _data $v \\;\n" +" set $varname.last $v\n" +" }\n" +" } else { puts stderr [concat failed ::toxy::item_dotrace: $res] }\n" +"}\n" +"\n" +"proc ::toxy::item_bindtrace {varname mastername ndxname op} {\n" +" set $varname [set $mastername]\n" +"}\n" +"\n" +"proc ::toxy::item_settrace {op path target varname} {\n" +" if {[catch {$path cget $op} res] == 0} {\n" +" if {$res == \"\"} {\n" +" if {[catch {$path config $op $varname} err]} {\n" +" error $err\n" +" }\n" +" } else {\n" +" if {[info tclversion] < 8.4} {\n" +" trace variable $res w \"::toxy::item_bindtrace $varname\"\n" +" } else {\n" +" trace add variable $res write \"::toxy::item_bindtrace $varname\"\n" +" }\n" +" }\n" +" if {![info exists $varname.last]} { set $varname.last \"\" }\n" +" if {[info tclversion] < 8.4} {\n" +" trace variable $varname w \"::toxy::item_dotrace $target\"\n" +" } else {\n" +" trace add variable $varname write \"::toxy::item_dotrace $target\"\n" +" }\n" +" return\n" +" } else { return 0 }\n" +"}\n" +"\n" +"# LATER revisit -- seems clumsy and fragile\n" +"proc ::toxy::item_removetrace {op path varname} {\n" +" if {[catch {$path cget $op} res] == 0} {\n" +" if {$res == $varname} {\n" +" if {[catch {$path config $op \"\"} err]} {\n" +" error $err\n" +" }\n" +" } elseif {$res != \"\"} {\n" +" if {[info tclversion] < 8.4} {\n" +" catch { trace vdelete $res w \"::toxy::item_bindtrace $varname\" }\n" +" } else {\n" +" catch { trace remove variable \\\n" +" $res write \"::toxy::item_bindtrace $varname\" }\n" +" }\n" +" }\n" +" }\n" +"}\n" +"\n" +"proc ::toxy::item_destroy {path varname} {\n" +" ::toxy::item_removetrace -variable $path $varname.var\n" +" ::toxy::item_removetrace -textvariable $path $varname.txt\n" +" if {[info tclversion] < 8.4} {\n" +" catch { unset $varname.last $varname.var $varname.txt $varname }\n" +" } else {\n" +" unset -nocomplain $varname.last $varname.var $varname.txt $varname\n" +" }\n" +" catch {destroy $path}\n" +"}\n" +"\n" +"proc ::toxy::item_getconfig {path target} {\n" +" set wd [winfo reqwidth $path]\n" +" set ht [winfo reqheight $path]\n" +" if {$wd < 2 || $ht < 2} {\n" +"# LATER rethink\n" +" update idletasks\n" +" set wd [winfo width $path]\n" +" set ht [winfo height $path]\n" +" }\n" +" pd $target.rp _config $target.rp [$path cget -bg] $wd $ht \\\n" +" [catch {$path config -state normal}]\\;\n" +"}\n" +"\n" +"proc ::toxy::item_visconfig {path target name varname cvpath px py} {\n" +" if {[info exists ::toxy::itemoptions]} {\n" +" set failed [catch {eval $path config $::toxy::itemoptions} res]\n" +" unset ::toxy::itemoptions\n" +" if {$failed} { error [concat in $path config: $res] }\n" +" }\n" +"\n" +" if {[info exists ::toxy::longnewhook]} {\n" +" set failed [catch {eval $::toxy::longnewhook} res]\n" +" unset ::toxy::longnewhook\n" +" if {$failed} { error [concat in ::toxy::longnewhook: $res] }\n" +" }\n" +"\n" +" $cvpath create window $px $py \\\n" +" -anchor nw -window $path -tags [concat toxy$name $target]\n" +"\n" +"# FIXME use ${name}::explicittrace\n" +" if {[info exists ::toxy::storethispath]} {\n" +"# FIXME explicit traces\n" +" set needtraces 0\n" +" } else {\n" +" set needtraces 1\n" +" }\n" +"\n" +" if {$needtraces != 0} {\n" +" if {[catch {::toxy::item_settrace -variable \\\n" +" $path $target $varname.var} res1]} {\n" +" error [concat in ::toxy::item_settrace: $res1]\n" +" }\n" +" if {[catch {::toxy::item_settrace -textvariable \\\n" +" $path $target $varname.txt} res2]} {\n" +" error [concat in ::toxy::item_settrace: $res2]\n" +" }\n" +"# puts stderr [concat traces: ($res1) ($res2)]\n" +" if {$res1 == 0 && $res2 == 0} {\n" +"# puts stderr [concat toxy warning: $path untraceable]\n" +" }\n" +" }\n" +"\n" +" set failed [catch {::toxy::master $path $cvpath $target} res]\n" +" if {$failed} { error [concat in ::toxy::master: $res] }\n" +"\n" +" if {[info exists ::toxy::longvishook]} {\n" +" set failed [catch {eval $::toxy::longvishook} res]\n" +" unset ::toxy::longvishook\n" +" if {$failed} { error [concat in ::toxy::longvishook: $res] }\n" +" }\n" +" if {[info exists ::toxy::shortvishook]} {\n" +" set failed [catch {eval $::toxy::shortvishook} res]\n" +" unset ::toxy::shortvishook\n" +" if {$failed} { error [concat in ::toxy::shortvishook: $res] }\n" +" }\n" +"\n" +" ::toxy::item_getconfig $path $target\n" +"\n" +" return\n" +"}\n" +"\n" +"proc ::toxy::item_vis {tkclass path target name varname cvpath px py} {\n" +" if {[winfo exists $path]} {\n" +"# puts stderr [concat $path exists]\n" +" set ::toxy::itemfailure 0\n" +" } else {\n" +" set ::toxy::itemfailure [catch {$tkclass $path} ::toxy::itemerrmess]\n" +" }\n" +" if {$::toxy::itemfailure == 0} {\n" +" set ::toxy::itemfailure [catch {::toxy::item_visconfig \\\n" +" $path $target $name $varname $cvpath $px $py} \\\n" +" ::toxy::itemerrmess]\n" +" }\n" +" if {$::toxy::itemfailure} {\n" +" if {[winfo exists $path]} {destroy $path}\n" +" puts stderr [concat tcl error: $::toxy::itemerrmess]\n" +" pd $target.rp _failure \\;\n" +" }\n" +"}\n" +"\n" +"# empirically, binding event coords as %X - [winfo rootx $cvpath] works\n" +"# better, than %x + [winfo x %W], or %x + t->te_xpix, LATER investigate\n" +"\n" +"proc ::toxy::item_click {target cvpath x y b f} {\n" +" pd $target.rp _click \\\n" +" [$cvpath canvasx [expr {$x - [winfo rootx $cvpath]}]] \\\n" +" [$cvpath canvasy [expr {$y - [winfo rooty $cvpath]}]] $b $f\\;\n" +"}\n" +"\n" +"proc ::toxy::item_inout {target v} {\n" +" pd [concat $target.rp _inout $v \\;]\n" +"}\n" +"\n" +"proc ::toxy::master_release {target cvpath x y b} {\n" +" ::toxy::item_inout $target 3\n" +"# pdtk_canvas_mouseup is a hack, which we must call anyway\n" +" pdtk_canvas_mouseup $cvpath \\\n" +" [expr {$x - [winfo rootx $cvpath]}] \\\n" +" [expr {$y - [winfo rooty $cvpath]}] $b\n" +"}\n" +"\n" +"proc ::toxy::master_motion {target cvpath x y} {\n" +" pd $target.rp _motion \\\n" +" [$cvpath canvasx [expr {$x - [winfo rootx $cvpath]}]] \\\n" +" [$cvpath canvasy [expr {$y - [winfo rooty $cvpath]}]] 0 \\;\n" +"}\n" +"\n" +"proc ::toxy::master {path cvpath target} {\n" +" bind $path <ButtonRelease> \"::toxy::master_release $target $cvpath %X %Y %b\"\n" +" bind $path <1> \"::toxy::item_click $target $cvpath %X %Y %b 0\"\n" +" bind $path <Shift-1> \"::toxy::item_click $target $cvpath %X %Y %b 1\"\n" +" bind $path <Control-1> \"::toxy::item_click $target $cvpath %X %Y %b 2\"\n" +" bind $path <Control-Shift-1> \"::toxy::item_click $target $cvpath %X %Y %b 3\"\n" +" bind $path <Alt-1> \"::toxy::item_click $target $cvpath %X %Y %b 4\"\n" +" bind $path <Alt-Shift-1> \"::toxy::item_click $target $cvpath %X %Y %b 5\"\n" +" bind $path <Alt-Control-1> \"::toxy::item_click $target $cvpath %X %Y %b 6\"\n" +" bind $path <Alt-Control-Shift-1> \\\n" +" \"::toxy::item_click $target $cvpath %X %Y %b 7\"\n" +" bind $path <3> \"::toxy::item_click $target $cvpath %X %Y %b 8\"\n" +"\n" +" bind $path <Motion> \"::toxy::master_motion $target $cvpath %X %Y\"\n" +" bind $path <B1-Motion> \"::toxy::master_motion $target $cvpath %X %Y\"\n" +" bind $path <Enter> \"::toxy::item_inout $target 1\"\n" +" bind $path <Leave> \"::toxy::item_inout $target 0\"\n" +"\n" +" if {[catch {$path config -state normal}] == 0} {\n" +" bind $path <<disable>> \"$path config -state disabled\"\n" +" bind $path <<enable>> \"$path config -state normal\"\n" +" }\n" +"\n" +" if {[winfo class $path] == \"Canvas\"} {\n" +"# undo the \"bind Canvas <1> {+focus %W}\" from above\n" +" bind $path <FocusIn> \"focus $cvpath\"\n" +" }\n" +"}\n" +"\n" +"# to be called explicitly from vis proc, LATER rethink\n" +"proc ::toxy::subwidget {path parent cvpath target} {\n" +" bind $path <ButtonRelease> \"::toxy::master_release $target $cvpath %X %Y %b\"\n" +" bind $path <1> \"::toxy::item_click $target $cvpath %X %Y %b 0\"\n" +" bind $path <Shift-1> \"::toxy::item_click $target $cvpath %X %Y %b 1\"\n" +" bind $path <Control-1> \"::toxy::item_click $target $cvpath %X %Y %b 2\"\n" +" bind $path <Control-Shift-1> \"::toxy::item_click $target $cvpath %X %Y %b 3\"\n" +" bind $path <Alt-1> \"::toxy::item_click $target $cvpath %X %Y %b 4\"\n" +" bind $path <Alt-Shift-1> \"::toxy::item_click $target $cvpath %X %Y %b 5\"\n" +" bind $path <Alt-Control-1> \"::toxy::item_click $target $cvpath %X %Y %b 6\"\n" +" bind $path <Alt-Control-Shift-1> \\\n" +" \"::toxy::item_click $target $cvpath %X %Y %b 7\"\n" +" bind $path <3> \"::toxy::item_click $target $cvpath %X %Y %b 8\"\n" +"\n" +" bind $path <Motion> \"::toxy::master_motion $target $cvpath %X %Y\"\n" +" bind $path <B1-Motion> \"::toxy::master_motion $target $cvpath %X %Y\"\n" +" bind $path <Enter> \"::toxy::item_inout $target 1\"\n" +" bind $path <Leave> \"::toxy::item_inout $target 0\"\n" +"\n" +" if {[catch {$path config -state normal}] == 0} {\n" +" bind $parent <<disable>> \"+$path config -state disabled\"\n" +" bind $parent <<enable>> \"+$path config -state normal\"\n" +" }\n" +"}\n" +"\n" +"# standard widget types, LATER move to separate .wid files\n" +"\n" +"# FIXME\n" +"proc ::toxy::scale_command {target sel v} {\n" +" if {$::toxy::scale_isactive} {\n" +" pd [concat $target $sel $v \\;]\n" +" }\n" +" set ::toxy::scale_isactive 1\n" +"}\n" +"\n" +"proc ::toxy::scale_doset {path v} {\n" +" set ::toxy::scale_isactive 0\n" +" $path set $v\n" +"}\n" +"\n" +"proc ::toxy::popup_command {path target remote i text} {\n" +" set [$path cget -textvariable] $text\n" +" pd [concat $target _cb $i \\;]\n" +" if {$remote != \".\"} {\n" +" pd [concat $remote $i \\;]\n" +" }\n" +"}\n" +"\n" +"proc ::toxy::popup {path target remote entries args} {\n" +" if {[winfo exists $path.pop]} {\n" +"# puts stderr [concat $path.pop exists]\n" +" } elseif {[catch {eval {menu $path.pop} $args} err] == 0} {\n" +" set i 0\n" +" foreach e $entries {\n" +" if {$e == \".\"} {\n" +" $path.pop add separator\n" +" } else {\n" +" incr i\n" +" $path.pop add command -label [lindex $e 0] \\\n" +" -command [concat ::toxy::popup_command \\\n" +" $path $target $remote $i \\\n" +" [lindex $e [expr {[llength $e] > 1}]]]\n" +" }\n" +" }\n" +" } else { error [concat in ::toxy::popup: $err] }\n" +"}\n" +"\n" +"# FIXME should be part of the float widget type, but we need it for plain scales\n" +"set ::toxy::scale_isactive 1\n" +"\n" +"#> bang button\n" +"#. -image ::toxy::img::empty -command .<.>\n" +"#. -bg pink -activebackground red -width 50 -height 50\n" +"#. @bang .- flash .: .- invoke\n" +"\n" +"#> float scale\n" +"#. -command [concat ::toxy::scale_command .| _cb]\n" +"#. -bg pink -activebackground red -length 200\n" +"#. @float .- set .#1\n" +"#. @vset ::toxy::scale_doset .- .#1\n" +"\n" +"#> symbol entry\n" +"#. -bg pink -font .(helvetica 24.) -width 16\n" +"#. @symbol .- delete 0 end .: .- insert 0 .#1\n" +"\n" +"#@ vis\n" +"bind .- <Return> {eval .<[.- get].>; focus .^.c}\n" +"\n" +"#> popup menubutton\n" +"#. -menu .-.pop\n" +"#. -bg purple -fg white -activebackground magenta -text popup\n" +"#. -width 8 -relief raised -borderwidth 3\n" +"#. @float if .(.#1 >= 1.) .(.-.pop invoke .#1.)\n" +"#. #items test\n" +"#. #iprops \"-bg\" purple \"-fg\" white \"-activebackground\" magenta \"-borderwidth\" 3\n" +"\n" +"#@ vis\n" +"::toxy::popup .- .| . [concat .#items] .#iprops\n" diff --git a/externals/miXed/toxy/tot.c b/externals/miXed/toxy/tot.c new file mode 100644 index 000000000..0fb576357 --- /dev/null +++ b/externals/miXed/toxy/tot.c @@ -0,0 +1,687 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER handle stcriptlet's named arguments */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "unstable/forky.h" +#include "hammer/file.h" +#include "hammer/gui.h" +#include "common/props.h" +#include "toxy/scriptlet.h" +#include "build_counter" + +#ifdef KRZYSZCZ +//#define TOT_DEBUG +#endif + +/* probably much more than needed for canvas messages from gui */ +#define TOTSPY_MAXSIZE 32 + +typedef struct _tot +{ + t_object x_ob; + t_glist *x_glist; /* containing glist */ + t_symbol *x_dotname; /* "." (if explicit), ".parent", ".root", etc. */ + t_symbol *x_cvname; /* destination name (if literal), or 0 */ + t_symbol *x_cvremote; /* bindsym of the above */ + t_symbol *x_cvpathname; /* see tot_getpathname() */ + t_symbol *x_visedpathname; /* see tot__vised() */ + t_symbol *x_target; + int x_warned; + t_scriptlet *x_persistent; + t_scriptlet *x_transient; + t_outlet *x_out2; + t_outlet *x_out4; + t_symbol *x_defname; /* file name (if given as a creation arg) */ + t_hammerfile *x_filehandle; + t_pd *x_guidetached; + t_pd *x_guisink; + struct _totspy *x_spy; +} t_tot; + +typedef struct _totspy +{ + t_pd ts_pd; + int ts_on; + t_canvas *ts_cv; + t_symbol *ts_target; + t_symbol *ts_qsym; + int ts_gotmotion; + t_atom ts_lastmotion[3]; + double ts_lasttime; + t_symbol *ts_selector; + t_atom ts_outbuf[TOTSPY_MAXSIZE]; + t_outlet *ts_out3; + t_clock *ts_cleanupclock; /* also a tot-is-gone flag */ +} t_totspy; + +static t_class *tot_class; +static t_class *totspy_class; +static t_class *totsink_class; +static t_class *tot_guiconnect_class = 0; + +static t_symbol *totps_motion; +static t_symbol *totps_qpush; +static t_symbol *totps_query; + +static t_symbol *totps_dotparent; /* holder of our containing glist's box */ +static t_symbol *totps_dotroot; /* our document's root canvas */ +static t_symbol *totps_dotowner; /* parent of .root */ +static t_symbol *totps_dottop; /* top-level canvas */ + +static t_glist *tot_getglist(t_tot *x) +{ + t_glist *glist; + if (x->x_cvremote) + glist = (t_glist *)pd_findbyclass(x->x_cvremote, canvas_class); + else if (x->x_dotname == totps_dotparent) + glist = x->x_glist->gl_owner; + else if (x->x_dotname == totps_dotroot) + glist = canvas_getrootfor(x->x_glist); + else if (x->x_dotname == totps_dotowner) + { + if (glist = canvas_getrootfor(x->x_glist)) + glist = glist->gl_owner; + } + else if (x->x_dotname == totps_dottop) + { + glist = x->x_glist; + while (glist->gl_owner) glist = glist->gl_owner; + } + else + glist = x->x_glist; + return (glist); +} + +static t_symbol *tot_getcvname(t_tot *x) +{ + t_glist *glist = tot_getglist(x); + t_symbol *cvname = (glist ? glist->gl_name : x->x_cvname); + if (cvname) + return (cvname); + else if (x->x_dotname) + return (x->x_dotname); + else + { + loudbug_bug("tot_getcvname"); + return (gensym("???")); + } +} + +static t_canvas *tot_getcanvas(t_tot *x, int complain) +{ + t_canvas *cv = 0; + t_glist *glist = tot_getglist(x); + if (glist) + cv = glist_getcanvas(glist); + else if (complain) + { + if (x->x_dotname && *x->x_dotname->s_name) + loud_error((t_pd *)x, "%s canvas does not exist", + &x->x_dotname->s_name[1]); + else + loud_error((t_pd *)x, "bad canvas name '%s'", + tot_getcvname(x)->s_name); + } + if (!x->x_warned) + { + x->x_warned = 1; + if (!cv) cv = x->x_glist; /* redundant */ + loud_warning((t_pd *)x, 0, "using containing canvas ('%s')", + cv->gl_name->s_name); + } + return (cv); +} + +static t_canvas *tot_cvhook(t_pd *z) +{ + return (tot_getcanvas((t_tot *)z, 1)); +} + +static t_symbol *tot_dogetpathname(t_tot *x, int visedonly, int complain) +{ + t_canvas *cv = tot_getcanvas(x, complain); + if (cv) + { + if (visedonly && !glist_isvisible(cv)) + return (0); + else if (cv == x->x_glist) + /* containing glist is our destination, and we are not in a gop */ + return (x->x_cvpathname); + else + { + char buf[32]; + sprintf(buf, ".x%x.c", (int)cv); + return (gensym(buf)); + } + } + else return (0); +} + +static t_symbol *tot_getpathname(t_tot *x, int complain) +{ + return (tot_dogetpathname(x, 0, complain)); +} + +static t_symbol *tot_getvisedpathname(t_tot *x, int complain) +{ + return (tot_dogetpathname(x, 1, complain)); +} + +static void tot_reset(t_tot *x) +{ + scriptlet_reset(x->x_persistent); +} + +static void tot_prealloc(t_tot *x, t_floatarg f) +{ + int reqsize = (int)f; + scriptlet_prealloc(x->x_persistent, reqsize, 1); + scriptlet_prealloc(x->x_transient, reqsize, 1); /* LATER rethink */ +} + +static void tot_add(t_tot *x, t_symbol *s, int ac, t_atom *av) +{ + scriptlet_add(x->x_persistent, 0, 0, ac, av); +} + +static void tot_addnext(t_tot *x, t_symbol *s, int ac, t_atom *av) +{ + scriptlet_setseparator(x->x_persistent, '\n'); + scriptlet_add(x->x_persistent, 0, 0, ac, av); +} + +static void tot_push(t_tot *x, t_symbol *s, int ac, t_atom *av) +{ + if (scriptlet_evaluate(x->x_persistent, x->x_transient, 1, ac, av, 0)) + { + if (s == totps_qpush) + scriptlet_qpush(x->x_transient); + else + scriptlet_push(x->x_transient); + } +} + +static void tot_tot(t_tot *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac) + { + t_scriptlet *sp = x->x_transient; + scriptlet_reset(sp); + scriptlet_add(sp, 1, 1, ac, av); + if (s == totps_query) + scriptlet_qpush(sp); + else + scriptlet_push(sp); + } +} + +static void tot_dooutput(t_tot *x, t_outlet *op, + t_symbol *s, int ac, t_atom *av) +{ + if (ac == 1) + { + if (av->a_type == A_FLOAT) + outlet_float(op, av->a_w.w_float); + else if (av->a_type == A_SYMBOL) + outlet_symbol(op, av->a_w.w_symbol); + } + else if (ac) + { + if (av->a_type == A_FLOAT) + outlet_list(op, &s_list, ac, av); + else if (av->a_type == A_SYMBOL) + outlet_anything(op, av->a_w.w_symbol, ac - 1, av + 1); + } + else outlet_bang(op); +} + +static void tot__reply(t_tot *x, t_symbol *s, int ac, t_atom *av) +{ + tot_dooutput(x, ((t_object *)x)->ob_outlet, s, ac, av); +} + +static void tot__callback(t_tot *x, t_symbol *s, int ac, t_atom *av) +{ + tot_dooutput(x, x->x_out2, s, ac, av); +} + +static void tot_properties(t_gobj *z, t_glist *glist) +{ + t_tot *x = (t_tot *)z; + int nleft; + char *head = scriptlet_getcontents(x->x_persistent, &nleft); + hammereditor_open(x->x_filehandle, "scriptlet editor", 0); + if (nleft) + { + char buf[MAXPDSTRING + 1], *lastptr = buf + MAXPDSTRING; + *lastptr = 0; + while (nleft > 0) + { + if (nleft > MAXPDSTRING) + { + strncpy(buf, head, MAXPDSTRING); + head += MAXPDSTRING; + nleft -= MAXPDSTRING; + } + else + { + strncpy(buf, head, nleft); + lastptr = buf + nleft; + *lastptr = 0; + nleft = 0; + } + hammereditor_append(x->x_filehandle, buf); + } + hammereditor_append(x->x_filehandle, "\n"); + } + hammereditor_setdirty(x->x_filehandle, 0); +} + +static void tot_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av) +{ + t_tot *x = (t_tot *)z; + scriptlet_reset(x->x_persistent); + scriptlet_add(x->x_persistent, 0, 0, ac, av); +} + +static void tot_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + scriptlet_read(((t_tot *)z)->x_persistent, fn); +} + +static void tot_writehook(t_pd *z, t_symbol *fn, int ac, t_atom *av) +{ + scriptlet_write(((t_tot *)z)->x_persistent, fn); +} + +static void tot_read(t_tot *x, t_symbol *s) +{ + if (s && s != &s_) + scriptlet_read(x->x_persistent, s); + else + hammerpanel_open(x->x_filehandle, 0); +} + +static void tot_write(t_tot *x, t_symbol *s) +{ + if (s && s != &s_) + scriptlet_write(x->x_persistent, s); + else + hammerpanel_save(x->x_filehandle, + canvas_getdir(x->x_glist), x->x_defname); +} + +/* This is called for all Map (f==1) and all Destroy (f==0) events, + comming from any canvas. If visedpathname is zero, we assume our + canvas does not exist. So we ignore everything, waiting for a Map + event that fits tot_getpathname(). Once we spot it, we set + visedpathname, and ignore everything, waiting for a Destroy event + that fits visedpathname. Then we clear visedpathname, etc... */ +static void tot__vised(t_tot *x, t_symbol *s, t_floatarg f) +{ + int flag = f != 0.; +#ifdef TOT_DEBUG + t_symbol *pn = tot_getpathname(x, 0); + loudbug_post("tot__vised %s %g (pathname %s) ", s->s_name, f, + (pn ? pn->s_name : "unknown")); +#endif + if (!x->x_visedpathname) + { + if (flag && s == tot_getpathname(x, 0)) + { + x->x_visedpathname = s; + outlet_bang(x->x_out4); + } + } + else if (!flag && s == x->x_visedpathname) + x->x_visedpathname = 0; /* LATER reconsider reporting this */ +} + +#ifdef TOT_DEBUG +static void tot_postscriptlet(t_scriptlet *sp, char *message) +{ + int nleft; + char *head = scriptlet_getbuffer(sp, &nleft); + loudbug_startpost("*** %s (size %d)", message, nleft); + if (nleft) + { + char buf[MAXPDSTRING + 1], *lastptr = buf + MAXPDSTRING; + *lastptr = 0; + loudbug_stringpost(" ***\n\""); + while (nleft > 0) + { + if (nleft > MAXPDSTRING) + { + strncpy(buf, head, MAXPDSTRING); + head += MAXPDSTRING; + nleft -= MAXPDSTRING; + } + else + { + strncpy(buf, head, nleft); + lastptr = buf + nleft; + *lastptr = 0; + nleft = 0; + } + loudbug_stringpost(buf); + } + loudbug_stringpost("\"\n---------------\n"); + } + else loudbug_stringpost(": \"\" ***\n"); +} + +static void tot_debug(t_tot *x) +{ + t_symbol *pn = tot_getpathname(x, 0); + int sz; + char *bp; + loudbug_post("containing glist: %x", x->x_glist); + loudbug_post("destination: %s", tot_getcvname(x)->s_name); + loudbug_post("pathname%s %s", (pn ? ":" : ""), + (pn ? pn->s_name : "unknown")); + tot_postscriptlet(x->x_transient, "transient buffer"); + tot_postscriptlet(x->x_persistent, "persistent buffer"); +} +#endif + +static void tot_detach(t_tot *x) +{ + t_canvas *cv = tot_getcanvas(x, 1); + if (cv && glist_isvisible(cv)) + { + t_pd *gc; + t_symbol *target; + char buf[64]; + sprintf(buf, ".x%x", (int)cv); + target = gensym(buf); + if (!tot_guiconnect_class) + { + gc = (t_pd *)guiconnect_new(0, gensym("tot")); + tot_guiconnect_class = *gc; + typedmess(gc, gensym("signoff"), 0, 0); + } + if (gc = pd_findbyclass(target, tot_guiconnect_class)) + { + x->x_guidetached = gc; + pd_unbind(gc, target); + pd_bind(x->x_guisink, target); + } + } +} + +static void tot_attach(t_tot *x) +{ + t_canvas *cv = tot_getcanvas(x, 1); + if (cv && glist_isvisible(cv) && x->x_guidetached) + { + if (tot_guiconnect_class) + { + t_pd *gc; + t_symbol *target; + char buf[64]; + sprintf(buf, ".x%x", (int)cv); + target = gensym(buf); + if (gc = pd_findbyclass(target, tot_guiconnect_class)) + { + } + else + { /* assuming nobody else detached it in the meantime... */ + pd_unbind(x->x_guisink, target); + pd_bind(x->x_guidetached, target); + x->x_guidetached = 0; + } + } + else loudbug_bug("tot_attach"); + } +} + +static void tot_capture(t_tot *x, t_symbol *s, t_floatarg f) +{ + t_totspy *ts = x->x_spy; + if ((int)f) + { + t_canvas *cv = tot_getcanvas(x, 1); + ts->ts_qsym = (s == &s_ ? 0 : s); + if (cv != ts->ts_cv) + { + if (ts->ts_target) + { + pd_unbind((t_pd *)ts, ts->ts_target); + ts->ts_cv = 0; + ts->ts_target = 0; + } + if (cv) + { + char buf[64]; + ts->ts_cv = cv; + sprintf(buf, ".x%x", (int)cv); + pd_bind((t_pd *)ts, ts->ts_target = gensym(buf)); + } + } + ts->ts_on = (ts->ts_target != 0); + if (ts->ts_on && ts->ts_qsym) + { + ts->ts_lasttime = clock_getlogicaltime(); + ts->ts_selector = gensym("add"); + SETFLOAT(&ts->ts_outbuf[0], 0); + SETSYMBOL(&ts->ts_outbuf[1], ts->ts_qsym); + SETSYMBOL(&ts->ts_outbuf[2], &s_); + outlet_anything(ts->ts_out3, gensym("clear"), 0, 0); + } + } + else ts->ts_on = 0; +} + +/* this is needed to overcome glist_getnextxy()-related troubles */ +static void tot_lastmotion(t_tot *x, t_symbol *s) +{ + t_totspy *ts = x->x_spy; + if (ts->ts_gotmotion) + { + if (s == &s_) + s = ts->ts_target; + if (s && s->s_thing) + typedmess(s->s_thing, totps_motion, 3, ts->ts_lastmotion); + } +} + +static void totspy_anything(t_totspy *ts, t_symbol *s, int ac, t_atom *av) +{ + if (ts->ts_cleanupclock) + return; + if (s == totps_motion) + { + if (ac == 3) + { + ts->ts_lastmotion[0] = av[0]; + ts->ts_lastmotion[1] = av[1]; + ts->ts_lastmotion[2] = av[2]; + ts->ts_gotmotion = 1; + } + else loudbug_bug("totspy_anything"); + } + if (ts->ts_on) + { + if (ts->ts_qsym) + { + int cnt = ac + 3; + if (cnt < TOTSPY_MAXSIZE) + { + t_atom *ap = ts->ts_outbuf; + ap++->a_w.w_float = (float)clock_gettimesince(ts->ts_lasttime); + ap++; + ap++->a_w.w_symbol = s; + while (ac--) *ap++ = *av++; + outlet_anything(ts->ts_out3, + ts->ts_selector, cnt, ts->ts_outbuf); + ts->ts_lasttime = clock_getlogicaltime(); + } + else loud_warning((t_pd *)ts, 0, + "unexpectedly long message (\"%s...\"), ignored", + s->s_name); + } + else outlet_anything(ts->ts_out3, s, ac, av); + } +} + +static void totspy_cleanuptick(t_totspy *ts) +{ + if (ts->ts_target) + pd_unbind((t_pd *)ts, ts->ts_target); + if (ts->ts_cleanupclock) + clock_free(ts->ts_cleanupclock); + pd_free((t_pd *)ts); +} + +static void totsink_anything(t_pd *x, t_symbol *s, int ac, t_atom *av) +{ + /* nop */ +} + +static void tot_free(t_tot *x) +{ + pd_unbind((t_pd *)x, x->x_target); + hammergui_unbindvised((t_pd *)x); + hammerfile_free(x->x_filehandle); + scriptlet_free(x->x_persistent); + scriptlet_free(x->x_transient); + if (x->x_spy->ts_target) + { + /* postpone unbinding, due to a danger of being deleted by + a message to the canvas we spy on... */ + x->x_spy->ts_cleanupclock = + clock_new(x->x_spy, (t_method)totspy_cleanuptick); + clock_delay(x->x_spy->ts_cleanupclock, 0); + } + else pd_free((t_pd *)x->x_spy); + pd_free(x->x_guisink); +} + +static void *tot_new(t_symbol *s1, t_symbol *s2) +{ + t_tot *x = (t_tot *)pd_new(tot_class); + char buf[64]; + sprintf(buf, "tot%x", (int)x); + pd_bind((t_pd *)x, x->x_target = gensym(buf)); + x->x_glist = canvas_getcurrent(); + x->x_transient = scriptlet_new((t_pd *)x, x->x_target, x->x_target, + 0, x->x_glist, tot_cvhook); + x->x_persistent = scriptlet_new((t_pd *)x, x->x_target, x->x_target, + 0, x->x_glist, tot_cvhook); + if (s1 && s1 != &s_ && *s1->s_name != '.') + { + x->x_dotname = 0; + x->x_warned = 1; + x->x_cvremote = canvas_makebindsym(x->x_cvname = s1); + x->x_cvpathname = 0; + } + else + { + t_glist *glist; + x->x_dotname = (s1 && *s1->s_name == '.' ? s1 : 0); + x->x_warned = (x->x_dotname != 0); /* do not warn if explicit */ + x->x_cvname = 0; + x->x_cvremote = 0; + glist = tot_getglist(x); + if (glist == x->x_glist) + { + sprintf(buf, ".x%x.c", (int)glist); + x->x_cvpathname = gensym(buf); + } + else x->x_cvpathname = 0; + } + outlet_new((t_object *)x, &s_anything); + x->x_out2 = outlet_new((t_object *)x, &s_anything); + x->x_spy = (t_totspy *)pd_new(totspy_class); + x->x_spy->ts_on = 0; + x->x_spy->ts_cv = 0; + x->x_spy->ts_target = 0; + x->x_spy->ts_qsym = 0; + x->x_spy->ts_gotmotion = 0; + x->x_spy->ts_out3 = outlet_new((t_object *)x, &s_anything); + x->x_out4 = outlet_new((t_object *)x, &s_bang); + if (s2 && s2 != &s_) + { + x->x_defname = s2; + scriptlet_read(x->x_persistent, s2); + } + else x->x_defname = &s_; + x->x_filehandle = hammerfile_new((t_pd *)x, 0, + tot_readhook, tot_writehook, + tot_editorhook); + hammergui_bindvised((t_pd *)x); + x->x_visedpathname = tot_getvisedpathname(x, 0); + x->x_guidetached = 0; + x->x_guisink = pd_new(totsink_class); + return (x); +} + +void tot_setup(void) +{ + post("beware! this is tot %s, %s %s build...", + TOXY_VERSION, loud_ordinal(TOXY_BUILD), TOXY_RELEASE); + totps_motion = gensym("motion"); + totps_qpush = gensym("qpush"); + totps_query = gensym("query"); + totps_dotparent = gensym(".parent"); + totps_dotroot = gensym(".root"); + totps_dotowner = gensym(".owner"); + totps_dottop = gensym(".top"); + tot_class = class_new(gensym("tot"), + (t_newmethod)tot_new, + (t_method)tot_free, + sizeof(t_tot), 0, A_DEFSYM, A_DEFSYM, 0); + class_addmethod(tot_class, (t_method)tot_prealloc, + gensym("prealloc"), A_FLOAT, 0); + class_addmethod(tot_class, (t_method)tot_read, + gensym("read"), A_DEFSYM, 0); + class_addmethod(tot_class, (t_method)tot_write, + gensym("write"), A_DEFSYM, 0); + class_addmethod(tot_class, (t_method)tot_reset, + gensym("reset"), 0); + class_addmethod(tot_class, (t_method)tot_push, + gensym("push"), A_GIMME, 0); + class_addmethod(tot_class, (t_method)tot_push, + gensym("qpush"), A_GIMME, 0); + class_addmethod(tot_class, (t_method)tot_add, + gensym("add"), A_GIMME, 0); + class_addmethod(tot_class, (t_method)tot_addnext, + gensym("addnext"), A_GIMME, 0); + class_addmethod(tot_class, (t_method)tot_tot, + gensym("tot"), A_GIMME, 0); + class_addmethod(tot_class, (t_method)tot_tot, + gensym("query"), A_GIMME, 0); + class_addmethod(tot_class, (t_method)tot_detach, + gensym("detach"), 0); + class_addmethod(tot_class, (t_method)tot_attach, + gensym("attach"), 0); + class_addmethod(tot_class, (t_method)tot_capture, + gensym("capture"), A_FLOAT, A_DEFSYM, 0); + class_addmethod(tot_class, (t_method)tot_lastmotion, + gensym("lastmotion"), A_DEFSYM, 0); + class_addmethod(tot_class, (t_method)tot__reply, + gensym("_rp"), A_GIMME, 0); + class_addmethod(tot_class, (t_method)tot__callback, + gensym("_cb"), A_GIMME, 0); + class_addmethod(tot_class, (t_method)tot__vised, + gensym("_vised"), A_SYMBOL, A_FLOAT, 0); +#ifdef TOT_DEBUG + class_addmethod(tot_class, (t_method)tot_debug, + gensym("debug"), 0); +#endif + forky_setpropertiesfn(tot_class, tot_properties); + hammerfile_setup(tot_class, 0); + totspy_class = class_new(gensym("tot spy"), 0, 0, + sizeof(t_totspy), CLASS_PD, 0); + class_addanything(totspy_class, totspy_anything); + totsink_class = class_new(gensym("tot sink"), 0, 0, + sizeof(t_pd), CLASS_PD, 0); + class_addanything(totsink_class, totsink_anything); +} diff --git a/externals/miXed/toxy/tow.c b/externals/miXed/toxy/tow.c new file mode 100644 index 000000000..3003de83f --- /dev/null +++ b/externals/miXed/toxy/tow.c @@ -0,0 +1,26 @@ +/* Copyright (c) 2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* The tow extern just loads the 'widget' library. + The tow class itself is defined in widget.c. */ + +#include "m_pd.h" +#include "common/loud.h" +#include "unstable/loader.h" + +void tow_setup(void) +{ + int result = LOADER_OK; + if (zgetfn(&pd_objectmaker, gensym("widget"))) + loud_warning(0, "tow", "widget is already loaded"); + else + result = unstable_load_lib("", "widget"); + if (result == LOADER_NOFILE) + loud_error(0, "widget library is missing"); + else if (!zgetfn(&pd_objectmaker, gensym("widget"))) + { + loud_error(0, "version mismatch"); + loud_errand(0, "use a more recent Pd release (or recompile toxy)."); + } +} diff --git a/externals/miXed/toxy/toxy-all.exclude b/externals/miXed/toxy/toxy-all.exclude new file mode 100644 index 000000000..d9e9df122 --- /dev/null +++ b/externals/miXed/toxy/toxy-all.exclude @@ -0,0 +1,8 @@ +*~ +*.o +*.gz +*.html +*.out +ref +ref/* +dumpsetups diff --git a/externals/miXed/toxy/toxy-help.include b/externals/miXed/toxy/toxy-help.include new file mode 100644 index 000000000..289c81c53 --- /dev/null +++ b/externals/miXed/toxy/toxy-help.include @@ -0,0 +1 @@ +bin/plustot-help.pd diff --git a/externals/miXed/toxy/toxy-shared.include b/externals/miXed/toxy/toxy-shared.include new file mode 100644 index 000000000..69322e76a --- /dev/null +++ b/externals/miXed/toxy/toxy-shared.include @@ -0,0 +1,26 @@ +shared/shared.h +shared/common/loud.c +shared/common/loud.h +shared/common/grow.c +shared/common/grow.h +shared/common/dict.c +shared/common/dict.h +shared/common/os.c +shared/common/os.h +shared/hammer/file.c +shared/hammer/file.h +shared/hammer/gui.c +shared/hammer/gui.h +shared/unstable/fragile.c +shared/unstable/fragile.h +shared/unstable/forky.c +shared/unstable/forky.h +shared/unstable/loader.c +shared/unstable/loader.h +shared/unstable/pd_imp.h +shared/common/props.c +shared/common/props.h +shared/toxy/plusbob.c +shared/toxy/plusbob.h +shared/toxy/scriptlet.c +shared/toxy/scriptlet.h diff --git a/externals/miXed/toxy/toxy-test.exclude b/externals/miXed/toxy/toxy-test.exclude new file mode 100644 index 000000000..6b3cc437c --- /dev/null +++ b/externals/miXed/toxy/toxy-test.exclude @@ -0,0 +1,5 @@ +*~ +import-result.pd +import-debug.pd +temporary +temporary/* diff --git a/externals/miXed/toxy/toxy-vicious.exclude b/externals/miXed/toxy/toxy-vicious.exclude new file mode 100644 index 000000000..5e5a82ec6 --- /dev/null +++ b/externals/miXed/toxy/toxy-vicious.exclude @@ -0,0 +1,3 @@ +*~ +old +old/* diff --git a/externals/miXed/toxy/widget.c b/externals/miXed/toxy/widget.c new file mode 100644 index 000000000..71c24a887 --- /dev/null +++ b/externals/miXed/toxy/widget.c @@ -0,0 +1,1577 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +/* LATER think about reloading method for .wid files */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "g_canvas.h" +#include "common/loud.h" +#include "common/grow.h" +#include "unstable/forky.h" +#include "hammer/file.h" +#include "common/props.h" +#include "toxy/scriptlet.h" +#include "widget.h" +#include "build_counter" + +/* our proxy of the text_class (not in the API), LATER do not cheat */ +static t_class *makeshift_class; + +#ifdef KRZYSZCZ +#define WIDGET_DEBUG +//#define TOW_DEBUG +//#define WIDGET_PROFILE +#endif + +enum { WIDGET_NOVIS = 0, WIDGET_PUSHVIS, WIDGET_REVIS }; + +typedef struct _towentry +{ + struct _tow *te_tow; + struct _towentry *te_next; +} t_towentry; + +typedef struct _widgetentry +{ + struct _widget *we_widget; + struct _widgetentry *we_next; +} t_widgetentry; + +typedef struct _widget +{ + t_object x_ob; + t_glist *x_glist; /* containing glist */ + t_widgettype *x_typedef; + t_symbol *x_type; /* 1st creation arg: our type */ + t_symbol *x_tkclass; /* Tk widget class */ + t_symbol *x_name; /* 2nd creation arg: our name (common tag) */ + t_symbol *x_cbtarget; /* same, mangled (a target, and a tag) */ + t_symbol *x_rptarget; /* same, further mangled */ + t_symbol *x_cvpathname; /* see widget_getcvpathname() */ + t_symbol *x_cvtarget; /* for gui commands to be (re)sent to */ + t_symbol *x_varname; /* tcl variable holding our data */ + t_props *x_options; /* instance options */ + t_props *x_handlers; /* instance handlers */ + t_props *x_arguments; /* instance arguments */ + t_props *x_xargs; /* type and instance arguments, resolved */ + t_props *x_diffoptions; /* type options minus instance options */ + t_props *x_diffhandlers; /* same for handlers */ + t_props *x_diffarguments; /* same for arguments */ + t_widgethandlers *x_hooks; /* actual handlers (short definitions) */ + t_scriptlet *x_optscript; /* option scriptlet */ + t_scriptlet *x_auxscript; /* auxiliary scriptlet */ + t_scriptlet *x_transient; /* output buffer */ + t_hammerfile *x_filehandle; + int x_width; + int x_height; + t_symbol *x_background; + int x_hasstate; /* no longer used, LATER rethink */ + int x_disabled; + int x_selected; + int x_update; /* see widget_update() */ + int x_vised; + int x_constructed; + t_clock *x_transclock; + t_towentry *x_towlist; +} t_widget; + +typedef struct _tow +{ + t_object x_ob; + t_glist *x_glist; /* containing glist */ + t_glist *x_targetglist; /* containing or parent glist */ + t_symbol *x_cvremote; /* null if targetglist is set */ + t_symbol *x_cvname; + t_symbol *x_type; /* 2nd creation arg: widget's type */ + t_symbol *x_name; /* 3rd creation arg: widget's name */ + t_widgetentry *x_widgetlist; + struct _tow *x_next; /* next in the global towlist */ +} t_tow; + +static t_class *widget_class; +static t_class *tow_class; + +/* Global towlist, searched in widget_attach(). There is no global widgetlist, + because a destination glist is searched instead in tow_attach(). */ +static t_tow *widget_towlist = 0; + +static t_symbol *widgetps_mouse; +static t_symbol *widgetps_motion; +static t_symbol *widgetps_vis; +static t_symbol *widgetps_new; +static t_symbol *widgetps_free; +static t_symbol *widgetps_data; +static t_symbol *widgetps_add; +static t_symbol *widgetps_delete; +static t_symbol *widgetps_set; +static t_symbol *widgetps_get; + +#ifdef WIDGET_PROFILE +static double widgetprofile_lasttime; + +static double widgetprofile_step(void) +{ + double newtime = sys_getrealtime(), + delta = newtime - widgetprofile_lasttime; + widgetprofile_lasttime = newtime; + return (delta); +} + +static int widgetprofile_handlerphase = 0; +static double widgetprofile_handlerslice[3]; +static double widgetprofile_handlerdelta[2]; + +static void widgetprofile_handler_enter(void) +{ + widgetprofile_handlerphase = 1; + widgetprofile_step(); +} + +static void widgetprofile_handler_eval(void) +{ + widgetprofile_handlerphase = 2; + widgetprofile_handlerdelta[0] = widgetprofile_step(); +} + +static void widgetprofile_handler_push(void) +{ + widgetprofile_handlerphase = 3; + widgetprofile_handlerdelta[1] = widgetprofile_step(); +} + +static void widgetprofile_handler_quit(void) +{ + if (widgetprofile_handlerphase == 3) + { + widgetprofile_handlerslice[2] += widgetprofile_step(); + widgetprofile_handlerslice[0] += widgetprofile_handlerdelta[0]; + widgetprofile_handlerslice[1] += widgetprofile_handlerdelta[1]; + } + widgetprofile_handlerphase = 0; +} + +static void widget_profile(t_widget *x) +{ + loudbug_post("total time in ms:"); + loudbug_post("\thandler get %g", widgetprofile_handlerslice[0] * 1000.); + loudbug_post("\thandler eval %g", widgetprofile_handlerslice[1] * 1000.); + loudbug_post("\thandler push %g", widgetprofile_handlerslice[2] * 1000.); +} + +#define WIDGETPROFILE_HANDLER_ENTER widgetprofile_handler_enter() +#define WIDGETPROFILE_HANDLER_EVAL widgetprofile_handler_eval() +#define WIDGETPROFILE_HANDLER_PUSH widgetprofile_handler_push() +#define WIDGETPROFILE_HANDLER_QUIT widgetprofile_handler_quit() +#else +#define WIDGETPROFILE_HANDLER_ENTER +#define WIDGETPROFILE_HANDLER_EVAL +#define WIDGETPROFILE_HANDLER_PUSH +#define WIDGETPROFILE_HANDLER_QUIT +#endif + +/* resolving type and instance arguments into x_xargs */ +static char *widget_propsresolver(t_pd *owner, int ac, t_atom *av) +{ + t_widget *x = (t_widget *)owner; + int len; + scriptlet_reset(x->x_auxscript); + if (scriptlet_add(x->x_auxscript, 1, 0, ac, av)) + return (scriptlet_getcontents(x->x_auxscript, &len)); + else + return (0); +} + +static t_canvas *widget_cvhook(t_pd *caller) +{ + return (glist_getcanvas(((t_widget *)caller)->x_glist)); +} + +/* LATER move to scriptlet.c, use the scriptlet interface (.^) */ +static t_symbol *widget_getcvpathname(t_widget *x, t_glist *glist) +{ + t_canvas *cv; + if (glist && glist != x->x_glist) + { + loudbug_bug("widget_getcvpathname"); + x->x_glist = glist; + } + cv = glist_getcanvas(x->x_glist); + if (cv == x->x_glist) + return (x->x_cvpathname); /* we are not in a gop */ + else + { + char buf[32]; + sprintf(buf, ".x%x.c", (int)cv); + return (gensym(buf)); + } +} + +/* LATER use the scriptlet interface (.-) */ +static t_symbol *widget_getmypathname(t_widget *x, t_glist *glist) +{ + char buf[64]; + t_symbol *cvpathname = widget_getcvpathname(x, glist); + sprintf(buf, "%s.%s%x", cvpathname->s_name, x->x_name->s_name, (int)x); + return (gensym(buf)); +} + +/* If Tk widget creation fails, gui will send the '_failure' message + to the Pd widget object, asking the receiving object to transform + itself into a regular text object. Due to the 'bindlist' corruption + danger, this cannot be done directly from the '_failure' call, but + has to be scheduled through a 'transclock', instead. When the clock + fires, the widget object creates, and glist_adds a 'makeshift' text + object, then glist_deletes itself. */ + +/* this lock prevents glist_noselect() from reevaluating failure boxes */ +static int widget_transforming = 0; + +/* LATER also bind this to F4 or something */ +static void widget_transtick(t_widget *x) +{ + t_text *newt, *oldt = (t_text *)x; + t_binbuf *bb = binbuf_new(); + int nopt, nhnd, narg; + t_atom *opt = props_getall(x->x_options, &nopt); + t_atom *hnd = props_getall(x->x_handlers, &nhnd); + t_atom *arg = props_getall(x->x_arguments, &narg); + if (widget_transforming++) + loudbug_bug("widget_transtick"); + binbuf_addv(bb, "sss", gensym("widget"), x->x_type, x->x_name); + if (narg) binbuf_add(bb, narg, arg); + if (nopt) binbuf_add(bb, nopt, opt); + if (nhnd) binbuf_add(bb, nhnd, hnd); + canvas_setcurrent(x->x_glist); + newt = (t_text *)pd_new(makeshift_class); + newt->te_width = 0; + newt->te_type = T_OBJECT; + newt->te_binbuf = bb; + newt->te_xpix = oldt->te_xpix; + newt->te_ypix = oldt->te_ypix; + outlet_new(newt, &s_); + inlet_new(newt, &newt->ob_pd, &s_, &s_); + /* LATER preserve connections (although connected widget is a bad thing) */ + glist_add(x->x_glist, &newt->te_g); + if (glist_isvisible(x->x_glist)) + { + glist_noselect(x->x_glist); + glist_select(x->x_glist, &newt->te_g); + gobj_activate(&newt->te_g, x->x_glist, 1); + x->x_glist->gl_editor->e_textdirty = 1; /* force evaluation */ + } + canvas_unsetcurrent(x->x_glist); + canvas_dirty(x->x_glist, 1); + glist_delete(x->x_glist, (t_gobj *)x); + widget_transforming--; +} + +/* FIXME x_glist field validation against glist parameter (all handlers) */ + +static void widget_getrect(t_gobj *z, t_glist *glist, + int *xp1, int *yp1, int *xp2, int *yp2) +{ + t_widget *x = (t_widget *)z; + float x1, y1, x2, y2; + x1 = text_xpix((t_text *)x, glist); + y1 = text_ypix((t_text *)x, glist); + x2 = x1 + x->x_width; + y2 = y1 + x->x_height; + *xp1 = x1; + *yp1 = y1; + *xp2 = x2; + *yp2 = y2; +} + +static void widget_displace(t_gobj *z, t_glist *glist, int dx, int dy) +{ + t_widget *x = (t_widget *)z; + t_text *t = (t_text *)z; +#if 0 + loudbug_post("displace %d %d (%d %d -> %d %d)", + dx, dy, t->te_xpix, t->te_ypix, + t->te_xpix + dx, t->te_ypix + dy); +#endif + t->te_xpix += dx; + t->te_ypix += dy; + if (glist_isvisible(glist)) + sys_vgui("%s move %s %d %d\n", widget_getcvpathname(x, glist)->s_name, + x->x_cbtarget->s_name, dx, dy); + canvas_fixlinesfor(glist, t); +} + +/* LATER handle subitems */ +static void widget_select(t_gobj *z, t_glist *glist, int flag) +{ + t_widget *x = (t_widget *)z; + char *mypathname = widget_getmypathname(x, glist)->s_name; + if (flag) + { + sys_vgui("%s config -bg blue\n", mypathname); + sys_vgui("event generate %s <<disable>>\n", mypathname); + x->x_selected = 1; + } + else + { + if (x->x_disabled) + sys_vgui("%s config -bg %s\n", mypathname, + (x->x_background ? x->x_background->s_name : "gray")); + else + sys_vgui("%s config -bg %s \n", mypathname, + (x->x_background ? x->x_background->s_name : "gray")); + sys_vgui("event generate %s <<enable>>\n", mypathname); + x->x_selected = 0; + } +} + +static void widget_delete(t_gobj *z, t_glist *glist) +{ + canvas_deletelinesfor(glist, (t_text *)z); +} + +static void widget_pushoptions(t_widget *x, int doit) +{ + char *mypathname = widget_getmypathname(x, x->x_glist)->s_name; + if (scriptlet_evaluate(x->x_optscript, x->x_transient, 0, 0, 0, x->x_xargs)) + { +#ifdef WIDGET_DEBUG + int sz; + char *dp = scriptlet_getcontents(x->x_transient, &sz); + loudbug_post("vis: \"%s\"", dp); +#endif + if (doit) + { + sys_vgui("%s config ", mypathname); + scriptlet_push(x->x_transient); + } + else scriptlet_vpush(x->x_transient, "itemoptions"); + } + else if (!scriptlet_isempty(x->x_optscript)) + loudbug_bug("widget_pushoptions"); +} + +static void widget_pushonehook(t_widget *x, t_scriptlet *sp, char *vname) +{ + if (scriptlet_evaluate(sp, x->x_transient, 0, 0, 0, x->x_xargs)) + scriptlet_vpush(x->x_transient, vname); + else if (!scriptlet_isempty(sp)) + loudbug_bug("widget_pushonehook (%s)", vname); +} + +static void widget_pushvishooks(t_widget *x) +{ + if (widgettype_isdefined(x->x_typedef)) + { + t_widgethandlers *wh = widgettype_getscripts(x->x_typedef); + widget_pushonehook(x, widgethandlers_getvis(wh), "longvishook"); + } + widget_pushonehook(x, widgethandlers_getvis(x->x_hooks), "shortvishook"); +} + +static void widget_pushnewhooks(t_widget *x) +{ + /* LATER master constructor */ + if (widgettype_isdefined(x->x_typedef)) + { + t_widgethandlers *wh = widgettype_getscripts(x->x_typedef); + widget_pushonehook(x, widgethandlers_getnew(wh), "longnewhook"); + } + widget_pushonehook(x, widgethandlers_getnew(x->x_hooks), "shortnewhook"); +} + +static void widget_pushfreehooks(t_widget *x) +{ + /* LATER master destructor */ + if (widgettype_isdefined(x->x_typedef)) + { + t_widgethandlers *wh = widgettype_getscripts(x->x_typedef); + widget_pushonehook(x, widgethandlers_getfree(wh), "longfreehook"); + } + widget_pushonehook(x, widgethandlers_getfree(x->x_hooks), "shortfreehook"); +} + +static void widget_pushdatahooks(t_widget *x, int ac, t_atom *av) +{ + t_scriptlet *sp; + WIDGETPROFILE_HANDLER_ENTER; + if (!widgettype_isdefined(x->x_typedef) + || !(sp = widgethandlers_getdata(widgettype_getscripts(x->x_typedef))) + || scriptlet_isempty(sp)) + sp = widgethandlers_getdata(x->x_hooks); + if (sp) + { + WIDGETPROFILE_HANDLER_EVAL; + if (scriptlet_evaluate(sp, x->x_transient, 0, ac, av, x->x_xargs)) + { + WIDGETPROFILE_HANDLER_PUSH; + scriptlet_push(x->x_transient); + } + else if (!scriptlet_isempty(sp)) + loudbug_bug("widget_pushdatahooks (%s)", + (sp == widgethandlers_getdata(x->x_hooks) ? + "short" : "long")); + } + WIDGETPROFILE_HANDLER_QUIT; +} + +static void widget_getconfig(t_widget *x) +{ + sys_vgui("::toxy::item_getconfig %s %s\n", + widget_getmypathname(x, x->x_glist)->s_name, + x->x_cbtarget->s_name); +} + +static void widget_vis(t_gobj *z, t_glist *glist, int vis) +{ + t_widget *x = (t_widget *)z; + t_text *t = (t_text *)z; + char *cvpathname = widget_getcvpathname(x, glist)->s_name; + char *mypathname = widget_getmypathname(x, glist)->s_name; + x->x_update = WIDGET_NOVIS; + if (vis) + { + float px1 = text_xpix((t_text *)x, glist); + float py1 = text_ypix((t_text *)x, glist); +#ifndef PD_MINOR_VERSION + rtext_new(glist, t, glist->gl_editor->e_rtext, 0); +#endif + widget_pushoptions(x, 0); + widget_pushvishooks(x); + if (!x->x_constructed) + { + widget_pushnewhooks(x); + x->x_constructed = 1; + } + sys_vgui("::toxy::item_vis %s %s %s %s %s %s %g %g\n", + x->x_tkclass->s_name, mypathname, + x->x_cbtarget->s_name, x->x_name->s_name, + x->x_varname->s_name, cvpathname, px1, py1); + x->x_vised = 1; + } + else + { +#ifndef PD_MINOR_VERSION + t_rtext *rt = glist_findrtext(glist, t); + if (rt) rtext_free(rt); +#endif + x->x_vised = 0; + } +} + +static void widget_save(t_gobj *z, t_binbuf *bb) +{ + t_widget *x = (t_widget *)z; + t_text *t = (t_text *)x; + int nopt, nhnd, narg; + t_atom *opt = props_getall(x->x_options, &nopt); + t_atom *hnd = props_getall(x->x_handlers, &nhnd); + t_atom *arg = props_getall(x->x_arguments, &narg); + binbuf_addv(bb, "ssiisss", gensym("#X"), gensym("obj"), + (int)t->te_xpix, (int)t->te_ypix, + atom_getsymbol(binbuf_getvec(t->te_binbuf)), + x->x_type, x->x_name); + if (narg) binbuf_add(bb, narg, arg); + if (nopt) binbuf_add(bb, nopt, opt); + if (nhnd) binbuf_add(bb, nhnd, hnd); + binbuf_addsemi(bb); +} + +static void widget_editorappend(t_widget *x, t_props *pp) +{ + int ac; + t_atom *ap; + if (ap = props_getfirst(pp, &ac)) + { + if (pp != x->x_diffoptions) + hammereditor_append(x->x_filehandle, "\n"); + do + { + int nleft; + char buf[MAXPDSTRING + 1], *head; + buf[MAXPDSTRING] = 0; + scriptlet_reset(x->x_auxscript); + scriptlet_add(x->x_auxscript, 0, 0, ac, ap); + head = scriptlet_getcontents(x->x_auxscript, &nleft); + while (nleft > 0) + { + if (nleft > MAXPDSTRING) + { + strncpy(buf, head, MAXPDSTRING); + head += MAXPDSTRING; + nleft -= MAXPDSTRING; + } + else + { + strncpy(buf, head, nleft); + buf[nleft] = 0; + nleft = 0; + } + hammereditor_append(x->x_filehandle, buf); + } + hammereditor_append(x->x_filehandle, "\n"); + } + while (ap = props_getnext(pp, &ac)); + } +} + +static void widget_properties(t_gobj *z, t_glist *glist) +{ + t_widget *x = (t_widget *)z; + char buf[MAXPDSTRING]; + sprintf(buf, "%s %s", x->x_type->s_name, x->x_name->s_name); + hammereditor_open(x->x_filehandle, buf, 0); + widget_editorappend(x, x->x_diffoptions); + widget_editorappend(x, x->x_options); + widget_editorappend(x, x->x_diffhandlers); + widget_editorappend(x, x->x_handlers); + widget_editorappend(x, x->x_diffarguments); + widget_editorappend(x, x->x_arguments); + hammereditor_setdirty(x->x_filehandle, 0); +} + +static t_widgetbehavior widget_behavior = +{ + widget_getrect, + widget_displace, + widget_select, + 0, + widget_delete, + widget_vis, + 0, + FORKY_WIDGETPADDING +}; + +static void widget_novis(t_widget *x) +{ + sys_vgui("::toxy::item_destroy %s %s\n", + widget_getmypathname(x, x->x_glist)->s_name, x->x_varname->s_name); +} + +static void widget_update(t_widget *x, t_props *op) +{ + if (op == x->x_options) + { + t_atom *ap; + int ac; + props_diff(x->x_diffoptions, + widgettype_getoptions(x->x_typedef), x->x_options); + scriptlet_reset(x->x_optscript); + ap = props_getall(x->x_diffoptions, &ac); + if (ac) scriptlet_add(x->x_optscript, 0, 0, ac, ap); + ap = props_getall(x->x_options, &ac); + if (ac) scriptlet_add(x->x_optscript, 0, 0, ac, ap); + if (x->x_update && + glist_isvisible(x->x_glist)) /* FIXME the condition */ + { + if (x->x_update == WIDGET_REVIS) + { + widget_novis(x); + widget_vis((t_gobj *)x, x->x_glist, 1); + } + else if (x->x_update == WIDGET_PUSHVIS) + { + widget_pushoptions(x, 1); + widget_getconfig(x); + } + x->x_update = WIDGET_NOVIS; + } + } + else if (op == x->x_handlers) + { + props_diff(x->x_diffhandlers, + widgettype_gethandlers(x->x_typedef), x->x_handlers); + /* This is the only point where mirroring of handlers is performed. + We get here both during construction, and after any change + in our handlers -- the mirror never stales. */ + widgethandlers_reset(x->x_hooks); + widgethandlers_fill(x->x_hooks, x->x_diffhandlers); + widgethandlers_fill(x->x_hooks, x->x_handlers); + } + else if (op == x->x_arguments) + { + props_diff(x->x_diffarguments, + widgettype_getarguments(x->x_typedef), x->x_arguments); + props_clearvalues(x->x_xargs); + props_clonevalues(x->x_xargs, x->x_diffarguments); + props_clonevalues(x->x_xargs, x->x_arguments); + } +} + +static t_symbol *widget_addprops(t_widget *x, t_props *op, + int single, t_props *filter, + t_symbol *s, int ac, t_atom *av) +{ + if (op) + { + t_symbol *empty; + empty = props_add(op, single, filter, s, ac, av); + if (empty) + loud_error((t_pd *)x, "no value given for %s '%s'", + props_getname(op), empty->s_name); + widget_update(x, op); + return (empty); + } + else + { + loudbug_bug("widget_addprops"); + return (0); + } +} + +static t_symbol *widget_addmessage(t_widget *x, int unique, + t_symbol *s, int ac, t_atom *av) +{ + t_symbol *empty; + if (s) + { + /* FIXME mixed messages */ + if (*s->s_name == '-') + x->x_update = WIDGET_PUSHVIS; + else if (*s->s_name == '#') + x->x_update = WIDGET_REVIS; + else + x->x_update = WIDGET_NOVIS; + } + /* Instance-type duplicates are not removed, unless 'unique' is set. + If it is set, we are called from editorhook, so we assume duplicates + were not specified explicitly. In other cases we keep duplicates, + because type may change until next time this widget is created or + refreshed. */ + if (!(empty = widget_addprops(x, x->x_arguments, 0, + (unique ? x->x_diffarguments : 0), + s, ac, av)) && + !(empty = widget_addprops(x, x->x_handlers, 0, + (unique ? x->x_diffhandlers : 0), + s, ac, av))) + empty = widget_addprops(x, x->x_options, 0, + (unique ? x->x_diffoptions : 0), + s, ac, av); + return (empty); +} + +static void widget_anything(t_widget *x, t_symbol *s, int ac, t_atom *av) +{ + if (s && s != &s_) + { + if (*s->s_name == '-' || *s->s_name == '@' || *s->s_name == '#') + { + t_symbol *empty; + if (empty = widget_addmessage(x, 0, s, ac, av)) + loud_errand((t_pd *)x, + "(use 'remove %s' if that is what you want).", + empty->s_name); + } + else + { + /* FIXME use long defs too, cf widget_pushdatahooks() */ + t_scriptlet *sp; + WIDGETPROFILE_HANDLER_ENTER; + if (sp = widgethandlers_getother(x->x_hooks, s)) + { + WIDGETPROFILE_HANDLER_EVAL; + if (scriptlet_evaluate(sp, x->x_transient, + 1, ac, av, x->x_xargs)) + { + WIDGETPROFILE_HANDLER_PUSH; + scriptlet_push(x->x_transient); + } + else if (!scriptlet_isempty(sp)) + loudbug_bug("widget_anything"); + } + else if (s == widgetps_vis || s == widgetps_new || + s == widgetps_free || s == widgetps_data) + loud_error((t_pd *)x, + "explicit call of the special handler \"%s\"", + s->s_name); + else + loud_nomethod((t_pd *)x, s); + WIDGETPROFILE_HANDLER_QUIT; + } + } +} + +/* FIXME use long defs too, cf widget_pushdatahooks() */ +static void widget_bang(t_widget *x) +{ + t_scriptlet *sp; + WIDGETPROFILE_HANDLER_ENTER; + sp = widgethandlers_getbang(x->x_hooks); + WIDGETPROFILE_HANDLER_EVAL; + if (scriptlet_evaluate(sp, x->x_transient, 1, 0, 0, x->x_xargs)) + { + WIDGETPROFILE_HANDLER_PUSH; + scriptlet_push(x->x_transient); + } + else if (!scriptlet_isempty(sp)) + loudbug_bug("widget_bang"); + WIDGETPROFILE_HANDLER_QUIT; +} + +/* FIXME use long defs too, cf widget_pushdatahooks() */ +static void widget_float(t_widget *x, t_float f) +{ + t_scriptlet *sp; + t_atom at; + WIDGETPROFILE_HANDLER_ENTER; + sp = widgethandlers_getfloat(x->x_hooks); + WIDGETPROFILE_HANDLER_EVAL; + SETFLOAT(&at, f); + if (scriptlet_evaluate(sp, x->x_transient, 1, 1, &at, x->x_xargs)) + { + WIDGETPROFILE_HANDLER_PUSH; + scriptlet_push(x->x_transient); + } + else if (!scriptlet_isempty(sp)) + loudbug_bug("widget_float"); + WIDGETPROFILE_HANDLER_QUIT; +} + +/* FIXME use long defs too, cf widget_pushdatahooks() */ +static void widget_symbol(t_widget *x, t_symbol *s) +{ + t_scriptlet *sp; + t_atom at; + WIDGETPROFILE_HANDLER_ENTER; + sp = widgethandlers_getsymbol(x->x_hooks); + WIDGETPROFILE_HANDLER_EVAL; + SETSYMBOL(&at, s); + if (scriptlet_evaluate(sp, x->x_transient, 1, 1, &at, x->x_xargs)) + { + WIDGETPROFILE_HANDLER_PUSH; + scriptlet_push(x->x_transient); + } + else if (!scriptlet_isempty(sp)) + loudbug_bug("widget_symbol"); + WIDGETPROFILE_HANDLER_QUIT; +} + +static void widget_set(t_widget *x, t_symbol *s, int ac, t_atom *av) +{ + t_symbol *prp; + if (ac && av->a_type == A_SYMBOL && (prp = av->a_w.w_symbol)) + { + t_symbol *empty = 0; + ac--; av++; + if (*prp->s_name == '-') + { + x->x_update = WIDGET_PUSHVIS; + empty = widget_addprops(x, x->x_options, 1, 0, prp, ac, av); + } + else if (*prp->s_name == '@') + empty = widget_addprops(x, x->x_handlers, 1, 0, prp, ac, av); + else if (*prp->s_name == '#') + empty = widget_addprops(x, x->x_arguments, 1, 0, prp, ac, av); + if (empty) + loud_errand((t_pd *)x, + "(use 'remove %s' if that is what you want).", + empty->s_name); + } + else loud_messarg((t_pd *)x, s); +} + +static void widget_remove(t_widget *x, t_symbol *s) +{ + if (s) + { + t_props *op; + if (*s->s_name == '-') + op = x->x_options; + else if (*s->s_name == '@') + op = x->x_handlers; + else if (*s->s_name == '#') + op = x->x_arguments; + else + op = 0; + if (op && props_remove(op, s)) + { + if (op == x->x_options) /* LATER rethink */ + x->x_update = WIDGET_REVIS; + widget_update(x, op); + } + else loud_warning((t_pd *)x, 0, "%s %s has not been specified", + props_getname(op), s->s_name); + } +} + +static void widget_tot(t_widget *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac) + { + scriptlet_reset(x->x_auxscript); + scriptlet_add(x->x_auxscript, 1, 1, ac, av); + if (scriptlet_evaluate(x->x_auxscript, x->x_transient, 1, + 0, 0, x->x_xargs)) + scriptlet_push(x->x_transient); + } +} + +static void widget_refresh(t_widget *x) +{ + x->x_update = WIDGET_REVIS; + widget_update(x, x->x_arguments); + widget_update(x, x->x_handlers); + widget_update(x, x->x_options); +} + +static int widget_resettype(t_widget *x, t_widgettype *wt) +{ + if (!wt || /* LATER rethink, cf widgettype_reload() */ + wt == x->x_typedef) + { + widget_pushfreehooks(x); + if (!(x->x_tkclass = widgettype_tkclass(x->x_typedef))) + x->x_tkclass = x->x_type; + x->x_update = WIDGET_REVIS; + widget_update(x, x->x_arguments); + widget_pushnewhooks(x); + widget_update(x, x->x_handlers); + widget_update(x, x->x_options); + return (1); + } + else + { + loudbug_bug("widget_resettype"); + return (0); + } +} + +static void widget_redefine(t_widget *x) +{ + widget_resettype(x, widgettype_reload(x->x_type, x->x_glist)); +} + +static void widget_editorhook(t_pd *z, t_symbol *s, int ac, t_atom *av) +{ + t_widget *x = (t_widget *)z; + props_clearall(x->x_options); + widget_addmessage(x, 1, 0, ac, av); + widget_refresh(x); +} + +static void widget__failure(t_widget *x) +{ + loud_error((t_pd *)x, "creation failure"); + /* details printed at the gui side, in order to support special chars + in error message */ + loud_errand((t_pd *)x, "see standard error for details"); + x->x_vised = 0; + clock_delay(x->x_transclock, 0); +} + +/* LATER handle subitems */ +static void widget__config(t_widget *x, t_symbol *target, t_symbol *bg, + t_floatarg fw, t_floatarg fh, t_floatarg fst) +{ +#ifdef WIDGET_DEBUG + loudbug_post("config %x %s \"%s\" %g %g", + (int)x, target->s_name, bg->s_name, fw, fh); +#endif + x->x_width = (int)fw; + x->x_height = (int)fh; + if (bg != &s_) x->x_background = bg; + x->x_hasstate = ((int)fst == 0); + canvas_fixlinesfor(x->x_glist, (t_text *)x); /* FIXME */ +} + +/* FIXME this is only a template */ +static void widget__data(t_widget *x, t_symbol *s, int ac, t_atom *av) +{ +#ifdef WIDGET_DEBUG + loudbug_startpost("_data:"); + loudbug_postatom(ac, av); + loudbug_endpost(); +#endif + if (ac && av->a_type == A_SYMBOL) + { + s = av->a_w.w_symbol; + if (s == widgetps_add) + { + widget_pushdatahooks(x, ac, av); + } + else if (s == widgetps_delete) + { + widget_pushdatahooks(x, ac, av); + } + else if (s == widgetps_set) + { + widget_pushdatahooks(x, ac, av); + } + else if (s == widgetps_get) + { + widget_pushdatahooks(x, ac, av); + } + else loud_error((t_pd *)x, + "invalid \"_data\" subcommand \"%s\"", s->s_name); + } + else loud_error((t_pd *)x, "missing \"_data\" subcommand"); +} + +static void widget__callback(t_widget *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac == 1) + { + if (av->a_type == A_FLOAT) + outlet_float(((t_object *)x)->ob_outlet, av->a_w.w_float); + else if (av->a_type == A_SYMBOL) + outlet_symbol(((t_object *)x)->ob_outlet, av->a_w.w_symbol); + } + else if (ac) + { + if (av->a_type == A_FLOAT) + outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, av); + else if (av->a_type == A_SYMBOL) + outlet_anything(((t_object *)x)->ob_outlet, + av->a_w.w_symbol, ac - 1, av + 1); + } + else outlet_bang(((t_object *)x)->ob_outlet); +} + +/* see also widget_select() */ +/* LATER handle subitems */ +static void widget__inout(t_widget *x, t_floatarg f) +{ + int disable = (int)f && x->x_glist->gl_edit; + if (x->x_disabled) + { + if (!disable) + { + if (!x->x_selected) + { + char *mypathname = widget_getmypathname(x, x->x_glist)->s_name; + sys_vgui("event generate %s <<enable>>\n", mypathname); + } + x->x_disabled = 0; + } + } + else if (disable) + { + if (!x->x_selected) + { + char *mypathname = widget_getmypathname(x, x->x_glist)->s_name; + sys_vgui("event generate %s <<disable>>\n", mypathname); + } + x->x_disabled = 1; + } +} + +static void widget__click(t_widget *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac != 4) + { + loud_error((t_pd *)x, "bad arguments to the '%s' method", s->s_name); + return; + } + if (x->x_glist->gl_havewindow) /* LATER calculate on-parent coords */ + { + if (x->x_cvtarget->s_thing) + /* LATER rethink */ + typedmess(x->x_cvtarget->s_thing, widgetps_mouse, ac, av); + else + typedmess((t_pd *)x->x_glist, widgetps_mouse, ac, av); + widget__inout(x, 2.); + } +} + +/* LATER think how to grab the mouse when dragging */ +static void widget__motion(t_widget *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac != 3) + { + loud_error((t_pd *)x, "bad arguments to the '%s' method", s->s_name); + return; + } + if (x->x_glist->gl_havewindow) /* LATER calculate on-parent coords */ + { +#if 0 + loudbug_post("motion %g %g", av[0].a_w.w_float, av[1].a_w.w_float); +#endif + if (x->x_cvtarget->s_thing) + /* LATER rethink */ + typedmess(x->x_cvtarget->s_thing, widgetps_motion, ac, av); + else + typedmess((t_pd *)x->x_glist, widgetps_motion, ac, av); + } +} + +int widget_iswidget(t_gobj *g, t_symbol *type, t_symbol *name) +{ + if (*(t_pd *)g == widget_class) + { + t_widget *x = (t_widget *)g; + return ((!type || type == x->x_type) && + (!name || name == x->x_name)); + } + else return (0); +} + +#ifdef WIDGET_DEBUG +static void widgetbug_postprops(char *msg, t_props *pp) +{ + int ac; + t_atom *av = props_getall(pp, &ac); + if (av) + { + loudbug_startpost(msg); + loudbug_postatom(ac, av); + loudbug_endpost(); + } +} + +static void widget_debug(t_widget *x) +{ + t_widgethandlers *wh = widgettype_getscripts(x->x_typedef); + t_symbol *pn = widget_getcvpathname(x, 0); + t_symbol *mn = widget_getmypathname(x, 0); + int sz, i, nopt; + t_atom *ap; + static char bempty[] = "<empty>"; + char *bp, *key; + loudbug_post("containing glist: %x", (int)x->x_glist); + loudbug_post("cv pathname%s %s", + (pn ? ":" : ""), (pn ? pn->s_name : "unknown")); + loudbug_post("my pathname%s %s", + (mn ? ":" : ""), (mn ? mn->s_name : "unknown")); + widgetbug_postprops("default options:", + widgettype_getoptions(x->x_typedef)); + widgetbug_postprops("instance options:", x->x_options); + widgetbug_postprops("diff options:", x->x_diffoptions); + widgetbug_postprops("default handlers:", + widgettype_gethandlers(x->x_typedef)); + widgetbug_postprops("instance handlers:", x->x_handlers); + widgetbug_postprops("diff handlers:", x->x_diffhandlers); + widgetbug_postprops("default arguments:", + widgettype_getarguments(x->x_typedef)); + widgetbug_postprops("instance arguments:", x->x_arguments); + widgetbug_postprops("diff arguments:", x->x_diffarguments); + loudbug_post("dictionary:"); + bp = props_firstvalue(x->x_xargs, &key); + while (bp) + { + loudbug_post("\t%s: \"%s\"", key, bp); + bp = props_nextvalue(x->x_xargs, &key); + } + bp = scriptlet_getcontents(x->x_transient, &sz); + loudbug_post("transient buffer (size %d):\n\"%s\"", sz, (bp ? bp : bempty)); + bp = scriptlet_getcontents(x->x_optscript, &sz); + loudbug_post("option buffer (size %d):\n\"%s\"", sz, (bp ? bp : bempty)); + + bp = scriptlet_getcontents(widgethandlers_getnew(wh), &sz); + loudbug_post("long newhook (size %d):\n\"%s\"", sz, (bp ? bp : bempty)); + bp = scriptlet_getcontents(widgethandlers_getfree(wh), &sz); + loudbug_post("long freehook (size %d):\n\"%s\"", sz, (bp ? bp : bempty)); + bp = scriptlet_getcontents(widgethandlers_getdata(wh), &sz); + loudbug_post("long datahook (size %d):\n\"%s\"", sz, (bp ? bp : bempty)); + + bp = scriptlet_getcontents(widgethandlers_getvis(wh), &sz); + loudbug_post("long vishook (size %d):\n\"%s\"", sz, (bp ? bp : bempty)); + bp = scriptlet_getcontents(widgethandlers_getvis(x->x_hooks), &sz); + loudbug_post("short vishook (size %d):\n\"%s\"", + sz, (bp ? bp : bempty)); + + bp = masterwidget_getcontents(&sz); + loudbug_post("setup definitions (size %d):\n\"%s\"", + sz, (bp ? bp : bempty)); +} +#endif + +static void widget_attach(t_widget *x); +static void widget_detach(t_widget *x); + +/* FIXME for all gui objects use a single sink (with a single clock) */ +static void gui_unbind(t_pd *x, t_symbol *s) +{ + t_guiconnect *gc = guiconnect_new(0, s); + guiconnect_notarget(gc, 1000.); + pd_unbind(x, s); +} + +static void widget_free(t_widget *x) +{ + widget_novis(x); + widget_pushfreehooks(x); + gui_unbind((t_pd *)x, x->x_cbtarget); + gui_unbind((t_pd *)x, x->x_rptarget); + widgethandlers_free(x->x_hooks); + props_freeall(x->x_options); + props_freeall(x->x_xargs); + props_freeall(x->x_diffoptions); + scriptlet_free(x->x_optscript); + scriptlet_free(x->x_auxscript); + scriptlet_free(x->x_transient); + hammerfile_free(x->x_filehandle); + if (x->x_transclock) clock_free(x->x_transclock); + widget_detach(x); +} + +static void *widget_new(t_symbol *s, int ac, t_atom *av) +{ + t_widget *x; + t_symbol *type = 0, *name = 0; + char buf[MAXPDSTRING]; + if (widget_transforming) + return (0); + masterwidget_validate(); + if (ac && av->a_type == A_SYMBOL) + { + type = av->a_w.w_symbol; + ac--; av++; + } + if (ac && av->a_type == A_SYMBOL) + { + name = av->a_w.w_symbol; + ac--; av++; + } + /* LATER think about anonymous widgets (single arg, or '.') */ + if (!type || type == &s_ || !name || name == &s_) + { + loud_error(0, "bad arguments for a widget"); + loud_errand(0, "expecting \"widget <type> <name> [properties]\""); + return (0); + } + + x = (t_widget *)pd_new(widget_class); + x->x_type = type; + x->x_name = name; + + sprintf(buf, "%s%x", x->x_name->s_name, (int)x); + pd_bind((t_pd *)x, x->x_cbtarget = gensym(buf)); + sprintf(buf, "%s%x.rp", x->x_name->s_name, (int)x); + pd_bind((t_pd *)x, x->x_rptarget = gensym(buf)); + + x->x_glist = canvas_getcurrent(); + x->x_typedef = widgettype_get(x->x_type, 0, 0, x->x_glist); + if (!(x->x_tkclass = widgettype_tkclass(x->x_typedef))) + x->x_tkclass = x->x_type; + + sprintf(buf, ".x%x.c", (int)x->x_glist); + x->x_cvpathname = gensym(buf); + sprintf(buf, ".x%x", (int)x->x_glist); + x->x_cvtarget = gensym(buf); + sprintf(buf, "::toxy::v%x", (int)x); + x->x_varname = gensym(buf); + + x->x_auxscript = scriptlet_new((t_pd *)x, x->x_rptarget, x->x_cbtarget, + x->x_name, x->x_glist, widget_cvhook); + x->x_transient = scriptlet_newalike(x->x_auxscript); + x->x_optscript = scriptlet_newalike(x->x_auxscript); + + x->x_options = props_new((t_pd *)x, "option", "-", 0, 0); + x->x_handlers = props_new((t_pd *)x, "handler", "@", x->x_options, 0); + x->x_arguments = props_new((t_pd *)x, "argument", "#", x->x_options, 0); + x->x_xargs = props_new((t_pd *)x, "argument", "#", 0, widget_propsresolver); + x->x_diffoptions = props_new((t_pd *)x, "option", "-", 0, 0); + x->x_diffhandlers = props_new((t_pd *)x, "handler", "@", + x->x_diffoptions, 0); + x->x_diffarguments = props_new((t_pd *)x, "argument", "#", + x->x_diffoptions, 0); + + x->x_hooks = widgethandlers_new(x->x_auxscript); + + outlet_new((t_object *)x, &s_anything); + /* LATER consider estimating these, based on widget class and options. + The default used to be 50x50, which confused people wanting widgets + in small gops, of size exactly as specified by the 'coords' message, + but finding gops stretched, to accomodate the widget's default area. */ + x->x_width = 5; + x->x_height = 5; + x->x_filehandle = hammerfile_new((t_pd *)x, 0, 0, 0, widget_editorhook); + x->x_transclock = clock_new(x, (t_method)widget_transtick); + x->x_background = 0; + x->x_hasstate = 0; + x->x_update = WIDGET_NOVIS; + x->x_disabled = 0; + x->x_vised = 0; + widget_attach(x); + widget_addmessage(x, 0, 0, ac, av); + x->x_constructed = 0; + return (x); +} + +static t_glist *tow_getglist(t_tow *x, int complain) +{ + t_glist *glist = (x->x_cvremote ? + (t_glist *)pd_findbyclass(x->x_cvremote, canvas_class) : + x->x_targetglist); + if (!glist && x->x_cvname && complain) + loud_error((t_pd *)x, "bad canvas name '%s'", x->x_cvname->s_name); + return (glist); +} + +static void tow_widgetattach(t_tow *x, t_widget *w) +{ + t_towentry *te = getbytes(sizeof(*te)); + t_widgetentry *we = getbytes(sizeof(*we)); + te->te_tow = x; + te->te_next = w->x_towlist; + w->x_towlist = te; + we->we_widget = w; + we->we_next = x->x_widgetlist; + x->x_widgetlist = we; + pd_bind((t_pd *)x, w->x_cbtarget); +#ifdef TOW_DEBUG + loudbug_post("%s widget '%s' attached", + w->x_type->s_name, w->x_cbtarget->s_name); +#endif +} + +static void tow_widgetdetach(t_tow *x, t_widget *w) +{ + t_widgetentry *we1, *we2; + for (we1 = 0, we2 = x->x_widgetlist; we2; we2 = we2->we_next) + { + if (we2->we_widget == w) + { +#ifdef TOW_DEBUG + loudbug_post("%s widget '%s' detached by widget's destructor", + w->x_type->s_name, w->x_cbtarget->s_name); +#endif + pd_unbind((t_pd *)x, w->x_cbtarget); + if (we1) + we1->we_next = we2->we_next; + else + x->x_widgetlist = we2->we_next; + freebytes(we2, sizeof(*we2)); + return; + } + we1 = we2; + } + loudbug_bug("tow_widgetdetach"); +} + +static void widget_attach(t_widget *x) +{ + t_tow *t; + for (t = widget_towlist; t; t = t->x_next) + if (x->x_glist == tow_getglist(t, 0) && + t->x_type == x->x_type && t->x_name == x->x_name) + tow_widgetattach(t, x); +} + +static void widget_detach(t_widget *x) +{ + t_towentry *te; + while (te = x->x_towlist) + { + x->x_towlist = te->te_next; + tow_widgetdetach(te->te_tow, x); + freebytes(te, sizeof(*te)); + } +} + +static void tow_attach(t_tow *x) +{ + t_glist *glist = tow_getglist(x, 0); + if (glist) + { + t_gobj *g; + for (g = glist->gl_list; g; g = g->g_next) + { + if (*(t_pd *)g == widget_class) + { + t_widget *w = (t_widget *)g; + if (w->x_type == x->x_type && w->x_name == x->x_name) + tow_widgetattach(x, w); + } + } +#ifdef TOW_DEBUG + if (!x->x_widgetlist) + loudbug_post("%s widget '%s' not found", + x->x_type->s_name, x->x_name->s_name); +#endif + } +#ifdef TOW_DEBUG + else if (x->x_cvname) + loudbug_post("glist '%s' not found", x->x_cvname->s_name); +#endif +} + +static void tow_detach(t_tow *x) +{ + t_widgetentry *we; + while (we = x->x_widgetlist) + { + t_widget *w = we->we_widget; + t_towentry *te1, *te2; + x->x_widgetlist = we->we_next; + pd_unbind((t_pd *)x, w->x_cbtarget); + freebytes(we, sizeof(*we)); + for (te1 = 0, te2 = w->x_towlist; te2; te2 = te2->te_next) + { + if (te2->te_tow == x) + { +#ifdef TOW_DEBUG + loudbug_post("%s widget '%s' detached by tow's destructor", + w->x_type->s_name, w->x_cbtarget->s_name); +#endif + if (te1) + te1->te_next = te2->te_next; + else + w->x_towlist = te2->te_next; + freebytes(te2, sizeof(*te2)); + break; + } + te1 = te2; + } + if (!te2) loudbug_bug("tow_detach"); + } +} + +static void tow_bang(t_tow *x) +{ + t_widgetentry *we; + for (we = x->x_widgetlist; we; we = we->we_next) + widget_bang(we->we_widget); +} + +static void tow_float(t_tow *x, t_float f) +{ + t_widgetentry *we; + for (we = x->x_widgetlist; we; we = we->we_next) + widget_float(we->we_widget, f); +} + +static void tow_symbol(t_tow *x, t_symbol *s) +{ + t_widgetentry *we; + for (we = x->x_widgetlist; we; we = we->we_next) + widget_symbol(we->we_widget, s); +} + +static void tow_anything(t_tow *x, t_symbol *s, int ac, t_atom *av) +{ + t_widgetentry *we; + for (we = x->x_widgetlist; we; we = we->we_next) + typedmess((t_pd *)we->we_widget, s, ac, av); +} + +static void tow_redefine(t_tow *x) +{ + t_widgettype *wt = widgettype_reload(x->x_type, x->x_glist); + t_widgetentry *we; + for (we = x->x_widgetlist; we; we = we->we_next) + if (!widget_resettype(we->we_widget, wt)) + break; +} + +/* LATER broadcasting: canvas-wide or type-on-canvas-wide */ +static void tow_settarget(t_tow *x, t_symbol *s1, t_symbol *s2, t_symbol *s3) +{ + char buf[64]; + if (s1 == &s_ || !strcmp(s1->s_name, ".")) + s1 = 0; + if (s1 && strcmp(s1->s_name, ".parent")) + { + x->x_cvremote = canvas_makebindsym(x->x_cvname = s1); + x->x_targetglist = 0; + } + else + { + x->x_cvremote = 0; + if (s1) + { + if (x->x_glist->gl_owner) + x->x_targetglist = x->x_glist->gl_owner; + else + { /* The case of a tow pointing out from an abstraction, + targeting its parent, is considered invalid (otherwise, + opening an abstraction as a top-level patch should not be + flagged as error). LATER rethink. */ + loud_error((t_pd *)x, "parent of a top level patch requested,"); + loud_errand((t_pd *)x, "this is a dangling tow..."); + x->x_cvname = 0; + x->x_targetglist = 0; + } + } + else x->x_targetglist = x->x_glist; + } + if (x->x_targetglist) + x->x_cvname = x->x_targetglist->gl_name; + x->x_type = s2; + x->x_name = s3; + tow_attach(x); +} + +static void tow_retarget(t_tow *x, t_symbol *s1, t_symbol *s2, t_symbol *s3) +{ + tow_detach(x); + tow_settarget(x, s1, s2, s3); +} + +static void tow_pwd(t_tow *x, t_symbol *s) +{ + t_glist *glist; + t_symbol *dir; + if (s && s->s_thing && (glist = tow_getglist(x, 1)) && + (dir = canvas_getdir(glist))) + pd_symbol(s->s_thing, dir); +} + +static void tow__callback(t_tow *x, t_symbol *s, int ac, t_atom *av) +{ + if (ac == 1) + { + if (av->a_type == A_FLOAT) + outlet_float(((t_object *)x)->ob_outlet, av->a_w.w_float); + else if (av->a_type == A_SYMBOL) + outlet_symbol(((t_object *)x)->ob_outlet, av->a_w.w_symbol); + } + else if (ac) + { + if (av->a_type == A_FLOAT) + outlet_list(((t_object *)x)->ob_outlet, &s_list, ac, av); + else if (av->a_type == A_SYMBOL) + outlet_anything(((t_object *)x)->ob_outlet, + av->a_w.w_symbol, ac - 1, av + 1); + } + else outlet_bang(((t_object *)x)->ob_outlet); +} + +#ifdef TOW_DEBUG +static void tow_debug(t_tow *x) +{ + t_widgetentry *we; + loudbug_post("attached widgets:"); + for (we = x->x_widgetlist; we; we = we->we_next) + { + t_widget *w = we->we_widget; + t_towentry *te; + int other = 0, found = 0; + loudbug_startpost("\t%s %s", w->x_type->s_name, w->x_cbtarget->s_name); + for (te = w->x_towlist; te; te = te->te_next) + if (te->te_tow == x) + found++; + else + other++; + loudbug_post(" (%d other tow%s)", other, (other == 1 ? "" : "s")); + if (found != 1) + loudbug_bug("listed %d times in widget's towlist", found); + } +} +#endif + +static void tow_free(t_tow *x) +{ + t_tow *t1, *t2; +#ifdef TOW_DEBUG + loudbug_startpost("updating towlist..."); +#endif + for (t1 = 0, t2 = widget_towlist; t2; t2 = t2->x_next) + { + if (t2 == x) + { + if (t1) + t1->x_next = t2->x_next; + else + widget_towlist = t2->x_next; +#ifdef TOW_DEBUG + loudbug_post("ok"); +#endif + break; + } + t1 = t2; + } + tow_detach(x); +} + +static void *tow_new(t_symbol *s1, t_symbol *s2, t_symbol *s3) +{ + t_tow *x = (t_tow *)pd_new(tow_class); + x->x_glist = canvas_getcurrent(); + x->x_targetglist = 0; + x->x_widgetlist = 0; + x->x_next = widget_towlist; + widget_towlist = x; + outlet_new((t_object *)x, &s_anything); + tow_settarget(x, s1, s2, s3); + return (x); +} + +void widget_setup(void) +{ + post("beware! this is widget %s, %s %s build...", + TOXY_VERSION, loud_ordinal(TOXY_BUILD), TOXY_RELEASE); + widgetps_mouse = gensym("mouse"); + widgetps_motion = gensym("motion"); + widgetps_vis = gensym("vis"); + widgetps_new = gensym("new"); + widgetps_free = gensym("free"); + widgetps_data = gensym("data"); + widgetps_add = gensym("add"); + widgetps_delete = gensym("delete"); + widgetps_set = gensym("set"); + widgetps_get = gensym("get"); + widgettype_setup(); + widget_class = class_new(gensym("widget"), + (t_newmethod)widget_new, + (t_method)widget_free, + sizeof(t_widget), 0, A_GIMME, 0); + class_setwidget(widget_class, &widget_behavior); + forky_setsavefn(widget_class, widget_save); + forky_setpropertiesfn(widget_class, widget_properties); + class_addbang(widget_class, widget_bang); + class_addfloat(widget_class, widget_float); + class_addsymbol(widget_class, widget_symbol); + class_addanything(widget_class, widget_anything); + class_addmethod(widget_class, (t_method)widget_set, + gensym("set"), A_GIMME, 0); + class_addmethod(widget_class, (t_method)widget_remove, + gensym("remove"), A_SYMBOL, 0); + class_addmethod(widget_class, (t_method)widget_tot, + gensym("tot"), A_GIMME, 0); + class_addmethod(widget_class, (t_method)widget_refresh, + gensym("refresh"), 0); + class_addmethod(widget_class, (t_method)widget_redefine, + gensym("redefine"), 0); + class_addmethod(widget_class, (t_method)widget__failure, + gensym("_failure"), 0); + class_addmethod(widget_class, (t_method)widget__config, + gensym("_config"), + A_SYMBOL, A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(widget_class, (t_method)widget__data, + gensym("_data"), A_GIMME, 0); + class_addmethod(widget_class, (t_method)widget__callback, + gensym("_cb"), A_GIMME, 0); + class_addmethod(widget_class, (t_method)widget__inout, + gensym("_inout"), A_FLOAT, 0); + class_addmethod(widget_class, (t_method)widget__click, + gensym("_click"), A_GIMME, 0); + class_addmethod(widget_class, (t_method)widget__motion, + gensym("_motion"), A_GIMME, 0); +#ifdef WIDGET_DEBUG + class_addmethod(widget_class, (t_method)widget_debug, + gensym("debug"), 0); +#endif +#ifdef WIDGET_PROFILE + class_addmethod(widget_class, (t_method)widget_profile, + gensym("profile"), 0); +#endif + hammerfile_setup(widget_class, 0); + + makeshift_class = class_new(gensym("text"), 0, 0, + sizeof(t_text), + /* inlet added explicitly (cf text_class) */ + CLASS_NOINLET | CLASS_PATCHABLE, 0); + + tow_class = class_new(gensym("tow"), + (t_newmethod)tow_new, + (t_method)tow_free, + sizeof(t_tow), 0, A_SYMBOL, A_DEFSYM, A_DEFSYM, 0); + class_addbang(tow_class, tow_bang); + class_addfloat(tow_class, tow_float); + class_addsymbol(tow_class, tow_symbol); + class_addanything(tow_class, tow_anything); + class_addmethod(tow_class, (t_method)tow_redefine, + gensym("redefine"), 0); + class_addmethod(tow_class, (t_method)tow_retarget, + gensym("retarget"), A_SYMBOL, A_SYMBOL, A_SYMBOL, 0); + class_addmethod(tow_class, (t_method)tow_pwd, + gensym("pwd"), A_SYMBOL, 0); + class_addmethod(tow_class, (t_method)tow__callback, + gensym("_cb"), A_GIMME, 0); +#ifdef TOW_DEBUG + class_addmethod(tow_class, (t_method)tow_debug, + gensym("debug"), 0); +#endif +} diff --git a/externals/miXed/toxy/widget.h b/externals/miXed/toxy/widget.h new file mode 100644 index 000000000..7481bbcc6 --- /dev/null +++ b/externals/miXed/toxy/widget.h @@ -0,0 +1,46 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#ifndef __WIDGET_H__ +#define __WIDGET_H__ + +EXTERN_STRUCT _widgettype; +#define t_widgettype struct _widgettype + +EXTERN_STRUCT _masterwidget; +#define t_masterwidget struct _masterwidget + +EXTERN_STRUCT _widgethandlers; +#define t_widgethandlers struct _widgethandlers + +t_widgettype *widgettype_find(t_symbol *s); +t_widgettype *widgettype_get(t_symbol *s, char *ver, char *opt, t_glist *glist); +t_widgettype *widgettype_reload(t_symbol *s, t_glist *glist); +int widgettype_isdefined(t_widgettype *wt); +t_symbol *widgettype_tkclass(t_widgettype *wt); +t_props *widgettype_getoptions(t_widgettype *wt); +t_props *widgettype_gethandlers(t_widgettype *wt); +t_props *widgettype_getarguments(t_widgettype *wt); +t_widgethandlers *widgettype_getscripts(t_widgettype *wt); +char *widgettype_propname(t_symbol *s); +void widgettype_setup(void); + +char *masterwidget_getcontents(int *szp); +void masterwidget_validate(void); + +t_widgethandlers *widgethandlers_new(t_scriptlet *generator); +void widgethandlers_free(t_widgethandlers *wh); +void widgethandlers_reset(t_widgethandlers *wh); +void widgethandlers_fill(t_widgethandlers *wh, t_props *pp); +t_scriptlet *widgethandlers_getvis(t_widgethandlers *wh); +t_scriptlet *widgethandlers_getnew(t_widgethandlers *wh); +t_scriptlet *widgethandlers_getfree(t_widgethandlers *wh); +t_scriptlet *widgethandlers_getdata(t_widgethandlers *wh); +t_scriptlet *widgethandlers_getbang(t_widgethandlers *wh); +t_scriptlet *widgethandlers_getfloat(t_widgethandlers *wh); +t_scriptlet *widgethandlers_getsymbol(t_widgethandlers *wh); +t_scriptlet *widgethandlers_getother(t_widgethandlers *wh, t_symbol *selector); +t_scriptlet *widgethandlers_takeany(t_widgethandlers *wh, t_symbol *selector); + +#endif diff --git a/externals/miXed/toxy/widgethandlers.c b/externals/miXed/toxy/widgethandlers.c new file mode 100644 index 000000000..f95ffbaf2 --- /dev/null +++ b/externals/miXed/toxy/widgethandlers.c @@ -0,0 +1,211 @@ +/* Copyright (c) 2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/props.h" +#include "toxy/scriptlet.h" +#include "widget.h" + +#ifdef KRZYSZCZ +//#define WIDGETHANDLERS_DEBUG +#endif + +typedef struct _widgetscript +{ + t_symbol *ws_selector; + t_scriptlet *ws_script; + struct _widgetscript *ws_next; +} t_widgetscript; + +struct _widgethandlers +{ + t_scriptlet *wh_vis; + t_scriptlet *wh_new; + t_scriptlet *wh_free; + t_scriptlet *wh_data; + t_scriptlet *wh_bang; + t_scriptlet *wh_float; + t_scriptlet *wh_symbol; + t_widgetscript *wh_others; +}; + +static t_symbol *widgetps_vis = 0; +static t_symbol *widgetps_new; +static t_symbol *widgetps_free; +static t_symbol *widgetps_data; + +t_widgethandlers *widgethandlers_new(t_scriptlet *generator) +{ + t_widgethandlers *wh = getbytes(sizeof(*wh)); + if (!widgetps_vis) + { + widgetps_vis = gensym("vis"); + widgetps_new = gensym("new"); + widgetps_free = gensym("free"); + widgetps_data = gensym("data"); + } + wh->wh_vis = scriptlet_newalike(generator); + wh->wh_new = scriptlet_newalike(generator); + wh->wh_free = scriptlet_newalike(generator); + wh->wh_data = scriptlet_newalike(generator); + wh->wh_bang = scriptlet_newalike(generator); + wh->wh_float = scriptlet_newalike(generator); + wh->wh_symbol = scriptlet_newalike(generator); + wh->wh_others = 0; + return (wh); +} + +void widgethandlers_free(t_widgethandlers *wh) +{ + t_widgetscript *ws, *wsnext = wh->wh_others; + scriptlet_free(wh->wh_vis); + scriptlet_free(wh->wh_new); + scriptlet_free(wh->wh_free); + scriptlet_free(wh->wh_data); + scriptlet_free(wh->wh_bang); + scriptlet_free(wh->wh_float); + scriptlet_free(wh->wh_symbol); + while (ws = wsnext) + { + wsnext = ws->ws_next; + scriptlet_free(ws->ws_script); + freebytes(ws, sizeof(*ws)); + } + freebytes(wh, sizeof(*wh)); +} + +void widgethandlers_reset(t_widgethandlers *wh) +{ + t_widgetscript *ws = wh->wh_others; + scriptlet_reset(wh->wh_vis); + scriptlet_reset(wh->wh_new); + scriptlet_reset(wh->wh_free); + scriptlet_reset(wh->wh_data); + scriptlet_reset(wh->wh_bang); + scriptlet_reset(wh->wh_float); + scriptlet_reset(wh->wh_symbol); + for (ws = wh->wh_others; ws; ws = ws->ws_next) + scriptlet_reset(ws->ws_script); +} + +static t_widgetscript *widgethandlers_takeotherscript(t_widgethandlers *wh, + t_symbol *selector) +{ + t_widgetscript *ws; + for (ws = wh->wh_others; ws; ws = ws->ws_next) + if (ws->ws_selector == selector) + break; + if (!ws) + { + ws = getbytes(sizeof(*ws)); + ws->ws_selector = selector; + ws->ws_script = scriptlet_newalike(wh->wh_vis); + ws->ws_next = wh->wh_others; + wh->wh_others = ws; + } + return (ws); +} + +t_scriptlet *widgethandlers_takeany(t_widgethandlers *wh, t_symbol *selector) +{ + t_scriptlet *sp; + if (selector == widgetps_vis) + sp = wh->wh_vis; + else if (selector == widgetps_new) + sp = wh->wh_new; + else if (selector == widgetps_free) + sp = wh->wh_free; + else if (selector == widgetps_data) + sp = wh->wh_data; + else if (selector == &s_bang) + sp = wh->wh_bang; + else if (selector == &s_float) + sp = wh->wh_float; + else if (selector == &s_symbol) + sp = wh->wh_symbol; + else + { + t_widgetscript *ws; + if (ws = widgethandlers_takeotherscript(wh, selector)) + sp = ws->ws_script; + else + { + loudbug_bug("widgethandlers_takeany"); + sp = 0; + } + } + return (sp); +} + +void widgethandlers_fill(t_widgethandlers *wh, t_props *pp) +{ + int ac; + t_atom *ap; + if (ap = props_getfirst(pp, &ac)) + { + do + { + if (ac > 1 && ap->a_type == A_SYMBOL && + ap->a_w.w_symbol->s_name[0] == '@' && + ap->a_w.w_symbol->s_name[1] != 0) + { + t_symbol *sel = gensym(ap->a_w.w_symbol->s_name + 1); + t_scriptlet *sp; + if (sp = widgethandlers_takeany(wh, sel)) + { + scriptlet_reset(sp); + scriptlet_add(sp, 0, 0, ac - 1, ap + 1); + } + } + else loudbug_bug("widgethandlers_fill"); + } + while (ap = props_getnext(pp, &ac)); + } +} + +t_scriptlet *widgethandlers_getvis(t_widgethandlers *wh) +{ + return (wh->wh_vis); +} + +t_scriptlet *widgethandlers_getnew(t_widgethandlers *wh) +{ + return (wh->wh_new); +} + +t_scriptlet *widgethandlers_getfree(t_widgethandlers *wh) +{ + return (wh->wh_free); +} + +t_scriptlet *widgethandlers_getdata(t_widgethandlers *wh) +{ + return (wh->wh_data); +} + +t_scriptlet *widgethandlers_getbang(t_widgethandlers *wh) +{ + return (wh->wh_bang); +} + +t_scriptlet *widgethandlers_getfloat(t_widgethandlers *wh) +{ + return (wh->wh_float); +} + +t_scriptlet *widgethandlers_getsymbol(t_widgethandlers *wh) +{ + return (wh->wh_symbol); +} + +t_scriptlet *widgethandlers_getother(t_widgethandlers *wh, t_symbol *selector) +{ + t_widgetscript *ws; + for (ws = wh->wh_others; ws; ws = ws->ws_next) + if (ws->ws_selector == selector) + return (ws->ws_script); + return (0); +} diff --git a/externals/miXed/toxy/widgettype.c b/externals/miXed/toxy/widgettype.c new file mode 100644 index 000000000..1cc102d93 --- /dev/null +++ b/externals/miXed/toxy/widgettype.c @@ -0,0 +1,452 @@ +/* Copyright (c) 2003-2005 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include <stdio.h> +#include <string.h> +#include "m_pd.h" +#include "common/loud.h" +#include "common/grow.h" +#include "common/dict.h" +#include "common/props.h" +#include "toxy/scriptlet.h" +#include "widget.h" + +static char masterwidget_builtin[] = +#include "setup.wiq" +; + +#define WIDGETTYPE_VERBOSE +#ifdef KRZYSZCZ +//#define WIDGETTYPE_DEBUG +#endif + +struct _widgettype +{ + t_pd wt_pd; + t_glist *wt_glist; /* set by the loading widget */ + t_symbol *wt_typekey; /* this is a typemap symbol */ + t_symbol *wt_tkclass; /* also 'undefined' flag (gensym symbol) */ + char *wt_requirements; + int wt_isinternal; /* true if built-in or defined in setup.wid */ + t_props *wt_options; + t_props *wt_handlers; /* defined inside of #. comments */ + t_props *wt_arguments; + t_scriptlet *wt_auxscript; + t_widgethandlers *wt_scripts; /* multiliners tagged with #@ comments */ +}; + +struct _masterwidget +{ + t_pd mw_pd; + t_symbol *mw_target; + t_scriptlet *mw_setupscript; + t_dict *mw_typemap; + t_widgettype *mw_parsedtype; /* the type currently parsed, if loading */ + t_binbuf *mw_bb; /* auxiliary, LATER remove */ +}; + +static t_class *widgettype_class; +static t_class *masterwidget_class; + +static t_masterwidget *masterwidget = 0; + +static t_canvas *widgettype_cvhook(t_pd *caller) +{ + return (0); +} + +static void widgettype_map(t_widgettype *wt, char *cls, char *req) +{ + wt->wt_tkclass = (cls ? gensym(cls) : 0); + if (wt->wt_requirements) + freebytes(wt->wt_requirements, strlen(wt->wt_requirements) + 1); + if (req && *req) + { + char *opt = 0; + wt->wt_requirements = getbytes(strlen(req) + 1); + strcpy(wt->wt_requirements, req); + while (req) + { + char *w1 = scriptlet_nextword(req); + opt = (*req == '-' ? req : (w1 && *w1 == '-' ? w1 : 0)); + if (opt) + { + if (strcmp(opt + 1, "exact")) + { + loud_error + (0, "unknown option \"%s\" in widget type header", opt); + opt = 0; + } + if (*req == '-') + { + req = w1; + continue; + } + else w1 = scriptlet_nextword(w1); + } + if (*req >= '0' && *req <= '9') + { + loud_error + (0, "invalid base widget name \"%s\" in widget type header", + req); + req = w1; + } + else + { + t_widgettype *base; + char *ver = (w1 && *w1 >= '0' && *w1 <= '9' ? w1 : 0); + char *w2 = (ver ? scriptlet_nextword(ver) : w1); +#if 1 + loudbug_post("require %s (version %s %s)", + req, (opt ? opt : ">="), (ver ? ver : "any")); +#endif + base = widgettype_get(gensym(req), ver, opt, wt->wt_glist); + if (!base->wt_tkclass) + loud_error(0, "missing base widget file \"%s.wid\"", req); + req = w2; + } + } + } + else wt->wt_requirements = 0; +} + +static void widgettype_clear(t_widgettype *wt) +{ + props_clearall(wt->wt_options); + widgethandlers_reset(wt->wt_scripts); +} + +#if 0 +/* only for debugging (never call, unless certain that nobody references wt) */ +static void widgettype_free(t_masterwidget *mw, t_widgettype *wt) +{ + loudbug_startpost("widgettype free... "); + if (wt->wt_requirements) + freebytes(wt->wt_requirements, strlen(wt->wt_requirements) + 1); + dict_unbind(mw->mw_typemap, (t_pd *)wt, wt->wt_typekey); + props_freeall(wt->wt_options); + scriptlet_free(wt->wt_auxscript); + widgethandlers_free(wt->wt_scripts); + pd_free((t_pd *)wt); + loudbug_post("done"); +} +#endif + +static t_widgettype *widgettype_new(t_masterwidget *mw, char *typ, char *cls, + char *req, t_glist *glist) +{ + t_widgettype *wt = (t_widgettype *)pd_new(widgettype_class); + wt->wt_glist = glist; + wt->wt_typekey = dict_key(mw->mw_typemap, typ); + widgettype_map(wt, cls, req); + wt->wt_isinternal = 0; + wt->wt_options = props_new(0, "option", "-", 0, 0); + wt->wt_handlers = props_new(0, "handler", "@", wt->wt_options, 0); + wt->wt_arguments = props_new(0, "argument", "#", wt->wt_options, 0); + wt->wt_auxscript = scriptlet_new((t_pd *)wt, mw->mw_target, mw->mw_target, + 0, 0, widgettype_cvhook); + wt->wt_scripts = widgethandlers_new(wt->wt_auxscript); + dict_bind(mw->mw_typemap, (t_pd *)wt, wt->wt_typekey); + return (wt); +} + +static t_canvas *masterwidget_cvhook(t_pd *caller) +{ + return (0); +} + +static t_scriptlet *masterwidget_cmnthook(t_pd *caller, char *rc, + char sel, char *buf) +{ + t_masterwidget *mw = masterwidget; + if (!*buf) + return (SCRIPTLET_UNLOCK); + if (sel == '>') + { + t_symbol *typekey; + t_widgettype *typeval; + char *cls = scriptlet_nextword(buf); + char *req = (cls ? scriptlet_nextword(cls) : 0); + mw->mw_parsedtype = 0; + if (!cls) + cls = buf; + typekey = dict_key(mw->mw_typemap, buf); + typeval = (t_widgettype *)dict_firstvalue(mw->mw_typemap, typekey, 0); + if (caller == (t_pd *)mw) + { /* setup.wid or built-in defaults */ + if (typeval) + { + /* LATER may need revisiting, when/if we accept explicit + 'redefine' requests for internal types */ + loud_warning((t_pd *)mw, 0, "redefinition of '%s'\ + in \"%s.wid\" file, ignored", buf, rc); + return (SCRIPTLET_LOCK); + } + } + else + { /* <type>.wid */ + if (caller != (t_pd *)typeval) + { + loud_warning((t_pd *)mw, 0, "alien definition of '%s'\ + in \"%s.wid\" file, ignored", buf, rc); + return (SCRIPTLET_LOCK); + } + } + if (typeval) + widgettype_map(typeval, cls, req); + else + { + typeval = widgettype_new(mw, buf, cls, req, 0); + typeval->wt_isinternal = (caller == (t_pd *)mw); + } + mw->mw_parsedtype = typeval; +#ifdef WIDGETTYPE_DEBUG + loudbug_post("adding widget type '%s'", typeval->wt_typekey->s_name); +#endif + widgethandlers_reset(typeval->wt_scripts); + + /* What should follow after the header? In a cleaner layout, perhaps, + the header would be placed at the top, followed by setup. Any + handler would require an explicit #@ tag, and the next statement + would return SCRIPTLET_UNLOCK. LATER revisit -- the change breaks + old .wid files, so better wait for a more robust parsing, which + notices dot-sequences in the setup part and warns about them. + Setup before header will be valid after the change, anyway. */ + return (widgethandlers_getvis(typeval->wt_scripts)); + } + else if (sel == '.') + { + if (mw->mw_parsedtype + && (*buf == '-' || *buf == '@' || *buf == '#')) + { + t_symbol *empty; + int ac; + /* LATER get rid of the binbuf thing */ + binbuf_text(mw->mw_bb, buf, strlen(buf)); + if (ac = binbuf_getnatom(mw->mw_bb)) + { + t_atom *av = binbuf_getvec(mw->mw_bb); + t_props *pp; + if (!(empty = props_add(pp = mw->mw_parsedtype->wt_options, + 0, 0, 0, ac, av)) && + !(empty = props_add(pp = mw->mw_parsedtype->wt_handlers, + 0, 0, 0, ac, av))) + empty = props_add(pp = mw->mw_parsedtype->wt_arguments, + 0, 0, 0, ac, av); + if (empty) + loud_warning((t_pd *)mw, 0, + "no value given for %s '%s'\ + of a widget type '%s' in \"%s.wid\" file", + props_getname(pp), empty->s_name, + mw->mw_parsedtype->wt_typekey->s_name, rc); + } + } + } + else if (sel == '@') + { /* multiline definition of a handler */ + scriptlet_nextword(buf); + if (mw->mw_parsedtype) + return (widgethandlers_takeany(mw->mw_parsedtype->wt_scripts, + gensym(buf))); + } + return (SCRIPTLET_UNLOCK); +} + +static int widgettype_doload(t_widgettype *wt, t_symbol *s) +{ + int result = 0; + /* <type>.wid searched in the current patch's dir + pd_path, + but not in `pwd` */ + t_scriptlet *mwsp = + scriptlet_new((t_pd *)masterwidget, masterwidget->mw_target, + masterwidget->mw_target, 0, wt->wt_glist, 0); + masterwidget->mw_parsedtype = wt; + + if (scriptlet_rcload(mwsp, (t_pd *)wt, + s->s_name, ".wid", 0, masterwidget_cmnthook) + == SCRIPTLET_OK) + { +#ifdef WIDGETTYPE_VERBOSE + loudbug_post("using a separate %s's definition file", s->s_name); +#endif + if (!scriptlet_isempty(mwsp)) + { + t_scriptlet *sp = + scriptlet_new((t_pd *)masterwidget, masterwidget->mw_target, + masterwidget->mw_target, 0, 0, 0); + if (scriptlet_evaluate(mwsp, sp, 0, 0, 0, 0)) + { + scriptlet_push(sp); + scriptlet_append(masterwidget->mw_setupscript, mwsp); + } + else loudbug_bug("widgettype_doload"); + scriptlet_free(sp); + } + result = 1; + } + scriptlet_free(mwsp); + return (result); +} + +t_widgettype *widgettype_find(t_symbol *s) +{ + return ((t_widgettype *)dict_firstvalue(masterwidget->mw_typemap, + dict_key(masterwidget->mw_typemap, + s->s_name), 0)); +} + +t_widgettype *widgettype_get(t_symbol *s, char *ver, char *opt, t_glist *glist) +{ + t_widgettype *wt = widgettype_find(s); + /* Design decision: default widget definitions are NOT implicitly + overridden by <type>.wid (sacrificing flexibility for feature + stability). */ + if (!wt) + { + /* first instance of a type not defined in setup.wid */ + wt = widgettype_new(masterwidget, s->s_name, 0, 0, glist); + /* LATER use version and option */ + widgettype_doload(wt, s); + } + return (wt); +} + +t_widgettype *widgettype_reload(t_symbol *s, t_glist *glist) +{ + t_widgettype *wt = widgettype_find(s); + if (!wt) + /* first instance of a type not defined in setup.wid */ + wt = widgettype_new(masterwidget, s->s_name, 0, 0, glist); + if (wt && !wt->wt_isinternal) + { /* LATER consider safe-loading through a temporary type */ + widgettype_clear(wt); + wt->wt_glist = glist; + if (widgettype_doload(wt, s)) + return (wt); + } + return (0); +} + +int widgettype_isdefined(t_widgettype *wt) +{ + return (wt->wt_tkclass != 0); +} + +t_symbol *widgettype_tkclass(t_widgettype *wt) +{ + return (wt->wt_tkclass); +} + +t_props *widgettype_getoptions(t_widgettype *wt) +{ + return (wt->wt_options); +} + +t_props *widgettype_gethandlers(t_widgettype *wt) +{ + return (wt->wt_handlers); +} + +t_props *widgettype_getarguments(t_widgettype *wt) +{ + return (wt->wt_arguments); +} + +t_widgethandlers *widgettype_getscripts(t_widgettype *wt) +{ + return (wt->wt_scripts); +} + +void widgettype_setup(void) +{ + static int done = 0; + if (!done) + { + widgettype_class = class_new(gensym("widget type"), 0, 0, + sizeof(t_widgettype), CLASS_PD, 0); + masterwidget_class = class_new(gensym("Widget"), 0, 0, + sizeof(t_masterwidget), CLASS_PD, 0); + done = 1; + } +} + +char *masterwidget_getcontents(int *szp) +{ + return (scriptlet_getcontents(masterwidget->mw_setupscript, szp)); +} + +void masterwidget_validate(void) +{ + int rcresult; + char buf[MAXPDSTRING]; + if (masterwidget) + return; + masterwidget = (t_masterwidget *)pd_new(masterwidget_class); + sprintf(buf, "mw%x", (int)masterwidget); + /* never unbound, LATER rethink */ + pd_bind((t_pd *)masterwidget, masterwidget->mw_target = gensym(buf)); + + masterwidget->mw_typemap = dict_new(0); + + /* setup.wid searched in `pwd` + pd_path, but not in current patch's dir + (LATER only the pd_path should be searched) */ + masterwidget->mw_setupscript = + scriptlet_new((t_pd *)masterwidget, masterwidget->mw_target, + masterwidget->mw_target, 0, 0, 0); + masterwidget->mw_bb = binbuf_new(); + masterwidget->mw_parsedtype = 0; + + rcresult = + scriptlet_rcload(masterwidget->mw_setupscript, 0, "setup", ".wid", + masterwidget_builtin, masterwidget_cmnthook); + if (rcresult == SCRIPTLET_OK) + { +#ifdef WIDGETTYPE_VERBOSE + loudbug_post("using file 'setup.wid'"); +#endif + } + else + { + char *msg; + if (rcresult == SCRIPTLET_NOFILE) + msg = "no"; + else if (rcresult == SCRIPTLET_BADFILE) + msg = "corrupt"; + else if (rcresult == SCRIPTLET_NOVERSION) + msg = "unknown version of"; + else if (rcresult == SCRIPTLET_OLDERVERSION) + msg = "obsolete"; + else if (rcresult == SCRIPTLET_NEWERVERSION) + msg = "incompatible"; + else + msg = "cannot use"; + loud_warning((t_pd *)masterwidget, 0, + "%s file 'setup.wid'... using built-in defaults", msg); + } + if (!scriptlet_isempty(masterwidget->mw_setupscript)) + rcresult = SCRIPTLET_OK; + else if (rcresult == SCRIPTLET_OK) + { + loud_warning((t_pd *)masterwidget, 0, + "missing setup definitions in file 'setup.wid'"); + scriptlet_reset(masterwidget->mw_setupscript); + rcresult = + scriptlet_rcparse(masterwidget->mw_setupscript, 0, "master", + masterwidget_builtin, masterwidget_cmnthook); + } + else + { + loudbug_bug("masterwidget_validate 1"); + rcresult = SCRIPTLET_BADFILE; + } + if (rcresult == SCRIPTLET_OK) + { + t_scriptlet *sp = scriptlet_newalike(masterwidget->mw_setupscript); + if (scriptlet_evaluate(masterwidget->mw_setupscript, sp, 0, 0, 0, 0)) + scriptlet_push(sp); + else + loudbug_bug("masterwidget_validate 2"); + scriptlet_free(sp); + } +} -- GitLab