Digital Music Programming II: intinThis lab demonstrates how to get multiple integer inputs into a Max object. Max enumerates the inputs to an object in an unusual way. The first inlet is handled differently than the other inlets, but you can consider it to be inlet 0. The other inlets are numbered from right to left starting with 1 on the far right.
There are two steps to creating an inlet. First you must create the graphical inlets on the Max object. This is done in the create_object in the program code example below by calling the Max function intin. The program example needs to create 4 additional inputs, since the first input (inlet 0) is implicitly created. intin(mo, 1); intin(mo, 2); intin(mo, 3); intin(mo, 4); Once you have defined inputs with the intin function, you can use the addinx and addint function to associate functions with inlets. Here is how this is done in the main function: addint ((method)Input1); addinx ((method)Input2, 4); addinx ((method)Input3, 3); addinx ((method)Input4, 2); addinx ((method)Input5, 1); The following program will generate an object with 5 inputs. Inside the code, the addinx functions will enumerate the inputs as 0, 4, 3, 2, 1 from left to right, but in the Max environment, the numbers 1, 2, 3, 4, 5 will be output when one of the respective inputs receives a number. For example, inlet 4 in the picture above received a value of 10 from a number box attached to it. This causes the number 2 to be output from the object because the second input to the object was triggered. (inlet 4 = input 2).
Exercises
|