A previously studied data structure in Max and Pd included the table object. It can be used to store and retrieve integer values via integer indices. The funbuff object provides similar functionality, while the coll object serves more general storage purposes.
Max and Pd are written in the C programming language. Both provide an object allowing a C-like syntax to help reduce the number of objects necessary in a patch.
- The funbuff object can be used to store and retrieve x,y pairs of numbers.
- The coll object can store and retrieve lists of numbers or text, either using integer or symbolic indices.
- If using symbolic indices, the list must begin with the word store. In this case, the first item after store is used as the list address.
- When coll receives the address alone at its inlet, it sends the address out its right outlet (preceded by the word symbol if it is symbolic) and the list contents out the left outlet.
- One can view and edit the contents of a coll object by double-clicking on it and making changes in the text window that appears.
- The contents of a coll object can be stored to and loaded from a file using write and read messages.
- The coll object responds to a variety of other messages that allow one to read, edit, and access its elements.
- The menu object provides a pop-up menu in a Max patcher. It stores ascii names with integer indices (0 = first element).
- When an integer value is received at the menu inlet, the menu item text is displayed. When a menu item is selected using a mouse, the item index is sent out the outlet.
- The preset object can be used to store user interface settings in a patcher.
- If the preset object is not connected to any objects, it stores settings for all user interface objects in a patch (except tables).
- If the left outlet of a preset object is connected to inlets of user interface objects (including tables), it will store the settings for only those objects.
- If the right outlet of a preset object is connected to inlets of user interface objects (including tables), it will store the settings for all user interface objects (not including tables) in a patcher except those it is connected to.
- To store settings in a preset, either shift-click on a preset or send a store message followed by a preset number to the preset inlet.
- A preset can be retrieved by sending an integer value to the preset inlet.
- Presets can be cleared using a clear message followed by a preset number. All presets can be cleared using the clearall message.
- The expr object allows one to create C-like mathematical formulas that can include the use of C language math functions.
- Notice the use of the $f1 argument, which converts the input to a floating-point value. The output is converted to an int using the int() function.
- The if object allows one to perform calculations based on the if-then-else format.
- The then and else portions of the if statement contain messages similar to what would be typed into a message box.
- If the then or else statement begins with the out2 argument, the output is sent to the right outlet.
- If the then or else statement begins with a send argument, followed by the name of a receive object, values are sent to all receive objects with that name.
- The if object does not exist in Pd or Pd-extended.
| ©2003-2020 McGill University. All Rights Reserved. Maintained by Gary P. Scavone.
|