aboutsummaryrefslogtreecommitdiff
path: root/examples/list_change.tcl
blob: 26190e4086fa37c15ed2054f041db49c6af28f05 (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
package require Tclpd 0.2.3
package require TclpdLib 0.19

proc+ list_change::constructor {self args} {
    # add second inlet (first created by default)
    pd::add_inlet $self list

    # add outlet
    pd::add_outlet $self list

    set @curlist {}
}

proc+ list_change::0_list {self args} {
    # HOT inlet
    if {$args != $@curlist} {
        set @curlist $args
        pd::outlet $self 0 list $@curlist
    }
}

proc+ list_change::0_bang {self} {
    if {$@curlist == {}} return
    pd::outlet $self 0 list $@curlist
}

proc+ list_change::1_list {self args} {
    # COLD inlet
    set @curlist $args
}

pd::class list_change