File: int-or-float-help.pd

package info (click to toggle)
pd-rtclib 4.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,572 kB
  • sloc: makefile: 13; sh: 1
file content (112 lines) | stat: -rw-r--r-- 3,559 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#N canvas 189 177 593 402 10;
#N canvas 375 365 667 396 integer-mode 0;
#X obj 60 130 int-or-float;
#X floatatom 60 61 5 0 0 0 - - -;
#X floatatom 60 156 5 0 0 0 - - -;
#X obj 60 84 * 0.1;
#X floatatom 60 109 5 0 0 0 - - -;
#X text 38 33 no args \, nothing in second inlet;
#X floatatom 314 63 5 0 0 0 - - -;
#X floatatom 314 158 5 0 0 0 - - -;
#X obj 314 86 * 0.1;
#X floatatom 314 111 5 0 0 0 - - -;
#X text 314 33 "i" or "int" as arg;
#X obj 314 132 int-or-float i;
#X floatatom 458 65 5 0 0 0 - - -;
#X floatatom 458 160 5 0 0 0 - - -;
#X obj 458 88 * 0.1;
#X floatatom 458 113 5 0 0 0 - - -;
#X obj 458 134 int-or-float int;
#X obj 66 300 int-or-float;
#X floatatom 66 231 5 0 0 0 - - -;
#X floatatom 66 326 5 0 0 0 - - -;
#X obj 66 254 * 0.1;
#X floatatom 66 279 5 0 0 0 - - -;
#X text 44 203 no args \, whole number in second inlet;
#X msg 145 273 10;
#X obj 145 253 loadbang;
#X text 21 10 INTEGER MODE;
#X connect 0 0 2 0;
#X connect 1 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 0 0;
#X connect 6 0 8 0;
#X connect 8 0 9 0;
#X connect 9 0 11 0;
#X connect 11 0 7 0;
#X connect 12 0 14 0;
#X connect 14 0 15 0;
#X connect 15 0 16 0;
#X connect 16 0 13 0;
#X connect 17 0 19 0;
#X connect 18 0 20 0;
#X connect 20 0 21 0;
#X connect 21 0 17 0;
#X connect 23 0 17 1;
#X connect 24 0 23 0;
#X restore 69 198 pd integer-mode;
#N canvas 375 365 743 459 float-mode 0;
#X obj 60 130 int-or-float;
#X floatatom 60 61 5 0 0 0 - - -;
#X floatatom 60 156 5 0 0 0 - - -;
#X obj 60 84 * 0.1;
#X floatatom 60 109 5 0 0 0 - - -;
#X floatatom 430 64 5 0 0 0 - - -;
#X floatatom 430 159 5 0 0 0 - - -;
#X obj 430 87 * 0.1;
#X floatatom 430 112 5 0 0 0 - - -;
#X floatatom 574 66 5 0 0 0 - - -;
#X floatatom 574 161 5 0 0 0 - - -;
#X obj 574 89 * 0.1;
#X floatatom 574 114 5 0 0 0 - - -;
#X msg 139 107 0.1;
#X obj 139 83 loadbang;
#X text 28 10 FLOAT MODE;
#X text 38 33 no args \, but non-whole number in second inlet.;
#X text 430 34 "f" or "float" as argument:;
#X obj 430 133 int-or-float f;
#X obj 574 135 int-or-float float;
#X text 53 233 IMPORTANT: Arguments override what was sent into second
inlet. This next use case will run in *integer mode*:;
#X floatatom 66 288 5 0 0 0 - - -;
#X floatatom 66 383 5 0 0 0 - - -;
#X obj 66 311 * 0.1;
#X floatatom 66 336 5 0 0 0 - - -;
#X msg 173 336 0.1;
#X obj 173 311 loadbang;
#X obj 66 357 int-or-float int;
#X text 194 361 "int"-arg is stronger!;
#X connect 0 0 2 0;
#X connect 1 0 3 0;
#X connect 3 0 4 0;
#X connect 4 0 0 0;
#X connect 5 0 7 0;
#X connect 7 0 8 0;
#X connect 8 0 18 0;
#X connect 9 0 11 0;
#X connect 11 0 12 0;
#X connect 12 0 19 0;
#X connect 13 0 0 1;
#X connect 14 0 13 0;
#X connect 18 0 6 0;
#X connect 19 0 10 0;
#X connect 21 0 23 0;
#X connect 23 0 24 0;
#X connect 24 0 27 0;
#X connect 25 0 27 1;
#X connect 26 0 25 0;
#X connect 27 0 22 0;
#X restore 68 231 pd float-mode;
#X text 65 118 This abstraction converts incoming numbers to integer
values depending on its argument or numbers sent into its rightmost
inlet. It can operate in two modes: int or float.;
#X obj 69 51 int-or-float;
#X text 185 50 Arguments: "i" \, "int" \, "f" \, "float" (optional)
;
#X text 185 72 All in- and outlets accept or send numbers.;
#X text 15 14 int-or-float: Optionally convert numbers to int.;
#X text 66 272 int-or-float is mainly useful when converting Max patches
to Pd. Max handles floating point numbers differently from integer
values \, but in Pd everything is a float \, so we need to explicitly
tell Pd \, if we want a conversion to integer or not.;
#X text 188 199 Default mode is int.;