A newer version of Max is available. Click here to access the latest version of the Max documentation

funbuff Reference

Store pairs of numbers

funbuff

Description

Stores, manages, and recalls pairs of numbers.

Examples

Pairs or lists are stored as x, y pairs an x value alone, or next, sends out a y value... Interpolating between points stored in funbuff

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 funbuff, 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] (default: 0)

Adds or removes the object from the patcher's background layer. background 1 adds the object to the background layer, background 0 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'

hidden [int] (default: 0)

Toggles whether an object is hidden when the patcher is locked.

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] (default: 0)

Toggles whether an object ignores mouse clicks in a locked patcher.

jspainterfile [symbol]

JS Painter File

patching_rect [4 floats] (default: 0. 0. 100. 0.)

Sets the position and size of the object in the patcher window.

position [2 floats]

g/s(set)

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] (default: 0)

Sets whether an object belongs to the patcher's presentation.

presentation_rect [4 floats] (default: 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]

g/s(set)

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]

g/s(set)

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

Arguments

x-value [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.

  (inlet1)

Arguments

y-value [int]
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.

float

Arguments

x or y value [float]
In either inlet: Converted to int.

clear

Erases the contents of funbuff.

copy

Copies the current selection (made by using the select message) into the global funbuff clipboard. The data stored on this clipboard can then be pasted into another funbuff object using the paste message.

cut

Copies the current selection (made by using the select message) into the global funbuff clipboard and deletes it from the funbuff object. The data stored on this clipboard can then be pasted into another funbuff object using the paste message.

delete

Arguments

x-value [int]
y-value [int]
In left inlet: The word delete, followed by two numbers, looks for such an x,y pair in funbuff, and deletes it if it exists. If delete is followed by only one number, only the x value is sought, and deleted if it is present.

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

Arguments

flag [int]
The word embed, followed by a non-zero number, causes the funbuff data to be stored inside the patcher. The default setting is not to store the funbuff data inside the patcher.

find

Arguments

y-value [int]
The word find, followed by a number, will output (out the left outlet) all x values (indexes) whose y value is equal to the number indicated.

goto

Arguments

index [int]
The word goto, followed by a number, sets a pointer to the x value (index) specified by the number. A subsequent next message will return the y value at the specified x.

interp

Arguments

x-value [int]
In left inlet: The word interp, followed by a number, uses that number as an x value, measures its position between its two neighboring x values in the 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, 0 is sent out.

interptab

Arguments

value [int]
tablename [symbol]
In left inlet: The word interptab, followed by a number and the name of a named table object functions similarly to the interp 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.

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 goto pointer to the next greater x value.

paste

The word paste will copy the contents of the global funbuff clipboard into a funbuff object. The contents of the clipboard are set using the select, copy and cut messages. These messages provide a handy way of copying data between different funbuff objects in any open patchers.

print

Prints diagnostic information regarding funbuff 's current state in the Max Console.

read

Arguments

filename [symbol]
Calls up the Open Document dialog box so that a file of x,y values can be read into funbuff. If the word read 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.

select

Arguments

starting-index and range [list]
In left inlet: The word select, followed by an two integers representing a starting index and a range will select a region of the funbuff which can be edited using the cut, copy and paste messages. For example select 2 3 will select the part of a funbuff from index 2 through index 5.

set

Arguments

value-pair [list]
In left inlet: The word set, followed by one or more space-separated pairs of numbers, stores each pair as x,y pair.

undo

The undo message is used to undo the results of the previous cut or paste message.

write

Arguments

filename [symbol]
Calls up the standard Save As dialog box, so that the contents of funbuff can be saved as a separate file. If the word write is followed by a symbol, the contents of the funbuff are saved immediately in a file, using the symbol as the filename.

Output

bang

Out right outlet: When the pointer reaches the end of a funbuff, no numbers are sent out in response to a next message, but a bang 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 next 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 next 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