aboutsummaryrefslogtreecommitdiff
path: root/doc/pddp/help-value.pd
blob: fb55a0352de2faac5646187a42a3b269b29c2cd9 (plain)
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
#N canvas 1 1 889 657 10;
#X text 62 10 -- nonlocal shared value (named variable);
#X obj 21 10 value;
#X text 17 46 [value] is a container. It holds a global variable numeric
value and can be "polled" at any time with a "bang" message. In other
words \, [value] is a place where numbers can be stored and then accessed
by all active PD windows.;
#X text 16 109 SCOPE;
#X text 18 127 Understanding "scope" is important while developing
programmatic applications. In PD there are three levels of "scope":
;
#X text 29 170 1 Local Scope: all objects \, subroutines \, data \,
and variables which exist within a single patch on a single computer
and do not communicate with other active PD patches.;
#X text 27 226 2 Global Scope: all objects \, subroutines \, data and
variables which exist within single or multiple patches on a single
computer which communicate with other active PD patches.;
#X text 17 354 As a general rule \, all things are considered "local"
in PD and if communication between PD windows is necessary \, then
[send]/[receive] \, or [throw]/[catch] objects are used. Likewise \,
if communication is necessary between many computers running PD \,
then objects such as [netsend]/[netreceive] are used.;
#X text 16 441 The exception to the above rule is [value]. This object
is a container which makes its data known to all [value] objects of
the same name in all active PD windows on a single computer: hence
\, GLOBAL scope.;
#X text 28 288 3 Network (Universal) Scope: all objects \, subroutines
\, data and variables which exist within single or multiple patches
on two or more computers which communicate with other active PD patches
via a network.;
#X text 419 15 To create a [value] object \, a name should be defined
for the variable that it will contain. For example:;
#X obj 422 54 value my_variable;
#X text 419 110 To assign a numeric value to that variable \, a number
box or message can be used \, as follows:;
#X obj 420 190 value my_variable;
#X msg 438 167 42;
#X text 12 523 The [value] object can be abbreviated as follows:;
#X obj 19 550 v;
#X text 48 550 is the same as;
#X obj 142 552 value;
#X obj 384 12 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 384 583 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 417 77 If no name is given \, then the object will communicate
with all other [value] objects with no name.;
#X floatatom 420 214 5 0 0;
#X floatatom 420 147 5 0 0;
#X obj 417 304 value my_variable;
#X floatatom 417 328 5 0 0;
#X obj 417 284 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 464 146 play with me;
#X text 463 166 or click me;
#X text 416 237 Notice that the number is not outputted to the outlet
\; it is merely stored. To retreive the number \, send a "bang" \,
like below:;
#X text 414 354 Now \, to show how global scope works \, click the
sub-patch below and then "bang" the [value] object to retreive the
current number. While you're in the sub-patch \, change the number
and then return to this window and click the above "bang". You'll quickly
see how this variable can be retreived or reset in any active PD window.
;
#N canvas 0 0 452 302 global_values 0;
#X obj 43 127 v my_variable;
#X floatatom 43 149 5 0 0;
#X obj 43 86 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X floatatom 61 104 5 0 0;
#X connect 0 0 1 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X restore 415 442 pd global_values;
#X text 414 474;
#X text 409 490 RELATED OBJECTS;
#N canvas 73 229 452 302 related_objects_from_other_libraries 0;
#X obj 28 37 getenv;
#X text 18 86 These objects are offered in PD only if you have downloaded
and properly installed the appropriate library. These objects may or
may not exist in a single library.;
#X text 17 135 The best places to find information about PD's libraries
is:;
#X text 14 157 www.puredata.org and click on "Downloads" then "Software"
;
#X text 15 173 or;
#X text 16 187 iem.kug.ac.at/pdb/;
#X restore 413 551 pd related_objects_from_other_libraries;
#X obj 408 517 send;
#X obj 441 517 receive;
#X text 492 504 These objects are actually quite different than [value]
but it's important to understand that difference in relation to [value].
;
#X text 252 603 This document was updated for PD version 0.35 test
26 by Dave Sabine as part of a project called pddp proposed by Krzysztof
Czaja to build comprehensive documentation for PD.;
#X connect 13 0 22 0;
#X connect 14 0 13 0;
#X connect 19 0 20 0;
#X connect 23 0 13 0;
#X connect 24 0 25 0;
#X connect 26 0 24 0;