1 |
{ Polyhonic variables are, in contrast to all other variable types, not global |
2 |
variables, but instead they exist separately in each event. Which circumvents |
3 |
the problem that (global) variables may be altered undesiredly if event |
4 |
handlers are called in "parallel". Downside: polyphonic variables need to be |
5 |
allocated as many times as events exist in the system. Thus: one single |
6 |
polyphonic variable takes a lot of memory! Due to this reason, only integer |
7 |
variables are allowed to be declared as polyphonics ATM. } |
8 |
|
9 |
on init |
10 |
declare polyphonic $p |
11 |
end on |
12 |
|
13 |
on note |
14 |
message($p) |
15 |
$p := $p + 1 |
16 |
message($p) |
17 |
$p := $p + 1 |
18 |
message($p) |
19 |
end on |