From ftm
Jump to: navigation, search
 
Line 1: Line 1:
Working with inputs in the ftm.mess object is analogous to the standard Max message object: $1 refers to inlet 1 etc. Lists are also 'spread out', so  
+
Working with inputs in the ftm.mess object is analoguous to the standard Max message object: $1 refers to inlet 1 etc. Lists are also 'spread out', so  
  
 
($1 + $2)
 
($1 + $2)

Revision as of 12:42, 5 August 2010

Working with inputs in the ftm.mess object is analoguous to the standard Max message object: $1 refers to inlet 1 etc. Lists are also 'spread out', so

($1 + $2)

with '1 3' in the left inlet will give you the sum of 1 and 3. Let's say we would like to only let lists of a certain length go through, you need to somehow get the list as a whole. This can be done with $*i, which stops ftm.mess from 'spreading out' the elements of the incoming list over successive inlets.

($*1) will output the input list.

Next, we check for the length and decide whether or not to output:

(if ((llen $*1) == 3) $*1) --> this will NOT work!

In this case, the order in which things get evaluated inside the ftm.mess object, is crucial. The two $*1 statements are independent, in that there is, in this case, no operation that actually modifies the internal variables ($1, $2...). So you can safely ask for the length of the input for use in the if statement and use it again to output if the statement is true. The problem in this case is that the list gets evaluated first and the first two elements are then used as the options for the if statement. So for example

(if 1 $*1) with 4 5 6 as the input will give you 4, whereas (if 0 $*1) with the same input will give you 5

the 6 gets lost in this construction.

So, what if we need to get the list through? We have to make it an object and pass it as a whole. This can be any ftm.object, let's say a tuple:

(if ((llen $*1) == 3) {$*1}) --> this will work, but you end up with a tuple. So finally there are two ways to handle this inside the same object:

I check the output tuples as list checkbox in the ftm.mess inspector II (l (if ((llen $*1) == 3) {$*1}))