Skip to content

Commit

Permalink
implement clear message on delwrite~ (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
dromer authored Nov 24, 2023
1 parent 0c5c778 commit f0433e0
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions hvcc/generators/ir2c/static/HvSignalTabwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
80 changes: 45 additions & 35 deletions hvcc/interpreters/pd2hv/libs/pd/delwrite~.pd
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit f0433e0

Please sign in to comment.