we need teachers like you! ;) i've been wondering about this: is the f+1 counter solution less expensive than a tgl? or does the toggle only slow down screen redraws? cheers, robbert
Roman Haefeli wrote:
hi matthew again
i attached a small patch, that shows how i would implement the most simple 'state alternator'. if you want to make state switching dependent on other states, it might be helpfull to have a look at the helppatch of [&& ], [|| ], [== ] and such. with these objects, it should be possible to implement the logic you want to achieve.
some random tips, that are important, when doing logic-stuff:
- many objects with two inlets only send a 'result' to the outlet, when
they're triggered by the left ('hot') inlet, whereas, if they get a message at their right ('cold') inlet, only their internal state is changed, but nothing is sent to the outlet. (Section 2.3.3 of the pd-html-manual is more detailed and might be interesting for you)
- you should care about execution order. for example, when one outlet is
connected to two inlets, the order of execution is *not* defined, or in other words: you don't know, which inlet gets the message first. therefore usually a [trigger]-object is inserted in between in order to avoid 'undefinedness' (have a look at the help of [trigger]).
- read the section about the 'depth-first'-principle in pd (section
2.3.2).
i hope, that was not too 'teacherish' ;-)
roman