From bccc0ff51dfbe00beb5329248836ad945494459a Mon Sep 17 00:00:00 2001 From: dreamer Date: Fri, 24 Nov 2023 12:03:18 +0100 Subject: [PATCH] implement clear message on delwrite~ --- CHANGELOG.md | 1 + .../generators/ir2c/static/HvSignalTabwrite.c | 3 + hvcc/interpreters/pd2hv/libs/pd/delwrite~.pd | 80 +++++++++++-------- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52460762..a1cc65a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Next Release ----- * Objects: `[bang~]` +* Object improvements: support `[clear(` message for `[delwrite~]` * Documentation fixes/additions * Daisy: ability to set samplerate and blocksize * Daisy: adding midirealtimein, polytouchin/out, midiin (midiout WIP) diff --git a/hvcc/generators/ir2c/static/HvSignalTabwrite.c b/hvcc/generators/ir2c/static/HvSignalTabwrite.c index f3d984a4..453b2290 100644 --- a/hvcc/generators/ir2c/static/HvSignalTabwrite.c +++ b/hvcc/generators/ir2c/static/HvSignalTabwrite.c @@ -36,6 +36,9 @@ void sTabwrite_onMessage(HeavyContextInterface *_c, SignalTabwrite *o, int letIn case HV_MSG_SYMBOL: { if (msg_compareSymbol(m, 0, "stop")) { o->head = HV_TABWRITE_STOPPED; + } else if (msg_compareSymbol(m, 0, "clear")) { + hv_size_t numBytes = o->table->allocated * sizeof(float); + hv_memclear(o->table->buffer, numBytes); } break; } diff --git a/hvcc/interpreters/pd2hv/libs/pd/delwrite~.pd b/hvcc/interpreters/pd2hv/libs/pd/delwrite~.pd index 8d290327..6f5be8e2 100644 --- a/hvcc/interpreters/pd2hv/libs/pd/delwrite~.pd +++ b/hvcc/interpreters/pd2hv/libs/pd/delwrite~.pd @@ -1,51 +1,61 @@ -#N canvas 538 250 585 275 10; -#X obj 10 181 inlet~; +#N canvas 973 266 457 387 10; #N canvas 0 22 450 300 @hv_obj 0; #X obj 48 70 inlet~; #X obj 147 72 inlet; -#X restore 10 206 pd @hv_obj __tabwrite~f del-\$1; -#X text 9 253 @hv_arg \$2 delay float 0 true; -#X obj 187 31 samplerate~; -#X obj 187 71 * \$2; +#X restore 10 309 pd @hv_obj __tabwrite~f del-\$1; +#X text 9 356 @hv_arg \$2 delay float 0 true; +#X obj 187 134 samplerate~; +#X obj 187 174 * \$2; #N canvas 0 22 450 300 @hv_obj 0; #X obj 142 60 inlet; #X obj 135 103 outlet; -#X restore 187 111 pd @hv_obj table del-\$1; -#X msg 187 91 resize \$1; -#X text 9 234 @hv_arg \$1 table string "" true; -#X obj 187 51 / 1000; +#X restore 187 214 pd @hv_obj table del-\$1; +#X msg 187 194 resize \$1; +#X text 9 337 @hv_arg \$1 table string "" true; +#X obj 187 154 / 1000; #N canvas 0 22 450 300 @hv_obj 0; #X obj 215 71 inlet; #X obj 165 71 inlet; #X obj 120 72 inlet; #X obj 129 122 outlet; -#X restore 187 159 pd @hv_obj __delay; -#X obj 187 8 loadbang; -#X obj 187 182 t a a a; -#X msg 226 228 mirror; +#X restore 187 262 pd @hv_obj __delay; +#X obj 187 111 loadbang; +#X obj 187 285 t a a a; +#X msg 226 331 mirror; #N canvas 0 22 450 300 @hv_obj 0; #X obj 215 71 inlet; #X obj 165 71 inlet; #X obj 120 72 inlet; #X obj 129 122 outlet; -#X restore 226 206 pd @hv_obj __delay; -#X obj 187 134 t b a a, f 25; -#X text 254 90 returns the size of the table; -#X msg 331 159 @HV_N_SIMD; -#X connect 0 0 1 0; -#X connect 3 0 8 0; -#X connect 4 0 6 0; -#X connect 5 0 14 0; -#X connect 6 0 5 0; -#X connect 8 0 4 0; -#X connect 9 0 11 0; -#X connect 10 0 3 0; -#X connect 11 0 1 1; -#X connect 11 1 9 0; -#X connect 11 2 13 0; -#X connect 12 0 5 0; -#X connect 13 0 12 0; -#X connect 14 0 9 0; -#X connect 14 1 9 2; -#X connect 14 2 16 0; -#X connect 16 0 13 2; +#X restore 226 309 pd @hv_obj __delay; +#X obj 187 237 t b a a, f 25; +#X text 254 193 returns the size of the table; +#X msg 331 262 @HV_N_SIMD; +#N canvas 1401 0 450 300 @hv_obj 0; +#X obj 48 57 inlet; +#X obj 48 114 outlet; +#X restore 83 52 pd @hv_obj __switchcase clear; +#X msg 83 75 clear; +#X text 80 32 connection from the left inlet to the switchcase; +#X text 81 21 NOTE(dreamer): there is supposed to be a control; +#X obj 10 26 inlet~ -~>; +#X connect 2 0 7 0; +#X connect 3 0 5 0; +#X connect 4 0 13 0; +#X connect 5 0 4 0; +#X connect 7 0 3 0; +#X connect 8 0 10 0; +#X connect 9 0 2 0; +#X connect 10 0 0 1; +#X connect 10 1 8 0; +#X connect 10 2 12 0; +#X connect 11 0 4 0; +#X connect 12 0 11 0; +#X connect 13 0 8 0; +#X connect 13 1 8 2; +#X connect 13 2 15 0; +#X connect 15 0 12 2; +#X connect 16 0 17 0; +#X connect 17 0 0 1; +#X connect 20 0 0 0; +#X connect 20 0 16 0;