On Mon, 2007-01-22 at 12:01 +0000, matthew venn wrote:
So I want a bunch of buttons that do *multiple actions, depending on the current state of the sampler*. So for example I gave:
- in stop mode, if I press the button we go to record/play mode
- in record/play mode, the button closes the loop and stops playback.
I will need a few different states, such as
- playing
- overdubbing
- stopped
- recording
that will be tied to 1 of a few different parallel samplers (probably around 4).
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:
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)
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]).
2.3.2).
i hope, that was not too 'teacherish' ;-)
roman