Skip to content

Commit d51ef4f

Browse files
committed
fix table addressing to externel graphical arrays; add limitation to the docs
1 parent 566c134 commit d51ef4f

5 files changed

Lines changed: 87 additions & 1 deletion

File tree

docs/02.getting_started.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ When externing a table using `@hv_table` annotation, or appending it after the n
4444

4545
`[table array1 100 @hv_table]`
4646

47+
Using spaces in array names is no longer supported.
48+
4749
### GUI Objects
4850

4951
Most GUI objects will also accept send/receive configurations. These will be converted to send/receive objects in the Control Graph.
@@ -130,3 +132,4 @@ This list will be continuously epanded to document differences in object behavio
130132
* Right inlet for table onset of `[tabread4~]` does not do anything.
131133
* Right inlet for `[lop~]` does not support signal input.
132134
* Heavy does not support multichannel connections.
135+
* Arrays do not support spaces in the name.

hvcc/interpreters/pd2hv/HeavyObject.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ def __init__(
6161
obj_args = obj_args or []
6262
self.obj_dict = {}
6363

64+
# clean up externed tables
65+
if obj_type in (
66+
"__var",
67+
"__tabwrite",
68+
"__tabwrite~f",
69+
"__tabwrite_stoppable~f",
70+
"__tabread",
71+
"__tabread~f",
72+
"__tabread~if",
73+
"__tabread_stoppable~f"
74+
):
75+
for i, a in enumerate(obj_args):
76+
obj_args[i] = a.split(" ")[0] if "@hv_table" in a else a
77+
6478
for i, a in enumerate(self.__obj_dict.args):
6579
arg = cast(Union[IRArg, LangArg], a)
6680
# if the argument exists (and has been correctly resolved)
@@ -91,7 +105,7 @@ def __init__(
91105

92106
# send/receive, table, etc. must have public scope
93107
# TODO(mhroth): dirty
94-
if obj_type in ["table", "__table", "send", "__send", "receive", "__receive"]:
108+
if obj_type in ("table", "__table", "send", "__send", "receive", "__receive"):
95109
self.__annotations["scope"] = "public"
96110

97111
@classmethod
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[@ 0.000] print: 0
2+
[@ 0.000] print: 0
3+
[@ 0.000] print: 0
4+
[@ 0.000] print: 2
5+
[@ 0.000] print: -100
6+
[@ 0.000] print: 1
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#N canvas 750 181 444 399 10;
2+
#N canvas 0 22 450 278 (subpatch) 0;
3+
#X array array1\ @hv_table 3 float 2;
4+
#X coords 0 1 3 -1 200 140 1 0 0;
5+
#X restore 192 293 graph;
6+
#X obj 21 6 loadbang;
7+
#X obj 24 330 print;
8+
#X msg 85 267 0;
9+
#X msg 55 267 1;
10+
#X msg 25 267 2;
11+
#X obj 22 231 t b b b;
12+
#X obj 287 139 t b b;
13+
#X msg 290 178 2;
14+
#X msg 322 178 0;
15+
#X obj 217 139 t b b;
16+
#X msg 252 178 1;
17+
#X msg 220 178 120;
18+
#X obj 153 143 t b b;
19+
#X obj 83 143 t b b;
20+
#X msg 192 182 1;
21+
#X msg 153 182 -100;
22+
#X msg 115 182 2;
23+
#X msg 83 182 1;
24+
#X obj 21 80 t b b b;
25+
#X obj 84 113 t b b b b;
26+
#X obj 98 234 tabwrite array1\ @hv_table;
27+
#X obj 24 308 tabread array1\ @hv_table;
28+
#X obj 21 39 bng 25 250 50 0 empty empty empty 17 7 0 10 #191919 #ffffff #ffffff;
29+
#X connect 1 0 23 0;
30+
#X connect 3 0 22 0;
31+
#X connect 4 0 22 0;
32+
#X connect 5 0 22 0;
33+
#X connect 6 0 5 0;
34+
#X connect 6 1 4 0;
35+
#X connect 6 2 3 0;
36+
#X connect 7 0 8 0;
37+
#X connect 7 1 9 0;
38+
#X connect 8 0 21 0;
39+
#X connect 9 0 21 1;
40+
#X connect 10 0 12 0;
41+
#X connect 10 1 11 0;
42+
#X connect 11 0 21 1;
43+
#X connect 12 0 21 0;
44+
#X connect 13 0 16 0;
45+
#X connect 13 1 15 0;
46+
#X connect 14 0 18 0;
47+
#X connect 14 1 17 0;
48+
#X connect 15 0 21 1;
49+
#X connect 16 0 21 0;
50+
#X connect 17 0 21 1;
51+
#X connect 18 0 21 0;
52+
#X connect 19 0 6 0;
53+
#X connect 19 1 20 0;
54+
#X connect 19 2 6 0;
55+
#X connect 20 0 14 0;
56+
#X connect 20 1 13 0;
57+
#X connect 20 2 10 0;
58+
#X connect 20 3 7 0;
59+
#X connect 22 0 2 0;
60+
#X connect 23 0 19 0;

tests/test_control.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ def test_tabread(self):
276276
def test_tabwrite(self):
277277
self._test_control_patch("test-tabwrite.pd")
278278

279+
def test_tabwrite_hv_table(self):
280+
self._test_control_patch("test-tabwrite_hv_table.pd")
281+
279282
def test_tan(self):
280283
self._test_control_patch("test-tan.pd")
281284

0 commit comments

Comments
 (0)