├── antlr-4.2.2-complete.jar
├── input7.pd
├── adsr.pd
├── input9.pd
├── fcounter.pd
├── input2.pd
├── input8.pd
├── input4.pd
├── input5.pd
├── input1.pd
├── osc3.pd
├── input12.pd
├── osc.pd
├── pedes.pd
├── osc1.pd
├── fg27-1.pd
├── input3.pd
├── .gitignore
├── ambientrainall.pd
├── ambientrainall (copy).pd
├── busyTone.pd
├── fcounteruse.pd
├── input6.pd
├── tline.pd
├── input11.pd
├── input10.pd
├── ambientrain.pd
├── fg27-2.pd
├── dtmfTone.pd
├── figures
├── figure9-4.pd
└── figure25-6.pd
├── ambientrain (copy).pd
├── osc2.pd
├── myadsr.pd
├── dialingTone.pd
├── pulsedial.pd
├── burn.pd
├── src
├── ConvertPd.java
├── Rows.tokens
├── RowsLexer.tokens
├── RowsListener.java
├── Rows.g4
├── RowsBaseListener.java
├── RowsLexer.java
├── RowsParser.java
└── ConvertPdListener.java
├── myadsruse.pd
├── draft.pd
├── fig27-3a.pd
├── ringingTone.pd
├── toyboat.pd
├── fig27-3b.pd
├── turbine.pd
├── fireme.pd
├── schroder.pd
├── mywind.pd
├── jetengine.pd
└── README.md
/antlr-4.2.2-complete.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aonurdemir/Mephisto/HEAD/antlr-4.2.2-complete.jar
--------------------------------------------------------------------------------
/input7.pd:
--------------------------------------------------------------------------------
1 | #N canvas 399 482 450 300 10;
2 | #X obj 88 196 dac~;
3 | #X obj 99 75 osc~ 440;
4 | #X obj 98 144 *~ 2;
5 | #X connect 1 0 2 0;
6 | #X connect 2 0 0 0;
7 | #X connect 2 0 0 1;
8 |
--------------------------------------------------------------------------------
/adsr.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1142 405 624 300 10;
2 | #X obj 119 110 inlet a;
3 | #X obj 190 107 inlet d;
4 | #X obj 255 106 inlet sl;
5 | #X obj 324 113 inlet st;
6 | #X obj 390 114 r;
7 | #X msg 120 183 1 a \, sl d a \, 0 r a+d+st;
8 |
--------------------------------------------------------------------------------
/input9.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1079 474 450 300 10;
2 | #X obj 142 105 osc~ 440;
3 | #X msg 141 26 880;
4 | #X obj 154 169 dac~;
5 | #X floatatom 151 70 5 0 0 0 - - -;
6 | #X connect 0 0 2 0;
7 | #X connect 1 0 3 0;
8 | #X connect 3 0 0 0;
9 |
--------------------------------------------------------------------------------
/fcounter.pd:
--------------------------------------------------------------------------------
1 | #N canvas 796 603 450 300 10;
2 | #X obj 238 108 inlet ms;
3 | #X obj 210 156 metro;
4 | #X obj 210 191 f;
5 | #X obj 246 191 + 1;
6 | #X obj 208 245 outlet;
7 | #X connect 0 0 1 1;
8 | #X connect 0 0 1 0;
9 | #X connect 1 0 2 0;
10 | #X connect 2 0 3 0;
11 | #X connect 2 0 4 0;
12 | #X connect 3 0 2 1;
13 |
--------------------------------------------------------------------------------
/input2.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1094 397 450 300 10;
2 | #X obj 100 218 dac~;
3 | #X obj 100 168 osc~ 440;
4 | #X floatatom 100 87 5 0 0 0 - - -;
5 | #X obj 100 124 + 4;
6 | #X floatatom 157 85 5 0 0 0 - - -;
7 | #X connect 1 0 0 1;
8 | #X connect 1 0 0 0;
9 | #X connect 2 0 3 0;
10 | #X connect 3 0 1 0;
11 | #X connect 4 0 3 1;
12 |
--------------------------------------------------------------------------------
/input8.pd:
--------------------------------------------------------------------------------
1 | #N canvas 962 494 450 300 10;
2 | #X floatatom 143 66 5 0 0 0 - - -;
3 | #X obj 142 105 osc~ 440;
4 | #X obj 134 254 dac~;
5 | #X msg 218 154 1;
6 | #X msg 177 152 0;
7 | #X obj 130 197 *~ 1;
8 | #X connect 0 0 1 0;
9 | #X connect 1 0 5 0;
10 | #X connect 3 0 5 1;
11 | #X connect 4 0 5 1;
12 | #X connect 5 0 2 0;
13 | #X connect 5 0 2 1;
14 |
--------------------------------------------------------------------------------
/input4.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1128 580 450 300 10;
2 | #X obj 100 218 dac~;
3 | #X obj 113 165 osc~ 440;
4 | #X obj 94 123 osc~ 440;
5 | #X obj 194 125 osc~ 440;
6 | #X floatatom 96 57 5 0 0 0 - - -;
7 | #X connect 1 0 0 0;
8 | #X connect 1 0 0 1;
9 | #X connect 2 0 0 0;
10 | #X connect 2 0 0 1;
11 | #X connect 4 0 2 0;
12 | #X connect 4 0 1 0;
13 | #X connect 4 0 3 0;
14 |
--------------------------------------------------------------------------------
/input5.pd:
--------------------------------------------------------------------------------
1 | #N canvas 933 372 450 300 10;
2 | #X obj 128 233 dac~;
3 | #X floatatom 96 57 5 0 0 0 - - -;
4 | #X obj 102 107 +;
5 | #X floatatom 154 52 5 0 0 0 - - -;
6 | #X obj 141 185 osc~;
7 | #X obj 122 145 - 5;
8 | #X connect 1 0 2 0;
9 | #X connect 2 0 5 0;
10 | #X connect 3 0 2 1;
11 | #X connect 4 0 0 0;
12 | #X connect 4 0 0 1;
13 | #X connect 5 0 4 0;
14 |
--------------------------------------------------------------------------------
/input1.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1140 699 450 300 10;
2 | #X obj 100 218 dac~;
3 | #X obj 100 168 osc~ 440;
4 | #X floatatom 100 87 5 0 0 0 - - -;
5 | #X obj 100 124 + 4;
6 | #X floatatom 157 85 5 0 0 0 - - -;
7 | #X floatatom 44 161 5 0 0 0 - - -;
8 | #X connect 1 0 0 1;
9 | #X connect 1 0 0 0;
10 | #X connect 2 0 3 0;
11 | #X connect 3 0 1 0;
12 | #X connect 3 0 5 0;
13 | #X connect 4 0 3 1;
14 |
--------------------------------------------------------------------------------
/osc3.pd:
--------------------------------------------------------------------------------
1 | #N canvas 447 456 450 300 10;
2 | #X obj 215 206 dac~;
3 | #X obj 251 158 osc~ 440;
4 | #X floatatom 118 162 5 0 0 0 - - -;
5 | #X floatatom 100 81 5 0 0 0 - - -;
6 | #X floatatom 151 88 5 0 0 0 - - -;
7 | #X obj 135 124 + 4;
8 | #X connect 1 0 0 1;
9 | #X connect 2 0 0 0;
10 | #X connect 3 0 5 0;
11 | #X connect 4 0 1 0;
12 | #X connect 4 0 5 1;
13 | #X connect 5 0 2 0;
14 | #X connect 5 0 0 0;
15 |
--------------------------------------------------------------------------------
/input12.pd:
--------------------------------------------------------------------------------
1 | #N canvas 810 155 447 442 10;
2 | #X floatatom 116 56 5 0 0 0 - - -;
3 | #X obj 79 142 osc~;
4 | #X obj 77 187 *~ 1;
5 | #X obj 79 220 dac~;
6 | #X obj 163 145 osc~;
7 | #X obj 80 97 * 40;
8 | #X obj 172 98 * 40;
9 | #X connect 0 0 5 0;
10 | #X connect 0 0 6 0;
11 | #X connect 1 0 2 0;
12 | #X connect 2 0 3 0;
13 | #X connect 2 0 3 1;
14 | #X connect 4 0 2 0;
15 | #X connect 5 0 1 0;
16 | #X connect 6 0 4 0;
17 |
--------------------------------------------------------------------------------
/osc.pd:
--------------------------------------------------------------------------------
1 | #N canvas 770 488 450 300 10;
2 | #X obj 205 196 dac~;
3 | #X floatatom 206 15 5 0 0 0 - - -;
4 | #X obj 199 73 +;
5 | #X floatatom 272 13 5 0 0 0 - - -;
6 | #X obj 217 121 osc~ 440;
7 | #X obj 281 92 +;
8 | #X obj 309 121 osc~ 440;
9 | #X connect 1 0 2 0;
10 | #X connect 1 0 5 0;
11 | #X connect 2 0 4 0;
12 | #X connect 3 0 2 1;
13 | #X connect 3 0 5 1;
14 | #X connect 4 0 0 0;
15 | #X connect 4 0 0 1;
16 | #X connect 5 0 6 0;
17 |
--------------------------------------------------------------------------------
/pedes.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1185 466 450 432 10;
2 | #X obj 85 127 mod 2;
3 | #X obj 92 161 sig~;
4 | #X obj 122 189 osc~ 2500;
5 | #X obj 98 226 *~;
6 | #X obj 90 255 *~ 0.2;
7 | #X obj 98 295 dac~;
8 | #X msg 86 35 100;
9 | #X obj 83 92 fcounter;
10 | #X connect 0 0 1 0;
11 | #X connect 1 0 3 0;
12 | #X connect 2 0 3 1;
13 | #X connect 3 0 4 0;
14 | #X connect 4 0 5 0;
15 | #X connect 4 0 5 1;
16 | #X connect 6 0 7 0;
17 | #X connect 7 0 0 0;
18 |
--------------------------------------------------------------------------------
/osc1.pd:
--------------------------------------------------------------------------------
1 | #N canvas 417 388 450 300 10;
2 | #X obj 205 196 dac~;
3 | #X floatatom 206 15 5 0 0 0 - - -;
4 | #X obj 220 57 +;
5 | #X floatatom 272 13 5 0 0 0 - - -;
6 | #X obj 214 144 osc~ 440;
7 | #X obj 235 88 +;
8 | #X obj 309 121 osc~ 440;
9 | #X floatatom 282 38 5 0 0 0 - - -;
10 | #X connect 1 0 2 0;
11 | #X connect 2 0 5 0;
12 | #X connect 3 0 2 1;
13 | #X connect 4 0 0 0;
14 | #X connect 4 0 0 1;
15 | #X connect 5 0 4 0;
16 | #X connect 7 0 5 1;
17 |
--------------------------------------------------------------------------------
/fg27-1.pd:
--------------------------------------------------------------------------------
1 | #N canvas 964 224 565 668 10;
2 | #X obj 223 146 osc~ 2;
3 | #X obj 237 181 *~ 100000;
4 | #X obj 239 218 clip~ 0 1;
5 | #X obj 149 260 osc~ 800;
6 | #X obj 243 265 lop~ 70;
7 | #X obj 194 324 *~;
8 | #X obj 191 365 *~ 0.2;
9 | #X obj 194 414 dac~;
10 | #X connect 0 0 1 0;
11 | #X connect 1 0 2 0;
12 | #X connect 2 0 4 0;
13 | #X connect 3 0 5 0;
14 | #X connect 4 0 5 1;
15 | #X connect 5 0 6 0;
16 | #X connect 6 0 7 0;
17 | #X connect 6 0 7 1;
18 |
--------------------------------------------------------------------------------
/input3.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1092 402 450 300 10;
2 | #X obj 100 218 dac~;
3 | #X obj 100 168 osc~ 440;
4 | #X floatatom 100 87 5 0 0 0 - - -;
5 | #X floatatom 157 85 5 0 0 0 - - -;
6 | #X floatatom 167 95 5 0 0 0 - - -;
7 | #X floatatom 177 105 5 0 0 0 - - -;
8 | #X floatatom 187 115 5 0 0 0 - - -;
9 | #X connect 1 0 0 1;
10 | #X connect 1 0 0 0;
11 | #X connect 2 0 1 0;
12 | #X connect 3 0 1 0;
13 | #X connect 4 0 1 0;
14 | #X connect 5 0 1 0;
15 | #X connect 6 0 1 0;
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | !src/ConvertPd.java
2 | !src/ConvertPdListener.java
3 | !src/Rows.g4
4 | bin/
5 | /draft.dsp
6 | /*.dsp
7 | /Makefile*
8 | /jetengine.0.tmp-svg/
9 | /jackqtdirk/
10 | /jackqtdir/
11 | /draft.1.tmp-svg/
12 | /ambientrain.7.tmp-svg/
13 | /bench.2.tmp-svg/
14 | /bench.4.tmp-svg/
15 | /draft.5.tmp-svg/
16 | /fireme.1.tmp-svg/
17 | /fireme.3.tmp-svg/
18 | /jetengine.4.tmp-svg/
19 | /jetengine.6.tmp-svg/
20 | /toyboat1.7.tmp-svg/
21 | /dsps/
22 | /ambientrain.dsp~
23 | /audria/
24 | /audria/
25 | /b.dsp~
26 |
--------------------------------------------------------------------------------
/ambientrainall.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1034 433 450 300 10;
2 | #X obj 158 36 / 20;
3 | #X obj 158 57 + 0 4;
4 | #X obj 102 115 hip~ 2000;
5 | #X obj 105 186 dac~;
6 | #X obj 183 -27 hsl 128 15 0.1 0.5 0 0 empty empty empty -2 -8 0 10
7 | -262144 -1 -1 0 1;
8 | #X obj 167 150 bp~ 100 0.5;
9 | #X obj 103 82 ambientrain 10 0.1 0.16 3;
10 | #X connect 0 0 1 0;
11 | #X connect 1 0 6 1;
12 | #X connect 2 0 5 0;
13 | #X connect 2 0 3 0;
14 | #X connect 2 0 3 1;
15 | #X connect 4 0 0 0;
16 | #X connect 6 0 2 0;
17 |
--------------------------------------------------------------------------------
/ambientrainall (copy).pd:
--------------------------------------------------------------------------------
1 | #N canvas 1034 433 450 300 10;
2 | #X obj 158 36 / 20;
3 | #X obj 158 57 + 0 4;
4 | #X obj 102 115 hip~ 2000;
5 | #X obj 105 186 dac~;
6 | #X obj 183 -27 hsl 128 15 0.1 0.5 0 0 empty empty empty -2 -8 0 10
7 | -262144 -1 -1 0 1;
8 | #X obj 167 150 bp~ 100 0.5;
9 | #X obj 103 82 ambientrain 10 0.1 0.16 3;
10 | #X connect 0 0 1 0;
11 | #X connect 1 0 6 1;
12 | #X connect 2 0 5 0;
13 | #X connect 2 0 3 0;
14 | #X connect 2 0 3 1;
15 | #X connect 4 0 0 0;
16 | #X connect 6 0 2 0;
17 |
--------------------------------------------------------------------------------
/busyTone.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1409 222 450 762 10;
2 | #X obj 139 232 lop~ 100;
3 | #X obj 136 267 *~;
4 | #X obj 30 113 osc~ 480;
5 | #X obj 38 157 +~;
6 | #X obj 129 373 dac~;
7 | #X obj 87 111 osc~ 620;
8 | #X obj 191 115 osc~ 2;
9 | #X obj 195 150 *~ 10000;
10 | #X obj 196 194 clip~ 0 1;
11 | #X obj 139 325 *~ 0.1;
12 | #X connect 0 0 1 1;
13 | #X connect 1 0 9 0;
14 | #X connect 2 0 3 0;
15 | #X connect 3 0 1 0;
16 | #X connect 5 0 3 1;
17 | #X connect 6 0 7 0;
18 | #X connect 7 0 8 0;
19 | #X connect 8 0 0 0;
20 | #X connect 9 0 4 0;
21 | #X connect 9 0 4 1;
22 |
--------------------------------------------------------------------------------
/fcounteruse.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1087 553 450 383 10;
2 | #X obj 184 143 fcounter;
3 | #X floatatom 340 194 5 0 0 0 - - -;
4 | #X obj 185 169 mod 2;
5 | #X floatatom 115 172 5 0 0 0 - - -;
6 | #X obj 187 326 dac~;
7 | #X msg 189 87 100;
8 | #X obj 184 209 sig~;
9 | #X obj 183 244 *~;
10 | #X obj 227 210 osc~ 2500;
11 | #X obj 187 281 *~ 0.2;
12 | #X connect 0 0 2 0;
13 | #X connect 0 0 3 0;
14 | #X connect 2 0 1 0;
15 | #X connect 2 0 6 0;
16 | #X connect 5 0 0 0;
17 | #X connect 6 0 7 0;
18 | #X connect 7 0 9 0;
19 | #X connect 8 0 7 1;
20 | #X connect 9 0 4 0;
21 | #X connect 9 0 4 1;
22 |
--------------------------------------------------------------------------------
/input6.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1049 528 450 300 10;
2 | #X obj 128 233 dac~;
3 | #X floatatom 96 57 5 0 0 0 - - -;
4 | #X obj 102 107 +;
5 | #X floatatom 154 52 5 0 0 0 - - -;
6 | #X floatatom 173 82 5 0 0 0 - - -;
7 | #X floatatom 219 70 5 0 0 0 - - -;
8 | #X obj 141 185 osc~;
9 | #X obj 122 145 - 5;
10 | #X obj 204 185 /;
11 | #X obj 198 147 +;
12 | #X connect 1 0 2 0;
13 | #X connect 2 0 7 0;
14 | #X connect 3 0 2 1;
15 | #X connect 4 0 7 1;
16 | #X connect 4 0 9 1;
17 | #X connect 5 0 8 1;
18 | #X connect 5 0 9 0;
19 | #X connect 6 0 0 0;
20 | #X connect 6 0 0 1;
21 | #X connect 9 0 6 0;
22 | #X connect 9 0 8 0;
23 |
--------------------------------------------------------------------------------
/tline.pd:
--------------------------------------------------------------------------------
1 | #N canvas 66 87 299 343 10;
2 | #X obj 113 -110 clip~ -0.9 0.9;
3 | #X obj 110 -76 bp~ 2000 12;
4 | #X obj 69 -39 *~ 0.5;
5 | #X obj 139 -40 clip~ -0.4 0.4;
6 | #X obj 155 -1 *~ 0.15;
7 | #X obj 123 41 hip~ 90;
8 | #X obj 119 85 hip~ 90;
9 | #X obj 71 0 bp~ 400 3;
10 | #X obj 117 117 *~ 0.8;
11 | #X obj 141 -147 inlet~;
12 | #X obj 126 147 outlet~;
13 | #X connect 0 0 1 0;
14 | #X connect 1 0 3 0;
15 | #X connect 1 0 2 0;
16 | #X connect 2 0 7 0;
17 | #X connect 3 0 4 0;
18 | #X connect 4 0 5 0;
19 | #X connect 5 0 6 0;
20 | #X connect 6 0 8 0;
21 | #X connect 7 0 5 0;
22 | #X connect 8 0 10 0;
23 | #X connect 9 0 0 0;
24 |
--------------------------------------------------------------------------------
/input11.pd:
--------------------------------------------------------------------------------
1 | #N canvas 787 173 447 442 10;
2 | #X obj 101 74 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
3 | -1;
4 | #X obj 183 70 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
5 | -1;
6 | #X obj 69 154 osc~;
7 | #X obj 70 258 *~;
8 | #X obj 71 297 dac~;
9 | #X msg 101 209 1;
10 | #X msg 174 209 2;
11 | #X msg 69 113 440.5;
12 | #X msg 141 109 500.5;
13 | #X connect 0 0 7 0;
14 | #X connect 0 0 5 0;
15 | #X connect 1 0 8 0;
16 | #X connect 1 0 6 0;
17 | #X connect 2 0 3 0;
18 | #X connect 3 0 4 0;
19 | #X connect 3 0 4 1;
20 | #X connect 5 0 3 1;
21 | #X connect 6 0 3 1;
22 | #X connect 7 0 2 0;
23 | #X connect 8 0 2 0;
24 |
--------------------------------------------------------------------------------
/input10.pd:
--------------------------------------------------------------------------------
1 | #N canvas 790 324 447 442 10;
2 | #X obj 258 327 dac~;
3 | #X msg 170 137 13;
4 | #X msg 209 138 15;
5 | #X msg 284 135 10;
6 | #X msg 325 136 5;
7 | #X obj 186 186 +;
8 | #X obj 302 187 -;
9 | #X obj 255 268 osc~;
10 | #X obj 194 78 trigger b b b b;
11 | #X floatatom 170 25 5 0 0 0 - - -;
12 | #X obj 253 223 + 440.5;
13 | #X connect 1 0 5 0;
14 | #X connect 2 0 5 1;
15 | #X connect 3 0 6 0;
16 | #X connect 4 0 6 1;
17 | #X connect 5 0 10 0;
18 | #X connect 6 0 10 0;
19 | #X connect 7 0 0 0;
20 | #X connect 7 0 0 1;
21 | #X connect 8 0 1 0;
22 | #X connect 8 1 2 0;
23 | #X connect 8 2 3 0;
24 | #X connect 8 3 4 0;
25 | #X connect 9 0 8 0;
26 | #X connect 10 0 7 0;
27 |
--------------------------------------------------------------------------------
/ambientrain.pd:
--------------------------------------------------------------------------------
1 | #N canvas 912 314 712 485 10;
2 | #X obj 182 89 noise~;
3 | #X obj 185 250 *~;
4 | #X obj 185 281 *~;
5 | #X obj 185 310 *~ 4;
6 | #X obj 237 90 / 20;
7 | #X obj 181 164 clip~ 0.16 1;
8 | #X obj 185 217 -~ 0.16;
9 | #X obj 223 354 hip~ 2000;
10 | #X obj 226 425 dac~;
11 | #X floatatom 234 51 5 0.1 0.5 0 - - -;
12 | #X obj 205 127 bp~ 100 0.1;
13 | #X connect 0 0 10 0;
14 | #X connect 1 0 2 0;
15 | #X connect 1 0 2 1;
16 | #X connect 2 0 3 0;
17 | #X connect 3 0 7 0;
18 | #X connect 4 0 10 2;
19 | #X connect 5 0 6 0;
20 | #X connect 6 0 1 0;
21 | #X connect 6 0 1 1;
22 | #X connect 7 0 8 0;
23 | #X connect 7 0 8 1;
24 | #X connect 9 0 4 0;
25 | #X connect 10 0 5 0;
26 |
--------------------------------------------------------------------------------
/fg27-2.pd:
--------------------------------------------------------------------------------
1 | #N canvas 962 229 565 668 10;
2 | #X obj 223 146 osc~ 2;
3 | #X obj 237 181 *~ 100000;
4 | #X obj 239 218 clip~ 0 1;
5 | #X obj 243 265 lop~ 70;
6 | #X obj 226 321 *~;
7 | #X obj 191 365 *~ 0.2;
8 | #X obj 194 414 dac~;
9 | #X obj 181 292 osc~ 800;
10 | #X obj 127 161 sig~ 1;
11 | #X obj 136 277 -~;
12 | #X obj 133 325 *~;
13 | #X obj 56 206 osc~ 600;
14 | #X connect 0 0 1 0;
15 | #X connect 1 0 2 0;
16 | #X connect 2 0 3 0;
17 | #X connect 3 0 4 1;
18 | #X connect 3 0 9 1;
19 | #X connect 4 0 5 0;
20 | #X connect 5 0 6 0;
21 | #X connect 5 0 6 1;
22 | #X connect 7 0 4 0;
23 | #X connect 8 0 9 0;
24 | #X connect 9 0 10 1;
25 | #X connect 10 0 5 0;
26 | #X connect 11 0 10 0;
27 |
--------------------------------------------------------------------------------
/dtmfTone.pd:
--------------------------------------------------------------------------------
1 | #N canvas 732 207 565 668 10;
2 | #X obj 82 93 unpack f f;
3 | #X obj 86 131 osc~;
4 | #X obj 133 130 osc~;
5 | #X obj 107 165 +~;
6 | #X obj 96 321 dac~;
7 | #X obj 108 253 hip~ 100;
8 | #X obj 98 284 *~ 0.25;
9 | #X msg 52 47 1209 697;
10 | #X msg 121 48 1336 697;
11 | #X msg 201 54 1477 697;
12 | #X msg 206 140 1;
13 | #X obj 109 205 *~;
14 | #X msg 210 169 0;
15 | #X connect 0 0 1 0;
16 | #X connect 0 1 2 0;
17 | #X connect 1 0 3 0;
18 | #X connect 2 0 3 1;
19 | #X connect 3 0 11 0;
20 | #X connect 5 0 6 0;
21 | #X connect 6 0 4 0;
22 | #X connect 7 0 0 0;
23 | #X connect 8 0 0 0;
24 | #X connect 9 0 0 0;
25 | #X connect 10 0 11 1;
26 | #X connect 11 0 5 0;
27 | #X connect 12 0 11 1;
28 |
--------------------------------------------------------------------------------
/figures/figure9-4.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1251 239 447 442 10;
2 | #X floatatom 116 56 5 0 0 0 - - -;
3 | #X obj 125 151 + 1;
4 | #X floatatom 120 196 5 0 0 0 - - -;
5 | #X floatatom 196 195 5 0 0 0 - - -;
6 | #X obj 114 235 * 5;
7 | #X obj 203 238 / 4;
8 | #X floatatom 125 287 5 0 0 0 - - -;
9 | #X floatatom 204 288 5 0 0 0 - - -;
10 | #X obj 177 328 +;
11 | #X obj 179 386 dac~;
12 | #X obj 119 107 trigger f f;
13 | #X obj 185 148 pow 2;
14 | #X connect 0 0 10 0;
15 | #X connect 1 0 2 0;
16 | #X connect 2 0 4 0;
17 | #X connect 3 0 5 0;
18 | #X connect 4 0 6 0;
19 | #X connect 5 0 7 0;
20 | #X connect 6 0 8 0;
21 | #X connect 7 0 8 1;
22 | #X connect 8 0 9 0;
23 | #X connect 10 0 1 0;
24 | #X connect 10 1 11 0;
25 | #X connect 11 0 3 0;
26 |
--------------------------------------------------------------------------------
/ambientrain (copy).pd:
--------------------------------------------------------------------------------
1 | #N canvas 476 264 461 379 10;
2 | #X obj 73 25 noise~;
3 | #X obj 130 24 inlet f;
4 | #X obj 188 24 inlet q;
5 | #X obj 248 25 inlet t;
6 | #X obj 310 24 inlet a;
7 | #X obj 73 72 bp~ \$1 \$2;
8 | #X obj 73 111 clip~ 0 1;
9 | #X obj 73 145 max~ \$3;
10 | #X obj 73 178 -~ \$3;
11 | #X obj 73 211 *~;
12 | #X obj 73 242 *~;
13 | #X obj 73 271 *~ 4;
14 | #X obj 72 302 outlet~;
15 | #X connect 0 0 5 0;
16 | #X connect 1 0 5 1;
17 | #X connect 2 0 5 2;
18 | #X connect 3 0 7 1;
19 | #X connect 4 0 11 1;
20 | #X connect 5 0 6 0;
21 | #X connect 6 0 7 0;
22 | #X connect 7 0 8 0;
23 | #X connect 8 0 9 0;
24 | #X connect 8 0 9 1;
25 | #X connect 9 0 10 0;
26 | #X connect 9 0 10 1;
27 | #X connect 10 0 11 0;
28 | #X connect 11 0 12 0;
29 |
--------------------------------------------------------------------------------
/osc2.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1137 360 450 300 10;
2 | #X obj 215 206 dac~;
3 | #X floatatom 216 25 5 0 0 0 - - -;
4 | #X obj 230 67 +;
5 | #X floatatom 282 23 5 0 0 0 - - -;
6 | #X obj 224 154 osc~ 440;
7 | #X obj 227 111 +;
8 | #X obj 300 153 osc~ 440;
9 | #X floatatom 307 88 5 0 0 0 - - -;
10 | #X floatatom 117 81 5 0 0 0 - - -;
11 | #X floatatom 110 171 5 0 0 0 - - -;
12 | #X floatatom 151 88 5 0 0 0 - - -;
13 | #X obj 118 120 +;
14 | #X connect 1 0 2 0;
15 | #X connect 2 0 5 0;
16 | #X connect 3 0 2 1;
17 | #X connect 3 0 7 0;
18 | #X connect 4 0 0 0;
19 | #X connect 5 0 4 0;
20 | #X connect 6 0 0 1;
21 | #X connect 7 0 5 1;
22 | #X connect 7 0 6 0;
23 | #X connect 8 0 11 0;
24 | #X connect 9 0 0 0;
25 | #X connect 10 0 11 1;
26 | #X connect 11 0 9 0;
27 |
--------------------------------------------------------------------------------
/myadsr.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1075 263 624 492 10;
2 | #X obj 114 111 inlet a;
3 | #X obj 186 112 inlet d;
4 | #X obj 251 112 inlet sl;
5 | #X obj 324 113 inlet st;
6 | #X obj 390 114 inlet r;
7 | #X obj 117 299 pack f f f f f f;
8 | #X obj 275 182 +;
9 | #X obj 280 248 +;
10 | #X obj 329 142 t b f;
11 | #X obj 241 151 t b f;
12 | #X obj 133 383 outlet;
13 | #X msg 140 347 1 \$1 \, \$2 \$3 \$4 \, 0 \$5 \$6;
14 | #X connect 0 0 5 0;
15 | #X connect 0 0 5 3;
16 | #X connect 0 0 6 0;
17 | #X connect 1 0 5 2;
18 | #X connect 1 0 9 0;
19 | #X connect 2 0 5 1;
20 | #X connect 3 0 8 0;
21 | #X connect 4 0 5 4;
22 | #X connect 5 0 11 0;
23 | #X connect 6 0 7 0;
24 | #X connect 7 0 5 5;
25 | #X connect 8 0 7 0;
26 | #X connect 8 1 7 1;
27 | #X connect 9 0 6 0;
28 | #X connect 9 1 6 1;
29 | #X connect 11 0 10 0;
30 |
--------------------------------------------------------------------------------
/dialingTone.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1213 290 447 668 10;
2 | #X obj 97 522 dac~;
3 | #X obj 88 144 osc~ 350;
4 | #X obj 117 171 osc~ 450;
5 | #X msg 202 176 1;
6 | #X msg 242 176 0;
7 | #X obj 92 209 +~;
8 | #X obj 95 244 *~;
9 | #X obj 92 275 clip~ -0.9 0.9;
10 | #X obj 89 309 bp~ 2000 12;
11 | #X obj 48 346 *~ 0.5;
12 | #X obj 118 345 clip~ -0.4 0.4;
13 | #X obj 50 385 bp~ 4000 3;
14 | #X obj 134 384 *~ 0.15;
15 | #X obj 102 426 hip~ 90;
16 | #X obj 98 470 hip~ 90;
17 | #X connect 1 0 5 0;
18 | #X connect 2 0 5 1;
19 | #X connect 3 0 6 1;
20 | #X connect 4 0 6 1;
21 | #X connect 5 0 6 0;
22 | #X connect 6 0 7 0;
23 | #X connect 7 0 8 0;
24 | #X connect 8 0 10 0;
25 | #X connect 8 0 9 0;
26 | #X connect 9 0 11 0;
27 | #X connect 10 0 12 0;
28 | #X connect 11 0 13 0;
29 | #X connect 12 0 13 0;
30 | #X connect 13 0 14 0;
31 | #X connect 14 0 0 0;
32 | #X connect 14 0 0 1;
33 |
--------------------------------------------------------------------------------
/pulsedial.pd:
--------------------------------------------------------------------------------
1 | #N canvas 914 144 565 668 10;
2 | #X obj 153 62 fcounter;
3 | #X obj 152 103 mod 6;
4 | #X obj 163 158 < 2;
5 | #X obj 159 209 sig~;
6 | #X obj 138 519 dac~;
7 | #X msg 167 5 20;
8 | #X obj 137 246 clip~ -0.9 0.9;
9 | #X obj 134 280 bp~ 2000 12;
10 | #X obj 93 317 *~ 0.5;
11 | #X obj 163 316 clip~ -0.4 0.4;
12 | #X obj 179 355 *~ 0.15;
13 | #X obj 147 397 hip~ 90;
14 | #X obj 143 441 hip~ 90;
15 | #X obj 95 356 bp~ 400 3;
16 | #X obj 141 473 *~ 0.8;
17 | #X connect 0 0 1 0;
18 | #X connect 1 0 2 0;
19 | #X connect 2 0 3 0;
20 | #X connect 3 0 6 0;
21 | #X connect 5 0 0 0;
22 | #X connect 6 0 7 0;
23 | #X connect 7 0 9 0;
24 | #X connect 7 0 8 0;
25 | #X connect 8 0 13 0;
26 | #X connect 9 0 10 0;
27 | #X connect 10 0 11 0;
28 | #X connect 11 0 12 0;
29 | #X connect 12 0 14 0;
30 | #X connect 13 0 11 0;
31 | #X connect 14 0 4 0;
32 | #X connect 14 0 4 1;
33 |
--------------------------------------------------------------------------------
/burn.pd:
--------------------------------------------------------------------------------
1 | #N canvas 66 82 450 603 10;
2 | #X obj 184 166 *~;
3 | #X obj 184 215 *~ 150;
4 | #X msg 239 215 1;
5 | #X msg 275 215 0.6;
6 | #X obj 161 252 noise~;
7 | #X obj 162 287 bp~ 8000 0.5;
8 | #X obj 161 324 vcf~ 0 1;
9 | #X obj 162 355 hip~ 120;
10 | #X obj 161 388 *~ 120;
11 | #X obj 162 417 clip~ -1 1;
12 | #X obj 192 440 *~ 12000;
13 | #X obj 163 478 vcf~ 0 0.6;
14 | #X obj 204 103 inlet~;
15 | #X obj 241 166 loadbang;
16 | #X obj 163 507 outlet~;
17 | #X connect 0 0 1 0;
18 | #X connect 1 0 6 1;
19 | #X connect 2 0 6 2;
20 | #X connect 3 0 11 2;
21 | #X connect 4 0 5 0;
22 | #X connect 5 0 6 0;
23 | #X connect 6 0 7 0;
24 | #X connect 7 0 8 0;
25 | #X connect 8 0 9 0;
26 | #X connect 9 0 11 0;
27 | #X connect 10 0 11 1;
28 | #X connect 11 0 14 0;
29 | #X connect 12 0 0 0;
30 | #X connect 12 0 0 1;
31 | #X connect 12 0 10 0;
32 | #X connect 13 0 2 0;
33 | #X connect 13 0 3 0;
34 |
--------------------------------------------------------------------------------
/src/ConvertPd.java:
--------------------------------------------------------------------------------
1 | import org.antlr.v4.runtime.*;
2 | import org.antlr.v4.runtime.tree.*;
3 | import java.io.FileInputStream;
4 | import java.io.InputStream;
5 | public class ConvertPd {
6 | public static void main(String[] args) throws Exception {
7 | String inputFile = null;
8 | if ( args.length>0 ) inputFile = args[0];
9 | InputStream is = System.in;
10 | if ( inputFile!=null ) is = new FileInputStream(inputFile);
11 | ANTLRInputStream input = new ANTLRInputStream(is);
12 | RowsLexer lexer = new RowsLexer(input);
13 | CommonTokenStream tokens = new CommonTokenStream(lexer);
14 | RowsParser parser = new RowsParser(tokens);
15 | ParseTree tree = parser.file(); // parse
16 | ParseTreeWalker walker = new ParseTreeWalker(); // create standard walker
17 | ConvertPdListener extractor = new ConvertPdListener(parser,inputFile);
18 | walker.walk(extractor, tree); // initiate walk of tree with listener
19 |
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/myadsruse.pd:
--------------------------------------------------------------------------------
1 | #N canvas 586 365 606 452 10;
2 | #X floatatom 111 30 5 0 0 0 - - -;
3 | #X floatatom 170 25 5 0 0 0 - - -;
4 | #X floatatom 238 37 5 0 0 0 - - -;
5 | #X floatatom 311 29 5 0 0 0 - - -;
6 | #X floatatom 383 46 5 0 0 0 - - -;
7 | #X obj 251 190 vline~;
8 | #X msg 13 108 1 1000 \, 0.5 1000 1000 \, 0 1000 3000;
9 | #X obj 164 272 osc~ 440;
10 | #X obj 226 318 *~;
11 | #X obj 228 368 dac~;
12 | #X obj 248 118 myadsr;
13 | #X obj 324 191 metro 100;
14 | #X obj 332 150 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
15 | 1;
16 | #X obj 316 258 snapshot~;
17 | #X floatatom 333 316 5 0 0 0 - - -;
18 | #X connect 0 0 10 0;
19 | #X connect 1 0 10 1;
20 | #X connect 2 0 10 2;
21 | #X connect 3 0 10 3;
22 | #X connect 4 0 10 4;
23 | #X connect 5 0 8 1;
24 | #X connect 5 0 13 0;
25 | #X connect 6 0 5 0;
26 | #X connect 7 0 8 0;
27 | #X connect 8 0 9 0;
28 | #X connect 8 0 9 1;
29 | #X connect 10 0 5 0;
30 | #X connect 11 0 13 0;
31 | #X connect 12 0 11 0;
32 | #X connect 13 0 14 0;
33 |
--------------------------------------------------------------------------------
/draft.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1028 169 635 703 10;
2 | #X obj 312 50 sig~;
3 | #X obj 311 73 lop~ 0.2;
4 | #X obj 311 622 lop~ 11000;
5 | #X obj 316 698 dac~;
6 | #X obj 313 659 *~ 0.1;
7 | #X obj 406 159 *~;
8 | #X obj 406 208 *~ 150;
9 | #X obj 383 245 noise~;
10 | #X obj 384 280 bp~ 8000 0.5;
11 | #X obj 383 317 vcf~ 0 1;
12 | #X obj 384 348 hip~ 120;
13 | #X obj 383 381 *~ 120;
14 | #X obj 384 410 clip~ -1 1;
15 | #X obj 414 433 *~ 12000;
16 | #X obj 385 471 vcf~ 0 0.6;
17 | #X floatatom 313 27 5 0.1 1 0 - - -;
18 | #X msg 461 208 0;
19 | #X msg 484 445 0;
20 | #X connect 0 0 1 0;
21 | #X connect 1 0 5 1;
22 | #X connect 1 0 5 0;
23 | #X connect 1 0 13 0;
24 | #X connect 2 0 4 0;
25 | #X connect 4 0 3 0;
26 | #X connect 4 0 3 1;
27 | #X connect 5 0 6 0;
28 | #X connect 6 0 9 1;
29 | #X connect 7 0 8 0;
30 | #X connect 8 0 9 0;
31 | #X connect 9 0 10 0;
32 | #X connect 10 0 11 0;
33 | #X connect 11 0 12 0;
34 | #X connect 12 0 14 0;
35 | #X connect 13 0 14 1;
36 | #X connect 14 0 2 0;
37 | #X connect 15 0 0 0;
38 | #X connect 16 0 9 2;
39 | #X connect 17 0 14 2;
40 |
--------------------------------------------------------------------------------
/src/Rows.tokens:
--------------------------------------------------------------------------------
1 | LOP=22
2 | LT=8
3 | OSC=12
4 | VCF=23
5 | MOD=16
6 | PHASOR=13
7 | TRIGGER=39
8 | DAC=14
9 | TAB=46
10 | MAX=34
11 | MSG=27
12 | METRO=15
13 | SEMICOLON=43
14 | BANG=40
15 | FLOAT=37
16 | INT=36
17 | UNPACK=30
18 | MIN=35
19 | MINUS=5
20 | FCOUNTER=17
21 | BP=20
22 | LINE=29
23 | LPAREN=44
24 | CANVAS=25
25 | FLOATATOM=11
26 | RPAREN=45
27 | EXPR=10
28 | POW=28
29 | TGL=33
30 | HIP=21
31 | CONNECT=26
32 | MULTIPLY=4
33 | OBJ=24
34 | COS=31
35 | SIG=18
36 | GT=7
37 | PLUS=6
38 | VAR=41
39 | NL=47
40 | DIGIT=38
41 | NOBJ=2
42 | NOISE=32
43 | EQ=9
44 | XOBJ=1
45 | CLIP=19
46 | DIVIDE=3
47 | STRING=42
48 | 'floatatom'=11
49 | 'expr'=10
50 | 'trigger'=39
51 | 'sig~'=18
52 | 'noise~'=32
53 | '=='=9
54 | '#X'=1
55 | 'line~'=29
56 | 'mod'=16
57 | 'metro'=15
58 | '>'=7
59 | 'phasor~'=13
60 | 'fcounter'=17
61 | 'canvas'=25
62 | 'vcf~'=23
63 | ';'=43
64 | 'max~'=34
65 | 'tgl'=33
66 | ')'=45
67 | 'osc~'=12
68 | 'unpack'=30
69 | 'dac~'=14
70 | 'lop~'=22
71 | 'connect'=26
72 | 'bng'=40
73 | 'pow'=28
74 | 'hip~'=21
75 | 'min~'=35
76 | '<'=8
77 | '('=44
78 | 'msg'=27
79 | '#N'=2
80 | 'bp~'=20
81 | 'clip~'=19
82 | 'obj'=24
83 | 'cos~'=31
84 |
--------------------------------------------------------------------------------
/src/RowsLexer.tokens:
--------------------------------------------------------------------------------
1 | LOP=22
2 | LT=8
3 | OSC=12
4 | VCF=23
5 | MOD=16
6 | PHASOR=13
7 | TRIGGER=39
8 | DAC=14
9 | TAB=46
10 | MAX=34
11 | MSG=27
12 | METRO=15
13 | SEMICOLON=43
14 | BANG=40
15 | FLOAT=37
16 | INT=36
17 | UNPACK=30
18 | MIN=35
19 | MINUS=5
20 | FCOUNTER=17
21 | BP=20
22 | LINE=29
23 | LPAREN=44
24 | CANVAS=25
25 | FLOATATOM=11
26 | RPAREN=45
27 | EXPR=10
28 | POW=28
29 | TGL=33
30 | HIP=21
31 | CONNECT=26
32 | MULTIPLY=4
33 | OBJ=24
34 | COS=31
35 | SIG=18
36 | GT=7
37 | PLUS=6
38 | VAR=41
39 | NL=47
40 | DIGIT=38
41 | NOBJ=2
42 | NOISE=32
43 | EQ=9
44 | XOBJ=1
45 | CLIP=19
46 | DIVIDE=3
47 | STRING=42
48 | 'floatatom'=11
49 | 'expr'=10
50 | 'trigger'=39
51 | 'sig~'=18
52 | 'noise~'=32
53 | '=='=9
54 | '#X'=1
55 | 'line~'=29
56 | 'mod'=16
57 | 'metro'=15
58 | '>'=7
59 | 'phasor~'=13
60 | 'fcounter'=17
61 | 'canvas'=25
62 | 'vcf~'=23
63 | ';'=43
64 | 'max~'=34
65 | 'tgl'=33
66 | ')'=45
67 | 'osc~'=12
68 | 'unpack'=30
69 | 'dac~'=14
70 | 'lop~'=22
71 | 'connect'=26
72 | 'bng'=40
73 | 'pow'=28
74 | 'hip~'=21
75 | 'min~'=35
76 | '<'=8
77 | '('=44
78 | 'msg'=27
79 | '#N'=2
80 | 'bp~'=20
81 | 'clip~'=19
82 | 'obj'=24
83 | 'cos~'=31
84 |
--------------------------------------------------------------------------------
/fig27-3a.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1294 280 565 668 10;
2 | #X msg 100 92 500;
3 | #X obj 87 152 fcounter;
4 | #X obj 96 185 mod 3;
5 | #X obj 94 223 trigger f f f;
6 | #X obj 94 264 == 0;
7 | #X obj 137 266 == 1;
8 | #X obj 179 264 == 2;
9 | #X obj 84 302 sig~;
10 | #X obj 129 305 sig~;
11 | #X obj 181 305 sig~;
12 | #X obj 73 346 lop~ 70;
13 | #X obj 135 346 lop~ 70;
14 | #X obj 54 386 osc~ 723;
15 | #X obj 118 382 osc~ 932;
16 | #X obj 184 381 osc~ 1012;
17 | #X obj 61 421 *~;
18 | #X obj 119 420 *~;
19 | #X obj 186 420 *~;
20 | #X obj 107 465 *~ 0.2;
21 | #X obj 110 515 dac~;
22 | #X obj 195 344 lop~ 70;
23 | #X connect 0 0 1 0;
24 | #X connect 1 0 2 0;
25 | #X connect 2 0 3 0;
26 | #X connect 3 0 4 0;
27 | #X connect 3 1 5 0;
28 | #X connect 3 2 6 0;
29 | #X connect 4 0 7 0;
30 | #X connect 5 0 8 0;
31 | #X connect 6 0 9 0;
32 | #X connect 7 0 10 0;
33 | #X connect 8 0 11 0;
34 | #X connect 9 0 20 0;
35 | #X connect 10 0 15 1;
36 | #X connect 11 0 16 1;
37 | #X connect 12 0 15 0;
38 | #X connect 13 0 16 0;
39 | #X connect 14 0 17 0;
40 | #X connect 15 0 18 0;
41 | #X connect 16 0 18 0;
42 | #X connect 17 0 18 0;
43 | #X connect 18 0 19 0;
44 | #X connect 18 0 19 1;
45 | #X connect 20 0 17 1;
46 |
--------------------------------------------------------------------------------
/ringingTone.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1421 134 450 762 10;
2 | #X obj 141 101 fcounter;
3 | #X msg 148 55 1000;
4 | #X obj 139 132 mod 6;
5 | #X obj 139 176 > 2;
6 | #X obj 140 207 sig~;
7 | #X obj 139 232 lop~ 100;
8 | #X obj 136 267 *~;
9 | #X obj 30 113 osc~ 480;
10 | #X obj 87 111 osc~ 440;
11 | #X obj 38 157 +~;
12 | #X obj 139 325 *~;
13 | #X msg 178 295 1;
14 | #X obj 120 361 clip~ -0.9 0.9;
15 | #X obj 117 395 bp~ 2000 12;
16 | #X obj 76 432 *~ 0.5;
17 | #X obj 146 431 clip~ -0.4 0.4;
18 | #X obj 162 470 *~ 0.15;
19 | #X obj 130 512 hip~ 90;
20 | #X obj 126 556 hip~ 90;
21 | #X obj 127 597 dac~;
22 | #X obj 78 471 bp~ 400 3;
23 | #X msg 220 295 0;
24 | #X connect 0 0 2 0;
25 | #X connect 1 0 0 0;
26 | #X connect 2 0 3 0;
27 | #X connect 3 0 4 0;
28 | #X connect 4 0 5 0;
29 | #X connect 5 0 6 1;
30 | #X connect 6 0 10 0;
31 | #X connect 7 0 9 0;
32 | #X connect 8 0 9 1;
33 | #X connect 9 0 6 0;
34 | #X connect 10 0 12 0;
35 | #X connect 11 0 10 1;
36 | #X connect 12 0 13 0;
37 | #X connect 13 0 15 0;
38 | #X connect 13 0 14 0;
39 | #X connect 14 0 20 0;
40 | #X connect 15 0 16 0;
41 | #X connect 16 0 17 0;
42 | #X connect 17 0 18 0;
43 | #X connect 18 0 19 0;
44 | #X connect 18 0 19 1;
45 | #X connect 20 0 17 0;
46 | #X connect 21 0 10 1;
47 |
--------------------------------------------------------------------------------
/toyboat.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1114 138 450 530 10;
2 | #X obj 70 41 noise~;
3 | #X obj 180 55 osc~ 9;
4 | #X obj 70 155 *~;
5 | #X obj 119 186 *~ 600;
6 | #X obj 120 219 clip~ 0 1;
7 | #X obj 215 245 noise~;
8 | #X obj 118 250 hip~ 10;
9 | #X obj 117 279 lop~ 30;
10 | #X obj 113 312 *~;
11 | #X obj 221 271 hip~ 1000;
12 | #X obj 71 124 bp~ 9 9;
13 | #X obj 217 300 bp~ 590 4;
14 | #X obj 63 343 bp~ 470 8;
15 | #X obj 130 344 bp~ 780 9;
16 | #X obj 119 382 hip~ 100;
17 | #X obj 199 345 bp~ 1024 9;
18 | #X obj 126 414 *~ 2;
19 | #X obj 113 454 dac~;
20 | #X obj 141 76 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1;
21 | #X obj 213 109 == 0;
22 | #X obj 154 155 *~;
23 | #X connect 0 0 10 0;
24 | #X connect 1 0 20 0;
25 | #X connect 2 0 3 0;
26 | #X connect 3 0 4 0;
27 | #X connect 4 0 6 0;
28 | #X connect 5 0 9 0;
29 | #X connect 6 0 7 0;
30 | #X connect 7 0 8 0;
31 | #X connect 8 0 12 0;
32 | #X connect 8 0 13 0;
33 | #X connect 8 0 15 0;
34 | #X connect 9 0 11 0;
35 | #X connect 10 0 2 0;
36 | #X connect 11 0 8 1;
37 | #X connect 12 0 14 0;
38 | #X connect 13 0 14 0;
39 | #X connect 14 0 16 0;
40 | #X connect 15 0 14 0;
41 | #X connect 16 0 17 0;
42 | #X connect 16 0 17 1;
43 | #X connect 18 0 2 1;
44 | #X connect 18 0 19 0;
45 | #X connect 19 0 20 1;
46 | #X connect 20 0 3 0;
47 |
--------------------------------------------------------------------------------
/fig27-3b.pd:
--------------------------------------------------------------------------------
1 | #N canvas 872 230 565 668 10;
2 | #X obj 54 386 osc~ 723;
3 | #X obj 118 382 osc~ 932;
4 | #X obj 184 381 osc~ 1012;
5 | #X obj 61 421 *~;
6 | #X obj 119 420 *~;
7 | #X obj 186 420 *~;
8 | #X obj 104 465 *~ 0.2;
9 | #X obj 155 522 dac~;
10 | #X obj 75 341 cos~;
11 | #X obj 140 341 cos~;
12 | #X obj 208 345 cos~;
13 | #X obj 72 295 -~ 0.25;
14 | #X obj 141 297 -~ 0.25;
15 | #X obj 213 299 -~ 0.25;
16 | #X obj 76 248 *~ 0.5;
17 | #X obj 146 248 *~ 0.5;
18 | #X obj 216 249 *~ 0.5;
19 | #X obj 150 208 -~ 1;
20 | #X obj 215 209 -~ 2;
21 | #X obj 67 162 clip~ 0 1;
22 | #X obj 151 161 clip~ 1 2;
23 | #X obj 226 159 clip~ 2 3;
24 | #X obj 157 111 *~ 3;
25 | #X obj 161 62 phasor~ 4;
26 | #X connect 0 0 3 0;
27 | #X connect 1 0 4 0;
28 | #X connect 2 0 5 0;
29 | #X connect 3 0 6 0;
30 | #X connect 4 0 6 0;
31 | #X connect 5 0 6 0;
32 | #X connect 6 0 7 0;
33 | #X connect 6 0 7 1;
34 | #X connect 8 0 3 1;
35 | #X connect 9 0 4 1;
36 | #X connect 10 0 5 1;
37 | #X connect 11 0 8 0;
38 | #X connect 12 0 9 0;
39 | #X connect 13 0 10 0;
40 | #X connect 14 0 11 0;
41 | #X connect 15 0 12 0;
42 | #X connect 16 0 13 0;
43 | #X connect 17 0 15 0;
44 | #X connect 18 0 16 0;
45 | #X connect 19 0 14 0;
46 | #X connect 20 0 17 0;
47 | #X connect 21 0 18 0;
48 | #X connect 22 0 19 0;
49 | #X connect 22 0 20 0;
50 | #X connect 22 0 21 0;
51 | #X connect 23 0 22 0;
52 |
--------------------------------------------------------------------------------
/turbine.pd:
--------------------------------------------------------------------------------
1 | #N canvas 66 82 591 697 10;
2 | #X obj 150 175 sig~;
3 | #X obj 191 177 sig~;
4 | #X obj 235 178 sig~;
5 | #X obj 274 177 sig~;
6 | #X obj 313 176 sig~;
7 | #X msg 161 104 3097 4495 5588 7471 11000;
8 | #X obj 153 216 *~;
9 | #X obj 193 216 *~;
10 | #X obj 235 216 *~;
11 | #X obj 275 213 *~;
12 | #X obj 315 213 *~;
13 | #X obj 143 267 osc~;
14 | #X obj 188 267 osc~;
15 | #X obj 233 267 osc~;
16 | #X obj 281 265 osc~;
17 | #X obj 322 269 osc~;
18 | #X obj 187 325 *~ 0.25;
19 | #X obj 305 323 *~ 0.4;
20 | #X obj 249 370 clip~ -0.9 0.9;
21 | #X obj 175 136 unpack f f f f f;
22 | #X obj 158 45 loadbang;
23 | #X obj 270 51 inlet~ engine speed;
24 | #X obj 261 410 outlet~;
25 | #X connect 0 0 6 0;
26 | #X connect 1 0 7 0;
27 | #X connect 2 0 8 0;
28 | #X connect 3 0 9 0;
29 | #X connect 4 0 10 0;
30 | #X connect 5 0 19 0;
31 | #X connect 6 0 11 0;
32 | #X connect 7 0 12 0;
33 | #X connect 8 0 13 0;
34 | #X connect 9 0 14 0;
35 | #X connect 10 0 15 0;
36 | #X connect 11 0 16 0;
37 | #X connect 12 0 16 0;
38 | #X connect 13 0 18 0;
39 | #X connect 14 0 17 0;
40 | #X connect 15 0 17 0;
41 | #X connect 16 0 18 0;
42 | #X connect 17 0 18 0;
43 | #X connect 18 0 22 0;
44 | #X connect 19 0 0 0;
45 | #X connect 19 1 1 0;
46 | #X connect 19 2 2 0;
47 | #X connect 19 3 3 0;
48 | #X connect 19 4 4 0;
49 | #X connect 20 0 5 0;
50 | #X connect 21 0 6 1;
51 | #X connect 21 0 7 1;
52 | #X connect 21 0 8 1;
53 | #X connect 21 0 9 1;
54 | #X connect 21 0 10 1;
55 |
--------------------------------------------------------------------------------
/figures/figure25-6.pd:
--------------------------------------------------------------------------------
1 | #N canvas 66 82 717 880 10;
2 | #X msg 199 109 5;
3 | #X obj 190 171 t b f;
4 | #X obj 232 225 * 100;
5 | #X obj 240 264 delay;
6 | #X msg 168 294 1;
7 | #X msg 236 301 0;
8 | #X obj 176 339 metro 100;
9 | #X obj 154 390 t b b;
10 | #X obj 218 427 del 40;
11 | #X obj 150 460 + 1;
12 | #X obj 203 460 == 0;
13 | #X obj 146 499 sig~;
14 | #X obj 177 791 dac~;
15 | #X obj 165 537 clip~ -0.9 0.9;
16 | #X obj 162 571 bp~ 2000 12;
17 | #X obj 121 608 *~ 0.5;
18 | #X obj 191 607 clip~ -0.4 0.4;
19 | #X obj 207 646 *~ 0.15;
20 | #X obj 175 688 hip~ 90;
21 | #X obj 171 732 hip~ 90;
22 | #X obj 123 647 bp~ 400 3;
23 | #X obj 190 767 *~ 0.8;
24 | #X obj 217 378 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
25 | -1 -1;
26 | #X floatatom 193 492 5 0 0 0 - - -;
27 | #X connect 0 0 1 0;
28 | #X connect 1 0 4 0;
29 | #X connect 1 1 2 0;
30 | #X connect 2 0 3 0;
31 | #X connect 3 0 5 0;
32 | #X connect 4 0 6 0;
33 | #X connect 5 0 6 0;
34 | #X connect 6 0 7 0;
35 | #X connect 6 0 22 0;
36 | #X connect 7 0 9 0;
37 | #X connect 7 1 8 0;
38 | #X connect 8 0 9 0;
39 | #X connect 9 0 11 0;
40 | #X connect 9 0 10 0;
41 | #X connect 9 0 23 0;
42 | #X connect 10 0 9 1;
43 | #X connect 11 0 13 0;
44 | #X connect 13 0 14 0;
45 | #X connect 14 0 16 0;
46 | #X connect 14 0 15 0;
47 | #X connect 15 0 20 0;
48 | #X connect 16 0 17 0;
49 | #X connect 17 0 18 0;
50 | #X connect 18 0 19 0;
51 | #X connect 19 0 21 0;
52 | #X connect 20 0 18 0;
53 | #X connect 21 0 12 0;
54 | #X connect 21 0 12 1;
55 |
--------------------------------------------------------------------------------
/fireme.pd:
--------------------------------------------------------------------------------
1 | #N canvas 853 267 558 600 10;
2 | #X obj 158 71 noise~;
3 | #X obj 187 312 *~ 0.6;
4 | #X obj 132 313 *~ 0.3;
5 | #X obj 113 242 *~;
6 | #X obj 153 116 lop~ 1;
7 | #X obj 154 166 *~;
8 | #X obj 78 117 hip~ 1000;
9 | #X obj 153 192 *~;
10 | #X obj 154 139 *~ 10;
11 | #X obj 228 173 clip~ -0.9 0.9;
12 | #X obj 228 193 hip~ 25;
13 | #X obj 228 150 hip~ 25;
14 | #X obj 228 217 *~ 0.6;
15 | #X obj 338 458 hip~ 1000;
16 | #X obj 143 457 bp~ 1200 0.6;
17 | #X obj 60 456 bp~ 600 0.2;
18 | #X obj 153 216 *~ 600;
19 | #X obj 192 553 dac~;
20 | #X floatatom 312 53 5 0.1 5 0 - - -;
21 | #X obj 227 125 *~ 100;
22 | #X obj 228 99 bp~ 30 5;
23 | #X obj 232 455 bp~ 2600 0.4;
24 | #X obj 196 501 *~ 0.2;
25 | #X connect 0 0 4 0;
26 | #X connect 0 0 6 0;
27 | #X connect 0 0 20 0;
28 | #X connect 1 0 15 0;
29 | #X connect 1 0 14 0;
30 | #X connect 1 0 21 0;
31 | #X connect 1 0 13 0;
32 | #X connect 2 0 15 0;
33 | #X connect 2 0 14 0;
34 | #X connect 2 0 21 0;
35 | #X connect 2 0 13 0;
36 | #X connect 3 0 2 0;
37 | #X connect 4 0 8 0;
38 | #X connect 5 0 7 0;
39 | #X connect 5 0 7 1;
40 | #X connect 6 0 3 0;
41 | #X connect 7 0 16 0;
42 | #X connect 8 0 5 0;
43 | #X connect 8 0 5 1;
44 | #X connect 9 0 10 0;
45 | #X connect 10 0 12 0;
46 | #X connect 11 0 9 0;
47 | #X connect 12 0 1 0;
48 | #X connect 13 0 22 0;
49 | #X connect 14 0 22 0;
50 | #X connect 15 0 22 0;
51 | #X connect 16 0 3 1;
52 | #X connect 18 0 20 2;
53 | #X connect 19 0 11 0;
54 | #X connect 20 0 19 0;
55 | #X connect 21 0 22 0;
56 | #X connect 22 0 17 0;
57 | #X connect 22 0 17 1;
58 |
--------------------------------------------------------------------------------
/schroder.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1380 121 450 502 10;
2 | #X obj 103 46 osc~ 440;
3 | #X obj 217 43 delread~ A 101;
4 | #X obj 234 67 delread~ B 143;
5 | #X obj 252 93 delread~ C 165;
6 | #X obj 271 124 delread~ D 177;
7 | #X obj 104 91 +~;
8 | #X obj 146 91 +~;
9 | #X obj 106 160 +~;
10 | #X obj 212 166 +~;
11 | #X obj 152 159 -~;
12 | #X obj 251 166 -~;
13 | #X obj 145 216 +~;
14 | #X obj 106 217 +~;
15 | #X obj 176 216 -~;
16 | #X obj 213 215 -~;
17 | #X obj 106 264 *~ 0.4;
18 | #X obj 155 292 *~ 0.37;
19 | #X obj 203 314 *~ 0.333;
20 | #X obj 255 338 *~ 0.3;
21 | #X obj 255 378 delwrite~ D 1000;
22 | #X obj 218 398 delwrite~ C 1000;
23 | #X obj 169 418 delwrite~ B 1000;
24 | #X obj 130 438 delwrite~ A 1000;
25 | #X obj 40 190 dac~;
26 | #X floatatom 94 15 5 0 0 0 - - -;
27 | #X connect 0 0 5 0;
28 | #X connect 0 0 6 0;
29 | #X connect 1 0 5 1;
30 | #X connect 2 0 6 1;
31 | #X connect 3 0 8 0;
32 | #X connect 3 0 10 0;
33 | #X connect 4 0 8 1;
34 | #X connect 4 0 10 1;
35 | #X connect 5 0 23 0;
36 | #X connect 5 0 7 0;
37 | #X connect 5 0 9 0;
38 | #X connect 6 0 23 1;
39 | #X connect 6 0 9 1;
40 | #X connect 6 0 7 1;
41 | #X connect 7 0 12 0;
42 | #X connect 7 0 13 0;
43 | #X connect 8 0 12 1;
44 | #X connect 8 0 13 1;
45 | #X connect 9 0 11 0;
46 | #X connect 9 0 14 0;
47 | #X connect 10 0 11 1;
48 | #X connect 10 0 14 1;
49 | #X connect 11 0 16 0;
50 | #X connect 12 0 15 0;
51 | #X connect 13 0 17 0;
52 | #X connect 14 0 18 0;
53 | #X connect 15 0 22 0;
54 | #X connect 16 0 21 0;
55 | #X connect 17 0 20 0;
56 | #X connect 18 0 19 0;
57 | #X connect 24 0 0 0;
58 |
--------------------------------------------------------------------------------
/mywind.pd:
--------------------------------------------------------------------------------
1 | #N canvas 666 209 750 598 10;
2 | #X obj 237 374 noise~;
3 | #X obj 238 406 bp~ 800 1;
4 | #X obj 185 472 *~ 0.3;
5 | #X obj 186 508 dac~;
6 | #X obj 176 54 +~ 1;
7 | #X obj 176 85 *~ 0.25;
8 | #X obj 212 331 +~;
9 | #X obj 182 362 +~;
10 | #X obj 177 21 osc~ 0.1;
11 | #X obj 183 408 +~ 0.2;
12 | #X obj 184 436 *~;
13 | #X obj 194 125 noise~;
14 | #X obj 194 163 lop~ 0.5;
15 | #X obj 194 199 lop~ 0.5;
16 | #X obj 194 234 *~ 50;
17 | #X obj 302 161 +~ 0.5;
18 | #X obj 300 197 *~;
19 | #X obj 300 233 -~ 0.125;
20 | #X obj 235 271 *~;
21 | #X obj 383 123 max~ 0.4;
22 | #X obj 455 105 noise~;
23 | #X obj 454 134 lop~ 3;
24 | #X obj 454 161 lop~ 3;
25 | #X obj 454 214 *~ 20;
26 | #X obj 383 181 *~ 8;
27 | #X obj 382 212 *~;
28 | #X obj 382 256 *~;
29 | #X obj 383 153 -~ 0.4;
30 | #X obj 455 191 hip~ 0.001;
31 | #X connect 0 0 1 0;
32 | #X connect 1 0 10 1;
33 | #X connect 2 0 3 0;
34 | #X connect 2 0 3 1;
35 | #X connect 4 0 5 0;
36 | #X connect 5 0 7 0;
37 | #X connect 5 0 15 0;
38 | #X connect 5 0 19 0;
39 | #X connect 6 0 7 1;
40 | #X connect 7 0 9 0;
41 | #X connect 8 0 4 0;
42 | #X connect 9 0 10 0;
43 | #X connect 10 0 2 0;
44 | #X connect 11 0 12 0;
45 | #X connect 12 0 13 0;
46 | #X connect 13 0 14 0;
47 | #X connect 14 0 18 0;
48 | #X connect 15 0 16 0;
49 | #X connect 15 0 16 1;
50 | #X connect 16 0 17 0;
51 | #X connect 17 0 18 1;
52 | #X connect 18 0 6 0;
53 | #X connect 19 0 27 0;
54 | #X connect 20 0 21 0;
55 | #X connect 21 0 22 0;
56 | #X connect 22 0 28 0;
57 | #X connect 23 0 26 1;
58 | #X connect 24 0 25 0;
59 | #X connect 24 0 25 1;
60 | #X connect 25 0 26 0;
61 | #X connect 26 0 6 1;
62 | #X connect 27 0 24 0;
63 | #X connect 28 0 23 0;
64 |
--------------------------------------------------------------------------------
/jetengine.pd:
--------------------------------------------------------------------------------
1 | #N canvas 1138 169 775 718 10;
2 | #X obj 302 40 sig~;
3 | #X obj 301 63 lop~ 0.2;
4 | #X obj 253 492 *~ 0.5;
5 | #X obj 251 528 +~;
6 | #X obj 249 563 lop~ 11000;
7 | #X obj 254 639 dac~;
8 | #X obj 251 600 *~ 0.1;
9 | #X obj 23 218 sig~;
10 | #X obj 64 220 sig~;
11 | #X obj 108 221 sig~;
12 | #X obj 147 220 sig~;
13 | #X obj 186 219 sig~;
14 | #X msg 34 147 3097 4495 5588 7471 11000;
15 | #X obj 26 259 *~;
16 | #X obj 66 259 *~;
17 | #X obj 108 259 *~;
18 | #X obj 148 256 *~;
19 | #X obj 188 256 *~;
20 | #X obj 16 310 osc~;
21 | #X obj 61 310 osc~;
22 | #X obj 106 310 osc~;
23 | #X obj 154 308 osc~;
24 | #X obj 195 312 osc~;
25 | #X obj 60 368 *~ 0.25;
26 | #X obj 178 366 *~ 0.4;
27 | #X obj 122 413 clip~ -0.9 0.9;
28 | #X obj 48 179 unpack f f f f f;
29 | #X obj 396 149 *~;
30 | #X obj 396 198 *~ 150;
31 | #X msg 451 198 1;
32 | #X msg 487 198 0.6;
33 | #X obj 373 235 noise~;
34 | #X obj 374 338 hip~ 120;
35 | #X obj 373 371 *~ 120;
36 | #X obj 374 400 clip~ -1 1;
37 | #X obj 404 423 *~ 12000;
38 | #X floatatom 303 17 5 0.1 1 0 - - -;
39 | #X obj 375 461 vcf~ 0 0.6;
40 | #X obj 373 307 vcf~ 0 1;
41 | #X obj 374 270 bp~ 8000 0.5;
42 | #X connect 0 0 1 0;
43 | #X connect 1 0 13 1;
44 | #X connect 1 0 14 1;
45 | #X connect 1 0 15 1;
46 | #X connect 1 0 16 1;
47 | #X connect 1 0 17 1;
48 | #X connect 1 0 27 1;
49 | #X connect 1 0 27 0;
50 | #X connect 1 0 35 0;
51 | #X connect 2 0 3 0;
52 | #X connect 3 0 4 0;
53 | #X connect 4 0 6 0;
54 | #X connect 6 0 5 0;
55 | #X connect 6 0 5 1;
56 | #X connect 7 0 13 0;
57 | #X connect 8 0 14 0;
58 | #X connect 9 0 15 0;
59 | #X connect 10 0 16 0;
60 | #X connect 11 0 17 0;
61 | #X connect 12 0 26 0;
62 | #X connect 13 0 18 0;
63 | #X connect 14 0 19 0;
64 | #X connect 15 0 20 0;
65 | #X connect 16 0 21 0;
66 | #X connect 17 0 22 0;
67 | #X connect 18 0 23 0;
68 | #X connect 19 0 23 0;
69 | #X connect 20 0 25 0;
70 | #X connect 21 0 24 0;
71 | #X connect 22 0 24 0;
72 | #X connect 23 0 25 0;
73 | #X connect 24 0 25 0;
74 | #X connect 25 0 2 0;
75 | #X connect 26 0 7 0;
76 | #X connect 26 1 8 0;
77 | #X connect 26 2 9 0;
78 | #X connect 26 3 10 0;
79 | #X connect 26 4 11 0;
80 | #X connect 27 0 28 0;
81 | #X connect 28 0 38 1;
82 | #X connect 29 0 38 2;
83 | #X connect 30 0 37 2;
84 | #X connect 31 0 39 0;
85 | #X connect 32 0 33 0;
86 | #X connect 33 0 34 0;
87 | #X connect 34 0 37 0;
88 | #X connect 35 0 37 1;
89 | #X connect 36 0 0 0;
90 | #X connect 37 0 3 1;
91 | #X connect 38 0 32 0;
92 | #X connect 39 0 38 0;
93 |
--------------------------------------------------------------------------------
/src/RowsListener.java:
--------------------------------------------------------------------------------
1 | // Generated from Rows.g4 by ANTLR 4.2.2
2 | import org.antlr.v4.runtime.misc.NotNull;
3 | import org.antlr.v4.runtime.tree.ParseTreeListener;
4 |
5 | /**
6 | * This interface defines a complete listener for a parse tree produced by
7 | * {@link RowsParser}.
8 | */
9 | public interface RowsListener extends ParseTreeListener {
10 | /**
11 | * Enter a parse tree produced by {@link RowsParser#Minus}.
12 | * @param ctx the parse tree
13 | */
14 | void enterMinus(@NotNull RowsParser.MinusContext ctx);
15 | /**
16 | * Exit a parse tree produced by {@link RowsParser#Minus}.
17 | * @param ctx the parse tree
18 | */
19 | void exitMinus(@NotNull RowsParser.MinusContext ctx);
20 |
21 | /**
22 | * Enter a parse tree produced by {@link RowsParser#file}.
23 | * @param ctx the parse tree
24 | */
25 | void enterFile(@NotNull RowsParser.FileContext ctx);
26 | /**
27 | * Exit a parse tree produced by {@link RowsParser#file}.
28 | * @param ctx the parse tree
29 | */
30 | void exitFile(@NotNull RowsParser.FileContext ctx);
31 |
32 | /**
33 | * Enter a parse tree produced by {@link RowsParser#Paren}.
34 | * @param ctx the parse tree
35 | */
36 | void enterParen(@NotNull RowsParser.ParenContext ctx);
37 | /**
38 | * Exit a parse tree produced by {@link RowsParser#Paren}.
39 | * @param ctx the parse tree
40 | */
41 | void exitParen(@NotNull RowsParser.ParenContext ctx);
42 |
43 | /**
44 | * Enter a parse tree produced by {@link RowsParser#row}.
45 | * @param ctx the parse tree
46 | */
47 | void enterRow(@NotNull RowsParser.RowContext ctx);
48 | /**
49 | * Exit a parse tree produced by {@link RowsParser#row}.
50 | * @param ctx the parse tree
51 | */
52 | void exitRow(@NotNull RowsParser.RowContext ctx);
53 |
54 | /**
55 | * Enter a parse tree produced by {@link RowsParser#Single}.
56 | * @param ctx the parse tree
57 | */
58 | void enterSingle(@NotNull RowsParser.SingleContext ctx);
59 | /**
60 | * Exit a parse tree produced by {@link RowsParser#Single}.
61 | * @param ctx the parse tree
62 | */
63 | void exitSingle(@NotNull RowsParser.SingleContext ctx);
64 |
65 | /**
66 | * Enter a parse tree produced by {@link RowsParser#MulDiv}.
67 | * @param ctx the parse tree
68 | */
69 | void enterMulDiv(@NotNull RowsParser.MulDivContext ctx);
70 | /**
71 | * Exit a parse tree produced by {@link RowsParser#MulDiv}.
72 | * @param ctx the parse tree
73 | */
74 | void exitMulDiv(@NotNull RowsParser.MulDivContext ctx);
75 | }
--------------------------------------------------------------------------------
/src/Rows.g4:
--------------------------------------------------------------------------------
1 | grammar Rows;
2 |
3 |
4 | file: (row)+ ;
5 | row:XOBJ type=CONNECT INT? INT? INT? INT? SEMICOLON NL
6 | |XOBJ type=OBJ INT INT name=OSC expr? SEMICOLON NL
7 | |XOBJ type=OBJ INT INT name=PHASOR INT? SEMICOLON NL
8 | |XOBJ type=OBJ INT INT name=DAC SEMICOLON NL
9 | |NOBJ type=CANVAS INT? INT? INT? INT? INT? SEMICOLON NL
10 | |XOBJ type=FLOATATOM expr expr expr expr expr expr MINUS MINUS MINUS SEMICOLON NL
11 | |XOBJ type=OBJ INT INT name=PLUS number=(INT|FLOAT)? SEMICOLON NL
12 | |XOBJ type=OBJ INT INT name=MINUS number=(INT|FLOAT)? SEMICOLON NL
13 | |XOBJ type=OBJ INT INT name=MULTIPLY number=(INT|FLOAT)? SEMICOLON NL
14 | |XOBJ type=OBJ INT INT name=DIVIDE number=(INT|FLOAT)? SEMICOLON NL
15 | |XOBJ type=OBJ INT INT name=POW number=(INT|FLOAT)? SEMICOLON NL
16 | |XOBJ type=OBJ INT INT name=TRIGGER (INT|FLOAT|STRING)+ SEMICOLON NL
17 | |XOBJ type=OBJ INT INT name=BANG INT INT INT INT STRING STRING STRING INT INT INT INT expr expr NL expr SEMICOLON NL
18 | |XOBJ type=OBJ INT INT name=EXPR expr SEMICOLON NL
19 | |XOBJ type=MSG INT INT (INT|FLOAT)* SEMICOLON NL
20 | |XOBJ type=OBJ INT INT name=METRO INT SEMICOLON NL
21 | |XOBJ type=OBJ INT INT name=FCOUNTER SEMICOLON NL
22 | |XOBJ type=OBJ INT INT name=MOD INT SEMICOLON NL
23 | |XOBJ type=OBJ INT INT name=CLIP expr expr SEMICOLON NL
24 | |XOBJ type=OBJ INT INT name=VCF expr expr SEMICOLON NL
25 | |XOBJ type=OBJ INT INT name=BP expr expr SEMICOLON NL
26 | |XOBJ type=OBJ INT INT name=HIP expr? SEMICOLON NL
27 | |XOBJ type=OBJ INT INT name=LOP expr? SEMICOLON NL
28 | |XOBJ type=OBJ INT INT name=MAX expr? SEMICOLON NL
29 | |XOBJ type=OBJ INT INT name=MIN expr? SEMICOLON NL
30 | |XOBJ type=OBJ INT INT name=GT expr? SEMICOLON NL
31 | |XOBJ type=OBJ INT INT name=LT expr? SEMICOLON NL
32 | |XOBJ type=OBJ INT INT name=EQ expr? SEMICOLON NL
33 | |XOBJ type=OBJ INT INT name=LINE SEMICOLON NL
34 | |XOBJ type=OBJ INT INT name=UNPACK (INT|FLOAT|STRING)+ SEMICOLON NL
35 | |XOBJ type=OBJ INT INT name=COS SEMICOLON NL
36 | |XOBJ type=OBJ INT INT name=NOISE SEMICOLON NL
37 | |XOBJ type=OBJ INT INT name=TGL INT INT STRING STRING STRING expr expr expr expr expr expr expr expr expr SEMICOLON NL
38 | |XOBJ type=OBJ INT INT name=SIG number=(INT|FLOAT)? SEMICOLON NL;
39 |
40 |
41 | expr: (INT|FLOAT|VAR) #Single
42 | |expr (MULTIPLY|DIVIDE) expr #MulDiv
43 | |expr (PLUS|MINUS) expr #Single
44 | |MINUS expr #Minus
45 | |LPAREN expr RPAREN #Paren
46 | ;
47 |
48 | XOBJ: '#X';
49 | NOBJ: '#N';
50 | DIVIDE: '/' | '/~';
51 | MULTIPLY: '*' | '*~';
52 | MINUS: '-' | '-~';
53 | PLUS: '+'| '+~';
54 | GT: '>';
55 | LT: '<';
56 | EQ: '==';
57 | EXPR: 'expr';
58 | FLOATATOM: 'floatatom';
59 | OSC: 'osc~';
60 | PHASOR: 'phasor~';
61 | DAC: 'dac~';
62 | METRO: 'metro';
63 | MOD: 'mod';
64 | FCOUNTER: 'fcounter';
65 | SIG: 'sig~';
66 | CLIP: 'clip~';
67 | BP: 'bp~';
68 | HIP: 'hip~';
69 | LOP: 'lop~';
70 | VCF: 'vcf~';
71 | OBJ: 'obj';
72 | CANVAS: 'canvas';
73 | CONNECT: 'connect';
74 | MSG: 'msg';
75 | POW: 'pow';
76 | LINE: 'line~';
77 | UNPACK: 'unpack';
78 | COS: 'cos~';
79 | NOISE: 'noise~';
80 | TGL: 'tgl';
81 | MAX: 'max~';
82 | MIN: 'min~';
83 |
84 | INT: DIGIT+;
85 | FLOAT: DIGIT+ '.' DIGIT*;
86 | DIGIT: [0-9];
87 | TRIGGER : 'trigger';
88 | BANG: 'bng';
89 | VAR: '$'STRING;
90 | STRING: [a-zA-z0-9]+;
91 | SEMICOLON : ';';
92 | LPAREN: '(';
93 | RPAREN: ')';
94 |
95 |
96 | TAB : [ \t]+ -> skip ;
97 | NL : '\r'? '\n';
98 |
99 |
--------------------------------------------------------------------------------
/src/RowsBaseListener.java:
--------------------------------------------------------------------------------
1 | // Generated from Rows.g4 by ANTLR 4.2.2
2 |
3 | import org.antlr.v4.runtime.ParserRuleContext;
4 | import org.antlr.v4.runtime.misc.NotNull;
5 | import org.antlr.v4.runtime.tree.ErrorNode;
6 | import org.antlr.v4.runtime.tree.TerminalNode;
7 |
8 | /**
9 | * This class provides an empty implementation of {@link RowsListener},
10 | * which can be extended to create a listener which only needs to handle a subset
11 | * of the available methods.
12 | */
13 | public class RowsBaseListener implements RowsListener {
14 | /**
15 | * {@inheritDoc}
16 | *
17 | *
The default implementation does nothing.
18 | */
19 | @Override public void enterMinus(@NotNull RowsParser.MinusContext ctx) { }
20 | /**
21 | * {@inheritDoc}
22 | *
23 | * The default implementation does nothing.
24 | */
25 | @Override public void exitMinus(@NotNull RowsParser.MinusContext ctx) { }
26 |
27 | /**
28 | * {@inheritDoc}
29 | *
30 | * The default implementation does nothing.
31 | */
32 | @Override public void enterFile(@NotNull RowsParser.FileContext ctx) { }
33 | /**
34 | * {@inheritDoc}
35 | *
36 | * The default implementation does nothing.
37 | */
38 | @Override public void exitFile(@NotNull RowsParser.FileContext ctx) { }
39 |
40 | /**
41 | * {@inheritDoc}
42 | *
43 | * The default implementation does nothing.
44 | */
45 | @Override public void enterParen(@NotNull RowsParser.ParenContext ctx) { }
46 | /**
47 | * {@inheritDoc}
48 | *
49 | * The default implementation does nothing.
50 | */
51 | @Override public void exitParen(@NotNull RowsParser.ParenContext ctx) { }
52 |
53 | /**
54 | * {@inheritDoc}
55 | *
56 | * The default implementation does nothing.
57 | */
58 | @Override public void enterRow(@NotNull RowsParser.RowContext ctx) { }
59 | /**
60 | * {@inheritDoc}
61 | *
62 | * The default implementation does nothing.
63 | */
64 | @Override public void exitRow(@NotNull RowsParser.RowContext ctx) { }
65 |
66 | /**
67 | * {@inheritDoc}
68 | *
69 | * The default implementation does nothing.
70 | */
71 | @Override public void enterSingle(@NotNull RowsParser.SingleContext ctx) { }
72 | /**
73 | * {@inheritDoc}
74 | *
75 | * The default implementation does nothing.
76 | */
77 | @Override public void exitSingle(@NotNull RowsParser.SingleContext ctx) { }
78 |
79 | /**
80 | * {@inheritDoc}
81 | *
82 | * The default implementation does nothing.
83 | */
84 | @Override public void enterMulDiv(@NotNull RowsParser.MulDivContext ctx) { }
85 | /**
86 | * {@inheritDoc}
87 | *
88 | * The default implementation does nothing.
89 | */
90 | @Override public void exitMulDiv(@NotNull RowsParser.MulDivContext ctx) { }
91 |
92 | /**
93 | * {@inheritDoc}
94 | *
95 | * The default implementation does nothing.
96 | */
97 | @Override public void enterEveryRule(@NotNull ParserRuleContext ctx) { }
98 | /**
99 | * {@inheritDoc}
100 | *
101 | * The default implementation does nothing.
102 | */
103 | @Override public void exitEveryRule(@NotNull ParserRuleContext ctx) { }
104 | /**
105 | * {@inheritDoc}
106 | *
107 | * The default implementation does nothing.
108 | */
109 | @Override public void visitTerminal(@NotNull TerminalNode node) { }
110 | /**
111 | * {@inheritDoc}
112 | *
113 | * The default implementation does nothing.
114 | */
115 | @Override public void visitErrorNode(@NotNull ErrorNode node) { }
116 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Hello all
2 |
3 | This project was my thesis project, and it's been much while since I dealt with it. 8 years ! :)
4 |
5 | Regarding the rising era of the game technologies, I decided to have a look at the project because of some coincidences that
6 | I faced this week (06.08.2022).
7 |
8 | I have added required dependencies and some documentation telling how you can run this project with your PD patches
9 | and get some dsp code written for Faust.
10 |
11 | If you have any questions, please fire an **Issue**.
12 |
13 | ## Introduction
14 | Mephisto is a transpiler for converting sound patches designed using the graphical computer music
15 | environment Pure Data to the functional DSP programming language Faust. Faust itself compiles into
16 | highly-optimized C++ code. The aim of the transpiler is to enable creating highly optimized C++ code
17 | embeddable in games or other interactive media for sound designers, musicians and sound engineers using
18 | PureData in their workflows and to reduce the prototype-to-product delay.
19 |
20 | PD and Max/MSP softwares are widely used for procedural sound design for games.
21 | However, the software cannot be easily integrated with games. On the other hand,
22 | various optimized synthesizes can be developed using low level languages by Faust.
23 | Transporting models and applying the same algorithms from PD to Faust is really
24 | a burden to procedural sound designers. The aim of this project is to write a source
25 | to source transpiler which transpiles PD source to Faust source. After getting faust code, it is up to you and
26 | Faust to generate the C++ code.
27 |
28 | ## How to Run in Unix Environments
29 | - Build the application from its sources
30 | - `javac -cp antlr-4.2.2-complete.jar:. -d bin src/*.java`
31 | - For testing purposes you can use the input1.pd file to see whether the app is running correctly or not
32 | - `java -cp antlr-4.2.2-complete.jar:./bin ConvertPd input1.pd`
33 | - You will see the transpiled output in the output console. Additionally, `input1.dsp` file will be created in order to
34 | be used in Faust. My using this file with Faust, you can get optimized C++ code which can be used natively in your games.
35 |
36 | ## How to Run The Transpiler with JetBrains Intellij IDE
37 | - Open your IDE, then clone and open the project.
38 | - Right click the file `antlr-4.2.2-complete.jar` and click `Add as a library`.
39 | - Right click `src/ConvertPd.java` file, then go to `More Run/Debug` > `Modify Run Configuration`
40 | - For testing purposes, give the `input1.pd` file as program argument and then click `Ok`
41 | - Finally, right click again the `src/ConvertPd.java` file, then click `Run ConvertPD.main()`
42 | - You will see the transpiled output in the output console. Additionally, `input1.dsp` file will be created in order to
43 | be used in Faust. My using this file with Faust, you can get optimized C++ code which can be used natively in your games.
44 |
45 | ## About The Code
46 | - `Rows.g4` file defines the grammar of internals of the .pd files. After you draw a patch and save it in PureData (PD),
47 | you will see a bunch of lines defining what you have drawn in the UI when you open the file with a text editor.
48 | - All files contained in the expression `Rows*.java` are created by ANTLR (https://www.antlr.org/) using `Rows.g4` file.
49 | - `ConvertPdListener.java` is the file where the whole logic resides. Compiling and Faust code generation happen in here
50 | by using the Lexer and the Parser which are generated by ANTLR.
51 | - `ConvertPd.java` file is the main class which runs the application by using the classes created via ANTLR and the file
52 | `ConvertPdListener.java`
53 |
54 | ## Extending the Grammar
55 | If you want to further improve the transpiler, there are two things to consider:
56 | - You can extend the grammar by editing the `Rows.g4` file. You can add new rules for the grammar if you want to
57 | implement some unimplemented blocks of PD. After editing the grammar file, you should re-build the project as instructed
58 | above.
59 | - After re-building the Lexer and Parser, you should add the transpiling logic of the block into the `ConvertPdListener.java`
60 | file.
61 |
62 | This file's structure is as below:
63 | - `public void enterRow(RowsParser.RowContext ctx)` function is called for every row in the .pd file. In this function,
64 | `PDObject`(class)s are created by looking the tokens provided by the `Parser`.
65 | - Everything is started when the exitFile function is called. This is because `~dac` object in the pd file resides at the bottom
66 | of the file. If you think the pd patch as a graph and the `~dac` object as the starting point, this function starts the traversal.
67 | It looks for the objects coming into the inlets of the `~dac` object and then calls
68 | `public String createObject_setOutput(int objectNumber,int outletNumber)` function.
69 | - `createObject_setOutput` function is used for every other `PDObject` and defines the Faust equivalents of the objects.
70 | Additionally, it is responsible for connecting the inlets and the outlets of the objects. This function continues to be
71 | called recursively until a leaf object is reached. As a result whole graph is traversed and the Faust code is generated.
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/RowsLexer.java:
--------------------------------------------------------------------------------
1 | // Generated from Rows.g4 by ANTLR 4.2.2
2 | import org.antlr.v4.runtime.Lexer;
3 | import org.antlr.v4.runtime.CharStream;
4 | import org.antlr.v4.runtime.Token;
5 | import org.antlr.v4.runtime.TokenStream;
6 | import org.antlr.v4.runtime.*;
7 | import org.antlr.v4.runtime.atn.*;
8 | import org.antlr.v4.runtime.dfa.DFA;
9 | import org.antlr.v4.runtime.misc.*;
10 |
11 | @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
12 | public class RowsLexer extends Lexer {
13 | protected static final DFA[] _decisionToDFA;
14 | protected static final PredictionContextCache _sharedContextCache =
15 | new PredictionContextCache();
16 | public static final int
17 | XOBJ=1, NOBJ=2, DIVIDE=3, MULTIPLY=4, MINUS=5, PLUS=6, GT=7, LT=8, EQ=9,
18 | EXPR=10, FLOATATOM=11, OSC=12, PHASOR=13, DAC=14, METRO=15, MOD=16, FCOUNTER=17,
19 | SIG=18, CLIP=19, BP=20, HIP=21, LOP=22, VCF=23, OBJ=24, CANVAS=25, CONNECT=26,
20 | MSG=27, POW=28, LINE=29, UNPACK=30, COS=31, NOISE=32, TGL=33, MAX=34,
21 | MIN=35, INT=36, FLOAT=37, DIGIT=38, TRIGGER=39, BANG=40, VAR=41, STRING=42,
22 | SEMICOLON=43, LPAREN=44, RPAREN=45, TAB=46, NL=47;
23 | public static String[] modeNames = {
24 | "DEFAULT_MODE"
25 | };
26 |
27 | public static final String[] tokenNames = {
28 | "",
29 | "'#X'", "'#N'", "DIVIDE", "MULTIPLY", "MINUS", "PLUS", "'>'", "'<'", "'=='",
30 | "'expr'", "'floatatom'", "'osc~'", "'phasor~'", "'dac~'", "'metro'", "'mod'",
31 | "'fcounter'", "'sig~'", "'clip~'", "'bp~'", "'hip~'", "'lop~'", "'vcf~'",
32 | "'obj'", "'canvas'", "'connect'", "'msg'", "'pow'", "'line~'", "'unpack'",
33 | "'cos~'", "'noise~'", "'tgl'", "'max~'", "'min~'", "INT", "FLOAT", "DIGIT",
34 | "'trigger'", "'bng'", "VAR", "STRING", "';'", "'('", "')'", "TAB", "NL"
35 | };
36 | public static final String[] ruleNames = {
37 | "XOBJ", "NOBJ", "DIVIDE", "MULTIPLY", "MINUS", "PLUS", "GT", "LT", "EQ",
38 | "EXPR", "FLOATATOM", "OSC", "PHASOR", "DAC", "METRO", "MOD", "FCOUNTER",
39 | "SIG", "CLIP", "BP", "HIP", "LOP", "VCF", "OBJ", "CANVAS", "CONNECT",
40 | "MSG", "POW", "LINE", "UNPACK", "COS", "NOISE", "TGL", "MAX", "MIN", "INT",
41 | "FLOAT", "DIGIT", "TRIGGER", "BANG", "VAR", "STRING", "SEMICOLON", "LPAREN",
42 | "RPAREN", "TAB", "NL"
43 | };
44 |
45 |
46 | public RowsLexer(CharStream input) {
47 | super(input);
48 | _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
49 | }
50 |
51 | @Override
52 | public String getGrammarFileName() { return "Rows.g4"; }
53 |
54 | @Override
55 | public String[] getTokenNames() { return tokenNames; }
56 |
57 | @Override
58 | public String[] getRuleNames() { return ruleNames; }
59 |
60 | @Override
61 | public String getSerializedATN() { return _serializedATN; }
62 |
63 | @Override
64 | public String[] getModeNames() { return modeNames; }
65 |
66 | @Override
67 | public ATN getATN() { return _ATN; }
68 |
69 | public static final String _serializedATN =
70 | "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\61\u014f\b\1\4\2"+
71 | "\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4"+
72 | "\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22"+
73 | "\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31"+
74 | "\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t"+
75 | " \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t"+
76 | "+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\3\2\3\2\3\2\3\3\3\3\3\3\3\4\3\4\3"+
77 | "\4\5\4k\n\4\3\5\3\5\3\5\5\5p\n\5\3\6\3\6\3\6\5\6u\n\6\3\7\3\7\3\7\5\7"+
78 | "z\n\7\3\b\3\b\3\t\3\t\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f"+
79 | "\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\16\3"+
80 | "\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3"+
81 | "\20\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3"+
82 | "\23\3\23\3\23\3\23\3\23\3\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3"+
83 | "\25\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\27\3\27\3\30\3\30\3\30\3"+
84 | "\30\3\30\3\31\3\31\3\31\3\31\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\33\3"+
85 | "\33\3\33\3\33\3\33\3\33\3\33\3\33\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3"+
86 | "\35\3\36\3\36\3\36\3\36\3\36\3\36\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3"+
87 | " \3 \3 \3 \3 \3!\3!\3!\3!\3!\3!\3!\3\"\3\"\3\"\3\"\3#\3#\3#\3#\3#\3$\3"+
88 | "$\3$\3$\3$\3%\6%\u0118\n%\r%\16%\u0119\3&\6&\u011d\n&\r&\16&\u011e\3&"+
89 | "\3&\7&\u0123\n&\f&\16&\u0126\13&\3\'\3\'\3(\3(\3(\3(\3(\3(\3(\3(\3)\3"+
90 | ")\3)\3)\3*\3*\3*\3+\6+\u013a\n+\r+\16+\u013b\3,\3,\3-\3-\3.\3.\3/\6/\u0145"+
91 | "\n/\r/\16/\u0146\3/\3/\3\60\5\60\u014c\n\60\3\60\3\60\2\2\61\3\3\5\4\7"+
92 | "\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22"+
93 | "#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36;\37= ?!A\"C"+
94 | "#E$G%I&K\'M(O)Q*S+U,W-Y.[/]\60_\61\3\2\5\3\2\62;\4\2\62;C|\4\2\13\13\""+
95 | "\"\u0158\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2"+
96 | "\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27"+
97 | "\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2"+
98 | "\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2"+
99 | "\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2"+
100 | "\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2"+
101 | "\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S"+
102 | "\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2"+
103 | "\2\2\3a\3\2\2\2\5d\3\2\2\2\7j\3\2\2\2\to\3\2\2\2\13t\3\2\2\2\ry\3\2\2"+
104 | "\2\17{\3\2\2\2\21}\3\2\2\2\23\177\3\2\2\2\25\u0082\3\2\2\2\27\u0087\3"+
105 | "\2\2\2\31\u0091\3\2\2\2\33\u0096\3\2\2\2\35\u009e\3\2\2\2\37\u00a3\3\2"+
106 | "\2\2!\u00a9\3\2\2\2#\u00ad\3\2\2\2%\u00b6\3\2\2\2\'\u00bb\3\2\2\2)\u00c1"+
107 | "\3\2\2\2+\u00c5\3\2\2\2-\u00ca\3\2\2\2/\u00cf\3\2\2\2\61\u00d4\3\2\2\2"+
108 | "\63\u00d8\3\2\2\2\65\u00df\3\2\2\2\67\u00e7\3\2\2\29\u00eb\3\2\2\2;\u00ef"+
109 | "\3\2\2\2=\u00f5\3\2\2\2?\u00fc\3\2\2\2A\u0101\3\2\2\2C\u0108\3\2\2\2E"+
110 | "\u010c\3\2\2\2G\u0111\3\2\2\2I\u0117\3\2\2\2K\u011c\3\2\2\2M\u0127\3\2"+
111 | "\2\2O\u0129\3\2\2\2Q\u0131\3\2\2\2S\u0135\3\2\2\2U\u0139\3\2\2\2W\u013d"+
112 | "\3\2\2\2Y\u013f\3\2\2\2[\u0141\3\2\2\2]\u0144\3\2\2\2_\u014b\3\2\2\2a"+
113 | "b\7%\2\2bc\7Z\2\2c\4\3\2\2\2de\7%\2\2ef\7P\2\2f\6\3\2\2\2gk\7\61\2\2h"+
114 | "i\7\61\2\2ik\7\u0080\2\2jg\3\2\2\2jh\3\2\2\2k\b\3\2\2\2lp\7,\2\2mn\7,"+
115 | "\2\2np\7\u0080\2\2ol\3\2\2\2om\3\2\2\2p\n\3\2\2\2qu\7/\2\2rs\7/\2\2su"+
116 | "\7\u0080\2\2tq\3\2\2\2tr\3\2\2\2u\f\3\2\2\2vz\7-\2\2wx\7-\2\2xz\7\u0080"+
117 | "\2\2yv\3\2\2\2yw\3\2\2\2z\16\3\2\2\2{|\7@\2\2|\20\3\2\2\2}~\7>\2\2~\22"+
118 | "\3\2\2\2\177\u0080\7?\2\2\u0080\u0081\7?\2\2\u0081\24\3\2\2\2\u0082\u0083"+
119 | "\7g\2\2\u0083\u0084\7z\2\2\u0084\u0085\7r\2\2\u0085\u0086\7t\2\2\u0086"+
120 | "\26\3\2\2\2\u0087\u0088\7h\2\2\u0088\u0089\7n\2\2\u0089\u008a\7q\2\2\u008a"+
121 | "\u008b\7c\2\2\u008b\u008c\7v\2\2\u008c\u008d\7c\2\2\u008d\u008e\7v\2\2"+
122 | "\u008e\u008f\7q\2\2\u008f\u0090\7o\2\2\u0090\30\3\2\2\2\u0091\u0092\7"+
123 | "q\2\2\u0092\u0093\7u\2\2\u0093\u0094\7e\2\2\u0094\u0095\7\u0080\2\2\u0095"+
124 | "\32\3\2\2\2\u0096\u0097\7r\2\2\u0097\u0098\7j\2\2\u0098\u0099\7c\2\2\u0099"+
125 | "\u009a\7u\2\2\u009a\u009b\7q\2\2\u009b\u009c\7t\2\2\u009c\u009d\7\u0080"+
126 | "\2\2\u009d\34\3\2\2\2\u009e\u009f\7f\2\2\u009f\u00a0\7c\2\2\u00a0\u00a1"+
127 | "\7e\2\2\u00a1\u00a2\7\u0080\2\2\u00a2\36\3\2\2\2\u00a3\u00a4\7o\2\2\u00a4"+
128 | "\u00a5\7g\2\2\u00a5\u00a6\7v\2\2\u00a6\u00a7\7t\2\2\u00a7\u00a8\7q\2\2"+
129 | "\u00a8 \3\2\2\2\u00a9\u00aa\7o\2\2\u00aa\u00ab\7q\2\2\u00ab\u00ac\7f\2"+
130 | "\2\u00ac\"\3\2\2\2\u00ad\u00ae\7h\2\2\u00ae\u00af\7e\2\2\u00af\u00b0\7"+
131 | "q\2\2\u00b0\u00b1\7w\2\2\u00b1\u00b2\7p\2\2\u00b2\u00b3\7v\2\2\u00b3\u00b4"+
132 | "\7g\2\2\u00b4\u00b5\7t\2\2\u00b5$\3\2\2\2\u00b6\u00b7\7u\2\2\u00b7\u00b8"+
133 | "\7k\2\2\u00b8\u00b9\7i\2\2\u00b9\u00ba\7\u0080\2\2\u00ba&\3\2\2\2\u00bb"+
134 | "\u00bc\7e\2\2\u00bc\u00bd\7n\2\2\u00bd\u00be\7k\2\2\u00be\u00bf\7r\2\2"+
135 | "\u00bf\u00c0\7\u0080\2\2\u00c0(\3\2\2\2\u00c1\u00c2\7d\2\2\u00c2\u00c3"+
136 | "\7r\2\2\u00c3\u00c4\7\u0080\2\2\u00c4*\3\2\2\2\u00c5\u00c6\7j\2\2\u00c6"+
137 | "\u00c7\7k\2\2\u00c7\u00c8\7r\2\2\u00c8\u00c9\7\u0080\2\2\u00c9,\3\2\2"+
138 | "\2\u00ca\u00cb\7n\2\2\u00cb\u00cc\7q\2\2\u00cc\u00cd\7r\2\2\u00cd\u00ce"+
139 | "\7\u0080\2\2\u00ce.\3\2\2\2\u00cf\u00d0\7x\2\2\u00d0\u00d1\7e\2\2\u00d1"+
140 | "\u00d2\7h\2\2\u00d2\u00d3\7\u0080\2\2\u00d3\60\3\2\2\2\u00d4\u00d5\7q"+
141 | "\2\2\u00d5\u00d6\7d\2\2\u00d6\u00d7\7l\2\2\u00d7\62\3\2\2\2\u00d8\u00d9"+
142 | "\7e\2\2\u00d9\u00da\7c\2\2\u00da\u00db\7p\2\2\u00db\u00dc\7x\2\2\u00dc"+
143 | "\u00dd\7c\2\2\u00dd\u00de\7u\2\2\u00de\64\3\2\2\2\u00df\u00e0\7e\2\2\u00e0"+
144 | "\u00e1\7q\2\2\u00e1\u00e2\7p\2\2\u00e2\u00e3\7p\2\2\u00e3\u00e4\7g\2\2"+
145 | "\u00e4\u00e5\7e\2\2\u00e5\u00e6\7v\2\2\u00e6\66\3\2\2\2\u00e7\u00e8\7"+
146 | "o\2\2\u00e8\u00e9\7u\2\2\u00e9\u00ea\7i\2\2\u00ea8\3\2\2\2\u00eb\u00ec"+
147 | "\7r\2\2\u00ec\u00ed\7q\2\2\u00ed\u00ee\7y\2\2\u00ee:\3\2\2\2\u00ef\u00f0"+
148 | "\7n\2\2\u00f0\u00f1\7k\2\2\u00f1\u00f2\7p\2\2\u00f2\u00f3\7g\2\2\u00f3"+
149 | "\u00f4\7\u0080\2\2\u00f4<\3\2\2\2\u00f5\u00f6\7w\2\2\u00f6\u00f7\7p\2"+
150 | "\2\u00f7\u00f8\7r\2\2\u00f8\u00f9\7c\2\2\u00f9\u00fa\7e\2\2\u00fa\u00fb"+
151 | "\7m\2\2\u00fb>\3\2\2\2\u00fc\u00fd\7e\2\2\u00fd\u00fe\7q\2\2\u00fe\u00ff"+
152 | "\7u\2\2\u00ff\u0100\7\u0080\2\2\u0100@\3\2\2\2\u0101\u0102\7p\2\2\u0102"+
153 | "\u0103\7q\2\2\u0103\u0104\7k\2\2\u0104\u0105\7u\2\2\u0105\u0106\7g\2\2"+
154 | "\u0106\u0107\7\u0080\2\2\u0107B\3\2\2\2\u0108\u0109\7v\2\2\u0109\u010a"+
155 | "\7i\2\2\u010a\u010b\7n\2\2\u010bD\3\2\2\2\u010c\u010d\7o\2\2\u010d\u010e"+
156 | "\7c\2\2\u010e\u010f\7z\2\2\u010f\u0110\7\u0080\2\2\u0110F\3\2\2\2\u0111"+
157 | "\u0112\7o\2\2\u0112\u0113\7k\2\2\u0113\u0114\7p\2\2\u0114\u0115\7\u0080"+
158 | "\2\2\u0115H\3\2\2\2\u0116\u0118\5M\'\2\u0117\u0116\3\2\2\2\u0118\u0119"+
159 | "\3\2\2\2\u0119\u0117\3\2\2\2\u0119\u011a\3\2\2\2\u011aJ\3\2\2\2\u011b"+
160 | "\u011d\5M\'\2\u011c\u011b\3\2\2\2\u011d\u011e\3\2\2\2\u011e\u011c\3\2"+
161 | "\2\2\u011e\u011f\3\2\2\2\u011f\u0120\3\2\2\2\u0120\u0124\7\60\2\2\u0121"+
162 | "\u0123\5M\'\2\u0122\u0121\3\2\2\2\u0123\u0126\3\2\2\2\u0124\u0122\3\2"+
163 | "\2\2\u0124\u0125\3\2\2\2\u0125L\3\2\2\2\u0126\u0124\3\2\2\2\u0127\u0128"+
164 | "\t\2\2\2\u0128N\3\2\2\2\u0129\u012a\7v\2\2\u012a\u012b\7t\2\2\u012b\u012c"+
165 | "\7k\2\2\u012c\u012d\7i\2\2\u012d\u012e\7i\2\2\u012e\u012f\7g\2\2\u012f"+
166 | "\u0130\7t\2\2\u0130P\3\2\2\2\u0131\u0132\7d\2\2\u0132\u0133\7p\2\2\u0133"+
167 | "\u0134\7i\2\2\u0134R\3\2\2\2\u0135\u0136\7&\2\2\u0136\u0137\5U+\2\u0137"+
168 | "T\3\2\2\2\u0138\u013a\t\3\2\2\u0139\u0138\3\2\2\2\u013a\u013b\3\2\2\2"+
169 | "\u013b\u0139\3\2\2\2\u013b\u013c\3\2\2\2\u013cV\3\2\2\2\u013d\u013e\7"+
170 | "=\2\2\u013eX\3\2\2\2\u013f\u0140\7*\2\2\u0140Z\3\2\2\2\u0141\u0142\7+"+
171 | "\2\2\u0142\\\3\2\2\2\u0143\u0145\t\4\2\2\u0144\u0143\3\2\2\2\u0145\u0146"+
172 | "\3\2\2\2\u0146\u0144\3\2\2\2\u0146\u0147\3\2\2\2\u0147\u0148\3\2\2\2\u0148"+
173 | "\u0149\b/\2\2\u0149^\3\2\2\2\u014a\u014c\7\17\2\2\u014b\u014a\3\2\2\2"+
174 | "\u014b\u014c\3\2\2\2\u014c\u014d\3\2\2\2\u014d\u014e\7\f\2\2\u014e`\3"+
175 | "\2\2\2\r\2joty\u0119\u011e\u0124\u013b\u0146\u014b\3\b\2\2";
176 | public static final ATN _ATN =
177 | new ATNDeserializer().deserialize(_serializedATN.toCharArray());
178 | static {
179 | _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
180 | for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
181 | _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
182 | }
183 | }
184 | }
--------------------------------------------------------------------------------
/src/RowsParser.java:
--------------------------------------------------------------------------------
1 | // Generated from Rows.g4 by ANTLR 4.2.2
2 | import org.antlr.v4.runtime.atn.*;
3 | import org.antlr.v4.runtime.dfa.DFA;
4 | import org.antlr.v4.runtime.*;
5 | import org.antlr.v4.runtime.misc.*;
6 | import org.antlr.v4.runtime.tree.*;
7 | import java.util.List;
8 | import java.util.Iterator;
9 | import java.util.ArrayList;
10 |
11 | @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
12 | public class RowsParser extends Parser {
13 | protected static final DFA[] _decisionToDFA;
14 | protected static final PredictionContextCache _sharedContextCache =
15 | new PredictionContextCache();
16 | public static final int
17 | XOBJ=1, NOBJ=2, DIVIDE=3, MULTIPLY=4, MINUS=5, PLUS=6, GT=7, LT=8, EQ=9,
18 | EXPR=10, FLOATATOM=11, OSC=12, PHASOR=13, DAC=14, METRO=15, MOD=16, FCOUNTER=17,
19 | SIG=18, CLIP=19, BP=20, HIP=21, LOP=22, VCF=23, OBJ=24, CANVAS=25, CONNECT=26,
20 | MSG=27, POW=28, LINE=29, UNPACK=30, COS=31, NOISE=32, TGL=33, MAX=34,
21 | MIN=35, INT=36, FLOAT=37, DIGIT=38, TRIGGER=39, BANG=40, VAR=41, STRING=42,
22 | SEMICOLON=43, LPAREN=44, RPAREN=45, TAB=46, NL=47;
23 | public static final String[] tokenNames = {
24 | "", "'#X'", "'#N'", "DIVIDE", "MULTIPLY", "MINUS", "PLUS", "'>'",
25 | "'<'", "'=='", "'expr'", "'floatatom'", "'osc~'", "'phasor~'", "'dac~'",
26 | "'metro'", "'mod'", "'fcounter'", "'sig~'", "'clip~'", "'bp~'", "'hip~'",
27 | "'lop~'", "'vcf~'", "'obj'", "'canvas'", "'connect'", "'msg'", "'pow'",
28 | "'line~'", "'unpack'", "'cos~'", "'noise~'", "'tgl'", "'max~'", "'min~'",
29 | "INT", "FLOAT", "DIGIT", "'trigger'", "'bng'", "VAR", "STRING", "';'",
30 | "'('", "')'", "TAB", "NL"
31 | };
32 | public static final int
33 | RULE_file = 0, RULE_row = 1, RULE_expr = 2;
34 | public static final String[] ruleNames = {
35 | "file", "row", "expr"
36 | };
37 |
38 | @Override
39 | public String getGrammarFileName() { return "Rows.g4"; }
40 |
41 | @Override
42 | public String[] getTokenNames() { return tokenNames; }
43 |
44 | @Override
45 | public String[] getRuleNames() { return ruleNames; }
46 |
47 | @Override
48 | public String getSerializedATN() { return _serializedATN; }
49 |
50 | @Override
51 | public ATN getATN() { return _ATN; }
52 |
53 | public RowsParser(TokenStream input) {
54 | super(input);
55 | _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
56 | }
57 | public static class FileContext extends ParserRuleContext {
58 | public RowContext row(int i) {
59 | return getRuleContext(RowContext.class,i);
60 | }
61 | public List row() {
62 | return getRuleContexts(RowContext.class);
63 | }
64 | public FileContext(ParserRuleContext parent, int invokingState) {
65 | super(parent, invokingState);
66 | }
67 | @Override public int getRuleIndex() { return RULE_file; }
68 | @Override
69 | public void enterRule(ParseTreeListener listener) {
70 | if ( listener instanceof RowsListener ) ((RowsListener)listener).enterFile(this);
71 | }
72 | @Override
73 | public void exitRule(ParseTreeListener listener) {
74 | if ( listener instanceof RowsListener ) ((RowsListener)listener).exitFile(this);
75 | }
76 | }
77 |
78 | public final FileContext file() throws RecognitionException {
79 | FileContext _localctx = new FileContext(_ctx, getState());
80 | enterRule(_localctx, 0, RULE_file);
81 | int _la;
82 | try {
83 | enterOuterAlt(_localctx, 1);
84 | {
85 | setState(7);
86 | _errHandler.sync(this);
87 | _la = _input.LA(1);
88 | do {
89 | {
90 | {
91 | setState(6); row();
92 | }
93 | }
94 | setState(9);
95 | _errHandler.sync(this);
96 | _la = _input.LA(1);
97 | } while ( _la==XOBJ || _la==NOBJ );
98 | }
99 | }
100 | catch (RecognitionException re) {
101 | _localctx.exception = re;
102 | _errHandler.reportError(this, re);
103 | _errHandler.recover(this, re);
104 | }
105 | finally {
106 | exitRule();
107 | }
108 | return _localctx;
109 | }
110 |
111 | public static class RowContext extends ParserRuleContext {
112 | public Token type;
113 | public Token name;
114 | public Token number;
115 | public TerminalNode CLIP() { return getToken(RowsParser.CLIP, 0); }
116 | public TerminalNode STRING(int i) {
117 | return getToken(RowsParser.STRING, i);
118 | }
119 | public List INT() { return getTokens(RowsParser.INT); }
120 | public TerminalNode CANVAS() { return getToken(RowsParser.CANVAS, 0); }
121 | public TerminalNode TGL() { return getToken(RowsParser.TGL, 0); }
122 | public TerminalNode SIG() { return getToken(RowsParser.SIG, 0); }
123 | public TerminalNode MSG() { return getToken(RowsParser.MSG, 0); }
124 | public TerminalNode MAX() { return getToken(RowsParser.MAX, 0); }
125 | public TerminalNode LOP() { return getToken(RowsParser.LOP, 0); }
126 | public TerminalNode INT(int i) {
127 | return getToken(RowsParser.INT, i);
128 | }
129 | public TerminalNode DIVIDE() { return getToken(RowsParser.DIVIDE, 0); }
130 | public TerminalNode EQ() { return getToken(RowsParser.EQ, 0); }
131 | public TerminalNode HIP() { return getToken(RowsParser.HIP, 0); }
132 | public TerminalNode NL(int i) {
133 | return getToken(RowsParser.NL, i);
134 | }
135 | public TerminalNode XOBJ() { return getToken(RowsParser.XOBJ, 0); }
136 | public List expr() {
137 | return getRuleContexts(ExprContext.class);
138 | }
139 | public TerminalNode FLOAT(int i) {
140 | return getToken(RowsParser.FLOAT, i);
141 | }
142 | public ExprContext expr(int i) {
143 | return getRuleContext(ExprContext.class,i);
144 | }
145 | public TerminalNode OBJ() { return getToken(RowsParser.OBJ, 0); }
146 | public TerminalNode PLUS() { return getToken(RowsParser.PLUS, 0); }
147 | public TerminalNode OSC() { return getToken(RowsParser.OSC, 0); }
148 | public TerminalNode LINE() { return getToken(RowsParser.LINE, 0); }
149 | public List NL() { return getTokens(RowsParser.NL); }
150 | public TerminalNode VCF() { return getToken(RowsParser.VCF, 0); }
151 | public TerminalNode SEMICOLON() { return getToken(RowsParser.SEMICOLON, 0); }
152 | public TerminalNode FLOATATOM() { return getToken(RowsParser.FLOATATOM, 0); }
153 | public List FLOAT() { return getTokens(RowsParser.FLOAT); }
154 | public TerminalNode BP() { return getToken(RowsParser.BP, 0); }
155 | public TerminalNode BANG() { return getToken(RowsParser.BANG, 0); }
156 | public List MINUS() { return getTokens(RowsParser.MINUS); }
157 | public TerminalNode MULTIPLY() { return getToken(RowsParser.MULTIPLY, 0); }
158 | public TerminalNode MIN() { return getToken(RowsParser.MIN, 0); }
159 | public TerminalNode EXPR() { return getToken(RowsParser.EXPR, 0); }
160 | public TerminalNode METRO() { return getToken(RowsParser.METRO, 0); }
161 | public TerminalNode COS() { return getToken(RowsParser.COS, 0); }
162 | public TerminalNode PHASOR() { return getToken(RowsParser.PHASOR, 0); }
163 | public TerminalNode TRIGGER() { return getToken(RowsParser.TRIGGER, 0); }
164 | public TerminalNode MINUS(int i) {
165 | return getToken(RowsParser.MINUS, i);
166 | }
167 | public TerminalNode DAC() { return getToken(RowsParser.DAC, 0); }
168 | public TerminalNode NOBJ() { return getToken(RowsParser.NOBJ, 0); }
169 | public TerminalNode LT() { return getToken(RowsParser.LT, 0); }
170 | public TerminalNode CONNECT() { return getToken(RowsParser.CONNECT, 0); }
171 | public TerminalNode FCOUNTER() { return getToken(RowsParser.FCOUNTER, 0); }
172 | public TerminalNode NOISE() { return getToken(RowsParser.NOISE, 0); }
173 | public TerminalNode GT() { return getToken(RowsParser.GT, 0); }
174 | public TerminalNode UNPACK() { return getToken(RowsParser.UNPACK, 0); }
175 | public List STRING() { return getTokens(RowsParser.STRING); }
176 | public TerminalNode MOD() { return getToken(RowsParser.MOD, 0); }
177 | public TerminalNode POW() { return getToken(RowsParser.POW, 0); }
178 | public RowContext(ParserRuleContext parent, int invokingState) {
179 | super(parent, invokingState);
180 | }
181 | @Override public int getRuleIndex() { return RULE_row; }
182 | @Override
183 | public void enterRule(ParseTreeListener listener) {
184 | if ( listener instanceof RowsListener ) ((RowsListener)listener).enterRow(this);
185 | }
186 | @Override
187 | public void exitRule(ParseTreeListener listener) {
188 | if ( listener instanceof RowsListener ) ((RowsListener)listener).exitRow(this);
189 | }
190 | }
191 |
192 | public final RowContext row() throws RecognitionException {
193 | RowContext _localctx = new RowContext(_ctx, getState());
194 | enterRule(_localctx, 2, RULE_row);
195 | int _la;
196 | try {
197 | setState(381);
198 | switch ( getInterpreter().adaptivePredict(_input,28,_ctx) ) {
199 | case 1:
200 | enterOuterAlt(_localctx, 1);
201 | {
202 | setState(11); match(XOBJ);
203 | setState(12); ((RowContext)_localctx).type = match(CONNECT);
204 | setState(14);
205 | switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) {
206 | case 1:
207 | {
208 | setState(13); match(INT);
209 | }
210 | break;
211 | }
212 | setState(17);
213 | switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
214 | case 1:
215 | {
216 | setState(16); match(INT);
217 | }
218 | break;
219 | }
220 | setState(20);
221 | switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) {
222 | case 1:
223 | {
224 | setState(19); match(INT);
225 | }
226 | break;
227 | }
228 | setState(23);
229 | _la = _input.LA(1);
230 | if (_la==INT) {
231 | {
232 | setState(22); match(INT);
233 | }
234 | }
235 |
236 | setState(25); match(SEMICOLON);
237 | setState(26); match(NL);
238 | }
239 | break;
240 |
241 | case 2:
242 | enterOuterAlt(_localctx, 2);
243 | {
244 | setState(27); match(XOBJ);
245 | setState(28); ((RowContext)_localctx).type = match(OBJ);
246 | setState(29); match(INT);
247 | setState(30); match(INT);
248 | setState(31); ((RowContext)_localctx).name = match(OSC);
249 | setState(33);
250 | _la = _input.LA(1);
251 | if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MINUS) | (1L << INT) | (1L << FLOAT) | (1L << VAR) | (1L << LPAREN))) != 0)) {
252 | {
253 | setState(32); expr(0);
254 | }
255 | }
256 |
257 | setState(35); match(SEMICOLON);
258 | setState(36); match(NL);
259 | }
260 | break;
261 |
262 | case 3:
263 | enterOuterAlt(_localctx, 3);
264 | {
265 | setState(37); match(XOBJ);
266 | setState(38); ((RowContext)_localctx).type = match(OBJ);
267 | setState(39); match(INT);
268 | setState(40); match(INT);
269 | setState(41); ((RowContext)_localctx).name = match(PHASOR);
270 | setState(43);
271 | _la = _input.LA(1);
272 | if (_la==INT) {
273 | {
274 | setState(42); match(INT);
275 | }
276 | }
277 |
278 | setState(45); match(SEMICOLON);
279 | setState(46); match(NL);
280 | }
281 | break;
282 |
283 | case 4:
284 | enterOuterAlt(_localctx, 4);
285 | {
286 | setState(47); match(XOBJ);
287 | setState(48); ((RowContext)_localctx).type = match(OBJ);
288 | setState(49); match(INT);
289 | setState(50); match(INT);
290 | setState(51); ((RowContext)_localctx).name = match(DAC);
291 | setState(52); match(SEMICOLON);
292 | setState(53); match(NL);
293 | }
294 | break;
295 |
296 | case 5:
297 | enterOuterAlt(_localctx, 5);
298 | {
299 | setState(54); match(NOBJ);
300 | setState(55); ((RowContext)_localctx).type = match(CANVAS);
301 | setState(57);
302 | switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) {
303 | case 1:
304 | {
305 | setState(56); match(INT);
306 | }
307 | break;
308 | }
309 | setState(60);
310 | switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) {
311 | case 1:
312 | {
313 | setState(59); match(INT);
314 | }
315 | break;
316 | }
317 | setState(63);
318 | switch ( getInterpreter().adaptivePredict(_input,9,_ctx) ) {
319 | case 1:
320 | {
321 | setState(62); match(INT);
322 | }
323 | break;
324 | }
325 | setState(66);
326 | switch ( getInterpreter().adaptivePredict(_input,10,_ctx) ) {
327 | case 1:
328 | {
329 | setState(65); match(INT);
330 | }
331 | break;
332 | }
333 | setState(69);
334 | _la = _input.LA(1);
335 | if (_la==INT) {
336 | {
337 | setState(68); match(INT);
338 | }
339 | }
340 |
341 | setState(71); match(SEMICOLON);
342 | setState(72); match(NL);
343 | }
344 | break;
345 |
346 | case 6:
347 | enterOuterAlt(_localctx, 6);
348 | {
349 | setState(73); match(XOBJ);
350 | setState(74); ((RowContext)_localctx).type = match(FLOATATOM);
351 | setState(75); expr(0);
352 | setState(76); expr(0);
353 | setState(77); expr(0);
354 | setState(78); expr(0);
355 | setState(79); expr(0);
356 | setState(80); expr(0);
357 | setState(81); match(MINUS);
358 | setState(82); match(MINUS);
359 | setState(83); match(MINUS);
360 | setState(84); match(SEMICOLON);
361 | setState(85); match(NL);
362 | }
363 | break;
364 |
365 | case 7:
366 | enterOuterAlt(_localctx, 7);
367 | {
368 | setState(87); match(XOBJ);
369 | setState(88); ((RowContext)_localctx).type = match(OBJ);
370 | setState(89); match(INT);
371 | setState(90); match(INT);
372 | setState(91); ((RowContext)_localctx).name = match(PLUS);
373 | setState(93);
374 | _la = _input.LA(1);
375 | if (_la==INT || _la==FLOAT) {
376 | {
377 | setState(92);
378 | ((RowContext)_localctx).number = _input.LT(1);
379 | _la = _input.LA(1);
380 | if ( !(_la==INT || _la==FLOAT) ) {
381 | ((RowContext)_localctx).number = (Token)_errHandler.recoverInline(this);
382 | }
383 | consume();
384 | }
385 | }
386 |
387 | setState(95); match(SEMICOLON);
388 | setState(96); match(NL);
389 | }
390 | break;
391 |
392 | case 8:
393 | enterOuterAlt(_localctx, 8);
394 | {
395 | setState(97); match(XOBJ);
396 | setState(98); ((RowContext)_localctx).type = match(OBJ);
397 | setState(99); match(INT);
398 | setState(100); match(INT);
399 | setState(101); ((RowContext)_localctx).name = match(MINUS);
400 | setState(103);
401 | _la = _input.LA(1);
402 | if (_la==INT || _la==FLOAT) {
403 | {
404 | setState(102);
405 | ((RowContext)_localctx).number = _input.LT(1);
406 | _la = _input.LA(1);
407 | if ( !(_la==INT || _la==FLOAT) ) {
408 | ((RowContext)_localctx).number = (Token)_errHandler.recoverInline(this);
409 | }
410 | consume();
411 | }
412 | }
413 |
414 | setState(105); match(SEMICOLON);
415 | setState(106); match(NL);
416 | }
417 | break;
418 |
419 | case 9:
420 | enterOuterAlt(_localctx, 9);
421 | {
422 | setState(107); match(XOBJ);
423 | setState(108); ((RowContext)_localctx).type = match(OBJ);
424 | setState(109); match(INT);
425 | setState(110); match(INT);
426 | setState(111); ((RowContext)_localctx).name = match(MULTIPLY);
427 | setState(113);
428 | _la = _input.LA(1);
429 | if (_la==INT || _la==FLOAT) {
430 | {
431 | setState(112);
432 | ((RowContext)_localctx).number = _input.LT(1);
433 | _la = _input.LA(1);
434 | if ( !(_la==INT || _la==FLOAT) ) {
435 | ((RowContext)_localctx).number = (Token)_errHandler.recoverInline(this);
436 | }
437 | consume();
438 | }
439 | }
440 |
441 | setState(115); match(SEMICOLON);
442 | setState(116); match(NL);
443 | }
444 | break;
445 |
446 | case 10:
447 | enterOuterAlt(_localctx, 10);
448 | {
449 | setState(117); match(XOBJ);
450 | setState(118); ((RowContext)_localctx).type = match(OBJ);
451 | setState(119); match(INT);
452 | setState(120); match(INT);
453 | setState(121); ((RowContext)_localctx).name = match(DIVIDE);
454 | setState(123);
455 | _la = _input.LA(1);
456 | if (_la==INT || _la==FLOAT) {
457 | {
458 | setState(122);
459 | ((RowContext)_localctx).number = _input.LT(1);
460 | _la = _input.LA(1);
461 | if ( !(_la==INT || _la==FLOAT) ) {
462 | ((RowContext)_localctx).number = (Token)_errHandler.recoverInline(this);
463 | }
464 | consume();
465 | }
466 | }
467 |
468 | setState(125); match(SEMICOLON);
469 | setState(126); match(NL);
470 | }
471 | break;
472 |
473 | case 11:
474 | enterOuterAlt(_localctx, 11);
475 | {
476 | setState(127); match(XOBJ);
477 | setState(128); ((RowContext)_localctx).type = match(OBJ);
478 | setState(129); match(INT);
479 | setState(130); match(INT);
480 | setState(131); ((RowContext)_localctx).name = match(POW);
481 | setState(133);
482 | _la = _input.LA(1);
483 | if (_la==INT || _la==FLOAT) {
484 | {
485 | setState(132);
486 | ((RowContext)_localctx).number = _input.LT(1);
487 | _la = _input.LA(1);
488 | if ( !(_la==INT || _la==FLOAT) ) {
489 | ((RowContext)_localctx).number = (Token)_errHandler.recoverInline(this);
490 | }
491 | consume();
492 | }
493 | }
494 |
495 | setState(135); match(SEMICOLON);
496 | setState(136); match(NL);
497 | }
498 | break;
499 |
500 | case 12:
501 | enterOuterAlt(_localctx, 12);
502 | {
503 | setState(137); match(XOBJ);
504 | setState(138); ((RowContext)_localctx).type = match(OBJ);
505 | setState(139); match(INT);
506 | setState(140); match(INT);
507 | setState(141); ((RowContext)_localctx).name = match(TRIGGER);
508 | setState(143);
509 | _errHandler.sync(this);
510 | _la = _input.LA(1);
511 | do {
512 | {
513 | {
514 | setState(142);
515 | _la = _input.LA(1);
516 | if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INT) | (1L << FLOAT) | (1L << STRING))) != 0)) ) {
517 | _errHandler.recoverInline(this);
518 | }
519 | consume();
520 | }
521 | }
522 | setState(145);
523 | _errHandler.sync(this);
524 | _la = _input.LA(1);
525 | } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INT) | (1L << FLOAT) | (1L << STRING))) != 0) );
526 | setState(147); match(SEMICOLON);
527 | setState(148); match(NL);
528 | }
529 | break;
530 |
531 | case 13:
532 | enterOuterAlt(_localctx, 13);
533 | {
534 | setState(149); match(XOBJ);
535 | setState(150); ((RowContext)_localctx).type = match(OBJ);
536 | setState(151); match(INT);
537 | setState(152); match(INT);
538 | setState(153); ((RowContext)_localctx).name = match(BANG);
539 | setState(154); match(INT);
540 | setState(155); match(INT);
541 | setState(156); match(INT);
542 | setState(157); match(INT);
543 | setState(158); match(STRING);
544 | setState(159); match(STRING);
545 | setState(160); match(STRING);
546 | setState(161); match(INT);
547 | setState(162); match(INT);
548 | setState(163); match(INT);
549 | setState(164); match(INT);
550 | setState(165); expr(0);
551 | setState(166); expr(0);
552 | setState(167); match(NL);
553 | setState(168); expr(0);
554 | setState(169); match(SEMICOLON);
555 | setState(170); match(NL);
556 | }
557 | break;
558 |
559 | case 14:
560 | enterOuterAlt(_localctx, 14);
561 | {
562 | setState(172); match(XOBJ);
563 | setState(173); ((RowContext)_localctx).type = match(OBJ);
564 | setState(174); match(INT);
565 | setState(175); match(INT);
566 | setState(176); ((RowContext)_localctx).name = match(EXPR);
567 | setState(177); expr(0);
568 | setState(178); match(SEMICOLON);
569 | setState(179); match(NL);
570 | }
571 | break;
572 |
573 | case 15:
574 | enterOuterAlt(_localctx, 15);
575 | {
576 | setState(181); match(XOBJ);
577 | setState(182); ((RowContext)_localctx).type = match(MSG);
578 | setState(183); match(INT);
579 | setState(184); match(INT);
580 | setState(188);
581 | _errHandler.sync(this);
582 | _la = _input.LA(1);
583 | while (_la==INT || _la==FLOAT) {
584 | {
585 | {
586 | setState(185);
587 | _la = _input.LA(1);
588 | if ( !(_la==INT || _la==FLOAT) ) {
589 | _errHandler.recoverInline(this);
590 | }
591 | consume();
592 | }
593 | }
594 | setState(190);
595 | _errHandler.sync(this);
596 | _la = _input.LA(1);
597 | }
598 | setState(191); match(SEMICOLON);
599 | setState(192); match(NL);
600 | }
601 | break;
602 |
603 | case 16:
604 | enterOuterAlt(_localctx, 16);
605 | {
606 | setState(193); match(XOBJ);
607 | setState(194); ((RowContext)_localctx).type = match(OBJ);
608 | setState(195); match(INT);
609 | setState(196); match(INT);
610 | setState(197); ((RowContext)_localctx).name = match(METRO);
611 | setState(198); match(INT);
612 | setState(199); match(SEMICOLON);
613 | setState(200); match(NL);
614 | }
615 | break;
616 |
617 | case 17:
618 | enterOuterAlt(_localctx, 17);
619 | {
620 | setState(201); match(XOBJ);
621 | setState(202); ((RowContext)_localctx).type = match(OBJ);
622 | setState(203); match(INT);
623 | setState(204); match(INT);
624 | setState(205); ((RowContext)_localctx).name = match(FCOUNTER);
625 | setState(206); match(SEMICOLON);
626 | setState(207); match(NL);
627 | }
628 | break;
629 |
630 | case 18:
631 | enterOuterAlt(_localctx, 18);
632 | {
633 | setState(208); match(XOBJ);
634 | setState(209); ((RowContext)_localctx).type = match(OBJ);
635 | setState(210); match(INT);
636 | setState(211); match(INT);
637 | setState(212); ((RowContext)_localctx).name = match(MOD);
638 | setState(213); match(INT);
639 | setState(214); match(SEMICOLON);
640 | setState(215); match(NL);
641 | }
642 | break;
643 |
644 | case 19:
645 | enterOuterAlt(_localctx, 19);
646 | {
647 | setState(216); match(XOBJ);
648 | setState(217); ((RowContext)_localctx).type = match(OBJ);
649 | setState(218); match(INT);
650 | setState(219); match(INT);
651 | setState(220); ((RowContext)_localctx).name = match(CLIP);
652 | setState(221); expr(0);
653 | setState(222); expr(0);
654 | setState(223); match(SEMICOLON);
655 | setState(224); match(NL);
656 | }
657 | break;
658 |
659 | case 20:
660 | enterOuterAlt(_localctx, 20);
661 | {
662 | setState(226); match(XOBJ);
663 | setState(227); ((RowContext)_localctx).type = match(OBJ);
664 | setState(228); match(INT);
665 | setState(229); match(INT);
666 | setState(230); ((RowContext)_localctx).name = match(VCF);
667 | setState(231); expr(0);
668 | setState(232); expr(0);
669 | setState(233); match(SEMICOLON);
670 | setState(234); match(NL);
671 | }
672 | break;
673 |
674 | case 21:
675 | enterOuterAlt(_localctx, 21);
676 | {
677 | setState(236); match(XOBJ);
678 | setState(237); ((RowContext)_localctx).type = match(OBJ);
679 | setState(238); match(INT);
680 | setState(239); match(INT);
681 | setState(240); ((RowContext)_localctx).name = match(BP);
682 | setState(241); expr(0);
683 | setState(242); expr(0);
684 | setState(243); match(SEMICOLON);
685 | setState(244); match(NL);
686 | }
687 | break;
688 |
689 | case 22:
690 | enterOuterAlt(_localctx, 22);
691 | {
692 | setState(246); match(XOBJ);
693 | setState(247); ((RowContext)_localctx).type = match(OBJ);
694 | setState(248); match(INT);
695 | setState(249); match(INT);
696 | setState(250); ((RowContext)_localctx).name = match(HIP);
697 | setState(252);
698 | _la = _input.LA(1);
699 | if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MINUS) | (1L << INT) | (1L << FLOAT) | (1L << VAR) | (1L << LPAREN))) != 0)) {
700 | {
701 | setState(251); expr(0);
702 | }
703 | }
704 |
705 | setState(254); match(SEMICOLON);
706 | setState(255); match(NL);
707 | }
708 | break;
709 |
710 | case 23:
711 | enterOuterAlt(_localctx, 23);
712 | {
713 | setState(256); match(XOBJ);
714 | setState(257); ((RowContext)_localctx).type = match(OBJ);
715 | setState(258); match(INT);
716 | setState(259); match(INT);
717 | setState(260); ((RowContext)_localctx).name = match(LOP);
718 | setState(262);
719 | _la = _input.LA(1);
720 | if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MINUS) | (1L << INT) | (1L << FLOAT) | (1L << VAR) | (1L << LPAREN))) != 0)) {
721 | {
722 | setState(261); expr(0);
723 | }
724 | }
725 |
726 | setState(264); match(SEMICOLON);
727 | setState(265); match(NL);
728 | }
729 | break;
730 |
731 | case 24:
732 | enterOuterAlt(_localctx, 24);
733 | {
734 | setState(266); match(XOBJ);
735 | setState(267); ((RowContext)_localctx).type = match(OBJ);
736 | setState(268); match(INT);
737 | setState(269); match(INT);
738 | setState(270); ((RowContext)_localctx).name = match(MAX);
739 | setState(272);
740 | _la = _input.LA(1);
741 | if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MINUS) | (1L << INT) | (1L << FLOAT) | (1L << VAR) | (1L << LPAREN))) != 0)) {
742 | {
743 | setState(271); expr(0);
744 | }
745 | }
746 |
747 | setState(274); match(SEMICOLON);
748 | setState(275); match(NL);
749 | }
750 | break;
751 |
752 | case 25:
753 | enterOuterAlt(_localctx, 25);
754 | {
755 | setState(276); match(XOBJ);
756 | setState(277); ((RowContext)_localctx).type = match(OBJ);
757 | setState(278); match(INT);
758 | setState(279); match(INT);
759 | setState(280); ((RowContext)_localctx).name = match(MIN);
760 | setState(282);
761 | _la = _input.LA(1);
762 | if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MINUS) | (1L << INT) | (1L << FLOAT) | (1L << VAR) | (1L << LPAREN))) != 0)) {
763 | {
764 | setState(281); expr(0);
765 | }
766 | }
767 |
768 | setState(284); match(SEMICOLON);
769 | setState(285); match(NL);
770 | }
771 | break;
772 |
773 | case 26:
774 | enterOuterAlt(_localctx, 26);
775 | {
776 | setState(286); match(XOBJ);
777 | setState(287); ((RowContext)_localctx).type = match(OBJ);
778 | setState(288); match(INT);
779 | setState(289); match(INT);
780 | setState(290); ((RowContext)_localctx).name = match(GT);
781 | setState(292);
782 | _la = _input.LA(1);
783 | if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MINUS) | (1L << INT) | (1L << FLOAT) | (1L << VAR) | (1L << LPAREN))) != 0)) {
784 | {
785 | setState(291); expr(0);
786 | }
787 | }
788 |
789 | setState(294); match(SEMICOLON);
790 | setState(295); match(NL);
791 | }
792 | break;
793 |
794 | case 27:
795 | enterOuterAlt(_localctx, 27);
796 | {
797 | setState(296); match(XOBJ);
798 | setState(297); ((RowContext)_localctx).type = match(OBJ);
799 | setState(298); match(INT);
800 | setState(299); match(INT);
801 | setState(300); ((RowContext)_localctx).name = match(LT);
802 | setState(302);
803 | _la = _input.LA(1);
804 | if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MINUS) | (1L << INT) | (1L << FLOAT) | (1L << VAR) | (1L << LPAREN))) != 0)) {
805 | {
806 | setState(301); expr(0);
807 | }
808 | }
809 |
810 | setState(304); match(SEMICOLON);
811 | setState(305); match(NL);
812 | }
813 | break;
814 |
815 | case 28:
816 | enterOuterAlt(_localctx, 28);
817 | {
818 | setState(306); match(XOBJ);
819 | setState(307); ((RowContext)_localctx).type = match(OBJ);
820 | setState(308); match(INT);
821 | setState(309); match(INT);
822 | setState(310); ((RowContext)_localctx).name = match(EQ);
823 | setState(312);
824 | _la = _input.LA(1);
825 | if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << MINUS) | (1L << INT) | (1L << FLOAT) | (1L << VAR) | (1L << LPAREN))) != 0)) {
826 | {
827 | setState(311); expr(0);
828 | }
829 | }
830 |
831 | setState(314); match(SEMICOLON);
832 | setState(315); match(NL);
833 | }
834 | break;
835 |
836 | case 29:
837 | enterOuterAlt(_localctx, 29);
838 | {
839 | setState(316); match(XOBJ);
840 | setState(317); ((RowContext)_localctx).type = match(OBJ);
841 | setState(318); match(INT);
842 | setState(319); match(INT);
843 | setState(320); ((RowContext)_localctx).name = match(LINE);
844 | setState(321); match(SEMICOLON);
845 | setState(322); match(NL);
846 | }
847 | break;
848 |
849 | case 30:
850 | enterOuterAlt(_localctx, 30);
851 | {
852 | setState(323); match(XOBJ);
853 | setState(324); ((RowContext)_localctx).type = match(OBJ);
854 | setState(325); match(INT);
855 | setState(326); match(INT);
856 | setState(327); ((RowContext)_localctx).name = match(UNPACK);
857 | setState(329);
858 | _errHandler.sync(this);
859 | _la = _input.LA(1);
860 | do {
861 | {
862 | {
863 | setState(328);
864 | _la = _input.LA(1);
865 | if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INT) | (1L << FLOAT) | (1L << STRING))) != 0)) ) {
866 | _errHandler.recoverInline(this);
867 | }
868 | consume();
869 | }
870 | }
871 | setState(331);
872 | _errHandler.sync(this);
873 | _la = _input.LA(1);
874 | } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INT) | (1L << FLOAT) | (1L << STRING))) != 0) );
875 | setState(333); match(SEMICOLON);
876 | setState(334); match(NL);
877 | }
878 | break;
879 |
880 | case 31:
881 | enterOuterAlt(_localctx, 31);
882 | {
883 | setState(335); match(XOBJ);
884 | setState(336); ((RowContext)_localctx).type = match(OBJ);
885 | setState(337); match(INT);
886 | setState(338); match(INT);
887 | setState(339); ((RowContext)_localctx).name = match(COS);
888 | setState(340); match(SEMICOLON);
889 | setState(341); match(NL);
890 | }
891 | break;
892 |
893 | case 32:
894 | enterOuterAlt(_localctx, 32);
895 | {
896 | setState(342); match(XOBJ);
897 | setState(343); ((RowContext)_localctx).type = match(OBJ);
898 | setState(344); match(INT);
899 | setState(345); match(INT);
900 | setState(346); ((RowContext)_localctx).name = match(NOISE);
901 | setState(347); match(SEMICOLON);
902 | setState(348); match(NL);
903 | }
904 | break;
905 |
906 | case 33:
907 | enterOuterAlt(_localctx, 33);
908 | {
909 | setState(349); match(XOBJ);
910 | setState(350); ((RowContext)_localctx).type = match(OBJ);
911 | setState(351); match(INT);
912 | setState(352); match(INT);
913 | setState(353); ((RowContext)_localctx).name = match(TGL);
914 | setState(354); match(INT);
915 | setState(355); match(INT);
916 | setState(356); match(STRING);
917 | setState(357); match(STRING);
918 | setState(358); match(STRING);
919 | setState(359); expr(0);
920 | setState(360); expr(0);
921 | setState(361); expr(0);
922 | setState(362); expr(0);
923 | setState(363); expr(0);
924 | setState(364); expr(0);
925 | setState(365); expr(0);
926 | setState(366); expr(0);
927 | setState(367); expr(0);
928 | setState(368); match(SEMICOLON);
929 | setState(369); match(NL);
930 | }
931 | break;
932 |
933 | case 34:
934 | enterOuterAlt(_localctx, 34);
935 | {
936 | setState(371); match(XOBJ);
937 | setState(372); ((RowContext)_localctx).type = match(OBJ);
938 | setState(373); match(INT);
939 | setState(374); match(INT);
940 | setState(375); ((RowContext)_localctx).name = match(SIG);
941 | setState(377);
942 | _la = _input.LA(1);
943 | if (_la==INT || _la==FLOAT) {
944 | {
945 | setState(376);
946 | ((RowContext)_localctx).number = _input.LT(1);
947 | _la = _input.LA(1);
948 | if ( !(_la==INT || _la==FLOAT) ) {
949 | ((RowContext)_localctx).number = (Token)_errHandler.recoverInline(this);
950 | }
951 | consume();
952 | }
953 | }
954 |
955 | setState(379); match(SEMICOLON);
956 | setState(380); match(NL);
957 | }
958 | break;
959 | }
960 | }
961 | catch (RecognitionException re) {
962 | _localctx.exception = re;
963 | _errHandler.reportError(this, re);
964 | _errHandler.recover(this, re);
965 | }
966 | finally {
967 | exitRule();
968 | }
969 | return _localctx;
970 | }
971 |
972 | public static class ExprContext extends ParserRuleContext {
973 | public ExprContext(ParserRuleContext parent, int invokingState) {
974 | super(parent, invokingState);
975 | }
976 | @Override public int getRuleIndex() { return RULE_expr; }
977 |
978 | public ExprContext() { }
979 | public void copyFrom(ExprContext ctx) {
980 | super.copyFrom(ctx);
981 | }
982 | }
983 | public static class MinusContext extends ExprContext {
984 | public ExprContext expr() {
985 | return getRuleContext(ExprContext.class,0);
986 | }
987 | public TerminalNode MINUS() { return getToken(RowsParser.MINUS, 0); }
988 | public MinusContext(ExprContext ctx) { copyFrom(ctx); }
989 | @Override
990 | public void enterRule(ParseTreeListener listener) {
991 | if ( listener instanceof RowsListener ) ((RowsListener)listener).enterMinus(this);
992 | }
993 | @Override
994 | public void exitRule(ParseTreeListener listener) {
995 | if ( listener instanceof RowsListener ) ((RowsListener)listener).exitMinus(this);
996 | }
997 | }
998 | public static class ParenContext extends ExprContext {
999 | public ExprContext expr() {
1000 | return getRuleContext(ExprContext.class,0);
1001 | }
1002 | public TerminalNode RPAREN() { return getToken(RowsParser.RPAREN, 0); }
1003 | public TerminalNode LPAREN() { return getToken(RowsParser.LPAREN, 0); }
1004 | public ParenContext(ExprContext ctx) { copyFrom(ctx); }
1005 | @Override
1006 | public void enterRule(ParseTreeListener listener) {
1007 | if ( listener instanceof RowsListener ) ((RowsListener)listener).enterParen(this);
1008 | }
1009 | @Override
1010 | public void exitRule(ParseTreeListener listener) {
1011 | if ( listener instanceof RowsListener ) ((RowsListener)listener).exitParen(this);
1012 | }
1013 | }
1014 | public static class MulDivContext extends ExprContext {
1015 | public List expr() {
1016 | return getRuleContexts(ExprContext.class);
1017 | }
1018 | public ExprContext expr(int i) {
1019 | return getRuleContext(ExprContext.class,i);
1020 | }
1021 | public TerminalNode MULTIPLY() { return getToken(RowsParser.MULTIPLY, 0); }
1022 | public TerminalNode DIVIDE() { return getToken(RowsParser.DIVIDE, 0); }
1023 | public MulDivContext(ExprContext ctx) { copyFrom(ctx); }
1024 | @Override
1025 | public void enterRule(ParseTreeListener listener) {
1026 | if ( listener instanceof RowsListener ) ((RowsListener)listener).enterMulDiv(this);
1027 | }
1028 | @Override
1029 | public void exitRule(ParseTreeListener listener) {
1030 | if ( listener instanceof RowsListener ) ((RowsListener)listener).exitMulDiv(this);
1031 | }
1032 | }
1033 | public static class SingleContext extends ExprContext {
1034 | public TerminalNode FLOAT() { return getToken(RowsParser.FLOAT, 0); }
1035 | public TerminalNode INT() { return getToken(RowsParser.INT, 0); }
1036 | public List expr() {
1037 | return getRuleContexts(ExprContext.class);
1038 | }
1039 | public TerminalNode MINUS() { return getToken(RowsParser.MINUS, 0); }
1040 | public ExprContext expr(int i) {
1041 | return getRuleContext(ExprContext.class,i);
1042 | }
1043 | public TerminalNode VAR() { return getToken(RowsParser.VAR, 0); }
1044 | public TerminalNode PLUS() { return getToken(RowsParser.PLUS, 0); }
1045 | public SingleContext(ExprContext ctx) { copyFrom(ctx); }
1046 | @Override
1047 | public void enterRule(ParseTreeListener listener) {
1048 | if ( listener instanceof RowsListener ) ((RowsListener)listener).enterSingle(this);
1049 | }
1050 | @Override
1051 | public void exitRule(ParseTreeListener listener) {
1052 | if ( listener instanceof RowsListener ) ((RowsListener)listener).exitSingle(this);
1053 | }
1054 | }
1055 |
1056 | public final ExprContext expr() throws RecognitionException {
1057 | return expr(0);
1058 | }
1059 |
1060 | private ExprContext expr(int _p) throws RecognitionException {
1061 | ParserRuleContext _parentctx = _ctx;
1062 | int _parentState = getState();
1063 | ExprContext _localctx = new ExprContext(_ctx, _parentState);
1064 | ExprContext _prevctx = _localctx;
1065 | int _startState = 4;
1066 | enterRecursionRule(_localctx, 4, RULE_expr, _p);
1067 | int _la;
1068 | try {
1069 | int _alt;
1070 | enterOuterAlt(_localctx, 1);
1071 | {
1072 | setState(391);
1073 | switch (_input.LA(1)) {
1074 | case MINUS:
1075 | {
1076 | _localctx = new MinusContext(_localctx);
1077 | _ctx = _localctx;
1078 | _prevctx = _localctx;
1079 |
1080 | setState(384); match(MINUS);
1081 | setState(385); expr(2);
1082 | }
1083 | break;
1084 | case INT:
1085 | case FLOAT:
1086 | case VAR:
1087 | {
1088 | _localctx = new SingleContext(_localctx);
1089 | _ctx = _localctx;
1090 | _prevctx = _localctx;
1091 | setState(386);
1092 | _la = _input.LA(1);
1093 | if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << INT) | (1L << FLOAT) | (1L << VAR))) != 0)) ) {
1094 | _errHandler.recoverInline(this);
1095 | }
1096 | consume();
1097 | }
1098 | break;
1099 | case LPAREN:
1100 | {
1101 | _localctx = new ParenContext(_localctx);
1102 | _ctx = _localctx;
1103 | _prevctx = _localctx;
1104 | setState(387); match(LPAREN);
1105 | setState(388); expr(0);
1106 | setState(389); match(RPAREN);
1107 | }
1108 | break;
1109 | default:
1110 | throw new NoViableAltException(this);
1111 | }
1112 | _ctx.stop = _input.LT(-1);
1113 | setState(401);
1114 | _errHandler.sync(this);
1115 | _alt = getInterpreter().adaptivePredict(_input,31,_ctx);
1116 | while ( _alt!=2 && _alt!=ATN.INVALID_ALT_NUMBER ) {
1117 | if ( _alt==1 ) {
1118 | if ( _parseListeners!=null ) triggerExitRuleEvent();
1119 | _prevctx = _localctx;
1120 | {
1121 | setState(399);
1122 | switch ( getInterpreter().adaptivePredict(_input,30,_ctx) ) {
1123 | case 1:
1124 | {
1125 | _localctx = new MulDivContext(new ExprContext(_parentctx, _parentState));
1126 | pushNewRecursionContext(_localctx, _startState, RULE_expr);
1127 | setState(393);
1128 | if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)");
1129 | setState(394);
1130 | _la = _input.LA(1);
1131 | if ( !(_la==DIVIDE || _la==MULTIPLY) ) {
1132 | _errHandler.recoverInline(this);
1133 | }
1134 | consume();
1135 | setState(395); expr(5);
1136 | }
1137 | break;
1138 |
1139 | case 2:
1140 | {
1141 | _localctx = new SingleContext(new ExprContext(_parentctx, _parentState));
1142 | pushNewRecursionContext(_localctx, _startState, RULE_expr);
1143 | setState(396);
1144 | if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)");
1145 | setState(397);
1146 | _la = _input.LA(1);
1147 | if ( !(_la==MINUS || _la==PLUS) ) {
1148 | _errHandler.recoverInline(this);
1149 | }
1150 | consume();
1151 | setState(398); expr(4);
1152 | }
1153 | break;
1154 | }
1155 | }
1156 | }
1157 | setState(403);
1158 | _errHandler.sync(this);
1159 | _alt = getInterpreter().adaptivePredict(_input,31,_ctx);
1160 | }
1161 | }
1162 | }
1163 | catch (RecognitionException re) {
1164 | _localctx.exception = re;
1165 | _errHandler.reportError(this, re);
1166 | _errHandler.recover(this, re);
1167 | }
1168 | finally {
1169 | unrollRecursionContexts(_parentctx);
1170 | }
1171 | return _localctx;
1172 | }
1173 |
1174 | public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
1175 | switch (ruleIndex) {
1176 | case 2: return expr_sempred((ExprContext)_localctx, predIndex);
1177 | }
1178 | return true;
1179 | }
1180 | private boolean expr_sempred(ExprContext _localctx, int predIndex) {
1181 | switch (predIndex) {
1182 | case 0: return precpred(_ctx, 4);
1183 |
1184 | case 1: return precpred(_ctx, 3);
1185 | }
1186 | return true;
1187 | }
1188 |
1189 | public static final String _serializedATN =
1190 | "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\61\u0197\4\2\t\2"+
1191 | "\4\3\t\3\4\4\t\4\3\2\6\2\n\n\2\r\2\16\2\13\3\3\3\3\3\3\5\3\21\n\3\3\3"+
1192 | "\5\3\24\n\3\3\3\5\3\27\n\3\3\3\5\3\32\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1193 | "\3\3\5\3$\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3.\n\3\3\3\3\3\3\3\3\3"+
1194 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3<\n\3\3\3\5\3?\n\3\3\3\5\3B\n\3\3"+
1195 | "\3\5\3E\n\3\3\3\5\3H\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1196 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3`\n\3\3\3\3\3\3\3\3\3\3"+
1197 | "\3\3\3\3\3\3\3\5\3j\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3t\n\3\3\3\3"+
1198 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3~\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5"+
1199 | "\3\u0088\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\6\3\u0092\n\3\r\3\16\3\u0093"+
1200 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1201 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1202 | "\3\3\3\3\3\3\3\3\7\3\u00bd\n\3\f\3\16\3\u00c0\13\3\3\3\3\3\3\3\3\3\3\3"+
1203 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1204 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1205 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1206 | "\3\3\3\3\3\3\3\5\3\u00ff\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3\u0109"+
1207 | "\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3\u0113\n\3\3\3\3\3\3\3\3\3\3\3"+
1208 | "\3\3\3\3\3\3\5\3\u011d\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3\u0127\n"+
1209 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3\u0131\n\3\3\3\3\3\3\3\3\3\3\3\3"+
1210 | "\3\3\3\3\3\5\3\u013b\n\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1211 | "\3\3\3\3\3\3\3\6\3\u014c\n\3\r\3\16\3\u014d\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1212 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1213 | "\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3"+
1214 | "\3\3\3\3\3\5\3\u017c\n\3\3\3\3\3\5\3\u0180\n\3\3\4\3\4\3\4\3\4\3\4\3\4"+
1215 | "\3\4\3\4\5\4\u018a\n\4\3\4\3\4\3\4\3\4\3\4\3\4\7\4\u0192\n\4\f\4\16\4"+
1216 | "\u0195\13\4\3\4\2\3\6\5\2\4\6\2\7\3\2&\'\4\2&\',,\4\2&\'++\3\2\5\6\3\2"+
1217 | "\7\b\u01d4\2\t\3\2\2\2\4\u017f\3\2\2\2\6\u0189\3\2\2\2\b\n\5\4\3\2\t\b"+
1218 | "\3\2\2\2\n\13\3\2\2\2\13\t\3\2\2\2\13\f\3\2\2\2\f\3\3\2\2\2\r\16\7\3\2"+
1219 | "\2\16\20\7\34\2\2\17\21\7&\2\2\20\17\3\2\2\2\20\21\3\2\2\2\21\23\3\2\2"+
1220 | "\2\22\24\7&\2\2\23\22\3\2\2\2\23\24\3\2\2\2\24\26\3\2\2\2\25\27\7&\2\2"+
1221 | "\26\25\3\2\2\2\26\27\3\2\2\2\27\31\3\2\2\2\30\32\7&\2\2\31\30\3\2\2\2"+
1222 | "\31\32\3\2\2\2\32\33\3\2\2\2\33\34\7-\2\2\34\u0180\7\61\2\2\35\36\7\3"+
1223 | "\2\2\36\37\7\32\2\2\37 \7&\2\2 !\7&\2\2!#\7\16\2\2\"$\5\6\4\2#\"\3\2\2"+
1224 | "\2#$\3\2\2\2$%\3\2\2\2%&\7-\2\2&\u0180\7\61\2\2\'(\7\3\2\2()\7\32\2\2"+
1225 | ")*\7&\2\2*+\7&\2\2+-\7\17\2\2,.\7&\2\2-,\3\2\2\2-.\3\2\2\2./\3\2\2\2/"+
1226 | "\60\7-\2\2\60\u0180\7\61\2\2\61\62\7\3\2\2\62\63\7\32\2\2\63\64\7&\2\2"+
1227 | "\64\65\7&\2\2\65\66\7\20\2\2\66\67\7-\2\2\67\u0180\7\61\2\289\7\4\2\2"+
1228 | "9;\7\33\2\2:<\7&\2\2;:\3\2\2\2;<\3\2\2\2<>\3\2\2\2=?\7&\2\2>=\3\2\2\2"+
1229 | ">?\3\2\2\2?A\3\2\2\2@B\7&\2\2A@\3\2\2\2AB\3\2\2\2BD\3\2\2\2CE\7&\2\2D"+
1230 | "C\3\2\2\2DE\3\2\2\2EG\3\2\2\2FH\7&\2\2GF\3\2\2\2GH\3\2\2\2HI\3\2\2\2I"+
1231 | "J\7-\2\2J\u0180\7\61\2\2KL\7\3\2\2LM\7\r\2\2MN\5\6\4\2NO\5\6\4\2OP\5\6"+
1232 | "\4\2PQ\5\6\4\2QR\5\6\4\2RS\5\6\4\2ST\7\7\2\2TU\7\7\2\2UV\7\7\2\2VW\7-"+
1233 | "\2\2WX\7\61\2\2X\u0180\3\2\2\2YZ\7\3\2\2Z[\7\32\2\2[\\\7&\2\2\\]\7&\2"+
1234 | "\2]_\7\b\2\2^`\t\2\2\2_^\3\2\2\2_`\3\2\2\2`a\3\2\2\2ab\7-\2\2b\u0180\7"+
1235 | "\61\2\2cd\7\3\2\2de\7\32\2\2ef\7&\2\2fg\7&\2\2gi\7\7\2\2hj\t\2\2\2ih\3"+
1236 | "\2\2\2ij\3\2\2\2jk\3\2\2\2kl\7-\2\2l\u0180\7\61\2\2mn\7\3\2\2no\7\32\2"+
1237 | "\2op\7&\2\2pq\7&\2\2qs\7\6\2\2rt\t\2\2\2sr\3\2\2\2st\3\2\2\2tu\3\2\2\2"+
1238 | "uv\7-\2\2v\u0180\7\61\2\2wx\7\3\2\2xy\7\32\2\2yz\7&\2\2z{\7&\2\2{}\7\5"+
1239 | "\2\2|~\t\2\2\2}|\3\2\2\2}~\3\2\2\2~\177\3\2\2\2\177\u0080\7-\2\2\u0080"+
1240 | "\u0180\7\61\2\2\u0081\u0082\7\3\2\2\u0082\u0083\7\32\2\2\u0083\u0084\7"+
1241 | "&\2\2\u0084\u0085\7&\2\2\u0085\u0087\7\36\2\2\u0086\u0088\t\2\2\2\u0087"+
1242 | "\u0086\3\2\2\2\u0087\u0088\3\2\2\2\u0088\u0089\3\2\2\2\u0089\u008a\7-"+
1243 | "\2\2\u008a\u0180\7\61\2\2\u008b\u008c\7\3\2\2\u008c\u008d\7\32\2\2\u008d"+
1244 | "\u008e\7&\2\2\u008e\u008f\7&\2\2\u008f\u0091\7)\2\2\u0090\u0092\t\3\2"+
1245 | "\2\u0091\u0090\3\2\2\2\u0092\u0093\3\2\2\2\u0093\u0091\3\2\2\2\u0093\u0094"+
1246 | "\3\2\2\2\u0094\u0095\3\2\2\2\u0095\u0096\7-\2\2\u0096\u0180\7\61\2\2\u0097"+
1247 | "\u0098\7\3\2\2\u0098\u0099\7\32\2\2\u0099\u009a\7&\2\2\u009a\u009b\7&"+
1248 | "\2\2\u009b\u009c\7*\2\2\u009c\u009d\7&\2\2\u009d\u009e\7&\2\2\u009e\u009f"+
1249 | "\7&\2\2\u009f\u00a0\7&\2\2\u00a0\u00a1\7,\2\2\u00a1\u00a2\7,\2\2\u00a2"+
1250 | "\u00a3\7,\2\2\u00a3\u00a4\7&\2\2\u00a4\u00a5\7&\2\2\u00a5\u00a6\7&\2\2"+
1251 | "\u00a6\u00a7\7&\2\2\u00a7\u00a8\5\6\4\2\u00a8\u00a9\5\6\4\2\u00a9\u00aa"+
1252 | "\7\61\2\2\u00aa\u00ab\5\6\4\2\u00ab\u00ac\7-\2\2\u00ac\u00ad\7\61\2\2"+
1253 | "\u00ad\u0180\3\2\2\2\u00ae\u00af\7\3\2\2\u00af\u00b0\7\32\2\2\u00b0\u00b1"+
1254 | "\7&\2\2\u00b1\u00b2\7&\2\2\u00b2\u00b3\7\f\2\2\u00b3\u00b4\5\6\4\2\u00b4"+
1255 | "\u00b5\7-\2\2\u00b5\u00b6\7\61\2\2\u00b6\u0180\3\2\2\2\u00b7\u00b8\7\3"+
1256 | "\2\2\u00b8\u00b9\7\35\2\2\u00b9\u00ba\7&\2\2\u00ba\u00be\7&\2\2\u00bb"+
1257 | "\u00bd\t\2\2\2\u00bc\u00bb\3\2\2\2\u00bd\u00c0\3\2\2\2\u00be\u00bc\3\2"+
1258 | "\2\2\u00be\u00bf\3\2\2\2\u00bf\u00c1\3\2\2\2\u00c0\u00be\3\2\2\2\u00c1"+
1259 | "\u00c2\7-\2\2\u00c2\u0180\7\61\2\2\u00c3\u00c4\7\3\2\2\u00c4\u00c5\7\32"+
1260 | "\2\2\u00c5\u00c6\7&\2\2\u00c6\u00c7\7&\2\2\u00c7\u00c8\7\21\2\2\u00c8"+
1261 | "\u00c9\7&\2\2\u00c9\u00ca\7-\2\2\u00ca\u0180\7\61\2\2\u00cb\u00cc\7\3"+
1262 | "\2\2\u00cc\u00cd\7\32\2\2\u00cd\u00ce\7&\2\2\u00ce\u00cf\7&\2\2\u00cf"+
1263 | "\u00d0\7\23\2\2\u00d0\u00d1\7-\2\2\u00d1\u0180\7\61\2\2\u00d2\u00d3\7"+
1264 | "\3\2\2\u00d3\u00d4\7\32\2\2\u00d4\u00d5\7&\2\2\u00d5\u00d6\7&\2\2\u00d6"+
1265 | "\u00d7\7\22\2\2\u00d7\u00d8\7&\2\2\u00d8\u00d9\7-\2\2\u00d9\u0180\7\61"+
1266 | "\2\2\u00da\u00db\7\3\2\2\u00db\u00dc\7\32\2\2\u00dc\u00dd\7&\2\2\u00dd"+
1267 | "\u00de\7&\2\2\u00de\u00df\7\25\2\2\u00df\u00e0\5\6\4\2\u00e0\u00e1\5\6"+
1268 | "\4\2\u00e1\u00e2\7-\2\2\u00e2\u00e3\7\61\2\2\u00e3\u0180\3\2\2\2\u00e4"+
1269 | "\u00e5\7\3\2\2\u00e5\u00e6\7\32\2\2\u00e6\u00e7\7&\2\2\u00e7\u00e8\7&"+
1270 | "\2\2\u00e8\u00e9\7\31\2\2\u00e9\u00ea\5\6\4\2\u00ea\u00eb\5\6\4\2\u00eb"+
1271 | "\u00ec\7-\2\2\u00ec\u00ed\7\61\2\2\u00ed\u0180\3\2\2\2\u00ee\u00ef\7\3"+
1272 | "\2\2\u00ef\u00f0\7\32\2\2\u00f0\u00f1\7&\2\2\u00f1\u00f2\7&\2\2\u00f2"+
1273 | "\u00f3\7\26\2\2\u00f3\u00f4\5\6\4\2\u00f4\u00f5\5\6\4\2\u00f5\u00f6\7"+
1274 | "-\2\2\u00f6\u00f7\7\61\2\2\u00f7\u0180\3\2\2\2\u00f8\u00f9\7\3\2\2\u00f9"+
1275 | "\u00fa\7\32\2\2\u00fa\u00fb\7&\2\2\u00fb\u00fc\7&\2\2\u00fc\u00fe\7\27"+
1276 | "\2\2\u00fd\u00ff\5\6\4\2\u00fe\u00fd\3\2\2\2\u00fe\u00ff\3\2\2\2\u00ff"+
1277 | "\u0100\3\2\2\2\u0100\u0101\7-\2\2\u0101\u0180\7\61\2\2\u0102\u0103\7\3"+
1278 | "\2\2\u0103\u0104\7\32\2\2\u0104\u0105\7&\2\2\u0105\u0106\7&\2\2\u0106"+
1279 | "\u0108\7\30\2\2\u0107\u0109\5\6\4\2\u0108\u0107\3\2\2\2\u0108\u0109\3"+
1280 | "\2\2\2\u0109\u010a\3\2\2\2\u010a\u010b\7-\2\2\u010b\u0180\7\61\2\2\u010c"+
1281 | "\u010d\7\3\2\2\u010d\u010e\7\32\2\2\u010e\u010f\7&\2\2\u010f\u0110\7&"+
1282 | "\2\2\u0110\u0112\7$\2\2\u0111\u0113\5\6\4\2\u0112\u0111\3\2\2\2\u0112"+
1283 | "\u0113\3\2\2\2\u0113\u0114\3\2\2\2\u0114\u0115\7-\2\2\u0115\u0180\7\61"+
1284 | "\2\2\u0116\u0117\7\3\2\2\u0117\u0118\7\32\2\2\u0118\u0119\7&\2\2\u0119"+
1285 | "\u011a\7&\2\2\u011a\u011c\7%\2\2\u011b\u011d\5\6\4\2\u011c\u011b\3\2\2"+
1286 | "\2\u011c\u011d\3\2\2\2\u011d\u011e\3\2\2\2\u011e\u011f\7-\2\2\u011f\u0180"+
1287 | "\7\61\2\2\u0120\u0121\7\3\2\2\u0121\u0122\7\32\2\2\u0122\u0123\7&\2\2"+
1288 | "\u0123\u0124\7&\2\2\u0124\u0126\7\t\2\2\u0125\u0127\5\6\4\2\u0126\u0125"+
1289 | "\3\2\2\2\u0126\u0127\3\2\2\2\u0127\u0128\3\2\2\2\u0128\u0129\7-\2\2\u0129"+
1290 | "\u0180\7\61\2\2\u012a\u012b\7\3\2\2\u012b\u012c\7\32\2\2\u012c\u012d\7"+
1291 | "&\2\2\u012d\u012e\7&\2\2\u012e\u0130\7\n\2\2\u012f\u0131\5\6\4\2\u0130"+
1292 | "\u012f\3\2\2\2\u0130\u0131\3\2\2\2\u0131\u0132\3\2\2\2\u0132\u0133\7-"+
1293 | "\2\2\u0133\u0180\7\61\2\2\u0134\u0135\7\3\2\2\u0135\u0136\7\32\2\2\u0136"+
1294 | "\u0137\7&\2\2\u0137\u0138\7&\2\2\u0138\u013a\7\13\2\2\u0139\u013b\5\6"+
1295 | "\4\2\u013a\u0139\3\2\2\2\u013a\u013b\3\2\2\2\u013b\u013c\3\2\2\2\u013c"+
1296 | "\u013d\7-\2\2\u013d\u0180\7\61\2\2\u013e\u013f\7\3\2\2\u013f\u0140\7\32"+
1297 | "\2\2\u0140\u0141\7&\2\2\u0141\u0142\7&\2\2\u0142\u0143\7\37\2\2\u0143"+
1298 | "\u0144\7-\2\2\u0144\u0180\7\61\2\2\u0145\u0146\7\3\2\2\u0146\u0147\7\32"+
1299 | "\2\2\u0147\u0148\7&\2\2\u0148\u0149\7&\2\2\u0149\u014b\7 \2\2\u014a\u014c"+
1300 | "\t\3\2\2\u014b\u014a\3\2\2\2\u014c\u014d\3\2\2\2\u014d\u014b\3\2\2\2\u014d"+
1301 | "\u014e\3\2\2\2\u014e\u014f\3\2\2\2\u014f\u0150\7-\2\2\u0150\u0180\7\61"+
1302 | "\2\2\u0151\u0152\7\3\2\2\u0152\u0153\7\32\2\2\u0153\u0154\7&\2\2\u0154"+
1303 | "\u0155\7&\2\2\u0155\u0156\7!\2\2\u0156\u0157\7-\2\2\u0157\u0180\7\61\2"+
1304 | "\2\u0158\u0159\7\3\2\2\u0159\u015a\7\32\2\2\u015a\u015b\7&\2\2\u015b\u015c"+
1305 | "\7&\2\2\u015c\u015d\7\"\2\2\u015d\u015e\7-\2\2\u015e\u0180\7\61\2\2\u015f"+
1306 | "\u0160\7\3\2\2\u0160\u0161\7\32\2\2\u0161\u0162\7&\2\2\u0162\u0163\7&"+
1307 | "\2\2\u0163\u0164\7#\2\2\u0164\u0165\7&\2\2\u0165\u0166\7&\2\2\u0166\u0167"+
1308 | "\7,\2\2\u0167\u0168\7,\2\2\u0168\u0169\7,\2\2\u0169\u016a\5\6\4\2\u016a"+
1309 | "\u016b\5\6\4\2\u016b\u016c\5\6\4\2\u016c\u016d\5\6\4\2\u016d\u016e\5\6"+
1310 | "\4\2\u016e\u016f\5\6\4\2\u016f\u0170\5\6\4\2\u0170\u0171\5\6\4\2\u0171"+
1311 | "\u0172\5\6\4\2\u0172\u0173\7-\2\2\u0173\u0174\7\61\2\2\u0174\u0180\3\2"+
1312 | "\2\2\u0175\u0176\7\3\2\2\u0176\u0177\7\32\2\2\u0177\u0178\7&\2\2\u0178"+
1313 | "\u0179\7&\2\2\u0179\u017b\7\24\2\2\u017a\u017c\t\2\2\2\u017b\u017a\3\2"+
1314 | "\2\2\u017b\u017c\3\2\2\2\u017c\u017d\3\2\2\2\u017d\u017e\7-\2\2\u017e"+
1315 | "\u0180\7\61\2\2\u017f\r\3\2\2\2\u017f\35\3\2\2\2\u017f\'\3\2\2\2\u017f"+
1316 | "\61\3\2\2\2\u017f8\3\2\2\2\u017fK\3\2\2\2\u017fY\3\2\2\2\u017fc\3\2\2"+
1317 | "\2\u017fm\3\2\2\2\u017fw\3\2\2\2\u017f\u0081\3\2\2\2\u017f\u008b\3\2\2"+
1318 | "\2\u017f\u0097\3\2\2\2\u017f\u00ae\3\2\2\2\u017f\u00b7\3\2\2\2\u017f\u00c3"+
1319 | "\3\2\2\2\u017f\u00cb\3\2\2\2\u017f\u00d2\3\2\2\2\u017f\u00da\3\2\2\2\u017f"+
1320 | "\u00e4\3\2\2\2\u017f\u00ee\3\2\2\2\u017f\u00f8\3\2\2\2\u017f\u0102\3\2"+
1321 | "\2\2\u017f\u010c\3\2\2\2\u017f\u0116\3\2\2\2\u017f\u0120\3\2\2\2\u017f"+
1322 | "\u012a\3\2\2\2\u017f\u0134\3\2\2\2\u017f\u013e\3\2\2\2\u017f\u0145\3\2"+
1323 | "\2\2\u017f\u0151\3\2\2\2\u017f\u0158\3\2\2\2\u017f\u015f\3\2\2\2\u017f"+
1324 | "\u0175\3\2\2\2\u0180\5\3\2\2\2\u0181\u0182\b\4\1\2\u0182\u0183\7\7\2\2"+
1325 | "\u0183\u018a\5\6\4\4\u0184\u018a\t\4\2\2\u0185\u0186\7.\2\2\u0186\u0187"+
1326 | "\5\6\4\2\u0187\u0188\7/\2\2\u0188\u018a\3\2\2\2\u0189\u0181\3\2\2\2\u0189"+
1327 | "\u0184\3\2\2\2\u0189\u0185\3\2\2\2\u018a\u0193\3\2\2\2\u018b\u018c\f\6"+
1328 | "\2\2\u018c\u018d\t\5\2\2\u018d\u0192\5\6\4\7\u018e\u018f\f\5\2\2\u018f"+
1329 | "\u0190\t\6\2\2\u0190\u0192\5\6\4\6\u0191\u018b\3\2\2\2\u0191\u018e\3\2"+
1330 | "\2\2\u0192\u0195\3\2\2\2\u0193\u0191\3\2\2\2\u0193\u0194\3\2\2\2\u0194"+
1331 | "\7\3\2\2\2\u0195\u0193\3\2\2\2\"\13\20\23\26\31#-;>ADG_is}\u0087\u0093"+
1332 | "\u00be\u00fe\u0108\u0112\u011c\u0126\u0130\u013a\u014d\u017b\u017f\u0189"+
1333 | "\u0191\u0193";
1334 | public static final ATN _ATN =
1335 | new ATNDeserializer().deserialize(_serializedATN.toCharArray());
1336 | static {
1337 | _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
1338 | for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
1339 | _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
1340 | }
1341 | }
1342 | }
--------------------------------------------------------------------------------
/src/ConvertPdListener.java:
--------------------------------------------------------------------------------
1 | import java.io.FileNotFoundException;
2 | import java.io.PrintWriter;
3 | import java.io.UnsupportedEncodingException;
4 | import java.util.ArrayList;
5 | import java.util.HashMap;
6 | import java.util.Iterator;
7 | import java.util.List;
8 | import java.util.Map;
9 | import java.util.Map.Entry;
10 |
11 | import org.antlr.v4.runtime.TokenStream;
12 |
13 | //tracked version
14 | public class ConvertPdListener extends RowsBaseListener {
15 | class Pair{
16 | int objectNumber;
17 | int outletNumber;
18 | public Pair(int objectNum,int outletNumber){
19 | this.objectNumber = objectNum;
20 | this.outletNumber = outletNumber;
21 | }
22 | public String toString() {
23 | return objectNumber + "-" + outletNumber;
24 | }
25 | }
26 | class PDObject{
27 |
28 | String name;
29 | String defaultVal;
30 | List args;
31 | //integer -> PDObject's inletNumber
32 | //List -> [{0,0}, {1,0}] means 0th object's 0th outlet and 1st object's 0th outlet are coming into this PDObject's inlet
33 | Map> objectInlets;
34 | Map outputs;
35 | Map outputTypes;
36 | public PDObject(String name,String defaultVal){
37 | this.name = name;
38 | this.defaultVal = defaultVal;
39 | this.objectInlets = new HashMap>();
40 | this.outputs = new HashMap();
41 | this.outputTypes = new HashMap();
42 |
43 | }
44 | public PDObject(String name){
45 | this.name = name;
46 | this.defaultVal = "no-default";
47 | this.objectInlets = new HashMap>();
48 | this.outputs = new HashMap();
49 | this.outputTypes = new HashMap();
50 | }
51 | public PDObject(String name,List args){
52 | this.name = name;
53 | this.defaultVal = "no-default";
54 | this.objectInlets = new HashMap>();
55 | this.outputs = new HashMap();
56 | this.args = args;
57 | this.outputTypes = new HashMap();
58 | }
59 | public String toString() {
60 | return name + objectInlets.toString();
61 | }
62 | }
63 |
64 | String fileName;
65 | RowsParser parser;
66 | List imports;
67 | List exps;
68 | int objNo = 0;
69 |
70 | //new variables
71 | Map pdObjects; //integer -> object number
72 | int dacObjectNumber;
73 | Map definitions;
74 |
75 |
76 |
77 | public ConvertPdListener(RowsParser parser,String fileName) {
78 | this.fileName = fileName;
79 | this.parser = parser;
80 | this.imports = new ArrayList();
81 | this.exps = new ArrayList();
82 |
83 | this.pdObjects = new HashMap();
84 | this.definitions = new HashMap();
85 | }
86 |
87 | // @Override
88 | // public void exitExpr(RowsParser.ExprContext ctx){
89 | // TokenStream tokens = parser.getTokenStream();
90 | // System.out.println(tokens.getText(ctx));
91 | //
92 | // }
93 |
94 | @Override
95 | public void enterFile(RowsParser.FileContext ctx){
96 | // System.out.println("row:"+ctx.row().getText());
97 | }
98 | PrintWriter writer;
99 | @Override
100 | public void exitFile(RowsParser.FileContext ctx) {
101 | //System.out.println(imports);
102 | //System.out.println(objects);
103 | //System.out.println(pdObjects);
104 | try {
105 | writer = new PrintWriter(this.fileName.substring(0, this.fileName.length()-3)+".dsp", "UTF-8");
106 | } catch (FileNotFoundException e) {
107 | // TODO Auto-generated catch block
108 | e.printStackTrace();
109 | } catch (UnsupportedEncodingException e) {
110 | // TODO Auto-generated catch block
111 | e.printStackTrace();
112 | }
113 | PDObject dacObject = pdObjects.get(dacObjectNumber);
114 |
115 | //Pair inlet0 = dacObject.objectInlets.get(0);
116 | String inlet0 = "";
117 | List comingSourcesToInlet0 = dacObject.objectInlets.get(0);
118 | if(comingSourcesToInlet0 != null){
119 | for(int i=0; i comingSourcesToInlet1 = dacObject.objectInlets.get(1);
129 | if(comingSourcesToInlet1 !=null){
130 | for(int i=0; i 0){
155 | for(int i=0; i> it = this.definitions.entrySet().iterator();
163 | while (it.hasNext()) {
164 | Entry pairs = it.next();
165 | System.out.println(pairs.getValue());
166 | writer.println(pairs.getValue());
167 | it.remove(); // avoids a ConcurrentModificationException //REMOVES ALSO FROM HASH TABLE
168 | }
169 |
170 | System.out.println(process);
171 | writer.println(process);
172 | writer.close();
173 | System.out.println("created successfully: " + this.fileName.substring(0, this.fileName.length()-3)+".dsp");
174 | }
175 |
176 | //Creates the object with given objectNumber and sets the numbered outlet output
177 | public String createObject_setOutput(int objectNumber,int outletNumber){
178 |
179 | PDObject pdObject = pdObjects.get(objectNumber);
180 |
181 | if(pdObject.name.equalsIgnoreCase("'osc~'")){
182 | //TODO Implement inlet1
183 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
184 | String inlet0="";
185 | if(comingSourcesToInlet0 !=null){
186 | for (int i = 0; i < comingSourcesToInlet0.size(); i++) {
187 | Pair tmp = comingSourcesToInlet0.get(i);
188 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber) + "+";
189 | }
190 | inlet0 = inlet0.substring(0, inlet0.length()-1);
191 | pdObject.defaultVal = inlet0;
192 | }
193 |
194 | String output_on_outlet0 = String.format("osc%s", objectNumber);
195 |
196 | pdObject.outputs.put(outletNumber,output_on_outlet0);
197 | pdObject.outputTypes.put(outletNumber, "float");
198 |
199 | this.definitions.put(objectNumber, String.format("osc%s=osc(%s);", objectNumber,pdObject.defaultVal));
200 | return output_on_outlet0;
201 | }
202 |
203 | else if(pdObject.name.equalsIgnoreCase("'floatatom'")){
204 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
205 | String inlet0="";
206 | if(comingSourcesToInlet0 !=null){
207 | Pair tmp = comingSourcesToInlet0.get(0);
208 | PDObject obj = pdObjects.get(tmp.objectNumber);
209 | if(obj.name.equalsIgnoreCase("'msg'")){
210 | String objOut = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
211 | inlet0 += String.format("((1-checkbox%s)*number%s)+%s",tmp.objectNumber,objectNumber,objOut);
212 | }
213 | //if coming an input except for msg, ignore the floatatom element and pass the coming input as output
214 | else{
215 | String comingObjOutput = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
216 | // if(obj.outputTypes.get(tmp.outletNumber).equalsIgnoreCase("float")){
217 | //
218 | // }
219 | inlet0 += comingObjOutput;
220 | }
221 | //inlet0 = createObject_setOutput(tmp.objectNumber, tmp.objectNumber);
222 |
223 | }
224 | //IF NO COMING CONNECTION INTO INLET0
225 | else{
226 | inlet0 = String.format("number%s",objectNumber);
227 | String l = pdObject.args.get(0);
228 | String u = pdObject.args.get(1);
229 | if(Float.parseFloat(l) == 0){
230 | l = "0";
231 | }
232 | if(Float.parseFloat(u) == 0){
233 | u = "10000";
234 | }
235 | this.definitions.put(objectNumber, String.format("number%s=hslider(\"number %s\" ,1 ,%s,%s,0.1);", objectNumber,objectNumber,l,u));
236 | }
237 |
238 | String output_on_outlet0 = String.format("%s",inlet0);
239 | pdObject.outputs.put(outletNumber, output_on_outlet0);
240 | pdObject.outputTypes.put(0, "float");
241 | //if(inlet0 == null){
242 |
243 | //}
244 | // else{
245 | //
246 | // this.definitions.put(objectNumber, String.format("number%s=%s;", objectNumber,inlet0));
247 | // }
248 |
249 | return output_on_outlet0;
250 |
251 |
252 | }
253 | else if(pdObject.name.equalsIgnoreCase("'tgl'")){
254 | this.definitions.put(objectNumber, String.format("checkbox%s=checkbox(\"checkbox %s\");", objectNumber,objectNumber));
255 | String output_on_outlet0 = String.format("checkbox%s",objectNumber);
256 | pdObject.outputs.put(outletNumber, output_on_outlet0);
257 | pdObject.outputTypes.put(0, "float");
258 | return pdObject.outputs.get(outletNumber);
259 | }
260 | else if(pdObject.name.equalsIgnoreCase("PLUS")){
261 | //Collect objects coming into inlet 0
262 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
263 | String inlet0="";
264 | if(comingSourcesToInlet0 !=null){
265 | for (int i = 0; i < comingSourcesToInlet0.size(); i++) {
266 | Pair tmp = comingSourcesToInlet0.get(i);
267 | String out = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
268 | PDObject obj = pdObjects.get(tmp.objectNumber);
269 | if(obj.outputTypes.get(tmp.outletNumber).equalsIgnoreCase("float")){
270 | inlet0 += out + "+";
271 | }
272 |
273 | }
274 | inlet0 = inlet0.substring(0, inlet0.length()-1);
275 | }
276 |
277 | //Collect objects coming into inlet 1
278 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
279 | String inlet1="";
280 | if(comingSourcesToInlet1 !=null){
281 | for (int i = 0; i < comingSourcesToInlet1.size(); i++) {
282 | Pair tmp = comingSourcesToInlet1.get(i);
283 | String out = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
284 | inlet1 += out + "+";
285 | }
286 | inlet1 = inlet1.substring(0, inlet1.length()-1);
287 | pdObject.defaultVal = inlet1; // this expression violates the cold inlet mechanism
288 | }
289 |
290 | String output_on_outlet0 = String.format("(%s+%s)",inlet0,pdObject.defaultVal);
291 | pdObject.outputs.put(outletNumber, output_on_outlet0);
292 | pdObject.outputTypes.put(outletNumber, "float");
293 |
294 | //return with respect to outlet number -> return what outletNumber is expected to return
295 | return pdObject.outputs.get(outletNumber);
296 | }
297 | else if(pdObject.name.equalsIgnoreCase("MINUS")){
298 | //Collect objects coming into inlet 0
299 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
300 | Pair inlet0=null;
301 | if(comingSourcesToInlet0 !=null){
302 | //TODO actually -> taking only the first object coming into inlet 0
303 | // expected -> should take all objects coming into inlet 0
304 | inlet0 = comingSourcesToInlet0.get(0);
305 | }
306 |
307 | String coming_into_inlet0 = null;
308 | if(inlet0 != null){
309 | //Create the object coming into current PDObject and get its output
310 | coming_into_inlet0 = createObject_setOutput(inlet0.objectNumber, inlet0.outletNumber);
311 | }
312 |
313 | //Collect objects coming into inlet 1
314 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
315 | Pair inlet1=null;
316 | if(comingSourcesToInlet1 !=null){
317 | //TODO actually -> taking only the first object coming into inlet 0
318 | // expected -> should take all objects coming into inlet 0
319 | inlet1 = comingSourcesToInlet1.get(0);
320 | }
321 |
322 |
323 | String coming_into_inlet1 = null;
324 | if(inlet1 != null){
325 | //Create the object coming into current PDObject and get its output
326 | coming_into_inlet1 = createObject_setOutput(inlet1.objectNumber, inlet1.outletNumber);
327 | pdObject.defaultVal = coming_into_inlet1; // this expression violates the cold inlet mechanism
328 | }
329 |
330 | String output_on_outlet0 = String.format("(%s-%s)",coming_into_inlet0,pdObject.defaultVal);
331 | pdObject.outputs.put(outletNumber, output_on_outlet0);
332 | pdObject.outputTypes.put(outletNumber, "float");
333 |
334 | //return with respect to outlet number -> return what outletNumber is expected to return
335 | return output_on_outlet0;
336 | }
337 | else if(pdObject.name.equalsIgnoreCase("MULTIPLY")){
338 | //Collect objects coming into inlet 0
339 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
340 | String inlet0="(";
341 | if(comingSourcesToInlet0 !=null){
342 | for (int i = 0; i < comingSourcesToInlet0.size(); i++) {
343 | Pair tmp = comingSourcesToInlet0.get(i);
344 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber) + "+";
345 | }
346 | inlet0 = inlet0.substring(0, inlet0.length()-1);
347 | inlet0 += ")";
348 | }
349 |
350 | //Collect objects coming into inlet 1
351 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
352 | String inlet1="(";
353 | if(comingSourcesToInlet1 !=null){
354 | for(int i=0; i< comingSourcesToInlet1.size(); i++){
355 | Pair obj = comingSourcesToInlet1.get(i);
356 | inlet1 += createObject_setOutput(obj.objectNumber, obj.outletNumber) + "+";
357 | }
358 | inlet1 = inlet1.substring(0, inlet1.length()-1);
359 | inlet1 += ")";
360 | pdObject.defaultVal = inlet1;
361 | }
362 |
363 |
364 | String output_on_outlet0 = String.format("(%s*%s)",inlet0,pdObject.defaultVal);
365 | pdObject.outputs.put(outletNumber, output_on_outlet0);
366 | pdObject.outputTypes.put(outletNumber, "float");
367 | //return with respect to outlet number -> return what outletNumber is expected to return
368 | return pdObject.outputs.get(outletNumber);
369 | }
370 | else if(pdObject.name.equalsIgnoreCase("DIVIDE")){
371 | //Collect objects coming into inlet 0
372 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
373 | Pair inlet0=null;
374 | if(comingSourcesToInlet0 !=null){
375 | //TODO actually -> taking only the first object coming into inlet 0
376 | // expected -> should take all objects coming into inlet 0
377 | inlet0 = comingSourcesToInlet0.get(0);
378 | }
379 |
380 | String coming_into_inlet0 = null;
381 | if(inlet0 != null){
382 | //Create the object coming into current PDObject and get its output
383 | coming_into_inlet0 = createObject_setOutput(inlet0.objectNumber, inlet0.outletNumber);
384 | }
385 |
386 | //Collect objects coming into inlet 1
387 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
388 | Pair inlet1=null;
389 | if(comingSourcesToInlet1 !=null){
390 | //TODO actually -> taking only the first object coming into inlet 0
391 | // expected -> should take all objects coming into inlet 0
392 | inlet1 = comingSourcesToInlet1.get(0);
393 | }
394 |
395 |
396 | String coming_into_inlet1 = null;
397 | if(inlet1 != null){
398 | //Create the object coming into current PDObject and get its output
399 | coming_into_inlet1 = createObject_setOutput(inlet1.objectNumber, inlet1.outletNumber);
400 | pdObject.defaultVal = coming_into_inlet1; // this expression violates the cold inlet mechanism
401 | }
402 |
403 | String output_on_outlet0 = String.format("(%s/%s)",coming_into_inlet0,pdObject.defaultVal);
404 | pdObject.outputs.put(outletNumber, output_on_outlet0);
405 |
406 | //return with respect to outlet number -> return what outletNumber is expected to return
407 | return output_on_outlet0;
408 | }
409 | else if(pdObject.name.equalsIgnoreCase("'pow'")){
410 | //Collect objects coming into inlet 0
411 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
412 | Pair inlet0=null;
413 | if(comingSourcesToInlet0 !=null){
414 | //TODO actually -> taking only the first object coming into inlet 0
415 | // expected -> should take all objects coming into inlet 0
416 | inlet0 = comingSourcesToInlet0.get(0);
417 | }
418 |
419 | String coming_into_inlet0 = null;
420 | if(inlet0 != null){
421 | //Create the object coming into current PDObject and get its output
422 | coming_into_inlet0 = createObject_setOutput(inlet0.objectNumber, inlet0.outletNumber);
423 | }
424 |
425 | //Collect objects coming into inlet 1
426 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
427 | Pair inlet1=null;
428 | if(comingSourcesToInlet1 !=null){
429 | //TODO actually -> taking only the first object coming into inlet 0
430 | // expected -> should take all objects coming into inlet 0
431 | inlet1 = comingSourcesToInlet1.get(0);
432 | }
433 |
434 |
435 | String coming_into_inlet1 = null;
436 | if(inlet1 != null){
437 | //Create the object coming into current PDObject and get its output
438 | coming_into_inlet1 = createObject_setOutput(inlet1.objectNumber, inlet1.outletNumber);
439 | pdObject.defaultVal = coming_into_inlet1; // this expression violates the cold inlet mechanism
440 | }
441 |
442 | String output_on_outlet0 = String.format("(%s^%s)",coming_into_inlet0,pdObject.defaultVal);
443 | pdObject.outputs.put(outletNumber, output_on_outlet0);
444 |
445 | //return with respect to outlet number -> return what outletNumber is expected to return
446 | return output_on_outlet0;
447 | }
448 | else if(pdObject.name.equalsIgnoreCase("'msg'")){
449 | //Collect objects coming into inlet 0
450 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
451 | String inlet0="";
452 | if(comingSourcesToInlet0 !=null){
453 | //TODO actually -> taking only the first object coming into inlet 0
454 | // expected -> should take all objects coming into inlet 0
455 | Pair tmp = comingSourcesToInlet0.get(0);
456 | inlet0 = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
457 | }
458 |
459 |
460 | String output_on_outlet0 = "";
461 | //Assume BANG as coming message
462 | if(!inlet0.equalsIgnoreCase("")){
463 | output_on_outlet0 = String.format("(%s*%s)",inlet0,pdObject.args.get(0));
464 | }
465 | //if there is no input then implement message object directly
466 | else{
467 | this.definitions.put(objectNumber, String.format("checkbox%s=checkbox(\"%s\");\n"
468 | + "msg%s = checkbox%s * %s;", objectNumber,pdObject.args.get(0),objectNumber,objectNumber,pdObject.args.get(0)));
469 | output_on_outlet0 = String.format("(msg%s)",objectNumber);
470 | }
471 |
472 | pdObject.outputs.put(outletNumber, output_on_outlet0);
473 | pdObject.outputTypes.put(outletNumber, "float");
474 | //return with respect to outlet number -> return what outletNumber is expected to return
475 | return output_on_outlet0;
476 | }
477 | else if(pdObject.name.equalsIgnoreCase("'trigger'")){
478 | //outputs
479 | List outputs = new ArrayList(pdObject.args.size());
480 | //System.out.println("trigger");
481 |
482 | Boolean bang = false;
483 | for(int i=0; i comingSources = pdObject.objectInlets.get(0);
493 | String inlet_0="";
494 | if(comingSources !=null){
495 | //TODO actually -> taking only the first object coming into inlet 0
496 | // expected -> should take all objects coming into inlet 0
497 | Pair tmp = comingSources.get(0);
498 | inlet_0 = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
499 | outputs.set(i, String.format("%s",inlet_0));
500 | pdObject.outputTypes.put(i, "float");
501 | }
502 | }
503 | }
504 | if(bang==true){
505 | this.definitions.put(objectNumber,String.format("t%sbang = checkbox(\"t%sbang\");", objectNumber,objectNumber));
506 | }
507 |
508 | for (int i = 0; i < outputs.size(); i++) {
509 | pdObject.outputs.put(i, outputs.get(i));
510 | }
511 |
512 | //return with respect to outlet number -> return what outletNumber is expected to return
513 | return pdObject.outputs.get(outletNumber);
514 | }
515 | else if(pdObject.name.equalsIgnoreCase("'bng'")){
516 | //Collect objects coming into inlet 0
517 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
518 | String inlet0="";
519 | this.definitions.put(objectNumber,String.format("bang%s = checkbox(\"bang%s\");", objectNumber,objectNumber));
520 | if(comingSourcesToInlet0 !=null){
521 | //TODO actually -> taking only the first object coming into inlet 0
522 | // expected -> should take all objects coming into inlet 0
523 | Pair tmp = comingSourcesToInlet0.get(0);
524 | inlet0 = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
525 | }
526 | String output_on_outlet0 = String.format("bang%s", objectNumber);
527 | return output_on_outlet0;
528 |
529 | }
530 | else if(pdObject.name.equalsIgnoreCase("'fcounter'")){
531 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
532 | String inlet0="";
533 | if(comingSourcesToInlet0 !=null){
534 | Pair tmp = comingSourcesToInlet0.get(0);
535 | String comingObjOutput = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
536 | inlet0 += comingObjOutput;
537 | }
538 | this.definitions.put(objectNumber,String.format("fcounter%s(nn) = int((+(1)~_)/((nn/1000)*SR));",objectNumber));
539 | String output_on_outlet0 = String.format("fcounter%s(%s)",objectNumber,inlet0);
540 | pdObject.outputs.put(outletNumber, output_on_outlet0);
541 | pdObject.outputTypes.put(0, "float");
542 | return output_on_outlet0;
543 | }
544 | else if(pdObject.name.equalsIgnoreCase("'mod'")){
545 | //Collect objects coming into inlet 0
546 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
547 | String inlet0="";
548 | if(comingSourcesToInlet0 !=null){
549 | Pair tmp = comingSourcesToInlet0.get(0);
550 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
551 | }
552 |
553 | //Collect objects coming into inlet 1
554 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
555 | String inlet1=null;
556 | if(comingSourcesToInlet1 !=null){
557 | Pair tmp =comingSourcesToInlet1.get(0);
558 | inlet1 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
559 | pdObject.defaultVal = inlet1;
560 | }
561 |
562 | String output_on_outlet0 = String.format("(%s%s%s)",inlet0,"%",pdObject.defaultVal);
563 | pdObject.outputs.put(outletNumber, output_on_outlet0);
564 | pdObject.outputTypes.put(0, "float");
565 | //return with respect to outlet number -> return what outletNumber is expected to return
566 | return output_on_outlet0;
567 | }
568 | else if(pdObject.name.equalsIgnoreCase("'sig~'")){
569 | //Collect objects coming into inlet 0
570 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
571 | String inlet0="";
572 | if(comingSourcesToInlet0 !=null){
573 | Pair tmp = comingSourcesToInlet0.get(0);
574 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
575 | }
576 |
577 | //Collect objects coming into inlet 1
578 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
579 | String inlet1="";
580 | if(comingSourcesToInlet1 !=null){
581 | Pair obj = comingSourcesToInlet1.get(0);
582 | inlet1 += createObject_setOutput(obj.objectNumber, obj.outletNumber);
583 | pdObject.defaultVal = inlet1;
584 | }
585 | String output_on_outlet0;
586 | if(inlet0.equalsIgnoreCase("")){
587 | output_on_outlet0 = String.format("%s",pdObject.defaultVal);
588 | }
589 | else{
590 | output_on_outlet0 = String.format("%s",inlet0);
591 | }
592 |
593 | pdObject.outputs.put(outletNumber, output_on_outlet0);
594 | pdObject.outputTypes.put(outletNumber, "float");
595 | //return with respect to outlet number -> return what outletNumber is expected to return
596 | return pdObject.outputs.get(outletNumber);
597 | }
598 | else if(pdObject.name.equalsIgnoreCase("'clip~'")){
599 | //Collect objects coming into inlet 0
600 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
601 | String inlet0="(";
602 | if(comingSourcesToInlet0 !=null){
603 | for(int i=0; i%s ,%s ,s) );",objectNumber,pdObject.args.get(0),pdObject.args.get(0),
612 | pdObject.args.get(1),pdObject.args.get(1)));
613 |
614 |
615 | String output_on_outlet0;
616 | output_on_outlet0 = String.format("clip%s(%s)",objectNumber,inlet0);
617 |
618 |
619 | pdObject.outputs.put(outletNumber, output_on_outlet0);
620 | pdObject.outputTypes.put(outletNumber, "float");
621 | //return with respect to outlet number -> return what outletNumber is expected to return
622 | return pdObject.outputs.get(outletNumber);
623 | }
624 | else if(pdObject.name.equalsIgnoreCase("'max~'")){
625 | //Collect objects coming into inlet 0
626 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
627 | String inlet0="(";
628 | if(comingSourcesToInlet0 !=null){
629 | for(int i=0; i return what outletNumber is expected to return
647 | return pdObject.outputs.get(outletNumber);
648 | }
649 | else if(pdObject.name.equalsIgnoreCase("'min~'")){
650 | //Collect objects coming into inlet 0
651 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
652 | String inlet0="(";
653 | if(comingSourcesToInlet0 !=null){
654 | for(int i=0; i (%s), (%s) , s );",objectNumber,pdObject.defaultVal,pdObject.defaultVal));
663 |
664 |
665 | String output_on_outlet0;
666 | output_on_outlet0 = String.format("min%s(%s)",objectNumber,inlet0);
667 |
668 |
669 | pdObject.outputs.put(outletNumber, output_on_outlet0);
670 | pdObject.outputTypes.put(outletNumber, "float");
671 | //return with respect to outlet number -> return what outletNumber is expected to return
672 | return pdObject.outputs.get(outletNumber);
673 | }
674 | else if(pdObject.name.equalsIgnoreCase("'bp~'")){
675 | //Collect objects coming into inlet 0
676 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
677 | String inlet0="";
678 | if(comingSourcesToInlet0 !=null){
679 | Pair tmp = comingSourcesToInlet0.get(0);
680 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
681 | }
682 |
683 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
684 | String inlet1="";
685 | if(comingSourcesToInlet1 !=null){
686 | Pair tmp = comingSourcesToInlet1.get(0);
687 | inlet1 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
688 | }
689 | List comingSourcesToInlet2 = pdObject.objectInlets.get(2);
690 | String inlet2="";
691 | if(comingSourcesToInlet2 !=null){
692 | Pair tmp = comingSourcesToInlet2.get(0);
693 | inlet2 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
694 | }
695 | String freq=pdObject.args.get(0);
696 | if(inlet1 != ""){
697 | freq = inlet1;
698 | }
699 | String Q=pdObject.args.get(1);
700 | if(inlet2 != ""){
701 | Q = inlet2;
702 | }
703 |
704 | imports.add("import(\"effect.lib\");");
705 | imports.add("import(\"filter.lib\");");
706 | //this.definitions.put(objectNumber, String.format("resonbp%s=%s:moog_vcf_2bn((%s/10),%s):*(70);", objectNumber,inlet0,Q,freq));
707 | this.definitions.put(objectNumber, String.format("resonbp%s=%s:resonbp(%s:smooth(0.999),%s:smooth(0.999),%s);", objectNumber,inlet0,freq,Q,"1"));
708 | String output_on_outlet0;
709 | output_on_outlet0 = String.format("resonbp%s",objectNumber);
710 |
711 |
712 | pdObject.outputs.put(outletNumber, output_on_outlet0);
713 | pdObject.outputTypes.put(outletNumber, "float");
714 | //return with respect to outlet number -> return what outletNumber is expected to return
715 | return pdObject.outputs.get(outletNumber);
716 | }
717 | else if(pdObject.name.equalsIgnoreCase("'hip~'")){
718 | //Collect objects coming into inlet 0
719 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
720 | String inlet0="(";
721 | if(comingSourcesToInlet0 !=null){
722 | for(int i=0; i return what outletNumber is expected to return
739 | return pdObject.outputs.get(outletNumber);
740 | }
741 | else if(pdObject.name.equalsIgnoreCase("'lop~'")){
742 | //Collect objects coming into inlet 0
743 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
744 | String inlet0="(";
745 | if(comingSourcesToInlet0 !=null){
746 | for(int i=0; i return what outletNumber is expected to return
762 | return pdObject.outputs.get(outletNumber);
763 | }
764 | else if(pdObject.name.equalsIgnoreCase("'>'")){
765 | //Collect objects coming into inlet 0
766 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
767 | String inlet0="";
768 | if(comingSourcesToInlet0 !=null){
769 | Pair tmp = comingSourcesToInlet0.get(0);
770 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
771 | }
772 |
773 | //Collect objects coming into inlet 1
774 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
775 | String inlet1=null;
776 | if(comingSourcesToInlet1 !=null){
777 | Pair tmp =comingSourcesToInlet1.get(0);
778 | inlet1 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
779 | pdObject.defaultVal = inlet1;
780 | }
781 |
782 | String output_on_outlet0 = String.format("(%s>%s)",inlet0,pdObject.defaultVal);
783 | pdObject.outputs.put(outletNumber, output_on_outlet0);
784 | pdObject.outputTypes.put(0, "float");
785 | //return with respect to outlet number -> return what outletNumber is expected to return
786 | return output_on_outlet0;
787 | }
788 | else if(pdObject.name.equalsIgnoreCase("'<'")){
789 | //Collect objects coming into inlet 0
790 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
791 | String inlet0="";
792 | if(comingSourcesToInlet0 !=null){
793 | Pair tmp = comingSourcesToInlet0.get(0);
794 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
795 | }
796 |
797 | //Collect objects coming into inlet 1
798 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
799 | String inlet1=null;
800 | if(comingSourcesToInlet1 !=null){
801 | Pair tmp =comingSourcesToInlet1.get(0);
802 | inlet1 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
803 | pdObject.defaultVal = inlet1;
804 | }
805 |
806 | String output_on_outlet0 = String.format("(%s<%s)",inlet0,pdObject.defaultVal);
807 | pdObject.outputs.put(outletNumber, output_on_outlet0);
808 | pdObject.outputTypes.put(0, "float");
809 | //return with respect to outlet number -> return what outletNumber is expected to return
810 | return output_on_outlet0;
811 | }
812 | else if(pdObject.name.equalsIgnoreCase("'=='")){
813 | //Collect objects coming into inlet 0
814 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
815 | String inlet0="";
816 | if(comingSourcesToInlet0 !=null){
817 | Pair tmp = comingSourcesToInlet0.get(0);
818 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
819 | }
820 |
821 | //Collect objects coming into inlet 1
822 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
823 | String inlet1=null;
824 | if(comingSourcesToInlet1 !=null){
825 | Pair tmp =comingSourcesToInlet1.get(0);
826 | inlet1 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
827 | pdObject.defaultVal = inlet1;
828 | }
829 |
830 | String output_on_outlet0 = String.format("(%s==%s)",inlet0,pdObject.defaultVal);
831 | pdObject.outputs.put(outletNumber, output_on_outlet0);
832 | pdObject.outputTypes.put(0, "float");
833 | //return with respect to outlet number -> return what outletNumber is expected to return
834 | return output_on_outlet0;
835 | }
836 | else if(pdObject.name.equalsIgnoreCase("'metro'")){
837 | //Collect objects coming into inlet 0
838 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
839 | String inlet0="";
840 | if(comingSourcesToInlet0 !=null){
841 | Pair pair = comingSourcesToInlet0.get(0);
842 | inlet0 += createObject_setOutput(pair.objectNumber,pair.outletNumber);
843 | }
844 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
845 | String inlet1="";
846 | if(comingSourcesToInlet1 !=null){
847 | Pair pair = comingSourcesToInlet1.get(0);
848 | inlet1 += createObject_setOutput(pair.objectNumber,pair.outletNumber);
849 | }
850 | imports.add("import(\"filter.lib\");");
851 | imports.add("import(\"music.lib\");");
852 | this.definitions.put(objectNumber,String.format("metro%s(toggle,t)=(((+(1)~_)%int(SR*t/1000))==0)*toggle",objectNumber));
853 |
854 | String output_on_outlet0;
855 | output_on_outlet0 = String.format("metro%s(%s,%s)",objectNumber,inlet0,inlet1);
856 |
857 |
858 | pdObject.outputs.put(outletNumber, output_on_outlet0);
859 | pdObject.outputTypes.put(outletNumber, "bang");
860 | //return with respect to outlet number -> return what outletNumber is expected to return
861 | return pdObject.outputs.get(outletNumber);
862 | }
863 | else if(pdObject.name.equalsIgnoreCase("'line~'")){
864 | //Collect objects coming into inlet 0
865 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
866 | String inlet0="";
867 | if(comingSourcesToInlet0 !=null){
868 | Pair tmp = comingSourcesToInlet0.get(0);
869 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
870 | }
871 | imports.add("import(\"math.lib\");");
872 | this.definitions.put(objectNumber,String.format("clip%s(s) = if (s < (%s), (%s) , if ( s>%s ,%s ,s) );",objectNumber,pdObject.args.get(0),pdObject.args.get(0),
873 | pdObject.args.get(1),pdObject.args.get(1)));
874 |
875 |
876 | String output_on_outlet0;
877 | output_on_outlet0 = String.format("clip%s(%s)",objectNumber,inlet0);
878 |
879 |
880 | pdObject.outputs.put(outletNumber, output_on_outlet0);
881 | pdObject.outputTypes.put(outletNumber, "float");
882 | //return with respect to outlet number -> return what outletNumber is expected to return
883 | return pdObject.outputs.get(outletNumber);
884 | }
885 | else if(pdObject.name.equalsIgnoreCase("'unpack'")){
886 | //Collect objects coming into inlet 0
887 |
888 | PDObject msgObject;
889 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
890 | String inlet0="";
891 | if(comingSourcesToInlet0 !=null){
892 | for (int i = 0; i < comingSourcesToInlet0.size(); i++) {
893 | Pair tmp = comingSourcesToInlet0.get(i);
894 | //inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
895 | msgObject = pdObjects.get(tmp.objectNumber);
896 | String display = "";
897 |
898 | String output_on_outlet;
899 | output_on_outlet = String.format("(checkbox%s*%s)",tmp.objectNumber,msgObject.args.get(outletNumber));
900 | String tmpOut = pdObject.outputs.get(outletNumber);
901 | if(tmpOut !=null){
902 | //tmpOut+= "+" + output_on_outlet;
903 | }
904 | else{
905 | tmpOut = output_on_outlet;
906 | }
907 |
908 | pdObject.outputs.put(outletNumber, tmpOut);
909 | pdObject.outputTypes.put(outletNumber, "float");
910 | for (int j = 0; j < msgObject.args.size(); j++) {
911 | display += msgObject.args.get(j) + " ";
912 | }
913 |
914 |
915 | display = display.substring(0, display.length()-1);
916 | this.definitions.put(tmp.objectNumber, String.format("checkbox%s=checkbox(\"%s\");\n", tmp.objectNumber,display));
917 | }
918 |
919 |
920 | }
921 | //return with respect to outlet number -> return what outletNumber is expected to return
922 | return pdObject.outputs.get(outletNumber);
923 | }
924 | else if(pdObject.name.equalsIgnoreCase("'phasor~'")){
925 | //TODO Implement inlet1
926 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
927 | String inlet0="";
928 | if(comingSourcesToInlet0 !=null){
929 | for (int i = 0; i < comingSourcesToInlet0.size(); i++) {
930 | Pair tmp = comingSourcesToInlet0.get(i);
931 | inlet0 += createObject_setOutput(tmp.objectNumber, tmp.outletNumber) + "+";
932 | }
933 | inlet0 = inlet0.substring(0, inlet0.length()-1);
934 | pdObject.defaultVal = inlet0;
935 | }
936 | this.definitions.put(objectNumber, "phs(f) = +(1)~_ :%(44100/f): /(44100/f);\n");
937 | String output_on_outlet0 = String.format("phs(%s)", pdObject.defaultVal);
938 |
939 | pdObject.outputs.put(outletNumber,output_on_outlet0);
940 | pdObject.outputTypes.put(outletNumber, "float");
941 |
942 | //this.definitions.put(objectNumber, String.format("sawtooth%s=sawtooth(%s);", objectNumber,pdObject.defaultVal));
943 | return output_on_outlet0;
944 | }
945 | else if(pdObject.name.equalsIgnoreCase("'cos~'")){
946 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
947 | String inlet0="";
948 | if(comingSourcesToInlet0 !=null){
949 | Pair tmp = comingSourcesToInlet0.get(0);
950 | String comingObjOutput = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
951 | inlet0 += comingObjOutput;
952 | }
953 |
954 | String output_on_outlet0 = String.format("cos(2*PI*%s)",inlet0);
955 | pdObject.outputs.put(outletNumber, output_on_outlet0);
956 | pdObject.outputTypes.put(0, "float");
957 | return output_on_outlet0;
958 | }
959 |
960 | else if(pdObject.name.equalsIgnoreCase("'noise~'")){
961 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
962 | String inlet0="";
963 | if(comingSourcesToInlet0 !=null){
964 | Pair tmp = comingSourcesToInlet0.get(0);
965 | String comingObjOutput = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
966 | inlet0 += comingObjOutput;
967 | }
968 |
969 | String output_on_outlet0 = String.format("noise",inlet0);
970 | pdObject.outputs.put(outletNumber, output_on_outlet0);
971 | pdObject.outputTypes.put(0, "float");
972 | return output_on_outlet0;
973 | }
974 | else if(pdObject.name.equalsIgnoreCase("'vcf~'")){
975 | List comingSourcesToInlet0 = pdObject.objectInlets.get(0);
976 | String inlet0="";
977 | if(comingSourcesToInlet0 !=null){
978 | Pair tmp = comingSourcesToInlet0.get(0);
979 | String comingObjOutput = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
980 | inlet0 += comingObjOutput;
981 | }
982 |
983 | List comingSourcesToInlet1 = pdObject.objectInlets.get(1);
984 | String inlet1=pdObject.args.get(0);
985 | if(comingSourcesToInlet1 !=null){
986 | Pair tmp = comingSourcesToInlet1.get(0);
987 | String comingObjOutput = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
988 | inlet1 = comingObjOutput;
989 | }
990 |
991 | List comingSourcesToInlet2 = pdObject.objectInlets.get(2);
992 | String inlet2=pdObject.args.get(1);
993 | if(comingSourcesToInlet2 !=null){
994 | Pair tmp = comingSourcesToInlet2.get(0);
995 | String comingObjOutput = createObject_setOutput(tmp.objectNumber, tmp.outletNumber);
996 | inlet2 = comingObjOutput;
997 | }
998 | //this.definitions.put(objectNumber, "onepole(p) = *(1.0-(p)) : + ~ *(p);\n" +
999 | //"moogvcf(mk,p) = (+ : onepole(p) : onepole(p) : onepole(p) : onepole(p)) ~ *(mk);\n" +
1000 | //"mypole(fr) = 1.0-fr*2.0*PI/SR;\n");
1001 |
1002 |
1003 |
1004 | // : *(20: component(\"music.lib\").db2linear: smooth(0.999))
1005 | String output_on_outlet0 = String.format("(%s:moog_vcf_2b((%s/10),%s)):*(70)",inlet0,inlet2,inlet1);
1006 | pdObject.outputs.put(outletNumber, output_on_outlet0);
1007 | pdObject.outputTypes.put(0, "float");
1008 | return output_on_outlet0;
1009 | }
1010 | else{
1011 | return "UIO";
1012 | }
1013 |
1014 |
1015 | }
1016 |
1017 | @Override
1018 | public void enterRow(RowsParser.RowContext ctx) {
1019 | if(ctx.type.getType() == RowsParser.OBJ){
1020 |
1021 | if(ctx.name.getType() == RowsParser.OSC){
1022 | imports.add("import(\"music.lib\");");
1023 | String freq = "440";
1024 | if(ctx.expr(0) != null){
1025 | freq = ctx.expr(0).getText();
1026 | }
1027 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.OSC],freq));
1028 | objNo++;
1029 | }
1030 |
1031 | else if(ctx.name.getType() == RowsParser.DAC){
1032 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.DAC]));
1033 | dacObjectNumber = objNo;
1034 | objNo++;
1035 | }
1036 |
1037 | else if(ctx.name.getType() == RowsParser.PLUS){
1038 | String defaultVal = "0";
1039 | if(ctx.INT(2) != null){
1040 | defaultVal = ctx.INT(2).getText();
1041 | }
1042 | else if(ctx.FLOAT(0) != null){
1043 | defaultVal=ctx.FLOAT(0).getText();
1044 | }
1045 |
1046 |
1047 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.PLUS],defaultVal));
1048 | objNo++;
1049 | }
1050 |
1051 | else if(ctx.name.getType() == RowsParser.MINUS){
1052 | String defaultVal = "0";
1053 | if(ctx.INT(2) != null){
1054 | defaultVal = ctx.INT(2).getText();
1055 | }
1056 | else if(ctx.FLOAT(0) != null){
1057 | defaultVal=ctx.FLOAT(0).getText();
1058 | }
1059 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.MINUS],defaultVal));
1060 | objNo++;
1061 | }
1062 | else if(ctx.name.getType() == RowsParser.MULTIPLY){
1063 | String defaultVal = "0";
1064 | if(ctx.INT(2) != null){
1065 | defaultVal = ctx.INT(2).getText();
1066 | }
1067 | else if(ctx.FLOAT(0) != null){
1068 | defaultVal=ctx.FLOAT(0).getText();
1069 | }
1070 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.MULTIPLY],defaultVal));
1071 | objNo++;
1072 | }
1073 | else if(ctx.name.getType() == RowsParser.DIVIDE){
1074 | String defaultVal = "0";
1075 | if(ctx.INT(2) != null){
1076 | defaultVal = ctx.INT(2).getText();
1077 | }
1078 | else if(ctx.FLOAT(0) != null){
1079 | defaultVal=ctx.FLOAT(0).getText();
1080 | }
1081 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.DIVIDE],defaultVal));
1082 | objNo++;
1083 | }
1084 | else if(ctx.name.getType() == RowsParser.POW){
1085 | String defaultVal = "0";
1086 | if(ctx.INT(2) != null){
1087 | defaultVal = ctx.INT(2).getText();
1088 | }
1089 | else if(ctx.FLOAT(0) != null){
1090 | defaultVal=ctx.FLOAT(0).getText();
1091 | }
1092 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.POW],defaultVal));
1093 | objNo++;
1094 | }
1095 | else if(ctx.name.getType() == RowsParser.TRIGGER){
1096 | List args = new ArrayList();
1097 | //ignore canvas positions and get the first item in the args
1098 | for(int i=5; i args = new ArrayList();
1136 | args.add(ctx.expr(0).getText());
1137 | args.add(ctx.expr(1).getText());
1138 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.CLIP],args));
1139 | objNo++;
1140 | }
1141 | else if(ctx.name.getType() == RowsParser.BP){
1142 | List args = new ArrayList();
1143 | args.add(ctx.expr(0).getText());
1144 | args.add(ctx.expr(1).getText());
1145 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.BP],args));
1146 | objNo++;
1147 | }
1148 | else if(ctx.name.getType() == RowsParser.HIP){
1149 | String defaultVal = "0";
1150 | if(ctx.expr(0) != null){
1151 | defaultVal = ctx.expr(0).getText();
1152 | }
1153 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.HIP],defaultVal));
1154 | objNo++;
1155 | }
1156 | else if(ctx.name.getType() == RowsParser.LOP){
1157 | String defaultVal = "0";
1158 | if(ctx.expr(0) != null){
1159 | defaultVal = ctx.expr(0).getText();
1160 | }
1161 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.LOP],defaultVal));
1162 | objNo++;
1163 | }
1164 | else if(ctx.name.getType() == RowsParser.GT){
1165 | String defaultVal = "0";
1166 | if(ctx.expr(0) != null){
1167 | defaultVal = ctx.expr(0).getText();
1168 | }
1169 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.GT],defaultVal));
1170 | objNo++;
1171 | }
1172 | else if(ctx.name.getType() == RowsParser.MAX){
1173 | String defaultVal = "0";
1174 | if(ctx.expr(0) != null){
1175 | defaultVal = ctx.expr(0).getText();
1176 | }
1177 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.MAX],defaultVal));
1178 | objNo++;
1179 | }
1180 | else if(ctx.name.getType() == RowsParser.MIN){
1181 | String defaultVal = "0";
1182 | if(ctx.expr(0) != null){
1183 | defaultVal = ctx.expr(0).getText();
1184 | }
1185 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.MIN],defaultVal));
1186 | objNo++;
1187 | }
1188 | else if(ctx.name.getType() == RowsParser.LT){
1189 | String defaultVal = "0";
1190 | if(ctx.expr(0) != null){
1191 | defaultVal = ctx.expr(0).getText();
1192 | }
1193 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.LT],defaultVal));
1194 | objNo++;
1195 | }
1196 | else if(ctx.name.getType() == RowsParser.EQ){
1197 | String defaultVal = "0";
1198 | if(ctx.expr(0) != null){
1199 | defaultVal = ctx.expr(0).getText();
1200 | }
1201 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.EQ],defaultVal));
1202 | objNo++;
1203 | }
1204 | else if(ctx.name.getType() == RowsParser.METRO){
1205 | String defaultVal = "1000";
1206 | if(ctx.expr(0) != null){
1207 | defaultVal = ctx.expr(0).getText();
1208 | }
1209 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.METRO],defaultVal));
1210 | objNo++;
1211 | }
1212 | else if(ctx.name.getType() == RowsParser.LINE){
1213 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.LINE]));
1214 | objNo++;
1215 | }
1216 | else if(ctx.name.getType() == RowsParser.UNPACK){
1217 | List args = new ArrayList();
1218 | //ignore canvas positions and get the first item in the args
1219 | for(int i=5; i args = new ArrayList();
1249 | args.add(ctx.expr(0).getText());
1250 | args.add(ctx.expr(1).getText());
1251 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.VCF],args));
1252 | objNo++;
1253 | }
1254 | else if(ctx.name.getType() == RowsParser.NOISE){
1255 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.NOISE]));
1256 | objNo++;
1257 | imports.add("import(\"music.lib\");");
1258 | }
1259 | else{
1260 | System.out.println("ERROR: There is an object which is not inserted in pdObjects."); ;
1261 | }
1262 | }
1263 |
1264 | else if(ctx.type.getType() == RowsParser.FLOATATOM){
1265 | List args = new ArrayList();
1266 | args.add(ctx.expr(3).getText());
1267 | args.add(ctx.expr(4).getText());
1268 | pdObjects.put(objNo, new PDObject(parser.getTokenNames()[RowsParser.FLOATATOM],args));
1269 | objNo++;
1270 | }
1271 |
1272 | else if(ctx.type.getType() == RowsParser.CONNECT){
1273 | int srcObjNumber = Integer.parseInt(ctx.INT(0).getText());
1274 | int srcOutletNumber = Integer.parseInt(ctx.INT(1).getText());
1275 | int sinkObjNumber = Integer.parseInt(ctx.INT(2).getText());
1276 | int sinkInletNumber = Integer.parseInt(ctx.INT(3).getText());
1277 |
1278 | PDObject sinkObj = pdObjects.get(sinkObjNumber);
1279 | List comingObjects = sinkObj.objectInlets.get(sinkInletNumber);
1280 | if(comingObjects==null){
1281 | comingObjects = new ArrayList();
1282 | }
1283 | comingObjects.add(new Pair(srcObjNumber, srcOutletNumber));
1284 | sinkObj.objectInlets.put(sinkInletNumber, comingObjects);
1285 | }
1286 | else if(ctx.type.getType() == RowsParser.MSG){
1287 | List args = new ArrayList();
1288 | //ignore canvas positions and get the first item in the message
1289 | for(int i=4; i