funbuff
Store pairs of numbers
Description
Stores, manages, and recalls pairs of numbers.
Arguments
filename[symbol]
optional
The argument specifies the name of a file to be read into funbuff when the patch is loaded. Changes to the contents of one funbuff will not affect the contents of another funbuff object with the same name.
A file for funbuff can also be created using a text editor window, beginning the text with the word , followed by a list of space-separated numbers which specify alternating x and y values. A funbuff that has been saved as a file can be viewed and edited as text by choosing Open as Text... from the File menu. Numbers in the form of text can be pasted in from other sources such as the editing window of a capture object, or even from another program such as a word processor.
Attributes
Common Box Attributes
annotation[symbol]
Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.
background[int]: 0
Adds or removes the object from the patcher's background layer.
adds the object to the background layer, removes it. Objects in the background layer are shown behind all objects in the default foreground layer.
color[4 floats]
Sets the color for the object box outline.
fontface[int]
Sets the type style used by the object. The options are:
plain
bold
italic
bold italic
Possible values:
0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'
fontname[symbol]
Sets the object's font.
fontsize[float]
Sets the object's font size (in points).
Possible values:
'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'
hint[symbol]
Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.
ignoreclick[int]: 0
Toggles whether an object ignores mouse clicks in a locked patcher.
jspainterfile[symbol]
You can override the default appearance of a user interface object by assigning a JavaScript file with code for painting the object. The file must be in the search path.
patching_rect[4 floats]: 0. 0. 100. 0.
Sets the position and size of the object in the patcher window.
position[2 floats]
write-only
Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.
presentation[int]: 0
Sets whether an object belongs to the patcher's presentation.
presentation_rect[4 floats]: 0. 0. 0. 0.
Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.
rect[4 floats]
write-only
Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).
size[2 floats]
write-only
Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.
textcolor[4 floats]
Sets the color for the object's text in RGBA format.
textjustification[int]
Sets the justification for the object's text.
Possible values:
0 = 'left'
1 = 'center'
2 = 'right'
varname[symbol]
Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.
Messages
bang
In left inlet: Prints information in the Max Console concerning the current status of the funbuff object's contents: how many elements it contains, the minimum and maximum x and y values it contains, and its domain and range (the maximum minus the minimum, for the x and y axes respectively).
int
In left inlet: The number is the x value of an x,y pair. If a y value has been received in the right inlet, the two numbers are stored together in funbuff. Otherwise, the x value causes the corresponding y value stored in funbuff to be sent out the left outlet.
If there is no stored x value which matches the number received, funbuff uses the closest x value which is less than the number received, and sends out the corresponding y value.
- x-value
[int]
(inlet1)
In right inlet: The number is a y value which will be paired with the next x value received in the left inlet, and stored in funbuff.
- y-value
[int]
float
In either inlet: Converted to
.- x or y value
[float]
clear
Erases the contents of funbuff.
copy
cut
delete
In left inlet: The word funbuff, and deletes it if it exists. If is followed by only one number, only the x value is sought, and deleted if it is present.
, followed by two numbers, looks for such an x,y pair in- x-value
[int]
- y-value
[int]
dump
In left inlet: Sends all the stored pairs out the middle and left outlets in immediate succession. The y values are sent out the middle outlet, and the x values are sent out the left outlet, in alternation. The pairs are sent out in ascending order based on the x value.
embed
find
The word
, followed by a number, will output (out the left outlet) all x values (indexes) whose y value is equal to the number indicated.- y-value
[int]
goto
The word
, followed by a number, sets a pointer to the x value (index) specified by the number. A subsequent message will return the y value at the specified x.- index
[int]
interp
In left inlet: The word funbuff, and then sends--out the left outlet--the y value that holds a corresponding position between the two neighboring y values. If the received number is already the x value in a stored x,y pair, the corresponding y value is sent out. If the received number exceeds the minimum or maximum x values stored in funbuff, the y value that's associated with the minimum or maximum x value is sent out. If the funbuff is empty, is sent out.
, followed by a number, uses that number as an x value, measures its position between its two neighboring x values in the- x-value
[int]
interptab
In left inlet: The word table object functions similarly to the message (mentioned above), except that it uses the data in the table as an interpolating function. This allows you to easily perform non-linear interpolation between consecutive values in a funbuff.
, followed by a number and the name of a named- value
[int]
- tablename
[symbol]
max
Sends the maximum y value currently stored in the funbuff out the left outlet.
min
Sends the minimum y value currently stored in the funbuff out the left outlet.
next
Finds the x value pointed to by the pointer (or, if the pointer points to a number not yet stored as an x value, to the next greater x value), and sends the corresponding y value out the left outlet. Also, funbuff calculates the difference between that x value and the value previously pointed to by the pointer, sends the difference out the middle outlet, and resets the pointer to the next greater x value.
paste
print
Prints diagnostic information regarding funbuff 's current state in the Max Console.
read
Calls up the Open Document dialog box so that a file of x,y values can be read into funbuff. If the word is followed by a symbol, Max looks for a file with that name (in the file search path) to load directly into the funbuff. The funbuff file format is described on the next page.
- filename
[symbol]
select
set
In left inlet: The word
, followed by one or more space-separated pairs of numbers, stores each pair as x,y pair.- value-pair
[list]
undo
The
message is used to undo the results of the previous or message.Output
bang
Out right outlet: When the pointer reaches the end of a funbuff, no numbers are sent out in response to a message, but a is sent out to notify that the end has been reached.
int
Out left outlet: When an x value is received in the left inlet, the corresponding y value is sent out. (Or, if there is no such x value yet stored in funbuff, the y value corresponding to the next lesser x value is sent out.) When the word is received in the left inlet, funbuff sends out the y value that corresponds to the x value pointed to by its pointer (or, if there is no such x value, the y value of the next greater x value).
Out middle outlet: When the word is received in its left inlet, funbuff sends out the difference between the x value pointed to by its pointer, and the x value previously pointed to, then resets the pointer to the next x value.
See Also
Name | Description |
---|---|
bline | Generate ramps using bang |
coll | Store and edit a collection of data |
funbuff | Store pairs of numbers |
itable | Data table editor |
line | Generate timed ramp |
table | Store and edit an array of numbers |